i18n + service manager + web updater

This commit is contained in:
Serghey Rodin 2013-01-29 00:18:09 +02:00
commit 6e631c32a1
84 changed files with 1806 additions and 1458 deletions

View file

@ -34,7 +34,7 @@ $v_domain = escapeshellarg($_GET['domain']);
exec (VESTA_CMD."v-list-web-domain ".$user." ".$v_domain." json", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
} else {
$data = json_decode(implode('', $output), true);
@ -99,7 +99,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-change-web-domain-ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
$restart_web = 'yes';
@ -109,7 +109,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." ".$v_domain." ".$v_ip." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
$restart_dns = 'yes';
@ -121,7 +121,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-change-dns-domain-ip ".$v_username." '".$v_alias."' ".$v_ip, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
$restart_dns = 'yes';
@ -136,7 +136,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-change-web-domain-tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -159,7 +159,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-delete-web-domain-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -168,7 +168,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-delete-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
$restart_dns = 'yes';
@ -185,7 +185,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-add-web-domain-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -193,7 +193,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-add-dns-on-web-alias ".$v_username." ".$v_domain." '".$alias."' 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
$restart_dns = 'yes';
@ -208,7 +208,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-delete-web-domain-nginx ".$v_username." ".$v_domain." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -226,7 +226,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-change-web-domain-nginx-tpl ".$v_username." ".$v_domain." 'default' ".escapeshellarg($ext)." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
$v_nginx_ext = str_replace(',', ', ', $ext);
@ -247,7 +247,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-add-web-domain-nginx ".$v_username." ".$v_domain." 'default' ".escapeshellarg($ext)." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -260,7 +260,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-delete-web-domain-ssl ".$v_username." ".$v_domain." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -299,7 +299,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-change-web-domain-sslcert ".$user." ".$v_domain." ".$tmpdir." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -315,7 +315,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-change-web-domain-sslhome ".$user." ".$v_domain." ".$v_ssl_home." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
$v_ssl_home = $_POST['v_ssl_home'];
@ -335,7 +335,7 @@ if (!empty($_POST['save'])) {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg);
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
} else {
exec ('mktemp -d', $mktemp_output, $return_var);
$tmpdir = $mktemp_output[0];
@ -363,7 +363,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-add-web-domain-ssl ".$user." ".$v_domain." ".$tmpdir." ".$v_ssl_home." 'no'", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -381,7 +381,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-delete-web-domain-stats ".$v_username." ".$v_domain, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -392,7 +392,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-change-web-domain-stats ".$v_username." ".$v_domain." ".$v_stats, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -402,7 +402,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-add-web-domain-stats ".$v_username." ".$v_domain." ".$v_stats, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -413,7 +413,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-delete-web-domain-stats-user ".$v_username." ".$v_domain, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -431,14 +431,14 @@ if (!empty($_POST['save'])) {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg);
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
} else {
$v_stats_user = escapeshellarg($_POST['v_stats_user']);
$v_stats_password = escapeshellarg($_POST['v_stats_password']);
exec (VESTA_CMD."v-add-web-domain-stats-user ".$v_username." ".$v_domain." ".$v_stats_user." ".$v_stats_password, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -456,7 +456,7 @@ if (!empty($_POST['save'])) {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg);
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
}
if (($v_stats_user != $_POST['v_stats_user']) || ($_POST['v_stats_password'] != "••••••••" ) && (empty($_SESSION['error_msg']))) {
$v_stats_user = escapeshellarg($_POST['v_stats_user']);
@ -464,7 +464,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-add-web-domain-stats-user ".$v_username." ".$v_domain." ".$v_stats_user." ".$v_stats_password, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -477,7 +477,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-delete-web-domain-ftp ".$v_username." ".$v_domain, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -496,7 +496,7 @@ if (!empty($_POST['save'])) {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg);
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
}
if (($v_ftp_user != $_POST['v_ftp_user']) || ($_POST['v_ftp_password'] != "••••••••" ) && (empty($_SESSION['error_msg']))) {
$v_ftp_user = preg_replace("/^".$user."_/", "", $_POST['v_ftp_user']);
@ -505,7 +505,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-add-web-domain-ftp ".$v_username." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -524,7 +524,7 @@ if (!empty($_POST['save'])) {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg);
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
}
if (($v_ftp_user != $_POST['v_ftp_user']) || ($_POST['v_ftp_password'] != "••••••••" ) && (empty($_SESSION['error_msg']))) {
$v_ftp_user = preg_replace("/^".$user."_/", "", $_POST['v_ftp_user']);
@ -533,7 +533,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-add-web-domain-ftp ".$v_username." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
unset($output);
@ -555,7 +555,7 @@ if (!empty($_POST['save'])) {
$error_msg = $error_msg.", ".$error;
}
}
$_SESSION['error_msg'] = _('Error: field "%s" can not be blank.',$error_msg);
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
}
if (empty($_SESSION['error_msg'])) {
$v_ftp_user = escapeshellarg($_POST['v_ftp_user']);
@ -563,7 +563,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-add-web-domain-ftp ".$v_username." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password, $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
} else {
if (!empty($_POST['v_ftp_email'])) {
@ -571,7 +571,7 @@ if (!empty($_POST['save'])) {
$subject = _("FTP login credentials");
$hostname = exec('hostname');
$from = _('MAIL_FROM',$hostname);
$mailtext .= _('FTP_ACCOUNT_READY',$_GET['v_domain'],$user,$_POST['v_ftp_user'],$_POST['v_ftp_password']);
$mailtext .= _('FTP_ACCOUNT_READY',$_GET['domain'],$user,$_POST['v_ftp_user'],$_POST['v_ftp_password']);
send_email($to, $subject, $mailtext, $from);
unset($v_ftp_email);
}
@ -587,7 +587,7 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-restart-web", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
}
@ -597,13 +597,13 @@ if (!empty($_POST['save'])) {
exec (VESTA_CMD."v-restart-dns", $output, $return_var);
if ($return_var != 0) {
$error = implode('<br>', $output);
if (empty($error)) $error = _('Error: vesta did not return any output.');
if (empty($error)) $error = _('Error code:',$return_var);
$_SESSION['error_msg'] = $error;
}
}
if (empty($_SESSION['error_msg'])) {
$_SESSION['ok_msg'] = _('OK: changes has been saved.');
$_SESSION['ok_msg'] = _('Changes has been saved.');
}
}