diff --git a/web/add/cron/autoupdate/index.php b/web/add/cron/autoupdate/index.php
index bc7db99dd..53d50c059 100644
--- a/web/add/cron/autoupdate/index.php
+++ b/web/add/cron/autoupdate/index.php
@@ -3,12 +3,13 @@
error_reporting(NULL);
ob_start();
session_start();
-include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php');
+include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
if ($_SESSION['user'] == 'admin') {
- v_exec('v-add-cron-vesta-autoupdate', [], false);
+ exec (VESTA_CMD."v-add-cron-vesta-autoupdate", $output, $return_var);
$_SESSION['error_msg'] = __('Autoupdate has been successfully enabled');
+ unset($output);
}
-header('Location: /list/updates/');
+header("Location: /list/updates/");
exit;
diff --git a/web/add/cron/index.php b/web/add/cron/index.php
index c78881877..62cae8f1c 100644
--- a/web/add/cron/index.php
+++ b/web/add/cron/index.php
@@ -13,7 +13,7 @@ if (!empty($_POST['ok'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check empty fields
@@ -35,16 +35,18 @@ if (!empty($_POST['ok'])) {
}
// Protect input
- $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'];
+ $v_min = escapeshellarg($_POST['v_min']);
+ $v_hour = escapeshellarg($_POST['v_hour']);
+ $v_day = escapeshellarg($_POST['v_day']);
+ $v_month = escapeshellarg($_POST['v_month']);
+ $v_wday = escapeshellarg($_POST['v_wday']);
+ $v_cmd = escapeshellarg($_POST['v_cmd']);
// Add cron job
if (empty($_SESSION['error_msg'])) {
- v_exec('v-add-cron-job', [$user, $v_min, $v_hour, $v_day, $v_month, $v_wday, $v_cmd]);
+ exec (VESTA_CMD."v-add-cron-job ".$user." ".$v_min." ".$v_hour." ".$v_day." ".$v_month." ".$v_wday." ".$v_cmd, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Flush field values on success
@@ -56,6 +58,7 @@ if (!empty($_POST['ok'])) {
unset($v_month);
unset($v_wday);
unset($v_cmd);
+ unset($output);
}
}
diff --git a/web/add/cron/reports/index.php b/web/add/cron/reports/index.php
index f3f31db95..4b0424e32 100644
--- a/web/add/cron/reports/index.php
+++ b/web/add/cron/reports/index.php
@@ -3,10 +3,11 @@
error_reporting(NULL);
ob_start();
session_start();
-include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php');
+include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
-v_exec('v-add-cron-reports', [$user], false);
+exec (VESTA_CMD."v-add-cron-reports ".$user, $output, $return_var);
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully enabled');
+unset($output);
-header('Location: /list/cron/');
+header("Location: /list/cron/");
exit;
diff --git a/web/add/db/index.php b/web/add/db/index.php
index 2a328f515..c206eb13c 100644
--- a/web/add/db/index.php
+++ b/web/add/db/index.php
@@ -12,7 +12,7 @@ if (!empty($_POST['ok'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check empty fields
@@ -30,7 +30,7 @@ if (!empty($_POST['ok'])) {
$error_msg = $error_msg.", ".$error;
}
}
- $_SESSION['error_msg'] = __('Field "%s" can not be blank.', $error_msg);
+ $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
}
// Validate email
@@ -43,11 +43,12 @@ if (!empty($_POST['ok'])) {
// Check password length
if (empty($_SESSION['error_msg'])) {
$pw_len = strlen($_POST['v_password']);
- if ($pw_len < 6) $_SESSION['error_msg'] = __('Password is too short.', $error_msg);
+ if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg);
}
- $v_database = $_POST['v_database'];
- $v_dbuser = $_POST['v_dbuser'];
+ // Protect input
+ $v_database = escapeshellarg($_POST['v_database']);
+ $v_dbuser = escapeshellarg($_POST['v_dbuser']);
$v_type = $_POST['v_type'];
$v_charset = $_POST['v_charset'];
$v_host = $_POST['v_host'];
@@ -55,24 +56,32 @@ if (!empty($_POST['ok'])) {
// Add database
if (empty($_SESSION['error_msg'])) {
- $v_password = tempnam('/tmp', 'vst');
- $fp = fopen($v_password, 'w');
+ $v_type = escapeshellarg($_POST['v_type']);
+ $v_charset = escapeshellarg($_POST['v_charset']);
+ $v_host = escapeshellarg($_POST['v_host']);
+ $v_password = tempnam("/tmp","vst");
+ $fp = fopen($v_password, "w");
fwrite($fp, $_POST['v_password']."\n");
fclose($fp);
- v_exec('v-add-database', [$user, $v_database, $v_dbuser, $v_password, $v_type, $v_host, $v_charset]);
+ exec (VESTA_CMD."v-add-database ".$user." ".$v_database." ".$v_dbuser." ".$v_password." ".$v_type." ".$v_host." ".$v_charset, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
unlink($v_password);
- $v_password = $_POST['v_password'];
+ $v_password = escapeshellarg($_POST['v_password']);
+ $v_type = $_POST['v_type'];
+ $v_host = $_POST['v_host'];
+ $v_charset = $_POST['v_charset'];
}
// Get database manager url
if (empty($_SESSION['error_msg'])) {
- list($http_host, $port) = explode(':', $_SERVER['HTTP_HOST'] . ':');
+ list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"] . ":");
if ($_POST['v_host'] != 'localhost' ) $http_host = $_POST['v_host'];
- if ($_POST['v_type'] == 'mysql') $db_admin = 'phpMyAdmin';
- if ($_POST['v_type'] == 'mysql') $db_admin_link = "http://$http_host/phpmyadmin/";
+ if ($_POST['v_type'] == 'mysql') $db_admin = "phpMyAdmin";
+ if ($_POST['v_type'] == 'mysql') $db_admin_link = "http://".$http_host."/phpmyadmin/";
if (($_POST['v_type'] == 'mysql') && (!empty($_SESSION['DB_PMA_URL']))) $db_admin_link = $_SESSION['DB_PMA_URL'];
- if ($_POST['v_type'] == 'pgsql') $db_admin = 'phpPgAdmin';
- if ($_POST['v_type'] == 'pgsql') $db_admin_link = "http://$http_host/phppgadmin/";
+ if ($_POST['v_type'] == 'pgsql') $db_admin = "phpPgAdmin";
+ if ($_POST['v_type'] == 'pgsql') $db_admin_link = "http://".$http_host."/phppgadmin/";
if (($_POST['v_type'] == 'pgsql') && (!empty($_SESSION['DB_PGA_URL']))) $db_admin_link = $_SESSION['DB_PGA_URL'];
}
@@ -81,15 +90,15 @@ if (!empty($_POST['ok'])) {
$to = $v_db_email;
$subject = __("Database Credentials");
$hostname = exec('hostname');
- $from = __('MAIL_FROM', $hostname);
- $mailtext = __('DATABASE_READY', $user.'_'.$_POST['v_database'], $user.'_'.$_POST['v_dbuser'], $_POST['v_password'], $db_admin_link);
+ $from = __('MAIL_FROM',$hostname);
+ $mailtext = __('DATABASE_READY',$user."_".$_POST['v_database'],$user."_".$_POST['v_dbuser'],$_POST['v_password'],$db_admin_link);
send_email($to, $subject, $mailtext, $from);
}
// Flush field values on success
if (empty($_SESSION['error_msg'])) {
- $_SESSION['ok_msg'] = __('DATABASE_CREATED_OK', htmlentities($user.'_'.$_POST['v_database']), htmlentities($user.'_'.$_POST['v_database']));
- $_SESSION['ok_msg'] .= " / " . __('open %s', $db_admin) . '';
+ $_SESSION['ok_msg'] = __('DATABASE_CREATED_OK',htmlentities($user)."_".htmlentities($_POST['v_database']),htmlentities($user)."_".htmlentities($_POST['v_database']));
+ $_SESSION['ok_msg'] .= " / " . __('open %s',$db_admin) . "";
unset($v_database);
unset($v_dbuser);
unset($v_password);
@@ -108,15 +117,16 @@ top_panel($user,$TAB);
$v_db_email = $panel[$user]['CONTACT'];
// List avaiable database types
-$db_types = explode(',', $_SESSION['DB_SYSTEM']);
+$db_types = split(",",$_SESSION['DB_SYSTEM']);
// List available database servers
$db_hosts = array();
foreach ($db_types as $db_type ) {
- v_exec('v-list-database-hosts', [$db_type, 'json'], false, $output);
- $db_hosts_tmp = json_decode($output, true);
+ exec (VESTA_CMD."v-list-database-hosts ".$db_type." 'json'", $output, $return_var);
+ $db_hosts_tmp = json_decode(implode('', $output), true);
$db_hosts = array_merge($db_hosts, $db_hosts_tmp);
unset($db_hosts_tmp);
+ unset($output);
}
// Display body
diff --git a/web/add/dns/index.php b/web/add/dns/index.php
index 086ca5d7e..629e2ec57 100644
--- a/web/add/dns/index.php
+++ b/web/add/dns/index.php
@@ -13,7 +13,7 @@ if (!empty($_POST['ok'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check empty fields
@@ -32,47 +32,56 @@ if (!empty($_POST['ok'])) {
// Protect input
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
+ $v_domain = escapeshellarg($v_domain);
$v_domain = strtolower($v_domain);
- $v_ip = $_POST['v_ip'];
- if (!empty($_POST['v_ns1'])) $v_ns1 = $_POST['v_ns1'];
- if (!empty($_POST['v_ns2'])) $v_ns2 = $_POST['v_ns2'];
- if (!empty($_POST['v_ns3'])) $v_ns3 = $_POST['v_ns3'];
- if (!empty($_POST['v_ns4'])) $v_ns4 = $_POST['v_ns4'];
- if (!empty($_POST['v_ns5'])) $v_ns5 = $_POST['v_ns5'];
- if (!empty($_POST['v_ns6'])) $v_ns6 = $_POST['v_ns6'];
- if (!empty($_POST['v_ns7'])) $v_ns7 = $_POST['v_ns7'];
- if (!empty($_POST['v_ns8'])) $v_ns8 = $_POST['v_ns8'];
+ $v_ip = escapeshellarg($_POST['v_ip']);
+ if (!empty($_POST['v_ns1'])) $v_ns1 = escapeshellarg($_POST['v_ns1']);
+ if (!empty($_POST['v_ns2'])) $v_ns2 = escapeshellarg($_POST['v_ns2']);
+ if (!empty($_POST['v_ns3'])) $v_ns3 = escapeshellarg($_POST['v_ns3']);
+ if (!empty($_POST['v_ns4'])) $v_ns4 = escapeshellarg($_POST['v_ns4']);
+ if (!empty($_POST['v_ns5'])) $v_ns5 = escapeshellarg($_POST['v_ns5']);
+ if (!empty($_POST['v_ns6'])) $v_ns6 = escapeshellarg($_POST['v_ns6']);
+ if (!empty($_POST['v_ns7'])) $v_ns7 = escapeshellarg($_POST['v_ns7']);
+ if (!empty($_POST['v_ns8'])) $v_ns8 = escapeshellarg($_POST['v_ns8']);
// Add dns domain
if (empty($_SESSION['error_msg'])) {
- v_exec('v-add-dns-domain', [$user, $v_domain, $v_ip, $v_ns1, $v_ns2, $v_ns3, $v_ns4, $v_ns5, $v_ns6, $v_ns7, $v_ns8, 'no']);
+ exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$v_ns4." ".$v_ns5." ".$v_ns6." ".$v_ns7." ".$v_ns8." no", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Set expiriation date
if (empty($_SESSION['error_msg'])) {
if ((!empty($_POST['v_exp'])) && ($_POST['v_exp'] != date('Y-m-d', strtotime('+1 year')))) {
- $v_exp = $_POST['v_exp'];
- v_exec('v-change-dns-domain-exp', [$user, $v_domain, $v_exp, 'no']);
+ $v_exp = escapeshellarg($_POST['v_exp']);
+ exec (VESTA_CMD."v-change-dns-domain-exp ".$user." ".$v_domain." ".$v_exp." no", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
}
// Set ttl
if (empty($_SESSION['error_msg'])) {
if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400') && (empty($_SESSION['error_msg']))) {
- $v_ttl = $_POST['v_ttl'];
- v_exec('v-change-dns-domain-ttl', [$user, $v_domain, $v_ttl, 'no']);
+ $v_ttl = escapeshellarg($_POST['v_ttl']);
+ exec (VESTA_CMD."v-change-dns-domain-ttl ".$user." ".$v_domain." ".$v_ttl." no", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
}
// Restart dns server
if (empty($_SESSION['error_msg'])) {
- v_exec('v-restart-dns');
+ exec (VESTA_CMD."v-restart-dns", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Flush field values on success
if (empty($_SESSION['error_msg'])) {
- $_SESSION['ok_msg'] = __('DNS_DOMAIN_CREATED_OK', htmlentities($_POST[v_domain]), htmlentities($_POST[v_domain]));
+ $_SESSION['ok_msg'] = __('DNS_DOMAIN_CREATED_OK',htmlentities($_POST[v_domain]),htmlentities($_POST[v_domain]));
unset($v_domain);
}
}
@@ -84,7 +93,7 @@ if (!empty($_POST['ok_rec'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check empty fields
@@ -104,15 +113,18 @@ if (!empty($_POST['ok_rec'])) {
}
// Protect input
- $v_domain = $_POST['v_domain'];
- $v_rec = $_POST['v_rec'];
- $v_type = $_POST['v_type'];
- $v_val = $_POST['v_val'];
- $v_priority = $_POST['v_priority'];
+ $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']);
// Add dns record
if (empty($_SESSION['error_msg'])) {
- v_exec('v-add-dns-record', [$user, $v_domain, $v_rec, $v_type, $v_val, $v_priority]);
+ exec (VESTA_CMD."v-add-dns-record ".$user." ".$v_domain." ".$v_rec." ".$v_type." ".$v_val." ".$v_priority, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
+ $v_type = $_POST['v_type'];
}
// Flush field values on success
@@ -147,8 +159,8 @@ if (empty($_GET['domain'])) {
if (empty($v_ttl)) $v_ttl = 14400;
if (empty($v_exp)) $v_exp = date('Y-m-d', strtotime('+1 year'));
if (empty($v_ns1)) {
- v_exec('v-list-user-ns', [$user, 'json'], false, $output);
- $nameservers = json_decode($output, true);
+ exec (VESTA_CMD."v-list-user-ns ".$user." json", $output, $return_var);
+ $nameservers = json_decode(implode('', $output), true);
$v_ns1 = str_replace("'", "", $nameservers[0]);
$v_ns2 = str_replace("'", "", $nameservers[1]);
$v_ns3 = str_replace("'", "", $nameservers[2]);
@@ -157,6 +169,7 @@ if (empty($_GET['domain'])) {
$v_ns6 = str_replace("'", "", $nameservers[5]);
$v_ns7 = str_replace("'", "", $nameservers[6]);
$v_ns8 = str_replace("'", "", $nameservers[7]);
+ unset($output);
}
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns.html');
}
diff --git a/web/add/favorite/index.php b/web/add/favorite/index.php
index 9987ecc9c..e9f2e828d 100644
--- a/web/add/favorite/index.php
+++ b/web/add/favorite/index.php
@@ -9,13 +9,15 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
// if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
// header('location: /login/');
-// exit;
+// exit();
// }
- $v_section = $_REQUEST['v_section'];
- $v_unit_id = $_REQUEST['v_unit_id'];
+ // Protect input
+ $v_section = escapeshellarg($_REQUEST['v_section']);
+ $v_unit_id = escapeshellarg($_REQUEST['v_unit_id']);
- $_SESSION['favourites'][strtoupper((string)$v_section)][(string)$v_unit_id] = 1;
+ $_SESSION['favourites'][strtoupper($_REQUEST['v_section'])][$_REQUEST['v_unit_id']] = 1;
- v_exec('v-add-user-favourites', [$_SESSION['user'], $v_section, $v_unit_id], false/*true*/);
+ exec (VESTA_CMD."v-add-user-favourites ".$_SESSION['user']." ".$v_section." ".$v_unit_id, $output, $return_var);
+// check_return_code($return_var,$output);
?>
\ No newline at end of file
diff --git a/web/add/firewall/banlist/index.php b/web/add/firewall/banlist/index.php
index e95324bf3..f0e97042a 100644
--- a/web/add/firewall/banlist/index.php
+++ b/web/add/firewall/banlist/index.php
@@ -31,12 +31,15 @@ if (!empty($_POST['ok'])) {
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
}
- $v_chain = $_POST['v_chain'];
- $v_ip = $_POST['v_ip'];
+ // Protect input
+ $v_chain = escapeshellarg($_POST['v_chain']);
+ $v_ip = escapeshellarg($_POST['v_ip']);
// Add firewall ban
if (empty($_SESSION['error_msg'])) {
- v_exec('v-add-firewall-ban', [$v_ip, $v_chain]);
+ exec (VESTA_CMD."v-add-firewall-ban ".$v_ip." ".$v_chain, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Flush field values on success
diff --git a/web/add/firewall/index.php b/web/add/firewall/index.php
index e6ead5a16..caae650ce 100644
--- a/web/add/firewall/index.php
+++ b/web/add/firewall/index.php
@@ -20,7 +20,7 @@ if (!empty($_POST['ok'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check empty fields
@@ -39,17 +39,21 @@ if (!empty($_POST['ok'])) {
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
}
- $v_action = $_POST['v_action'];
- $v_protocol = $_POST['v_protocol'];
- $v_port = str_replace(' ', ',', $_POST['v_port']);
+ // Protect input
+ $v_action = escapeshellarg($_POST['v_action']);
+ $v_protocol = escapeshellarg($_POST['v_protocol']);
+ $v_port = str_replace(" ",",", $_POST['v_port']);
$v_port = preg_replace('/\,+/', ',', $v_port);
- $v_port = trim($v_port, ',');
- $v_ip = $_POST['v_ip'];
- $v_comment = $_POST['v_comment'];
+ $v_port = trim($v_port, ",");
+ $v_port = escapeshellarg($v_port);
+ $v_ip = escapeshellarg($_POST['v_ip']);
+ $v_comment = escapeshellarg($_POST['v_comment']);
// Add firewall rule
if (empty($_SESSION['error_msg'])) {
- v_exec('v-add-firewall-rule', [$v_action, $v_ip, $v_port, $v_protocol, $v_comment]);
+ exec (VESTA_CMD."v-add-firewall-rule ".$v_action." ".$v_ip." ".$v_port." ".$v_protocol." ".$v_comment, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Flush field values on success
diff --git a/web/add/ip/index.php b/web/add/ip/index.php
index 5ac006801..5f48a081d 100644
--- a/web/add/ip/index.php
+++ b/web/add/ip/index.php
@@ -19,7 +19,7 @@ if (!empty($_POST['ok'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check empty fields
@@ -38,12 +38,13 @@ if (!empty($_POST['ok'])) {
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
}
- $v_ip = $_POST['v_ip'];
- $v_netmask = $_POST['v_netmask'];
- $v_name = $_POST['v_name'];
- $v_nat = $_POST['v_nat'];
- $v_interface = $_POST['v_interface'];
- $v_owner = $_POST['v_owner'];
+ // Protect input
+ $v_ip = escapeshellarg($_POST['v_ip']);
+ $v_netmask = escapeshellarg($_POST['v_netmask']);
+ $v_name = escapeshellarg($_POST['v_name']);
+ $v_nat = escapeshellarg($_POST['v_nat']);
+ $v_interface = escapeshellarg($_POST['v_interface']);
+ $v_owner = escapeshellarg($_POST['v_owner']);
$v_shared = $_POST['v_shared'];
// Check shared checkmark
@@ -52,11 +53,16 @@ if (!empty($_POST['ok'])) {
} else {
$ip_status = 'dedicated';
$v_dedicated = 'yes';
+
}
// Add IP
if (empty($_SESSION['error_msg'])) {
- v_exec('v-add-sys-ip', [$v_ip, $v_netmask, $v_interface, $v_owner, $ip_status, $v_name, $v_nat]);
+ exec (VESTA_CMD."v-add-sys-ip ".$v_ip." ".$v_netmask." ".$v_interface." ".$v_owner." '".$ip_status."' ".$v_name." ".$v_nat, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
+ $v_owner = $_POST['v_owner'];
+ $v_interface = $_POST['v_interface'];
}
// Flush field values on success
@@ -76,12 +82,14 @@ include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
top_panel($user,$TAB);
// List network interfaces
-v_exec('v-list-sys-interfaces', ['json'], false, $output);
-$interfaces = json_decode($output, true);
+exec (VESTA_CMD."v-list-sys-interfaces 'json'", $output, $return_var);
+$interfaces = json_decode(implode('', $output), true);
+unset($output);
// List users
-v_exec('v-list-sys-users', ['json'], false, $output);
-$users = json_decode($output, true);
+exec (VESTA_CMD."v-list-sys-users 'json'", $output, $return_var);
+$users = json_decode(implode('', $output), true);
+unset($output);
// Display body
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_ip.html');
diff --git a/web/add/mail/index.php b/web/add/mail/index.php
index 5ae28a38c..12adde125 100644
--- a/web/add/mail/index.php
+++ b/web/add/mail/index.php
@@ -14,7 +14,7 @@ if (!empty($_POST['ok'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check empty fields
@@ -53,16 +53,19 @@ if (!empty($_POST['ok'])) {
// Set domain name to lowercase and remove www prefix
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
+ $v_domain = escapeshellarg($v_domain);
$v_domain = strtolower($v_domain);
// Add mail domain
if (empty($_SESSION['error_msg'])) {
- v_exec('v-add-mail-domain', [$user, $v_domain, $v_antispam, $v_antivirus, $v_dkim]);
+ exec (VESTA_CMD."v-add-mail-domain ".$user." ".$v_domain." ".$v_antispam." ".$v_antivirus." ".$v_dkim, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Flush field values on success
if (empty($_SESSION['error_msg'])) {
- $_SESSION['ok_msg'] = __('MAIL_DOMAIN_CREATED_OK', htmlentities($_POST['v_domain']), htmlentities($_POST['v_domain']));
+ $_SESSION['ok_msg'] = __('MAIL_DOMAIN_CREATED_OK',htmlentities($_POST['v_domain']),htmlentities($_POST['v_domain']));
unset($v_domain);
}
}
@@ -74,7 +77,7 @@ if (!empty($_POST['ok_acc'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check empty fields
@@ -89,16 +92,17 @@ if (!empty($_POST['ok_acc'])) {
$error_msg = $error_msg.", ".$error;
}
}
- $_SESSION['error_msg'] = __('Field "%s" can not be blank.', $error_msg);
+ $_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
}
// Protect input
- $v_domain = strtolower($_POST['v_domain']);
- $v_account = $_POST['v_account'];
- $v_quota = $_POST['v_quota'];
+ $v_domain = escapeshellarg($_POST['v_domain']);
+ $v_domain = strtolower($v_domain);
+ $v_account = escapeshellarg($_POST['v_account']);
+ $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'])) $v_quota = 0;
if ((!empty($_POST['v_quota'])) || (!empty($_POST['v_aliases'])) || (!empty($_POST['v_fwd'])) ) $v_adv = 'yes';
// Add Mail Account
@@ -107,55 +111,65 @@ if (!empty($_POST['ok_acc'])) {
$fp = fopen($v_password, "w");
fwrite($fp, $_POST['v_password']."\n");
fclose($fp);
- v_exec('v-add-mail-account', [$user, $v_domain, $v_account, $v_password, $v_quota]);
+ exec (VESTA_CMD."v-add-mail-account ".$user." ".$v_domain." ".$v_account." ".$v_password." ".$v_quota, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
unlink($v_password);
- $v_password = $_POST['v_password'];
+ $v_password = escapeshellarg($_POST['v_password']);
}
// 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("/\n/", " ", $_POST['v_aliases']);
+ $valiases = preg_replace("/,/", " ", $valiases);
$valiases = preg_replace('/\s+/', ' ',$valiases);
$valiases = trim($valiases);
- $aliases = explode(' ', $valiases);
+ $aliases = explode(" ", $valiases);
foreach ($aliases as $alias) {
+ $alias = escapeshellarg($alias);
if (empty($_SESSION['error_msg'])) {
- v_exec('v-add-mail-account-alias', [$user, $v_domain, $v_account, $alias]);
+ exec (VESTA_CMD."v-add-mail-account-alias ".$user." ".$v_domain." ".$v_account." ".$alias, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
}
}
// Add Forwarders
if ((!empty($_POST['v_fwd'])) && (empty($_SESSION['error_msg']))) {
- $vfwd = preg_replace('/\n/', ' ', $_POST['v_fwd']);
- $vfwd = preg_replace('/,/', ' ', $vfwd);
+ $vfwd = preg_replace("/\n/", " ", $_POST['v_fwd']);
+ $vfwd = preg_replace("/,/", " ", $vfwd);
$vfwd = preg_replace('/\s+/', ' ',$vfwd);
$vfwd = trim($vfwd);
- $fwd = explode(' ', $vfwd);
+ $fwd = explode(" ", $vfwd);
foreach ($fwd as $forward) {
+ $forward = escapeshellarg($forward);
if (empty($_SESSION['error_msg'])) {
- v_exec('v-add-mail-account-forward', [$user, $v_domain, $v_account, $forward]);
+ exec (VESTA_CMD."v-add-mail-account-forward ".$user." ".$v_domain." ".$v_account." ".$forward, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
}
}
// Add fwd_only flag
if ((!empty($_POST['v_fwd_only'])) && (empty($_SESSION['error_msg']))) {
- v_exec('v-add-mail-account-fwd-only', [$user, $v_domain, $v_account]);
+ exec (VESTA_CMD."v-add-mail-account-fwd-only ".$user." ".$v_domain." ".$v_account, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Get webmail url
if (empty($_SESSION['error_msg'])) {
- list($http_host, $port) = explode(':', $_SERVER['HTTP_HOST'].':');
- $webmail = "http://$http_host/webmail/";
+ list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
+ $webmail = "http://".$http_host."/webmail/";
if (!empty($_SESSION['MAIL_URL'])) $webmail = $_SESSION['MAIL_URL'];
}
// Flush field values on success
if (empty($_SESSION['error_msg'])) {
- $_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK', htmlentities(strtolower($_POST['v_account'])), htmlentities($_POST['v_domain']), htmlentities(strtolower($_POST['v_account'])), htmlentities($_POST['v_domain']));
- $_SESSION['ok_msg'] .= " / " . __('open webmail') . '';
+ $_SESSION['ok_msg'] = __('MAIL_ACCOUNT_CREATED_OK',htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]),htmlentities(strtolower($_POST['v_account'])),htmlentities($_POST[v_domain]));
+ $_SESSION['ok_msg'] .= " / " . __('open webmail') . "";
unset($v_account);
unset($v_password);
unset($v_password);
diff --git a/web/add/package/index.php b/web/add/package/index.php
index f93e1b03e..f620b4711 100644
--- a/web/add/package/index.php
+++ b/web/add/package/index.php
@@ -19,7 +19,7 @@ if (!empty($_POST['ok'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check empty fields
@@ -57,23 +57,24 @@ if (!empty($_POST['ok'])) {
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
}
- $v_package = $_POST['v_package'];
- $v_web_template = $_POST['v_web_template'];
- $v_backend_template = $_POST['v_backend_template'];
- $v_proxy_template = $_POST['v_proxy_template'];
- $v_dns_template = $_POST['v_dns_template'];
- $v_shell = $_POST['v_shell'];
- $v_web_domains = $_POST['v_web_domains'];
- $v_web_aliases = $_POST['v_web_aliases'];
- $v_dns_domains = $_POST['v_dns_domains'];
- $v_dns_records = $_POST['v_dns_records'];
- $v_mail_domains = $_POST['v_mail_domains'];
- $v_mail_accounts = $_POST['v_mail_accounts'];
- $v_databases = $_POST['v_databases'];
- $v_cron_jobs = $_POST['v_cron_jobs'];
- $v_backups = $_POST['v_backups'];
- $v_disk_quota = $_POST['v_disk_quota'];
- $v_bandwidth = $_POST['v_bandwidth'];
+ // Protect input
+ $v_package = escapeshellarg($_POST['v_package']);
+ $v_web_template = escapeshellarg($_POST['v_web_template']);
+ $v_backend_template = escapeshellarg($_POST['v_backend_template']);
+ $v_proxy_template = escapeshellarg($_POST['v_proxy_template']);
+ $v_dns_template = escapeshellarg($_POST['v_dns_template']);
+ $v_shell = escapeshellarg($_POST['v_shell']);
+ $v_web_domains = escapeshellarg($_POST['v_web_domains']);
+ $v_web_aliases = escapeshellarg($_POST['v_web_aliases']);
+ $v_dns_domains = escapeshellarg($_POST['v_dns_domains']);
+ $v_dns_records = escapeshellarg($_POST['v_dns_records']);
+ $v_mail_domains = escapeshellarg($_POST['v_mail_domains']);
+ $v_mail_accounts = escapeshellarg($_POST['v_mail_accounts']);
+ $v_databases = escapeshellarg($_POST['v_databases']);
+ $v_cron_jobs = escapeshellarg($_POST['v_cron_jobs']);
+ $v_backups = escapeshellarg($_POST['v_backups']);
+ $v_disk_quota = escapeshellarg($_POST['v_disk_quota']);
+ $v_bandwidth = escapeshellarg($_POST['v_bandwidth']);
$v_ns1 = trim($_POST['v_ns1'], '.');
$v_ns2 = trim($_POST['v_ns2'], '.');
$v_ns3 = trim($_POST['v_ns3'], '.');
@@ -89,46 +90,43 @@ if (!empty($_POST['ok'])) {
if (!empty($v_ns6)) $v_ns .= ",".$v_ns6;
if (!empty($v_ns7)) $v_ns .= ",".$v_ns7;
if (!empty($v_ns8)) $v_ns .= ",".$v_ns8;
- $v_time = date('H:i:s');
- $v_date = date('Y-m-d');
+ $v_ns = escapeshellarg($v_ns);
+ $v_time = escapeshellarg(date('H:i:s'));
+ $v_date = escapeshellarg(date('Y-m-d'));
// Create temporary dir
if (empty($_SESSION['error_msg'])) {
- exec('mktemp -d', $output, $return_var);
+ exec ('mktemp -d', $output, $return_var);
$tmpdir = $output[0];
- check_return_code($return_var, $output);
+ check_return_code($return_var,$output);
unset($output);
}
// Create package file
if (empty($_SESSION['error_msg'])) {
- $a_pkg = [
- 'WEB_TEMPLATE' => $v_web_template,
- 'BACKEND_TEMPLATE' => !empty($_SESSION['WEB_BACKEND']) ? $v_backend_template : null,
- 'PROXY_TEMPLATE' => !empty($_SESSION['PROXY_SYSTEM']) ? $v_proxy_template : null,
- 'DNS_TEMPLATE' => $v_dns_template,
- 'WEB_DOMAINS' => $v_web_domains,
- 'WEB_ALIASES' => $v_web_aliases,
- 'DNS_DOMAINS' => $v_dns_domains,
- 'DNS_RECORDS' => $v_dns_records,
- 'MAIL_DOMAINS' => $v_mail_domains,
- 'MAIL_ACCOUNTS' => $v_mail_accounts,
- 'DATABASES' => $v_databases,
- 'CRON_JOBS' => $v_cron_jobs,
- 'DISK_QUOTA' => $v_disk_quota,
- 'BANDWIDTH' => $v_bandwidth,
- 'NS' => $v_ns,
- 'SHELL' => $v_shell,
- 'BACKUPS' => $v_backups,
- 'TIME' => $v_time,
- 'DATE' => $v_date,
- ];
-
- $pkg = '';
- foreach ($a_pkg as $key => $value) {
- if (is_null($value)) continue;
- $pkg .= $key . '=' . escapeshellarg($value) . "\n";
+ $pkg = "WEB_TEMPLATE=".$v_web_template."\n";
+ if (!empty($_SESSION['WEB_BACKEND'])) {
+ $pkg .= "BACKEND_TEMPLATE=".$v_backend_template."\n";
}
+ if (!empty($_SESSION['PROXY_SYSTEM'])) {
+ $pkg .= "PROXY_TEMPLATE=".$v_proxy_template."\n";
+ }
+ $pkg .= "DNS_TEMPLATE=".$v_dns_template."\n";
+ $pkg .= "WEB_DOMAINS=".$v_web_domains."\n";
+ $pkg .= "WEB_ALIASES=".$v_web_aliases."\n";
+ $pkg .= "DNS_DOMAINS=".$v_dns_domains."\n";
+ $pkg .= "DNS_RECORDS=".$v_dns_records."\n";
+ $pkg .= "MAIL_DOMAINS=".$v_mail_domains."\n";
+ $pkg .= "MAIL_ACCOUNTS=".$v_mail_accounts."\n";
+ $pkg .= "DATABASES=".$v_databases."\n";
+ $pkg .= "CRON_JOBS=".$v_cron_jobs."\n";
+ $pkg .= "DISK_QUOTA=".$v_disk_quota."\n";
+ $pkg .= "BANDWIDTH=".$v_bandwidth."\n";
+ $pkg .= "NS=".$v_ns."\n";
+ $pkg .= "SHELL=".$v_shell."\n";
+ $pkg .= "BACKUPS=".$v_backups."\n";
+ $pkg .= "TIME=".$v_time."\n";
+ $pkg .= "DATE=".$v_date."\n";
$fp = fopen($tmpdir."/".$_POST['v_package'].".pkg", 'w');
fwrite($fp, $pkg);
@@ -137,15 +135,18 @@ if (!empty($_POST['ok'])) {
// Add new package
if (empty($_SESSION['error_msg'])) {
- v_exec('v-add-user-package', [$tmpdir, $v_package]);
+ exec (VESTA_CMD."v-add-user-package ".$tmpdir." ".$v_package, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
- // Remove tmpdir
- safe_exec('rm', ['-rf', $tmpdir]);
+ // Remove tmpdir
+ exec ('rm -rf '.$tmpdir, $output, $return_var);
+ unset($output);
// Flush field values on success
if (empty($_SESSION['error_msg'])) {
- $_SESSION['ok_msg'] = __('PACKAGE_CREATED_OK', htmlentities($_POST['v_package']), htmlentities($_POST['v_package']));
+ $_SESSION['ok_msg'] = __('PACKAGE_CREATED_OK',htmlentities($_POST['v_package']),htmlentities($_POST['v_package']));
unset($v_package);
}
@@ -159,28 +160,33 @@ include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
top_panel($user,$TAB);
// List web temmplates
-v_exec('v-list-web-templates', ['json'], false, $output);
-$web_templates = json_decode($output, true);
+exec (VESTA_CMD."v-list-web-templates json", $output, $return_var);
+$web_templates = json_decode(implode('', $output), true);
+unset($output);
// List web templates for backend
if (!empty($_SESSION['WEB_BACKEND'])) {
- v_exec('v-list-web-templates-backend', ['json'], false, $output);
- $backend_templates = json_decode($output, true);
+ exec (VESTA_CMD."v-list-web-templates-backend json", $output, $return_var);
+ $backend_templates = json_decode(implode('', $output), true);
+ unset($output);
}
// List web templates for proxy
if (!empty($_SESSION['PROXY_SYSTEM'])) {
- v_exec('v-list-web-templates-proxy', ['json'], false, $output);
- $proxy_templates = json_decode($output, true);
+ exec (VESTA_CMD."v-list-web-templates-proxy json", $output, $return_var);
+ $proxy_templates = json_decode(implode('', $output), true);
+ unset($output);
}
// List DNS templates
-v_exec('v-list-dns-templates', ['json'], false, $output);
-$dns_templates = json_decode($output, true);
+exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var);
+$dns_templates = json_decode(implode('', $output), true);
+unset($output);
// List system shells
-v_exec('v-list-sys-shells', ['json'], false, $output);
-$shells = json_decode($output, true);
+exec (VESTA_CMD."v-list-sys-shells json", $output, $return_var);
+$shells = json_decode(implode('', $output), true);
+unset($output);
// Set default values
if (empty($v_web_template)) $v_web_template = 'default';
@@ -188,17 +194,17 @@ if (empty($v_backend_template)) $v_backend_template = 'default';
if (empty($v_proxy_template)) $v_proxy_template = 'default';
if (empty($v_dns_template)) $v_dns_template = 'default';
if (empty($v_shell)) $v_shell = 'nologin';
-if (empty($v_web_domains)) $v_web_domains = '1';
-if (empty($v_web_aliases)) $v_web_aliases = '1';
-if (empty($v_dns_domains)) $v_dns_domains = '1';
-if (empty($v_dns_records)) $v_dns_records = '1';
-if (empty($v_mail_domains)) $v_mail_domains = '1';
-if (empty($v_mail_accounts)) $v_mail_accounts = '1';
-if (empty($v_databases)) $v_databases = '1';
-if (empty($v_cron_jobs)) $v_cron_jobs = '1';
-if (empty($v_backups)) $v_backups = '1';
-if (empty($v_disk_quota)) $v_disk_quota = '1000';
-if (empty($v_bandwidth)) $v_bandwidth = '1000';
+if (empty($v_web_domains)) $v_web_domains = "'1'";
+if (empty($v_web_aliases)) $v_web_aliases = "'1'";
+if (empty($v_dns_domains)) $v_dns_domains = "'1'";
+if (empty($v_dns_records)) $v_dns_records = "'1'";
+if (empty($v_mail_domains)) $v_mail_domains = "'1'";
+if (empty($v_mail_accounts)) $v_mail_accounts = "'1'";
+if (empty($v_databases)) $v_databases = "'1'";
+if (empty($v_cron_jobs)) $v_cron_jobs = "'1'";
+if (empty($v_backups)) $v_backups = "'1'";
+if (empty($v_disk_quota)) $v_disk_quota = "'1000'";
+if (empty($v_bandwidth)) $v_bandwidth = "'1000'";
if (empty($v_ns1)) $v_ns1 = 'ns1.example.ltd';
if (empty($v_ns2)) $v_ns2 = 'ns2.example.ltd';
diff --git a/web/add/user/index.php b/web/add/user/index.php
index 434dd6746..26de10209 100644
--- a/web/add/user/index.php
+++ b/web/add/user/index.php
@@ -19,7 +19,7 @@ if (!empty($_POST['ok'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check empty fields
@@ -48,15 +48,16 @@ if (!empty($_POST['ok'])) {
// Check password length
if (empty($_SESSION['error_msg'])) {
$pw_len = strlen($_POST['v_password']);
- if ($pw_len < 6) $_SESSION['error_msg'] = __('Password is too short.', $error_msg);
+ if ($pw_len < 6 ) $_SESSION['error_msg'] = __('Password is too short.',$error_msg);
}
- $v_username = $_POST['v_username'];
- $v_email = $_POST['v_email'];
- $v_package = $_POST['v_package'];
- $v_language = $_POST['v_language'];
- $v_fname = $_POST['v_fname'];
- $v_lname = $_POST['v_lname'];
+ // Protect input
+ $v_username = escapeshellarg($_POST['v_username']);
+ $v_email = escapeshellarg($_POST['v_email']);
+ $v_package = escapeshellarg($_POST['v_package']);
+ $v_language = escapeshellarg($_POST['v_language']);
+ $v_fname = escapeshellarg($_POST['v_fname']);
+ $v_lname = escapeshellarg($_POST['v_lname']);
$v_notify = $_POST['v_notify'];
@@ -66,14 +67,18 @@ if (!empty($_POST['ok'])) {
$fp = fopen($v_password, "w");
fwrite($fp, $_POST['v_password']."\n");
fclose($fp);
- v_exec('v-add-user', [$v_username, $v_password, $v_email, $v_package, $v_fname, $v_lname]);
+ exec (VESTA_CMD."v-add-user ".$v_username." ".$v_password." ".$v_email." ".$v_package." ".$v_fname." ".$v_lname, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
unlink($v_password);
- $v_password = $_POST['v_password'];
+ $v_password = escapeshellarg($_POST['v_password']);
}
// Set language
if (empty($_SESSION['error_msg'])) {
- v_exec('v-change-user-language', [$v_username, $v_language]);
+ exec (VESTA_CMD."v-change-user-language ".$v_username." ".$v_language, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Send email to the new user
@@ -81,6 +86,7 @@ if (!empty($_POST['ok'])) {
$to = $_POST['v_notify'];
$subject = _translate($_POST['v_language'],"Welcome to Vesta Control Panel");
$hostname = exec('hostname');
+ unset($output);
$from = _translate($_POST['v_language'],'MAIL_FROM',$hostname);
if (!empty($_POST['v_fname'])) {
$mailtext = _translate($_POST['v_language'],'GREETINGS_GORDON_FREEMAN',$_POST['v_fname'],$_POST['v_lname']);
@@ -112,13 +118,15 @@ include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
top_panel($user,$TAB);
// List hosting packages
-$return_var = v_exec('v-list-user-packages', ['json'], false, $output);
+exec (VESTA_CMD."v-list-user-packages json", $output, $return_var);
check_error($return_var);
-$data = json_decode($output, true);
+$data = json_decode(implode('', $output), true);
+unset($output);
// List languages
-v_exec('v-list-sys-languages', ['json'], false, $output);
-$languages = json_decode($output, true);
+exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var);
+$languages = json_decode(implode('', $output), true);
+unset($output);
// Display body
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_user.html');
diff --git a/web/add/web/index.php b/web/add/web/index.php
index faa88d182..612ae547b 100644
--- a/web/add/web/index.php
+++ b/web/add/web/index.php
@@ -13,7 +13,7 @@ if (!empty($_POST['ok'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check for empty fields
@@ -42,10 +42,11 @@ if (!empty($_POST['ok'])) {
// Set domain to lowercase and remove www prefix
$v_domain = preg_replace("/^www\./i", "", $_POST['v_domain']);
+ $v_domain = escapeshellarg($v_domain);
$v_domain = strtolower($v_domain);
// Define domain ip address
- $v_ip = $_POST['v_ip'];
+ $v_ip = escapeshellarg($_POST['v_ip']);
// Define domain aliases
$v_aliases = $_POST['v_aliases'];
@@ -53,10 +54,11 @@ if (!empty($_POST['ok'])) {
$aliases = preg_replace("/\r/", ",", $aliases);
$aliases = preg_replace("/\t/", ",", $aliases);
$aliases = preg_replace("/ /", ",", $aliases);
- $aliases_arr = explode(',', $aliases);
+ $aliases_arr = explode(",", $aliases);
$aliases_arr = array_unique($aliases_arr);
$aliases_arr = array_filter($aliases_arr);
- $aliases = implode(',', $aliases_arr);
+ $aliases = implode(",",$aliases_arr);
+ $aliases = escapeshellarg($aliases);
// Define proxy extentions
$v_proxy_ext = $_POST['v_proxy_ext'];
@@ -64,10 +66,11 @@ if (!empty($_POST['ok'])) {
$proxy_ext = preg_replace("/\r/", ",", $proxy_ext);
$proxy_ext = preg_replace("/\t/", ",", $proxy_ext);
$proxy_ext = preg_replace("/ /", ",", $proxy_ext);
- $proxy_ext_arr = explode(',', $proxy_ext);
+ $proxy_ext_arr = explode(",", $proxy_ext);
$proxy_ext_arr = array_unique($proxy_ext_arr);
$proxy_ext_arr = array_filter($proxy_ext_arr);
- $proxy_ext = implode(',', $proxy_ext_arr);
+ $proxy_ext = implode(",",$proxy_ext_arr);
+ $proxy_ext = escapeshellarg($proxy_ext);
// Define other options
$v_elog = $_POST['v_elog'];
@@ -76,7 +79,7 @@ if (!empty($_POST['ok'])) {
$v_ssl_key = $_POST['v_ssl_key'];
$v_ssl_ca = $_POST['v_ssl_ca'];
$v_ssl_home = $data[$v_domain]['SSL_HOME'];
- $v_stats = $_POST['v_stats'];
+ $v_stats = escapeshellarg($_POST['v_stats']);
$v_stats_user = $data[$v_domain]['STATS_USER'];
$v_stats_password = $data[$v_domain]['STATS_PASSWORD'];
$v_ftp = $_POST['v_ftp'];
@@ -101,32 +104,44 @@ if (!empty($_POST['ok'])) {
// Add web domain
if (empty($_SESSION['error_msg'])) {
- v_exec('v-add-web-domain', [$user, $v_domain, $v_ip, 'no', $aliases, $proxy_ext]);
+ exec (VESTA_CMD."v-add-web-domain ".$user." ".$v_domain." ".$v_ip." 'no' ".$aliases." ".$proxy_ext, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
$domain_added = empty($_SESSION['error_msg']);
}
// Add DNS domain
if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) {
- v_exec('v-add-dns-domain', [$user, $v_domain, $v_ip]);
+ exec (VESTA_CMD."v-add-dns-domain ".$user." ".$v_domain." ".$v_ip, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Add DNS for domain aliases
if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) {
foreach ($aliases_arr as $alias) {
- if ($alias != 'www.' . $_POST['v_domain']) {
- v_exec('v-add-dns-on-web-alias', [$user, $alias, $v_ip, 'no']);
+ if ($alias != "www.".$_POST['v_domain']) {
+ $alias = escapeshellarg($alias);
+ exec (VESTA_CMD."v-add-dns-on-web-alias ".$user." ".$alias." ".$v_ip." 'no'", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
}
}
// Add mail domain
if (($_POST['v_mail'] == 'on') && (empty($_SESSION['error_msg']))) {
- v_exec('v-add-mail-domain', [$user, $v_domain]);
+ exec (VESTA_CMD."v-add-mail-domain ".$user." ".$v_domain, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Delete proxy support
if ((!empty($_SESSION['PROXY_SYSTEM'])) && ($_POST['v_proxy'] == 'off') && (empty($_SESSION['error_msg']))) {
- v_exec('v-delete-web-domain-proxy', [$user, $v_domain, 'no']);
+ $ext = escapeshellarg($ext);
+ exec (VESTA_CMD."v-delete-web-domain-proxy ".$user." ".$v_domain." 'no'", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Add SSL certificates
@@ -159,46 +174,60 @@ if (!empty($_POST['ok'])) {
fclose($fp);
}
- $v_ssl_home = $_POST['v_ssl_home'];
- v_exec('v-add-web-domain-ssl', [$user, $v_domain, $tmpdir, $v_ssl_home, 'no']);
+ $v_ssl_home = escapeshellarg($_POST['v_ssl_home']);
+ exec (VESTA_CMD."v-add-web-domain-ssl ".$user." ".$v_domain." ".$tmpdir." ".$v_ssl_home." 'no'", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Add web stats
if ((!empty($_POST['v_stats'])) && ($_POST['v_stats'] != 'none' ) && (empty($_SESSION['error_msg']))) {
- $v_stats = $_POST['v_stats'];
- v_exec('v-add-web-domain-stats', [$user, $v_domain, $v_stats]);
+ $v_stats = escapeshellarg($_POST['v_stats']);
+ exec (VESTA_CMD."v-add-web-domain-stats ".$user." ".$v_domain." ".$v_stats, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Add web stats password
if ((!empty($_POST['v_stats_user'])) && (empty($_SESSION['error_msg']))) {
- $v_stats_user = $_POST['v_stats_user'];
+ $v_stats_user = escapeshellarg($_POST['v_stats_user']);
$v_stats_password = tempnam("/tmp","vst");
$fp = fopen($v_stats_password, "w");
fwrite($fp, $_POST['v_stats_password']."\n");
fclose($fp);
- v_exec('v-add-web-domain-stats-user', [$user, $v_domain, $v_stats_user, $v_stats_password]);
+ exec (VESTA_CMD."v-add-web-domain-stats-user ".$user." ".$v_domain." ".$v_stats_user." ".$v_stats_password, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
unlink($v_stats_password);
- $v_stats_password = $_POST['v_stats_password'];
+ $v_stats_password = escapeshellarg($_POST['v_stats_password']);
}
// Restart DNS server
if (($_POST['v_dns'] == 'on') && (empty($_SESSION['error_msg']))) {
- v_exec('v-restart-dns');
+ exec (VESTA_CMD."v-restart-dns", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Restart web server
if (empty($_SESSION['error_msg'])) {
- v_exec('v-restart-web');
+ exec (VESTA_CMD."v-restart-web", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Restart backend server
//if ((!empty($_SESSION['WEB_BACKEND'])) && (empty($_SESSION['error_msg']))) {
- // v_exec('v-restart-backend');
+ // exec (VESTA_CMD."v-restart-web-backend", $output, $return_var);
+ // check_return_code($return_var,$output);
+ // unset($output);
//}
// Restart proxy server
if ((!empty($_SESSION['PROXY_SYSTEM'])) && ($_POST['v_proxy'] == 'on') && (empty($_SESSION['error_msg']))) {
- v_exec('v-restart-proxy');
+ exec (VESTA_CMD."v-restart-proxy", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Add FTP
@@ -236,19 +265,22 @@ if (!empty($_POST['ok'])) {
$v_ftp_user_data['v_ftp_user'] = preg_replace("/^".$user."_/i", "", $v_ftp_user_data['v_ftp_user']);
$v_ftp_username = $v_ftp_user_data['v_ftp_user'];
$v_ftp_username_full = $user . '_' . $v_ftp_user_data['v_ftp_user'];
+ $v_ftp_user = escapeshellarg($v_ftp_user_data['v_ftp_user']);
if ($domain_added) {
- $v_ftp_path = trim($v_ftp_user_data['v_ftp_path']);
+ $v_ftp_path = escapeshellarg(trim($v_ftp_user_data['v_ftp_path']));
$v_ftp_password = tempnam("/tmp","vst");
$fp = fopen($v_ftp_password, "w");
fwrite($fp, $v_ftp_user_data['v_ftp_password']."\n");
fclose($fp);
- v_exec('v-add-web-domain-ftp', [$user, $v_domain, $v_ftp_username, $v_ftp_password, $v_ftp_path]);
+ exec (VESTA_CMD."v-add-web-domain-ftp ".$user." ".$v_domain." ".$v_ftp_username." ".$v_ftp_password . " " . $v_ftp_path, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
unlink($v_ftp_password);
if ((!empty($v_ftp_user_data['v_ftp_email'])) && (empty($_SESSION['error_msg']))) {
$to = $v_ftp_user_data['v_ftp_email'];
- $subject = __('FTP login credentials');
- $from = __('MAIL_FROM', $_POST['v_domain']);
- $mailtext = __('FTP_ACCOUNT_READY', $_POST['v_domain'], $user, $v_ftp_username, $v_ftp_user_data['v_ftp_password']);
+ $subject = __("FTP login credentials");
+ $from = __('MAIL_FROM',$_POST['v_domain']);
+ $mailtext = __('FTP_ACCOUNT_READY',$_POST['v_domain'],$user,$v_ftp_user_data['v_ftp_user'],$v_ftp_user_data['v_ftp_password']);
send_email($to, $subject, $mailtext, $from);
unset($v_ftp_email);
}
@@ -257,13 +289,13 @@ if (!empty($_POST['ok'])) {
}
if ($return_var == 0) {
- $v_ftp_password = '••••••••';
+ $v_ftp_password = "••••••••";
$v_ftp_user_data['is_new'] = 0;
} else {
$v_ftp_user_data['is_new'] = 1;
}
- $v_ftp_username = preg_replace("/^{$user}_/", '', $v_ftp_user_data['v_ftp_user']);
+ $v_ftp_username = preg_replace("/^".$user."_/", "", $v_ftp_user_data['v_ftp_user']);
$v_ftp_users_updated[] = array(
'is_new' => $v_ftp_user_data['is_new'],
'v_ftp_user' => $return_var == 0 ? $v_ftp_username_full : $v_ftp_username,
@@ -279,8 +311,8 @@ if (!empty($_POST['ok'])) {
if (!empty($_SESSION['error_msg']) && $domain_added) {
$_SESSION['ok_msg'] = __('WEB_DOMAIN_CREATED_OK',htmlentities($_POST[v_domain]),htmlentities($_POST[v_domain]));
$_SESSION['flash_error_msg'] = $_SESSION['error_msg'];
- $url = '/edit/web/?domain=' . strtolower(preg_replace('/^www\./i', '', $_POST['v_domain']));
- header("Location: $url");
+ $url = '/edit/web/?domain='.strtolower(preg_replace("/^www\./i", "", $_POST['v_domain']));
+ header('Location: ' . $url);
exit;
}
}
@@ -312,12 +344,14 @@ $v_ftp_user_prepath = $panel[$user]['HOME'] . "/web";
$v_ftp_email = $panel[$user]['CONTACT'];
// List IP addresses
-v_exec('v-list-user-ips', [$user, 'json'], false, $output);
-$ips = json_decode($output, true);
+exec (VESTA_CMD."v-list-user-ips ".$user." json", $output, $return_var);
+$ips = json_decode(implode('', $output), true);
+unset($output);
// List web stat engines
-v_exec('v-list-web-stats', ['json'], false, $output);
-$stats = json_decode($output, true);
+exec (VESTA_CMD."v-list-web-stats json", $output, $return_var);
+$stats = json_decode(implode('', $output), true);
+unset($output);
// Display body
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_web.html');
diff --git a/web/api/index.php b/web/api/index.php
index 928f950df..97f082594 100644
--- a/web/api/index.php
+++ b/web/api/index.php
@@ -2,6 +2,7 @@
define('VESTA_CMD', '/usr/bin/sudo /usr/local/vesta/bin/');
if (isset($_POST['user']) || isset($_POST['hash'])) {
+
// Authentication
$auth_code = 1;
if (empty($_POST['hash'])) {
@@ -11,18 +12,18 @@ if (isset($_POST['user']) || isset($_POST['hash'])) {
exit;
}
- $v_user = $_POST['user'];
+ $v_user = escapeshellarg($_POST['user']);
$v_password = tempnam("/tmp","vst");
$fp = fopen($v_password, "w");
fwrite($fp, $_POST['password']."\n");
fclose($fp);
- $v_ip_addr = $_SERVER['REMOTE_ADDR'];
- $auth_code = v_exec('v-check-user-password', [$v_user, $v_password, $v_ip_addr], false);
+ $v_ip_addr = escapeshellarg($_SERVER["REMOTE_ADDR"]);
+ exec(VESTA_CMD ."v-check-user-password ".$v_user." ".$v_password." '".$v_ip_addr."'", $output, $auth_code);
unlink($v_password);
} else {
$key = '/usr/local/vesta/data/keys/' . basename($_POST['hash']);
if (file_exists($key) && is_file($key)) {
- $auth_code = 0;
+ $auth_code = '0';
}
}
@@ -32,17 +33,37 @@ if (isset($_POST['user']) || isset($_POST['hash'])) {
}
// Prepare arguments
- $args = [];
- if (isset($_POST['cmd'])) $cmd = $_POST['cmd'];
- if (isset($_POST['arg1'])) $args[] = $_POST['arg1'];
- if (isset($_POST['arg2'])) $args[] = $_POST['arg2'];
- if (isset($_POST['arg3'])) $args[] = $_POST['arg3'];
- if (isset($_POST['arg4'])) $args[] = $_POST['arg4'];
- if (isset($_POST['arg5'])) $args[] = $_POST['arg5'];
- if (isset($_POST['arg6'])) $args[] = $_POST['arg6'];
- if (isset($_POST['arg7'])) $args[] = $_POST['arg7'];
- if (isset($_POST['arg8'])) $args[] = $_POST['arg8'];
- if (isset($_POST['arg9'])) $args[] = $_POST['arg9'];
+ if (isset($_POST['cmd'])) $cmd = escapeshellarg($_POST['cmd']);
+ if (isset($_POST['arg1'])) $arg1 = escapeshellarg($_POST['arg1']);
+ if (isset($_POST['arg2'])) $arg2 = escapeshellarg($_POST['arg2']);
+ if (isset($_POST['arg3'])) $arg3 = escapeshellarg($_POST['arg3']);
+ if (isset($_POST['arg4'])) $arg4 = escapeshellarg($_POST['arg4']);
+ if (isset($_POST['arg5'])) $arg5 = escapeshellarg($_POST['arg5']);
+ if (isset($_POST['arg6'])) $arg6 = escapeshellarg($_POST['arg6']);
+ if (isset($_POST['arg7'])) $arg7 = escapeshellarg($_POST['arg7']);
+ if (isset($_POST['arg8'])) $arg8 = escapeshellarg($_POST['arg8']);
+ if (isset($_POST['arg9'])) $arg9 = escapeshellarg($_POST['arg9']);
+
+ // Build query
+ $cmdquery = VESTA_CMD.$cmd." ";
+ if(!empty($arg1)){
+ $cmdquery = $cmdquery.$arg1." "; }
+ if(!empty($arg2)){
+ $cmdquery = $cmdquery.$arg2." "; }
+ if(!empty($arg3)){
+ $cmdquery = $cmdquery.$arg3." "; }
+ if(!empty($arg4)){
+ $cmdquery = $cmdquery.$arg4." "; }
+ if(!empty($arg5)){
+ $cmdquery = $cmdquery.$arg5." "; }
+ if(!empty($arg6)){
+ $cmdquery = $cmdquery.$arg6." "; }
+ if(!empty($arg7)){
+ $cmdquery = $cmdquery.$arg7." "; }
+ if(!empty($arg8)){
+ $cmdquery = $cmdquery.$arg8." "; }
+ if(!empty($arg9)){
+ $cmdquery = $cmdquery.$arg9; }
// Check command
if ($cmd == "'v-make-tmp-file'") {
@@ -53,7 +74,7 @@ if (isset($_POST['user']) || isset($_POST['hash'])) {
$return_var = 0;
} else {
// Run normal cmd query
- $return_var = v_exec($cmd, $args, false, $output);
+ exec ($cmdquery, $output, $return_var);
}
if ((!empty($_POST['returncode'])) && ($_POST['returncode'] == 'yes')) {
@@ -62,7 +83,7 @@ if (isset($_POST['user']) || isset($_POST['hash'])) {
if (($return_var == 0) && (empty($output))) {
echo "OK";
} else {
- echo $output . "\n";
+ echo implode("\n",$output)."\n";
}
}
}
diff --git a/web/bulk/backup/exclusions/index.php b/web/bulk/backup/exclusions/index.php
index 56e412617..4d0e43933 100644
--- a/web/bulk/backup/exclusions/index.php
+++ b/web/bulk/backup/exclusions/index.php
@@ -16,7 +16,8 @@ switch ($action) {
}
foreach ($backup as $value) {
- v_exec($cmd, [$user, $value], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
}
header("Location: /list/backup/exclusions");
diff --git a/web/bulk/backup/index.php b/web/bulk/backup/index.php
index 6c0095520..f191dfe2a 100644
--- a/web/bulk/backup/index.php
+++ b/web/bulk/backup/index.php
@@ -12,7 +12,7 @@ $action = $_POST['action'];
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
switch ($action) {
@@ -22,7 +22,8 @@ switch ($action) {
}
foreach ($backup as $value) {
- v_exec($cmd, [$user, $value], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
}
header("Location: /list/backup/");
diff --git a/web/bulk/cron/index.php b/web/bulk/cron/index.php
index 191ad3c83..0beb49083 100644
--- a/web/bulk/cron/index.php
+++ b/web/bulk/cron/index.php
@@ -9,7 +9,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
$job = $_POST['job'];
@@ -24,15 +24,19 @@ if ($_SESSION['user'] == 'admin') {
case 'unsuspend': $cmd='v-unsuspend-cron-job';
break;
case 'delete-cron-reports': $cmd='v-delete-cron-reports';
- v_exec($cmd, [$user], false);
+ exec (VESTA_CMD.$cmd." ".$user, $output, $return_var);
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully diabled');
+ unset($output);
header("Location: /list/cron/");
exit;
+ break;
case 'add-cron-reports': $cmd='v-add-cron-reports';
- v_exec($cmd, [$user], false);
+ exec (VESTA_CMD.$cmd." ".$user, $output, $return_var);
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully enabled');
+ unset($output);
header("Location: /list/cron/");
exit;
+ break;
default: header("Location: /list/cron/"); exit;
}
} else {
@@ -40,26 +44,31 @@ if ($_SESSION['user'] == 'admin') {
case 'delete': $cmd='v-delete-cron-job';
break;
case 'delete-cron-reports': $cmd='v-delete-cron-reports';
- v_exec($cmd, [$user], false);
+ exec (VESTA_CMD.$cmd." ".$user, $output, $return_var);
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully diabled');
+ unset($output);
header("Location: /list/cron/");
exit;
+ break;
case 'add-cron-reports': $cmd='v-add-cron-reports';
- v_exec($cmd, [$user], false);
+ exec (VESTA_CMD.$cmd." ".$user, $output, $return_var);
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully enabled');
+ unset($output);
header("Location: /list/cron/");
exit;
+ break;
default: header("Location: /list/cron/"); exit;
}
}
foreach ($job as $value) {
- v_exec($cmd, [$user, $value, 'no'], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$user." ".$value." no", $output, $return_var);
$restart = 'yes';
}
if (!empty($restart)) {
- v_exec('v-restart-cron', [], false);
+ exec (VESTA_CMD."v-restart-cron", $output, $return_var);
}
header("Location: /list/cron/");
diff --git a/web/bulk/db/index.php b/web/bulk/db/index.php
index c9e1f55a0..15361be4b 100644
--- a/web/bulk/db/index.php
+++ b/web/bulk/db/index.php
@@ -9,7 +9,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
$database = $_POST['database'];
@@ -34,7 +34,8 @@ if ($_SESSION['user'] == 'admin') {
}
foreach ($database as $value) {
- v_exec($cmd, [$user, $value], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
}
header("Location: /list/db/");
diff --git a/web/bulk/dns/index.php b/web/bulk/dns/index.php
index 81ba40bb4..d7fe0a292 100644
--- a/web/bulk/dns/index.php
+++ b/web/bulk/dns/index.php
@@ -9,7 +9,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
$domain = $_POST['domain'];
@@ -58,22 +58,25 @@ if ($_SESSION['user'] == 'admin') {
if (empty($record)) {
foreach ($domain as $value) {
// DNS
- v_exec($cmd, [$user, $value, 'no'], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$user." ".$value." no", $output, $return_var);
$restart = 'yes';
}
} else {
foreach ($record as $value) {
// DNS Record
- v_exec($cmd, [$user, $domain, $value, 'no'], false);
+ $value = escapeshellarg($value);
+ $dom = escapeshellarg($domain);
+ exec (VESTA_CMD.$cmd." ".$user." ".$dom." ".$value." no", $output, $return_var);
$restart = 'yes';
}
}
if (!empty($restart)) {
- v_exec('v-restart-dns', [], false);
+ exec (VESTA_CMD."v-restart-dns", $output, $return_var);
}
-if (empty($record)) {
+if (empty($record)) {
header("Location: /list/dns/");
exit;
} else {
diff --git a/web/bulk/firewall/banlist/index.php b/web/bulk/firewall/banlist/index.php
index b61652ee4..fe7308a53 100644
--- a/web/bulk/firewall/banlist/index.php
+++ b/web/bulk/firewall/banlist/index.php
@@ -10,7 +10,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check user
@@ -22,7 +22,10 @@ if ($_SESSION['user'] != 'admin') {
$ipchain = $_POST['ipchain'];
/*if (!empty($_POST['ipchain'])) {
$ipchain = $_POST['ipchain'];
- list($ip, $chain) = explode(':', $ipchain);
+ list($ip,$chain) = split(":",$ipchain);
+ $v_ip = escapeshellarg($ip);
+ $v_chain = escapeshellarg($chain);
+
}*/
$action = $_POST['action'];
@@ -34,8 +37,10 @@ switch ($action) {
}
foreach ($ipchain as $value) {
- list($ip, $chain) = explode(':', $value);
- v_exec($cmd, [$ip, $chain], false);
+ list($ip,$chain) = split(":",$value);
+ $v_ip = escapeshellarg($ip);
+ $v_chain = escapeshellarg($chain);
+ exec (VESTA_CMD.$cmd." ".$v_ip." ".$v_chain, $output, $return_var);
}
header("Location: /list/firewall/banlist");
diff --git a/web/bulk/firewall/index.php b/web/bulk/firewall/index.php
index 32c6b5e30..6f076cb81 100644
--- a/web/bulk/firewall/index.php
+++ b/web/bulk/firewall/index.php
@@ -10,7 +10,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Check user
@@ -34,7 +34,8 @@ switch ($action) {
}
foreach ($rule as $value) {
- v_exec($cmd, [$value], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
$restart = 'yes';
}
diff --git a/web/bulk/ip/index.php b/web/bulk/ip/index.php
index 5fd779ff1..4f1705403 100644
--- a/web/bulk/ip/index.php
+++ b/web/bulk/ip/index.php
@@ -9,7 +9,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
$ip = $_POST['ip'];
@@ -17,11 +17,11 @@ $action = $_POST['action'];
if ($_SESSION['user'] == 'admin') {
switch ($action) {
- case 'reread IP': $cmd = 'v-update-sys-ip';
- v_exec($cmd, [], false);
- header('Location: /list/ip/');
- exit;
- case 'delete': $cmd = 'v-delete-sys-ip';
+ case 'reread IP': exec(VESTA_CMD."v-update-sys-ip", $output, $return_var);
+ header("Location: /list/ip/");
+ exit;
+ break;
+ case 'delete': $cmd='v-delete-sys-ip';
break;
default: header("Location: /list/ip/"); exit;
}
@@ -31,7 +31,8 @@ if ($_SESSION['user'] == 'admin') {
}
foreach ($ip as $value) {
- v_exec($cmd, [$value], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
}
header("Location: /list/ip/");
diff --git a/web/bulk/mail/index.php b/web/bulk/mail/index.php
index 21cb0a6b5..c526c9e0e 100644
--- a/web/bulk/mail/index.php
+++ b/web/bulk/mail/index.php
@@ -9,7 +9,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
$domain = $_POST['domain'];
@@ -58,18 +58,21 @@ if ($_SESSION['user'] == 'admin') {
if (empty($account)) {
foreach ($domain as $value) {
// Mail
- v_exec($cmd, [$user, $value], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$user." ".$value, $output, $return_var);
$restart = 'yes';
}
} else {
foreach ($account as $value) {
// Mail Account
- v_exec($cmd, [$user, $domain, $value], false);
+ $value = escapeshellarg($value);
+ $dom = escapeshellarg($domain);
+ exec (VESTA_CMD.$cmd." ".$user." ".$dom." ".$value, $output, $return_var);
$restart = 'yes';
}
}
-if (empty($account)) {
+if (empty($account)) {
header("Location: /list/mail/");
exit;
} else {
diff --git a/web/bulk/package/index.php b/web/bulk/package/index.php
index 95eef7bb2..32e36e936 100644
--- a/web/bulk/package/index.php
+++ b/web/bulk/package/index.php
@@ -9,7 +9,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
$package = $_POST['package'];
@@ -27,7 +27,8 @@ if ($_SESSION['user'] == 'admin') {
}
foreach ($package as $value) {
- v_exec($cmd, [$value], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
$restart = 'yes';
}
diff --git a/web/bulk/restore/index.php b/web/bulk/restore/index.php
index c3dd7b360..3bc048414 100644
--- a/web/bulk/restore/index.php
+++ b/web/bulk/restore/index.php
@@ -9,11 +9,11 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
$action = $_POST['action'];
-$backup = $_POST['backup'];
+$backup = escapeshellarg($_POST['backup']);
$web = 'no';
$dns = 'no';
@@ -22,22 +22,25 @@ $db = 'no';
$cron = 'no';
$udir = 'no';
-if (!empty($_POST['web'])) $web = implode(',', $_POST['web']);
-if (!empty($_POST['dns'])) $dns = implode(',', $_POST['dns']);
-if (!empty($_POST['mail'])) $mail = implode(',', $_POST['mail']);
-if (!empty($_POST['db'])) $db = implode(',', $_POST['db']);
+if (!empty($_POST['web'])) $web = escapeshellarg(implode(",",$_POST['web']));
+if (!empty($_POST['dns'])) $dns = escapeshellarg(implode(",",$_POST['dns']));
+if (!empty($_POST['mail'])) $mail = escapeshellarg(implode(",",$_POST['mail']));
+if (!empty($_POST['db'])) $db = escapeshellarg(implode(",",$_POST['db']));
if (!empty($_POST['cron'])) $cron = 'yes';
-if (!empty($_POST['udir'])) $udir = implode(',', $_POST['udir']);
+if (!empty($_POST['udir'])) $udir = escapeshellarg(implode(",",$_POST['udir']));
if ($action == 'restore') {
- $return_var = v_exec('v-schedule-user-restore', [$user, $backup, $web, $dns, $mail, $db, $cron, $udir]);
- switch ($return_var) {
- case 0:
- $_SESSION['error_msg'] = __('RESTORE_SCHEDULED');
- break;
- case 4:
+ exec (VESTA_CMD."v-schedule-user-restore ".$user." ".$backup." ".$web." ".$dns." ".$mail." ".$db." ".$cron." ".$udir, $output, $return_var);
+ if ($return_var == 0) {
+ $_SESSION['error_msg'] = __('RESTORE_SCHEDULED');
+ } else {
+ $_SESSION['error_msg'] = implode('
', $output);
+ if (empty($_SESSION['error_msg'])) {
+ $_SESSION['error_msg'] = __('Error: vesta did not return any output.');
+ }
+ if ($return_var == 4) {
$_SESSION['error_msg'] = __('RESTORE_EXISTS');
- break;
+ }
}
}
diff --git a/web/bulk/service/index.php b/web/bulk/service/index.php
index 8ed4fca23..70ce660c7 100644
--- a/web/bulk/service/index.php
+++ b/web/bulk/service/index.php
@@ -9,7 +9,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
$service = $_POST['service'];
@@ -27,14 +27,16 @@ if ($_SESSION['user'] == 'admin') {
}
if ((!empty($_POST['system'])) && ($action == 'restart')) {
- v_exec('v-restart-system', ['yes'], false);
+ exec (VESTA_CMD."v-restart-system yes", $output, $return_var);
$_SESSION['error_srv'] = 'The system is going down for reboot NOW!';
+ unset($output);
header("Location: /list/server/");
exit;
}
foreach ($service as $value) {
- v_exec($cmd, [$value], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
}
}
diff --git a/web/bulk/user/index.php b/web/bulk/user/index.php
index 28c9459e1..5d42fbfd9 100644
--- a/web/bulk/user/index.php
+++ b/web/bulk/user/index.php
@@ -9,7 +9,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
$user = $_POST['user'];
@@ -48,14 +48,15 @@ if ($_SESSION['user'] == 'admin') {
}
foreach ($user as $value) {
- v_exec($cmd, [$value, $restart], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$value." ".$restart, $output, $return_var);
$changes = 'yes';
}
if ((!empty($restart)) && (!empty($changes))) {
- v_exec('v-restart-web', [], false);
- v_exec('v-restart-dns', [], false);
- v_exec('v-restart-cron', [], false);
+ exec (VESTA_CMD."v-restart-web", $output, $return_var);
+ exec (VESTA_CMD."v-restart-dns", $output, $return_var);
+ exec (VESTA_CMD."v-restart-cron", $output, $return_var);
}
header("Location: /list/user/");
diff --git a/web/bulk/vesta/index.php b/web/bulk/vesta/index.php
index 3ab537485..c909f83e3 100644
--- a/web/bulk/vesta/index.php
+++ b/web/bulk/vesta/index.php
@@ -9,7 +9,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
@@ -23,7 +23,8 @@ if ($_SESSION['user'] == 'admin') {
default: header("Location: /list/updates/"); exit;
}
foreach ($pkg as $value) {
- v_exec($cmd, [$value], false);
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$value, $output, $return_var);
}
}
diff --git a/web/bulk/web/index.php b/web/bulk/web/index.php
index 1b7673b41..4a661a1ff 100644
--- a/web/bulk/web/index.php
+++ b/web/bulk/web/index.php
@@ -9,7 +9,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
$domain = $_POST['domain'];
@@ -34,14 +34,15 @@ if ($_SESSION['user'] == 'admin') {
}
foreach ($domain as $value) {
- v_exec($cmd, [$user, $value, 'no'], false);
- $restart = 'yes';
+ $value = escapeshellarg($value);
+ exec (VESTA_CMD.$cmd." ".$user." ".$value." no", $output, $return_var);
+ $restart='yes';
}
if (isset($restart)) {
- v_exec('v-restart-web', [], false);
- v_exec('v-restart-proxy', [], false);
- v_exec('v-restart-dns', [], false);
+ exec (VESTA_CMD."v-restart-web", $output, $return_var);
+ exec (VESTA_CMD."v-restart-proxy", $output, $return_var);
+ exec (VESTA_CMD."v-restart-dns", $output, $return_var);
}
header("Location: /list/web/");
diff --git a/web/delete/backup/exclusion/index.php b/web/delete/backup/exclusion/index.php
index 5e3d9cf30..29ad3bd58 100644
--- a/web/delete/backup/exclusion/index.php
+++ b/web/delete/backup/exclusion/index.php
@@ -6,17 +6,20 @@ session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
- $user = $_GET['user'];
+ $user=$_GET['user'];
}
if (!empty($_GET['system'])) {
- $v_system = $_GET['system'];
- v_exec('v-delete-user-backup-exclusions', [$user, $v_system]);
+ $v_username = escapeshellarg($user);
+ $v_system = escapeshellarg($_GET['system']);
+ exec (VESTA_CMD."v-delete-user-backup-exclusions ".$v_username." ".$v_system, $output, $return_var);
}
+check_return_code($return_var,$output);
+unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/delete/backup/index.php b/web/delete/backup/index.php
index 9546a3361..33f492268 100644
--- a/web/delete/backup/index.php
+++ b/web/delete/backup/index.php
@@ -6,23 +6,26 @@ session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
- $user = $_GET['user'];
+ $user=$_GET['user'];
}
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
if (!empty($_GET['backup'])) {
- $v_backup = $_GET['backup'];
- v_exec('v-delete-user-backup', [$user, $v_backup]);
+ $v_username = escapeshellarg($user);
+ $v_backup = escapeshellarg($_GET['backup']);
+ exec (VESTA_CMD."v-delete-user-backup ".$v_username." ".$v_backup, $output, $return_var);
}
+check_return_code($return_var,$output);
+unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/delete/cron/autoupdate/index.php b/web/delete/cron/autoupdate/index.php
index 11ea356cb..ad670ef03 100644
--- a/web/delete/cron/autoupdate/index.php
+++ b/web/delete/cron/autoupdate/index.php
@@ -6,8 +6,9 @@ session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
if ($_SESSION['user'] == 'admin') {
- v_exec('v-delete-cron-vesta-autoupdate', [], false);
+ exec (VESTA_CMD."v-delete-cron-vesta-autoupdate", $output, $return_var);
$_SESSION['error_msg'] = __('Autoupdate has been successfully disabled');
+ unset($output);
}
header("Location: /list/updates/");
diff --git a/web/delete/cron/index.php b/web/delete/cron/index.php
index eff4ca06c..d4ca20263 100644
--- a/web/delete/cron/index.php
+++ b/web/delete/cron/index.php
@@ -6,23 +6,26 @@ session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
- $user = $_GET['user'];
+ $user=$_GET['user'];
}
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
if (!empty($_GET['job'])) {
- $v_job = $_GET['job'];
- v_exec('v-delete-cron-job', [$user, $v_job]);
+ $v_username = escapeshellarg($user);
+ $v_job = escapeshellarg($_GET['job']);
+ exec (VESTA_CMD."v-delete-cron-job ".$v_username." ".$v_job, $output, $return_var);
}
+check_return_code($return_var,$output);
+unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/delete/cron/reports/index.php b/web/delete/cron/reports/index.php
index 1025f70e6..af7df20f2 100644
--- a/web/delete/cron/reports/index.php
+++ b/web/delete/cron/reports/index.php
@@ -5,8 +5,9 @@ ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
-v_exec('v-delete-cron-reports', [$user], false);
+exec (VESTA_CMD."v-delete-cron-reports ".$user, $output, $return_var);
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully disabled');
+unset($output);
header("Location: /list/cron/");
exit;
diff --git a/web/delete/db/index.php b/web/delete/db/index.php
index fa3f50460..f2088ad2b 100644
--- a/web/delete/db/index.php
+++ b/web/delete/db/index.php
@@ -6,23 +6,26 @@ session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
- $user = $_GET['user'];
+ $user=$_GET['user'];
}
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
if (!empty($_GET['database'])) {
- $v_database = $_GET['database'];
- v_exec('v-delete-database', [$user, $v_database]);
+ $v_username = escapeshellarg($user);
+ $v_database = escapeshellarg($_GET['database']);
+ exec (VESTA_CMD."v-delete-database ".$v_username." ".$v_database, $output, $return_var);
}
+check_return_code($return_var,$output);
+unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/delete/dns/index.php b/web/delete/dns/index.php
index b89f52735..7069d0c89 100644
--- a/web/delete/dns/index.php
+++ b/web/delete/dns/index.php
@@ -7,23 +7,26 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Delete as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
- $user = $_GET['user'];
+ $user=$_GET['user'];
}
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// DNS domain
if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
- $v_domain = $_GET['domain'];
- v_exec('v-delete-dns-domain', [$user, $v_domain]);
+ $v_username = escapeshellarg($user);
+ $v_domain = escapeshellarg($_GET['domain']);
+ exec (VESTA_CMD."v-delete-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
header("Location: /list/dns/");
@@ -32,13 +35,15 @@ if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
// DNS record
if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
- $v_domain = $_GET['domain'];
- $v_record_id = $_GET['record_id'];
- v_exec('v-delete-dns-record', [$user, $v_domain, $v_record_id]);
-
+ $v_username = escapeshellarg($user);
+ $v_domain = escapeshellarg($_GET['domain']);
+ $v_record_id = escapeshellarg($_GET['record_id']);
+ exec (VESTA_CMD."v-delete-dns-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
header("Location: /list/dns/?domain=".$_GET['domain']);
@@ -47,7 +52,7 @@ if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/delete/favorite/index.php b/web/delete/favorite/index.php
index 059e8a1e6..9f471b9bd 100644
--- a/web/delete/favorite/index.php
+++ b/web/delete/favorite/index.php
@@ -5,10 +5,11 @@
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
- $v_section = $_REQUEST['v_section'];
- $v_unit_id = $_REQUEST['v_unit_id'];
+ unset($_SESSION['favourites'][strtoupper($_REQUEST['v_section'])][$_REQUEST['v_unit_id']]);
- unset($_SESSION['favourites'][strtoupper((string)$v_section)][(string)$v_unit_id]);
+ $v_section = escapeshellarg($_REQUEST['v_section']);
+ $v_unit_id = escapeshellarg($_REQUEST['v_unit_id']);
- v_exec('v-delete-user-favourites', [$_SESSION['user'], $v_section, $v_unit_id], false/*true*/);
+ exec (VESTA_CMD."v-delete-user-favourites ".$_SESSION['user']." ".$v_section." ".$v_unit_id, $output, $return_var);
+// check_return_code($return_var,$output);
?>
\ No newline at end of file
diff --git a/web/delete/firewall/banlist/index.php b/web/delete/firewall/banlist/index.php
index c45c81d1b..7b30edd59 100644
--- a/web/delete/firewall/banlist/index.php
+++ b/web/delete/firewall/banlist/index.php
@@ -16,18 +16,20 @@ if ($_SESSION['user'] != 'admin') {
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
if ((!empty($_GET['ip'])) && (!empty($_GET['chain']))) {
- $v_ip = $_GET['ip'];
- $v_chain = $_GET['chain'];
- v_exec('v-delete-firewall-ban', [$v_ip, $v_chain]);
+ $v_ip = escapeshellarg($_GET['ip']);
+ $v_chain = escapeshellarg($_GET['chain']);
+ exec (VESTA_CMD."v-delete-firewall-ban ".$v_ip." ".$v_chain, $output, $return_var);
}
+check_return_code($return_var,$output);
+unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/delete/firewall/index.php b/web/delete/firewall/index.php
index ef0211554..b6b38f0c6 100644
--- a/web/delete/firewall/index.php
+++ b/web/delete/firewall/index.php
@@ -16,17 +16,19 @@ if ($_SESSION['user'] != 'admin') {
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
if (!empty($_GET['rule'])) {
- $v_rule = $_GET['rule'];
- v_exec('v-delete-firewall-rule', [$v_rule]);
+ $v_rule = escapeshellarg($_GET['rule']);
+ exec (VESTA_CMD."v-delete-firewall-rule ".$v_rule, $output, $return_var);
}
+check_return_code($return_var,$output);
+unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/delete/ip/index.php b/web/delete/ip/index.php
index b45ef15a8..f8bcd994d 100644
--- a/web/delete/ip/index.php
+++ b/web/delete/ip/index.php
@@ -8,19 +8,22 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
if ($_SESSION['user'] == 'admin') {
if (!empty($_GET['ip'])) {
- $v_ip = $_GET['ip'];
- v_exec('v-delete-sys-ip', [$v_ip]);
+ $v_ip = escapeshellarg($_GET['ip']);
+ exec (VESTA_CMD."v-delete-sys-ip ".$v_ip, $output, $return_var);
}
+ check_return_code($return_var,$output);
+ unset($output);
+
}
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/delete/mail/index.php b/web/delete/mail/index.php
index 1446ac349..8a3d87f82 100644
--- a/web/delete/mail/index.php
+++ b/web/delete/mail/index.php
@@ -7,22 +7,25 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Delete as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
- $user = $_GET['user'];
+ $user=$_GET['user'];
}
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Mail domain
if ((!empty($_GET['domain'])) && (empty($_GET['account']))) {
- $v_domain = $_GET['domain'];
- v_exec('v-delete-mail-domain', [$user, $v_domain]);
+ $v_username = escapeshellarg($user);
+ $v_domain = escapeshellarg($_GET['domain']);
+ exec (VESTA_CMD."v-delete-mail-domain ".$v_username." ".$v_domain, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
header("Location: /list/mail/");
@@ -31,12 +34,15 @@ if ((!empty($_GET['domain'])) && (empty($_GET['account']))) {
// Mail account
if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) {
- $v_domain = $_GET['domain'];
- $v_account = $_GET['account'];
- v_exec('v-delete-mail-account', [$user, $v_domain, $v_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);
+ check_return_code($return_var,$output);
+ unset($output);
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
header("Location: /list/mail/?domain=".$_GET['domain']);
@@ -45,7 +51,7 @@ if ((!empty($_GET['domain'])) && (!empty($_GET['account']))) {
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/delete/notification/index.php b/web/delete/notification/index.php
index 982a37132..fa3a14f10 100644
--- a/web/delete/notification/index.php
+++ b/web/delete/notification/index.php
@@ -8,17 +8,23 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
if($_GET['delete'] == 1){
- $v_id = (string)((int)$_GET['notification_id']);
- v_exec('v-delete-user-notification', [$user, $v_id]);
+ $v_username = escapeshellarg($user);
+ $v_id = escapeshellarg((int)$_GET['notification_id']);
+ exec (VESTA_CMD."v-delete-user-notification ".$v_username." ".$v_id, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
} else {
- $v_id = (string)((int)$_GET['notification_id']);
- //echo VESTA_CMD."v-acknowledge-user-notification ".$v_username." ".$v_id;
- v_exec('v-acknowledge-user-notification', [$user, $v_id]);
+ $v_username = escapeshellarg($user);
+ $v_id = escapeshellarg((int)$_GET['notification_id']);
+ echo VESTA_CMD."v-acknowledge-user-notification ".$v_username." ".$v_id;
+ exec (VESTA_CMD."v-acknowledge-user-notification ".$v_username." ".$v_id, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
exit;
diff --git a/web/delete/package/index.php b/web/delete/package/index.php
index 78f45000a..1058f495d 100644
--- a/web/delete/package/index.php
+++ b/web/delete/package/index.php
@@ -8,19 +8,21 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
if ($_SESSION['user'] == 'admin') {
if (!empty($_GET['package'])) {
- $v_package = $_GET['package'];
- v_exec('v-delete-user-package', [$v_package]);
+ $v_package = escapeshellarg($_GET['package']);
+ exec (VESTA_CMD."v-delete-user-package ".$v_package, $output, $return_var);
}
+ check_return_code($return_var,$output);
+ unset($output);
}
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/delete/user/index.php b/web/delete/user/index.php
index cdd19a669..8e20b4c63 100644
--- a/web/delete/user/index.php
+++ b/web/delete/user/index.php
@@ -8,20 +8,22 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
if ($_SESSION['user'] == 'admin') {
if (!empty($_GET['user'])) {
- $v_username = $_GET['user'];
- v_exec('v-delete-user', [$v_username]);
+ $v_username = escapeshellarg($_GET['user']);
+ exec (VESTA_CMD."v-delete-user ".$v_username, $output, $return_var);
}
+ check_return_code($return_var,$output);
unset($_SESSION['look']);
+ unset($output);
}
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/delete/web/index.php b/web/delete/web/index.php
index 199a89523..ecf6f415c 100644
--- a/web/delete/web/index.php
+++ b/web/delete/web/index.php
@@ -8,22 +8,25 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Delete as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
- $user = $_GET['user'];
+ $user=$_GET['user'];
}
if (!empty($_GET['domain'])) {
- $v_domain = $_GET['domain'];
- v_exec('v-delete-domain', [$user, $v_domain]);
+ $v_username = escapeshellarg($user);
+ $v_domain = escapeshellarg($_GET['domain']);
+ exec (VESTA_CMD."v-delete-domain ".$v_username." ".$v_domain, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
$back = $_SESSION['back'];
if (!empty($back)) {
- header("Location: $back");
+ header("Location: ".$back);
exit;
}
diff --git a/web/download/file/index.php b/web/download/file/index.php
index 662387e14..5322185b1 100644
--- a/web/download/file/index.php
+++ b/web/download/file/index.php
@@ -8,7 +8,7 @@ if ((!isset($_SESSION['FILEMANAGER_KEY'])) || (empty($_SESSION['FILEMANAGER_KEY'
$user = $_SESSION['user'];
if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {
- $user = $_SESSION['look'];
+ $user=$_SESSION['look'];
}
if (!empty($_REQUEST['path'])) {
@@ -16,10 +16,10 @@ if (!empty($_REQUEST['path'])) {
header("Content-type: application/octet-stream");
header("Content-Transfer-Encoding: binary");
header("Content-disposition: attachment;filename=".basename($path));
- // TODO: Implement `v_passthru`?
- passthru(VESTA_CMD.'v-open-fs-file '.build_shell_args([$user, $path]));
+ passthru (VESTA_CMD . "v-open-fs-file " . $user . " " . escapeshellarg($path));
exit;
-} else {
+}
+else {
die('File not found');
}
diff --git a/web/download/web-log/index.php b/web/download/web-log/index.php
index 8ebbc9dbb..79b5601cd 100644
--- a/web/download/web-log/index.php
+++ b/web/download/web-log/index.php
@@ -3,20 +3,26 @@
error_reporting(NULL);
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
-
$v_domain = $_GET['domain'];
+$v_domain = escapeshellarg($_GET['domain']);
if ($_GET['type'] == 'access') $type = 'access';
if ($_GET['type'] == 'error') $type = 'error';
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=".$_GET['domain'].".".$type."-log.txt");
-header("Content-Type: application/octet-stream");
+header("Content-Type: application/octet-stream; ");
header("Content-Transfer-Encoding: binary");
-$return_var = v_exec("v-list-web-domain-{$type}log", [$user, $v_domain, '5000'], false, $output);
-if ($return_var == 0) {
- echo $output . "\n";
+$v_domain = escapeshellarg($_GET['domain']);
+if ($_GET['type'] == 'access') $type = 'access';
+if ($_GET['type'] == 'error') $type = 'error';
+
+exec (VESTA_CMD."v-list-web-domain-".$type."log $user ".$v_domain." 5000", $output, $return_var);
+if ($return_var == 0 ) {
+ foreach($output as $file) {
+ echo $file . "\n";
+ }
}
?>
diff --git a/web/edit/backup/exclusions/index.php b/web/edit/backup/exclusions/index.php
index 75a2bf78a..8bac32c16 100644
--- a/web/edit/backup/exclusions/index.php
+++ b/web/edit/backup/exclusions/index.php
@@ -9,12 +9,14 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Edit as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
- $user = $_GET['user'];
+ $user=escapeshellarg($_GET['user']);
}
// List backup exclustions
-v_exec('v-list-user-backup-exclusions', [$user, 'json'], true, $output);
-$data = json_decode($output, true);
+exec (VESTA_CMD."v-list-user-backup-exclusions ".$user." 'json'", $output, $return_var);
+check_return_code($return_var,$output);
+$data = json_decode(implode('', $output), true);
+unset($output);
// Parse web
$v_username = $user;
@@ -68,10 +70,9 @@ if (!empty($_POST['save'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
- // TODO: Use array?
$v_web = $_POST['v_web'];
$v_web_tmp = str_replace("\r\n", ",", $_POST['v_web']);
$v_web_tmp = rtrim($v_web_tmp, ",");
@@ -111,7 +112,9 @@ if (!empty($_POST['save'])) {
unset($mktemp_output);
// Save changes
- v_exec('v-update-user-backup-exclusions', [$user, $tmp]);
+ exec (VESTA_CMD."v-update-user-backup-exclusions ".$user." ".$tmp, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
// Set success message
if (empty($_SESSION['error_msg'])) {
diff --git a/web/edit/cron/index.php b/web/edit/cron/index.php
index 557ea8b03..d78b4eb6e 100644
--- a/web/edit/cron/index.php
+++ b/web/edit/cron/index.php
@@ -9,7 +9,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Edit as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
- $user = $_GET['user'];
+ $user=escapeshellarg($_GET['user']);
}
// Check job id
@@ -18,14 +18,16 @@ if (empty($_GET['job'])) {
exit;
}
-$v_username = $user;
-$v_job = $_GET['job'];
-
// List cron job
-v_exec('v-list-cron-job', [$user, $v_job, 'json'], true, $output);
-$data = json_decode($output, true);
+$v_job = escapeshellarg($_GET['job']);
+exec (VESTA_CMD."v-list-cron-job ".$user." ".$v_job." 'json'", $output, $return_var);
+check_return_code($return_var,$output);
+$data = json_decode(implode('', $output), true);
+unset($output);
// Parse cron job
+$v_username = $user;
+$v_job = $_GET['job'];
$v_min = $data[$v_job]['MIN'];
$v_hour = $data[$v_job]['HOUR'];
$v_day = $data[$v_job]['DAY'];
@@ -35,25 +37,35 @@ $v_cmd = $data[$v_job]['CMD'];
$v_date = $data[$v_job]['DATE'];
$v_time = $data[$v_job]['TIME'];
$v_suspended = $data[$v_job]['SUSPENDED'];
-$v_status = $v_suspended == 'yes' ? 'suspended' : 'active';
+if ( $v_suspended == 'yes' ) {
+ $v_status = 'suspended';
+} else {
+ $v_status = 'active';
+}
// Check POST request
if (!empty($_POST['save'])) {
+
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
- $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'];
+ $v_username = $user;
+ $v_min = escapeshellarg($_POST['v_min']);
+ $v_hour = escapeshellarg($_POST['v_hour']);
+ $v_day = escapeshellarg($_POST['v_day']);
+ $v_month = escapeshellarg($_POST['v_month']);
+ $v_wday = escapeshellarg($_POST['v_wday']);
+ $v_cmd = escapeshellarg($_POST['v_cmd']);
// Save changes
- v_exec('v-change-cron-job', [$v_username, $v_job, $v_min, $v_hour, $v_day, $v_month, $v_wday, $v_cmd]);
+ exec (VESTA_CMD."v-change-cron-job ".$v_username." ".$v_job." ".$v_min." ".$v_hour." ".$v_day." ".$v_month." ".$v_wday." ".$v_cmd, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
+
+ $v_cmd = $_POST['v_cmd'];
// Set success message
if (empty($_SESSION['error_msg'])) {
diff --git a/web/edit/db/index.php b/web/edit/db/index.php
index 4a2377d10..29d358f80 100644
--- a/web/edit/db/index.php
+++ b/web/edit/db/index.php
@@ -21,40 +21,51 @@ if (empty($_GET['database'])) {
// Edit as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
- $user = $_GET['user'];
+ $user=escapeshellarg($_GET['user']);
}
-$v_username = $user;
-$v_database = $_GET['database'];
-
// List datbase
-v_exec('v-list-database', [$user, $v_database, 'json'], true, $output);
-$data = json_decode($output, true);
+$v_database = escapeshellarg($_GET['database']);
+exec (VESTA_CMD."v-list-database ".$user." ".$v_database." 'json'", $output, $return_var);
+check_return_code($return_var,$output);
+$data = json_decode(implode('', $output), true);
+unset($output);
// Parse database
+$v_username = $user;
+$v_database = $_GET['database'];
$v_dbuser = $data[$v_database]['DBUSER'];
-$v_password = '';
+$v_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'];
-$v_status = $v_suspended == 'yes' ? 'suspended' : 'active';
+if ( $v_suspended == 'yes' ) {
+ $v_status = 'suspended';
+} else {
+ $v_status = 'active';
+}
// Check POST request
if (!empty($_POST['save'])) {
+ $v_username = $user;
+
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Change database user
if (($v_dbuser != $_POST['v_dbuser']) && (empty($_SESSION['error_msg']))) {
$v_dbuser = preg_replace("/^".$user."_/", "", $_POST['v_dbuser']);
- v_exec('v-change-database-user', [$v_username, $v_database, $v_dbuser]);
- $v_dbuser = $user . '_' . $v_dbuser;
+ $v_dbuser = escapeshellarg($v_dbuser);
+ exec (VESTA_CMD."v-change-database-user ".$v_username." ".$v_database." ".$v_dbuser, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
+ $v_dbuser = $user."_".preg_replace("/^".$user."_/", "", $_POST['v_dbuser']);
}
// Change database password
@@ -63,9 +74,11 @@ if (!empty($_POST['save'])) {
$fp = fopen($v_password, "w");
fwrite($fp, $_POST['v_password']."\n");
fclose($fp);
- v_exec('v-change-database-password', [$v_username, $v_database, $v_password]);
+ exec (VESTA_CMD."v-change-database-password ".$v_username." ".$v_database." ".$v_password, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
unlink($v_password);
- $v_password = $_POST['v_password'];
+ $v_password = escapeshellarg($_POST['v_password']);
}
// Set success message
diff --git a/web/edit/dns/index.php b/web/edit/dns/index.php
index f9c2a6111..6ceac64a5 100644
--- a/web/edit/dns/index.php
+++ b/web/edit/dns/index.php
@@ -15,18 +15,20 @@ if (empty($_GET['domain'])) {
// Edit as someone else?
if (($_SESSION['user'] == 'admin') && (!empty($_GET['user']))) {
- $user = $_GET['user'];
+ $user=escapeshellarg($_GET['user']);
}
-$v_username = $user;
// List dns domain
if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
- $v_domain = $_GET['domain'];
-
- v_exec('v-list-dns-domain', [$user, $v_domain, 'json'], true, $output);
- $data = json_decode($output, true);
+ $v_domain = escapeshellarg($_GET['domain']);
+ exec (VESTA_CMD."v-list-dns-domain ".$user." ".$v_domain." json", $output, $return_var);
+ check_return_code($return_var,$output);
+ $data = json_decode(implode('', $output), true);
+ unset($output);
// Parse dns domain
+ $v_username = $user;
+ $v_domain = $_GET['domain'];
$v_ip = $data[$v_domain]['IP'];
$v_template = $data[$v_domain]['TPL'];
$v_ttl = $data[$v_domain]['TTL'];
@@ -42,19 +44,24 @@ if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
}
// List dns templates
- v_exec('v-list-dns-templates', ['json'], false, $output);
- $templates = json_decode($output, true);
+ exec (VESTA_CMD."v-list-dns-templates json", $output, $return_var);
+ $templates = json_decode(implode('', $output), true);
+ unset($output);
}
// List dns record
if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
- $v_domain = $_GET['domain'];
- $v_record_id = $_GET['record_id'];
-
- v_exec('v-list-dns-records', [$user, $v_domain, 'json'], true, $output);
- $data = json_decode($output, true);
+ $v_domain = escapeshellarg($_GET['domain']);
+ $v_record_id = escapeshellarg($_GET['record_id']);
+ exec (VESTA_CMD."v-list-dns-records ".$user." ".$v_domain." 'json'", $output, $return_var);
+ check_return_code($return_var,$output);
+ $data = json_decode(implode('', $output), true);
+ unset($output);
// Parse dns record
+ $v_username = $user;
+ $v_domain = $_GET['domain'];
+ $v_record_id = $_GET['record_id'];
$v_rec = $data[$v_record_id]['RECORD'];
$v_type = $data[$v_record_id]['TYPE'];
$v_val = $data[$v_record_id]['VALUE'];
@@ -71,51 +78,63 @@ if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
// Check POST request for dns domain
if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
- $v_domain = $_POST['v_domain'];
+ $v_domain = escapeshellarg($_POST['v_domain']);
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
// Change domain IP
if (($v_ip != $_POST['v_ip']) && (empty($_SESSION['error_msg']))) {
- $v_ip = $_POST['v_ip'];
- v_exec('v-change-dns-domain-ip', [$v_username, $v_domain, $v_ip, 'no']);
+ $v_ip = escapeshellarg($_POST['v_ip']);
+ exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var);
+ check_return_code($return_var,$output);
$restart_dns = 'yes';
+ unset($output);
}
// Change domain template
if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
- $v_template = $_POST['v_template'];
- v_exec('v-change-dns-domain-tpl', [$v_username, $v_domain, $v_template, 'no']);
+ $v_template = escapeshellarg($_POST['v_template']);
+ exec (VESTA_CMD."v-change-dns-domain-tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
$restart_dns = 'yes';
}
// Change SOA record
if (($v_soa != $_POST['v_soa']) && (empty($_SESSION['error_msg']))) {
- $v_soa = $_POST['v_soa'];
- v_exec('v-change-dns-domain-soa', [$v_username, $v_domain, $v_soa, 'no']);
+ $v_soa = escapeshellarg($_POST['v_soa']);
+ exec (VESTA_CMD."v-change-dns-domain-soa ".$v_username." ".$v_domain." ".$v_soa." 'no'", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
$restart_dns = 'yes';
}
// Change expiriation date
if (($v_exp != $_POST['v_exp']) && (empty($_SESSION['error_msg']))) {
- $v_exp = $_POST['v_exp'];
- v_exec('v-change-dns-domain-exp', [$v_username, $v_domain, $v_exp, 'no']);
+ $v_exp = escapeshellarg($_POST['v_exp']);
+ exec (VESTA_CMD."v-change-dns-domain-exp ".$v_username." ".$v_domain." ".$v_exp." 'no'", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Change domain ttl
if (($v_ttl != $_POST['v_ttl']) && (empty($_SESSION['error_msg']))) {
- $v_ttl = $_POST['v_ttl'];
- v_exec('v-change-dns-domain-ttl', [$v_username, $v_domain, $v_ttl, 'no']);
+ $v_ttl = escapeshellarg($_POST['v_ttl']);
+ exec (VESTA_CMD."v-change-dns-domain-ttl ".$v_username." ".$v_domain." ".$v_ttl." 'no'", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
$restart_dns = 'yes';
}
// Restart dns server
if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) {
- v_exec('v-restart-dns');
+ exec (VESTA_CMD."v-restart-dns", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Set success message
@@ -130,30 +149,38 @@ if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (!empty($_GET['reco
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
- exit;
+ exit();
}
- $v_domain = $_POST['v_domain'];
- $v_record_id = $_POST['v_record_id'];
+ // Protect input
+ $v_domain = escapeshellarg($_POST['v_domain']);
+ $v_record_id = escapeshellarg($_POST['v_record_id']);
// Change dns record
if (($v_val != $_POST['v_val']) || ($v_priority != $_POST['v_priority']) && (empty($_SESSION['error_msg']))) {
+ $v_val = escapeshellarg($_POST['v_val']);
+ $v_priority = escapeshellarg($_POST['v_priority']);
+ exec (VESTA_CMD."v-change-dns-record ".$v_username." ".$v_domain." ".$v_record_id." ".$v_val." ".$v_priority, $output, $return_var);
+ check_return_code($return_var,$output);
$v_val = $_POST['v_val'];
- $v_priority = $_POST['v_priority'];
- v_exec('v-change-dns-record', [$v_username, $v_domain, $v_record_id, $v_val, $v_priority]);
+ unset($output);
$restart_dns = 'yes';
}
// Change dns record id
if (($_GET['record_id'] != $_POST['v_record_id']) && (empty($_SESSION['error_msg']))) {
- $v_old_record_id = $_GET['record_id'];
- v_exec('v-change-dns-record-id', [$v_username, $v_domain, $v_old_record_id, $v_record_id]);
+ $v_old_record_id = escapeshellarg($_GET['record_id']);
+ exec (VESTA_CMD."v-change-dns-record-id ".$v_username." ".$v_domain." ".$v_old_record_id." ".$v_record_id, $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
$restart_dns = 'yes';
}
// Restart dns server
if (!empty($restart_dns) && (empty($_SESSION['error_msg']))) {
- v_exec('v-restart-dns');
+ exec (VESTA_CMD."v-restart-dns", $output, $return_var);
+ check_return_code($return_var,$output);
+ unset($output);
}
// Set success message
diff --git a/web/edit/file/index.php b/web/edit/file/index.php
index f26c2d3c8..6f7474c94 100644
--- a/web/edit/file/index.php
+++ b/web/edit/file/index.php
@@ -31,22 +31,24 @@ if (($_SESSION['user'] == 'admin') && (!empty($_SESSION['look']))) {