backup pages

This commit is contained in:
Serghey Rodin 2012-06-28 14:11:35 +03:00
commit 7a99bd4ad0
7 changed files with 153 additions and 4 deletions

View file

@ -0,0 +1,17 @@
<?php
// Init
error_reporting(NULL);
ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
if ($_SESSION['user'] == 'admin') {
if (!empty($_GET['backup'])) {
$v_username = escapeshellarg($user);
$v_backup = escapeshellarg($_GET['backup']);
exec (VESTA_CMD."v_delete_user_backup ".$v_username." ".$v_backup, $output, $return_var);
unset($output);
}
}
header("Location: /list/backup/");

View file

@ -0,0 +1,23 @@
<?php
// Init
error_reporting(NULL);
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$backup = $_GET['backup'];
// Data
if ($_SESSION['user'] == 'admin') {
header('Content-type: application/gzip');
header("Content-Disposition: attachment; filename=\"".$backup."\";" );
header("X-Accel-Redirect: /backup/" . $backup);
}
if ((!empty($_SESSION['user'])) && ($_SESSION['user'] != 'admin')) {
if (preg_match("/^".$user."/i", $backup)) {
header('Content-type: application/gzip');
header("Content-Disposition: attachment; filename=\"".$backup."\";" );
header("X-Accel-Redirect: /backup/" . $backup);
}
}
?>

View file

@ -13,7 +13,46 @@ foreach ($data as $key => $value) {
if (!empty($data[$key]['MAIL'])) $mail = 'yes ¨';
if (!empty($data[$key]['DB'])) $db = 'yes ¨';
?>
<script type="text/javascript">
$(function(){
$('#restore_dialog_<?php echo "$i" ?>').dialog({
modal: true,
autoOpen: false,
width: 360,
buttons: {
"Ok": function(event, ui) {
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#restore_link_<?php echo "$i" ?>').click(function(){
$('#restore_dialog_<?php echo "$i" ?>').dialog('open');
return false;
});
$('#delete_dialog_<?php echo "$i" ?>').dialog({
modal: true,
autoOpen: false,
width: 360,
buttons: {
"Ok": function(event, ui) {
location.href = '/delete/backup/?backup=<?php echo "$key" ?>';
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#delete_link_<?php echo "$i" ?>').click(function(){
$('#delete_dialog_<?php echo "$i" ?>').dialog('open');
return false;
});
});
</script>
<tr class="data-row">
<td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
<table class="data-col1">
@ -25,9 +64,21 @@ foreach ($data as $key => $value) {
<td class="data-dotted" width="830px" style="vertical-align:top;">
<table width="830px"><tr>
<td></td>
<td class="data-controls" width="80px"><img src="/images/download.png" width="8px" height="8px"><a href="#"> download</a></td>
<td class="data-controls" width="70px"><img src="/images/restore.png" width="6px" height="8px"><a href="#"> restore</a></td>
<td class="data-controls" width="70px"><img src="/images/delete.png" width="7px" height="7px"><a href="#"> delete</a></td>
<td class="data-controls" width="80px"><img src="/images/download.png" width="8px" height="8px"><a href="/download/backup/?backup=<?php echo $key ?>" target="_blank"> download</a></td>
<td class="data-controls" width="80px">
<img src="/images/restore.png" width="6px" height="8px">
<a href="#" id="restore_link_<?php echo "$i"?>"> restore</a>
<div id="restore_dialog_<?php echo "$i" ?>" title="Confirmation">
<p class="counter-value">Are you sure you want to restore <b><?php echo "$key" ?></b> backup?</p>
</div>
</td>
<td class="data-controls" width="70px">
<img src="/images/delete.png" width="7px" height="7px">
<a href="#" id="delete_link_<?php echo $i ?>"> delete</a>
<div id="delete_dialog_<?php echo $i ?>" title="Confirmation">
<p class="counter-value">Are you sure you want to delete <b><?php echo "$key" ?></b> backup?</p>
</div>
</td>
</tr></table>
<table class="data-col2" width="830px">

View file

@ -1,7 +1,7 @@
<table class="sub-menu">
<tr>
<td width="142px" style="padding: 16px 0 16px 6px">
<button style="width:120px; padding: 2px 0px 2px 0px;" onclick="location.href='/add/backup/'">Add Backup</button>
<button style="width:120px; padding: 2px 0px 2px 0px;" onclick="location.href='#'"> Backup Now</button>
<td><a style="padding: 0 4px 0 12px" class="select-controls" href='javascript:checkedAll("vstobjects");'> toggle all </a>
<select style="margin:0 0 0 0px">
<option>apply to selected</option>