diff --git a/web/add/cron/index.php b/web/add/cron/index.php index 8dea0444..597c0916 100644 --- a/web/add/cron/index.php +++ b/web/add/cron/index.php @@ -1,77 +1,77 @@ - $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank."; - } else { - // Add Cron Job - 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']; - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - unset($v_password); - unset($output); - } else { - $_SESSION['ok_msg'] = "OK: cron job has been created successfully."; - 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); - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_cron.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -//} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); + $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg); + } else { + // Add Cron Job + 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']; + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + unset($v_password); + unset($output); + } else { + $_SESSION['ok_msg'] = _("OK: cron job has been created successfully."); + 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); + + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_cron.html'); + unset($_SESSION['error_msg']); + unset($_SESSION['ok_msg']); +//} + +// Footer +include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/add/db/index.php b/web/add/db/index.php index e23f205e..46b61dd6 100644 --- a/web/add/db/index.php +++ b/web/add/db/index.php @@ -1,76 +1,76 @@ - $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank."; - } else { - // Add Database - $v_type = escapeshellarg($_POST['v_type']); - $v_charset = escapeshellarg($_POST['v_charset']); - exec (VESTA_CMD."v-add-database ".$user." ".$v_database." ".$v_dbuser." ".$v_password." ".$v_type." 'default' ".$v_charset, $output, $return_var); - $v_type = $_POST['v_type']; - $v_charset = $_POST['v_charset']; - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - unset($v_password); - unset($output); - } else { - $_SESSION['ok_msg'] = "OK: database ".$user."_".$_POST['v_database']." has been created successfully."; - unset($v_database); - unset($v_dbuser); - unset($v_password); - unset($v_type); - unset($v_charset); - unset($output); - } - } - } - exec (VESTA_CMD."v-list-database-types 'json'", $output, $return_var); - $db_types = json_decode(implode('', $output), true); - unset($output); - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_db.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -//} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); + $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg); + } else { + // Add Database + $v_type = escapeshellarg($_POST['v_type']); + $v_charset = escapeshellarg($_POST['v_charset']); + exec (VESTA_CMD."v-add-database ".$user." ".$v_database." ".$v_dbuser." ".$v_password." ".$v_type." 'default' ".$v_charset, $output, $return_var); + $v_type = $_POST['v_type']; + $v_charset = $_POST['v_charset']; + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + unset($v_password); + unset($output); + } else { + $_SESSION['ok_msg'] = _('DATABASE_CREATED_OK',$user."_".$_POST['v_database'],$user."_".$_POST['v_database']); + unset($v_database); + unset($v_dbuser); + unset($v_password); + unset($v_type); + unset($v_charset); + unset($output); + } + } + } + exec (VESTA_CMD."v-list-database-types 'json'", $output, $return_var); + $db_types = json_decode(implode('', $output), true); + unset($output); + + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_db.html'); + unset($_SESSION['error_msg']); + unset($_SESSION['ok_msg']); +//} + +// Footer +include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/add/dns/index.php b/web/add/dns/index.php index b47fef76..9d759737 100644 --- a/web/add/dns/index.php +++ b/web/add/dns/index.php @@ -1,171 +1,171 @@ - $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank."; - } else { - - // Add DNS - exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_template." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$ns4, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - - // Change Expiriation date - 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, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - // Change TTL - if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400')) { - $v_ttl = escapeshellarg($_POST['v_ttl']); - exec (VESTA_CMD."v-change-dns-domain-ttl ".$user." ".$v_domain." ".$v_ttl, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: domain ".$_POST[v_domain]." has been created successfully."; - unset($v_domain); - } - } - } - - - // DNS Record - if (!empty($_POST['ok_rec'])) { - // Check input - 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'; - - // Protect input - $v_domain = escapeshellarg($_POST['v_domain']); - $v_rec = escapeshellarg($_POST['v_rec']); - $v_type = escapeshellarg($_POST['v_type']); - $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'] = "Error: field ".$error_msg." can not be blank."; - } else { - // Add DNS Record - exec (VESTA_CMD."v-add-dns-domain-record ".$user." ".$v_domain." ".$v_rec." ".$v_type." ".$v_val." ".$v_priority, $output, $return_var); - $v_type = $_POST['v_type']; - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: record ".$_POST[v_rec].".".$_POST[v_domain]." has been created successfully."; - unset($v_domain); - unset($v_rec); - unset($v_val); - unset($v_priority); - } - } - } - - - if ((empty($_GET['domain'])) && (empty($_POST['domain']))) { - exec (VESTA_CMD."v-get-user-value ".$user." 'TEMPLATE'", $output, $return_var); - $template = $output[0] ; - unset($output); - - exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var); - $templates = json_decode(implode('', $output), true); - unset($output); - - if ((empty($v_ns1)) && (empty($v_ns2))) { - exec (VESTA_CMD."v-list-user-ns ".$user." json", $output, $return_var); - $nameservers = json_decode(implode('', $output), true); - $v_ns1 = $nameservers[0]; - $v_ns2 = $nameservers[1]; - $v_ns3 = $nameservers[2]; - $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')); - if ($_SESSION['user'] == 'admin') { - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns.html'); - } else { - include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_dns.html'); - } - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); - } else { - $v_domain = $_GET['domain']; - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns_rec.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); - } -//} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); + $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg); + } else { + + // Add DNS + exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_template." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$ns4, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + + // Change Expiriation date + 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, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + // Change TTL + if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400')) { + $v_ttl = escapeshellarg($_POST['v_ttl']); + exec (VESTA_CMD."v-change-dns-domain-ttl ".$user." ".$v_domain." ".$v_ttl, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = _('DOMAIN_CREATED_OK',$_POST[v_domain],$_POST[v_domain]); + unset($v_domain); + } + } + } + + + // DNS Record + if (!empty($_POST['ok_rec'])) { + // Check input + 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'; + + // Protect input + $v_domain = escapeshellarg($_POST['v_domain']); + $v_rec = escapeshellarg($_POST['v_rec']); + $v_type = escapeshellarg($_POST['v_type']); + $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'] = _('Error: field "%s" can not be blank.',$error_msg); + } else { + // Add DNS Record + exec (VESTA_CMD."v-add-dns-domain-record ".$user." ".$v_domain." ".$v_rec." ".$v_type." ".$v_val." ".$v_priority, $output, $return_var); + $v_type = $_POST['v_type']; + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = _('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']))) { + exec (VESTA_CMD."v-get-user-value ".$user." 'TEMPLATE'", $output, $return_var); + $template = $output[0] ; + unset($output); + + exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var); + $templates = json_decode(implode('', $output), true); + unset($output); + + if ((empty($v_ns1)) && (empty($v_ns2))) { + exec (VESTA_CMD."v-list-user-ns ".$user." json", $output, $return_var); + $nameservers = json_decode(implode('', $output), true); + $v_ns1 = $nameservers[0]; + $v_ns2 = $nameservers[1]; + $v_ns3 = $nameservers[2]; + $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')); + if ($_SESSION['user'] == 'admin') { + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns.html'); + } else { + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_dns.html'); + } + unset($_SESSION['error_msg']); + unset($_SESSION['ok_msg']); + } else { + $v_domain = $_GET['domain']; + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns_rec.html'); + 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 4e3b1f47..a3071adf 100644 --- a/web/add/ip/index.php +++ b/web/add/ip/index.php @@ -1,87 +1,86 @@ - $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank."; - } 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, $output, $return_var); - $v_owner = $_POST['v_owner']; - $v_interface = $_POST['v_interface']; - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - unset($v_password); - unset($output); - } else { - $_SESSION['ok_msg'] = "OK: ip ".$_POST['v_ip']." has been created successfully."; - unset($v_ip); - unset($v_netmask); - unset($v_name); - unset($output); - } - } - } - 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']); -} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); + $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = _('Error: 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, $output, $return_var); + $v_owner = $_POST['v_owner']; + $v_interface = $_POST['v_interface']; + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + unset($v_password); + unset($output); + } else { + $_SESSION['ok_msg'] = _('IP_CREATED_OK',$_POST['v_ip'],$_POST['v_ip']); + unset($v_ip); + unset($v_netmask); + unset($v_name); + unset($output); + } + } + } + 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']); +} + +// Footer +include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/add/mail/index.php b/web/add/mail/index.php index 59dac6b7..6ce74559 100644 --- a/web/add/mail/index.php +++ b/web/add/mail/index.php @@ -1,178 +1,178 @@ - $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank."; - } else { - - // Add mail domain - exec (VESTA_CMD."v-add-mail-domain ".$user." ".$v_domain." ".$v_antispam." ".$v_antivirus." ".$v_dkim, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: domain ".$_POST[v_domain]." has been created successfully."; - unset($v_domain); - } - } - } - - - // Mail Account - if (!empty($_POST['ok_acc'])) { - // Check input - if (empty($_POST['v_domain'])) $errors[] = 'domain'; - if (empty($_POST['v_account'])) $errors[] = 'account'; - if (empty($_POST['v_password'])) $errors[] = 'password'; - - // Protect input - $v_domain = escapeshellarg($_POST['v_domain']); - $v_account = escapeshellarg($_POST['v_account']); - $v_password = escapeshellarg($_POST['v_password']); - $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'] = "Error: field ".$error_msg." can not be blank."; - } else { - // Add Mail Account - exec (VESTA_CMD."v-add-mail-account ".$user." ".$v_domain." ".$v_account." ".$v_password." ".$v_quota, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - - // 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - } - unset($output); - } - } - - unset($output); - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: account ".$_POST['v_account']."@".$_POST[v_domain]." has been created successfully."; - unset($v_account); - unset($v_password); - unset($v_password); - unset($v_aliases); - unset($v_fwd); - unset($v_quota); - } - } - } - - - if ((empty($_GET['domain'])) && (empty($_POST['domain']))) { - $v_domain = $_GET['domain']; - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); - } else { - $v_domain = $_GET['domain']; - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail_acc.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); - } -//} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); + $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg); + } else { + + // Add mail domain + exec (VESTA_CMD."v-add-mail-domain ".$user." ".$v_domain." ".$v_antispam." ".$v_antivirus." ".$v_dkim, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = _("DOMAIN_MAIL_CREATED_OK",$_POST[v_domain],$_POST[v_domain]); + unset($v_domain); + } + } + } + + + // Mail Account + if (!empty($_POST['ok_acc'])) { + // Check input + if (empty($_POST['v_domain'])) $errors[] = _('domain'); + if (empty($_POST['v_account'])) $errors[] = _('account'); + if (empty($_POST['v_password'])) $errors[] = _('password'); + + // Protect input + $v_domain = escapeshellarg($_POST['v_domain']); + $v_account = escapeshellarg($_POST['v_account']); + $v_password = escapeshellarg($_POST['v_password']); + $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'] = _('Error: field "%s" can not be blank.',$error_msg); + } else { + // Add Mail Account + exec (VESTA_CMD."v-add-mail-account ".$user." ".$v_domain." ".$v_account." ".$v_password." ".$v_quota, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + + // 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + } + unset($output); + } + } + + unset($output); + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = _('MAIL_ACCOUNT_CREATED_OK',$_POST['v_account'],$_POST[v_domain],$_POST['v_account'],$_POST[v_domain]); + unset($v_account); + unset($v_password); + unset($v_password); + unset($v_aliases); + unset($v_fwd); + unset($v_quota); + } + } + } + + + if ((empty($_GET['domain'])) && (empty($_POST['domain']))) { + $v_domain = $_GET['domain']; + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail.html'); + unset($_SESSION['error_msg']); + unset($_SESSION['ok_msg']); + } else { + $v_domain = $_GET['domain']; + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_mail_acc.html'); + 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 cd093c83..0dd4a25a 100644 --- a/web/add/package/index.php +++ b/web/add/package/index.php @@ -1,164 +1,164 @@ - $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank."; - } else { - exec ('mktemp -d', $output, $return_var); - $tmpdir = $output[0]; - unset($output); - - // Create package - $pkg = "TEMPLATE=".$v_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); - - // Add new package - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$v_package, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - // Remove tmpdir - exec ('rm -rf '.$tmpdir, $output, $return_var); - unset($output); - - // Check output - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: package ".$_POST['v_package']." has been created successfully."; - unset($v_package); - } - - } - } - - - exec (VESTA_CMD."v-list-web-templates json", $output, $return_var); - check_error($return_var); - $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_template)) $v_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']); -} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); + $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg); + } else { + exec ('mktemp -d', $output, $return_var); + $tmpdir = $output[0]; + unset($output); + + // Create package + $pkg = "TEMPLATE=".$v_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); + + // Add new package + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$v_package, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + $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_template)) $v_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']); +} + +// Footer +include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/add/user/index.php b/web/add/user/index.php index 521e8b7b..e7dce33c 100644 --- a/web/add/user/index.php +++ b/web/add/user/index.php @@ -1,103 +1,99 @@ - $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank."; - } - - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - if (empty($v_notify)) { - $to = $_POST['v_email']; - $subject = "Welcome to Vesta Control Panel"; - $hostname = exec('hostname'); - $from = "Vesta Control Panel "; - if (!empty($_POST['v_fname'])) { - $mailtext = "Hello ".$_POST['v_fname']." ".$_POST['v_lname'].",\n"; - } else { - $mailtext = "Hello,\n"; - } - $mailtext .= "Your account has been created successfully and is ready to use.\n\n"; - $mailtext .= "https://".$_SERVER['HTTP_HOST']."/login/\n"; - $mailtext .= "username: ".$_POST['v_username']."\n"; - $mailtext .= "password: ".$_POST['v_password']."\n\n"; - $mailtext .= "--\nVesta Control Panel\n"; - send_email($to, $subject, $mailtext, $from); - } - - $_SESSION['ok_msg'] = "OK: user ".$_POST[v_username]." has been created successfully."; - unset($v_username); - unset($v_password); - unset($v_email); - unset($v_fname); - unset($v_lname); - } - 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); - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_user.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); + $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + if (empty($v_notify)) { + $to = $_POST['v_email']; + $subject = _("Welcome to Vesta Control Panel"); + $hostname = exec('hostname'); + $from = _('MAIL_FROM',$hostname); + if (!empty($_POST['v_fname'])) { + $mailtext = _('GREETINGS_GORDON_FREEMAN',$_POST['v_fname'],$_POST['v_lname']); + } else { + $mailtext = _('GREETINGS'); + } + $mailtext .= _('ACCOUNT_READY',$_SERVER['HTTP_HOST'],$_POST['v_username'],$_POST['v_password']); + send_email($to, $subject, $mailtext, $from); + } + + $_SESSION['ok_msg'] = _('ACCOUNT_CREATED_OK',$_POST[v_username],$_POST[v_username]); + unset($v_username); + unset($v_password); + unset($v_email); + unset($v_fname); + unset($v_lname); + } + 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); + + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_user.html'); + 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 716ccb3c..92abdc9c 100644 --- a/web/add/web/index.php +++ b/web/add/web/index.php @@ -1,328 +1,324 @@ - $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank."; - } - - if (empty($_SESSION['error_msg'])) { - // Add WEB - exec (VESTA_CMD."v-add-web-domain ".$user." ".$v_domain." ".$v_ip." ".$v_template." 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - } - - - // Add Nginx - if (($_POST['v_nginx'] == 'on') && (empty($_SESSION['error_msg']))) { - $ext = str_replace(' ', '', $v_nginx_ext); - $ext = escapeshellarg($ext); - exec (VESTA_CMD."v-add-web-domain-nginx ".$user." ".$v_domain." 'default' ".$ext." 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - if (!empty($v_ftp_email)) { - $to = $_POST['v_ftp_email']; - $subject = "FTP login credentials"; - $hostname = exec('hostname'); - $from = "Vesta Control Panel "; - $mailtext .= "Your ftp account has been created successfully and is ready to use.\n\n"; - $mailtext .= "hostname: ".$_POST['v_domain']."\n"; - $mailtext .= "username: ".$user."_".$_POST['v_ftp_user']."\n"; - $mailtext .= "password: ".$_POST['v_ftp_password']."\n\n"; - $mailtext .= "--\nVesta Control Panel\n"; - send_email($to, $subject, $mailtext, $from); - unset($v_ftp_email); - } - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-restart-web", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $_SESSION['ok_msg'] = "OK: domain ".$_POST[v_domain]." has been created successfully."; - 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-get-user-value ".$user." 'TEMPLATE'", $output, $return_var); - $template = $output[0] ; - 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-stats json", $output, $return_var); - $stats = json_decode(implode('', $output), true); - unset($output); - -// Are you admin? -if ($_SESSION['user'] == 'admin') { - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_web.html'); -} else { - include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_web.html'); -} - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -//} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); + $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = _('Error: 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." ".$v_template." 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + } + + + // Add Nginx + if (($_POST['v_nginx'] == 'on') && (empty($_SESSION['error_msg']))) { + $ext = str_replace(' ', '', $v_nginx_ext); + $ext = escapeshellarg($ext); + exec (VESTA_CMD."v-add-web-domain-nginx ".$user." ".$v_domain." 'default' ".$ext." 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + 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_email); + } + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-restart-web", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $_SESSION['ok_msg'] = _('HOSTING_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-get-user-value ".$user." 'TEMPLATE'", $output, $return_var); + $template = $output[0] ; + 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-stats json", $output, $return_var); + $stats = json_decode(implode('', $output), true); + unset($output); + +// Are you admin? +if ($_SESSION['user'] == 'admin') { + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_web.html'); +} else { + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_web.html'); +} + unset($_SESSION['error_msg']); + unset($_SESSION['ok_msg']); +//} + +// Footer +include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/delete/backup/index.php b/web/delete/backup/index.php index af7ee41a..24f37746 100644 --- a/web/delete/backup/index.php +++ b/web/delete/backup/index.php @@ -1,34 +1,34 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - -//} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/backup/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + +//} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/backup/"); +exit; diff --git a/web/delete/cron/index.php b/web/delete/cron/index.php index d5568fe4..c6a5c0d5 100644 --- a/web/delete/cron/index.php +++ b/web/delete/cron/index.php @@ -1,34 +1,34 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - -//} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/cron/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + +//} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/cron/"); +exit; diff --git a/web/delete/db/index.php b/web/delete/db/index.php index 44f6a513..56c22784 100644 --- a/web/delete/db/index.php +++ b/web/delete/db/index.php @@ -1,34 +1,34 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - -//} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/db/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + +//} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/db/"); +exit; diff --git a/web/delete/dns/index.php b/web/delete/dns/index.php index 417bb367..f06390db 100644 --- a/web/delete/dns/index.php +++ b/web/delete/dns/index.php @@ -1,63 +1,63 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - - $back = $_SESSION['back']; - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/dns/"); - exit; - } - - // DNS record - if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) { - $v_username = escapeshellarg($user); - $v_domain = escapeshellarg($_GET['domain']); - $v_record_id = escapeshellarg($_GET['record_id']); - exec (VESTA_CMD."v-delete-dns-domain-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $back = $_SESSION['back']; - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/dns/?domain=".$_GET['domain']); - exit; - } -//} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/dns/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + + $back = $_SESSION['back']; + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/dns/"); + exit; + } + + // DNS record + if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) { + $v_username = escapeshellarg($user); + $v_domain = escapeshellarg($_GET['domain']); + $v_record_id = escapeshellarg($_GET['record_id']); + exec (VESTA_CMD."v-delete-dns-domain-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $back = $_SESSION['back']; + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/dns/?domain=".$_GET['domain']); + exit; + } +//} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/dns/"); +exit; diff --git a/web/delete/ip/index.php b/web/delete/ip/index.php index 44419f91..47d45d71 100644 --- a/web/delete/ip/index.php +++ b/web/delete/ip/index.php @@ -1,29 +1,29 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - -} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/ip/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + +} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/ip/"); +exit; diff --git a/web/delete/mail/index.php b/web/delete/mail/index.php index 4879b1e9..ddff2484 100644 --- a/web/delete/mail/index.php +++ b/web/delete/mail/index.php @@ -1,62 +1,62 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $back = $_SESSION['back']; - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/mail/"); - exit; - } - - // Mail account - if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) { - $v_username = escapeshellarg($user); - $v_domain = escapeshellarg($_GET['domain']); - $v_account = escapeshellarg($_GET['account']); - exec (VESTA_CMD."v-delete-mail-account ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $back = $_SESSION['back']; - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/mail/?domain=".$_GET['domain']); - exit; - } -//} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/mail/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $back = $_SESSION['back']; + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/mail/"); + exit; + } + + // Mail account + if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) { + $v_username = escapeshellarg($user); + $v_domain = escapeshellarg($_GET['domain']); + $v_account = escapeshellarg($_GET['account']); + exec (VESTA_CMD."v-delete-mail-account ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $back = $_SESSION['back']; + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/mail/?domain=".$_GET['domain']); + exit; + } +//} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/mail/"); +exit; diff --git a/web/delete/package/index.php b/web/delete/package/index.php index d7dc6069..d255972f 100644 --- a/web/delete/package/index.php +++ b/web/delete/package/index.php @@ -1,28 +1,28 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); -} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/package/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); +} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/package/"); +exit; diff --git a/web/delete/user/index.php b/web/delete/user/index.php index ca08147b..ade17d08 100644 --- a/web/delete/user/index.php +++ b/web/delete/user/index.php @@ -1,28 +1,28 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); -} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/user/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); +} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/user/"); +exit; diff --git a/web/delete/web/index.php b/web/delete/web/index.php index c088f041..cba00b02 100644 --- a/web/delete/web/index.php +++ b/web/delete/web/index.php @@ -1,60 +1,60 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - - // DNS - if ($return_var == 0) { - exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain." json", $output, $lreturn_var); - if ($lreturn_var == 0 ) { - exec (VESTA_CMD."v-delete-dns-domain ".$v_username." ".$v_domain, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - } - - // Mail - if ($return_var == 0) { - exec (VESTA_CMD."v-list-mail-domain ".$v_username." ".$v_domain." json", $output, $lreturn_var); - if ($lreturn_var == 0 ) { - exec (VESTA_CMD."v-delete-mail-domain ".$v_username." ".$v_domain, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - } -} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/web/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + + // DNS + if ($return_var == 0) { + exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain." json", $output, $lreturn_var); + if ($lreturn_var == 0 ) { + exec (VESTA_CMD."v-delete-dns-domain ".$v_username." ".$v_domain, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + } + + // Mail + if ($return_var == 0) { + exec (VESTA_CMD."v-list-mail-domain ".$v_username." ".$v_domain." json", $output, $lreturn_var); + if ($lreturn_var == 0 ) { + exec (VESTA_CMD."v-delete-mail-domain ".$v_username." ".$v_domain, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + } +} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/web/"); +exit; diff --git a/web/edit/cron/index.php b/web/edit/cron/index.php index b061071a..646f7af6 100644 --- a/web/edit/cron/index.php +++ b/web/edit/cron/index.php @@ -1,85 +1,85 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $v_cmd = $_POST['v_cmd']; - } - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: changes has been saved."; - } - } - } - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_cron.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -//} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + $v_username = $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $v_cmd = $_POST['v_cmd']; + } + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + } + } + + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_cron.html'); + unset($_SESSION['error_msg']); + unset($_SESSION['ok_msg']); +//} + +// Footer +include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/edit/db/index.php b/web/edit/db/index.php index f63411e2..a62cd540 100644 --- a/web/edit/db/index.php +++ b/web/edit/db/index.php @@ -1,79 +1,79 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $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'; - } - - // Action - if (!empty($_POST['save'])) { - $v_username = $user; - // Change 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $v_password = "••••••••"; - unset($output); - } - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: changes has been saved."; - } - } - } - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_db.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -//} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + $v_username = $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'; + } + + // Action + if (!empty($_POST['save'])) { + $v_username = $user; + // Change 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $v_password = "••••••••"; + unset($output); + } + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + } + } + + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_db.html'); + unset($_SESSION['error_msg']); + unset($_SESSION['ok_msg']); +//} + +// Footer +include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/edit/dns/index.php b/web/edit/dns/index.php index 043bf5c6..b0a61908 100644 --- a/web/edit/dns/index.php +++ b/web/edit/dns/index.php @@ -1,210 +1,210 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - $data = json_decode(implode('', $output), true); - unset($output); - - $v_username = $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); - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $restart_dns = 'yes'; - } - - // Restart dns - if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-restart-dns", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: changes has been saved."; - } - - } - 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-domain-records ".$user." ".$v_domain." 'json'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $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-domain-record ".$v_username." ".$v_domain." ".$v_record_id." ".$v_val." ".$v_priority, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $v_val = $_POST['v_val']; - $restart_dns = 'yes'; - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: changes has been saved."; - } - - } - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns_rec.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); - } -//} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + + $v_username = $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); + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $restart_dns = 'yes'; + } + + // Restart dns + if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-restart-dns", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + } + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + + } + 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-domain-records ".$user." ".$v_domain." 'json'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + $v_username = $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-domain-record ".$v_username." ".$v_domain." ".$v_record_id." ".$v_val." ".$v_priority, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $v_val = $_POST['v_val']; + $restart_dns = 'yes'; + unset($output); + } + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + + } + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns_rec.html'); + 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 0d701a87..bdc0b370 100644 --- a/web/edit/ip/index.php +++ b/web/edit/ip/index.php @@ -1,119 +1,119 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $user; - $v_ip = $_GET['ip']; - $v_netmask = $data[$v_ip]['NETMASK']; - $v_interace = $data[$v_ip]['INTERFACE']; - $v_name = $data[$v_ip]['NAME']; - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: changes has been saved."; - } - } - } - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_ip.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + $v_username = $user; + $v_ip = $_GET['ip']; + $v_netmask = $data[$v_ip]['NETMASK']; + $v_interace = $data[$v_ip]['INTERFACE']; + $v_name = $data[$v_ip]['NAME']; + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + } + } + + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_ip.html'); + 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 ca3c152b..cab7a11e 100644 --- a/web/edit/mail/index.php +++ b/web/edit/mail/index.php @@ -1,370 +1,370 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $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'; - } - } - - // 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $v_antivirus = 'yes'; - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: changes has been saved."; - } - } - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); - } else { - - $v_username = $user; - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $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_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']; - } - - // 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - } - } - - // 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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'] = "Error: field atoreply message can not be blank."; - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $v_autoreply = 'yes'; - $v_autoreply_message = $_POST['v_autoreply_message']; - } - } - - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: changes has been saved."; - } - - } - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail_acc.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); - } -//} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + $v_username = $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'; + } + } + + // 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $v_antivirus = 'yes'; + unset($output); + } + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + } + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail.html'); + unset($_SESSION['error_msg']); + unset($_SESSION['ok_msg']); + } else { + + $v_username = $user; + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + $v_username = $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_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']; + } + + // 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + } + } + + // 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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'] = "Error: field atoreply message can not be blank."; + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $v_autoreply = 'yes'; + $v_autoreply_message = $_POST['v_autoreply_message']; + } + } + + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + + } + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_mail_acc.html'); + 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 21e47b7d..a5ea6d02 100644 --- a/web/edit/package/index.php +++ b/web/edit/package/index.php @@ -1,190 +1,190 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - $data = json_decode(implode('', $output), true); - unset($output); - - $v_package = $_GET['package']; - $v_template = $data[$v_package]['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); - $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_template'])) $errors[] = '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_template = escapeshellarg($_POST['v_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'] = "Error: field ".$error_msg." can not be blank."; - } else { - exec ('mktemp -d', $output, $return_var); - $tmpdir = $output[0]; - unset($output); - - // Create package - $pkg = "TEMPLATE=".$v_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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: changes has been saved."; - } - } - } - } - - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_package.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + + $v_package = $_GET['package']; + $v_template = $data[$v_package]['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); + $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_template'])) $errors[] = '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_template = escapeshellarg($_POST['v_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'] = _('Error: field "%s" can not be blank.',$error_msg); + } else { + exec ('mktemp -d', $output, $return_var); + $tmpdir = $output[0]; + unset($output); + + // Create package + $pkg = "TEMPLATE=".$v_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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + } + } + } + + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_package.html'); + 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 947e5197..8411a551 100644 --- a/web/edit/user/index.php +++ b/web/edit/user/index.php @@ -1,275 +1,275 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $_GET['user']; - $v_password = "••••••••"; - $v_email = $data[$v_username]['CONTACT']; - $v_template = $data[$v_username]['TEMPLATE']; - $v_package = $data[$v_username]['PACKAGE']; - $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-web-templates json", $output, $return_var); - $templates = 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 password - if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { - $v_password = escapeshellarg($_POST['v_password']); - exec (VESTA_CMD."v-change-user-password ".$v_username." ".$v_password, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $v_password = "••••••••"; - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - // Change template - if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) { - $v_template = escapeshellarg($_POST['v_template']); - exec (VESTA_CMD."v-change-user-template ".$v_username." ".$v_template, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - } - unset($output); - } - - // Change Name - if (($v_fname != $_POST['v_fname']) || ($v_lname != $_POST['v_lname']) && (empty($_SESSION['error_msg']))) { - $v_fname = escapeshellarg($_POST['v_fname']); - $v_lname = escapeshellarg($_POST['v_lname']); - exec (VESTA_CMD."v-change-user-name ".$v_username." ".$v_fname." ".$v_lname, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - // Change NameServers - if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (empty($_SESSION['error_msg']))) { - $v_ns1 = escapeshellarg($_POST['v_ns1']); - $v_ns2 = escapeshellarg($_POST['v_ns2']); - $v_ns3 = escapeshellarg($_POST['v_ns3']); - $v_ns4 = escapeshellarg($_POST['v_ns4']); - $ns_cmd = VESTA_CMD."v-change-user-ns ".$v_username." ".$v_ns1." ".$v_ns2; - if (!empty($_POST['v_ns3'])) $ns_cmd = $ns_cmd." ".$v_ns3; - if (!empty($_POST['v_ns4'])) $ns_cmd = $ns_cmd." ".$v_ns4; - exec ($ns_cmd, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: changes has been saved."; - } - } - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_user.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} else { - // Check user argument? - if (empty($_GET['user'])) { - header("Location: /list/user/"); - exit; - } - - // Check user - $v_username = escapeshellarg($_GET['user']); - exec (VESTA_CMD."v-list-user ".$v_username." json", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $_GET['user']; - $v_password = "••••••••"; - $v_email = $data[$v_username]['CONTACT']; - $v_fname = $data[$v_username]['FNAME']; - $v_lname = $data[$v_username]['LNAME']; - $v_ns = $data[$v_username]['NS']; - $nameservers = explode(", ", $v_ns); - $v_ns1 = $nameservers[0]; - $v_ns2 = $nameservers[1]; - $v_ns3 = $nameservers[2]; - $v_ns4 = $nameservers[3]; - $v_suspended = $data[$v_username]['SUSPENDED']; - if ( $v_suspended == 'yes' ) { - $v_status = 'suspended'; - } else { - $v_status = 'active'; - } - $v_time = $data[$v_username]['TIME']; - $v_date = $data[$v_username]['DATE']; - - } - - // Action - if (!empty($_POST['save'])) { - $v_username = escapeshellarg($_POST['v_username']); - - // Change password - if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { - $v_password = escapeshellarg($_POST['v_password']); - exec (VESTA_CMD."v-change-user-password ".$v_username." ".$v_password, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $v_password = "••••••••"; - unset($output); - } - - // Change contact email - if (($v_email != $_POST['v_email']) && (empty($_SESSION['error_msg']))) { - $v_email = escapeshellarg($_POST['v_email']); - exec (VESTA_CMD."v-change-user-contact ".$v_username." ".$v_email, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - // Change NameServers - if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (empty($_SESSION['error_msg']))) { - $v_ns1 = escapeshellarg($_POST['v_ns1']); - $v_ns2 = escapeshellarg($_POST['v_ns2']); - $v_ns3 = escapeshellarg($_POST['v_ns3']); - $v_ns4 = escapeshellarg($_POST['v_ns4']); - $ns_cmd = VESTA_CMD."v-change-user-ns ".$v_username." ".$v_ns1." ".$v_ns2; - if (!empty($_POST['v_ns3'])) $ns_cmd = $ns_cmd." ".$v_ns3; - if (!empty($_POST['v_ns4'])) $ns_cmd = $ns_cmd." ".$v_ns4; - exec ($ns_cmd, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: changes has been saved."; - } - } - include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_user.html'); - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + $v_username = $_GET['user']; + $v_password = "••••••••"; + $v_email = $data[$v_username]['CONTACT']; + $v_template = $data[$v_username]['TEMPLATE']; + $v_package = $data[$v_username]['PACKAGE']; + $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-web-templates json", $output, $return_var); + $templates = 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 password + if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { + $v_password = escapeshellarg($_POST['v_password']); + exec (VESTA_CMD."v-change-user-password ".$v_username." ".$v_password, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $v_password = "••••••••"; + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + // Change template + if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) { + $v_template = escapeshellarg($_POST['v_template']); + exec (VESTA_CMD."v-change-user-template ".$v_username." ".$v_template, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + } + unset($output); + } + + // Change Name + if (($v_fname != $_POST['v_fname']) || ($v_lname != $_POST['v_lname']) && (empty($_SESSION['error_msg']))) { + $v_fname = escapeshellarg($_POST['v_fname']); + $v_lname = escapeshellarg($_POST['v_lname']); + exec (VESTA_CMD."v-change-user-name ".$v_username." ".$v_fname." ".$v_lname, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + // Change NameServers + if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (empty($_SESSION['error_msg']))) { + $v_ns1 = escapeshellarg($_POST['v_ns1']); + $v_ns2 = escapeshellarg($_POST['v_ns2']); + $v_ns3 = escapeshellarg($_POST['v_ns3']); + $v_ns4 = escapeshellarg($_POST['v_ns4']); + $ns_cmd = VESTA_CMD."v-change-user-ns ".$v_username." ".$v_ns1." ".$v_ns2; + if (!empty($_POST['v_ns3'])) $ns_cmd = $ns_cmd." ".$v_ns3; + if (!empty($_POST['v_ns4'])) $ns_cmd = $ns_cmd." ".$v_ns4; + exec ($ns_cmd, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + } + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_user.html'); + unset($_SESSION['error_msg']); + unset($_SESSION['ok_msg']); +} else { + // Check user argument? + if (empty($_GET['user'])) { + header("Location: /list/user/"); + exit; + } + + // Check user + $v_username = escapeshellarg($_GET['user']); + exec (VESTA_CMD."v-list-user ".$v_username." json", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + $v_username = $_GET['user']; + $v_password = "••••••••"; + $v_email = $data[$v_username]['CONTACT']; + $v_fname = $data[$v_username]['FNAME']; + $v_lname = $data[$v_username]['LNAME']; + $v_ns = $data[$v_username]['NS']; + $nameservers = explode(", ", $v_ns); + $v_ns1 = $nameservers[0]; + $v_ns2 = $nameservers[1]; + $v_ns3 = $nameservers[2]; + $v_ns4 = $nameservers[3]; + $v_suspended = $data[$v_username]['SUSPENDED']; + if ( $v_suspended == 'yes' ) { + $v_status = 'suspended'; + } else { + $v_status = 'active'; + } + $v_time = $data[$v_username]['TIME']; + $v_date = $data[$v_username]['DATE']; + + } + + // Action + if (!empty($_POST['save'])) { + $v_username = escapeshellarg($_POST['v_username']); + + // Change password + if (($v_password != $_POST['v_password']) && (empty($_SESSION['error_msg']))) { + $v_password = escapeshellarg($_POST['v_password']); + exec (VESTA_CMD."v-change-user-password ".$v_username." ".$v_password, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $v_password = "••••••••"; + unset($output); + } + + // Change contact email + if (($v_email != $_POST['v_email']) && (empty($_SESSION['error_msg']))) { + $v_email = escapeshellarg($_POST['v_email']); + exec (VESTA_CMD."v-change-user-contact ".$v_username." ".$v_email, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + // Change NameServers + if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (empty($_SESSION['error_msg']))) { + $v_ns1 = escapeshellarg($_POST['v_ns1']); + $v_ns2 = escapeshellarg($_POST['v_ns2']); + $v_ns3 = escapeshellarg($_POST['v_ns3']); + $v_ns4 = escapeshellarg($_POST['v_ns4']); + $ns_cmd = VESTA_CMD."v-change-user-ns ".$v_username." ".$v_ns1." ".$v_ns2; + if (!empty($_POST['v_ns3'])) $ns_cmd = $ns_cmd." ".$v_ns3; + if (!empty($_POST['v_ns4'])) $ns_cmd = $ns_cmd." ".$v_ns4; + exec ($ns_cmd, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + } + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_user.html'); + 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 f453fb5b..ace532dc 100644 --- a/web/edit/web/index.php +++ b/web/edit/web/index.php @@ -1,591 +1,591 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - $data = json_decode(implode('', $output), true); - unset($output); - $v_username = $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_nginx = $data[$v_domain]['NGINX']; - $v_nginx_ext = str_replace(',', ', ', $data[$v_domain]['NGINX_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']; - - 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-stats json", $output, $return_var); - $stats = json_decode(implode('', $output), true); - 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-web-domain-ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $restart_web = 'yes'; - unset($output); - exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain." json", $output, $return_var); - if ((empty($_SESSION['error_msg'])) && ($return_var == 0 )) { - exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $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-web-domain-tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $restart_web = 'yes'; - } - - // 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))) { - $restart_web = 'yes'; - $v_template = escapeshellarg($_POST['v_template']); - exec (VESTA_CMD."v-delete-web-domain-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-delete-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $restart_dns = 'yes'; - } - unset($output); - } - } - - $result = array_diff($aliases, $valiases); - foreach ($result as $alias) { - if ((empty($_SESSION['error_msg'])) && (!empty($alias))) { - $restart_web = 'yes'; - $v_template = escapeshellarg($_POST['v_template']); - exec (VESTA_CMD."v-add-web-domain-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - if (empty($_SESSION['error_msg'])) { - exec (VESTA_CMD."v-add-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $restart_dns = 'yes'; - } - unset($output); - } - } - } - - // Nginx - if ((!empty($v_nginx)) && (empty($_POST['v_nginx'])) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-delete-web-domain-nginx ".$v_username." ".$v_domain." 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - unset($v_nginx); - $restart_web = 'yes'; - } - if ((!empty($v_nginx)) && (!empty($_POST['v_nginx'])) && (empty($_SESSION['error_msg']))) { - $ext = preg_replace("/\n/", " ", $_POST['v_nginx_ext']); - $ext = preg_replace("/,/", " ", $ext); - $ext = preg_replace('/\s+/', ' ',$ext); - $ext = trim($ext); - $ext = str_replace(' ', ", ", $ext); - if ( $v_nginx_ext != $ext ) { - $ext = str_replace(', ', ",", $ext); - exec (VESTA_CMD."v-change-web-domain-nginx-tpl ".$v_username." ".$v_domain." 'default' ".escapeshellarg($ext)." 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $v_nginx_ext = str_replace(',', ', ', $ext); - unset($output); - $restart_web = 'yes'; - } - } - if ((empty($v_nginx)) && (!empty($_POST['v_nginx'])) && (empty($_SESSION['error_msg']))) { - $nginx_ext = "'jpg,jpeg,gif,png,ico,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,tar,wav,bmp,rtf,js,mp3,avi,mpeg,html,htm'"; - if (!empty($_POST['v_nginx_ext'])) { - $ext = preg_replace("/\n/", " ", $_POST['v_nginx_ext']); - $ext = preg_replace("/,/", " ", $ext); - $ext = preg_replace('/\s+/', ' ',$ext); - $ext = trim($ext); - $ext = str_replace(' ', ",", $ext); - $v_nginx_ext = str_replace(',', ', ', $ext); - } - exec (VESTA_CMD."v-add-web-domain-nginx ".$v_username." ".$v_domain." 'default' ".escapeshellarg($ext)." 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $v_nginx = 'default'; - $restart_web = 'yes'; - } - - // SSL - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $v_ssl = 'no'; - $restart_web = 'yes'; - } - 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); - $tmpdir = $mktemp_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); - } - - exec (VESTA_CMD."v-change-web-domain-sslcert ".$user." ".$v_domain." ".$tmpdir." 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $restart_web = 'yes'; - $v_ssl_crt = $_POST['v_ssl_crt']; - $v_ssl_key = $_POST['v_ssl_key']; - $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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - $v_ssl_home = $_POST['v_ssl_home']; - unset($output); - } - } - 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'; - if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_home']))) $errors[] = 'ssl home'; - $v_ssl_home = escapeshellarg($_POST['v_ssl_home']); - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank."; - } else { - exec ('mktemp -d', $mktemp_output, $return_var); - $tmpdir = $mktemp_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'])); - 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'])); - 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'])); - fclose($fp); - } - exec (VESTA_CMD."v-add-web-domain-ssl ".$user." ".$v_domain." ".$tmpdir." ".$v_ssl_home." 'no'", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $v_ssl = 'yes'; - $restart_web = 'yes'; - $v_ssl_crt = $_POST['v_ssl_crt']; - $v_ssl_key = $_POST['v_ssl_key']; - $v_ssl_ca = $_POST['v_ssl_ca']; - $v_ssl_home = $_POST['v_ssl_home']; - } - } - - // 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $v_stats = ''; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - - // Web Stats Auth - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $v_stats_user = ''; - $v_stats_password = ''; - } - if ((empty($v_stats_user)) && (!empty($_POST['v_stats_auth'])) && (empty($_SESSION['error_msg']))) { - if (empty($_POST['v_stats_user'])) $errors[] = 'stats username'; - if (empty($_POST['v_stats_password'])) $errors[] = 'stats password'; - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank."; - } else { - $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 ".$v_username." ".$v_domain." ".$v_stats_user." ".$v_stats_password, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $v_stats_password = "••••••••"; - } - } - if ((!empty($v_stats_user)) && (!empty($_POST['v_stats_auth'])) && (empty($_SESSION['error_msg']))) { - if (empty($_POST['v_stats_user'])) $errors[] = 'stats user'; - if (empty($_POST['v_stats_password'])) $errors[] = 'stats password'; - if (!empty($errors[0])) { - foreach ($errors as $i => $error) { - if ( $i == 0 ) { - $error_msg = $error; - } else { - $error_msg = $error_msg.", ".$error; - } - } - $_SESSION['error_msg'] = "Error: field ".$error_msg." can not be blank."; - } - if (($v_stats_user != $_POST['v_stats_user']) || ($_POST['v_stats_password'] != "••••••••" ) && (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 ".$v_username." ".$v_domain." ".$v_stats_user." ".$v_stats_password, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $v_stats_password = "••••••••"; - } - } - - // 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $v_ftp= ''; - $v_ftp_user = ''; - $v_ftp_password = ''; - } - 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 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'] = "Error: field ".$error_msg." can not be blank."; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $v_ftp_user = $user."_".$_POST['v_ftp_user']; - $v_ftp_password = "••••••••"; - } - } - - 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 username'; - if (empty($_POST['v_ftp_password'])) $errors[] = 'ftp 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'] = "Error: field ".$error_msg." can not be blank."; - } - 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); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } else { - if (!empty($_POST['v_ftp_email'])) { - $to = $_POST['v_ftp_email']; - $subject = "FTP login credentials"; - $hostname = exec('hostname'); - $from = "Vesta Control Panel "; - $mailtext .= "Your ftp account has been created successfully and is ready to use.\n\n"; - $mailtext .= "hostname: ".$_GET['domain']."\n"; - $mailtext .= "username: ".$user."_".$_POST['v_ftp_user']."\n"; - $mailtext .= "password: ".$_POST['v_ftp_password']."\n\n"; - $mailtext .= "--\nVesta Control Panel\n"; - send_email($to, $subject, $mailtext, $from); - unset($v_ftp_email); - } - } - unset($output); - $v_ftp_user = $user."_".$_POST['v_ftp_user']; - $v_ftp_password = "••••••••"; - } - } - - // Restart web - if (!empty($restart_web) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-restart-web", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - } - - // Restart dns - if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) { - exec (VESTA_CMD."v-restart-dns", $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - } - - if (empty($_SESSION['error_msg'])) { - $_SESSION['ok_msg'] = "OK: changes has been saved."; - } - - } -if ($_SESSION['user'] == 'admin') { - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_web.html'); -} else { - include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_web.html'); -} - unset($_SESSION['error_msg']); - unset($_SESSION['ok_msg']); -//} - -// Footer -include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + $data = json_decode(implode('', $output), true); + unset($output); + $v_username = $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_nginx = $data[$v_domain]['NGINX']; + $v_nginx_ext = str_replace(',', ', ', $data[$v_domain]['NGINX_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']; + + 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-stats json", $output, $return_var); + $stats = json_decode(implode('', $output), true); + 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-web-domain-ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $restart_web = 'yes'; + unset($output); + exec (VESTA_CMD."v-list-dns-domain ".$v_username." ".$v_domain." json", $output, $return_var); + if ((empty($_SESSION['error_msg'])) && ($return_var == 0 )) { + exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $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-web-domain-tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $restart_web = 'yes'; + } + + // 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))) { + $restart_web = 'yes'; + $v_template = escapeshellarg($_POST['v_template']); + exec (VESTA_CMD."v-delete-web-domain-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-delete-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $restart_dns = 'yes'; + } + unset($output); + } + } + + $result = array_diff($aliases, $valiases); + foreach ($result as $alias) { + if ((empty($_SESSION['error_msg'])) && (!empty($alias))) { + $restart_web = 'yes'; + $v_template = escapeshellarg($_POST['v_template']); + exec (VESTA_CMD."v-add-web-domain-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + if (empty($_SESSION['error_msg'])) { + exec (VESTA_CMD."v-add-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $restart_dns = 'yes'; + } + unset($output); + } + } + } + + // Nginx + if ((!empty($v_nginx)) && (empty($_POST['v_nginx'])) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-delete-web-domain-nginx ".$v_username." ".$v_domain." 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + unset($v_nginx); + $restart_web = 'yes'; + } + if ((!empty($v_nginx)) && (!empty($_POST['v_nginx'])) && (empty($_SESSION['error_msg']))) { + $ext = preg_replace("/\n/", " ", $_POST['v_nginx_ext']); + $ext = preg_replace("/,/", " ", $ext); + $ext = preg_replace('/\s+/', ' ',$ext); + $ext = trim($ext); + $ext = str_replace(' ', ", ", $ext); + if ( $v_nginx_ext != $ext ) { + $ext = str_replace(', ', ",", $ext); + exec (VESTA_CMD."v-change-web-domain-nginx-tpl ".$v_username." ".$v_domain." 'default' ".escapeshellarg($ext)." 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $v_nginx_ext = str_replace(',', ', ', $ext); + unset($output); + $restart_web = 'yes'; + } + } + if ((empty($v_nginx)) && (!empty($_POST['v_nginx'])) && (empty($_SESSION['error_msg']))) { + $nginx_ext = "'jpg,jpeg,gif,png,ico,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,tar,wav,bmp,rtf,js,mp3,avi,mpeg,html,htm'"; + if (!empty($_POST['v_nginx_ext'])) { + $ext = preg_replace("/\n/", " ", $_POST['v_nginx_ext']); + $ext = preg_replace("/,/", " ", $ext); + $ext = preg_replace('/\s+/', ' ',$ext); + $ext = trim($ext); + $ext = str_replace(' ', ",", $ext); + $v_nginx_ext = str_replace(',', ', ', $ext); + } + exec (VESTA_CMD."v-add-web-domain-nginx ".$v_username." ".$v_domain." 'default' ".escapeshellarg($ext)." 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $v_nginx = 'default'; + $restart_web = 'yes'; + } + + // SSL + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $v_ssl = 'no'; + $restart_web = 'yes'; + } + 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); + $tmpdir = $mktemp_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); + } + + exec (VESTA_CMD."v-change-web-domain-sslcert ".$user." ".$v_domain." ".$tmpdir." 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $restart_web = 'yes'; + $v_ssl_crt = $_POST['v_ssl_crt']; + $v_ssl_key = $_POST['v_ssl_key']; + $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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + $v_ssl_home = $_POST['v_ssl_home']; + unset($output); + } + } + 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'; + if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_home']))) $errors[] = 'ssl home'; + $v_ssl_home = escapeshellarg($_POST['v_ssl_home']); + if (!empty($errors[0])) { + foreach ($errors as $i => $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg); + } else { + exec ('mktemp -d', $mktemp_output, $return_var); + $tmpdir = $mktemp_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'])); + 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'])); + 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'])); + fclose($fp); + } + exec (VESTA_CMD."v-add-web-domain-ssl ".$user." ".$v_domain." ".$tmpdir." ".$v_ssl_home." 'no'", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $v_ssl = 'yes'; + $restart_web = 'yes'; + $v_ssl_crt = $_POST['v_ssl_crt']; + $v_ssl_key = $_POST['v_ssl_key']; + $v_ssl_ca = $_POST['v_ssl_ca']; + $v_ssl_home = $_POST['v_ssl_home']; + } + } + + // 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $v_stats = ''; + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + } + + // Web Stats Auth + 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $v_stats_user = ''; + $v_stats_password = ''; + } + if ((empty($v_stats_user)) && (!empty($_POST['v_stats_auth'])) && (empty($_SESSION['error_msg']))) { + if (empty($_POST['v_stats_user'])) $errors[] = 'stats username'; + if (empty($_POST['v_stats_password'])) $errors[] = 'stats password'; + if (!empty($errors[0])) { + foreach ($errors as $i => $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg); + } else { + $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 ".$v_username." ".$v_domain." ".$v_stats_user." ".$v_stats_password, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $v_stats_password = "••••••••"; + } + } + if ((!empty($v_stats_user)) && (!empty($_POST['v_stats_auth'])) && (empty($_SESSION['error_msg']))) { + if (empty($_POST['v_stats_user'])) $errors[] = 'stats user'; + if (empty($_POST['v_stats_password'])) $errors[] = 'stats password'; + if (!empty($errors[0])) { + foreach ($errors as $i => $error) { + if ( $i == 0 ) { + $error_msg = $error; + } else { + $error_msg = $error_msg.", ".$error; + } + } + $_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg); + } + if (($v_stats_user != $_POST['v_stats_user']) || ($_POST['v_stats_password'] != "••••••••" ) && (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 ".$v_username." ".$v_domain." ".$v_stats_user." ".$v_stats_password, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $v_stats_password = "••••••••"; + } + } + + // 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $v_ftp= ''; + $v_ftp_user = ''; + $v_ftp_password = ''; + } + 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 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'] = _('Error: 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $v_ftp_user = $user."_".$_POST['v_ftp_user']; + $v_ftp_password = "••••••••"; + } + } + + 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 username'; + if (empty($_POST['v_ftp_password'])) $errors[] = 'ftp 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'] = _('Error: 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); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } else { + if (!empty($_POST['v_ftp_email'])) { + $to = $_POST['v_ftp_email']; + $subject = "FTP login credentials"; + $hostname = exec('hostname'); + $from = "Vesta Control Panel "; + $mailtext .= "Your ftp account has been created successfully and is ready to use.\n\n"; + $mailtext .= "hostname: ".$_GET['domain']."\n"; + $mailtext .= "username: ".$user."_".$_POST['v_ftp_user']."\n"; + $mailtext .= "password: ".$_POST['v_ftp_password']."\n\n"; + $mailtext .= "--\nVesta Control Panel\n"; + send_email($to, $subject, $mailtext, $from); + unset($v_ftp_email); + } + } + unset($output); + $v_ftp_user = $user."_".$_POST['v_ftp_user']; + $v_ftp_password = "••••••••"; + } + } + + // Restart web + if (!empty($restart_web) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-restart-web", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + } + + // Restart dns + if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) { + exec (VESTA_CMD."v-restart-dns", $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + } + + if (empty($_SESSION['error_msg'])) { + $_SESSION['ok_msg'] = "OK: changes has been saved."; + } + + } +if ($_SESSION['user'] == 'admin') { + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_web.html'); +} else { + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_web.html'); +} + unset($_SESSION['error_msg']); + unset($_SESSION['ok_msg']); +//} + +// Footer +include($_SERVER['DOCUMENT_ROOT'].'/templates/footer.html'); diff --git a/web/inc/i18n/en.php b/web/inc/i18n/en.php new file mode 100644 index 00000000..31d4872c --- /dev/null +++ b/web/inc/i18n/en.php @@ -0,0 +1,15 @@ +'Hour', + 'Min'=>'Min', + 'pb'=>'pb', + +); \ No newline at end of file diff --git a/web/inc/i18n/ru.php b/web/inc/i18n/ru.php new file mode 100644 index 00000000..a2f6a134 --- /dev/null +++ b/web/inc/i18n/ru.php @@ -0,0 +1,82 @@ +'Час', + 'Min'=>'Мин', + 'pb'=>'пб', + 'tb'=>'тб', + 'gb'=>'гб', + 'mb'=>'мб', + 'Error'=>'Ошибка', + 'minute'=>'минута', + 'hour'=>'час', + 'day'=>'день', + 'month'=>'месяц', + 'day of week'=>'день недели', + 'cmd'=>'командная строка', + 'Error: field "%s" can not be blank.'=>'Ошибка: Поле "%s" не может быть пустым.', + _('Error: vesta did not return any output.')=>'Ошибка: Vesta не отвечает', + 'OK: cron job has been created successfully.'=>'Успех: Задание Cron успешно создано', + 'database'=>'база данных', + 'username'=>'имя пользователя', + 'password'=>'пароль', + 'type'=>'тип', + 'charset'=>'кодировка', + 'DATABASE_CREATED_OK'=>'Успех: База данных %s успешно создана.', + 'domain'=>'домен', + 'ip'=>'IP', + 'DOMAIN_CREATED_OK'=>'Успех: Домен %s успешно создан.', + 'RECORD_CREATED_OK'=>'Успех: Запись %s.%s успешно создана.', + 'ip address'=>'IP-адрес', + 'netmask'=>'маска подсети', + 'interface'=>'интерфейс', + 'assigned user'=>'назначенный пользователь', + 'IP_CREATED_OK'=>'"Успех: ip-адрес %s успешно создан.', + 'DOMAIN_MAIL_CREATED_OK'=>'Успех: почта для домена %s подключена успешно', + 'account'=>'аккаунт', + 'password'=>'пароль', + 'MAIL_ACCOUNT_CREATED_OK'=>'Успех: почтовый аккаунт %s@%s успешно создан.', + 'package'=>'пакет', + 'template'=>'шаблон', + 'shell'=>'SSH', + 'web domains'=>'хосты', + 'web aliases'=>'перенаправления хостов', + 'dns records'=>'DNS записи', + 'mail domains'=>'домены с почтой', + 'mail accounts'=>'почтовые аккаунты', + 'databases'=>'базы данных', + 'cron jobs'=>'cron задания', + 'backups'=>'бэкапы', + 'quota'=>'квота диска', + 'bandwidth'=>'ширина канала', + 'ns1'=>'DNS-сервер #1', + 'ns2'=>'DNS-сервер #2', + 'PACKAGE_CREATED_OK'=>'Успех: Пакет %s успешно создан.', + 'user'=>'пользователь', + 'email'=>'Email', + 'first name'=>'Имя', + 'last name'=>'Фамилия', + 'Please enter valid email address.'=>'Пожалуйста, введите реальный email адрес.', + '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", + 'ACCOUNT_CREATED_OK'=>'Успех: Пользователь %s успешно создан.', + 'ssl certificate'=>'SSL сертификат', + 'ssl key'=>'ключ SSL сертификата', + 'stats user password'=>'пароль для доступа к статистике', + 'ftp user password'=>'пароль для доступа к FTP', + 'FTP login credentials'=>'Данные для доступа к FTP', + 'FTP_ACCOUNT_READY'=>"Ваш FTP аккаунт успешно создан и готов к использованию.\n\nХост: %s\nИмя пользователя: %s_%s\nПароль: %s\n\n--\nПанель управления Vesta\n", + 'HOSTING_DOMAIN_CREATED_OK'=>'Успешно: хостинг для домена %s был успешно создан.', + + + +); \ No newline at end of file diff --git a/web/inc/main.php b/web/inc/main.php index 5df9e1bd..c9c2f440 100644 --- a/web/inc/main.php +++ b/web/inc/main.php @@ -1,138 +1,159 @@ - 0 ) { - header("Location: /error/"); - exit; - } -} - -function top_panel($user, $TAB) { - global $panel; - $command = VESTA_CMD."v-list-user '".$user."' 'json'"; - exec ($command, $output, $return_var); - if ( $return_var > 0 ) { - header("Location: /error/"); - exit; - } - $panel = json_decode(implode('', $output), true); - unset($output); - if ( $user == 'admin' ) { - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/panel.html'); - } else { - include($_SERVER['DOCUMENT_ROOT'].'/templates/user/panel.html'); - } -} - -function humanize_time($usage) { - if ( $usage > 60 ) { - $usage = $usage / 60; - $usage = number_format($usage, 2); - $usage = $usage." Hour."; - } else { - $usage = $usage." Min."; - } - return $usage; -} - -function humanize_usage($usage) { - if ( $usage > 1000 ) { - $usage = $usage / 1000; - if ( $usage > 1000 ) { - $usage = $usage / 1000 ; - if ( $usage > 1000 ) { - $usage = $usage / 1000 ; - $usage = number_format($usage, 2); - $usage = $usage." pb"; - } else { - $usage = number_format($usage, 2); - $usage = $usage." tb"; - } - } else { - $usage = number_format($usage, 2); - $usage = $usage." gb"; - } - } else { - $usage = $usage." mb"; - } - return $usage; -} - -function get_percentage($used,$total) { - if (!isset($total)) $total = 0; - if (!isset($used)) $used = 0; - if ( $total == 0 ) { - $percent = 0; - } else { - $percent = $used / $total; - $percent = $percent * 100; - $percent = number_format($percent, 0, '', ''); - if ( $percent > 100 ) { - $percent = 100; - } - if ( $percent < 0 ) { - $percent = 0; - } - - } - return $percent; -} - -function send_email($to,$subject,$mailtext,$from) { - $charset = "utf-8"; - $to = '<'.$to.'>'; - $boundary = '--' . md5( uniqid("myboundary") ); - $priorities = array( '1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)' ); - $priority = $priorities[2]; - $ctencoding = "8bit"; - $sep = chr(13) . chr(10); - $disposition = "inline"; - $subject = "=?$charset?B?".base64_encode($subject)."?="; - $header = "From: $from \nX-Priority: $priority\nCC:\n"; - $header .= "Mime-Version: 1.0\nContent-Type: text/plain; charset=$charset \n"; - $header .= "Content-Transfer-Encoding: $ctencoding\nX-Mailer: Php/libMailv1.3\n"; - $message = $mailtext; - mail($to, $subject, $message, $header); -} - -function display_error_block() { - if (!empty($_SESSION['error_msg'])) { - echo ' - -
-

'; - echo $_SESSION['error_msg']; - echo "

\n
\n"; - unset($_SESSION['error_msg']); - } -} -?> +1) { $args[0] = $text; + return call_user_func_array("sprintf",$args); + } + else return $text; +} + +// Check user session +if (!isset($_SESSION['user'])) { + $_SESSION['request_uri'] = $_SERVER['REQUEST_URI']; + header("Location: /login/"); + exit; +} + +if (isset($_SESSION['look']) && ( $_SESSION['look'] != 'admin' )) { + $user = $_SESSION['look']; +} else { + $user = $_SESSION['user']; +} + +define('VESTA_CMD', '/usr/bin/sudo /usr/local/vesta/bin/'); + +$i = 0; + +// Define functions +function check_error($return_var){ + if ( $return_var > 0 ) { + header("Location: /error/"); + exit; + } +} + +function top_panel($user, $TAB) { + global $panel; + $command = VESTA_CMD."v-list-user '".$user."' 'json'"; + exec ($command, $output, $return_var); + if ( $return_var > 0 ) { + header("Location: /error/"); + exit; + } + $panel = json_decode(implode('', $output), true); + unset($output); + if ( $user == 'admin' ) { + include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/panel.html'); + } else { + include($_SERVER['DOCUMENT_ROOT'].'/templates/user/panel.html'); + } +} + +function humanize_time($usage) { + if ( $usage > 60 ) { + $usage = $usage / 60; + $usage = number_format($usage, 2); + $usage = $usage." "._('Hour')."."; + } else { + $usage = $usage." "._('Min')."."; + } + return $usage; +} + +function humanize_usage($usage) { + if ( $usage > 1000 ) { + $usage = $usage / 1000; + if ( $usage > 1000 ) { + $usage = $usage / 1000 ; + if ( $usage > 1000 ) { + $usage = $usage / 1000 ; + $usage = number_format($usage, 2); + $usage = $usage." "._('pb'); + } else { + $usage = number_format($usage, 2); + $usage = $usage." "._('tb'); + } + } else { + $usage = number_format($usage, 2); + $usage = $usage." "._('gb'); + } + } else { + $usage = $usage." "._('mb'); + } + return $usage; +} + +function get_percentage($used,$total) { + if (!isset($total)) $total = 0; + if (!isset($used)) $used = 0; + if ( $total == 0 ) { + $percent = 0; + } else { + $percent = $used / $total; + $percent = $percent * 100; + $percent = number_format($percent, 0, '', ''); + if ( $percent > 100 ) { + $percent = 100; + } + if ( $percent < 0 ) { + $percent = 0; + } + + } + return $percent; +} + +function send_email($to,$subject,$mailtext,$from) { + $charset = "utf-8"; + $to = '<'.$to.'>'; + $boundary = '--' . md5( uniqid("myboundary") ); + $priorities = array( '1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)' ); + $priority = $priorities[2]; + $ctencoding = "8bit"; + $sep = chr(13) . chr(10); + $disposition = "inline"; + $subject = "=?$charset?B?".base64_encode($subject)."?="; + $header = "From: $from \nX-Priority: $priority\nCC:\n"; + $header .= "Mime-Version: 1.0\nContent-Type: text/plain; charset=$charset \n"; + $header .= "Content-Transfer-Encoding: $ctencoding\nX-Mailer: Php/libMailv1.3\n"; + $message = $mailtext; + mail($to, $subject, $message, $header); +} + +function display_error_block() { + if (!empty($_SESSION['error_msg'])) { + echo ' + +
+

'; + echo $_SESSION['error_msg']; + echo "

\n
\n"; + unset($_SESSION['error_msg']); + } +} +?> diff --git a/web/suspend/cron/index.php b/web/suspend/cron/index.php index 13824ea7..6c9c68a2 100644 --- a/web/suspend/cron/index.php +++ b/web/suspend/cron/index.php @@ -1,32 +1,32 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); -} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/cron/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); +} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/cron/"); +exit; diff --git a/web/suspend/db/index.php b/web/suspend/db/index.php index 9e22dcee..320c89d3 100644 --- a/web/suspend/db/index.php +++ b/web/suspend/db/index.php @@ -1,34 +1,34 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - -} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/db/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + +} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/db/"); +exit; diff --git a/web/suspend/dns/index.php b/web/suspend/dns/index.php index 38586bc8..e907f609 100644 --- a/web/suspend/dns/index.php +++ b/web/suspend/dns/index.php @@ -1,63 +1,63 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $back = $_SESSION['back']; - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/dns/"); - exit; - } - - // DNS record - if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) { - $v_username = escapeshellarg($user); - $v_domain = escapeshellarg($_GET['domain']); - $v_record_id = escapeshellarg($_GET['record_id']); - exec (VESTA_CMD."v-suspend-dns-domain-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $back = $_SESSION['back']; - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/dns/?domain=".$_GET['domain']); - exit; - - } - -} -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/dns/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $back = $_SESSION['back']; + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/dns/"); + exit; + } + + // DNS record + if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) { + $v_username = escapeshellarg($user); + $v_domain = escapeshellarg($_GET['domain']); + $v_record_id = escapeshellarg($_GET['record_id']); + exec (VESTA_CMD."v-suspend-dns-domain-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $back = $_SESSION['back']; + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/dns/?domain=".$_GET['domain']); + exit; + + } + +} +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/dns/"); +exit; diff --git a/web/suspend/mail/index.php b/web/suspend/mail/index.php index cda23e81..a9a99632 100644 --- a/web/suspend/mail/index.php +++ b/web/suspend/mail/index.php @@ -1,61 +1,61 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $back=getenv("HTTP_REFERER"); - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/mail/"); - exit; - } - - // Mail account - if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) { - $v_username = escapeshellarg($user); - $v_domain = escapeshellarg($_GET['domain']); - $v_account = escapeshellarg($_GET['account']); - exec (VESTA_CMD."v-suspend-mail-account ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $back = $_SESSION['back']; - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/mail/?domain=".$_GET['domain']); - exit; - } -} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} -header("Location: /list/mail/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $back=getenv("HTTP_REFERER"); + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/mail/"); + exit; + } + + // Mail account + if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) { + $v_username = escapeshellarg($user); + $v_domain = escapeshellarg($_GET['domain']); + $v_account = escapeshellarg($_GET['account']); + exec (VESTA_CMD."v-suspend-mail-account ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $back = $_SESSION['back']; + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/mail/?domain=".$_GET['domain']); + exit; + } +} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} +header("Location: /list/mail/"); +exit; diff --git a/web/suspend/user/index.php b/web/suspend/user/index.php index 20d1debb..9f4bd86a 100644 --- a/web/suspend/user/index.php +++ b/web/suspend/user/index.php @@ -1,30 +1,30 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - -} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/user/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + +} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/user/"); +exit; diff --git a/web/suspend/web/index.php b/web/suspend/web/index.php index fef9158e..36ab7d0b 100644 --- a/web/suspend/web/index.php +++ b/web/suspend/web/index.php @@ -1,33 +1,33 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); -} - -$back = $_SESSION['back']; -if (!empty($back)) { - header("Location: ".$back); - exit; -} - -header("Location: /list/web/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); +} + +$back = $_SESSION['back']; +if (!empty($back)) { + header("Location: ".$back); + exit; +} + +header("Location: /list/web/"); +exit; diff --git a/web/unsuspend/cron/index.php b/web/unsuspend/cron/index.php index 500517b6..0b5e4760 100644 --- a/web/unsuspend/cron/index.php +++ b/web/unsuspend/cron/index.php @@ -1,32 +1,32 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - -} - -$back=getenv("HTTP_REFERER"); -if (!empty($back)) { - header("Location: ".$back); - exit; -} -header("Location: /list/cron/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + +} + +$back=getenv("HTTP_REFERER"); +if (!empty($back)) { + header("Location: ".$back); + exit; +} +header("Location: /list/cron/"); +exit; diff --git a/web/unsuspend/dns/index.php b/web/unsuspend/dns/index.php index 2b87b6bd..d2170948 100644 --- a/web/unsuspend/dns/index.php +++ b/web/unsuspend/dns/index.php @@ -1,62 +1,62 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $back=getenv("HTTP_REFERER"); - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/dns/"); - exit; - - } - - // DNS record - if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) { - $v_username = escapeshellarg($user); - $v_domain = escapeshellarg($_GET['domain']); - $v_record_id = escapeshellarg($_GET['record_id']); - exec (VESTA_CMD."v-unsuspend-dns-domain-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $back=getenv("HTTP_REFERER"); - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/dns/?domain=".$_GET['domain']); - exit; - } - -} - -$back=getenv("HTTP_REFERER"); -if (!empty($back)) { - header("Location: ".$back); - exit; -} -header("Location: /list/dns/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $back=getenv("HTTP_REFERER"); + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/dns/"); + exit; + + } + + // DNS record + if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) { + $v_username = escapeshellarg($user); + $v_domain = escapeshellarg($_GET['domain']); + $v_record_id = escapeshellarg($_GET['record_id']); + exec (VESTA_CMD."v-unsuspend-dns-domain-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $back=getenv("HTTP_REFERER"); + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/dns/?domain=".$_GET['domain']); + exit; + } + +} + +$back=getenv("HTTP_REFERER"); +if (!empty($back)) { + header("Location: ".$back); + exit; +} +header("Location: /list/dns/"); +exit; diff --git a/web/unsuspend/mail/index.php b/web/unsuspend/mail/index.php index 5c95351e..7f2dd127 100644 --- a/web/unsuspend/mail/index.php +++ b/web/unsuspend/mail/index.php @@ -1,60 +1,60 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $back=getenv("HTTP_REFERER"); - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/mail/"); - exit; - } - - // Mail account - if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) { - $v_username = escapeshellarg($user); - $v_domain = escapeshellarg($_GET['domain']); - $v_account = escapeshellarg($_GET['account']); - exec (VESTA_CMD."v-unsuspend-mail-account ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - $back=getenv("HTTP_REFERER"); - if (!empty($back)) { - header("Location: ".$back); - exit; - } - header("Location: /list/mail/?domain=".$_GET['domain']); - exit; - } -} - -$back=getenv("HTTP_REFERER"); -if (!empty($back)) { - header("Location: ".$back); - exit; -} -header("Location: /list/mail/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $back=getenv("HTTP_REFERER"); + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/mail/"); + exit; + } + + // Mail account + if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) { + $v_username = escapeshellarg($user); + $v_domain = escapeshellarg($_GET['domain']); + $v_account = escapeshellarg($_GET['account']); + exec (VESTA_CMD."v-unsuspend-mail-account ".$v_username." ".$v_domain." ".$v_account, $output, $return_var); + if ($return_var != 0) { + $error = implode('
', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); + $back=getenv("HTTP_REFERER"); + if (!empty($back)) { + header("Location: ".$back); + exit; + } + header("Location: /list/mail/?domain=".$_GET['domain']); + exit; + } +} + +$back=getenv("HTTP_REFERER"); +if (!empty($back)) { + header("Location: ".$back); + exit; +} +header("Location: /list/mail/"); +exit; diff --git a/web/unsuspend/user/index.php b/web/unsuspend/user/index.php index 8a07505a..0441eecf 100644 --- a/web/unsuspend/user/index.php +++ b/web/unsuspend/user/index.php @@ -1,28 +1,28 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); -} - -$back=getenv("HTTP_REFERER"); -if (!empty($back)) { - header("Location: ".$back); - exit; -} -header("Location: /list/user/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); +} + +$back=getenv("HTTP_REFERER"); +if (!empty($back)) { + header("Location: ".$back); + exit; +} +header("Location: /list/user/"); +exit; diff --git a/web/unsuspend/web/index.php b/web/unsuspend/web/index.php index 04ff36ca..786357a9 100644 --- a/web/unsuspend/web/index.php +++ b/web/unsuspend/web/index.php @@ -1,31 +1,31 @@ -', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); -} - -$back=getenv("HTTP_REFERER"); -if (!empty($back)) { - header("Location: ".$back); - exit; -} -header("Location: /list/web/"); -exit; +', $output); + if (empty($error)) $error = _('Error: vesta did not return any output.'); + $_SESSION['error_msg'] = $error; + } + unset($output); +} + +$back=getenv("HTTP_REFERER"); +if (!empty($back)) { + header("Location: ".$back); + exit; +} +header("Location: /list/web/"); +exit;