Browse Source

unsuspend + delete user

Serghey Rodin 14 years ago
parent
commit
e7128b4a9f

+ 5 - 7
web/css/jquery-custom-dialogs.css

@@ -35,7 +35,7 @@
 ----------------------------------*/
 
 /* Overlays */
-.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #e6e6e6;}
 
 
 /*!
@@ -56,7 +56,7 @@
 .ui-widget { font-family: Arial, Helvetica, sans-serif; font-size: 12pt; }
 .ui-widget .ui-widget { font-size: 10pt; }
 .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; }
-.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
+.ui-widget-content { border: 1px solid #aaaaaa; color: #222222; }
 .ui-widget-content a { color: #222222; }
 .ui-widget-header { border: 1px solid #d6d4c9; background: #ebe9dc; color: #777777; font-size: 10pt; font-weight: bold;}
 .ui-widget-header a { color: #222222; }
@@ -76,9 +76,7 @@
 ----------------------------------*/
 
 /* states and images */
-.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
-.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
-.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-icon { width: 16px; height: 16px; }
 .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
 .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
 .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
@@ -266,7 +264,7 @@
 ----------------------------------*/
 
 /* Overlays */
-.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-overlay { opacity: .30;filter:Alpha(Opacity=30); }
 .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*!
  * jQuery UI Resizable 1.8.20
  *
@@ -415,7 +413,7 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
  *
  * http://docs.jquery.com/UI/Dialog#theming
  */
-.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
+.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; background: #fff; }
 .ui-dialog .ui-dialog-titlebar { padding: .4em 10pt; position: relative;  }
 .ui-dialog .ui-dialog-title { float: left; margin: .10pt 16px .10pt 0;  font-family: Georgia; font-style: italic; color: #c69c6d;} 
 .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }

+ 48 - 0
web/delete/user/index.php

@@ -0,0 +1,48 @@
+<?php
+// Init
+//error_reporting(NULL);
+ob_start();
+session_start();
+$TAB = 'USER';
+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/user/");
+    }
+
+    // Ok
+    if (!empty($_GET['user'])) {
+        $v_username = escapeshellarg($_GET['user']);
+        exec (VESTA_CMD."v_delete_user ".$v_username, $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 deleted.";
+                unset($v_lname);
+        }
+        unset($output);
+
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_delete_user.html');
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/delete_user.html');
+    unset($_SESSION['error_msg']);
+    unset($_SESSION['ok_msg']);
+
+    } else {
+        header("Location: /list/user/");
+    }
+}
+
+// Footer
+include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html');

+ 8 - 0
web/edit/user/index.php

@@ -46,6 +46,14 @@ if ($_SESSION['user'] == 'admin') {
         $v_ns2 = $nameservers[1];
         $v_ns3 = $nameservers[2];
         $v_ns4 = $nameservers[3];
+        $v_suspended = $data[$v_username]['SUSPENDED'];
+        if ( $v_suspended == 'yes' ) {
+            $v_status =  'suspended';
+        } else {
+            $v_status =  'active';
+        }
+        $v_time = $data[$v_username]['TIME'];
+        $v_date = $data[$v_username]['DATE'];
 
         unset($output);
 

+ 24 - 0
web/templates/admin/delete_user.html

@@ -0,0 +1,24 @@
+<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;">
+                    <form method="post">
+                        <input type="submit" class="add-button" name="back" value="Back to users">
+                    </form>
+                </td>
+            </tr>
+        </table>
+    </td>
+</tr>
+</table>

+ 3 - 1
web/templates/admin/edit_user.html

@@ -14,7 +14,9 @@ document.v_edit_user.v_password.value = randomstring;
 <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>
+            <tr><td style="padding: 20px 0 4px 4px;"><a class="data-date" ?><?php echo date("d M Y", strtotime($v_date))?></a></td></tr>
+            <tr><td style="padding: 0 0 6px 4px;"><a class="data-date" ?><?php echo $v_time?></a></td></tr>
+            <tr><td style="padding: 0 0 0 24px;" class="data-<?php echo $v_status ?>"><i><b><?php echo $v_status ?></b></i></td></tr>
         </table>
     </td>
     <td class="data-dotted" width="830px" style="vertical-align:top;">

+ 15 - 0
web/templates/admin/menu_delete_user.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\"><i>".$_SESSION['error_msg']."</i></a>";
+        } else {
+            if (!empty($_SESSION['ok_msg'])) {
+                echo "<a class=\"add-ok\"><i> ".$_SESSION['ok_msg']."</i></a>";
+            }
+        }
+    ?>
+    </td>
+</tr>
+</table>

+ 3 - 3
web/templates/admin/menu_suspend_user.html

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

+ 3 - 3
web/templates/admin/menu_unsuspend_user.html

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

+ 14 - 5
web/templates/admin/suspend_user.html

@@ -9,12 +9,21 @@
         <table width="830px"><tr>
             <td></td>
         </tr></table>
-        <form method="post" name="v_suspend_user">
+
         <table class="data-col2" width="830px">
-            <tr><td style="padding: 24px 0 0 0;">
-                <input type="submit" class="add-button" name="back" value="Back to users">
-            </td></tr>
-            </form>
+            <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>
+                </td>
+                <td style="padding: 24px 0 0 0;">
+                    <form action="/unsuspend/user/" method="get">
+                        <input type="hidden" name="user" value="<?php echo $_GET['user']?>">
+                        <input type="submit" class="add-button" name="unsuspend" value="Unsuspend <?php echo $_GET['user']?>">
+                    </form>
+                </td>
+            </tr>
         </table>
     </td>
 </tr>

+ 14 - 5
web/templates/admin/unsuspend_user.html

@@ -9,12 +9,21 @@
         <table width="830px"><tr>
             <td></td>
         </tr></table>
-        <form method="post" name="v_suspend_user">
+
         <table class="data-col2" width="830px">
-            <tr><td style="padding: 24px 0 0 0;">
-                <input type="submit" class="add-button" name="back" value="Back to users">
-            </td></tr>
-            </form>
+            <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>
+                </td>
+                <td style="padding: 24px 0 0 0;">
+                    <form action="/suspend/user/" method="get">
+                        <input type="hidden" name="user" value="<?php echo $_GET['user']?>">
+                        <input type="submit" class="add-button" name="suspend" value="Suspend <?php echo $_GET['user']?>">
+                    </form>
+                </td>
+            </tr>
         </table>
     </td>
 </tr>

+ 2 - 2
web/unsuspend/user/index.php

@@ -34,8 +34,8 @@ if ($_SESSION['user'] == 'admin') {
         }
         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_unsuspend_user.html');
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/unsuspend_user.html');
     unset($_SESSION['error_msg']);
     unset($_SESSION['ok_msg']);