From 0a18b88eba09f03e9e0532b23597114859e99e03 Mon Sep 17 00:00:00 2001
From: Your Name
+';
+
+printFooter();
+
+?>
diff --git a/author/edit.php b/author/edit.php
new file mode 100644
index 0000000..b2928f0
--- /dev/null
+++ b/author/edit.php
@@ -0,0 +1,407 @@
+' . oc_('Submission edits are no longer available.') . ' View This Submission | View All Submissions ' . oc_('Please check the following:') . ' ' . safeHTMLstr(oc_('The submission has been updated. Below is the information submitted.')) . ' ' . sprintf(oc_('A copy has also been emailed to the contact author. If you notice any problems or do not receive the email within 24 hours, please contact the Chair.'), urlencode($OC_configAR['OC_pcemail']), urlencode($_POST['pid'])) . ' ' . sprintf(oc_('There is a %d hour limit to complete updates'), $editTimeout) . '' . $err . $errInc . '
';
+ } else {
+ $q = "UPDATE `" . OCC_TABLE_PAPER . "` SET `lastupdate`='" . safeSQLstr(date("Y-m-d")) . "', `edittoken`=NULL, `edittime`=NULL";
+ foreach ($qfields as $qid => $qval) {
+ $q .= ", `" . $qid . "`=" . $qval;
+ }
+ $q .= " WHERE `paperid`=" . (int) $_POST['pid'];
+ $r = ocsql_query($q) or err(oc_('Unable to update submission'));
+
+ $q = "DELETE FROM `" . OCC_TABLE_AUTHOR . "` WHERE `paperid`=" . (int) $_POST['pid'];
+ $r = ocsql_query($q) or err(oc_('Unable to update authors or topics (2)'));
+ foreach ($afields as $qid => $qar) {
+ $q = "INSERT INTO `" . OCC_TABLE_AUTHOR . "` SET `paperid`=" . (int) $_POST['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 or topics.'));
+ }
+
+ if (!empty($tfields)) {
+ $q = "DELETE FROM `" . OCC_TABLE_PAPERTOPIC . "` WHERE `paperid`='" . safeSQLstr($_POST['pid']) . "'";
+ $r = ocsql_query($q) or err(oc_('Unable to update topics'));
+ $q = "INSERT INTO `" . OCC_TABLE_PAPERTOPIC . "` (`paperid`,`topicid`) VALUES";
+ foreach ($tfields as $t) {
+ $q .= " (" . safeSQLstr($_POST['pid']) . ",$t),";
+ }
+ $r = ocsql_query(rtrim($q, ',')) or err(oc_('Unable to add topics'));
+ }
+
+ // Get and update notification template
+ // ocIgnore included so poEdit picks up (DB) template translation
+ //T: [:sid:] is the numeric submission ID
+ $ocIgnoreSubject = oc_('Submission Update ID [:sid:]');
+ $ocIgnoreBody = '[:fields:]'; // don't bother with translation
+ $fields = oc_genFieldMessage($OC_submissionFieldSetAR, $OC_submissionFieldAR, $_POST);
+ list($mailsubject, $mailbody) = oc_getTemplate('author-edit');
+ $templateExtraAR = array(
+ 'sid' => $_POST['pid'],
+ 'fields' => (oc_('Submission ID') . ': ' . $_POST['pid'] . "\n\n" . $fields)
+ );
+ $mailsubject = oc_replaceVariables($mailsubject, $templateExtraAR);
+ $mailbody = oc_replaceVariables($mailbody, $templateExtraAR);
+
+ // Set up confirmation
+ $confirmmsg = '' . safeHTMLstr($fields) . '
';
+ if (! $chair) {
+ $confirmmsg .= '
' . sprintf(oc_("We did not find any submissions where the contact author's email is %s"), safeHTMLstr($_POST['email'])) . '.
'; + printFooter(); + exit; + } + else { + $msg = "\n" . sprintf(oc_('Per your request, here is a list of submissions made to the %s OpenConf system with you listed as the contact:'), $OC_configAR['OC_confName']) . "\n"; + + while ($e = ocsql_fetch_array($r)) { + $msg .= ' +ID: ' . $e['paperid'] . ' +Title: ' . $e['title'] . ' + '; + } + sendEmail($_POST['email'], oc_('List of submissions made'), $msg, $OC_configAR['OC_notifyAuthorEmailPapers']); + print oc_('We have emailed the list of submissions for which you are the contact author.'); + printFooter(); + exit; + } +} +else { + print '' . oc_('Please enter your email address below and click on Email Submissions. We will then email you a list of submissions for which you are the contact author.') . "
\n"; +} + +print ' + +'; + +if (oc_hookSet('author-email_papers-bottom')) { + foreach ($GLOBALS['OC_hooksAR']['author-email_papers-bottom'] as $hook) { + require_once $hook; + } +} + +printFooter(); + +?> diff --git a/author/index.html b/author/index.html new file mode 100644 index 0000000..e69de29 diff --git a/author/index.php b/author/index.php new file mode 100644 index 0000000..e69de29 diff --git a/author/paper.php b/author/paper.php new file mode 100644 index 0000000..de5f4a7 --- /dev/null +++ b/author/paper.php @@ -0,0 +1,93 @@ + + +| ( ' . oc_('forgot ID?') . ' ) | |
| ( ' . oc_('forgot password?') . ' ) |
' . oc_("Submission ID or contact author's email invalid.") . ' ' . sprintf(oc_('Please contact the Chair.'), $OC_configAR['OC_pcemail'], 'Unable to Reset Password') . '
'; + printFooter(); + exit; + } + else { + $newpwd = oc_password_generate(); + $q2 = "UPDATE `" . OCC_TABLE_PAPER . "` SET `password`='" . safeSQLstr(oc_password_hash($newpwd)) . "' WHERE `paperid`='" . safeSQLstr($_POST['pid']) . "'"; + $r2 = ocsql_query($q2) or err(oc_('Unable to update password')); + $msg = "\n" . sprintf(oc_('Per your request, we have issued you a new password for accessing the %s OpenConf system. The new password is:'), $OC_configAR['OC_confName']) . "\n " . $newpwd . "\n\n" . oc_('You may change this password by signing in to the OpenConf system and editing your submission.'); + sendEmail($_POST['email'], oc_('Author Password Reset'), $msg, $OC_configAR['OC_notifyAuthorReset']); + print oc_('We have emailed you a new password.'); + printFooter(); + exit; + } +} +else { + print '' . oc_('Please enter your submission id and the contact author\'s email below') . "
\n"; +} + +print ' + + +'; + printFooter(); + + if (oc_hookSet('author-status-bottom')) { + foreach ($GLOBALS['OC_hooksAR']['author-status-bottom'] as $hook) { + require_once $hook; + } + } + +} + +exit; + +?> \ No newline at end of file diff --git a/author/submission-validate.inc b/author/submission-validate.inc new file mode 100644 index 0000000..b19cc4f --- /dev/null +++ b/author/submission-validate.inc @@ -0,0 +1,152 @@ + $fs) { + if ($fsid != 'fs_authors') { // non-author field + foreach ($fs['fields'] as $fid) { + if (!preg_match("/^(?:file|password\d)$/", $fid)) { // skip validation of special fields + oc_validateField($fid, $GLOBALS['OC_submissionFieldAR'], $qfields, $err); + } + } + } else { // author field + for ($a=1; $a<=$OC_configAR['OC_authorsMax']; $a++) { + if (!isset($_POST['name_last' . $a]) || empty($_POST['name_last' . $a])) { + if ($firstBlankAuthor == 0) { + $firstBlankAuthor = $a; + } + if ((isset($_POST['name_first' . $a]) && !empty($_POST['name_first' . $a])) + || (isset($_POST['organization' . $a]) && !empty($_POST['organization' . $a])) + || (isset($_POST['email' . $a]) && !empty($_POST['email' . $a])) + ) { + $err .= '' . 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("/\<(?:p|br) ?\/?\>/", $OC_configAR['OC_subConfirmNotice'])) { // HTML? + $confirmmsg .= oc_($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:\]/", '+'; + +if (oc_hookSet('author-upload-bottom')) { + foreach ($GLOBALS['OC_hooksAR']['author-upload-bottom'] as $hook) { + require_once $hook; + } +} + +printFooter(); + +?> diff --git a/author/view.inc b/author/view.inc new file mode 100644 index 0000000..090f01a --- /dev/null +++ b/author/view.inc @@ -0,0 +1,63 @@ + $aval) { + if (preg_match("/^(?:paperid|position)$/", $akey)) { continue; } + $spl[$akey . $apos] = $aval; + } +} +$oc_authorNum = $apos; + +// Get topics +$qt = "SELECT `topicid` FROM `" . OCC_TABLE_PAPERTOPIC . "` WHERE `paperid`='" . safeSQLstr($pid) . "'"; +$rt = ocsql_query($qt) or err(oc_('Unable to retrieve topic(s) information')); +$spl['topics'] = array(); +while ($t = ocsql_fetch_array($rt)) { + $spl['topics'][] = $t['topicid']; +} + +require_once OCC_FORM_INC_FILE; +require_once OCC_SUBMISSION_INC_FILE; + +print ' +
| ' . safeHTMLstr(oc_('Submission ID')) . ': | ' . safeHTMLstr($pid) . ' |
|---|
'; + printFooter(); + exit; +} + +// Is this a post? +if (isset($_POST['ocaction']) && ($_POST['ocaction'] == 'Withdraw Submission')) { + // Check for paper ID & password + if (! isset($_POST['pid']) || + ! preg_match("/^\d+$/", $_POST['pid']) || + ! isset($_POST['pwd']) || + empty($_POST['pwd']) + ) { + warn(oc_('Submission ID or password entered is incorrect')); + printFooter(); + exit; + } + + $pq = "SELECT `" . OCC_TABLE_PAPER . "`.`title`, `" . OCC_TABLE_PAPER . "`.`password`, `" . OCC_TABLE_AUTHOR . "`.`email` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "` WHERE `" . OCC_TABLE_PAPER . "`.`paperid`='" . safeSQLstr($_POST['pid']) . "' AND `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` AND `" . OCC_TABLE_PAPER . "`.`contactid`=`" . OCC_TABLE_AUTHOR . "`.`position`"; + $pr = ocsql_query($pq) or err("Unable to retrieve submission"); + if (ocsql_num_rows($pr) != 1) { + warn(oc_('Submission ID or password entered is incorrect')); + printFooter(); + exit; + } + $pl = ocsql_fetch_array($pr); + if (!oc_password_verify($_POST['pwd'], $pl['password'])) { + warn(oc_('Submission ID or password entered is incorrect')); + printFooter(); + exit; + } + + // Withdraw submission + if (withdrawPaper($_POST['pid'], OCC_WORD_AUTHOR)) { + $mailto = ''; + if ($OC_configAR['OC_emailAuthorRecipients'] == 1) { + $ar = ocsql_query("SELECT `email` FROM `" . OCC_TABLE_AUTHOR . "` WHERE `paperid`='" . safeSQLstr($_POST['pid']) . "'") or err('Unable to retrieve author email addresses'); + while ($al = ocsql_fetch_assoc($ar)) { + $mailto .= $al['email'] . ','; + } + $mailto = rtrim($mailto, ','); + } + + deletePaper($_POST['pid'], false); + print '
' . oc_('Your submission has been withdrawn. If this is not what you intended to do, please contact the Chair.') . '
'; + // Notify via email + // ocIgnore included so poEdit picks up (DB) template translation + //T: [:sid:] is the numeric submission ID + $ocIgnoreSubject = oc_('Submission Withdraw - ID [:sid:]'); + $ocIgnoreBody = oc_('The submission below has been withdrawn at the author\'s request. If you did not intend to withdraw the submission, please reply back. + +[:submission:]'); + list($mailsubject, $mailbody) = oc_getTemplate('author-withdraw'); + $templateExtraAR = array( + 'sid' => $_POST['pid'], + 'submission' => oc_('Submission ID') . ': ' . $_POST['pid'] . "\n" . oc_('Title') . ': ' . $pl['title'] + ); + $mailsubject = oc_replaceVariables($mailsubject, $templateExtraAR); + $mailbody = oc_replaceVariables($mailbody, $templateExtraAR); + + if (empty($mailto)) { + $mailto = $pl['email']; + } + sendEmail($mailto, $mailsubject, $mailbody, $OC_configAR['OC_notifyAuthorWithdraw']); + } else { + print '' . oc_('We encountered a problem withdrawing your submission. Please contact the Chair.') . '
'; + } + + printFooter(); + exit; +} // if submit + +// display sub id/password form +print ' + + +'; + +if (oc_hookSet('author-withdraw-bottom')) { + foreach ($GLOBALS['OC_hooksAR']['author-withdraw-bottom'] as $hook) { + require_once $hook; + } +} + +printFooter(); + +exit; + +?> diff --git a/chair/assign_advocates.php b/chair/assign_advocates.php new file mode 100644 index 0000000..cddec0d --- /dev/null +++ b/chair/assign_advocates.php @@ -0,0 +1,318 @@ +Please go back and select at least one submission and one advocate'; + } else { + // Get conflicts? + if ($OC_configAR['OC_allowConflictOverride'] && isset($_POST['conflict_override']) && ($_POST['conflict_override'] == 1)) { + $conflictAR = array(); + } else { + $conflictAR = getConflicts(); + } + // Assign advocates (and reviewers?) + // NOTE: Although a foreach is used below for future expansion, there should only be 1 advocate + $advocateAssignmentAR = array(); // keep track of advocates w/successful assignments + $submissionAssignmentAR = array(); // keep track of submissions assigned + foreach ($_POST['advocates'] as $i) { + if (!is_numeric($i)) { err('Invalid advocate ID: ' . safeHTMLstr($i)); } + foreach ($_POST['papers'] as $j) { + if (!is_numeric($j)) { err('Invalid submission ID: ' . safeHTMLstr($j)); } + // Check for conflict + if (in_array("$j-$i",$conflictAR)) { + print "
! Submission $j is in conflict with advocate $i.
\n"; + continue; + } + // Delete current assignment? + if (isset($_POST['assignment_override']) && ($_POST['assignment_override'] == 1)) { + oc_deleteAssignments($j, null, 'advocate'); + } + // Make assignment + $q = "INSERT INTO `" . OCC_TABLE_PAPERADVOCATE . "` (`paperid`,`advocateid`) VALUES ('" . safeSQLstr($j) . "','" . safeSQLstr($i) . "')"; + ocsql_query($q); + if (($merr = ocsql_errno()) != 0) { + if ($merr == 1062) { // Duplicate entry + print "! Submission $j already has an advocate assigned. Please delete the existing advocate first before assigning a new one, or select Override Current Assingment.
\n"; + } else { + print "!! Error assigning submission $j to advocate $i
\n"; + } + } else { + print "Submission $j assigned to advocate $i.\n"; + if (!isset($advocateAssignmentAR[$i])) { + $advocateAssignmentAR[$i] = array(); + } + $advocateAssignmentAR[$i][] = $j; + if (!in_array($j, $submissionAssignmentAR)) { + $submissionAssignmentAR[] = $j; + } + // Also assign a reviewer? + if (isset($_POST['asrev']) && ($_POST['asrev'] == "yes")) { + $q = "INSERT INTO `" . OCC_TABLE_PAPERREVIEWER . "` (`paperid`,`reviewerid`,`assigned`) VALUES ('" . safeSQLstr($j) . "','" . safeSQLstr($i) . "','" . safeSQLstr(date('Y-m-d')) . "')"; + ocsql_query($q); + if (($merr = ocsql_errno()) != 0) { + if ($merr == 1062) { // Duplicate entry + print "
! Submission $j has already been assigned reviewer $i.
\n"; + } else { + print "!! Error assigning submission $j to reviewer $i
\n"; + } + } + } + } + } + } + + print 'Notification sent to ' . safeHTMLstr($l['name']) . ' (' . safeHTMLstr($l['reviewerid']) . ')
'; + } else { + print '!! Unable to email notification to ' . safeHTMLstr($l['name']) . ' (' . safeHTMLstr($l['reviewerid']) . ')
'; + } + } + print ''; + } else { + if (!isset($_GET['s']) || ($_GET['s'] == "id")) { + $idsortstr = 'ID'; + $nsortstr = 'Name'; + $rsortstr = 'No. Submission'; + $legend = "[ Advocate ID - $nsortstr ($rsortstr) ]"; + $sortby = "`" . OCC_TABLE_REVIEWER . "`.`reviewerid`"; + } elseif ($_GET['s'] == "reviews") { + $rsortstr = 'No. Reviews'; + $idsortstr = 'ID'; + $nsortstr = 'Name'; + $legend = "[ No. Submissions - Advocate $nsortstr - $idsortstr ]"; + $sortby = "`acount`, `" . OCC_TABLE_REVIEWER . "`.`name_last`, `" . OCC_TABLE_REVIEWER . "`.`name_first`"; + } else { + $idsortstr = 'ID'; + $nsortstr = 'Name'; + $rsortstr = 'No. Submissions'; + $legend = "[ Advocate Name - $idsortstr ($rsortstr) ]"; + $sortby = "`" . OCC_TABLE_REVIEWER . "`.`name_last`, `" . OCC_TABLE_REVIEWER . "`.`name_first`"; + } + $rq = "SELECT `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, CONCAT_WS(' ', `" . OCC_TABLE_REVIEWER . "`.`name_first`, `" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, count(`" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`) AS `acount` FROM `" . OCC_TABLE_REVIEWER . "` LEFT JOIN `" . OCC_TABLE_PAPERADVOCATE . "` ON `" . OCC_TABLE_REVIEWER . "`.`reviewerid`=`" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid` WHERE `" . OCC_TABLE_REVIEWER . "`.`onprogramcommittee`='T' GROUP BY `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, `name` ORDER BY $sortby"; + $rr = ocsql_query($rq) or err("Unable to get program committee members"); + // Get pad size for advocate id's - yes, we really need the max id, but this should do:) + $rsize = oc_strlen((string) ocsql_num_rows($rr)); + if (ocsql_num_rows($rr) == 0) { + print 'No program committee members have signed up yet
'; + } else { + // display filter? + $subSort = false; + $revSort = false; + $subFilterAR = array(); + $revFilterAR = array(); + if (count($topicsAR) > 1) { + print ' +
Assignments have been made
+ + '; + unset($_SESSION['OPENCONFCHAIRVARS']['aAssignments']); + + printFooter(); + exit; +} + +// Check whether any reviewers or advocates assigned yet +$aq = "SELECT `paperid`, `advocateid` FROM `" . OCC_TABLE_PAPERADVOCATE . "`"; +$ar = ocsql_query($aq) or err("Unable to access database"); +$patot = ocsql_num_rows($ar); +$q = "SELECT count(*) as `rtot` FROM `" . OCC_TABLE_PAPERREVIEWER . "`"; +$r = ocsql_query($q) or err("Unable to access database"); +$rl = ocsql_fetch_array($r); +if (($patot > 0) || ($rl['rtot'] > 0)) { + print 'Advocates or Reviewers appear to have already been assigned. Existing advocate assignments will be deleted unless you choose Yes to Keep Existing Assignments below.
'; + $confirmOverride = true; +} else { + $confirmOverride = false; +} + +// Get number of papers and initialize paper count array +$pAR = array(); // paper advocate array +$pInfoAR = array(); // paper info array +$q = "SELECT `paperid`, `title`, `accepted`, `type` FROM `" . OCC_TABLE_PAPER . "` ORDER BY `paperid`"; +$r = ocsql_query($q) or err("Unable to get papers"); +if (($ptot = ocsql_num_rows($r)) == 0) { + warn('No submissions have been made yet.'); +} +while ($l=ocsql_fetch_array($r)) { + $pAR[$l['paperid']] = ""; + $pInfoAR[$l['paperid']] = array( + 'title' => $l['title'], + 'accepted' => $l['accepted'], + 'type' => $l['type'] + ); +} + +// Get number of advocates and initialize advocate count array +$aNameAR = array(); // advocate name array +$aAR = array(); // advocate papers array +$q = "SELECT `reviewerid`, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name` FROM `" . OCC_TABLE_REVIEWER . "` WHERE `onprogramcommittee`='T' ORDER BY `reviewerid`"; +$r = ocsql_query($q) or err("Unable to get advocates"); +if (($atot = ocsql_num_rows($r)) == 0) { + warn('No program committee members have signed up yet.'); +} +while ($l=ocsql_fetch_array($r)) { + $aAR[$l['reviewerid']] = array(); + $aNameAR[$l['reviewerid']] = $l['name']; +} + +// Get conflicts +$nAR = getConflicts(); + +// Calculate max # of papers each advocate should advocate (pronunciation test) +if (isset($_POST['ppa']) && preg_match("/^\d+$/",$_POST['ppa'])) { + $papersPerAdvocate = $_POST['ppa']; +} else { + $papersPerAdvocate = ceil($ptot/$atot); # +count($nAR) to $ptot ? +} + +// Set min # of papers each advocate should be assigned +if (isset($_POST['ppat']) && preg_match("/^\d+$/",$_POST['ppat'])) { + $ppaThreshold = $_POST['ppat']; +} else { + $ppaThreshold = floor($papersPerAdvocate/2); +} + +// Keep assignments already made? +if (!isset($_POST['keep']) || ($_POST['keep'] == 'Yes')) { + $confirmOverride = false; + if ($patot > 0) { + while ($al = ocsql_fetch_array($ar)) { + $pAR[$al['paperid']] = $al['advocateid']; + array_push($aAR[$al['advocateid']],$al['paperid']); + } + } +} + +// Get list of sub. types +$OC_activeSubTypeAR = array(); +$typer = ocsql_query("SELECT DISTINCT `type` FROM `" . OCC_TABLE_PAPER . "` WHERE `type` IS NOT NULL AND `type`!='' ORDER BY `type`") or err('Unable to retrieve submission types'); +while ($typel = ocsql_fetch_assoc($typer)) { + $OC_activeSubTypeAR[$typel['type']] = substr($typel['type'], 0, 50); +} + +// Algorithm to use +if (isset($_POST['algo']) && ctype_digit($_POST['algo'])) { + $algo = $_POST['algo']; +} else { + $algo = 0; // default to first defined algorithm above +} +// Run algo +if (isset($OC_algorithmAR[$algo]['include']) && is_file($OC_algorithmAR[$algo]['include'])) { + require_once $OC_algorithmAR[$algo]['include']; +} else { + err("Algorithm choice unknown"); + exit; +} + +// Remedy missing advocates by assigning advocates w/lowest #s (if set) +if (isset($_POST['remedy']) && in_array("random",$_POST['remedy'])) { + foreach (array_keys($pAR) as $k) { + if (oc_skipSubAssignment($k)) { + continue; + } + if (empty($pAR[$k])) { + // Create an ordered array of advocates w/least # of reviews + $acountAR = array(); + foreach (array_keys($aAR) as $k2) { + $acountAR[$k2] = count($aAR[$k2]); + } + asort($acountAR); + reset($acountAR); + // Assign advocate + while (key($acountAR) && empty($pAR[$k])) { + // check for no conflict + if (!in_array($k.'-'.key($acountAR),$nAR)) { + $pAR[$k] = key($acountAR); + array_push($aAR[key($acountAR)],$k); + } + next($acountAR); + } + } + } +} + + + +// Remember assignments +$_SESSION['OPENCONFCHAIRVARS']['aAssignments'] = $pAR; + +// Display form +print ' +Below you will find OpenConf\'s suggested advocate assignments. You may fine tune these automated assignments by changing the following options and clicking Re-Evaluate Assignments. Once you are satisfied, click the Make Assignments button to commit them to the database. You may manually add/delete advocates afterwards through the Assign Advocates Manually and List/Unassign Advocates menus.'; + +if (oc_moduleValid('oc_auto_assign')) { + print ' If instead of using this feature you would like assignments to be made automatically when a new submission is made, use the Auto Assign module.'; +} + +print '
+ + ++ +'; + +function fmtNumSpacing ($n,$dir="l") { + $sp = ""; + if ($n < 10) { $sp = " "; } + elseif ($n < 100) { $sp = " "; } + if ($dir=="l") { return($sp.$n); } + else { return($n.$sp); } +} + +function fmtStrSpacing ($str,$len) { + $a = substr($str,0,$len); + for ($i=oc_strlen($a); $i<$len; $i++) { + $a .= " "; + } + return $a; +} + +print ' +
| Suggested Assignments' . ((!isset($_POST['keep']) || ($_POST['keep'] == 'Yes')) ? ' including already assigned ' : '') . ' | ||
|---|---|---|
+ * Unable to assign advocate + +Click title for submission info (new window) + + +Submission ID (Title) (Advocate) +'; +foreach ($pAR as $k => $v) { + $tmpStr = fmtNumSpacing($k).' (' . safeHTMLstr(fmtStrSpacing($pInfoAR[$k]['title'], 20)) . ") ("; + if (!empty($v)) { + $tmpStr .= safeHTMLstr(fmtStrSpacing($pAR[$k] . "-" . $aNameAR[$pAR[$k]],15)); + print $tmpStr.")\n"; + } + else { + $tmpStr .= fmtStrSpacing("",15); + print '' . $tmpStr . ") *\n"; + } +} + + +print ' + | + * below threshold + +Click name for reviewer info (new window) +Place cursor on No. Submissions for assignments + +No. Submissions per Advocate ID (Name) +'; + +foreach ($aAR as $k => $v) { + $titleStr = "Submissions for Advocate $k - " . $aNameAR[$k] . ":\n\n"; + foreach ($v as $vv) { $titleStr .= "$vv - ". safeHTMLstr(substr($pInfoAR[$vv]['title'],0,40))."\n"; } + $tmpStr = '' . fmtNumSpacing(count($v)) . " - " . fmtNumSpacing($k) . '' . safeHTMLstr($titleStr) . ' (' . safeHTMLstr(fmtStrSpacing($aNameAR[$k],25)).")"; + if (count($v) <= $ppaThreshold) { print ''.$tmpStr." *\n"; } + else { print $tmpStr . "\n"; } +} + +print ' + | |
Assignments have been made
+ + '; + unset($_SESSION['OPENCONFCHAIRVARS']['pAssignments']); + + printFooter(); + exit; +} + +// Check whether any reviews assigned yet +$prq = "SELECT `paperid`, `reviewerid` FROM `" . OCC_TABLE_PAPERREVIEWER . "`"; +$prr = ocsql_query($prq) or err("Unable to access database"); +$prtot = ocsql_num_rows($prr); +if ($prtot > 0) { + print 'Reviews appear to have already been assigned. Existing reviews will be deleted unless you choose Yes to Keep Existing Assignments below.
'; + $confirmOverride = true; +} else { + $confirmOverride = false; +} + + +if (isset($_GET['timeout']) && ($_GET['timeout'] == 1) && isset($_SESSION['OPENCONFCHAIRVARS']['timeoutAR']) && is_array($_SESSION['OPENCONFCHAIRVARS']['timeoutAR'])) { + foreach($_SESSION['OPENCONFCHAIRVARS']['timeoutAR'] as $k => $v) { + if ($k == 'POST') { + foreach ($v as $pk => $pv) { + $_POST[$pk] = $pv; + } + } else { + $$k = $v; + } + } + unset($_SESSION['OPENCONFCHAIRVARS']['timeoutAR']); +} else { + // Assign PC members as reviewers? + $ppa = ''; + if (isset($_POST['pcrev']) && ($_POST['pcrev'] == 'Yes')) { + $onpc = ""; + // Set a diff max # of subs per advocate reviewer + if (isset($_POST['ppa']) && preg_match("/^\d+$/", $_POST['ppa'])) { + $ppa = $_POST['ppa']; + } + } else { + $onpc = " AND `" . OCC_TABLE_REVIEWER . "`.`onprogramcommittee`='F'"; + } + + // Get number of papers and initialize paper count array + $pAR = array(); // paper reviewers array + $pInfoAR = array(); // paper info array + $q = "SELECT `paperid`, `title`, `accepted`, `type` FROM `" . OCC_TABLE_PAPER . "` ORDER BY `paperid`"; + $r = ocsql_query($q) or err("Unable to get submissions"); + if (($ptot = ocsql_num_rows($r)) == 0) { + warn('No submissions have been made yet.'); + } + while ($l=ocsql_fetch_array($r)) { + $pAR[$l['paperid']] = array(); + $pInfoAR[$l['paperid']] = array( + 'title' => $l['title'], + 'accepted' => $l['accepted'], + 'type' => $l['type'] + ); + } + + // Get number of reviewers and initialize reviewer count arrays + $rAR = array(); // reviewer papers array + $rNameAR = array(); // reviewer name array + $pcAR = array(); // program committee array + $q = "SELECT `reviewerid`, CONCAT_WS(' ', `name_first`, `name_last`) AS `name`, `onprogramcommittee` FROM `" . OCC_TABLE_REVIEWER . "` ORDER BY `reviewerid`"; + $r = ocsql_query($q) or err("Unable to get reviewers"); + if (($rtot = ocsql_num_rows($r)) == 0) { + warn('No reviewers have signed up yet.'); + } + while ($l=ocsql_fetch_array($r)) { + $rAR[$l['reviewerid']] = array(); + $rNameAR[$l['reviewerid']] = $l['name']; + if ($l['onprogramcommittee'] == 'T') { $pcAR[] = $l['reviewerid']; } + } + + // Revise rtot based on whether pc members assigned as reviewers + if (!isset($_POST['pcrev']) || ($_POST['pcrev'] == 'No')) { + $rtot -= count($pcAR); + } + + // Get conflicts + $nAR = getConflicts(); + + // Calculate # of reviewers per paper + if (isset($_POST['rpp']) && preg_match("/^\d+$/",$_POST['rpp'])) { + $reviewersPerPaper = $_POST['rpp']; + } else { + if (($rppavg=round($rtot/$ptot)) > $OC_configAR['OC_minReviewersPerPaper']) { + $reviewersPerPaper = $rppavg; + } else { + $reviewersPerPaper = $OC_configAR['OC_minReviewersPerPaper']; + } + } + + // Calculate max # of papers each reviewer should get assigned + if (isset($_POST['ppr']) && preg_match("/^\d+$/",$_POST['ppr'])) { + $papersPerReviewer = $_POST['ppr']; + #set below: $pprThreshold = $_POST['pprt']; + } else { + $totrevs = $rtot; + $papersPerReviewer = ceil((($ptot*$reviewersPerPaper)+count($nAR))/$totrevs); # possibly remove +count($nAR) + } + + // Set min # of paper each reviewer should be assigned + if (isset($_POST['pprt']) && preg_match("/^\d+$/",$_POST['pprt'])) { + $pprThreshold = $_POST['pprt']; + } else { + $pprThreshold = floor($papersPerReviewer/2); + } + + // Keep assignments already made? + if (!isset($_POST['keep']) || ($_POST['keep'] == 'Yes')) { + $confirmOverride = false; + if ($prtot > 0) { + while ($prl = ocsql_fetch_array($prr)) { + array_push($pAR[$prl['paperid']], $prl['reviewerid']); + array_push($rAR[$prl['reviewerid']], $prl['paperid']); + } + } + } + + // Add advocates as reviewers? + if ($OC_configAR['OC_paperAdvocates'] + && (!isset($_POST['advrev']) || empty($_POST['advrev']) || ($_POST['advrev'] == "Yes")) + ) { + $q = "SELECT `paperid`, `advocateid` FROM `" . OCC_TABLE_PAPERADVOCATE . "`"; + $r = ocsql_query($q) or err("Unable to get submissions' advocate"); + while ($l=ocsql_fetch_array($r)) { + if (oc_skipSubAssignment($l['paperid'])) { + continue; + } + if (!in_array($l['advocateid'], $pAR[$l['paperid']])) { + array_push($pAR[$l['paperid']], $l['advocateid']); + array_push($rAR[$l['advocateid']], $l['paperid']); + } + } + } + + // Set max # of papers for advocate reviewers + if (empty($ppa)) { + $papersPerAdvocate = $papersPerReviewer; + } else { + $papersPerAdvocate = $ppa; + } + + // Algorithm to use + if (isset($_POST['algo']) && ctype_digit($_POST['algo'])) { + $algo = $_POST['algo']; + } else { + $algo = 0; // default to first defined algorithm above + } +} + +// Get list of sub. types +$OC_activeSubTypeAR = array(); +$typer = ocsql_query("SELECT DISTINCT `type` FROM `" . OCC_TABLE_PAPER . "` WHERE `type` IS NOT NULL AND `type`!='' ORDER BY `type`") or err('Unable to retrieve submission types'); +while ($typel = ocsql_fetch_assoc($typer)) { + $OC_activeSubTypeAR[$typel['type']] = substr($typel['type'], 0, 50); +} + +// Run algo +if (isset($OC_algorithmAR[$algo]['include']) && is_file($OC_algorithmAR[$algo]['include'])) { + require_once $OC_algorithmAR[$algo]['include']; +} else { + err("Algorithm choice unknown"); + exit; +} + +// Remedy missing reviews by assigning reviewers w/lowest #s (if set) +if (isset($_POST['remedy']) && in_array("random", $_POST['remedy'])) { + foreach (array_keys($pAR) as $k) { + if (oc_skipSubAssignment($k)) { + continue; + } + if (count($pAR[$k]) < $reviewersPerPaper) { + // Create an ordered array of reviewers w/least # of reviews + $rcountAR = array(); + foreach (array_keys($rAR) as $k2) { + if ((!isset($_POST['pcrev']) || ($_POST['pcrev'] == 'No')) && in_array($k2, $pcAR)) { // skip PC members? + continue; + } + $rcountAR[$k2] = count($rAR[$k2]); + } + asort($rcountAR); + reset($rcountAR); + // Assign reviewers + if (!in_array(key($rcountAR),$pAR[$k]) && !in_array($k.'-'.key($rcountAR),$nAR)) { + array_push($pAR[$k], key($rcountAR)); + array_push($rAR[key($rcountAR)], $k); + } + while ( (count($pAR[$k]) < $reviewersPerPaper) && (next($rcountAR) !== false) ) { + if (!in_array(key($rcountAR),$pAR[$k]) && !in_array($k.'-'.key($rcountAR),$nAR)) { + array_push($pAR[$k], key($rcountAR)); + array_push($rAR[key($rcountAR)], $k); + } + } + } + } +} + +// Remember assignments +$_SESSION['OPENCONFCHAIRVARS']['pAssignments'] = $pAR; + +// Display form +print ' + + +Below you will find OpenConf\'s suggested review assignments. You may fine tune these automated assignments by changing the following options and clicking Re-Evaluate Assignments. Once you are satisfied, click the Make Assignments button to commit them to the database. You may manually add/delete reviews afterwards through the Assign Reviews Manually and List/Unassign Reviews menus.'; + +if (oc_moduleValid('oc_auto_assign')) { + print ' If instead of using this feature you would like assignments to be made automatically when a new submission is made, use the Auto Assign module.'; +} + +print '
+ + ++ +'; + +function fmtNumSpacing ($n, $dir="l") { + $sp = ""; + if ($n < 10) { $sp = " "; } + elseif ($n < 100) { $sp = " "; } + if ($dir=="l") { return($sp.$n); } + else { return($n.$sp); } +} + +function fmtStrSpacing ($str, $len) { + $a = substr($str,0,$len); + for ($i=oc_strlen($a); $i<$len; $i++) { + $a .= " "; + } + return $a; +} + +print ' +
| Suggested Assignments' . ((!isset($_POST['keep']) || ($_POST['keep'] == 'Yes')) ? ' including already assigned ' : '') . ' | ||
|---|---|---|
+ * below threshold + +Place cursor on No. Reviewers for assignments +Click title for submission info (new window) + +No. Reviewers per Submission ID (Title) +'; +foreach ($pAR as $k => $v) { + $titleStr = "Reviewers for Submission $k:\n\n"; + foreach ($v as $vv) { $titleStr .= "$vv - " . $rNameAR[$vv] . "\n"; } + $tmpStr = '' . fmtNumSpacing(count($v)) . " - " . fmtNumSpacing($k) . '' . safeHTMLstr($titleStr) . ' (' . safeHTMLstr(fmtStrSpacing($pInfoAR[$k]['title'], 28)) . ")"; + if (count($v) < $reviewersPerPaper) { print '' . $tmpStr . " *\n"; } + else { print $tmpStr."\n"; } +} + + +print ' + | + * below threshold + +Place cursor on No. Submissions for reviewers +Click name for reviewer info (new window) + +No. Submissions per Reviewer ID (Name) +'; + +foreach ($rAR as $k => $v) { + $titleStr = "Submissions for Reviewer $k:\n\n"; + foreach ($v as $vv) { $titleStr .= "$vv - " . substr($pInfoAR[$vv]['title'],0,40) . "\n"; } + $tmpStr = '' . fmtNumSpacing(count($v)) . " - " . fmtNumSpacing($k) . '' . safeHTMLstr($titleStr) . ' ('; + if (in_array($k, $pcAR)) { + $tmpStr .= 'PC-'; + $len = 21; + } else { + $len = 24; + } + $tmpStr .= '' . safeHTMLstr(fmtStrSpacing($rNameAR[$k],$len)).")"; + if (count($v) <= $pprThreshold) { print '' . $tmpStr . " *\n"; } + else { print $tmpStr . "\n"; } +} + +print ' | |
'; + } else { + // Get conflicts? + if ($OC_configAR['OC_allowConflictOverride'] && isset($_POST['conflict_override']) && ($_POST['conflict_override'] == 1)) { + $conflictAR = array(); + } else { + $conflictAR = getConflicts(); + } + // Assign reviews + $reviewerAssignmentAR = array(); // keep track of reviewers w/successful assignments + $submissionAssignmentAR = array(); // keep track of submissions assigned + foreach ($_POST['reviewers'] as $i) { + // valid rev id? + if (!preg_match("/^\d+$/", $i)) { + err('Invalid reviewer selected'); + } + // iterate through submissions for reviewers + foreach ($_POST['papers'] as $j) { + // valid sub id? + if (!preg_match("/^\d+$/", $j)) { + err('Invalid submission selected'); + } + // Check for conflict + if (in_array("$j-$i", $conflictAR)) { + print "
! Submission $j is in conflict with reviewer $i.
\n"; + continue; + } + // Make assignment + $q = "INSERT INTO `" . OCC_TABLE_PAPERREVIEWER . "` (`paperid`,`reviewerid`,`assigned`) VALUES ('" . safeSQLstr($j) . "','" . safeSQLstr($i) . "','" . safeSQLstr(date('Y-m-d')) . "')"; + ocsql_query($q); + if (($merr = ocsql_errno()) != 0) { + if ($merr == 1062) { // Duplicate entry + print "! Submission $j was already assigned reviewer $i.
\n"; + } else { + print "!! Error assigning submission $j to reviewer $i
\n"; + } + } else { + print "Submission $j assigned to reviewer $i.
\n"; + if (!isset($reviewerAssignmentAR[$i])) { + $reviewerAssignmentsAR[$i] = array(); + } + $reviewerAssignmentAR[$i][] = $j; + if (!in_array($j, $submissionAssignmentAR)) { + $submissionAssignmentAR[] = $j; + } + + // Hook + if (oc_hookSet('chair-assign-review')) { + foreach ($OC_hooksAR['chair-assign-review'] as $f) { + require_once $f; + } + } + + } + } + } + + print 'Notification sent to ' . safeHTMLstr($l['name']) . ' (' . safeHTMLstr($l['reviewerid']) . ')
'; + } else { + print '!! Unable to email notification to ' . safeHTMLstr($l['name']) . ' (' . safeHTMLstr($l['reviewerid']) . ')
'; + } + } + print ''; + } + else { + if (!isset($_GET['s']) || empty($_GET['s']) || ($_GET['s'] == "id")) { + $idsortstr = 'ID'; + $nsortstr = 'Name'; + $rsortstr = 'No. Reviews'; + $legend = "[ Reviewer ID - $nsortstr ($rsortstr) ]"; + $sortby = "`" . OCC_TABLE_REVIEWER . "`.`reviewerid`"; + } elseif ($_GET['s'] == "reviews") { + $rsortstr = 'No. Reviews'; + $idsortstr = 'ID'; + $nsortstr = 'Name'; + $legend = "[ No. Reviews - Reviewer $nsortstr - $idsortstr ]"; + $sortby = "`rcount`, `" . OCC_TABLE_REVIEWER . "`.`name_last`, `" . OCC_TABLE_REVIEWER . "`.`name_first`"; + } else { + $idsortstr = 'ID'; + $nsortstr = 'Name'; + $rsortstr = 'No. Reviews'; + $legend = "[ Reviewer Name - $idsortstr ($rsortstr) ]"; + $sortby = "`" . OCC_TABLE_REVIEWER . "`.`name_last`, `" . OCC_TABLE_REVIEWER . "`.`name_first`"; + } + $rq = "SELECT `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, `onprogramcommittee`, CONCAT_WS(' ', `" . OCC_TABLE_REVIEWER . "`.`name_first`, `" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, COUNT(`" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`) AS `rcount` FROM `" . OCC_TABLE_REVIEWER . "` LEFT JOIN `" . OCC_TABLE_PAPERREVIEWER . "` ON `" . OCC_TABLE_REVIEWER . "`.`reviewerid`=`" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid` GROUP BY `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, `onprogramcommittee`, `name` ORDER BY $sortby"; + $rr = ocsql_query($rq) or err("Unable to get reviewers"); + // Get pad size for reviewer id's - yes, we really need the max id, but this should do:) + $rsize = oc_strlen((string) ocsql_num_rows($rr)); + if (ocsql_num_rows($rr) == 0) { + print 'No reviewers have signed up yet
'; + } + else { + // display filter? + $subSort = false; + $revSort = false; + $subFilterAR = array(); + $revFilterAR = array(); + if (count($topicsAR) > 1) { + print ' +
'; + if ($count > 0) { + print safeHTMLstr($count) . ' review records have been cleared'; + } else { + print 'No reviews found to be cleared'; + } + print '
'; + +} + +print ' + +'; + + +printFooter(); + +?> diff --git a/chair/create_sub.php b/chair/create_sub.php new file mode 100644 index 0000000..c23a960 --- /dev/null +++ b/chair/create_sub.php @@ -0,0 +1,100 @@ +Title must be entered'; + } + if (!isset($_POST['name_last']) || !preg_match("/\p{L}/u", $_POST['name_last'])) { + $err .= 'Submission ID ' . $pid . ' successfully created.
Notify ' . safeHTMLstr(oc_strtolower(OCC_WORD_AUTHOR)) . '
'; + printFooter(); + exit; + } else { + ocsql_query("DELETE FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`=" . (int) $pid . " LIMIT 1"); + err('Unable to add ' . safeHTMLstr(oc_strtolower(OCC_WORD_AUTHOR)) . ' to submission'); + } + } +} + +if (!empty($err)) { + print 'Please correct the following items. Note that the password fields must be re-entered.
This form allows you to create a new submission record. It is intended to permit late submissions once New Submissions have been closed. Upon creating the submission record, provide the ' . oc_strtolower(OCC_WORD_AUTHOR) . ' with the submission ID and password, and instruct them to edit the submission. An email link will be provided upon submission of this form for contacting the ' . oc_strtolower(OCC_WORD_AUTHOR) . ' with this information.
+ + +'; + +printFooter(); + +?> diff --git a/chair/db_backup.php b/chair/db_backup.php new file mode 100644 index 0000000..13795b8 --- /dev/null +++ b/chair/db_backup.php @@ -0,0 +1,137 @@ + 0) { + $l = mysqli_fetch_row($r); + $sqldump .= $l[1]; + if (preg_match("/auto_increment/s",$l[1])) { + mysqli_free_result($r); + $q = 'SHOW TABLE STATUS LIKE "' . $table . '"'; + $r = ocsql_query($q) or backuperr("Unable to query auto increment value for $table $q"); + $l = mysqli_fetch_array($r); + $sqldump .= " AUTO_INCREMENT=" . $l['Auto_increment']; + } + $sqldump .= ";\n\n\n"; + } + mysqli_free_result($r); + + $q = 'SELECT * FROM ' . quoteit($table); + if ($table == 'log') { + $q .= " WHERE `type` NOT LIKE '%fail'"; + } + $r = ocsql_query($q) or backuperr("Unable to query table contents for $table"); + $fieldNum = mysqli_num_fields($r); + $recNum = mysqli_num_rows($r); + $sqldump .= ' +# +# Records in table ' . quoteit($table) . ' (' . $recNum . ') +# + +'; + + $fieldAR = array(); + for ($f=0; $f < $fieldNum; $f++) { + $finfo = mysqli_fetch_field_direct($r, $f); + $fieldAR[$f] = quoteit($finfo->name); + if (preg_match("/(?:int|timestamp)$/",$finfo->type)) { + $fieldNumAR[$f] = TRUE; + } else { $fieldNumAR[$f] = FALSE; } + } + + $fldVal = array(); + while ($row = mysqli_fetch_row($r)) { + $sqldump .= 'INSERT INTO ' . quoteit($table) . ' VALUES ('; + for ($f=0; $f < $fieldNum; $f++) { + if (!isset($row[$f])) { + $fldVal[] = 'NULL'; + } elseif (($row[$f] == '0') || ($row[$f] != '')) { + if ($fieldNumAR[$f]) { + $fldVal[] = $row[$f]; + } else { + $fldVal[] = "'" . safeSQLstr($row[$f]) . "'"; + } + } else { + $fldVal[] = "''"; + } + } + $sqldump .= implode(', ', $fldVal) . ");\n"; + unset($fldVal); + } + mysqli_free_result($r); + +} // for tables + +$fileName = 'openconf'; +if (preg_match("/^\w+$/", $OC_configAR['OC_confName'])) { + $fileName .= '-' . $OC_configAR['OC_confName']; +} +$fileName .= '-' . date('YmdHi') . '.sql'; + +oc_sendNoCacheHeaders(); +header('Content-Type: text/plain'); +header('Content-Disposition: attachment; filename="' . $fileName . '"'); + +print $sqldump; + +?> diff --git a/chair/db_reset.php b/chair/db_reset.php new file mode 100644 index 0000000..c8ad215 --- /dev/null +++ b/chair/db_reset.php @@ -0,0 +1,72 @@ +Selected tables have been emptied'; + } elseif ($_POST['submit'] == "Empty Tables") { + print 'Please confirm that you want to empty (truncate) the tables:
NOTE: Once emptied, the data in the tables cannot be recovered. Make a backup, and use caution when deciding which tables to empty.
Select tables to empty:
' . safeHTMLstr($l['body']) . '+'; + } else { + warn('Unable to find message'); + } +} elseif (isset($_GET['lid']) && ctype_digit($_GET['lid'])) { + $q = "SELECT `" . OCC_TABLE_EMAIL_QUEUE . "`.`id`, `" . OCC_TABLE_EMAIL_QUEUE . "`.`reference_id`, `" . OCC_TABLE_EMAIL_QUEUE . "`.`sent`, `" . OCC_TABLE_EMAIL_QUEUE . "`.`tries`, `" . OCC_TABLE_EMAIL_QUEUE . "`.`to`, `" . OCC_TABLE_EMAIL_QUEUE . "`.`subject` FROM `" . OCC_TABLE_EMAIL_QUEUE . "`, `" . OCC_TABLE_LOG . "` WHERE `" . OCC_TABLE_LOG . "`.`logid`='" . safeSQLstr($_GET['lid']) . "' AND `" . OCC_TABLE_LOG . "`.`datetime`=`" . OCC_TABLE_EMAIL_QUEUE . "`.`queued` ORDER BY `id`"; + $r = ocsql_query($q) or err('Unable to retrieve log entries'); + if (ocsql_num_rows($r) > 0) { + $displayed = true; + print '
| ID | Sent | Ref ID | To | Subject |
|---|---|---|---|---|
| ' . safeHTMLstr($l['id']) . ' | '; + if (!empty($l['sent'])) { + print safeHTMLstr($l['sent']); + } else { + print 'Failed to send'; + $failed++; + } + print ' | ' . safeHTMLstr($l['reference_id']) . ' | ' . safeHTMLstr($l['to']) . ' | ' . safeHTMLstr($l['subject']) . " |
Log entries are shown in Coordinated Universal Time (UTC)
'; + if ($failed > 0) { + print ' +'; + } + } else { + warn('No messages found'); + } +} else { + warn('Invalid ID'); +} + +printFooter(); + +?> diff --git a/chair/email-resend.php b/chair/email-resend.php new file mode 100644 index 0000000..6938185 --- /dev/null +++ b/chair/email-resend.php @@ -0,0 +1,38 @@ +Message ID ' . safeHTMLstr($_GET['qid']) . ' successfully sent. +Note: Re-sent messages will not be displayed in the log/queue.
+'; + } else { + warn('Unable to send message ID ' . safeHTMLstr($_GET['qid'])); + } + } +} else { + warn('Invalid ID'); +} + +printFooter(); + +?> \ No newline at end of file diff --git a/chair/email.inc b/chair/email.inc new file mode 100644 index 0000000..a510366 --- /dev/null +++ b/chair/email.inc @@ -0,0 +1,200 @@ + OCC_WORD_CHAIR . ' Email Address', + 'OC_confirmmail' => 'Notification Email Address', + 'OC_confName' => 'Event/Journal Short Name', + 'OC_confNameFull' => 'Event/Journal Full Name', + 'OC_confURL' => 'Event/Journal Web Address', + 'OC_openconfURL' => 'OpenConf Web Address', +); + +$OC_emailVarAR['author'] = array( + 'paperid' => 'Submission ID', + 'title' => 'Submission Title', + 'name_last' => 'Recipient Last Name', + 'name_first' => 'Recipient First Name', + 'email' => 'Recipient Email' +); + +$OC_emailVarAR['author_acceptance'] = array( + 'author-comments' => 'Reviewers Comment to Author', + 'advocate-comment' => 'Committee (Adv.) Comment', + 'chair-notes' => OCC_WORD_CHAIR . ' Notes' +); +if ($OC_configAR['OC_paperAdvocates']) { + $OC_emailVarAR['author_acceptance']['advocate-name'] = 'Advocate Name'; + $OC_emailVarAR['author_acceptance']['advocate-email'] = 'Advocate Email'; +} +if (oc_moduleActive('oc_customforms')) { + $OC_emailVarAR['author_acceptance']['review-fields'] = 'Review Fields set to Show Author in Custom Forms module'; +} + +$OC_emailVarAR['committee'] = array( + 'name_last' => 'Reviewer Last Name', + 'name_first' => 'Reviewer First Name', + 'username' => 'Reviewer Username', + 'email' => 'Reviewer Email' +); + +// Check for addt'l (hook) variables +if (oc_hookSet('chair-email-variables')) { + foreach ($OC_hooksAR['chair-email-variables'] as $f) { + require_once $f; + } +} + +// Retrieve templates +$templateAR = array(); +$q = "SELECT `templateid`, `name`, `module` FROM `" . OCC_TABLE_TEMPLATE . "` WHERE `type`='email' ORDER BY `name` ASC"; +$r = ocsql_query($q) or err('Unable to retrieve templates'); +while ($l = ocsql_fetch_assoc($r)) { + // Skip templates for modules not active + if (isset($l['module']) && !empty($l['module']) && ($l['module'] != 'OC') && !in_array($l['module'], $OC_activeModulesAR)) { + continue; + } + // Skip PC templates if advocates not used + if ($OC_configAR['OC_paperAdvocates'] || !preg_match("/^pc_/", $l['templateid'])) { + $templateAR[$l['templateid']] = $l['name']; + } +} + +// Author(s) to include +if ($OC_configAR['OC_emailAuthorRecipients'] == 0) { + $authorIncludeSQL = " AND `" . OCC_TABLE_AUTHOR . "`.`position`=`" . OCC_TABLE_PAPER . "`.`contactid` "; +} else { + $authorIncludeSQL = ''; +} + +// Set up recipients +// - limit keys to [\w-], and text to [\w -] +$recipientAR = array(); +$recipientAR['authors_all']['text'] = OCC_WORD_AUTHOR . 's - All'; +$recipientAR['authors_all']['sql'] = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `name_last`, `name_first`, `title`, `email` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "` WHERE `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` " . $authorIncludeSQL . " ORDER BY `paperid`"; +$recipientAR['authors_all']['vars'] = array_merge($OC_emailVarAR['author'], $OC_emailVarAR['author_acceptance']); +$recipientAR['authors_all']['special'] = 'email-authors.inc'; +$recipientAR['authors_all']['id'] = "`" . OCC_TABLE_PAPER . "`.`paperid`"; + +$sr = ocsql_query("SELECT COUNT(*) AS `count` FROM `" . OCC_TABLE_PAPER . "` WHERE `student`='T'") or err('Unable to check student field'); +if (($sl = ocsql_fetch_assoc($sr)) && ($sl['count'] > 0)) { + $recipientAR['authors_students']['text'] = OCC_WORD_AUTHOR . 's - Student submissions'; + $recipientAR['authors_students']['sql'] = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `name_last`, `name_first`, `title`, `email` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "` WHERE `" . OCC_TABLE_PAPER . "`.`student`='T' AND `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` " . $authorIncludeSQL . " ORDER BY `paperid`"; + $recipientAR['authors_students']['vars'] = array_merge($OC_emailVarAR['author'], $OC_emailVarAR['author_acceptance']); + $recipientAR['authors_students']['special'] = 'email-authors.inc'; + $recipientAR['authors_students']['id'] = "`" . OCC_TABLE_PAPER . "`.`paperid`"; +} + +$recipientAR['authors_nofile']['text'] = OCC_WORD_AUTHOR . 's - Missing file'; +$recipientAR['authors_nofile']['sql'] = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `name_last`, `name_first`, `title`, `email` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "` WHERE `format` is NULL AND `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` " . $authorIncludeSQL . " ORDER BY `paperid`"; +$recipientAR['authors_nofile']['vars'] = array_merge($OC_emailVarAR['author'], $OC_emailVarAR['author_acceptance']); +$recipientAR['authors_nofile']['special'] = 'email-authors.inc'; +$recipientAR['authors_nofile']['id'] = "`" . OCC_TABLE_PAPER . "`.`paperid`"; + +if (count($OC_acceptanceValuesAR) > 1) { + $recipientAR['authors_accepted_all']['text'] = OCC_WORD_AUTHOR . 's - All accepted'; + $recipientAR['authors_accepted_all']['sql'] = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_AUTHOR . "`.`name_last`, `" . OCC_TABLE_AUTHOR . "`.`name_first`, `" . OCC_TABLE_PAPER . "`.`title`, `" . OCC_TABLE_AUTHOR . "`.`email` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "`, `" . OCC_TABLE_ACCEPTANCE . "` WHERE `" . OCC_TABLE_PAPER . "`.`accepted`=`" . OCC_TABLE_ACCEPTANCE . "`.`value` AND `" . OCC_TABLE_ACCEPTANCE . "`.`accepted`=1 AND `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` " . $authorIncludeSQL . " ORDER BY `paperid`"; + $recipientAR['authors_accepted_all']['vars'] = array_merge($OC_emailVarAR['author'], $OC_emailVarAR['author_acceptance']); + $recipientAR['authors_accepted_all']['special'] = 'email-authors.inc'; + $recipientAR['authors_accepted_all']['id'] = "`" . OCC_TABLE_PAPER . "`.`paperid`"; +} + +// acceptance break down +foreach ($OC_acceptanceValuesAR as $idx => $acc) { + $recipientAR['authors_' . $idx]['text'] = OCC_WORD_AUTHOR . 's - Decision - ' . $acc['value']; + $recipientAR['authors_' . $idx]['sql'] = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `name_last`, `name_first`, `title`, `email` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "` WHERE `" . OCC_TABLE_PAPER . "`.`accepted`='" . safeSQLstr($acc['value']) . "' AND `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` " . $authorIncludeSQL . " ORDER BY `paperid`"; + $recipientAR['authors_' . $idx]['vars'] = array_merge($OC_emailVarAR['author'], $OC_emailVarAR['author_acceptance']); + $recipientAR['authors_' . $idx]['special'] = 'email-authors.inc'; + $recipientAR['authors_' . $idx]['id'] = "`" . OCC_TABLE_PAPER . "`.`paperid`"; +} + +// type break down if in use +if (isset($OC_submissionFieldAR['type']['values']) && is_array($OC_submissionFieldAR['type']['values']) && (count($OC_submissionFieldAR['type']['values']) > 0)) { + foreach ($OC_submissionFieldAR['type']['values'] as $typeidx => $typeval) { + $recipientAR['authors_type_' . $typeidx]['text'] = OCC_WORD_AUTHOR . 's - Type - ' . $typeval; + $recipientAR['authors_type_' . $typeidx]['sql'] = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `name_last`, `name_first`, `title`, `email` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "` WHERE `" . OCC_TABLE_PAPER . "`.`type`='" . safeSQLstr($typeval) . "' AND `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` " . $authorIncludeSQL . " ORDER BY `paperid`"; + $recipientAR['authors_type_' . $typeidx]['vars'] = array_merge($OC_emailVarAR['author'], $OC_emailVarAR['author_acceptance']); + $recipientAR['authors_type_' . $typeidx]['special'] = 'email-authors.inc'; + $recipientAR['authors_type_' . $typeidx]['id'] = "`" . OCC_TABLE_PAPER . "`.`paperid`"; + } +} + +if (isset($OC_submissionFieldAR['presenter']) && in_array('presenter', $OC_submissionFieldSetAR['fs_authors']['fields'])) { + $recipientAR['presenters']['text'] = 'Presenting ' . OCC_WORD_AUTHOR . 's - Accepted'; + $recipientAR['presenters']['sql'] = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`title`, `" . OCC_TABLE_AUTHOR . "`.`name_last`, `" . OCC_TABLE_AUTHOR . "`.`name_first`, `" . OCC_TABLE_AUTHOR . "`.`email` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "`, `" . OCC_TABLE_ACCEPTANCE . "` WHERE `" . OCC_TABLE_PAPER . "`.`accepted`=`" . OCC_TABLE_ACCEPTANCE . "`.`value` AND `" . OCC_TABLE_ACCEPTANCE . "`.`accepted`=1 AND `" . OCC_TABLE_AUTHOR . "`.`presenter`='T' AND `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` ORDER BY `paperid`"; + $recipientAR['presenters']['vars'] = $OC_emailVarAR['author']; + $recipientAR['presenters']['id'] = "`" . OCC_TABLE_PAPER . "`.`paperid`"; +} + +if ($OC_configAR['OC_paperAdvocates']) { + $recipientAR['reviewer_pc_all']['text'] = 'Review and Program Committee Members - All'; + $recipientAR['reviewer_pc_all']['text'] = 'Review and Program Committee Members - All'; + $recipientAR['reviewer_pc_all']['sql'] = "SELECT `reviewerid`, `name_last`, `name_first`, `username`, `email` FROM `" . OCC_TABLE_REVIEWER . "` WHERE 1=1 ORDER BY `reviewerid`"; + $recipientAR['reviewer_pc_all']['vars'] = $OC_emailVarAR['committee']; + $recipientAR['reviewer_pc_all']['id'] = '`reviewerid`'; + + $recipientAR['reviewers_all']['text'] = 'Reviewers - All (except Program Committee members)'; +} else { + $recipientAR['reviewers_all']['text'] = 'Reviewers - All'; +} +$recipientAR['reviewers_all']['sql'] = "SELECT `reviewerid`, `name_last`, `name_first`, `username`, `email` FROM `" . OCC_TABLE_REVIEWER . "` WHERE `onprogramcommittee`='F' ORDER BY `reviewerid`"; +$recipientAR['reviewers_all']['vars'] = $OC_emailVarAR['committee']; +$recipientAR['reviewers_all']['id'] = '`reviewerid`'; + +$recipientAR['reviewers_noreview']['text'] = 'Reviewers - Reviews not yet completed or no score'; +$recipientAR['reviewers_noreview']['sql'] = "SELECT `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, `name_last`, `name_first`, `username`, `email` FROM `" . OCC_TABLE_REVIEWER . "`, `" . OCC_TABLE_PAPERREVIEWER . "` WHERE (`" . OCC_TABLE_PAPERREVIEWER . "`.`completed` != 'T' OR `" . OCC_TABLE_PAPERREVIEWER . "`.`score` IS NULL) AND `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` GROUP BY `reviewerid`, `name_last`, `name_first`, `username`, `email` ORDER BY `reviewerid`"; +$recipientAR['reviewers_noreview']['vars'] = $OC_emailVarAR['committee']; +$recipientAR['reviewers_noreview']['id'] = "`" . OCC_TABLE_REVIEWER . "`.`reviewerid`"; + +$recipientAR['reviewers_reviewscomplete']['text'] = 'Reviewers - Reviews all completed'; +$recipientAR['reviewers_reviewscomplete']['sql'] = "SELECT `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, `name_last`, `name_first`, `username`, `email`, MIN(`completed`) AS `minc` FROM `" . OCC_TABLE_REVIEWER . "`, `" . OCC_TABLE_PAPERREVIEWER . "` WHERE `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` GROUP BY `reviewerid`, `name_last`, `name_first`, `username`, `email` HAVING MIN(`completed`) NOT LIKE 'F' ORDER BY `reviewerid`"; +$recipientAR['reviewers_reviewscomplete']['vars'] = $OC_emailVarAR['committee']; +$recipientAR['reviewers_reviewscomplete']['id'] = "`" . OCC_TABLE_REVIEWER . "`.`reviewerid`"; + +$recipientAR['reviewers_nocomment']['text'] = 'Reviewers - Missing author comments'; +$recipientAR['reviewers_nocomment']['sql'] = "SELECT `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, `name_last`, `name_first`, `username`, `email` FROM `" . OCC_TABLE_REVIEWER . "`, `" . OCC_TABLE_PAPERREVIEWER . "` WHERE `" . OCC_TABLE_PAPERREVIEWER . "`.`authorcomments` IS NULL AND `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` GROUP BY `reviewerid`, `name_last`, `name_first`, `username`, `email` ORDER BY `reviewerid`"; +$recipientAR['reviewers_nocomment']['vars'] = $OC_emailVarAR['committee']; +$recipientAR['reviewers_nocomment']['id'] = "`" . OCC_TABLE_REVIEWER . "`.`reviewerid`"; + +if ($OC_configAR['OC_paperAdvocates']) { + $recipientAR['pc_all']['text'] = 'Program Committee - All'; + $recipientAR['pc_all']['sql'] = "SELECT `reviewerid`, `name_last`, `name_first`, `username`, `email` FROM `" . OCC_TABLE_REVIEWER . "` WHERE `onprogramcommittee`='T' ORDER BY `reviewerid`"; + $recipientAR['pc_all']['vars'] = $OC_emailVarAR['committee']; + $recipientAR['pc_all']['id'] = '`reviewerid`'; + + $recipientAR['pc_norecommendation']['text'] = 'Program Committee - Missing advocate recommendation'; + $recipientAR['pc_norecommendation']['sql'] = "SELECT `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, `name_last`, `name_first`, `username`, `email` FROM `" . OCC_TABLE_REVIEWER . "`, `" . OCC_TABLE_PAPERADVOCATE . "` WHERE `" . OCC_TABLE_PAPERADVOCATE . "`.`adv_recommendation` is NULL and `" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` GROUP BY `reviewerid`, `name_last`, `name_first`, `username`, `email` ORDER BY `reviewerid`"; + $recipientAR['pc_norecommendation']['vars'] = $OC_emailVarAR['committee']; + $recipientAR['pc_norecommendation']['id'] = "`" . OCC_TABLE_REVIEWER . "`.`reviewerid`"; +} + +// Check for addt'l (hook) recipients +if (oc_hookSet('chair-email-recipient')) { + foreach ($OC_hooksAR['chair-email-recipient'] as $f) { + require_once $f; + } +} + +// Get sorted list of recipients +$recipients = array(); +foreach ($recipientAR as $k => $v) { + $recipients[$k] = $v['text']; +} +natcasesort($recipients); diff --git a/chair/email.php b/chair/email.php new file mode 100644 index 0000000..3ab71f1 --- /dev/null +++ b/chair/email.php @@ -0,0 +1,489 @@ +New Email » '; +} + +printHeader("Email", 1); + +require_once 'email.inc'; + +clearstatcache(); + +$commentSeparator = "\n***************************************************************\n"; // author comments separator + +$specialIndexAR = array(); // tracks which DB col to use for special var handling + +function showAddresses($recipient, $sql) { + $r = ocsql_query($sql) or err("Unable to retrieve emails"); + if (ocsql_num_rows($r) == 0) { + print 'No email addresses available for ' . safeHTMLstr($recipient) . '
'; + } else { + print 'Email addresses for ' . safeHTMLstr($recipient) . ':
'; + while ($l = ocsql_fetch_array($r)){ + print safeHTMLstr($l['email']) . "Messages are being queued for delivery. Once queued, this page will refresh and the message sent out. If the page does not refresh, you must click the link that will appear at the bottom of the page, and is also available on the ' . OCC_WORD_CHAIR . ' home page.
'; + } else { + $queueMessages = false; + } + ob_end_flush(); + flush(); + ob_start(); + $emailAR = array(); + while ($l = ocsql_fetch_array($r)) { + if ( + empty($l['email']) + || + (isset($_POST['skipsame']) && ($_POST['skipsame'] == 'yes') && in_array($l['email'], $emailAR)) + ) { + continue; + } + + $emailAR[] = $l['email']; + + $tmpsubject = oc_replaceVariables($subject, $l); + $tmpmessage = oc_replaceVariables($message, $l); + + // Replace special vars (\w-\w) + if (isset($recipientAR[$_POST['recipient']]['special'])) { + $tmpmessage = preg_replace_callback( + "/\[:(\w+)-(\w+):\]/", + function ($matches) { + return specialValue($matches[1], $matches[2]); + }, + $tmpmessage + ); + } + + // YMMV wrt below + $tmpmessage = preg_replace("/\r/","",$tmpmessage); + + $to = $l['email']; // req'd for OC_mailCopyLast code block below + print 'emailing ' . safeHTMLstr($l['email'] . ' (' . $l[0] . ') ... '); + ob_flush(); + flush(); + if ($queueMessages) { + // try to get id for log reference + $reference_id = ''; + if (isset($l['paperid']) && preg_match("/^\d+$/", $l['paperid'])) { + $reference_id = $l['paperid']; + } + if (isset($l['reviewerid']) && preg_match("/^\d+$/", $l['reviewerid'])) { + if (!empty($reference_id)) { + $reference_id .= '-'; + } + $reference_id = $l['reviewerid']; + } + // add to queue + $queueAR[] = "('" . $date . "', '" . safeSQLstr($l['email']) . "', '" . safeSQLstr($tmpsubject) . "', '" . safeSQLstr($tmpmessage) . "', '" . safeSQLstr($reference_id) . "')"; + print "queuedA copy of the last message ' . ($queueMessages ? 'queued' : 'sent') . ' has been forwarded to ' . $OC_configAR['OC_confirmmail'] . '.
'; + } else { + print 'The system was unable to forward a copy of the last message ' . ($queueMessages ? 'queued' : 'sent') . ' to ' . $OC_configAR['OC_confirmmail'] . '.
'; + } + } + + // attempt javascript redirect + if ($queueMessages) { + print ' + +Your messages have been queued. If this page does not refresh automatically and your browser does not look like it is doing something, please follow this link to send them out now, or visit the ' . OCC_WORD_CHAIR . ' home page to send them out later.
+'; + } + } + // Preview Email + elseif ($_POST['submit'] == "Preview Message") { + $q = $recipientAR[$_POST['recipient']]['sql'] . " LIMIT 1"; + if (isset($_POST['selected_recipients']) && !empty($_POST['selected_recipients'])) { + list($selid, $selemail) = preg_split("/\//", $_POST['selected_recipients'][0]); + $q = preg_replace("/ WHERE /", " WHERE " . $recipientAR[$_POST['recipient']]['id'] . "='" . safeSQLstr($selid) . "' AND " . (isset($recipientAR[$_POST['recipient']]['emailcol']) ? $recipientAR[$_POST['recipient']]['emailcol'] : "`email`") . "='" . safeSQLstr($selemail) . "' AND ", $q); + } + $r = ocsql_query($q) or err("Unable to retrieve information to preview"); + if (ocsql_num_rows($r) == 0) { + err("No email addresses found (preview)"); + } + + $l = ocsql_fetch_array($r); + + // Special var handling + if (isset($recipientAR[$_POST['recipient']]['special']) && is_file($recipientAR[$_POST['recipient']]['special'])) { + require_once $recipientAR[$_POST['recipient']]['special']; + } + + print ' + +
+
+';
+
+ $tmpsubject = oc_replaceVariables($subject, $l);
+ $tmpmessage = oc_replaceVariables($message, $l);
+
+ // Replace special vars (\w-\w)
+ if (isset($recipientAR[$_POST['recipient']]['special'])) {
+ $tmpmessage = preg_replace_callback(
+ "/\[:(\w+)-(\w+):\]/",
+ function ($matches) {
+ return specialValue($matches[1], $matches[2]);
+ },
+ $tmpmessage
+ );
+ }
+
+ // Show to/subject and message
+ print 'To: ';
+ if (isset($_POST['select_recipients']) && ($_POST['select_recipients'] == 1)) {
+ if (! isset($_POST['selected_recipients']) || empty($_POST['selected_recipients'])) {
+ warn('No recipients selected');
+ } elseif (count($_POST['selected_recipients']) == 1) {
+ list($id, $email) = explode("/", $_POST['selected_recipients'][0]);
+ print safeHTMLstr($email . ' (ID: ' . $id . ')');
+ } else {
+ print "(The following is a list of selected recipients. The preview is shown for only one of them.)";
+ foreach ($_POST['selected_recipients'] as $recip) {
+ list($id, $email) = explode("/", $recip);
+ print "\n " . safeHTMLstr($email . ' (ID: ' . $id . ')');
+ }
+ }
+ } else {
+ print safeHTMLstr($l['email']);
+ }
+ print "\n\n";
+ print 'Subject: ' . safeHTMLstr($tmpsubject) . "\n\n";
+ print safeHTMLstr(wordwrap($tmpmessage, $OC_configAR['OC_emailWrap'])) . "\n\n";
+ }
+ // Write Email
+ elseif (($_POST['submit'] == "Write Email Online") || ($_POST['submit'] == "Edit Message")) {
+ // Valid recipient?
+ if (!isset($_POST['recipient']) || !isset($recipients[$_POST['recipient']])) {
+ err("Unknown recipient group selected");
+ }
+ // Any addresses
+ $r = ocsql_query($recipientAR[$_POST['recipient']]['sql']) or err("Unable to retrieve email addresses");
+ if (ocsql_num_rows($r) == 0) {
+ print 'No email addresses available for ' . safeHTMLstr($recipientAR[$_POST['recipient']]['text']) . '
'; + } else { + + print ' + +The variables appearing next to the message field may be used in your email by enclosing each instance in [:variable:] . These will be substituted for their value prior to the email being sent. For example, to include the conference (short) name in your message use [:OC_confName:] . Some variables are only available for certain recipient groups. The [:review-fields:] variable, available when emailing author acceptance notices, includes the review form fields designated to "show author" in the Custom Forms module; the default is to only show the reviewer Comments to Author.
+ '; + } // if Any emails + } // end submit write +} // end submit +// Not a submit - select recipient/template +else { + print ' + + +'; + +} // else not a submit + +printFooter(); + +?> diff --git a/chair/email_process_queue.php b/chair/email_process_queue.php new file mode 100644 index 0000000..0dbda2e --- /dev/null +++ b/chair/email_process_queue.php @@ -0,0 +1,87 @@ +New Email » '; + +ob_start(); + +printHeader("Email Queue", 1); + +ob_flush(); +flush(); + +$r = ocsql_query("SELECT * FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE `sent` IS NULL AND `tries`<1") or err('Unable to retrieve queued messages'); +$count = ocsql_num_rows($r); +if (($count == 0) && (!isset($_GET['pass']) || !ctype_digit($_GET['pass']))) { + print 'The queue is empty. View email log.
'; +} else { + if (isset($_GET['f']) && ctype_digit($_GET['f'])) { + $failed = $_GET['f']; + } else { + $failed = 0; + } + $date = safeSQLstr(gmdate('Y-m-d H:i:s')); + print '' . ((isset($_GET['pass']) && ($_GET['pass'] == 1)) ? 'Remaining m' : 'M') . 'essages in queue: ' . $count . "
\n"; + while ($l = ocsql_fetch_assoc($r)) { + if ($l['tries'] >= 1) { continue; } // skip messages that have been tried already + print 'Message ID ' . $l['id'] . ' (' . safeHTMLstr($l['to']) . ') ... '; + ob_flush(); + flush(); + $set = "`tries`=" . ((int) $l['tries'] + 1); + if (oc_mail($l['to'], $l['subject'], $l['body'])) { + print 'sent'; + $set .= ", `sent`='" . $date . "'"; + } else { + print 'FAILED!!!'; + if ($l['tries'] == 2) { // this will have been the third try + print ' Too many tries, will not try again.'; + } + print ''; + $failed++; + } + print "All messages have been sent.
'; + } else { + print '' . $failed . ' messages failed to be sent.
'; + } + print 'View email log (most recent batch of messages will appear at the top)
'; +} + +ob_end_flush(); + +printFooter(); + +?> \ No newline at end of file diff --git a/chair/email_templates.php b/chair/email_templates.php new file mode 100644 index 0000000..a9236d8 --- /dev/null +++ b/chair/email_templates.php @@ -0,0 +1,161 @@ +New Email » '; + +printHeader('Email Templates', 1); + +require_once 'email.inc'; + +clearstatcache(); + +function oc_templateForm($tid, $name, $subject, $body) { + print ' + +Template not found
'; + } +} elseif (isset($_POST['ocaction'])) { + switch($_POST['ocaction']) { + case 'Add Template': + $name = (isset($_POST['name']) ? trim($_POST['name']) : ''); + $templateid = 'custom' . time(); + if (!preg_match("/^[\w -]+$/", $name)) { + print 'Template name must not be blank, and only contain
letters, numbers, hyphen, underscore, and space
A template with that name already exists
'; + } elseif ( ! ocsql_query("INSERT INTO `" . OCC_TABLE_TEMPLATE . "` SET `templateid`='" . safeSQLstr($templateid) . "', `type`='email', `module`='OC', `name`='" . safeSQLstr($name) . "', `subject`='', `body`='', `updated`='" . safeSQLstr(date('Y-m-d')) . "'") ) { + print 'Unable to add template; perhaps you double-clicked? Check below.
'; + } else { + print 'Template added
'; + $templateAR[$templateid] = $name; + asort($templateAR); + $name = ''; + } + break; + + case 'Delete Templates': + if (isset($_POST['templates']) && is_array($_POST['templates'])) { + $count = 0; + foreach ($_POST['templates'] as $tid) { + if (isset($templateAR[$tid])) { + if (ocsql_query("DELETE FROM `" . OCC_TABLE_TEMPLATE . "` WHERE `type`='email' AND `templateid`='" . safeSQLstr($tid) . "' LIMIT 1")) { + unset($templateAR[$tid]); + $count++; + } + } + } + print 'Deleted ' . $count . ' template' . (($count!=1) ? 's' : '') . '
'; + } + break; + + case 'Save Template': + $templatename = (isset($_POST['templatename']) ? trim($_POST['templatename']) : ''); + $templateid = (isset($_POST['templateid']) ? trim($_POST['templateid']) : ''); + $subject = (isset($_POST['subject']) ? trim($_POST['subject']) : ''); + $body = (isset($_POST['body']) ? trim($_POST['body']) : ''); + + $err = ''; + if ( ! preg_match("/^[\w-]+$/", $templateid) || ! isset($templateAR[$templateid]) ) { + warn('Template ID invalid'); + } elseif (!preg_match("/^[\w -]+$/", $templatename)) { + $err = 'Template name invalid'; + } elseif (preg_match("/[\r\n]/", $subject)) { + $err = 'Subject invalid'; + } else { + $q = "UPDATE `" . OCC_TABLE_TEMPLATE . "` SET `name`='" . safeSQLstr($templatename) . "', `subject`='" . safeSQLstr($subject) . "', `body`='" . safeSQLstr($body) . "', `updated`='" . safeSQLstr(date("Y-m-d")) . "' WHERE `templateid`='" . safeSQLstr($templateid) . "' LIMIT 1"; + if ( ! ocsql_query($q) ) { + $err = 'Unable to add/update database'; + } + } + + if (empty($err)) { + print 'Template saved
'; + } else { + print '' . $err . '
'; + } + + oc_templateForm($templateid, $templatename, $subject, $body); + + break; + + default: + warn('Request unknown'); + exit; + } +} + +print ' + +'; + +printFooter(); + +?> diff --git a/chair/email_username.php b/chair/email_username.php new file mode 100644 index 0000000..78ca391 --- /dev/null +++ b/chair/email_username.php @@ -0,0 +1,41 @@ +Functionality disabled'; +} +elseif (isset($_POST['submit']) && ($_POST['submit'] == "Email Username")) { + $msg = ' +The ' . OCC_WORD_CHAIR . ' username for accessing the ' . $OC_configAR['OC_confName'] . ' OpenConf system is: + + ' . $OC_configAR['OC_chair_uname'] . ' +'; + if (sendEmail($OC_configAR['OC_pcemail'], OCC_WORD_CHAIR . " username", $msg)) { + print 'The ' . OCC_WORD_CHAIR . ' username has been emailed to the ' . OCC_WORD_CHAIR . '\'s address
'; + } else { + err('Unable to send email'); + } +} else { + print ' +Click the button below to email the username to the ' . OCC_WORD_CHAIR . '\'s address
+ +'; +} + +printFooter(); + +?> diff --git a/chair/email_variables.php b/chair/email_variables.php new file mode 100644 index 0000000..4d2a0b5 --- /dev/null +++ b/chair/email_variables.php @@ -0,0 +1,79 @@ + + + + + +' . safeHTMLstr($rAR['text']) . '
' . $rAR['table']; + } +} else { + print '' . safeHTMLstr($first['text']) . '
' . $first['table'] . 'General
| [:' . safeHTMLstr($varID) . ':] | ' . safeHTMLstr($var) . ' |
| ' . htmlspecialchars(isset($fieldNameAR[$f]) ? $fieldNameAR[$f] : ucwords(preg_replace("/_/", " ", trim($f, "_")))) . ' | '; + } + print '
| ' . htmlspecialchars($val) . ' | '; + } + print '
Note: When opening up a CSV or Tab-delimited file in a spreadsheet, you may need to specify the character encoding: UTF-8.
+ +'; + +printFooter(); + +?> diff --git a/chair/export_reviewers.php b/chair/export_reviewers.php new file mode 100644 index 0000000..80bcfc3 --- /dev/null +++ b/chair/export_reviewers.php @@ -0,0 +1,171 @@ + 'ID', + 'name' => 'Full Name', +); + +if ($OC_configAR['OC_paperAdvocates']) { + $fieldAR['onprogramcommittee'] = 'OnProgramCommittee'; +} + +foreach ($OC_reviewerFieldSetAR as $fsKey => $fsAR) { + foreach ($fsAR['fields'] AS $fieldID) { + if (preg_match("/^password/i", $fieldID) || ($fieldID == 'topics') || empty($OC_reviewerFieldAR[$fieldID]['short'])) { continue; } + $fieldAR[$fieldID] = $OC_reviewerFieldAR[$fieldID]['short']; + } +} + +if (isset($OC_reviewerFieldAR['topics']['short'])) { + $fieldAR['_topics'] = $OC_reviewerFieldAR['topics']['short']; +} + +$fieldAR['skip' . $skip++] = ''; + +// Default list of checked fields +$checkedFieldAR = array_keys($fieldAR); + +// Include extra fields +if (oc_hookSet('chair-export_reviewers-fields')) { + foreach ($OC_hooksAR['chair-export_reviewers-fields'] as $v) { + require_once $v; + } +} + +if (isset($_GET['template']) && ($_GET['template'] == 1)) { + $template = true; + unset($fieldAR['name']); +} else { + $template = false; +} + +if (isset($_POST['submit']) && ($_POST['submit'] == "Generate File") && isset($_POST['fields']) && !empty($_POST['fields'])) { + // Check for valid submission + if (!validToken('chair')) { + warn('Invalid submission'); + } + // Verify Fields + $fieldARkeys = array_keys($fieldAR); + foreach ($_POST['fields'] as $f) { + if (!in_array($f, $fieldARkeys)) { + err('Invalid field name selection'); + } + } + + // Init extra field AR + $extraAR = array(); + + // List of fields to export + $exportFieldsAR = $_POST['fields']; + + // Topics + if (in_array('_topics', $exportFieldsAR)) { + $q = "SELECT `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, `" . OCC_TABLE_TOPIC . "`.`topicname`, `" . OCC_TABLE_TOPIC . "`.`short` FROM `" . OCC_TABLE_REVIEWER . "`, `" . OCC_TABLE_TOPIC . "`, `" . OCC_TABLE_REVIEWERTOPIC . "` WHERE `" . OCC_TABLE_REVIEWER . "`.`reviewerid`=`" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid` AND `" . OCC_TABLE_REVIEWERTOPIC . "`.`topicid`=`" . OCC_TABLE_TOPIC . "`.`topicid`"; + $r = ocsql_query($q) or err("Unable to retrieve data for export (t)", $hdr, $hdrfn); + while ($l = ocsql_fetch_assoc($r)) { + if (isset($extraAR[$l['reviewerid']]['_topics'])) { + $extraAR[$l['reviewerid']]['_topics'] .= "\n" . useTopic($l['short'], $l['topicname']); + } else { + $extraAR[$l['reviewerid']]['_topics'] = useTopic($l['short'], $l['topicname']); + } + } + } + + // Get extra fields data + if (oc_hookSet('chair-export_reviewers-data')) { + foreach ($OC_hooksAR['chair-export_reviewers-data'] as $v) { + require_once $v; + } + } + + // Get sub. data & iterate through each + $q = "SELECT *,`reviewerid` AS `id`, CONCAT_WS(' ', `name_first`, `name_last`) AS `name` FROM `" . OCC_TABLE_REVIEWER . "` ORDER BY `reviewerid`"; + $r = ocsql_query($q) or err("Unable to retrieve data for export"); + if ((ocsql_num_rows($r) == 0) && !$template) { + warn("There are no committee members to export", 'Export Committee Members', 1); + exit; + } else { // Export file + oc_export($scope, $exportFieldsAR, $fieldAR, $r, $extraAR, $OC_reviewerFieldAR); + exit; + } + +} + +// Display form +printHeader($hdr, $hdrfn); + +print ' + + +Note: When opening up a CSV or Tab-delimited file in a spreadsheet, you may need to specify the character encoding: UTF-8.
+ +'; + +printFooter(); + +?> diff --git a/chair/export_reviews-guide.php b/chair/export_reviews-guide.php new file mode 100644 index 0000000..a1a2513 --- /dev/null +++ b/chair/export_reviews-guide.php @@ -0,0 +1,49 @@ + $v) { + print '' . safeHTMLstr($v['short']) . '
'; + if (($k != 'sessions') && isset($v['values']) && is_array($v['values'])) { + print 'Review Completed
+Note: When opening up a CSV or Tab-delimited file in a spreadsheet, you may need to specify the character encoding: UTF-8.
+ +'; + +printFooter(); + +?> diff --git a/chair/import_reviewer-template.php b/chair/import_reviewer-template.php new file mode 100644 index 0000000..80afda8 --- /dev/null +++ b/chair/import_reviewer-template.php @@ -0,0 +1,36 @@ + 'id', + 'onprogramcommittee' => 'onprogramcommittee', + 'password' => 'password' +); + +foreach ($OC_reviewerFieldAR as $f => $far) { + if (preg_match("/^password/", $f)) { continue; } + $fieldAR[$f] = str_replace("\"", "\"\"", $far['short']); +} + +oc_export_headers('committee-import-template.csv', 'csv'); +print '"' . strtoupper(implode('","', $fieldAR)) . '"' . "\r\n"; +exit; + +?> \ No newline at end of file diff --git a/chair/import_reviewers.php b/chair/import_reviewers.php new file mode 100644 index 0000000..f62e1f9 --- /dev/null +++ b/chair/import_reviewers.php @@ -0,0 +1,362 @@ + 0) // not empty (redundant w/ERR) + && (($fp = fopen($_FILES['csvfile']['tmp_name'], "r")) !== false) // open ok + ) { + // retrieve existing reviewer IDs, usernames, email addresses + $reviewerIdAR = array(); + $usernameAR = array(); + $emailAR = array(); + $r = ocsql_query("SELECT `reviewerid`, `username`, `email` FROM `" . OCC_TABLE_REVIEWER . "`"); + while ($l = ocsql_fetch_assoc($r)) { + $reviewerIdAR[] = $l['reviewerid']; + $usernameAR[] = $l['username']; + $emailAR[] = $l['email']; + } + // set list of field names to ID mapping + $fieldIdAR = array( + 'id' => 'reviewerid', + 'onprogramcommittee' => 'onprogramcommittee', + 'password' => 'password' + ); + $fieldNameAR = array( + 'id' => 'reviewerid', + 'onprogramcommittee' => 'onprogramcommittee', + 'password' => 'password' + ); + foreach ($OC_reviewerFieldAR as $fid => $far) { + $lowshort = strtolower($far['short']); + $fieldIdAR[$fid] = $lowshort; + $fieldNameAR[$lowshort] = $fid; + } + // retieve and check header row + $fieldMapAR = array(); + $errAR = array(); + $row = fgetcsv($fp, 0, $_POST['delimiter'], $_POST['enclosure'], $_POST['escape']); + foreach ($row as $rowid => $rowval) { + $col = strtolower($rowval); + if (isset($fieldIdAR[$col])) { + $fieldMapAR[$rowid] = $col; + } elseif (isset($fieldNameAR[$col])) { + $fieldMapAR[$rowid] = $fieldNameAR[$col]; + } elseif (!isset($_POST['skipunknown']) || ($_POST['skipunknown'] != 1)) { + $errAR[] = 'Unknown column ' . safeHTMLstr($rowval); + } + } + + // get short topics + $shortTopicAR = array(); + $shorttopr = ocsql_query("SELECT `topicid`, `short` FROM `" . OCC_TABLE_TOPIC . "`") or err('unable to retrieve short topics'); + while ($shorttopl = ocsql_fetch_assoc($shorttopr)) { + if (empty($shorttopl['short'])) { continue; } + $shortTopicAR[$shorttopl['topicid']] = $shorttopl['short']; + } + + // check for missing required field columns + if (!in_array('name_last', $fieldMapAR) || !in_array('email', $fieldMapAR)) { + $errAR[] = 'Email and Last Name field columns not found'; + } + if (count($errAR) > 0) { + print '' . safeHTMLstr(count($importAR)) . ' records imported
'; + } else { + print 'No valid reviewer records found
'; + } + } else { + print 'File did not upload properly or size too large
'; + } + + // clear out file + if (isset($_FILES['csvfile']['tmp_name']) && is_file($_FILES['csvfile']['tmp_name'])) { + unlink($_FILES['csvfile']['tmp_name']); + } + + print 'Select the CSV file, then click the Import Committee Members button. The file must be in standard CSV format and have a header row that matches the committee profile form field (short) names or IDs. For a CSV file template, see below.
+ + + +Template:
+ + +Import rules:
+' . safeHTMLstr(count($importAR)) . ' records imported. List submissions
'; + } else { + print 'No valid submission records found
'; + } + } else { + print 'File did not upload properly or size too large
'; + } + + // clear out file + if (isset($_FILES['csvfile']['tmp_name']) && is_file($_FILES['csvfile']['tmp_name'])) { + unlink($_FILES['csvfile']['tmp_name']); + } + + print 'Select the CSV file, then click the Import Submissions button. The file must be in standard CSV format and have a header row that matches the submission form field (short) names or IDs. For a CSV file template, see below.
+ + + +Template:
+ + +Import rules:
+Event:
' . safeHTMLstr(OCC_LICENSE_EVENT) . '
Hosting End Date:
' . safeHTMLstr(OCC_END_DATE) . '
Prepaid Submissions:*
' . safeHTMLstr(OCC_SUBS) . '
License Type:
' . safeHTMLstr(OCC_LICENSE_TYPE) . '
License Expires:*
' . safeHTMLstr(OCC_LICENSE_EXPIRES) . '
Licensed Event:
'; if (substr(md5($zl=OCC_LICENSE_EVENT.OCC_LICENSE_TYPE.OCC_LICENSE_EXPIRES), 0, 3) == OCC_LICENSE_){$z='f';$zz=safeHTMLstr(OCC_LICENSE_EVENT);}else{$zz=base64_decode('PHNwYW4gY2xhc3M9ImVyciI+VGhpcyBldmVudCBhcHBlYXJzIHRvIGJlIGltcHJvcGVybHkgbGljZW5zZWQ7IGNvbnRhY3QgPGEgaHJlZj0iaHR0cDovL3d3dy5vcGVuY29uZi5jb20vY29udGFjdC8iPk9wZW5Db25mIFN1cHBvcnQ8L2E+PC9zcGFuPg==');$z='ff';} print $zz.'
• Download OpenConf ' . $OC_configAR['OC_versionLatest'] . '
' . $e . '
'; +} + +print ' + + +'; + +printFooter(); +?> diff --git a/chair/install-complete.php b/chair/install-complete.php new file mode 100644 index 0000000..60f16ae --- /dev/null +++ b/chair/install-complete.php @@ -0,0 +1,57 @@ +Congratulations, you have completed the OpenConf installation! +Proceed to your OpenConf Home Page
+
NOTE: Before accepting file uploads, you will need to change permissions of the file upload directory (default: data/papers/) so that the Web (HTTP) server process has read-write privileges.
+'; +} + +printFooter(); + +?> diff --git a/chair/install-db.php b/chair/install-db.php new file mode 100644 index 0000000..094c19d --- /dev/null +++ b/chair/install-db.php @@ -0,0 +1,296 @@ +' . safeHTMLstr(mysqli_connect_error()); + } else { + // Specify UTF-8 use for connection + if (mysqli_query($dbtest, "SET NAMES " . OCC_DB_ENCODING . " COLLATE " . OCC_DB_COLLATION)) { + // Create DB? + if (isset($_POST['dbcreate']) && ($_POST['dbcreate'] == 1)) { + if (preg_match("/^[\w-]+$/", $_POST['dbname'])) { + $q = "CREATE DATABASE `" . $_POST['dbname'] . "` DEFAULT CHARACTER SET " . OCC_DB_ENCODING . " DEFAULT COLLATE " . OCC_DB_COLLATION; + if (!mysqli_query($dbtest, $q) && (mysqli_errno($dbtest) != 1007)) { // 1007=exists + $e = 'Unable to create database ' . safeHTMLstr($_POST['dbname']) . ". DB Error:Step 1 of 5: Enter Database Settings
'; + +if (!empty($e)) { + print '' . $e . '
'; +} + +print ' + + + + +The above information is stored in config.php';
+
+if (defined('OCC_DB_NAME') && (OCC_DB_NAME != '')) {
+ print '.
If you already configured config.php and loaded the schema, you may skip to the next step.';
+}
+
+print '
+
You must agree to the OpenConf License in order to install or use this software.
'; + } +} else { + header("Location: install.php"); +} + +printFooter(); +?> diff --git a/chair/install.php b/chair/install.php new file mode 100644 index 0000000..427e2f2 --- /dev/null +++ b/chair/install.php @@ -0,0 +1,64 @@ + +Welcome to OpenConf! This appears to be a new install, so we will take you through the set-up and configuration of your OpenConf system. Following are the steps to install OpenConf:
+ ++1. Enter Database Settings + –> +2. Create ' . OCC_WORD_CHAIR . ' Account + –> +3. Tailor Configuration Settings + –> +4. Set Topics + –> +5. Open Submissions & Sign-Up/In +
+ +'; + +function stripDDS($f) { + return(preg_replace("/\.\.\//","",$f)); +} + +$e = ""; +clearstatcache(); +if ((is_file(OCC_CONFIG_FILE) && !is_writable(OCC_CONFIG_FILE)) && (!defined('OCC_DB_NAME') || (OCC_DB_NAME == ''))) { + print ' +Before proceeding, you must allow write privilege by the Web server (HTTP) process to the config.php files.
+'; +} else { + print ' + +'; +} + +print ' +If you have already installed OpenConf but are still seeing this page, change the value of OCC_INSTALL_COMPLETE in config.php
+ +'; + +printFooter(); + +?> diff --git a/chair/list_advocates.php b/chair/list_advocates.php new file mode 100644 index 0000000..8c44576 --- /dev/null +++ b/chair/list_advocates.php @@ -0,0 +1,195 @@ +\n"; + } + } + print "Advocate(s) have been unassigned.
\n"; + if (isset($_POST['s'])) { + print ''; + } + printFooter(); + exit; +} + +if (!isset($_GET['s']) || ($_GET['s'] == "pid")) { + $sortby = "`paperid`"; + $pidsort='S-ID'; +} else { + print ' +
'; } +else { + $currid = null; + $row = 2; // Seed at 2 to handle same IDs + print '
| ' . $nsort . ' | ' . $idsort . ' |
|---|---|
| ' . safeHTMLstr($l['name_first']) . ' ' . safeHTMLstr($l['name_last']) . ' | |
| ' . safeHTMLstr($l['name_first']) . ' ' . safeHTMLstr($l['name_last']) . ' | ' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . ' |
| ' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . ' | |
| ' . safeHTMLstr($l['name_first']) . ' ' . safeHTMLstr($l['name_last']) . ' | ' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . ' |
'; +} else { + print ' +
Note: Only the country of the contact ' . oc_strtolower(OCC_WORD_AUTHOR) . ' is used for reporting
+| Country | Count ' . $OC_sortImg . ' |
|---|---|
| ' . implode(' ', $countries) . ' | ' . $num . " |
| unknown | ' . $nocountry . " |
| Country ' . $OC_sortImg . ' | Count |
| ' . $country . ' | ' . $num . " |
| unknown | ' . $nocountry . " |
| Setting | Name | Description |
|---|---|---|
| ' . safeHTMLstr($l['setting']) . ' | ' . safeHTMLstr($l['name']) . ' | ' . $l['description'] . " |
| ' . safeHTMLstr($OC_modulesAR[$l['module']]['name']) . ' Module' . (oc_moduleActive($l['module']) ? '' : ' - Inactive') . ' | ||
| ' . safeHTMLstr($l['setting']) . ' | ' . safeHTMLstr($l['name']) . ' | ' . $l['description'] . " |
Conflicts have been unset.
'; + print ''; + printFooter(); + exit; + } elseif ($_POST['ocaction'] == 'update') { + if (isset($_POST['alloworgconflict']) && ($_POST['alloworgconflict'] == 'no')) { + updateConfigSetting('OC_allowOrgConflict', 0); + $OC_configAR['OC_allowOrgConflict'] = 0; + } else { + updateConfigSetting('OC_allowOrgConflict', 1); + $OC_configAR['OC_allowOrgConflict'] = 1; + } + if (isset($_POST['allowemailconflict']) && ($_POST['allowemailconflict'] == 'no')) { + updateConfigSetting('OC_allowEmailConflict', 0); + $OC_configAR['OC_allowEmailConflict'] = 0; + } else { + updateConfigSetting('OC_allowEmailConflict', 1); + $OC_configAR['OC_allowEmailConflict'] = 1; + } + } +} + +$pq = "SELECT `" . OCC_TABLE_CONFLICT . "`.`paperid`, `" . OCC_TABLE_CONFLICT . "`.`reviewerid`, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, `title` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_REVIEWER . "`, `" . OCC_TABLE_CONFLICT . "` WHERE `" . OCC_TABLE_CONFLICT . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` AND `" . OCC_TABLE_CONFLICT . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid`"; + +if (empty($_GET['s']) || ($_GET['s'] == "pid")) { + $q = $pq . " ORDER BY `" . OCC_TABLE_CONFLICT . "`.`paperid`, `" . OCC_TABLE_CONFLICT . "`.`reviewerid`"; + $sortid = "paper"; + $pidsort='P-IDManually Set Conflicts: [set]
+'; + +$r = ocsql_query($q) or err("Unable to get information"); +if (ocsql_num_rows($r) == 0) { + print 'No conflicts have been set.
'; +} else { + $s = substr($sortid, 0, 1); + + print ' + +'; +} + +// Show auto-detected conflicts +print ' +Automatically Detected Conflicts:
+ +'; + +if (($OC_configAR['OC_allowEmailConflict'] == 1) && ($OC_configAR['OC_allowOrgConflict'] == 1)) { + print 'Auto-conflict detection is disabled; change settings above.
'; +} else { + $q = "SELECT `" . OCC_TABLE_AUTHOR . "`.`paperid`, `reviewerid`, `title`, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name` FROM `" . OCC_TABLE_AUTHOR . "`, `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_REVIEWER . "` WHERE " . + "`" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` AND ("; + if ($GLOBALS['OC_configAR']['OC_allowEmailConflict'] == 0) { + $q .= " (`" . OCC_TABLE_AUTHOR . "`.`email`=`" . OCC_TABLE_REVIEWER . "`.`email`)"; + } + if ($GLOBALS['OC_configAR']['OC_allowOrgConflict'] == 0) { + if ($GLOBALS['OC_configAR']['OC_allowEmailConflict'] == 0) { + $q .= " OR"; + } + $q .= " (`" . OCC_TABLE_AUTHOR . "`.`organization` <> '' AND `" . OCC_TABLE_AUTHOR . "`.`organization`=`" . OCC_TABLE_REVIEWER . "`.`organization`)"; + } + $q .= ") GROUP BY `paperid`, `reviewerid`, `title`, `name` ORDER BY `paperid`, `reviewerid`"; + $r = ocsql_query($q) or err("Unable to get auto paper/reviewer conflicts"); + if (ocsql_num_rows($r) < 1) { + print 'No conflicts detected
'; + } else { + print '| Submission | Reviewer |
|---|---|
| ' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . ' | ' . $l['reviewerid'] .'. ' . safeHTMLstr($l['name']) . ' | '; + $row = $rowAR[$row]; + } + print '
For a match to occur, the email address or organization name must be exactly the same.
'; + } +} + +// Check for addt'l (hook) conflict displays +if (isset($OC_hooksAR['list_conflicts-display']) && !empty($OC_hooksAR['list_conflicts-display'])) { + foreach ($OC_hooksAR['list_conflicts-display'] as $hook) { + print 'No files found
'; + } +} else { + print 'Unable to open files directory
'; +} + +printFooter(); + +?> diff --git a/chair/list_papers.js b/chair/list_papers.js new file mode 100644 index 0000000..374eac5 --- /dev/null +++ b/chair/list_papers.js @@ -0,0 +1,44 @@ +// +----------------------------------------------------------------------+ +// | OpenConf | +// +----------------------------------------------------------------------+ +// | Copyright (c) 2002-2020 Zakon Group LLC. All Rights Reserved. | +// +----------------------------------------------------------------------+ +// | This source file is subject to the OpenConf License, available on | +// | the OpenConf web site: www.OpenConf.com | +// +----------------------------------------------------------------------+ + +var oc_ftAR = new Array(); +var oc_accAR = new Array(); + +// Updates checkboxes based on form selection +function selectBoxes() { + var boxSelectID = document.getElementById("boxselect"); + var boxSelect = boxSelectID.options[boxSelectID.selectedIndex].value; + if (boxSelect == "all") { + for (i=0; iwithdrawing id $paperid ... "; + if (! withdrawPaper($paperid, OCC_WORD_CHAIR)) { + print 'SUBMISSION NOT FOUND'; + } + print "
\n"; + $log = false; + } else { + print "deleting id $paperid ...
\n"; + } + // delete paper + deletePaper($paperid, $log); + } else { + print "Unable to process submission id " . safeHTMLstr($paperid) . ".The number of submissions selected may have been greater than supported by this server. Additional passes may be required.
'; + } + } elseif (preg_match("/^(Restore|Delete Withdrawn) Submissions$/", $_POST['subaction']) && isset($_POST['wpapers']) && !empty($_POST['wpapers'])) { + foreach ($_POST['wpapers'] as $paperid) { + if (preg_match("/^\d+$/",$paperid)) { + if ($_POST['subaction'] == 'Restore Submissions') { // restore? + print "restoring id $paperid ... "; + $ret = restorePaper($paperid); + if ($ret != $paperid) { + if ($ret === null) { + print 'SUBMISSION NOT FOUND'; + } else { + print 'Duplicate ID -- New ID Assigned: ' . safeHTMLstr($ret) . ''; + } + } + print "
\n"; + } elseif ($_POST['subaction'] == 'Delete Withdrawn Submissions') { // delete withdrawn? + print "deleting withdrawn id $paperid ... "; + if ( ! ocsql_query("DELETE FROM `" . OCC_TABLE_WITHDRAWN . "` WHERE `paperid`='" . safeSQLstr($paperid) . "' LIMIT 1") ) { + print 'DELETION FAILED'; + } + print "
\n"; + } + } else { + print "Unable to process submission id " . safeHTMLstr($paperid) . ".The number of submissions selected may have been greater than supported by this server. Additional passes may be required.
'; + } + } + + print ''; + printFooter(); + exit; +} + +// Headers & Sorting +$rsortstr = 'ID'; +$tsortstr = 'Title'; +$nsortstr = 'Contact ' . OCC_WORD_AUTHOR . ''; +$ssortstr = 'Stud.'; +$stsortstr = 'Type'; + +if (!isset($_GET['s'])) { + $_GET['s'] = 'id'; +} +switch ($_GET['s']) { + case 'id': + $sortby = "`paperid`"; + $rsortstr = 'IDNo submissions available.
'; +} else { + print ' + + + +'; +} + +$q = "SELECT `paperid`, `title`, `contact_author`, `contact_email`, `withdraw_date`, `withdrawn_by` FROM `" . OCC_TABLE_WITHDRAWN . "` ORDER BY `paperid`"; +$r = ocsql_query($q) or err('Unable to check for withdrawn submissions'); +if ((ocsql_num_rows($r) > 0) && empty($atype) && empty($stype)) { + print ' + +Withdrawn Submissions
+ + +'; +} + +printFooter(); + +?> diff --git a/chair/list_reviewers.php b/chair/list_reviewers.php new file mode 100644 index 0000000..f117095 --- /dev/null +++ b/chair/list_reviewers.php @@ -0,0 +1,170 @@ +All Committee Members'; + print ' + +'; +} + +if (isset($_POST['faction']) && isset($_POST['revids']) && !empty($_POST['revids'])) { + // Check for valid submission + if (!validToken('chair')) { + warn('Invalid submission'); + } + + if ($_POST['faction'] == "Delete Members") { // delete members + foreach ($_POST['revids'] as $reviewerid) { + if (preg_match("/^\d+$/", $reviewerid)) { + oc_deleteAssignments(null, $reviewerid, 'advocate'); + oc_deleteAssignments(null, $reviewerid); + issueSQL("DELETE FROM `" . OCC_TABLE_REVIEWERTOPIC . "` WHERE `reviewerid`='" . safeSQLstr($reviewerid) . "'"); + issueSQL("DELETE FROM `" . OCC_TABLE_REVIEWER . "` WHERE `reviewerid`='" . safeSQLstr($reviewerid) . "'"); + + if (oc_hookSet('delete_reviewer')) { + foreach ($GLOBALS['OC_hooksAR']['delete_reviewer'] as $inc) { + include $inc; + } + } + } + } + } elseif ($_POST['faction'] == "Add to PC") { // add to program committee + foreach ($_POST['revids'] as $reviewerid) { + if (preg_match("/^\d+$/", $reviewerid)) { + issueSQL("UPDATE " . OCC_TABLE_REVIEWER . " SET `onprogramcommittee`='T' WHERE `reviewerid`='" . safeSQLstr($reviewerid) . "' LIMIT 1"); + } + } + } elseif ($_POST['faction'] == "Remove from PC") { // remove from program committee + foreach ($_POST['revids'] as $reviewerid) { + if (preg_match("/^\d+$/", $reviewerid)) { + oc_deleteAssignments(null, $reviewerid, 'advocate'); + issueSQL("UPDATE `" . OCC_TABLE_REVIEWER . "` SET `onprogramcommittee`='F' WHERE `reviewerid`='" . safeSQLstr($reviewerid) . "' LIMIT 1"); + } + } + } +} + +if (!isset($_REQUEST['s']) || empty($_REQUEST['s']) || ($_REQUEST['s'] == "id")) { + $sortby = "`reviewerid`"; + $rsortstr = 'ID'; +} else { + print ' +
Count: ' . ocsql_num_rows($r) . '
+Note: If you choose to delete committee member(s), all review ' . ($OC_configAR['OC_paperAdvocates'] ? 'and advocacy ' : '') . ' data will also be deleted.
+ +'; +} + +printFooter(); + +?> diff --git a/chair/list_reviewers_country.php b/chair/list_reviewers_country.php new file mode 100644 index 0000000..542354f --- /dev/null +++ b/chair/list_reviewers_country.php @@ -0,0 +1,104 @@ +All Committee Members'; + print ' + +'; +} + +$q = "SELECT `country`, COUNT(`reviewerid`) AS `num` FROM `" . OCC_TABLE_REVIEWER . "` $cmtSQL GROUP BY `country` ORDER BY `num` DESC"; +$r = ocsql_query($q) or err("Unable to get information"); +if (ocsql_num_rows($r) == 0) { + print 'No committee members have signed up yet'; +} else { + print ' +
| Country ' . $OC_sortImg . ' | Count |
|---|---|
| ' . $country . ' | ' . $num . " |
| unknown | ' . $nocountry . " |
| Country | Count ' . $OC_sortImg . ' |
| ' . implode(' ', $countries) . ' | ' . $num . " |
| unknown | ' . $nocountry . " |
'; +} else { + $s = substr($sortid,0,1); + + print '
| Review Status: | Marked as Complete | +Started | +Not Yet Saved | +
| Recommendation: | '; + foreach ($OC_reviewQuestionsAR['recommendation']['values'] as $k => $v) { + print '(' . $k . ') ' . safeHTMLstr(preg_match('/:/', $v) ? substr($v,0,strpos($v,':')) : substr($v,0,30)) . ' '; + } + print ' + |
Invalid change request. Were submissions selected?
'; + } +} + +// Get accept/reject/pending count +$r = ocsql_query("SELECT `accepted`, COUNT(*) AS `count` FROM `" . OCC_TABLE_PAPER . "` GROUP BY `accepted`") or err("Unable to get score count"); +if (ocsql_num_rows($r) == 0) { + warn('No submissions have been made yet.'); +} +$accCountAR = array(); +while ($l = ocsql_fetch_array($r)) { + if (empty($l['accepted'])) { + $accCountAR['Pending'] = $l['count']; + } else { + $accCountAR[$l['accepted']] = $l['count']; + } +} + + +// Get pending papers advocate recommendation counts +$advcountTotal = 0; +$advCountAR = array(); +if (isset($accCountAR['Pending']) && ($accCountAR['Pending'] > 0)) { + $cq = "SELECT `adv_recommendation`, COUNT(`advocateid`) AS `count` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_PAPERADVOCATE . "` WHERE `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERADVOCATE . "`.`paperid` AND `" . OCC_TABLE_PAPER . "`.`accepted` IS NULL GROUP BY `adv_recommendation`"; + if ($cr = ocsql_query($cq)) { + while ($cl = ocsql_fetch_array($cr)) { + if (empty($cl['adv_recommendation'])) { + $advCountAR['Pending'] = $cl['count']; + } else { + $advCountAR[$cl['adv_recommendation']] = $cl['count']; + } + $advcountTotal += $cl['count']; + } + } +} + +// Select sort order +$psort='Submission ID. Title'; +$ssort='Score'; +$arsort='Advocate'; +} else { + print ' +
+
+ + |
+Legend: +
|
+
'; } +else { + print ' +
Score: ' . $usescore . "
\nKeywords: " . safeHTMLstr($l['keywords']) . "
\n" . OCC_WORD_AUTHOR . " Topics:
'; +} else { + print ' +
| ' . $tsort . ' | ' . $psort . ' | |
|---|---|---|
| ' . safeHTMLstr(useTopic($l['short'], $l['topicname']) . ' (' . $l['topicid'] . ')') . ' | ||
| ' . safeHTMLstr(useTopic($l['short'], $l['topicname']) . ' (' . $l['topicid'] . ')') . ' | ' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . ' | |
| ' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . ' | ||
| ' . safeHTMLstr(useTopic($l['short'], $l['topicname']) . ' (' . $l['topicid'] . ')') . ' | ' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . ' | |
'; +} else { + print '
| ' . $tsort . ' | ' . $nsort .' |
|---|---|
| ' . safeHTMLstr(useTopic($l['short'],$l['topicname'])) . ' | ' . $l['num'] . " |
'; +} else { + print ' +
| ' . $topicsortstr . ' | Committee Member ' . $memberidsortstr . '. ' . $membernamesortstr . ' | |
|---|---|---|
| '; + } else { + $row = $rowAR[$row]; + print ' | ||
| ' . safeHTMLstr(useTopic($l['short'],$l['topicname'])) . ' | '; + $currid = $l['topicid']; + } + print '' . $l['reviewerid'] . '. ' . safeHTMLstr($l['name']) . ''; + if (($cmt != 'pc') && ($l['onprogramcommittee'] == 'T')) { + print " [PC]"; + } + print " | |
| ' . safeHTMLstr(useTopic($l['short'],$l['topicname'])) . ' | '; + } else { + $row = $rowAR[$row]; + $currid = $l['reviewerid']; + print ' | |
| ' . safeHTMLstr(useTopic($l['short'],$l['topicname'])) . ' | ' . $l['reviewerid'] . '. ' . safeHTMLstr($l['name']) . ''; + if (($cmt != 'pc') && ($l['onprogramcommittee'] == 'T')) { + print " [PC]"; + } + print ' | '; + } + print "|
'; +} else { + print '
| ' . $tsort . ' | ' . $nsort .' |
|---|---|
| ' . safeHTMLstr(useTopic($l['short'],$l['topicname'])) . ' | ' . $l['num'] . " |
show all ' . safeHTMLstr($type) . ' entries | search
'; + } + + // Get email entries with failed messages + $failedMessageAR = array(); + $q = "SELECT `queued` FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE `sent` IS NULL GROUP BY `queued`"; + $r = ocsql_query($q) or err('Unable to retrieve email log entries'); + while ($l = ocsql_fetch_assoc($r)) { + $failedMessageAR[] = $l['queued']; + } + + // retrieve entries + $q = "SELECT * FROM `" . OCC_TABLE_LOG . "` WHERE `type`" . (empty($type) ? "!='sql'" : ("='" . safeSQLstr($type) . "'")) . " ORDER BY `datetime` DESC" . $limit; + $r = ocsql_query($q) or err('Unable to retrieve log entries'); + if (ocsql_num_rows($r) == 0) { + warn('No log entries were found'); + } + + // display entries + if ($GLOBALS['OC_configAR']['OC_timeZone'] != 'UTC') { + print 'The Date/Time column is shown in Coordinated Universal Time (UTC).
UTC ' . date('P') . ' = ' . safeHTMLstr($GLOBALS['OC_configAR']['OC_timeZone'] ) . '
| Date / Time (UTC) | Type | Entry |
|---|---|---|
| '; + if (!empty($l['extra'])) { // extra stuff? if so link it in + print '' . safeHTMLstr($l['datetime']) . ''; + } else { + print safeHTMLstr($l['datetime']); + } + print ' | ' . safeHTMLstr($l['type']); + if (($l['type'] == 'email') && in_array($l['datetime'], $failedMessageAR)) { + print ' – failed'; + } + print ' | ' . safeHTMLstr($l['entry']) . " |
The variables appearing next to the message field may be used in your email by enclosing each instance in [:variable:] . These will be substituted for their value prior to the email being sent. For example, to include the conference (short) name in your message use [:OC_confName:] . Some variables are only available for certain types of notification.
+'; + + printFooter(); + exit; +} + +if (isset($_GET['ocaction']) && ($_GET['ocaction'] == 'edit') && isset($_GET['tid']) && isset($templateAR[$_GET['tid']])) { + $r = ocsql_query("SELECT `name`, `subject`, `body`, `variables` FROM `" . OCC_TABLE_TEMPLATE . "` WHERE `type`='notification' AND `templateid`='" . safeSQLstr($_GET['tid']) . "'") or err('Unable to retrieve template'); + if (ocsql_num_rows($r) == 1) { + $l = ocsql_fetch_assoc($r); + oc_templateForm($_GET['tid'], $l['subject'], $l['body']); + } else { + print 'Template not found
'; + } +} elseif (isset($_POST['ocaction']) && ($_POST['ocaction'] == 'Save Template')) { + $templateid = (isset($_POST['templateid']) ? trim($_POST['templateid']) : ''); + $subject = (isset($_POST['subject']) ? trim($_POST['subject']) : ''); + $body = (isset($_POST['body']) ? trim($_POST['body']) : ''); + + $err = ''; + if ( ! preg_match("/^[\w-]+$/", $templateid) || ! isset($templateAR[$templateid]) ) { + warn('Template ID invalid'); + } elseif (preg_match("/[\r\n]/", $subject)) { + $err = 'Subject invalid'; + } else { + $q = "UPDATE `" . OCC_TABLE_TEMPLATE . "` SET `subject`='" . safeSQLstr($subject) . "', `body`='" . safeSQLstr($body) . "', `updated`='" . safeSQLstr(date("Y-m-d")) . "' WHERE `templateid`='" . safeSQLstr($templateid) . "' AND `type`='notification' LIMIT 1"; + if ( ! ocsql_query($q) ) { + $err = 'Unable to add/update database'; + } + } + + if (empty($err)) { + print 'Template saved
'; + } else { + print '' . $err . '
'; + } + + oc_templateForm($templateid, $subject, $body); + + exit; +} + +print ' +click name to edit
+If modifying a template and non-English language(s)
in use, include translation(s) in the template.
Please re-enter your settings, noting the following:
Settings Saved
'; + } + + $OC_privacy_policy = $_POST['OC_privacy_policy']; +} else { + // retrieve policy template + list($none, $OC_privacy_policy) = oc_getTemplate('privacy_policy'); +} + +print ' + +'; + +oc_replaceCKEditor(array('OC_privacy_policy'), true, 600, 400); + +printFooter(); + +?> \ No newline at end of file diff --git a/chair/reset.php b/chair/reset.php new file mode 100644 index 0000000..9e2456c --- /dev/null +++ b/chair/reset.php @@ -0,0 +1,55 @@ +Functionality disabled'; +} +elseif (isset($_POST['submit']) && ($_POST['submit'] == "Reset Password") && preg_match("/^\w+$/",$_POST['uname'])) { + if (oc_strtolower($OC_configAR['OC_chair_uname']) != oc_strtolower($_POST['uname'])) { + print '' . OCC_WORD_CHAIR . ' username entered is invalid.
'; + } + else { // username valid + $newpwd = oc_password_generate(); + updateConfigSetting('OC_chair_pwd', oc_password_hash($newpwd)) or err('Unable to create new password'); + $msg = ' +Per your request, we have issued you a new ' . OCC_WORD_CHAIR. ' password for accessing the ' . $OC_configAR['OC_confName'] . ' OpenConf system. The new password is: + + ' . $newpwd . ' + +You may change this password at any time by signing in to the OpenConf system and updating your profile. + +'; + if (sendEmail($OC_configAR['OC_pcemail'], OCC_WORD_CHAIR . " Password Reset", $msg)) { + print 'We have emailed you a new password. Once you receive it, please sign in and change it.
'; + } else { + warn('We have generated a new password for you, but were unable to email it. Please contact the OpenConf administrator'); + } + } +} else { + print ' +Enter ' . OCC_WORD_CHAIR . '\'s username and click the Reset Password button
+ ++'; +} + +printFooter(); + +?> diff --git a/chair/search.inc b/chair/search.inc new file mode 100644 index 0000000..110ca53 --- /dev/null +++ b/chair/search.inc @@ -0,0 +1,296 @@ + substr($OC_fieldAR[$f]['short'], 0, 30), + 'type' => $OC_fieldAR[$f]['type'], + 'fieldset' => $fsAR['fieldset'] + ); + if ($OC_fieldAR[$f]['type'] == 'date') { + $dateFieldsAR[] = $f; + } + if (isset($OC_fieldAR[$f]['values']) && is_array($OC_fieldAR[$f]['values']) && (count($OC_fieldAR[$f]['values']) > 0)) { + if (!isset($OC_fieldAR[$f]['usekey']) || $OC_fieldAR[$f]['usekey']) { + $fieldsAR[$f]['values'] = $OC_fieldAR[$f]['values']; + } else { + $fieldsAR[$f]['values'] = array(); + foreach ($OC_fieldAR[$f]['values'] as $v) { + $fieldsAR[$f]['values'][$v] = $v; + } + } + } + } + } + } +} + +function queryFieldWrapper($table, $field, $fieldType, $fieldValue, $operator, $tableFieldOverride=null) { + if ($tableFieldOverride !== null) { + $tableField = $tableFieldOverride; + } else { + $tableField = "`" . $table . "`.`" . safeSQLstr($field) . "`"; + } + $qf = ''; + if (($fieldType == 'checkbox') || ($fieldType == 'picklist')) { + $qf = "FIND_IN_SET('" . safeSQLstr($fieldValue) . "', " . $tableField . ") "; + } else { + if ($operator == 'contains') { + $qf = $tableField . " LIKE '%" . safeSQLstr(preg_replace(array('/_/', '/%/'), array('\\_', '\\%'), oc_strtolower($fieldValue))) . "%'" ; + } elseif ($operator == 'before') { + $qf = "( (" . $tableField . "<'" . safeSQLstr(oc_strtolower($fieldValue)) . "') OR (" . $tableField . " IS NULL) )"; + } elseif ($operator == 'after') { + $qf = $tableField . ">'" . safeSQLstr(oc_strtolower($fieldValue)) . "'"; + } elseif ($operator == 'onbefore') { + $qf = "( (" . $tableField . "<='" . safeSQLstr(oc_strtolower($fieldValue)) . "') OR (" . $tableField . " IS NULL) )"; + } elseif ($operator == 'onafter') { + $qf = $tableField . ">='" . safeSQLstr(oc_strtolower($fieldValue)) . "'"; + } else { + $qf = $tableField . "='" . safeSQLstr(oc_strtolower($fieldValue)) . "'"; + } + } + return($qf); +} + +function displayResultsHeader() { + header('Content-type: text/html; charset=utf-8'); + print ' + +
Select one or more fields to search on and enter your query, then click the Search button. The search will find submissions matching all non-empty queries. When selecting fields with pre-defined values, the text query box will be replaced with a drop-down list of the values.
+ + + + +'; + +} \ No newline at end of file diff --git a/chair/search_committee.php b/chair/search_committee.php new file mode 100644 index 0000000..dcd0c3f --- /dev/null +++ b/chair/search_committee.php @@ -0,0 +1,131 @@ + 'Member ID', + 'type' => 'int', + 'fieldset' => '', +); +$intFieldsAR[] = 'reviewerid'; + +if ($OC_configAR['OC_paperAdvocates']) { + $fieldsAR['onprogramcommittee'] = array( + 'short' => 'PC Member', + 'type' => 'dropdown', + 'fieldset' => '', + 'values' => array('T' => 'Yes', 'F' => 'No') + ); +} + +setupFieldsAR($fieldsAR, $OC_reviewerFieldSetAR, $OC_reviewerFieldAR, $dateFieldsAR, $skipFieldTypeAR, $skipFieldIdAR); + +$fieldsAR['signupdate'] = array( + 'short' => 'Sign Up Date', + 'type' => 'date', + 'fieldset' => 'Extras', +); +$dateFieldsAR[] = 'signupdate'; + +$fieldsAR['lastsignin'] = array( + 'short' => 'Last Sign In', + 'type' => 'date', + 'fieldset' => 'Extras', +); +$dateFieldsAR[] = 'lastsignin'; + +// Hooks +// -- Use 'Extras' for fieldset name +if (oc_hookSet('search-committee')) { + foreach ($GLOBALS['OC_hooksAR']['search-committee'] as $v) { + require_once $v; + } +} + +// Search Submission POST +if (isset($_POST['ocsubmit']) && ($_POST['ocsubmit'] == 'Search')) { + displayResultsHeader(); + + // Check for valid submission + if (!validToken('chair')) { + print 'Invalid submission
'; + } else { + $q = ''; + $includeTopic = false; + for ($i=1; $i <= $searchFieldNum; $i++) { + if (validateSearchFields($i, $fieldsAR, $intFieldsAR, $dateFieldsAR)) { + $f = $_POST['searchfield'.$i]; + $fval = $_POST['searchvalue'.$i]; + if ($f == 'topics') { + $q .= " AND " . queryFieldWrapper(OCC_TABLE_REVIEWERTOPIC, 'topicid', 'dropdown', $fval, false); + $includeTopic = true; + } else { + $q .= " AND " . queryFieldWrapper(OCC_TABLE_REVIEWER, $f, $fieldsAR[$f]['type'], $fval, $_POST['searchoperator'.$i]); + } + } + } + + if (!empty($q)) { + $q = "SELECT `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, `" . OCC_TABLE_REVIEWER . "`.`username`, `" . OCC_TABLE_REVIEWER . "`.`onprogramcommittee`, CONCAT_WS(' ', `" . OCC_TABLE_REVIEWER . "`.`name_first`, `" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, `" . OCC_TABLE_REVIEWER . "`.`email` FROM `" . OCC_TABLE_REVIEWER . "`" . ($includeTopic ? (", `" . OCC_TABLE_REVIEWERTOPIC . "`") : '') . " WHERE 1=1 " . ($includeTopic ? ("AND `" . OCC_TABLE_REVIEWER . "`.`reviewerid`=`" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid` ") : '') . $q . " GROUP BY `" . OCC_TABLE_REVIEWER . "`.`reviewerid` ORDER BY `reviewerid`"; + if ($r = ocsql_query($q)) { + if (($num = ocsql_num_rows($r)) > 0) { + print ' +Matches: ' . safeHTMLstr($num) . '
+| ID | PC | Name | Username |
|---|---|---|---|
| ' . safeHTMLstr($l['reviewerid']) . ' | ' . (($l['onprogramcommittee'] == 'T') ? '✓' : '') . ' | ' . safeHTMLstr($l['name']) . ' | ' . safeHTMLstr($l['username']) . ' |
No matches found
'; + } + } else { + print 'Error encoutered while searching
'; + } + } else { + print 'Missing or invalid search parameters
'; + } + } + + displayResultsFooter(); + exit; +} + +// Display search form +printHeader('Committee Members Search', 1); +displaySearchForm($fieldsAR, $dateFieldsAR, $intFieldsAR, $decFieldsAR, $searchFieldNum); +printFooter(); + +?> \ No newline at end of file diff --git a/chair/search_submissions.php b/chair/search_submissions.php new file mode 100644 index 0000000..929e194 --- /dev/null +++ b/chair/search_submissions.php @@ -0,0 +1,182 @@ + 'Submission ID', + 'type' => 'int', + 'fieldset' => '', +); +$intFieldsAR[] = 'paperid'; + +setupFieldsAR($fieldsAR, $OC_submissionFieldSetAR, $OC_submissionFieldAR, $dateFieldsAR, $skipFieldTypeAR, $skipFieldIdAR); + +$fieldsAR['submissiondate'] = array( + 'short' => 'Submission Date', + 'type' => 'date', + 'fieldset' => 'Extras', +); +$dateFieldsAR[] = 'submissiondate'; + +$fieldsAR['lastupdate'] = array( + 'short' => 'Last Updated', + 'type' => 'date', + 'fieldset' => 'Extras', +); +$dateFieldsAR[] = 'lastupdate'; + +$fieldsAR['accepted'] = array( + 'short' => 'Acceptance Decision', + 'type' => 'dropdown', + 'fieldset' => 'Extras', + 'values' => array() +); +// values also used for adv_recommendation below +foreach ($OC_acceptanceValuesAR as $acc) { + $fieldsAR['accepted']['values'][$acc['value']] = $acc['value']; +} +$fieldsAR['accepted']['values']['_NULL_'] = 'pending'; + +if ($OC_configAR['OC_paperAdvocates']) { + $fieldsAR['adv_recommendation'] = array( + 'short' => 'Advocate Recommendation', + 'type' => 'dropdown', + 'fieldset' => 'Extras', + 'values' => $fieldsAR['accepted']['values'] + ); + $fieldsAR['advocateid'] = array( + 'short' => 'Advocate ID (assigned)', + 'type' => 'int', + 'fieldset' => 'Extras' + ); + $intFieldsAR[] = 'advocateid'; +} + +$fieldsAR['reviewerid'] = array( + 'short' => 'Reviewer ID (assigned)', + 'type' => 'int', + 'fieldset' => 'Extras' +); +$intFieldsAR[] = 'reviewerid'; + +$fieldsAR['score'] = array( + 'short' => 'Reviews Score (average)', + 'type' => 'int', + 'fieldset' => 'Extras', +); +$decFieldsAR[] = 'score'; + +// Hooks +// -- Use 'Extras' for fieldset name +if (oc_hookSet('search-submissions')) { + foreach ($GLOBALS['OC_hooksAR']['search-submissions'] as $v) { + require_once $v; + } +} + +// Search Submission POST +if (isset($_POST['ocsubmit']) && ($_POST['ocsubmit'] == 'Search')) { + displayResultsHeader(); + + // Check for valid submission + if (!validToken('chair')) { + print 'Invalid submission
'; + } else { + $q = ''; + $includeTopic = false; + $includeAdvocate = false; + $includeReviewer = false; + for ($i=1; $i <= $searchFieldNum; $i++) { + if (validateSearchFields($i, $fieldsAR, $intFieldsAR, $dateFieldsAR, $decFieldsAR)) { + $f = $_POST['searchfield'.$i]; + $fval = $_POST['searchvalue'.$i]; + if ($f == 'topics') { + $q .= " AND " . queryFieldWrapper(OCC_TABLE_PAPERTOPIC, 'topicid', 'dropdown', $fval, false); + $includeTopic = true; + } elseif ( ($f == 'accepted') && ($fval == '_NULL_') ) { + $q .= " AND `" . OCC_TABLE_PAPER . "`.`accepted` IS NULL"; + } elseif ($OC_configAR['OC_paperAdvocates'] && ($f == 'adv_recommendation')) { + $q .= " AND " . queryFieldWrapper(OCC_TABLE_PAPERADVOCATE, 'adv_recommendation', 'dropdown', $fval, false); + $includeAdvocate = true; + } elseif ($OC_configAR['OC_paperAdvocates'] && ($f == 'advocateid')) { + $q .= " AND " . queryFieldWrapper(OCC_TABLE_PAPERADVOCATE, 'advocateid', 'int', $fval, $_POST['searchoperator'.$i]); + $includeAdvocate = true; + } elseif ($f == 'reviewerid') { + $q .= " AND " . queryFieldWrapper(OCC_TABLE_PAPERREVIEWER, 'reviewerid', 'int', $fval, $_POST['searchoperator'.$i]); + $includeReviewer = true; + } elseif ($f == 'score') { + $q .= " AND `" . OCC_TABLE_PAPER . "`.`paperid` IN (SELECT `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid` FROM `" . OCC_TABLE_PAPERREVIEWER . "` GROUP BY `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid` HAVING " . queryFieldWrapper(OCC_TABLE_PAPERREVIEWER, 'score', 'dropdown', $fval, $_POST['searchoperator'.$i], "AVG(`" . OCC_TABLE_PAPERREVIEWER . "`.`score`)") . ")"; + } elseif (in_array($f, $OC_submissionFieldSetAR['fs_authors']['fields'])) { + $q .= " AND " . queryFieldWrapper(OCC_TABLE_AUTHOR, $f, $fieldsAR[$f]['type'], $fval, $_POST['searchoperator'.$i]); + } else { + $q .= " AND " . queryFieldWrapper(OCC_TABLE_PAPER, $f, $fieldsAR[$f]['type'], $fval, $_POST['searchoperator'.$i]); + } + } + } + + // Display results + if (!empty($q)) { + $q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`title`, `" . OCC_TABLE_PAPER . "`.`type`, CONCAT_WS(' ', `" . OCC_TABLE_AUTHOR . "`.`name_first`, `" . OCC_TABLE_AUTHOR . "`.`name_last`) AS `name`, `" . OCC_TABLE_AUTHOR . "`.`email` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "`" . ($includeTopic ? (", `" . OCC_TABLE_PAPERTOPIC . "`") : '') . ($includeAdvocate ? (", `" . OCC_TABLE_PAPERADVOCATE . "`") : '') . ($includeReviewer ? (", `" . OCC_TABLE_PAPERREVIEWER . "`") : '') . " WHERE `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` AND `" . OCC_TABLE_PAPER . "`.`contactid`=`" . OCC_TABLE_AUTHOR . "`.`position` " . ($includeTopic ? ("AND `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERTOPIC . "`.`paperid` ") : '') . ($includeAdvocate ? ("AND `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERADVOCATE . "`.`paperid` ") : '') . ($includeReviewer ? ("AND `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERREVIEWER . "`.`paperid` ") : '') . $q . " GROUP BY `paperid` ORDER BY `paperid`"; + if ($r = ocsql_query($q)) { + if (($num = ocsql_num_rows($r)) > 0) { + print ' +Matches: ' . safeHTMLstr($num) . '
+| ID | Title | Contact | ' . (isset($fieldsAR['type']) ? 'Type | ' : '') . '
|---|---|---|---|
| ' . safeHTMLstr($l['paperid']) . ' | ' . safeHTMLstr($l['title']) . ' | ' . safeHTMLstr($l['name']) . ' | ' . (isset($fieldsAR['type']) ? ('' . safeHTMLstr($l['type']) . ' | ') : '') . '
No matches found
'; + } + } else { + print 'Error encoutered while searching
'; + } + } else { + print 'Missing or invalid search parameters
'; + } + } + + displayResultsFooter(); + + exit; +} + +// Display search form +printHeader('Submissions Search', 1); +displaySearchForm($fieldsAR, $dateFieldsAR, $intFieldsAR, $decFieldsAR, $searchFieldNum); +printFooter(); + +?> \ No newline at end of file diff --git a/chair/set_config.php b/chair/set_config.php new file mode 100644 index 0000000..1c19a03 --- /dev/null +++ b/chair/set_config.php @@ -0,0 +1,585 @@ + + + +'; + +if (!OCC_INSTALL_COMPLETE && isset($_REQUEST['install']) && ($_REQUEST['install'] == 1)) { + require_once "install-include.php"; + $token = ''; +} else { + beginChairSession(); + printHeader("Configuration", 1); + $token = $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken']; + // Display active modules config + if (isset($OC_activeModulesAR) && !empty($OC_activeModulesAR)) { + $modules = array(); + foreach ($OC_activeModulesAR as $module) { + if (is_file('../modules/' . $module . '/settings.inc')) { + $modules[$module] = $OC_modulesAR[$module]['name']; + } + } + asort($modules); + $moduleOptions = ''; + foreach ($modules as $mid => $mname) { + $moduleOptions .= ''; + } + if (!empty($moduleOptions)) { + print ' + +'; + } + } +} + +// YesNo fields +$yesNoFieldsAR = array('OC_notifyIncludeIP', 'OC_reviewerReadPapers', 'OC_reviewerSeeAssignedReviews', 'OC_reviewerCompleteBeforeSAR', 'OC_reviewerSeeOtherReviews', 'OC_reviewerSeeDecision', 'OC_reviewerSeeOtherReviewers', 'OC_reviewerSeeAuthors', 'OC_reviewerUnassignReviews', 'OC_reviewerSeeAdvocate', 'OC_advocateReadPapers', 'OC_advocateSeeOtherReviews', 'OC_advocateSeeAuthors', 'OC_advocateSeeDecision', 'OC_paperAdvocates', 'OC_editAcceptedOnly', 'OC_authorOneContact', 'OC_authorViewSubIfEditClosed'); + +// Notification array +$notifyAR = array( + 'OC_notifyAuthorSubmit' => OCC_WORD_AUTHOR . ' makes a submission', + 'OC_notifyAuthorEdit' => OCC_WORD_AUTHOR . ' updates (edits) submission', + 'OC_notifyAuthorEmailPapers' => OCC_WORD_AUTHOR . ' requests own submission list emailed', + 'OC_notifyAuthorUpload' => OCC_WORD_AUTHOR . ' uploads a file', + 'OC_notifyAuthorReset' => OCC_WORD_AUTHOR . ' requests password reset', + 'OC_notifyAuthorWithdraw' => OCC_WORD_AUTHOR . ' withdraws submission', + 'OC_notifyReviewerSignup' => 'Committee member signs up for account', + 'OC_notifyReviewerProfileUpdate' => 'Committee member updates profile', + 'OC_notifyReviewerReset' => 'Committee member resets password', + 'OC_notifyReviewerEmailUsername' => 'Committee member requests username emailed' +); + +// Fields that may be updated through this form +$settingsAR = array_merge($yesNoFieldsAR, array_keys($notifyAR), array( + 'OC_confNameFull', 'OC_confName', 'OC_confURL', 'OC_headerImage', 'OC_homePageNotice', 'OC_pcemail', 'OC_confirmmail', 'OC_keycode_reviewer', 'OC_reviewerSignUpNotice', 'OC_committeeFooter', 'OC_keycode_program', 'OC_programSignUpNotice', 'startid', 'OC_paperSubNote', 'OC_subConfirmNotice', 'OC_authorsMinDisplay', 'OC_authorsMax', 'OC_extar', 'OC_locales', 'OC_localeDefault', 'OC_timeZone', 'OC_wordForAuthor', 'OC_wordForChair' +)); + +if (OCC_ADVANCED_CONFIG) { + $emailAuthorRecipientsAR = array( + 1 => 'All', + 0 => 'Contact Only' + ); + + $settingsAR[] = 'OC_emailAuthorRecipients'; +} + +// Allow submission start ID to change? +if (($air = ocsql_query("SELECT COUNT(`paperid`) AS `count` FROM `" . OCC_TABLE_PAPER . "`")) && ($ail = ocsql_fetch_assoc($air)) && ($ail['count'] == 0) + && ($air = ocsql_query("SHOW TABLE STATUS WHERE `name`='" . OCC_TABLE_PAPER . "'")) && (ocsql_num_rows($air) == 1) && ($ail = ocsql_fetch_assoc($air)) +) { + $startid = $ail['Auto_increment']; +} + +// Submission? +$e = array(); +if (isset($_POST['submit']) && ($_POST['submit'] == "Save Settings")) { + // Check for valid submission + if (OCC_INSTALL_COMPLETE && !validToken('chair')) { + warn('Invalid submission', $hdr, $hdrfn); + } + // Check input + if (!isset($_POST['OC_confName']) || !preg_match("/\p{L}/u", $_POST['OC_confName'])) { + $e[] = 'Entity Short Name must include at least one alphanumeric character'; + } elseif (preg_match("/\"/", $_POST['OC_confName'])) { + $e[] = 'Entity Short Name must not contain quotes'; + } + if (!isset($_POST['OC_confNameFull']) || !preg_match("/\p{L}/u", $_POST['OC_confNameFull'])) { + $e[] = 'Entity Full Name must include at least one alphanumeric character'; + } + if (isset($_POST['OC_confURL']) && !empty($_POST['OC_confURL']) && !preg_match("/^(?:https?:\/\/|\/)/i", $_POST['OC_confURL'])) { + $e[] = 'Entity Web Address should start with https:// (if on another server) or / (for local server)'; + } + if (isset($_POST['OC_headerImage']) && !empty($_POST['OC_headerImage']) && !preg_match("/^(?:https?:\/\/|\/)/i", $_POST['OC_headerImage'])) { + $e[] = 'Header Image should start with https:// (if on another server) or / (if on local server)'; + } + if (!isset($_POST['OC_pcemail'])) { + $e[] = OCC_WORD_CHAIR . ' Email address invalid.'; + } elseif (preg_match("/,/", $_POST['OC_pcemail'])) { // Multiple addresses + $cmAR = explode(",", $_POST['OC_pcemail']); + foreach ($cmAR as $cm) { + $cm = trim($cm); + if (!validEmail($cm)) { + $e[] = OCC_WORD_CHAIR . ' Email does not appear to be valid'; + break; + } + } + } elseif (!validEmail($_POST['OC_pcemail'])) { // Single address + $e[] = OCC_WORD_CHAIR . ' Email does not appear to be valid'; + } + if (!isset($_POST['OC_confirmmail'])) { + $e[] = 'Notification Email address invalid. Try setting it the same as the ' . OCC_WORD_CHAIR . ' Email'; + } elseif (preg_match("/,/", $_POST['OC_confirmmail'])) { // Multiple addresses + $cmAR = explode(",", $_POST['OC_confirmmail']); + foreach ($cmAR as $cm) { + $cm = trim($cm); + if (!validEmail($cm)) { + $e[] = 'Notification Email does not appear to be valid'; + break; + } + } + } elseif (!validEmail($_POST['OC_confirmmail'])) { // Single address + $e[] = 'Notification Email does not appear to be valid'; + } + if (isset($_POST['startid']) && ! preg_match("/^[1-9]\d*$/", $_POST['startid'])) { + $e[] = 'Submission Starting ID invalid'; + } + if (isset($_POST['OC_authorsMinDisplay'])) { + if (! preg_match("/^[1-9][0-9]?$/", $_POST['OC_authorsMinDisplay'])) { + $e[] = 'Min Authors to Display must be a number between 1-99'; + } elseif (isset($_POST['OC_authorsMax']) && ($_POST['OC_authorsMinDisplay'] > $_POST['OC_authorsMax'] )) { + $e[] = 'Min Authors must be less than or equal to the Max Authors Allowed value'; + } + } + if (isset($_POST['OC_authorsMax']) && ! preg_match("/^[1-9][0-9]?$/", $_POST['OC_authorsMax'])) { + $e[] = 'Max Authors Allowed must be a number between 1-99'; + } + if (!isset($_POST['OC_extar']) || count($_POST['OC_extar']) == 0) { + $e[] = 'Select at least one file format'; + } else { // check formats are valid + foreach ($_POST['OC_extar'] as $fmat) { + if (!isset($OC_formatAR[$fmat])) { + $e[] = 'Invalid format selected'; + continue; + } + } + } + + $notifyKeysAR = array_keys($notifyAR); + foreach ($notifyKeysAR as $nk) { + if (!isset($_POST[$nk])) { + $_POST[$nk] = 0; + } elseif (!preg_match("/^[01]$/", $_POST[$nk])) { + $e[] = 'Invalid notification selection'; + continue; + } + } + foreach ($yesNoFieldsAR as $ynf) { + if (!isset($_POST[$ynf]) || ($_POST[$ynf] != 1)) { // catch case where checkbox used (e.g., rev/adv permissions) + $_POST[$ynf] = 0; + } + } + if (isset($_POST['OC_wordForAuthor']) && !in_array($_POST['OC_wordForAuthor'], $OC_wordForAuthorAR)) { + $e[] = 'Word for Author is invalid'; + } + if (isset($_POST['OC_wordForChair']) && !in_array($_POST['OC_wordForChair'], $OC_wordForChairAR)) { + $e[] = 'Word for Chair is invalid'; + } + if (!isset($_POST['OC_timeZone']) || !oc_validateTimeZone($_POST['OC_timeZone'])) { + $e[] = 'Time Zone is invalid'; + } + if (!isset($_POST['OC_locales']) || empty($_POST['OC_locales']) || !is_array($_POST['OC_locales'])) { + $e[] = 'At least one language must be selected'; + $_POST['OC_locales'] = array(); + } else { + if (!isset($_POST['OC_localeDefault']) || !isset($OC_languageAR[$_POST['OC_localeDefault']])) { + $e[] = 'Default Language is invalid'; + } elseif (!in_array($_POST['OC_localeDefault'], $_POST['OC_locales'])) { + $_POST['OC_locales'][] = $_POST['OC_localeDefault']; // auto-select default language + } + foreach ($_POST['OC_locales'] as $locale) { + if (!isset($OC_languageAR[$locale])) { + $e[] = 'Invalid locale selected: ' . safeHTMLstr($locale); + } + } + } + if (empty($e)) { + // Update form's OC_ fields + $_POST['OC_extar'] = implode(',', $_POST['OC_extar']); + $_POST['OC_locales'] = implode(',', $_POST['OC_locales']); + foreach (array_keys($_POST) as $p) { + if (preg_match("/^OC_[\w-]+$/", $p) && in_array($p, $settingsAR) && isset($OC_configAR[$p]) && ($OC_configAR[$p] != $_POST[$p])) { + updateConfigSetting($p, $_POST[$p], 'OC'); + $OC_configAR[$p] = $_POST[$p]; + } + } + + // Auto increment? + if (isset($startid) && ($startid != $_POST['startid'])) { + ocsql_query("ALTER TABLE `" . OCC_TABLE_PAPER . "` AUTO_INCREMENT=" . (int) $_POST['startid']); + } + + // if install, redirect + if (isset($_REQUEST['install']) && ($_REQUEST['install'] == 1)) { + header("Location: set_topics.php?install=1"); + exit; + } + + print 'Configuration successfully updated
'; + + // reset special vars to array + $_POST['OC_extar'] = explode(',', $OC_configAR['OC_extar']); + $_POST['OC_locales'] = explode(',', $OC_configAR['OC_locales']); + } +} else { // not submit; init POST with config values + $_POST = $OC_configAR; + $_POST['OC_locales'] = explode(',', $OC_configAR['OC_locales']); + // Allow submission auto increment to be set? + if (isset($startid)) { + $_POST['startid'] = $startid; + } +} + +if ((!OCC_INSTALL_COMPLETE) && isset($_REQUEST['install']) && ($_REQUEST['install'] == 1)) { + printHeader($hdr,$hdrfn); + print 'Step 3 of 5: Tailor Configuration Settings
'; +} + +if (!empty($e)) { + print '