1) { if (!is_dir($path)) { // check if directory exists $input_errors[] = sprintf(gettext("Directory %s doesn't exist!"), $path); } else { $path_check = explode("/", $path); // split path to get directory names $path_elements = count($path_check); // get path depth $fp = substr(sprintf('%o', fileperms("/$path_check[1]/$path_check[2]")), -1); // get mountpoint permissions for others if ($fp >= 5) { // transmission needs at least read & search permission at the mountpoint $directory = "/$path_check[1]/$path_check[2]"; // set to the mountpoint for ($i = 3; $i < $path_elements - 1; $i++) { // traverse the path and set permissions to rx $directory = $directory."/$path_check[$i]"; // add next level exec("chmod o=+r+x \"$directory\""); // set permissions to o=+r+x } $path_elements = $path_elements - 1; $directory = $directory."/$path_check[$path_elements]"; // add last level exec("chmod 775 {$directory}"); // set permissions to 775 exec("chown {$_POST['who']} {$directory}*"); } else { $input_errors[] = sprintf(gettext("%s needs at least read & execute permissions at the mount point for directory %s! Set the Read and Execute bits for Others (Access Restrictions | Mode) for the mount point %s (in Disks | Mount Point | Management or Disks | ZFS | Datasets) and hit Save in order to take them effect."), $application, $path, "/{$path_check[1]}/{$path_check[2]}"); } } } } if (isset($_POST['save']) && $_POST['save']) { unset($input_errors); if (empty($input_errors)) { $config['onebuttoninstaller']['storage_path'] = !empty($_POST['storage_path']) ? $_POST['storage_path'] : $g['media_path']; $config['onebuttoninstaller']['storage_path'] = rtrim($config['onebuttoninstaller']['storage_path'],'/'); // ensure to have NO trailing slash if (!isset($_POST['path_check']) && (strpos($config['onebuttoninstaller']['storage_path'], "/mnt/") === false)) { $input_errors[] = gettext("The common directory for all extensions MUST be set to a directory below '/mnt/' to prevent to loose the extensions after a reboot on embedded systems!"); } else { if (!is_dir($config['onebuttoninstaller']['storage_path'])) mkdir($config['onebuttoninstaller']['storage_path'], 0775, true); change_perms($config['onebuttoninstaller']['storage_path']); $config['onebuttoninstaller']['path_check'] = isset($_POST['path_check']) ? true : false; $install_dir = $config['onebuttoninstaller']['storage_path']."/"; // get directory where the installer script resides if (!is_dir("{$install_dir}onebuttoninstaller/log")) { mkdir("{$install_dir}onebuttoninstaller/log", 0775, true); } $return_val = mwexec("fetch {$verify_hostname} -vo {$install_dir}onebuttoninstaller/onebuttoninstaller-install.php 'https://raw.github.com/crestAT/nas4free-onebuttoninstaller/master/onebuttoninstaller/onebuttoninstaller-install.php'", false); if ($return_val == 0) { chmod("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php", 0775); require_once("{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); } else { $input_errors[] = sprintf(gettext("Installation file %s not found, installation aborted!"), "{$install_dir}onebuttoninstaller/onebuttoninstaller-install.php"); return; } mwexec("rm -Rf ext/OBI; rm -f OBI.php", true); header("Location:onebuttoninstaller-config.php"); } } } if (isset($_POST['cancel']) && $_POST['cancel']) { $return_val = mwexec("rm -Rf ext/OBI; rm -f OBI.php", true); if ($return_val == 0) { $savemsg .= $application." ".gettext("not installed"); } else { $input_errors[] = $application." removal failed"; } header("Location:index.php"); } $pconfig['storage_path'] = !empty($config['onebuttoninstaller']['storage_path']) ? $config['onebuttoninstaller']['storage_path'] : $g['media_path']; $pconfig['path_check'] = isset($config['onebuttoninstaller']['path_check']) ? true : false; include("fbegin.inc"); ?>
/mnt/)."), $pconfig['storage_path'], true, 60);?> ".gettext("Please use this option only if you know what you are doing!")."", false);?>
"/> "/>