70 lines
2.3 KiB
PHP
Executable File
70 lines
2.3 KiB
PHP
Executable File
<?php
|
|
include_once('path.php');
|
|
|
|
if ($_SESSION['validUser'] !== true) {
|
|
$destinationURL = "../index.php";
|
|
header("Location:$destinationURL");
|
|
exit();
|
|
}
|
|
|
|
$fileNames = array();
|
|
if (isset($_GET)) {
|
|
$jobNameGetString = ($_GET["JOB_NAME"] == '0') ? '+ManualTask' : $_GET["JOB_NAME"];
|
|
$refreshItem = $_GET["getDir"];
|
|
$fileNames = array();
|
|
$fileTypes = array();
|
|
$fileInfos = array();
|
|
$fileSize = array();
|
|
$fileLMod = array();
|
|
# dummy jobtype as of now, need to get proper jobType from popupScript.js
|
|
$jobType = ucfirst($_GET["jobType"]);
|
|
$jobNameGetString = $_GET["JOB_NAME"]=='0'?'+ManualTask':$_GET["JOB_NAME"];
|
|
|
|
$reload = 0;
|
|
if($jobNameGetString != '+ManualTask') {
|
|
$jobNameGetString = substr($jobNameGetString, (strlen($jobType) + 1));
|
|
}
|
|
if($_GET['reload'] == 1){
|
|
$reload = 1;
|
|
}
|
|
$jobPath = Scheduler::$user_dir."$jobType/$jobNameGetString";
|
|
|
|
$reloadData = 0;
|
|
if(is_dir($jobPath)) {
|
|
$filePath = '';
|
|
if($jobType == Scheduler::$backup || $jobType == Scheduler::$localBackup) {
|
|
$filePath = "$jobPath/" . BACKUPSETFILEDISPLAY;
|
|
} else if ($jobType == Scheduler::$restore) {
|
|
$filePath = "$jobPath/" . RESTORESETFILEDISPLAY;
|
|
}
|
|
|
|
if(file_exists($filePath)) {
|
|
# modified by sabin cheruvattil to support multiple users.
|
|
if ($jobType == Scheduler::$backup || $jobType == Scheduler::$localBackup) {
|
|
$validate = validateFileList($filePath, $refreshItem, $jobPath);
|
|
Scheduler::debug_Log($validate);
|
|
parse_str($validate, $backupSetContent);
|
|
} else if ($jobType == Scheduler::$restore && $reload == 0 && customFileSize($filePath)) {
|
|
$filePath = "$jobPath/" . RESTORESETFILEDISPLAY;
|
|
parse_str(validateRestoreFileList($filePath, $refreshItem, $jobPath), $backupSetContent);
|
|
$reloadData = 1;
|
|
} else if($jobType == Scheduler::$restore && $reload == 1 && customFileSize($filePath)) {
|
|
parse_str(loadValidRestoreSetContent($jobPath), $backupSetContent);
|
|
}
|
|
|
|
$fileNames = $backupSetContent['fileNames'];
|
|
$fileTypes = $backupSetContent['fileTypes'];
|
|
$fileInfos = $backupSetContent['fileInfos'];
|
|
$fileSize = $backupSetContent['fileSize'];
|
|
$fileLMod = $backupSetContent['fileLMod'];
|
|
}
|
|
}
|
|
}
|
|
if(count($fileNames) > 0)
|
|
$resp = array(true, $fileNames, $fileTypes, $fileInfos, $fileSize, $fileLMod);
|
|
else
|
|
$resp = array(false, 'File not found',$reloadData);
|
|
|
|
echo json_encode($resp);
|
|
|
|
?>
|