unified error msg variable

This commit is contained in:
Serghey Rodin 2013-11-02 16:43:40 +02:00
commit 849d536993
7 changed files with 36 additions and 35 deletions

View file

@ -26,14 +26,14 @@ if (!empty($_POST['udir'])) $udir = escapeshellarg(implode(",",$_POST['udir']));
if ($action == 'restore') { if ($action == 'restore') {
exec (VESTA_CMD."v-schedule-user-restore ".$user." ".$backup." ".$web." ".$dns." ".$mail." ".$db." ".$cron." ".$udir, $output, $return_var); exec (VESTA_CMD."v-schedule-user-restore ".$user." ".$backup." ".$web." ".$dns." ".$mail." ".$db." ".$cron." ".$udir, $output, $return_var);
if ($return_var == 0) { if ($return_var == 0) {
$_SESSION['restore_msg'] = __('RESTORE_SCHEDULED'); $_SESSION['error_msg'] = __('RESTORE_SCHEDULED');
} else { } else {
$_SESSION['restore_msg'] = implode('<br>', $output); $_SESSION['error_msg'] = implode('<br>', $output);
if (empty($_SESSION['restore_msg'])) { if (empty($_SESSION['error_msg'])) {
$_SESSION['restore_msg'] = __('Error: vesta did not return any output.'); $_SESSION['error_msg'] = __('Error: vesta did not return any output.');
} }
if ($return_var == 4) { if ($return_var == 4) {
$_SESSION['restore_msg'] = __('RESTORE_EXISTS'); $_SESSION['error_msg'] = __('RESTORE_EXISTS');
} }
} }
} }

View file

@ -213,6 +213,7 @@ function send_email($to,$subject,$mailtext,$from) {
function display_error_block() { function display_error_block() {
if (!empty($_SESSION['error_msg'])) { if (!empty($_SESSION['error_msg'])) {
echo ' echo '
<div>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" ); $( "#dialog:ui-dialog" ).dialog( "destroy" );
@ -226,10 +227,10 @@ function display_error_block() {
}); });
}); });
</script> </script>
<div id="dialog-message" title="Error"> <div id="dialog-message" title="">
<p>'; <p>'. $_SESSION['error_msg'] .'</p>
echo $_SESSION['error_msg']; </div>
echo "</p>\n </div>\n"; </div>'."\n";
unset($_SESSION['error_msg']); unset($_SESSION['error_msg']);
} }
} }

View file

@ -13,7 +13,7 @@ if ($_SESSION['user'] == 'admin') {
if ($return_var != 0) { if ($return_var != 0) {
$error = implode('<br>', $output); $error = implode('<br>', $output);
if (empty($error)) $error = __('SERVICE_ACTION_FAILED',__('restart'),$v_service); if (empty($error)) $error = __('SERVICE_ACTION_FAILED',__('restart'),$v_service);
$_SESSION['error_srv'] = $error; $_SESSION['error_msg'] = $error;
} }
unset($output); unset($output);
} }

View file

@ -8,7 +8,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
if ($_SESSION['user'] == 'admin') { if ($_SESSION['user'] == 'admin') {
if (!empty($_GET['hostname'])) { if (!empty($_GET['hostname'])) {
exec (VESTA_CMD."v-restart-system yes", $output, $return_var); exec (VESTA_CMD."v-restart-system yes", $output, $return_var);
$_SESSION['error_srv'] = 'The system is going down for reboot NOW!'; $_SESSION['error_msg'] = 'The system is going down for reboot NOW!';
} }
unset($output); unset($output);
} }

View file

@ -8,15 +8,15 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$v_username = escapeshellarg($user); $v_username = escapeshellarg($user);
exec (VESTA_CMD."v-schedule-user-backup ".$v_username, $output, $return_var); exec (VESTA_CMD."v-schedule-user-backup ".$v_username, $output, $return_var);
if ($return_var == 0) { if ($return_var == 0) {
$_SESSION['backup_msg'] = __('BACKUP_SCHEDULED'); $_SESSION['error_msg'] = __('BACKUP_SCHEDULED');
} else { } else {
$_SESSION['backup_msg'] = implode('<br>', $output); $_SESSION['error_msg'] = implode('<br>', $output);
if (empty($_SESSION['backup_msg'])) { if (empty($_SESSION['error_msg'])) {
$_SESSION['backup_msg'] = __('Error: vesta did not return any output.'); $_SESSION['error_msg'] = __('Error: vesta did not return any output.');
} }
if ($return_var == 4) { if ($return_var == 4) {
$_SESSION['backup_msg'] = __('BACKUP_EXISTS'); $_SESSION['error_msg'] = __('BACKUP_EXISTS');
} }
} }

View file

@ -30,14 +30,14 @@ if (!empty($_GET['type'])) {
exec ($restore_cmd, $output, $return_var); exec ($restore_cmd, $output, $return_var);
if ($return_var == 0) { if ($return_var == 0) {
$_SESSION['restore_msg'] = __('RESTORE_SCHEDULED'); $_SESSION['error_msg'] = __('RESTORE_SCHEDULED');
} else { } else {
$_SESSION['restore_msg'] = implode('<br>', $output); $_SESSION['error_msg'] = implode('<br>', $output);
if (empty($_SESSION['restore_msg'])) { if (empty($_SESSION['error_msg'])) {
$_SESSION['restore_msg'] = __('Error: vesta did not return any output.'); $_SESSION['error_msg'] = __('Error: vesta did not return any output.');
} }
if ($return_var == 4) { if ($return_var == 4) {
$_SESSION['restore_msg'] = __('RESTORE_EXISTS'); $_SESSION['error_msg'] = __('RESTORE_EXISTS');
} }
} }

View file

@ -14,7 +14,7 @@ if ($_SESSION['user'] == 'admin') {
if ($return_var != 0) { if ($return_var != 0) {
$error = implode('<br>', $output); $error = implode('<br>', $output);
if (empty($error)) $error = 'Error: '.$v_pkg.' update failed'; if (empty($error)) $error = 'Error: '.$v_pkg.' update failed';
$_SESSION['error_upd'] = $error; $_SESSION['error_msg'] = $error;
} }
unset($output); unset($output);
} }