0){ $resp[] = false; $resp[] = $jobType=='Backup'?DUPLICATE_BACKUP_JOB:DUPLICATE_RESTORE_JOB; echo json_encode($resp); exit; } if(strcmp($_POST['jobType'], "Backup") === 0) { $countOfJobs = getTotalCountOfJobs(); if($countOfJobs >= 5){ $resp[] = false; $resp[] = "You are not allowed to create more than 5 Backup sets"; Scheduler::Log("Failed to open backup set file " . $jobNameDirPath . " : Crossed Total Count Of Jobs Limit" ); echo json_encode($resp); exit; } } $data = array(); $jobNameDirPath = Scheduler::$user_dir."$jobType/$newJobName"; if(!is_dir($jobNameDirPath)){ if(!mkdir($jobNameDirPath, $permissionVal)){ $resp[] = false; $resp[] = "Failed to create Directory $jobNameDirPath : ".customErrorMsg(); echo json_encode($resp); exit; } @chmod($jobNameDirPath, $permissionVal); } $job_type_val = strcmp($_POST['jobType'], "Backup"); if(strcmp($_POST['jobType'], "Backup") === 0) { $displayFile = "$jobNameDirPath/".BACKUPSETFILEDISPLAY; } else { $displayFile = "$jobNameDirPath/".RESTORESETFILEDISPLAY; } if(file_exists($displayFile)){ unlink($displayFile); } $displayFileHandle = fopen($displayFile, "w+"); if(!$displayFileHandle){ $resp[] = false; $resp[] = "Failed to create $jobNameDirPath. Please try again."; Scheduler::Log("Failed to open backup set file " . $jobNameDirPath . " : " . customErrorMsg()); echo json_encode($resp); exit; } if(count($_POST['chk_group'])>0){ $itemType = $_POST['itemType']; $itemSize = $_POST['itemSize']; $itemLModf = $_POST['itemLModf']; $cnt =0; foreach($_POST['chk_group'] as $dirPath){ $dirPath = phpRealEscapeString($dirPath); $itemLModfVal = $itemLModf[$cnt]; if($job_type_val != 0) { if($itemLModfVal != "undefined") { $date = strtotime($itemLModfVal); $itemLModfVal = date("D M j H:i:s Y",$date); } } fwrite($displayFileHandle, $dirPath."\n".$itemType[$cnt]."\n".$itemSize[$cnt]."\n".$itemLModfVal."\n"); $cnt++; } } fclose($displayFileHandle); @chmod($displayFile, $permissionVal); $data["job_type"] = $jobType; Scheduler::AddJob($data, $jobType.'_'.$newJobName); $message = "Successfully Created the " . $_POST['jobType'] . " Job"; Scheduler::Log($message); $resp[] = true; $resp[] = $message; echo json_encode($resp); }