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') {
exec (VESTA_CMD."v-schedule-user-restore ".$user." ".$backup." ".$web." ".$dns." ".$mail." ".$db." ".$cron." ".$udir, $output, $return_var);
if ($return_var == 0) {
$_SESSION['restore_msg'] = __('RESTORE_SCHEDULED');
$_SESSION['error_msg'] = __('RESTORE_SCHEDULED');
} else {
$_SESSION['restore_msg'] = implode('<br>', $output);
if (empty($_SESSION['restore_msg'])) {
$_SESSION['restore_msg'] = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = implode('<br>', $output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['error_msg'] = __('Error: vesta did not return any output.');
}
if ($return_var == 4) {
$_SESSION['restore_msg'] = __('RESTORE_EXISTS');
$_SESSION['error_msg'] = __('RESTORE_EXISTS');
}
}
}

View file

@ -213,23 +213,24 @@ function send_email($to,$subject,$mailtext,$from) {
function display_error_block() {
if (!empty($_SESSION['error_msg'])) {
echo '
<script type="text/javascript">
$(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-message" ).dialog({
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
});
</script>
<div id="dialog-message" title="Error">
<p>';
echo $_SESSION['error_msg'];
echo "</p>\n </div>\n";
<div>
<script type="text/javascript">
$(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-message" ).dialog({
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
});
</script>
<div id="dialog-message" title="">
<p>'. $_SESSION['error_msg'] .'</p>
</div>
</div>'."\n";
unset($_SESSION['error_msg']);
}
}

View file

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

View file

@ -8,7 +8,7 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
if ($_SESSION['user'] == 'admin') {
if (!empty($_GET['hostname'])) {
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);
}

View file

@ -8,15 +8,15 @@ include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$v_username = escapeshellarg($user);
exec (VESTA_CMD."v-schedule-user-backup ".$v_username, $output, $return_var);
if ($return_var == 0) {
$_SESSION['backup_msg'] = __('BACKUP_SCHEDULED');
$_SESSION['error_msg'] = __('BACKUP_SCHEDULED');
} else {
$_SESSION['backup_msg'] = implode('<br>', $output);
if (empty($_SESSION['backup_msg'])) {
$_SESSION['backup_msg'] = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = implode('<br>', $output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['error_msg'] = __('Error: vesta did not return any output.');
}
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);
if ($return_var == 0) {
$_SESSION['restore_msg'] = __('RESTORE_SCHEDULED');
$_SESSION['error_msg'] = __('RESTORE_SCHEDULED');
} else {
$_SESSION['restore_msg'] = implode('<br>', $output);
if (empty($_SESSION['restore_msg'])) {
$_SESSION['restore_msg'] = __('Error: vesta did not return any output.');
$_SESSION['error_msg'] = implode('<br>', $output);
if (empty($_SESSION['error_msg'])) {
$_SESSION['error_msg'] = __('Error: vesta did not return any output.');
}
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) {
$error = implode('<br>', $output);
if (empty($error)) $error = 'Error: '.$v_pkg.' update failed';
$_SESSION['error_upd'] = $error;
$_SESSION['error_msg'] = $error;
}
unset($output);
}