You must apply the changes in order for them to take effect."); $dummy = gettext("The following input errors were detected"); if (($configuration = ext_load_config($configFile)) === false) $input_errors[] = sprintf(gettext("Configuration file %s not found!"), "{$configName}.conf"); if (!isset($configuration['rootfolder']) && !is_dir($configuration['rootfolder'] )) $input_errors[] = gettext("Extension installed with fault"); $platform = $g['platform']; if ($platform == "livecd" || $platform == "liveusb") $input_errors[] = sprintf(gettext("Attention: the used XigmaNAS platform '%s' is not recommended for extensions! After a reboot all extensions will no longer be available, use XigmaNAS embedded or full platform instead!"), $platform); $pgtitle = array(gettext("Extensions"), $configuration['appname']." ".$configuration['version'], gettext("Configuration")); if (!isset($configuration) || !is_array($configuration)) $configuration = array(); /* Check if the directory exists, the mountpoint has at least o=rx permissions and * set the permission to 775 for the last directory in the path */ function change_perms($dir) { global $input_errors; $path = rtrim($dir,'/'); // remove trailing slash if (strlen($path) > 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("{$configName} 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."), $path, "/{$path_check[1]}/{$path_check[2]}"); } } } } if (isset($_POST['save']) && $_POST['save']) { unset($input_errors); if (empty($input_errors)) { $configuration['enable'] = isset($_POST['enable']) ? true : false; if (isset($_POST['enable'])) { $configuration['storage_path'] = !empty($_POST['storage_path']) ? $_POST['storage_path'] : $g['media_path']; $configuration['storage_path'] = rtrim($configuration['storage_path'],'/'); // ensure to have NO trailing slash if (!isset($_POST['path_check']) && (strpos($configuration['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($configuration['storage_path'])) mkdir($configuration['storage_path'], 0775, true); change_perms($_POST['storage_path']); $configuration['path_check'] = isset($_POST['path_check']) ? true : false; $configuration['re_install'] = isset($_POST['re_install']) ? true : false; $configuration['auto_update'] = isset($_POST['auto_update']) ? true : false; $configuration['show_beta'] = isset($_POST['show_beta']) ? true : false; $savemsg .= get_std_save_message(ext_save_config($configFile, $configuration))." "; require_once("{$configuration['rootfolder']}/{$configName}-start.php"); } } else $savemsg .= get_std_save_message(ext_save_config($configFile, $configuration))." "; } // end of empty input_errors } $pconfig['enable'] = $configuration['enable']; $pconfig['storage_path'] = !empty($configuration['storage_path']) ? $configuration['storage_path'] : $g['media_path']; $pconfig['path_check'] = $configuration['path_check']; $pconfig['re_install'] = $configuration['re_install']; $pconfig['auto_update'] = $configuration['auto_update']; $pconfig['show_beta'] = $configuration['show_beta']; if (($message = ext_check_version("{$configuration['rootfolder']}/version_server.txt", "{$configName}", $configuration['version'], gettext("Maintenance"))) !== false) $savemsg .= $message; bindtextdomain($domain, $localeOSDirectory); include("fbegin.inc"); bindtextdomain($domain, $localeExtDirectory); ?>