From 60f9f276b82d5f4af2d1f528e3bd94b9afb400c0 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Fri, 29 May 2015 19:51:24 +0300 Subject: [PATCH] UI improvements --- web/css/styles.min.css | 14 +++++++- web/edit/db/index.php | 6 ++-- web/edit/mail/index.php | 6 ++-- web/edit/user/index.php | 6 ++-- web/edit/web/index.php | 46 +++++++++++++------------- web/inc/main.php | 41 +++++++++++++++++++++++ web/list/updates/index.php | 2 +- web/templates/admin/add_package.html | 33 ++++++++++++++++-- web/templates/admin/add_web.html | 2 +- web/templates/admin/edit_cron.html | 4 +-- web/templates/admin/edit_db.html | 2 +- web/templates/admin/edit_dns.html | 4 +-- web/templates/admin/edit_dns_rec.html | 2 +- web/templates/admin/edit_firewall.html | 2 +- web/templates/admin/edit_ip.html | 2 +- web/templates/admin/edit_mail.html | 2 +- web/templates/admin/edit_mail_acc.html | 2 +- web/templates/admin/edit_package.html | 33 +++++++++++++++--- web/templates/admin/edit_user.html | 2 +- web/templates/admin/edit_web.html | 36 +++++++++++++++++--- web/templates/admin/list_backup.html | 2 +- web/templates/admin/list_cron.html | 2 +- web/templates/admin/list_db.html | 4 +-- web/templates/admin/list_dns.html | 2 +- web/templates/admin/list_dns_rec.html | 2 +- web/templates/admin/list_firewall.html | 2 +- web/templates/admin/list_ip.html | 2 +- web/templates/admin/list_mail.html | 4 +-- web/templates/admin/list_mail_acc.html | 4 +-- web/templates/admin/list_packages.html | 6 ++-- web/templates/admin/list_search.html | 2 +- web/templates/admin/list_services.html | 2 +- web/templates/admin/list_stats.html | 12 +++---- web/templates/admin/list_user.html | 16 ++++----- web/templates/admin/list_web.html | 6 ++-- web/templates/user/edit_dns.html | 2 +- web/templates/user/edit_user.html | 2 +- web/templates/user/edit_web.html | 6 ++-- web/templates/user/list_cron.html | 2 +- web/templates/user/list_db.html | 4 +-- web/templates/user/list_dns.html | 2 +- web/templates/user/list_dns_rec.html | 2 +- web/templates/user/list_mail.html | 4 +-- web/templates/user/list_mail_acc.html | 4 +-- web/templates/user/list_search.html | 2 +- web/templates/user/list_stats.html | 12 +++---- web/templates/user/list_user.html | 14 ++++---- web/templates/user/list_web.html | 6 ++-- web/templates/user/panel.html | 4 +-- 49 files changed, 256 insertions(+), 125 deletions(-) diff --git a/web/css/styles.min.css b/web/css/styles.min.css index d8be836c..99787b3b 100644 --- a/web/css/styles.min.css +++ b/web/css/styles.min.css @@ -1080,6 +1080,10 @@ div.l-content > div.l-separator:nth-of-type(4) { display: inline-block; border-style: solid none solid solid; } +.lang-ru .l-select { + width: 199px; +} + .l-select:after { pointer-events: none; background-image: url("/images/sprite.png"); @@ -1104,6 +1108,9 @@ div.l-content > div.l-separator:nth-of-type(4) { border: 0; outline: 0; } +.lang-ru .l-select select { + min-width: 215px; +} .l-select select option { padding: 7px; } @@ -1342,6 +1349,7 @@ div.l-content > div.l-separator:nth-of-type(4) { .l-unit__stat-col--right { float: left; + max-width: 152px; } .l-unit-toolbar__col--left { @@ -1988,7 +1996,7 @@ div.l-content > div.l-separator:nth-of-type(4) { height: 16px; overflow: hidden; padding-top: 6px; - width: 600px; + max-width: 600px; } .vst-ok a { @@ -2362,6 +2370,10 @@ td.hint { vertical-align: top; width: 500px; } + +.login a.error { + color: #BE5ABF; +} .vestacp { color: #505050; font-size: 10px; diff --git a/web/edit/db/index.php b/web/edit/db/index.php index f5f0e536..59fb84f8 100644 --- a/web/edit/db/index.php +++ b/web/edit/db/index.php @@ -35,7 +35,7 @@ unset($output); $v_username = $user; $v_database = $_GET['database']; $v_dbuser = $data[$v_database]['DBUSER']; -$v_password = "••••••••"; +$v_password = ""; $v_host = $data[$v_database]['HOST']; $v_type = $data[$v_database]['TYPE']; $v_charset = $data[$v_database]['CHARSET']; @@ -63,7 +63,7 @@ if (!empty($_POST['save'])) { } // Change database password - if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { + if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) { $v_password = tempnam("/tmp","vst"); $fp = fopen($v_password, "w"); fwrite($fp, $_POST['v_password']."\n"); @@ -72,7 +72,7 @@ if (!empty($_POST['save'])) { check_return_code($return_var,$output); unset($output); unlink($v_password); - $v_password = "••••••••"; + $v_password = escapeshellarg($_POST['v_password']); } // Set success message diff --git a/web/edit/mail/index.php b/web/edit/mail/index.php index 457a897f..e9873315 100644 --- a/web/edit/mail/index.php +++ b/web/edit/mail/index.php @@ -60,7 +60,7 @@ if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) { $v_username = $user; $v_domain = $_GET['domain']; $v_account = $_GET['account']; - $v_password = "••••••••"; + $v_password = ""; $v_aliases = str_replace(',', "\n", $data[$v_account]['ALIAS']); $valiases = explode(",", $data[$v_account]['ALIAS']); $v_fwd = str_replace(',', "\n", $data[$v_account]['FWD']); @@ -177,7 +177,7 @@ if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['acco $v_account = escapeshellarg($_POST['v_account']); // Change password - if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { + if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) { $v_password = tempnam("/tmp","vst"); $fp = fopen($v_password, "w"); fwrite($fp, $_POST['v_password']."\n"); @@ -186,7 +186,7 @@ if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['acco check_return_code($return_var,$output); unset($output); unlink($v_password); - $v_password = "••••••••"; + $v_password = escapeshellarg($_POST['v_password']);; } // Change quota diff --git a/web/edit/user/index.php b/web/edit/user/index.php index e052301e..f6e07e95 100644 --- a/web/edit/user/index.php +++ b/web/edit/user/index.php @@ -32,7 +32,7 @@ $data = json_decode(implode('', $output), true); unset($output); // Parse user -$v_password = "••••••••"; +$v_password = ""; $v_email = $data[$v_username]['CONTACT']; $v_package = $data[$v_username]['PACKAGE']; $v_language = $data[$v_username]['LANGUAGE']; @@ -75,7 +75,7 @@ unset($output); if (!empty($_POST['save'])) { // Change password - if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { + if ((!empty($_POST['v_password'])) && (empty($_SESSION['error_msg']))) { $v_password = tempnam("/tmp","vst"); $fp = fopen($v_password, "w"); fwrite($fp, $_POST['v_password']."\n"); @@ -84,7 +84,7 @@ if (!empty($_POST['save'])) { check_return_code($return_var,$output); unset($output); unlink($v_password); - $v_password = "••••••••"; + $v_password = escapeshellarg($_POST['v_password']); } // Change package (admin only) diff --git a/web/edit/web/index.php b/web/edit/web/index.php index 5c1dcb41..6a115193 100644 --- a/web/edit/web/index.php +++ b/web/edit/web/index.php @@ -51,9 +51,10 @@ $v_proxy_template = $data[$v_domain]['PROXY']; $v_proxy_ext = str_replace(',', ', ', $data[$v_domain]['PROXY_EXT']); $v_stats = $data[$v_domain]['STATS']; $v_stats_user = $data[$v_domain]['STATS_USER']; -if (!empty($v_stats_user)) $v_stats_password = "••••••••"; +if (!empty($v_stats_user)) $v_stats_password = ""; $v_ftp_user = $data[$v_domain]['FTP_USER']; -if (!empty($v_ftp_user)) $v_ftp_password = "••••••••"; +$v_ftp_path = $data[$v_domain]['FTP_PATH']; +if (!empty($v_ftp_user)) $v_ftp_password = ""; $v_ftp_user_prepath = $data[$v_domain]['DOCUMENT_ROOT']; $v_ftp_user_prepath = str_replace('/public_html', '', $v_ftp_user_prepath, $occurance = 1); $v_ftp_email = $panel[$user]['CONTACT']; @@ -430,7 +431,6 @@ if (!empty($_POST['save'])) { // Change web stats user or password if ((empty($v_stats_user)) && (!empty($_POST['v_stats_auth'])) && (empty($_SESSION['error_msg']))) { if (empty($_POST['v_stats_user'])) $errors[] = __('stats username'); - if (empty($_POST['v_stats_password'])) $errors[] = __('stats password'); if (!empty($errors[0])) { foreach ($errors as $i => $error) { if ( $i == 0 ) { @@ -450,14 +450,13 @@ if (!empty($_POST['save'])) { check_return_code($return_var,$output); unset($output); unlink($v_stats_password); - $v_stats_password = "••••••••"; + $v_stats_password = escapeshellarg($_POST['v_stats_password']); } } // Add web stats authorization if ((!empty($v_stats_user)) && (!empty($_POST['v_stats_auth'])) && (empty($_SESSION['error_msg']))) { if (empty($_POST['v_stats_user'])) $errors[] = __('stats user'); - if (empty($_POST['v_stats_password'])) $errors[] = __('stats password'); if (!empty($errors[0])) { foreach ($errors as $i => $error) { if ( $i == 0 ) { @@ -468,7 +467,7 @@ if (!empty($_POST['save'])) { } $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); } - if (($v_stats_user != $_POST['v_stats_user']) || ($_POST['v_stats_password'] != "••••••••" ) && (empty($_SESSION['error_msg']))) { + if (($v_stats_user != $_POST['v_stats_user']) || (!empty($_POST['v_stats_password'])) && (empty($_SESSION['error_msg']))) { $v_stats_user = escapeshellarg($_POST['v_stats_user']); $v_stats_password = tempnam("/tmp","vst"); $fp = fopen($v_stats_password, "w"); @@ -478,22 +477,22 @@ if (!empty($_POST['save'])) { check_return_code($return_var,$output); unset($output); unlink($v_stats_password); - $v_stats_password = "••••••••"; + $v_stats_password = escapeshellarg($_POST['v_stats_password']); } } - // Change ftp accounts + // Update ftp account if (!empty($_POST['v_ftp_user'])) { $v_ftp_users_updated = array(); foreach ($_POST['v_ftp_user'] as $i => $v_ftp_user_data) { - if (empty($v_ftp_user_data['v_ftp_user']) && empty($v_ftp_user_data['v_ftp_password'])) { + if (empty($v_ftp_user_data['v_ftp_user'])) { continue; } + $v_ftp_user_data['v_ftp_user'] = preg_replace("/^".$user."_/i", "", $v_ftp_user_data['v_ftp_user']); if ($v_ftp_user_data['is_new'] == 1 && !empty($_POST['v_ftp'])) { if ((!empty($v_ftp_user_data['v_ftp_email'])) && (!filter_var($v_ftp_user_data['v_ftp_email'], FILTER_VALIDATE_EMAIL))) $_SESSION['error_msg'] = __('Please enter valid email address.'); if (empty($v_ftp_user_data['v_ftp_user'])) $errors[] = 'ftp user'; - if (empty($v_ftp_user_data['v_ftp_password'])) $errors[] = 'ftp user password'; if (!empty($errors[0])) { foreach ($errors as $i => $error) { if ( $i == 0 ) { @@ -505,6 +504,7 @@ if (!empty($_POST['save'])) { $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); } + // Add ftp account $v_ftp_username = $v_ftp_user_data['v_ftp_user']; $v_ftp_username_full = $user . '_' . $v_ftp_user_data['v_ftp_user']; $v_ftp_user = escapeshellarg($v_ftp_username); @@ -531,7 +531,7 @@ if (!empty($_POST['save'])) { } if ($return_var == 0) { - $v_ftp_password = "••••••••"; + $v_ftp_password = ""; $v_ftp_user_data['is_new'] = 0; } else { @@ -550,7 +550,7 @@ if (!empty($_POST['save'])) { continue; } - + // Delete FTP account if ($v_ftp_user_data['delete'] == 1) { $v_ftp_username = $user . '_' . $v_ftp_user_data['v_ftp_user']; exec (VESTA_CMD."v-delete-web-domain-ftp ".$v_username." ".$v_domain." ".$v_ftp_username, $output, $return_var); @@ -561,9 +561,7 @@ if (!empty($_POST['save'])) { } if (!empty($_POST['v_ftp'])) { - // Change FTP Account if (empty($v_ftp_user_data['v_ftp_user'])) $errors[] = __('ftp user'); - if (empty($v_ftp_user_data['v_ftp_password'])) $errors[] = __('ftp user password'); if (!empty($errors[0])) { foreach ($errors as $i => $error) { if ( $i == 0 ) { @@ -575,19 +573,23 @@ if (!empty($_POST['save'])) { $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); } + // Change FTP account path $v_ftp_username = $user . '_' . $v_ftp_user_data['v_ftp_user']; //preg_replace("/^".$user."_/", "", $v_ftp_user_data['v_ftp_user']); $v_ftp_username = escapeshellarg($v_ftp_username); - $v_ftp_user_data['v_ftp_password'] = escapeshellarg(trim($v_ftp_user_data['v_ftp_password'])); - $v_ftp_path = escapeshellarg(trim($v_ftp_user_data['v_ftp_path'])); - exec (VESTA_CMD."v-change-web-domain-ftp-path ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_path, $output, $return_var); - if ($v_ftp_user_data['v_ftp_password'] != "'••••••••'" && $v_ftp_user_data['v_ftp_password'] != "••••••••" && !empty($v_ftp_user_data['v_ftp_password'])) { + //if (!empty($v_ftp_user_data['v_ftp_path'])) { + $v_ftp_path = escapeshellarg(trim($v_ftp_user_data['v_ftp_path'])); + exec (VESTA_CMD."v-change-web-domain-ftp-path ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_path, $output, $return_var); + //} + + // Change FTP account password + if (!empty($v_ftp_user_data['v_ftp_password'])) { $v_ftp_password = tempnam("/tmp","vst"); $fp = fopen($v_ftp_password, "w"); fwrite($fp, $v_ftp_user_data['v_ftp_password']."\n"); fclose($fp); - exec (VESTA_CMD."v-change-web-domain-ftp-password ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_user_data['v_ftp_password'], $output, $return_var); + exec (VESTA_CMD."v-change-web-domain-ftp-password ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_password, $output, $return_var); unlink($v_ftp_password); - $v_ftp_user_data['v_ftp_password'] = escapeshellarg(trim($v_ftp_user_data['v_ftp_password'])); + $to = $v_ftp_user_data['v_ftp_email']; $subject = __("FTP login credentials"); $hostname = exec('hostname'); @@ -599,12 +601,10 @@ if (!empty($_POST['save'])) { check_return_code($return_var, $output); unset($output); - $v_ftp_password = "••••••••"; - $v_ftp_users_updated[] = array( 'is_new' => 0, 'v_ftp_user' => $v_ftp_username, - 'v_ftp_password' => $v_ftp_password, + 'v_ftp_password' => $v_ftp_user_data['v_ftp_password'], 'v_ftp_path' => $v_ftp_user_data['v_ftp_path'], 'v_ftp_email' => $v_ftp_user_data['v_ftp_email'], 'v_ftp_pre_path' => $v_ftp_user_prepath diff --git a/web/inc/main.php b/web/inc/main.php index 13f12fd9..c4ac59e1 100644 --- a/web/inc/main.php +++ b/web/inc/main.php @@ -181,6 +181,47 @@ function humanize_usage($usage) { return $usage; } +function humanize_usage_size($usage) { + if ( $usage > 1024 ) { + $usage = $usage / 1024; + if ( $usage > 1024 ) { + $usage = $usage / 1024 ; + if ( $usage > 1024 ) { + $usage = $usage / 1024 ; + $usage = number_format($usage, 2); + } else { + $usage = number_format($usage, 2); + } + } else { + $usage = number_format($usage, 2); + } + } + + return $usage; +} + +function humanize_usage_measure($usage) { + $measure = 'kb'; + if ( $usage > 1024 ) { + $usage = $usage / 1024; + if ( $usage > 1024 ) { + $usage = $usage / 1024 ; + if ( $usage > 1024 ) { + $measure = __('pb'); + } else { + $measure = __('tb'); + } + } else { + $measure = __('gb'); + } + } else { + $measure = __('mb'); + } + + return $measure; +} + + function get_percentage($used,$total) { if (!isset($total)) $total = 0; if (!isset($used)) $used = 0; diff --git a/web/list/updates/index.php b/web/list/updates/index.php index f53f7682..394b50e2 100644 --- a/web/list/updates/index.php +++ b/web/list/updates/index.php @@ -1,6 +1,6 @@ - + " . strtoupper($_SESSION['WEB_SYSTEM']) . "" ;?> @@ -73,10 +73,37 @@ + + + + " . strtoupper($_SESSION['WEB_BACKEND']). "" ;?> + + + + + + + + + - + " .strtoupper($_SESSION['PROXY_SYSTEM']) . "" ;?> + @@ -100,7 +127,7 @@ - + " .strtoupper($_SESSION['DNS_SYSTEM']) . "" ;?> diff --git a/web/templates/admin/add_web.html b/web/templates/admin/add_web.html index edb878b8..95ebb6cd 100644 --- a/web/templates/admin/add_web.html +++ b/web/templates/admin/add_web.html @@ -373,7 +373,7 @@ diff --git a/web/templates/admin/edit_cron.html b/web/templates/admin/edit_cron.html index aaec18cf..6c559acf 100644 --- a/web/templates/admin/edit_cron.html +++ b/web/templates/admin/edit_cron.html @@ -29,7 +29,7 @@ $back = "location.href='".$back."'"; } ?> - +
- # () + # ()
@@ -41,7 +41,7 @@ - +
diff --git a/web/templates/admin/edit_db.html b/web/templates/admin/edit_db.html index db748391..ed0c38f8 100644 --- a/web/templates/admin/edit_db.html +++ b/web/templates/admin/edit_db.html @@ -29,7 +29,7 @@ $back = "location.href='".$back."'"; } ?> - +