} ### POST actions ### if ($_POST['action'] == 'restore_all') { $warning = ""; $return = $_POST['return']; $return_url = $return == "archive" ? "archive.php" : ($return == "viewall" ? "viewall.php" : "index.php"); $command = "/xGDBvm/scripts/xGDB_RestoreAll.sh"; exec($command); header("Location: {$return_url}"); } elseif ($_POST['action'] == 'restore_one' && $_POST['id'] != '' && $_POST['xgdb'] != '') { $warning = ""; $id = intval($_POST['id']); // e.g. 1, the ID of the GDB requesting restoration $xgdb = $_POST['xgdb']; //e.g. GDB001, the GDBID of the GDB requesting restoration $xgdb = shell_args_whitelist($xgdb); // sanitize 2/26/15 $source_file = $_POST['source_file']; //e.g GDB002-[description-species].tar; The archive source may be the SAME numbered GDB archive as the current GDB, or (if specified by user and stored in xGDB_Log.Restore_From_OtherGDB) a DIFFERENT-numbered GDB archive.... $pattern = "/^(GDB\\d\\d\\d)(-\\S+)(\\.tar)\$/"; # Parse the GDB ID from the source filename if (preg_match($pattern, $source_file, $matches)) { $xgdb_source = $matches[1]; // e.g. GDB001 } else { $warning = "The archive source file is incorrectly named or missing, and it could not be loaded"; exit; } $id_source = intval(substr($xgdb_source, -3)); // e.g. 2 $return = $_POST['return'];
$file = $_POST['source_file']; # Restore_From_File (from Genomes.xGDB_Log), a filename e.g. GDB002-Description-Species.tar $file = shell_args_whitelist($file); $return = "archive.php"; $return_url = $return == 'view' ? "view.php?id={$id}" : "archive.php"; $command = "/xGDBvm/scripts/xGDB_DeleteOneArchive.sh {$xgdb} {$id} {$file} >> /tmp/log & "; exec($command); header("Location: {$return_url}"); } elseif ($_POST['action'] == 'copy_one') { $warning = ""; $xgdb = $_POST['xgdb']; $xgdb = shell_args_whitelist($xgdb); $id = intval($_POST['id']); $file = $_POST['source_file']; # Restore_From_File (from Genomes.xGDB_Log), a filename e.g. GDB002-Description-Species.tar $file = shell_args_whitelist($file); $return_url = "archive.php"; $command = "/xGDBvm/scripts/xGDB_CopyOneArchive.sh {$xgdb} {$id} {$file} >> /tmp/log & "; exec($command); header("Location: {$return_url}"); } elseif ($_POST['action'] == 'delete_archive_all') { $warning = ""; $return = "archive.php"; $return_url = $return == 'view' ? "view.php?id={$id}" : "archive.php"; $command = "/xGDBvm/scripts/xGDB_DeleteArchiveAll.sh >> /tmp/log & "; exec($command); header("Location: {$return_url}"); } else { $warning = "Could not proceed. Unable to archive"; exit; }
$ID = $id; #post result. $DBid = 'GDB' . substr('00' . $id, -3); #calculated from unique ID $DBname = $data["DBname"]; $Status = $data["Status"]; $Organism = $data["Organism"]; $GSQ_CompResources = $data["GSQ_CompResources"]; $GTH_CompResources = $data["GTH_CompResources"]; ####### Database Creation ####### $Input_Data_Path = $data["Input_Data_Path"]; $input_path_trim = trim($Input_Data_Path); //trim spaces from ends $input_path = preg_replace('/\\s/', '_', $input_path_trim); //change any directory name spaces into "_" $input_path = shell_args_whitelist($input_path); //from validation_functions.inc.php 2/26/15 $GFF_Type = $data["GFF_Type"]; $gff_type = $GFF_Type == "CpGAT" ? "standard" : "other"; //specifies gff3 file type, whether CpGAT generated or "other". ####### GSQ Parameters ####### $RepeatMask_Status = $data["RepeatMask_Status"]; $RepeatMask_File = $data["RepeatMask_File"]; $Species_Model = $data["Species_Model"]; $Alignment_Stringency = $data["Alignment_Stringency"]; ####### GSQ Parameters ####### $Gth_Species_Model = $data["Gth_Species_Model"]; ######## CpGAT ######## $CpGAT_Status = $data["CpGAT_Status"]; $CpGAT_ReferenceProt_File = $data["CpGAT_ReferenceProt_File"]; $CpGAT_BGF = $data["CpGAT_BGF"];