ソースを参照

web suspend/unsuspend

Serghey Rodin 13 年 前
コミット
320e50fb7b

+ 9 - 8
web/suspend/web/index.php

@@ -3,7 +3,7 @@
 //error_reporting(NULL);
 ob_start();
 session_start();
-$TAB = 'USER';
+$TAB = 'WEB';
 include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
 
 // Header
@@ -21,26 +21,27 @@ if ($_SESSION['user'] == 'admin') {
     }
 
     // Ok
-    if (!empty($_GET['user'])) {
-        $v_username = escapeshellarg($_GET['user']);
-        exec (VESTA_CMD."v_suspend_web_domain ".$v_username, $output, $return_var);
+    if (!empty($_GET['domain'])) {
+        $v_username = escapeshellarg($user);
+        $v_domain = escapeshellarg($_GET['domain']);
+        exec (VESTA_CMD."v_suspend_web_domain ".$v_username." ".$v_domain, $output, $return_var);
         if ($return_var != 0) {
             $error = implode('<br>', $output);
             if (empty($error)) $error = 'Error: vesta did not return any output.';
             $_SESSION['error_msg'] = $error;
         } else {
-            $_SESSION['ok_msg'] = "OK: user <b>".$_GET[user]."</b> has been suspended.";
+            $_SESSION['ok_msg'] = "OK: web domain <b>".$_GET['domain']."</b> has been suspended.";
                 unset($v_lname);
         }
         unset($output);
 
-    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_user.html');
-    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_user.html');
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_suspend_web.html');
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/suspend_web.html');
     unset($_SESSION['error_msg']);
     unset($_SESSION['ok_msg']);
 
     } else {
-        header("Location: /list/user/");
+        header("Location: /list/web/");
     }
 
 }

+ 1 - 1
web/templates/admin/delete_user.html

@@ -14,7 +14,7 @@
             <tr>
                 <td style="padding: 24px 0 0 0;">
                     <form method="post">
-                        <input type="submit" class="add-button" name="back" value="Back to users">
+                        <input type="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
                     </form>
                 </td>
             </tr>

+ 1 - 1
web/templates/admin/list_web.html

@@ -5,7 +5,7 @@ foreach ($data as $key => $value) {
     ++$i;
     if ($data[$key]['SUSPENDED'] == 'yes') {
         $status = 'suspended';
-        $spnd_action = 'ususpend' ;
+        $spnd_action = 'unsuspend' ;
     } else {
         $status = 'active';
         $spnd_action = 'suspend' ;

+ 15 - 0
web/templates/admin/menu_suspend_web.html

@@ -0,0 +1,15 @@
+<table class="sub-menu">
+<tr>
+    <td style="padding: 50px 2px 38px 153px;" >
+    <?php 
+        if (!empty($_SESSION['error_msg'])) {
+            echo "<a class=\"add-error\">".$_SESSION['error_msg']."</a>";
+        } else {
+            if (!empty($_SESSION['ok_msg'])) {
+                echo "<a class=\"add-ok\"> ".$_SESSION['ok_msg']."</a>";
+            }
+        }
+    ?>
+    </td>
+</tr>
+</table>

+ 15 - 0
web/templates/admin/menu_unsuspend_web.html

@@ -0,0 +1,15 @@
+<table class="sub-menu">
+<tr>
+    <td style="padding: 50px 2px 38px 153px;" >
+    <?php 
+        if (!empty($_SESSION['error_msg'])) {
+            echo "<a class=\"add-error\">".$_SESSION['error_msg']."</a>";
+        } else {
+            if (!empty($_SESSION['ok_msg'])) {
+                echo "<a class=\"add-ok\"> ".$_SESSION['ok_msg']."</a>";
+            }
+        }
+    ?>
+    </td>
+</tr>
+</table>

+ 2 - 2
web/templates/admin/suspend_user.html

@@ -13,8 +13,8 @@
         <table class="data-col2" width="830px">
             <tr>
                 <td style="padding: 24px 0 0 0;" width="100px">
-                    <form method="post">
-                        <input type="submit" class="add-button" name="back" value="Back to users">
+                    <form method="get">
+                        <input type="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
                     </form>
                 </td>
                 <td style="padding: 24px 0 0 0;">

+ 30 - 0
web/templates/admin/suspend_web.html

@@ -0,0 +1,30 @@
+<table class='data'>
+<tr class="data-add">
+    <td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
+        <table class="data-col1">
+            <tr><td style="padding: 18 0 4 18;"></td></tr>
+        </table>
+    </td>
+    <td class="data-dotted" width="830px" style="vertical-align:top;">
+        <table width="830px"><tr>
+            <td></td>
+        </tr></table>
+
+        <table class="data-col2" width="830px">
+            <tr>
+                <td style="padding: 24px 0 0 0;" width="100px">
+                    <form method="get">
+                        <input type="button" class="add-button" value="Back to domains" onClick="location.href='/list/web/'">
+                    </form>
+                </td>
+                <td style="padding: 24px 0 0 0;">
+                    <form action="/unsuspend/web/" method="get">
+                        <input type="hidden" name="domain" value="<?php echo $_GET['domain']?>">
+                        <input type="submit" class="add-button" name="unsuspend" value="Unsuspend <?php echo $_GET['domain']?>">
+                    </form>
+                </td>
+            </tr>
+        </table>
+    </td>
+</tr>
+</table>

+ 1 - 1
web/templates/admin/unsuspend_user.html

@@ -14,7 +14,7 @@
             <tr>
                 <td style="padding: 24px 0 0 0;" width="100px">
                     <form method="post">
-                        <input type="submit" class="add-button" name="back" value="Back to users">
+                        <input type="button" class="add-button" value="Back to users" onClick="location.href='/list/user/'">
                     </form>
                 </td>
                 <td style="padding: 24px 0 0 0;">

+ 30 - 0
web/templates/admin/unsuspend_web.html

@@ -0,0 +1,30 @@
+<table class='data'>
+<tr class="data-add">
+    <td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
+        <table class="data-col1">
+            <tr><td style="padding: 18 0 4 18;"></td></tr>
+        </table>
+    </td>
+    <td class="data-dotted" width="830px" style="vertical-align:top;">
+        <table width="830px"><tr>
+            <td></td>
+        </tr></table>
+
+        <table class="data-col2" width="830px">
+            <tr>
+                <td style="padding: 24px 0 0 0;" width="100px">
+                    <form method="get">
+                        <input type="button" class="add-button" value="Back to domains" onClick="location.href='/list/web/'">
+                    </form>
+                </td>
+                <td style="padding: 24px 0 0 0;">
+                    <form action="/suspend/web/" method="get">
+                        <input type="hidden" name="domain" value="<?php echo $_GET['domain']?>">
+                        <input type="submit" class="add-button" name="unsuspend" value="Suspend <?php echo $_GET['domain']?>">
+                    </form>
+                </td>
+            </tr>
+        </table>
+    </td>
+</tr>
+</table>

+ 50 - 0
web/unsuspend/web/index.php

@@ -0,0 +1,50 @@
+<?php
+// Init
+//error_reporting(NULL);
+ob_start();
+session_start();
+$TAB = 'WEB';
+include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
+
+// Header
+include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
+
+// Panel
+top_panel($user,$TAB);
+
+// Are you admin?
+if ($_SESSION['user'] == 'admin') {
+
+    // Cancel
+    if (!empty($_POST['back'])) {
+        header("Location: /list/web/");
+    }
+
+    // Ok
+    if (!empty($_GET['domain'])) {
+        $v_username = escapeshellarg($user);
+        $v_domain = escapeshellarg($_GET['domain']);
+        exec (VESTA_CMD."v_unsuspend_web_domain ".$v_username." ".$v_domain, $output, $return_var);
+        if ($return_var != 0) {
+            $error = implode('<br>', $output);
+            if (empty($error)) $error = 'Error: vesta did not return any output.';
+            $_SESSION['error_msg'] = $error;
+        } else {
+            $_SESSION['ok_msg'] = "OK: web domain <b>".$_GET['domain']."</b> has been unsuspended.";
+                unset($v_lname);
+        }
+        unset($output);
+
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_unsuspend_web.html');
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/unsuspend_web.html');
+    unset($_SESSION['error_msg']);
+    unset($_SESSION['ok_msg']);
+
+    } else {
+        header("Location: /list/web/");
+    }
+
+}
+
+// Footer
+include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');