diff --git a/bin/v-add-cron-job b/bin/v-add-cron-job index b6b2dd575..75a396a09 100755 --- a/bin/v-add-cron-job +++ b/bin/v-add-cron-job @@ -55,7 +55,7 @@ str="$str CMD='$command' SUSPENDED='no' TIME='$TIME' DATE='$DATE'" # Adding to crontab echo "$str" >> $VESTA/data/users/$user/cron.conf -# Chaning permissions +# Changing permissions chmod 660 $VESTA/data/users/$user/cron.conf # Sort jobs by id number diff --git a/bin/v-copy-fs-file b/bin/v-copy-fs-file new file mode 100755 index 000000000..a3004654b --- /dev/null +++ b/bin/v-copy-fs-file @@ -0,0 +1,58 @@ +#!/bin/bash +# File copier + +user=$1 +file_src=$2 +file_dst=$3 + +# Checking arguments +if [ -z "$file_dst" ]; then + echo "Usage: USER SRC_FILE DST_FILE" + exit 1 +fi + +# Checking users +if [ ! -e "$VESTA/data/users/$user" ]; then + exit 1 +fi + +# Checking homedir +homedir=$(grep "^$user:" /etc/passwd | cut -f 6 -d :) +if [ -z $homedir ]; then + exit 1 +fi + +# Checking source file +if [ ! -e "$file_src" ]; then + exit 1 +fi + +# Checking source path +rpath=$(readlink -f "$file_src") +if [ -z "$(echo $rpath |grep ^/tmp)" ]; then + exit 1 +fi + +# Checking destination path +rpath=$(readlink -f "$file_dst") +if [ -z "$(echo $rpath |grep ^$homedir)" ]; then + exit 1 +fi + +# Checking dst file permission +if [ -e "$file_dst" ]; then + perms=$(stat --format '%a' $file_dst) +fi + +# Copying file +cp $file_src $file_dst + +# Changing ownership +chown $user:$user $file_dst + +# Changin permissions +if [ ! -z "$perms" ]; then + chmod $perms $file_dst +fi + +exit diff --git a/bin/v-list-fs-directory b/bin/v-list-fs-directory new file mode 100755 index 000000000..a06b4168d --- /dev/null +++ b/bin/v-list-fs-directory @@ -0,0 +1,39 @@ +#!/bin/bash +# File list wrapper + +user=$1 +path=$2 + +# Checking arguments +if [ -z "$user" ]; then + echo "Usage: USER [PATH]" + exit 1 +fi + +# Checking users +if [ ! -e "$VESTA/data/users/$user" ]; then + exit 1 +fi + +# Checking homedir +homedir=$(grep "^$user:" /etc/passwd | cut -f 6 -d :) +if [ -z $homedir ]; then + exit 1 +fi + +# Checking path +if [ ! -z "$path" ]; then + # Validating absolute path + rpath=$(readlink -f "$path") + if [ -z "$(echo $rpath |grep $homedir)" ]; then + exit 1 + fi +else + path=$homedir +fi + +# Listing files +find "$path" -maxdepth 1 -printf "%y/%m/%TY-%Tm-%Td/%TH:%TM:%TS/%u/%g/%s/%P\n" + + +exit diff --git a/bin/v-list-user-ns b/bin/v-list-user-ns index d296191b3..1da0fe5f1 100755 --- a/bin/v-list-user-ns +++ b/bin/v-list-user-ns @@ -21,7 +21,7 @@ json_list_ns() { ns=$(grep "^NS='" $USER_DATA/user.conf |cut -f 2 -d \') echo '[' i=1 - nslistc=$(echo -e "${ns//,/\n}"|wc -l) + nslistc=$(echo -e "${ns//,/\\n}"|wc -l) for nameserver in ${ns//,/ };do if [ "$i" -ne "$nslistc" ]; then echo -e "\t\"$nameserver\"," diff --git a/bin/v-open-fs-file b/bin/v-open-fs-file new file mode 100755 index 000000000..d5c8ea3a6 --- /dev/null +++ b/bin/v-open-fs-file @@ -0,0 +1,36 @@ +#!/bin/bash +# File reader + +user=$1 +path=$2 + +# Checking arguments +if [ -z "$path" ]; then + echo "Usage: USER PATH" + exit 1 +fi + +# Checking users +if [ ! -e "$VESTA/data/users/$user" ]; then + exit 1 +fi + +# Checking homedir +homedir=$(grep "^$user:" /etc/passwd | cut -f 6 -d :) +if [ -z $homedir ]; then + exit 1 +fi + +# Checking path +if [ ! -z "$path" ]; then + # Validating absolute path + rpath=$(readlink -f "$path") + if [ -z "$(echo $rpath |grep $homedir)" ]; then + exit 1 + fi +fi + +cat "$path" + +exit + diff --git a/func/db.sh b/func/db.sh index fbcc4670d..2489e3d91 100644 --- a/func/db.sh +++ b/func/db.sh @@ -337,20 +337,20 @@ dump_mysql_database() { fi query='SELECT VERSION()' - mysql -h $HOST -u $USER -p$PASSWORD -e "$query" > /dev/null 2>&1 + mysql -h $HOST -u $USER -p$PASSWORD -e "$query" >/dev/null 2>/tmp/e.mysql if [ '0' -ne "$?" ]; then rm -rf $tmpdir - echo "Can't connect to mysql server $HOST" |\ + echo -e "Can't connect to $HOST\n$(cat /tmp/e.mysql)" |\ $send_mail -s "$subj" $email echo "Error: Connection failed" log_event "$E_CONNECT $EVENT" exit $E_CONNECT fi - mysqldump -h $HOST -u $USER -p$PASSWORD -r $dump $database + mysqldump -h $HOST -u $USER -p$PASSWORD -r $dump $database 2>/tmp/e.mysql if [ '0' -ne "$?" ]; then rm -rf $tmpdir - echo "Can't dump mysql database $database" |\ + echo -e "Can't dump database $database\n$(cat /tmp/e.mysql)" |\ $send_mail -s "$subj" $email echo "Error: dump $database failed" log_event "$E_DB $EVENT" diff --git a/web/add/cron/index.php b/web/add/cron/index.php index 047d89b20..d7f1a2ce0 100644 --- a/web/add/cron/index.php +++ b/web/add/cron/index.php @@ -4,32 +4,19 @@ error_reporting(NULL); ob_start(); session_start(); $TAB = 'CRON'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); -// Header -include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); - -// Panel -top_panel($user,$TAB); - +// Check POST request if (!empty($_POST['ok'])) { - // Check input + + // Check empty fields if ((!isset($_POST['v_min'])) || ($_POST['v_min'] == '')) $errors[] = __('minute'); if ((!isset($_POST['v_hour'])) || ($_POST['v_hour'] == '')) $errors[] = __('hour'); if ((!isset($_POST['v_day'])) || ($_POST['v_day'] == '')) $errors[] = __('day'); if ((!isset($_POST['v_month'])) || ($_POST['v_month'] == '')) $errors[] = __('month'); if ((!isset($_POST['v_wday'])) || ($_POST['v_wday'] == '')) $errors[] = __('day of week'); if ((!isset($_POST['v_cmd'])) || ($_POST['v_cmd'] == '')) $errors[] = __('cmd'); - - // Protect input - $v_min = escapeshellarg($_POST['v_min']); - $v_hour = escapeshellarg($_POST['v_hour']); - $v_day = escapeshellarg($_POST['v_day']); - $v_month = escapeshellarg($_POST['v_month']); - $v_wday = escapeshellarg($_POST['v_wday']); - $v_cmd = escapeshellarg($_POST['v_cmd']); - - // Check for errors if (!empty($errors[0])) { foreach ($errors as $i => $error) { if ( $i == 0 ) { @@ -39,32 +26,46 @@ if (!empty($_POST['ok'])) { } } $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } else { - // Add Cron Job + } + + // Protect input + $v_min = escapeshellarg($_POST['v_min']); + $v_hour = escapeshellarg($_POST['v_hour']); + $v_day = escapeshellarg($_POST['v_day']); + $v_month = escapeshellarg($_POST['v_month']); + $v_wday = escapeshellarg($_POST['v_wday']); + $v_cmd = escapeshellarg($_POST['v_cmd']); + + // Add cron job + if (empty($_SESSION['error_msg'])) { exec (VESTA_CMD."v-add-cron-job ".$user." ".$v_min." ".$v_hour." ".$v_day." ".$v_month." ".$v_wday." ".$v_cmd, $output, $return_var); - $v_type = $_POST['v_type']; - $v_charset = $_POST['v_charset']; check_return_code($return_var,$output); - unset($v_password); unset($output); - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('CRON_CREATED_OK'); - unset($v_min); - unset($v_hour); - unset($v_day); - unset($v_month); - unset($v_wday); - unset($v_cmd); - unset($output); - } + } + + // Flush field values on success + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('CRON_CREATED_OK'); + unset($v_min); + unset($v_hour); + unset($v_day); + unset($v_month); + unset($v_wday); + unset($v_cmd); + unset($output); } } -exec (VESTA_CMD."v-list-database-types 'json'", $output, $return_var); -$db_types = json_decode(implode('', $output), true); -unset($output); +// Header +include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); +// Panel +top_panel($user,$TAB); + +// Display body include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_cron.html'); + +// Flush session messages unset($_SESSION['error_msg']); unset($_SESSION['ok_msg']); diff --git a/web/add/db/index.php b/web/add/db/index.php index a4c1e543e..a9d7e8fa7 100644 --- a/web/add/db/index.php +++ b/web/add/db/index.php @@ -6,24 +6,16 @@ session_start(); $TAB = 'DB'; include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); -// Header -include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); - -// Panel -top_panel($user,$TAB); - -$v_db_email = $panel[$user]['CONTACT']; - +// Check POST request if (!empty($_POST['ok'])) { - // Check input + + // Check empty fields if (empty($_POST['v_database'])) $errors[] = __('database'); if (empty($_POST['v_dbuser'])) $errors[] = __('username'); if (empty($_POST['v_password'])) $errors[] = __('password'); if (empty($_POST['v_type'])) $errors[] = __('type'); if (empty($_POST['v_host'])) $errors[] = __('host'); if (empty($_POST['v_charset'])) $errors[] = __('charset'); - - // Check for errors if (!empty($errors[0])) { foreach ($errors as $i => $error) { if ( $i == 0 ) { @@ -36,12 +28,18 @@ if (!empty($_POST['ok'])) { } // Validate email - if (!empty($_POST['v_db_email'])) { + if ((!empty($_POST['v_db_email'])) && (empty($_SESSION['error_msg']))) { if (!filter_var($_POST['v_db_email'], FILTER_VALIDATE_EMAIL)) { $_SESSION['error_msg'] = __('Please enter valid email address.'); } } + // Check password length + if (empty($_SESSION['error_msg'])) { + $pw_len = strlen($_POST['v_password']); + if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg); + } + // Protect input $v_database = escapeshellarg($_POST['v_database']); $v_dbuser = escapeshellarg($_POST['v_dbuser']); @@ -51,63 +49,71 @@ if (!empty($_POST['ok'])) { $v_host = $_POST['v_host']; $v_db_email = $_POST['v_db_email']; - // Check password length + // Add database if (empty($_SESSION['error_msg'])) { - $pw_len = strlen($_POST['v_password']); - if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg); - } - - if (empty($_SESSION['error_msg'])) { - // Add Database $v_type = escapeshellarg($_POST['v_type']); $v_charset = escapeshellarg($_POST['v_charset']); $v_host = escapeshellarg($_POST['v_host']); exec (VESTA_CMD."v-add-database ".$user." ".$v_database." ".$v_dbuser." ".$v_password." ".$v_type." ".$v_host." ".$v_charset, $output, $return_var); + check_return_code($return_var,$output); + unset($output); $v_type = $_POST['v_type']; $v_host = $_POST['v_host']; $v_charset = $_POST['v_charset']; - check_return_code($return_var,$output); + } + + // Get database manager url + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-list-sys-config json", $output, $return_var); + $sys = json_decode(implode('', $output), true); unset($output); - if ((!empty($v_db_email)) && (empty($_SESSION['error_msg']))) { - list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]); - if ($_POST['v_type'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/"; - if ($_POST['v_type'] == 'pgsql') $db_admin_link = "http://".$http_host."/phppgadmin/"; - $to = $v_db_email; - $subject = __("Database Credentials"); - $hostname = exec('hostname'); - $from = __('MAIL_FROM',$hostname); - $mailtext = __('DATABASE_READY',$user."_".$_POST['v_database'],$user."_".$_POST['v_dbuser'],$_POST['v_password'],$db_admin_link); - send_email($to, $subject, $mailtext, $from); - } - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-list-sys-config json", $output, $return_var); - $sys = json_decode(implode('', $output), true); - unset($output); + list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"] . ":"); + if ($_POST['v_host'] != 'localhost' ) $http_host = $_POST['v_host']; + if ($_POST['v_type'] == 'mysql') $db_admin = "phpMyAdmin"; + if ($_POST['v_type'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/"; + if (($_POST['v_type'] == 'mysql') && (!empty($sys['config']['DB_PMA_URL']))) $db_admin_link = $sys['config']['DB_PMA_URL']; + if ($_POST['v_type'] == 'pgsql') $db_admin = "phpPgAdmin"; + if ($_POST['v_type'] == 'pgsql') $db_admin_link = "http://".$http_host."/phppgadmin/"; + if (($_POST['v_type'] == 'pgsql') && (!empty($sys['config']['DB_PGA_URL']))) $db_admin_link = $sys['config']['DB_PGA_URL']; + } - list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"] . ":"); - if ($_POST['v_host'] != 'localhost' ) $http_host = $_POST['v_host']; - if ($_POST['v_type'] == 'mysql') $db_admin = "phpMyAdmin"; - if ($_POST['v_type'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/"; - if (($_POST['v_type'] == 'mysql') && (!empty($sys['config']['DB_PMA_URL']))) $db_admin_link = $sys['config']['DB_PMA_URL']; - if ($_POST['v_type'] == 'pgsql') $db_admin = "phpPgAdmin"; - if ($_POST['v_type'] == 'pgsql') $db_admin_link = "http://".$http_host."/phppgadmin/"; - if (($_POST['v_type'] == 'pgsql') && (!empty($sys['config']['DB_PGA_URL']))) $db_admin_link = $sys['config']['DB_PGA_URL']; + // Email login credentials + if ((!empty($v_db_email)) && (empty($_SESSION['error_msg']))) { + $to = $v_db_email; + $subject = __("Database Credentials"); + $hostname = exec('hostname'); + $from = __('MAIL_FROM',$hostname); + $mailtext = __('DATABASE_READY',$user."_".$_POST['v_database'],$user."_".$_POST['v_dbuser'],$_POST['v_password'],$db_admin_link); + send_email($to, $subject, $mailtext, $from); + } - $_SESSION['ok_msg'] = __('DATABASE_CREATED_OK',$user."_".$_POST['v_database'],$user."_".$_POST['v_database']); - $_SESSION['ok_msg'] .= " / " . __('open %s',$db_admin) . ""; - unset($v_database); - unset($v_dbuser); - unset($v_password); - unset($v_type); - unset($v_charset); - } + // Flush field values on success + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('DATABASE_CREATED_OK',$user."_".$_POST['v_database'],$user."_".$_POST['v_database']); + $_SESSION['ok_msg'] .= " / " . __('open %s',$db_admin) . ""; + unset($v_database); + unset($v_dbuser); + unset($v_password); + unset($v_type); + unset($v_charset); } } +// Header +include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); + +// Panel +top_panel($user,$TAB); + +// Get user email +$v_db_email = $panel[$user]['CONTACT']; + +// List avaiable database types exec (VESTA_CMD."v-list-database-types 'json'", $output, $return_var); $db_types = json_decode(implode('', $output), true); unset($output); +// List available database servers $db_hosts = array(); foreach ($db_types as $db_type ) { exec (VESTA_CMD."v-list-database-hosts ".$db_type." 'json'", $output, $return_var); @@ -117,7 +123,10 @@ foreach ($db_types as $db_type ) { unset($output); } +// Display body include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_db.html'); + +// Flush session messages unset($_SESSION['error_msg']); unset($_SESSION['ok_msg']); diff --git a/web/add/dns/index.php b/web/add/dns/index.php index 8f6ec6c8e..f5a1b8a68 100644 --- a/web/add/dns/index.php +++ b/web/add/dns/index.php @@ -4,31 +4,15 @@ error_reporting(NULL); ob_start(); session_start(); $TAB = 'DNS'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); -// Header -include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); - -// Panel -top_panel($user,$TAB); - +// Check POST request for dns domain if (!empty($_POST['ok'])) { - // Check input + + // Check empty fields if (empty($_POST['v_domain'])) $errors[] = __('domain'); if (empty($_POST['v_ip'])) $errors[] = __('ip'); - - // Protect input - $v_domain = preg_replace("/^www./i", "", $_POST['v_domain']); - $v_domain = escapeshellarg($v_domain); - $v_domain = strtolower($v_domain); - $v_ip = escapeshellarg($_POST['v_ip']); - - if (!empty($_POST['v_ns1'])) $v_ns1 = escapeshellarg($_POST['v_ns1']); - if (!empty($_POST['v_ns2'])) $v_ns2 = escapeshellarg($_POST['v_ns2']); - if (!empty($_POST['v_ns3'])) $v_ns3 = escapeshellarg($_POST['v_ns3']); - if (!empty($_POST['v_ns4'])) $v_ns4 = escapeshellarg($_POST['v_ns4']); - - // Check for errors if (!empty($errors[0])) { foreach ($errors as $i => $error) { if ( $i == 0 ) { @@ -38,49 +22,78 @@ if (!empty($_POST['ok'])) { } } $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } else { - // Add DNS + } + + // Protect input + $v_domain = preg_replace("/^www./i", "", $_POST['v_domain']); + $v_domain = escapeshellarg($v_domain); + $v_domain = strtolower($v_domain); + $v_ip = escapeshellarg($_POST['v_ip']); + if (!empty($_POST['v_ns1'])) $v_ns1 = escapeshellarg($_POST['v_ns1']); + if (!empty($_POST['v_ns2'])) $v_ns2 = escapeshellarg($_POST['v_ns2']); + if (!empty($_POST['v_ns3'])) $v_ns3 = escapeshellarg($_POST['v_ns3']); + if (!empty($_POST['v_ns4'])) $v_ns4 = escapeshellarg($_POST['v_ns4']); + + // Add dns domain + if (empty($_SESSION['error_msg'])) { exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$v_ns4." no", $output, $return_var); check_return_code($return_var,$output); unset($output); + } - // Change Expiriation date + // Set expiriation date + if (empty($_SESSION['error_msg'])) { if ((!empty($_POST['v_exp'])) && ($_POST['v_exp'] != date('Y-m-d', strtotime('+1 year')))) { $v_exp = escapeshellarg($_POST['v_exp']); exec (VESTA_CMD."v-change-dns-domain-exp ".$user." ".$v_domain." ".$v_exp." no", $output, $return_var); check_return_code($return_var,$output); unset($output); } + } - // Change TTL + // Set ttl + if (empty($_SESSION['error_msg'])) { if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400') && (empty($_SESSION['error_msg']))) { $v_ttl = escapeshellarg($_POST['v_ttl']); exec (VESTA_CMD."v-change-dns-domain-ttl ".$user." ".$v_domain." ".$v_ttl." no", $output, $return_var); check_return_code($return_var,$output); unset($output); } + } - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('DNS_DOMAIN_CREATED_OK',$_POST[v_domain],$_POST[v_domain]); - unset($v_domain); - } - - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-restart-dns", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } + // Restart dns server + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-restart-dns", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + // Flush field values on success + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('DNS_DOMAIN_CREATED_OK',$_POST[v_domain],$_POST[v_domain]); + unset($v_domain); } } -// DNS Record + +// Check POST request for dns record if (!empty($_POST['ok_rec'])) { - // Check input + + // Check empty fields if (empty($_POST['v_domain'])) $errors[] = 'domain'; if (empty($_POST['v_rec'])) $errors[] = 'record'; if (empty($_POST['v_type'])) $errors[] = 'type'; if (empty($_POST['v_val'])) $errors[] = 'value'; + if (!empty($errors[0])) { + foreach ($errors as $i => $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); + } // Protect input $v_domain = escapeshellarg($_POST['v_domain']); @@ -89,34 +102,36 @@ if (!empty($_POST['ok_rec'])) { $v_val = escapeshellarg($_POST['v_val']); $v_priority = escapeshellarg($_POST['v_priority']); - // Check for errors - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } else { - // Add DNS Record + // Add dns record + if (empty($_SESSION['error_msg'])) { exec (VESTA_CMD."v-add-dns-record ".$user." ".$v_domain." ".$v_rec." ".$v_type." ".$v_val." ".$v_priority, $output, $return_var); - $v_type = $_POST['v_type']; check_return_code($return_var,$output); unset($output); - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('DNS_RECORD_CREATED_OK',$_POST[v_rec],$_POST[v_domain]); - unset($v_domain); - unset($v_rec); - unset($v_val); - unset($v_priority); - } + $v_type = $_POST['v_type']; + } + + // Flush field values on success + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('DNS_RECORD_CREATED_OK',$_POST[v_rec],$_POST[v_domain]); + unset($v_domain); + unset($v_rec); + unset($v_val); + unset($v_priority); } } -if ((empty($_GET['domain'])) && (empty($_POST['domain']))) { - if ((empty($v_ns1)) && (empty($v_ns2))) { + +// Header +include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); + +// Panel +top_panel($user,$TAB); + +// Display body for dns domain +if (empty($_GET['domain'])) { + if (empty($v_ttl)) $v_ttl = 14400; + if (empty($v_exp)) $v_exp = date('Y-m-d', strtotime('+1 year')); + if (empty($v_ns1)) { exec (VESTA_CMD."v-list-user-ns ".$user." json", $output, $return_var); $nameservers = json_decode(implode('', $output), true); $v_ns1 = $nameservers[0]; @@ -125,17 +140,18 @@ if ((empty($_GET['domain'])) && (empty($_POST['domain']))) { $v_ns4 = $nameservers[3]; unset($output); } - if (empty($v_ttl)) $v_ttl = 14400; - if (empty($v_exp)) $v_exp = date('Y-m-d', strtotime('+1 year')); include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} else { +} + +// Display body for dns record +if (!empty($_GET['domain'])) { $v_domain = $_GET['domain']; include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns_rec.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); } +// Flush session messages +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); + // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/add/ip/index.php b/web/add/ip/index.php index 23eeb2434..dfb595ca1 100644 --- a/web/add/ip/index.php +++ b/web/add/ip/index.php @@ -4,80 +4,93 @@ error_reporting(NULL); ob_start(); session_start(); $TAB = 'IP'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); +// Check user +if ($_SESSION['user'] != 'admin') { + header("Location: /list/user"); + exit; +} + +// Check POST request +if (!empty($_POST['ok'])) { + + // Check empty fields + if (empty($_POST['v_ip'])) $errors[] = __('ip address'); + if (empty($_POST['v_netmask'])) $errors[] = __('netmask'); + if (empty($_POST['v_interface'])) $errors[] = __('interface'); + if (empty($_POST['v_owner'])) $errors[] = __('assigned user'); + if (!empty($errors[0])) { + foreach ($errors as $i => $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); + } + + // Protect input + $v_ip = escapeshellarg($_POST['v_ip']); + $v_netmask = escapeshellarg($_POST['v_netmask']); + $v_name = escapeshellarg($_POST['v_name']); + $v_nat = escapeshellarg($_POST['v_nat']); + $v_interface = escapeshellarg($_POST['v_interface']); + $v_owner = escapeshellarg($_POST['v_owner']); + $v_shared = $_POST['v_shared']; + + // Check shared checkmark + if ($v_shared == 'on') { + $ip_status = 'shared'; + } else { + $ip_status = 'dedicated'; + $v_dedicated = 'yes'; + + } + + // Add IP + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-add-sys-ip ".$v_ip." ".$v_netmask." ".$v_interface." ".$v_owner." '".$ip_status."' ".$v_name." ".$v_nat, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $v_owner = $_POST['v_owner']; + $v_interface = $_POST['v_interface']; + } + + // Flush field values on success + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('IP_CREATED_OK',$_POST['v_ip'],$_POST['v_ip']); + unset($v_ip); + unset($v_netmask); + unset($v_name); + unset($v_nat); + } +} + // Header include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); // Panel top_panel($user,$TAB); -// Are you admin? -if ($_SESSION['user'] == 'admin') { - if (!empty($_POST['ok'])) { - // Check input - if (empty($_POST['v_ip'])) $errors[] = __('ip address'); - if (empty($_POST['v_netmask'])) $errors[] = __('netmask'); - if (empty($_POST['v_interface'])) $errors[] = __('interface'); - if (empty($_POST['v_owner'])) $errors[] = __('assigned user'); +// List network interfaces +exec (VESTA_CMD."v-list-sys-interfaces 'json'", $output, $return_var); +$interfaces = json_decode(implode('', $output), true); +unset($output); - // Protect input - $v_ip = escapeshellarg($_POST['v_ip']); - $v_netmask = escapeshellarg($_POST['v_netmask']); - $v_name = escapeshellarg($_POST['v_name']); - $v_nat = escapeshellarg($_POST['v_nat']); +// List users +exec (VESTA_CMD."v-list-sys-users 'json'", $output, $return_var); +$users = json_decode(implode('', $output), true); +unset($output); - $v_interface = $_POST['v_interface']; - $v_shared = $_POST['v_shared']; - if ($v_shared == 'on') { - $ip_status = 'shared'; - } else { - $ip_status = 'dedicated'; - $v_dedicated = 'yes'; - } +// Display body +include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_ip.html'); - $v_owner = $_POST['v_owner']; - - // Check for errors - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } else { - // Add IP - $v_interface = escapeshellarg($_POST['v_interface']); - $v_owner = $_POST['v_owner']; - exec (VESTA_CMD."v-add-sys-ip ".$v_ip." ".$v_netmask." ".$v_interface." ".$v_owner." '".$ip_status."' ".$v_name." ".$v_nat, $output, $return_var); - $v_owner = $_POST['v_owner']; - $v_interface = $_POST['v_interface']; - check_return_code($return_var,$output); - unset($output); - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('IP_CREATED_OK',$_POST['v_ip'],$_POST['v_ip']); - unset($v_ip); - unset($v_netmask); - unset($v_name); - unset($v_nat); - } - } - } - exec (VESTA_CMD."v-list-sys-interfaces 'json'", $output, $return_var); - $interfaces = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-sys-users 'json'", $output, $return_var); - $users = json_decode(implode('', $output), true); - unset($output); - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_ip.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} +// Flush session messages +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/add/mail/index.php b/web/add/mail/index.php index 492d16739..41c0714d9 100644 --- a/web/add/mail/index.php +++ b/web/add/mail/index.php @@ -4,41 +4,15 @@ error_reporting(NULL); ob_start(); session_start(); $TAB = 'MAIL'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); -// Header -include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); -// Panel -top_panel($user,$TAB); - -// Mail Domain +// Check POST request for mail domain if (!empty($_POST['ok'])) { + + // Check empty fields if (empty($_POST['v_domain'])) $errors[] = __('domain'); - if (!empty($_POST['v_antispam'])) { - $v_antispam = 'yes'; - } else { - $v_antispam = 'no'; - } - - if (!empty($_POST['v_antivirus'])) { - $v_antivirus = 'yes'; - } else { - $v_antivirus = 'no'; - } - - if (!empty($_POST['v_dkim'])) { - $v_dkim = 'yes'; - } else { - $v_dkim = 'no'; - } - - // Protect input - $v_domain = preg_replace("/^www./i", "", $_POST['v_domain']); - $v_domain = escapeshellarg($v_domain); - $v_domain = strtolower($v_domain); - - // Check for errors if (!empty($errors[0])) { foreach ($errors as $i => $error) { if ( $i == 0 ) { @@ -48,27 +22,66 @@ if (!empty($_POST['ok'])) { } } $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } else { + } - // Add mail domain + // Check antispam option + if (!empty($_POST['v_antispam'])) { + $v_antispam = 'yes'; + } else { + $v_antispam = 'no'; + } + + // Check antivirus option + if (!empty($_POST['v_antivirus'])) { + $v_antivirus = 'yes'; + } else { + $v_antivirus = 'no'; + } + + // Check dkim option + if (!empty($_POST['v_dkim'])) { + $v_dkim = 'yes'; + } else { + $v_dkim = 'no'; + } + + // Set domain name to lowercase and remove www prefix + $v_domain = preg_replace("/^www./i", "", $_POST['v_domain']); + $v_domain = escapeshellarg($v_domain); + $v_domain = strtolower($v_domain); + + // Add mail domain + if (empty($_SESSION['error_msg'])) { exec (VESTA_CMD."v-add-mail-domain ".$user." ".$v_domain." ".$v_antispam." ".$v_antivirus." ".$v_dkim, $output, $return_var); check_return_code($return_var,$output); unset($output); + } - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('MAIL_DOMAIN_CREATED_OK',$_POST['v_domain'],$_POST['v_domain']); - unset($v_domain); - } + // Flush field values on success + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('MAIL_DOMAIN_CREATED_OK',$_POST['v_domain'],$_POST['v_domain']); + unset($v_domain); } } -// Mail Account +// Check POST request for mail account if (!empty($_POST['ok_acc'])) { - // Check input + + // Check empty fields if (empty($_POST['v_domain'])) $errors[] = __('domain'); if (empty($_POST['v_account'])) $errors[] = __('account'); if (empty($_POST['v_password'])) $errors[] = __('password'); + if (!empty($errors[0])) { + foreach ($errors as $i => $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); + } // Protect input $v_domain = escapeshellarg($_POST['v_domain']); @@ -78,99 +91,100 @@ if (!empty($_POST['ok_acc'])) { $v_quota = escapeshellarg($_POST['v_quota']); $v_aliases = $_POST['v_aliases']; $v_fwd = $_POST['v_fwd']; - if (empty($_POST['v_quota'])) $v_quota = 0; if ((!empty($_POST['v_quota'])) || (!empty($_POST['v_aliases'])) || (!empty($_POST['v_fwd'])) ) $v_adv = 'yes'; - // Check for errors - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } else { - // Add Mail Account + // Add Mail Account + if (empty($_SESSION['error_msg'])) { exec (VESTA_CMD."v-add-mail-account ".$user." ".$v_domain." ".$v_account." ".$v_password." ".$v_quota, $output, $return_var); check_return_code($return_var,$output); unset($output); + } - // Add Aliases - if ((!empty($_POST['v_aliases'])) && (empty($_SESSION['error_msg']))) { - $valiases = preg_replace("/\n/", " ", $_POST['v_aliases']); - $valiases = preg_replace("/,/", " ", $valiases); - $valiases = preg_replace('/\s+/', ' ',$valiases); - $valiases = trim($valiases); - $aliases = explode(" ", $valiases); - foreach ($aliases as $alias) { - $alias = escapeshellarg($alias); - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-add-mail-account-alias ".$user." ".$v_domain." ".$v_account." ".$alias, $output, $return_var); - check_return_code($return_var,$output); - } - unset($output); - } - } - - // Add Forwads - if ((!empty($_POST['v_fwd'])) && (empty($_SESSION['error_msg']))) { - $vfwd = preg_replace("/\n/", " ", $_POST['v_fwd']); - $vfwd = preg_replace("/,/", " ", $vfwd); - $vfwd = preg_replace('/\s+/', ' ',$vfwd); - $vfwd = trim($vfwd); - $fwd = explode(" ", $vfwd); - foreach ($fwd as $forward) { - $forward = escapeshellarg($forward); - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-add-mail-account-forward ".$user." ".$v_domain." ".$v_account." ".$forward, $output, $return_var); - check_return_code($return_var,$output); - } - unset($output); - } - // Add fwd_only flag - if ((!empty($_POST['v_fwd_only'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-add-mail-account-fwd-only ".$user." ".$v_domain." ".$v_account, $output, $return_var); + // Add Aliases + if ((!empty($_POST['v_aliases'])) && (empty($_SESSION['error_msg']))) { + $valiases = preg_replace("/\n/", " ", $_POST['v_aliases']); + $valiases = preg_replace("/,/", " ", $valiases); + $valiases = preg_replace('/\s+/', ' ',$valiases); + $valiases = trim($valiases); + $aliases = explode(" ", $valiases); + foreach ($aliases as $alias) { + $alias = escapeshellarg($alias); + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-add-mail-account-alias ".$user." ".$v_domain." ".$v_account." ".$alias, $output, $return_var); check_return_code($return_var,$output); unset($output); } } + } - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-list-sys-config json", $output, $return_var); - $sys = json_decode(implode('', $output), true); - unset($output); - - list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":"); - $webmail = "http://".$http_host."/webmail/"; - if (!empty($sys['config']['MAIL_URL'])) $webmail = $sys['config']['MAIL_URL']; - - $_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK',strtolower($_POST['v_account']),$_POST[v_domain],strtolower($_POST['v_account']),$_POST[v_domain]); - $_SESSION['ok_msg'] .= " / " . __('open webmail') . ""; - unset($v_account); - unset($v_password); - unset($v_password); - unset($v_aliases); - unset($v_fwd); - unset($v_quota); + // Add Forwarders + if ((!empty($_POST['v_fwd'])) && (empty($_SESSION['error_msg']))) { + $vfwd = preg_replace("/\n/", " ", $_POST['v_fwd']); + $vfwd = preg_replace("/,/", " ", $vfwd); + $vfwd = preg_replace('/\s+/', ' ',$vfwd); + $vfwd = trim($vfwd); + $fwd = explode(" ", $vfwd); + foreach ($fwd as $forward) { + $forward = escapeshellarg($forward); + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-add-mail-account-forward ".$user." ".$v_domain." ".$v_account." ".$forward, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } } } + + // Add fwd_only flag + if ((!empty($_POST['v_fwd_only'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-add-mail-account-fwd-only ".$user." ".$v_domain." ".$v_account, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Get webmail url + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-list-sys-config json", $output, $return_var); + $sys = json_decode(implode('', $output), true); + unset($output); + list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":"); + $webmail = "http://".$http_host."/webmail/"; + if (!empty($sys['config']['MAIL_URL'])) $webmail = $sys['config']['MAIL_URL']; + } + + // Flush field values on success + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK',strtolower($_POST['v_account']),$_POST[v_domain],strtolower($_POST['v_account']),$_POST[v_domain]); + $_SESSION['ok_msg'] .= " / " . __('open webmail') . ""; + unset($v_account); + unset($v_password); + unset($v_password); + unset($v_aliases); + unset($v_fwd); + unset($v_quota); + } } +// Header +include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); -if ((empty($_GET['domain'])) && (empty($_POST['domain']))) { - $v_domain = (isset($_GET['domain'])?$_GET['domain']:''); +// Panel +top_panel($user,$TAB); + +// Display body for mail domain +if (empty($_GET['domain'])) { include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} else { +} + +// Display body for mail account +if (!empty($_GET['domain'])) { $v_domain = $_GET['domain']; include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail_acc.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); } +// Flush session messages +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); + // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/add/package/index.php b/web/add/package/index.php index 594d3529d..7feb8218b 100644 --- a/web/add/package/index.php +++ b/web/add/package/index.php @@ -4,175 +4,181 @@ error_reporting(NULL); ob_start(); session_start(); $TAB = 'PACKAGE'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); -if (empty($_SESSION['user'])) { - header("Location: /login/"); +// Check user +if ($_SESSION['user'] != 'admin') { + header("Location: /list/user"); + exit; } +// Check POST request +if (!empty($_POST['ok'])) { + + // Check empty fields + if (empty($_POST['v_package'])) $errors[] = __('package'); + if (empty($_POST['v_web_template'])) $errors[] = __('web template'); + if (empty($_POST['v_proxy_template'])) $errors[] = __('proxy template'); + if (empty($_POST['v_dns_template'])) $errors[] = __('dns template'); + if (empty($_POST['v_shell'])) $errrors[] = __('shell'); + if (!isset($_POST['v_web_domains'])) $errors[] = __('web domains'); + if (!isset($_POST['v_web_aliases'])) $errors[] = __('web aliases'); + if (!isset($_POST['v_dns_domains'])) $errors[] = __('dns domains'); + if (!isset($_POST['v_dns_records'])) $errors[] = __('dns records'); + if (!isset($_POST['v_mail_domains'])) $errors[] = __('mail domains'); + if (!isset($_POST['v_mail_accounts'])) $errors[] = __('mail accounts'); + if (!isset($_POST['v_databases'])) $errors[] = __('databases'); + if (!isset($_POST['v_cron_jobs'])) $errors[] = __('cron jobs'); + if (!isset($_POST['v_backups'])) $errors[] = __('backups'); + if (!isset($_POST['v_disk_quota'])) $errors[] = __('quota'); + if (!isset($_POST['v_bandwidth'])) $errors[] = __('bandwidth'); + if (empty($_POST['v_ns1'])) $errors[] = __('ns1'); + if (empty($_POST['v_ns2'])) $errors[] = __('ns2'); + if (!empty($errors[0])) { + foreach ($errors as $i => $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); + } + + // Protect input + $v_package = escapeshellarg($_POST['v_package']); + $v_web_template = escapeshellarg($_POST['v_web_template']); + $v_proxy_template = escapeshellarg($_POST['v_proxy_template']); + $v_dns_template = escapeshellarg($_POST['v_dns_template']); + $v_shell = escapeshellarg($_POST['v_shell']); + $v_web_domains = escapeshellarg($_POST['v_web_domains']); + $v_web_aliases = escapeshellarg($_POST['v_web_aliases']); + $v_dns_domains = escapeshellarg($_POST['v_dns_domains']); + $v_dns_records = escapeshellarg($_POST['v_dns_records']); + $v_mail_domains = escapeshellarg($_POST['v_mail_domains']); + $v_mail_accounts = escapeshellarg($_POST['v_mail_accounts']); + $v_databases = escapeshellarg($_POST['v_databases']); + $v_cron_jobs = escapeshellarg($_POST['v_cron_jobs']); + $v_backups = escapeshellarg($_POST['v_backups']); + $v_disk_quota = escapeshellarg($_POST['v_disk_quota']); + $v_bandwidth = escapeshellarg($_POST['v_bandwidth']); + $v_ns1 = trim($_POST['v_ns1'], '.'); + $v_ns2 = trim($_POST['v_ns2'], '.'); + $v_ns3 = trim($_POST['v_ns3'], '.'); + $v_ns4 = trim($_POST['v_ns4'], '.'); + $v_ns = $v_ns1.",".$v_ns2; + if (!empty($v_ns3)) $v_ns .= ",".$v_ns3; + if (!empty($v_ns4)) $v_ns .= ",".$v_ns4; + $v_ns = escapeshellarg($v_ns); + $v_time = escapeshellarg(date('H:i:s')); + $v_date = escapeshellarg(date('Y-m-d')); + + // Create temporary dir + if (empty($_SESSION['error_msg'])) { + exec ('mktemp -d', $output, $return_var); + $tmpdir = $output[0]; + check_return_code($return_var,$output); + unset($output); + } + + // Create package file + if (empty($_SESSION['error_msg'])) { + $pkg = "WEB_TEMPLATE=".$v_web_template."\n"; + $pkg .= "PROXY_TEMPLATE=".$v_proxy_template."\n"; + $pkg .= "DNS_TEMPLATE=".$v_dns_template."\n"; + $pkg .= "WEB_DOMAINS=".$v_web_domains."\n"; + $pkg .= "WEB_ALIASES=".$v_web_aliases."\n"; + $pkg .= "DNS_DOMAINS=".$v_dns_domains."\n"; + $pkg .= "DNS_RECORDS=".$v_dns_records."\n"; + $pkg .= "MAIL_DOMAINS=".$v_mail_domains."\n"; + $pkg .= "MAIL_ACCOUNTS=".$v_mail_accounts."\n"; + $pkg .= "DATABASES=".$v_databases."\n"; + $pkg .= "CRON_JOBS=".$v_cron_jobs."\n"; + $pkg .= "DISK_QUOTA=".$v_disk_quota."\n"; + $pkg .= "BANDWIDTH=".$v_bandwidth."\n"; + $pkg .= "NS=".$v_ns."\n"; + $pkg .= "SHELL=".$v_shell."\n"; + $pkg .= "BACKUPS=".$v_backups."\n"; + $pkg .= "TIME=".$v_time."\n"; + $pkg .= "DATE=".$v_date."\n"; + + $fp = fopen($tmpdir."/".$_POST['v_package'].".pkg", 'w'); + fwrite($fp, $pkg); + fclose($fp); + } + + // Add new package + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$v_package, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Remove tmpdir + exec ('rm -rf '.$tmpdir, $output, $return_var); + unset($output); + + // Flush field values on success + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('PACKAGE_CREATED_OK',$_POST['v_package'],$_POST['v_package']); + unset($v_package); + } + +} + + // Header include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); // Panel top_panel($user,$TAB); -// Are you admin? -if ($_SESSION['user'] == 'admin') { - if (!empty($_POST['ok'])) { - // Check input - if (empty($_POST['v_package'])) $errors[] = __('package'); - if (empty($_POST['v_web_template'])) $errors[] = __('web template'); - if (empty($_POST['v_proxy_template'])) $errors[] = __('proxy template'); - if (empty($_POST['v_dns_template'])) $errors[] = __('dns template'); - if (empty($_POST['v_shell'])) $errrors[] = __('shell'); - if (!isset($_POST['v_web_domains'])) $errors[] = __('web domains'); - if (!isset($_POST['v_web_aliases'])) $errors[] = __('web aliases'); - if (!isset($_POST['v_dns_domains'])) $errors[] = __('dns domains'); - if (!isset($_POST['v_dns_records'])) $errors[] = __('dns records'); - if (!isset($_POST['v_mail_domains'])) $errors[] = __('mail domains'); - if (!isset($_POST['v_mail_accounts'])) $errors[] = __('mail accounts'); - if (!isset($_POST['v_databases'])) $errors[] = __('databases'); - if (!isset($_POST['v_cron_jobs'])) $errors[] = __('cron jobs'); - if (!isset($_POST['v_backups'])) $errors[] = __('backups'); - if (!isset($_POST['v_disk_quota'])) $errors[] = __('quota'); - if (!isset($_POST['v_bandwidth'])) $errors[] = __('bandwidth'); - if (empty($_POST['v_ns1'])) $errors[] = __('ns1'); - if (empty($_POST['v_ns2'])) $errors[] = __('ns2'); +// List web temmplates +exec (VESTA_CMD."v-list-web-templates json", $output, $return_var); +$web_templates = json_decode(implode('', $output), true); +unset($output); +// List web templates for proxy +exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var); +$proxy_templates = json_decode(implode('', $output), true); +unset($output); - // Protect input - $v_package = escapeshellarg($_POST['v_package']); - $v_web_template = escapeshellarg($_POST['v_web_template']); - $v_proxy_template = escapeshellarg($_POST['v_proxy_template']); - $v_dns_template = escapeshellarg($_POST['v_dns_template']); - $v_shell = escapeshellarg($_POST['v_shell']); - $v_web_domains = escapeshellarg($_POST['v_web_domains']); - $v_web_aliases = escapeshellarg($_POST['v_web_aliases']); - $v_dns_domains = escapeshellarg($_POST['v_dns_domains']); - $v_dns_records = escapeshellarg($_POST['v_dns_records']); - $v_mail_domains = escapeshellarg($_POST['v_mail_domains']); - $v_mail_accounts = escapeshellarg($_POST['v_mail_accounts']); - $v_databases = escapeshellarg($_POST['v_databases']); - $v_cron_jobs = escapeshellarg($_POST['v_cron_jobs']); - $v_backups = escapeshellarg($_POST['v_backups']); - $v_disk_quota = escapeshellarg($_POST['v_disk_quota']); - $v_bandwidth = escapeshellarg($_POST['v_bandwidth']); - $v_ns1 = trim($_POST['v_ns1'], '.'); - $v_ns2 = trim($_POST['v_ns2'], '.'); - $v_ns3 = trim($_POST['v_ns3'], '.'); - $v_ns4 = trim($_POST['v_ns4'], '.'); - $v_ns = $v_ns1.",".$v_ns2; - if (!empty($v_ns3)) $v_ns .= ",".$v_ns3; - if (!empty($v_ns4)) $v_ns .= ",".$v_ns4; - $v_ns = escapeshellarg($v_ns); - $v_time = escapeshellarg(date('H:i:s')); - $v_date = escapeshellarg(date('Y-m-d')); +// List DNS templates +exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var); +$dns_templates = json_decode(implode('', $output), true); +unset($output); - // Check for errors - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } else { - exec ('mktemp -d', $output, $return_var); - $tmpdir = $output[0]; - unset($output); +// List system shells +exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var); +$shells = json_decode(implode('', $output), true); +unset($output); - // Create package - $pkg = "WEB_TEMPLATE=".$v_web_template."\n"; - $pkg .= "PROXY_TEMPLATE=".$v_proxy_template."\n"; - $pkg .= "DNS_TEMPLATE=".$v_dns_template."\n"; - $pkg .= "WEB_DOMAINS=".$v_web_domains."\n"; - $pkg .= "WEB_ALIASES=".$v_web_aliases."\n"; - $pkg .= "DNS_DOMAINS=".$v_dns_domains."\n"; - $pkg .= "DNS_RECORDS=".$v_dns_records."\n"; - $pkg .= "MAIL_DOMAINS=".$v_mail_domains."\n"; - $pkg .= "MAIL_ACCOUNTS=".$v_mail_accounts."\n"; - $pkg .= "DATABASES=".$v_databases."\n"; - $pkg .= "CRON_JOBS=".$v_cron_jobs."\n"; - $pkg .= "DISK_QUOTA=".$v_disk_quota."\n"; - $pkg .= "BANDWIDTH=".$v_bandwidth."\n"; - $pkg .= "NS=".$v_ns."\n"; - $pkg .= "SHELL=".$v_shell."\n"; - $pkg .= "BACKUPS=".$v_backups."\n"; - $pkg .= "TIME=".$v_time."\n"; - $pkg .= "DATE=".$v_date."\n"; +// Set default values +if (empty($v_web_template)) $v_web_template = 'default'; +if (empty($v_proxy_template)) $v_proxy_template = 'default'; +if (empty($v_dns_template)) $v_dns_template = 'default'; +if (empty($v_shell)) $v_shell = 'nologin'; +if (empty($v_web_domains)) $v_web_domains = "'0'"; +if (empty($v_web_aliases)) $v_web_aliases = "'0'"; +if (empty($v_dns_domains)) $v_dns_domains = "'0'"; +if (empty($v_dns_records)) $v_dns_records = "'0'"; +if (empty($v_mail_domains)) $v_mail_domains = "'0'"; +if (empty($v_mail_accounts)) $v_mail_accounts = "'0'"; +if (empty($v_databases)) $v_databases = "'0'"; +if (empty($v_cron_jobs)) $v_cron_jobs = "'0'"; +if (empty($v_backups)) $v_backups = "'0'"; +if (empty($v_disk_quota)) $v_disk_quota = "'0'"; +if (empty($v_bandwidth)) $v_bandwidth = "'0'"; +if (empty($v_ns1)) $v_ns1 = 'ns1.example.ltd'; +if (empty($v_ns2)) $v_ns2 = 'ns2.example.ltd'; - // Write package - $fp = fopen($tmpdir."/".$_POST['v_package'].".pkg", 'w'); - fwrite($fp, $pkg); - fclose($fp); +// Display body +include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_package.html'); - // Add new package - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$v_package, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - // Remove tmpdir - exec ('rm -rf '.$tmpdir, $output, $return_var); - unset($output); - - // Check output - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('PACKAGE_CREATED_OK',$_POST['v_package'],$_POST['v_package']); - unset($v_package); - } - - } - } - - - exec (VESTA_CMD."v-list-web-templates json", $output, $return_var); - check_error($return_var); - $web_templates = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var); - check_error($return_var); - $proxy_templates = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var); - check_error($return_var); - $dns_templates = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var); - check_error($return_var); - $shells = json_decode(implode('', $output), true); - unset($output); - - // Set default values - if (empty($v_web_template)) $v_web_template = 'default'; - if (empty($v_proxy_template)) $v_proxy_template = 'default'; - if (empty($v_dns_template)) $v_dns_template = 'default'; - if (empty($v_shell)) $v_shell = 'nologin'; - if (empty($v_web_domains)) $v_web_domains = "'0'"; - if (empty($v_web_aliases)) $v_web_aliases = "'0'"; - if (empty($v_dns_domains)) $v_dns_domains = "'0'"; - if (empty($v_dns_records)) $v_dns_records = "'0'"; - if (empty($v_mail_domains)) $v_mail_domains = "'0'"; - if (empty($v_mail_accounts)) $v_mail_accounts = "'0'"; - if (empty($v_databases)) $v_databases = "'0'"; - if (empty($v_cron_jobs)) $v_cron_jobs = "'0'"; - if (empty($v_backups)) $v_backups = "'0'"; - if (empty($v_disk_quota)) $v_disk_quota = "'0'"; - if (empty($v_bandwidth)) $v_bandwidth = "'0'"; - if (empty($v_ns1)) $v_ns1 = 'ns1.example.ltd'; - if (empty($v_ns2)) $v_ns2 = 'ns2.example.ltd'; - - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_package.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} +// Flush session messages +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/add/user/index.php b/web/add/user/index.php index 59e9181ea..3324c0464 100644 --- a/web/add/user/index.php +++ b/web/add/user/index.php @@ -1,110 +1,128 @@ $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); + } + + // Validate email + if ((empty($_SESSION['error_msg'])) && (!filter_var($_POST['v_email'], FILTER_VALIDATE_EMAIL))) { + $_SESSION['error_msg'] = __('Please enter valid email address.'); + } + + // Check password length + if (empty($_SESSION['error_msg'])) { + $pw_len = strlen($_POST['v_password']); + if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg); + } + + // Protect input + $v_username = escapeshellarg($_POST['v_username']); + $v_password = escapeshellarg($_POST['v_password']); + $v_email = escapeshellarg($_POST['v_email']); + $v_package = escapeshellarg($_POST['v_package']); + $v_language = escapeshellarg($_POST['v_language']); + $v_fname = escapeshellarg($_POST['v_fname']); + $v_lname = escapeshellarg($_POST['v_lname']); + $v_notify = $_POST['v_notify']; + + + // Add user + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-add-user ".$v_username." ".$v_password." ".$v_email." ".$v_package." ".$v_fname." ".$v_lname, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Set language + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-change-user-language ".$v_username." ".$v_language, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Send email to the new user + if ((empty($_SESSION['error_msg'])) && (!empty($v_notify))) { + $to = $_POST['v_notify']; + $subject = _translate($_POST['v_language'],"Welcome to Vesta Control Panel"); + $hostname = exec('hostname'); + unset($output); + $from = _translate($_POST['v_language'],'MAIL_FROM',$hostname); + if (!empty($_POST['v_fname'])) { + $mailtext = _translate($_POST['v_language'],'GREETINGS_GORDON_FREEMAN',$_POST['v_fname'],$_POST['v_lname']); + } else { + $mailtext = _translate($_POST['v_language'],'GREETINGS'); + } + $mailtext .= _translate($_POST['v_language'],'ACCOUNT_READY',$_SERVER['HTTP_HOST'],$_POST['v_username'],$_POST['v_password']); + send_email($to, $subject, $mailtext, $from); + } + + // Flush field values on success + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('USER_CREATED_OK',$_POST['v_username'],$_POST['v_username']); + $_SESSION['ok_msg'] .= " / " . __('login as') ." ".$_POST['v_username']. ""; + unset($v_username); + unset($v_password); + unset($v_email); + unset($v_fname); + unset($v_lname); + unset($v_notify); + } +} + + // Header include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); // Panel top_panel($user,$TAB); -// Are you admin? -if ($_SESSION['user'] == 'admin') { - if (!empty($_POST['ok'])) { - // Check input - if (empty($_POST['v_username'])) $errors[] = __('user'); - if (empty($_POST['v_password'])) $errors[] = __('password'); - if (empty($_POST['v_package'])) $errrors[] = __('package'); - if (empty($_POST['v_email'])) $errors[] = __('email'); - if (empty($_POST['v_fname'])) $errors[] = __('first name'); - if (empty($_POST['v_lname'])) $errors[] = __('last name'); +// List hosting packages +exec (VESTA_CMD."v-list-user-packages json", $output, $return_var); +check_error($return_var); +$data = json_decode(implode('', $output), true); +unset($output); - // Protect input - $v_username = escapeshellarg($_POST['v_username']); - $v_password = escapeshellarg($_POST['v_password']); - $v_email = escapeshellarg($_POST['v_email']); - $v_package = escapeshellarg($_POST['v_package']); - $v_language = escapeshellarg($_POST['v_language']); - $v_fname = escapeshellarg($_POST['v_fname']); - $v_lname = escapeshellarg($_POST['v_lname']); - $v_notify = $_POST['v_notify']; +// List languages +exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var); +$languages = json_decode(implode('', $output), true); +unset($output); - // Validate email - if (!filter_var($_POST['v_email'], FILTER_VALIDATE_EMAIL)) { - $_SESSION['error_msg'] = __('Please enter valid email address.'); - } +// Display body +include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_user.html'); - // Check for errors - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } - - // Check password length - if (empty($_SESSION['error_msg'])) { - $pw_len = strlen($_POST['v_password']); - if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg); - } - - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-add-user ".$v_username." ".$v_password." ".$v_email." ".$v_package." ".$v_fname." ".$v_lname, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-change-user-language ".$v_username." ".$v_language, $output, $return_var); - if (!empty($v_notify)) { - $to = $_POST['v_notify']; - $subject = _translate($_POST['v_language'],"Welcome to Vesta Control Panel"); - $hostname = exec('hostname'); - $from = _translate($_POST['v_language'],'MAIL_FROM',$hostname); - if (!empty($_POST['v_fname'])) { - $mailtext = _translate($_POST['v_language'],'GREETINGS_GORDON_FREEMAN',$_POST['v_fname'],$_POST['v_lname']); - } else { - $mailtext = _translate($_POST['v_language'],'GREETINGS'); - } - $mailtext .= _translate($_POST['v_language'],'ACCOUNT_READY',$_SERVER['HTTP_HOST'],$_POST['v_username'],$_POST['v_password']); - send_email($to, $subject, $mailtext, $from); - } - - $_SESSION['ok_msg'] = __('USER_CREATED_OK',$_POST[v_username],$_POST[v_username]); - $_SESSION['ok_msg'] .= " / " . __('login as') ." ".$_POST[v_username]. ""; - unset($v_username); - unset($v_password); - unset($v_email); - unset($v_fname); - unset($v_lname); - unset($v_notify); - } - unset($output); - } - } - - exec (VESTA_CMD."v-list-user-packages json", $output, $return_var); - check_error($return_var); - $data = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var); - $languages = json_decode(implode('', $output), true); - unset($output); - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_user.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} +// Flush session messages +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/add/web/index.php b/web/add/web/index.php index 0c13cf58e..63d8d792b 100644 --- a/web/add/web/index.php +++ b/web/add/web/index.php @@ -4,277 +4,350 @@ error_reporting(NULL); ob_start(); session_start(); $TAB = 'WEB'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); +// Check POST request +if (!empty($_POST['ok'])) { + + // Check for empty fields + if (empty($_POST['v_domain'])) $errors[] = __('domain'); + if (empty($_POST['v_ip'])) $errors[] = __('ip'); + if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_crt']))) $errors[] = __('ssl certificate'); + if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_key']))) $errors[] = __('ssl key'); + if (!empty($errors[0])) { + foreach ($errors as $i => $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); + } + + // Check stats password length + if ((!empty($v_stats)) && (empty($_SESSION['error_msg']))) { + if (!empty($_POST['v_stats_user'])) { + $pw_len = strlen($_POST['v_stats_password']); + if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg); + } + } + + // Default proxy extention list + $v_proxy_ext = 'jpeg, jpg, png, gif, bmp, ico, svg, tif, tiff, css, js, htm, html, ttf, '; + $v_proxy_ext .= 'otf, webp, woff, txt, csv, rtf, doc, docx, xls, xlsx, ppt, pptx, odf, '; + $v_proxy_ext .= 'odp, ods, odt, pdf, psd, ai, eot, eps, ps, zip, tar, tgz, gz, rar, '; + $v_proxy_ext .= 'bz2, 7z, aac, m4a, mp3, mp4, ogg, wav, wma, 3gp, avi, flv, m4v, mkv, '; + $v_proxy_ext .= 'mov, mp4, mpeg, mpg, wmv, exe, iso, dmg, swf'; + + // Set advanced option checkmark + if (empty($_POST['v_proxy'])) $v_adv = 'yes'; + if (!empty($_POST['v_ftp'])) $v_adv = 'yes'; + if ($_POST['v_proxy_ext'] != $v_proxy_ext) $v_adv = 'yes'; + + // Set domain name to lowercase and remove www prefix + $v_domain = preg_replace("/^www\./i", "", $_POST['v_domain']); + $v_domain = escapeshellarg($v_domain); + $v_domain = strtolower($v_domain); + + // Prepare domain values + $v_ip = escapeshellarg($_POST['v_ip']); + if ((!empty($_POST['v_aliases'])) && ($_POST['v_aliases'] != 'www.'.$_POST['v_domain'])) $v_adv = 'yes'; + if ((!empty($_POST['v_ssl'])) || (!empty($_POST['v_elog']))) $v_adv = 'yes'; + if ((!empty($_POST['v_ssl_crt'])) || (!empty($_POST['v_ssl_key']))) $v_adv = 'yes'; + if ((!empty($_POST['v_ssl_ca'])) || ($_POST['v_stats'] != 'none')) $v_adv = 'yes'; + if (!empty($v_domain)) $v_ftp_user_prepath .= $v_domain; + if (empty($_POST['v_dns'])) $v_dns = 'off'; + if (empty($_POST['v_mail'])) $v_mail = 'off'; + if (empty($_POST['v_proxy'])) $v_proxy = 'off'; + $v_aliases = $_POST['v_aliases']; + $v_elog = $_POST['v_elog']; + $v_ssl = $_POST['v_ssl']; + $v_ssl_crt = $_POST['v_ssl_crt']; + $v_ssl_key = $_POST['v_ssl_key']; + $v_ssl_ca = $_POST['v_ssl_ca']; + $v_ssl_home = $data[$v_domain]['SSL_HOME']; + $v_stats = escapeshellarg($_POST['v_stats']); + $v_stats_user = $data[$v_domain]['STATS_USER']; + $v_stats_password = $data[$v_domain]['STATS_PASSWORD']; + $v_proxy_ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']); + $v_proxy_ext = preg_replace("/,/", " ", $v_proxy_ext); + $v_proxy_ext = preg_replace('/\s+/', ' ',$v_proxy_ext); + $v_proxy_ext = trim($v_proxy_ext); + $v_proxy_ext = str_replace(' ', ", ", $v_proxy_ext); + $v_ftp = $_POST['v_ftp']; + $v_ftp_user = $_POST['v_ftp_user']; + $v_ftp_password = $_POST['v_ftp_password']; + $v_ftp_email = $_POST['v_ftp_email']; + + + // Add web domain + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-add-web-domain ".$user." ".$v_domain." ".$v_ip." 'no'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $domain_added = empty($_SESSION['error_msg']); + } + + // Add DNS domain + if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Add mail domain + if (($_POST['v_mail'] == 'on') && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-add-mail-domain ".$user." ".$v_domain, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Add domain aliases + if ((!empty($_POST['v_aliases'])) && (empty($_SESSION['error_msg']))) { + $valiases = preg_replace("/\n/", " ", $_POST['v_aliases']); + $valiases = preg_replace("/,/", " ", $valiases); + $valiases = preg_replace('/\s+/', ' ',$valiases); + $valiases = trim($valiases); + $aliases = explode(" ", $valiases); + foreach ($aliases as $alias) { + if ($alias == 'www.'.$_POST['v_domain']) { + $www_alias = 'yes'; + } else { + $alias = escapeshellarg($alias); + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-add-web-domain-alias ".$user." ".$v_domain." ".$alias." 'no'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-add-dns-on-web-alias ".$user." ".$v_domain." ".$alias." 'no'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + } + } + } + + // Delete www. alias if it wasn't found + if ((empty($www_alias)) && (empty($_SESSION['error_msg']))) { + $alias = preg_replace("/^www./i", "", $_POST['v_domain']); + $alias = 'www.'.$alias; + $alias = escapeshellarg($alias); + exec (VESTA_CMD."v-delete-web-domain-alias ".$user." ".$v_domain." ".$alias." 'no'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Add proxy support + if (($_POST['v_proxy'] == 'on') && (empty($_SESSION['error_msg']))) { + $ext = str_replace(' ', '', $v_proxy_ext); + $ext = escapeshellarg($ext); + exec (VESTA_CMD."v-add-web-domain-proxy ".$user." ".$v_domain." '' ".$ext." 'no'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Add SSL certificates + if ((!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) { + exec ('mktemp -d', $output, $return_var); + $tmpdir = $output[0]; + unset($output); + + // Save certificate + if (!empty($_POST['v_ssl_crt'])) { + $fp = fopen($tmpdir."/".$_POST['v_domain'].".crt", 'w'); + fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_crt'])); + fwrite($fp, "\n"); + fclose($fp); + } + + // Save private key + if (!empty($_POST['v_ssl_key'])) { + $fp = fopen($tmpdir."/".$_POST['v_domain'].".key", 'w'); + fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_key'])); + fwrite($fp, "\n"); + fclose($fp); + } + + // Save CA bundle + if (!empty($_POST['v_ssl_ca'])) { + $fp = fopen($tmpdir."/".$_POST['v_domain'].".ca", 'w'); + fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_ca'])); + fwrite($fp, "\n"); + fclose($fp); + } + + $v_ssl_home = escapeshellarg($_POST['v_ssl_home']); + exec (VESTA_CMD."v-add-web-domain-ssl ".$user." ".$v_domain." ".$tmpdir." ".$v_ssl_home." 'no'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Add web stats + if ((!empty($_POST['v_stats'])) && ($_POST['v_stats'] != 'none' ) && (empty($_SESSION['error_msg']))) { + $v_stats = escapeshellarg($_POST['v_stats']); + exec (VESTA_CMD."v-add-web-domain-stats ".$user." ".$v_domain." ".$v_stats, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Add web stats password + if ((!empty($_POST['v_stats_user'])) && (empty($_SESSION['error_msg']))) { + $v_stats_user = escapeshellarg($_POST['v_stats_user']); + $v_stats_password = escapeshellarg($_POST['v_stats_password']); + exec (VESTA_CMD."v-add-web-domain-stats-user ".$user." ".$v_domain." ".$v_stats_user." ".$v_stats_password, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Restart DNS server + if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-restart-dns", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Restart web server + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-restart-web", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Restart proxy server + if (($_POST['v_proxy'] == 'on') && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-restart-proxy", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Add FTP + if ((!empty($_POST['v_ftp'])) && (empty($_SESSION['error_msg']))) { + $v_ftp_users_updated = array(); + foreach ($_POST['v_ftp_user'] as $i => $v_ftp_user_data) { + if ($v_ftp_user_data['is_new'] == 1) { + 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 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); + } + + // Validate email + 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.'); + } + + // Check ftp password length + if ((!empty($v_ftp_user_data['v_ftp']))) { + if (!empty($v_ftp_user_data['v_ftp_user'])) { + $pw_len = strlen($v_ftp_user_data['v_ftp_password']); + if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg); + } + } + + $v_ftp_user_data['v_ftp_user'] = preg_replace("/^".$user."_/i", "", $v_ftp_user_data['v_ftp_user']); + $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_user_data['v_ftp_user']); + $v_ftp_password = escapeshellarg($v_ftp_user_data['v_ftp_password']); + + if ($domain_added) { + exec (VESTA_CMD."v-add-web-domain-ftp ".$user." ".$v_domain." ".$v_ftp_username." ".$v_ftp_password . " " . $v_ftp_user_data['v_ftp_path'], $output, $return_var); + check_return_code($return_var,$output); + unset($output); + if ((!empty($v_ftp_user_data['v_ftp_email'])) && (empty($_SESSION['error_msg']))) { + $to = $v_ftp_user_data['v_ftp_email']; + $subject = __("FTP login credentials"); + $from = __('MAIL_FROM',$_POST['v_domain']); + $mailtext = __('FTP_ACCOUNT_READY',$_POST['v_domain'],$user,$v_ftp_user_data['v_ftp_user'],$v_ftp_user_data['v_ftp_password']); + send_email($to, $subject, $mailtext, $from); + unset($v_ftp_email); + } + } else { + $return_var = -1; + } + + if ($return_var == 0) { + $v_ftp_password = "••••••••"; + $v_ftp_user_data['is_new'] = 0; + } else { + $v_ftp_user_data['is_new'] = 1; + } + + $v_ftp_username = preg_replace("/^".$user."_/", "", $v_ftp_user_data['v_ftp_user']); + $v_ftp_users_updated[] = array( + 'is_new' => $v_ftp_user_data['is_new'], + 'v_ftp_user' => $return_var == 0 ? $v_ftp_username_full : $v_ftp_username, + 'v_ftp_password' => $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 + ); + continue; + } + } + + if (!empty($_SESSION['error_msg']) && $domain_added) { + $_SESSION['ok_msg'] = __('WEB_DOMAIN_CREATED_OK',$_POST[v_domain],$_POST[v_domain]); + $_SESSION['flash_error_msg'] = $_SESSION['error_msg']; + $url = '/edit/web/?domain='.strtolower(preg_replace("/^www\./i", "", $_POST['v_domain'])); + header('Location: ' . $url); + exit; + } + } + + // Flush field values on success + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('WEB_DOMAIN_CREATED_OK',$_POST[v_domain],$_POST[v_domain]); + unset($v_domain); + unset($v_aliases); + unset($v_ssl); + unset($v_ssl_crt); + unset($v_ssl_key); + unset($v_ssl_ca); + unset($v_stats_user); + unset($v_stats_password); + unset($v_ftp); + } +} + + // Header include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); // Panel top_panel($user,$TAB); + +// Define user variables +$v_ftp_user_prepath = $panel[$user]['HOME'] . "/web"; $v_ftp_email = $panel[$user]['CONTACT']; - if (!empty($_POST['ok'])) { - // Check input - if (empty($_POST['v_domain'])) $errors[] = __('domain'); - if (empty($_POST['v_ip'])) $errors[] = __('ip'); - if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_crt']))) $errors[] = __('ssl certificate'); - if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_key']))) $errors[] = __('ssl key'); - if ((!empty($_POST['v_aliases'])) && ($_POST['v_aliases'] != 'www.'.$_POST['v_domain'])) $v_adv = 'yes'; - if ((!empty($_POST['v_ssl'])) || (!empty($_POST['v_elog']))) $v_adv = 'yes'; - if ((!empty($_POST['v_ssl_crt'])) || (!empty($_POST['v_ssl_key']))) $v_adv = 'yes'; - if ((!empty($_POST['v_ssl_ca'])) || ($_POST['v_stats'] != 'none')) $v_adv = 'yes'; - if (empty($_POST['v_proxy'])) $v_adv = 'yes'; - if (!empty($_POST['v_ftp'])) $v_adv = 'yes'; - $v_proxy_ext = 'jpeg, jpg, png, gif, bmp, ico, svg, tif, tiff, css, js, htm, html, ttf,'; - $v_proxy_ext .= 'otf, webp, woff, txt, csv, rtf, doc, docx, xls, xlsx, ppt, pptx, odf, '; - $v_proxy_ext .= 'odp, ods, odt, pdf, psd, ai, eot, eps, ps, zip, tar, tgz, gz, rar, '; - $v_proxy_ext .= 'bz2, 7z, aac, m4a, mp3, mp4, ogg, wav, wma, 3gp, avi, flv, m4v, mkv, '; - $v_proxy_ext .= 'mov, mp4, mpeg, mpg, wmv, exe, iso, dmg, swf'; - if ($_POST['v_proxy_ext'] != $v_proxy_ext) $v_adv = 'yes'; +// List IP addresses +exec (VESTA_CMD."v-list-user-ips ".$user." json", $output, $return_var); +$ips = json_decode(implode('', $output), true); +unset($output); - // Protect input - $v_domain = preg_replace("/^www\./i", "", $_POST['v_domain']); - $v_domain = escapeshellarg($v_domain); - $v_domain = strtolower($v_domain); - $v_ip = escapeshellarg($_POST['v_ip']); - if (empty($_POST['v_dns'])) $v_dns = 'off'; - if (empty($_POST['v_mail'])) $v_mail = 'off'; - if (empty($_POST['v_proxy'])) $v_proxy = 'off'; - $v_aliases = $_POST['v_aliases']; - $v_elog = $_POST['v_elog']; - $v_ssl = $_POST['v_ssl']; - $v_ssl_crt = $_POST['v_ssl_crt']; - $v_ssl_key = $_POST['v_ssl_key']; - $v_ssl_ca = $_POST['v_ssl_ca']; - $v_ssl_home = $data[$v_domain]['SSL_HOME']; - $v_stats = escapeshellarg($_POST['v_stats']); - $v_stats_user = $data[$v_domain]['STATS_USER']; - $v_stats_password = $data[$v_domain]['STATS_PASSWORD']; - $v_proxy_ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']); - $v_proxy_ext = preg_replace("/,/", " ", $v_proxy_ext); - $v_proxy_ext = preg_replace('/\s+/', ' ',$v_proxy_ext); - $v_proxy_ext = trim($v_proxy_ext); - $v_proxy_ext = str_replace(' ', ", ", $v_proxy_ext); - $v_ftp = $_POST['v_ftp']; - $v_ftp_user = $_POST['v_ftp_user']; - $v_ftp_password = $_POST['v_ftp_password']; - $v_ftp_email = $_POST['v_ftp_email']; +// List web stat engines +exec (VESTA_CMD."v-list-web-stats json", $output, $return_var); +$stats = json_decode(implode('', $output), true); +unset($output); - // Validate email - if ((!empty($_POST['v_ftp_email'])) && (!filter_var($_POST['v_ftp_email'], FILTER_VALIDATE_EMAIL))) { - $_SESSION['error_msg'] = __('Please enter valid email address.'); - } +// Display body +include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_web.html'); - // Check ftp password length - if ((!empty($_POST['v_ftp'])) && (empty($_SESSION['error_msg']))) { - if (!empty($_POST['v_ftp_user'])) { - $pw_len = strlen($_POST['v_ftp_password']); - if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg); - } - } - - // Check stats password length - if ((!empty($v_stats)) && (empty($_SESSION['error_msg']))) { - if (!empty($_POST['v_stats_user'])) { - $pw_len = strlen($_POST['v_stats_password']); - if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg); - } - } - - // Check for errors - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } - - if (empty($_SESSION['error_msg'])) { - // Add WEB - exec (VESTA_CMD."v-add-web-domain ".$user." ".$v_domain." ".$v_ip." 'no'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - - // Add DNS - if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - // Add Mail - if (($_POST['v_mail'] == 'on') && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-add-mail-domain ".$user." ".$v_domain, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - // Add Aliases - if ((!empty($_POST['v_aliases'])) && (empty($_SESSION['error_msg']))) { - $valiases = preg_replace("/\n/", " ", $_POST['v_aliases']); - $valiases = preg_replace("/,/", " ", $valiases); - $valiases = preg_replace('/\s+/', ' ',$valiases); - $valiases = trim($valiases); - $aliases = explode(" ", $valiases); - foreach ($aliases as $alias) { - if ($alias == 'www.'.$_POST['v_domain']) { - $www_alias = 'yes'; - } else { - $alias = escapeshellarg($alias); - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-add-web-domain-alias ".$user." ".$v_domain." ".$alias." 'no'", $output, $return_var); - check_return_code($return_var,$output); - } - unset($output); - if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-add-dns-on-web-alias ".$user." ".$v_domain." ".$alias." 'no'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - } - } - } - if ((empty($www_alias)) && (empty($_SESSION['error_msg']))) { - $alias = preg_replace("/^www./i", "", $_POST['v_domain']); - $alias = 'www.'.$alias; - $alias = escapeshellarg($alias); - exec (VESTA_CMD."v-delete-web-domain-alias ".$user." ".$v_domain." ".$alias." 'no'", $output, $return_var); - check_return_code($return_var,$output); - } - - - // Add proxy - if (($_POST['v_proxy'] == 'on') && (empty($_SESSION['error_msg']))) { - $ext = str_replace(' ', '', $v_proxy_ext); - $ext = escapeshellarg($ext); - exec (VESTA_CMD."v-add-web-domain-proxy ".$user." ".$v_domain." '' ".$ext." 'no'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - // Add SSL - if (!empty($_POST['v_ssl'])) { - exec ('mktemp -d', $output, $return_var); - $tmpdir = $output[0]; - - // Certificate - if (!empty($_POST['v_ssl_crt'])) { - $fp = fopen($tmpdir."/".$_POST['v_domain'].".crt", 'w'); - fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_crt'])); - fwrite($fp, "\n"); - fclose($fp); - } - - // Key - if (!empty($_POST['v_ssl_key'])) { - $fp = fopen($tmpdir."/".$_POST['v_domain'].".key", 'w'); - fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_key'])); - fwrite($fp, "\n"); - fclose($fp); - } - - // CA - if (!empty($_POST['v_ssl_ca'])) { - $fp = fopen($tmpdir."/".$_POST['v_domain'].".ca", 'w'); - fwrite($fp, str_replace("\r\n", "\n", $_POST['v_ssl_ca'])); - fwrite($fp, "\n"); - fclose($fp); - } - - $v_ssl_home = escapeshellarg($_POST['v_ssl_home']); - exec (VESTA_CMD."v-add-web-domain-ssl ".$user." ".$v_domain." ".$tmpdir." ".$v_ssl_home." 'no'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - // Add WebStats - if ((!empty($_POST['v_stats'])) && ($_POST['v_stats'] != 'none' ) && (empty($_SESSION['error_msg']))) { - $v_stats = escapeshellarg($_POST['v_stats']); - exec (VESTA_CMD."v-add-web-domain-stats ".$user." ".$v_domain." ".$v_stats, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - - if ((!empty($_POST['v_stats_user'])) && (empty($_SESSION['error_msg']))) { - $v_stats_user = escapeshellarg($_POST['v_stats_user']); - $v_stats_password = escapeshellarg($_POST['v_stats_password']); - exec (VESTA_CMD."v-add-web-domain-stats-user ".$user." ".$v_domain." ".$v_stats_user." ".$v_stats_password, $output, $return_var); - check_return_code($return_var,$output); - unset($v_stats_user); - unset($v_stats_password); - unset($output); - } - } - - - // Add FTP - if ((!empty($_POST['v_ftp'])) && (empty($_SESSION['error_msg']))) { - $v_ftp_user = escapeshellarg($_POST['v_ftp_user']); - $v_ftp_password = escapeshellarg($_POST['v_ftp_password']); - exec (VESTA_CMD."v-add-web-domain-ftp ".$user." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password, $output, $return_var); - check_return_code($return_var,$output); - if (empty($_SESSION['error_msg'])) { - if (!empty($v_ftp_email)) { - $to = $_POST['v_ftp_email']; - $subject = __("FTP login credentials"); - $hostname = exec('hostname'); - $from = __('MAIL_FROM',$hostname); - $mailtext .= __('FTP_ACCOUNT_READY',$_POST['v_domain'],$user,$_POST['v_ftp_user'],$_POST['v_ftp_password']); - send_email($to, $subject, $mailtext, $from); - } - } - unset($v_ftp); - unset($v_ftp_user); - unset($v_ftp_password); - unset($output); - } - - if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-restart-dns", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-restart-web", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-restart-proxy", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - unset($output); - $_SESSION['ok_msg'] = __('WEB_DOMAIN_CREATED_OK',$_POST[v_domain],$_POST[v_domain]); - unset($v_domain); - unset($v_aliases); - unset($v_ssl); - unset($v_ssl_crt); - unset($v_ssl_key); - unset($v_ssl_ca); - } - } - } - - exec (VESTA_CMD."v-list-user-ips ".$user." json", $output, $return_var); - $ips = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-web-stats json", $output, $return_var); - $stats = json_decode(implode('', $output), true); - unset($output); - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_web.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -//} +// Flush session messages +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/css/jquery-custom-dialogs.css b/web/css/jquery-custom-dialogs.css index f1a4fa752..f0cb265ab 100644 --- a/web/css/jquery-custom-dialogs.css +++ b/web/css/jquery-custom-dialogs.css @@ -35,7 +35,7 @@ ----------------------------------*/ /* Overlays */ -.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #e6e6e6;} +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #999;} /*! @@ -58,7 +58,7 @@ .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; color: #222222; } .ui-widget-content a { color: #222222; } -.ui-widget-header { background: #505050; color: #444; font-size: 10pt; font-weight: bold;} +.ui-widget-header { background: #777; color: #444; font-size: 10pt; font-weight: bold;} .ui-widget-header a { color: #222222; } /* Interaction Cues @@ -75,14 +75,14 @@ /* Icons ----------------------------------*/ -/* states and images */ +/* states and images .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); } .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } - +*/ /* positioning */ .ui-icon-carat-1-n { background-position: 0 0; } @@ -376,8 +376,8 @@ * http://docs.jquery.com/UI/Button#theming */ .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .10pt; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ -.ui-button { filter:chroma(color=#000000); cursor: pointer; color: #555; background-color: #ececec; border: 1px solid #e0e0e0; border-radius: 3px 3px 3px 3px; font-weight: bold; font-size: 14px; padding: 2px 16px; width: 108px; height: 34px; } -.ui-button:hover { border: 1px solid #f79b44; background-color: #f79b44; color: #fff;} +.ui-button { filter:chroma(color=#000000); cursor: pointer; color: #fff; background-color: #f79b44; border: 1px solid #f79b44; border-radius: 3px 3px 3px 3px; font-weight: bold; font-size: 14px; padding: 2px 16px; width: 108px; height: 34px; } +.ui-button:hover { border: 1px solid #9e9e9e; background-color: #9e9e9e; color: #fff;} .ui-button:active { background-color: #ccc; color: #fff; border: 1px solid #ccc; } .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ diff --git a/web/css/main.css b/web/css/main.css index b2a114e83..4e2c6ecfb 100644 --- a/web/css/main.css +++ b/web/css/main.css @@ -1,6 +1,6 @@ body { font-family: Arial, Helvetica, sans-serif; - background-color: #e1e8e8; + background-color: #75b0c5; margin: 0; padding: 0; border: 0; @@ -19,6 +19,9 @@ td { padding: 0; } +label { + cursor: pointer; +} .hidden { display: none; @@ -26,13 +29,33 @@ td { .top { width: 1000px; - position: fixed; background: #fff; - border-bottom: 1px solid #e1e8e8; } +.top.small .submenu{ + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.10); +} + + +.top .nav-logo .logo-container{ + background-color: #fff; + width: 167px; +} + +.top.small-logo .nav-logo .logo-container{ + position: fixed; +} +.top.small-logo .nav-logo img{ + margin: 29px 0 -4px 10px; + padding: 0 0 10px; +} + + .top-menu { height: 24px; background-color: #505050; + width: 1000px; + position: fixed; + z-index: 10; } .top-link { @@ -51,9 +74,9 @@ td { background-color: #f79b44; } -.top-link:active{ +.top-link:active { color: #333; - background-color: #f1f1f1; + background-color: #eee; } .top-selected-link { @@ -65,7 +88,7 @@ td { line-height: 22px; padding: 0 20px 2px; color: #333; - background-color: #f0f0f0; + background-color: #eee; } .top-selected-link:hover { @@ -75,7 +98,7 @@ td { .top-selected-link:active { color: #2361a1; - background-color: #f1f1f1; + background-color: #eee; } .top-user { @@ -93,7 +116,7 @@ td { color: #fff; } -.top-user:active{ +.top-user:active { color: #fff; background-color: #f79b44; } @@ -120,12 +143,21 @@ td { background-color: #999; } +.main-menu{ + display: block; + float: left; + margin-bottom: 1px; +} + .nav-logo { float: left; - height: 111px; + height: 139px; width: 167px; - margin: 0; - border-bottom: 1px solid #e1e8e8; + margin: 0 0 0px; +} + +.nav-logo img{ + margin: 56px 0 0 10px; } .nav-lnk { @@ -145,59 +177,96 @@ td { width: 119px; float:left; cursor: pointer; - border-bottom: 1px solid #e1e8e8; + padding-bottom: 2px; } .nav-block:hover { height:108px; - border-bottom: 4px solid #f79b44; + padding-bottom: 0; } .nav-selected-block { + padding-bottom: 0; font-family: Arial, Helvetica, sans-serif; margin: 0; - color: #2361a1; + color: #4a82be; height: 108px; width: 119px; float: left; - border-bottom: 4px solid #777777; cursor: pointer; } .nav-selected-block:hover { height:108px; - border-bottom: 4px solid #f79b44; } .nav-selected-block:active { color: #f79b44; } -.nav-header { - padding: 14px 0 0 6px; - margin: 0; - letter-spacing: -1.0px; - font-size: 16pt; - font-weight: bold; +.top .nav-block .marker, +.top .nav-selected-block .marker { + -webkit-transition: background .1s ease-in-out; + -moz-transition: background .1s ease-in-out; + -o-transition: background .1s ease-in-out; + transition: background .1s ease-in-out; + padding: 0; + height: 4px; + margin: 12px 0 0 0; + width: 100%; + background-color: #fff; } -.nav-selected-header { - padding: 14px 0 0 6px; - margin: 0; - letter-spacing: -1.0px; +.top .nav-selected-block .marker { + background-color: #777; + border-bottom: 1px solid #777; +} + +.top.small .marker{ + position: fixed; + top: 66px; + width: 119px; +} + +.nav-block:hover .marker{ + background-color: #f79b44; + border-bottom: 1px solid #f79b44; +} + +.nav-selected-block:hover .marker{ + background-color: #f79b44; + border-bottom: 1px solid #f79b44; +} + +.nav-header, .nav-selected-header { + background-color: #FFF; font-size: 16pt; font-weight: bold; + height: 27px; + letter-spacing: -1px; + margin: 0; + padding: 16px 0 0 6px; + position: fixed; + top: 24px; + width: 113px; + z-index: 10; +} + +.top.small .nav-header, .top.small .nav-selected-header{ + height: 38px; } .nav-counters { padding: 1px 0 0 6px; - margin: 0; + margin: 65px 0 0 0; height: 58px; line-height: 1.4em; font-size: 9pt; font-family: Arial, Helvetica, sans-serif; color: #333; decoration: none; + overflow: hidden; + opacity: 0.8; } .submenu { @@ -205,6 +274,19 @@ td { vertical-align: middle; float: left; width: 1000px; + border-bottom: 1px solid #e1e8e8; + border-top: 1px solid #e1e8e8; + background-color: #fff; + margin-bottom: -1px; +} + +.top.small .submenu{ + position: fixed; + top: 82px; +} + +.submenu .wrapper{ + padding: 11px 10px 14px 10px; } .submenu-button-block { @@ -226,7 +308,7 @@ td { } .submenu-button-select { - width: 20px; + width: 28px; height: 28px; cursor: pointer; color: #555; @@ -273,16 +355,26 @@ td { } .submenu-button-main:hover { - border: 1px solid #999; - background-color: #999; + border: 1px solid #aaa; + background-color: #adaeae; + + -webkit-transition: background .1s ease-in-out; + -moz-transition: background .1s ease-in-out; + -o-transition: background .1s ease-in-out; + transition: background .1s ease-in-out; } .submenu-button-select:hover { - border: 1px solid #f79b44; + border: 1px solid #adaeae; + background-color: #adaeae; + color: #fff; } .submenu-button-search:hover { - border: 1px solid #f79b44; + border: 1px solid #adaeae; + background-color: #adaeae; + color: #fff; + } .submenu-button-main:active { @@ -308,7 +400,7 @@ td { } .submenu-select-link { - color: #6A6A6A; + color: #6a6a6a; display: block; float: left; font-size: 8pt; @@ -331,21 +423,34 @@ td { .submenu-select-dropdown { font-family:Arial, Helvetica, sans-serif; font-size: 9pt; - color: #333333; + color: #333; display: block; float: left; height: 28px; margin: 0 4px 0 0; min-width: 138px; - background-color: #FFFFFF; - border: 1px solid #CCCCCC; + background-color: #fff; + border: 1px solid #ccc; border-radius: 3px 3px 3px 3px; padding: 4px 5px; } + +.submenu-select-dropdown:hover { + border: 1px solid #909090; +} + +.submenu-select-dropdown:focus { + border: 1px solid #f79b44; + background-color: #fffcd2; + color: #333; +} + + .submenu-select-dropdown option { padding: 5px 5px 5px 8px; } + .submenu-search-block { display: block; text-align: right; @@ -366,11 +471,13 @@ td { } .submenu-search-field:hover { - border: 1px solid #f79b44; + border: 1px solid #909090; } .submenu-search-field:focus { border: 1px solid #f79b44; + background-color: #FFFCD2; + color: #333; } .bottom { @@ -404,11 +511,11 @@ td { } .vst { - padding: 4px 4px 0 4px; + padding: 5px 7px 0 7px; margin: 0; text-decoration: none; color: #999; - font-size: 12pt; + font-size: 11pt; float: left; } @@ -422,11 +529,11 @@ td { } .vst-selected { - padding: 4px 4px 0 4px; + padding: 5px 7px 0 7px; margin: 0; text-decoration: none; color: #2361a1; - font-size: 12pt; + font-size: 11pt; float: left; } @@ -449,21 +556,18 @@ td { font-size: 12pt; text-align: left; vertical-align:top; - margin: 0; + margin: 1px 0 0 0; behavior:url("/css/csshover3.htc"); + background-color: #fff } .data a { text-decoration: none; } -.data-row:hover { - margin: 0; - background-color: #f0f0f0; -} -.data-row:active { - background-color: #f7f7d8; +.data-row.selected, .data-row.selected.suspended{ + background-color: #e4e9e9; } .datarowhover { @@ -530,7 +634,7 @@ td { .data-date { letter-spacing: 0.3em; font-size: 8pt; - color: #6A6A6A + color: #6a6a6a } .data-active { @@ -550,26 +654,36 @@ td { height: 16px; border-left: 1px solid #d3d3d3; font-size: 8pt; - padding: 2px 12px 1px 6px; + padding: 6px 11px 2px; letter-spacing: 0.1em; - color: #2361a1; + color: #3e7c91; text-decoration: none; cursor: pointer; } +.data-controls.edit{ + font-weight: bold; + letter-spacing: 0; +} + .data-controls:hover { color: #fff; background-color: #f79b44; } .data-controls:active { - background-color: #999 + background-color: #999; } + .data-controls img { border: 0px; } +.ch-toggle { + cursor: pointer; +} + .data-count { font-family: Arial, Helvetica, sans-serif; color: #505050; @@ -599,6 +713,14 @@ td { padding: 1px 0 2px 0; } +.suspended .domain { + color: #777; +} + +.domain.hostname { + font-size: 16pt; +} + .cron { color: #222; font-size: 18px; @@ -675,17 +797,17 @@ td { .vst-ok { font-size: 12pt; - color: #62a358; + color: #33691e; padding: 4px; } -.vst-ok a{ - color: #58934f; - text-decoration: none; +.vst-ok a { + color: #33691e; } -.vst-ok a:hover{ - text-decoration: underline; +.vst-ok a:hover { + background: #f79b44; + color: #fff; } .vst-error { @@ -713,11 +835,13 @@ td { } .vst-textinput:hover { - border: 1px solid #f79b44; + border: 1px solid #909090; } .vst-textinput:focus { border: 1px solid #f79b44; + background-color: #fffcd2; + color: #333; } .vst-textinput:disabled { @@ -737,17 +861,23 @@ td { } .vst-input:hover { - border: 1px solid #f79b44; + border: 1px solid #909090; } .vst-input:focus { border: 1px solid #f79b44; + background-color: #fffcd2; + color: #333; } .vst-input:disabled { background-color: #f1f1f1; } +.vst-input.long{ + width: 580px; +} + .vst-list { font-family:Arial, Helvetica, sans-serif; font-size: 12pt; @@ -767,7 +897,7 @@ td { padding: 5px; font-size: 12pt; border: 1px solid #f7f6ed; - margin: 2px 6px 0 0; + margin: 2px 6px 0 3px; } .vst-checkbox:hover { @@ -775,23 +905,23 @@ td { } .button { - filter:chroma(color=#000000); + filter:chroma(color=#000); cursor: pointer; border-radius: 3px 3px 3px 3px; - font-size: 14px; + font-size: 13px; font-weight: bold; - padding: 2px 16px; + padding: 1px 16px 3px 16px; width: 108px; height: 34px; - color: #555; - background-color: #fff; - border: 1px solid #ccc; + color: #fafafa; + border: 1px solid #f79b44; + background-color: #f79b44; } .button:hover { color: #fff; - border: 1px solid #f79b44; - background-color: #f79b44; + border: 1px solid #999; + background-color: #999; } .button:active { @@ -800,7 +930,7 @@ td { } .login-button { - filter:chroma(color=#000000); + filter:chroma(color=#000); cursor: pointer; border-radius: 3px 3px 3px 3px; font-size: 14px; @@ -809,14 +939,13 @@ td { width: 108px; height: 34px; color: #fff; - background-color: #999; - border: 1px solid #999; + background-color: #f79b44; + border: 1px solid #f79b44; } .login-button:hover { - color: #fff; - border: 1px solid #f79b44; - background-color: #f79b44; + border: 1px solid #adaeae; + background-color: #adaeae; } .login-button:active { @@ -864,7 +993,7 @@ td { background-color: #777; } -.fixed{ +.fixed { position: fixed; border: none; top: -3px; @@ -872,7 +1001,7 @@ td { background-color: #fff; } -*html .fixed{ +*html .fixed { position:absolute; position:fixed; _position:absolute; @@ -880,7 +1009,7 @@ td { _top:expression( eval(document.body.scrollTop) + 'px' ); } -#vstobjects{ +#vstobjects { padding-top: 193px; min-height: 372px; } @@ -911,7 +1040,7 @@ td { padding: 0 26px 0 0; } -.vestacp{ +.vestacp { font-size: 8pt; color: #505050; text-align: right; @@ -919,10 +1048,132 @@ td { .error { font-size: 10pt; - color: #dE6c5d; + color: #de6c5d; } .hint { font-size: 14pt; color: #7fa1cb; } + +.step-top { + padding-top: 42px; +} + +.step-bottom { + padding-bottom: 20px; +} + +.step-left { + padding-left: 50px; +} + +.input-label { + padding-top: 20px; +} + +.additional-control { + margin-left: 20px; + color: #2361a1; + border-bottom: 1px solid #f79b44; + font-size: 10pt; + letter-spacing: 0.1em; + cursor: pointer; +} + +.additional-control:hover { + color: #7fa1cb; +} + +.additional-control:active { + color: #fff; + background-color: #f79b44; +} + +.ftp-path-prefix { + color: #848483; + font-size: 13px; +} + +.ftp-path-value { + color: #333; + font-size: 13px; + font-weight: bold; +} + +.data .suspended { + background: url(/images/disabled_bg.png); +} + +.timer-container .refresh-timer { + border: 2px solid #c0d4a6; + border-radius: 14px; + height: 14px; + width: 14px; + margin: 10px; + float: left; + margin: 7px 10px 0 0; +} + +.timer-container .refresh-timer.paused{ + border: 2px solid #9f9f9f; +} + +.timer-container .refresh-timer.paused .loader-half.right, +.timer-container .refresh-timer.paused .loader-half.dark{ + background-color: #9F9F9F; +} + +.timer-container .loader-half { + border-radius: 0 14px 14px 0; + height: 14px; + width: 7px; + float: left; +} + +.timer-container .loader-half.left { + border-radius: 14px 0 0 14px; + background-color: #fff; +} + +.timer-container .loader-half.right { + margin-left: 7px; + background-color: #c0d4a6; +} + +.timer-container .loader-half.dark{ + background-color: #c0d4a6; +} + +.timer-container .movement{ + float: left; + width: 14px; + height: 14px; + position: absolute; +} + +.timer-container .movement.left { + z-index: 10; +} + +.timer-container .movement.right{ + transform: rotate(180deg); + -webkit-transform: rotate(180deg); +} + +.timer-container .timer-button{ + cursor: pointer; + text-decotation: underline; + margin: 11px 0 0 38px; + width: 15px; + float: left; + height: 10px; +} + +.timer-container .timer-button.pause{ + background: url(/images/pause.png) no-repeat ; +} + +.timer-container .timer-button.play{ + background: url(/images/start.png) no-repeat; +} diff --git a/web/edit/backup/exclusions/index.php b/web/edit/backup/exclusions/index.php index a9c09929e..3f0e81130 100644 --- a/web/edit/backup/exclusions/index.php +++ b/web/edit/backup/exclusions/index.php @@ -3,116 +3,129 @@ error_reporting(NULL); ob_start(); session_start(); - $TAB = 'BACKUP EXCLUSIONS'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); +// Edit as someone else? +if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { + $user=escapeshellarg($_GET['user']); +} + +// List backup exclustions +exec (VESTA_CMD."v-list-user-backup-exclusions ".$user." 'json'", $output, $return_var); +check_return_code($return_var,$output); +$data = json_decode(implode('', $output), true); +unset($output); + +// Parse web +$v_username = $user; +foreach ($data['WEB'] as $key => $value) { + if (!empty($value)){ + $v_web .= $key . ":" . $value. "\n"; + } else { + $v_web .= $key . "\n"; + } +} + +// Parse dns +foreach ($data['DNS'] as $key => $value) { + if (!empty($value)){ + $v_dns .= $key . ":" . $value. "\n"; + } else { + $v_dns .= $key . "\n"; + } +} + +// Parse mail +foreach ($data['MAIL'] as $key => $value) { + if (!empty($value)){ + $v_mail .= $key . ":" . $value. "\n"; + } else { + $v_mail .= $key . "\n"; + } +} + +// Parse databases +foreach ($data['DB'] as $key => $value) { + if (!empty($value)){ + $v_db .= $key . ":" . $value. "\n"; + } else { + $v_db .= $key . "\n"; + } +} + +// Parse user directories +foreach ($data['USER'] as $key => $value) { + if (!empty($value)){ + $v_userdir .= $key . ":" . $value. "\n"; + } else { + $v_userdir .= $key . "\n"; + } +} + +// Check POST request +if (!empty($_POST['save'])) { + $v_web = $_POST['v_web']; + $v_web_tmp = str_replace("\r\n", ",", $_POST['v_web']); + $v_web_tmp = rtrim($v_web_tmp, ","); + $v_web_tmp = "WEB=" . escapeshellarg($v_web_tmp); + + $v_dns = $_POST['v_dns']; + $v_dns_tmp = str_replace("\r\n", ",", $_POST['v_dns']); + $v_dns_tmp = rtrim($v_dns_tmp, ","); + $v_dns_tmp = "DNS=" . escapeshellarg($v_dns_tmp); + + $v_mail = $_POST['v_mail']; + $v_mail_tmp = str_replace("\r\n", ",", $_POST['v_mail']); + $v_mail_tmp = rtrim($v_mail_tmp, ","); + $v_mail_tmp = "MAIL=" . escapeshellarg($v_mail_tmp); + + $v_db = $_POST['v_db']; + $v_db_tmp = str_replace("\r\n", ",", $_POST['v_db']); + $v_db_tmp = rtrim($v_db_tmp, ","); + $v_db_tmp = "DB=" . escapeshellarg($v_db_tmp); + + $v_cron = $_POST['v_cron']; + $v_cron_tmp = str_replace("\r\n", ",", $_POST['v_cron']); + $v_cron_tmp = rtrim($v_cron_tmp, ","); + $v_cron_tmp = "CRON=" . escapeshellarg($v_cron_tmp); + + $v_userdir = $_POST['v_userdir']; + $v_userdir_tmp = str_replace("\r\n", ",", $_POST['v_userdir']); + $v_userdir_tmp = rtrim($v_userdir_tmp, ","); + $v_userdir_tmp = "USER=" . escapeshellarg($v_userdir_tmp); + + // Create temporary exeption list on a filesystem + exec ('mktemp', $mktemp_output, $return_var); + $tmp = $mktemp_output[0]; + $fp = fopen($tmp, 'w'); + fwrite($fp, $v_web_tmp . "\n" . $v_dns_tmp . "\n" . $v_mail_tmp . "\n" . $v_db_tmp . "\n" . $v_userdir_tmp . "\n"); + fclose($fp); + unset($mktemp_output); + + // Save changes + exec (VESTA_CMD."v-update-user-backup-exclusions ".$user." ".$tmp, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + + // Set success message + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __("Changes has been saved."); + } +} + + // Header include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); // Panel top_panel($user,$TAB); -// Edit as someone else? -if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { - $user=escapeshellarg($_GET['user']); -} - -exec (VESTA_CMD."v-list-user-backup-exclusions ".$user." 'json'", $output, $return_var); -check_return_code($return_var,$output); -if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $user; - - foreach ($data['WEB'] as $key => $value) { - if (!empty($value)){ - $v_web .= $key . ":" . $value. "\n"; - } else { - $v_web .= $key . "\n"; - } - } - - foreach ($data['DNS'] as $key => $value) { - if (!empty($value)){ - $v_dns .= $key . ":" . $value. "\n"; - } else { - $v_dns .= $key . "\n"; - } - } - - foreach ($data['MAIL'] as $key => $value) { - if (!empty($value)){ - $v_mail .= $key . ":" . $value. "\n"; - } else { - $v_mail .= $key . "\n"; - } - } - - foreach ($data['DB'] as $key => $value) { - if (!empty($value)){ - $v_db .= $key . ":" . $value. "\n"; - } else { - $v_db .= $key . "\n"; - } - } - - foreach ($data['USER'] as $key => $value) { - if (!empty($value)){ - $v_userdir .= $key . ":" . $value. "\n"; - } else { - $v_userdir .= $key . "\n"; - } - } - - - // Action - if (!empty($_POST['save'])) { - - $v_web = $_POST['v_web']; - $v_web_tmp = str_replace("\r\n", ",", $_POST['v_web']); - $v_web_tmp = rtrim($v_web_tmp, ","); - $v_web_tmp = "WEB=" . escapeshellarg($v_web_tmp); - - $v_dns = $_POST['v_dns']; - $v_dns_tmp = str_replace("\r\n", ",", $_POST['v_dns']); - $v_dns_tmp = rtrim($v_dns_tmp, ","); - $v_dns_tmp = "DNS=" . escapeshellarg($v_dns_tmp); - - $v_mail = $_POST['v_mail']; - $v_mail_tmp = str_replace("\r\n", ",", $_POST['v_mail']); - $v_mail_tmp = rtrim($v_mail_tmp, ","); - $v_mail_tmp = "MAIL=" . escapeshellarg($v_mail_tmp); - - $v_db = $_POST['v_db']; - $v_db_tmp = str_replace("\r\n", ",", $_POST['v_db']); - $v_db_tmp = rtrim($v_db_tmp, ","); - $v_db_tmp = "DB=" . escapeshellarg($v_db_tmp); - - $v_cron = $_POST['v_cron']; - $v_cron_tmp = str_replace("\r\n", ",", $_POST['v_cron']); - $v_cron_tmp = rtrim($v_cron_tmp, ","); - $v_cron_tmp = "CRON=" . escapeshellarg($v_cron_tmp); - - $v_userdir = $_POST['v_userdir']; - $v_userdir_tmp = str_replace("\r\n", ",", $_POST['v_userdir']); - $v_userdir_tmp = rtrim($v_userdir_tmp, ","); - $v_userdir_tmp = "USER=" . escapeshellarg($v_userdir_tmp); - - exec ('mktemp', $mktemp_output, $return_var); - $tmp = $mktemp_output[0]; - $fp = fopen($tmp, 'w'); - fwrite($fp, $v_web_tmp . "\n" . $v_dns_tmp . "\n" . $v_mail_tmp . "\n" . $v_db_tmp . "\n" . $v_userdir_tmp . "\n"); - fclose($fp); - exec (VESTA_CMD."v-update-user-backup-exclusions ".$user." ".$tmp, $output, $return_var); - check_return_code($return_var,$output); - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __("Changes has been saved."); - } - } -} - +// Display body include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_backup_exclusions.html'); + +// Flush session messages unset($_SESSION['error_msg']); unset($_SESSION['ok_msg']); diff --git a/web/edit/cron/index.php b/web/edit/cron/index.php index c5929b405..09d63cb5e 100644 --- a/web/edit/cron/index.php +++ b/web/edit/cron/index.php @@ -3,73 +3,79 @@ error_reporting(NULL); ob_start(); session_start(); - $TAB = 'CRON'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); +// Edit as someone else? +if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { + $user=escapeshellarg($_GET['user']); +} + +// Check job id +if (empty($_GET['job'])) { + header("Location: /list/cron/"); + exit; +} + +// List cron job +$v_job = escapeshellarg($_GET['job']); +exec (VESTA_CMD."v-list-cron-job ".$user." ".$v_job." 'json'", $output, $return_var); +check_return_code($return_var,$output); +$data = json_decode(implode('', $output), true); +unset($output); + +// Parse cron job +$v_username = $user; +$v_job = $_GET['job']; +$v_min = $data[$v_job]['MIN']; +$v_hour = $data[$v_job]['HOUR']; +$v_day = $data[$v_job]['DAY']; +$v_month = $data[$v_job]['MONTH']; +$v_wday = $data[$v_job]['WDAY']; +$v_cmd = $data[$v_job]['CMD']; +$v_date = $data[$v_job]['DATE']; +$v_time = $data[$v_job]['TIME']; +$v_suspended = $data[$v_job]['SUSPENDED']; +if ( $v_suspended == 'yes' ) { + $v_status = 'suspended'; +} else { + $v_status = 'active'; +} + +// Check POST request +if (!empty($_POST['save'])) { + $v_username = $user; + $v_min = escapeshellarg($_POST['v_min']); + $v_hour = escapeshellarg($_POST['v_hour']); + $v_day = escapeshellarg($_POST['v_day']); + $v_month = escapeshellarg($_POST['v_month']); + $v_wday = escapeshellarg($_POST['v_wday']); + $v_cmd = escapeshellarg($_POST['v_cmd']); + + // Save changes + exec (VESTA_CMD."v-change-cron-job ".$v_username." ".$v_job." ".$v_min." ".$v_hour." ".$v_day." ".$v_month." ".$v_wday." ".$v_cmd, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + + $v_cmd = $_POST['v_cmd']; + + // Set success message + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __("Changes has been saved."); + } +} + // Header include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); // Panel top_panel($user,$TAB); -// Edit as someone else? -if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { - $user=escapeshellarg($_GET['user']); -} - -// Check user argument? -if (empty($_GET['job'])) { - header("Location: /list/cron/"); - exit; -} - -$v_job = escapeshellarg($_GET['job']); -exec (VESTA_CMD."v-list-cron-job ".$user." ".$v_job." 'json'", $output, $return_var); -check_return_code($return_var,$output); -if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $user; - $v_job = $_GET['job']; - $v_min = $data[$v_job]['MIN']; - $v_hour = $data[$v_job]['HOUR']; - $v_day = $data[$v_job]['DAY']; - $v_month = $data[$v_job]['MONTH']; - $v_wday = $data[$v_job]['WDAY']; - $v_cmd = $data[$v_job]['CMD']; - $v_date = $data[$v_job]['DATE']; - $v_time = $data[$v_job]['TIME']; - $v_suspended = $data[$v_job]['SUSPENDED']; - if ( $v_suspended == 'yes' ) { - $v_status = 'suspended'; - } else { - $v_status = 'active'; - } - - // Action - if (!empty($_POST['save'])) { - $v_username = $user; - // Change job - if (($v_min != $_POST['v_min']) || ($v_hour != $_POST['v_hour']) || ($v_day != $_POST['v_day']) || ($v_month != $_POST['v_month']) || ($v_wday != $_POST['v_wday']) || ($v_cmd != $_POST['v_cmd']) &&(empty($_SESSION['error_msg']))) { - $v_min = escapeshellarg($_POST['v_min']); - $v_hour = escapeshellarg($_POST['v_hour']); - $v_day = escapeshellarg($_POST['v_day']); - $v_month = escapeshellarg($_POST['v_month']); - $v_wday = escapeshellarg($_POST['v_wday']); - $v_cmd = escapeshellarg($_POST['v_cmd']); - exec (VESTA_CMD."v-change-cron-job ".$v_username." ".$v_job." ".$v_min." ".$v_hour." ".$v_day." ".$v_month." ".$v_wday." ".$v_cmd, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $v_cmd = $_POST['v_cmd']; - } - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __("Changes has been saved."); - } - } -} - +// Display body include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_cron.html'); + +// Flush session messages unset($_SESSION['error_msg']); unset($_SESSION['ok_msg']); diff --git a/web/edit/db/index.php b/web/edit/db/index.php index 435bbb17f..c64e53046 100644 --- a/web/edit/db/index.php +++ b/web/edit/db/index.php @@ -3,8 +3,8 @@ error_reporting(NULL); ob_start(); session_start(); - $TAB = 'DB'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header @@ -13,6 +13,7 @@ include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); // Panel top_panel($user,$TAB); +// Check database id if (empty($_GET['database'])) { header("Location: /list/db/"); exit; @@ -23,69 +24,63 @@ if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { $user=escapeshellarg($_GET['user']); } +// List datbase $v_database = escapeshellarg($_GET['database']); exec (VESTA_CMD."v-list-database ".$user." ".$v_database." 'json'", $output, $return_var); check_return_code($return_var,$output); -if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); - unset($output); +$data = json_decode(implode('', $output), true); +unset($output); + +// Parse database +$v_username = $user; +$v_database = $_GET['database']; +$v_dbuser = $data[$v_database]['DBUSER']; +$v_password = "••••••••"; +$v_host = $data[$v_database]['HOST']; +$v_type = $data[$v_database]['TYPE']; +$v_charset = $data[$v_database]['CHARSET']; +$v_date = $data[$v_database]['DATE']; +$v_time = $data[$v_database]['TIME']; +$v_suspended = $data[$v_database]['SUSPENDED']; +if ( $v_suspended == 'yes' ) { + $v_status = 'suspended'; +} else { + $v_status = 'active'; +} + +// Check POST request +if (!empty($_POST['save'])) { $v_username = $user; - $v_database = $_GET['database']; - $v_dbuser = $data[$v_database]['DBUSER']; - $v_password = "••••••••"; - $v_host = $data[$v_database]['HOST']; - $v_type = $data[$v_database]['TYPE']; - $v_charset = $data[$v_database]['CHARSET']; - $v_date = $data[$v_database]['DATE']; - $v_time = $data[$v_database]['TIME']; - $v_suspended = $data[$v_database]['SUSPENDED']; - if ( $v_suspended == 'yes' ) { - $v_status = 'suspended'; - } else { - $v_status = 'active'; + + // Change database user + if (($v_dbuser != $_POST['v_dbuser']) && (empty($_SESSION['error_msg']))) { + $v_dbuser = preg_replace("/^".$user."_/", "", $_POST['v_dbuser']); + $v_dbuser = escapeshellarg($v_dbuser); + exec (VESTA_CMD."v-change-database-user ".$v_username." ".$v_database." ".$v_dbuser, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $v_dbuser = $user."_".preg_replace("/^".$user."_/", "", $_POST['v_dbuser']); } - // Action - if (!empty($_POST['save'])) { - $v_username = $user; + // Change database password + if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { + $v_password = escapeshellarg($_POST['v_password']); + exec (VESTA_CMD."v-change-database-password ".$v_username." ".$v_database." ".$v_password, $output, $return_var); + check_return_code($return_var,$output); + $v_password = "••••••••"; + unset($output); + } - // Change database username - if (($v_dbuser != $_POST['v_dbuser']) && (empty($_SESSION['error_msg']))) { - $v_dbuser = preg_replace("/^".$user."_/", "", $_POST['v_dbuser']); - $v_dbuser = escapeshellarg($v_dbuser); - if ($v_password != $_POST['v_password']) { - // Change username and password - $v_password = escapeshellarg($_POST['v_password']); - exec (VESTA_CMD."v-change-database-user ".$v_username." ".$v_database." ".$v_dbuser." ".$v_password, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $v_dbuser = $user."_".preg_replace("/^".$user."_/", "", $_POST['v_dbuser']); - $v_password = "••••••••"; - $v_pw_changed = 'yes'; - } else { - // Change only username - exec (VESTA_CMD."v-change-database-user ".$v_username." ".$v_database." ".$v_dbuser, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $v_dbuser = $user."_".preg_replace("/^".$user."_/", "", $_POST['v_dbuser']); - } - } - - // Change only database password - if (($v_password != $_POST['v_password']) && (!isset($v_pw_changed)) && (empty($_SESSION['error_msg']))) { - $v_password = escapeshellarg($_POST['v_password']); - exec (VESTA_CMD."v-change-database-password ".$v_username." ".$v_database." ".$v_password, $output, $return_var); - check_return_code($return_var,$output); - $v_password = "••••••••"; - unset($output); - } - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('Changes has been saved.'); - } + // Set success message + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('Changes has been saved.'); } } +// Display body include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_db.html'); + +// Flush session messages unset($_SESSION['error_msg']); unset($_SESSION['ok_msg']); diff --git a/web/edit/dns/index.php b/web/edit/dns/index.php index cd6a1c179..d07d1a6dd 100644 --- a/web/edit/dns/index.php +++ b/web/edit/dns/index.php @@ -3,17 +3,11 @@ error_reporting(NULL); ob_start(); session_start(); - $TAB = 'DNS'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); -// Header -include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); - -// Panel -top_panel($user,$TAB); - -// Check user argument? +// Check domain name if (empty($_GET['domain'])) { header("Location: /list/dns/"); exit; @@ -24,163 +18,194 @@ if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { $user=escapeshellarg($_GET['user']); } -// Check domain +// List dns domain if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) { $v_domain = escapeshellarg($_GET['domain']); exec (VESTA_CMD."v-list-dns-domain ".$user." ".$v_domain." json", $output, $return_var); check_return_code($return_var,$output); + $data = json_decode(implode('', $output), true); + unset($output); + + // Parse dns domain + $v_username = $user; + $v_domain = $_GET['domain']; + $v_ip = $data[$v_domain]['IP']; + $v_template = $data[$v_domain]['TPL']; + $v_ttl = $data[$v_domain]['TTL']; + $v_exp = $data[$v_domain]['EXP']; + $v_soa = $data[$v_domain]['SOA']; + $v_date = $data[$v_domain]['DATE']; + $v_time = $data[$v_domain]['TIME']; + $v_suspended = $data[$v_domain]['SUSPENDED']; + if ( $v_suspended == 'yes' ) { + $v_status = 'suspended'; + } else { + $v_status = 'active'; + } + + // List dns templates + exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var); + $templates = json_decode(implode('', $output), true); + unset($output); +} + +// List dns record +if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) { + $v_domain = escapeshellarg($_GET['domain']); + $v_record_id = escapeshellarg($_GET['record_id']); + exec (VESTA_CMD."v-list-dns-records ".$user." ".$v_domain." 'json'", $output, $return_var); + check_return_code($return_var,$output); + $data = json_decode(implode('', $output), true); + unset($output); + + // Parse dns record + $v_username = $user; + $v_domain = $_GET['domain']; + $v_record_id = $_GET['record_id']; + $v_rec = $data[$v_record_id]['RECORD']; + $v_type = $data[$v_record_id]['TYPE']; + $v_val = $data[$v_record_id]['VALUE']; + $v_priority = $data[$v_record_id]['PRIORITY']; + $v_suspended = $data[$v_record_id]['SUSPENDED']; + if ( $v_suspended == 'yes' ) { + $v_status = 'suspended'; + } else { + $v_status = 'active'; + } + $v_date = $data[$v_record_id]['DATE']; + $v_time = $data[$v_record_id]['TIME']; +} + +// Check POST request for dns domain +if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (empty($_GET['record_id']))) { + $v_domain = escapeshellarg($_POST['v_domain']); + + // Change domain IP + if (($v_ip != $_POST['v_ip']) && (empty($_SESSION['error_msg']))) { + $v_ip = escapeshellarg($_POST['v_ip']); + exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var); + check_return_code($return_var,$output); + $restart_dns = 'yes'; + unset($output); + } + + // Change domain template + if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) { + $v_template = escapeshellarg($_POST['v_template']); + exec (VESTA_CMD."v-change-dns-domain-tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $restart_dns = 'yes'; + } + + // Change SOA record + if (($v_soa != $_POST['v_soa']) && (empty($_SESSION['error_msg']))) { + $v_soa = escapeshellarg($_POST['v_soa']); + exec (VESTA_CMD."v-change-dns-domain-soa ".$v_username." ".$v_domain." ".$v_soa." 'no'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $restart_dns = 'yes'; + } + + // Change expiriation date + if (($v_exp != $_POST['v_exp']) && (empty($_SESSION['error_msg']))) { + $v_exp = escapeshellarg($_POST['v_exp']); + exec (VESTA_CMD."v-change-dns-domain-exp ".$v_username." ".$v_domain." ".$v_exp." 'no'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Change domain ttl + if (($v_ttl != $_POST['v_ttl']) && (empty($_SESSION['error_msg']))) { + $v_ttl = escapeshellarg($_POST['v_ttl']); + exec (VESTA_CMD."v-change-dns-domain-ttl ".$v_username." ".$v_domain." ".$v_ttl." 'no'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $restart_dns = 'yes'; + } + + // Restart dns server + if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-restart-dns", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Set success message if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); + $_SESSION['ok_msg'] = __('Changes has been saved.'); + } +} + +// Check POST request for dns record +if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['record_id']))) { + // Protect input + $v_domain = escapeshellarg($_POST['v_domain']); + $v_record_id = escapeshellarg($_POST['v_record_id']); + + // Change dns record + if (($v_val != $_POST['v_val']) || ($v_priority != $_POST['v_priority']) && (empty($_SESSION['error_msg']))) { + $v_val = escapeshellarg($_POST['v_val']); + $v_priority = escapeshellarg($_POST['v_priority']); + exec (VESTA_CMD."v-change-dns-record ".$v_username." ".$v_domain." ".$v_record_id." ".$v_val." ".$v_priority, $output, $return_var); + check_return_code($return_var,$output); + $v_val = $_POST['v_val']; unset($output); - $v_username = $user; - $v_domain = $_GET['domain']; - $v_ip = $data[$v_domain]['IP']; - $v_template = $data[$v_domain]['TPL']; - $v_ttl = $data[$v_domain]['TTL']; - $v_exp = $data[$v_domain]['EXP']; - $v_soa = $data[$v_domain]['SOA']; - $v_date = $data[$v_domain]['DATE']; - $v_time = $data[$v_domain]['TIME']; - $v_suspended = $data[$v_domain]['SUSPENDED']; - if ( $v_suspended == 'yes' ) { - $v_status = 'suspended'; - } else { - $v_status = 'active'; - } - exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var); - $templates = json_decode(implode('', $output), true); + $restart_dns = 'yes'; + } + + // Change dns record id + if (($_GET['record_id'] != $_POST['v_record_id']) && (empty($_SESSION['error_msg']))) { + $v_old_record_id = escapeshellarg($_GET['record_id']); + exec (VESTA_CMD."v-change-dns-record-id ".$v_username." ".$v_domain." ".$v_old_record_id." ".$v_record_id, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $restart_dns = 'yes'; + } + + // Restart dns server + if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-restart-dns", $output, $return_var); + check_return_code($return_var,$output); unset($output); } - // Action - if (!empty($_POST['save'])) { - $v_domain = escapeshellarg($_POST['v_domain']); - - // IP - if (($v_ip != $_POST['v_ip']) && (empty($_SESSION['error_msg']))) { - $v_ip = escapeshellarg($_POST['v_ip']); - exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var); - check_return_code($return_var,$output); - $restart_dns = 'yes'; - unset($output); - } - - // Template - if (( $_SESSION['user'] == 'admin') && ($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) { - $v_template = escapeshellarg($_POST['v_template']); - exec (VESTA_CMD."v-change-dns-domain-tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $restart_dns = 'yes'; - } - - // SOA - if (($v_soa != $_POST['v_soa']) && (empty($_SESSION['error_msg']))) { - $v_soa = escapeshellarg($_POST['v_soa']); - exec (VESTA_CMD."v-change-dns-domain-soa ".$v_username." ".$v_domain." ".$v_soa." 'no'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $restart_dns = 'yes'; - } - - // EXP - if (($v_exp != $_POST['v_exp']) && (empty($_SESSION['error_msg']))) { - $v_exp = escapeshellarg($_POST['v_exp']); - exec (VESTA_CMD."v-change-dns-domain-exp ".$v_username." ".$v_domain." ".$v_exp." 'no'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $restart_dns = 'yes'; - } - - // TTL - if (($v_ttl != $_POST['v_ttl']) && (empty($_SESSION['error_msg']))) { - $v_ttl = escapeshellarg($_POST['v_ttl']); - exec (VESTA_CMD."v-change-dns-domain-ttl ".$v_username." ".$v_domain." ".$v_ttl." 'no'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $restart_dns = 'yes'; - } - - // Restart dns - if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-restart-dns", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('Changes has been saved.'); - } + // Set success message + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('Changes has been saved.'); } + // Change url if record id was changed + if ((empty($_SESSION['error_msg'])) && ($_GET['record_id'] != $_POST['v_record_id'])) { + header("Location: /edit/dns/?domain=".$_GET['domain']."&record_id=".$_POST['v_record_id']); + exit; + } +} + +// Header +include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); + +// Panel +top_panel($user,$TAB); + +// Display body for dns domain +if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) { if ($_SESSION['user'] == 'admin') { include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns.html'); } else { include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_dns.html'); } - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} else { - $v_domain = escapeshellarg($_GET['domain']); - $v_record_id = escapeshellarg($_GET['record_id']); - exec (VESTA_CMD."v-list-dns-records ".$user." ".$v_domain." 'json'", $output, $return_var); - check_return_code($return_var,$output); - if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $user; - $v_domain = $_GET['domain']; - $v_record_id = $_GET['record_id']; - $v_rec = $data[$v_record_id]['RECORD']; - $v_type = $data[$v_record_id]['TYPE']; - $v_val = $data[$v_record_id]['VALUE']; - $v_priority = $data[$v_record_id]['PRIORITY']; - $v_suspended = $data[$v_record_id]['SUSPENDED']; - if ( $v_suspended == 'yes' ) { - $v_status = 'suspended'; - } else { - $v_status = 'active'; - } - $v_date = $data[$v_record_id]['DATE']; - $v_time = $data[$v_record_id]['TIME']; - } - - // Action - if (!empty($_POST['save'])) { - $v_domain = escapeshellarg($_POST['v_domain']); - $v_record_id = escapeshellarg($_POST['v_record_id']); - if (($v_val != $_POST['v_val']) || ($v_priority != $_POST['v_priority']) && (empty($_SESSION['error_msg']))) { - $v_val = escapeshellarg($_POST['v_val']); - $v_priority = escapeshellarg($_POST['v_priority']); - exec (VESTA_CMD."v-change-dns-record ".$v_username." ".$v_domain." ".$v_record_id." ".$v_val." ".$v_priority, $output, $return_var); - check_return_code($return_var,$output); - $v_val = $_POST['v_val']; - $restart_dns = 'yes'; - unset($output); - } - - if (($_GET['record_id'] != $_POST['v_record_id']) && (empty($_SESSION['error_msg']))) { - $v_old_record_id = escapeshellarg($_GET['record_id']); - exec (VESTA_CMD."v-change-dns-record-id ".$v_username." ".$v_domain." ".$v_old_record_id." ".$v_record_id, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('Changes has been saved.'); - } - - if ((empty($_SESSION['error_msg'])) && ($_GET['record_id'] != $_POST['v_record_id'])) { - header("Location: /edit/dns/?domain=".$_GET['domain']."&record_id=".$_POST['v_record_id']); - exit; - } - } - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns_rec.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); } +// List dns record +if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) { + // Display body for dns record + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns_rec.html'); +} + +// Flush session messages +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/edit/ip/index.php b/web/edit/ip/index.php index c6cdf2de9..bec1ae58f 100644 --- a/web/edit/ip/index.php +++ b/web/edit/ip/index.php @@ -3,107 +3,114 @@ error_reporting(NULL); ob_start(); session_start(); - $TAB = 'IP'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); +// Check user +if ($_SESSION['user'] != 'admin') { + header("Location: /list/user"); + exit; +} + +// Check ip argument +if (empty($_GET['ip'])) { + header("Location: /list/ip/"); + exit; +} + +// List ip +$v_ip = escapeshellarg($_GET['ip']); +exec (VESTA_CMD."v-list-sys-ip ".$v_ip." 'json'", $output, $return_var); +check_return_code($return_var,$output); +$data = json_decode(implode('', $output), true); +unset($output); + +// Parse ip +$v_username = $user; +$v_ip = $_GET['ip']; +$v_netmask = $data[$v_ip]['NETMASK']; +$v_interace = $data[$v_ip]['INTERFACE']; +$v_name = $data[$v_ip]['NAME']; +$v_nat = $data[$v_ip]['NAT']; +$v_ipstatus = $data[$v_ip]['STATUS']; +if ($v_ipstatus == 'dedicated') $v_dedicated = 'yes'; +$v_owner = $data[$v_ip]['OWNER']; +$v_date = $data[$v_ip]['DATE']; +$v_time = $data[$v_ip]['TIME']; +$v_suspended = $data[$v_ip]['SUSPENDED']; +if ( $v_suspended == 'yes' ) { + $v_status = 'suspended'; +} else { + $v_status = 'active'; +} + +// List users +exec (VESTA_CMD."v-list-sys-users 'json'", $output, $return_var); +$users = json_decode(implode('', $output), true); +unset($output); + +// Check POST request +if (!empty($_POST['save'])) { + $v_ip = escapeshellarg($_POST['v_ip']); + + // Change Status + if (($v_ipstatus == 'shared') && (empty($_POST['v_shared'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-change-sys-ip-status ".$v_ip." 'dedicated'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $v_dedicated = 'yes'; + } + if (($v_ipstatus == 'dedicated') && (!empty($_POST['v_shared'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-change-sys-ip-status ".$v_ip." 'shared'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + unset($v_dedicated); + } + + // Change owner + if (($v_owner != $_POST['v_owner']) && (empty($_SESSION['error_msg']))) { + $v_owner = escapeshellarg($_POST['v_owner']); + exec (VESTA_CMD."v-change-sys-ip-owner ".$v_ip." ".$v_owner, $output, $return_var); + check_return_code($return_var,$output); + $v_owner = $_POST['v_owner']; + unset($output); + } + + // Change associated domain + if (($v_name != $_POST['v_name']) && (empty($_SESSION['error_msg']))) { + $v_name = escapeshellarg($_POST['v_name']); + exec (VESTA_CMD."v-change-sys-ip-name ".$v_ip." ".$v_name, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Change NAT address + if (($v_nat != $_POST['v_nat']) && (empty($_SESSION['error_msg']))) { + $v_nat = escapeshellarg($_POST['v_nat']); + exec (VESTA_CMD."v-change-sys-ip-nat ".$v_ip." ".$v_nat, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Set success message + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('Changes has been saved.'); + } +} + // Header include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); // Panel top_panel($user,$TAB); -// Are you admin? -if ($_SESSION['user'] == 'admin') { +// Display body +include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_ip.html'); - // Check user argument? - if (empty($_GET['ip'])) { - header("Location: /list/ip/"); - exit; - } - - $v_ip = escapeshellarg($_GET['ip']); - exec (VESTA_CMD."v-list-sys-ip ".$v_ip." 'json'", $output, $return_var); - check_return_code($return_var,$output); - if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $user; - $v_ip = $_GET['ip']; - $v_netmask = $data[$v_ip]['NETMASK']; - $v_interace = $data[$v_ip]['INTERFACE']; - $v_name = $data[$v_ip]['NAME']; - $v_nat = $data[$v_ip]['NAT']; - $v_ipstatus = $data[$v_ip]['STATUS']; - if ($v_ipstatus == 'dedicated') $v_dedicated = 'yes'; - $v_owner = $data[$v_ip]['OWNER']; - $v_date = $data[$v_ip]['DATE']; - $v_time = $data[$v_ip]['TIME']; - $v_suspended = $data[$v_ip]['SUSPENDED']; - if ( $v_suspended == 'yes' ) { - $v_status = 'suspended'; - } else { - $v_status = 'active'; - } - - exec (VESTA_CMD."v-list-sys-users 'json'", $output, $return_var); - $users = json_decode(implode('', $output), true); - unset($output); - - // Action - if (!empty($_POST['save'])) { - $v_username = $user; - $v_ip = escapeshellarg($_POST['v_ip']); - - // Change Status - if (($v_ipstatus == 'shared') && (empty($_POST['v_shared'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-change-sys-ip-status ".$v_ip." 'dedicated'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $v_dedicated = 'yes'; - } - if (($v_ipstatus == 'dedicated') && (!empty($_POST['v_shared'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-change-sys-ip-status ".$v_ip." 'shared'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - unset($v_dedicated); - } - - // Change owner - if (($v_owner != $_POST['v_owner']) && (empty($_SESSION['error_msg']))) { - $v_owner = escapeshellarg($_POST['v_owner']); - exec (VESTA_CMD."v-change-sys-ip-owner ".$v_ip." ".$v_owner, $output, $return_var); - check_return_code($return_var,$output); - $v_owner = $_POST['v_owner']; - unset($output); - } - - // Change Name - if (($v_name != $_POST['v_name']) && (empty($_SESSION['error_msg']))) { - $v_name = escapeshellarg($_POST['v_name']); - exec (VESTA_CMD."v-change-sys-ip-name ".$v_ip." ".$v_name, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - // Change Nat - if (($v_nat != $_POST['v_nat']) && (empty($_SESSION['error_msg']))) { - $v_nat = escapeshellarg($_POST['v_nat']); - exec (VESTA_CMD."v-change-sys-ip-nat ".$v_ip." ".$v_nat, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('Changes has been saved.'); - } - } - } - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_ip.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} +// Flush session messages +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/edit/mail/index.php b/web/edit/mail/index.php index c70c6c896..6ff029351 100644 --- a/web/edit/mail/index.php +++ b/web/edit/mail/index.php @@ -3,8 +3,8 @@ error_reporting(NULL); ob_start(); session_start(); - $TAB = 'MAIL'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header @@ -13,7 +13,7 @@ include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); // Panel top_panel($user,$TAB); -// Check user argument? +// Check domain argument if (empty($_GET['domain'])) { header("Location: /list/mail/"); exit; @@ -23,272 +23,289 @@ if (empty($_GET['domain'])) { if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { $user=escapeshellarg($_GET['user']); } +$v_username = $user; -// Check domain +// List mail domain if ((!empty($_GET['domain'])) && (empty($_GET['account']))) { $v_domain = escapeshellarg($_GET['domain']); exec (VESTA_CMD."v-list-mail-domain ".$user." ".$v_domain." json", $output, $return_var); - check_return_code($return_var,$output); - if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $user; - $v_domain = $_GET['domain']; - $v_antispam = $data[$v_domain]['ANTISPAM']; - $v_antivirus = $data[$v_domain]['ANTIVIRUS']; - $v_dkim = $data[$v_domain]['DKIM']; - $v_catchall = $data[$v_domain]['CATCHALL']; - $v_date = $data[$v_domain]['DATE']; - $v_time = $data[$v_domain]['TIME']; - $v_suspended = $data[$v_domain]['SUSPENDED']; - if ( $v_suspended == 'yes' ) { - $v_status = 'suspended'; - } else { - $v_status = 'active'; - } + $data = json_decode(implode('', $output), true); + unset($output); + + // Parse domain + $v_domain = $_GET['domain']; + $v_antispam = $data[$v_domain]['ANTISPAM']; + $v_antivirus = $data[$v_domain]['ANTIVIRUS']; + $v_dkim = $data[$v_domain]['DKIM']; + $v_catchall = $data[$v_domain]['CATCHALL']; + $v_date = $data[$v_domain]['DATE']; + $v_time = $data[$v_domain]['TIME']; + $v_suspended = $data[$v_domain]['SUSPENDED']; + if ( $v_suspended == 'yes' ) { + $v_status = 'suspended'; + } else { + $v_status = 'active'; } +} - // Action - if (!empty($_POST['save'])) { - $v_domain = escapeshellarg($_POST['v_domain']); - // Antispam - if (($v_antispam == 'yes') && (empty($_POST['v_antispam'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-delete-mail-domain-antispam ".$v_username." ".$v_domain, $output, $return_var); - check_return_code($return_var,$output); - $v_antispam = 'no'; - unset($output); - } - if (($v_antispam == 'no') && (!empty($_POST['v_antispam'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-add-mail-domain-antispam ".$v_username." ".$v_domain, $output, $return_var); - check_return_code($return_var,$output); - $v_antispam = 'yes'; - unset($output); - } - // Antivirus - if (($v_antivirus == 'yes') && (empty($_POST['v_antivirus'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-delete-mail-domain-antivirus ".$v_username." ".$v_domain, $output, $return_var); - check_return_code($return_var,$output); - $v_antivirus = 'no'; - unset($output); - } - if (($v_antivirus == 'no') && (!empty($_POST['v_antivirus'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-add-mail-domain-antivirus ".$v_username." ".$v_domain, $output, $return_var); - check_return_code($return_var,$output); - $v_antivirus = 'yes'; - unset($output); - } - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('Changes has been saved.'); - } - - // DKIM - if (($v_dkim == 'yes') && (empty($_POST['v_dkim'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-delete-mail-domain-dkim ".$v_username." ".$v_domain, $output, $return_var); - check_return_code($return_var,$output); - $v_dkim = 'no'; - unset($output); - } - if (($v_dkim == 'no') && (!empty($_POST['v_dkim'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-add-mail-domain-dkim ".$v_username." ".$v_domain, $output, $return_var); - check_return_code($return_var,$output); - $v_dkim = 'yes'; - unset($output); - } - - // Catchall - if ((!empty($v_catchall)) && (empty($_POST['v_catchall'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-delete-mail-domain-catchall ".$v_username." ".$v_domain, $output, $return_var); - check_return_code($return_var,$output); - $v_catchall = ''; - unset($output); - } - if ((!empty($v_catchall)) && (!empty($_POST['v_catchall'])) && (empty($_SESSION['error_msg']))) { - if ($v_catchall != $_POST['v_catchall']) { - $v_catchall = escapeshellarg($_POST['v_catchall']); - exec (VESTA_CMD."v-change-mail-domain-catchall ".$v_username." ".$v_domain." ".$v_catchall, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - } - if ((empty($v_catchall)) && (!empty($_POST['v_catchall'])) && (empty($_SESSION['error_msg']))) { - $v_catchall = escapeshellarg($_POST['v_catchall']); - exec (VESTA_CMD."v-add-mail-domain-catchall ".$v_username." ".$v_domain." ".$v_catchall, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('Changes has been saved.'); - } - } - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} else { - $v_username = $user; +// List mail account +if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) { $v_domain = escapeshellarg($_GET['domain']); $v_account = escapeshellarg($_GET['account']); exec (VESTA_CMD."v-list-mail-account ".$user." ".$v_domain." ".$v_account." 'json'", $output, $return_var); - check_return_code($return_var,$output); - if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); + $data = json_decode(implode('', $output), true); + unset($output); + + // Parse mail account + $v_username = $user; + $v_domain = $_GET['domain']; + $v_account = $_GET['account']; + $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']); + $vfwd = explode(",", $data[$v_account]['FWD']); + $v_fwd_only = $data[$v_account]['FWD_ONLY']; + $v_quota = $data[$v_account]['QUOTA']; + $v_autoreply = $data[$v_account]['AUTOREPLY']; + $v_suspended = $data[$v_account]['SUSPENDED']; + if ( $v_suspended == 'yes' ) { + $v_status = 'suspended'; + } else { + $v_status = 'active'; + } + $v_date = $data[$v_account]['DATE']; + $v_time = $data[$v_account]['TIME']; + + // Parse autoreply + if ( $v_autoreply == 'yes' ) { + exec (VESTA_CMD."v-list-mail-account-autoreply ".$user." '".$v_domain."' '".$v_account."' json", $output, $return_var); + $autoreply_str = json_decode(implode('', $output), true); unset($output); - $v_username = $user; - $v_domain = $_GET['domain']; - $v_account = $_GET['account']; - $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']); - $vfwd = explode(",", $data[$v_account]['FWD']); - $v_fwd_only = $data[$v_account]['FWD_ONLY']; - $v_quota = $data[$v_account]['QUOTA']; - $v_autoreply = $data[$v_account]['AUTOREPLY']; - if ( $v_autoreply == 'yes' ) { - exec (VESTA_CMD."v-list-mail-account-autoreply ".$user." '".$v_domain."' '".$v_account."' json", $output, $return_var); - $autoreply_str = json_decode(implode('', $output), true); - unset($output); - $v_autoreply_message = $autoreply_str[$v_account]['MSG']; - } - $v_suspended = $data[$v_account]['SUSPENDED']; - if ( $v_suspended == 'yes' ) { - $v_status = 'suspended'; - } else { - $v_status = 'active'; - } - $v_date = $data[$v_account]['DATE']; - $v_time = $data[$v_account]['TIME']; + $v_autoreply_message = $autoreply_str[$v_account]['MSG']; } - - // Action - if (!empty($_POST['save'])) { - $v_domain = escapeshellarg($_POST['v_domain']); - $v_account = escapeshellarg($_POST['v_account']); - // Password - if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { - $v_password = escapeshellarg($_POST['v_password']); - exec (VESTA_CMD."v-change-mail-account-password ".$v_username." ".$v_domain." ".$v_account." ".$v_password, $output, $return_var); - check_return_code($return_var,$output); - $v_password = "••••••••"; - unset($output); - } - - // Quota - if (($v_quota != $_POST['v_quota']) && (empty($_SESSION['error_msg']))) { - if (empty($_POST['v_quota'])) { - $v_quota = 0; - } else { - $v_quota = escapeshellarg($_POST['v_quota']); - } - exec (VESTA_CMD."v-change-mail-account-quota ".$v_username." ".$v_domain." ".$v_account." ".$v_quota, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - // Aliases - if (empty($_SESSION['error_msg'])) { - $waliases = preg_replace("/\n/", " ", $_POST['v_aliases']); - $waliases = preg_replace("/,/", " ", $waliases); - $waliases = preg_replace('/\s+/', ' ',$waliases); - $waliases = trim($waliases); - $aliases = explode(" ", $waliases); - $v_aliases = str_replace(' ', "\n", $waliases); - $result = array_diff($valiases, $aliases); - foreach ($result as $alias) { - if ((empty($_SESSION['error_msg'])) && (!empty($alias))) { - exec (VESTA_CMD."v-delete-mail-account-alias ".$v_username." ".$v_domain." ".$v_account." '".$alias."'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - } - $result = array_diff($aliases, $valiases); - foreach ($result as $alias) { - if ((empty($_SESSION['error_msg'])) && (!empty($alias))) { - exec (VESTA_CMD."v-add-mail-account-alias ".$v_username." ".$v_domain." ".$v_account." '".$alias."'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - } - } - // Forwarders - if (empty($_SESSION['error_msg'])) { - $wfwd = preg_replace("/\n/", " ", $_POST['v_fwd']); - $wfwd = preg_replace("/,/", " ", $wfwd); - $wfwd = preg_replace('/\s+/', ' ',$wfwd); - $wfwd = trim($wfwd); - $fwd = explode(" ", $wfwd); - $v_fwd = str_replace(' ', "\n", $wfwd); - $result = array_diff($vfwd, $fwd); - foreach ($result as $forward) { - if ((empty($_SESSION['error_msg'])) && (!empty($forward))) { - exec (VESTA_CMD."v-delete-mail-account-forward ".$v_username." ".$v_domain." ".$v_account." '".$forward."'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - } - $result = array_diff($fwd, $vfwd); - foreach ($result as $forward) { - if ((empty($_SESSION['error_msg'])) && (!empty($forward))) { - exec (VESTA_CMD."v-add-mail-account-forward ".$v_username." ".$v_domain." ".$v_account." '".$forward."'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - } - } - - // FWD_ONLY flag - if (($v_fwd_only == 'yes') && (empty($_POST['v_fwd_only'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-delete-mail-account-fwd-only ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $v_fwd_only = ''; - } - if (($v_fwd_only != 'yes') && (!empty($_POST['v_fwd_only'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-add-mail-account-fwd-only ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $v_fwd_only = 'yes'; - } - - // Autoreply - if (($v_autoreply == 'yes') && (empty($_POST['v_autoreply'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-delete-mail-account-autoreply ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $v_autoreply = 'no'; - $v_autoreply_message = ''; - } - if (($v_autoreply == 'yes') && (!empty($_POST['v_autoreply'])) && (empty($_SESSION['error_msg']))) { - if ( $v_autoreply_message != str_replace("\r\n", "\n", $_POST['v_autoreply_message'])) { - $v_autoreply_message = str_replace("\r\n", "\n", $_POST['v_autoreply_message']); - $v_autoreply_message = escapeshellarg($v_autoreply_message); - exec (VESTA_CMD."v-add-mail-account-autoreply ".$v_username." ".$v_domain." ".$v_account." ".$v_autoreply_message, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $v_autoreply_message = $_POST['v_autoreply_message']; - } - } - if (($v_autoreply == 'no') && (!empty($_POST['v_autoreply'])) && (empty($_SESSION['error_msg']))) { - if (empty($_POST['v_autoreply_message'])) $_SESSION['error_msg'] = $_SESSION['error_msg'] = __('Field "%s" can not be blank.','atoreply'); - if (empty($_SESSION['error_msg'])) { - $v_autoreply_message = str_replace("\r\n", "\n", $_POST['v_autoreply_message']); - $v_autoreply_message = escapeshellarg($v_autoreply_message); - exec (VESTA_CMD."v-add-mail-account-autoreply ".$v_username." ".$v_domain." ".$v_account." ".$v_autoreply_message, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $v_autoreply = 'yes'; - $v_autoreply_message = $_POST['v_autoreply_message']; - } - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('Changes has been saved.'); - } - } - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail_acc.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); } +// Check POST request for mail domain +if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (empty($_GET['account']))) { + $v_domain = escapeshellarg($_POST['v_domain']); + + // Delete antispam + if (($v_antispam == 'yes') && (empty($_POST['v_antispam'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-delete-mail-domain-antispam ".$v_username." ".$v_domain, $output, $return_var); + check_return_code($return_var,$output); + $v_antispam = 'no'; + unset($output); + } + + // Add antispam + if (($v_antispam == 'no') && (!empty($_POST['v_antispam'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-add-mail-domain-antispam ".$v_username." ".$v_domain, $output, $return_var); + check_return_code($return_var,$output); + $v_antispam = 'yes'; + unset($output); + } + + // Delete antivirus + if (($v_antivirus == 'yes') && (empty($_POST['v_antivirus'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-delete-mail-domain-antivirus ".$v_username." ".$v_domain, $output, $return_var); + check_return_code($return_var,$output); + $v_antivirus = 'no'; + unset($output); + } + + // Add antivirs + if (($v_antivirus == 'no') && (!empty($_POST['v_antivirus'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-add-mail-domain-antivirus ".$v_username." ".$v_domain, $output, $return_var); + check_return_code($return_var,$output); + $v_antivirus = 'yes'; + unset($output); + } + + // Delete DKIM + if (($v_dkim == 'yes') && (empty($_POST['v_dkim'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-delete-mail-domain-dkim ".$v_username." ".$v_domain, $output, $return_var); + check_return_code($return_var,$output); + $v_dkim = 'no'; + unset($output); + } + + // Add DKIM + if (($v_dkim == 'no') && (!empty($_POST['v_dkim'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-add-mail-domain-dkim ".$v_username." ".$v_domain, $output, $return_var); + check_return_code($return_var,$output); + $v_dkim = 'yes'; + unset($output); + } + + // Delete catchall + if ((!empty($v_catchall)) && (empty($_POST['v_catchall'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-delete-mail-domain-catchall ".$v_username." ".$v_domain, $output, $return_var); + check_return_code($return_var,$output); + $v_catchall = ''; + unset($output); + } + + // Change catchall address + if ((!empty($v_catchall)) && (!empty($_POST['v_catchall'])) && (empty($_SESSION['error_msg']))) { + if ($v_catchall != $_POST['v_catchall']) { + $v_catchall = escapeshellarg($_POST['v_catchall']); + exec (VESTA_CMD."v-change-mail-domain-catchall ".$v_username." ".$v_domain." ".$v_catchall, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + } + + // Add catchall + if ((empty($v_catchall)) && (!empty($_POST['v_catchall'])) && (empty($_SESSION['error_msg']))) { + $v_catchall = escapeshellarg($_POST['v_catchall']); + exec (VESTA_CMD."v-add-mail-domain-catchall ".$v_username." ".$v_domain." ".$v_catchall, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Set success message + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('Changes has been saved.'); + } +} + +// Check POST request for mail account +if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['account']))) { + $v_domain = escapeshellarg($_POST['v_domain']); + $v_account = escapeshellarg($_POST['v_account']); + + // Change password + if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { + $v_password = escapeshellarg($_POST['v_password']); + exec (VESTA_CMD."v-change-mail-account-password ".$v_username." ".$v_domain." ".$v_account." ".$v_password, $output, $return_var); + check_return_code($return_var,$output); + $v_password = "••••••••"; + unset($output); + } + + // Change quota + if (($v_quota != $_POST['v_quota']) && (empty($_SESSION['error_msg']))) { + if (empty($_POST['v_quota'])) { + $v_quota = 0; + } else { + $v_quota = escapeshellarg($_POST['v_quota']); + } + exec (VESTA_CMD."v-change-mail-account-quota ".$v_username." ".$v_domain." ".$v_account." ".$v_quota, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Change account aliases + if (empty($_SESSION['error_msg'])) { + $waliases = preg_replace("/\n/", " ", $_POST['v_aliases']); + $waliases = preg_replace("/,/", " ", $waliases); + $waliases = preg_replace('/\s+/', ' ',$waliases); + $waliases = trim($waliases); + $aliases = explode(" ", $waliases); + $v_aliases = str_replace(' ', "\n", $waliases); + $result = array_diff($valiases, $aliases); + foreach ($result as $alias) { + if ((empty($_SESSION['error_msg'])) && (!empty($alias))) { + exec (VESTA_CMD."v-delete-mail-account-alias ".$v_username." ".$v_domain." ".$v_account." '".$alias."'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + } + $result = array_diff($aliases, $valiases); + foreach ($result as $alias) { + if ((empty($_SESSION['error_msg'])) && (!empty($alias))) { + exec (VESTA_CMD."v-add-mail-account-alias ".$v_username." ".$v_domain." ".$v_account." '".$alias."'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + } + } + + // Change forwarders + if (empty($_SESSION['error_msg'])) { + $wfwd = preg_replace("/\n/", " ", $_POST['v_fwd']); + $wfwd = preg_replace("/,/", " ", $wfwd); + $wfwd = preg_replace('/\s+/', ' ',$wfwd); + $wfwd = trim($wfwd); + $fwd = explode(" ", $wfwd); + $v_fwd = str_replace(' ', "\n", $wfwd); + $result = array_diff($vfwd, $fwd); + foreach ($result as $forward) { + if ((empty($_SESSION['error_msg'])) && (!empty($forward))) { + exec (VESTA_CMD."v-delete-mail-account-forward ".$v_username." ".$v_domain." ".$v_account." '".$forward."'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + } + $result = array_diff($fwd, $vfwd); + foreach ($result as $forward) { + if ((empty($_SESSION['error_msg'])) && (!empty($forward))) { + exec (VESTA_CMD."v-add-mail-account-forward ".$v_username." ".$v_domain." ".$v_account." '".$forward."'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + } + } + + // Delete FWD_ONLY flag + if (($v_fwd_only == 'yes') && (empty($_POST['v_fwd_only'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-delete-mail-account-fwd-only ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $v_fwd_only = ''; + } + + // Add FWD_ONLY flag + if (($v_fwd_only != 'yes') && (!empty($_POST['v_fwd_only'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-add-mail-account-fwd-only ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $v_fwd_only = 'yes'; + } + + // Delete autoreply + if (($v_autoreply == 'yes') && (empty($_POST['v_autoreply'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-delete-mail-account-autoreply ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $v_autoreply = 'no'; + $v_autoreply_message = ''; + } + + // Add autoreply + if ((!empty($_POST['v_autoreply'])) && (empty($_SESSION['error_msg']))) { + if ( $v_autoreply_message != str_replace("\r\n", "\n", $_POST['v_autoreply_message'])) { + $v_autoreply_message = str_replace("\r\n", "\n", $_POST['v_autoreply_message']); + $v_autoreply_message = escapeshellarg($v_autoreply_message); + exec (VESTA_CMD."v-add-mail-account-autoreply ".$v_username." ".$v_domain." ".$v_account." ".$v_autoreply_message, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $v_autoreply = 'yes'; + $v_autoreply_message = $_POST['v_autoreply_message']; + } + } + + // Set success message + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('Changes has been saved.'); + } +} + +// Display body for mail domain +if ((!empty($_GET['domain'])) && (empty($_GET['account']))) { + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail.html'); +} + +// Display body for mail account +if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) { + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail_acc.html'); +} + +// Flush session messages +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); + // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/edit/package/index.php b/web/edit/package/index.php index 2347aa261..41b3640b6 100644 --- a/web/edit/package/index.php +++ b/web/edit/package/index.php @@ -3,196 +3,199 @@ error_reporting(NULL); ob_start(); session_start(); - $TAB = 'PACKAGE'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); + +// Check user +if ($_SESSION['user'] != 'admin') { + header("Location: /list/user"); + exit; +} + +// Check package argument +if (empty($_GET['package'])) { + header("Location: /list/package/"); + exit; +} + + +// List package +$v_package = escapeshellarg($_GET['package']); +exec (VESTA_CMD."v-list-user-package ".$v_package." 'json'", $output, $return_var); +$data = json_decode(implode('', $output), true); +unset($output); + +// Parse package +$v_package = $_GET['package']; +$v_web_template = $data[$v_package]['WEB_TEMPLATE']; +$v_proxy_template = $data[$v_package]['PROXY_TEMPLATE']; +$v_dns_template = $data[$v_package]['DNS_TEMPLATE']; +$v_web_domains = $data[$v_package]['WEB_DOMAINS']; +$v_web_aliases = $data[$v_package]['WEB_ALIASES']; +$v_dns_domains = $data[$v_package]['DNS_DOMAINS']; +$v_dns_records = $data[$v_package]['DNS_RECORDS']; +$v_mail_domains = $data[$v_package]['MAIL_DOMAINS']; +$v_mail_accounts = $data[$v_package]['MAIL_ACCOUNTS']; +$v_databases = $data[$v_package]['DATABASES']; +$v_cron_jobs = $data[$v_package]['CRON_JOBS']; +$v_disk_quota = $data[$v_package]['DISK_QUOTA']; +$v_bandwidth = $data[$v_package]['BANDWIDTH']; +$v_shell = $data[$v_package]['SHELL']; +$v_ns = $data[$v_package]['NS']; +$nameservers = explode(", ", $v_ns); +$v_ns1 = $nameservers[0]; +$v_ns2 = $nameservers[1]; +$v_ns3 = $nameservers[2]; +$v_ns4 = $nameservers[3]; +$v_backups = $data[$v_package]['BACKUPS']; +$v_date = $data[$v_package]['DATE']; +$v_time = $data[$v_package]['TIME']; +$v_status = 'active'; + +// List web templates +exec (VESTA_CMD."v-list-web-templates json", $output, $return_var); +$web_templates = json_decode(implode('', $output), true); +unset($output); + +// List proxy templates +exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var); +$proxy_templates = json_decode(implode('', $output), true); +unset($output); + +// List dns templates +exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var); +$dns_templates = json_decode(implode('', $output), true); +unset($output); + +// List shels +exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var); +$shells = json_decode(implode('', $output), true); +unset($output); + +// Check POST request +if (!empty($_POST['save'])) { + + // Check empty fields + if (empty($_POST['v_package'])) $errors[] = __('package'); + if (empty($_POST['v_web_template'])) $errors[] = __('web template'); + if (empty($_POST['v_proxy_template'])) $errors[] = __('proxy template'); + if (empty($_POST['v_dns_template'])) $errors[] = __('dns template'); + if (empty($_POST['v_shell'])) $errrors[] = __('shell'); + if (!isset($_POST['v_web_domains'])) $errors[] = __('web domains'); + if (!isset($_POST['v_web_aliases'])) $errors[] = __('web aliases'); + if (!isset($_POST['v_dns_domains'])) $errors[] = __('dns domains'); + if (!isset($_POST['v_dns_records'])) $errors[] = __('dns records'); + if (!isset($_POST['v_mail_domains'])) $errors[] = __('mail domains'); + if (!isset($_POST['v_mail_accounts'])) $errors[] = __('mail accounts'); + if (!isset($_POST['v_databases'])) $errors[] = __('databases'); + if (!isset($_POST['v_cron_jobs'])) $errors[] = __('cron jobs'); + if (!isset($_POST['v_backups'])) $errors[] = __('backups'); + if (!isset($_POST['v_disk_quota'])) $errors[] = __('quota'); + if (!isset($_POST['v_bandwidth'])) $errors[] = __('bandwidth'); + if (empty($_POST['v_ns1'])) $errors[] = __('ns1'); + if (empty($_POST['v_ns2'])) $errors[] = __('ns2'); + if (!empty($errors[0])) { + foreach ($errors as $i => $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); + } + + // Protect input + $v_package = escapeshellarg($_POST['v_package']); + $v_web_template = escapeshellarg($_POST['v_web_template']); + $v_proxy_template = escapeshellarg($_POST['v_proxy_template']); + $v_dns_template = escapeshellarg($_POST['v_dns_template']); + $v_shell = escapeshellarg($_POST['v_shell']); + $v_web_domains = escapeshellarg($_POST['v_web_domains']); + $v_web_aliases = escapeshellarg($_POST['v_web_aliases']); + $v_dns_domains = escapeshellarg($_POST['v_dns_domains']); + $v_dns_records = escapeshellarg($_POST['v_dns_records']); + $v_mail_domains = escapeshellarg($_POST['v_mail_domains']); + $v_mail_accounts = escapeshellarg($_POST['v_mail_accounts']); + $v_databases = escapeshellarg($_POST['v_databases']); + $v_cron_jobs = escapeshellarg($_POST['v_cron_jobs']); + $v_backups = escapeshellarg($_POST['v_backups']); + $v_disk_quota = escapeshellarg($_POST['v_disk_quota']); + $v_bandwidth = escapeshellarg($_POST['v_bandwidth']); + $v_ns1 = trim($_POST['v_ns1'], '.'); + $v_ns2 = trim($_POST['v_ns2'], '.'); + $v_ns3 = trim($_POST['v_ns3'], '.'); + $v_ns4 = trim($_POST['v_ns4'], '.'); + $v_ns = $v_ns1.",".$v_ns2; + if (!empty($v_ns3)) $v_ns .= ",".$v_ns3; + if (!empty($v_ns4)) $v_ns .= ",".$v_ns4; + $v_ns = escapeshellarg($v_ns); + $v_time = escapeshellarg(date('H:i:s')); + $v_date = escapeshellarg(date('Y-m-d')); + + // Create temprorary directory + exec ('mktemp -d', $output, $return_var); + $tmpdir = $output[0]; + unset($output); + + // Save package file on a fs + $pkg = "WEB_TEMPLATE=".$v_web_template."\n"; + $pkg .= "PROXY_TEMPLATE=".$v_proxy_template."\n"; + $pkg .= "DNS_TEMPLATE=".$v_dns_template."\n"; + $pkg .= "WEB_DOMAINS=".$v_web_domains."\n"; + $pkg .= "WEB_ALIASES=".$v_web_aliases."\n"; + $pkg .= "DNS_DOMAINS=".$v_dns_domains."\n"; + $pkg .= "DNS_RECORDS=".$v_dns_records."\n"; + $pkg .= "MAIL_DOMAINS=".$v_mail_domains."\n"; + $pkg .= "MAIL_ACCOUNTS=".$v_mail_accounts."\n"; + $pkg .= "DATABASES=".$v_databases."\n"; + $pkg .= "CRON_JOBS=".$v_cron_jobs."\n"; + $pkg .= "DISK_QUOTA=".$v_disk_quota."\n"; + $pkg .= "BANDWIDTH=".$v_bandwidth."\n"; + $pkg .= "NS=".$v_ns."\n"; + $pkg .= "SHELL=".$v_shell."\n"; + $pkg .= "BACKUPS=".$v_backups."\n"; + $pkg .= "TIME=".$v_time."\n"; + $pkg .= "DATE=".$v_date."\n"; + $fp = fopen($tmpdir."/".$_POST['v_package'].".pkg", 'w'); + fwrite($fp, $pkg); + fclose($fp); + + // Save changes + exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$v_package." 'yes'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + + // Remove temporary dir + exec ('rm -rf '.$tmpdir, $output, $return_var); + unset($output); + + // Propogate new package + exec (VESTA_CMD."v-update-user-package ".$v_package." 'json'", $output, $return_var); + check_return_code($return_var,$output); + unset($output); + + // Set success message + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = __('Changes has been saved.'); + } +} + + // Header include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); // Panel top_panel($user,$TAB); -// Are you admin? -if ($_SESSION['user'] == 'admin') { +// Display body +include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_package.html'); - // Check user argument? - if (empty($_GET['package'])) { - header("Location: /list/package/"); - exit; - } - - $v_package = escapeshellarg($_GET['package']); - exec (VESTA_CMD."v-list-user-package ".$v_package." 'json'", $output, $return_var); - check_return_code($return_var,$output); - if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); - unset($output); - - $v_package = $_GET['package']; - $v_web_template = $data[$v_package]['WEB_TEMPLATE']; - $v_proxy_template = $data[$v_package]['PROXY_TEMPLATE']; - $v_dns_template = $data[$v_package]['DNS_TEMPLATE']; - $v_web_domains = $data[$v_package]['WEB_DOMAINS']; - $v_web_aliases = $data[$v_package]['WEB_ALIASES']; - $v_dns_domains = $data[$v_package]['DNS_DOMAINS']; - $v_dns_records = $data[$v_package]['DNS_RECORDS']; - $v_mail_domains = $data[$v_package]['MAIL_DOMAINS']; - $v_mail_accounts = $data[$v_package]['MAIL_ACCOUNTS']; - $v_databases = $data[$v_package]['DATABASES']; - $v_cron_jobs = $data[$v_package]['CRON_JOBS']; - $v_disk_quota = $data[$v_package]['DISK_QUOTA']; - $v_bandwidth = $data[$v_package]['BANDWIDTH']; - $v_shell = $data[$v_package]['SHELL']; - $v_ns = $data[$v_package]['NS']; - $nameservers = explode(", ", $v_ns); - $v_ns1 = $nameservers[0]; - $v_ns2 = $nameservers[1]; - $v_ns3 = $nameservers[2]; - $v_ns4 = $nameservers[3]; - $v_backups = $data[$v_package]['BACKUPS']; - $v_date = $data[$v_package]['DATE']; - $v_time = $data[$v_package]['TIME']; - $v_status = 'active'; - - - exec (VESTA_CMD."v-list-web-templates json", $output, $return_var); - check_error($return_var); - $web_templates = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var); - check_error($return_var); - $proxy_templates = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var); - check_error($return_var); - $dns_templates = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var); - check_error($return_var); - $shells = json_decode(implode('', $output), true); - unset($output); - - // Action - if (!empty($_POST['save'])) { - // Check input - if (empty($_POST['v_package'])) $errors[] = __('package'); - if (empty($_POST['v_web_template'])) $errors[] = __('web template'); - if (empty($_POST['v_proxy_template'])) $errors[] = __('proxy template'); - if (empty($_POST['v_dns_template'])) $errors[] = __('dns template'); - if (empty($_POST['v_shell'])) $errrors[] = __('shell'); - if (!isset($_POST['v_web_domains'])) $errors[] = __('web domains'); - if (!isset($_POST['v_web_aliases'])) $errors[] = __('web aliases'); - if (!isset($_POST['v_dns_domains'])) $errors[] = __('dns domains'); - if (!isset($_POST['v_dns_records'])) $errors[] = __('dns records'); - if (!isset($_POST['v_mail_domains'])) $errors[] = __('mail domains'); - if (!isset($_POST['v_mail_accounts'])) $errors[] = __('mail accounts'); - if (!isset($_POST['v_databases'])) $errors[] = __('databases'); - if (!isset($_POST['v_cron_jobs'])) $errors[] = __('cron jobs'); - if (!isset($_POST['v_backups'])) $errors[] = __('backups'); - if (!isset($_POST['v_disk_quota'])) $errors[] = __('quota'); - if (!isset($_POST['v_bandwidth'])) $errors[] = __('bandwidth'); - if (empty($_POST['v_ns1'])) $errors[] = __('ns1'); - if (empty($_POST['v_ns2'])) $errors[] = __('ns2'); - - // Protect input - $v_package = escapeshellarg($_POST['v_package']); - $v_web_template = escapeshellarg($_POST['v_web_template']); - $v_proxy_template = escapeshellarg($_POST['v_proxy_template']); - $v_dns_template = escapeshellarg($_POST['v_dns_template']); - $v_shell = escapeshellarg($_POST['v_shell']); - $v_web_domains = escapeshellarg($_POST['v_web_domains']); - $v_web_aliases = escapeshellarg($_POST['v_web_aliases']); - $v_dns_domains = escapeshellarg($_POST['v_dns_domains']); - $v_dns_records = escapeshellarg($_POST['v_dns_records']); - $v_mail_domains = escapeshellarg($_POST['v_mail_domains']); - $v_mail_accounts = escapeshellarg($_POST['v_mail_accounts']); - $v_databases = escapeshellarg($_POST['v_databases']); - $v_cron_jobs = escapeshellarg($_POST['v_cron_jobs']); - $v_backups = escapeshellarg($_POST['v_backups']); - $v_disk_quota = escapeshellarg($_POST['v_disk_quota']); - $v_bandwidth = escapeshellarg($_POST['v_bandwidth']); - $v_ns1 = trim($_POST['v_ns1'], '.'); - $v_ns2 = trim($_POST['v_ns2'], '.'); - $v_ns3 = trim($_POST['v_ns3'], '.'); - $v_ns4 = trim($_POST['v_ns4'], '.'); - $v_ns = $v_ns1.",".$v_ns2; - if (!empty($v_ns3)) $v_ns .= ",".$v_ns3; - if (!empty($v_ns4)) $v_ns .= ",".$v_ns4; - $v_ns = escapeshellarg($v_ns); - $v_time = escapeshellarg(date('H:i:s')); - $v_date = escapeshellarg(date('Y-m-d')); - - // Check for errors - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } else { - exec ('mktemp -d', $output, $return_var); - $tmpdir = $output[0]; - unset($output); - - // Create package - $pkg = "WEB_TEMPLATE=".$v_web_template."\n"; - $pkg .= "PROXY_TEMPLATE=".$v_proxy_template."\n"; - $pkg .= "DNS_TEMPLATE=".$v_dns_template."\n"; - $pkg .= "WEB_DOMAINS=".$v_web_domains."\n"; - $pkg .= "WEB_ALIASES=".$v_web_aliases."\n"; - $pkg .= "DNS_DOMAINS=".$v_dns_domains."\n"; - $pkg .= "DNS_RECORDS=".$v_dns_records."\n"; - $pkg .= "MAIL_DOMAINS=".$v_mail_domains."\n"; - $pkg .= "MAIL_ACCOUNTS=".$v_mail_accounts."\n"; - $pkg .= "DATABASES=".$v_databases."\n"; - $pkg .= "CRON_JOBS=".$v_cron_jobs."\n"; - $pkg .= "DISK_QUOTA=".$v_disk_quota."\n"; - $pkg .= "BANDWIDTH=".$v_bandwidth."\n"; - $pkg .= "NS=".$v_ns."\n"; - $pkg .= "SHELL=".$v_shell."\n"; - $pkg .= "BACKUPS=".$v_backups."\n"; - $pkg .= "TIME=".$v_time."\n"; - $pkg .= "DATE=".$v_date."\n"; - - // Write package - $fp = fopen($tmpdir."/".$_POST['v_package'].".pkg", 'w'); - fwrite($fp, $pkg); - fclose($fp); - - // Rewrite package - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$v_package." 'yes'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - // Remove tmpdir - exec ('rm -rf '.$tmpdir, $output, $return_var); - unset($output); - - // Propogate new package - exec (VESTA_CMD."v-update-user-package ".$v_package." 'json'", $output, $return_var); - check_return_code($return_var,$output); - unset($output); - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('Changes has been saved.'); - } - } - } - } - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_package.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} +// Flush session messages +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/edit/user/index.php b/web/edit/user/index.php index bc1aa8889..50f36c3ad 100644 --- a/web/edit/user/index.php +++ b/web/edit/user/index.php @@ -3,118 +3,126 @@ error_reporting(NULL); ob_start(); session_start(); - $TAB = 'USER'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); // Header include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); +// Check user argument +if (empty($_GET['user'])) { + header("Location: /list/user/"); + exit; +} + +// Edit as someone else? +if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { + $user=$_GET['user']; + $v_username=$_GET['user']; +} else { + $user=$_SESSION['user']; + $v_username=$_SESSION['user']; +} + +// List user +exec (VESTA_CMD."v-list-user ".$v_username." json", $output, $return_var); +check_return_code($return_var,$output); +$data = json_decode(implode('', $output), true); +unset($output); + +// Parse user +$v_password = "••••••••"; +$v_email = $data[$v_username]['CONTACT']; +$v_package = $data[$v_username]['PACKAGE']; +$v_language = $data[$v_username]['LANGUAGE']; +$v_fname = $data[$v_username]['FNAME']; +$v_lname = $data[$v_username]['LNAME']; +$v_shell = $data[$v_username]['SHELL']; +$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']; + +// List packages +exec (VESTA_CMD."v-list-user-packages json", $output, $return_var); +$packages = json_decode(implode('', $output), true); +unset($output); + +// List lanugages +exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var); +$languages = json_decode(implode('', $output), true); +unset($output); + +// List shells +exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var); +$shells = json_decode(implode('', $output), true); +unset($output); + // Are you admin? -if ($_SESSION['user'] == 'admin') { - // Check user argument? - if (empty($_GET['user'])) { - header("Location: /list/user/"); - exit; - } +// Check POST request +if (!empty($_POST['save'])) { - // Check user - $v_username = escapeshellarg($_GET['user']); - exec (VESTA_CMD."v-list-user ".$v_username." json", $output, $return_var); - check_return_code($return_var,$output); - if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $_GET['user']; + // 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); + check_return_code($return_var,$output); $v_password = "••••••••"; - $v_email = $data[$v_username]['CONTACT']; - $v_package = $data[$v_username]['PACKAGE']; - $v_language = $data[$v_username]['LANGUAGE']; - $v_fname = $data[$v_username]['FNAME']; - $v_lname = $data[$v_username]['LNAME']; - $v_shell = $data[$v_username]['SHELL']; - $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']; - - exec (VESTA_CMD."v-list-user-packages json", $output, $return_var); - $packages = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var); - $languages = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var); - $shells = json_decode(implode('', $output), true); unset($output); } - // Action - if (!empty($_POST['save'])) { - $v_username = escapeshellarg($_POST['v_username']); + // Change package (admin only) + if (($v_package != $_POST['v_package']) && ($_SESSION['user'] == 'admin') && (empty($_SESSION['error_msg']))) { + $v_package = escapeshellarg($_POST['v_package']); + exec (VESTA_CMD."v-change-user-package ".$v_username." ".$v_package, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } - // 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); - check_return_code($return_var,$output); - $v_password = "••••••••"; - unset($output); - } + // Change language + if (($v_language != $_POST['v_language']) && (empty($_SESSION['error_msg']))) { + $v_language = escapeshellarg($_POST['v_language']); + exec (VESTA_CMD."v-change-user-language ".$v_username." ".$v_language, $output, $return_var); + check_return_code($return_var,$output); + if (($_GET['user'] == 'admin') && (empty($_SESSION['error_msg']))) $_SESSION['language'] = $_POST['v_language']; + unset($output); + } - // Change package - if (($v_package != $_POST['v_package']) && (empty($_SESSION['error_msg']))) { - $v_package = escapeshellarg($_POST['v_package']); - exec (VESTA_CMD."v-change-user-package ".$v_username." ".$v_package, $output, $return_var); + // Change shell (admin only) + if (($v_shell != $_POST['v_shell']) && ($_SESSION['user'] == 'admin') && (empty($_SESSION['error_msg']))) { + $v_shell = escapeshellarg($_POST['v_shell']); + exec (VESTA_CMD."v-change-user-shell ".$v_username." ".$v_shell, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + } + + // Change contact email + if (($v_email != $_POST['v_email']) && (empty($_SESSION['error_msg']))) { + if (!filter_var($_POST['v_email'], FILTER_VALIDATE_EMAIL)) { + $_SESSION['error_msg'] = __('Please enter valid email address.'); + } else { + $v_email = escapeshellarg($_POST['v_email']); + exec (VESTA_CMD."v-change-user-contact ".$v_username." ".$v_email, $output, $return_var); check_return_code($return_var,$output); unset($output); } + } - // Change language - if (($v_language != $_POST['v_language']) && (empty($_SESSION['error_msg']))) { - $v_language = escapeshellarg($_POST['v_language']); - exec (VESTA_CMD."v-change-user-language ".$v_username." ".$v_language, $output, $return_var); - check_return_code($return_var,$output); - if (($_GET['user'] == 'admin') && (empty($_SESSION['error_msg']))) $_SESSION['language'] = $_POST['v_language']; - unset($output); - } - - // Change shell - if (($v_shell != $_POST['v_shell']) && (empty($_SESSION['error_msg']))) { - $v_shell = escapeshellarg($_POST['v_shell']); - exec (VESTA_CMD."v-change-user-shell ".$v_username." ".$v_shell, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - } - - // Change contact email - if (($v_email != $_POST['v_email']) && (empty($_SESSION['error_msg']))) { - // Validate email - if (!filter_var($_POST['v_email'], FILTER_VALIDATE_EMAIL)) { - $_SESSION['error_msg'] = __('Please enter valid email address.'); - } else { - $v_email = escapeshellarg($_POST['v_email']); - exec (VESTA_CMD."v-change-user-contact ".$v_username." ".$v_email, $output, $return_var); - check_return_code($return_var,$output); - } - unset($output); - } - - // Change Name - if (($v_fname != $_POST['v_fname']) || ($v_lname != $_POST['v_lname']) && (empty($_SESSION['error_msg']))) { + // Change full name (admin only) + if (($v_fname != $_POST['v_fname']) || ($v_lname != $_POST['v_lname'])) { + if (($_SESSION['user'] == 'admin') && (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); @@ -123,124 +131,41 @@ if ($_SESSION['user'] == 'admin') { $v_fname = $_POST['v_fname']; $v_lname = $_POST['v_lname']; } - - // 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); - check_return_code($return_var,$output); - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('Changes has been saved.'); - } - } - // Panel - top_panel($user,$TAB); - - 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 = $user; - exec (VESTA_CMD."v-list-user ".$v_username." json", $output, $return_var); - check_return_code($return_var,$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); + check_return_code($return_var,$output); + unset($output); + } + + // Set success message if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); - unset($output); - $v_password = "••••••••"; - $v_email = $data[$v_username]['CONTACT']; - $v_fname = $data[$v_username]['FNAME']; - $v_lname = $data[$v_username]['LNAME']; - $v_language = $data[$v_username]['LANGUAGE']; - $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']; - - exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var); - $languages = json_decode(implode('', $output), true); - unset($output); - + $_SESSION['ok_msg'] = __('Changes has been saved.'); } - - // Action - if (!empty($_POST['save'])) { - // 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); - check_return_code($return_var,$output); - $v_password = "••••••••"; - unset($output); - } - - // Change language - if (($v_language != $_POST['v_language']) && (empty($_SESSION['error_msg']))) { - $v_language = escapeshellarg($_POST['v_language']); - exec (VESTA_CMD."v-change-user-language ".$v_username." ".$v_language, $output, $return_var); - check_return_code($return_var,$output); - if (empty($_SESSION['error_msg'])) $_SESSION['language'] = $_POST['v_language']; - 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); - check_return_code($return_var,$output); - 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); - check_return_code($return_var,$output); - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = __('Changes has been saved.'); - } - } - // Panel - top_panel($user,$TAB); - - include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_user.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); } +// Panel +top_panel($user,$TAB); + +// Display body +if ($_SESSION['user'] == 'admin') { + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_user.html'); +} else { + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_user.html'); +} + +// Flush session messages +unset($_SESSION['error_msg']); +unset($_SESSION['ok_msg']); + // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/edit/web/index.php b/web/edit/web/index.php index a607e5465..fad416202 100644 --- a/web/edit/web/index.php +++ b/web/edit/web/index.php @@ -4,17 +4,11 @@ error_reporting(NULL); ob_start(); session_start(); unset($_SESSION['error_msg']); - $TAB = 'WEB'; + include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); -// Header -include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); - -// Panel -top_panel($user,$TAB); - -// Check user argument? +// Check domain argument if (empty($_GET['domain'])) { header("Location: /list/web/"); exit; @@ -25,73 +19,77 @@ if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) { $user=escapeshellarg($_GET['user']); } -// Check domain +// List domain $v_domain = escapeshellarg($_GET['domain']); exec (VESTA_CMD."v-list-web-domain ".$user." ".$v_domain." json", $output, $return_var); -check_return_code($return_var,$output); -if (empty($_SESSION['error_msg'])) { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $user; - $v_domain = $_GET['domain']; - $v_ip = $data[$v_domain]['IP']; - $v_template = $data[$v_domain]['TPL']; - $v_aliases = str_replace(',', "\n", $data[$v_domain]['ALIAS']); - $valiases = explode(",", $data[$v_domain]['ALIAS']); - $v_tpl = $data[$v_domain]['IP']; - $v_cgi = $data[$v_domain]['CGI']; - $v_elog = $data[$v_domain]['ELOG']; - $v_ssl = $data[$v_domain]['SSL']; - if ( $v_ssl == 'yes' ) { - exec (VESTA_CMD."v-list-web-domain-ssl ".$user." '".$v_domain."' json", $output, $return_var); - $ssl_str = json_decode(implode('', $output), true); - unset($output); - $v_ssl_crt = $ssl_str[$v_domain]['CRT']; - $v_ssl_key = $ssl_str[$v_domain]['KEY']; - $v_ssl_ca = $ssl_str[$v_domain]['CA']; - } - $v_ssl_home = $data[$v_domain]['SSL_HOME']; - $v_proxy = $data[$v_domain]['PROXY']; - $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 = "••••••••"; - $v_ftp_user = $data[$v_domain]['FTP_USER']; - if (!empty($v_ftp_user)) $v_ftp_password = "••••••••"; - $v_suspended = $data[$v_domain]['SUSPENDED']; - if ( $v_suspended == 'yes' ) { - $v_status = 'suspended'; - } else { - $v_status = 'active'; - } - $v_time = $data[$v_domain]['TIME']; - $v_date = $data[$v_domain]['DATE']; +$data = json_decode(implode('', $output), true); +unset($output); - exec (VESTA_CMD."v-list-user-ips ".$user." json", $output, $return_var); - $ips = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-web-templates json", $output, $return_var); - $templates = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var); - $proxy_templates = json_decode(implode('', $output), true); - unset($output); - - exec (VESTA_CMD."v-list-web-stats json", $output, $return_var); - $stats = json_decode(implode('', $output), true); +// Parse domain +$v_username = $user; +$v_domain = $_GET['domain']; +$v_ip = $data[$v_domain]['IP']; +$v_template = $data[$v_domain]['TPL']; +$v_aliases = str_replace(',', "\n", $data[$v_domain]['ALIAS']); +$valiases = explode(",", $data[$v_domain]['ALIAS']); +$v_tpl = $data[$v_domain]['IP']; +$v_cgi = $data[$v_domain]['CGI']; +$v_elog = $data[$v_domain]['ELOG']; +$v_ssl = $data[$v_domain]['SSL']; +if ( $v_ssl == 'yes' ) { + exec (VESTA_CMD."v-list-web-domain-ssl ".$user." '".$v_domain."' json", $output, $return_var); + $ssl_str = json_decode(implode('', $output), true); unset($output); + $v_ssl_crt = $ssl_str[$v_domain]['CRT']; + $v_ssl_key = $ssl_str[$v_domain]['KEY']; + $v_ssl_ca = $ssl_str[$v_domain]['CA']; } - - -// Action +$v_ssl_home = $data[$v_domain]['SSL_HOME']; +$v_proxy = $data[$v_domain]['PROXY']; +$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 = "••••••••"; +$v_ftp_user = $data[$v_domain]['FTP_USER']; +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']; +$v_suspended = $data[$v_domain]['SUSPENDED']; +if ( $v_suspended == 'yes' ) { + $v_status = 'suspended'; +} else { + $v_status = 'active'; +} +$v_time = $data[$v_domain]['TIME']; +$v_date = $data[$v_domain]['DATE']; + +// List ip addresses +exec (VESTA_CMD."v-list-user-ips ".$user." json", $output, $return_var); +$ips = json_decode(implode('', $output), true); +unset($output); + +// List web templates +exec (VESTA_CMD."v-list-web-templates json", $output, $return_var); +$templates = json_decode(implode('', $output), true); +unset($output); + +// List proxy templates +exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var); +$proxy_templates = json_decode(implode('', $output), true); +unset($output); + +// List web stat engines +exec (VESTA_CMD."v-list-web-stats json", $output, $return_var); +$stats = json_decode(implode('', $output), true); +unset($output); + +// Check POST request if (!empty($_POST['save'])) { $v_domain = escapeshellarg($_POST['v_domain']); - // IP + // Change web domain IP if (($v_ip != $_POST['v_ip']) && (empty($_SESSION['error_msg']))) { $v_ip = escapeshellarg($_POST['v_ip']); exec (VESTA_CMD."v-change-web-domain-ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var); @@ -99,27 +97,36 @@ if (!empty($_POST['save'])) { $restart_web = 'yes'; $restart_proxy = 'yes'; unset($output); + } + + // Chane dns domain IP + if (empty($_SESSION['error_msg'])) { exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain." json", $output, $return_var); - if ((empty($_SESSION['error_msg'])) && ($return_var == 0 )) { - unset($output); + unset($output); + if ($return_var == 0 ) { exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var); check_return_code($return_var,$output); - $restart_dns = 'yes'; - } - unset($output); - foreach($valiases as $v_alias ){ - exec (VESTA_CMD."v-list-dns-domain ".$v_username." '".$v_alias."' json", $output, $return_var); - if ((empty($_SESSION['error_msg'])) && ($return_var == 0 )) { - exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." '".$v_alias."' ".$v_ip, $output, $return_var); - check_return_code($return_var,$output); - $restart_dns = 'yes'; - } unset($output); + $restart_dns = 'yes'; } } - // Template - if (( $_SESSION['user'] == 'admin') && ($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) { + // Change dns ip for each alias + if (empty($_SESSION['error_msg'])) { + foreach($valiases as $v_alias ){ + exec (VESTA_CMD."v-list-dns-domain ".$v_username." '".$v_alias."' json", $output, $return_var); + unset($output); + if ($return_var == 0 ) { + exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." '".$v_alias."' ".$v_ip, $output, $return_var); + check_return_code($return_var,$output); + unset($output); + $restart_dns = 'yes'; + } + } + } + + // Change template (admin only) + if (($v_template != $_POST['v_template']) && ( $_SESSION['user'] == 'admin') && (empty($_SESSION['error_msg']))) { $v_template = escapeshellarg($_POST['v_template']); exec (VESTA_CMD."v-change-web-domain-tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var); check_return_code($return_var,$output); @@ -127,7 +134,7 @@ if (!empty($_POST['save'])) { $restart_web = 'yes'; } - // Aliases + // Change aliases if (empty($_SESSION['error_msg'])) { $waliases = preg_replace("/\n/", " ", $_POST['v_aliases']); $waliases = preg_replace("/,/", " ", $waliases); @@ -151,9 +158,9 @@ if (!empty($_POST['save'])) { if ($return_var == 0) { exec (VESTA_CMD."v-delete-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); check_return_code($return_var,$output); + unset($output); $restart_dns = 'yes'; } - unset($output); } } } @@ -173,15 +180,15 @@ if (!empty($_POST['save'])) { if ($return_var == 0) { exec (VESTA_CMD."v-add-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); check_return_code($return_var,$output); + unset($output); $restart_dns = 'yes'; } } - unset($output); } } } - // Proxy + // Delete proxy support if ((!empty($v_proxy)) && (empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) { exec (VESTA_CMD."v-delete-web-domain-proxy ".$v_username." ".$v_domain." 'no'", $output, $return_var); check_return_code($return_var,$output); @@ -189,6 +196,8 @@ if (!empty($_POST['save'])) { unset($v_proxy); $restart_proxy = 'yes'; } + + // Change proxy template / Update extention list if ((!empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) { $ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']); $ext = preg_replace("/,/", " ", $ext); @@ -205,6 +214,8 @@ if (!empty($_POST['save'])) { $restart_proxy = 'yes'; } } + + // Add proxy support if ((empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) { $v_proxy_template = $_POST['v_proxy_template']; if (!empty($_POST['v_proxy_ext'])) { @@ -221,7 +232,7 @@ if (!empty($_POST['save'])) { $restart_proxy = 'yes'; } - // SSL + // Delete SSL certificate if (( $v_ssl == 'yes' ) && (empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) { exec (VESTA_CMD."v-delete-web-domain-ssl ".$v_username." ".$v_domain." 'no'", $output, $return_var); check_return_code($return_var,$output); @@ -230,6 +241,8 @@ if (!empty($_POST['save'])) { $restart_web = 'yes'; $restart_proxy = 'yes'; } + + // Change SSL certificate if (($v_ssl == 'yes') && (!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) { if (( $v_ssl_crt != str_replace("\r\n", "\n", $_POST['v_ssl_crt'])) || ( $v_ssl_key != str_replace("\r\n", "\n", $_POST['v_ssl_key'])) || ( $v_ssl_ca != str_replace("\r\n", "\n", $_POST['v_ssl_ca']))) { exec ('mktemp -d', $mktemp_output, $return_var); @@ -269,15 +282,8 @@ if (!empty($_POST['save'])) { $v_ssl_ca = $_POST['v_ssl_ca']; } } - if (( $v_ssl == 'yes') && (!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) { - if ( $v_ssl_home != $_POST['v_ssl_home'] ) { - $v_ssl_home = escapeshellarg($_POST['v_ssl_home']); - exec (VESTA_CMD."v-change-web-domain-sslhome ".$user." ".$v_domain." ".$v_ssl_home." 'no'", $output, $return_var); - check_return_code($return_var,$output); - $v_ssl_home = $_POST['v_ssl_home']; - unset($output); - } - } + + // Add SSL certificate if (( $v_ssl == 'no') && (!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) { if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_crt']))) $errors[] = 'ssl certificate'; if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_key']))) $errors[] = 'ssl key'; @@ -329,19 +335,34 @@ if (!empty($_POST['save'])) { } } - // Web Stats + // Change document root for ssl domain + if (( $v_ssl == 'yes') && (!empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) { + if ( $v_ssl_home != $_POST['v_ssl_home'] ) { + $v_ssl_home = escapeshellarg($_POST['v_ssl_home']); + exec (VESTA_CMD."v-change-web-domain-sslhome ".$user." ".$v_domain." ".$v_ssl_home." 'no'", $output, $return_var); + check_return_code($return_var,$output); + $v_ssl_home = $_POST['v_ssl_home']; + unset($output); + } + } + + // Delete web stats if ((!empty($v_stats)) && ($_POST['v_stats'] == 'none') && (empty($_SESSION['error_msg']))) { exec (VESTA_CMD."v-delete-web-domain-stats ".$v_username." ".$v_domain, $output, $return_var); check_return_code($return_var,$output); unset($output); $v_stats = ''; } + + // Change web stats engine if ((!empty($v_stats)) && ($_POST['v_stats'] != $v_stats) && (empty($_SESSION['error_msg']))) { $v_stats = escapeshellarg($_POST['v_stats']); exec (VESTA_CMD."v-change-web-domain-stats ".$v_username." ".$v_domain." ".$v_stats, $output, $return_var); check_return_code($return_var,$output); unset($output); } + + // Add web stats if ((empty($v_stats)) && ($_POST['v_stats'] != 'none') && (empty($_SESSION['error_msg']))) { $v_stats = escapeshellarg($_POST['v_stats']); exec (VESTA_CMD."v-add-web-domain-stats ".$v_username." ".$v_domain." ".$v_stats, $output, $return_var); @@ -349,7 +370,7 @@ if (!empty($_POST['save'])) { unset($output); } - // Web Stats Auth + // Delete web stats authorization if ((!empty($v_stats_user)) && (empty($_POST['v_stats_auth'])) && (empty($_SESSION['error_msg']))) { exec (VESTA_CMD."v-delete-web-domain-stats-user ".$v_username." ".$v_domain, $output, $return_var); check_return_code($return_var,$output); @@ -357,6 +378,8 @@ if (!empty($_POST['save'])) { $v_stats_user = ''; $v_stats_password = ''; } + + // 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'); @@ -378,6 +401,8 @@ if (!empty($_POST['save'])) { $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'); @@ -401,112 +426,203 @@ if (!empty($_POST['save'])) { } } - // Delete FTP Account - if ((!empty($v_ftp_user)) && (empty($_POST['v_ftp'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-delete-web-domain-ftp ".$v_username." ".$v_domain, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $v_ftp= ''; - $v_ftp_user = ''; - $v_ftp_password = ''; - } - - // Change FTP Account - if ((!empty($v_ftp_user)) && (!empty($_POST['v_ftp'])) && (empty($_SESSION['error_msg']))) { - if (empty($_POST['v_ftp_user'])) $errors[] = __('ftp user'); - if (empty($_POST['v_ftp_password'])) $errors[] = __('ftp user password'); - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; + // Change ftp accounts + if (!empty($_POST['v_ftp_user'])) { + $v_ftp_users_updated = array(); + foreach ($_POST['v_ftp_user'] as $i => $v_ftp_user_data) { + $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) { + 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 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); } - } - $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } - if (($v_ftp_user != $_POST['v_ftp_user']) || ($_POST['v_ftp_password'] != "••••••••" ) && (empty($_SESSION['error_msg']))) { - $v_ftp_user = preg_replace("/^".$user."_/", "", $_POST['v_ftp_user']); - $v_ftp_user = escapeshellarg($v_ftp_user); - $v_ftp_password = escapeshellarg($_POST['v_ftp_password']); - exec (VESTA_CMD."v-add-web-domain-ftp ".$v_username." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password, $output, $return_var); - check_return_code($return_var,$output); - unset($output); - $v_ftp= ''; - $v_ftp_user = $user."_".preg_replace("/^".$user."_/", "", $_POST['v_ftp_user']); - $v_ftp_password = "••••••••"; - } - } - // Add FTP Account - if ((empty($v_ftp_user)) && (!empty($_POST['v_ftp'])) && (empty($_SESSION['error_msg']))) { - if ((!empty($_POST['v_ftp_email'])) && (!filter_var($_POST['v_ftp_email'], FILTER_VALIDATE_EMAIL))) $_SESSION['error_msg'] = __('Please enter valid email address.'); - if (empty($_POST['v_ftp_user'])) $errors[] = 'ftp user'; - if (empty($_POST['v_ftp_password'])) $errors[] = 'ftp user password'; - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; + $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); + $v_ftp_password = escapeshellarg($v_ftp_user_data['v_ftp_password']); + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-add-web-domain-ftp ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_password . " " . $v_ftp_user_data['v_ftp_path'], $output, $return_var); + check_return_code($return_var,$output); + if ((!empty($v_ftp_user_data['v_ftp_email'])) && (empty($_SESSION['error_msg']))) { + $to = $v_ftp_user_data['v_ftp_email']; + $subject = __("FTP login credentials"); + $hostname = exec('hostname'); + $from = __('MAIL_FROM',$hostname); + $mailtext = __('FTP_ACCOUNT_READY',$_GET['domain'],$user,$v_ftp_username,$v_ftp_user_data['v_ftp_password']); + send_email($to, $subject, $mailtext, $from); + unset($v_ftp_email); + } + unset($output); } + + if ($return_var == 0) { + $v_ftp_password = "••••••••"; + $v_ftp_user_data['is_new'] = 0; + } + else { + $v_ftp_user_data['is_new'] = 1; + } + + $v_ftp_users_updated[] = array( + 'is_new' => empty($_SESSION['error_msg']) ? 0 : 1, + 'v_ftp_user' => $v_ftp_username_full, + 'v_ftp_password' => $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 + ); + + continue; } - $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); - } - if (empty($_SESSION['error_msg'])) { - $v_ftp_user = escapeshellarg($_POST['v_ftp_user']); - $v_ftp_password = escapeshellarg($_POST['v_ftp_password']); - exec (VESTA_CMD."v-add-web-domain-ftp ".$v_username." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password, $output, $return_var); - check_return_code($return_var,$output); - if ((!empty($_POST['v_ftp_email'])) && (empty($_SESSION['error_msg']))) { - $to = $_POST['v_ftp_email']; - $subject = __("FTP login credentials"); - $hostname = exec('hostname'); - $from = __('MAIL_FROM',$hostname); - $mailtext .= __('FTP_ACCOUNT_READY',$_GET['domain'],$user,$_POST['v_ftp_user'],$_POST['v_ftp_password']); - send_email($to, $subject, $mailtext, $from); - unset($v_ftp_email); + + + 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); + check_return_code($return_var,$output); + unset($output); + + continue; } + + // 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 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg); + } + + $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'])); + exec (VESTA_CMD."v-change-web-domain-ftp-path ".$v_username." ".$v_domain." ".$v_ftp_username." ".$v_ftp_user_data['v_ftp_path'], $output, $return_var); + if ($v_ftp_user_data['v_ftp_password'] != "••••••••" && !empty($v_ftp_user_data['v_ftp_password'])) { + 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); + } + check_return_code($return_var, $output); unset($output); - $v_ftp_user = $user."_".$_POST['v_ftp_user']; + $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_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 + ); } } - // Restart web + // Restart web server if (!empty($restart_web) && (empty($_SESSION['error_msg']))) { exec (VESTA_CMD."v-restart-web", $output, $return_var); check_return_code($return_var,$output); unset($output); } - // Restart proxy + // Restart proxy server if (!empty($restart_proxy) && (empty($_SESSION['error_msg']))) { exec (VESTA_CMD."v-restart-proxy", $output, $return_var); check_return_code($return_var,$output); unset($output); } - // Restart dns + // Restart dns server if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) { exec (VESTA_CMD."v-restart-dns", $output, $return_var); check_return_code($return_var,$output); unset($output); } + // Set success message if (empty($_SESSION['error_msg'])) { $_SESSION['ok_msg'] = __('Changes has been saved.'); } } + + +$v_ftp_users_raw = explode(':', $v_ftp_user); +$v_ftp_users_paths_raw = explode(':', $data[$v_domain]['FTP_PATH']); +$v_ftp_users = array(); +foreach ($v_ftp_users_raw as $v_ftp_user_index => $v_ftp_user_val) { + if (empty($v_ftp_user_val)) { + continue; + } + $v_ftp_users[] = array( + 'is_new' => 0, + 'v_ftp_user' => $v_ftp_user_val, + 'v_ftp_password' => $v_ftp_password, + 'v_ftp_path' => (isset($v_ftp_users_paths_raw[$v_ftp_user_index]) ? $v_ftp_users_paths_raw[$v_ftp_user_index] : ''), + 'v_ftp_email' => $v_ftp_email, + 'v_ftp_pre_path' => $v_ftp_user_prepath + ); +} + +if (empty($v_ftp_users)) { + $v_ftp_user = null; + $v_ftp_users[] = array( + 'is_new' => 1, + 'v_ftp_user' => '', + 'v_ftp_password' => '', + 'v_ftp_path' => (isset($v_ftp_users_paths_raw[$v_ftp_user_index]) ? $v_ftp_users_paths_raw[$v_ftp_user_index] : ''), + 'v_ftp_email' => '', + 'v_ftp_pre_path' => $v_ftp_user_prepath + ); +} + +// set default pre path for newly created users +$v_ftp_pre_path_new_user = $v_ftp_user_prepath; +if (isset($v_ftp_users_updated)) { + $v_ftp_users = $v_ftp_users_updated; + if (empty($v_ftp_users_updated)) { + $v_ftp_user = null; + $v_ftp_users[] = array( + 'is_new' => 1, + 'v_ftp_user' => '', + 'v_ftp_password' => '', + 'v_ftp_path' => (isset($v_ftp_users_paths_raw[$v_ftp_user_index]) ? $v_ftp_users_paths_raw[$v_ftp_user_index] : ''), + 'v_ftp_email' => '', + 'v_ftp_pre_path' => $v_ftp_user_prepath + ); + } +} + +// Header +include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html'); + +// Panel +top_panel($user,$TAB); + +// Display body if ($_SESSION['user'] == 'admin') { include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_web.html'); } else { include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_web.html'); } + +// Flush session messages unset($_SESSION['error_msg']); unset($_SESSION['ok_msg']); - // Footer include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/images/db.png b/web/images/db.png new file mode 100644 index 000000000..7317de69e Binary files /dev/null and b/web/images/db.png differ diff --git a/web/images/disabled_bg.png b/web/images/disabled_bg.png new file mode 100644 index 000000000..2eff4f429 Binary files /dev/null and b/web/images/disabled_bg.png differ diff --git a/web/images/edit.png b/web/images/edit.png index 2ccfad8c9..b30e73c94 100644 Binary files a/web/images/edit.png and b/web/images/edit.png differ diff --git a/web/images/folder.png b/web/images/folder.png new file mode 100644 index 000000000..41dc4e4e2 Binary files /dev/null and b/web/images/folder.png differ diff --git a/web/images/login-as.png b/web/images/login-as.png index 1d7e049c7..06a5b7122 100644 Binary files a/web/images/login-as.png and b/web/images/login-as.png differ diff --git a/web/images/logo.png b/web/images/logo.png index 19acb5a43..9a902492d 100644 Binary files a/web/images/logo.png and b/web/images/logo.png differ diff --git a/web/images/mail.png b/web/images/mail.png new file mode 100644 index 000000000..1281299b9 Binary files /dev/null and b/web/images/mail.png differ diff --git a/web/images/more.png b/web/images/more.png index a2d6aa7c9..ce3092267 100644 Binary files a/web/images/more.png and b/web/images/more.png differ diff --git a/web/images/pause.png b/web/images/pause.png new file mode 100644 index 000000000..4120a61cb Binary files /dev/null and b/web/images/pause.png differ diff --git a/web/images/stats.png b/web/images/stats.png new file mode 100644 index 000000000..c464fe6e4 Binary files /dev/null and b/web/images/stats.png differ diff --git a/web/inc/i18n/ar.php b/web/inc/i18n/ar.php index 0aba39923..58dd12196 100644 --- a/web/inc/i18n/ar.php +++ b/web/inc/i18n/ar.php @@ -38,6 +38,7 @@ $LANG['ar'] = array( 'Add Package' => 'إضافة رزمة', 'Add IP' => 'إضافة بروتوكول إنترنت', 'Search' => 'بحث', + 'Add one more FTP Account' => 'إضافة المزيد من حساب واحد', 'Overall Statistics' => 'إحصائيات عامة', 'Daily' => 'يومي', 'Weekly' => 'أسبوعي', @@ -329,7 +330,7 @@ $LANG['ar'] = array( 'City / Locality' => 'المدينة / المنطقة', 'Organization' => 'مؤسسة', - '1 account' => '1 حساب', + '1 account' => '1 حساب', '%s accounts' => 'حسابات %s', '1 domain' => '1 نطاق', '%s domains' => 'نطاقات %s', @@ -392,6 +393,7 @@ $LANG['ar'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'هل تريد فعلا حذف الاستثناء %s?', 'DELETE_PACKAGE_CONFIRMATION' => 'هل تريد فعلا حذف الرزمة %s?', 'DELETE_IP_CONFIRMATION' => 'هل تريد فعلا حذف عنوان بروتوكول الإنترنت %s?', + 'RESTART_CONFIRMATION' => 'هل أنت متأكد من أنك تريد إعادة تشغيل %s?', 'Welcome' => 'أهلا وسهلا', 'LOGGED_IN_AS' => 'تم تسجيل الدخول ك %s', 'Error' => 'خطأ', diff --git a/web/inc/i18n/bs.php b/web/inc/i18n/bs.php index 98fdb8af6..90c920876 100644 --- a/web/inc/i18n/bs.php +++ b/web/inc/i18n/bs.php @@ -38,6 +38,7 @@ $LANG['bs'] = array( 'Add Package' => 'Dodaj paket', 'Add IP' => 'Dodaj IP', 'Search' => 'Traži', + 'Add one more FTP Account' => 'Dodaj još jednu FTP račun', 'Overall Statistics' => 'Globalna statistika', 'Daily' => 'Dnevno', 'Weekly' => 'Sedmično', @@ -392,6 +393,7 @@ $LANG['bs'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Are you sure to delete %s exclusion?', 'DELETE_PACKAGE_CONFIRMATION' => 'Are you sure to delete package %s?', 'DELETE_IP_CONFIRMATION' => 'Are you sure to delere IP address %s?', + 'RESTART_CONFIRMATION' => 'Are you sure you want to restart %s?', 'Welcome' => 'Dobrodošli', 'LOGGED_IN_AS' => 'Logovani ste kao %s', 'Error' => 'Greška', diff --git a/web/inc/i18n/cn.php b/web/inc/i18n/cn.php index d0de99820..ef0f4fa0d 100644 --- a/web/inc/i18n/cn.php +++ b/web/inc/i18n/cn.php @@ -38,6 +38,7 @@ $LANG['cn'] = array( 'Add Package' => '增加预设方案', 'Add IP' => '增加IP', 'Search' => '搜索', + 'Add one more FTP Account' => '增加一個FTP賬號', 'Overall Statistics' => '总体统计', 'Daily' => '日', 'Weekly' => '周', @@ -392,6 +393,7 @@ $LANG['cn'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Are you sure to delete %s exclusion?', 'DELETE_PACKAGE_CONFIRMATION' => '你确定删除方案 %s?', 'DELETE_IP_CONFIRMATION' => '你确定删除IP地址 %s?', + 'RESTART_CONFIRMATION' => 'Are you sure you want to restart %s?', 'Welcome' => '欢迎光临', 'LOGGED_IN_AS' => '以用户身份 %s 登录', 'Error' => '错误', diff --git a/web/inc/i18n/cz.php b/web/inc/i18n/cz.php index 7f4a95667..bc9249a5e 100644 --- a/web/inc/i18n/cz.php +++ b/web/inc/i18n/cz.php @@ -39,6 +39,7 @@ $LANG['cz'] = array( 'Add Package' => 'Přidat balíček', 'Add IP' => 'Přidat IP', 'Search' => 'Vyhledávání', + 'Add one more FTP Account' => 'Přidat jeden FTP účet', 'Overall Statistics' => 'Celkové statistiky', 'Daily' => 'Denně', 'Weekly' => 'Týdně', @@ -393,6 +394,7 @@ $LANG['cz'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Opravdu chcete odstranit vyloučení %s?', 'DELETE_PACKAGE_CONFIRMATION' => 'Opravdu chcete odstranit package %s?', 'DELETE_IP_CONFIRMATION' => 'Opravdu chcete odstranit IP adresu %s?', + 'RESTART_CONFIRMATION' => 'Opravdu chcete restartovat %s?', 'Welcome' => 'Vítejte!', 'LOGGED_IN_AS' => 'Přihlášen jako uživatel %s', 'Error' => 'Chyba', diff --git a/web/inc/i18n/de.php b/web/inc/i18n/de.php index 9aa9fb291..bcf73c63b 100644 --- a/web/inc/i18n/de.php +++ b/web/inc/i18n/de.php @@ -38,6 +38,7 @@ $LANG['de'] = array( 'Add Package' => 'Paket erstellen', 'Add IP' => 'IP hinzufügen', 'Search' => 'Suche', + 'Add one more FTP Account' => 'Fügen Sie eine weitere FTP-Konto', 'Overall Statistics' => 'Globale Statistik', 'Daily' => 'Täglich', 'Weekly' => 'Wöchentlich', @@ -392,6 +393,7 @@ $LANG['de'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Ausschlüsse %s wirklich löschen?', 'DELETE_PACKAGE_CONFIRMATION' => 'Packet %s? wirklich löschen?', 'DELETE_IP_CONFIRMATION' => '%s wirklich löschen?', + 'RESTART_CONFIRMATION' => '%s wirklich neu starten?', 'Welcome' => 'Willkommen', 'LOGGED_IN_AS' => 'Angemeldet als %s', 'Error' => 'Fehler', diff --git a/web/inc/i18n/en.php b/web/inc/i18n/en.php index f4a8613f2..b44dd555b 100644 --- a/web/inc/i18n/en.php +++ b/web/inc/i18n/en.php @@ -38,6 +38,7 @@ $LANG['en'] = array( 'Add Package' => 'Add Package', 'Add IP' => 'Add IP', 'Search' => 'Search', + 'Add one more FTP Account' => 'Add one more FTP Account', 'Overall Statistics' => 'Overall Statistics', 'Daily' => 'Daily', 'Weekly' => 'Weekly', @@ -265,7 +266,7 @@ $LANG['en'] = array( 'Message' => 'Message', 'use local-part' => 'use local-part', 'one or more email addresses' => 'one or more email addresses', - 'Prefix will be automaticaly added to database name and database user' => 'Prefix %s will be automaticaly added to database name and database user', + 'Prefix will be automaticaly added to database name and database user' => 'Prefix %s will be automaticaly added to database name and database user.', 'Database' => 'Database', 'Type' => 'Type', 'Minute' => 'Minute', @@ -355,50 +356,51 @@ $LANG['en'] = array( '%s objects' => '%s objects', 'no exclusions' => 'no exclusions', - 'USER_CREATED_OK' => 'User %s has been created successfully', + 'USER_CREATED_OK' => 'User %s has been created successfully.', 'WEB_DOMAIN_CREATED_OK' => 'Domain %s has been created successfully.', 'DNS_DOMAIN_CREATED_OK' => 'DNS domain %s has been created successfully.', 'DNS_RECORD_CREATED_OK' => 'Record %s.%s has been created successfully.', 'MAIL_DOMAIN_CREATED_OK' => 'Mail domain %s has been created successfully.', - 'MAIL_ACCOUNT_CREATED_OK' => 'Mail account %s@%s has been created successfully', - 'DATABASE_CREATED_OK' => 'Database %s has been created successfully', + 'MAIL_ACCOUNT_CREATED_OK' => 'Mail account %s@%s has been created successfully.', + 'DATABASE_CREATED_OK' => 'Database %s has been created successfully.', 'CRON_CREATED_OK' => 'Cron job has been created successfully.', 'IP_CREATED_OK' => 'IP address %s has been created successfully.', 'PACKAGE_CREATED_OK' => 'Package %s has been created successfully.', 'SSL_GENERATED_OK' => 'Certificate has been generated successfully.', - 'Autoupdate has been successfully enabled' => 'Autoupdate has been successfully enabled', - 'Autoupdate has been successfully disabled' => 'Autoupdate has been successfully disabled', - 'Changes has been saved.' => 'Changes has been saved.', + 'Autoupdate has been successfully enabled' => 'Autoupdate has been successfully enabled.', + 'Autoupdate has been successfully disabled' => 'Autoupdate has been successfully disabled.', + 'Changes has been saved.' => 'Changes have been saved.', 'Confirmation' => 'Confirmation', - 'DELETE_USER_CONFIRMATION' => 'Are you sure to delete user %s?', - 'SUSPEND_USER_CONFIRMATION' => 'Are you sure to suspend user %s?', - 'UNSUSPEND_USER_CONFIRMATION' => 'Are you sure to unsuspend user %s?', - 'DELETE_DOMAIN_CONFIRMATION' => 'Are you sure to delete domain %s?', - 'SUSPEND_DOMAIN_CONFIRMATION' => 'Are you sure to suspend domain %s?', - 'UNSUSPEND_DOMAIN_CONFIRMATION' => 'Are you sure to unsuspend domain %s?', - 'DELETE_RECORD_CONFIRMATION' => 'Are you sure to delete record %s?', - 'SUSPEND_RECORD_CONFIRMATION' => 'Are you sure to suspend record %s?', - 'UNSUSPEND_RECORD_CONFIRMATION' => 'Are you sure to unsuspend record %s?', - 'DELETE_MAIL_ACCOUNT_CONFIRMATION' => 'Are you sure to delete %s?', - 'SUSPEND_MAIL_ACCOUNT_CONFIRMATION' => 'Are you sure to suspend %s?', - 'UNSUSPEND_MAIL_ACCOUNT_CONFIRMATION' => 'Are you sure to unsuspend %s?', - 'DELETE_DATABASE_CONFIRMATION' => 'Are you sure to delete database %s?', - 'SUSPEND_DATABASE_CONFIRMATION' => 'Are you sure to suspend database %s?', - 'UNSUSPEND_DATABASE_CONFIRMATION' => 'Are you sure to unsuspend database %s?', - 'DELETE_CRON_CONFIRMATION' => 'Are you sure to delete cron job?', - 'SUSPEND_CRON_CONFIRMATION' => 'Are you sure to suspend cron job?', - 'UNSUSPEND_CRON_CONFIRMATION' => 'Are you sure to unsuspend cron job?', - 'DELETE_BACKUP_CONFIRMATION' => 'Are you sure to delete %s backup?', - 'DELETE_EXCLUSION_CONFIRMATION' => 'Are you sure to delete %s exclusion?', - 'DELETE_PACKAGE_CONFIRMATION' => 'Are you sure to delete package %s?', - 'DELETE_IP_CONFIRMATION' => 'Are you sure to delere IP address %s?', + 'DELETE_USER_CONFIRMATION' => 'Are you sure you want to delete user %s?', + 'SUSPEND_USER_CONFIRMATION' => 'Are you sure you want to suspend user %s?', + 'UNSUSPEND_USER_CONFIRMATION' => 'Are you sure you want to unsuspend user %s?', + 'DELETE_DOMAIN_CONFIRMATION' => 'Are you sure you want to delete domain %s?', + 'SUSPEND_DOMAIN_CONFIRMATION' => 'Are you sure you want to suspend domain %s?', + 'UNSUSPEND_DOMAIN_CONFIRMATION' => 'Are you sure you want to unsuspend domain %s?', + 'DELETE_RECORD_CONFIRMATION' => 'Are you sure you want to delete record %s?', + 'SUSPEND_RECORD_CONFIRMATION' => 'Are you sure you want to suspend record %s?', + 'UNSUSPEND_RECORD_CONFIRMATION' => 'Are you sure you want to unsuspend record %s?', + 'DELETE_MAIL_ACCOUNT_CONFIRMATION' => 'Are you sure you want to delete %s?', + 'SUSPEND_MAIL_ACCOUNT_CONFIRMATION' => 'Are you sure you want to suspend %s?', + 'UNSUSPEND_MAIL_ACCOUNT_CONFIRMATION' => 'Are you sure you want to unsuspend %s?', + 'DELETE_DATABASE_CONFIRMATION' => 'Are you sure you want to delete database %s?', + 'SUSPEND_DATABASE_CONFIRMATION' => 'Are you sure you want to suspend database %s?', + 'UNSUSPEND_DATABASE_CONFIRMATION' => 'Are you sure you want to unsuspend database %s?', + 'DELETE_CRON_CONFIRMATION' => 'Are you sure you want to delete cron job?', + 'SUSPEND_CRON_CONFIRMATION' => 'Are you sure you want to suspend cron job?', + 'UNSUSPEND_CRON_CONFIRMATION' => 'Are you sure you want to unsuspend cron job?', + 'DELETE_BACKUP_CONFIRMATION' => 'Are you sure you want to delete %s backup?', + 'DELETE_EXCLUSION_CONFIRMATION' => 'Are you sure you want to delete %s exclusion?', + 'DELETE_PACKAGE_CONFIRMATION' => 'Are you sure you want to delete package %s?', + 'DELETE_IP_CONFIRMATION' => 'Are you sure you want to delete IP address %s?', + 'RESTART_CONFIRMATION' => 'Are you sure you want to restart %s?', 'Welcome' => 'Welcome', 'LOGGED_IN_AS' => 'Logged in as user %s', 'Error' => 'Error', - 'Invalid username or password' => 'Invalid username or password', - 'Invalid username or code' => 'Invalid username or code', - 'Passwords not match' => 'Passwords not match', - 'Please enter valid email address.' => 'Please enter valid email address.', + 'Invalid username or password' => 'Invalid username or password.', + 'Invalid username or code' => 'Invalid username or code.', + 'Passwords not match' => 'Passwords do not match.', + 'Please enter valid email address.' => 'Please enter a valid email address.', 'Field "%s" can not be blank.' => 'Field "%s" can not be blank.', 'Password is too short.' => 'Password is too short (minimum is 6 characters)', 'Error code:' => 'Error code: %s', @@ -406,7 +408,7 @@ $LANG['en'] = array( 'IP address is in use' => 'IP address is in use', 'BACKUP_SCHEDULED' => 'Task has been added to the queue. You will receive an email notification when your backup is ready for download.', 'BACKUP_EXISTS' => 'An existing backup is already running. Please wait for that backup to finish.', - 'RESTORE_SCHEDULED' => 'Task has been added to the queue. You will receive an email notification when your backup is ready for download.', + 'RESTORE_SCHEDULED' => 'Task has been added to the queue. You will receive an email notification when your restore has been completed.', 'RESTORE_EXISTS' => 'An existing restoration task is already running. Please wait for it to finish before launching it again.', 'WEB_EXCLUSIONS' => "Type domain name, one per line. To exclude all domains use *. To exclude specific dirs use following format: domain.com:public_html/cache:public_html/tmp", @@ -420,10 +422,10 @@ $LANG['en'] = array( 'MAIL_FROM' => 'Vesta Control Panel ', 'GREETINGS_GORDON_FREEMAN' => "Hello, %s %s,\n", 'GREETINGS' => "Hello,\n", - 'ACCOUNT_READY' => "Your account has been created and ready for use.\n\nhttps://%s/login/\nUsername: %s\nPassword: %s\n\n--\nVesta Control Panel\n", + 'ACCOUNT_READY' => "Your account has been created and is ready for use.\n\nhttps://%s/login/\nUsername: %s\nPassword: %s\n\n--\nVesta Control Panel\n", 'FTP login credentials' => 'FTP login credentials', - 'FTP_ACCOUNT_READY' => "FTP account has been created and ready for use.\n\nHostname: %s\nUsername: %s_%s\nPassword: %s\n\n--\nVesta Control Panel\n", + 'FTP_ACCOUNT_READY' => "FTP account has been created and is ready for use.\n\nHostname: %s\nUsername: %s_%s\nPassword: %s\n\n--\nVesta Control Panel\n", 'Database Credentials' => 'Database Credentials', 'DATABASE_READY' => "Database has been created successfully.\n\nDatabase: %s\nUser: %s\nPassword: %s\n%s\n\n--\nVesta Control Panel\n", diff --git a/web/inc/i18n/es.php b/web/inc/i18n/es.php index e160a9ee8..6b746b682 100644 --- a/web/inc/i18n/es.php +++ b/web/inc/i18n/es.php @@ -38,6 +38,7 @@ $LANG['es'] = array( 'Add Package' => 'Añadir Plan', 'Add IP' => 'Añadir IP', 'Search' => 'Buscar', + 'Add one more FTP Account' => 'Añadir una más de Cuenta FTP', 'Overall Statistics' => 'Estadística General', 'Daily' => 'Diariamente', 'Weekly' => 'Semanalmente', @@ -392,6 +393,7 @@ $LANG['es'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => '¿Está seguro que desea eliminar el exclusiones %s ?', 'DELETE_PACKAGE_CONFIRMATION' => '¿Está seguor que desea eliminar el plan %s?', 'DELETE_IP_CONFIRMATION' => '¿Está seguro que desea eliminar la dirección IP %s?', + 'RESTART_CONFIRMATION' => '¿Está seguro que desea reiniciar %s?', 'Welcome' => 'Bienvenido', 'LOGGED_IN_AS' => 'Conectado como el usuario %s', 'Error' => 'Error', diff --git a/web/inc/i18n/fi.php b/web/inc/i18n/fi.php index c0b4b0b35..ace48fad3 100644 --- a/web/inc/i18n/fi.php +++ b/web/inc/i18n/fi.php @@ -38,6 +38,7 @@ $LANG['fi'] = array( 'Restore All' => 'Palauta kaikki', 'Add Package' => 'Lisää paketti', 'Add IP' => 'Lisää IP', + 'Add one more FTP Account' => 'Lisää vielä yhden FTP käyttäjä', 'Search' => 'Haku', 'Overall Statistics' => 'Kokonaistilastot', 'Daily' => 'Päivä', @@ -333,7 +334,7 @@ $LANG['fi'] = array( 'City / Locality' => 'Kaupunki / Paikkakunta', 'Organization' => 'Organisaatio', - '1 account' => '1 tili', + '1 account' => '1 tili', '%s accounts' => '%s tiliä', '1 domain' => '1 domain', '%s domains' => '%s domainia', @@ -396,6 +397,7 @@ $LANG['fi'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Haluatko varmasti poistaa %s poikkeuksen?', 'DELETE_PACKAGE_CONFIRMATION' => 'Haluatko varmasti poistaa paketin %s?', 'DELETE_IP_CONFIRMATION' => 'Haluatko varmasti poistaa IP-osoitteen %s?', + 'RESTART_CONFIRMATION' => 'Haluatko varmasti käynnistää uudelleen %s?', 'Welcome' => 'Tervetuloa', 'LOGGED_IN_AS' => 'Kirjautunut käyttäjänä %s', 'Error' => 'Virhe', diff --git a/web/inc/i18n/fr.php b/web/inc/i18n/fr.php index 35a5e5923..b9589fe8a 100644 --- a/web/inc/i18n/fr.php +++ b/web/inc/i18n/fr.php @@ -1,7 +1,7 @@ 'Ajouter un Domaine', 'Add Web Domain' => 'Ajouter un Domaine', 'Add DNS Domain' => 'Ajouter un DNS', - 'Add DNS Record' => 'Ajouter un Enregistrement DNS', + 'Add DNS Record' => 'Ajouter un DNS', 'Add Mail Domain' => 'Ajouter un Domaine', 'Add Mail Account' => 'Ajouter un Compte', 'Add Database' => 'Ajouter une BDD', @@ -38,6 +38,7 @@ $LANG['fr'] = array( 'Add Package' => 'Ajouter un Paquet', 'Add IP' => 'Ajouter une IP', 'Search' => 'Rechercher', + 'Add one more FTP Account' => 'Ajouter un autre Compte FTP', 'Overall Statistics' => 'Statistiques Générales', 'Daily' => 'Quotidien', 'Weekly' => 'Hebdomadaire', @@ -158,7 +159,7 @@ $LANG['fr'] = array( 'IP Addresses' => 'Adresses IP', 'Backups' => 'Sauvegardes', 'Backup System' => 'Système de Sauvegarde', - 'backup exclusions' => 'exclusions de la sauvegarde', + 'backup exclusions' => 'exclusions', 'template' => 'template', 'SSL Support' => 'Support SSL', 'SSL Home Directory' => 'Racine SSL', @@ -291,8 +292,8 @@ $LANG['fr'] = array( 'day of week' => 'jour de la semaine', 'cmd' => 'cmd', 'users' => 'utilisateurs', - 'disk' => 'disque', - 'traffic' => 'traffic', + 'disk' => 'disque', + 'traffic' => 'traffic', 'domains' => 'domaines', 'aliases' => 'alias', 'records' => 'enregistrements', @@ -331,7 +332,7 @@ $LANG['fr'] = array( 'City / Locality' => 'Ville', 'Organization' => 'Organisation', - '1 account' => '1 compte', + '1 account' => '1 compte', '%s accounts' => '%s comptes', '1 domain' => '1 domaine', '%s domains' => '%s domaines', @@ -394,6 +395,7 @@ $LANG['fr'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Êtes-vous sûr de vouloir supprimer l\'exclusion %s ?', 'DELETE_PACKAGE_CONFIRMATION' => 'Êtes-vous sûr de vouloir supprimer le paquet %s ?', 'DELETE_IP_CONFIRMATION' => 'Êtes-vous sûr de vouloir supprimer l\'adresse IP %s ?', + 'RESTART_CONFIRMATION' => 'Êtes-vous sûr de vouloir redémarrer le serveur %s ?', 'Welcome' => 'Bienvenue', 'LOGGED_IN_AS' => 'Connecté en tant que %s', 'Error' => 'Erreur', diff --git a/web/inc/i18n/hu.php b/web/inc/i18n/hu.php index 25b52d700..d5abfbac8 100644 --- a/web/inc/i18n/hu.php +++ b/web/inc/i18n/hu.php @@ -17,7 +17,7 @@ $LANG['hu'] = array( 'Log in' => 'Belépés', 'Log out' => 'Kilépés', - 'USER' => 'FELHASZNÁLÓ', + 'USER' => 'USER', 'WEB' => 'WEB', 'DNS' => 'DNS', 'MAIL' => 'MAIL', @@ -39,6 +39,7 @@ $LANG['hu'] = array( 'Restore All' => 'Összes visszaállítása', 'Add Package' => 'Csomag hozzáadása', 'Add IP' => 'Új IP', + 'Add one more FTP Account' => 'Add one more FTP Account', 'Search' => 'Keresés', 'Overall Statistics' => 'Átfogó statisztikák', 'Daily' => 'Napi', @@ -142,7 +143,7 @@ $LANG['hu'] = array( 'Databases' => 'Adatbázis', 'User Directories' => 'Felhasználói könyvtárak', 'Template' => 'Sablon', - 'Web Template' => 'Apache sablon, + 'Web Template' => 'Apache sablon', 'Proxy Template' => 'Nginx sablon', 'DNS Template' => 'DNS sablon', 'Web Domains' => 'Web Domainek', @@ -331,7 +332,7 @@ $LANG['hu'] = array( 'City / Locality' => 'Város', 'Organization' => 'Szervezet', - '1 account' => '1 fiók', + '1 account' => '1 fiók', '%s accounts' => '%s fiók', '1 domain' => '1 domain', '%s domains' => '%s domainek', @@ -394,11 +395,12 @@ $LANG['hu'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Biztos, hogy törlöd a(z) %s kivételt?', 'DELETE_PACKAGE_CONFIRMATION' => 'Biztos, hogy törlöd a(z) %s csomagot?', 'DELETE_IP_CONFIRMATION' => 'Biztos, hogy törlöd a(z) IP címet?', + 'RESTART_CONFIRMATION' => 'Are you sure you want to restart %s?', 'Welcome' => 'Üdvözöljük', 'LOGGED_IN_AS' => 'Belépve, mint %s', 'Error' => 'Hiba', 'Invalid username or password' => 'Hibás felhasználónév vagy jelszó', - 'Invalid username or code' => 'Hibás felhasználónév vagy kód + 'Invalid username or code' => 'Hibás felhasználónév vagy kód', 'Passwords not match' => 'A jelszavak nem egyeznek meg', 'Please enter valid email address.' => 'Kérlek valós e-mail címet adj meg!', 'Field "%s" can not be blank.' => 'A(z) "%s" mező nem lehet üres.', diff --git a/web/inc/i18n/id.php b/web/inc/i18n/id.php index 783a74559..be50f2daa 100644 --- a/web/inc/i18n/id.php +++ b/web/inc/i18n/id.php @@ -40,6 +40,7 @@ $LANG['id'] = array( 'Restore All' => 'Kembalikan Semua', 'Add Package' => 'Tambah Paket', 'Add IP' => 'Tambah IP', + 'Add one more FTP Account' => 'Tambah satu lagi Pengguna FTP', 'Search' => 'Cari', 'Overall Statistics' => 'Seluruh Statistik', 'Daily' => 'Harian', @@ -332,7 +333,7 @@ $LANG['id'] = array( 'City / Locality' => 'Kota', 'Organization' => 'Organisasi', - '1 account' => '1 pengguna', + '1 account' => '1 pengguna', '%s accounts' => '%s pengguna', '1 domain' => '1 domain', '%s domains' => '%s domains', @@ -395,6 +396,7 @@ $LANG['id'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Pengecualian %s mau dihapus?', 'DELETE_PACKAGE_CONFIRMATION' => 'Paket %s mau dihapus?', 'DELETE_IP_CONFIRMATION' => 'Alamat IP %s beneran mau dihapus?', + 'RESTART_CONFIRMATION' => '%s mau me-restart?', 'Welcome' => 'Selamat Datang', 'LOGGED_IN_AS' => 'Masuk sebagai pengguna %s', 'Error' => 'Kesalahan', diff --git a/web/inc/i18n/it.php b/web/inc/i18n/it.php index 002eca97b..a074ed354 100644 --- a/web/inc/i18n/it.php +++ b/web/inc/i18n/it.php @@ -39,6 +39,7 @@ $LANG['it'] = array( 'Add Package' => 'Nuovo Pacchetto', 'Add IP' => 'Aggiungi IP', 'Search' => 'Cerca', + 'Add one more FTP Account' => 'Nuovo account FTP', 'Overall Statistics' => 'Statistiche Generali', 'Daily' => 'Giornaliero', 'Weekly' => 'Settimanale', @@ -330,7 +331,7 @@ $LANG['it'] = array( 'City / Locality' => 'Città / Località', 'Organization' => 'Organizzazione', - '1 account' => '1 account', + '1 account' => '1 account', '%s accounts' => '%s account', '1 domain' => '1 dominio', '%s domains' => '%s domini', @@ -393,6 +394,7 @@ $LANG['it'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Sei sicuro di voler cancellare l\'esclusione %s?', 'DELETE_PACKAGE_CONFIRMATION' => 'Sei sicuro di voler cancellare il pacchetto %s?', 'DELETE_IP_CONFIRMATION' => 'Sei sicuro di voler l\'indirizoz IP %s?', + 'RESTART_CONFIRMATION' => 'Sei sicuro di voler riavviare %s?', 'Welcome' => 'Benvenuto', 'LOGGED_IN_AS' => 'Connesso come l\'utente %s', 'Error' => 'Errore', diff --git a/web/inc/i18n/nl.php b/web/inc/i18n/nl.php index f64918c8f..c38560c6d 100644 --- a/web/inc/i18n/nl.php +++ b/web/inc/i18n/nl.php @@ -38,6 +38,7 @@ $LANG['nl'] = array( 'Restore All' => 'Herstel alles', 'Add Package' => 'Pakket toevoegen', 'Add IP' => 'IP toevoegen', + 'Add one more FTP Account' => 'Nog een FTP-account toevoegen', 'Search' => 'Zoeken', 'Overall Statistics' => 'Globale statistieken', 'Daily' => 'Dagelijks', @@ -393,6 +394,7 @@ $LANG['nl'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Weet u zeker dat u uitsluitingen %s wilt verwijderen?', 'DELETE_PACKAGE_CONFIRMATION' => 'Weet u zeker dat u het pakket %s wilt verwijderen?', 'DELETE_IP_CONFIRMATION' => 'Weet u zeker dat u het IP-adres %s wilt verwijderen?', + 'RESTART_CONFIRMATION' => 'Weet u zeker dat %s wilt herstarten?', 'Welcome' => 'Welkom', 'LOGGED_IN_AS' => 'Ingelogd als gebruiker %s', 'Error' => 'Fout', diff --git a/web/inc/i18n/no.php b/web/inc/i18n/no.php index 7a601ff5c..971b9f73d 100644 --- a/web/inc/i18n/no.php +++ b/web/inc/i18n/no.php @@ -39,6 +39,7 @@ $LANG['no'] = array( 'Add Package' => 'Legg til Pakke', 'Add IP' => 'Legg til IP', 'Search' => 'Søk', + 'Add one more FTP Account' => 'Legg til én FTP Konto', 'Overall Statistics' => 'Samlede Statistikker', 'Daily' => 'Daglig', 'Weekly' => 'Ukentlig', @@ -330,7 +331,7 @@ $LANG['no'] = array( 'City / Locality' => 'By / Beliggenhet', 'Organization' => 'Organisasjon', - '1 account' => '1 konto', + '1 account' => '1 konto', '%s accounts' => '%s kontoer', '1 domain' => '1 domene', '%s domains' => '%s domener', @@ -393,6 +394,7 @@ $LANG['no'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Er du sikker på at du vil slette %s eksklusjon?', 'DELETE_PACKAGE_CONFIRMATION' => 'Er du sikker på at du vil slette pakken %s?', 'DELETE_IP_CONFIRMATION' => 'Er du sikker på at du vil slette IP Addressen %s?', + 'RESTART_CONFIRMATION' => 'Er du sikker på at du vil omstarte %s?', 'Welcome' => 'Velkommen', 'LOGGED_IN_AS' => 'Logget inn som %s', 'Error' => 'Feil', diff --git a/web/inc/i18n/pt.php b/web/inc/i18n/pt.php index ae6d0a086..0b6dc94b6 100644 --- a/web/inc/i18n/pt.php +++ b/web/inc/i18n/pt.php @@ -38,6 +38,7 @@ $LANG['pt'] = array( 'Add Package' => 'Adicionar Pacote', 'Add IP' => 'Adicionar IP', 'Search' => 'Pesquisar', + 'Add one more FTP Account' => 'Adicionar mais uma conta FTP', 'Overall Statistics' => 'Estatísticas Gerais', 'Daily' => 'Diário', 'Weekly' => 'Semanal', @@ -392,6 +393,7 @@ $LANG['pt'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Tem certeza que deseja deletar o exclusões %s?', 'DELETE_PACKAGE_CONFIRMATION' => 'Tem certeza que deseja deletar o pacote %s?', 'DELETE_IP_CONFIRMATION' => 'Tem certeza que deseja deletar o endereço IP %s?', + 'RESTART_CONFIRMATION' => 'Tem certeza que deseja reiniciar %s?', 'Welcome' => 'Bem Vindo', 'LOGGED_IN_AS' => 'Entrar como o usuário %s', 'Error' => 'Erro', diff --git a/web/inc/i18n/ro.php b/web/inc/i18n/ro.php index c659275b8..aca021c5f 100644 --- a/web/inc/i18n/ro.php +++ b/web/inc/i18n/ro.php @@ -40,6 +40,7 @@ $LANG['ro'] = array( 'Add Package' => 'Adăugare pachet', 'Add IP' => 'Adăugare IP', 'Search' => 'Сăutare', + 'Add one more FTP Account' => 'Inca un FTP count', 'Overall Statistics' => 'Statistică rezumativă', 'Daily' => 'Zilnic', 'Weekly' => 'Săptămânal', @@ -394,6 +395,7 @@ $LANG['ro'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Ești sigur că dorești să ștergi excludere %s?', 'DELETE_PACKAGE_CONFIRMATION' => 'Ești sigur că dorești să ștergi %s', 'DELETE_IP_CONFIRMATION' => 'Ești sigur că dorești să șterge IP %s?', + 'RESTART_CONFIRMATION' => 'Ești sigur că dorești să restartezi %s?', 'Welcome' => 'Bun venit', 'LOGGED_IN_AS' => 'Ai intrat ca utilizator %s', 'Error' => 'Eroare', diff --git a/web/inc/i18n/ru.php b/web/inc/i18n/ru.php index 89e877d3c..6dad5bac9 100644 --- a/web/inc/i18n/ru.php +++ b/web/inc/i18n/ru.php @@ -40,6 +40,7 @@ $LANG['ru'] = array( 'Add Package' => 'Добавить пакет', 'Add IP' => 'Добавить IP', 'Search' => 'Поиск', + 'Add one more FTP Account' => 'Добавить еще один FTP аккаунт', 'Overall Statistics' => 'Сводная статистика', 'Daily' => 'Ежедневые', 'Weekly' => 'Еженедельные', @@ -394,6 +395,7 @@ $LANG['ru'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Вы уверены, что хотите удалить исключение %s?', 'DELETE_PACKAGE_CONFIRMATION' => 'Вы уверены, что хотите удалить пакет %s?', 'DELETE_IP_CONFIRMATION' => 'Вы уверены, что хотите удалить IP адрес %s?', + 'RESTART_CONFIRMATION' => 'Вы уверены, что хотите перезагрузить %s?', 'Welcome' => 'Добро пожаловать', 'LOGGED_IN_AS' => 'Вы вошли как пользователь %s', 'Error' => 'Ошибка', diff --git a/web/inc/i18n/ua.php b/web/inc/i18n/ua.php index 4bb39c6c1..ed3eef9f9 100644 --- a/web/inc/i18n/ua.php +++ b/web/inc/i18n/ua.php @@ -4,9 +4,9 @@ * COLOBOCman (colobocman@gmail.com) * Alex Connor (alex_connor@icloud.com) */ - + $LANG['ua'] = array( - + 'Packages' => 'Пакети', 'IP' => 'IP', 'Graphs' => 'Графіки', @@ -16,7 +16,7 @@ $LANG['ua'] = array( 'Updates' => 'Оновлення', 'Log in' => 'Увійти', 'Log out' => 'Вийти', - + 'USER' => 'USER', 'WEB' => 'WEB', 'DNS' => 'DNS', @@ -24,7 +24,7 @@ $LANG['ua'] = array( 'DB' => 'DB', 'CRON' => 'CRON', 'BACKUP' => 'BACKUP', - + 'Add User' => 'Додати акаунт', 'Add Domain' => 'Додати домен', 'Add Web Domain' => 'Додати WEB домен', @@ -39,6 +39,7 @@ $LANG['ua'] = array( 'Restore All' => 'Відновити все', 'Add Package' => 'Додати пакет', 'Add IP' => 'Додати IP', + 'Add one more FTP Account' => 'Додати ще один FTP акаунт', 'Search' => 'Пошук', 'Overall Statistics' => 'Загальна статистика', 'Daily' => 'Щоденні', @@ -49,7 +50,7 @@ $LANG['ua'] = array( 'Back' => 'Назад', 'Save' => 'Зберегти', 'Submit' => 'Відправити', - + 'toggle all' => 'виділити все', 'apply to selected' => 'застосувати до вибраних', 'rebuild' => 'перестворити', @@ -86,7 +87,7 @@ $LANG['ua'] = array( 'reread IP' => 'оновити IP', 'enable autoupdate' => 'увімкнути автооновлення', 'disable autoupdate' => 'вимкнути автооновлення', - + 'Adding User' => 'Додавання акаунту', 'Editing User' => 'Редагування акаунту', 'Adding Domain' => 'Додавання домену', @@ -111,7 +112,7 @@ $LANG['ua'] = array( 'Generating CSR' => 'Генерування CSR запиту', 'Listing' => 'Список', 'Search Results' => 'Результати пошуку', - + 'active' => 'активне', 'spnd' => 'заблоковано', 'suspended' => 'заблокований', @@ -119,7 +120,7 @@ $LANG['ua'] = array( 'stopped' => 'зупинений', 'outdated' => 'застарілий', 'updated' => 'оновлений', - + 'yes' => 'так', 'no' => 'ні', 'none' => 'нема', @@ -356,7 +357,7 @@ $LANG['ua'] = array( '1 object' => 'об`єктів на сторінці: 1', '%s objects' => 'об`єктів на сторінці: %s', 'no exclusions' => 'немає виключень', - + 'USER_CREATED_OK' => 'Аккаунт %s успішно створено', 'WEB_DOMAIN_CREATED_OK' => 'Домен %s успішно створено.', 'DNS_DOMAIN_CREATED_OK' => 'Домен %s успішно створено.', @@ -394,6 +395,7 @@ $LANG['ua'] = array( 'DELETE_EXCLUSION_CONFIRMATION' => 'Ви впевнені, що хочете видалити вийняток %s?', 'DELETE_PACKAGE_CONFIRMATION' => 'Ви впевнені, що хочете видалити пакет %s?', 'DELETE_IP_CONFIRMATION' => 'Ви впевнені, що хочете видалити IP адресу %s?', + 'RESTART_CONFIRMATION' => 'Ви впевнені, що хочете перезапустити %s?', 'Welcome' => 'Ласкаво просимо', 'LOGGED_IN_AS' => 'Ви увійшли як користувач %s', 'Error' => 'Помилка', @@ -417,19 +419,19 @@ $LANG['ua'] = array( 'DB_EXCLUSIONS' => "Вкажіть бази по одній на рядок. Для того, щоб виключити всі, використовуйте *", 'CRON_EXCLUSIONS' => "Для того, щоб виключити всі завдання, використовуйте *", 'USER_EXCLUSIONS' => "Вкажіть теки по одній на рядок. Для того, щоб виключити всі, використовуйте *", - + 'Welcome to Vesta Control Panel' => 'Вітаємо в панелі керування Vesta', 'MAIL_FROM' => 'Vesta Control Panel ', 'GREETINGS_GORDON_FREEMAN' => "Вітаємо, %s %s,\n", 'GREETINGS' => "Вітаємо,\n", 'ACCOUNT_READY' => "Ваш аккаунт успішно створений і готовий до використання.\n\nhttps://%s/login/\nІм`я користувача: %s\nПароль: %s\n\n--\nПанель керування Vesta\n", - + 'FTP login credentials' => 'Дані доступу до FTP', 'FTP_ACCOUNT_READY' => "FTP аккаунт успішно створений і готовий до використання.\n\nХост: %s\nІм`я користувача: %s_%s\nПароль: %s\n\n--\nПанель керування Vesta\n", - + 'Database Credentials' => 'Дані доступу до БД', 'DATABASE_READY' => "База даних успішно створена.\n\nБаза даних: %s\nКористувач: %s\nПароль: %s\n%s\n\n--\nПанель керування Vesta\n", - + 'forgot password' => 'нагадати', 'Confirm' => 'Підтвердити', 'New Password' => 'Новий пароль', diff --git a/web/js/events.js b/web/js/events.js index f183ba831..881eadcfa 100644 --- a/web/js/events.js +++ b/web/js/events.js @@ -102,7 +102,7 @@ VE.helpers.createConfirmationDialog = function(elm, dialog_title, confirmed_loca $(this).dialog("destroy"); }, buttons: { - "Ok": function(event, ui) { + "OK": function(event, ui) { location.href = confirmed_location_url; }, "Cancel": function() { diff --git a/web/js/pages/add.web.js b/web/js/pages/add.web.js index 8b06b14a0..d350a4375 100644 --- a/web/js/pages/add.web.js +++ b/web/js/pages/add.web.js @@ -1,37 +1,158 @@ -// -// -// Updates ftp username dynamically, showing its prefix App.Actions.WEB.update_ftp_username_hint = function(elm, hint) { if (hint.trim() == '') { $(elm).parent().find('.hint').html(''); - } - // remove prefix from value in order to eliminate duplicates + } + + hint = hint.replace(/[^\w\d]/gi, ''); + if (hint.indexOf(GLOBAL.FTP_USER_PREFIX) == 0) { hint = hint.slice(GLOBAL.FTP_USER_PREFIX.length, hint.length); } - + $(elm).parent().find('.v-ftp-user').val(hint); $(elm).parent().find('.hint').text(GLOBAL.FTP_USER_PREFIX + hint); } -// -// listener that triggers ftp user hint updating App.Listeners.WEB.keypress_ftp_username = function() { - var ref = $('input[name="v_ftp_user"]'); - var current_val = ref.val(); - if (current_val.trim() != '') { - App.Actions.DB.update_ftp_username_hint(ref, current_val); - } - - ref.bind('keypress input', function(evt) { + var ftp_user_inputs = $('.v-ftp-user'); + $.each(ftp_user_inputs, function(i, ref) { + var ref = $(ref); + var current_val = ref.val(); + if (current_val.trim() != '') { + App.Actions.WEB.update_ftp_username_hint(ref, current_val); + } + + ref.bind('keypress', function(evt) { + clearTimeout(window.frp_usr_tmt); + window.frp_usr_tmt = setTimeout(function() { + var elm = $(evt.target); + App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val()); + }, 100); + }); + }); +} + +App.Listeners.WEB.keypress_domain_name = function() { + $('#v_domain').bind('keypress', function(evt) { clearTimeout(window.frp_usr_tmt); window.frp_usr_tmt = setTimeout(function() { - var elm = $(evt.target); - App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val()); + //var elm = $(evt.target); + //App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val()); + var domain = $('.ftp-path-prefix').text(GLOBAL.FTP_USER_PREPATH + '/' + $('#v_domain').val()); }, 100); }); } +// +// + +App.Actions.WEB.update_ftp_path_hint = function(elm, hint) { + if (hint.trim() == '') { + $(elm).parent().find('.v-ftp-path-hint').html(''); + } + + if (hint[0] != '/') { + hint = '/' + hint; + } + hint = hint.replace(/\/(\/+)/g, '/'); + + $(elm).parent().find('.v-ftp-path-hint').text(hint); +} + +App.Listeners.WEB.keypress_ftp_path = function() { + var ftp_path_inputs = $('.v-ftp-path'); + $.each(ftp_path_inputs, function(i, ref) { + var ref = $(ref); + var current_val = ref.val(); + if (current_val.trim() != '') { + App.Actions.WEB.update_ftp_path_hint(ref, current_val); + } + + ref.bind('keypress', function(evt) { + clearTimeout(window.frp_usr_tmt); + window.frp_usr_tmt = setTimeout(function() { + var elm = $(evt.target); + App.Actions.WEB.update_ftp_path_hint(elm, $(elm).val()); + }, 100); + }); + }); +} + +// +// +App.Actions.WEB.add_ftp_user_form = function() { + var ref = $('#templates').find('.ftptable').clone(true); + var index = $('.data-col2 .ftptable').length + 1; + + ref.find('input').each(function(i, elm) { + var attr_value = $(elm).attr('name').replace('%INDEX%', index); + $(elm).attr('name', attr_value); + }); + + ref.find('.ftp-user-number').text(index); + + $('.data-col2 .ftptable:last').after(ref); + + var index = 1; + $('.data-col2 .ftp-user-number:visible').each(function(i, o) { + $(o).text(index); + index += 1; + }); +} + +App.Actions.WEB.remove_ftp_user = function(elm) { + var ref = $(elm).parents('.ftptable'); + ref.remove(); + + var index = 1; + $('.data-col2 .ftp-user-number:visible').each(function(i, o) { + $(o).text(index); + index += 1; + }); + + if ($('.ftptable-nrm:visible').length == 0) { + $('.v-add-new-user').hide(); + $('input[name="v_ftp"]').attr('checked', false); + } +} + + +App.Actions.WEB.toggle_additional_ftp_accounts = function(elm) { + if ($(elm).attr('checked')) { + $('.ftptable-nrm, .v-add-new-user, .add-new-ftp-user-button').show(); + $('.ftptable-nrm').each(function(i, elm) { + var login = $(elm).find('.v-ftp-user'); + if (login.val().trim() != '') { + $(elm).find('.v-ftp-user-deleted').val(0); + } + }); + } + else { + $('.ftptable-nrm, .v-add-new-user, .add-new-ftp-user-button').hide(); + $('.ftptable-nrm').each(function(i, elm) { + var login = $(elm).find('.v-ftp-user'); + if (login.val().trim() != '') { + $(elm).find('.v-ftp-user-deleted').val(1); + } + }); + } + + if ($('.ftptable-nrm:visible').length == 0) { + var ref = $('#templates').find('.ftptable').clone(true); + var index = $('.data-col2 .ftptable').length + 1; + + ref.find('input').each(function(i, elm) { + var attr_value = $(elm).attr('name').replace('%INDEX%', index); + $(elm).attr('name', attr_value); + }); + + ref.find('.ftp-user-number').text(index); + + $('.v-add-new-user').parent('tr').prev().find('td').html(ref); + } +} + // // Page entry point -// Trigger listeners App.Listeners.WEB.keypress_ftp_username(); +App.Listeners.WEB.keypress_ftp_path(); +App.Listeners.WEB.keypress_domain_name(); diff --git a/web/js/pages/edit.web.js b/web/js/pages/edit.web.js index fc9be3fcf..5d8ede2f2 100644 --- a/web/js/pages/edit.web.js +++ b/web/js/pages/edit.web.js @@ -1,29 +1,138 @@ App.Actions.WEB.update_ftp_username_hint = function(elm, hint) { if (hint.trim() == '') { $(elm).parent().find('.hint').html(''); - } + } + + hint = hint.replace(/[^\w\d]/gi, ''); + if (hint.indexOf(GLOBAL.FTP_USER_PREFIX) == 0) { hint = hint.slice(GLOBAL.FTP_USER_PREFIX.length, hint.length); } + $(elm).parent().find('.v-ftp-user').val(hint); $(elm).parent().find('.hint').text(GLOBAL.FTP_USER_PREFIX + hint); } App.Listeners.WEB.keypress_ftp_username = function() { - var ref = $('input[name="v_ftp_user"]'); - var current_val = ref.val(); - if (current_val.trim() != '') { - App.Actions.DB.update_ftp_username_hint(ref, current_val); + var ftp_user_inputs = $('.v-ftp-user'); + $.each(ftp_user_inputs, function(i, ref) { + var ref = $(ref); + var current_val = ref.val(); + if (current_val.trim() != '') { + App.Actions.WEB.update_ftp_username_hint(ref, current_val); + } + + ref.bind('keypress', function(evt) { + clearTimeout(window.frp_usr_tmt); + window.frp_usr_tmt = setTimeout(function() { + var elm = $(evt.target); + App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val()); + }, 100); + }); + }); +} + +// +// + +App.Actions.WEB.update_ftp_path_hint = function(elm, hint) { + if (hint.trim() == '') { + $(elm).parent().find('.v-ftp-path-hint').html(''); + } + + if (hint[0] != '/') { + hint = '/' + hint; } - ref.bind('keypress', function(evt) { - clearTimeout(window.frp_usr_tmt); - window.frp_usr_tmt = setTimeout(function() { - var elm = $(evt.target); - App.Actions.WEB.update_ftp_username_hint(elm, $(elm).val()); - }, 100); + hint = hint.replace(/\/(\/+)/g, '/'); + + $(elm).parent().find('.v-ftp-path-hint').text(hint); +} + +App.Listeners.WEB.keypress_ftp_path = function() { + var ftp_path_inputs = $('.v-ftp-path'); + $.each(ftp_path_inputs, function(i, ref) { + var ref = $(ref); + var current_val = ref.val(); + if (current_val.trim() != '') { + App.Actions.WEB.update_ftp_path_hint(ref, current_val); + } + + ref.bind('keypress', function(evt) { + clearTimeout(window.frp_usr_tmt); + window.frp_usr_tmt = setTimeout(function() { + var elm = $(evt.target); + App.Actions.WEB.update_ftp_path_hint(elm, $(elm).val()); + }, 100); + }); }); } +// +// +App.Actions.WEB.add_ftp_user_form = function() { + var ref = $('#templates').find('.ftptable').clone(true); + var index = $('.data-col2 .ftptable').length + 1; + + ref.find('input').each(function(i, elm) { + var attr_value = $(elm).attr('name').replace('%INDEX%', index); + $(elm).attr('name', attr_value); + }); + + ref.find('.ftp-user-number').text(index); + + $('.data-col2 .ftptable:last').after(ref); + + var index = 1; + $('.data-col2 .ftp-user-number:visible').each(function(i, o) { + $(o).text(index); + index += 1; + }); +} + +App.Actions.WEB.remove_ftp_user = function(elm) { + var ref = $(elm).parents('.ftptable'); + ref.find('.v-ftp-user-deleted').val('1'); + if (ref.find('.v-ftp-user-is-new').val() == 1) { + ref.remove(); + return true; + } + ref.removeClass('ftptable-nrm'); + ref.hide(); + + var index = 1; + $('.data-col2 .ftp-user-number:visible').each(function(i, o) { + $(o).text(index); + index += 1; + }); + + if ($('.ftptable-nrm:visible').length == 0) { + $('.add-new-ftp-user-button').hide(); + $('input[name="v_ftp"]').attr('checked', false); + } +} + +App.Actions.WEB.toggle_additional_ftp_accounts = function(elm) { + if ($(elm).attr('checked')) { + $('.ftptable-nrm, .v-add-new-user, .add-new-ftp-user-button').show(); + $('.ftptable-nrm').each(function(i, elm) { + var login = $(elm).find('.v-ftp-user'); + if (login.val().trim() != '') { + $(elm).find('.v-ftp-user-deleted').val(0); + } + }); + } + else { + $('.ftptable-nrm, .v-add-new-user, .add-new-ftp-user-button').hide(); + $('.ftptable-nrm').each(function(i, elm) { + var login = $(elm).find('.v-ftp-user'); + if (login.val().trim() != '') { + $(elm).find('.v-ftp-user-deleted').val(1); + } + }); + } +} + // // Page entry point App.Listeners.WEB.keypress_ftp_username(); +App.Listeners.WEB.keypress_ftp_path(); diff --git a/web/js/templates.js b/web/js/templates.js index ee5aeda60..e91f2f799 100644 --- a/web/js/templates.js +++ b/web/js/templates.js @@ -66,7 +66,7 @@ var Templator = function() { 'undefined' == typeof App.Templates._indexes[key] ? App.Templates._indexes[key] = {} : false; 'undefined' == typeof App.Templates._indexes[key][ref_key] ? - App.Templates._indexes[key][ref_key] = {} : false; + App.Templates._indexes[key][ref_key] = {} : false; jQuery(tpl).each(function(index, o) { if (':' == o.charAt(0)) { @@ -84,8 +84,8 @@ var Templator = function() Templator.getTemplate = function(ns, key){ return [ - App.Templates._indexes[ns][key], - App.Templates.html[ns][key].slice(0) + App.Templates._indexes[ns][key], + App.Templates.html[ns][key].slice(0) ]; } // init templator diff --git a/web/templates/admin/add_cron.html b/web/templates/admin/add_cron.html index c988cba9b..ac998b9c1 100644 --- a/web/templates/admin/add_cron.html +++ b/web/templates/admin/add_cron.html @@ -34,7 +34,7 @@ - @@ -44,7 +44,7 @@ - @@ -54,7 +54,7 @@ - @@ -64,7 +64,7 @@ - @@ -74,7 +74,7 @@ - @@ -84,22 +84,22 @@ -
+
+
+
+
+
+
- > + >
- - diff --git a/web/templates/admin/add_db.html b/web/templates/admin/add_db.html index 438824ab3..b864043b4 100644 --- a/web/templates/admin/add_db.html +++ b/web/templates/admin/add_db.html @@ -54,12 +54,12 @@
+ +
- - @@ -70,7 +70,7 @@ - @@ -81,17 +81,17 @@ - - @@ -109,7 +109,7 @@ - @@ -128,7 +128,7 @@ - @@ -174,7 +174,7 @@ - @@ -186,10 +186,10 @@
+
+
+
+ /
- +
+
+
+
+
- - diff --git a/web/templates/admin/add_dns.html b/web/templates/admin/add_dns.html index c7d042594..c78393d3a 100644 --- a/web/templates/admin/add_dns.html +++ b/web/templates/admin/add_dns.html @@ -45,7 +45,7 @@
+ +
- @@ -55,7 +55,7 @@ - @@ -65,15 +65,15 @@ - -
+
+
+
- +
+ - @@ -83,7 +83,7 @@ - @@ -93,7 +93,7 @@ - @@ -123,10 +123,10 @@
+ ()
+ TTL
+
- - diff --git a/web/templates/admin/add_dns_rec.html b/web/templates/admin/add_dns_rec.html index 4fb6ad71b..f79eb0b2d 100644 --- a/web/templates/admin/add_dns_rec.html +++ b/web/templates/admin/add_dns_rec.html @@ -34,7 +34,7 @@
+ +
- @@ -44,7 +44,7 @@ - @@ -55,7 +55,7 @@ - @@ -78,7 +78,7 @@ - @@ -88,7 +88,7 @@ - @@ -100,10 +100,10 @@
+
+
+
+
+ ()
- - diff --git a/web/templates/admin/add_ip.html b/web/templates/admin/add_ip.html index 2957bd6c4..6bb0ec5fe 100644 --- a/web/templates/admin/add_ip.html +++ b/web/templates/admin/add_ip.html @@ -45,7 +45,7 @@
+ +
- @@ -55,7 +55,7 @@ - @@ -65,7 +65,7 @@ - @@ -83,25 +83,20 @@ - - - - -
+
+
+
- + +
- onclick="javascript:elementHideShow('usrtable');"> -
+ - - - @@ -127,7 +122,7 @@ - @@ -141,10 +136,10 @@
+
+
+ ()
+ ()
- - diff --git a/web/templates/admin/add_mail.html b/web/templates/admin/add_mail.html index 3c839b482..3f284b7dc 100644 --- a/web/templates/admin/add_mail.html +++ b/web/templates/admin/add_mail.html @@ -34,7 +34,7 @@
+ +
- @@ -44,42 +44,27 @@ - - - - - - - - - - - -
+
- + +
- > + +
- -
- > -
- -
- > + +
- - diff --git a/web/templates/admin/add_mail_acc.html b/web/templates/admin/add_mail_acc.html index bbf943e62..65afefeab 100644 --- a/web/templates/admin/add_mail_acc.html +++ b/web/templates/admin/add_mail_acc.html @@ -55,7 +55,7 @@
+ +
- @@ -65,7 +65,7 @@ - @@ -75,25 +75,25 @@ - - -
+
+
+ /
- +
+
+ - @@ -103,7 +103,7 @@ - @@ -113,7 +113,7 @@ - @@ -123,26 +123,20 @@ - - - - -
+ ()
+ ()
+ ()
- + +
- > -
- - diff --git a/web/templates/admin/add_package.html b/web/templates/admin/add_package.html index 56777f656..833b088e2 100644 --- a/web/templates/admin/add_package.html +++ b/web/templates/admin/add_package.html @@ -35,7 +35,7 @@
+ +
- @@ -45,7 +45,7 @@ - @@ -68,7 +68,7 @@ - @@ -91,7 +91,7 @@ - @@ -114,7 +114,7 @@ - @@ -137,7 +137,7 @@ - @@ -147,7 +147,7 @@ - @@ -157,7 +157,7 @@ - @@ -167,7 +167,7 @@ - @@ -177,7 +177,7 @@ - @@ -187,7 +187,7 @@ - @@ -197,7 +197,7 @@ - @@ -207,7 +207,7 @@ - @@ -217,7 +217,7 @@ - @@ -227,7 +227,7 @@ - @@ -237,7 +237,7 @@ - @@ -247,7 +247,7 @@ - @@ -274,10 +274,10 @@
+
+
+
+
+
+
+ ()
+
+ ()
+
+ ()
+
+
+
+ ()
+ ()
+
- - diff --git a/web/templates/admin/add_user.html b/web/templates/admin/add_user.html index b645e7ac9..2913a9497 100644 --- a/web/templates/admin/add_user.html +++ b/web/templates/admin/add_user.html @@ -53,7 +53,7 @@
+ +
- @@ -63,17 +63,17 @@ - @@ -83,7 +83,7 @@ - @@ -107,7 +107,7 @@ - @@ -133,7 +133,7 @@ - @@ -143,7 +143,7 @@ - @@ -153,7 +153,7 @@ - @@ -166,10 +166,10 @@
+
+ /
- +
+
+
+
+
+
- - diff --git a/web/templates/admin/add_web.html b/web/templates/admin/add_web.html index 6f50d67a5..b8522c1ab 100644 --- a/web/templates/admin/add_web.html +++ b/web/templates/admin/add_web.html @@ -42,7 +42,7 @@ document.v_add_web.v_stats_password.value = webrandom; } - function FTPrandom() { + function FTPrandom(elm) { var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; var string_length = 10; var ftprandomstring = ''; @@ -50,7 +50,7 @@ var rnum = Math.floor(Math.random() * chars.length); ftprandomstring += chars.substring(rnum,rnum+1); } - document.v_add_web.v_ftp_password.value = ftprandomstring; + $(elm).parents('.ftptable').find('.v-ftp-user-psw').val(ftprandomstring); } function elementHideShow(elementToHideOrShow){ @@ -75,7 +75,7 @@
+ +
- @@ -85,7 +85,7 @@ - @@ -107,34 +107,24 @@ - - - - - - - - -
+
+
- + +
- > + +
- -
- > -
+
- @@ -144,25 +134,20 @@ - - - -
+
- -
- onclick="javascript:elementHideShow('proxytable');"> + +
- - @@ -170,26 +155,21 @@ - - - -
+
+
- / + + /
- onclick="javascript:elementHideShow('ssltable');"> -
- - - - - - - - @@ -234,7 +214,7 @@ - @@ -256,20 +236,15 @@ - - - - - - - - -
+
+
+
+
+
+
+ ()
+
+
- + +
- onclick="javascript:elementHideShow('statstable');"> -
+ - @@ -279,73 +254,104 @@ -
+
+ /
- +
- + +
- onclick="javascript:elementHideShow('ftptable');"> -
- - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + +
-
- -
- -
- / -
- - -
- class="ftptable ftptable-nrm" name="v_add_domain_ftp"> +
+ # () + + +
+
+ +
+ name="v_ftp_user[][v_ftp_user]" > + +
+ / +
+ + +
+ + +
+ +
+ + +
+ - - @@ -354,7 +360,71 @@
+ +
+ + + diff --git a/web/templates/admin/edit_backup_exclusions.html b/web/templates/admin/edit_backup_exclusions.html index 770966eb5..e2f974d78 100644 --- a/web/templates/admin/edit_backup_exclusions.html +++ b/web/templates/admin/edit_backup_exclusions.html @@ -38,7 +38,7 @@
- @@ -48,7 +48,7 @@ - @@ -58,7 +58,7 @@ - @@ -68,7 +68,7 @@ - @@ -78,7 +78,7 @@ - @@ -88,7 +88,7 @@ - @@ -100,10 +100,10 @@
+
+
+
+
+
+
- - diff --git a/web/templates/admin/edit_cron.html b/web/templates/admin/edit_cron.html index 9a6cd1bcb..786180a0b 100644 --- a/web/templates/admin/edit_cron.html +++ b/web/templates/admin/edit_cron.html @@ -40,7 +40,7 @@
+ +
- @@ -50,7 +50,7 @@ - @@ -60,7 +60,7 @@ - @@ -70,7 +70,7 @@ - @@ -80,7 +80,7 @@ - @@ -90,22 +90,22 @@ -
+
+
+
+
+
+
- > + >
- - @@ -113,4 +113,4 @@
+ +
- + \ No newline at end of file diff --git a/web/templates/admin/edit_db.html b/web/templates/admin/edit_db.html index 8a7af352d..96111abdd 100644 --- a/web/templates/admin/edit_db.html +++ b/web/templates/admin/edit_db.html @@ -61,7 +61,7 @@
- @@ -72,7 +72,7 @@ - @@ -83,17 +83,17 @@ - @@ -103,7 +103,7 @@ - @@ -113,7 +113,7 @@ - @@ -125,10 +125,10 @@
+
+
+ /
- +
+
+
- - diff --git a/web/templates/admin/edit_dns.html b/web/templates/admin/edit_dns.html index 017ffca65..ff28fc8e5 100644 --- a/web/templates/admin/edit_dns.html +++ b/web/templates/admin/edit_dns.html @@ -40,7 +40,7 @@
+ +
- @@ -50,7 +50,7 @@ - @@ -60,7 +60,7 @@ - @@ -81,7 +81,7 @@ - @@ -91,7 +91,7 @@ - @@ -101,7 +101,7 @@ - @@ -113,10 +113,10 @@
+
+
+
+ ()
+ SOA
+ TTL
- - diff --git a/web/templates/admin/edit_dns_rec.html b/web/templates/admin/edit_dns_rec.html index ad900fa75..b9e5f97c8 100644 --- a/web/templates/admin/edit_dns_rec.html +++ b/web/templates/admin/edit_dns_rec.html @@ -40,7 +40,7 @@
+ +
- @@ -51,7 +51,7 @@ - @@ -61,7 +61,7 @@ - @@ -71,7 +71,7 @@ - @@ -81,7 +81,7 @@ - @@ -91,7 +91,7 @@ - @@ -104,10 +104,10 @@
+
+
+
+
+ ()
+ ()
- - diff --git a/web/templates/admin/edit_ip.html b/web/templates/admin/edit_ip.html index 49e97b1c5..a166a2d14 100644 --- a/web/templates/admin/edit_ip.html +++ b/web/templates/admin/edit_ip.html @@ -52,7 +52,7 @@
+ +
- @@ -62,7 +62,7 @@ - @@ -72,7 +72,7 @@ - @@ -82,35 +82,36 @@ - - - - - - - - - @@ -120,7 +121,7 @@ - @@ -133,10 +134,10 @@
+
+
+
- + +
- + + + + + + + + +
+ +
+ +
- -
- -
+ ()
+ ()
- - @@ -144,4 +145,4 @@
+ +
- + \ No newline at end of file diff --git a/web/templates/admin/edit_mail.html b/web/templates/admin/edit_mail.html index 4f4e82006..e9317d1c2 100644 --- a/web/templates/admin/edit_mail.html +++ b/web/templates/admin/edit_mail.html @@ -40,7 +40,7 @@
- @@ -50,37 +50,22 @@ - - - - - - - - - - - - - @@ -92,10 +77,10 @@
+
- + +
- > + +
- + +
- > -
- -
- > -
+
- - diff --git a/web/templates/admin/edit_mail_acc.html b/web/templates/admin/edit_mail_acc.html index c427685b1..1ca35090a 100644 --- a/web/templates/admin/edit_mail_acc.html +++ b/web/templates/admin/edit_mail_acc.html @@ -62,7 +62,7 @@
+ +
- @@ -74,17 +74,17 @@ - @@ -94,7 +94,7 @@ - @@ -104,7 +104,7 @@ - @@ -114,27 +114,17 @@ - - - - - - - - -
+
+ /
- + ()
+ ()
+ ()
- + +
- > + +
- -
- onclick="javascript:elementHideShow('autoreplytable');"> -
+
@@ -152,10 +142,10 @@
- - diff --git a/web/templates/admin/edit_package.html b/web/templates/admin/edit_package.html index 079d637b5..e7248659e 100644 --- a/web/templates/admin/edit_package.html +++ b/web/templates/admin/edit_package.html @@ -40,7 +40,7 @@
+ +
- @@ -51,7 +51,7 @@ - @@ -74,7 +74,7 @@ - @@ -97,7 +97,7 @@ - @@ -120,7 +120,7 @@ - @@ -143,7 +143,7 @@ - @@ -153,7 +153,7 @@ - @@ -163,7 +163,7 @@ - @@ -173,7 +173,7 @@ - @@ -183,7 +183,7 @@ - @@ -193,7 +193,7 @@ - @@ -203,7 +203,7 @@ - @@ -213,7 +213,7 @@ - @@ -223,7 +223,7 @@ - @@ -233,7 +233,7 @@ - @@ -243,7 +243,7 @@ - @@ -253,7 +253,7 @@ - @@ -280,10 +280,10 @@
+
+
+
+
+
+
+ ()
+
+ ()
+
+ ()
+
+
+
+ ()
+ ()
+
- - diff --git a/web/templates/admin/edit_user.html b/web/templates/admin/edit_user.html index c1b93a3c5..bec90e90d 100644 --- a/web/templates/admin/edit_user.html +++ b/web/templates/admin/edit_user.html @@ -52,7 +52,7 @@
+ +
- @@ -62,17 +62,17 @@ - @@ -82,7 +82,7 @@ - @@ -103,7 +103,7 @@ - @@ -127,7 +127,7 @@ - @@ -137,7 +137,7 @@ - @@ -147,7 +147,7 @@ - @@ -168,7 +168,7 @@ - @@ -195,10 +195,10 @@
+
+ /
- +
+
+
+
+
+
+
- - diff --git a/web/templates/admin/edit_web.html b/web/templates/admin/edit_web.html index 3ef861501..dd2696ce5 100644 --- a/web/templates/admin/edit_web.html +++ b/web/templates/admin/edit_web.html @@ -10,12 +10,15 @@ @@ -36,7 +39,7 @@ document.v_edit_web.v_stats_password.value = webrandom; } - function FTPrandom() { + function FTPrandom(elm) { var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; var string_length = 10; var ftprandomstring = ''; @@ -44,7 +47,8 @@ var rnum = Math.floor(Math.random() * chars.length); ftprandomstring += chars.substring(rnum,rnum+1); } - document.v_edit_web.v_ftp_password.value = ftprandomstring; + + $(elm).parents('.ftptable').find('.v-ftp-user-psw').val(ftprandomstring); } function elementHideShow(elementToHideOrShow){ @@ -72,7 +76,7 @@
+ +
→ ".$_SESSION['ok_msg'].""; + } if (!empty($_SESSION['error_msg'])) { echo " → ".$_SESSION['error_msg'].""; - } else { - if (!empty($_SESSION['ok_msg'])) { - echo " → ".$_SESSION['ok_msg'].""; - } + } + if (!empty($_SESSION['flash_error_msg'])) { + echo " / FTP USER ".$_SESSION['flash_error_msg'].""; + unset($_SESSION['flash_error_msg']); } ?> - @@ -82,7 +86,7 @@ - @@ -105,7 +109,7 @@ - @@ -115,7 +119,7 @@ - @@ -136,20 +140,15 @@ - - - - -
+
+
+
+
- + +
- onclick="javascript:elementHideShow('proxytable');"> -
+ - @@ -173,7 +172,7 @@ - @@ -186,21 +185,16 @@ - - - - -
+
+
- / + + /
- onclick="javascript:elementHideShow('ssltable');"> -
+ - @@ -218,7 +212,7 @@ - @@ -228,7 +222,7 @@ - @@ -238,7 +232,7 @@ - @@ -251,7 +245,7 @@ - @@ -273,20 +267,15 @@ - - - - - - - - - + + + +
+
+
+
+ ()
+
- + +
- onclick="javascript:elementHideShow('statstable');"> -
+ - @@ -296,80 +285,106 @@ -
+
+ /
- +
- + +
- onclick="javascript:elementHideShow('ftptable');"> -
- + + $ftp_user): ?> + +
- - + + + - - - - -
- - ' . __('Prefix will be automaticaly added to username',$user."_") . '' ?> + + # () + +
- +
+ +
+ name="v_ftp_user[][v_ftp_user]" >
- / + + /
- + - + +
- + +
+ +
+ +
+ + +
- - @@ -378,7 +393,74 @@
+ +
+ + + + diff --git a/web/templates/admin/list_backup.html b/web/templates/admin/list_backup.html index 3fb26ed11..b532f6b4e 100644 --- a/web/templates/admin/list_backup.html +++ b/web/templates/admin/list_backup.html @@ -1,6 +1,6 @@ -