' . oc_('Submissions are closed.') . '

'; printFooter(); exit; } // File upload settings $uploadDir = $OC_configAR['OC_paperDir']; $extAR = $OC_configAR['OC_extar']; $fileNotice = $OC_configAR['OC_paperFldNote']; $formatDBFldName = 'format'; $fileFldName = 'File'; if (oc_hookSet('author-submit-preprocess')) { foreach ($GLOBALS['OC_hooksAR']['author-submit-preprocess'] as $hook) { require_once $hook; } } require_once OCC_FORM_INC_FILE; require_once OCC_SUBMISSION_INC_FILE; // Check whether this is a submission if (isset($_POST['submit'])) { $err = ''; $errInc = ''; $qfields = array(); // fields to insert into submission table $afields = array(); // fields to insert into authors table $tfields = array(); // fields to insert into topics table $fileUploaded = false; require_once 'submission-validate.inc'; // errors? if (!empty($err)) { print '

' . oc_('Please check the following:') . '


'; // remove uploaded file? if (isset($_FILES['file']['tmp_name']) && is_file($_FILES['file']['tmp_name'])) { unlink($_FILES['file']['tmp_name']); } } else { // Check that paper hasn't been submitted yet; if it has notify author and bail $q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "` WHERE `" . OCC_TABLE_PAPER . "`.`title`='" . safeSQLstr($_POST['title']) . "' AND `" . OCC_TABLE_AUTHOR . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` AND `" . OCC_TABLE_AUTHOR . "`.`position`=`" . OCC_TABLE_PAPER . "`.`contactid` AND `" . OCC_TABLE_AUTHOR . "`.`name_last`='" . safeSQLstr($_POST['name_last'.$_POST['contactid']]) . "'"; $r = ocsql_query($q) or err(oc_('Unable to verify whether submission has already been made')); if (mysql_num_rows($r) > 0) { print '

' . oc_('This submission appears to already have been made; please check your email for a confirmation. '); if ($OC_statusAR['OC_edit_open']) { print sprintf(oc_('You may review or edit the submission here.'), 'edit.php') . ' '; } print oc_('Please contact the Chair with any questions.') . '

'; printFooter(); exit; } $backupMsg = ''; // add paper $q = "INSERT INTO `" . OCC_TABLE_PAPER . "` SET `submissiondate`='" . safeSQLstr(date("Y-m-d")) . "', `lastupdate`='" . safeSQLstr(date("Y-m-d")) . "'"; foreach ($qfields as $qid => $qval) { $q .= ", `" . $qid . "`=" . $qval; } $r = ocsql_query($q) or err(oc_('unable to process submission')); $backupMsg .= "$q\n\n"; // get paper ID $pid = mysql_insert_id() or err(oc_('unable to get submission ID')); // add authors foreach ($afields as $qid => $qar) { $q = "INSERT INTO `" . OCC_TABLE_AUTHOR . "` SET `paperid`=" . $pid . ", `position`=" . $qid; foreach ($qar as $qqid => $qqval) { $q .= ", `" . $qqid . "`=" . $qqval; } $r = ocsql_query($q) or err(oc_('unable to add one or more authors, but submission added. Please edit submission.')); $backupMsg .= "$q\n\n"; } // add topic(s) if (!empty($tfields)) { $q = "INSERT INTO `" . OCC_TABLE_PAPERTOPIC . "` (`paperid`,`topicid`) VALUES"; foreach ($tfields as $t) { $q .= " ($pid,$t),"; } $r = ocsql_query(rtrim($q, ',')) or err(oc_('unable to add submission topic, but submission and authors added')); $backupMsg .= "$q\n\n"; } if (!empty($OC_configAR['OC_subBackupEmail'])) { sendEmail($OC_configAR['OC_subBackupEmail'], "Submission ID $pid SQL", $backupMsg); } $formFields = oc_('Submission ID') . ": " . $pid . "\n\n" . oc_genFieldMessage($OC_submissionFieldSetAR, $OC_submissionFieldAR, $_POST); // confirm it $confirmmsg = '

' . sprintf('

' . oc_('Thank you for your submission. Your submission ID number is %s. Please write this number down and include it in any communications with us.') . '

', $pid); $confirmmsg .= sprintf('

' . oc_('Below is the information submitted. We have also emailed a copy to the contact author. If you notice any problems or do not receive the email within 24 hours, please contact the Chair.') . '

', $OC_configAR['OC_pcemail'], $pid); // File Uploaded? if ($fileUploaded) { $fileName = $uploadDir . $pid . '.' . $_POST['format']; if (oc_saveFile($_FILES['file']['tmp_name'], $fileName, $_POST['format'])) { $formFields .= "\n\n" . oc_('File') . ':' . oc_('uploaded') . "\n"; // confirm to user // update format $fq = "UPDATE `" . OCC_TABLE_PAPER . "` SET `" . $formatDBFldName . "`='" . safeSQLstr($_POST['format']) . "' WHERE `paperid`='" . $pid . "' LIMIT 1"; ocsql_query($fq); // note no error check } else { $formFields .= "\n\n" . oc_('File') . ':' . oc_('NOT uploaded') . "\n"; // confirm to user $confirmmsg .= '

' . sprintf(oc_('Your file failed to load properly. Please try uploading just the file or contact the Chair.'), 'upload.php') . '

'; } } elseif ( $OC_configAR['OC_includeSubmissionUploadLink'] && ! $OC_configAR['OC_includeSubmissionUploadField'] ) { $confirmmsg .= '

>>> ' . oc_('Proceed to upload file') . '


'; } $mailbody = sprintf(oc_('Thank you for your submission to %s. Below is a copy of the information submitted for your records.'), $OC_configAR['OC_confName']) . "\n\n" . $formFields; if (oc_hookSet('author-submit-save')) { foreach ($GLOBALS['OC_hooksAR']['author-submit-save'] as $hook) { require_once $hook; } } print $confirmmsg . '
' . safeHTMLstr($formFields) . '
'; sendEmail($contactemail, sprintf(oc_('Submission ID %s'), $pid), $mailbody, $OC_configAR['OC_notifyAuthorSubmit']); printFooter(); exit; } // else no errors } print '
' . (preg_match("/\<(?:p|br) ?\/?\>/", $OC_configAR['OC_paperSubNote']) ? $OC_configAR['OC_paperSubNote'] : nl2br($OC_configAR['OC_paperSubNote'])) . '


'; oc_displayFieldSet($OC_submissionFieldSetAR, $OC_submissionFieldAR, $_POST); if (oc_hookSet('author-submit-fields')) { foreach ($GLOBALS['OC_hooksAR']['author-submit-fields'] as $hook) { require_once $hook; } } print '
' . oc_('Please check over your entries, making sure everything is filled out. When ready, click on the Make Submission button below once.') . '

'; printFooter(); ?>