示例#1
0
     }
     break;
 case "export_del2":
     if (isset($_GET["id"])) {
         $e = nas_get_export_by_id($_GET["id"]);
         $msg = _("This is your last chance, all data from this export, including all its subdirectories and mounts, will be deleted and cannot be restored.");
         $msg .= "<br><br><strong>" . _("This action is irreversible.") . "</strong><br><br>";
         $msg .= '<a href="?page=nas">' . _("Cancel deletion") . '</a> | <a href="?page=nas&action=export_del3&id=' . $_GET["id"] . '">' . strtoupper(_("DELETE")) . '</a>';
         $xtpl->perex(_("Please confirm deletion of export ") . $e["path"] . _(" and all its subdirectories and mounts"), $msg);
     }
     break;
 case "export_del3":
     if (isset($_GET["id"])) {
         $e = nas_get_export_by_id($_GET["id"]);
         if (nas_can_user_manage_export($e)) {
             nas_export_delete($e["export_id"]);
             notify_user(_("Export deleted"), _("Export was successfully deleted."));
             redirect('?page=nas');
         }
     }
     break;
 case "mount_add":
     mount_add_form($mount_export_add_target, $mount_custom_add_target);
     $xtpl->sbar_add(_("Back"), '?page=nas');
     break;
 case "mount_export_add_save":
     if ($_POST["export_id"] && $_POST["dst"] && $_POST["vps_id"]) {
         $e = nas_get_export_by_id($_POST["export_id"]);
         $vps = new vps_load($_POST["vps_id"]);
         if (is_mount_dst_valid($_POST["dst"]) === false) {
             $xtpl->perex(_("Destination contains forbidden characters"), '');
示例#2
0
         $vps = vps_load($_REQUEST["veid"]);
     }
     $lazy = $_POST["lazy_delete"] ? true : false;
     $can_delete = false;
     if ($playground_enabled && $_SESSION["member"]["m_id"] == $vps->ve["m_id"]) {
         foreach ($playground_servers as $pg) {
             if ($pg["server_id"] == $vps->ve["server_id"]) {
                 $can_delete = true;
                 $lazy = true;
                 break;
             }
         }
     }
     if ($_SESSION["is_admin"] || $can_delete) {
         if (!$lazy && $vps->ve["vps_backup_export"]) {
             nas_export_delete($vps->ve["vps_backup_export"]);
             $vps->delete_all_backups();
         }
         $vps->destroy($lazy, $can_delete);
         notify_user(_("Delete VPS") . ' #' . $vps->veid, _("Deletion of VPS") . " {$_GET["veid"]} " . strtolower(_("planned")));
         redirect('?page=adminvps');
     }
     break;
 case 'revive':
     if (!$vps->exists) {
         $vps = vps_load($_REQUEST["veid"]);
     }
     if ($_SESSION["is_admin"]) {
         $vps->revive();
         notify_user(_("Revival"), _("VPS was revived."));
         redirect('?page=adminvps&action=info&veid=' . $vps->veid);
示例#3
0
function nas_delete_members_exports($m_id)
{
    global $db;
    $sql = "SELECT *, e.id AS export_id, e.quota AS export_quota, e.used AS export_used, e.avail AS export_avail\n\t\t\tFROM storage_export e\n\t\t\tINNER JOIN storage_root r ON r.id = e.root_id\n\t\t\tINNER JOIN servers s ON r.node_id = s.server_id\n\t\t\tLEFT JOIN members m ON m.m_id = e.member_id\n\t\t\tWHERE e.`default` = 'no' AND e.member_id = " . $db->check($m_id) . "\n\t\t\tORDER BY s.server_id ASC, path ASC";
    $rs = $db->query($sql);
    while ($row = $db->fetch_array($rs)) {
        nas_export_delete($row["export_id"]);
    }
}
示例#4
0
             $msg .= "</ul>";
         }
         if (count($mounts) > 0) {
             $msg .= _("Following mounts of these exports will be deleted too:") . "<ul>";
             foreach ($mounts as $m) {
                 $msg .= "<li> VPS #" . $m["vps_id"] . "; " . _("path") . " " . $m["dst"] . "</li>";
             }
             $msg .= "</ul>";
         }
         $msg .= '<br><br><a href="?page=cluster&action=nas_settings">' . strtoupper(_("No")) . '</a> | <a href="?page=cluster&action=nas_def_export_del2&id=' . $_GET["id"] . '">' . strtoupper(_("Yes")) . '</a>';
         $xtpl->perex(_("Do you really want to delete export") . ' ' . $e["path"] . '?', $msg);
     }
     break;
 case "nas_def_export_del2":
     if ($_GET["id"] && ($e = nas_get_export_by_id($_GET["id"]))) {
         nas_export_delete($_GET["id"]);
         notify_user(_("Default export deleted"), _("Default export successfully deleted."));
         redirect('?page=cluster&action=nas_settings');
     }
     break;
 case "nas_def_mount_add":
     $xtpl->table_title(_("Add default mount for new VPS"));
     mount_add_form('?page=cluster&action=nas_def_export_mount_save', '?page=cluster&action=nas_def_custom_mount_save', true);
     $xtpl->sbar_add(_("Back"), '?page=cluster&action=nas_settings');
     break;
 case "nas_def_export_mount_save":
     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');
     }