Serghey Rodin 13 лет назад
Родитель
Сommit
7bfebfff62

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

@@ -155,6 +155,113 @@ if ($_SESSION['user'] == 'admin') {
     include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_user.html');
     unset($_SESSION['error_msg']);
     unset($_SESSION['ok_msg']);
+} else {
+    // Check user argument?
+    if (empty($_GET['user'])) {
+        header("Location: /list/user/");
+        exit;
+    }
+
+    // Check user
+    $v_username = escapeshellarg($_GET['user']);
+    exec (VESTA_CMD."v_list_user ".$v_username." json", $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 {
+        $data = json_decode(implode('', $output), true);
+        unset($output);
+        $v_username = $_GET['user'];
+        $v_password = "••••••••";
+        $v_email = $data[$v_username]['CONTACT'];
+        $v_fname = $data[$v_username]['FNAME'];
+        $v_lname = $data[$v_username]['LNAME'];
+        $v_ns = $data[$v_username]['NS'];
+        $nameservers = explode(", ", $v_ns);
+        $v_ns1 = $nameservers[0];
+        $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'];
+
+    }
+
+    // Action
+    if (!empty($_POST['save'])) {
+        $v_username = escapeshellarg($_POST['v_username']);
+
+        // Change password
+        if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) {
+            $v_password = escapeshellarg($_POST['v_password']);
+            exec (VESTA_CMD."v_change_user_password ".$v_username." ".$v_password, $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;
+            }
+            $v_password = "••••••••";
+            unset($output);
+        }
+
+        // Change contact email
+        if (($v_email != $_POST['v_email']) && (empty($_SESSION['error_msg']))) {
+            $v_email = escapeshellarg($_POST['v_email']);
+            exec (VESTA_CMD."v_change_user_contact ".$v_username." ".$v_email, $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;
+            }
+            unset($output);
+        }
+
+        // Change Name
+        if (($v_fname != $_POST['v_fname']) || ($v_lname != $_POST['v_lname']) && (empty($_SESSION['error_msg']))) {
+            $v_fname = escapeshellarg($_POST['v_fname']);
+            $v_lname = escapeshellarg($_POST['v_lname']);
+            exec (VESTA_CMD."v_change_user_name ".$v_username." ".$v_fname." ".$v_lname, $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;
+            }
+            unset($output);
+        }
+
+        // Change NameServers
+        if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (empty($_SESSION['error_msg']))) {
+            $v_ns1 = escapeshellarg($_POST['v_ns1']);
+            $v_ns2 = escapeshellarg($_POST['v_ns2']);
+            $v_ns3 = escapeshellarg($_POST['v_ns3']);
+            $v_ns4 = escapeshellarg($_POST['v_ns4']);
+            $ns_cmd = VESTA_CMD."v_change_user_ns ".$v_username." ".$v_ns1." ".$v_ns2;
+            if (!empty($_POST['v_ns3'])) $ns_cmd = $ns_cmd." ".$v_ns3;
+            if (!empty($_POST['v_ns4'])) $ns_cmd = $ns_cmd." ".$v_ns4;
+            exec ($ns_cmd, $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;
+            }
+            unset($output);
+        }
+
+        if (empty($_SESSION['error_msg'])) {
+            $_SESSION['ok_msg'] = "OK: changes has been saved.";
+        }
+    }
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/user/menu_edit_user.html');
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_user.html');
+    unset($_SESSION['error_msg']);
+    unset($_SESSION['ok_msg']);
 }
 
 // Footer

+ 1 - 1
web/inc/main.php

@@ -39,7 +39,7 @@ function top_panel($user, $TAB) {
     if ( $user == 'admin' ) {
         include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/panel.html');
     } else {
-        include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/panel.html');
+        include($_SERVER['DOCUMENT_ROOT'].'/templates/user/panel.html');
     }
 }
 

+ 9 - 0
web/list/user/index.php

@@ -26,6 +26,15 @@ if ($_SESSION['user'] == 'admin') {
 
     include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_user.html');
     include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_user.html');
+} else {
+    exec (VESTA_CMD."v_list_user ".$user." json", $output, $return_var);
+    check_error($return_var);
+    $data = json_decode(implode('', $output), true);
+    $data = array_reverse($data);
+    unset($output);
+
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/user/menu_user.html');
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/user/list_user.html');
 }
 
 

+ 1 - 0
web/templates/admin/add_dns.html

@@ -60,3 +60,4 @@
     </td>
 </tr>
 </table>
+<table class="data-spacer" style="height:9px"><tr><td></td></tr></table>

+ 1 - 0
web/templates/admin/add_mail.html

@@ -27,3 +27,4 @@
     </td>
 </tr>
 </table>
+<table class="data-spacer" style="height:19px"><tr><td></td></tr></table>

+ 1 - 0
web/templates/admin/add_mail_acc.html

@@ -59,3 +59,4 @@
     </td>
 </tr>
 </table>
+<table class="data-spacer" style="height:5px"><tr><td></td></tr></table>

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

@@ -130,4 +130,6 @@ foreach ($data as $key => $value) {
 </tr>
 </table>
 </form>
-<?php if ($i < 2) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:153px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:17px\"><tr><td></td></tr></table>"; ?>

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

@@ -146,4 +146,6 @@ foreach ($data as $key => $value) {
 </tr>
 </table>
 </form>
-<?php if ($i < 2) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:172px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:55px\"><tr><td></td></tr></table>"; ?>

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

@@ -131,4 +131,6 @@ foreach ($data as $key => $value) {
 </tr>
 </table>
 </form>
-<?php if ($i < 2) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:166px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:43px\"><tr><td></td></tr></table>"; ?>

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

@@ -128,4 +128,6 @@ foreach ($data as $key => $value) {
 </tr>
 </table>
 </form>
-<?php if ($i < 2) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:157px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:25px\"><tr><td></td></tr></table>"; ?>

+ 4 - 1
web/templates/admin/list_dns_rec.html

@@ -111,4 +111,7 @@ foreach ($data as $key => $value) {
 </tr>
 </table>
 </form>
-<?php if ($i < 3) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:196px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:103px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 3) echo "<table class=\"data-spacer\" style=\"height:10px\"><tr><td></td></tr></table>"; ?>

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

@@ -94,4 +94,6 @@ foreach ($data as $key => $value) {
 </tr>
 </table>
 </form>
-<?php if ($i < 2) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:173px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:57px\"><tr><td></td></tr></table>"; ?>

+ 4 - 1
web/templates/admin/list_log.html

@@ -44,4 +44,7 @@ foreach ($data as $key => $value) {
     </td>
 </tr>
 </table>
-<?php if ($i < 2) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:216px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:125px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 3) echo "<table class=\"data-spacer\" style=\"height:34px\"><tr><td></td></tr></table>"; ?>

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

@@ -134,4 +134,6 @@ foreach ($data as $key => $value) {
 </tr>
 </table>
 </form>
-<?php if ($i < 2) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:166px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:43px\"><tr><td></td></tr></table>"; ?>

+ 4 - 1
web/templates/admin/list_mail_acc.html

@@ -124,5 +124,8 @@ foreach ($data as $key => $value) {
     ?>
     </td>
 </tr>
+</table>
 </form>
-<?php if ($i < 3) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:173px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 2) echo "<table class=\"data-spacer\" style=\"height:57px\"><tr><td></td></tr></table>"; ?>

+ 2 - 1
web/templates/admin/list_stats.html

@@ -91,4 +91,5 @@ foreach ($data as $key => $value) {
     listed</td>
 </tr>
 </table>
-<?php if ($i < 2) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:123px\"><tr><td></td></tr></table>"; ?>

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

@@ -191,4 +191,4 @@ foreach ($data as $key => $value) {
 </tr>
 </table>
 </form>
-<?php if ($i < 1) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:70px\"><tr><td></td></tr></table>"; ?>

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

@@ -155,4 +155,5 @@ foreach ($data as $key => $value) {
 </tr>
 </table>
 </form>
-<?php if ($i < 2) echo "<table class=\"data-spacer\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 0) echo "<table class=\"data-spacer\" style=\"height:279px\"><tr><td></td></tr></table>"; ?>
+<?php if ($i == 1) echo "<table class=\"data-spacer\" style=\"height:113px\"><tr><td></td></tr></table>"; ?>

+ 0 - 1
web/templates/header.html

@@ -261,7 +261,6 @@ if (!empty($_SESSION['look'])) {
     .data-spacer {
         margin: 0;
         width: 990px;
-        height: 230px;
     }
 
     .data-add {