Exemplo n.º 1
0
         if ($_SESSION["is_admin"] && ($ds = is_ds_valid($_POST["dataset"])) === false) {
             $xtpl->perex(_("Dataset contains forbidden characters"), '');
             export_add_form($export_add_target);
         } else {
             if ($ok && $m->exists) {
                 nas_export_add($_SESSION["is_admin"] ? $_POST["member"] : $_SESSION["member"]["m_id"], $_POST["root_id"], $_SESSION["is_admin"] ? $ds : NULL, $path, $_POST["quota_val"] * (2 << $NAS_UNITS_TR[$_POST["quota_unit"]]), $_SESSION["is_admin"] ? $_POST["user_editable"] : -1, $_SESSION["is_admin"] ? $_POST["type"] : "data");
                 notify_user(_("Export created"), _("Export was created."));
                 redirect('?page=nas');
             }
         }
     }
     break;
 case "export_edit":
     $e = nas_get_export_by_id($_GET["id"]);
     if (nas_can_user_manage_export($e)) {
         export_edit_form('?page=nas&action=export_edit_save', $e);
     }
     $xtpl->sbar_add(_("Back"), '?page=nas');
     break;
 case "export_edit_save":
     if ($_GET["id"] && $_POST["quota_val"] && $_POST["quota_unit"]) {
         $e = nas_get_export_by_id($_GET["id"]);
         // FIXME: control if quota is not less than used
         if (nas_can_user_manage_export($e)) {
             nas_export_update($_GET["id"], $_POST["quota_val"] * (2 << $NAS_UNITS_TR[$_POST["quota_unit"]]), $_SESSION["is_admin"] ? $_POST["user_editable"] : -1, $_SESSION["is_admin"] ? $_POST["type"] : NULL);
         }
         notify_user(_("Export Updated"), _("Export was successfully updated."));
     } else {
         notify_user(_("Export NOT updated"), _("Export was not updated."));
     }
     redirect('?page=nas');
Exemplo n.º 2
0
     $xtpl->sbar_add(_("Add default mount for VPS"), '?page=cluster&action=nas_def_mount_add');
     break;
 case "nas_settings_save":
     $cluster_cfg->set("nas_default_mount_options", $_POST["mount_options"]);
     $cluster_cfg->set("nas_default_umount_options", $_POST["umount_options"]);
     $xtpl->perex(_("NAS settings saved"), '');
     $list_nodes = true;
     break;
 case "nas_def_export_add":
     $xtpl->table_title(_("Add default export for new") . ' ' . ($_GET["for"] == "member" ? _("member") : _("VPS")));
     export_add_form($export_add_target, true);
     $xtpl->sbar_add(_("Back"), '?page=cluster&action=nas_settings');
     break;
 case "nas_def_export_edit":
     $e = nas_get_export_by_id($_GET["id"]);
     export_edit_form('?page=cluster&action=nas_def_export_save', $e);
     break;
 case "nas_def_export_save":
     if (isset($_POST["root_id"]) || isset($_POST["quota_val"])) {
         if ($_GET["id"]) {
             nas_export_update($_GET["id"], $_POST["quota_val"] * (2 << $NAS_UNITS_TR[$_POST["quota_unit"]]), $_POST["user_editable"], $_POST["type"]);
         } else {
             nas_export_add($_POST["member"], $_POST["root_id"], $_POST["dataset"], $_POST["path"], $_POST["quota_val"] * (2 << $NAS_UNITS_TR[$_POST["quota_unit"]]), $_POST["user_editable"], $_POST["type"], $_GET["for"]);
         }
         notify_user(_("Default export saved"), '');
         redirect('?page=cluster&action=nas_settings');
     }
     break;
 case "nas_def_export_del":
     if ($_GET["id"] && ($e = nas_get_export_by_id($_GET["id"]))) {
         $mounts = nas_get_mounts_for_export($_GET["id"]);