92 lines
3.6 KiB
PHP
Executable File
92 lines
3.6 KiB
PHP
Executable File
<?php
|
|
include_once 'path.php';
|
|
if(!isset($_SESSION['validUser']) || $_SESSION['validUser'] !== true)
|
|
exit(header("Location:../index.php"));
|
|
|
|
if($_SESSION['validUser'] === true)
|
|
{
|
|
$fullPath = isset($_GET['fullPath']) ? rawurldecode($_GET['fullPath']) : '';
|
|
$pageid = (isset( $_GET['pageid'] )) ? $_GET['pageid'] : '0';
|
|
$dedupBucket = (isset( $_GET['dedupBucket'] )) ? $_GET['dedupBucket'] : '';
|
|
$fullPath = phpRealEscapeString($fullPath);
|
|
$drivePath = isset($_GET['drivePath']) ? rawurldecode($_GET['drivePath']) : getLocalBackupLocation();
|
|
$drivePath = phpRealEscapeString($drivePath);
|
|
|
|
$dirArrayDefault = array();
|
|
$dirArrayDefault = getRestoreDirList($fullPath,$drivePath,$pageid,$dedupBucket); //Calling function to read local directory list to restore
|
|
$resStatus = true;
|
|
$resHtml = '';
|
|
$countDir = count($dirArrayDefault);
|
|
if($countDir > 0){
|
|
$index=0;
|
|
foreach($dirArrayDefault as $name=>$attributes)
|
|
{
|
|
$dirName = trim($name,"/");
|
|
$dirSize = humanReadableSize(trim($attributes['size']));
|
|
$dirDate = trim($attributes['date']);
|
|
|
|
/*$size[] = $dirSize;
|
|
$date[] = $dirDate;*/
|
|
$size[] = $attributes['size'];
|
|
$date[] = $attributes['date'];
|
|
$fullPathHTML = htmlentities($fullPath.$dirName, ENT_QUOTES);
|
|
$dirName = str_replace('&','&',$dirName);
|
|
$dirNameHTML = htmlentities($dirName, ENT_QUOTES);
|
|
|
|
if($attributes['type'] == "D") {
|
|
$resHtml .= '<tr class="row_list">';
|
|
$resHtml .= '<td class="file_check">';
|
|
$resHtml .= '<input type="checkbox" id="chk_elements['.$index.']" name="chk_elements['.$index.']" value="'.$fullPathHTML.'">';
|
|
$resHtml .= '<label >folder</label> </td>';
|
|
$resHtml .= '<td class="cont_heading" title="'.$dirNameHTML.'">';
|
|
$resHtml .= '<a class="getDirList" href="javascript:void(0);" alt="'.$fullPathHTML.'/"><img src="include/images/idq_ico_folder.png"></a>';
|
|
$resHtml .= '<a class="getDirList" href="javascript:void(0);" alt="'.$fullPathHTML.'/"><span>'.str_replace(' ',' ',$dirNameHTML).'</span></a>';
|
|
$resHtml .= '</td>';
|
|
$resHtml .= '<td class="file_size">'.$dirSize.'</td><td class="file_date">'.$dirDate.'</td>';
|
|
$resHtml .= '<td class="file_menu_list"></td>';
|
|
$resHtml .= '</tr>';
|
|
|
|
$type[] = 'folder';
|
|
} else {
|
|
$resHtml .= '<tr class="row_list">';
|
|
$resHtml .= '<td class="file_check">';
|
|
$resHtml .= '<input type="checkbox" id="chk_elements['.$index.']" name="chk_elements['.$index.']" value="'.$fullPathHTML.'">';
|
|
$resHtml .= '<label >file</label></td>';
|
|
$resHtml .= '<td class="cont_heading" title="'.$dirNameHTML.'"><img src="include/images/idq_ico_file.png" >';
|
|
$resHtml .= '<span>'.str_replace(' ',' ',$dirNameHTML).'</span></td>';
|
|
$resHtml .= '<td class="file_size" value="'.$attributes['size'].'">'.$dirSize.'</td><td class="file_date" value="'.$attributes['date'].'">'.$dirDate.'</td>';
|
|
$resHtml .= '<td></td>';
|
|
$resHtml .= '</tr>';
|
|
|
|
$type[] = 'file';
|
|
}
|
|
$dirArray[] = $fullPath.$dirName;
|
|
$index++;
|
|
}
|
|
|
|
$resArr['retry'] = ($countDir<MAX_NUM_OF_ITEMS)?false:true;
|
|
|
|
} else if($pageid>0){
|
|
$resStatus = false;
|
|
$resArr['retry'] = false;
|
|
}
|
|
else {
|
|
$resStatus = false;
|
|
$resHtml = '<div class="nfiles" style="display:block;">No files</div>';
|
|
}
|
|
$resArr[]=$resStatus;
|
|
$resArr[]=$resHtml;
|
|
if(!isset($dirArray)) {
|
|
$dirArray = array();
|
|
}
|
|
if(!isset($type)) {
|
|
$type = array();
|
|
$size = array();
|
|
$date = array();
|
|
}
|
|
$resArr[]= array('url'=>rawurlencode($drivePath).rawurlencode($fullPath),'dir'=>$dirArray,'type'=>$type,'size'=>$size,'date'=>$date);
|
|
echo json_encode($resArr);
|
|
exit;
|
|
}
|
|
?>
|