' . oc_('Submissions are closed.') . '
'; printFooter(); exit; } // File upload settings $uploadDir = $OC_configAR['OC_paperDir']; $extAR = $OC_configAR['OC_extar']; $fileNotice = ( isset($OC_configAR['OC_paperFldNote']) ? $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:') . '' . $err . $errInc . '
' . 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 = ocsql_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`=" . (int) $pid . ", `position`=" . (int) $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 = ''; // 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') . '
'; } } if (isset($OC_configAR['OC_subConfirmNotice'])) { if (preg_match("/<\w+>/", $OC_configAR['OC_subConfirmNotice'])) { // HTML? $confirmmsg .= oc_(preg_replace("/[\r\n]/", "", $OC_configAR['OC_subConfirmNotice'])); } else { $confirmmsg .= nl2br(oc_($OC_configAR['OC_subConfirmNotice'])); } } else { //T: [:code:] should be left untranslated $confirmmsg .= oc_('Thank you for your submission. Your submission ID number is [:sid:]. Please write this number down and include it in any communications with us.
Below is the information submitted. We have also emailed a copy to the submission contact. If you notice any problems or do not receive the email within 24 hours, please contact us.
[:formfields:]
'); } // Get and update notification template // ocIgnore included so poEdit picks up (DB) template translation //T: [:sid:] is the numeric submission ID $ocIgnoreSubject = oc_('Submission ID [:sid:]'); //T: [:OC_confName:] is the event name $ocIgnoreBody = oc_('Thank you for your submission to [:OC_confName:]. Below is a copy of the information submitted for your records. [:fields:]'); list($mailsubject, $mailbody) = oc_getTemplate('author-submit'); $templateExtraAR = array( 'sid' => $pid, 'fields' => $formFields ); $mailsubject = oc_replaceVariables($mailsubject, $templateExtraAR); $mailbody = oc_replaceVariables($mailbody, $templateExtraAR); if (oc_hookSet('author-submit-save')) { foreach ($GLOBALS['OC_hooksAR']['author-submit-save'] as $hook) { require_once $hook; } } // Set up confirmation $confirmmsg = preg_replace("/\[:sid:\]/", $pid, $confirmmsg); $confirmmsg = preg_replace("/\[:formfields:\]/", '