View This Submission | View All Submissions


'; } elseif (! $OC_statusAR['OC_upload_open']) { // Check that we're still open warn('Files are no longer being accepted'); } // Check whether this is a submission if (isset($_POST['submit']) && ($_POST['submit'] == "Upload File")) { if ($chair && !validToken('chair')) { warn('Invalid submission'); } // Check inputs if (!preg_match("/^\d+$/",$_POST['pid']) || (! $chair && empty($_POST['pwd'])) || empty($_FILES['paper']['name']) || ! in_array($_POST['format'], $OC_configAR['OC_extar']) ) { warn('Please go back and fill in all fields.'); } // Set PID to intval in case of leading 0's $usepid = intval($_POST['pid']); // Retrieve pwd & format $pq = "SELECT `format`, `password` FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`='".$usepid."'"; $pr = ocsql_query($pq) or err("Unable to upload file (" . mysql_errno() . ")"); if (mysql_num_rows($pr) != 1) { warn("Unable to find submission ID ".$usepid); } $pl = mysql_fetch_array($pr); // Valid pid/pwd?; check for chair pwd first to save db call if (! $chair && (! OCC_CHAIR_PWD_TRUMPS || (hashPassword($_POST['pwd'], $OC_configAR['OC_chair_pwd']) != $OC_configAR['OC_chair_pwd'])) && (! defined('OCC_SUPERCHAIR_PASSWORD') || (hashPassword($_POST['pwd'], OCC_SUPERCHAIR_PASSWORD) != OCC_SUPERCHAIR_PASSWORD)) && (hashPassword($_POST['pwd'], $pl['password']) != $pl['password']) && (md5($_POST['pwd']) != $pl['password']) ) { warn('Password entered is not valid for submission ID '.$usepid); } // Was a paper successfully loaded & filesize > 0? if (!isset($_FILES['paper']['error']) || $_FILES['paper']['error'] || ! is_uploaded_file($_FILES['paper']['tmp_name']) || ($_FILES['paper']['size'] <= 0)) { warn('The file failed to load. Please go back and try again. If the problem persists, contact the Program Chair'); } if (oc_hookSet('author-upload-validate')) { foreach ($GLOBALS['OC_hooksAR']['author-upload-validate'] as $hook) { require_once $hook; } } // Delete old file? $oldFileName = $OC_configAR['OC_paperDir'] . $usepid . '.' . $pl['format']; if (is_file($oldFileName)) { unlink($oldFileName); } // Move new file $err = 0; $newFileName = $OC_configAR['OC_paperDir'] . $usepid . '.' . $_POST['format']; // Check whether file uploaded if (is_uploaded_file($_FILES['paper']['tmp_name']) && move_uploaded_file($_FILES['paper']['tmp_name'],$newFileName) ) { // Update file permissions chmod($newFileName, 0666); $confirmmsg = 'Submission ID ' . $usepid . ' has been uploaded.'; // Set lastupdate date, and format if needed $eq = "UPDATE " . OCC_TABLE_PAPER . " SET lastupdate='" . date("Y-m-d") . "'"; // also update format if changed if ($_POST['format'] != $pl['format']) { $eq .= ", format='".$_POST['format']."'"; } $eq .= " WHERE paperid='".$usepid."'"; if (!ocsql_query($eq)) { $confirmmsg .= "However, we were unable to update the database (" . mysql_errno() . ").\n"; $err = 1; } // Send email confirmation sendEmail(NULL, "Submission ID " . $usepid . " file uploaded", $confirmmsg, $OC_configAR['OC_notifyAuthorUpload']); if (!$err) { print $confirmmsg; } else { err($confirmmsg); } } else { // file failed to upload or move properly print 'The file failed to load properly. Please email it directly to the Program Chair


'; } printFooter(); exit; } print '

'; if ($chair) { print ' '; } print ''; if (! $chair) { print ' '; } print '
Submission ID: ( forgot ID? )
Password: ( forgot password? )
File:     Format: '; if (count($OC_configAR['OC_extar']) == 1) { # Only accept one format? print $OC_formatAR[$OC_configAR['OC_extar'][0]] . ' only

'; } else { print '

\n"; } print ' ' . $OC_configAR['OC_paperFldNote'] . '
File limit is ' . $OC_maxFileSize . '. If your file is larger than ' . $OC_maxFileSize . ', leave the File field empty and contact the Program Chair.

'; printFooter(); ?>