List Files Directory

'; $format = $extAR[0]; if (isset($_POST['submit']) && ($_POST['submit'] == "Set Format")) { // Check for valid submission if (!validToken('chair')) { warn('Invalid submission'); } // Validate fields if (!preg_match("/^\d+$/",$_POST['id'])) { // check for valid paper ID format $e = "Invalid submission ID"; } elseif (!in_array($_POST['format'], $extAR)) { // check for valid paper format $e = "File format not in list of accepted formats"; } else { // check paper exists $q = "SELECT `" . $formatDBFldName . "` FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`='" . $_POST['id'] . "'"; $r = ocsql_query($q) or err("Unable to retrieve submission ID " . $_POST['id']); if (mysql_num_rows($r) != 1) { $e = "Submission ID not found"; } else { // rename file? only if file name w/new ext does not exist (but w/old ext does) $l = mysql_fetch_array($r); if (in_array($l[$formatDBFldName], $extAR)) { $oldFileName = $uploadDir . $_POST['id'] . '.' . $l[$formatDBFldName]; $newFileName = $uploadDir . $_POST['id'] . '.' . $_POST['format']; if (!oc_isFile($newFileName) && oc_isFile($oldFileName)) { oc_renameFile($oldFileName, $newFileName) or err("Unable to update file name"); } else { print '

Failed to update file name

'; } } // update format in db $q = "UPDATE `" . OCC_TABLE_PAPER . "` SET `" . $formatDBFldName . "`='" . safeSQLstr($_POST['format']) . "' WHERE `paperid`='" . safeSQLstr($_POST['id']) . "'"; ocsql_query($q) or err("Unable to update submission format"); print '

File format has been updated

'; } } } if (!empty($e)) { print '

' . $e . "

\n"; } print '
'; if (oc_hookSet('chair-set_format-formtop')) { foreach ($GLOBALS['OC_hooksAR']['chair-set_format-formtop'] as $hook) { require_once $hook; } } print '
Submission ID:
Format:
 

This will set the submission\'s file format in the database.
Also, if a file with the new extension does not already exist,
the file is renamed from the old format extension to the new.

'; printFooter(); ?>