479 lines
19 KiB
PHP
Executable File
479 lines
19 KiB
PHP
Executable File
<?php
|
|
include_once 'path.php';
|
|
if(!isset($_SESSION['validUser']) || $_SESSION['validUser'] !== true)
|
|
exit(header("Location:../index.php"));
|
|
|
|
if(file_exists($drlFile))
|
|
$restorePathName = file_get_contents($drlFile);
|
|
else
|
|
{
|
|
$drlPath = Scheduler::$user_dir."RESTORE_DATA";
|
|
file_put_contents($drlFile,$drlPath);
|
|
@chmod($drlFile, $permissionVal);
|
|
$restorePathName = $drlPath;
|
|
}
|
|
|
|
/* Checking whether any Manual Restore Task is running or not*/
|
|
$startPidfilePath = Scheduler::$restore_dir."+TrashManualTask/".START_PID;
|
|
$userCancelPath = Scheduler::$restore_dir."+TrashManualTask/".CANCEL_PATH;
|
|
|
|
$cancellingRestoreJob=false;
|
|
$currentRestoreJob=0;
|
|
$versionInfo = array();
|
|
if(file_exists($startPidfilePath)){
|
|
if(file_exists($userCancelPath)){
|
|
$currentRestoreJob = 0;
|
|
$cancellingRestoreJob=true;
|
|
} else {
|
|
$currentRestoreJob = 0;
|
|
}
|
|
$versionInfoUnSerialized = file_get_contents($startPidfilePath);
|
|
$versionInfoUnSerialized = unserialize($versionInfoUnSerialized);
|
|
if (is_array($versionInfoUnSerialized) && (count($versionInfoUnSerialized) > 0)) {
|
|
$versionInfo = $versionInfoUnSerialized;
|
|
}
|
|
} else {
|
|
$currentRestoreJob = '';
|
|
}
|
|
|
|
?>
|
|
<!-- search popup from restore starts -->
|
|
|
|
|
|
<!-- search popup from restore ends -->
|
|
|
|
|
|
|
|
<!-- content: -->
|
|
<section class="container body_wrap trash-wrap" style="margin-top:-40px;">
|
|
<div class="ajax_loader" ><p>loader...</p></div>
|
|
<section class="breadcrum_menu">
|
|
<div class="breadcrumb" id="fullPathBreadCrumb"></div>
|
|
<p class="storage-desc">Files that have been in Trash for more than 30 days will be automatically deleted.</p>
|
|
</section>
|
|
|
|
<section class="menu restore_menu">
|
|
<div class="option_heading" >
|
|
<div class="right_w"> </div>
|
|
</div>
|
|
<div class="msg_option">
|
|
<div class="option_msg">
|
|
<div class="heading_option"> Options </div>
|
|
<div class="close_menu"><img src="include/images/popup_close_btn.png" ></div>
|
|
</div>
|
|
</div>
|
|
<div class="left_menu">
|
|
<ul class="menu_ul">
|
|
<li id="backButton"><a data-tooltip="Back" name="Back" title="Back" class="back" href="javascript:void(0)" alt="">Back</a></li>
|
|
<li id="putbackButton"><a data-tooltip="Put Back" name="Put Back" title="Put Back" class="putback" alt="">Put Back</a></li>
|
|
<?php
|
|
if(!$_SESSION['dedup'])
|
|
print '<li id="deleteButton" class="delete_li"><a data-tooltip="Delete" name="Delete" title="Delete" class="menu_delete" alt="">Delete</a></li>';
|
|
?>
|
|
</ul>
|
|
<a alt="Trash" class="restore_trash_menu" id="empty_trash" title="Empty Trash" href="javascript:void(0);" style="display: none;"><span>Trash</span></a>
|
|
</div>
|
|
<div class="trash-right-menu">
|
|
|
|
|
|
<div class="trash-search">
|
|
<input type="text" placeholder="Search file/folder" title="Search" value="*" class="search_box_inpt search_input">
|
|
<!-- input type="submit" class="search_box_btn" id="remoteSearchTrash" value="Search" style="margin-top: -30px;" -->
|
|
<input type="submit" class="search_box_trash_btn" id="remoteSearchTrash" value="Search">
|
|
<input type="submit" class="search_box_trash_cancel_btn" value="Search" style="display:none;">
|
|
</div>
|
|
<!-- input type="submit" class="disabled_search_btn" value="Search" style="display: none;" -->
|
|
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<!-- <div class="container body_wrap trash-wrap trash-page"> -->
|
|
<div class="trash-page">
|
|
<div class="tab_loader">
|
|
<p>loader...</p>
|
|
</div>
|
|
<div class="nfiles empty_box" style="display: none; width: 100%;">
|
|
<div class="empty_box_inner">
|
|
<div class="empty_trash"></div>
|
|
<p>No files</p>
|
|
</div>
|
|
</div>
|
|
<!-- div class="empty_box"><div class="empty_box_inner"><div class="empty_trash"></div><p><b>No files in Trash.</b></p></div></div -->
|
|
<div class="exclude">
|
|
<form id="startTrashRestoreForm" name="startTrashRestoreForm" method="POST">
|
|
<div class="excludeContainer" id="rgt">
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr class="excludeheader header_part ">
|
|
<td class="file_check"><input type="checkbox" id="mainchek" class="checkcontrol">
|
|
<label class="mainCheck">All</label></td>
|
|
<td class="fname">File / Folder name</td>
|
|
<td class="file_size">Size</td>
|
|
<td class="file_date">Date modified</td>
|
|
<td width="5%"></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<div id="loadTrashPath">
|
|
<div class="excludefiles">
|
|
<table id="trash_list_data" class="folderBackupContent backupset_table bc_table">
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- End excludeContainer -->
|
|
<?php
|
|
if($cancellingRestoreJob==true){
|
|
$cancellingJob = 'style="display:block;"';
|
|
$startJobButton = 'style="display:none;"';
|
|
$cancelJobButton = 'style="display:none;"';
|
|
} else if($currentRestoreJob===0){
|
|
$cancellingJob = 'style="display:none;"';
|
|
$startJobButton = 'style="display:none;"';
|
|
$cancelJobButton = 'style="display:block;"';
|
|
} else {
|
|
$cancellingJob = 'style="display:none;"';
|
|
$startJobButton = 'style="display:block;"';
|
|
$cancelJobButton = 'style="display:none;"';
|
|
}
|
|
?>
|
|
<div class="restorenow_btm">
|
|
<div class="restorenow_lft">
|
|
<label>Restore location:</label>
|
|
<input type="textbox" name="restoreLocation" id="restoreLocation" class="restore_txtbox" readonly="" value="<?php echo htmlentities($restorePathName, ENT_QUOTES); ?>">
|
|
<input type="hidden" name="restoreLocationLength" id="restoreLocationLength" value="<?php echo strlen($restorePathName) ?>" />
|
|
<input type="button" id="file_browse" value="...">
|
|
</div>
|
|
<div class="restorenow_rgt">
|
|
<input type="hidden" id="startTrashManualTaskButton" name="startTrashManualTaskButton">
|
|
<input type="hidden" id="cancelTrashManualTaskButton" name="cancelTrashManualTaskButton">
|
|
<div class="loading_icon" <?php print $cancelJobButton; ?>>Loading...</div>
|
|
<input type="submit" id="startTrashRestore" class="scheduleBtn" value="Restore Now" onClick="return startTrashManualRestore()" <?php print $startJobButton; ?>>
|
|
<div class="stop_restore">
|
|
<div class="restore_loading_gray" <?php print $cancellingJob; ?> ></div>
|
|
<span class="scheduleBtn" id="cancellingRestore" <?php print $cancellingJob; ?> >Stopping Restore</span>
|
|
</div>
|
|
<input type="submit" id="cancelTrashRestore" class="scheduleBtn" value="Stop Restore" onClick="return cancelTrashManualRestore()" <?php print $cancelJobButton; ?>>
|
|
</div>
|
|
</div >
|
|
</form>
|
|
<form id="startTrashRestoreVersionForm" name="startTrashRestoreForm" method="POST">
|
|
<div class="excludefiles scheduler_part restore_cnt version_restore_cnt" style="display:none;">
|
|
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="folderBackupContent version_restore_cnt">
|
|
<tbody>
|
|
<tr>
|
|
<td style="display:none;">
|
|
<input id="vr_file" type="hidden" name="chk_group[]" value="" style="display:none;">
|
|
<input id="vr_file_type" type="hidden" name="itemType[]" value="file">
|
|
<input id="vr_file_len" type="hidden" name="chk_length[]" value="0">
|
|
<input id="vr_file_ver" type="hidden" name="vrn" value=""/>
|
|
<input id="vr_file_size" type="hidden" name="vrs" value=""/>
|
|
<input id="vr_file_modifiedon" type="hidden" name="vrm" value=""/>
|
|
</td>
|
|
<td width="33%"><span id="versioncountno"></span></td>
|
|
<td width="32%"><span id="versionfilesize"></span></td>
|
|
<td width="39%"><span id="versiondatemodified"></span></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
<!-- End exclude -->
|
|
</div>
|
|
</section>
|
|
<!-- /content -->
|
|
|
|
<!-- Table row dropdwon -->
|
|
<ul id="dropdown" class="dropdown row_dropdown trash_dropdown">
|
|
<!-- <li><a class="file_menu_share">Share</a></li>-->
|
|
<?php if(!$_SESSION['dedup']) print '<li><a class="file_menu_delete" >Delete</a></li>'; ?>
|
|
<li><a class="file_menu_putback">Put Back</a></li>
|
|
<li><a class="file_menu_version" style="display: block;">Version</a></li>
|
|
<!-- li><a class="file_menu_restoreset">Restore</a></li -->
|
|
|
|
</ul>
|
|
<!-- Start Delete Popup -->
|
|
<div class="popup_container popup_delete popLeft">
|
|
<section class="popup_header">
|
|
<h2 class="account_cancel">Delete</h2>
|
|
<span class="popup_close_btn hide_popup"></span> </section>
|
|
<section class="popup_content">
|
|
<div class="account_cancel_box">
|
|
<p id="deleteConfirmationMessage">Are you sure you want to delete <b id="delPopupEllipse"></b> Permanently?</p>
|
|
</div>
|
|
</section>
|
|
<section class="popup_footer">
|
|
<p class="donot_ask"><input type="checkbox" id="trash_del_chk" value=""> Do not ask again.</p>
|
|
<input type="button" value="Yes" class="scheduleBtn cancelAccount" id="deleteConfirmation">
|
|
<input type="button" value="No" class="scheduleBtn cancelAccount" id="cancelDelete">
|
|
</section>
|
|
</div>
|
|
<!-- End Delete Popup -->
|
|
|
|
<!-- Start: Put back - confirmation popup -->
|
|
<div class="popup_container put_back_popup">
|
|
<section class="popup_header">
|
|
<h4>Put Back</h4>
|
|
<span class="popup_close_btn hide_popup"></span> </section>
|
|
</section>
|
|
<section class="popup_body">
|
|
<div>Are you sure you want to put back <b id="putBackPopupEllipse"></b> from trash?</div>
|
|
<div class="clear"></div>
|
|
</section>
|
|
<section class="popup_footer">
|
|
<p class="donot_ask"><input type="checkbox" id="trash_putback_chk" value=""> Do not ask again.</p>
|
|
<div class="">
|
|
<input type="submit" id="putbackConfirmation" class="scheduleBtn" value=" Yes ">
|
|
<input type="submit" id="cancelPutback" class="scheduleBtn" value=" No ">
|
|
</div>
|
|
</section>
|
|
</div >
|
|
<!-- End: Put back - confirmation popup -->
|
|
|
|
<!-- Start: Put back - confirmation popup -->
|
|
<div class="popup_container empty_trash_popup">
|
|
<section class="popup_header">
|
|
<h4>Empty</h4>
|
|
<span class="popup_close_btn hide_popup"></span> </section>
|
|
</section>
|
|
<section class="popup_body">
|
|
<div>Are you sure you want to delete Trash Items permanently?</div>
|
|
<div class="clear"></div>
|
|
</section>
|
|
<section class="popup_footer">
|
|
<div class="">
|
|
<input type="submit" id="emptyConfirmation" class="scheduleBtn" value=" Yes ">
|
|
<input id="cancelEmpty" type="submit" class="scheduleBtn" value=" No ">
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<!-- End: Put back - confirmation popup -->
|
|
|
|
<!-- START: Version details Popup -->
|
|
<div class="version_container popup_container popLeft" style="display: none;">
|
|
<section class="popup_header">
|
|
<div class="genr_img"></div>
|
|
<h2> <b><span id="folderDetailsName" alt="TEST" title="TEST">TEST</span></b> </h2>
|
|
<div class="fldr_path"><span style="float: left;">Path:</span><span id="folderDetailsPath" alt="Home" title="Home">Home</span> </div>
|
|
<span class="popup_close_btn hide_popup"></span>
|
|
<div style="clear:both;"></div>
|
|
<div class="common_msg error_msg version_error_msg" style="display: none;">
|
|
<p id="versionErrorMsg">Please select any one version to continue</p>
|
|
<a class="close_info" href="javascript:void(0)"><img width="16" height="16" src="include/images/close.png" alt="close" title="Close"></a>
|
|
</div>
|
|
</section>
|
|
<section class="popup_content">
|
|
<ul class="details_body">
|
|
<li class="details_head">
|
|
<div> <b>Version</b> </div>
|
|
<div> <b>Size</b> </div>
|
|
<div> <b>Date modified</b> </div>
|
|
</li>
|
|
</ul>
|
|
<ul class="details_body version_list">s
|
|
</ul>
|
|
</section>
|
|
<section class="popup_footer">
|
|
<div class="btncontainer">
|
|
<input type="submit" class="scheduleBtn" id="version_update" value="Restore">
|
|
<input type="submit" class="scheduleBtn popup_cancelBtn" value="Cancel">
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<!-- End Details Popup -->
|
|
|
|
<!-- Start: Restore location - Popup -->
|
|
|
|
<div class="popup_container popContent Backuplocation_popup popLeft trash-page">
|
|
<section class="popup_header">
|
|
<h4>Select your restore location</h4>
|
|
<span class="popup_close_btn hide_popup"></span>
|
|
</section>
|
|
<section class="popup_body">
|
|
<!-- files table -->
|
|
<div class="exclude popup_set_exclude">
|
|
<div class="excludeContainer">
|
|
<div id="restoreLocationBreadCrumb" class="breadcrumb"><a href="javascript:void(0);" alt="/" class="getRestoreDirList">/</a></div>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="folderBackupContent">
|
|
<tbody><tr class="excludeheader header_part ">
|
|
<td class="cont_heading" width="100%">File/Folder name</td>
|
|
<!-- <td width="15%">Size</td>
|
|
<td width="16%">Date modified</td> -->
|
|
</tr>
|
|
</tbody></table>
|
|
<div class="ajax_loader"><p>loader...</p></div>
|
|
<div class="nfiles"><?php print NO_FILES;?></div>
|
|
<div id="loadRestoreLocation">
|
|
<?php require_once("restoreLocation.php"); ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- End file table -->
|
|
<div class="clear"></div>
|
|
</section>
|
|
<section class="popup_footer">
|
|
<div class="btncontainer">
|
|
<input type="submit" id="addRestoreLocationTrash" class="scheduleBtn addButton" value=" Ok ">
|
|
<input type="submit" class="scheduleBtn popup_cancelBtn" value="Cancel">
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<!-- End: Restore location - Popup -->
|
|
|
|
|
|
<script>
|
|
<?php
|
|
if($currentRestoreJob===0){
|
|
?> $( document ).ready(function() {
|
|
watchTrashRestoreStatus = 1;
|
|
});
|
|
<?php } ?>
|
|
var localDirMore = true;
|
|
checkTrashItemArray = [];
|
|
startRemoteSearch("trash");
|
|
$("#backButton").on('click',function(){ $(".leftnavbutton.act").trigger("click"); });
|
|
//$(function(){ startTrashList("/");});
|
|
$('.popup_container,.nfiles').hide();
|
|
jQuery(document).ready(function(){
|
|
var localDirMore = true;
|
|
onScrollForRemote();
|
|
});
|
|
|
|
// Empty Trash realted function
|
|
$('.empty_trash_menu').on('click',function(){
|
|
$('.body_wrap .exclude ').hide();
|
|
$('.empty_box').show();
|
|
});
|
|
|
|
$('.excludefiles').scroll(function(){
|
|
$('.dropdown').fadeOut();
|
|
});
|
|
|
|
$("#emptyConfirmation").on('click',function(){
|
|
$.popContainerHide();
|
|
emptyTrashWatcher();
|
|
targetUrl = "action.php?action=emptyTrash";
|
|
if(dedup==true){
|
|
var deviceID = deDupDeviceID;
|
|
targetUrl +="&deviceID="+encodeURIComponent(deviceID);
|
|
}
|
|
jQuery('.alert,#page_loader').show();
|
|
$.ajax({
|
|
url: targetUrl,
|
|
type: "POST",
|
|
dataType: 'json',
|
|
success: function(validatedData){ }
|
|
});
|
|
});
|
|
$("#empty_trash").on('click',function(){
|
|
$.popContainer();
|
|
$(".sec_pos_container").append($('.empty_trash_popup').show());
|
|
$(".master_wrapper .popup_container").addClass('popLeft');
|
|
});
|
|
function emptyTrashWatcher(){
|
|
setTimeout(emptyTrashWatchercall,500);
|
|
}
|
|
|
|
function emptyTrashWatchercall(){
|
|
var watcherVar = 0;
|
|
targetUrl = "action.php?action=emptyTrashChk";
|
|
|
|
$.ajax({
|
|
url: targetUrl,
|
|
type: "POST",
|
|
dataType: 'json',
|
|
success: function(validatedData){
|
|
output = validatedData;
|
|
if(output.SIZE > 0 && output.SIZE != false){
|
|
window.deleteStatus = 0;
|
|
var msg_type = "";
|
|
var msg = "";
|
|
var time = 1;
|
|
|
|
if(output.STATUS == 0)
|
|
{
|
|
msg_type = '.error_msg';
|
|
msg = 'Delete Operation has failed. Please check log for details.';
|
|
}
|
|
else if(output.STATUS == 1)
|
|
{
|
|
jQuery('#page_loader').hide();
|
|
msg_type = '.welcome_message';
|
|
msg = 'Delete operation has been completed successfully.';
|
|
$(".restore_trash_menu").hide();
|
|
searchItemArray = [];
|
|
jQuery('#empty_trash,#deleteButton,#putbackButton').hide();
|
|
}
|
|
else if(output.STATUS == 4)
|
|
{
|
|
msg_type = '.error_msg';
|
|
msg = 'No items selected for Delete';
|
|
}
|
|
jQuery('input#mainchek').removeAttr('checked').siblings('label').removeAttr('class');
|
|
jQuery('.alert,#page_loader').hide();
|
|
$(".excludeContainer").hide();
|
|
$(".empty_box").show();
|
|
setTimeout(function(){ showErrorMessages(msg_type,msg);} , time);
|
|
}else{
|
|
watcherVar = setTimeout(emptyTrashWatchercall,1000);
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
$("input#version_update" ).click(function() {
|
|
if (!$('#startTrashRestore').is(':visible')) {
|
|
$.popContainerHide();
|
|
showErrorMessages('.error_msg', 'Restore Job is in progress...');
|
|
return;
|
|
}
|
|
var versionSelected = $('.version_container .popup_content .details_body li.active');
|
|
var filePath = $('.version_container .popup_header #folderDetailsPath').attr('path');
|
|
if (versionSelected.length == 1) {
|
|
var selectedVersionDetails = [];
|
|
selectedVersionDetails['version'] = $.trim(versionSelected.find('#versioncountno').text());
|
|
selectedVersionDetails['size'] = $.trim(versionSelected.find('#versionfilesize').text());
|
|
selectedVersionDetails['datemodified'] = $.trim(versionSelected.find('#versiondatemodified').text());
|
|
$('.restore_cnt').hide();
|
|
$('.version_restore_cnt').show();
|
|
$(".excludefiles.restore_cnt table.restore_cnt").find('*').prop('disabled',true);
|
|
$(".excludefiles.version_restore_cnt table.version_restore_cnt").find('*').prop('disabled',false);
|
|
$.popContainerHide();
|
|
var showVersionSelected = $('.excludefiles.version_restore_cnt table.version_restore_cnt');
|
|
showVersionSelected.find('#vr_file').val(filePath);
|
|
showVersionSelected.find('#vr_file_type').val('file');
|
|
showVersionSelected.find('#vr_file_ver').val(selectedVersionDetails['version']);
|
|
showVersionSelected.find('#vr_file_size').val(selectedVersionDetails['size']);
|
|
showVersionSelected.find('#vr_file_modifiedon').val(selectedVersionDetails['datemodified']);
|
|
showVersionSelected.find('span#versioncountno').text(selectedVersionDetails['version']);
|
|
showVersionSelected.find('span#versionfilesize').text(selectedVersionDetails['size']);
|
|
showVersionSelected.find('span#versiondatemodified').text(selectedVersionDetails['datemodified']);
|
|
|
|
var displayPath = $('.main_chk_table1.version_restore_cnt');
|
|
var folderPath = filePath.substring(filePath.lastIndexOf("/") + 1);
|
|
folderPath = folderPath.replace(/[\s]/g,' ');
|
|
displayPath.find('span#folderDetailsName').text(folderPath);
|
|
displayPath.find('span#folderDetailsName').attr('alt', filePath.substring(filePath.lastIndexOf("/") + 1))
|
|
.attr('title', filePath.substring(filePath.lastIndexOf("/") + 1));
|
|
|
|
var folderPath = filePath.slice(0, filePath.lastIndexOf('/'));
|
|
folderPath = folderPath.replace(/[\s]/g,' ');
|
|
displayPath.find('span#folderDetailsPath').text('Home' + (folderPath));
|
|
displayPath.find('span#folderDetailsPath').attr('alt', 'Home' + (filePath.slice(0, filePath.lastIndexOf('/'))))
|
|
.attr('title', 'Home' + (filePath.slice(0, filePath.lastIndexOf('/'))));
|
|
$('#startTrashRestoreForm #startTrashRestore').trigger('click');
|
|
}
|
|
else {
|
|
showErrorMessages('.version_error_msg', 'Please select any one version to continue');
|
|
}
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|