Esempio n. 1
0
     break;
 case "mount_edit":
     $m = nas_get_mount_by_id($_GET["id"]);
     $vps = new vps_load($m["vps_id"]);
     if (nas_can_user_manage_mount($m, $vps)) {
         mount_edit_form($mount_edit_target, $m);
     }
     $xtpl->sbar_add(_("Back"), '?page=nas');
     break;
 case "mount_edit_save":
     if ($_GET["id"] && ($_POST["export_id"] || $_POST["src"]) && $_POST["dst"]) {
         $m = nas_get_mount_by_id($_GET["id"]);
         $vps = new vps_load($_POST["vps_id"]);
         if (($dst = is_mount_dst_valid($_POST["dst"])) === false) {
             $xtpl->perex(_("Destination contains forbidden characters"), '');
             mount_edit_form($mount_edit_target, $m);
         } else {
             if (nas_can_user_manage_mount($m, $vps)) {
                 nas_mount_update($_GET["id"], $_POST["export_id"], $_POST["vps_id"], $_POST["access_mode"], $_SESSION["is_admin"] ? $_POST["source_node_id"] : NULL, $_SESSION["is_admin"] ? $_POST["src"] : NULL, $dst, $_SESSION["is_admin"] ? $_POST["m_opts"] : NULL, $_SESSION["is_admin"] ? $_POST["u_opts"] : NULL, $_SESSION["is_admin"] ? $_POST["type"] : NULL, $_POST["cmd_premount"], $_POST["cmd_postmount"], $_POST["cmd_preumount"], $_POST["cmd_postumount"], $_POST["remount_immediately"]);
             }
             notify_user(_("Mount updated."), '');
         }
     } else {
         notify_user(_("Mount NOT updated."), '');
     }
     redirect('?page=nas');
     break;
 case "mount_del":
     if ($_GET["id"] && ($m = nas_get_mount_by_id($_GET["id"]))) {
         $vps = new vps_load($m["vps_id"]);
         if (nas_can_user_manage_mount($m, $vps)) {
Esempio n. 2
0
     if ($_POST["export_id"] && $_POST["dst"] && isset($_POST["vps_id"])) {
         nas_mount_add($_POST["export_id"], $_POST["vps_id"], $_POST["access_mode"], 0, "", $_POST["dst"], $_SESSION["is_admin"] ? $_POST["m_opts"] : NULL, $_SESSION["is_admin"] ? $_POST["u_opts"] : NULL, "nfs", $_POST["cmd_premount"], $_POST["cmd_postmount"], $_POST["cmd_preumount"], $_POST["cmd_postumount"], false, true);
         notify_user(_("Default mount saved"), '');
         redirect('?page=cluster&action=nas_settings');
     }
     break;
 case "nas_def_custom_mount_save":
     if ($_POST["export_id"] && $_POST["dst"] && isset($_POST["vps_id"])) {
         nas_mount_add(0, $_POST["vps_id"], $_POST["access_mode"], $_POST["source_node_id"], $_POST["src"], $_POST["dst"], $_POST["m_opts"], $_POST["u_opts"], $_POST["type"], $_POST["cmd_premount"], $_POST["cmd_postmount"], $_POST["cmd_preumount"], $_POST["cmd_postumount"], false, true);
         notify_user(_("Default mount saved"), '');
         redirect('?page=cluster&action=nas_settings');
     }
     break;
 case "nas_def_mount_edit":
     $m = nas_get_mount_by_id($_GET["id"]);
     mount_edit_form('?page=cluster&action=nas_def_mount_edit_save', $m, true);
     $xtpl->sbar_add(_("Back"), '?page=cluster&action=nas_settings');
     break;
 case "nas_def_mount_edit_save":
     if ($_GET["id"] && ($_POST["export_id"] || $_POST["src"]) && $_POST["dst"]) {
         nas_mount_update($_GET["id"], $_POST["export_id"], $_POST["vps_id"], $_POST["access_mode"], $_POST["source_node_id"], $_POST["src"], $_POST["dst"], $_POST["m_opts"], $_POST["u_opts"], $_POST["type"], $_POST["cmd_premount"], $_POST["cmd_postmount"], $_POST["cmd_preumount"], $_POST["cmd_postumount"], false, true);
         notify_user(_("Default mount saved"), '');
         redirect('?page=cluster&action=nas_settings');
     }
     break;
 case "nas_def_mount_del":
     if ($_GET["id"] && ($m = nas_get_mount_by_id($_GET["id"]))) {
         $xtpl->perex(_("Do you really want to delete default mount") . ' ' . $m["dst"] . ' ' . _("at") . ' #' . $m["vps_id"] . '?', '<a href="?page=cluster&action=nas_settings">' . strtoupper(_("No")) . '</a> | <a href="?page=cluster&action=nas_def_mount_del2&id=' . $_GET["id"] . '">' . strtoupper(_("Yes")) . '</a>');
     }
     break;
 case "nas_def_mount_del2":