first commit

This commit is contained in:
Your Name
2021-04-20 11:13:47 +05:30
parent b76859a3f1
commit 0a18b88eba
408 changed files with 47723 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
<FilesMatch "\.?(inc|sql)$">
deny from all
</FilesMatch>
+125
View File
@@ -0,0 +1,125 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
printHeader(oc_('Email Chair'), 3);
if (isset($_POST['ocaction']) && ($_POST['ocaction'] == "Send Email")) {
$err = '';
$message = '';
$hdr = $OC_configAR['OC_mailHeaders']; // keep before validate hook
if (isset($_POST['email']) && !empty($_POST['email'])) {
$err .= '<li>' . oc_('Fields not correctly filled out') . '</li>';
}
if (!isset($_POST['name']) || !preg_match("/\p{L}/u", $_POST['name']) || preg_match("/[\r\n]/", $_POST['name'])) {
$err .= '<li>' . sprintf(oc_('%s field empty or invalid'), oc_('Name')) . '</li>';
}
if (!isset($_POST['liame']) || !validEmail(($_POST['liame'] = trim($_POST['liame']))) || preg_match("/[\r\n]/", $_POST['liame'])) {
$err .= '<li>' . sprintf(oc_('%s field empty or invalid'), oc_('Email')) . '</li>';
}
if (($OC_configAR['OC_privacy_display'] > 0) && (!isset($_POST['consent']) || ($_POST['consent'] != '1'))) {
$err .= '<li>' . sprintf(oc_('%s field is required'), oc_('Consent')) . '</li>';
}
if (!isset($_POST['subject']) || !preg_match("/\p{L}/u", $_POST['subject']) || preg_match("/[\r\n]/", $_POST['subject'])) {
$err .= '<li>' . sprintf(oc_('%s field empty or invalid'), oc_('Subject')) . '</li>';
}
if (!isset($_POST['message']) || !preg_match("/\p{L}/u", $_POST['message'])) {
$err .= '<li>' . sprintf(oc_('%s field empty or invalid'), oc_('Message')) . '</li>';
} else {
$message = $_POST['message'];
}
if (oc_hookSet('author-contact-validate')) {
foreach ($GLOBALS['OC_hooksAR']['author-contact-validate'] as $hook) {
require_once $hook;
}
}
if (empty($err)) {
// add who it's from to body of message in case of an issue with reply headers
$message .= "\n\nFrom: " . $_POST['name'] . ' <' . $_POST['liame'] . ">\n";
// setup Reply-To
if (empty($hdr)) {
$hdr = 'From: "' . preg_replace('/"/', '', $_POST['name']) . '" <' . $GLOBALS['OC_configAR']['OC_pcemail'] . '>' . "\r\n" . // pcemail used to avoid email validation issues
'Reply-To: ' . $_POST['liame'] . "\r\n";
} else {
if (preg_match("/^(.*Reply-To:\s?)\S+(.*)$/s", $hdr, $matches)) {
$hdr = $matches[1] . $_POST['liame'] . $matches[2];
} elseif (preg_match("/[\r\n]$/s", $hdr)) {
$hdr .= 'Reply-To: ' . $_POST['liame'] . "\r\n";
} else {
$hdr .= "\r\n" . 'Reply-To: ' . $_POST['liame'] . "\r\n";
}
}
if (! oc_mail($OC_configAR['OC_pcemail'], $_POST['subject'], $message, $hdr)) {
err(oc_('An error occurred sending out the email.'));
} else {
print '<div class="note2">' . oc_('Your message has been sent.') . '</div>';
printFooter();
exit;
}
}
}
print '
<style type="text/css">
<!--
#recaptcha_response_field { background-color: #eee; }
-->
</style>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="ocaction" value="Send Email" />
<input type="hidden" name="email" value="" />
<table border="0" style="width: 500px; margin: 0 auto" cellspacing="4">
';
if (!empty($err)) {
print '<tr><td>&nbsp;</td><td class="warn">' . oc_('Please correct the following:') . '<ul>' . $err . '</ul></br>';
}
print '
<tr><td><strong><label for="name">' . oc_('Name') . ':</label></strong></td><td><input size="60" name="name" id="name" class="ocinput" style="width: 400px" value="' . safeHTMLstr(varValue('name', $_POST)) . '"></td></tr>
<tr><td><strong><label for="liame">' .
//T: Email Address
oc_('Email') . ':</label></strong></td><td><input size="60" name="liame" id="liame" class="ocinput" style="width: 400px" value="' . safeHTMLstr(varValue('liame', $_POST)) . '"></td></tr>
';
if ($OC_configAR['OC_privacy_display'] > 0) {
print '<tr><td>&nbsp;</td><td><label><input name="consent" id="consent" type="checkbox" value="1" ' . ((isset($_POST['consent']) && ($_POST['consent'] == '1')) ? 'checked ' : '') . '/> ' . oc_('I consent to the collection of my personal information and to receive emails about the message below.') . ' (<a href="../privacy_policy.php" target="_blank">' . oc_('Privacy Policy') . '</a>)</label></td></tr>';
}
print '
<tr><td><strong><label for="subject">' . oc_('Subject') . ':</label></strong></td><td><input size="60" name="subject" id="subject" class="ocinput" style="width: 400px" value="' .
//T: Email Subject Line
safeHTMLstr(varValue('subject', $_POST)) . '"></td></tr>
<tr><td valign="top"><strong><label for="message">' . oc_('Message') . ':</label></strong></td><td><textarea rows="5" cols="60" class="ocinput" style="width: 400px" name="message" id="message">' .
//T: Email Message
safeHTMLstr(varValue('message', $_POST)) . '</textarea></td></tr>
';
if (oc_hookSet('author-contact-fields')) {
foreach ($GLOBALS['OC_hooksAR']['author-contact-fields'] as $hook) {
require_once $hook;
}
}
print '
<tr><th align="center" colspan=2><br><input type="submit" name="submit" class="submit" value="' . oc_('Send Email') . '"></th></tr>
</table>
</form>
<p>
';
printFooter();
?>
+407
View File
@@ -0,0 +1,407 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$OC_subEdit = true; // flag for designating submission editing
require_once "../include.php";
oc_sendNoCacheHeaders();
$editTimeout = 2; // hours
// Cancel edit
if (isset($_GET['ocaction']) && ($_GET['ocaction'] == 'cancel')
&& isset($_GET['pid']) && ctype_digit($_GET['pid'])
&& isset($_GET['edittoken']) && preg_match("/^\w+$/", $_GET['edittoken'])
) {
ocsql_query("UPDATE `" . OCC_TABLE_PAPER . "` SET `edittoken`=NULL, `edittime`=NULL WHERE `paperid`=" . (int) $_GET['pid'] . " AND `edittoken`='" . safeSQLstr($_GET['edittoken']) . "' LIMIT 1");
header("Location: ../");
exit;
}
if (OCC_CHAIR_PWD_TRUMPS && isset($_REQUEST['c']) && ($_REQUEST['c'] == 1)) {
$hdrfn = 1;
beginChairSession();
$chair = true;
} else {
$hdrfn = 3;
$chair = false;
}
$hdr = oc_('Edit Submission');
$showPaper = false; // View (vs Edit) Submission if true
// Edit still allowed?
if (! $chair && ! $OC_statusAR['OC_edit_open']) {
if ($OC_configAR['OC_authorViewSubIfEditClosed']) {
$showPaper = true;
$hdr = oc_('View Submission'); // also used for auth form button
} else {
warn(oc_('Submission edits are no longer available.'), $hdr, $hdrfn);
exit;
}
}
printHeader($hdr, $hdrfn);
// Is this a post?
if (isset($_POST['ocaction'])) {
if (! isset($_POST['pid']) || ! preg_match("/^\d+$/", $_POST['pid'])) {
warn(oc_('Submission ID is invalid'));
}
if ($_POST['ocaction'] == 'Edit Submission') {
// Check password
if (! $chair && (! isset($_POST['passwordfld']) || empty($_POST['passwordfld']))) {
warn(oc_('Submission ID or password entered is incorrect'));
exit;
}
// verify login and acceptance status if not chair
if (! $chair) {
$pq = "SELECT `" . OCC_TABLE_PAPER . "`.`password`, `" . OCC_TABLE_ACCEPTANCE . "`.`accepted` FROM `" . OCC_TABLE_PAPER . "` LEFT JOIN `" . OCC_TABLE_ACCEPTANCE . "` ON (`" . OCC_TABLE_PAPER . "`.`accepted`=`" . OCC_TABLE_ACCEPTANCE . "`.`value`) WHERE `" . OCC_TABLE_PAPER . "`.`paperid`='" . safeSQLstr($_POST['pid']) . "'";
$pr = ocsql_query($pq) or err(oc_('Unable to retrieve submission'));
if (ocsql_num_rows($pr) != 1) {
warn(oc_('Submission ID or password entered is incorrect'));
exit;
}
$pl = ocsql_fetch_assoc($pr);
if (!oc_password_verify($_POST['passwordfld'], $pl['password'])) {
warn(oc_('Submission ID or password entered is incorrect'));
exit;
}
unset($_POST['passwordfld']);
if ( ! $showPaper ) {
// Edit limited to accepted subs only?
if (($OC_configAR['OC_editAcceptedOnly'] == 1) && ($pl['accepted'] != 1)) {
if ($OC_configAR['OC_authorViewSubIfEditClosed']) {
$showPaper = true;
print '<p class="warn" style="text-align: center;">' . oc_('Submission edits are no longer available.') . '</p>';
} else {
warn(oc_('Submission edits are no longer available.'));
exit;
}
} else {
// set token
$token = oc_idGen();
$pr = ocsql_query("UPDATE `" . OCC_TABLE_PAPER . "` SET `edittoken`='" . safeSQLstr($token) . "', `edittime`='" . safeSQLstr(time()) . "' WHERE `paperid`=" . (int) $_POST['pid'] . " LIMIT 1") or err(oc_('Unable to edit submission') . ' (token)');
}
}
if ($showPaper) {
$pid = $_POST['pid'];
require_once 'view.inc';
printFooter();
exit;
}
}
} elseif ($_POST['ocaction'] != 'Submit Changes') {
warn(oc_('Invalid request'));
exit;
}
if ($chair) { // display back links
print '<p style="text-align: center"><a href="../chair/show_paper.php?pid=' . urlencode($_POST['pid']) . '">View This Submission</a> | <a href="../chair/list_papers.php">View All Submissions</a></p>';
} elseif ($_POST['ocaction'] == 'Submit Changes') { // check token
$pq = "SELECT `edittoken`, `edittime` FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`='" . safeSQLstr($_POST['pid']) . "'";
$pr = ocsql_query($pq) or err(oc_('Unable to retrieve submission') . ' (tokeninfo)');
if (ocsql_num_rows($pr) != 1) { err(oc_('Submission ID or password entered is incorrect')); }
$pl = ocsql_fetch_assoc($pr);
if (!isset($_POST['edittoken'])
|| ($_POST['edittoken'] != $pl['edittoken'])
|| ((time() - $pl['edittime']) > (60 * 60 * $editTimeout))
) {
warn(sprintf(oc_('There is a %1$d hour timeout for editing the submission. Please <a href="%2$s">edit submission</a> once again'), $editTimeout, $_SERVER['PHP_SELF']));
exit;
}
}
// Set number of author fields to display if Submit Changes, else populate $_POST with database fields
if (isset($_POST['authornum']) && ctype_digit($_POST['authornum'])) {
$oc_authorNum = $_POST['authornum'];
} else {
// get sub
$anr = ocsql_query("SELECT * FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`=" . (int) $_POST['pid']) or err("Unable to retrieve submission information");
if (ocsql_num_rows($anr) != 1) {
err(oc_('Submission ID or password entered is incorrect'));
}
$_POST = array_merge((array)$_POST, ocsql_fetch_assoc($anr));
// get authors
$authorCount = 0;
$anr = ocsql_query("SELECT * FROM `" . OCC_TABLE_AUTHOR . "` WHERE `paperid`=" . (int) $_POST['pid'] . " ORDER BY `position`") or err(oc_('Unable to retrieve author(s) information'));
while ($anl = ocsql_fetch_assoc($anr)) {
foreach ($anl as $anli => $anlv) {
if (($anli == 'paperid') || ($anli == 'position')) { continue; }
$_POST[$anli . $anl['position']] = $anlv;
}
$authorCount = $anl['position']; // track highest position
}
// get topics
$anr = ocsql_query("SELECT `topicid` FROM `" . OCC_TABLE_PAPERTOPIC . "` WHERE `paperid`=" . (int) $_POST['pid']) or err(oc_('Unable to retrieve topic(s) information'));
$_POST['topics'] = array();
while ($anl = ocsql_fetch_assoc($anr)) {
$_POST['topics'][] = $anl['topicid'];
}
// set author num to either use min display or actual author count, whichever is greater
$oc_authorNum = (($authorCount > $OC_configAR['OC_authorsMinDisplay']) ? $authorCount : $OC_configAR['OC_authorsMinDisplay']);
// set token
if (! $chair) {
$_POST['edittoken'] = $token;
}
}
if (oc_hookSet('author-edit-preprocess')) {
foreach ($GLOBALS['OC_hooksAR']['author-edit-preprocess'] as $hook) {
require_once $hook;
}
}
require_once OCC_FORM_INC_FILE;
require_once OCC_SUBMISSION_INC_FILE;
// Set non-editable fields to disabled if submissions closed (and it's not Chair)
if (! $chair && ! $OC_statusAR['OC_submissions_open']) {
foreach ($OC_submissionFieldAR as $fid => $far) {
if (isset($far['closeedit']) && ! $far['closeedit']) {
$OC_submissionFieldAR[$fid]['enabled'] = false;
}
}
}
// remove consent field if already given
if (isset($OC_submissionFieldAR['consent'])) {
$cr = ocsql_query("SELECT `consent` FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`='" . safeSQLstr($_POST['pid']) . "'") or err('Unable to query consent status');
$cl = ocsql_fetch_assoc($cr);
if (!empty($cl['consent'])) {
unset($OC_submissionFieldAR['consent']);
foreach ($OC_submissionFieldSetAR as $fsid => $fsar) { // remove from fieldset
if (in_array('consent', $fsar['fields'])) {
$OC_submissionFieldSetAR[$fsid]['fields'] = array_diff($OC_submissionFieldSetAR[$fsid]['fields'], array('consent'));
continue; // field should only be in one fieldset
}
}
}
}
// Update topic field?
if ( isset($OC_submissionFieldAR['topics']['type']) && ($OC_submissionFieldAR['topics']['type'] == 'radio') && isset($_POST['topics']) && is_array($_POST['topics']) && isset($_POST['topics'][0]) ) {
$_POST['topics'] = $_POST['topics'][0]; // change from array to single value
}
// Update password fieldset
$OC_submissionFieldSetAR['fs_passwords']['fieldset'] = oc_('Change Password');
$OC_submissionFieldSetAR['fs_passwords']['note'] = oc_('Leave these fields blank if you do not want to change the password');
$OC_submissionFieldAR['password1']['name'] = oc_('New Password');
// Check whether we're submitting changes
if ($_POST['ocaction'] == "Submit Changes") {
if ($chair && !validToken('chair')) {
warn(oc_('Invalid submission'));
}
$err = '';
$errInc = '';
$qfields = array(); // fields to insert into submission table
$afields = array(); // fields to insert into authors table
$tfields = array(); // fields to insert into topics table
$fileUploaded = false;
require_once 'submission-validate.inc';
// process if no errors
if (!empty($err)) {
print '<p><span class="err">' . oc_('Please check the following:') . '<ul>' . $err . $errInc . '</ul></span><br /><hr /><br />';
} 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 = '<p><strong>' . safeHTMLstr(oc_('The submission has been updated. Below is the information submitted.')) . '</strong></p><pre>' . safeHTMLstr($fields) . '</pre>';
if (! $chair) {
$confirmmsg .= '<p><strong>' . sprintf(oc_('A copy has also been emailed to the contact author. If you notice any problems or do <em>not</em> receive the email within 24 hours, please contact the <a href="mailto:%1$s?subject=submission edit problem - %2$s">Chair</a>.'), urlencode($OC_configAR['OC_pcemail']), urlencode($_POST['pid'])) . '</strong></p>';
}
if (oc_hookSet('author-edit-save')) {
foreach ($GLOBALS['OC_hooksAR']['author-edit-save'] as $hook) {
require_once $hook;
}
}
//confirm it
print $confirmmsg;
if (! $chair) {
if (($OC_configAR['OC_emailAuthorRecipients'] == 1) && !empty($allemails)) {
$mailto = $allemails;
} else {
$mailto = $contactemail;
}
sendEmail($mailto, $mailsubject, $mailbody, $OC_configAR['OC_notifyAuthorEdit']);
}
printFooter();
// log
oc_logit('submission', 'Submission ID ' . $_POST['pid'] . ' edited' . ($chair ? ' by Chair' : '') . '. Title: ' . $_POST['title']);
exit;
} // else no $err
} // if Submit Changes
// Display form
print '
<form method="post" id="editsub" enctype="multipart/form-data" action="' . $_SERVER['PHP_SELF'] . '" class="ocform">
<input type="hidden" name="ocaction" value="Submit Changes" />
<input type="hidden" name="pid" value="' . safeHTMLstr($_POST['pid']) . '">
<input type="hidden" name="authornum" id="authornum" value="' . $oc_authorNum . '" />
';
if ($chair) {
print '
<input type="hidden" name="c" value="1">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
';
} else {
print '
<input type="hidden" name="edittoken" value="' . safeHTMLstr($_POST['edittoken']) . '" />
';
}
oc_displayFieldSet($OC_submissionFieldSetAR, $OC_submissionFieldAR, $_POST);
if (oc_hookSet('author-edit-fields')) {
foreach ($GLOBALS['OC_hooksAR']['author-edit-fields'] as $hook) {
require_once $hook;
}
}
if (! $chair) {
print '
<div id="oc_submit_emailConfirmOuter">
<div id="oc_submit_emailConfirmInner" aria-live="polite">
<p class="note">' . oc_('Emails will be sent to:') . '</p>
<p id="oc_submit_emailConfirm"></p>
</div>
</div>
';
}
print '<p><input type="submit" id="submit" name="submit" value="' . oc_('Submit Changes') . '" class="submit" />';
if (! $chair) {
print '
&nbsp; &nbsp; &nbsp; &nbsp;
<a href="' . $_SERVER['PHP_SELF'] . '?ocaction=cancel&pid=' . urlencode($_POST['pid']) . '&edittoken=' . urlencode(varValue('edittoken', $_POST)) . '&c=' . ($chair ? 1 : 0) . '">' . oc_('Cancel Changes') . '</a>
';
}
print '</p>
<span id="processing" style="position: relative; visibility: hidden;">' . oc_('Processing...') . '</span>
</form>
<script type="text/javascript">
oc_setupProcessingForm("editsub");
';
if (! $chair) {
print '
document.getElementById("editsub").addEventListener("change", function (evt) { oc_updateSubmitEmailAddresses(evt, true, ' . $OC_configAR['OC_emailAuthorRecipients'] . '); });
oc_updateSubmitEmailAddresses(null, true, ' . $OC_configAR['OC_emailAuthorRecipients'] . ');
';
}
print '</script>';
printFooter();
exit;
} // if Submission
// display login form by default
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" id="editform">
<input type="hidden" name="ocaction" value="Edit Submission" />
<table border=0 cellspacing=0 cellpadding=5>
<tr><td><strong><label for="pid">' . oc_('Submission ID') . '</label>:</strong></td><td><input name="pid" id="pid" size="10" tabindex="1"> ( <a href="email_papers.php" tabindex="4">' . oc_('forgot ID?') . '</a> )</td></tr>
<tr><td><strong><label for="passwordfld">' . oc_('Password') . '</label>:</strong></td><td><input name="passwordfld" id="passwordfld" type="password" tabindex="2" size="20" maxlength="255"> ( <a href="reset.php" tabindex="5">' . oc_('forgot password?') . '</a> )</td></tr>
</table>
<p><input type="submit" name="submit" class="submit" value="' . $hdr . '" tabindex="3" /></p>
</form>
' .
(
$showPaper ?
''
:
'<p class="note">' . sprintf(oc_('There is a %d hour limit to complete updates'), $editTimeout) . '</p>'
) . '
<script language="javascript">
<!--
document.forms[0].elements[0].focus();
// -->
</script>
';
if (oc_hookSet('author-edit-bottom')) {
foreach ($GLOBALS['OC_hooksAR']['author-edit-bottom'] as $hook) {
require_once $hook;
}
}
printFooter();
exit;
?>
+67
View File
@@ -0,0 +1,67 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
printHeader(oc_('Email Submissions'), 3);
if (isset($_POST['ocaction']) && ($_POST['ocaction'] == "Email Submissions") && (!empty($_POST['email']))) {
// check for valid email
if (!validEmail($_POST['email'])) {
print '<p style="text-align: center" class="warn">' . oc_('Email address entered is invalid') . '</p>';
printFooter();
exit;
}
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`title` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "` WHERE `" . OCC_TABLE_AUTHOR . "`.`email`='" . safeSQLstr(oc_strtolower($_POST['email'])) . "' AND `" . OCC_TABLE_AUTHOR . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` AND `" . OCC_TABLE_AUTHOR . "`.`position`=`" . OCC_TABLE_PAPER . "`.`contactid` ORDER BY `" . OCC_TABLE_PAPER . "`.`paperid`";
$r = ocsql_query($q) or err(oc_('Error checking for submissions'));
if (($rnum=ocsql_num_rows($r)) == 0) {
print '<p style="text-align: center" class="warn">' . sprintf(oc_("We did not find any submissions where the contact author's email is %s"), safeHTMLstr($_POST['email'])) . '.</p>';
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 '<p style="text-align: center; font-weight: bold">' . oc_('Please enter your email address below and click on <em>Email Submissions</em>. We will then email you a list of submissions for which you are the contact author.') . "</p>\n";
}
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" id="email_papersform">
<input type="hidden" name="ocaction" value="Email Submissions" />
<table border="0" style="margin: 0 auto">
<tr><td><strong>' . oc_('Email') . ':</strong></td><td><input size="20" name="email" id="email" value="' . safeHTMLstr(varValue('email', $_POST)) . '"></td></tr>
<tr><th align="center" colspan=2><br><input type="submit" name="submit" class="submit" value="' . oc_('Email Submissions') . '"></th></tr>
</table>
</form>
';
if (oc_hookSet('author-email_papers-bottom')) {
foreach ($GLOBALS['OC_hooksAR']['author-email_papers-bottom'] as $hook) {
require_once $hook;
}
}
printFooter();
?>
View File
View File
+93
View File
@@ -0,0 +1,93 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
$hdr = oc_('View File');
$hdrfn = 3;
$formatDBFldName = 'format';
$fileDir = $OC_configAR['OC_paperDir'];
$uploadOpen = $OC_statusAR['OC_view_file_open'];
if (oc_hookSet('author-viewfile-preprocess')) {
foreach ($GLOBALS['OC_hooksAR']['author-viewfile-preprocess'] as $hook) {
require_once $hook;
}
}
// Check that we're still open
if (! $uploadOpen) {
warn(oc_('Files may no longer be viewed'), $hdr, $hdrfn);
}
// Check whether this is a submission
if (isset($_POST['ocaction']) && ($_POST['ocaction'] == "View File")) {
// Check inputs
if (!preg_match("/^\d+$/",$_POST['pid']) || empty($_POST['pwd'])) {
warn(oc_('Submission ID or password entered is incorrect'), $hdr, $hdrfn);
}
if (oc_hookSet('author-viewfile-validate')) {
foreach ($GLOBALS['OC_hooksAR']['author-viewfile-validate'] as $hook) {
require_once $hook;
}
}
// Valid pid/pwd?
$pq = "SELECT `" . $formatDBFldName . "` AS `format`, `password` FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`='" . safeSQLstr($_POST['pid']) . "'";
$pr = ocsql_query($pq) or err(oc_('Unable to view file'), $hdr, $hdrfn);
if (ocsql_num_rows($pr) != 1) {
warn(sprintf(oc_('Submission ID or password entered is incorrect'), safeHTMLstr($_POST['pid'])), $hdr, $hdrfn);
}
$pl = ocsql_fetch_array($pr);
if (!oc_password_verify($_POST['pwd'], $pl['password'])) {
warn(sprintf(oc_('Submission ID or password entered is incorrect'), safeHTMLstr($_POST['pid'])), $hdr, $hdrfn);
}
$filename = $_POST['pid'] . '.' . $pl['format'];
if (! oc_displayFile($fileDir . $filename, $pl['format'])) {
warn(oc_('File does not exist'), $hdr, $hdrfn);
}
}
printHeader($hdr, $hdrfn);
print '
<form method="POST" enctype="multipart/form-data" action="' . $_SERVER['PHP_SELF'] . '" id="paperform">
<input type="hidden" name="ocaction" value="View File" />
<table border=0 cellspacing=0 cellpadding=5>
';
if (oc_hookSet('author-viewfile-formtop')) {
foreach ($GLOBALS['OC_hooksAR']['author-viewfile-formtop'] as $hook) {
require_once $hook;
}
}
print '
<tr><td><strong><label for="pid">' . oc_('Submission ID') . ':</label></strong></td><td><input name="pid" id="pid" size="10" tabindex="2"> ( <a href="email_papers.php" tabindex="5">' . oc_('forgot ID?') . '</a> )</td></tr>
<tr><td><strong><label for="pwd">' . oc_('Password') . ':</label></strong></td><td><input name="pwd" id="pwd" type="password" size="20" maxlength="255" tabindex="3"> ( <a href="reset.php" tabindex="6">' . oc_('forgot password?') . '</a> )</td></tr>
</table>
<p><input type="submit" name="submit" value="' . oc_('View File') . '" class="submit" tabindex="4" /></p>
</form>
';
if (oc_hookSet('author-paper-bottom')) {
foreach ($GLOBALS['OC_hooksAR']['author-paper-bottom'] as $hook) {
require_once $hook;
}
}
printFooter();
?>
+64
View File
@@ -0,0 +1,64 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
printHeader(oc_('Reset Password'), 3);
if (isset($_POST['ocaction']) && ($_POST['ocaction'] == "Reset Password") && preg_match("/^\d+$/",$_POST['pid']) && !empty($_POST['email'])) {
// check for valid email
if (!validEmail($_POST['email'])) {
print '<p style="text-align: center" class="warn">' . oc_('Email address entered is invalid') . '</p>';
printFooter();
exit;
}
$q = "SELECT `" . OCC_TABLE_AUTHOR . "`.`email` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "` WHERE `" . OCC_TABLE_PAPER . "`.`paperid`='" . safeSQLstr($_POST['pid']) . "' AND `" . OCC_TABLE_AUTHOR . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` AND `" . OCC_TABLE_AUTHOR . "`.`position`=`" . OCC_TABLE_PAPER . "`.`contactid` AND `" . OCC_TABLE_AUTHOR . "`.`email`='" . safeSQLstr(oc_strtolower($_POST['email'])) . "'";
$r = ocsql_query($q) or err(oc_('Error checking submission ID'));
if (ocsql_num_rows($r) != 1) {
print '<p style="text-align: center" class="warn">' . oc_("Submission ID or contact author's email invalid.") . ' ' . sprintf(oc_('Please contact the <a href="mailto:%1$s?subject=%2$s">Chair</a>.'), $OC_configAR['OC_pcemail'], 'Unable to Reset Password') . '</p>';
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 '<p style="text-align: center;">' . oc_('Please enter your submission id and the contact author\'s email below') . "</p>\n";
}
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" id="resetform">
<input type="hidden" name="ocaction" value="Reset Password" />
<table border="0" style="margin: 0 auto">
<tr><td><strong>' . oc_('Submission ID') . ':</strong></td><td><input size="20" name="pid" value="' . safeHTMLstr(varValue('pid', $_POST)) . '"></td></tr>
<tr><td><strong>' . oc_('Email') . ':</strong></td><td><input size="20" name="email" value="' . safeHTMLstr(varValue('email', $_POST)) . '"></td></tr>
<tr><th align="center" colspan=2><br><input type="submit" name="submit" class="submit" value="' . oc_('Reset Password') . '"></th></tr>
</table>
';
if (oc_hookSet('author-reset-bottom')) {
foreach ($GLOBALS['OC_hooksAR']['author-reset-bottom'] as $hook) {
require_once $hook;
}
}
printFooter();
?>
+140
View File
@@ -0,0 +1,140 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
require_once OCC_FORM_INC_FILE;
require_once OCC_REVIEW_INC_FILE;
$hdr = oc_('Check Status');
$hdrfn = 3;
require_once "../include-submissions.inc";
// Check status allowed?
if (! $OC_statusAR['OC_status_open']) {
warn(oc_('Check Status is not available.'), $hdr, $hdrfn);
}
// Is this a post?
if (isset($_POST['ocaction']) && ($_POST['ocaction'] == 'Check Status')) {
// Check token
if (!isset($_POST['token']) || !isset($_SESSION['atoken']) || ($_POST['token'] != $_SESSION['atoken'])) {
warn(oc_('Invalid submission'), $hdr, $hdrfn);
}
unset($_SESSION['atoken']);
session_write_close();
// 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'), $hdr, $hdrfn);
}
// retrieve sub
$q = "SELECT `title`, `password`, `accepted` FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`='" . safeSQLstr($_POST['pid']) . "'";
$r = ocsql_query($q) or err(oc_('Submission ID or password entered is incorrect'), $hdr, $hdrfn);
if (ocsql_num_rows($r) == 1) {
$l = ocsql_fetch_assoc($r);
// check pwd
if (oc_password_verify($_POST['pwd'], $l['password'])) {
// display info & status
printHeader($hdr, $hdrfn);
print '
<p><strong>' . oc_('Submission ID') . ':</strong> ' . safeHTMLstr($_POST['pid']) . '</p>
<p><strong>' .
//T: Submission Title
oc_('Title') . ':</strong> ' . safeHTMLstr($l['title']) . '</p>
<p><strong>' .
//T: Submission Status
oc_('Status') . ':</strong> ' . (empty($l['accepted']) ? oc_('Pending') : safeHTMLstr(oc_($l['accepted']))) . '</p>
';
if (oc_hookSet('author-status')) {
foreach ($GLOBALS['OC_hooksAR']['author-status'] as $v) {
require_once $v;
}
}
// display review comments to author
if ($OC_configAR['OC_authorSeePendingSubReviews'] || !empty($l['accepted'])) {
$q2 = "SELECT * FROM `" . OCC_TABLE_PAPERREVIEWER . "` WHERE `paperid`='" . safeSQLstr($_POST['pid']) . "' ORDER BY `reviewerid`";
$r2 = ocsql_query($q2) or err('Unable to retrieve review data');
if (ocsql_num_rows($r2) > 0) {
// Fields to display
$displayFieldAR = array();
foreach ($OC_reviewQuestionsAR as $fid => $far) {
if (isset($far['showauthor']) && $far['showauthor']) {
$displayFieldAR[] = $fid;
}
}
if (count($displayFieldAR) > 0) {
$rcount = 1;
while ($l2 = ocsql_fetch_assoc($r2)) {
$reviewInfo = '';
foreach ($displayFieldAR as $fid) {
if (!empty($l2[$fid])) {
$reviewInfo .= '<p><span style="font-weight: bold; font-style: italic; color: #555;">' . safeHTMLstr(oc_($OC_reviewQuestionsAR[$fid]['short'])) . ':</span> ' . nl2br(safeHTMLstr(oc_getFieldValue($OC_reviewQuestionsAR, $l2, $fid))) . "</p>\n";
}
}
if (!empty($reviewInfo)) {
print '<p><strong>' . safeHTMLstr(sprintf(oc_('Reviewer %s'), $rcount++)) . ':</strong></p><div style="margin-left: 20px;">' . $reviewInfo . '</div>';
}
}
}
}
}
printFooter();
} else {
warn(oc_('Submission ID or password entered is incorrect'), $hdr, $hdrfn);
}
} else {
warn(oc_('Submission ID or password entered is incorrect'), $hdr, $hdrfn);
}
}
else { // not a submission -- display sub id/password form
// set author token
$_SESSION['atoken'] = oc_idGen();
session_write_close();
printHeader($hdr, $hdrfn);
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" id="statusform">
<input type="hidden" name="ocaction" value="Check Status" />
<input type="hidden" name="token" value="' . safeHTMLstr($_SESSION['atoken']) . '" />
<table border=0 cellspacing=0 cellpadding=5>
<tr><td><strong><label for="pid">' . oc_('Submission ID') . '</label>:</strong></td><td><input name="pid" id="pid" size="10" tabindex="1"> ( <a href="email_papers.php" tabindex="4">' . oc_('forgot ID?') . '</a> )</td></tr>
<tr><td><strong><label for="password">' . oc_('Password') . '</label>:</strong></td><td><input name="pwd" id="password" type="password" tabindex="2" size="20" maxlength="255"> ( <a href="reset.php" tabindex="5">' . oc_('forgot password?') . '</a> )</td></tr>
</table>
<p><input type="submit" name="submit" value="' . oc_('Check Status') . '" class="submit" tabindex="3" /></p>
</form>
<script language="javascript">
<!--
document.forms[0].elements[0].focus();
// -->
</script>
';
printFooter();
if (oc_hookSet('author-status-bottom')) {
foreach ($GLOBALS['OC_hooksAR']['author-status-bottom'] as $hook) {
require_once $hook;
}
}
}
exit;
?>
+152
View File
@@ -0,0 +1,152 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$firstBlankAuthor = 0;
$lastAuthor = 0;
// Force contact author = 1
if ($author1contact) {
$_POST['contactid'] = 1;
}
// validate fields
$allemails = '';
foreach ($GLOBALS['OC_submissionFieldSetAR'] as $fsid => $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 .= '<li>' . sprintf(oc_('Author %d missing last name'), $a) . '</li>';
}
} else {
$afields[$a] = array('name_last' => "'" . safeSQLstr(varValue('name_last' . $a, $_POST)) . "'");
foreach ($fs['fields'] as $fid) {
if ($fid == 'name_last') { continue; }
// override required field attribute?
$requiredOverride = false;
if ($OC_configAR['OC_authorsRequiredData'] > 0) {
if (($OC_configAR['OC_authorsRequiredData'] == 1) && ($a != 1)) { // first author
$requiredOverride = true;
} elseif (($OC_configAR['OC_authorsRequiredData'] == 2) && ($a != $_POST['contactid'])) { // contact author
$requiredOverride = true;
}
}
// validate
oc_validateField($fid, $GLOBALS['OC_submissionFieldAR'], $afields[$a], $err, $a, $requiredOverride);
}
$lastAuthor = $a;
if (isset($_POST['email'.$a]) && !empty($_POST['email'.$a])) {
$allemails .= $_POST['email'.$a] . ',';
}
}
}
}
}
$allemails = rtrim($allemails, ',');
// Additional author checks
if ($lastAuthor == 0) { // no author info
$err .= '<li>' . oc_('Authors information missing.') . '</li>';
} elseif (($firstBlankAuthor > 0) && ($firstBlankAuthor < $lastAuthor)) { // blank author - can't skip otherwise ordering will be messed up
$err .= '<li>' . oc_('One or more author\'s data skipped. Please enter authors sequentially.') . '</li>';
} elseif (!preg_match("/^\d+$/", $_POST['contactid']) || ($_POST['contactid'] < 1) || ($_POST['contactid'] > $OC_configAR['OC_authorsMax'])) { // Check that we have a valid contact author & email
$err .= '<li>' . oc_('Contact author invalid') . '</li>';
} else {
$contactemail = $_POST['email' . $_POST['contactid']];
if (!validEmail($contactemail)) {
$err .= '<li>' . oc_('Contact author email does not seem valid') . '</li>';
}
}
// Update topics
if (isset($qfields['topics'])) {
if ($qfields['topics'] != 'NULL') {
if (!preg_match("/^'[\d\,]*'$/", $qfields['topics'])) {
$err .= '<li>' . sprintf(oc_('%s field does not appear to be valid'), oc_('Topic')) . '</li>'; // should only trigger if validateField above fails
} else {
$tfields = explode(',', trim($qfields['topics'], "'"));
}
}
unset($qfields['topics']);
}
// Check file
if (isset($OC_submissionFieldAR['file'])) {
if ( isset($_FILES['file']['error']) // good upload
&& ($_FILES['file']['error'] == UPLOAD_ERR_OK) // no error
&& is_uploaded_file($_FILES['file']['tmp_name']) // legitimate upload
&& ($_FILES['file']['size'] > 0) // file not empty
&& (empty($OC_configAR['OC_fileLimit']) || ($_FILES['file']['size'] <= ($OC_configAR['OC_fileLimit'] * 1024 * 1024))) // file size <= limit
) { // file uploaded ok
if ( ! isset($_POST['format']) || ! in_array($_POST['format'], $extAR) ) { // invalid format
$err .= '<li>' . oc_('File format invalid') . '</li>';
} else { // upload good
$fileUploaded = true;
$errInc .= '<br /><li>' . oc_('Also, re-select the file') . '</li>'; // let user know file must be re-selected if there was another error
if (oc_hookSet('author-file-validate')) {
foreach ($GLOBALS['OC_hooksAR']['author-file-validate'] as $hook) {
require_once $hook;
}
}
}
} elseif ( isset($_FILES['file']['error']) ) { // notify of error
switch($_FILES['file']['error']) {
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
$err .= '<li>' . oc_('File size too large') . '</li>';
break;
case UPLOAD_ERR_NO_FILE:
if (isset($OC_submissionFieldAR['file']['required']) && $OC_submissionFieldAR['file']['required']) { // file required? if not, no error
$err .= '<li>' . oc_('File missing') . '</li>';
}
break;
default:
$err .= '<li>' . oc_('File did not upload properly') . '</li>';
break;
}
}
}
// Check password if either field is not empty or it's an original submission
if ( (isset($_POST['password1']) && !empty($_POST['password1']))
|| (isset($_POST['password2']) && !empty($_POST['password2']))
|| ( ! isset($_POST['pid']) )
) {
if (!isset($_POST['password1']) || !isset($_POST['password2']) || empty($_POST['password1'])) {
$err .= '<li>' . oc_('Password must be entered twice') . '</li>';
} elseif ($_POST['password1'] != $_POST['password2']) {
$err .= '<li>' . oc_('Passwords entered do not match') . '</li>';
} else {
$qfields['password'] = "'" . oc_password_hash($_POST['password1']) . "'";
}
}
// Add datetime to consent and strip tags
if (isset($qfields['consent']) && preg_match("/^\'.*\'$/", $qfields['consent'])) {
$qfields['consent'] = rtrim(strip_tags($qfields['consent']), "'") . safeSQLstr(" (" . gmdate('Y-m-d H:i:s') . " UTC)") . "'";
}
if (oc_hookSet('author-submission-validate')) {
foreach ($GLOBALS['OC_hooksAR']['author-submission-validate'] as $hook) {
require_once $hook;
}
}
+632
View File
@@ -0,0 +1,632 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
if (!isset($oc_authorNum)) {
$oc_authorNum = 1;
}
// Force author 1 as contact
if (
( ($GLOBALS['OC_configAR']['OC_authorsMinDisplay'] == 1) && ($GLOBALS['OC_configAR']['OC_authorsMax'] == 1) )
||
($GLOBALS['OC_configAR']['OC_authorOneContact'] == 1)
) {
$author1contact = true;
} else {
$author1contact = false;
}
// Get topics
$topq = "SELECT * FROM `" . OCC_TABLE_TOPIC . "`";
if ($OC_configAR['OC_topicDisplayAlpha']) {
$topq .= " ORDER BY `topicname`";
}
$topr = ocsql_query($topq) or err('unable to retrieve topics');
if (($tnum = ocsql_num_rows($topr)) < 1) {
warn(oc_('We are still waiting for the list of topics to be finalized before opening up for submissions. Please check back later.'));
} else {
$topicAR = array();
while ($topl = ocsql_fetch_assoc($topr)) {
if ($topl['topicname'] == 'N/A') { continue; }
$topicAR[$topl['topicid']] = $topl['topicname'];
}
}
// Get authors
$sfAuthorAR = array();
for ($i=1; $i<=$GLOBALS['oc_authorNum']; $i++) {
$sfAuthorAR[$i] = oc_('Author') . ' ' . $i; // oc_() only around Author because of JS in include-forms
}
// See include-forms.inc for syntax format
$OC_submissionFieldAR = array();
$OC_submissionFieldSetAR = array();
// Hooks
if (oc_hookSet('author-submission-preinc')) {
foreach ($GLOBALS['OC_hooksAR']['author-submission-preinc'] as $v) {
require_once $v;
}
}
if (!isset($mod_oc_customforms_customSubForm) || (!$mod_oc_customforms_customSubForm)) { // skip if we have a custom form
// Consent
if (
(OCC_LICENSE != 'Public')
||
((OCC_LICENSE == 'Public') && ($OC_configAR['OC_privacy_display'] > 0))
) {
$OC_submissionFieldAR['consent'] = array(
'name' => oc_('Consent'),
'short' => oc_('Consent'),
'note' => '',
'type' => 'checkbox',
'reviewer' => false,
'advocate' => false,
'usekey' => false,
'required' => true,
'delimiter' => '',
'values' => array(oc_('I consent to the collection and use of my personal information, including receiving emails, consistent with the Privacy Policy linked above.') . ' ' . oc_('I have also obtained the consent of all other individuals whose information I provide.'))
);
$OC_submissionFieldSetAR['fs_consent'] = array(
'fieldset' => oc_('Consent'),
'note' => '',
'fields' => array('consent')
);
}
// General Info
$OC_submissionFieldAR['title'] = array(
'name' => oc_('Submission Title'),
'short' => oc_('Title'),
'note' => '',
'type' => 'text',
'reviewer' => true,
'advocate' => true,
'width' => 80,
'required' => true // always required
);
$OC_submissionFieldAR['type'] = array(
'name' => oc_('Submission Type'),
'short' => oc_('Submission Type'),
'note' => '',
'type' => 'radio',
'reviewer' => true,
'advocate' => true,
'closeedit' => false,
'usekey' => false,
'required' => true,
'display' => 'sameline',
'valuetype' => 'custom',
'values' => array()
);
if (isset($OC_configAR['OC_subtypes']) && !empty($OC_configAR['OC_subtypes'])) {
$OC_submissionFieldAR['type']['values'] = explode(',', $OC_configAR['OC_subtypes']);
}
$OC_submissionFieldAR['student'] = array(
'name' => oc_('Student'),
'short' => oc_('Student'),
'note' => '',
'type' => 'radio',
'reviewer' => true,
'advocate' => true,
'closeedit' => false,
'usekey' => true,
'required' => true,
'delimiter' => ' &nbsp; ',
'values' => array('T' => oc_('Yes'), 'F' => oc_('No'))
);
$OC_submissionFieldSetAR['fs_general'] = array(
'fieldset' => oc_('General Information'),
'note' => '',
'fields' => array('title', 'type', 'student')
);
// Authors
$OC_submissionFieldAR['orcid'] = array(
'name' => oc_('ORCID'),
'short' => oc_('ORCID'),
'note' => '',
'type' => 'text',
'width' => 30,
'maxchars' => 30,
'required' => false
);
$OC_submissionFieldAR['honorific'] = array(
'name' => oc_('Honorific'),
'short' => oc_('Honorific'),
'note' => '',
'type' => 'text',
'reviewer' => true,
'advocate' => true,
'required' => false
);
$OC_submissionFieldAR['name_first'] = array(
'name' => oc_('First/Given Name'),
'short' => oc_('First Name'),
'note' => '',
'type' => 'text',
'maxchars' => 60,
'reviewer' => true,
'advocate' => true,
'required' => false
);
$OC_submissionFieldAR['name_last'] = array(
'name' => oc_('Last/Family Name'),
'short' => oc_('Last Name'),
'note' => '',
'type' => 'text',
'maxchars' => 40,
'reviewer' => true,
'advocate' => true,
'required' => true // always required
);
$OC_submissionFieldAR['suffix'] = array(
'name' => oc_('Suffix'),
'short' => oc_('Suffix'),
'note' => '',
'type' => 'text',
'maxchars' => 60,
'reviewer' => true,
'advocate' => true,
'required' => false
);
$OC_submissionFieldAR['position_title'] = array(
'name' => oc_('Position/Title'),
'short' => oc_('Position'),
'note' => '',
'type' => 'text',
'required' => false
);
$OC_submissionFieldAR['organization'] = array(
'name' => oc_('Organization'),
'short' => oc_('Organization'),
'note' => '',
'type' => 'text',
'maxchars' => 150, // limitation as a result of utf8mb4 keys
'reviewer' => true,
'advocate' => true,
'required' => false
);
$OC_submissionFieldAR['department'] = array(
'name' => oc_('Department/Division'),
'short' => oc_('Department/Division'),
'note' => '',
'type' => 'text',
'required' => false
);
$OC_submissionFieldAR['address'] = array(
'name' => oc_('Address'),
'short' => oc_('Address'),
'note' => '',
'type' => 'text',
'required' => false
);
$OC_submissionFieldAR['address2'] = array(
'name' => oc_('Address 2'),
'short' => oc_('Address 2'),
'note' => '',
'type' => 'text',
'required' => false
);
$OC_submissionFieldAR['city'] = array(
'name' => oc_('City'),
'short' => oc_('City'),
'note' => '',
'type' => 'text',
'required' => false
);
$OC_submissionFieldAR['spc'] = array(
'name' => oc_('State/Province'),
'short' => oc_('State/Province'),
'note' => '',
'type' => 'text',
'required' => false
);
$OC_submissionFieldAR['postcode'] = array(
'name' => oc_('Postcode/Zip'),
'short' => oc_('Postcode/Zip'),
'note' => '',
'type' => 'text',
'required' => false
);
$OC_submissionFieldAR['country'] = array(
'name' => oc_('Country'),
'short' => oc_('Country'),
'note' => '',
'type' => 'dropdown',
'blank' => true,
'required' => false,
'usekey' => true,
'reviewer' => true,
'advocate' => true,
'valuetype' => 'country'
);
$OC_submissionFieldAR['email'] = array(
'name' => oc_('Email'),
'short' => oc_('Email'),
'note' => '',
'type' => 'email',
'required' => false // required for contact author automatically
);
$OC_submissionFieldAR['phone'] = array(
'name' => oc_('Telephone'),
'short' => oc_('Telephone'),
'note' => '',
'type' => 'text',
'required' => false
);
$OC_submissionFieldAR['url'] = array(
'name' => oc_('Web Site'),
'short' => oc_('Web Site'),
'note' => '',
'type' => 'text',
'required' => false,
'placeholder' => 'https://'
);
$OC_submissionFieldAR['facebook'] = array(
'name' => oc_('Facebook Page'),
'short' => oc_('Facebook'),
'note' => '',
'type' => 'text',
'required' => false,
'placeholder' => 'https://'
);
$OC_submissionFieldAR['twitter'] = array(
'name' => oc_('Twitter Page'),
'short' => oc_('Twitter'),
'note' => '',
'type' => 'text',
'required' => false,
'placeholder' => 'https://'
);
$OC_submissionFieldAR['linkedin'] = array(
'name' => oc_('LinkedIn Page'),
'short' => oc_('LinkedIn'),
'note' => '',
'type' => 'text',
'required' => false,
'placeholder' => 'https://'
);
$OC_submissionFieldAR['photo'] = array(
'name' => oc_('Photo Link'),
'short' => oc_('Photo'),
'note' => '',
'type' => 'text',
'required' => false,
'placeholder' => 'https://'
);
$OC_submissionFieldAR['presenter'] = array(
'name' => oc_('Presenter'),
'short' => oc_('Presenter'),
'note' => '',
'type' => 'radio',
'usekey' => true,
'required' => false,
'display' => 'sameline',
'values' => array('T' => oc_('Yes'), 'F' => oc_('No'))
);
$OC_submissionFieldAR['biography'] = array(
'name' => oc_('Biography'),
'short' => oc_('Biography'),
'note' => '',
'type' => 'textarea',
'required' => false
);
$OC_submissionFieldAR['role'] = array(
'name' => oc_('Contributor Role'),
'short' => oc_('Contributor Role'),
'note' => '',
'type' => 'picklist',
'usekey' => true,
'required' => false,
'values' => array(
1 => oc_('Conceptualization'),
2 => oc_('Data curation'),
3 => oc_('Formal Analysis'),
4 => oc_('Funding acquisition'),
5 => oc_('Investigation'),
6 => oc_('Methodology'),
7 => oc_('Project administration'),
8 => oc_('Resources'),
9 => oc_('Software'),
10 => oc_('Supervision'),
11 => oc_('Validation'),
12 => oc_('Visualization'),
13 => oc_('Writing - original draft'),
14 => oc_('Writing - review & editing')
)
);
$OC_submissionFieldSetAR['fs_authors'] = array(
'fieldset' => oc_('Author(s)'),
'note' => '',
'fields' => array('orcid', 'honorific', 'name_first', 'name_last', 'suffix', 'position_title', 'organization', 'department', 'address', 'address2', 'city', 'spc', 'postcode', 'country', 'email', 'phone', 'url', 'facebook', 'twitter', 'linkedin', 'photo', 'presenter', 'biography', 'role')
);
// Contact Author
$OC_submissionFieldAR['contactid'] = array(
'name' => oc_('Contact Author'),
'short' => oc_('Contact Author'),
'note' => oc_('Author who will serve as the point of contact for correspondence about the submission.'),
'type' => 'dropdown',
'required' => true, // always required
'usekey' => true,
'valuetype' => 'author'
);
$OC_submissionFieldAR['altcontact'] = array(
'name' => oc_('Alternate Contact'),
'short' => oc_('Alternate Contact'),
'note' => oc_('Alternate contact information, such as personal email address or telephone number; used only if unable to contact using above email address.'),
'type' => 'text',
'required' => false
);
$OC_submissionFieldSetAR['fs_contactauthor'] = array(
'fieldset' => oc_('Contact Author'),
'note' => '',
'fields' => array('contactid', 'altcontact')
);
// Topics
$OC_submissionFieldAR['topics'] = array(
'name' => oc_('Topic Areas'),
'short' => oc_('Topic(s)'),
'note' => '',
'type' => 'checkbox',
'usekey' => true,
'display' => 'newline',
'required' => true, // always required
'valuetype' => 'topic'
);
if ($OC_configAR['OC_multipleSubmissionTopics'] != 1) { // (!1 = limited to 1)
$OC_submissionFieldAR['topics']['maxselections'] = 1;
}
$OC_submissionFieldSetAR['fs_topics'] = array(
'fieldset' => oc_('Topic Areas'),
'note' => oc_('To help match submissions to reviewers and sessions, please select the area(s) most applicable to your submission'),
'fields' => array('topics')
);
// Content
$OC_submissionFieldAR['keywords'] = array(
'name' => oc_('Keywords'),
'short' => oc_('Keywords'),
'note' => '',
'type' => 'text',
'required' => false
);
$OC_submissionFieldAR['abstract'] = array(
'name' => oc_('Abstract'),
'short' => oc_('Abstract'),
'note' => '',
'reviewer' => true,
'advocate' => true,
'type' => 'textarea',
'height' => 10,
'required' => false
);
$OC_submissionFieldSetAR['fs_content'] = array(
'fieldset' => oc_('Content'),
'note' => '',
'fields' => array('keywords', 'abstract')
);
if ( preg_match("/submit/", $_SERVER['PHP_SELF']) || (isset($mod_oc_customforms_edit) && $mod_oc_customforms_edit) || (isset($mod_oc_formfields_edit) && $mod_oc_formfields_edit) ) { // only display file field if submission (or forms editing via module)
$OC_submissionFieldAR['file'] = array(
'name' => oc_('File'),
'short' => oc_('File'),
'note' => (empty($GLOBALS['fileNotice']) ? '' : $GLOBALS['fileNotice'] . '<br />') . (empty($OC_configAR['OC_fileLimit']) ? sprintf(oc_('File size limit is %s.'), $GLOBALS['OC_maxFileSize']) : ''),
'type' => 'file',
'closeedit' => false,
'required' => true
);
$OC_submissionFieldSetAR['fs_content']['fields'][] = 'file';
}
// Password
$OC_submissionFieldAR['password1'] = array(
'name' => oc_('Password'),
'short' => oc_('Password'),
'note' => '',
'type' => 'password',
'required' => true // always required
);
$OC_submissionFieldAR['password2'] = array(
'name' => oc_('Re-enter Password'),
'short' => oc_('Confirm'),
'note' => '',
'type' => 'password',
'required' => true // always required
);
$OC_submissionFieldSetAR['fs_passwords'] = array(
'fieldset' => oc_('Password'),
'note' => oc_('Please enter a password you will remember. The submission ID, which you will receive via email upon submission of this form, along with this password will allow you to make future changes to this submission.'),
'fields' => array('password1', 'password2')
);
// Comments
$OC_submissionFieldAR['comments'] = array(
'name' => oc_('Optional Comments'),
'short' => oc_('Comments'),
'note' => '',
'type' => 'textarea',
'required' => false
);
$OC_submissionFieldSetAR['fs_comments'] = array(
'fieldset' => oc_('Comments'),
'note' => '',
'fields' => array('comments')
);
// Unset fields that should not be displayed on form
if (!empty($GLOBALS['OC_configAR']['OC_hideSubFields'])) {
$hSF = explode(',', $GLOBALS['OC_configAR']['OC_hideSubFields']);
foreach ($hSF as $hs_f) {
list($a_fs, $a_f) = explode(':', $hs_f);
unset($OC_submissionFieldAR[$a_f]);
if (in_array($a_f, $OC_submissionFieldSetAR[$a_fs]['fields'])) {
$OC_submissionFieldSetAR[$a_fs]['fields'] = array_values(array_diff($OC_submissionFieldSetAR[$a_fs]['fields'], array($a_f)));
}
}
}
} // if ! custom form
// Hooks
if (oc_hookSet('author-submission-inc')) {
foreach ($GLOBALS['OC_hooksAR']['author-submission-inc'] as $v) {
require_once $v;
}
}
// Make updates if form not being edited by module
if (
(! isset($mod_oc_customforms_edit) || ! $mod_oc_customforms_edit)
&&
(! isset($mod_oc_formfields_edit) || ! $mod_oc_formfields_edit)
){
$GLOBALS['updateAuthorFieldsAR'] = array();
foreach ($OC_submissionFieldAR as $sfk => $sf) {
// remove field if either:
// - designated for new submissions only if sub being edited,
// - designated for Chair only and author viewing/editing
if (
(isset($sf['newsubonly']) && $sf['newsubonly'] && isset($GLOBALS['OC_subEdit']) && $GLOBALS['OC_subEdit'])
||
(
(isset($sf['chair']) && $sf['chair'])
&&
(
(isset($OC_subNew) && $OC_subNew)
||
(isset($OC_subEdit) && $OC_subEdit && (!isset($chair) || !$chair))
||
(isset($OC_subShow) && $OC_subShow)
)
)
) {
unset($OC_submissionFieldAR[$sfk]);
foreach ($OC_submissionFieldSetAR as $fsid => $fsar) {
if (in_array($sfk, $fsar['fields'])) {
$OC_submissionFieldSetAR[$fsid]['fields'] = array_diff($OC_submissionFieldSetAR[$fsid]['fields'], array($sfk));
continue; // field should only be in one fieldset
}
}
} else { // update values & valuetypes
if (isset($sf['valuetype']) && !empty($sf['valuetype']) && ($sf['valuetype'] != 'custom')) {
switch($sf['valuetype']) {
case 'author':
$OC_submissionFieldAR[$sfk]['values'] = $sfAuthorAR;
$GLOBALS['updateAuthorFieldsAR'][] = $sfk;
break;
case 'country':
require_once OCC_COUNTRY_FILE;
$OC_submissionFieldAR[$sfk]['values'] = $GLOBALS['OC_countryAR'];
break;
case 'topic':
$OC_submissionFieldAR[$sfk]['values'] = $topicAR;
break;
default: // lib file
require_once OCC_LIB_DIR . $sf['valuetype'] . '.inc';
$OC_submissionFieldAR[$sfk]['values'] = $GLOBALS['OC_' . $sf['valuetype'] . 'AR'];
break;
}
} elseif (
isset($sf['values'])
&& is_array($sf['values'])
&& ( !isset($mod_oc_customforms_customSubForm) || ! $mod_oc_customforms_customSubForm )
) {
// Translate values
if (!isset($sf['usekey']) || $sf['usekey']) {
foreach ($sf['values'] as $vk => $vv) {
$OC_submissionFieldAR[$sfk]['values'][$vk] = oc_($vv);
}
} else { // change to usekey in support of field values translation (e.g., consent, sub type)
$OC_submissionFieldAR[$sfk]['usekey'] = true;
$valuesAR = array();
foreach ($sf['values'] as $vv) {
$valuesAR[$vv] = oc_($vv);
}
$OC_submissionFieldAR[$sfk]['values'] = $valuesAR;
}
}
}
}
// Update Topics to radio if required and max selections = 1
if (isset($OC_submissionFieldAR['topics']['required']) && $OC_submissionFieldAR['topics']['required'] && isset($OC_submissionFieldAR['topics']['maxselections']) && ($OC_submissionFieldAR['topics']['maxselections'] == 1) && ($OC_submissionFieldAR['topics']['type'] == 'checkbox')){
$OC_submissionFieldAR['topics']['type'] = 'radio';
}
// Remove file field if present and not making new submission
if (isset($OC_submissionFieldAR['file']) && !preg_match("/submit/", $_SERVER['PHP_SELF']) && !preg_match("/preview/", $_SERVER['QUERY_STRING'])) {
unset($OC_submissionFieldAR['file']);
foreach ($OC_submissionFieldSetAR as $fsid => $fsar) {
if (in_array('file', $fsar['fields'])) {
if (count($fsar['fields']) == 1) {
unset($OC_submissionFieldSetAR[$fsid]);
} else {
$OC_submissionFieldSetAR[$fsid]['fields'] = array_diff($OC_submissionFieldSetAR[$fsid]['fields'], array('file'));
}
break;
}
}
}
// Set contact author field to 1 and hide it if (minDisplayAuthors=1 && maxAuthors=1) || (OC_authorOneContact=1)
if ( isset($OC_submissionFieldAR['contactid']) && $author1contact ) {
$OC_submissionFieldAR['contactid']['type'] = 'hidden';
$_POST['contactid'] = 1;
$GLOBALS['updateAuthorFieldsAR'] = array_diff($GLOBALS['updateAuthorFieldsAR'], array('contactid')); // remove contactid field from list of fields to be updated via Add Author
}
}
+244
View File
@@ -0,0 +1,244 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$OC_subNew = true; // flag for designating new submission
require_once "../include.php";
oc_sendNoCacheHeaders();
// Set number of author fields to display
if (isset($_POST['authornum']) && ctype_digit($_POST['authornum'])) {
$oc_authorNum = $_POST['authornum'];
} else {
$oc_authorNum = $OC_configAR['OC_authorsMinDisplay'];
}
printHeader(oc_('Submission'), 3);
// Check whether cfp still open
if (! $OC_statusAR['OC_submissions_open'] || ((defined('OCC_LICENSE_EXPIRES')) && (strtotime(OCC_LICENSE_EXPIRES) < time()))) {
print '<p class="warn">' . oc_('Submissions are closed.') . '</p>';
printFooter();
exit;
}
// File upload settings
$uploadDir = $OC_configAR['OC_paperDir'];
$extAR = $OC_configAR['OC_extar'];
$fileNotice = ( isset($OC_configAR['OC_paperFldNote']) ? oc_($OC_configAR['OC_paperFldNote']) : '' );
$formatDBFldName = 'format';
$fileFldName = 'File';
if (oc_hookSet('author-submit-preprocess')) {
foreach ($GLOBALS['OC_hooksAR']['author-submit-preprocess'] as $hook) {
require_once $hook;
}
}
require_once OCC_FORM_INC_FILE;
require_once OCC_SUBMISSION_INC_FILE;
// Check whether this is a submission
if (isset($_POST['submit'])) {
$err = '';
$errInc = '';
$qfields = array(); // fields to insert into submission table
$afields = array(); // fields to insert into authors table
$tfields = array(); // fields to insert into topics table
$fileUploaded = false;
require_once 'submission-validate.inc';
// errors?
if (!empty($err)) {
print '<p><span class="err">' . oc_('Please check the following:') . '<ul>' . $err . $errInc . '</ul></span><br /><hr /><br />';
// remove uploaded file?
if (isset($_FILES['file']['tmp_name']) && is_file($_FILES['file']['tmp_name'])) {
unlink($_FILES['file']['tmp_name']);
}
} else {
// Check that paper hasn't been submitted yet; if it has notify author and bail
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "` WHERE `" . OCC_TABLE_PAPER . "`.`title`='" . safeSQLstr($_POST['title']) . "' AND `" . OCC_TABLE_AUTHOR . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` AND `" . OCC_TABLE_AUTHOR . "`.`position`=`" . OCC_TABLE_PAPER . "`.`contactid` AND `" . OCC_TABLE_AUTHOR . "`.`name_last`='" . safeSQLstr($_POST['name_last'.$_POST['contactid']]) . "'";
$r = ocsql_query($q) or err(oc_('Unable to verify whether submission has already been made'));
if (ocsql_num_rows($r) > 0) {
print '<p><span class="err">' . 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 <a href="%s">here</a>.'), 'edit.php') . ' ';
}
print oc_('Please contact the Chair with any questions.') . '</span></p>';
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 .= '<p class="warn">' . sprintf(oc_('Your file failed to load properly. Please try <a href="%s">uploading just the file</a> or contact the Chair.'), 'upload.php') . '</p>';
}
}
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_('<p><strong>Thank you for your submission. Your submission ID number is [:sid:]. Please write this number down and include it in any communications with us.</strong></p>
<p><strong>Below is the information submitted. We have also emailed a copy to the submission contact. If you notice any problems or do <em>not</em> receive the email within 24 hours, please contact us.</strong></p>
<p>[:formfields:]</p>');
}
// 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:\]/", '<br />' . nl2br(safeHTMLstr($formFields)), $confirmmsg);
print $confirmmsg;
if (($OC_configAR['OC_emailAuthorRecipients'] == 1) && !empty($allemails)) {
$mailto = $allemails;
} else {
$mailto = $contactemail;
}
sendEmail($mailto, $mailsubject, $mailbody, $OC_configAR['OC_notifyAuthorSubmit']);
printFooter();
// log
oc_logit('submission', 'Submission ID ' . $pid . ' made. Title: ' . $_POST['title']);
if (oc_hookSet('author-submit-postsave')) {
foreach ($GLOBALS['OC_hooksAR']['author-submit-postsave'] as $hook) {
require_once $hook;
}
}
exit;
} // else no errors
}
if (isset($OC_configAR['OC_paperSubNote']) && !empty($OC_configAR['OC_paperSubNote'])) {
print '<div>' . (preg_match("/\<(?:p|br) ?\/?\>/", oc_($OC_configAR['OC_paperSubNote'])) ? oc_($OC_configAR['OC_paperSubNote']) : nl2br(oc_($OC_configAR['OC_paperSubNote']))) . '</div><p><hr /></p>';
}
print '
<form method="post" enctype="multipart/form-data" action="' . $_SERVER['PHP_SELF'] . '" class="ocform" id="makesub">
<input type="hidden" name="authornum" id="authornum" value="' . $oc_authorNum . '" />
';
oc_displayFieldSet($OC_submissionFieldSetAR, $OC_submissionFieldAR, $_POST);
if (oc_hookSet('author-submit-fields')) {
foreach ($GLOBALS['OC_hooksAR']['author-submit-fields'] as $hook) {
require_once $hook;
}
}
print '
<p class="note">' . oc_('Please check over your entries, making sure everything is filled out. When ready, click on the Make Submission button below once.') . '</p>
<div id="oc_submit_emailConfirmOuter">
<div id="oc_submit_emailConfirmInner" aria-live="polite">
<p class="note">' . oc_('The confirmation email will be sent to:') . '</p>
<p id="oc_submit_emailConfirm"></p>
</div>
</div>
<p><input type="submit" name="submit" id="submit" value="' . oc_('Make Submission') . '" class="submit" /></p>
<span id="processing" style="position: relative; visibility: hidden;">' . oc_('Processing...') . '</span>
</fieldset>
</form>
<script type="text/javascript">
oc_setupProcessingForm("makesub");
document.getElementById("makesub").addEventListener("change", function (evt) { oc_updateSubmitEmailAddresses(evt, true, ' . $OC_configAR['OC_emailAuthorRecipients'] . '); });
oc_updateSubmitEmailAddresses(null, true, ' . $OC_configAR['OC_emailAuthorRecipients'] . ');
</script>
';
printFooter();
?>
+260
View File
@@ -0,0 +1,260 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
$uploadDir = $OC_configAR['OC_paperDir'];
$uploadOpen = $OC_statusAR['OC_upload_open'];
$extAR = $OC_configAR['OC_extar'];
$fileNotice = ( isset($OC_configAR['OC_paperFldNote']) ? $OC_configAR['OC_paperFldNote'] : '' );
$formatDBFldName = 'format';
if (OCC_CHAIR_PWD_TRUMPS && isset($_REQUEST['c']) && ($_REQUEST['c'] == 1)) {
$hdrfn = 1;
beginChairSession();
$chair = TRUE;
} else {
$hdrfn = 3;
$chair = FALSE;
}
// Print appropriate header
printHeader(oc_('Upload File'), $hdrfn);
if (oc_hookSet('author-upload-preprocess')) {
foreach ($GLOBALS['OC_hooksAR']['author-upload-preprocess'] as $hook) {
require_once $hook;
}
}
if ($chair) { // display back links
print '<p style="text-align: center"><a href="../chair/show_paper.php?pid=' . safeHTMLstr($_REQUEST['pid']) . '">View This Submission</a> | <a href="../chair/list_papers.php">View All Submissions</a></p><br />';
} elseif (! $uploadOpen) { // Check that we're still open
warn(oc_('File upload is not available'));
}
// Check whether this is a submission
if (isset($_POST['ocaction']) && ($_POST['ocaction'] == "Upload File")) {
if ($chair && !validToken('chair')) {
warn(oc_('Invalid submission'));
}
// Check inputs
if (! isset($_POST['pid']) || ! preg_match("/^\d+$/", $_POST['pid'])) {
warn(oc_('Submission ID is invalid') . '. <a href="upload.php">' . oc_('Try again') . '</a>');
} elseif (
(! $chair && (!isset($_POST['pwd']) || empty($_POST['pwd'])))
|| (!isset($_FILES['file']['name']) || empty($_FILES['file']['name']))
|| (!isset($_POST['format']) || !in_array($_POST['format'], $extAR))
) {
warn('<form method="post" action="upload.php">' . oc_('Please fill in all fields.') . ' <input type="hidden" name="c" value="' . ($chair ? 1 : 0) . '" /><input type="hidden" name="pid" value="' . safeHTMLstr(varValue('pid', $_POST)) . '" /><input type="submit" value="' . oc_('Try again') . '" /></form>');
}
// Set PID to intval in case of leading 0's
$usepid = intval($_POST['pid']);
// Retrieve pwd, format, & contact author email
$pq = "SELECT `" . OCC_TABLE_PAPER . "`.`" . $formatDBFldName . "`, `" . OCC_TABLE_PAPER . "`.`accepted`, `" . OCC_TABLE_PAPER . "`.`password`, `" . OCC_TABLE_AUTHOR . "`.`email` FROM `" . OCC_TABLE_PAPER . "` LEFT JOIN `" . OCC_TABLE_AUTHOR . "` ON (`" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` AND `" . OCC_TABLE_PAPER . "`.`contactid`=`" . OCC_TABLE_AUTHOR . "`.`position`) WHERE `" . OCC_TABLE_PAPER . "`.`paperid`='" . $usepid . "'";
$pr = ocsql_query($pq) or err("Unable to upload file");
if (ocsql_num_rows($pr) != 1) {
warn(oc_('Submission ID or password entered is incorrect'));
}
$pl = ocsql_fetch_array($pr);
// Valid pid/pwd?; check for chair pwd first to save db call
if (! $chair
&& !oc_password_verify($_POST['pwd'], $pl['password'])
) {
warn(oc_('Submission ID or password entered is incorrect'));
}
// Was a file successfully loaded
if (!isset($_FILES['file']['error']) // bad upload
|| $_FILES['file']['error'] // error
|| ! is_uploaded_file($_FILES['file']['tmp_name']) // fake upload
|| ($_FILES['file']['size'] <= 0) // empty file
|| (!empty($OC_configAR['OC_fileLimit']) && ($_FILES['file']['size'] > ($OC_configAR['OC_fileLimit'] * 1024 * 1024))) // file size > limit
) {
warn(sprintf(oc_('The file failed to load. Please <a href="%1$s">try again</a>. If the problem persists, contact the <a href="mailto:%2$s?subject=File Upload failed">Chair</a>'), $_SERVER['PHP_SELF'], $OC_configAR['OC_pcemail']));
}
if (oc_hookSet('author-upload-validate')) {
foreach ($GLOBALS['OC_hooksAR']['author-upload-validate'] as $hook) {
require_once $hook;
}
}
// Delete old file?
$oldFileName = $uploadDir . $usepid . '.' . $pl[$formatDBFldName];
oc_deleteFile($oldFileName);
// Move new file
$err = 0;
$newFileName = $uploadDir . $usepid . '.' . $_POST['format'];
// Check whether file uploaded
if (is_uploaded_file($_FILES['file']['tmp_name'])
&& oc_saveFile($_FILES['file']['tmp_name'], $newFileName, $_POST['format'])
) {
//T: %s = submission ID (number)
$confirmmsg = sprintf(oc_('Submission ID %s has been uploaded.'), $usepid);
// 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:] file uploaded');
//T: [:sid:] is the numeric submission ID
$ocIgnoreBody = oc_('Submission ID [:sid:] has been uploaded.
[:error:]');
list($mailsubject, $mailbody) = oc_getTemplate('author-upload');
$templateExtraAR = array(
'sid' => $usepid,
'error' => ''
);
// Set lastupdate date, and format if needed
$eq = "UPDATE `" . OCC_TABLE_PAPER . "` SET `lastupdate`='" . safeSQLstr(date("Y-m-d")) . "'";
// also update format if changed
if ($_POST['format'] != $pl[$formatDBFldName]) {
$eq .= ", `" . $formatDBFldName . "`='" . safeSQLstr($_POST['format']) . "'";
}
$eq .= " WHERE `paperid`='" . $usepid . "'";
if ( ! ocsql_query($eq)) {
$templateExtraAR['error'] = oc_('However, we were unable to update the format.');
$confirmmsg .= "\n\n" . oc_('However, we were unable to update the format.');
$err = 1;
}
$mailsubject = oc_replaceVariables($mailsubject, $templateExtraAR);
$mailbody = oc_replaceVariables($mailbody, $templateExtraAR);
if (oc_hookSet('author-upload-preconfirm')) {
foreach ($GLOBALS['OC_hooksAR']['author-upload-preconfirm'] as $hook) {
require_once $hook;
}
}
// Send email confirmation
$mailto = '';
if ( $OC_configAR['OC_emailAuthorOnUpload'] && ! $chair) {
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, ',');
}
if (empty($mailto)) {
$mailto = $pl['email'];
}
}
sendEmail($mailto, $mailsubject, $mailbody, $OC_configAR['OC_notifyAuthorUpload']);
if (!$err) {
print $confirmmsg;
} else {
err($confirmmsg);
}
// log
oc_logit('submission', 'Submission ID ' . $usepid . ' file upload' . (isset($_POST['oc_multifile_type']) ? (' (MultiFile Type: ' . $_POST['oc_multifile_type'] . ')') : ''));
} else { // file failed to upload or move properly
print '<span class="err">' . sprintf(oc_('The file failed to load properly. Please email it directly to the <a href="mailto:%1$s?subject=%2$s File failed - submission ID %3$s">Chair</a>'), $OC_configAR['OC_pcemail'], $OC_configAR['OC_confName'], $usepid) . '</span>';
}
printFooter();
exit;
}
print '
<form method="POST" enctype="multipart/form-data" action="upload.php" id="uploadform">
<input type="hidden" name="ocaction" value="Upload File" />
';
if ($chair) {
print '
<input type="hidden" name="c" value="1">
<input type="hidden" name="token" value="' . safeHTMLstr($_SESSION[OCC_SESSION_VAR_NAME]['chairtoken']) . '" />
<input type="hidden" name="pid" value="' . safeHTMLstr($_REQUEST['pid']) . '" />
';
}
print '<table border="0" cellspacing="0" cellpadding="5" aria-live="polite">';
if (oc_hookSet('author-upload-formtop')) {
foreach ($GLOBALS['OC_hooksAR']['author-upload-formtop'] as $hook) {
require_once $hook;
}
}
if (! $chair) {
print '
<tr id="subid"><td style="font-weight: bold; white-space: nowrap;"><label for="pid">' . oc_('Submission ID') . ':</label></td><td><input name="pid" id="pid" size="10" tabindex="2" value="' . ((isset($_GET['id']) && ctype_digit($_GET['id'])) ? safeHTMLstr($_GET['id']) : '') . '"> ( <a href="email_papers.php" tabindex="7">' . oc_('forgot ID?') . '</a> )</td></tr>
<tr id="pwd"><td><strong><label for="pwdfld">' . oc_('Password') . ':</label></strong></td><td><input name="pwd" id="pwdfld" type="password" size="20" maxlength="255" tabindex="3"> ( <a href="reset.php" tabindex="8">' . oc_('forgot password?') . '</a> )</td></tr>
';
} else {
print '
<div style="display: none;"><div id="subid"></div><div id="pwd"></div></div>
';
}
print '
<tr id="filerow"><td valign="top"><strong><label for="file">' . oc_('File') . ':</label></strong></td><td><input type="file" name="file" id="file" size="30" tabindex="4" /> &nbsp; &nbsp; <strong><label for="format">' .
//T: File format
oc_('Format') . ':</label></strong>
';
print '<select name="format" id="format" tabindex="5">';
$formatoptions = "";
foreach ($extAR as $fval) {
$formatoptions .= '<option value="' . $fval . '"> ' . $OC_formatAR[$fval] . '</option>';
}
print $formatoptions;
print "</select><br /><br />\n";
print '
<div class="note2" id="fldnote">' . nl2br($fileNotice) . '</div>
';
if (empty($OC_configAR['OC_fileLimit'])) {
print '<p class="note">' . sprintf(oc_('File size limit is %s.'), $OC_maxFileSize) . '</p>';
}
print '
</td></tr>
';
if (oc_hookSet('author-upload-formbottom')) {
foreach ($GLOBALS['OC_hooksAR']['author-upload-formbottom'] as $hook) {
require_once $hook;
}
}
print '
</table>
<p>
<div id="sub"><input type="submit" name="subaction" class="submit" value="' . oc_('Upload File') . '" tabindex="6"></div>
</form>
<p>
';
if (oc_hookSet('author-upload-bottom')) {
foreach ($GLOBALS['OC_hooksAR']['author-upload-bottom'] as $hook) {
require_once $hook;
}
}
printFooter();
?>
+63
View File
@@ -0,0 +1,63 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
// included from edit.php
$spq = "SELECT * FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`='" . safeSQLstr($pid) . "'";
$spr = ocsql_query($spq) or err(oc_('Unable to retrieve submission'));
if (ocsql_num_rows($spr) != 1) {
warn(oc_('Submission ID is invalid'));
exit;
}
$spl = ocsql_fetch_assoc($spr);
ocsql_query("UPDATE `" . OCC_TABLE_PAPER . "` SET `edittoken`=NULL, `edittime`=NULL WHERE `paperid`='" . safeSQLstr($pid) . "' LIMIT 1");
// Get authors
$oc_authorNum = 0;
$qa = "SELECT * FROM `" . OCC_TABLE_AUTHOR . "` WHERE `paperid`='" . safeSQLstr($pid) . "' ORDER BY `position`";
$ra = ocsql_query($qa) or err(oc_('Unable to retrieve author(s) information'));
while ($a = ocsql_fetch_array($ra)) {
$apos = $a['position'];
foreach ($a as $akey => $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 '
<table class="ocfields">
<tr><th>' . safeHTMLstr(oc_('Submission ID')) . ':</th><td>' . safeHTMLstr($pid) . '</td></tr>
';
oc_showFieldSet($OC_submissionFieldSetAR, $OC_submissionFieldAR, $spl);
if (oc_hookSet('author-show_paper')) {
foreach ($GLOBALS['OC_hooksAR']['author-show_paper'] as $hook) {
require_once $hook;
}
}
print '</table>';
?>
+119
View File
@@ -0,0 +1,119 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
require_once "../include-submissions.inc";
printHeader(oc_('Withdraw Submission'), 3);
// Withdraw allowed?
if (! $OC_statusAR['OC_withdraw_open']) {
print '<strong>' . oc_('Submission withdraw is not available.') . '</strong><p>';
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 '<p>' . oc_('Your submission has been withdrawn. If this is not what you intended to do, please contact the Chair.') . '</p>';
// 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 '<p>' . oc_('We encountered a problem withdrawing your submission. Please contact the Chair.') . '</p>';
}
printFooter();
exit;
} // if submit
// display sub id/password form
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" id="withdrawform">
<input type="hidden" name="ocaction" value="Withdraw Submission" />
<table border=0 cellspacing=0 cellpadding=5>
<tr><td><strong><label for="pid">' . oc_('Submission ID') . '</label>:</strong></td><td><input name="pid" id="pid" size="10" tabindex="1"> ( <a href="email_papers.php" tabindex="4">' . oc_('forgot ID?') . '</a> )</td></tr>
<tr><td><strong><label for="password">' . oc_('Password') . '</label>:</strong></td><td><input name="pwd" id="password" type="password" tabindex="2" size="20" maxlength="255"> ( <a href="reset.php" tabindex="5">' . oc_('forgot password?') . '</a> )</td></tr>
</table>
<p class="warn">' . oc_('Clicking the button below will result in your submission being withdrawn.') . '</p>
<p><input type="submit" name="submit" value="' . oc_('Withdraw Submission') . '" tabindex="3" class="submit" onclick="return(confirm(\'' . oc_('Proceed with withdrawing submission?') . '\'))" /></p>
</form>
<script language="javascript">
<!--
document.forms[0].elements[0].focus();
// -->
</script>
';
if (oc_hookSet('author-withdraw-bottom')) {
foreach ($GLOBALS['OC_hooksAR']['author-withdraw-bottom'] as $hook) {
require_once $hook;
}
}
printFooter();
exit;
?>
+318
View File
@@ -0,0 +1,318 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$hdr = 'Assign Advocates';
$hdrfn = 1;
require_once "../include.php";
beginChairSession();
// Get topics
$topicsAR = array();
$q = "SELECT * FROM `" . OCC_TABLE_TOPIC . "`";
$r = ocsql_query($q) or err("Unable to query topics", $hdr, $hdrfn);
while ($l = ocsql_fetch_assoc($r)) {
$topicsAR[$l['topicid']] = useTopic($l['short'], $l['topicname'], 1);
}
// Filter
$filterOptionsAR = array('Submissions', 'Advocates');
$srfilter = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['srfilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['srfilter'] : ''); // submissions and/or reviewers
$topicfilter = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['topicfilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['topicfilter'] : ''); // topic
if (isset($_POST['fsubmit']) && ($_POST['fsubmit'] == 'Filter')) {
if (!isset($_POST['srfilter']) || empty($_POST['srfilter'])) {
$srfilter = '';
} elseif (in_array($_POST['srfilter'], $filterOptionsAR)) {
$srfilter = $_POST['srfilter'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['srfilter'] = $srfilter;
if (!isset($_POST['topicfilter']) || empty($_POST['topicfilter']) || !isset($topicsAR[$_POST['topicfilter']])) {
$topicfilter = '';
} else {
$topicfilter = $_POST['topicfilter'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['topicfilter'] = $topicfilter;
session_write_close();
} elseif (!isset($_GET['s']) && !isset($_POST['submit'])) { // reset filter if not coming from this page
unset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['srfilter']);
unset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['topicfilter']);
session_write_close();
$srfilter = '';
$topicfilter = '';
}
printHeader($hdr, $hdrfn);
if (isset($_POST['submit']) && ($_POST['submit'] == "Assign Advocates")) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// Check that we have at least one paper and advocate
if (empty($_POST['papers']) || empty($_POST['advocates'])) {
print '<span class="err">Please go back and select at least one submission and one advocate</span><p>';
} 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 "<p class=\"warn\">! Submission $j is in conflict with advocate $i.</p>\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 "<p class=\"warn\">! Submission $j already has an advocate assigned. Please delete the existing advocate first before assigning a new one, or select <em>Override Current Assingment</em>.</p>\n";
} else {
print "<p class=\"err\">!! Error assigning submission $j to advocate $i</p>\n";
}
} else {
print "<p>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 "<p class=\"warn\">! Submission $j has already been assigned reviewer $i.</p>\n";
} else {
print "<p class=\"err\">!! Error assigning submission $j to reviewer $i</p>\n";
}
}
}
}
}
}
print '<br /><hr /><br />';
// Notify?
if ( isset($_POST['notify']) && ($_POST['notify'] == 1) && (count($advocateAssignmentAR) > 0) ) {
// Get list of sub titles
$r = ocsql_query("SELECT `paperid`, `title` FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid` IN (" . implode(',',$submissionAssignmentAR) . ")") or err('Unable to retrieve submission titles for notification');
$submissionTitleAR = array();
while ($l = ocsql_fetch_assoc($r)) {
$submissionTitleAR[$l['paperid']] = $l['paperid'] . '. ' . $l['title'];
}
// Get advocates to notify
$q = "SELECT `reviewerid`, `name_first`, `name_last`, CONCAT_WS(' ', `name_first`, `name_last`) AS `name`, `email`, `username` FROM `" . OCC_TABLE_REVIEWER . "` WHERE `reviewerid` IN (" . implode(',', array_keys($advocateAssignmentAR)) . ")";
$r = ocsql_query($q) or err('Unable not get advocate email address(es) for notification');
// Get notification template
// ocIgnore included so poEdit picks up (DB) template translation
$ocIgnoreSubject = oc_('New Advocate Assignment(s)');
//T: [:OC_confName:] is the event name
$ocIgnoreBody = oc_('New assignments have been made for you to advocate in the [:OC_confName:] OpenConf system:
[:assignments:]
Thank you.');
list($subject, $message) = oc_getTemplate('chair-assign_advocates');
// Hook
if (oc_hookSet('chair-assign-advocate-notify')) {
foreach ($OC_hooksAR['chair-assign-advocate-notify'] as $f) {
require_once $f;
}
}
// Iterate through advocates
while ($l = ocsql_fetch_assoc($r)) {
$templateExtraAR = $l;
$templateExtraAR['assignments'] = '';
$templateExtraAR['advocateid'] = $l['reviewerid'];
foreach ($advocateAssignmentAR[$l['reviewerid']] as $sid) {
$templateExtraAR['assignments'] .= $submissionTitleAR[$sid] . "\n\n";
}
$tmpsubject = oc_replaceVariables($subject, $templateExtraAR);
$tmpmessage = oc_replaceVariables($message, $templateExtraAR);
if (sendEmail($l['email'], $tmpsubject, $tmpmessage)) {
print '<p>Notification sent to ' . safeHTMLstr($l['name']) . ' (' . safeHTMLstr($l['reviewerid']) . ')</p>';
} else {
print '<p class="err">!! Unable to email notification to <a href="mailto:' . safeHTMLstr($l['email']) . '">' . safeHTMLstr($l['name']) . '</a> (' . safeHTMLstr($l['reviewerid']) . ')</p>';
}
}
print '<p><hr /></p>';
}
}
print '
<p>&#187; <a href="' . $_SERVER['PHP_SELF'] . '?s=' . varValue('s', $_GET) . '">Make additional assignments</a></p>
<p>&#187; <a href="list_advocates.php">View/Edit assignments</a></p>
<p>&#187; <a href="list_conflicts.php">Manage conflicts</a></p>
';
} else {
$pq = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`title`, `" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid` FROM `" . OCC_TABLE_PAPER . "` LEFT JOIN `" . OCC_TABLE_PAPERADVOCATE . "` ON `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERADVOCATE . "`.`paperid` ORDER BY `" . OCC_TABLE_PAPER . "`.`paperid`";
$pr = ocsql_query($pq) or err("Unable to get submissions");
// Get pad size for paper id's - yes, we really need the max id, but this should do:)
$psize = oc_strlen((string) ocsql_num_rows($pr));
if (ocsql_num_rows($pr) == 0) {
print '<span class="warn">No submissions have been made yet</span><p>';
} else {
if (!isset($_GET['s']) || ($_GET['s'] == "id")) {
$idsortstr = 'ID';
$nsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=name">Name</a>';
$rsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=reviews" title="Number of Submissions">No. Submission</a>';
$legend = "[ Advocate ID - $nsortstr ($rsortstr) ]";
$sortby = "`" . OCC_TABLE_REVIEWER . "`.`reviewerid`";
} elseif ($_GET['s'] == "reviews") {
$rsortstr = 'No. Reviews';
$idsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=id">ID</a>';
$nsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=name">Name</a>';
$legend = "[ No. Submissions - Advocate $nsortstr - $idsortstr ]";
$sortby = "`acount`, `" . OCC_TABLE_REVIEWER . "`.`name_last`, `" . OCC_TABLE_REVIEWER . "`.`name_first`";
} else {
$idsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=id">ID</a>';
$nsortstr = 'Name';
$rsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=reviews" title="Number of Submissions">No. Submissions</a>';
$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 '<span class="warn">No program committee members have signed up yet</span><p>';
} else {
// display filter?
$subSort = false;
$revSort = false;
$subFilterAR = array();
$revFilterAR = array();
if (count($topicsAR) > 1) {
print '
<div style="text-align: center; margin: 1.5em 0;">
<form method="post" action="' . $_SERVER['PHP_SELF'] . '?s=' . safeHTMLstr($_GET['s']) . '" title="filter by topic">
<select name="srfilter" title="what to filter"><option value="">Submissions and Advocates</option>' . generateSelectOptions($filterOptionsAR, $srfilter, false) . '</select> &nbsp;<select name="topicfilter" title="topic to filter by"><option value="">All Topics</option>' . generateSelectOptions($topicsAR, $topicfilter, true) . '</select> &nbsp;<input type="submit" name="fsubmit" title="Filter" value="Filter" />
</form>
</div>
';
if (!empty($topicfilter)) {
if ($srfilter != 'Advocates') {
$subSort = true;
$r = ocsql_query("SELECT `paperid` FROM `" . OCC_TABLE_PAPERTOPIC . "` WHERE `topicid`='" . safeSQLstr($topicfilter) . "'") or err('Unable to filter submissions by topic');
while ($l = ocsql_fetch_assoc($r)) {
$subFilterAR[] = $l['paperid'];
}
}
if ($srfilter != 'Submissions') {
$revSort = true;
$r = ocsql_query("SELECT `reviewerid` FROM `" . OCC_TABLE_REVIEWERTOPIC . "` WHERE `topicid`='" . safeSQLstr($topicfilter) . "'") or err('Unable to filter reviewers by topic');
while ($l = ocsql_fetch_assoc($r)) {
$revFilterAR[] = $l['reviewerid'];
}
}
}
}
// display assignment form
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<div style="float: left; margin-right: 50px;">
<p><strong>Select Submission(s):</strong></p>
<p>[ Submission ID - Title (Advocate ID or ***) ]</p>
<select multiple size="20" name="papers[]">
';
$count = 0;
while ($paper = ocsql_fetch_assoc($pr)) {
if ($subSort && !in_array($paper['paperid'], $subFilterAR)) { continue; }
$count++;
print '<option value="' . $paper['paperid'] . '">' . padNumber($paper['paperid'],$psize) . ' - ' . safeHTMLstr(shortenStr($paper['title'],80)) . ' (' . ($paper['advocateid'] ? $paper['advocateid'] : '***') . ")</option>\n";
}
if ($count == 0) {
print '<option disabled>no topic match</option>';
}
print '
</select>
</div>
<div style="float: left;">
<p><strong>Select Advocate:</strong> &nbsp; <span class="note">(one per submission)</span><br />
<p>' . $legend . '</p>
<select size="20" name="advocates[]">
';
$count = 0;
while ($advocate = ocsql_fetch_assoc($rr)) {
if ($revSort && !in_array($advocate['reviewerid'], $revFilterAR)) { continue; }
$count++;
print '<option value="' . $advocate['reviewerid'] . '">';
if (!isset($_GET['s']) || ($_GET['s'] == "id")) {
print padNumber($advocate['reviewerid'],$rsize) . ' - ' . safeHTMLstr($advocate['name']) . " (" . $advocate['acount'] . ")</option>\n";
} elseif ($_GET['s'] == "reviews") {
print padNumber($advocate['acount'],2) . ' - ' . safeHTMLstr($advocate['name']) . " - " . $advocate['reviewerid'] . "</option>\n";
} else {
print safeHTMLstr($advocate['name']) . " - " . $advocate['reviewerid'] . " (" . $advocate['acount'] . ")</option>\n";
}
}
if ($count == 0) {
print '<option disabled>no topic match</option>';
}
print '
</select>
<br />
<span class="note">Tip: Click the ID, Name, or Submission links<br />above to re-sort this list (page will reload)</span>
</div>
<br style="clear: left;" />
<p><strong>Options:</strong></p>
<p><label><input type="checkbox" name="asrev" value="yes"> <strong><em>Assign as Reviewer</em></strong></label> &#8211; check box to also assign advocate as reviewer of submission</p>
<p><label><input type="checkbox" name="assignment_override" value="1"> <strong><em>Override Current Assignment</em></strong></label> &#8211; check box to change advocate if one already assigned</p>
';
if ($OC_configAR['OC_allowConflictOverride']) {
print '<p><label><input type="checkbox" name="conflict_override" value="1" /> <strong><em>Override Conflicts</em></strong></label> &#8211; check box to make assignments even if there is a conflict</p>';
}
print '
<p><label><input type="checkbox" name="notify" value="1"> <strong><em>Notify Advocate(s)</em></strong></label> &#8211; check box to notify advocate(s) that new assignments have been made</p>
<br />
<p><input type="submit" name="submit" class="submit" value="Assign Advocates"></p>
</form>
';
}
}
}
printFooter();
?>
+359
View File
@@ -0,0 +1,359 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Auto Assign Advocates",1);
$advocatePerPaper = 1;
// Init algorithm array
$OC_algorithmAR = array(
array(
'algorithm' => 'Weighted Topic Match',
'description' => 'Assigns based on number of topic matches (high to low) between submissions and reviewers, giving assignment precedence to submissions with the least number of overall matching reviewer/topic pairings',
'include' => 'assign_auto_advocates_weighted_topic_match.inc'
),
array(
'algorithm' => 'Topic Match',
'description' => 'Assigns based on number of topic matches (high to low) between submissions and reviewers',
'include' => 'assign_auto_advocates_topic_match.inc'
),
);
function oc_skipSubAssignment($sid) {
$skip = false;
// skip if accepted
if (isset($_POST['skipaccepted']) && ($_POST['skipaccepted'] == 'Yes') && isset($GLOBALS['pInfoAR'][$sid]['accepted']) && !empty($GLOBALS['pInfoAR'][$sid]['accepted'])) {
$skip = true;
}
//skip if not of the selected type
if (isset($_POST['limittype']) && !empty($_POST['limittype']) && isset($GLOBALS['pInfoAR'][$sid]['type']) && ($_POST['limittype'] != $GLOBALS['pInfoAR'][$sid]['type'])) {
$skip = true;
}
return($skip);
}
// Check for addt'l (hook) algorithms
if (oc_hookSet('assign_auto_advocates-algorithm')) {
foreach ($OC_hooksAR['assign_auto_advocates-algorithm'] as $k => $v) {
$OC_algorithmAR[] = $v;
}
}
// Submit - Commit assignments to database?
if (isset($_POST['submit']) && ($_POST['submit'] == "Make Assignments")) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
if (!isset($_SESSION['OPENCONFCHAIRVARS']['aAssignments'])) {
err("No advocates set");
}
// Keep or delete current assignments
$currAR = array();
if ($_POST['keep'] == 'Yes') {
$aq = "SELECT `paperid`, `advocateid` FROM `" . OCC_TABLE_PAPERADVOCATE . "`";
$ar = ocsql_query($aq) or err("Unable to access database");
while ($al = ocsql_fetch_array($ar)) {
$currAR[] = $al['paperid'] . '-' . $al['advocateid'];
}
} else {
oc_deleteAssignments(null, null, 'advocate');
}
// Add advocates
foreach ($_SESSION['OPENCONFCHAIRVARS']['aAssignments'] as $pid => $aid) {
if (!$aid || in_array($pid . '-' . $aid, $currAR)) { continue; }
$q = "INSERT INTO `" . OCC_TABLE_PAPERADVOCATE . "` (`paperid`,`advocateid`) VALUES ('" . safeSQLstr($pid) . "','" . safeSQLstr($aid) . "')";
issueSQL($q);
}
// Okey Dokey
print '<p><strong>Assignments have been made</strong></p>
<p><a href="list_advocates.php">List Advocates</a></p>
';
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 '<p class="err">Advocates or Reviewers appear to have already been assigned. Existing advocate assignments will be deleted unless you choose <em>Yes</em> to <em>Keep Existing Assignments</em> below.</p>';
$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 '
<p>Below you will find OpenConf\'s suggested advocate assignments. You may fine tune these automated assignments by changing the following options and clicking <em>Re-Evaluate Assignments</em>. Once you are satisfied, click the <em>Make Assignments</em> button to commit them to the database. You may manually add/delete advocates afterwards through the <em>Assign Advocates Manually</em> and <em>List/Unassign Advocates</em> 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 <a href="../modules/modules.php">Auto Assign</a> module.';
}
print '</p>
<form method="post" action="'.$_SERVER['PHP_SELF'].'">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<table border=0 cellspacing=5 cellpadding=0 bgcolor="#eeeeee">
<tr><td>Total Submissions:</td><td>' . $ptot . '</td></tr>
<tr><td>Total Advocates:</td><td>' . $atot . '</td></tr>
<tr><td>Advocate/Submission Pairings in Conflict:</td><td>' . count($nAR) . ' &nbsp;(<a href="list_conflicts.php" target="_blank" style="font-style: italic;" title="opens in a new window/tab">manage</a>)</td></tr>
<tr><td>Maximum Submissions per Advocate:</td><td><input name="ppa" size="4" maxlength="4" value="' . $papersPerAdvocate . '"></td></tr>
<tr><td>Highlight if Submissions per Advocate &lt; =</td><td><input name="ppat" size="4" maxlength="4" value="' . $ppaThreshold . '" style="background-color: #ffc;"></td></tr>
<tr><td valign="top" title="Selecting No will result in all current assignments being deleted">Keep Existing Assignments?</td><td>' . generateRadioOptions('keep', $yesNoAR, varValue('keep', $_POST, 'Yes'), 0) . '</td></tr>
<tr><td valign="top" title="Selecting No will result in submissions already accepted or rejected in also being assigned">Skip Accepted/Rejected Submissions?</td><td>' . generateRadioOptions('skipaccepted', $yesNoAR, varValue('skipaccepted', $_POST, 'Yes'), 0) . '</td></tr>
';
if (count($OC_activeSubTypeAR) > 1) {
print '
<tr><td valign="top" title="Only submissions of the selected type will be assigned">Assign submissions of type:</td><td><select name="limittype"><option value="">All</option>' . generateSelectOptions($OC_activeSubTypeAR, varValue('limittype', $_POST), 1) . '</select></td></tr>
';
}
$algoOptions = '';
foreach ($OC_algorithmAR as $k => $v) {
$algoOptions .= '<label title="' . safeHTMLstr((isset($v['description']) ? $v['description'] : '')) . '"><input type="radio" name="algo" value="' . $k . '" /> ' . safeHTMLstr($v['algorithm']) . '</label><br />';
}
$algoOptions = preg_replace("/(value=\"" . $algo . "\")/","$1 checked", $algoOptions);
print '<tr><td valign="top">Algorithm:</td><td>' . $algoOptions . '</td></tr>';
$remStr = '<tr><td valign="top">Remedy Missing Assignments by:</td><td><!--<input type="checkbox" name="remedy[]" value="bump">Bumping # Submissions / Advocate<br />--><label><input type="checkbox" name="remedy[]" value="random"> Randomly Assigning Advocate</label></td></tr>';
if (isset($_POST['remedy'])) {
foreach ($_POST['remedy'] as $rs) {
if (preg_match("/^\w+$/", $rs)) {
$remStr = preg_replace("/(value=\"" . preg_quote($rs, '/') . "\")/", "$1 checked", $remStr);
}
}
}
print $remStr . '
<tr><td colspan=2><br /><input type="submit" name="submit" class="submit" value="Re-Evaluate Assignments"><p><input type="submit" name="submit" class="submit" value="Make Assignments"' . ($confirmOverride ? ' onclick="return confirm(\'Confirm overwrite of existing assignments\')"' : '') . '> <span class="note">(commits assingments to database)</span></td></tr>
</table>
</form>
<p><hr><p>
<style type="text/css">
.phighlight { background: #ffcccc; font-weight: bold;}
.rhighlight { background: #ffffcc; font-weight: bold;}
</style>
';
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 '
<table border=0 cellspacing=0 cellpadding=0>
<tr><th colspan=3>Suggested Assignments' . ((!isset($_POST['keep']) || ($_POST['keep'] == 'Yes')) ? '<p class="note" style="font-weight: normal;">including already assigned</p>' : '') . '</th></tr>
<tr><td valign="top"><pre>
<span class="phighlight"> * </span> Unable to assign advocate
<span class="note">Click title for submission info (new window)</span>
<strong>Submission ID (Title) (Advocate)</strong>
';
foreach ($pAR as $k => $v) {
$tmpStr = fmtNumSpacing($k).' (<a href="show_paper.php?pid=' . $k . '" title="information for submission ID ' . $k . ' (new window)" target="p">' . safeHTMLstr(fmtStrSpacing($pInfoAR[$k]['title'], 20)) . "</a>) (";
if (!empty($v)) {
$tmpStr .= safeHTMLstr(fmtStrSpacing($pAR[$k] . "-" . $aNameAR[$pAR[$k]],15));
print $tmpStr.")\n";
}
else {
$tmpStr .= fmtStrSpacing("",15);
print '<span class="phighlight">' . $tmpStr . ") *</span>\n";
}
}
print '
</pre></td><td width="50" style="white-space: nowrap;"> &nbsp; &nbsp; &nbsp; &nbsp; </td><td valign="top"><pre>
<span class="rhighlight"> * </span> below threshold
<span class="note">Click name for reviewer info (new window)</span>
<span class="note">Place cursor on No. Submissions for assignments</span>
<strong>No. Submissions per Advocate ID (Name)</strong>
';
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 = '<span class="popup"><a href="javascript:popup(\'p' . $k . 'Popup\')">' . fmtNumSpacing(count($v)) . " - " . fmtNumSpacing($k) . '<span id="p' . $k. 'Popup">' . safeHTMLstr($titleStr) . '</span></a></span> (<a href="show_reviewer.php?rid='.$k.'" title="information for advocate ID ' . $k . ' (new window)" target="a">' . safeHTMLstr(fmtStrSpacing($aNameAR[$k],25))."</a>)";
if (count($v) <= $ppaThreshold) { print '<span class="rhighlight">'.$tmpStr." *</span>\n"; }
else { print $tmpStr . "\n"; }
}
print '
</pre></td></tr>
</table>
<script>
var ocaaakeepno = document.getElementById("keep2");
if (ocaaakeepno.addEventListener) {
ocaaakeepno.addEventListener("click", function(){alert("Selecting No will delete all current advocate assignments and data regardless of other options selected")}, false);
} else if (ocaaakeepno.attachEvent) {
ocaaakeepno.attachEvent("onclick", function(){alert("Selecting No will delete all current advocate assignments and data regardless of other options selected")});
}
var ocaaaskipno = document.getElementById("skipaccepted2");
if (ocaaaskipno.addEventListener) {
ocaaaskipno.addEventListener("click", function(){alert("Selecting No will result in submissions already accepted or rejected by the Chair also being assigned")}, false);
} else if (ocaaaskipno.attachEvent) {
ocaaaskipno.attachEvent("onclick", function(){alert("Selecting No will result in submissions already accepted or rejected by the Chair also being assigned")});
}
</script>
';
printFooter();
?>
@@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
function oc_algoTopicMatch ($ppa) {
global $pAR, $aAR, $nAR, $pInfoAR;
$q = "SELECT `" . OCC_TABLE_PAPERTOPIC . "`.`paperid`, `" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid`, count( * ) AS `totmatch` FROM `" . OCC_TABLE_PAPERTOPIC . "`, `" . OCC_TABLE_REVIEWERTOPIC . "`, `" . OCC_TABLE_REVIEWER . "` WHERE `" . OCC_TABLE_REVIEWER . "`.`onprogramcommittee`='T' AND `" . OCC_TABLE_REVIEWERTOPIC . "`.`topicid`=`" . OCC_TABLE_PAPERTOPIC . "`.`topicid` AND `" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` GROUP BY `paperid`, `reviewerid` ORDER BY `totmatch` DESC";
$r = ocsql_query($q) or err("Unable to retrieve advocates");
while ($l=ocsql_fetch_array($r)) {
// Skip submission (e.g., accepted subs)
if (oc_skipSubAssignment($l['paperid'])) {
continue;
}
if (!in_array($l['paperid']."-".$l['reviewerid'],$nAR) // advocate not in conflict
&& empty($pAR[$l['paperid']]) // no advocate set yet
&& (count($aAR[$l['reviewerid']]) < $ppa) ) // not enough papers yet
{
$pAR[$l['paperid']] = $l['reviewerid'];
array_push($aAR[$l['reviewerid']],$l['paperid']);
}
}
}
oc_algoTopicMatch($papersPerAdvocate);
@@ -0,0 +1,128 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
function oc_algoAdvocateWeightedTopicMatch ($ppa,$sortorder) {
global $pAR, $aAR, $nAR, $pInfoAR;
$topPAR = array();
$topicReviewerAR = array();
$topicScoreAR = array();
$paperScoreAR = array();
$reviewerScoreAR = array();
$paperTopicAR = array();
$reviewerTopicAR = array();
// Get paper topics
$q = "SELECT `" . OCC_TABLE_PAPERTOPIC . "`.`paperid`, `" . OCC_TABLE_PAPERTOPIC . "`.`topicid` FROM `" . OCC_TABLE_PAPERTOPIC . "` ORDER BY `topicid`";
$r = ocsql_query($q) or err("Unable to get submission topics");
while ($l=ocsql_fetch_array($r)) {
// Add topic to paper
if (!isset($paperTopicAR[$l['paperid']])) {
$paperTopicAR[$l['paperid']] = array();
}
array_push($paperTopicAR[$l['paperid']],$l['topicid']);
$paperScoreAR[$l['paperid']] = 0;
// Increment paper-topic count
if (isset($topPAR[$l['topicid']])) {
$topPAR[$l['topicid']]++;
} else {
$topPAR[$l['topicid']] = 1;
}
}
// Get advocate topics
$q = "SELECT `" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid`, `" . OCC_TABLE_REVIEWERTOPIC . "`.`topicid`, `" . OCC_TABLE_REVIEWER . "`.`onprogramcommittee` FROM `" . OCC_TABLE_REVIEWER . "`, `" . OCC_TABLE_REVIEWERTOPIC . "` WHERE `" . OCC_TABLE_REVIEWER . "`.`onprogramcommittee`='T' AND `" . OCC_TABLE_REVIEWER . "`.`reviewerid`=`" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid` ORDER BY `topicid`";
$r = ocsql_query($q) or err("Unable to get advocate topics");
while ($l=ocsql_fetch_array($r)) {
// Add topic to advocate
if (!isset($reviewerTopicAR[$l['reviewerid']])) {
$reviewerTopicAR[$l['reviewerid']] = array();
}
array_push($reviewerTopicAR[$l['reviewerid']],$l['topicid']);
$reviewerScoreAR[$l['topicid']] = 0;
// Increment reviewer-topic count
if (!isset($topicReviewerAR[$l['topicid']])) {
$topicReviewerAR[$l['topicid']] = array();
}
array_push($topicReviewerAR[$l['topicid']],$l['reviewerid']);
}
// Get list of topics used
$topList = array_unique(array_merge(array_keys($topPAR), array_keys($topicReviewerAR)));
// Calculate topic score = #advocates / #papers
foreach($topList as $t) {
if (isset($topPAR[$t]) && ($topPAR[$t] > 0) && isset($topicReviewerAR[$t]) && (count($topicReviewerAR[$t] > 0))) {
$topicScoreAR[$t] = count($topicReviewerAR[$t]) / $topPAR[$t];
}
else $topicScoreAR[$t] = 0;
}
// Calculate paper scores
foreach ($paperTopicAR as $paperid => $topiclist) {
$score = 0;
foreach ($topiclist as $topicid) {
$score += $topicScoreAR[$topicid];
}
$paperScoreAR[$paperid] = $score;
}
asort($paperScoreAR);
// Calculate advocate scores
foreach ($reviewerTopicAR as $reviewerid => $topiclist) {
$score = 0;
foreach ($topiclist as $topicid) {
$score += $topicScoreAR[$topicid];
}
$reviewerScoreAR[$reviewerid] = $score;
}
asort($reviewerScoreAR);
// Iterate through papers (score low to high) assigning
// advocates in order of their score
foreach (array_keys($paperScoreAR) as $paperid) {
// Skip if paper already has advocate
if (!empty($pAR[$paperid])) { continue; }
// Skip submission (e.g., accepted subs)
if (oc_skipSubAssignment($paperid)) {
continue;
}
// Create a list of advocates for paper incl. scores
$Rs = array();
if (isset($paperTopicAR[$paperid])) {
foreach($paperTopicAR[$paperid] as $topicid) {
if (isset($topicReviewerAR[$topicid])) { // may not have a reviewer for every topic
foreach ($topicReviewerAR[$topicid] as $reviewerid) {
if (!in_array($paperid."-".$reviewerid,$nAR) // advocate not in conflict
&& (count($aAR[$reviewerid]) < $ppa) ) // not enough papers yet
{
$Rs[$reviewerid] = $reviewerScoreAR[$reviewerid];
}
}
}
}
}
// Assign advocate based on reviewer score high->low
if (count($Rs) > 0) {
if ($sortorder=="1") { arsort($Rs); }
else { asort($Rs); }
reset($Rs);
$pAR[$paperid] = key($Rs);
array_push($aAR[key($Rs)],$paperid);
}
}
}
oc_algoAdvocateWeightedTopicMatch($papersPerAdvocate,1);
+521
View File
@@ -0,0 +1,521 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
function oc_skipSubAssignment($sid) {
$skip = false;
// skip if accepted
if (isset($_POST['skipaccepted']) && ($_POST['skipaccepted'] == 'Yes') && isset($GLOBALS['pInfoAR'][$sid]['accepted']) && !empty($GLOBALS['pInfoAR'][$sid]['accepted'])) {
$skip = true;
}
//skip if not of the selected type
if (isset($_POST['limittype']) && !empty($_POST['limittype']) && isset($GLOBALS['pInfoAR'][$sid]['type']) && ($_POST['limittype'] != $GLOBALS['pInfoAR'][$sid]['type'])) {
$skip = true;
}
return($skip);
}
function oc_assignTimeoutShutdown() {
$_SESSION['OPENCONFCHAIRVARS']['timeoutAR'] = array(
'pAR' => $GLOBALS['pAR'],
'nAR' => $GLOBALS['nAR'],
'rAR' => $GLOBALS['rAR'],
'pInfoAR' => $GLOBALS['pInfoAR'],
'ptot' => $GLOBALS['ptot'],
'rNameAR' => $GLOBALS['rNameAR'],
'pcAR' => $GLOBALS['pcAR'],
'rtot' => $GLOBALS['rtot'],
'reviewersPerPaper' => $GLOBALS['reviewersPerPaper'],
'papersPerReviewer' => $GLOBALS['papersPerReviewer'],
'pprThreshold' => $GLOBALS['pprThreshold'],
'algo' => $GLOBALS['algo'],
'continueFrom' => (isset($GLOBALS['continueVal']) ? $GLOBALS['continueVal'] : 0),
'POST' => array(
'remedy' => (isset($_POST['remedy']) ? $_POST['remedy'] : array()),
'keep' => (isset($_POST['keep']) ? $_POST['keep'] : ''),
'skipaccepted' => (isset($_POST['skipaccepted']) ? $_POST['skipaccepted'] : ''),
'limittype' => (isset($_POST['limittype']) ? $_POST['limittype'] : ''),
'pcrev' => (isset($_POST['pcrev']) ? $_POST['pcrev'] : ''),
'advrev' => (isset($_POST['advrev']) ? $_POST['advrev'] : ''),
'rpp' => (isset($_POST['rpp']) ? $_POST['rpp'] : ''),
'ppr' => (isset($_POST['ppr']) ? $_POST['ppr'] : ''),
'pprt' => (isset($_POST['pprt']) ? $_POST['pprt'] : ''),
'ppa' => (isset($_POST['ppa']) ? $_POST['ppa'] : ''),
'algo' => (isset($_POST['algo']) ? $_POST['algo'] : '')
)
);
if (isset($GLOBALS['continueAR'])) {
foreach ($GLOBALS['continueAR'] as $k) {
$_SESSION['OPENCONFCHAIRVARS']['timeoutAR'][$k] = $GLOBALS[$k];
}
}
session_write_close();
header("Location: " . $_SERVER['PHP_SELF'] . "?timeout=1");
ob_clean();
exit;
}
ob_start();
printHeader("Auto Assign Reviewers", 1);
// Init algorithm array
$OC_algorithmAR = array(
array(
'algorithm' => 'Weighted Topic Match',
'description' => 'Assigns based on number of topic matches (high to low) between submissions and reviewers, giving assignment precedence to submissions with the least number of overall matching reviewer/topic pairings',
'include' => 'assign_auto_reviewers_weighted_topic_match.inc'
),
array(
'algorithm' => 'Topic Match',
'description' => 'Assigns based on number of topic matches (high to low) between submissions and reviewers',
'include' => 'assign_auto_reviewers_topic_match.inc'
),
);
// Check for addt'l (hook) algorithms
if (oc_hookSet('assign_auto_reviewers-algorithm')) {
foreach ($OC_hooksAR['assign_auto_reviewers-algorithm'] as $k => $v) {
$OC_algorithmAR[] = $v;
}
}
// Submit - Commit assignments to database?
if (isset($_POST['submit']) && ($_POST['submit'] == "Make Assignments")) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
if (!isset($_SESSION['OPENCONFCHAIRVARS']['pAssignments'])) {
err("No reviewers set");
}
// Keep or delete current assignments?
$currAR = array();
if ($_POST['keep'] == 'Yes') {
$prq = "SELECT `paperid`, `reviewerid` FROM `" . OCC_TABLE_PAPERREVIEWER . "`";
$prr = ocsql_query($prq) or err("Unable to access database");
while ($prl = ocsql_fetch_array($prr)) {
$currAR[] = $prl['paperid'] . '-' . $prl['reviewerid'];
}
} else {
oc_deleteAssignments(null, null);
}
// Add reviewers
foreach ($_SESSION['OPENCONFCHAIRVARS']['pAssignments'] as $pid => $rids) {
foreach ($rids as $rid) {
if (!$rid || in_array($pid . '-' . $rid, $currAR)) { continue; }
$q = "INSERT INTO `" . OCC_TABLE_PAPERREVIEWER . "` (`paperid`,`reviewerid`,`assigned`) VALUES ('" . safeSQLstr($pid) . "','" . safeSQLstr($rid) . "','" . safeSQLstr(date('Y-m-d')) . "')";
issueSQL($q);
}
}
// Okey Dokey
print '<p><strong>Assignments have been made</strong></p>
<p><a href="list_reviews.php">List Reviews</a></p>
';
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 '<p class="err">Reviews appear to have already been assigned. Existing reviews will be deleted unless you choose <em>Yes</em> to <em>Keep Existing Assignments</em> below.</p>';
$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 '
<script language="javascript">
<!--
function suggestPPR() {
if (document.getElementById && Math.ceil) {
var rpp = document.getElementById("rpp").value;
var pprSug = Math.ceil(((' . $ptot . ' * rpp) + ' . count($nAR) . ') / ' . $rtot . ');
alert("Suggested value: " + pprSug);
}
}
function updatePPA(fieldChecked) {
if (fieldChecked == "Yes") {
document.getElementById("maxppa").style.display = "";
} else {
document.getElementById("maxppa").style.display = "none";
}
}
// -->
</script>
<p>Below you will find OpenConf\'s suggested review assignments. You may fine tune these automated assignments by changing the following options and clicking <em>Re-Evaluate Assignments</em>. Once you are satisfied, click the <em>Make Assignments</em> button to commit them to the database. You may manually add/delete reviews afterwards through the <em>Assign Reviews Manually</em> and <em>List/Unassign Reviews</em> 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 <a href="../modules/modules.php">Auto Assign</a> module.';
}
print '</p>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<table border=0 cellspacing=5 cellpadding=0 bgcolor="#eeeeee">
<tr><td>Total Submissions:</td><td>' . $ptot . '</td></tr>
<tr><td>Total Reviewers:</td><td>' . $rtot . '</td></tr>
<tr><td>Reviewer/Submission Pairings in Conflict:</td><td>' . count($nAR) . ' &nbsp;(<a href="list_conflicts.php" target="_blank" style="font-style: italic;" title="opens in a new window/tab">manage</a>)</td></tr>
<tr><td>Desired Reviewers per Submission:</td><td><input name="rpp" id="rpp" size="4" maxlength="4" value="' . $reviewersPerPaper . '" style="background-color: #fcc;"></td></tr>
<tr><td>Maximum Submissions per Reviewer:</td><td><input name="ppr" id="ppr" size="4" maxlength="4" value="' . $papersPerReviewer . '">
<script language="javascript">
<!--
document.write(\'(<a href="javascript:void(0);" onclick="suggestPPR();" style="font-style: italic;">suggest</a>)\');
// -->
</script>
</td></tr>
<tr><td>Highlight if Submissions per Reviewer &lt; =</td><td><input name="pprt" size="4" maxlength="4" value="' . $pprThreshold . '" style="background-color: #ffc;"></td></tr>
<tr><td valign="top" title="Selecting No will result in all current assignments being deleted">Keep Existing Assignments?</td><td>' . generateRadioOptions('keep', $yesNoAR, varValue('keep', $_POST, 'Yes'), 0) . '</td></tr>
<tr><td valign="top" title="Selecting No will result in submissions already accepted or rejected in also being assigned">Skip Accepted/Rejected Submissions?</td><td>' . generateRadioOptions('skipaccepted', $yesNoAR, varValue('skipaccepted', $_POST, 'Yes'), 0) . '</td></tr>
';
if (count($OC_activeSubTypeAR) > 1) {
print '
<tr><td valign="top" title="Only submissions of the selected type will be assigned">Assign submissions of type:</td><td><select name="limittype"><option value="">All</option>' . generateSelectOptions($OC_activeSubTypeAR, varValue('limittype', $_POST), 1) . '</select></td></tr>
';
}
$algoOptions = '';
foreach ($OC_algorithmAR as $k => $v) {
$algoOptions .= '<label title="' . safeHTMLstr((isset($v['description']) ? $v['description'] : '')) . '"><input type="radio" name="algo" value="' . $k . '" /> ' . safeHTMLstr($v['algorithm']) . '</label><br />';
}
$algoOptions = preg_replace("/(value=\"" . $algo . "\")/","$1 checked", $algoOptions);
print '<tr><td valign="top">Algorithm:</td><td>' . $algoOptions . '</td></tr>';
$remStr = '<tr><td valign="top">Remedy Missing Assignments by:</td><td><!--<input type="checkbox" name="remedy[]" value="bump">Bumping # Submissions / Reviewer<br />--><label><input type="checkbox" name="remedy[]" value="random">Randomly Assigning Reviewers</label></td></tr>';
if (isset($_POST['remedy']) && !empty($_POST['remedy'])) {
foreach ($_POST['remedy'] as $rs) {
if (preg_match("/^\w+$/", $rs)) {
$remStr = preg_replace("/(value=\"" . preg_quote($rs, '/') . "\")/", "$1 checked", $remStr);
}
}
}
print $remStr;
if ($OC_configAR['OC_paperAdvocates']) {
print '
<tr><td valign="top">Assign PC members as reviewers?</td><td>' . generateRadioOptions('pcrev', $yesNoAR, varValue('pcrev', $_POST, 'No'), 0, 'onclick="updatePPA(this.value);"') . '</td></tr>
<tr id="maxppa"><td valign="top">Maximum Submissions per Advocate:</td><td><input name="ppa" size="4" maxlength="4" value="' . safeHTMLstr(varValue('ppa', $_POST, '')) . '" /> <span class="note">leave blank to use reviewer value above</span></td></tr>
<tr><td valign="top">Assign submission\'s advocate as reviewer?</td><td>' . generateRadioOptions('advrev', $yesNoAR, varValue('advrev', $_POST, 'Yes'), 0) . '</td></tr>
';
} else {
print '
<input type="hidden" name="pcrev" value="No" />
<input type="hidden" name="ppa" value="" />
<input type="hidden" name="advrev" value="No" />
';
}
print '
<tr><td colspan=2>&nbsp;</td></tr>
<tr><td colspan=2><input type="submit" name="submit" class="submit" value="Re-Evaluate Assignments"><p><input type="submit" name="submit" class="submit" value="Make Assignments"' . ($confirmOverride ? ' onclick="return confirm(\'Confirm overwrite of existing assignments\')"' : '') . '> <span class="note">(commits assignments to database)</span></td></tr>
</table>
</form>
<p><hr><p>
<style type="text/css">
.phighlight { background: #ffcccc; font-weight: bold;}
.rhighlight { background: #ffffcc; font-weight: bold;}
</style>
';
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 '
<table border=0 cellspacing=0 cellpadding=0>
<tr><th colspan=3>Suggested Assignments' . ((!isset($_POST['keep']) || ($_POST['keep'] == 'Yes')) ? '<p class="note" style="font-weight: normal;">including already assigned</p>' : '') . '</th></tr>
<tr><td valign="top"><pre>
<span class="phighlight"> * </span> below threshold
<span class="note">Place cursor on No. Reviewers for assignments</span>
<span class="note">Click title for submission info (new window)</span>
<strong>No. Reviewers per Submission ID (Title)</strong>
';
foreach ($pAR as $k => $v) {
$titleStr = "Reviewers for Submission $k:\n\n";
foreach ($v as $vv) { $titleStr .= "$vv - " . $rNameAR[$vv] . "\n"; }
$tmpStr = '<span class="popup"><a href="javascript:popup(\'p' . $k . 'Popup\')">' . fmtNumSpacing(count($v)) . " - " . fmtNumSpacing($k) . '<span id="p' . $k . 'Popup">' . safeHTMLstr($titleStr) . '</span></a></span> (<a href="show_paper.php?pid=' . $k . '" title="information on Submission ID ' . $k . ' (new window)" target="p">' . safeHTMLstr(fmtStrSpacing($pInfoAR[$k]['title'], 28)) . "</a>)";
if (count($v) < $reviewersPerPaper) { print '<span class="phighlight">' . $tmpStr . " *</span>\n"; }
else { print $tmpStr."\n"; }
}
print '
</pre></td><td width="50" style="white-space: nowrap;"> &nbsp; &nbsp; &nbsp; &nbsp; </td><td valign="top"><pre>
<span class="rhighlight"> * </span> below threshold
<span class="note">Place cursor on No. Submissions for reviewers</span>
<span class="note">Click name for reviewer info (new window)</span>
<strong>No. Submissions per Reviewer ID (Name)</strong>
';
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 = '<span class="popup"><a href="javascript:popup(\'r' . $k . 'Popup\')">' . fmtNumSpacing(count($v)) . " - " . fmtNumSpacing($k) . '<span id="r' . $k. 'Popup">' . safeHTMLstr($titleStr) . '</span></a></span> (';
if (in_array($k, $pcAR)) {
$tmpStr .= 'PC-';
$len = 21;
} else {
$len = 24;
}
$tmpStr .= '<a href="show_reviewer.php?rid='.$k.'" title="information for reviewer ID ' . $k . ' (new window)" target="r">' . safeHTMLstr(fmtStrSpacing($rNameAR[$k],$len))."</a>)";
if (count($v) <= $pprThreshold) { print '<span class="rhighlight">' . $tmpStr . " *</span>\n"; }
else { print $tmpStr . "\n"; }
}
print '</pre></td></tr>
</table>
<script>
updatePPA("' . safeHTMLstr(varValue('pcrev', $_POST, 'No')) . '");
var ocaaakeepno = document.getElementById("keep2");
if (ocaaakeepno.addEventListener) {
ocaaakeepno.addEventListener("click", function(){alert("Selecting No will delete all current review assignments and data regardless of other options selected")}, false);
} else if (ocaaakeepno.attachEvent) {
ocaaakeepno.attachEvent("onclick", function(){alert("Selecting No will delete all current review assignments and data regardless of other options selected")});
}
var ocaaaskipno = document.getElementById("skipaccepted2");
if (ocaaaskipno.addEventListener) {
ocaaaskipno.addEventListener("click", function(){alert("Selecting No will result in submissions already accepted or rejected by the Chair also being assigned")}, false);
} else if (ocaaaskipno.attachEvent) {
ocaaaskipno.attachEvent("onclick", function(){alert("Selecting No will result in submissions already accepted or rejected by the Chair also being assigned")});
}
</script>
';
printFooter();
ob_end_flush();
?>
@@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
function oc_algoTopicMatch ($rpp, $ppr, $ppa) {
global $pAR, $rAR, $nAR,
$pInfoAR, $continueVal, $onpc, $pcAR;
if (isset($GLOBALS['continueFrom']) && !empty($GLOBALS['continueFrom'])) {
global $continueFrom;
} else {
$continueFrom = 0;
}
if (oc_checkTimeout()) { // shutdown if close to timeout
oc_assignTimeoutShutdown();
}
$q = "SELECT `" . OCC_TABLE_PAPERTOPIC . "`.`paperid`, `" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid`, COUNT(*) AS `totmatch` FROM `" . OCC_TABLE_PAPERTOPIC . "`, `" . OCC_TABLE_REVIEWERTOPIC . "`, `" . OCC_TABLE_REVIEWER . "` WHERE `" . OCC_TABLE_PAPERTOPIC . "`.`topicid`=`" . OCC_TABLE_REVIEWERTOPIC . "`.`topicid` AND `" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` " . $onpc . " GROUP BY `paperid`, `reviewerid` ORDER BY `totmatch` DESC";
$r = ocsql_query($q) or err("Unable to retrieve reviewers");
while ($l=ocsql_fetch_array($r)) {
if ($continueFrom && ($continueFrom != ($l['paperid']."-".$l['reviewerid']))) { // skip to where processing stopped
continue;
} else { // reset continueFrom - excessive, need to clean up
$continueFrom = 0;
$continueVal = $l['paperid']."-".$l['reviewerid'];
}
// Skip submission (e.g., accepted subs)
if (oc_skipSubAssignment($l['paperid'])) {
continue;
}
if (!in_array($l['paperid']."-".$l['reviewerid'],$nAR) // reviewer not in conflict
&& (!in_array($l['reviewerid'],$pAR[$l['paperid']])) // reviewer not yet assigned to paper
&& (count($pAR[$l['paperid']]) < $rpp) // not enough reviewers yet
&& (count($rAR[$l['reviewerid']]) < (in_array($l['reviewerid'], $pcAR) ? $ppa : $ppr)) ) // not enough papers yet
{
array_push($pAR[$l['paperid']],$l['reviewerid']);
array_push($rAR[$l['reviewerid']],$l['paperid']);
}
}
}
oc_algoTopicMatch($reviewersPerPaper, $papersPerReviewer, $papersPerAdvocate);
@@ -0,0 +1,155 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
function oc_algoWeightedTopicMatch ($rpp, $ppr, $ppa, $sortorder) {
global $pAR, $rAR, $nAR,
$paperScoreAR, $paperTopicAR, $topicReviewerAR, $reviewerScoreAR,
$pInfoAR, $continueVal, $onpc, $pcAR;
$GLOBALS['continueAR'] = array('paperScoreAR', 'paperTopicAR', 'topicReviewerAR', 'reviewerScoreAR');
if (isset($GLOBALS['continueFrom']) && !empty($GLOBALS['continueFrom'])) {
global $continueFrom;
} else {
$continueFrom = 0;
$continueVal = 0;
$reviewerTopicAR = array();
$topPAR = array();
$topicScoreAR = array();
$topicReviewerAR = array();
$paperScoreAR = array();
$reviewerScoreAR = array();
$paperTopicAR = array();
// Get paper topics
$q = "SELECT `" . OCC_TABLE_PAPERTOPIC . "`.`paperid`, `" . OCC_TABLE_PAPERTOPIC . "`.`topicid` FROM `" . OCC_TABLE_PAPERTOPIC . "` ORDER BY `topicid`";
$r = ocsql_query($q) or err("Unable to get submission topics");
while ($l=ocsql_fetch_array($r)) {
// Add topic to paper
if (!isset($paperTopicAR[$l['paperid']])) {
$paperTopicAR[$l['paperid']] = array();
}
array_push($paperTopicAR[$l['paperid']],$l['topicid']);
$paperScoreAR[$l['paperid']] = 0;
// Increment paper-topic count
if (isset($topPAR[$l['topicid']])) {
$topPAR[$l['topicid']]++;
} else {
$topPAR[$l['topicid']] = 1;
}
}
// Get reviewer topics
$q = "SELECT `" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid`, `" . OCC_TABLE_REVIEWERTOPIC . "`.`topicid` FROM `" . OCC_TABLE_REVIEWER . "`, `" . OCC_TABLE_REVIEWERTOPIC . "` WHERE `" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` " . $onpc . " ORDER BY `topicid`";
$r = ocsql_query($q) or err("Unable to get reviewer topics");
while ($l=ocsql_fetch_array($r)) {
// Add topic to reviewer
if (!isset($reviewerTopicAR[$l['reviewerid']])) {
$reviewerTopicAR[$l['reviewerid']] = array();
}
array_push($reviewerTopicAR[$l['reviewerid']],$l['topicid']);
$reviewerScoreAR[$l['topicid']] = 0;
// Increment reviewer-topic count
if (!isset($topicReviewerAR[$l['topicid']])) {
$topicReviewerAR[$l['topicid']] = array();
}
array_push($topicReviewerAR[$l['topicid']],$l['reviewerid']);
}
// Get list of topics used
$topList = array_unique(array_merge(array_keys($topPAR), array_keys($topicReviewerAR)));
// Calculate topic score = #reviewers / #papers
foreach($topList as $t) {
if (isset($topPAR[$t]) && ($topPAR[$t] > 0) && isset($topicReviewerAR[$t]) && (count($topicReviewerAR[$t] > 0))) {
$topicScoreAR[$t] = count($topicReviewerAR[$t]) / $topPAR[$t];
}
else $topicScoreAR[$t] = 0;
}
// Calculate paper scores
foreach ($paperTopicAR as $paperid => $topiclist) {
$score = 0;
foreach ($topiclist as $topicid) {
$score += $topicScoreAR[$topicid];
}
$paperScoreAR[$paperid] = $score;
}
asort($paperScoreAR);
// Calculate reviewer scores
foreach ($reviewerTopicAR as $reviewerid => $topiclist) {
$score = 0;
foreach ($topiclist as $topicid) {
$score += $topicScoreAR[$topicid];
}
$reviewerScoreAR[$reviewerid] = $score;
}
asort($reviewerScoreAR);
}
// Iterate through papers (score low to high) assigning
// REVIEWERS in order of their score
foreach (array_keys($paperScoreAR) as $paperid) {
if ($continueFrom && ($paperid != $continueFrom)) { // skip to where processing stopped
continue;
}
else { // reset continueFrom - excessive, need to clean up
$continueFrom = 0;
$continueVal = $paperid;
}
if (oc_checkTimeout()) { // shutdown if close to timeout
oc_assignTimeoutShutdown();
}
// Skip submission (e.g., accepted subs)
if (oc_skipSubAssignment($paperid)) {
continue;
}
// Create a list of reviewers for paper incl. scores
$Rs = array();
if (isset($paperTopicAR[$paperid])) {
foreach($paperTopicAR[$paperid] as $topicid) {
if (isset($topicReviewerAR[$topicid])) { // may not have a reviewer for every topic
foreach ($topicReviewerAR[$topicid] as $reviewerid) {
if (!in_array($reviewerid,$pAR[$paperid]) // reviewer not yet assigned to paper
&& !in_array($paperid."-".$reviewerid,$nAR) // reviewer not in conflict
&& (count($rAR[$reviewerid]) < (in_array($reviewerid, $pcAR) ? $ppa : $ppr)) ) // not enough papers yet
{
$Rs[$reviewerid] = $reviewerScoreAR[$reviewerid];
}
}
}
}
}
// Assign reviewers based on reviewer scores (sortorder: 1=highest first; 2=lowest first)
if (count($Rs) > 0) {
if ($sortorder=="1") { arsort($Rs); }
else { asort($Rs); }
reset($Rs);
// assign reviewers while available & not enough
while ((count($Rs)>0) && (count($pAR[$paperid]) < $rpp)) {
$rid = key($Rs);
array_push($pAR[$paperid],$rid);
array_push($rAR[$rid],$paperid);
unset($Rs[$rid]);
#next($Rs);
}
}
}
}
oc_algoWeightedTopicMatch($reviewersPerPaper, $papersPerReviewer, $papersPerAdvocate, 1);
+333
View File
@@ -0,0 +1,333 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$hdr = 'Assign Reviews';
$hdrfn = 1;
require_once "../include.php";
beginChairSession();
// Get topics
$topicsAR = array();
$q = "SELECT * FROM `" . OCC_TABLE_TOPIC . "`";
$r = ocsql_query($q) or err("Unable to query topics", $hdr, $hdrfn);
while ($l = ocsql_fetch_assoc($r)) {
$topicsAR[$l['topicid']] = useTopic($l['short'], $l['topicname'], 1);
}
// Filter
$filterOptionsAR = array('Submissions', 'Reviewers');
$srfilter = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['srfilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['srfilter'] : ''); // submissions and/or reviewers
$topicfilter = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['topicfilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['topicfilter'] : ''); // topic
if (isset($_POST['fsubmit']) && ($_POST['fsubmit'] == 'Filter')) {
if (!isset($_POST['srfilter']) || empty($_POST['srfilter'])) {
$srfilter = '';
} elseif (in_array($_POST['srfilter'], $filterOptionsAR)) {
$srfilter = $_POST['srfilter'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['srfilter'] = $srfilter;
if (!isset($_POST['topicfilter']) || empty($_POST['topicfilter']) || !isset($topicsAR[$_POST['topicfilter']])) {
$topicfilter = '';
} else {
$topicfilter = $_POST['topicfilter'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['topicfilter'] = $topicfilter;
session_write_close();
} elseif (!isset($_GET['s']) && !isset($_POST['submit'])) { // reset filter if not coming from this page
unset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['srfilter']);
unset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['topicfilter']);
session_write_close();
$srfilter = '';
$topicfilter = '';
}
printHeader($hdr, $hdrfn);
if (isset($_POST['submit']) && ($_POST['submit'] == "Assign Reviews")) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// Check that we have at least one paper and reviewer
if (
!isset($_POST['papers']) || !is_array($_POST['papers']) || (count($_POST['papers']) == 0)
||
!isset($_POST['reviewers']) || !is_array($_POST['reviewers']) || (count($_POST['reviewers']) == 0)
) {
print '<span class="warn">Please go back and select at least one submission and one reviewer</span><p>';
} 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 "<p class=\"warn\">! Submission $j is in conflict with reviewer $i.</p>\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 "<p class=\"warn\">! Submission $j was already assigned reviewer $i.</p>\n";
} else {
print "<p class=\"err\">!! Error assigning submission $j to reviewer $i</p>\n";
}
} else {
print "<p>Submission $j assigned to reviewer $i.</p>\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 '<p><hr /></p>';
// Notify?
if ( isset($_POST['notify']) && ($_POST['notify'] == 1) && (count($reviewerAssignmentAR) > 0) ) {
// Get list of sub titles
$r = ocsql_query("SELECT `paperid`, `title` FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid` IN (" . implode(',',$submissionAssignmentAR) . ")") or err('Unable to retrieve submission titles for notification');
$submissionTitleAR = array();
while ($l = ocsql_fetch_assoc($r)) {
$submissionTitleAR[$l['paperid']] = $l['paperid'] . '. ' . $l['title'];
}
// Get reviewers to notify
$q = "SELECT `reviewerid`, `name_first`, `name_last`, CONCAT_WS(' ', `name_first`, `name_last`) AS `name`, `username`, `email` FROM `" . OCC_TABLE_REVIEWER . "` WHERE `reviewerid` IN (" . implode(',', array_keys($reviewerAssignmentAR)) . ")";
$r = ocsql_query($q) or err('Unable not get reviewer email address(es) for notification');
// Get notification template
// ocIgnore included so poEdit picks up (DB) template translation
$ocIgnoreSubject = oc_('New Reviewer Assignment(s)');
//T: [:OC_confName:] is the event name
$ocIgnoreBody = oc_('New assignments have been made for you to review in the [:OC_confName:] OpenConf system:
[:assignments:]
Thank you.');
list($subject, $message) = oc_getTemplate('chair-assign_reviews');
// Hook
if (oc_hookSet('chair-assign-review-notify')) {
foreach ($OC_hooksAR['chair-assign-review-notify'] as $f) {
require_once $f;
}
}
// Iterate through reviewers
while ($l = ocsql_fetch_assoc($r)) {
$templateExtraAR = $l;
$templateExtraAR['assignments'] = '';
foreach ($reviewerAssignmentAR[$l['reviewerid']] as $sid) {
$templateExtraAR['assignments'] .= $submissionTitleAR[$sid] . "\n\n";
}
$tmpsubject = oc_replaceVariables($subject, $templateExtraAR);
$tmpmessage = oc_replaceVariables($message, $templateExtraAR);
if (sendEmail($l['email'], $tmpsubject, $tmpmessage)) {
print '<p>Notification sent to ' . safeHTMLstr($l['name']) . ' (' . safeHTMLstr($l['reviewerid']) . ')</p>';
} else {
print '<p class="err">!! Unable to email notification to <a href="mailto:' . safeHTMLstr($l['email']) . '">' . safeHTMLstr($l['name']) . '</a> (' . safeHTMLstr($l['reviewerid']) . ')</p>';
}
}
print '<p><hr /></p>';
}
}
print '
<p>&#187; <a href="' . $_SERVER['PHP_SELF'] . '?s=' . varValue('s', $_GET) . '">Make additional assignments</a></p>
<p>&#187; <a href="list_reviews.php">View/Edit assignments</a></p>
<p>&#187; <a href="list_conflicts.php">Manage conflicts</a></p>
';
} else {
$pq = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`title`, count(`" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`) AS `pcount` FROM `" . OCC_TABLE_PAPER . "` LEFT JOIN `" . OCC_TABLE_PAPERREVIEWER . "` ON `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERREVIEWER . "`.`paperid` GROUP BY `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`title` ORDER BY `" . OCC_TABLE_PAPER . "`.`paperid`";
$pr = ocsql_query($pq) or err("Unable to get submissions");
// Get pad size for paper id's - yes, we really need the max id, but this should do:)
$rows = ocsql_num_rows($pr);
$psize = oc_strlen((string) $rows);
if ($rows == 0) {
print '<span class="warn">No submissions have been made yet</span><p>';
}
else {
if (!isset($_GET['s']) || empty($_GET['s']) || ($_GET['s'] == "id")) {
$idsortstr = 'ID';
$nsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=name">Name</a>';
$rsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=reviews" title="Number of Reviews">No. Reviews</a>';
$legend = "[ Reviewer ID - $nsortstr ($rsortstr) ]";
$sortby = "`" . OCC_TABLE_REVIEWER . "`.`reviewerid`";
} elseif ($_GET['s'] == "reviews") {
$rsortstr = 'No. Reviews';
$idsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=id">ID</a>';
$nsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=name">Name</a>';
$legend = "[ No. Reviews - Reviewer $nsortstr - $idsortstr ]";
$sortby = "`rcount`, `" . OCC_TABLE_REVIEWER . "`.`name_last`, `" . OCC_TABLE_REVIEWER . "`.`name_first`";
} else {
$idsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=id">ID</a>';
$nsortstr = 'Name';
$rsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=reviews" title="Number of Reviews">No. Reviews</a>';
$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 '<span class="warn">No reviewers have signed up yet</span><p>';
}
else {
// display filter?
$subSort = false;
$revSort = false;
$subFilterAR = array();
$revFilterAR = array();
if (count($topicsAR) > 1) {
print '
<div style="text-align: center; margin: 1.5em 0;">
<form method="post" action="' . $_SERVER['PHP_SELF'] . '?s=' . safeHTMLstr($_GET['s']) . '" title="filter by topic">
<select name="srfilter" title="what to filter"><option value="">Submissions and Reviewers</option>' . generateSelectOptions($filterOptionsAR, $srfilter, false) . '</select> &nbsp;<select name="topicfilter" title="topic to filter by"><option value="">All Topics</option>' . generateSelectOptions($topicsAR, $topicfilter, true) . '</select> &nbsp;<input type="submit" name="fsubmit" title="Filter" value="Filter" />
</form>
</div>
';
if (!empty($topicfilter)) {
if ($srfilter != 'Reviewers') {
$subSort = true;
$r = ocsql_query("SELECT `paperid` FROM `" . OCC_TABLE_PAPERTOPIC . "` WHERE `topicid`='" . safeSQLstr($topicfilter) . "'") or err('Unable to filter submissions by topic');
while ($l = ocsql_fetch_assoc($r)) {
$subFilterAR[] = $l['paperid'];
}
}
if ($srfilter != 'Submissions') {
$revSort = true;
$r = ocsql_query("SELECT `reviewerid` FROM `" . OCC_TABLE_REVIEWERTOPIC . "` WHERE `topicid`='" . safeSQLstr($topicfilter) . "'") or err('Unable to filter reviewers by topic');
while ($l = ocsql_fetch_assoc($r)) {
$revFilterAR[] = $l['reviewerid'];
}
}
}
}
// display assignment form
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<div style="float: left; margin-right: 50px;">
<p><strong>Select Submission(s):</strong></p>
<p>[ Submission ID - Title (No. Reviewers) ]</p>
<select multiple size="20" name="papers[]">
';
$count = 0;
while ($paper = ocsql_fetch_assoc($pr)) {
if ($subSort && !in_array($paper['paperid'], $subFilterAR)) { continue; }
$count++;
print '<option value="' . $paper['paperid'] . '">' . padNumber($paper['paperid'],$psize) . ' - ' . safeHTMLstr(shortenStr($paper['title'],80)) . " (" . $paper['pcount'] . ")</option>\n";
}
if ($count == 0) {
print '<option disabled>no topic match</option>';
}
print '
</select>
</div>
<div style="float: left;">
<p><strong>Select Reviewer(s):</strong></p>
<p>' . $legend . '</p>
<select multiple size="20" name="reviewers[]">
';
$count = 0;
while ($reviewer = ocsql_fetch_assoc($rr)) {
if ($revSort && !in_array($reviewer['reviewerid'], $revFilterAR)) { continue; }
$count++;
print '<option value="' . $reviewer['reviewerid'] . '">';
if (!isset($_GET['s']) || empty($_GET['s']) || ($_GET['s'] == "id")) {
print padNumber($reviewer['reviewerid'],$rsize) . ' - ';
if ($reviewer['onprogramcommittee'] == 'T') {
print "[PC] ";
}
print safeHTMLstr($reviewer['name']) . " (" . $reviewer['rcount'] . ")</option>\n";
} elseif ($_GET['s'] == "reviews") {
print padNumber($reviewer['rcount'],2) . ' - ';
if ($reviewer['onprogramcommittee'] == 'T') {
print "[PC] ";
}
print safeHTMLstr($reviewer['name']) . " - " . $reviewer['reviewerid'];
} else {
if ($reviewer['onprogramcommittee'] == 'T') {
print "[PC] ";
}
print safeHTMLstr($reviewer['name']) . " - " . $reviewer['reviewerid'] . " (" . $reviewer['rcount'] . ")</option>\n";
}
}
if ($count == 0) {
print '<option disabled>no topic match</option>';
}
print '
</select>
<p class="note">Tip: Click the ID, Name, or Reviews links above<br />to re-sort this list (page will reload)</p>
</div>
<br style="clear: left;" />
<strong>Options:</strong><br />
';
if ($OC_configAR['OC_allowConflictOverride']) {
print '
<p><input type="checkbox" name="conflict_override" value="1" /> <strong><em>Override Conflicts</em></strong> &#8211; check box to force assignments even if there is a conflict</p>
';
}
print '
<p><label><input type="checkbox" name="notify" value="1"> <strong><em>Notify Reviewer(s)</em></strong></label> &#8211; check box to notify reviewer(s) that new assignments have been made</p>
<br />
<p><input type="submit" name="submit" class="submit" value="Assign Reviews" /></p>
</form>
';
}
}
}
printFooter();
?>
+84
View File
@@ -0,0 +1,84 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Clear Advocate Data",1);
// get acceptance types
$accTypesAR = array('All Submissions');
$r = ocsql_query("SELECT `accepted`, COUNT(`accepted`) AS `count`, SUM(ISNULL(`accepted`)) AS `pending` FROM `" . OCC_TABLE_PAPER . "` GROUP BY `accepted` ORDER BY `accepted`") or err('Unable to query acceptance types');
while ($l = ocsql_fetch_assoc($r)) {
if ($l['accepted'] == '') {
$accTypesAR[] = 'Pending';
} else {
$accTypesAR[] = $l['accepted'];
}
}
if (isset($_POST['submit']) && ($_POST['submit'] == 'Clear Advocate Recommendations')) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// Clear out recommendations
$fields = "`adv_recommendation`=NULL";
if (!isset($_POST['comments']) || ($_POST['comments'] != 1)) {
$fields .= ", `adv_comments`=NULL";
}
if ($_POST['type'] == 'All Submissions') {
issueSQL("UPDATE `" . OCC_TABLE_PAPERADVOCATE . "` SET " . $fields);
} else {
if ($_POST['type'] == 'Pending') {
$acceptedValue = ' IS NULL';
} elseif (in_array($_POST['type'], $accTypesAR)) {
$acceptedValue = "='" . safeSQLstr($_POST['type']) . "'";
} else {
warn('Invalid acceptance type');
}
issueSQL("UPDATE `" . OCC_TABLE_PAPERADVOCATE . "` `pa` INNER JOIN `" . OCC_TABLE_PAPER . "` `p` ON `pa`.`paperid`=`p`.`paperid` SET `pa`." . preg_replace("/, `/", ", `pa`.`", $fields) . " WHERE `p`.`accepted`" . $acceptedValue);
}
$count = ocsql_affected_rows();
// Hook
if (oc_hookSet('chair-clear-advocate')) {
foreach ($OC_hooksAR['chair-clear-advocate'] as $f) {
require_once $f;
}
}
print '<p style="text-align: center;" class="note">';
if ($count > 0) {
print safeHTMLstr($count) . ' advocate recommendation records have been cleared';
} else {
print 'No advocate recommendations found to be cleared';
}
print '</p>';
}
print '
<form method="post" action="clear_advocate_data.php">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p>Clicking the button below will clear out advocate recommendation data while maintaining advocate assignments. Only click the button if you intend on having advocates start the recommendation process anew.</p>
<p style="text-align: center"><select name="type">' . generateSelectOptions($accTypesAR, '', false) . '</select></p>
<p style="text-align: Center"><input type="submit" name="submit" class="submit" value="Clear Advocate Recommendations" /></p>
<p style="text-align: Center"><label title="check box to keep advocate comments"><input type="checkbox" name="comments" value="1" /> keep comments</label></p>
</form>
';
printFooter();
?>
+103
View File
@@ -0,0 +1,103 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Clear Review Data",1);
// get acceptance types
$accTypesAR = array('All Submissions');
$r = ocsql_query("SELECT `accepted`, COUNT(`accepted`) AS `count`, SUM(ISNULL(`accepted`)) AS `pending` FROM `" . OCC_TABLE_PAPER . "` GROUP BY `accepted` ORDER BY `accepted`") or err('Unable to query acceptance types');
while ($l = ocsql_fetch_assoc($r)) {
if ($l['accepted'] == '') {
$accTypesAR[] = 'Pending';
} else {
$accTypesAR[] = $l['accepted'];
}
}
// submit
if (isset($_POST['submit']) && ($_POST['submit'] == 'Clear Review Data')) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
//// Clear out reviews
// field list to be cleared
$fields = "`completed`='F', `updated`=NULL, `score`=NULL, `recommendation`=NULL, `category`=NULL, `value`=NULL, `familiar`=NULL, `bpcandidate`=NULL, `length`=NULL, `difference`=NULL";
if (!isset($_POST['authorcomments']) || ($_POST['authorcomments'] != 1)) {
$fields .= ", `authorcomments`=NULL";
}
if (!isset($_POST['committeecomments']) || ($_POST['committeecomments'] != 1)) {
$fields .= ", `pccomments`=NULL";
}
// include custom fields
$r = ocsql_query("SHOW COLUMNS FROM `" . OCC_TABLE_PAPERREVIEWER . "` WHERE LEFT(`field`, 3) = 'cf_'") or err('Unable to delete custom fields (1)');
if (ocsql_num_rows($r) >= 1) {
while ($l = ocsql_fetch_assoc($r)) {
$fields .= ", `" . $l['Field'] . "`=NULL";
}
}
// clear out
if ($_POST['type'] == 'All Submissions') {
issueSQL("TRUNCATE `" . OCC_TABLE_PAPERSESSION . "`");
issueSQL("UPDATE `" . OCC_TABLE_PAPERREVIEWER . "` SET " . $fields);
} else {
if ($_POST['type'] == 'Pending') {
$acceptedValue = ' IS NULL';
} elseif (in_array($_POST['type'], $accTypesAR)) {
$acceptedValue = "='" . safeSQLstr($_POST['type']) . "'";
} else {
warn('Invalid acceptance type');
}
issueSQL("DELETE FROM `" . OCC_TABLE_PAPERSESSION . "` WHERE `" . OCC_TABLE_PAPERSESSION . "`.`paperid` IN (SELECT `" . OCC_TABLE_PAPER . "`.`paperid` FROM `" . OCC_TABLE_PAPER . "` WHERE `" . OCC_TABLE_PAPER . "`.`accepted`" . $acceptedValue . ")");
issueSQL("UPDATE `" . OCC_TABLE_PAPERREVIEWER . "` `pr` INNER JOIN `" . OCC_TABLE_PAPER . "` `p` ON `pr`.`paperid`=`p`.`paperid` SET `pr`." . preg_replace("/, `/", ", `pr`.`", $fields) . " WHERE `p`.`accepted`" . $acceptedValue);
}
$count = ocsql_affected_rows();
// Hook
if (oc_hookSet('chair-clear-review')) {
foreach ($OC_hooksAR['chair-clear-review'] as $f) {
require_once $f;
}
}
// confirm
print '<p style="text-align: center;" class="note">';
if ($count > 0) {
print safeHTMLstr($count) . ' review records have been cleared';
} else {
print 'No reviews found to be cleared';
}
print '</p>';
}
print '
<form method="post" action="clear_review_data.php">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p>Clicking the button below will clear out data for all built-in and custom review form fields while maintaining review assignments. Only click the button if you intend on having reviewers start the review process anew. Backing up the database and exporting reviews is recommended prior to clearing review data.</p>
<p style="text-align: center"><select name="type">' . generateSelectOptions($accTypesAR, '', false) . '</select></p>
<p style="text-align: center"><input type="submit" name="submit" class="submit" value="Clear Review Data" onclick="return confirm(\'Confirm deletion of review data for submissions with selected acceptance type. Once cleared, data cannot be recovered.\')" /></p>
<p style="text-align: Center"><i>keep comments to</i> <label title="check box to keep reviewer comments to author"><input type="checkbox" name="authorcomments" value="1" /> author</label> <label title="check box to keep reviewer comments to committee"><input type="checkbox" name="committeecomments" value="1" /> committee</label></p>
</form>
';
printFooter();
?>
+100
View File
@@ -0,0 +1,100 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader('Create Submission', 1);
$err = '';
if (isset($_POST['submit']) && ($_POST['submit'] == 'Create Submission')) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// Validate fields
if (!isset($_POST['title']) || !preg_match("/\p{L}/u", $_POST['title'])) {
$err .= '<li>Title must be entered</li>';
}
if (!isset($_POST['name_last']) || !preg_match("/\p{L}/u", $_POST['name_last'])) {
$err .= '<li>Last Name must be entered</li>';
}
if (!isset($_POST['email']) || !validEmail($_POST['email'])) {
$err .= '<li>Email is not valid</li>';
}
if (!isset($_POST['password1']) || !isset($_POST['password2']) || empty($_POST['password1'])) {
$err .= '<li>' . oc_('Password must be entered twice') . '</li>';
} elseif ($_POST['password1'] != $_POST['password2']) {
$err .= '<li>' . oc_('Passwords entered do not match') . '</li>';
}
if (empty($err)) {
$q = "INSERT INTO `" . OCC_TABLE_PAPER . "` SET " .
"`title`='" . safeSQLstr($_POST['title']) . "', " .
"`password`='" . safeSQLstr(oc_password_hash($_POST['password1'])) . "', " .
"`contactid`=1, " .
"`altcontact`=' '," .
"`submissiondate`='" . safeSQLstr(date('Y-m-d')) . "'";
$r = ocsql_query($q) or err('Unable to create submission record.');
$pid = ocsql_insert_id() or err('unable to get submission ID');
$q = "INSERT INTO `" . OCC_TABLE_AUTHOR . "` SET " .
"`paperid`='" . safeSQLstr($pid) . "', " .
"`position`=1, " .
"`name_first`='" . safeSQLstr(varValue('name_first', $_POST)) . "', " .
"`name_last`='" . safeSQLstr($_POST['name_last']) . "', " .
"`email`='" . safeSQLstr($_POST['email']) . "'";
if ($r = ocsql_query($q)) {
if (preg_match("/^(.*)\/chair\/create_sub\.php/", $_SERVER['PHP_SELF'], $match)) {
$url = 'http' . ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) ? 's' : '') . '://' . safeHTMLstr($_SERVER['SERVER_NAME']) . (ctype_digit($_SERVER['SERVER_PORT']) && (($_SERVER['SERVER_PORT'] != '80')) ? (':' . $_SERVER['SERVER_PORT']) : '') . $match[1] . '/author/edit.php';
} elseif (!empty($OC_configAR['OC_confURL'])) {
$url = $OC_configAR['OC_confURL'];
} else {
$url = '';
}
$subject = urlencode($OC_configAR['OC_confName']) . ' Submission Information';
$body = 'A submission entry to ' . $OC_configAR['OC_confName'] . ' has been created for you. Please use the following information to edit your submission' . (empty($url) ? '' : (' at ' . $url)) . '.
Submission ID: ' . $pid . '
Password: ' . $_POST['password1'];
print '<p>Submission ID ' . $pid . ' successfully created.</p><p><a href="mailto:' . rawurlencode($_POST['email']) . '?subject=' . rawurlencode($subject) . '&body=' . rawurlencode($body) . '">Notify ' . safeHTMLstr(oc_strtolower(OCC_WORD_AUTHOR)) . '</a></p>';
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 '<p class="err">Please correct the following items. Note that the password fields must be re-entered.<ul>' . $err . '</ul></p><hr />';
}
print '
<p>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.</p>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" class="ocform">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<fieldset>
<div class="field"><label for="title">Submission Title:</label><input name="title" id="title" size="60" maxlength="1000" value="' . varValue('title', $_POST, '', true) . '" /></div>
<div class="field"><label for="name_first">Contact First Name:</label><input name="name_first" id="name_first" size="60" maxlength="60" value="' . varValue('name_first', $_POST, '', true) . '" /></div>
<div class="field"><label for="name_last">Contact Last Name:</label><input name="name_last" id="name_last" size="60" maxlength="40" value="' . varValue('name_last', $_POST, '', true) . '" /></div>
<div class="field"><label for="email">Contact Email:</label><input name="email" id="email" size="60" maxlength="100" value="' . varValue('email', $_POST, '', true) . '" /></div>
<div class="field"><label for="password1">Submission Password:</label><input name="password1" id="password1" type="password" size="60" value="" /></div><div class="field"><label for="password2">Re-enter Password:</label><input name="password2" id="password2" type="password" size="60" value="" /></div>
</fieldset>
<p><input type="submit" name="submit" value="Create Submission" class="submit" /></p>
</form>
';
printFooter();
?>
+137
View File
@@ -0,0 +1,137 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
// Module pre hook
if (oc_hookSet('db-backup-pre')) {
foreach ($OC_hooksAR['db-backup-pre'] as $f) {
require_once $f;
}
}
function backuperr($e) {
err($e,'Database Backup',1);
}
function quoteit($s) {
return("`$s`");
}
$tableAR=getTables();
$sqldump = '# OpenConf SQL Backup
# version ' . $GLOBALS['OC_configAR']['OC_version'] . '
# https://www.OpenConf.com
#
# Host: ' . OCC_DB_HOST . '
# Generated: ' . date('Y-m-d H:i:s') . '
# Server version: ' . mysqli_get_server_info($GLOBALS['OC_db']) . '
# PHP version: ' . phpversion() . '
#
# Database: ' . OCC_DB_NAME . '
#
';
foreach ($tableAR as $table) {
$sqldump .= '
#
# Delete table ' . quoteit($table) . '
#
DROP TABLE IF EXISTS ' . quoteit($table) . ';
#
# Table structure for ' . quoteit($table) . '
#
';
$q = 'SHOW CREATE TABLE ' . quoteit($table);
$r = ocsql_query($q) or backuperr("Unable to query table structure for $table");
if (mysqli_num_rows($r) > 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;
?>
+72
View File
@@ -0,0 +1,72 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Database Reset",1);
// Module pre hook
if (oc_hookSet('db-reset-pre')) {
foreach ($OC_hooksAR['db-reset-pre'] as $f) {
require_once $f;
}
}
$tableAR=getTables();
// Tables that should not be emptied
$dontEmptyTablesAR = array(OCC_TABLE_ACCEPTANCE, OCC_TABLE_CONFIG, OCC_TABLE_STATUS, OCC_TABLE_TEMPLATE, OCC_TABLE_TOPIC);
if (oc_hookSet('db-reset-dontempty')) {
foreach ($OC_hooksAR['db-reset-dontempty'] as $t) {
$dontEmptyTablesAR[] = $t;
}
}
if (isset($_POST['submit'])) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
if ($_POST['submit'] == "Confirm Request") {
foreach ($tableAR as $table) {
if (isset($_POST['table_'.$table]) && ($_POST['table_'.$table] == 1)) {
issueSQL("TRUNCATE $table");
}
}
print '<p class="note" style="text-align: center">Selected tables have been emptied</p>';
} elseif ($_POST['submit'] == "Empty Tables") {
print '<p><strong>Please confirm that you want to empty (truncate) the tables:</strong></p><form method="post" action="' . $_SERVER['PHP_SELF'] . '"><input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" /><ul>';
foreach ($tableAR as $table) {
if (isset($_POST['table_'.$table]) && ($_POST['table_'.$table] == 1)) {
print '<li>' . $table . '<input type="hidden" name="table_' . $table . '" value="1" /></li>';
}
}
print '</ul><br /><input type="submit" name="submit" class="submit" value="Confirm Request" /></form><br />';
} else {
err("Unknown submit option");
}
} else {
print '<p class="note">NOTE: Once emptied, the data in the tables cannot be recovered. Make a <a href="db_backup.php">backup</a>, and use caution when deciding which <a href="https://www.openconf.com/documentation/tables.php" target="_blank" title="description of tables will open in new window">tables</a> to empty.</p><p><strong>Select tables to empty:</strong></p><form method="post" action="' . $_SERVER['PHP_SELF'] . '"><input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />';
foreach ($tableAR as $table) {
print '<label><input type="checkbox" name="table_' . $table . '" value="1" ';
if (!in_array($table,$dontEmptyTablesAR)) { print ' checked'; }
print ' /> ' . $table . '</label><br />';
}
print '<br /><input type="submit" name="submit" value="Empty Tables" class="submit" /></form><br />';
}
printFooter();
?>
+41
View File
@@ -0,0 +1,41 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
$hdr = 'Download';
$hdrfn = 1;
beginChairSession();
$dir = $OC_configAR['OC_paperDir'];
$formatDBFldName = 'format';
$zipFilePrefix = 'c';
$urlBase = OCC_BASE_URL . 'chair/download.php?';
$savePath = '1/';
// Update dir/formatfld?
if (oc_hookSet('download-setup')) {
call_user_func($GLOBALS['OC_hooksAR']['download-setup'][0], $_GET['t']);
}
if (isset($_GET['acc']) && ($_GET['acc']==1)) { // accpted only?
$urlBase .= 'acc=1&';
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`" . $formatDBFldName . "` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_ACCEPTANCE . "` WHERE `". OCC_TABLE_PAPER . "`.`accepted`=`" . OCC_TABLE_ACCEPTANCE . "`.`value` AND `" . OCC_TABLE_ACCEPTANCE . "`.`accepted`=1 AND `" . OCC_TABLE_PAPER . "`.`" . $formatDBFldName . "` IS NOT NULL AND `" . OCC_TABLE_PAPER . "`.`" . $formatDBFldName . "`!='' ORDER BY `paperid`";
} else {
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`" . $formatDBFldName . "` FROM `" . OCC_TABLE_PAPER . "` WHERE `" . OCC_TABLE_PAPER . "`.`" . $formatDBFldName . "` IS NOT NULL AND `" . OCC_TABLE_PAPER . "`.`" . $formatDBFldName . "`!='' ORDER BY `paperid`";
}
require_once '../include-download.inc';
exit;
?>
+99
View File
@@ -0,0 +1,99 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once OCC_FORM_INC_FILE;
require_once OCC_REVIEW_INC_FILE;
$authorcomments = array();
$reviewfields = array();
$advocatecomment = array();
$advocatename = array();
$advocateemail = array();
$chairnotes = array();
// get acceptance type
if (preg_match("/^authors\_(\d+)$/", $_POST['recipient'], $matches) && isset($OC_acceptanceValuesAR[$matches[1]])) {
$accval = $OC_acceptanceValuesAR[$matches[1]]['value'];
$accSQL = "`" . OCC_TABLE_PAPER . "`.`accepted`='" . safeSQLstr($accval) . "'";
} else {
$accSQL = '';
}
// get review fields to display
$displayFieldAR = array();
foreach ($OC_reviewQuestionsAR as $fid => $far) {
if (isset($far['showauthor']) && $far['showauthor']) {
$displayFieldAR[] = $fid;
}
}
// get review fields and reviewer comments
$tempq = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPERREVIEWER . "`.* FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_PAPERREVIEWER . "` WHERE " . (!empty($accSQL) ? ($accSQL . " AND ") : '') . "`" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`";
$tempr = ocsql_query($tempq) or err("Unable to get " . oc_strtolower(OCC_WORD_AUTHOR) . " comments");
while ($templ = ocsql_fetch_array($tempr)) {
// init vars for paperid
if (!isset($authorcomments[$templ['paperid']])) {
$authorcomments[$templ['paperid']] = "";
}
if (!isset($reviewfields[$templ['paperid']])) {
$reviewfields[$templ['paperid']] = "";
}
// set author comments
if (!empty($templ['authorcomments'])) {
$authorcomments[$templ['paperid']] .= $commentSeparator . "\n" . $templ['authorcomments'] . "\n";
}
// set review fields
$reviewInfo = '';
foreach ($displayFieldAR as $fid) {
if (!empty($templ[$fid])) {
$reviewInfo .= oc_strtoupper(oc_($OC_reviewQuestionsAR[$fid]['short'])) . ': ' . oc_getFieldValue($OC_reviewQuestionsAR, $templ, $fid) ."\n\n";
}
}
if (!empty($reviewInfo)) {
$reviewfields[$templ['paperid']] .= $commentSeparator . "\n" . $reviewInfo . "\n";
}
}
// get advocate and comments
$tempq = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_REVIEWER . "`.`name_first`, `" . OCC_TABLE_REVIEWER . "`.`name_last`, `" . OCC_TABLE_REVIEWER . "`.`email`, `" . OCC_TABLE_PAPERADVOCATE . "`.`adv_comments` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_PAPERADVOCATE . "`, `" . OCC_TABLE_REVIEWER . "` WHERE " . (!empty($accSQL) ? ($accSQL . " AND ") : '') . "`" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERADVOCATE . "`.`paperid` AND `" . OCC_TABLE_REVIEWER . "`.`reviewerid`=`" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`";
$tempr = ocsql_query($tempq) or err("Unable to get advocate comments");
while ($templ = ocsql_fetch_array($tempr)) {
if ($OC_configAR['OC_paperAdvocates'] && !empty($templ['email'])) {
$advocatename[$templ['paperid']] = $templ['name_first'] . ' ' . $templ['name_last'];
$advocateemail[$templ['paperid']] = $templ['email'];
}
if (!empty($templ['adv_comments'])) {
$advocatecomment[$templ['paperid']] = "\n" . $templ['adv_comments'] . "\n";
}
}
// get chair comments
$tempq = "SELECT `paperid`, `pcnotes` FROM `" . OCC_TABLE_PAPER . "`" . (!empty($accSQL) ? ( " WHERE " . $accSQL) : '');
$tempr = ocsql_query($tempq) or err("Unable to get chair comments");
while ($templ = ocsql_fetch_array($tempr)) {
if (!empty($templ['pcnotes'])) {
$chairnotes[$templ['paperid']] = "\n" . $templ['pcnotes'] . "\n";
}
}
$specialIndexAR['authorcomments'] = 'paperid';
$specialIndexAR['reviewfields'] = 'paperid';
$specialIndexAR['advocatecomment'] = 'paperid';
$specialIndexAR['advocatename'] = 'paperid';
$specialIndexAR['advocateemail'] = 'paperid';
$specialIndexAR['chairnotes'] = 'paperid';
// Check for addt'l (hook) special variables
if (oc_hookSet('chair-email-authors')) {
foreach ($OC_hooksAR['chair-email-authors'] as $f) {
require_once $f;
}
}
+109
View File
@@ -0,0 +1,109 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Email Queue Log", 1);
if (isset($_POST['submit']) && ($_POST['submit'] == "Resend Failed Messages")) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// Check for valid qid
if (!isset($_POST['lid']) || !ctype_digit($_POST['lid'])) {
warn('email log entry selection invalid');
}
// Retrieve failed submissions, retry mailing them, and update their sent date
$baseq = "UPDATE `" . OCC_TABLE_EMAIL_QUEUE . "` SET `sent`='" . safeSQLstr(gmdate('Y-m-d H:i:s')) . "' WHERE `id`=";
$q = "SELECT `" . OCC_TABLE_EMAIL_QUEUE . "`.* FROM `" . OCC_TABLE_EMAIL_QUEUE . "`, `" . OCC_TABLE_LOG . "` WHERE `" . OCC_TABLE_LOG . "`.`logid`='" . safeSQLstr($_POST['lid']) . "' AND `" . OCC_TABLE_LOG . "`.`datetime`=`" . OCC_TABLE_EMAIL_QUEUE . "`.`queued` AND `" . OCC_TABLE_EMAIL_QUEUE . "`.`sent` IS NULL ORDER BY `id`";
$r = ocsql_query($q) or err('Unable to retrieve failed messages');
while ($l = ocsql_fetch_assoc($r)) {
if (oc_mail($l['to'], $l['subject'], $l['body'])) {
issueSQL($baseq . $l['id'] . " LIMIT 1");
}
}
$_GET['lid'] = $_POST['lid'];
}
print '<p style="text-align: center"><a href="log.php?type=email">show email log entries</a></p>';
if (isset($_GET['qid']) && ctype_digit($_GET['qid'])) {
$q = "SELECT * FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE `id`='" . safeSQLstr($_GET['qid']) . "'";
$r = ocsql_query($q) or err('Unable to retrieve message');
if (ocsql_num_rows($r) == 1) {
$l = ocsql_fetch_assoc($r);
print '
<strong>Message ID:</strong> ' . safeHTMLstr($l['id']) . '<br />
';
if (!empty($l['reference_id'])) {
print '<strong>Reference ID:</strong> ' . safeHTMLstr($l['reference_id']) . '<br />';
}
print '
<strong>Queued:</strong> ' . safeHTMLstr($l['queued']) . (!empty($_GET['lid']) ? ' &nbsp; (<a href="' . $_SERVER['PHP_SELF'] . '?lid=' . safeHTMLstr($_GET['lid']) . '">view messages queued at same time</a>)' : '') . '<br />
<strong>Sent:</strong> ';
if (!empty($l['sent'])) {
print safeHTMLstr($l['sent']);
} else {
print '<span class="warn" style="font-style: italic">Failed to send</span>';
}
print ' &nbsp; (<a href="email-resend.php?qid=' . urlencode($l['id']) . '">re-send message</a>)<br /><br />
<strong>To:</strong> ' . safeHTMLstr($l['to']) . '<br />
<strong>Subject:</strong> ' . safeHTMLstr($l['subject']) . '<br />
<pre>' . safeHTMLstr($l['body']) . '</pre>
';
} 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 '<table border="0" cellspacing="1" cellpadding="5"><tr class="rowheader"><th>ID</th><th>Sent</th><th><span title="Reference ID (e.g., submission, committee member)">Ref ID</span></th><th>To</th><th>Subject</th></tr>';
$row = 1;
$failed = 0;
while ($l = ocsql_fetch_assoc($r)) {
print '<tr class="row' . $row . '"><td><a href="' . $_SERVER['PHP_SELF'] . '?lid=' . safeHTMLstr($_GET['lid']) . '&qid=' . $l['id'] . '">' . safeHTMLstr($l['id']) . '</a></td><td style="white-space: nowrap;">';
if (!empty($l['sent'])) {
print safeHTMLstr($l['sent']);
} else {
print '<span class="warn" style="font-style: italic">Failed to send</span>';
$failed++;
}
print '</td><td>' . safeHTMLstr($l['reference_id']) . '</td><td>' . safeHTMLstr($l['to']) . '</td><td>' . safeHTMLstr($l['subject']) . "</td></tr>\n";
if ($row == 1) {
$row = 2;
} else {
$row = 1;
}
}
print '</table><p class="note">Log entries are shown in Coordinated Universal Time (UTC)</span></p>';
if ($failed > 0) {
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="lid" value="' . safeHTMLstr($_GET['lid']) . '" />
<input type="submit" name="submit" value="Resend Failed Messages" />
</form>';
}
} else {
warn('No messages found');
}
} else {
warn('Invalid ID');
}
printFooter();
?>
+38
View File
@@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Re-Send Message", 1);
if (isset($_GET['qid']) && ctype_digit($_GET['qid'])) {
$q = "SELECT * FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE `id`='" . safeSQLstr($_GET['qid']) . "'";
$r = ocsql_query($q) or err('Unable to retrieve message');
if (ocsql_num_rows($r) == 1) {
$l = ocsql_fetch_assoc($r);
if (oc_mail($l['to'], $l['subject'], $l['body'])) {
print '
<p>Message ID ' . safeHTMLstr($_GET['qid']) . ' successfully sent.</p>
<p class="note">Note: Re-sent messages will not be displayed in the log/queue.</p>
';
} else {
warn('Unable to send message ID ' . safeHTMLstr($_GET['qid']));
}
}
} else {
warn('Invalid ID');
}
printFooter();
?>
+200
View File
@@ -0,0 +1,200 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once OCC_SUBMISSION_INC_FILE;
function saveTemplate($subject, $body, $templateid) {
$q = "UPDATE `" . OCC_TABLE_TEMPLATE . "` SET `subject`='" . safeSQLstr($subject) . "', `body`='" . safeSQLstr($body) . "', `updated`='" . safeSQLstr(date('Y-m-d')) . "' WHERE `templateid`='" . safeSQLstr($templateid) . "'";
ocsql_query($q) or err('Unable to save template');
}
// Variables for use in emails
// - limit keys to [\w-], and values to [\w -]
$OC_emailVarAR['general'] = array(
'OC_pcemail' => 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);
+489
View File
@@ -0,0 +1,489 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
if (isset($_POST['submit'])) {
$OC_displayTop = '<a href="' . $_SERVER['PHP_SELF'] . '">New Email</a> &#187; ';
}
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 '<p class="warn">No email addresses available for ' . safeHTMLstr($recipient) . '</p>';
} else {
print '<p><strong>Email addresses for ' . safeHTMLstr($recipient) . ':</strong></p>';
while ($l = ocsql_fetch_array($r)){
print safeHTMLstr($l['email']) . "<br />\n";
}
}
}
function specialValue($a1, $a2) {
global $specialIndexAR, $l;
$varName = $a1 . $a2;
if (!empty($varName) && isset($specialIndexAR[$varName]) && isset($l[$specialIndexAR[$varName]]) && isset($GLOBALS[$varName][$l[$specialIndexAR[$varName]]])) {
return($GLOBALS[$varName][$l[$specialIndexAR[$varName]]]);
} else {
return('');
}
}
function queueMessage(&$queueAR, $date) {
$q = "INSERT INTO `" . OCC_TABLE_EMAIL_QUEUE . "` (`queued`, `to`, `subject`, `body`, `reference_id`) VALUES " . implode(', ', $queueAR);
if ( ! ocsql_query($q)) {
$err = 'Unable to queue messages (' . ocsql_errno() . '). You may want to try again or have the administrator check the error logs. ';
if (ocsql_query("DELETE FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE `datetime`='" . $date . "'")) {
$err .= 'Messages just queued for delivered have been deleted';
} else {
$err .= 'We were unable to remove messages queued for delivery; for reference, their time stamp is ' . $date . '.';
}
err($err);
}
}
if (isset($_POST['submit'])) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// Verify recipient
if (!isset($_POST['recipient']) || !isset($recipients[$_POST['recipient']])) {
warn("Recipient(s) must be selected");
}
// Verify template
if (!empty($_POST['template']) && !in_array($_POST['template'], array_keys($templateAR))) {
err("Invalid template");
}
// Which message should we use?
if (isset($_POST['message'])) {
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);
// YMMV wrt below
$message = preg_replace("/\r/","",$message);
// Save template?
if (!empty($_POST['template']) && isset($_POST['save']) && ($_POST['save'] == "yes")) {
saveTemplate($subject, $message, $_POST['template']);
}
} elseif (!empty($_POST['template'])) {
// retrieve template
list($subject, $message) = oc_getTemplate($_POST['template']);
} else {
$message = '';
$subject = '';
}
// Which submit?
// List Email addresses
if ($_POST['submit'] == "List Email Addresses") {
showAddresses($recipientAR[$_POST['recipient']]['text'], $recipientAR[$_POST['recipient']]['sql']);
}
// Send Email
elseif ($_POST['submit'] == "Send Message") {
$q = $recipientAR[$_POST['recipient']]['sql'];
// Individual recipients?
$recipientList = array();
if (isset($_POST['select_recipients']) && ($_POST['select_recipients'] == 1)) {
if (! isset($_POST['selected_recipients']) || empty($_POST['selected_recipients'])) {
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="recipient" value="' . safeHTMLstr($_POST['recipient']) . '" />
<input type="hidden" name="template" value="' . safeHTMLstr($_POST['template']) . '" />
<input type="hidden" name="subject" value="' . safeHTMLstr($subject) . '" />
<input type="hidden" name="message" value="' . safeHTMLstr($message) . '" />
<input type="hidden" name="select_recipients" value="1" />
<input type="submit" name="submit" value="Edit Message" class="submit" />
</form>
';
warn('No recipients selected');
}
$selectRecipients = true;
$qrecipientsAR = array();
foreach ($_POST['selected_recipients'] as $recip) {
list($id, $email) = explode('/', $recip);
if (!preg_match("/^\d+$/", $id) || !validEmail($email)) { continue; }
$recipientList[] = $email;
$qrecipientsAR[] = "'" . safeSQLstr($recip) . "'";
}
$q = preg_replace("/ WHERE /", " WHERE CONCAT_WS('/', " . $recipientAR[$_POST['recipient']]['id'] . ", " . (isset($recipientAR[$_POST['recipient']]['emailcol']) ? $recipientAR[$_POST['recipient']]['emailcol'] : "`email`") . ") IN (" . implode(',', $qrecipientsAR) . ") AND ", $q);
} else {
$selectRecipients = false;
}
$r = ocsql_query($q) or err("Unable to retrieve information to email");
$recipientTotal = ocsql_num_rows($r);
if ($recipientTotal == 0) {
err("No email addresses found (on send)");
} elseif ($selectRecipients && ( ! $OC_configAR['OC_emailAuthorRecipients'] ) && ($recipientTotal != count($_POST['selected_recipients']))) {
// This may mean that the recipientAR SELECT statement does not contain a WHERE clause, resulting the preg_replace above failing
warn("Recipient mismatch - contact your OpenConf administrator");
}
// Special var handling
if (isset($recipientAR[$_POST['recipient']]['special']) && is_file($recipientAR[$_POST['recipient']]['special'])) {
require_once $recipientAR[$_POST['recipient']]['special'];
}
// Log it
$date = safeSQLstr(gmdate('Y-m-d H:i:s')); // set fixed time for log & so messages in queue are grouped together
$logq = "INSERT INTO `" . OCC_TABLE_LOG . "` SET `datetime`='" . $date . "', `type`='email', `entry`='Email sent to ";
if ($selectRecipients) {
$logq .= safeSQLstr($extra = implode(", ", $recipientList));
} else {
$logq .= safeSQLstr($extra = $recipientAR[$_POST['recipient']]['text']);
}
$extra .= "\nSubject: " . $subject . "\n\n" . $message;
$logq .= "', `extra`='To: " . safeSQLstr($extra) . "'";
ocsql_query($logq);
// Send out emails
$to = $tmpmessage = $tmpsubject = '';
$queueAR = array();
$queue_date = gmdate('Y-m-d H:i:s');
if ($OC_configAR['OC_queueEmails']) { // queue messages?
$queueMessages = true;
print '<p>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.</p>';
} 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 "queued<br />\n";
if (count($queueAR) >= 10) { // store messages as a group to save on DB calls
queueMessage($queueAR, $date);
$queueAR = array(); // reset queue array
}
} elseif (oc_mail($l['email'], $tmpsubject, $tmpmessage)) { // deliver instantly
print "sent<br />\n";
} else {
print "<span class=\"err\">FAILED!!!</span><br />\n";
}
}
ob_end_flush();
flush();
// Any remaining messages for queue storage?
if ($queueMessages && (count($queueAR) > 0)) {
queueMessage($queueAR, $date);
}
// Email chair a copy of last email sent
if ($OC_configAR['OC_mailCopyLast']) {
$msg = "To: " . $to . "\nSubject: " . $tmpsubject . "\n\n" . $tmpmessage . "\n";
if (sendEmail($OC_configAR['OC_confirmmail'], 'Copy of last email sent', $msg)) {
print '<p>A copy of the last message ' . ($queueMessages ? 'queued' : 'sent') . ' has been forwarded to ' . $OC_configAR['OC_confirmmail'] . '.</p>';
} else {
print '<p class="err">The system was unable to forward a copy of the last message ' . ($queueMessages ? 'queued' : 'sent') . ' to ' . $OC_configAR['OC_confirmmail'] . '.</p>';
}
}
// attempt javascript redirect
if ($queueMessages) {
print '
<script language="javascript">
<!--
function gotoEmailQueue() {
window.location.replace("' . preg_replace('/email.php/', 'email_process_queue.php', $_SERVER['PHP_SELF']) . '");
}
setTimeout("gotoEmailQueue()", 5000);
// -->
</script>
<p style="font-weight: bold">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 <a href="email_process_queue.php" style="text-decoration: underline;">this link</a> to send them out now, or visit the ' . OCC_WORD_CHAIR . ' home page to send them out later.</p>
';
}
}
// 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 '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="recipient" value="' . safeHTMLstr($_POST['recipient']) . '" />
<input type="hidden" name="template" value="' . safeHTMLstr($_POST['template']) . '" />
<input type="hidden" name="subject" value="' . safeHTMLstr($subject) . '" />
<input type="hidden" name="message" value="' . safeHTMLstr($message) . '" />
';
if (isset($_POST['select_recipients']) && ($_POST['select_recipients'] == 1)) {
print '<input type="hidden" name="select_recipients" value="1" />';
if (isset($_POST['selected_recipients'])) {
foreach ($_POST['selected_recipients'] as $selected_recipient) {
print '<input type="hidden" name="selected_recipients[]" value="' . safeHTMLstr($selected_recipient) . '" />';
}
}
}
print '
<input type="submit" name="submit" value="Edit Message" class="submit" />
&nbsp; &nbsp; &nbsp;
<input type="submit" name="submit" value="Send Message" class="submit" />
</form>
<pre>
';
$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 '<strong>To:</strong> ';
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 "<i>(The following is a list of selected recipients. The preview is shown for only one of them.)</i>";
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 '<strong>Subject:</strong> ' . safeHTMLstr($tmpsubject) . "\n\n";
print safeHTMLstr(wordwrap($tmpmessage, $OC_configAR['OC_emailWrap'])) . "\n</pre>\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 '<p class="warn">No email addresses available for ' . safeHTMLstr($recipientAR[$_POST['recipient']]['text']) . '</p>';
} else {
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="recipient" value="' . safeHTMLstr($_POST['recipient']) . '" />
<input type="hidden" name="template" value="' . safeHTMLstr($_POST['template']) . '" />
<table border="0" cellspacing="10" cellpadding="0">
<tr><th style="text-align: left; vertical-align: top;"><label for="selected_recipients" style="font-weight: bold;">To:</label></th><td>';
if (isset($_POST['select_recipients']) && ($_POST['select_recipients'] == 1)) {
print '<input type="hidden" name="select_recipients" value="1" /><select name="selected_recipients[]" id="selected_recipients" size="10" multiple>';
if (! isset($_POST['selected_recipients'])) {
$_POST['selected_recipients'] = array();
}
$idField = substr($recipientAR[$_POST['recipient']]['id'], (strrpos($recipientAR[$_POST['recipient']]['id'], '`', -2)+1), -1);
while ($l = ocsql_fetch_assoc($r)) {
if (empty($l['email'])) { continue; }
if (isset($l['name'])) {
$name = $l['name'];
} elseif (isset($l['name_last'])) {
$name = $l['name_first'] . ' ' . $l['name_last'];
}
$idValue = $l[$idField] . '/' . $l['email'];
print '<option value="' . safeHTMLstr($idValue) . '"' . (in_array($idValue, $_POST['selected_recipients']) ? ' selected' : '') . '>[ID: ' . safeHTMLstr($l[$idField] . '] ' . $l['email'] . ' (' . $name) . ')</option>';
}
print '</select>';
} else {
print safeHTMLstr($recipientAR[$_POST['recipient']]['text']);
}
print '</td><td>&nbsp;</td></tr>
<tr><th style="text-align: left"><label for="subject">Subject:</label></th><td><input name="subject" id="subject" size="60" value="' . safeHTMLstr($subject) . '"></td><td>&nbsp;</td></tr>
<tr><th style="text-align: left" colspan="3"><label for="message">Message:</label></th></tr>
<tr>
<td colspan="2" valign="top"><textarea name="message" id="message" rows="25" cols="60">' . safeHTMLstr($message) . '</textarea></td>
<td valign="top" aria-describedby="variablesNote"><strong>[:<em>variables</em>:]</strong><br /><br /><table border="0" cellspacing="0" cellpadding="3">';
foreach ($OC_emailVarAR['general'] as $vkey => $vval) {
print '<tr><td valign="top" style="white-space: nowrap;">[:' . safeHTMLstr($vkey) . ':]</td><th style="font-style: italic; font-weight: normal; text-align: left;">' . safeHTMLstr($vval) . '</th></tr>';
}
foreach ($recipientAR[$_POST['recipient']]['vars'] as $vkey => $vval) {
print '<tr><td valign="top" style="white-space: nowrap;">[:' . safeHTMLstr($vkey) . ':]</td><th style="font-style: italic; font-weight: normal; text-align: left;">' . safeHTMLstr($vval) . '</th></tr>';
}
print '</table></td></tr>';
// Save template?
if (!empty($_POST['template'])) {
print '<tr><td colspan=3><br /><label><input type="checkbox" name="save" value="yes"> Save changes to template <i>' . safeHTMLstr($templateAR[$_POST['template']]) . '</i></label></td></tr>';
}
print '
<tr><td colspan=3><label><input type="checkbox" name="skipsame" value="yes"> Send at most one message per email address<br /> &nbsp; &nbsp; &nbsp; <i>Only check this option when message content is known to repeat for a recipient</i> </label></td></tr><tr><td colspan=3>
<br /><br />
<input type="submit" name="submit" value="Preview Message" class="submit" />
&nbsp; &nbsp; &nbsp;
<input type="submit" name="submit" value="Send Message" class="submit" />
</td></tr>
</table>
</form>
<p class="note" id="variablesNote">The variables appearing next to the message field may be used in your email by enclosing each instance in [:<em>variable</em>:] . 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.</p>
';
} // if Any emails
} // end submit write
} // end submit
// Not a submit - select recipient/template
else {
print '
<script language="javascript">
<!--
function selectTemplate(tmpl) {
if (document.getElementById) {
if (document.getElementById(tmpl)) {
document.getElementById(tmpl).selected = true;
} else {
document.getElementById("blank").selected = true;
}
}
}
// -->
</script>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<dl>
<dt><p><label for="recipient" style="font-weight: bold;">Select the recipient group you would like to email:</label></dt></p>
<dd><p><select name="recipient" id="recipient" onChange="selectTemplate(this.options[this.selectedIndex].value)"><option></option>
';
foreach ($recipients as $r => $rval) {
print '<option value="' . $r . '"';
if ($rval == 'blank') {
print ' disabled="disabled" style="font-style: italic; fot-weight: bold;"';
}
print '>' . safeHTMLstr($rval) . "</option>\n";
}
print '
</select></p>
<p style="padding-left: 50px"><label><input type="checkbox" name="select_recipients" value="1" /> Select individual recipients</label></p>
</dd>
<dd class="note">For "' . OCC_WORD_AUTHOR . 's -", ' . (($OC_configAR['OC_emailAuthorRecipients'] == 0) ? ('only the contact ' . oc_strtolower(OCC_WORD_AUTHOR)) : ('all ' . oc_strtolower(OCC_WORD_AUTHOR) . 's')) . ' of a submission will be emailed</dd>
<dt><p><label for="template" style="font-weight: bold;">Select an email template to use:</label> <span style="font-size: 0.8em;">(<a href="email_templates.php" title="edit templates">edit</a>)</span></dt></p>
<dd><p><select name="template" id="template">
<option value="" id="blank">Blank Email</option>
';
foreach ($templateAR as $k => $v) {
print '<option value="' . $k . '" id="' . $k . '">' . safeHTMLstr($v) . "</option>\n";
}
print '
</select></p></dd>
<dt>
<br />
<input type="submit" name="submit" value="Write Email Online" class="submit" />
&nbsp; &nbsp; &nbsp;
<input type="submit" name="submit" value="List Email Addresses" class="submit" />
</dt>
</dl>
</form>
';
} // else not a submit
printFooter();
?>
+87
View File
@@ -0,0 +1,87 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
$OC_displayTop = '<a href="email.php">New Email</a> &#187; ';
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 '<p>The queue is empty. <a href="log.php?type=email">View email log</a>.</p>';
} 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 '<p>' . ((isset($_GET['pass']) && ($_GET['pass'] == 1)) ? 'Remaining m' : 'M') . 'essages in queue: ' . $count . "</p>\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 '<span class="err">FAILED!!!';
if ($l['tries'] == 2) { // this will have been the third try
print ' Too many tries, will not try again.';
}
print '</span>';
$failed++;
}
print "<br />\n";
$q = "UPDATE `" . OCC_TABLE_EMAIL_QUEUE . "` SET " . $set . " WHERE `id`=" . (int) $l['id'] . " LIMIT 1";
if ( ! ocsql_query($q)) { // throw error so same message doesn't keep being sent
ob_flush_end();
err('Unable to update status for message ID ' . $l['id'] . '. Troubleshoot before trying again.');
}
// reload script if close to timeout
if (oc_checkTimeout()) {
print '
<script language="javascript" type="text/javascript">
<!--
window.location.replace("http' . ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) ? 's' : '') . '://' . safeHTMLstr($_SERVER['SERVER_NAME']) . (ctype_digit($_SERVER['SERVER_PORT']) && (($_SERVER['SERVER_PORT'] != '80')) ? (':' . $_SERVER['SERVER_PORT']) : '') . $_SERVER['PHP_SELF'] . '?pass=1&f=' . $failed . '");
// -->
</script>
<noscript>
<p style="font-weight: bold"><a href="' . $_SERVER['PHP_SELF'] . '">Click here</a> to continue processing messages.</p>
</noscript>
';
}
}
if ($failed == 0) {
print '<p>All messages have been sent.</p>';
} else {
print '<p style="warn">' . $failed . ' messages failed to be sent.</p>';
}
print '<p><a href="log.php?type=email">View email log</a> (most recent batch of messages will appear at the top)</p>';
}
ob_end_flush();
printFooter();
?>
+161
View File
@@ -0,0 +1,161 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
$OC_displayTop = '<a href="email.php">New Email</a> &#187; ';
printHeader('Email Templates', 1);
require_once 'email.inc';
clearstatcache();
function oc_templateForm($tid, $name, $subject, $body) {
print '
<p style="text-align: center;"><a href="' . $_SERVER['PHP_SELF'] . '">all templates</a></p>
<br />
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="templateid" value="' . safeHTMLstr($tid) . '" />
<table cellpadding="0" cellspacing="10">
<tr><td valign="top"><b>Template<br />Name:</b></td><td><input name="templatename" size="50" maxlength="50" value="' . safeHTMLstr($name) . '" /><br /><span class="note">letters, numbers, hyphen, underscore, and space</span><br />&nbsp;</td></tr>
<tr><td><b>Subject:</b></td><td><input name="subject" size="70" maxlength="70" value="' . safeHTMLstr($subject) . '" /></td></tr>
<tr><td><b>Message:</b></td><td>&nbsp;</td></tr>
<tr><td colspan="3">
<textarea name="body" rows="20" cols="70">' . safeHTMLstr($body) . '</textarea><br />
<p class="note">Variables available for use in a message are based on the recipient group selected when sending<br />
the message. <a href="email_variables.php?l=all" target="emailvars" title="opens in new window" onclick="' . "window.open('email_variables.php','emailvars','top=200,width=500,height=400,scrollbars=yes')" . '; return false;">View a list of groups and variables</a>.</p>
</td></tr>
<tr><td colspan="3"><input type="submit" name="ocaction" value="Save Template" class="submit" /></td></tr>
</table>
</form>
';
printFooter();
exit;
}
$name = ''; // new template name
if (isset($_GET['ocaction']) && ($_GET['ocaction'] == 'edit') && isset($_GET['tid']) && isset($templateAR[$_GET['tid']])) {
$r = ocsql_query("SELECT `name`, `subject`, `body` FROM `" . OCC_TABLE_TEMPLATE . "` WHERE `type`='email' 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['name'], $l['subject'], $l['body']);
} else {
print '<p class="warn" style="text-align: center;">Template not found</p>';
}
} 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 '<p class="warn" style="text-align: center;">Template name must not be blank, and only contain<br />letters, numbers, hyphen, underscore, and space</p>';
} elseif ( in_array($name, $templateAR) ) {
print '<p class="warn" style="text-align: center;">A template with that name already exists</p>';
} 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 '<p class="warn" style="text-align: center;">Unable to add template; perhaps you double-clicked? Check below.</p>';
} else {
print '<p class="note2" style="text-align: center;">Template added</p>';
$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 '<p class="note2" style="text-align: center;">Deleted ' . $count . ' template' . (($count!=1) ? 's' : '') . '</p>';
}
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 '<p class="note2" style="text-align: center;">Template saved</p>';
} else {
print '<p class="warn" style="text-align: center;">' . $err . '</p>';
}
oc_templateForm($templateid, $templatename, $subject, $body);
break;
default:
warn('Request unknown');
exit;
}
}
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<p style="margin: 1.5em 0; text-align: center;"><input name="name" size="20" value="' . safeHTMLstr($name) . '" placeholder="template name" title="Permitted: letters, numbers, hyphen, underscore, space" /> <input type="submit" name="ocaction" value="Add Template" /></p>
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<table border="0" cellspacing="1" cellpadding="4" style="margin: 0 auto;">
<tr class="rowheader"><th class="del">&nbsp;</th><th>Template<span style="font-weight: normal;"> - click name to edit</span></th></tr>
';
$row = 2;
$custom = 0;
foreach ($templateAR as $templateID => $templateName) {
print '<tr class="row' . $row . '"><td class="del">';
if (preg_match("/^custom/", $templateID)) {
print '<input type="checkbox" id="' . safeHTMLstr($templateID) . '" name="templates[]" value="' . safeHTMLstr($templateID) . '" />';
$custom++;
} else {
print '&nbsp;';
}
print '</td><td><label for="' . safeHTMLstr($templateID) . '"><a href="' . $_SERVER['PHP_SELF'] . '?ocaction=edit&tid=' . safeHTMLstr($templateID) . '">' . safeHTMLstr($templateName) . '</a></label></td></tr>';
$row = $rowAR[$row];
}
if ($custom > 0) {
print '<tr><td colspan="2" style="padding: 0;"><table border=0 cellpadding=5 cellspacing=0 bgcolor="#ccccff"><tr><td><input type="submit" name="ocaction" value="Delete Templates" onclick="return confirm(\'Confirm template deletion\');" /></td></tr></table></td></tr>';
}
print '
</table>
</form>
';
printFooter();
?>
+41
View File
@@ -0,0 +1,41 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
printHeader("Email Username", 3);
if (! $OC_configAR['OC_chairUsernameForgot']) {
print '<p class="err" style="text-align: center">Functionality disabled</p>';
}
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 '<p class="note2" style="text-align: center">The ' . OCC_WORD_CHAIR . ' username has been emailed to the ' . OCC_WORD_CHAIR . '\'s address</p><p style="text-align: center"><a href="signin.php">Proceed to sign in</a></p>';
} else {
err('Unable to send email');
}
} else {
print '
<p class="note2" style="text-align: center">Click the button below to email the username to the ' . OCC_WORD_CHAIR . '\'s address</p>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<p style="text-align: center"><input type="submit" name="submit" class="submit" value="Email Username"></p>
</form>
';
}
printFooter();
?>
+79
View File
@@ -0,0 +1,79 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
require_once 'email.inc';
print '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Email Variables</title>
</head>
<body>
<style type="text/css">
body { font-family: arial, verdana, sans-serif; font-size: 9pt; }
table { margin-left: 20px; }
td { font-family: arial, verdana, sans-serif; font-size: 9pt; }
td:first-child { padding-right: 20px; white-space: nowrap; vertical-align: top; }
</style>
<script language="Javascript" type="application/javascript">
var varsAR = Array();
';
$varsAR = array();
foreach ($recipients as $rName => $rID) {
$table = '<table>';
foreach ($recipientAR[$rName]['vars'] as $varID => $var) {
$table .= '<tr><td>[:' . safeHTMLstr($varID) . ':]</td><td>' . safeHTMLstr($var) . '</td></tr>';
}
$table .= '</table>';
$varsAR[$rName] = array('text' => $recipientAR[$rName]['text'], 'table' => $table);
print 'varsAR["' . safeHTMLstr($rName) . '"] = "<p><b>' . safeHTMLstr($recipientAR[$rName]['text']) . '</b></p>' . $table . '";' . "\n";
}
print '
function updateVars(group) {
document.getElementById("varDiv").innerHTML = varsAR[group];
}
</script>
';
if (isset($_GET['l']) && ($_GET['l'] == 'all')) {
foreach ($varsAR as $rAR) {
print '<p><b>' . safeHTMLstr($rAR['text']) . '</b></p>' . $rAR['table'];
}
} else {
print '<form><select id="group" onchange="updateVars(this.value)">';
$first = current($varsAR);
foreach ($varsAR as $varID => $varAR) {
print '<option value="' . safeHTMLstr($varID) . '">' . safeHTMLstr($varAR['text']) . '</option>';
}
print '</select></form><div id="varDiv" aria-live="polite"><p><b>' . safeHTMLstr($first['text']) . '</b></p>' . $first['table'] . '</div>';
}
print '<p><b>General</b></p><table>';
foreach ($OC_emailVarAR['general'] as $varID => $var) {
print '<tr><td>[:' . safeHTMLstr($varID) . ':]</td><td>' . safeHTMLstr($var) . '</td></tr>';
}
print '
</table>
</body>
</html>
';
?>
+313
View File
@@ -0,0 +1,313 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$OC_exportCharLimit = 32767; // max number of characters to include in a XLS(X)/CSV/TXT cell - optional based on user checkbox selection
$OC_exportFormatAR = array(
'csv' => array('name'=>'CSV', 'mime'=>'text/plain'),
'xls' => array('name'=>'Microsoft Excel 2000', 'mime'=>'application/vnd.ms-excel'),
'xlsx' => array('name'=>'Microsoft Excel 2007', 'mime'=>'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'),
'txt' => array('name'=>'Text (tab-delimited)', 'mime'=>'text/plain'),
'xml' => array('name'=>'XML', 'mime'=>'application/xml')
);
function oc_export_headers($filename, $format) {
oc_sendNoCacheHeaders();
header('Content-Type: ' . $GLOBALS['OC_exportFormatAR'][$format]['mime']);
header('Content-Disposition: attachment; filename="' . $filename . '"');
}
function oc_export_err($e) {
if (isset($GLOBALS['hdr'])) {
$hdr = $GLOBALS['hdr'];
} else {
$hdr = 'Export Error';
}
if (isset($GLOBALS['hdrfn'])) {
$hdrfn = $GLOBALS['hdrfn'];
} else {
$hdrfn = 1;
}
err($e, $hdr, $hdrfn);
}
function oc_colID($cols) { // converts a column number to its alpha representation (e.g., 0=A, 25=Z, 26=AA)
for ($r=""; $cols>=0; ($cols = intval($cols/26)-1)) {
$r = chr($cols%26 + 0x41) . $r;
}
return $r;
}
function oc_export(&$scope, &$exportFieldsAR, &$fieldNameAR, &$dbR, &$extraAR=array(), &$fieldAR=array()) {
if (isset($_POST['format']) && isset($GLOBALS['OC_exportFormatAR'][$_POST['format']])) {
$format = $_POST['format'];
} else {
$format = 'csv';
}
// set filename
$fileName = 'openconf';
if (preg_match("/^\w+$/", $GLOBALS['OC_configAR']['OC_confName'])) {
$fileName .= '-' . $GLOBALS['OC_configAR']['OC_confName'];
}
$fileName .= '-' . oc_strtolower($scope) . '-' . date('YmdHi') . '.' . $format;
// field limit?
if (isset($_POST['charlimit']) && ($_POST['charlimit'] == 1)) {
$useCharLimit = $GLOBALS['OC_exportCharLimit'];
} else {
$useCharLimit = 0;
}
// export file
switch ($format) {
case 'xlsx': // *****************************************************************
$rows = ocsql_num_rows($dbR) + 1; // +1 = header
$cols = count($exportFieldsAR);
$celltotal = $rows * $cols;
if (!class_exists('ZipArchive')) {
oc_export_err('ZipArchive library missing');
}
$tempZip = tempnam('/tmp/', 'ocexport') or oc_export_err('could not generate Excel file (1)');
copy(OCC_LIB_DIR . 'xlsx-template.zip', $tempZip) or oc_export_err('could not generate Excel file (2)');
$zip = new ZipArchive;
if (($res = $zip->open($tempZip)) && ($res === true)) {
// Create/add sheet1.xml
$sheetFile = tempnam('/tmp/', 'ocexport') or oc_export_err('could not generate Excel file (3)');
$fp = fopen($sheetFile, 'w') or oc_export_err('could not generate Excel file (4)');
fputs($fp, '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><dimension ref="A1:' . oc_colID($cols) . $rows . '"/><sheetViews><sheetView tabSelected="1" workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/><sheetData>');
$v = 0;
for ($row=1; $row<=$rows; $row++) {
fputs($fp, '<row r="' . $row . '" spans="1:' . $cols . '" ' . (($row==1) ? 'customFormat="1" ' : '') . 'x14ac:dyDescent="0.25">');
for ($col=0; $col<$cols; $col++) {
fputs($fp, '<c r="' . oc_colID($col) . $row . '" ' . (($row==1) ? 's="1" ' : '') . 't="s"><v>' . $v++ . '</v></c>');
}
fputs($fp, '</row>');
}
fputs($fp, '</sheetData><pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/></worksheet>');
fclose($fp);
if (($res = $zip->addFile($sheetFile, 'xl/worksheets/sheet1.xml')) && ($res === false)) {
$zip->close();
unlink($sheetFile);
unlink($tempZip);
oc_export_err('could not generate Excel file (5)');
}
// create/add shareStrings.xml
$sharedStringsFile = tempnam('/tmp/', 'ocexport') or oc_export_err('could not generate Excel file (6)');
$fp = fopen($sharedStringsFile, 'w') or oc_export_err('could not generate Excel file (7)');
fputs($fp, '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="' . $celltotal . '" uniqueCount="' . $celltotal . '">');
foreach ($exportFieldsAR as $f) { // header
fputs($fp, '<si><t>' . htmlspecialchars(isset($fieldNameAR[$f]) ? $fieldNameAR[$f] : ucwords(preg_replace("/_/", " ", trim($f, "_")))) . '</t></si>');
}
while ($l = ocsql_fetch_array($dbR)) { // data
foreach ($exportFieldsAR as $f) {
if (preg_match("/^_/", $f)) {
if (isset($extraAR[$l['id']][$f])) {
$val = $extraAR[$l['id']][$f];
} else {
$val ='';
}
} else {
$val = oc_getFieldValue($fieldAR, $l, $f, '', $useCharLimit, false);
}
fputs($fp, '<si><t>' . htmlspecialchars($val) . '</t></si>');
}
}
fputs($fp, '</sst>');
fclose($fp);
if (($res = $zip->addFile($sharedStringsFile, 'xl/sharedStrings.xml')) && ($res === false)) {
$zip->close();
unlink($sheetFile);
unlink($sharedStringsFile);
unlink($tempZip);
oc_export_err('could not generate Excel file (8)');
}
// create/add core.xml
$coreFile = tempnam('/tmp/', 'ocexport') or die('could not generate Excel file (6)');
$fp = fopen($coreFile, 'w') or oc_export_err('could not generate Excel file (9)');
fputs($fp, '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:creator>OpenConf</dc:creator><dcterms:created xsi:type="dcterms:W3CDTF">' . date("Y-m-d\TH:i:s.00\Z") . '</dcterms:created></cp:coreProperties>');
fclose($fp);
if (($res = $zip->addFile($coreFile, 'docProps/core.xml')) && ($res === false)) {
$zip->close();
unlink($sheetFile);
unlink($sharedStringsFile);
unlink($coreFile);
unlink($tempZip);
oc_export_err('could not generate Excel file (10)');
}
$zip->close();
unlink($sheetFile);
unlink($sharedStringsFile);
unlink($coreFile);
oc_export_headers($fileName, $format);
readfile($tempZip);
unlink($tempZip);
} else {
oc_export_err('could not generate Excel file (0)');
}
break;
case 'xls': // *****************************************************************
oc_export_headers($fileName, $format);
print '<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=utf-8" />
<style id="Classeur1_16681_Styles">
</style>
</head>
<body>
<div id="Classeur1_16681" align=center x:publishsource="Excel">
<table x:str border=0 cellpadding=0 cellspacing=0 width=100% style="border-collapse: collapse">
';
// Title Row
print '<tr>';
foreach ($exportFieldsAR as $f) {
print '<td class=xl2216681 nowrap><strong>' . htmlspecialchars(isset($fieldNameAR[$f]) ? $fieldNameAR[$f] : ucwords(preg_replace("/_/", " ", trim($f, "_")))) . '</strong></td>';
}
print '</tr>';
// Iterate through records
while ($l = ocsql_fetch_array($dbR)) {
print '<tr>';
foreach ($exportFieldsAR as $f) {
if (preg_match("/^_/", $f)) {
if (isset($extraAR[$l['id']][$f])) {
$val = $extraAR[$l['id']][$f];
} else {
$val ='';
}
} else {
$val = oc_getFieldValue($fieldAR, $l, $f, '', $useCharLimit, false);
}
print '<td class=xl2216681 nowrap>' . htmlspecialchars($val) . '</td>';
}
print '</tr>';
}
print '
</table>
</div>
</body>
</html>
';
break;
case 'xml': // *****************************************************************
oc_export_headers($fileName, $format);
print '<?xml version="1.0" encoding="utf-8" ?>
<!--
-
- OpenConf Export: ' . $scope . '
-
- Version: ' . $GLOBALS['OC_configAR']['OC_version'] . '
- Created: ' . date('Y-m-d H:i:s') . '
-
-->
<openconf>
';
// Iterate through records
while ($l = ocsql_fetch_array($dbR)) {
print " <entry>\n";
foreach ($exportFieldsAR as $f) {
$tag = (isset($fieldNameAR[$f]) ? $fieldNameAR[$f] : ucwords(preg_replace("/_/", " ", trim($f, "_"))));
$tag = preg_replace("/[^\w]/", "", $tag);
if (preg_match("/^_/", $f)) {
if (isset($extraAR[$l['id']][$f])) {
$val = $extraAR[$l['id']][$f];
} else {
$val ='';
}
} else {
$val = oc_getFieldValue($fieldAR, $l, $f, '', $useCharLimit, false);
}
if ($val == '') {
print " <$tag />\n";
} else {
print " <$tag>" . htmlspecialchars($val) . "</$tag>\n";
}
}
print " </entry>\n";
}
print '</openconf>';
break;
default: // *****************************************************************
oc_export_headers($fileName, $format);
if ($format == 'txt') {
$delim = "\t";
} else {
$delim = ',';
}
// Title Row
$titlerow = '';
foreach ($exportFieldsAR as $f) {
$titlerow .= '"' . str_replace("\"", "\"\"", (isset($fieldNameAR[$f]) ? $fieldNameAR[$f] : preg_replace("/_/", " ", trim($f, "_")))) . '"' . $delim;
}
print oc_strtoupper(rtrim($titlerow, $delim)) . "\r\n";
// Iterate through records
while ($l = ocsql_fetch_array($dbR)) {
$row = '';
// Add non-author/extra fields to row
foreach ($exportFieldsAR as $f) {
if (preg_match("/^_/", $f)) {
$row .= '"' . (isset($extraAR[$l['id']][$f]) ? str_replace("\"", "\"\"", $extraAR[$l['id']][$f]) : '') . '"' . $delim;
} else {
$row .= '"' . str_replace("\"", "\"\"", oc_getFieldValue($fieldAR, $l, $f, '', $useCharLimit, false)) . '"' . $delim;
}
}
$row = preg_replace("/\015(\012)?/", "\012", $row);
print rtrim($row, $delim) . "\015\012";
}
break;
}
// exit so not additional code is executed
exit;
} // oc_export f'n
+293
View File
@@ -0,0 +1,293 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$OC_translate = false; // do not translate
$hdr = 'Export Submissions';
$hdrfn = 1;
require_once "../include.php";
beginChairSession();
require_once 'export.inc';
// accepted or all papers?
if (isset($_REQUEST['acc']) && preg_match("/\d+/", $_REQUEST['acc']) && isset($OC_acceptanceValuesAR[$_REQUEST['acc']])) {
$accSQL = "AND `" . OCC_TABLE_PAPER . "`.`accepted`='" . safeSQLstr($OC_acceptanceValuesAR[$_REQUEST['acc']]['value']) . "'";
$accURL = 'acc=' . $_REQUEST['acc'];
$scope = 'submissions-' . safeHTMLstr(oc_strtolower(preg_replace("/[^\w]/", "_", $OC_acceptanceValuesAR[$_REQUEST['acc']]['value'])));
}
else {
$accSQL = '';
$accURL = '';
$scope = 'submissions-all';
}
// check that matching submissions exist
$r = ocsql_query("SELECT COUNT(*) AS `count` FROM `" . OCC_TABLE_PAPER . "` WHERE 1=1 " . $accSQL);
$l = ocsql_fetch_assoc($r);
if ($l['count'] == 0) {
warn('There are no submissions to export', $hdr, $hdrfn);
exit;
}
require_once OCC_FORM_INC_FILE;
require_once OCC_SUBMISSION_INC_FILE;
$skip = 1; // skip field id
$fieldAR = array(
'paperid' => 'Submission ID',
'submissiondate' => 'Submission Date',
'lastupdate' => 'Last Updated',
'accepted' => 'Acceptance',
'_score' => 'Score',
);
$authorFieldsAR = array();
foreach ($OC_submissionFieldSetAR as $fsKey => $fsAR) {
if (count($fsAR['fields']) == 0) { continue; }
if ($fsKey == 'fs_authors') {
$fieldAR['skip' . $skip++] = '';
$fieldAR['name'] = 'Contact ' . OCC_WORD_AUTHOR . ' Full Name';
$authorFieldsAR['author_name'] = 'All ' . OCC_WORD_AUTHOR . 's Full Name';
foreach ($fsAR['fields'] AS $fieldID) {
$fieldAR[$fieldID] = 'Contact ' . OCC_WORD_AUTHOR . ' ' . (empty($OC_submissionFieldAR[$fieldID]['short']) ? $OC_submissionFieldAR[$fieldID]['name'] : $OC_submissionFieldAR[$fieldID]['short']);
$authorFieldsAR['author_' . $fieldID] = 'All ' . OCC_WORD_AUTHOR . 's ' . (empty($OC_submissionFieldAR[$fieldID]['short']) ? $OC_submissionFieldAR[$fieldID]['name'] : $OC_submissionFieldAR[$fieldID]['short']);
}
$fieldAR['skip' . $skip++] = '';
} else {
foreach ($fsAR['fields'] AS $fieldID) {
if (preg_match("/^password/i", $fieldID) || ($fieldID == 'file') || ($fieldID == 'topics') || empty($OC_submissionFieldAR[$fieldID]['name'])) { continue; }
$fieldAR[$fieldID] = (empty($OC_submissionFieldAR[$fieldID]['short']) ? $OC_submissionFieldAR[$fieldID]['name'] : $OC_submissionFieldAR[$fieldID]['short']);
}
}
}
if (isset($OC_submissionFieldAR['topics']['short'])) {
$fieldAR['_topics'] = $OC_submissionFieldAR['topics']['short'];
}
$fieldAR['skip' . $skip++] = '';
$fieldAR = array_merge($fieldAR, $authorFieldsAR);
$fieldAR['skip' . $skip++] = '';
// Default list of checked fields
$checkedFieldAR = array('paperid','title','name','email');
// Advocate/Committee fields
if ($OC_configAR['OC_paperAdvocates']) {
$fieldAR['skip' . $skip++] = '';
$fieldAR['_advocateid'] = 'Advocate ID';
$fieldAR['_advocate'] = 'Advocate';
$fieldAR['_adv_recommendation'] = 'Advocate Recommendation';
$fieldAR['_adv_comments'] = 'Advocate (Committee) Notes';
$fieldAR['pcnotes'] = OCC_WORD_CHAIR . ' Notes';
$fieldAR['skip' . $skip++] = '';
} else {
$fieldAR['skip' . $skip++] = '';
$fieldAR['pcnotes'] = OCC_WORD_CHAIR . ' Notes';
$fieldAR['skip' . $skip++] = '';
}
// Include extra fields
if (oc_hookSet('chair-export-fields')) {
foreach ($OC_hooksAR['chair-export-fields'] as $v) {
require_once $v;
}
}
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', $hdr, $hdrfn);
}
}
// Init extra field AR
$extraAR = array();
// List of fields to export
$exportFieldsAR = $_POST['fields'];
// All author data to display
$incAuthorFieldsAR = array_intersect($_POST['fields'], array_keys($authorFieldsAR));
if (!empty($incAuthorFieldsAR)) {
$maxPosition = 1; // tracks max number of authors per submission
// Get all authors info
$q = "SELECT `" . OCC_TABLE_AUTHOR . "`.*, CONCAT_WS(' ', `" . OCC_TABLE_AUTHOR . "`.`name_first`, `" . OCC_TABLE_AUTHOR . "`.`name_last`) AS `name` FROM `" . OCC_TABLE_AUTHOR . "`, `" . OCC_TABLE_PAPER . "` WHERE `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` " . $accSQL . " ORDER BY `paperid`, `position`";
$r = ocsql_query($q) or err("Unable to retrieve data for export (1)", $hdr, $hdrfn);
while ($l = ocsql_fetch_assoc($r)) {
foreach ($authorFieldsAR as $afKey => $afVal) {
if (preg_match("/^author_(\w+)$/", $afKey, $matches)) {
if (isset($OC_submissionFieldAR[$matches[1]]['values']) && is_array($OC_submissionFieldAR[$matches[1]]['values'])
&& isset($OC_submissionFieldAR[$matches[1]]['usekey']) && $OC_submissionFieldAR[$matches[1]]['usekey']
&& !empty($l[$matches[1]])
&& isset($OC_submissionFieldAR[$matches[1]]['values'][$l[$matches[1]]])
) {
$extraAR[$l['paperid']]['_' . $afKey . $l['position']] = $OC_submissionFieldAR[$matches[1]]['values'][$l[$matches[1]]];
} else {
$extraAR[$l['paperid']]['_' . $afKey . $l['position']] = $l[$matches[1]];
}
$fieldAR['_' . $afKey . $l['position']] = preg_replace("/All " . OCC_WORD_AUTHOR . "s /", "", (OCC_WORD_AUTHOR . ' ' . $l['position'] . ' ' . $fieldAR[$afKey]));
}
}
if ($l['position'] > $maxPosition) {
$maxPosition = $l['position'];
}
}
$newAuthorFieldsAR = array();
for ($i=1; $i<=$maxPosition; $i++) {
foreach($incAuthorFieldsAR as $f) {
$newAuthorFieldsAR[] = '_' . $f . $i;
}
}
reset($incAuthorFieldsAR);
array_splice(
$exportFieldsAR,
array_search(current($incAuthorFieldsAR), $_POST['fields']),
count($incAuthorFieldsAR),
$newAuthorFieldsAR
);
}
// Topics
if (in_array('_topics', $exportFieldsAR)) {
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_TOPIC . "`.`topicname`, `" . OCC_TABLE_TOPIC . "`.`short` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_TOPIC . "`, `" . OCC_TABLE_PAPERTOPIC . "` WHERE `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERTOPIC . "`.`paperid` AND `" . OCC_TABLE_PAPERTOPIC . "`.`topicid`=`" . OCC_TABLE_TOPIC . "`.`topicid` " . $accSQL;
$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['paperid']]['_topics'])) {
$extraAR[$l['paperid']]['_topics'] .= "\n" . useTopic($l['short'], $l['topicname']);
} else {
$extraAR[$l['paperid']]['_topics'] = useTopic($l['short'], $l['topicname']);
}
}
}
// Score
if (in_array('_score', $exportFieldsAR)) {
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, ABS(FORMAT(AVG(`score`),2)) AS `recavg` FROM `" . OCC_TABLE_PAPER . "` LEFT JOIN `" . OCC_TABLE_PAPERREVIEWER . "` ON `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` WHERE 1=1 " . $accSQL . " GROUP BY `paperid`";
$r = ocsql_query($q) or err("Unable to retrieve data for export (s)", $hdr, $hdrfn);
while ($l = ocsql_fetch_assoc($r)) {
$extraAR[$l['paperid']]['_score'] = $l['recavg'];
}
}
// Committee Comments
if (preg_match("/\b_adv/", implode(',', $exportFieldsAR))) {
// $accSQL is left out below as OCC_TABLE_PAPER is not included, meaning we use a little more memory
$q = "SELECT `" . OCC_TABLE_PAPERADVOCATE . "`.*, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `advocate` FROM `" . OCC_TABLE_PAPERADVOCATE . "`, `" . OCC_TABLE_REVIEWER . "` WHERE `" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` ORDER BY `paperid`";
$r = ocsql_query($q) or err("Unable to retrieve data for export (c)", $hdr, $hdrfn);
while ($l = ocsql_fetch_assoc($r)) {
$extraAR[$l['paperid']]['_adv_comments'] = $l['adv_comments'];
$extraAR[$l['paperid']]['_advocateid'] = $l['advocateid'];
$extraAR[$l['paperid']]['_advocate'] = $l['advocate'];
$extraAR[$l['paperid']]['_adv_recommendation'] = $l['adv_recommendation'];
}
}
// Get extra fields data
if (oc_hookSet('chair-export-data')) {
foreach ($OC_hooksAR['chair-export-data'] as $v) {
require_once $v;
}
}
// Get sub. data & iterate through each
$q = "SELECT `" . OCC_TABLE_PAPER . "`.*, `" . OCC_TABLE_PAPER . "`.`paperid` AS `id`, `" . OCC_TABLE_AUTHOR . "`.*, CONCAT_WS(' ',`" . OCC_TABLE_AUTHOR . "`.`name_first`,`" . OCC_TABLE_AUTHOR . "`.`name_last`) AS `name` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_AUTHOR . "` WHERE `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` AND `" . OCC_TABLE_AUTHOR . "`.`position`=`" . OCC_TABLE_PAPER . "`.`contactid` " . $accSQL . " ORDER BY `" . OCC_TABLE_PAPER . "`.`paperid`";
$r = ocsql_query($q) or err("Unable to retrieve data for export", $hdr, $hdrfn);
if (ocsql_num_rows($r) == 0) {
warn("There are no papers to export", $hdr, $hdrfn);
exit;
} else { // Export file
oc_export($scope, $exportFieldsAR, $fieldAR, $r, $extraAR, $OC_submissionFieldAR);
exit;
}
}
// Display form
printHeader($hdr, $hdrfn);
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p>Export will generate one row/entry per submission. When selecting <em>All ' . OCC_WORD_AUTHOR . 's</em>, each ' . oc_strtolower(OCC_WORD_AUTHOR) . '\'s data will appear as separate fields.</p>
<script language="javascript" type="text/javascript">
<!--
function checkAllBoxes() {
var boxObj = document.getElementsByName(\'fields[]\');
for (var i=0; i<boxObj.length; i++) {
boxObj[i].checked = true;
}
}
document.write(\'<p><a href="#" onclick="checkAllBoxes(); return false;" style="margin-left: 25px; padding: 1px 3px; background-color: #eee; color: #00f; text-decoration: underline;" >check all</a></p>\');
// -->
</script>
';
foreach ($fieldAR as $fieldID => $fieldName) {
if (preg_match("/^skip\d+$/", $fieldID)) {
print '<br />';
continue;
}
print '<label><input type="checkbox" name="fields[]" value="' . $fieldID . '" ';
if (in_array($fieldID,$checkedFieldAR)) { print 'checked '; }
print '/> ' . $fieldName . "</label><br />\n";
}
print '
<br />
<label>Format: <select name="format">
';
foreach ($OC_exportFormatAR as $fmt => $fmtAR) {
print '<option value="' . $fmt . '">' . $fmtAR['name'] . '</option>';
}
print '
</select></label>
&nbsp; &nbsp;
<label>Submissions: <select name="acc">
<option value="">All</option>
';
foreach ($OC_acceptanceValuesAR as $idx => $acc) {
print '<option value="' . safeHTMLstr($idx) . '">' . safeHTMLstr($acc['value']) . '</option>';
}
print '
</select></label>
<input type="submit" name="submit" value="Generate File" style="float: left; margin-right: 2em;" class="submit" />
<br />
<p style="margin-left: 30px;"><label><input type="checkbox" name="charlimit" value="1" /> Limit cells to ' . $OC_exportCharLimit . ' characters (Excel/CSV limit)</label></p>
</form>
<p class="note">Note: When opening up a CSV or Tab-delimited file in a spreadsheet, you may need to specify the character encoding: UTF-8.</p>
';
printFooter();
?>
+171
View File
@@ -0,0 +1,171 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$OC_translate = false; // do not translate
$hdr = 'Export Committee Members';
$hdrfn = 1;
require_once "../include.php";
beginChairSession();
require_once 'export.inc';
$scope = 'committee_members'; // scope of export for filename
// check that reviewers exist
$r = ocsql_query("SELECT COUNT(*) AS `count` FROM `" . OCC_TABLE_REVIEWER . "`");
$l = ocsql_fetch_assoc($r);
if ($l['count'] == 0) {
warn('There are no reviewers to export', $hdr, $hdrfn);
exit;
}
require_once OCC_FORM_INC_FILE;
require_once OCC_COMMITTEE_INC_FILE;
$skip = 1;
$fieldAR = array(
'reviewerid' => '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 '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p>Export will generate one row/entry per committee member.</p>
<p style="font-weight: bold">Select Fields to Export:</p>
';
foreach ($fieldAR as $fieldID => $fieldName) {
if (preg_match("/^skip\d+$/", $fieldID)) {
print '<br />';
continue;
}
print '<label><input type="checkbox" name="fields[]" value="' . $fieldID . '" ';
if (in_array($fieldID,$checkedFieldAR)) { print 'checked '; }
print '/> ' . $fieldName . "</label><br />\n";
}
print '
<input type="submit" name="submit" class="submit" value="Generate File" />
&nbsp; &nbsp;
Format: <select name="format">
';
foreach ($OC_exportFormatAR as $fmt => $fmtAR) {
print '<option value="' . $fmt . '">' . $fmtAR['name'] . '</option>';
}
print '
</select>
</p>
</form>
<p class="note">Note: When opening up a CSV or Tab-delimited file in a spreadsheet, you may need to specify the character encoding: UTF-8.</p>
';
printFooter();
?>
+49
View File
@@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$OC_translate = false; // do not translate
require_once '../include.php';
require_once OCC_REVIEW_INC_FILE;
beginChairSession();
printHeader('Review Fields Guide', 1);
foreach ($OC_reviewQuestionsAR as $k => $v) {
print '<p><strong>' . safeHTMLstr($v['short']) . '</strong></p>';
if (($k != 'sessions') && isset($v['values']) && is_array($v['values'])) {
print '<ul>';
foreach ($v['values'] as $kk => $vv) {
if ($v['usekey']) {
print '<li>' . $kk . ': ' . $vv . '</li>';
} else {
print '<li>' . $vv . '</li>';
}
}
print '</ul>';
}
}
print '
<p><strong>Review Completed</strong></p>
<ul>
<li>T: True/Yes</li>
<li>F: False/No</li>
</ul>
';
printFooter();
?>
+176
View File
@@ -0,0 +1,176 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$OC_translate = false; // do not translate
$hdr = 'Export Reviews';
$hdrfn = 1;
require_once '../include.php';
beginChairSession();
require_once 'export.inc';
require_once OCC_FORM_INC_FILE;
require_once OCC_REVIEW_INC_FILE;
$skip = 1;
$scope = 'reviews'; // scope of export for filename
$fieldAR = array(
'paperid' => 'Submission ID',
'reviewerid' => 'Reviewer ID',
'title' => 'Submission Title',
'name' => 'Reviewer Name',
'score' => 'Score'
);
foreach ($OC_reviewQuestionsAR as $k => $v) {
$fieldAR[$k] = $v['short'];
}
// value needs special handling as it's stored in DB with multiple values in a single field
if (isset($fieldAR['value'])) {
unset($fieldAR['value']);
$fieldAR['_value'] = 'Value';
}
// session needs special handling as it's stored in seaprate table
if (isset($fieldAR['sessions'])) {
unset($fieldAR['sessions']);
$fieldAR['_sessions'] = 'Session(s)';
}
$fieldAR['completed'] = 'Review Completed (True/False)';
// Default list of checked fields
$checkedFieldAR = array_keys($fieldAR);
// Include extra fields
if (oc_hookSet('chair-export_reviews-fields')) {
foreach ($OC_hooksAR['chair-export_reviews-fields'] as $v) {
require_once $v;
}
}
if (isset($_POST['submit']) && ($_POST['submit'] == "Generate File") && isset($_POST['fields']) && !empty($_POST['fields'])) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission', $hdr, $hdrfn);
}
// Verify Fields
$fieldARkeys = array_keys($fieldAR);
foreach ($_POST['fields'] as $f) {
if (!in_array($f,$fieldARkeys)) {
err('Invalid field name selection', $hdr, $hdrfn);
}
}
// Init extra field AR
$extraAR = array();
// List of fields to export
$exportFieldsAR = $_POST['fields'];
// Get extra fields data
// value
if (isset($fieldAR['_value'])) {
$q = "SELECT `paperid`, `reviewerid`, `value` FROM `" . OCC_TABLE_PAPERREVIEWER . "`";
$r = ocsql_query($q) or err('Unable to retrieve value data for export', $hdr, $hdrfn);
while ($l = ocsql_fetch_assoc($r)) {
if (empty($l['value'])) { continue; }
$val = '';
$vAR = explode(",", $l['value']);
foreach ($vAR as $v) {
$val .= $OC_reviewQuestionsAR['value']['values'][$v] . "; ";
}
$extraAR[$l['paperid'] . '-' . $l['reviewerid']]['_value'] = rtrim($val, "; ");
}
}
// sessions
if (isset($fieldAR['_sessions'])) {
$q = "SELECT `" . OCC_TABLE_PAPERSESSION . "`.`paperid`, `" . OCC_TABLE_PAPERSESSION . "`.`reviewerid`, `" . OCC_TABLE_TOPIC . "`.`topicname`, `" . OCC_TABLE_TOPIC . "`.`short` FROM `" . OCC_TABLE_PAPERSESSION . "`, `" . OCC_TABLE_TOPIC . "` WHERE `" . OCC_TABLE_PAPERSESSION . "`.`topicid`=`" . OCC_TABLE_TOPIC . "`.`topicid`";
$r = ocsql_query($q) or err('Unable to retrieve session data for export', $hdr, $hdrfn);
while ($l = ocsql_fetch_assoc($r)) {
if (isset($extraAR[$l['paperid'] . '-' . $l['reviewerid']]['_sessions'])) {
$extraAR[$l['paperid'] . '-' . $l['reviewerid']]['_sessions'] .= ',' . useTopic($l['short'], $l['topicname']);
} else {
$extraAR[$l['paperid'] . '-' . $l['reviewerid']]['_sessions'] = useTopic($l['short'], $l['topicname']);
}
}
}
if (oc_hookSet('chair-export_reviews-data')) {
foreach ($OC_hooksAR['chair-export_reviews-data'] as $v) {
require_once $v;
}
}
// Get review data & iterate through each
$q = "SELECT `" . OCC_TABLE_PAPERREVIEWER . "`.*, CONCAT_WS('-', `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`, `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`) AS `id`, `" . OCC_TABLE_PAPER . "`.`title`, CONCAT_WS(' ', `" . OCC_TABLE_REVIEWER . "`.`name_first`, `" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name` FROM `" . OCC_TABLE_PAPERREVIEWER . "`, `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_REVIEWER . "` WHERE `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` AND `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` ORDER BY `paperid`, `reviewerid`";
$r = ocsql_query($q) or err('Unable to retrieve data for export', $hdr, $hdrfn);
if (ocsql_num_rows($r) == 0) {
warn("There is no review data to export", $hdr, $hdrfn);
exit;
} else { // Export file
oc_export($scope, $exportFieldsAR, $fieldAR, $r, $extraAR, $OC_reviewQuestionsAR);
exit;
}
}
// Display form
printHeader($hdr, $hdrfn);
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p>Export will generate one row/entry per submission/reviewer pair.</p>
<p style="font-weight: bold">Select Fields to Export:</p>
';
foreach ($fieldAR as $fieldID => $fieldName) {
if (preg_match("/^skip\d+$/", $fieldID)) {
print '<br />';
continue;
}
print '<label><input type="checkbox" name="fields[]" value="' . $fieldID . '" ';
if (in_array($fieldID,$checkedFieldAR)) { print 'checked '; }
print '/> ' . $fieldName . "</label><br />\n";
}
print '
<p><input type="submit" name="submit" class="submit" value="Generate File" />
&nbsp; &nbsp;
Format: <select name="format">
';
foreach ($OC_exportFormatAR as $fmt => $fmtAR) {
print '<option value="' . $fmt . '">' . $fmtAR['name'] . '</option>';
}
print '
</select>
</p>
<p style="margin-left: 30px;"><label><input type="checkbox" name="charlimit" value="1" /> Limit cells to ' . $OC_exportCharLimit . ' characters (Excel/CSV limit)</label></p>
</form>
<p class="note">Note: When opening up a CSV or Tab-delimited file in a spreadsheet, you may need to specify the character encoding: UTF-8.</p>
';
printFooter();
?>
+36
View File
@@ -0,0 +1,36 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
require_once 'export.inc';
require_once OCC_FORM_INC_FILE;
require_once OCC_COMMITTEE_INC_FILE;
$fieldAR = array(
'id' => '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;
?>
+362
View File
@@ -0,0 +1,362 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader('Import Committee Members', 1);
require_once OCC_FORM_INC_FILE;
require_once OCC_COMMITTEE_INC_FILE;
$encodingAR = array('UTF-8','ISO-8859-1', 'ISO-8850-2', 'ISO-8859-9', 'ISO-8859-15', 'Big5', 'GB2312', 'EUC-KR', 'EUC-JP', 'SJis', 'Windows-1251', 'Windows-1252');
if (isset($_POST['submit']) && ($_POST['submit'] == "Import Committee Members")) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// handle Mac line ending
if (isset($_POST['lineend']) && ($_POST['lineend'] == 1)) {
ini_set('auto_detect_line_endings', true);
}
if ( // file uploaded ok
isset($_FILES['csvfile']['error']) // good upload
&& ($_FILES['csvfile']['error'] == UPLOAD_ERR_OK) // no error
&& is_uploaded_file($_FILES['csvfile']['tmp_name']) // legitimate upload
&& ($_FILES['csvfile']['size'] > 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 '<ul class="warn"><li>' . implode('</li><li>', $errAR) . '</ul>';
} else {
// retrieve and check data
$importAR = array();
$rownum = 2; // skip header -- value for human consumption only
$reverseFieldMapAR = array_flip($fieldMapAR);
$reverseTopicAR = array_flip($topicAR);
$reverseShortTopicAR = array_flip($shortTopicAR);
while (($row = fgetcsv($fp, 0, $_POST['delimiter'], $_POST['enclosure'], $_POST['escape'])) !== false) {
if (count($row) < 2) { continue; }
if (!isset($row[$reverseFieldMapAR['name_last']]) || empty(trim($row[$reverseFieldMapAR['name_last']]))
|| !isset($row[$reverseFieldMapAR['email']]) || empty(trim($row[$reverseFieldMapAR['email']]))
) {
$errAR[] = 'Row ' . $rownum++ . ' missing Last Name or Email';
continue;
}
$recordAR = array();
foreach ($fieldMapAR as $colid => $fid) {
if (empty(trim($row[$colid]))) {
continue;
}
// check/convert encoding
if (isset($_POST['encoding']) && ($_POST['encoding'] != 'UTF-8')) {
$row[$colid] = mb_convert_encoding($row[$colid], 'UTF-8', $_POST['encoding']);
}
if (
(function_exists('mb_detect_encoding') && (mb_detect_encoding($row[$colid], 'UTF-8', true) != 'UTF-8'))
||
!preg_match("//u", $row[$colid])
) {
$errAR[] = 'Row ' . $rownum . ' Invalid UTF-8 encoding for field id ' . $fid;
}
if ($fid == 'password') {
if (preg_match("/^[a-f0-9]{50}$/", $row[$colid]) || preg_match("/^\$\w\w\$\w\w\$/", $row[$colid])) { // OC encrypted password
$recordAR['password'] = $row[$colid];
} elseif (!preg_match("/^$/", $row[$colid])) {
$recordAR['password'] = oc_password_hash($row[$colid]);
}
} elseif ($fid == 'topics') {
if (($topics = preg_split("/\n/", $row[$colid])) && (count($topics) > 0)) {
$recordAR['topics'] = array();
foreach ($topics as $topic) {
if (empty(trim($topic))) { continue; }
if (isset($reverseShortTopicAR[$topic])) { // short topic name
$recordAR['topics'][] = $reverseShortTopicAR[$topic];
} elseif (preg_match("/^\d+$/", $topic) && isset($topicAR[$topic])) { // topic ID
$recordAR['topics'][] = $topic;
} elseif (isset($reverseTopicAR[$topic])) { // full topic name
$recordAR['topics'][] = $reverseTopicAR[$topic];
} else {
$errAR[] = 'Row ' . $rownum . ' Topic invalid: ' . $topic;
}
}
} else {
$errAR[] = 'Row ' . $rownum . ' Topics invalid';
}
} elseif ($fid == 'id') {
if (preg_match("/^\d+$/", $row[$colid]) && !in_array($row[$colid], $reviewerIdAR)) {
$recordAR['reviewerid'] = $row[$colid];
$reviewerIdAR[] = $row[$colid];
} else {
$errAR[] = 'Row ' . $rownum . ' ID already exists or invalid';
}
} elseif ($fid == 'email') {
if (validEmail($row[$colid]) && !in_array($row[$colid], $emailAR)) {
$recordAR['email'] = $row[$colid];
$emailAR[] = $row[$colid];
} else {
$errAR[] = 'Row ' . $rownum . ' Email already exists or invalid';
}
} elseif ($fid == 'username') {
if (preg_match("/^[\p{L}\p{Nd}_\.\-\@]{5,50}$/u", $row[$colid]) && !in_array($row[$colid], $usernameAR)) {
$recordAR['username'] = $row[$colid];
$usernameAR[] = $row[$colid];
} else {
$errAR[] = 'Row ' . $rownum . ' Username already exists or invalid';
}
} elseif ($fid == 'onprogramcommittee') {
if (preg_match("/^[TF]$/i", $row[$colid])) {
$recordAR['onprogramcommittee'] = strtoupper($row[$colid]);
} else {
$errAR[] = 'Row ' . $rownum . ' OnProgramCommittee invalid';
}
} else {
if (preg_match("/^(?:checkbox|picklist)$/", $OC_reviewerFieldAR[$fid]['type'])) { // multi-select field
if (($values = preg_split("/\n/", $row[$colid])) && (count($values) > 0)) {
$recordAR[$fid] = array();
$reverseValuesAR = array_flip($OC_reviewerFieldAR[$fid]['values']);
foreach ($values as $value) {
if (empty(trim($value))) { continue; }
if (!isset($OC_reviewerFieldAR[$fid]['usekey']) || $OC_reviewerFieldAR[$fid]['usekey']) {
if (isset($OC_reviewerFieldAR[$fid]['values'][$value])) {
$recordAR[$fid][] = $value;
} elseif (isset($reverseValuesAR[$value])) {
$recordAR[$fid][] = $reverseValuesAR[$value];
}
} elseif (in_array($value, $OC_reviewerFieldAR[$fid]['values'])) {
$recordAR[$fid][] = $value;
} elseif ($fid == 'consent') { // override in case translated value saved
$recordAR[$fid][] = $value;
} else {
$errAR[] = 'Row ' . $rownum . ' ' . $OC_reviewerFieldAR[$fid]['short'] . ' invalid value: ' . $value;
}
}
} else {
$errAR[] = 'Row ' . $rownum . ' ' . $OC_reviewerFieldAR[$fid]['short'] . ' invalid';
}
} else { // not multi-select field (e.g., text, textarea, dropdown, radio)
if (isset($OC_reviewerFieldAR[$fid]['values']) && !empty($OC_reviewerFieldAR[$fid]['values'])) {
if (!isset($OC_reviewerFieldAR[$fid]['usekey']) || $OC_reviewerFieldAR[$fid]['usekey']) {
$reverseValuesAR = array_flip($OC_reviewerFieldAR[$fid]['values']);
if (isset($OC_reviewerFieldAR[$fid]['values'][$row[$colid]])) {
$recordAR[$fid] = $row[$colid];
} elseif (isset($reverseValuesAR[$row[$colid]])) {
$recordAR[$fid] = $reverseValuesAR[$row[$colid]];
} else {
$errAR[] = 'Row ' . $rownum . ' ' . $OC_reviewerFieldAR[$fid]['short'] . ' invalid value: ' . $row[$colid];
}
} elseif (in_array($row[$colid], $OC_reviewerFieldAR[$fid]['values'])) {
$recordAR[$fid] = $row[$colid];
} else {
$errAR[] = 'Row ' . $rownum . ' ' . $OC_reviewerFieldAR[$fid]['short'] . ' invalid value: ' . $row[$colid];
}
} else {
$recordAR[$fid] = $row[$colid];
}
}
}
}
// fill in missing fields
if (!isset($recordAR['password'])) {
$recordAR['password'] = oc_password_hash(oc_password_generate()); // filler password
}
if (!isset($recordAR['username']) && isset($recordAR['email'])) { // if not present, default username to email
if (!in_array($recordAR['email'], $usernameAR)) {
$recordAR['username'] = $recordAR['email'];
$usernameAR[] = $recordAR['username'];
} else {
$errAR[] = 'Row ' . $rownum . ' cannot use email for username';
}
}
if (!isset($recordAR['onprogramcommittee'])) { // default to not being on program committee
$recordAR['onprogramcommittee'] = 'F';
}
if (count($recordAR) > 0) {
$importAR[] = $recordAR;
}
$rownum++;
}
if (count($errAR) == 0) {
if (count($importAR) > 0) {
// import'em Danno
foreach($importAR as $recordID => $record) {
$reviewerid = 0;
$q = "INSERT INTO `" . OCC_TABLE_REVIEWER . "` SET ";
foreach ($record as $fid => $fval) {
if ($fid == 'topics') {
continue;
} elseif ($fid == 'reviewerid') {
$reviewerid = $fval;
}
$q .= "`" . $fid . "`='" . safeSQLstr((is_array($fval) ? implode(',', $fval) : $fval)) . "', ";
}
$q .= "`lastupdate`='" . safeSQLstr(date('Y-m-d')) . "'";
$r = ocsql_query($q) or warn('Import DB failure: (' . $recordID . ') ' . safeHTMLstr(ocsql_error()));
if ($reviewerid === 0) {
$reviewerid = ocsql_insert_id();
}
if (
preg_match("/^[1-9][0-9]*$/", $reviewerid)
&& isset($record['topics'])
&& is_array($record['topics'])
&& (count($record['topics']) > 0)
) {
$tq = "";
foreach ($record['topics'] as $topic) {
if (preg_match("/^\d+$/", $topic)) {
$tq .= "(" . $reviewerid . "," . $topic . "),";
}
}
if (!empty($tq)) {
$tq = "INSERT INTO `" . OCC_TABLE_REVIEWERTOPIC . "` (`reviewerid`, `topicid`) VALUES " . rtrim($tq, ',');
ocsql_query($tq) or warn('Topic import DB failure: (' . $recordID . ') ' . safeHTMLstr(ocsql_error()));
}
}
}
print '<p class="note2">' . safeHTMLstr(count($importAR)) . ' records imported</p>';
} else {
print '<p class="warn">No valid reviewer records found</p>';
}
} else {
print '<ul class="warn"><li>' . implode('</li><li>', $errAR) . '</ul>';
}
}
} else {
print '<p class="warn">File did not upload properly or size too large</p>';
}
// clear out file
if (isset($_FILES['csvfile']['tmp_name']) && is_file($_FILES['csvfile']['tmp_name'])) {
unlink($_FILES['csvfile']['tmp_name']);
}
print '<hr />';
}
// Display form
print '
<p>Select the CSV file, then click the <i>Import Committee Members</i> 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.</p>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p><b>CSV File:</b> <input type="file" name="csvfile" id="csvfile" /></p>
<p><input type="submit" name="submit" class="submit" value="Import Committee Members" /></p>
<p><b>Options:</b></p>
<div style="margin-left: 30px;">
<p>
<label>Delimiter: <input name="delimiter" id="delimiter" value="' . varValue('delimiter', $_POST, ',', true) . '" size="2" /></label> &nbsp; &nbsp;
<label>Enclosure: <input name="enclosure" id="enclosure" value="' . varValue('enclosure', $_POST, '&quot;', true) . '" size="2" /></label> &nbsp; &nbsp;
<label>Escape: <input name="escape" id="escape" value="' . varValue('escape', $_POST, '\\', true) . '" size="2" /></label>
</p>
';
if (function_exists('mb_convert_encoding')) {
print '
<p>
<label>Encoding: <select name="encoding">' . generateSelectOptions($encodingAR, varValue('encoding', $_POST), false) . '</select></label>
</p>
';
}
print '
<p>
<label><input type="checkbox" id="skipunknown" name="skipunknown" value="1" ' . ((isset($_POST['skipunknown']) && ($_POST['skipunknown'] == 1)) ? 'checked ' : '') . '/> skip unknown columns</label>
</p>
<p>
<label><input type="checkbox" id="lineend" name="lineend" value="1" ' . ((isset($_POST['lineend']) && ($_POST['lineend'] == 1)) ? 'checked ' : '') . '/> detect Mac line endings</label>
</p>
</div>
</form>
<hr />
<p style="font-weight: bold; color: #444;">Template:</p>
<form method="post" action="import_reviewer-template.php">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p style="margin-left: 30px"><input type="submit" name="submit" value="Download template" /></p>
</form>
<p style="font-weight: bold; color: #444;">Import rules:</p>
<ul>
<li>The CSV file is assumed to be plain text with one committee member record per row</li>
<li>Row 1 is assumed to be the title row with a unique field (short) name or ID per column, UTF-8 encoded</li>
<li>The committee member\'s Last Name and Email Address must be included</li>
<li>If no Username value is present, the Email Address will be used</li>
<li>The Username and Email Address must be unique</li>
<li>If no ID value is present, one will be automatically assigned</li>
<li>If no Password value is present, the committee member will need to use the "forgot password" feature to have a new one issued</li>
<li>The OnProgramCommittee value must be T for true or F for false; if neither of these, F is assumed</li>
<li>For multi-value fields (e.g., Topics, checkboxes, picklist), separate values with a newline (\n)</li>
</ul>
';
printFooter();
?>
+57
View File
@@ -0,0 +1,57 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
if (!validToken('chair') || !isset($_POST['maxauthors']) || !preg_match("/^[0-9]+$/", $_POST['maxauthors'])) {
warn('Invalid request', 'Submission Import', 0);
}
require_once 'export.inc';
require_once OCC_FORM_INC_FILE;
require_once OCC_SUBMISSION_INC_FILE;
$fieldAR = array(
'paperid' => 'Submission ID',
'password' => 'Password',
'submissiondate' => 'Submission Date',
'accepted' => 'Acceptance',
'pcnotes' => 'Chair Notes'
);
$authorFieldAR = array();
foreach ($OC_submissionFieldSetAR as $fsk=>$fsv) {
foreach ($fsv['fields'] as $f) {
if (preg_match("/^password/", $f) || empty($OC_submissionFieldAR[$f]['name']) || ($OC_submissionFieldAR[$f]['type'] == 'file')) { continue; }
if ($fsk == 'fs_authors') {
$authorFieldAR[] = $f;
} else {
$fieldAR[$f] = str_replace("\"", "\"\"", $OC_submissionFieldAR[$f]['short']);
}
}
}
for ($author=1; $author<=$_POST['maxauthors']; $author++) {
foreach ($authorFieldAR as $f) {
$fieldAR[$f . $author] = OCC_WORD_AUTHOR . ' ' . $author . ' ' . str_replace("\"", "\"\"", $OC_submissionFieldAR[$f]['short']);
}
}
oc_export_headers('submissions-import-template.csv', 'csv');
print '"' . strtoupper(implode('","', $fieldAR)) . '"' . "\r\n";
exit;
?>
+423
View File
@@ -0,0 +1,423 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader('Import Submissions', 1);
require_once OCC_FORM_INC_FILE;
require_once OCC_SUBMISSION_INC_FILE;
$encodingAR = array('UTF-8','ISO-8859-1', 'ISO-8850-2', 'ISO-8859-9', 'ISO-8859-15', 'Big5', 'GB2312', 'EUC-KR', 'EUC-JP', 'SJis', 'Windows-1251', 'Windows-1252');
if (isset($_POST['submit']) && ($_POST['submit'] == "Import Submissions")) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// handle Mac line ending
if (isset($_POST['lineend']) && ($_POST['lineend'] == 1)) {
ini_set('auto_detect_line_endings', true);
}
if ( // file uploaded ok
isset($_FILES['csvfile']['error']) // good upload
&& ($_FILES['csvfile']['error'] == UPLOAD_ERR_OK) // no error
&& is_uploaded_file($_FILES['csvfile']['tmp_name']) // legitimate upload
&& ($_FILES['csvfile']['size'] > 0) // not empty (redundant w/ERR)
&& (($fp = fopen($_FILES['csvfile']['tmp_name'], "r")) !== false) // open ok
) {
// retrieve existing submission IDs
$submissionIdAR = array();
$r = ocsql_query("SELECT `paperid` FROM `" . OCC_TABLE_PAPER . "`");
while ($l = ocsql_fetch_assoc($r)) {
$submissionIdAR[] = $l['paperid'];
}
// set list of field names to ID mapping
$fieldIdAR = array(
'paperid' => 'paperid',
'password' => 'password',
'submissiondate' => 'submissiondate',
'pcnotes' => 'pcnotes'
);
$fieldNameAR = array(
'submission id' => 'paperid',
'password' => 'password',
'submission date' => 'submissiondate',
'chair notes' => 'pcnotes'
);
$authorFieldIdAR = array();
$authorFieldNameAR = array();
foreach ($OC_submissionFieldSetAR as $fsk=>$fsv) {
foreach ($fsv['fields'] as $fid) {
if (preg_match("/^password/", $fid) || preg_match("/[\'\"]/", $OC_submissionFieldAR[$fid]['short'])) { continue; }
$lowshort = strtolower($OC_submissionFieldAR[$fid]['short']);
if ($fsk == 'fs_authors') {
$authorFieldIdAR[$fid] = $lowshort;
$authorFieldNameAR[$lowshort] = $fid;
} else {
$fieldIdAR[$fid] = $lowshort;
$fieldNameAR[$lowshort] = $fid;
}
}
}
// retieve and check header row
$fieldMapAR = array();
$authorFieldMapAR = array();
$errAR = array();
$row = fgetcsv($fp, 0, $_POST['delimiter'], $_POST['enclosure'], $_POST['escape']);
foreach ($row as $rowid => $rowval) {
if (preg_match("/^" . OCC_WORD_AUTHOR . " (\d+) (.*)$/i", $rowval, $matches)) {
$authornum = $matches[1];
$col = strtolower($matches[2]);
if (isset($authorFieldIdAR[$col])) {
$fieldMapAR[$rowid] = $col . '-' . $authornum;
} elseif (isset($authorFieldNameAR[$col])) {
$fieldMapAR[$rowid] = $authorFieldNameAR[$col] . '-' . $authornum;
} elseif (!isset($_POST['skipunknown']) || ($_POST['skipunknown'] != 1)) {
$errAR[] = 'Unknown column ' . safeHTMLstr($rowval);
}
} else {
$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('title', $fieldMapAR)
|| !in_array('name_last-1', $fieldMapAR)
|| !in_array('email-1', $fieldMapAR)
) {
$errAR[] = 'Title (title), ' . safeHTMLstr(OCC_WORD_AUTHOR) . ' 1 Last Name (name_last-1), or Author 1 Email (email-1) field columns not found';
}
if (count($errAR) > 0) {
print '<ul class="warn"><li>' . implode('</li><li>', $errAR) . '</ul>';
} else {
// retrieve and check data
$importAR = array();
$rownum = 2; // skip header -- value for human consumption only
$reverseFieldMapAR = array_flip($fieldMapAR);
$reverseTopicAR = array_flip($topicAR);
$reverseShortTopicAR = array_flip($shortTopicAR);
$today = date('Y-m-d');
while (($row = fgetcsv($fp, 0, $_POST['delimiter'], $_POST['enclosure'], $_POST['escape'])) !== false) {
$recordAR = array();
if (count($row) < 3) {
$errAR[] = 'Row ' . $rownum++ . ' skipped';
continue;
}
// check for title, author 1 last name & email
if (
!isset($row[$reverseFieldMapAR['title']]) || empty(trim($row[$reverseFieldMapAR['title']]))
|| !isset($row[$reverseFieldMapAR['name_last-1']]) || empty(trim($row[$reverseFieldMapAR['name_last-1']]))
|| !isset($row[$reverseFieldMapAR['email-1']]) || !validEmail(trim($row[$reverseFieldMapAR['email-1']]))
) {
$errAR[] = 'Row ' . $rownum++ . ' missing or invalid Title, ' . safeHTMLstr(OCC_WORD_AUTHOR) . ' 1 Last Name, or ' . safeHTMLstr(OCC_WORD_AUTHOR) . ' 1 Email';
continue;
}
// check for contact (if > 1) last name & email
if (
isset($reverseFieldMapAR['contactid'])
&& preg_match("/^(?:Author |" . OCC_WORD_AUTHOR . " |)(\d+)$/", $row[$reverseFieldMapAR['contactid']], $cidmatch)
) {
$recordAR['contactid'] = $cidmatch[1];
if (
($row[$cidmatch[1]] > 1)
&& (
!isset($reverseFieldMapAR['name_last-'.$cidmatch[1]])
|| empty($row[$reverseFieldMapAR['name_last-'.$cidmatch[1]]])
|| !isset($reverseFieldMapAR['email-'.$cidmatch[1]])
|| !validEmail($row[$reverseFieldMapAR['email-'.$cidmatch[1]]])
)
) {
$errAR[] = 'Row ' . $rownum++ . ' missing or invalid ' . safeHTMLstr(OCC_WORD_AUTHOR) . ' ' . $cidmatch[1] . ' Last Name or ' . safeHTMLstr(OCC_WORD_AUTHOR) . ' ' . $cidmatch[1] . ' Email';
continue;
}
} else {
$recordAR['contactid'] = 1;
}
// check non-empty fields
foreach ($fieldMapAR as $colid => $fid) {
if (empty(trim($row[$colid]))) {
continue;
}
// check/convert encoding
if (isset($_POST['encoding']) && ($_POST['encoding'] != 'UTF-8') && in_array($_POST['encoding'], $encodingAR)) {
$row[$colid] = mb_convert_encoding($row[$colid], 'UTF-8', $_POST['encoding']);
}
if (
(function_exists('mb_detect_encoding') && (mb_detect_encoding($row[$colid], 'UTF-8', true) != 'UTF-8'))
||
!preg_match("//u", $row[$colid])
) {
$errAR[] = 'Row ' . $rownum . (isset($recordAR['paperid']) ? (' (ID ' . safeHTMLstr($recordAR['paperid']) . ') ') : '') . 'Invalid UTF-8 encoding for field id ' . $fid;
}
if ($fid == 'password') {
if (preg_match("/^[a-f0-9]{50}$/", $row[$colid]) || preg_match("/^\$\w\w\$\w\w\$/", $row[$colid])) { // OC encrypted password
$recordAR['password'] = $row[$colid];
} elseif (!preg_match("/^$/", $row[$colid])) {
$recordAR['password'] = oc_password_hash($row[$colid]);
}
} elseif ($fid == 'topics') {
if (($topics = preg_split("/\n/", $row[$colid])) && (count($topics) > 0)) {
$recordAR['topics'] = array();
foreach ($topics as $topic) {
if (empty(trim($topic))) { continue; }
if (isset($reverseShortTopicAR[$topic])) { // short topic name
$recordAR['topics'][] = $reverseShortTopicAR[$topic];
} elseif (preg_match("/^\d+$/", $topic) && isset($topicAR[$topic])) { // topic ID
$recordAR['topics'][] = $topic;
} elseif (isset($reverseTopicAR[$topic])) { // full topic name
$recordAR['topics'][] = $reverseTopicAR[$topic];
} else {
$errAR[] = 'Row ' . $rownum . (isset($recordAR['paperid']) ? (' (ID ' . safeHTMLstr($recordAR['paperid']) . ') ') : '') . 'Topic invalid: ' . $topic;
}
}
} elseif (!preg_match("/^$/", $row[$colid])) {
$errAR[] = 'Row ' . $rownum . (isset($recordAR['paperid']) ? (' (ID ' . safeHTMLstr($recordAR['paperid']) . ') ') : '') . ' Topics invalid';
}
} elseif ($fid == 'paperid') {
if (preg_match("/^\d+$/", $row[$colid]) && !in_array($row[$colid], $submissionIdAR)) {
$recordAR['paperid'] = $row[$colid];
$submissionIdAR[] = $row[$colid];
} elseif (!preg_match("/^$/", $row[$colid])) {
$errAR[] = 'Row ' . $rownum . ' (ID ' . safeHTMLstr($row[$colid]) . ') Submission ID already exists or invalid';
}
} elseif ($fid == 'accepted') {
if (in_array($row[$colid], $OC_acceptedValuesAR)) {
$recordAR['accepted'] = $row[$colid];
} elseif (!preg_match("/^$/", $row[$colid])) {
$errAR[] = 'Row ' . $rownum . (isset($recordAR['paperid']) ? (' (ID ' . safeHTMLstr($recordAR['paperid']) . ') ') : '') . ' Accepted invalid';
}
} elseif ($fid == 'submissiondate') {
if (preg_match("/^\d{4}-\d\d-\d\d$/", $row[$colid])) {
$recordAR['submissiondate'] = $row[$colid];
} elseif (!preg_match("/^$/", $row[$colid])) {
$errAR[] = 'Row ' . $rownum . (isset($recordAR['paperid']) ? (' (ID ' . safeHTMLstr($recordAR['paperid']) . ') ') : '') . ' Submission Date invalid';
}
} else {
if (preg_match("/^(.*)-(\d+)$/", $fid, $fmatches)) {
$usefid = $fmatches[1];
} else {
$usefid = $fid;
}
if (preg_match("/^(?:checkbox|picklist)$/", $OC_submissionFieldAR[$usefid]['type'])) { // multi-select field
if (($values = preg_split("/\n/", $row[$colid])) && (count($values) > 0)) {
$recordAR[$fid] = array();
$reverseValuesAR = array_flip($OC_submissionFieldAR[$usefid]['values']);
foreach ($values as $value) {
if (empty(trim($value))) { continue; }
if (!isset($OC_submissionFieldAR[$usefid]['usekey']) || $OC_submissionFieldAR[$usefid]['usekey']) {
if (isset($OC_submissionFieldAR[$usefid]['values'][$value])) {
$recordAR[$fid][] = $value;
} elseif (isset($reverseValuesAR[$value])) {
$recordAR[$fid][] = $reverseValuesAR[$value];
}
} elseif (in_array($value, $OC_submissionFieldAR[$usefid]['values'])) {
$recordAR[$fid][] = $value;
} elseif ($fid == 'consent') { // override in case translated value saved
$recordAR[$fid][] = $value;
} else {
$errAR[] = 'Row ' . $rownum . ' ' . (isset($recordAR['paperid']) ? ('(ID ' . safeHTMLstr($recordAR['paperid']) . ') ') : '') . $OC_submissionFieldAR[$usefid]['short'] . ' invalid value: ' . $value;
}
}
} else {
$errAR[] = 'Row ' . $rownum . ' ' . $OC_submissionFieldAR[$usefid]['short'] . ' invalid';
}
} else { // not multi-select field (e.g., text, textarea, dropdown, radio)
if (isset($OC_submissionFieldAR[$usefid]['values']) && !empty($OC_submissionFieldAR[$usefid]['values'])) {
if (!isset($OC_submissionFieldAR[$usefid]['usekey']) || $OC_submissionFieldAR[$usefid]['usekey']) {
$reverseValuesAR = array_flip($OC_submissionFieldAR[$usefid]['values']);
if (isset($OC_submissionFieldAR[$usefid]['values'][$row[$colid]])) {
$recordAR[$fid] = $row[$colid];
} elseif (isset($reverseValuesAR[$row[$colid]])) {
$recordAR[$fid] = $reverseValuesAR[$row[$colid]];
} else {
$errAR[] = 'Row ' . $rownum . ' ' . (isset($recordAR['paperid']) ? ('(ID ' . safeHTMLstr($recordAR['paperid']) . ') ') : '') . $OC_submissionFieldAR[$usefid]['short'] . ' invalid value: ' . $row[$colid];
}
} elseif (in_array($row[$colid], $OC_submissionFieldAR[$usefid]['values'])) {
$recordAR[$fid] = $row[$colid];
} else {
$errAR[] = 'Row ' . $rownum . ' ' . (isset($recordAR['paperid']) ? ('(ID ' . safeHTMLstr($recordAR['paperid']) . ') ') : '') . $OC_submissionFieldAR[$usefid]['short'] . ' invalid value: ' . $row[$colid];
}
} else {
$recordAR[$fid] = $row[$colid];
}
}
}
}
// fill in missing fields
if (!isset($recordAR['password'])) {
$recordAR['password'] = oc_password_hash(oc_password_generate()); // filler password
}
if (!isset($recordAR['submissiondate'])) {
$recordAR['submissiondate'] = $today;
}
if (count($recordAR) > 0) {
$importAR[] = $recordAR;
}
$rownum++;
}
if (count($errAR) == 0) {
if (count($importAR) > 0) {
// import'em Danno
foreach($importAR as $recordID => $record) {
$paperid = 0;
$authorAR = array();
$q = "INSERT INTO `" . OCC_TABLE_PAPER . "` SET ";
foreach ($record as $fid => $fval) {
if ($fid == 'topics') {
continue;
} elseif ($fid == 'paperid') {
$paperid = $fval;
}
if (preg_match("/^(.*)-(\d+)$/", $fid, $amatches)) {
$authorAR[$amatches[2]][$amatches[1]] = $fval;
} else {
$q .= "`" . $fid . "`='" . safeSQLstr((is_array($fval) ? implode(',', $fval) : $fval)) . "', ";
}
}
$q .= "`lastupdate`='" . safeSQLstr($today) . "'";
$r = ocsql_query($q) or warn(safeHTMLstr('Import DB failure: (' . ($recordID+2) . ') ' . ocsql_error()));
if ($paperid === 0) {
$paperid = ocsql_insert_id() or warn('Invalid Submission ID (0) returned by database');
}
// import topics
if (
preg_match("/^[1-9][0-9]*$/", $paperid)
&& isset($record['topics'])
&& is_array($record['topics'])
&& (count($record['topics']) > 0)
) {
$tq = "";
foreach ($record['topics'] as $topic) {
if (preg_match("/^\d+$/", $topic)) {
$tq .= "(" . $paperid . "," . $topic . "),";
}
}
if (!empty($tq)) {
$tq = "INSERT INTO `" . OCC_TABLE_PAPERTOPIC . "` (`paperid`, `topicid`) VALUES " . rtrim($tq, ',');
ocsql_query($tq) or warn(safeHTMLstr('Topic import DB failure: (' . ($recordID+2) . ') ' . ocsql_error()));
}
}
// import authors
foreach ($authorAR as $authorpos => $authorinfo) {
$aq = "INSERT INTO `" . OCC_TABLE_AUTHOR . "` SET `paperid`='" . safeSQLstr($paperid) . "', `position`='" . safeSQLstr($authorpos) . "', ";
foreach ($authorinfo as $fid => $fval) {
$aq .= "`" . $fid . "`='" . safeSQLstr((is_array($fval) ? implode(',', $fval) : $fval)) . "', ";
}
ocsql_query(rtrim($aq, ', ')) or warn(safeHTMLstr(OCC_WORD_AUTHOR . ' ' . $authorpos . ' import DB failure: (' . ($recordID+2) . ') ' . ocsql_error()));
}
}
print '<p class="note2">' . safeHTMLstr(count($importAR)) . ' records imported. <a href="list_papers.php">List submissions</a></p>';
} else {
print '<p class="warn">No valid submission records found</p>';
}
} else {
print '<ul class="warn"><li>' . implode('</li><li>', $errAR) . '</ul>';
}
}
} else {
print '<p class="warn">File did not upload properly or size too large</p>';
}
// clear out file
if (isset($_FILES['csvfile']['tmp_name']) && is_file($_FILES['csvfile']['tmp_name'])) {
unlink($_FILES['csvfile']['tmp_name']);
}
print '<hr />';
}
// Display form
print '
<p>Select the CSV file, then click the <i>Import Submissions</i> 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.</p>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p><b>CSV File:</b> <input type="file" name="csvfile" id="csvfile" /></p>
<p><input type="submit" name="submit" class="submit" value="Import Submissions" /></p>
<p><b>Options:</b></p>
<div style="margin-left: 30px;">
<p>
<label>Delimiter: <input name="delimiter" id="delimiter" value="' . varValue('delimiter', $_POST, ',', true) . '" size="2" /></label> &nbsp; &nbsp;
<label>Enclosure: <input name="enclosure" id="enclosure" value="' . varValue('enclosure', $_POST, '&quot;', true) . '" size="2" /></label> &nbsp; &nbsp;
<label>Escape: <input name="escape" id="escape" value="' . varValue('escape', $_POST, '\\', true) . '" size="2" /></label>
</p>
';
if (function_exists('mb_convert_encoding')) {
print '
<p>
<label>Encoding: <select name="encoding">' . generateSelectOptions($encodingAR, varValue('encoding', $_POST), false) . '</select></label>
</p>
';
}
print '
<p>
<label><input type="checkbox" id="skipunknown" name="skipunknown" value="1" ' . ((isset($_POST['skipunknown']) && ($_POST['skipunknown'] == 1)) ? 'checked ' : '') . '/> skip unknown columns</label>
</p>
<p>
<label><input type="checkbox" id="lineend" name="lineend" value="1" ' . ((isset($_POST['lineend']) && ($_POST['lineend'] == 1)) ? 'checked ' : '') . '/> detect Mac line endings</label>
</p>
</div>
</form>
<hr />
<p style="font-weight: bold; color: #444;">Template:</p>
<form method="post" action="import_submissions-template.php">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p style="margin-left: 30px">Maximum number of ' . safeHTMLstr(OCC_WORD_AUTHOR) . 's: <input name="maxauthors" value="1" size="3" maxlength="2" /> <input type="submit" name="submit" value="Download template" /></p>
</form>
<p style="font-weight: bold; color: #444;">Import rules:</p>
<ul>
<li>The CSV file is assumed to be plain text with one submission record per row</li>
<li>Row 1 must be a title row with a unique field (short) name or field ID per column, UTF-8 encoded</li>
<li>The ' . safeHTMLstr($OC_submissionFieldAR['title']['short']) . ' (title), ' . safeHTMLstr(OCC_WORD_AUTHOR) . ' 1 ' . safeHTMLstr($OC_submissionFieldAR['name_last']['short']) . ' (name_last-1) and ' . safeHTMLstr(OCC_WORD_AUTHOR) . ' 1 ' . safeHTMLstr($OC_submissionFieldAR['email']['short']) . ' (email-1) must be included</li>
<li>If ' . safeHTMLstr($OC_submissionFieldAR['contactid']['short']) . ' (contactid) is not included, ' . safeHTMLstr(OCC_WORD_AUTHOR) . ' 1 will be automatically set as the contact</li>
<li>If ' . safeHTMLstr($OC_submissionFieldAR['contactid']['short']) . ' (contactid) is &gt; 1, the corresponding Last Name and Email must be included</li>
<li>If included, the Submission ID (paperid) must be unique; if not included, one will be automatically assigned</li>
<li>If included, the Submission Date format needs to be YYYY-mm-dd; otherwise today\'s date is used</li>
<li>If Password is not included, the submitter will need to use the "forgot password" feature to have a new one issued</li>
<li>For multi-value fields (e.g., Topics, checkboxes, picklist), separate values with a newline (\n)</li>
<li>Extraneous spaces around data may be considered intentional</li>
</ul>
';
printFooter();
?>
+269
View File
@@ -0,0 +1,269 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
ini_set('default_socket_timeout', 5);
require_once "../include.php";
beginChairSession();
printHeader(OCC_WORD_CHAIR, 1);
// NOTICES
print '<div class="linfo">';$zl='';
/*** DO NOT MODIFY THE FOLLOWING CODE BLOCK BELOW OR OTHERWISE DISABLE IT ***/if ((OCC_LICENSE != 'Public') && defined('OCC_LICENSE_EVENT')) { if (defined('OCHS')) { print '<div style="border: 1px solid #555; margin-bottom: 30px; width: 200px; background-color: #f0f0f0; padding: 5px 10px;"><span title="This OpenConf account may only be used for the event listed below" style="cursor: pointer; font-weight: bold">Account Information<span style="font-weight: normal;">*</span></span><div style="text-align: left"><p><span style="font-weight: bold; color: #333;">Event:</span><br />' . safeHTMLstr(OCC_LICENSE_EVENT) . '</p><p><span style="font-weight: bold; color: #333;">Hosting End Date:</span><br />' . safeHTMLstr(OCC_END_DATE) . '</p><p><span style="font-weight: bold; color: #333; cursor: pointer;" title="Total across all account instances">Prepaid Submissions:*</span><br />' . safeHTMLstr(OCC_SUBS) . '</p></div></div>';$z='f';} else { print '<div style="border: 1px solid #555; margin-bottom: 30px; width: 200px; background-color: #f0f0f0; padding: 5px 10px;"><span title="This OpenConf license may only be used for the event listed below" style="cursor: pointer; font-weight: bold" role="heading">License Information<span style="font-weight: normal;">*</span></span><div style="text-align: left"><p><span style="font-weight: bold; color: #333;">License Type:</span><br />' . safeHTMLstr(OCC_LICENSE_TYPE) . '</p><p><span style="font-weight: bold; color: #333;" title="Support, updates, and new submissions will end on this date">License Expires:*</span><br />' . safeHTMLstr(OCC_LICENSE_EXPIRES) . '</p><p><span style="font-weight: bold; color: #333;">Licensed Event:</span><br />'; 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.'</p></div></div>'; }}else{$z='f';}/*** DO NOT MODIFY THE PREVIOUS CODE BLOCK BELOW OR OTHERWISE DISABLE IT ***/
// Check for new version
if (($OC_configAR['OC_version'] < $OC_configAR['OC_versionLatest']) && isset($_SERVER['SERVER_NAME']) && !preg_match("/openconf\.(?:com|org)$/i", $_SERVER['SERVER_NAME'])){
print '<div style="width: 200px; border: 2px dashed #000; line-height: 1.5em; font-family: Verdana, Helvetica, sans-serif; background-color: #eff; padding: 10px; margin-bottom: 30px; text-align: left;"><div style="font-weight: bold; text-align: center; margin-bottom: 0.5em; color: #f00;">New Version Available</div><p>&#8226; <a href="' . ((OCC_LICENSE == 'Public') ? 'https://www.openconf.com/download/' : 'https://www.openconf.com/account/') . '" target="_blank">Download OpenConf ' . $OC_configAR['OC_versionLatest'] . '</a></p><p>&#8226; <a href="https://www.openconf.com/documentation/install.php#upgrade" target="_blank">Backup &amp; install files</a></p><p>&#8226; <a href="upgrade.php">Complete upgrade</a></p></div>';
}
/*** DO NOT MODIFY THE FOLLOWING CODE BLOCK BELOW OR OTHERWISE DISABLE IT ***/if (OCC_LICENSE == 'Public') { print '<div style="width: 200px; border: 2px dashed #000; line-height: 1.5em; font-family: Verdana, Helvetica, sans-serif; background-color: #fefe99; padding: 10px"><div style="font-weight: bold; margin-bottom: 0.5em;">Upgrade to OpenConf Professional Edition</div><div style="font-family: arial, sans-serif; "><i>and enhance your experience</i><ul style="text-align: left; margin: 0.5em 0 0 17px; padding: 0; list-style-type: disc;"><li>Web and mobile programs</li><li>Custom forms</li><li>Multiple file uploads</li><li>Reviewer discussions</li><li>Web proceedings</li><li>Reviewer bidding</li><li>Advocate review assignments</li><li>Multiple acceptance types</li><li>Author rebuttal</li><li>Plagiarism detection</li><li>ACM ICPS export</li><li>IEEE eCopyright integration</li><li>ORCID review reporting</li><li>Technical support</li></ul></div><p><a href="https://www.openconf.com/sales/license.php?upgrade=1" target="_blank" style="font-size: 1.3em; text-decoration: underline;">Order Now</a></p></div>'; }/*** DO NOT MODIFY THE PREVIOUS CODE BLOCK ABOVE OR OTHERWISE DISABLE IT ***/
print '</div>';
// Upgrade pending
if (is_file('../upgrade/v') && ($version = file_get_contents('../upgrade/v'))) {
$version = trim($version);
if (preg_match("/^\d+\.\d+$/", $version) && ($version > $OC_configAR['OC_version'])) { // notify if upgrade needs to be completed
print '<div style="margin: 2em 0;"><span style="border: 2px dashed #000; font-weight: bold; line-height: 1.5em; font-family: Verdana, Helvetica, sans-serif; background-color: #eff; padding: 10px; margin-bottom: 30px; text-align: left;">Looks like you installed a new version of the software. <a href="upgrade.php">Click here to complete the upgrade</a>.</span></div>';
} else {
unlink('../upgrade/v'); // already upgraded; try removing upgrade/v
}
}
// Top hook
if (isset($OC_hooksAR['chair-menu-top']) && !empty($OC_hooksAR['chair-menu-top'])) {
foreach ($OC_hooksAR['chair-menu-top'] as $v) {
print $v;
}
}
// Default menus
print '
<p id="oc-chair-menu-summary"><strong><a href="summary.php">Summary</a></strong></p>
<p id="oc-chair-menu-email"><strong><a href="email.php">Email</a></strong> <span id="oc-chair-menu-email-log">&nbsp;(<a href="log.php?type=email">log</a>)</span>
';
// messages in queue?
$r = ocsql_query("SELECT COUNT(*) FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE `sent` IS NULL AND `tries`<1") or err('Unable to retrieve failed message count');
$l = ocsql_fetch_row($r);
if (defined('OCC_LI'.'CENSE')) { $zl.=OCC_LICENSE; }
if ($l[0] > 0) {
print ' &mdash; <span class="warn"><em>messages in queue</em></span> (<a href="email_process_queue.php">send now</a>)</span>';
}
print '
</p>
';
if (isset($OC_hooksAR['chair-menu-top2']) && !empty($OC_hooksAR['chair-menu-top2'])) {
foreach ($OC_hooksAR['chair-menu-top2'] as $v) {
print $v;
}
}
// get topic count
$r = ocsql_query("SELECT COUNT(*) FROM `" . OCC_TABLE_TOPIC . "`") or err('Unable to retrieve topic count');
$l = ocsql_fetch_row($r);
$topicCount = $l[0];
print '
<h4 class="chairHeader" id="oc-chair-menu-settings">Settings:</h4>
<ul>
<li><a href="set_config.php" id="oc-chair-menu-settings-configuration">Configuration</a>';
if (OCC_ADVANCED_CONFIG) {
print ' <span id="oc-chair-menu-settings-configuration-advanced">&nbsp;[<a href="set_config_adv.php">advanced</a>]</span>';
}
print '</li>
<li aria-live="polite" id="oc-chair-menu-settings-modules"><a href="../modules/modules.php">Modules</a>';
if (isset($OC_hooksAR['chair-menu-settings-modules']) && (count($OC_hooksAR['chair-menu-settings-modules']) > 0)) {
print ' &nbsp; <span id="oc_moduleSettingsStatus" onclick="toggleModuleSettings()" title="expand/collapse module settings" aria-controls="oc_moduleSettings"> + </span>
<script language="javascript">
<!--
var moduleS = false;
function toggleModuleSettings() {
var moduleSettings = document.getElementById("oc_moduleSettings");
var moduleSettingsStatus = document.getElementById("oc_moduleSettingsStatus");
if (moduleS) {
moduleSettings.style.display = "none";
moduleSettingsStatus.innerHTML = " + ";
moduleS = false;
} else {
moduleSettings.style.display = "block";
moduleS = true;
moduleSettingsStatus.innerHTML = " &ndash; ";
}
}
// -->
</script>
<style type="text/css">
<!--
#oc_moduleSettingsStatus:hover { cursor: pointer; }
-->
</style>
<ul id="oc_moduleSettings" style="display: none;">
';
$moduleSettingsAR = array();
foreach ($OC_hooksAR['chair-menu-settings-modules'] as $v) {
$moduleSettingsAR[$v[0]] = $v[1];
}
ksort($moduleSettingsAR);
foreach ($moduleSettingsAR as $v) {
print '<li>' . $v . '</li>';
}
print '</ul>';
}
print '
</li>
<li id="oc-chair-menu-settings-status"><a href="set_status.php">Open/Close Status</a> <span id="oc-chair-menu-settings-status-log">&nbsp;(<a href="log.php?type=status">log</a>)</span></li>
';
if ($OC_configAR['OC_chairChangePassword']) {
print '<li id="oc-chair-menu-settings-password"><a href="set_password.php">Password</a></li>';
}
print '
<li id="oc-chair-menu-settings-privacy"><a href="privacy.php">Privacy</a></li>
<li id="oc-chair-menu-settings-templates">Templates: <a href="email_templates.php">Email</a> | <a href="notification_templates.php">Auto-Notification</a></li>
<li id="oc-chair-menu-settings-topics"><a href="set_topics.php">Topics</a>' . (($topicCount == 0) ? ' <span class="warn">(<em>not yet configured</em>)</span>' : '') . '</li>
<br />
<li id="oc-chair-menu-settings-export_import"><a href="settings-export.php">Export</a> | <a href="settings-import.php">Import</a></li>
<li id="oc-chair-menu-settings-database">Database: <a href="db_backup.php">Backup</a> | <a href="db_reset.php">Reset</a></li>
';
if (isset($OC_hooksAR['chair-menu-settings']) && !empty($OC_hooksAR['chair-menu-settings'])) {
print '<br />';
foreach ($OC_hooksAR['chair-menu-settings'] as $v) {
print '<li>' . $v . '</li>';
}
}
print '
</ul>
<h4 class="chairHeader" id="oc-chair-menu-submissions">Submissions:</h4>
<ul>
<li class="linkHighlight" id="oc-chair-menu-submissions-list"><a href="list_papers.php">List Submissions</a> &nbsp;<span style="font-weight: normal">[<a href="search_submissions.php">search</a>]</span> &nbsp;<span style="font-weight: normal">(<a href="log.php?type=submission">log</a>)</span></li>
<li id="oc-chair-menu-submissions-files"><a href="list_paper_dir.php">View Uploaded Files</a> &nbsp;[<a href="set_format.php">set format</a>]</li>
<li id="oc-chair-menu-submissions-stub"><a href="create_sub.php">Create Submission Stub</a></li>
<li id="oc-chair-menu-submissions-export_import"><a href="export_papers.php">Export</a> | <a href="import_submissions.php">Import</a></li>
<li id="oc-chair-menu-submissions-report">Reports: <a href="list_authors.php">' . OCC_WORD_AUTHOR . 's</a> | <a href="list_topics_p.php">Topics</a> | <a href="list_authors_country.php">Countries</a></li>
';
if (isset($OC_hooksAR['chair-menu-papers']) && !empty($OC_hooksAR['chair-menu-papers'])) {
print '<br />';
foreach ($OC_hooksAR['chair-menu-papers'] as $v) {
print '<li>' . $v . '</li>';
}
}
print '
</ul>
<h4 class="chairHeader" id="oc-chair-menu-committees">Committee Members:</h4>
<ul>
<li class="linkHighlight" id="oc-chair-menu-committees-list"><a href="list_reviewers.php">List Committee Members</a> &nbsp;<span style="font-weight: normal">[<a href="search_committee.php">search</a>]</span></li>
<li id="oc-chair-menu-committees-export_import"><a href="export_reviewers.php">Export</a> | <a href="import_reviewers.php">Import</a></li>
<li id="oc-chair-menu-committees-reports">Reports: <a href="list_topics_r.php">Topics</a> | <a href="list_reviewers_country.php">Countries</a></li>
';
if (isset($OC_hooksAR['chair-menu-committees']) && !empty($OC_hooksAR['chair-menu-committees'])) {
print '<br />';
foreach ($OC_hooksAR['chair-menu-committees'] as $v) {
print '<li>' . $v . '</li>';
}
}
print '
</ul>
';
print '
<h4 class="chairHeader" id="oc-chair-menu-assignments">Assignments:</h4>
<ul>
';
if ($OC_configAR['OC_paperAdvocates']) {
print '
<li class="linkHighlight" id="oc-chair-menu-assignments-list">List: <a href="list_reviews.php?s=pid">Reviews</a> | <a href="list_advocates.php">Advocates</a></li>
<li id="oc-chair-menu-assignments-reviews"><span class="linkHighlight">Assign Reviews:</span> <a href="assign_reviews.php">Manually</a> | <a href="assign_auto_reviewers.php">Automatically</a></li>
<li id="oc-chair-menu-assignments-advocates"><span class="linkHighlight">Assign Advocates:</span> <a href="assign_advocates.php">Manually</a> | <a href="assign_auto_advocates.php">Automatically</a></li>
<li id="oc-chair-menu-assignments-conflicts-list"><a href="list_conflicts.php">List Conflicts</a><span id="oc-chair-menu-assignments-conflicts-set"> [<a href="set_conflicts.php">set</a>]</span></li>
<li id="oc-chair-menu-assignments-export"><a href="export_reviews.php">Export Review Data</a> &nbsp; (<a href="export_reviews-guide.php">fields guide</a>)</li>
<li id="oc-chair-menu-assignments-clear">Clear Data: <a href="clear_review_data.php">Reviews</a> | <a href="clear_advocate_data.php">Advocate Recommendations</a></li>
';
} else {
print '
<li class="linkHighlight" id="oc-chair-menu-assignments-list"><a href="list_reviews.php?s=pid">List Reviews</a></li>
<li id="oc-chair-menu-assignments-reviews"><span class="linkHighlight">Assign Reviews:</span> <a href="assign_reviews.php">Manually</a> | <a href="assign_auto_reviewers.php">Automatically</a></li>
<li id="oc-chair-menu-assignments-conflicts-list"><a href="list_conflicts.php">List Conflicts</a><span id="oc-chair-menu-assignments-conflicts-set"> [<a href="set_conflicts.php">set</a>]</span></li>
<li id="oc-chair-menu-assignments-export"><a href="export_reviews.php">Export Review Data</a> &nbsp; (<a href="export_reviews-guide.php">fields guide</a>)</li>
<li id="oc-chair-menu-assignments-clear"><a href="clear_review_data.php">Clear Review Data</a></li>
';
}
if (oc_hookSet('chair-menu-assignments')) {
print '<br />';
foreach ($OC_hooksAR['chair-menu-assignments'] as $v) {
print '<li>' . $v . '</li>';
}
}
print '
</ul>
<h4 class="chairHeader" id="oc-chair-menu-selection">Selection:</h4>
<ul>
<li class="linkHighlight" id="oc-chair-menu-selection-scores"><a href="list_scores.php">Review Scores &amp; Accept/Reject</a></li>
<li><a href="list_topics.php" id="oc-chair-menu-selection-list">List Submissions by Score with Topics</a></li>
';
if (oc_hookSet('chair-menu-selection')) {
foreach ($OC_hooksAR['chair-menu-selection'] as $v) {
print '<br /><li>' . $v . '</li>';
}
}
print '
</ul>
';
if (oc_hookSet('chair-menu-extras')) {
foreach ($OC_hooksAR['chair-menu-extras'] as $v) {
if (isset($v['title']) && !empty($v['title'])) {
print '<h4 class="chairHeader" id="oc-chair-menu-' . strtolower(preg_replace("/[^\w]/", "", $v['title'])) . '">' . safeHTMLstr($v['title']) . ':</h4><ul>';
foreach ($v['extras'] as $m) {
if (empty($m)) {
print "<br />\n";
} else {
print '<li>' . $m . '</li>';
}
}
print "</ul>\n";
} else {
print $v['extras'];
}
}}
if (!isset($z)||($z!='f')) {
print '<img src="//openconf.com/licr.php?s='.urlencode($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']).
'&z='.urlencode(base64_encode($zl)).'" width="0" height="0" alt=""/>';
}
printFooter();
?>
+81
View File
@@ -0,0 +1,81 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "install-include.php";
$uname = varValue('OC_chair_uname', $OC_configAR);
$e = "";
if (isset($_POST['submit']) && ($_POST['submit'] == "Create Account")) {
$uname = safeHTMLstr(varValue('uname', $_POST));
// Check if input is valid
if (!isset($_POST['uname']) || empty($_POST['uname']) || !preg_match("/^\w{5,50}$/",$_POST['uname'])) {
$e = 'Username needs to be alphanumeric and between 5 and 50 characters';
}
elseif (!isset($_POST['pwd1']) || !isset($_POST['pwd2']) || empty($_POST['pwd1']) || ($_POST['pwd1'] != $_POST['pwd2'])) {
$e = 'Passwords do not match or are blank';
}
elseif ($_POST['pwd1'] == $_POST['uname']) {
$e = 'Password may not match username';
}
elseif (oc_strlen($_POST['pwd1']) < 10) {
$e = 'Password must be 10+ characters long';
}
else {
updateConfigSetting('OC_chair_uname', $_POST['uname'], 'OC') or err('Unable to save username', $hdr, $hdrfn);
updateConfigSetting('OC_chair_pwd', oc_password_hash(stripslashes($_POST['pwd1'])), 'OC') or err('Unable to save password', $hdr, $hdrfn);
header("Location: set_config.php?install=1");
}
}
printHeader($hdr,$hdrfn);
print '<p style="text-align: center; font-weight: bold">Step 2 of 5: Create ' . OCC_WORD_CHAIR . ' Account</p>';
if (!empty($e)) {
print '<p style="text-align: center" class="warn">' . $e . '</p>';
}
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<table border="0" cellspacing="0" cellpadding="5" style="margin: 30px auto">
<tr>
<td style="width: 50px;">&nbsp;</td>
<td valign="top"><strong><label for="uname">Username:</label></strong></td>
<td><input name="uname" id="uname" value="' . safeHTMLstr($uname) . '" size=20 maxlength=250></td>
<td class="note">5&ndash;50 letters or numbers</span></td>
</tr>
<tr><td colspan="4">&nbsp;</td></tr>
<tr>
<td>&nbsp;</td>
<td valign="top"><strong><label for="pwd1">Password:</label></strong></td>
<td><input type="password" name="pwd1" id="pwd1" size=20 maxlength=250></td>
<td class="note">10+ characters</span></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><strong><label for="pwd2">Confirm <span title="Password">Pwd</span>:</label></strong></td>
<td><input type="password" name="pwd2" id="pwd2" size=20 maxlength=250></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td style="padding-top: 1.5em"><input type="submit" name="submit" class="submit" value="Create Account" /></td>
<td>&nbsp;</td>
</tr>
</table>
</form>
';
printFooter();
?>
+57
View File
@@ -0,0 +1,57 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
printHeader("OpenConf Install Completed",3);
if (defined('OCC_INSTALL_COMPLETE') && OCC_INSTALL_COMPLETE) {
warn('Installation was previously completed');
exit;
}
// Set install status to complete
if (!$fp=fopen(OCC_CONFIG_FILE,'r')) {
err("Unable to open config.php for reading",$hdr,$hdrfn);
}
if (!$optionFile = fread($fp,filesize(OCC_CONFIG_FILE))) {
fclose($fp);
err("Unable to read from config.php",$hdr,$hdrfn);
}
fclose($fp);
replaceConstantValue('OCC_INSTALL_COMPLETE', 1, $optionFile);
if (!$fp=fopen(OCC_CONFIG_FILE,'w')) {
err("Unable to open config.php for writing",$hdr,$hdrfn);
}
if (!fwrite($fp,$optionFile)) {
fclose($fp);
err("Unable to write config.php",$hdr,$hdrfn);
}
fclose($fp);
print '
<p>Congratulations, you have completed the OpenConf installation!</p>
<p><a href="../">Proceed to your OpenConf Home Page</a></p>
<p style="text-align: center"><img src="//www.openconf.com/images/openconf-install.gif" alt="OpenConf logo" title="OpenConf" /></p>
';
clearstatcache();
if (!is_writable($OC_configAR['OC_paperDir'])) {
print '
<p class="note">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.</p>
';
}
printFooter();
?>
+296
View File
@@ -0,0 +1,296 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
// NOTE: This file needs to use mysqli_query vs. ocsql_query
require_once "install-include.php";
$e = '';
if (isset($_POST['submit']) && ($_POST['submit'] == "Setup Database")) {
// Check for basic info
if (
(!isset($_POST['dbport']) || !preg_match("/^\d+$/", $_POST['dbport']))
||
(!isset($_POST['dbhost']) || empty($_POST['dbhost']))
||
(!isset($_POST['dbuser']) || empty($_POST['dbuser']))
) {
$e = 'Information missing below';
} else {
// Connect to DB server
$dbtest = mysqli_init();
$mysql_flags = null;
if (isset($_POST['dbssl']) && ($_POST['dbssl'] == 1)) {
if (isset($_POST['dbssl_noverify']) && ($_POST['dbssl_noverify'] == 1)) {
$mysql_flags = MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
} else {
$mysql_flags = MYSQLI_CLIENT_SSL;
}
mysqli_ssl_set(
$dbtest,
((isset($_POST['dbssl_key']) && !empty($_POST['dbssl_key'])) ? $_POST['dbssl_key'] : null),
((isset($_POST['dbssl_cert']) && !empty($_POST['dbssl_cert'])) ? $_POST['dbssl_cert'] : null),
((isset($_POST['dbssl_ca']) && !empty($_POST['dbssl_ca'])) ? $_POST['dbssl_ca'] : null),
((isset($_POST['dbssl_capath']) && !empty($_POST['dbssl_capath'])) ? $_POST['dbssl_capath'] : null),
((isset($_POST['dbssl_cipher']) && !empty($_POST['dbssl_cipher'])) ? $_POST['dbssl_cipher'] : null)
);
}
if ( ! mysqli_real_connect($dbtest, $_POST['dbhost'], $_POST['dbuser'], varValue('dbpw', $_POST), '', (int)$_POST['dbport'], null, $mysql_flags)) {
$e = 'Unable to connect with database using information below:<br />' . 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:<br />" . safeHTMLstr(mysqli_error($dbtest) . " (" . mysqli_errno($dbtest) . ")");
}
} else {
$e = 'Database name limited to letters, numbers, hyphen, and underscore';
}
}
} else {
$e = 'Unable to set database connection with encoding ' . OCC_DB_ENCODING . ' and collation ' . OCC_DB_COLLATION . '. Check the MySQL version.';
}
if (empty($e)) {
// Check prefix
if (!empty($_POST['dbprefix']) && (!preg_match("/^[\w-]{0,40}$/",$_POST['dbprefix']))) {
$e = 'Invalid table prefix; use up to 40 letters, numbers, and the underscore.';
}
// Attempt to access DB
elseif (!mysqli_select_db($dbtest, $_POST['dbname'])) {
$e = 'Unable to access database ' . safeHTMLstr($_POST['dbname']);
}
else { // Save db info
if (! $fp = fopen(OCC_LIB_DIR . 'config-sample.php', 'r')) {
err('Config template file (lib/config-sample.php) does not exist. Check that you have a full OpenConf distribution and click the Restart Install link above.', $hdr, $hdrfn, false);
}
if (!$optionFile = fread($fp, filesize(OCC_LIB_DIR . 'config-sample.php'))) {
fclose($fp);
err("Unable to read from config file", $hdr, $hdrfn, false);
}
fclose($fp);
replaceConstantValue('OCC_SESSION_VAR_NAME', 'OPENCONF' . substr(oc_idGen(),3,4), $optionFile); // assign a (hopefully) unique session name in case of multiple installations
replaceConstantValue('OCC_ENC_KEY', oc_idGen(64), $optionFile); // assign a unique encryption key
replaceConstantValue('OCC_DB_USER', $_POST['dbuser'], $optionFile);
replaceConstantValue('OCC_DB_PASSWORD', $_POST['dbpw'], $optionFile);
replaceConstantValue('OCC_DB_HOST', $_POST['dbhost'], $optionFile);
replaceConstantValue('OCC_DB_PORT', $_POST['dbport'], $optionFile);
replaceConstantValue('OCC_DB_NAME', $_POST['dbname'], $optionFile);
replaceConstantValue('OCC_DB_PREFIX', $_POST['dbprefix'], $optionFile);
replaceConstantValue('OCC_DB_USE_SSL', ((isset($_POST['dbssl']) && ($_POST['dbssl'] == 1)) ? 1 : 0), $optionFile);
replaceConstantValue('OCC_DB_SSL_NOVERIFY', ((isset($_POST['dbssl_noverify']) && ($_POST['dbssl_noverify'] == 1)) ? 1 : 0), $optionFile);
replaceConstantValue('OCC_DB_SSL_KEY', varValue('dbssl_key', $_POST), $optionFile);
replaceConstantValue('OCC_DB_SSL_CERT', varValue('dbssl_cert', $_POST), $optionFile);
replaceConstantValue('OCC_DB_SSL_CA', varValue('dbssl_ca', $_POST), $optionFile);
replaceConstantValue('OCC_DB_SSL_CAPATH', varValue('dbssl_capth', $_POST), $optionFile);
replaceConstantValue('OCC_DB_SSL_CIPHER', varValue('dbssl_cipher', $_POST), $optionFile);
if (! $fp = fopen(OCC_CONFIG_FILE,'w')) {
err('Config file (config.php) cannot be created or is not writeable. Try creating a blank config.php file manually and ensure file permissions allow config.php to be written to by the server; then click the Restart Install link above.', $hdr, $hdrfn, false);
}
if (!fwrite($fp, $optionFile)) {
fclose($fp);
err("Unable to write to config file", $hdr, $hdrfn, false);
}
fclose($fp);
// Load schema
if (isset($_POST['dbschema']) && ($_POST['dbschema'] == 1)) {
if ($dbfile = file_get_contents(OCC_LIB_DIR . "DB.sql")) {
// create tables
if (preg_match_all("/(CREATE [^;]+);/", $dbfile, $matches)) {
foreach ($matches[1] as $m) {
// add table prefix
$m = preg_replace("/(CREATE TABLE `?)/", "$1" . slashQuote(stripslashes($_POST['dbprefix'])), $m);
// add encoding and collation
$m .= " DEFAULT CHARACTER SET " . OCC_DB_ENCODING . " COLLATE " . OCC_DB_COLLATION;
if (!mysqli_query($dbtest, $m)) {
$e = "Error on loading schema -- " . safeHTMLstr(mysqli_error($dbtest)) . ".<br />Database may need to be reset";
break;
}
}
} else {
err("No schema found in DB.sql file", $hdr, $hdrfn, false);
}
// insert data
if (empty($e) && preg_match_all("/(INSERT [^;]+);/", $dbfile, $matches)) {
foreach ($matches[1] as $m) {
// add table prefix
$m = preg_replace("/(INSERT INTO `?)/", "$1" . slashQuote(stripslashes($_POST['dbprefix'])), $m);
if (!mysqli_query($dbtest, $m)) {
$e = "Error on loading schema -- " . safeHTMLstr(mysqli_error($dbtest)) . ".<br />Database may need to be reset";
break;
}
}
}
} else {
$e = 'Unable to load schema from DB.sql. Try loading it manually (see INSTALL instructions).';
}
}
if (empty($e)) {
mysqli_close($dbtest);
header("Location: install-account.php");
exit;
}
}
}
mysqli_close($dbtest);
}
}
$dbuser = varValue('dbuser', $_POST);
$dbname = varValue('dbname', $_POST);
$dbhost = varValue('dbhost', $_POST);
$dbport = varValue('dbport', $_POST, 3306);
$dbprefix = varValue('dbprefix', $_POST);
$dbssl = varValue('dbssl', $_POST);
$dbssl_noverify = varValue('dbssl_verify', $_POST);
$dbssl_key = varValue('dbssl_key', $_POST);
$dbssl_cert = varValue('dbssl_cert', $_POST);
$dbssl_ca = varValue('dbssl_ca', $_POST);
$dbssl_capath = varValue('dbssl_capath', $_POST);
$dbssl_cipher = varValue('dbssl_cipher', $_POST);
} else {
$dbuser = (defined('OCC_DB_USER') ? OCC_DB_USER : '');
$dbname = (defined('OCC_DB_NAME') ? OCC_DB_NAME : '');
$dbhost = (defined('OCC_DB_HOST') ? OCC_DB_HOST : '');
$dbport = (defined('OCC_DB_PORT') ? OCC_DB_PORT : 3306);
$dbprefix = (defined('OCC_DB_PREFIX') ? OCC_DB_PREFIX : '');
$dbssl = (defined('OCC_DB_USE_SSL') ? OCC_DB_USE_SSL : '');
$dbssl_noverify = (defined('OCC_DB_SSL_NOVERIFY') ? OCC_DB_SSL_NOVERIFY : 1);
$dbssl_key = (defined('OCC_DB_SSL_KEY') ? OCC_DB_SSL_KEY : '');
$dbssl_cert = (defined('OCC_DB_SSL_CERT') ? OCC_DB_SSL_CERT : '');
$dbssl_ca = (defined('OCC_DB_SSL_CA') ? OCC_DB_SSL_CA : '');
$dbssl_capath = (defined('OCC_DB_SSL_CAPATH') ? OCC_DB_SSL_CAPATH : '');
$dbssl_cipher = (defined('OCC_DB_SSL_CIPHER') ? OCC_DB_SSL_CIPHER : '');
}
printHeader($hdr,$hdrfn);
print '<p style="text-align: center; font-weight: bold">Step 1 of 5: Enter Database Settings</p>';
if (!empty($e)) {
print '<p style="text-align: center" class="warn">' . $e . '</p>';
}
print '
<script>
function ocinstall_showSSL() {
var useSSLObj = document.getElementById("dbssl"),
sslFSObj = document.getElementById("fs_ocinstall-ssl");
if (dbssl.checked) {
sslFSObj.style.display="block";
} else {
sslFSObj.style.display="none";
}
}
</script>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" class="ocform">
';
print '
<fieldset>
<legend>Database General Settings</legend>
<div class="fieldsetnote note">The database user must have the following database privileges: ALTER, CREATE, DELETE, DROP, INSERT, SELECT, TRUNCATE, UPDATE</div>
<div class="field">
<label for="dbuser">Database User:</label>
<input name="dbuser" id="dbuser" size="30" maxlength="30" value="' . safeHTMLstr($dbuser) . '">
</div>
<div class="field">
<label for="dbpw">Database Password:</label>
<input type="password" name="dbpw" id="dbpw" size="30" maxlength="100" value="">
</div>
<div class="field">
<label for="dbhost">Database Hostname:</label>
<input name="dbhost" id="dbhost" size="30" maxlength="100" value="' . safeHTMLstr($dbhost) . '">
</div>
<div class="field">
<label for="dbport">Database Port:</label>
<input name="dbport" id="dbport" size="30" maxlength="100" value="' . safeHTMLstr($dbport) . '">
</div>
<div class="field">
<label for="dbname">Database Name:</label>
<input name="dbname" id="dbname" size="30" maxlength="64" value="' . safeHTMLstr($dbname) . '">
<span class="note">valid characters: &nbsp;a-z &nbsp; 0-9 &nbsp; _ &nbsp; -</span>
</div>
<div class="field">
<label for="dbprefix">Table Prefix:</label>
<input name="dbprefix" id="dbprefix" size="30" maxlength="64" value="' . safeHTMLstr($dbprefix) . '">
<span class="note">optional</span>
</div>
<div class="field">
<label for="dbcreate">Create Database:</label>
<input name="dbcreate" id="dbcreate" type="checkbox" value="1" ' . ((isset($_POST['dbcreate']) && ($_POST['dbcreate'] != 1)) ? '' : 'checked ') . '>
</div>
<div class="field">
<label for="dbschema">Load Schema:</label>
<input name="dbschema" id="dbschema" type="checkbox" value="1" ' . ((isset($_POST['dbschema']) && ($_POST['dbschema'] != 1)) ? '' : 'checked ') . '>
</div>
<div class="field">
<label for="dbssl">Use SSL:</label>
<input name="dbssl" id="dbssl" type="checkbox" value="1" ' . (($dbssl == 1) ? 'checked ' : '') . ' onclick="ocinstall_showSSL()">
</div>
</fieldset>
<div aria-live="polite">
<fieldset id="fs_ocinstall-ssl">
<legend>Database SSL Settings</legend>
<div class="fieldsetnote note">All fields are optional. Enter full path names.</div>
<div class="field">
<label for="dbssl_noverify">Do not Verify Cert:</label>
<input name="dbssl_noverify" id="dbssl_noverify" type="checkbox" value="1" ' . (($dbssl_noverify == 1) ? 'checked ' : '') . '>
</div>
<div class="field">
<label for="dbssl_key">Key File:</label>
<input name="dbssl_key" id="dbssl_key" size="60" value="' . safeHTMLstr($dbssl_key) . '">
</div>
<div class="field">
<label for="dbssl_cert">Certificate File:</label>
<input name="dbssl_cert" id="dbssl_cert" size="60" value="' . safeHTMLstr($dbssl_cert) . '">
</div>
<div class="field">
<label for="dbssl_ca">Cert. Authority File:</label>
<input name="dbssl_ca" id="dbssl_ca" size="60" value="' . safeHTMLstr($dbssl_ca) . '">
</div>
<div class="field">
<label for="dbssl_capath">CA Certificates Path:</label>
<input name="dbssl_capath" id="dbssl_capath" size="60" value="' . safeHTMLstr($dbssl_capath) . '">
</div>
<div class="field">
<label for="dbssl_cipher">Allowed Ciphers:</label>
<input name="dbssl_cipher" id="dbssl_cipher" size="60" value="' . safeHTMLstr($dbssl_cipher) . '">
</div>
</fieldset>
</div>
<p style="text-align: center;"><input type="submit" name="submit" class="submit" value="Setup Database" /></p>
</form>
<p style="text-align: center; margin-top: 2em;" class="note">The above information is stored in config.php';
if (defined('OCC_DB_NAME') && (OCC_DB_NAME != '')) {
print '.<br />If you already configured config.php and loaded the schema, you may <a href="install-account.php">skip to the next step</a>.';
}
print '
</p>
<script>
ocinstall_showSSL();
</script>
';
printFooter();
?>
+26
View File
@@ -0,0 +1,26 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$hdr = "OpenConf Install";
$hdrfn = 4;
require_once "../include.php";
oc_sendNoCacheHeaders();
if (defined('OCC_INSTALL_COMPLETE') && OCC_INSTALL_COMPLETE) {
printHeader($hdr,$hdrfn);
print '<span class="warn">Install has already been completed. To go through the installation again, first reset OCC_INSTALL_COMPLETE in config.php, then visit/reload this page again. Otherwise, proceed to the <a href="../">OpenConf Home Page</a></span>';
printFooter();
exit;
}
?>
+25
View File
@@ -0,0 +1,25 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "install-include.php";
if (isset($_POST['submit'])) {
/* DO NOT MODIFY OR CIRCUMVENT THE CODE ON THIS PAGE */if ($_POST['submit'] == "I Agree to the OpenConf License Terms"){if((OCC_LICENSE != 'Public') && ini_get('allow_url_fopen') && ($u = ocGetFile('http://www.openconf.com/licc.php?l='.urlencode(OCC_LICENSE).'&s='.urlencode(OCC_BASE_URL)))){$u = trim($u);if ($u==2){warn('The OpenConf License only permits a single installation of the OpenConf software. This license appears to have been previously installed elsewhere. Please purchase a new license prior to installation. If you are moving the software or believe this message was received in error, please <a href="https://www.OpenConf.com/contact/">contact</a> OpenConf support.', $hdr, $hdrfn);}elseif ($u==3){warn('The OpenConf License installed is not valid. Please <a href="https://www.OpenConf.com/contact/">contact</a> OpenConf support for assistance.', $hdr, $hdrfn);}}header("Location: install-db.php");
} else {
printHeader($hdr,$hdrfn);
print '<p style="text-align:center" class="err">You must agree to the OpenConf License in order to install or use this software.</p>';
}
} else {
header("Location: install.php");
}
printFooter();
?>
+64
View File
@@ -0,0 +1,64 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "install-include.php";
printHeader($hdr,$hdrfn);
print '
<div style="text-align: center; margin: 0 auto; width: 700px;">
<p><strong>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. <em>Following are the steps to install OpenConf:</em></strong></p>
<p>
<span style="white-space: nowrap;">1. Enter Database Settings</span>
&nbsp; &#8211;&gt; &nbsp;
<span style="white-space: nowrap;">2. Create ' . OCC_WORD_CHAIR . ' Account</span>
&nbsp; &#8211;&gt; &nbsp;
<span style="white-space: nowrap;">3. Tailor Configuration Settings</span>
&nbsp; &#8211;&gt; &nbsp;
<span style="white-space: nowrap;">4. Set Topics</span>
&nbsp; &#8211;&gt; &nbsp;
<span style="white-space: nowrap;">5. Open Submissions & Sign-Up/In</span>
</p>
';
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 '
<p><span class="warn">Before proceeding, you must allow write privilege by the Web server (HTTP) process to the config.php files.</span></p>
';
} else {
print '
<form method="post" action="install-license.php">
<p><strong>When you are ready to proceed, read the OpenConf License below and click the <em>I Agree</em> button to indicate your agreement to its terms:</strong></p>
<p style="text-align: center"><textarea name="license" style="width: 680px; height: 320px; background-color: #eee; padding: 5px;">';
readfile('../docs/LICENSE');
print '</textarea><br />
<p style="text-align: center"><input type="submit" name="submit" class="submit" value="I Agree to the OpenConf License Terms" /></p>
</form>
';
}
print '
<br />
<p><span class="note">If you have already installed OpenConf but are still seeing this page, change the value of OCC_INSTALL_COMPLETE in config.php</span></p>
</div>
';
printFooter();
?>
+195
View File
@@ -0,0 +1,195 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
// Retrieve submission types - do it here as used for filtering validation below
$subTypeAR = array();
$r = 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', 'Submissions', 1);
while ($l = ocsql_fetch_assoc($r)) {
$subTypeAR[$l['type']] = substr($l['type'], 0, 50);
}
// Filter?
$atype = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter'] : ''); // accepteance type
$stype = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter'] : ''); // submission type
if (isset($_POST['fsubmit']) && ($_POST['fsubmit'] == 'Filter')) {
if (!isset($_POST['atype']) || empty($_POST['atype'])) {
$atype = '';
} elseif (($_POST['atype'] == 'Pending') || isset($OC_acceptanceColorAR[$_POST['atype']])) {
$atype = $_POST['atype'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter'] = $atype;
if (!isset($_POST['stype']) || empty($_POST['stype']) || !isset($subTypeAR[$_POST['stype']])) {
$stype = '';
} else {
$stype = $_POST['stype'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter'] = $stype;
session_write_close();
}
printHeader("Advocates", 1);
if (isset($_POST['submit']) && ($_POST['submit'] == "Unassign Advocates") && !empty($_POST['drop'])) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
foreach ($_POST['drop'] as $val) {
if (preg_match("/^\d+,\d+$/",$val)) {
list($pid,$aid) = explode(",", $val);
oc_deleteAssignments($pid, $aid, 'advocate');
// Also delete as reviewer?
if (isset($_POST['droprev']) && ($_POST['droprev'] == "yes")) {
oc_deleteAssignments($pid, $aid);
}
}
else {
print "Unable to process " . safeHTMLstr($val) . ".<p>\n";
}
}
print "<p align=\"center\" class=\"note\">Advocate(s) have been unassigned.</p>\n";
if (isset($_POST['s'])) {
print '<p align="center"><a href="list_advocates.php">Return to Advocate Listings</a></p>';
}
printFooter();
exit;
}
if (!isset($_GET['s']) || ($_GET['s'] == "pid")) {
$sortby = "`paperid`";
$pidsort='<span style="white-space: nowrap;">S-ID</span><br />' . $OC_sortImg;
$psort='<a href="'.$_SERVER['PHP_SELF'].'?s=paper" title="sort by submission title">Submission</a>';
$nsort='<a href="'.$_SERVER['PHP_SELF'].'?s=name" title="sort by advocate name">Advocate</a>';
$aidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=aid" title="sort by advocate ID">A-ID</a></span>';
$_GET['s'] = 'pid';
} elseif ($_GET['s'] == "paper") {
$sortby = "`title`";
$pidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=pid" title="sort by submission ID">S-ID</a></span>';
$psort="Submission<br />" . $OC_sortImg;
$nsort='<a href="'.$_SERVER['PHP_SELF'].'?s=name" title="sort by advocate name">Advocate</a>';
$aidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=aid" title="sort by advocate ID">A-ID</a></span>';
} elseif ($_GET['s'] == "name") {
$sortby = "`name_last`, `name_first`";
$pidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=pid" title="sort by submission ID">S-ID</a></span>';
$psort='<a href="'.$_SERVER['PHP_SELF'].'?s=paper" title="sort by submission title">Submission</a>';
$nsort="Advocate<br />" . $OC_sortImg;
$aidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=aid" title="sort by advocate ID">A-ID</a></span>';
} elseif ($_GET['s'] == "aid") {
$sortby = "`advocateid`";
$pidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=pid" title="sort by submission ID">S-ID</a></span>';
$psort='<a href="'.$_SERVER['PHP_SELF'].'?s=paper" title="sort by submission title">Submission</a>';
$nsort='<a href="'.$_SERVER['PHP_SELF'].'?s=name" title="sort by advocate name">Advocate</a>';
$aidsort='<span style="white-space: nowrap;">A-ID</span><br />' . $OC_sortImg;
} else {
err("Unknown sort source");
}
// Display Filter
$aAR = array_keys($OC_acceptanceColorAR);
$aAR[] = 'Pending';
print '
<div style="text-align: center">
<form method="post" action="' . $_SERVER['PHP_SELF'] . '?s=' . safeHTMLstr($_GET['s']) . '">
<select name="atype"><option value="">All Acceptance Types</option>' . generateSelectOptions($aAR, $atype, false) . '</select> &nbsp;';
if (count($subTypeAR) > 0) {
print '<select name="stype"><option value="">All Submission Types</option>' . generateSelectOptions($subTypeAR, $stype, true) . '</select> &nbsp;';
}
print '<input type="submit" name="fsubmit" value="Filter" />
</form>
</div>
';
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`, `adv_recommendation`, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, `title` FROM `" . OCC_TABLE_PAPER . "` LEFT JOIN `" . OCC_TABLE_PAPERADVOCATE . "` ON `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERADVOCATE . "`.`paperid` LEFT JOIN `" . OCC_TABLE_REVIEWER . "` ON `" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid`";
switch($atype) {
case '':
break;
case 'Pending':
$q .= " WHERE (`" . OCC_TABLE_PAPER . "`.`accepted`='' OR `" . OCC_TABLE_PAPER . "`.`accepted` IS NULL) ";
break;
default:
$q .= " WHERE `" . OCC_TABLE_PAPER . "`.`accepted`='" . safeSQLstr($atype) . "' ";
break;
}
switch($stype) {
case '':
break;
default:
$q .= (preg_match("/ WHERE /", $q) ? ' AND ' : ' WHERE ') . "`" . OCC_TABLE_PAPER . "`.`type`='" . safeSQLstr($stype) . "' ";
break;
}
$q .= " ORDER BY " . $sortby;
$r = ocsql_query($q) or err("Unable to get information");
if (ocsql_num_rows($r) == 0) {
print '<span class="warn">No advocates found.</span><p>';
} else {
print '
<dl>
<dt><strong>Links:</strong></dt>
<dd><em>Recom.</em> &#8211; Show recommendation</dd>
<dd><em>Submission</em> &#8211; Show Submission info</dd>
<dd><em>Advocate</em> &#8211; Show Advocate info</dd>
</dl>
<script language="javascript" type="text/javascript">
<!--
function checkAllBoxes(boxstate) {
var boxObj = document.getElementsByName("drop[]");
for (var i=0; i<boxObj.length; i++) {
if (boxstate.checked) {
boxObj[i].checked = true;
} else {
boxObj[i].checked = false;
}
}
}
// -->
</script>
<form method="post" action="list_advocates.php">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="s" value="' . safeHTMLstr(varValue('s', $_GET)) . '">
<table border=0 cellspacing=1 cellpadding=4>
<tr><td align="right" colspan="6"><span style="background-color: #ccf; border: 12px solid #ccf;"> &nbsp; <input type="submit" name="submit" value="Unassign Advocates" onclick="return confirm(\'Data for unassigned advocates will be deleted. Proceed?\');" /> &nbsp; </span><br /><br /><label><input type="checkbox" name="droprev" value="yes"> Check to also unassign review</label></td></tr>
<tr class="rowheader"><th scope="col" valign="top" title="Advocate Recommendation">Recom.</th><th scope="col" valign="top" title="Submission ID">' . $pidsort . '</th><th scope="col" valign="top">' . $psort . '</th><th scope="col" valign="top" title="Advocate ID">' . $aidsort . '</th><th scope="col" valign="top">' . $nsort . '</th><th scope="col" bgcolor="#ccccff"><input type="checkbox" title="check/uncheck all boxes" onclick="checkAllBoxes(this);" /></th></tr>
';
$row = 1;
while ($l = ocsql_fetch_array($r)) {
print '<tr class="row' . $row . '">';
if (empty($l['adv_recommendation'])) {
print "<td>&nbsp;</td>";
} else {
print '<td><a href="show_adv_review.php?p=' . urlencode($l['paperid']) . '&a=' . urlencode($l['advocateid']) . '&s=' . urlencode(varValue('s', $_GET)) . '">' . safeHTMLstr($l['adv_recommendation']) . '</a></td>';
}
print '<td align="right">' . safeHTMLstr($l['paperid']) . '</td><td><a href="show_paper.php?pid=' . urlencode($l['paperid']) . '">' . safeHTMLstr($l['title']) . '</a></td>';
if (empty($l['advocateid'])) {
print "<td>&nbsp;</td><td>&nbsp;</td><td bgcolor=\"#ccccff\">&nbsp;</td>";
} else {
print '<td align="right">' . safeHTMLstr($l['advocateid']) . '</td><td><a href="show_reviewer.php?rid=' . urlencode($l['advocateid']) . '">' . safeHTMLstr($l['name']) . '</a></td>' .
'<td align="center" bgcolor="#ccccff"><input type="checkbox" name="drop[]" value="' . safeHTMLstr($l['paperid'] . ',' . $l['advocateid']) . '" title="SID ' . safeHTMLstr($l['paperid']) . ', AID ' . safeHTMLstr($l['advocateid']) . '"></td>';
}
print "</tr>";
if ($row==1) { $row=2; } else { $row=1; }
}
print '
<tr><td align="right" colspan="6"><label><input type="checkbox" name="droprev" value="yes"> Check to also unassign review</label><br /><br /><span style="background-color: #ccf; border: 12px solid #ccf;"> &nbsp; <input type="submit" name="submit" value="Unassign Advocates" onclick="return confirm(\'Data for unassigned advocates will be deleted. Proceed?\');" /> &nbsp; </span></td></tr>
</table>
</form>
';
}
printFooter();
?>
+92
View File
@@ -0,0 +1,92 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
// accepted or all papers?
if (isset($_REQUEST['acc']) && preg_match("/\d+/", $_REQUEST['acc']) && isset($OC_acceptanceValuesAR[$_REQUEST['acc']])) {
$accSQL = " AND `" . OCC_TABLE_PAPER . "`.`accepted`='" . safeSQLstr($OC_acceptanceValuesAR[$_REQUEST['acc']]['value']) . "'";
$accURL = 'acc=' . $_REQUEST['acc'];
$accReq = $_REQUEST['acc'];
}
else {
$accSQL = '';
$accURL = '';
$accReq = '';
}
// sort order
if (isset($_REQUEST['s']) && ($_REQUEST['s'] == "id")) {
$sortby = "`paperid`";
$idsort = 'Submission ID. Title<br />' . $OC_sortImg;
$nsort = '<a href="' . $_SERVER['PHP_SELF'] . '?s=name&' . $accURL . '">' . OCC_WORD_AUTHOR . '</a>';
} else {
$sortby = "`name_last`, `name_first`";
$idsort = '<a href="' . $_SERVER['PHP_SELF'] . '?s=id&' . $accURL . '">Submission ID. Title</a>';
$nsort = '<span title="Grouped by matching email address">' . OCC_WORD_AUTHOR. '</span><br />' . $OC_sortImg;
}
printHeader('All ' . OCC_WORD_AUTHOR . 's', 1);
$accOptions = '';
foreach ($OC_acceptanceValuesAR as $idx => $acc) {
$accOptions .= '<option value="' . safeHTMLstr($idx) . '">' . safeHTMLstr($acc['value']) . '</option>';
}
print '
<form method="post" action="list_authors.php">
<input type="hidden" name="s" value="' . (isset($_REQUEST['s']) ? safeHTMLstr($_REQUEST['s']) : '') . '" />
<p style="text-align: center;">
<select name="acc">
<option value="">All Submissions</option>
' . preg_replace('/(value="' . preg_quote($accReq) . '")/', "$1 selected", $accOptions) . '
</select>
<input type="submit" value="Filter" />
</p>
</form>
';
$q = "SELECT `" . OCC_TABLE_AUTHOR . "`.`name_last`, `" . OCC_TABLE_AUTHOR . "`.`name_first`, `" . OCC_TABLE_AUTHOR . "`.`email`, `" . OCC_TABLE_AUTHOR . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`title` FROM `" . OCC_TABLE_AUTHOR . "`, `" . OCC_TABLE_PAPER . "` WHERE `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_AUTHOR . "`.`paperid` " . $accSQL . " ORDER BY $sortby";
$r = ocsql_query($q) or err("Unable to get " . oc_strtolower(OCC_WORD_AUTHOR) . "s");
if (ocsql_num_rows($r) == 0) { print '<span class="warn">No submissions have been made yet.</span><p>'; }
else {
$currid = null;
$row = 2; // Seed at 2 to handle same IDs
print '<table border=0 cellspacing="1" cellpadding="4" style="margin: 0 auto;"><tr class="rowheader"><th valign="top">' . $nsort . '</th><th valign="top">' . $idsort . '</th></tr>';
if (isset($_REQUEST['s']) && ($_REQUEST['s'] == "id")) {
while ($l = ocsql_fetch_array($r)) {
if ($l['paperid'] == $currid) {
print '<tr class="row' . $row . '"><td>' . safeHTMLstr($l['name_first']) . ' ' . safeHTMLstr($l['name_last']) . '</td><td>&nbsp;</td></tr>';
} else {
$row = $rowAR[$row];
print '<tr class="row' . $row . '"><td>' . safeHTMLstr($l['name_first']) . ' ' . safeHTMLstr($l['name_last']) . '</td><td><a href="show_paper.php?pid=' . $l['paperid'] . '">' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . '</a></td></tr>';
$currid = $l['paperid'];
}
}
} else {
while ($l = ocsql_fetch_array($r)) {
if ($l['email'] == $currid) {
print '<tr class="row' . $row . '"><td>&nbsp;</td><td><a href="show_paper.php?pid=' . $l['paperid'] . '">' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . '</a></td></tr>';
} else {
$row = $rowAR[$row];
print '<tr class="row' . $row . '"><td>' . safeHTMLstr($l['name_first']) . ' ' . safeHTMLstr($l['name_last']) . '</td><td><a href="show_paper.php?pid=' . $l['paperid'] . '">' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . '</a></td></tr>';
}
$currid = $l['email'];
}
}
print "</table><br />\n";
}
printFooter();
?>
+108
View File
@@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
require_once OCC_COUNTRY_FILE;
beginChairSession();
// accepted or all submissions?
if (isset($_REQUEST['acc']) && preg_match("/\d+/", $_REQUEST['acc']) && isset($OC_acceptanceValuesAR[$_REQUEST['acc']])) {
$accSQL = "AND `" . OCC_TABLE_PAPER . "`.`accepted`='" . safeSQLstr($OC_acceptanceValuesAR[$_REQUEST['acc']]['value']) . "'";
$accURL = 'acc=' . urlencode($_REQUEST['acc']);
$accReq = $_REQUEST['acc'];
}
else {
$accSQL = '';
$accURL = '';
$accReq = '';
}
printHeader('Submission Countries', 1);
$accOptions = '';
foreach ($OC_acceptanceValuesAR as $idx => $acc) {
$accOptions .= '<option value="' . safeHTMLstr($idx) . '">' . safeHTMLstr($acc['value']) . '</option>';
}
print '
<form method="post" action="list_authors_country.php">
<input type="hidden" name="s" value="' . (isset($_REQUEST['s']) ? safeHTMLstr($_REQUEST['s']) : '') . '" />
<p style="text-align: center;">
<select name="acc">
<option value="">All Submissions</option>
' . preg_replace('/(value="' . preg_quote($accReq) . '")/', "$1 selected", $accOptions) . '
</select>
<input type="submit" value="Filter" />
</p>
</form>
';
$q = "SELECT `country`, COUNT(*) AS `num` FROM `" . OCC_TABLE_AUTHOR . "`, `" . OCC_TABLE_PAPER . "` WHERE `" . OCC_TABLE_AUTHOR . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` AND `" . OCC_TABLE_AUTHOR . "`.`position`=`" . OCC_TABLE_PAPER . "`.`contactid` $accSQL GROUP BY `country` ORDER BY `num` DESC";
$r = ocsql_query($q) or err("Unable to get information");
if (ocsql_num_rows($r) == 0) {
print '<span class="warn">No submissions available</span><p>';
} else {
print '
<p style="text-align: center" class="note">Note: Only the country of the contact ' . oc_strtolower(OCC_WORD_AUTHOR) . ' is used for reporting</p>
<table border="0" cellpadding="5" cellspacing="1" style="margin: 0 auto">
';
if (isset($_REQUEST['s']) && ($_REQUEST['s'] == "num")) {
print '<tr class="rowheader"><th valign="top"><a href="' . $_SERVER['PHP_SELF'] . '?s=country&' . $accURL . '">Country</a></th><th valign="top">Count<br />' . $OC_sortImg . '</th></tr>';
$resAR = array();
$nocountry = 0;
while ($l = ocsql_fetch_array($r)) {
if (empty($l['country']) || !isset($OC_countryAR[$l['country']])) {
$nocountry += $l['num'];
} else {
if (!isset($resAR[$l['num']])) {
$resAR[$l['num']] = array();
}
$resAR[$l['num']][] = $OC_countryAR[$l['country']];
}
}
$row = 1;
foreach ($resAR as $num => $countries) {
sort($countries, SORT_LOCALE_STRING);
print '<tr class="row' .$row . '"><td>' . implode('<br />', $countries) . '</td><td align="right">' . $num . "</td></tr>\n";
if ($row==1) { $row=2; } else { $row=1; }
}
if ($nocountry > 0) {
print '<tr class="row' . $row . '"><td style="font-style: italic;">unknown</td><td align="right">' . $nocountry . "</td></tr>\n";
}
} else {
print '<tr class="rowheader"><th valign="top">Country<br />' . $OC_sortImg . '</th><th valign="top"><a href="' . $_SERVER['PHP_SELF'] . '?s=num&' . $accURL . '">Count</a></th></tr>';
$resAR = array();
$nocountry = 0;
while ($l = ocsql_fetch_array($r)) {
if (!empty($l['country']) && isset($OC_countryAR[$l['country']])) {
$resAR[$OC_countryAR[$l['country']]] = $l['num'];
} else {
$nocountry = $l['num'];
}
}
ksort($resAR, SORT_LOCALE_STRING);
$row = 1;
foreach ($resAR as $country => $num) {
print '<tr class="row' . $row . '"><td>' . $country . '</td><td align="right">' . $num . "</td></tr>\n";
if ($row==1) { $row=2; } else { $row=1; }
}
if ($nocountry > 0) {
print '<tr class="row' . $row . '"><td style="font-style: italic;">unknown</td><td align="right">' . $nocountry . "</td></tr>\n";
}
}
print "</table>\n";
}
printFooter();
?>
+58
View File
@@ -0,0 +1,58 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require '../include.php';
beginChairSession();
$OC_extraHeaderAR[] = '
<style type="text/css">
<!--
table.settings { border: 0; }
table.settings th { padding: 5px 5px; vertical-align: top; }
table.settings td { padding: 2px 5px; vertical-align: top; }
table.settings th { font-weight: bold; text-align: center; background-color: #cdd; }
-->
</style>
';
printHeader('Settings Directory', 1);
print '<p style="text-align: center"><a href="set_config_adv.php">Advanced Configuration</a></p>';
$q = "SELECT `setting`, `name`, `description` FROM `" . OCC_TABLE_CONFIG . "` WHERE `module`='OC' ORDER BY `module`, `setting`";
$r = ocsql_query($q) or err('Unable to retrieve OpenConf settings');
$row = 1;
print '<table class="settings"><tr><th>Setting</th><th>Name</th><th>Description</th></tr>';
while ($l = ocsql_fetch_assoc($r)) {
print '<tr class="row' . $row . '"><td>' . safeHTMLstr($l['setting']) . '</td><td>' . safeHTMLstr($l['name']) . '</td><td>' . $l['description'] . "</td></tr>\n";
$row = (($row == 1) ? 2 : 1);
}
$q = "SELECT `module`, `setting`, `name`, `description` FROM `" . OCC_TABLE_CONFIG . "` WHERE `module`!='OC' ORDER BY `module`, `setting`";
$r = ocsql_query($q) or err('Unable to retrieve module settings');
$module = '';
while ($l = ocsql_fetch_assoc($r)) {
if ($l['module'] != $module) {
$module = $l['module'];
print '<tr><th colspan="3">' . safeHTMLstr($OC_modulesAR[$l['module']]['name']) . ' Module' . (oc_moduleActive($l['module']) ? '' : ' - Inactive') . '</th></tr>';
}
print '<tr class="row' . $row . '"><td>' . safeHTMLstr($l['setting']) . '</td><td>' . safeHTMLstr($l['name']) . '</td><td>' . $l['description'] . "</td></tr>\n";
$row = (($row == 1) ? 2 : 1);
}
print '</table>';
printFooter();
?>
+197
View File
@@ -0,0 +1,197 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Conflicts",1);
if (isset($_POST['ocaction'])) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
if (($_POST['ocaction'] == "Unset Conflicts (UC)") && (!empty($_POST['drop']))) {
foreach ($_POST['drop'] as $val) {
if (preg_match("/^\d+,\d+$/",$val)) {
list($pid,$rid) = explode(",", $val);
issueSQL("DELETE FROM `" . OCC_TABLE_CONFLICT . "` WHERE `paperid`='" . safeSQLstr($pid) . "' AND `reviewerid`='" . safeSQLstr($rid) . "'");
}
else {
print "Unable to process " . safeHTMLstr($val) . ".<p>\n";
}
}
print '<p class="note" align="center">Conflicts have been unset.</p>';
print '<p align="center"><a href="' . $_SERVER['PHP_SELF'] . '">Return to Conflict Listings</a></p>';
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='<span style="white-space: nowrap;">P-ID</span><br />' . $OC_sortImg;
$psort='<a href="'.$_SERVER['PHP_SELF'].'?s=paper">Submission</a>';
$rsort='<a href="'.$_SERVER['PHP_SELF'].'?s=reviewer">Reviewer</a>';
$ridsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=rid">R-ID</a></span>';
} elseif ($_GET['s'] == "paper") {
$q = $pq . " ORDER BY `" . OCC_TABLE_PAPER . "`.`title`, `" . OCC_TABLE_CONFLICT . "`.`reviewerid`";
$sortid = "paper";
$pidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=pid">P-ID</a></span>';
$psort="Submission<br />" . $OC_sortImg;
$rsort='<a href="'.$_SERVER['PHP_SELF'].'?s=reviewer">Reviewer</a>';
$ridsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=rid">R-ID</a></span>';
} elseif ($_GET['s'] == "rid") {
$q = $pq . " ORDER BY `" . OCC_TABLE_CONFLICT . "`.`reviewerid`, `" . OCC_TABLE_CONFLICT . "`.`paperid`";
$sortid = "reviewer";
$pidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=pid">P-ID</a></span>';
$psort='<a href="'.$_SERVER['PHP_SELF'].'?s=paper">Submission</a>';
$rsort='<a href="'.$_SERVER['PHP_SELF'].'?s=reviewer">Reviewer</a>';
$ridsort='<span style="white-space: nowrap;">R-ID</span><br />' . $OC_sortImg;
} elseif ($_GET['s'] == "reviewer") {
$q = $pq . " ORDER BY `" . OCC_TABLE_REVIEWER . "`.`name_last`, `" . OCC_TABLE_REVIEWER . "`.`name_first`, `" . OCC_TABLE_CONFLICT . "`.`paperid`";
$sortid = "reviewer";
$pidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=pid">P-ID</a></span>';
$psort='<a href="'.$_SERVER['PHP_SELF'].'?s=paper">Submission</a>';
$rsort="Reviewer<br />" . $OC_sortImg;
$ridsort= '<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=rid">R-ID</a></span>';
} else {
err("Unknown sort source");
}
print '
<p><strong>Manually Set Conflicts:</strong> [<a href="set_conflicts.php">set</a>]</p>
';
$r = ocsql_query($q) or err("Unable to get information");
if (ocsql_num_rows($r) == 0) {
print '<p class="note"> &nbsp; &nbsp; &nbsp; No conflicts have been set.</p>';
} else {
$s = substr($sortid, 0, 1);
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="src" value="' . $s . '">
<table border="0" cellspacing="1" cellpadding="4" COLS=3>
<tr><td align="right" colspan="5"><span style="border: 6px solid #ccf;"><input type="submit" name="ocaction" value="Unset Conflicts (UC)" /></span></td></tr>
<tr class="rowheader"><th valign="top" style="width: 4em;">' . $pidsort . '</th><th valign="top">' . $psort . '</th><th valign="top" style="width: 4em;">' . $ridsort . '</th><th valign="top">' . $rsort . '</th><th bgcolor="#ccccff">UC</th></tr>
';
$currid = -1;
$row = 1;
while ($l = ocsql_fetch_array($r)) {
if ($sortid == "reviewer") {
$ptags = '<td align="right">'.$l['paperid'].'</td><td><a href="show_paper.php?pid=' . $l['paperid'] . '" target="_blank" title="opens in new window/tab">' . safeHTMLstr($l['title']) . '</a></td>';
$rtags = '<td align="right">' . $l['reviewerid'] . '</td><td><a href="show_reviewer.php?rid=' . $l['reviewerid'] . '" target="_blank" title="opens in new window/tab">' . safeHTMLstr($l['name']) . '</a></td>';
} else {
$ptags = '<td align="right">'.$l['paperid'].'</td><td><a href="show_paper.php?pid=' . $l['paperid'] . '" target="_blank" title="opens in new window/tab">' . safeHTMLstr($l['title']) . '</a></td>';
$rtags = '<td align="right">'.$l['reviewerid'].'</td><td><a href="show_reviewer.php?rid=' . $l['reviewerid'] . '" target="_blank" title="opens in new window/tab">' . safeHTMLstr($l['name']) . '</a></td>';
}
$blanktags = '<td>&nbsp;</td><td>&nbsp;</td>';
if ($currid != $l[$sortid.'id']) {
if ($currid != -1) {
if ($row==1) { $row=2; } else { $row=1; }
}
$currid = $l[$sortid.'id'];
} else {
if ($sortid == "reviewer") { $rtags = $blanktags; }
else { $ptags = $blanktags; }
}
print '<tr class="row' . $row . '">' . $ptags . $rtags;
print '<td align="center" bgcolor="#ccccff">';
if (empty($l['reviewerid'])) { print '&nbsp;'; }
else {
print '<input type="checkbox" name="drop[]" value="' . safeHTMLstr($l['paperid'] . ',' . $l['reviewerid']) . '">';
}
print '</td>';
print "</tr>\n";
}
print '
<tr><td align="right" colspan="5"><span style="border: 6px solid #ccf;"><input type="submit" name="ocaction" value="Unset Conflicts (UC)" /></span></td></tr>
</table></form>
';
}
// Show auto-detected conflicts
print '
<p><hr /></p>
<p><strong>Automatically Detected Conflicts:</strong></p>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p style="margin-left: 30px;"><label><input type="checkbox" name="allowemailconflict" value="no" ' . (($OC_configAR['OC_allowEmailConflict'] == 0) ? 'checked ' : '') . '/> Email Address</label> &nbsp; &nbsp; &nbsp; <label><input type="checkbox" name="alloworgconflict" value="no" ' . (($OC_configAR['OC_allowOrgConflict'] == 0) ? 'checked ' : '') . '/> Organization Name</label> &nbsp; &nbsp; <input type="submit" name="ocaction" value="update" /></p>
</form>
';
if (($OC_configAR['OC_allowEmailConflict'] == 1) && ($OC_configAR['OC_allowOrgConflict'] == 1)) {
print '<p class="warn" style="margin-left: 30px;">Auto-conflict detection is disabled; change settings above.</p>';
} 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 '<p class="note"> &nbsp; &nbsp; &nbsp; No conflicts detected</p>';
} else {
print '<table border="0" cellspacing="1" cellpadding="4"><tr class="rowheader"><th>Submission</th><th>Reviewer</th></tr>';
$row = 1;
while ($l=ocsql_fetch_array($r)) {
print '<tr class="row' . $row . '"><td>' . $l['paperid'] . '. <a href="show_paper.php?pid=' . $l['paperid'] . '" target="_blank" title="opens in new window/tab">' . safeHTMLstr($l['title']) . '</a></td><td>' . $l['reviewerid'] .'. <a href="show_reviewer.php?rid=' . $l['reviewerid'] . '" target="_blank" title="opens in new window/tab">' . safeHTMLstr($l['name']) . '</a></td>';
$row = $rowAR[$row];
}
print '</table><p class="note">For a match to occur, the email address or organization name must be exactly the same.</p>';
}
}
// 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 '<p><hr /></p>';
require_once $hook;
}
}
printFooter();
?>
+108
View File
@@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Files Directory",1);
$skipAR = array('.','..','index.html','.htaccess');
$dir = $OC_configAR['OC_paperDir'];
$formatField = '`format`'; // paper table format field
$linkParams = 'c=1';
if (oc_hookSet('chair-list_files-preprocess')) {
foreach ($GLOBALS['OC_hooksAR']['chair-list_files-preprocess'] as $hook) {
require_once $hook;
}
}
// Delete Files form sub?
if (isset($_POST['subaction']) && ($_POST['subaction'] == 'Delete Files')) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
foreach ($_POST['files'] as $file) {
if (preg_match("/^(\d+)\.(\w+)$/", $file, $filematch)) {
if (!oc_deleteFile($dir . $file)) {
print '<p class="warn">Unable to delete file ' . safeHTMLstr($file) . '</p>';
}
issueSQL("UPDATE `" . OCC_TABLE_PAPER . "` SET " . $formatField . "=NULL WHERE `paperid`='" . safeSQLstr($filematch[1]) . "' AND " . $formatField . "='" . safeSQLstr($filematch[2]) . "' LIMIT 1");
}
}
}
// Display files
if ($pdh = opendir($dir)) {
$fAR = array();
while(($f = readdir($pdh)) !== false) {
if (is_file($dir.$f) && !in_array($f,$skipAR)) {
$fAR[$f] = oc_fileMtime($dir.$f);
}
}
closedir($pdh);
if (oc_hookSet('chair-list_files')) {
foreach ($GLOBALS['OC_hooksAR']['chair-list_files'] as $hook) {
require_once $hook;
}
}
$type = ((isset($_GET['oc_multifile_type']) && ctype_digit($_GET['oc_multifile_type'])) ? urlencode($_GET['oc_multifile_type']) : 1);
if (count($fAR) > 0) {
if (isset($_GET['s']) && ($_GET['s'] == 'date')) {
$dsort = 'Last Updated<br />' . $OC_sortImg;
$fsort = '<a href="' . $_SERVER['PHP_SELF'] . '?s=file' . (($type > 1) ? ('&oc_multifile_type=' . urlencode($_GET['oc_multifile_type'])) : '') . '">File</a>';
arsort($fAR,SORT_NUMERIC);
} else {
$fsort = 'File<br />' . $OC_sortImg;
$dsort = '<a href="' . $_SERVER['PHP_SELF'] . '?s=date' . (($type > 1) ? ('&oc_multifile_type=' . urlencode($_GET['oc_multifile_type'])) : '') . '">Last Updated</a>';
ksort($fAR,SORT_NUMERIC);
}
print '<div style="text-align: center; width: 150px; margin: 1em auto;"><table border="0" cellspacing="0" cellpadding="0"><tr><td style="padding-right: 20px;"><a href="download.php?t=' . ((isset($_GET['oc_multifile_type']) && ctype_digit($_GET['oc_multifile_type'])) ? urlencode($_GET['oc_multifile_type']) : 1) . '"><img src="../images/documentmulti-sm.gif" width="17" height="20" alt="icon" border="0" /><br />ZIP<br />all&nbsp;files</a></td><td style="padding-left: 20px;"><a href="download.php?t=' . $type . '&acc=1"><img src="../images/documentmulti-sm.gif" width="17" height="20" alt="icon" border="0" /><br />ZIP<br />accepted&nbsp;only</a></td></tr></table></div>';
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . (($type > 1) ? ('?oc_multifile_type=' . urlencode($_GET['oc_multifile_type'])) : '') . '">
<input type="hidden" name="token" value="' . safeHTMLstr($_SESSION[OCC_SESSION_VAR_NAME]['chairtoken']) . '" />
<input type="hidden" name="type" value="' . safeHTMLstr($type) . '" />
<table border="0" cellspacing="1" cellpadding="4" style="margin: 0 auto;">
<tr class="rowheader"><th class="del">&nbsp;</th><th>' . $fsort . '</th><th>Size</th><th>' . $dsort . '</th></tr>
';
$row = 1;
foreach ($fAR as $f => $d) {
print '<tr class="row' . $row . '"><td class="del"><input type="checkbox" name="files[]" id="file_' . urlencode($f) . '" value="' . urlencode($f) . '" title="file ' . urlencode($f) . '" /></td><td><a href="../review/paper.php?' . $linkParams . '&p=' . urlencode($f) . '" target="paper">' . urlencode($f) . '</a></td><td align="right">' . safeHTMLstr(oc_formatNumber(oc_fileSize($dir.$f))) . '</td><td>' . safeHTMLstr(date("d M Y H:i:s", $d)) . "</td></tr>\n";
$row = $rowAR[$row];
}
print '
<tr><td colspan="6" style="padding:0; margin:0;" valign="top">
<table border="0" cellpadding="5" cellspacing="0" bgcolor="#ccccff">
<tr><td><span style="white-space: nowrap;"><input type="submit" name="subaction" value="Delete Files" onclick="return confirm(\'Once deleted, files cannot be recovered. Proceed?\');" /></span></td></tr>
</table>
</td></tr>
</table>
</form>
';
} else { // 0 files
print '<p style="text-align: center;"><span class="warn">No files found</span></p>';
}
} else {
print '<p class="warn">Unable to open files directory</p>';
}
printFooter();
?>
+44
View File
@@ -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; i<document.subsForm.elements.length; i++) {
if (document.subsForm.elements[i].type=="checkbox") {
document.subsForm.elements[i].checked=true;
}
}
} else if (boxSelect in oc_ftAR) {
for (i=0; i<document.subsForm.elements.length; i++) {
if (document.subsForm.elements[i].type=="checkbox") {
if (oc_ftAR[boxSelect].indexOf(parseInt(document.subsForm.elements[i].value)) >= 0) {
document.subsForm.elements[i].checked=true;
} else {
document.subsForm.elements[i].checked=false;
}
}
}
} else if (boxSelect in oc_accAR) {
for (i=0; i<document.subsForm.elements.length; i++) {
if (document.subsForm.elements[i].type=="checkbox") {
if (oc_accAR[boxSelect].indexOf(parseInt(document.subsForm.elements[i].value)) >= 0) {
document.subsForm.elements[i].checked=true;
} else {
document.subsForm.elements[i].checked=false;
}
}
}
}
}
+342
View File
@@ -0,0 +1,342 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
require_once "../include-submissions.inc";
$fileTableHeader = '<th scope="col">File</th>'; // table header used for file column
$formatField = '`format`'; // paper table format field
beginChairSession();
oc_addJS('chair/list_papers.js');
// Retrieve submission types - do it here as used for filtering validation below
$subTypeAR = array();
$r = 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', 'Submissions', 1);
while ($l = ocsql_fetch_assoc($r)) {
$subTypeAR[$l['type']] = substr($l['type'], 0, 50);
}
// Filter?
$atype = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter'] : ''); // accepteance type
$stype = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter'] : ''); // submission type
if (isset($_POST['fsubmit']) && ($_POST['fsubmit'] == 'Filter')) {
if (!isset($_POST['atype']) || empty($_POST['atype'])) {
$atype = '';
} elseif (($_POST['atype'] == 'Pending') || isset($OC_acceptanceColorAR[$_POST['atype']])) {
$atype = $_POST['atype'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter'] = $atype;
if (!isset($_POST['stype']) || empty($_POST['stype']) || !isset($subTypeAR[$_POST['stype']])) {
$stype = '';
} else {
$stype = $_POST['stype'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter'] = $stype;
session_write_close();
}
printHeader("Submissions",1);
$verbAR = array(
'Delete Submissions' => 'deleted',
'Delete Withdrawn Submissions' => 'deleted',
'Withdraw Submissions' => 'withdrawn',
'Restore Submissions' => 'restored'
);
if (isset($_POST['subaction']) && isset($verbAR[$_POST['subaction']])) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
if (preg_match("/^(Delete|Withdraw) Submissions$/", $_POST['subaction']) && isset($_POST['papers']) && !empty($_POST['papers'])) {
foreach ($_POST['papers'] as $paperid) {
if (preg_match("/^\d+$/",$paperid)) {
// withdraw?
$log = true;
if ($_POST['subaction'] == 'Withdraw Submissions') {
print "<p>withdrawing id $paperid ... ";
if (! withdrawPaper($paperid, OCC_WORD_CHAIR)) {
print '<span class="warn">SUBMISSION NOT FOUND</span>';
}
print "</p>\n";
$log = false;
} else {
print "<p>deleting id $paperid ...</p>\n";
}
// delete paper
deletePaper($paperid, $log);
} else {
print "Unable to process submission id " . safeHTMLstr($paperid) . ".<br /><br />\n";
}
}
if (($miv = ini_get('max_input_vars')) && (count($_POST['papers']) > ($miv - 10))) {
print '<p class="warn">The number of submissions selected may have been greater than supported by this server. Additional passes may be required.</p>';
}
} 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 "<p>restoring id $paperid ... ";
$ret = restorePaper($paperid);
if ($ret != $paperid) {
if ($ret === null) {
print '<span class="warn">SUBMISSION NOT FOUND</span>';
} else {
print '<span class="warn">Duplicate ID -- New ID Assigned: ' . safeHTMLstr($ret) . '</span>';
}
}
print "</p>\n";
} elseif ($_POST['subaction'] == 'Delete Withdrawn Submissions') { // delete withdrawn?
print "<p>deleting withdrawn id $paperid ... ";
if ( ! ocsql_query("DELETE FROM `" . OCC_TABLE_WITHDRAWN . "` WHERE `paperid`='" . safeSQLstr($paperid) . "' LIMIT 1") ) {
print '<span class="warn">DELETION FAILED</span>';
}
print "</p>\n";
}
} else {
print "Unable to process submission id " . safeHTMLstr($paperid) . ".<br /><br />\n";
}
}
if (($miv = ini_get('max_input_vars')) && (count($_POST['wpapers']) > ($miv - 10))) {
print '<p class="warn">The number of submissions selected may have been greater than supported by this server. Additional passes may be required.</p>';
}
}
print '<p><a href="list_papers.php">Return to Submission Listings</a></p>';
printFooter();
exit;
}
// Headers & Sorting
$rsortstr = '<a href="'.$_SERVER['PHP_SELF'].'?s=id" title="sort by submission ID">ID</a>';
$tsortstr = '<a href="'.$_SERVER['PHP_SELF'].'?s=title" title="sort by submission title">Title</a>';
$nsortstr = '<a href="'.$_SERVER['PHP_SELF'].'?s=name" title="sort by contact author name">Contact ' . OCC_WORD_AUTHOR . '</a>';
$ssortstr = '<a href="'.$_SERVER['PHP_SELF'].'?s=student" title="sort by Student">Stud.</a>';
$stsortstr = '<a href="'.$_SERVER['PHP_SELF'].'?s=type" title="sort by type">Type</a>';
if (!isset($_GET['s'])) {
$_GET['s'] = 'id';
}
switch ($_GET['s']) {
case 'id':
$sortby = "`paperid`";
$rsortstr = 'ID<br />' . $OC_sortImg;
break;
case 'title':
$sortby = "`title`";
$tsortstr = 'Title<br />' . $OC_sortImg;
break;
case 'student':
$sortby = "`student`, `paperid`";
$ssortstr = '<span title="Student">Stud.</span><br />' . $OC_sortImg;
break;
case 'type':
$sortby = "`type`, `paperid`";
$stsortstr = 'Type<br />' . $OC_sortImg;
break;
case 'name':
default:
$sortby = "`name_last`, `name_first`";
$nsortstr = 'Contact ' . OCC_WORD_AUTHOR . '<br />' . $OC_sortImg;
$_GET['s'] = 'id';
break;
}
// Display Filter
$aAR = array_keys($OC_acceptanceColorAR);
$aAR[] = 'Pending';
print '
<div style="text-align: center">
<form method="post" action="' . $_SERVER['PHP_SELF'] . '?s=' . safeHTMLstr($_GET['s']) . '">
<select name="atype" title="submission acceptance types to be displayed when Filter button clicked"><option value="">All Acceptance Types</option>' . generateSelectOptions($aAR, $atype, false) . '</select> &nbsp;';
if (count($subTypeAR) > 0) {
print '<select name="stype" title="submission types to be displayed when Filter button clicked"><option value="">All Submission Types</option>' . generateSelectOptions($subTypeAR, $stype, true) . '</select> &nbsp;';
}
print '<input type="submit" name="fsubmit" value="Filter" />
</form>
</div>
';
// Students?
$OC_trackStudent = false;
$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)) {
$OC_trackStudent = true;
}
// Type?
$OC_trackType = false;
$sr = ocsql_query("SELECT COUNT(*) AS `count` FROM `" . OCC_TABLE_PAPER . "` WHERE `type`!='' AND `type` IS NOT NULL") or err('Unable to check type field');
if (($sl = ocsql_fetch_assoc($sr)) && ($sl['count'] > 0)) {
$OC_trackType = true;
}
// Extra fields init for hook
$extraFields = '';
// Hook
if (oc_hookSet('chair-list_papers-preprocess')) {
foreach ($OC_hooksAR['chair-list_papers-preprocess'] as $v) {
require_once $v;
}
}
// Iterate through subs
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, CONCAT_WS(' ', `name_first`, `name_last`) AS `name`, `" . OCC_TABLE_PAPER . "`.`accepted`, `" . OCC_TABLE_PAPER . "`.`title`, " . $formatField . ", `" . OCC_TABLE_PAPER . "`.`student`, `" . OCC_TABLE_PAPER . "`.`type`" . $extraFields . " FROM `" . OCC_TABLE_PAPER . "` LEFT JOIN `" . OCC_TABLE_AUTHOR . "` ON (`" . OCC_TABLE_AUTHOR . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` AND `" . OCC_TABLE_AUTHOR . "`.`position`=`" . OCC_TABLE_PAPER . "`.`contactid`) WHERE 1=1 ";
switch($atype) {
case '':
break;
case 'Pending':
$q .= "AND (`accepted`='' OR `accepted` IS NULL) ";
break;
default:
$q .= "AND `accepted`='" . safeSQLstr($atype) . "' ";
break;
}
switch($stype) {
case '':
break;
default:
$q .= "AND `type`='" . safeSQLstr($stype) . "' ";
break;
}
$q .= "ORDER BY $sortby";
$r = ocsql_query($q) or err("Unable to get submissions");
if (ocsql_num_rows($r) == 0) {
print '<p class="warn">No submissions available.</p>';
} else {
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="subsForm">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p>Number of Submissions: ' . ocsql_num_rows($r) . '</p>
<p style="margin-bottom: 1.5em;">
<select name="boxselect" id="boxselect" title="submissions to be selected when Select button clicked">
<option value="all">all submissions</option>
';
if (oc_hookSet('file_select_options')) {
print call_user_func($GLOBALS['OC_hooksAR']['file_select_options'][0]); // only one hook allowed here
} else {
print '<option value="ft1">submissions missing File</option>';
}
$accCountAR = array();
$accCountAR['Pending'] = array();
foreach ($OC_acceptanceValuesAR as $acc) {
print '<option value="' . safeHTMLstr($acc['value']) . '">submissions where decision is ' . safeHTMLstr($acc['value']) . '</option>';
$accCountAR[$acc['value']] = array();
}
print '
<option value="Pending">submissions where decision is Pending</option>
</select>
<input type="button" value="Select" onclick="selectBoxes()" style="float: left; margin-right: 0.5em; vertical-align: top;" />
</p>
<table border="0" cellspacing="1" cellpadding="4" cols="4">
<tr class="rowheader"><th class="del" scope="col"><input type="checkbox" title="check/uncheck all boxes" onclick="oc_toggleCheckboxes(this.checked, \'papers[]\');" /></th><th scope="col">' . $rsortstr . '</th><th scope="col">' . $tsortstr . '</th><th scope="col">' . $nsortstr . '</th>';
if ($OC_trackStudent) {
print '<th scope="col">' . $ssortstr . '</th>';
}
if ($OC_trackType) {
print '<th scope="col">' . $stsortstr . '</th>';
}
print $fileTableHeader . '</tr>
';
$row = 1;
$missingFileAR = array(); // global var hack bec. call_user_func does not allow pass by reference for non-object
$OC_downloadZipAR = array();
while ($l = ocsql_fetch_array($r)) {
print '<tr class="row' . $row . '"><td class="del"><input type="checkbox" name="papers[]" id="papers' . $l['paperid'] . '" value="' . $l['paperid'] . '" title="Submission ID ' . $l['paperid'] . '"></td><td align="right" width="40">' . $l['paperid'] . '</td><td><a href="show_paper.php?pid=' . $l['paperid'] . '">' . safeHTMLstr($l['title']) . '</a></td><td>' . safeHTMLstr($l['name']) . '</td>';
if ($OC_trackStudent) {
print '<th>'. (($l['student'] == 'T') ? '<span title="Student">&#10003;</span>' : '&nbsp;') . '</th>';
}
if ($OC_trackType) {
print '<td>' . varValue('type', $l, '&nbsp;', true) . '</td>';
}
print oc_printFileCells($l, true) . "</tr>\n";
$accCountAR[(empty($l['accepted']) ? 'Pending' : $l['accepted'])][] = $l['paperid'];
if ($row==1) { $row=2; } else { $row=1; }
}
$skipCells = 4 + ($OC_trackStudent ? 1 : 0) + ($OC_trackType ? 1 : 0);
print '<tr><td colspan="' . $skipCells . '" style="padding:0; margin:0;" valign="top"><table border="0" cellpadding="5" cellspacing="0" bgcolor="#ccccff"><tr><td><span style="white-space: nowrap;"><input type="submit" name="subaction" value="Delete Submissions" onclick="return confirm(\'Once deleted, submission data cannot be recovered. Proceed?\');" /> &nbsp; <input type="submit" name="subaction" value="Withdraw Submissions" onclick="return confirm(\'Upon withdraw, review data and uploaded files will be permanently deleted, and assigned committee members may be notified. Proceed?\');" /></span></td></tr></table></td>';
if (class_exists('ZipArchive')) {
if (oc_hookSet('print_file_cells_zip')) {
$str = call_user_func($GLOBALS['OC_hooksAR']['print_file_cells_zip'][0], $row, 0, 0, false); // only one hook allowed here
print $str;
} elseif (isset($OC_downloadZipAR[1]) && ($OC_downloadZipAR[1] > 1)) {
print '<td class="row' . $row . '" style="text-align: center; font-size: 0.8em;"><a href="download.php?t=1"><img src="../images/documentmulti-sm.gif" border="0" alt="' . oc_('Download All') . '" title="' . oc_('Download All') . '" width="17" height="20" /><br />ZIP</a></td>';
}
}
print '</tr>
</table>
<p class="note"><strong>Note:</strong> When deleting a submission, all records associated with the submission are permanently removed. When withdrawing a submission, all reviews and assignments, uploaded files, etc, are permanently removed; the submission and ' . oc_strtolower(OCC_WORD_AUTHOR) . ' table data however may be restored if submission-related modules have not been uninstalled.</p>
</form>
<script language="javascript" type="text/javascript">
// <!--
';
foreach ($missingFileAR as $k => $v) {
print 'oc_ftAR["' . $k . '"] = [' . implode(',', $v) . "];\n";
}
foreach ($accCountAR as $k => $v) {
print 'oc_accAR["' . $k . '"] = [' . implode(',', $v) . "];\n";
}
print '
// -->
</script>
';
}
$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 '
<a name="withdrawn"></a>
<p><hr /></p>
<p style="text-align: center; font-weight: bold; font-size: 1.1em">Withdrawn Submissions</p>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<table border="0" cellspacing="1" cellpadding="4" cols="4">
<tr class="rowheader"><td class="del"><input type="checkbox" title="check/uncheck all boxes" onclick="oc_toggleCheckboxes(this.checked, \'wpapers[]\');" /></td><th>ID</th><th>Title</th><th>Contact ' . OCC_WORD_AUTHOR . '</th><th>Withdrawn By / On</th></tr>
';
$row = 1;
while ($l = ocsql_fetch_assoc($r)) {
print '<tr class="row' . $row . '"><td class="del" width="25"><input type="checkbox" name="wpapers[]" value="' . $l['paperid'] . '" title="Withdrawn Submission ID ' . $l['paperid'] . '"></td><td align="right" width="40">' . $l['paperid'] . '</td><td>' . safeHTMLstr($l['title']) . '</td><td><a href="mailto:' . safeHTMLstr($l['contact_email']) . '">' . safeHTMLstr($l['contact_author']) . '</a></td><td>' . safeHTMLstr($l['withdrawn_by']) . ' / ' . safeHTMLstr($l['withdraw_date']) . '</tr>';
if ($row==1) { $row=2; } else { $row=1; }
}
print '
</table>
<table border=0 cellpadding=5 cellspacing=0 bgcolor="#ccccff"><tr><td><input type="submit" name="subaction" value="Delete Withdrawn Submissions" onclick="return confirm(\'Once deleted, submission data cannot be recovered. Proceed?\');" />&nbsp; <input type="submit" name="subaction" value="Restore Submissions" /></td></tr></table>
<p class="note"><strong>Note:</strong> Restoring a withdrawn submission will not restore all the submission data, only the information stored in the submission (paper) and ' . oc_strtolower(OCC_WORD_AUTHOR) . 's (author) table.</p>
</form>
';
}
printFooter();
?>
+170
View File
@@ -0,0 +1,170 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
if (isset($_REQUEST['cmt']) && ($_REQUEST['cmt'] == "rev")) {
$cmtAdd = " WHERE `onprogramcommittee`='F'";
$cmt = 'rev';
} elseif (isset($_REQUEST['cmt']) && ($_REQUEST['cmt'] == "pc")) {
$cmtAdd = " WHERE `onprogramcommittee`='T'";
$cmt = 'pc';
} else {
$cmtAdd = '';
$cmt = '';
$_REQUEST['cmt'] = '';
}
printHeader('Committee Members', 1);
if ($OC_configAR['OC_paperAdvocates']) {
$options = '<option value="">All Committee Members</option><option value="rev">Review Committee</option><option value="pc">Program Committee (Advocates)</option>';
print '
<form method="post" action="list_reviewers.php">
<input type="hidden" name="s" value="' . (isset($_REQUEST['s']) ? safeHTMLstr($_REQUEST['s']) : '') . '" />
<p style="text-align: center;">
<select name="cmt">' . preg_replace('/(value="' . $cmt . '")/', "$1 selected", $options) . '</select>
<input type="submit" value="Filter" />
</p>
</form>
';
}
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<br />' . $OC_sortImg;
$pcsortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=pc&cmt=' . $cmt . '" title="sort by program committee status">PC</a>';
$nsortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=name&cmt=' . $cmt . '" title="sort by name">Name</a>';
} elseif ($_REQUEST['s'] == "pc") {
$sortby = "`onprogramcommittee`, `name_last`, `name_first`";
$pcsortstr = 'PC<br />' . $OC_sortImg;
$rsortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=id&cmt=' . $cmt . '" title="sort by reviewer ID">ID</a>';
$nsortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=name&cmt=' . $cmt . '" title="sort by name">Name</a>';
} else { // name sort
$sortby = "`name_last`, `name_first`";
$nsortstr = 'Name<br />' . $OC_sortImg;
$rsortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=id&cmt=' . $cmt . '" title="sort by reviewer ID">ID</a>';
$pcsortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=pc&cmt=' . $cmt . '" title="sort by program committee status">PC</a>';
}
$q = "SELECT `reviewerid`, CONCAT_WS(' ',`name_first`,`name_last`) AS `name`, `username`, `email`, `onprogramcommittee`, `comments` FROM `" . OCC_TABLE_REVIEWER . "` $cmtAdd ORDER BY $sortby";
$r = ocsql_query($q) or err("Unable to get information");
if (ocsql_num_rows($r) == 0) {
print '<span class="warn">No committee members have signed up yet</span><p>';
} else {
print '
<p style="text-align: center">Count: ' . ocsql_num_rows($r) . '</p>
<p style="text-align: center;" class="note">Note: If you choose to delete committee member(s), all review ' . ($OC_configAR['OC_paperAdvocates'] ? 'and advocacy ' : '') . ' data will also be deleted.</p>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" id="membersform">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="cmt" value="' . safeHTMLstr($_REQUEST['cmt']) . '" />
<table border="0" style="margin: 0 auto;"><tr><td>
';
if (isset($_REQUEST['s'])) {
print '<input type="hidden" name="s" value="' . safeHTMLstr($_REQUEST['s']) . '" />';
}
print '
<table border="0" cellspacing="1" cellpadding="4">
<tr><td colspan="10" style="background-color: #ccf; padding-left: 30px;"><input type="submit" name="faction" value="Delete Members" onclick="return confirm(\'Delete all checked member account(s) and associated data (e.g., reviews)?\')" />
';
if ($OC_configAR['OC_paperAdvocates']) {
if ($cmt != 'pc') {
print ' &nbsp; &nbsp; <input type="submit" name="faction" value="Add to PC" />';
}
if ($cmt != 'rev') {
print ' &nbsp; &nbsp; <input type="submit" name="faction" value="Remove from PC" onclick="return confirm(\'Delete checked member(s) advocacy data?\')" />';
}
}
print '
</td></tr>
<tr class="rowheader"><th scope="col" class="del"><input type="checkbox" title="check/uncheck all boxes" onclick="oc_toggleCheckboxes(this.checked, \'revids[]\');" /></th><th scope="col">' . $rsortstr . '</th>
';
if (empty($_REQUEST['cmt'])) {
print '<th scope="col">' . $pcsortstr . '</th>';
}
print '<th scope="col">' . $nsortstr . '</th><th scope="col">Username</th><th scope="col">Comments</th></tr>';
$row = 1;
while ($l = ocsql_fetch_array($r)) {
print '<tr class="row' . $row . '"><td class="del"><input type="checkbox" name="revids[]" id="revids' . $l['reviewerid'] . '" value="' . $l['reviewerid'] . '"></td><td align="right" scope="row"><label for="revids' . $l['reviewerid'] . '">' . $l['reviewerid'] . '</label></td>';
if (empty($_REQUEST['cmt'])) {
print '<td style="text-align: center;">';
if ($l['onprogramcommittee'] == 'T') {
print '<span title="on program committee">&#10003;</span>';
} else {
print "&nbsp;";
}
print '</td>';
}
print '<td><a href="show_reviewer.php?rid='.$l['reviewerid'].'">' . safeHTMLstr($l['name']) . '</a></td><td>'.$l['username'].'</td><td>' . safeHTMLstr($l['comments']) . " &nbsp;</td></tr>\n";
if ($row==1) { $row=2; } else { $row=1; }
}
print '
<tr><td colspan="10" style="background-color: #ccf; padding-left: 30px;"><input type="submit" name="faction" value="Delete Members" onclick="return confirm(\'Delete all checked member account(s) and associated data (e.g., reviews)?\')" />
';
if ($OC_configAR['OC_paperAdvocates']) {
if ($cmt != 'pc') {
print ' &nbsp; &nbsp; <input type="submit" name="faction" value="Add to PC" />';
}
if ($cmt != 'rev') {
print ' &nbsp; &nbsp; <input type="submit" name="faction" value="Remove from PC" onclick="return confirm(\'Delete checked member(s) advocacy data?\')" />';
}
}
print '
</td></tr>
</table>
</td></tr></table>
</form>
';
}
printFooter();
?>
+104
View File
@@ -0,0 +1,104 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
require_once OCC_COUNTRY_FILE;
beginChairSession();
if (isset($_REQUEST['cmt']) && ($_REQUEST['cmt'] == "rev")) {
$cmtSQL = " WHERE `onprogramcommittee`='F'";
$cmt = 'rev';
} elseif (isset($_REQUEST['cmt']) && ($_REQUEST['cmt'] == "pc")) {
$cmtSQL = " WHERE `onprogramcommittee`='T'";
$cmt = 'pc';
} else {
$cmtSQL = '';
$cmt = '';
}
$cmtURL = (isset($_REQUEST['cmt']) ? ('&cmt=' . urlencode($_REQUEST['cmt'])) : '');
printHeader('Committee Member Countries', 1);
if ($OC_configAR['OC_paperAdvocates']) {
$options = '<option value="">All Committee Members</option><option value="rev">Review Committee</option><option value="pc">Program Committee (Advocates)</option>';
print '
<form method="post" action="list_reviewers_country.php">
<input type="hidden" name="s" value="' . (isset($_REQUEST['s']) ? safeHTMLstr($_REQUEST['s']) : '') . '" />
<p style="text-align: center;">
<select name="cmt">' . preg_replace('/(value="' . $cmt . '")/', "$1 selected", $options) . '</select>
<input type="submit" value="Filter" />
</p>
</form>
';
}
$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 '<span class="warn">No committee members have signed up yet</span><p>';
} else {
print '
<table border="0" cellpadding="5" cellspacing="1" style="margin: 0 auto">
';
if (!isset($_REQUEST['s']) || ($_REQUEST['s'] == "country")) {
print '<tr class="rowheader"><th valign="top">Country<br />' . $OC_sortImg . '</th><th valign="top"><a href="' . $_SERVER['PHP_SELF'] . '?s=num&' . $cmtURL . '">Count</a></th></tr>';
$resAR = array();
$nocountry = 0;
while ($l = ocsql_fetch_array($r)) {
if (!empty($l['country']) && isset($OC_countryAR[$l['country']])) {
$resAR[$OC_countryAR[$l['country']]] = $l['num'];
} else {
$nocountry = $l['num'];
}
}
ksort($resAR, SORT_LOCALE_STRING);
$row = 1;
foreach ($resAR as $country => $num) {
print '<tr class="row' . $row . '"><td>' . $country . '</td><td align="right">' . $num . "</td></tr>\n";
if ($row==1) { $row=2; } else { $row=1; }
}
if ($nocountry > 0) {
print '<tr class="row' . $row . '"><td style="font-style: italic;">unknown</td><td align="right">' . $nocountry . "</td></tr>\n";
}
} else {
print '<tr class="rowheader"><th valign="top"><a href="' . $_SERVER['PHP_SELF'] . '?s=country&' . $cmtURL . '">Country</a></th><th valign="top">Count<br />' . $OC_sortImg . '</th></tr>';
$resAR = array();
$nocountry = 0;
while ($l = ocsql_fetch_array($r)) {
if (empty($l['country']) || !isset($OC_countryAR[$l['country']])) {
$nocountry += $l['num'];
} else {
if (!isset($resAR[$l['num']])) {
$resAR[$l['num']] = array();
}
$resAR[$l['num']][] = $OC_countryAR[$l['country']];
}
}
$row = 1;
foreach ($resAR as $num => $countries) {
sort($countries, SORT_LOCALE_STRING);
print '<tr class="row' .$row . '"><td>' . implode('<br />', $countries) . '</td><td align="right">' . $num . "</td></tr>\n";
if ($row==1) { $row=2; } else { $row=1; }
}
if ($nocountry > 0) {
print '<tr class="row' . $row . '"><td style="font-style: italic;">unknown</td><td align="right">' . $nocountry . "</td></tr>\n";
}
}
print "</table>\n";
}
printFooter();
?>
+235
View File
@@ -0,0 +1,235 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
require_once OCC_REVIEW_INC_FILE;
beginChairSession();
// Retrieve submission types - do it here as used for filtering validation below
$subTypeAR = array();
$r = 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', 'Submissions', 1);
while ($l = ocsql_fetch_assoc($r)) {
$subTypeAR[$l['type']] = substr($l['type'], 0, 50);
}
// Filter?
$atype = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter'] : ''); // accepteance type
$stype = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter'] : ''); // submission type
if (isset($_POST['fsubmit']) && ($_POST['fsubmit'] == 'Filter')) {
if (!isset($_POST['atype']) || empty($_POST['atype'])) {
$atype = '';
} elseif (($_POST['atype'] == 'Pending') || isset($OC_acceptanceColorAR[$_POST['atype']])) {
$atype = $_POST['atype'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter'] = $atype;
if (!isset($_POST['stype']) || empty($_POST['stype']) || !isset($subTypeAR[$_POST['stype']])) {
$stype = '';
} else {
$stype = $_POST['stype'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter'] = $stype;
session_write_close();
}
printHeader("Reviews",1);
$pq = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`, `" . OCC_TABLE_PAPERREVIEWER . "`.`recommendation`, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, `" . OCC_TABLE_PAPERREVIEWER . "`.`completed`, `" . OCC_TABLE_PAPERREVIEWER . "`.`updated`, `title` FROM `" . OCC_TABLE_PAPER . "` LEFT JOIN `" . OCC_TABLE_PAPERREVIEWER . "` ON `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERREVIEWER . "`.`paperid` LEFT JOIN `" . OCC_TABLE_REVIEWER . "` ON `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid`";
switch($atype) {
case '':
break;
case 'Pending':
$pq .= " WHERE (`" . OCC_TABLE_PAPER . "`.`accepted`='' OR `" . OCC_TABLE_PAPER . "`.`accepted` IS NULL) ";
break;
default:
$pq .= " WHERE `" . OCC_TABLE_PAPER . "`.`accepted`='" . safeSQLstr($atype) . "' ";
break;
}
switch($stype) {
case '':
break;
default:
$pq .= (preg_match("/ WHERE /", $pq) ? ' AND ' : ' WHERE ') . "`" . OCC_TABLE_PAPER . "`.`type`='" . safeSQLstr($stype) . "' ";
break;
}
if (!isset($_GET['s']) || empty($_GET['s']) || ($_GET['s'] == "pid")) {
$q = $pq . " ORDER BY `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_REVIEWER . "`.`reviewerid`";
$sortid = "paper";
$pidsort='<span style="white-space: nowrap;">S-ID</span><br />' . $OC_sortImg;
$psort='<a href="'.$_SERVER['PHP_SELF'].'?s=paper" title="sort by submission title">Submission</a>';
$rsort='<a href="'.$_SERVER['PHP_SELF'].'?s=reviewer" title="sort by reviewer name">Reviewer</a>';
$ridsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=rid" title="sort by reviewer ID">R-ID</a></span>';
$_GET['s'] = 'pid';
} elseif ($_GET['s'] == "paper") {
$q = $pq . " ORDER BY `" . OCC_TABLE_PAPER . "`.`title`, `" . OCC_TABLE_REVIEWER . "`.`reviewerid`";
$sortid = "paper";
$pidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=pid" title="sort by submission ID">S-ID</a></span>';
$psort="Submission<br />" . $OC_sortImg;
$rsort='<a href="'.$_SERVER['PHP_SELF'].'?s=reviewer" title="sort by reviewer name">Reviewer</a>';
$ridsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=rid" title="sort by reviewer ID">R-ID</a></span>';
} elseif ($_GET['s'] == "rid") {
$q = $pq . " ORDER BY `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, `" . OCC_TABLE_PAPER . "`.`paperid`";
$sortid = "reviewer";
$pidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=pid" title="sort by submission ID">S-ID</a></span>';
$psort='<a href="'.$_SERVER['PHP_SELF'].'?s=paper" title="sort by submission title">Submission</a>';
$rsort='<a href="'.$_SERVER['PHP_SELF'].'?s=reviewer" title="sort by reviewer name">Reviewer</a>';
$ridsort='<span style="white-space: nowrap;">R-ID</span><br />' . $OC_sortImg;
} elseif ($_GET['s'] == "reviewer") {
$q = $pq . " ORDER BY `" . OCC_TABLE_REVIEWER . "`.`name_last`, `" . OCC_TABLE_REVIEWER . "`.`name_first`, `" . OCC_TABLE_PAPER . "`.`paperid`";
$sortid = "reviewer";
$pidsort='<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=pid" title="sort by submission ID">S-ID</a></span>';
$psort='<a href="'.$_SERVER['PHP_SELF'].'?s=paper" title="sort by submission title">Submission</a>';
$rsort="Reviewer<br />" . $OC_sortImg;
$ridsort= '<span style="white-space: nowrap;"><a href="'.$_SERVER['PHP_SELF'].'?s=rid" title="sort by reviewer ID">R-ID</a></span>';
} else {
err("Unknown sort source");
}
// Display Filter
$aAR = array_keys($OC_acceptanceColorAR);
$aAR[] = 'Pending';
print '
<div style="text-align: center">
<form method="post" action="' . $_SERVER['PHP_SELF'] . '?s=' . safeHTMLstr($_GET['s']) . '">
<select name="atype"><option value="">All Acceptance Types</option>' . generateSelectOptions($aAR, $atype, false) . '</select> &nbsp;';
if (count($subTypeAR) > 0) {
print '<select name="stype"><option value="">All Submission Types</option>' . generateSelectOptions($subTypeAR, $stype, true) . '</select> &nbsp;';
}
print '<input type="submit" name="fsubmit" value="Filter" />
</form>
</div>
';
$r = ocsql_query($q) or err("Unable to get information");
if (ocsql_num_rows($r) == 0) {
print '<span class="warn">No reviews found.</span><p>';
} else {
$s = substr($sortid,0,1);
print '<dl><dt><strong>Links:</strong></dt>';
if ($s == "p") {
print '<dd><em>R-ID</em> &#8211; Show review</dd>';
} else {
print '<dd><em>S-ID</em> &#8211; Show review</dd>';
}
print '
<dd><em>Reviewer</em> &#8211; Show Reviewer info</dd>
<dd><em>Submission</em> &#8211; Show Submission info</dd>
<br />
<dt><strong>Legend:</strong></dt>
<dd><table border="0" cellspacing="0" cellpadding="0"><tr>
<td>Review Status: &nbsp; &nbsp; </td><td bgcolor="#ccffcc" class="box" title="marked as complete"> &nbsp; &nbsp; </td><td>&nbsp; Marked as Complete &nbsp; &nbsp; &nbsp; </td>
<td bgcolor="#ffffcc" class="box" title="started"> &nbsp; &nbsp; </td><td>&nbsp;Started &nbsp; &nbsp; &nbsp; </td>
<td bgcolor="#ffcccc" class="box" title="not yet saved"> &nbsp; &nbsp; </td><td>&nbsp;Not Yet Saved</td>
</tr>
</table>
';
if (isset($OC_reviewQuestionsAR['recommendation'])) {
print '<br />
<table border="0" cellspacing="0" cellpadding="0"><tr>
<tr><td valign="top">Recommendation: </td><td>';
foreach ($OC_reviewQuestionsAR['recommendation']['values'] as $k => $v) {
print '<span style="white-space: none">(' . $k . ') ' . safeHTMLstr(preg_match('/:/', $v) ? substr($v,0,strpos($v,':')) : substr($v,0,30)) . ' &nbsp; </span>';
}
print '
</td></tr>
</table>
';
}
print '
</dd>
</dl>
<script language="javascript" type="text/javascript">
<!--
function checkAllBoxes(boxstate) {
var boxObj = document.getElementsByName("drop[]");
for (var i=0; i<boxObj.length; i++) {
if (boxstate.checked) {
boxObj[i].checked = true;
} else {
boxObj[i].checked = false;
}
}
}
// -->
</script>
<form method="post" action="unassign_review.php" id="reviewsform">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="src" value="' . $s . '">
<table border=0 cellspacing=1 cellpadding=4 COLS=3>
<tr><td align="right" colspan="6" style="padding-right: 0;"><span style="border: 6px solid #ccf;"><input type="submit" name="submit" value="Unassign Reviews" onclick="return confirm(\'Unassign checked reviews and delete review data?\');" /></span></td></tr>
<tr class="rowheader"><th scope="col" valign="top" style="width: 4em;" title="Submission ID">' . $pidsort . '</th><th scope="col" valign="top">' . $psort . '</th>';
if (isset($OC_reviewQuestionsAR['recommendation'])) {
print '<th scope="col" style="width: 6em;" title="Recommendation Score">Recom.</th>';
}
print '<th scope="col" valign="top" style="width: 4em;" title="Reviewer ID">' . $ridsort . '</th><th scope="col" valign="top">' . $rsort . '</th><th scope="col" bgcolor="#ccccff"><input type="checkbox" title="check/uncheck all boxes" onclick="checkAllBoxes(this);" /></th></tr>
';
$currid = -1;
$row = 1;
while ($l = ocsql_fetch_array($r)) {
if ($l['completed'] == "F" ) {
if ($l['updated']) { $reccolor = ' bgcolor="#ffffcc"'; $rectitle = 'started'; }
else { $reccolor = ' bgcolor="#ffcccc"'; $rectitle = 'not yet saved'; }
}
elseif (isset($l['completed'])) { $reccolor = ' bgcolor="#ccffcc"'; $rectitle = 'marked as complete'; }
else { $reccolor = ''; $rectitle = '';}
if ($sortid == "reviewer") {
$ptags = '<td align="right"' . $reccolor . ' title="' . safeHTMLstr($rectitle) . '"><a href="show_review.php?pid=' . $l['paperid'] . '&rid=' . $l['reviewerid'] . '">'.$l['paperid'].'</a></td><td><a href="show_paper.php?pid=' . $l['paperid'] . '">' . safeHTMLstr($l['title']) . '</a></td>';
$rtags = '<td align="right">' . $l['reviewerid'] . '</td><td><a href="show_reviewer.php?rid=' . $l['reviewerid'] . '">' . safeHTMLstr($l['name']) . '</a></td>';
} else {
$ptags = '<td align="right">' . $l['paperid'] . '</td><td><a href="show_paper.php?pid=' . $l['paperid'] . '">' . safeHTMLstr($l['title']) . '</a></td>';
$rtags = '<td align="right"' . $reccolor . ' title="' . safeHTMLstr($rectitle) . '"><a href="show_review.php?pid=' . $l['paperid'] . '&rid=' . $l['reviewerid'] . '">'.$l['reviewerid'].'</a></td><td><a href="show_reviewer.php?rid=' . $l['reviewerid'] . '">' . safeHTMLstr($l['name']) . '</a></td>';
}
$blanktags = '<td>&nbsp;</td><td>&nbsp;</td>';
if ($currid != $l[$sortid.'id']) {
if ($currid != -1) {
if ($row==1) { $row=2; } else { $row=1; }
}
$currid = $l[$sortid.'id'];
} else {
if ($sortid == "reviewer") { $rtags = $blanktags; }
else { $ptags = $blanktags; }
}
print '<tr class="row' . $row . '">' . $ptags;
if (isset($OC_reviewQuestionsAR['recommendation'])) {
print '<td align="center">' . safeHTMLstr($l['recommendation']) . '&nbsp;</td>';
};
print $rtags . '<td align="center" bgcolor="#ccccff">';
if (empty($l['reviewerid'])) { print '&nbsp;'; }
else {
print '<input type="checkbox" name="drop[]" value="' . safeHTMLstr($l['paperid'] . ',' . $l['reviewerid']) . '" title="SID ' . safeHTMLstr($l['paperid']) . ', RID ' . safeHTMLstr($l['reviewerid']) . '">';
}
print '</td>';
print "</tr>\n";
}
print '
<tr><td align="right" colspan="6" style="padding-right: 0;"><span style="border: 6px solid #ccf; "><input type="submit" name="submit" value="Unassign Reviews" onclick="return confirm(\'Unassign checked reviews and delete review data?\');" /></span></td></tr>
</table>
</form>
';
}
printFooter();
?>
+106
View File
@@ -0,0 +1,106 @@
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
// Updates checkboxes based on form selection
function selectBoxes() {
var boxSelectID = document.getElementById("boxselect");
var boxSelect = boxSelectID.options[boxSelectID.selectedIndex].value;
var score = document.getElementById("score").value;
switch (boxSelect) {
case "all":
for (i=0; i<document.scoresForm.elements.length; i++) {
if (document.scoresForm.elements[i].type=="checkbox") {
document.scoresForm.elements[i].checked=true;
}
}
break;
case "pending":
for (i=0; i<document.scoresForm.elements.length; i++) {
if (document.scoresForm.elements[i].type=="checkbox") {
if (document.getElementById("decision" + document.scoresForm.elements[i].value).innerHTML == "&nbsp;") {
document.scoresForm.elements[i].checked=true;
} else {
document.scoresForm.elements[i].checked=false;
}
}
}
break;
case "gt":
if ((score == "") || isNaN(score)) {
alert("Enter a valid score");
} else {
intscore = parseFloat(score);
for (i=0; i<document.scoresForm.elements.length; i++) {
if (document.scoresForm.elements[i].type=="checkbox") {
subscore = document.getElementById("subscore" + document.scoresForm.elements[i].value).innerHTML;
if ( ! isNaN(subscore) && (subscore >= intscore)) {
document.scoresForm.elements[i].checked=true;
} else {
document.scoresForm.elements[i].checked=false;
}
}
}
}
break;
case "eq":
if ((score == "") || isNaN(score)) {
alert("Enter a valid score"+score);
} else {
intscore = parseFloat(score);
for (i=0; i<document.scoresForm.elements.length; i++) {
if (document.scoresForm.elements[i].type=="checkbox") {
subscore = document.getElementById("subscore" + document.scoresForm.elements[i].value).innerHTML;
if ( ! isNaN(subscore) && (subscore == intscore)) {
document.scoresForm.elements[i].checked=true;
} else {
document.scoresForm.elements[i].checked=false;
}
}
}
}
break;
case "lt":
if ((score == "") || isNaN(score)) {
alert("Enter a valid score"+score);
} else {
intscore = parseFloat(score);
for (i=0; i<document.scoresForm.elements.length; i++) {
if (document.scoresForm.elements[i].type=="checkbox") {
subscore = document.getElementById("subscore" + document.scoresForm.elements[i].value).innerHTML;
if ( ! isNaN(subscore) && (subscore <= intscore)) {
document.scoresForm.elements[i].checked=true;
} else {
document.scoresForm.elements[i].checked=false;
}
}
}
}
break;
}
}
// check that key pressed is a number
function checkNumberFieldKeyPress(e) {
var key1 = (e.keyCode) ? e.keyCode : e.charCode;
var thekey = (key1) ? key1 : e.which;
if ((thekey >= 48) && (thekey <= 57)) // 0-9
return true;
switch (thekey) {
case 0:
case 8: // backspace
case 9: // tab
case 37: // left arrow
case 39: // right arrow
case 46: // period
//case 46: // delete
return true;
break;
}
return false;
}
+357
View File
@@ -0,0 +1,357 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
oc_addJS('chair/list_scores.js');
// Retrieve submission types - do it here as used for filtering validation below
$subTypeAR = array();
$r = 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', 'Submission Scores', 1);
while ($l = ocsql_fetch_assoc($r)) {
$subTypeAR[$l['type']] = substr($l['type'], 0, 50);
}
// Filter?
$atype = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter'] : ''); // accepteance type
$stype = (isset($_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter']) ? $_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter'] : ''); // submission type
if (isset($_POST['fsubmit']) && ($_POST['fsubmit'] == 'Filter')) {
if (!isset($_POST['atype']) || empty($_POST['atype'])) {
$atype = '';
} elseif (($_POST['atype'] == 'Pending') || isset($OC_acceptanceColorAR[$_POST['atype']])) {
$atype = $_POST['atype'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['accfilter'] = $atype;
if (!isset($_POST['stype']) || empty($_POST['stype']) || !isset($subTypeAR[$_POST['stype']])) {
$stype = '';
} else {
$stype = $_POST['stype'];
}
$_SESSION[OCC_SESSION_VAR_NAME]['chairvars']['typefilter'] = $stype;
session_write_close();
}
printHeader("Submission Scores",1);
// Change final decision
if (isset($_POST['asubmit']) && ($_POST['asubmit'] == 'Set')) {
if (
isset($_POST['subs'])
&& !empty($_POST['subs'])
&& isset($_POST['subaction'])
) {
if ($_POST['subaction'] == 'oc_advrec') { // change to advocate recommendation
foreach ($_POST['subs'] as $sid) {
if (ctype_digit($sid)) {
$q = "UPDATE `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_PAPERADVOCATE . "` SET `" . OCC_TABLE_PAPER . "`.`accepted`=`" . OCC_TABLE_PAPERADVOCATE . "`.`adv_recommendation` WHERE `" . OCC_TABLE_PAPER . "`.`paperid`='" . safeSQLstr($sid) . "' AND `" . OCC_TABLE_PAPERADVOCATE . "`.`paperid` IS NOT NULL AND `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERADVOCATE . "`.`paperid`"; // LIMIT cannot be set due to multiple database update
if (!isset($_POST['oc_override']) || ($_POST['oc_override'] != 1)) {
$q .= " AND `" . OCC_TABLE_PAPER . "`.`accepted` IS NULL";
}
ocsql_query($q);
}
}
} elseif (($_POST['subaction'] == 'Pending') || isset($OC_acceptanceColorAR[$_POST['subaction']])) { // change to specific acceptance or pending
if ($_POST['subaction'] == 'Pending') {
$accepted = 'null';
} else {
$accepted = "'" . safeSQLstr($_POST['subaction']) . "'";
}
foreach ($_POST['subs'] as $sid) {
if (ctype_digit($sid)) {
$q = "UPDATE `" . OCC_TABLE_PAPER . "` SET `accepted`=" . $accepted . " WHERE `paperid`='" . safeSQLstr($sid) . "'";
if (!isset($_POST['oc_override']) || ($_POST['oc_override'] != 1)) {
$q .= " AND `" . OCC_TABLE_PAPER . "`.`accepted` IS NULL";
}
$q .= " LIMIT 1";
ocsql_query($q);
}
}
} else {
print '<p class="warn" style="text-align: center">Invalid change request action.</p>';
}
} else {
print '<p class="warn" style="text-align: center">Invalid change request. Were submissions selected?</p>';
}
}
// 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='<a href="'.$_SERVER['PHP_SELF'].'?s=paper" title="sort by submission ID">Submission ID. Title</a>';
$ssort='<a href="'.$_SERVER['PHP_SELF'].'?s=score" title="sort by score">Score</a>';
$arsort='<a href="'.$_SERVER['PHP_SELF'].'?s=advrec" title="sort by advocate recommendation">Advocate<br />Recom.</a>';
$asort='<a href="'.$_SERVER['PHP_SELF'].'?s=advocate" title="sort by advocate name">Advocate</a>';
$pdsort='<a href="'.$_SERVER['PHP_SELF'].'?s=pcdecision" title="sort by acceptance decision">Final<br />Decision</a>';
$stsort='<a href="'.$_SERVER['PHP_SELF'].'?s=type" title="sort by submission type">Sub.&nbsp;Type</a>';
if (!isset($_GET['s'])) {
$_GET['s'] = 'score';
}
switch ($_GET['s']) {
case 'paper':
$psort="Submission ID. Title<br />" . $OC_sortImg;
$sort = "`paperid`";
break;
case 'advocate':
$asort = "Advocate<br />" . $OC_sortImg;
$sort = "`name_last`, `name_first`, `paperid`";
break;
case 'advrec':
$arsort = '<span title="Advocate Recommendation">Adv&nbsp;Recom</span><br />' . $OC_sortImg;
$sort = "`adv_recommendation`, `recavg` DESC, `paperid`";
break;
case 'pcdecision':
$pdsort = "Final&nbsp;Decision<br />" . $OC_sortImg;
$sort = "`accepted`, `recavg` DESC, `paperid`";
break;
case 'type':
$stsort = "Type<br />" . $OC_sortImg;
$sort = "`type`, `recavg` DESC, `paperid`";
break;
case 'scoreasc':
$ssort = 'Score<br /><a href="' . $_SERVER['PHP_SELF'] . '?s=score">' . $OC_sortImgAsc . '</a>';
$sort = "`recavg` ASC, `paperid`";
$_GET['s'] = 'scoreasc';
break;
case 'score':
default:
$ssort = 'Score<br /><a href="' . $_SERVER['PHP_SELF'] . '?s=scoreasc">' . $OC_sortImg . '</a>';
$sort = "`recavg` DESC, `paperid`";
$_GET['s'] = 'score';
break;
}
// Display Filter
$aAR = array_keys($OC_acceptanceColorAR);
$aAR[] = 'Pending';
print '
<div style="text-align: center">
<form method="post" action="' . $_SERVER['PHP_SELF'] . '?s=' . safeHTMLstr($_GET['s']) . '">
<select name="atype"><option value="">All Acceptance Types</option>' . generateSelectOptions($aAR, $atype, false) . '</select> &nbsp;';
if (count($subTypeAR) > 0) {
print '<select name="stype"><option value="">All Submission Types</option>' . generateSelectOptions($subTypeAR, $stype, true) . '</select> &nbsp;';
}
print '<input type="submit" name="fsubmit" value="Filter" />
</form>
</div>
<br />
';
// Type?
$OC_trackType = false;
$sr = ocsql_query("SELECT COUNT(*) AS `count` FROM `" . OCC_TABLE_PAPER . "` WHERE `type`!='' AND `type` IS NOT NULL") or err('Unable to check type field');
if (($sl = ocsql_fetch_assoc($sr)) && ($sl['count'] > 0)) {
$OC_trackType = true;
}
// Get all papers and decisions
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`type`, `" . OCC_TABLE_REVIEWER . "`.`username`, CONCAT_WS(' ', `" . OCC_TABLE_REVIEWER . "`.`name_first`, `" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, COUNT(`" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`) AS `cr`, COUNT(`score`) AS `crec`, ABS(FORMAT(AVG(`score`),2)) AS `recavg`, MAX(`score`) AS `recmax`, MIN(`score`) AS `recmin`, `title`, `accepted`, `adv_recommendation`, MIN(`completed`) AS `reviewscomplete` FROM `" . OCC_TABLE_PAPER . "` LEFT JOIN `" . OCC_TABLE_PAPERREVIEWER . "` ON `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` LEFT JOIN `" . OCC_TABLE_PAPERADVOCATE . "` ON `" . OCC_TABLE_PAPERADVOCATE . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` LEFT JOIN `" . OCC_TABLE_REVIEWER . "` ON `" . OCC_TABLE_REVIEWER . "`.`reviewerid`=`" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid` WHERE 1=1 ";
switch($atype) {
case '':
break;
case 'Pending':
$q .= "AND (`accepted`='' OR `accepted` IS NULL) ";
break;
default:
$q .= "AND `accepted`='" . safeSQLstr($atype) . "' ";
break;
}
switch($stype) {
case '':
break;
default:
$q .= "AND `type`='" . safeSQLstr($stype) . "' ";
break;
}
$q .= "GROUP BY `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`type`, `" . OCC_TABLE_REVIEWER . "`.`username`, `name`, `title`, `accepted`, `adv_recommendation` ORDER BY $sort";
$r = ocsql_query($q) or err("Unable to get scores");
if (ocsql_num_rows($r) == 0) {
print '<span class="warn">No submissions available.</span><p>';
} else {
print '
<table border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">
<dl>
<dt><strong>Links:</strong></dt>
<dd><em>Score</em> &#8211; Show reviews and accept/reject submission</dd>
<dd><em>Submission ID. Title</em> &#8211; Show submission info</dd>
<br />
<dt><strong>Definitions:</strong></dt>
<dd><em>Score</em> = average score across reviews (if no score, ignored)</dd>
<dd><em>Weight</em> = Number of reviews with a score</dd>
<dd>Weight<strong>*</strong> = May include reviews marked as incomplete (<a href="list_reviews.php">unassign</a>)</dd>
<dd><em>Range</em> = Min - Max scores</dd>
';
if ($OC_configAR['OC_paperAdvocates']) {
print '
<dd><em>Advocate Recom.</em> = Advocate Recommendation</dd>
';
if ($advcountTotal > 0) {
print '
<br />
<dt><strong>Pending Submissions\' Advocate Recommendation Count:</strong></dt>
<dd><br />
';
$c = 0;
foreach ($OC_acceptanceValuesAR as $acc) {
if ($c++ == 3) {
print "<br />\n";
$c = 0;
}
print '<span style="white-space: nowrap">' . safeHTMLstr($acc['value']) . ' - ' . (isset($advCountAR[$acc['value']]) ? $advCountAR[$acc['value']] : 0) . '</span> &nbsp; &nbsp; ';
}
print '
None - ' . (isset($advCountAR['Pending']) ? $advCountAR['Pending'] : 0) . '
</dd>
';
}
}
print '
</dl>
</td><td><span style="white-space: nowrap;"> &nbsp; &nbsp; &nbsp; &nbsp; </span></td><td valign="top" style="border: 1px solid #333; padding: 3px;">
<strong>Legend:</strong><br />
<table border=0 cellspacing=10 cellpadding=0>
';
foreach ($OC_acceptanceValuesAR as $acc) {
print '<tr><td style="background-color: #' . $acc['color'] . '" class="box" title="' . safeHTMLstr($acc['value']) . '"> &nbsp; &nbsp; </td><td>&nbsp; ' . safeHTMLstr($acc['value']) . ' (' . (isset($accCountAR[$acc['value']]) ? $accCountAR[$acc['value']] : 0) . ')</td></tr>';
}
print '
<tr><td bgcolor="#e6e6e6" class="box" title="Pending"> &nbsp; &nbsp; </td><td>&nbsp; Pending (' . (isset($accCountAR['Pending']) ? $accCountAR['Pending'] : 0) . ')</td></tr>
';
if ($OC_configAR['OC_paperAdvocates']) {
print '
<tr><td bgcolor="#ffffcc" class="box" title="Final decision does not match advocate recommendation"> &nbsp; &nbsp; </td><td><span style="white-space: nowrap;">&nbsp; Decision != Recom.</span></td></tr>
';
}
print '
</table>
</td>
</tr></table>
<br />
<form method="post" action="' . $_SERVER['PHP_SELF'] . '?s=' . safeHTMLstr($_GET['s']) . '" name="scoresForm">
<input type="hidden" name="s" value="">
<input type="button" value="Select" onclick="selectBoxes()" />
<select name="boxselect" id="boxselect">
<option value="all">all submissions</option>
<option value="pending">all pending submissions</option>
<option value="gt">submissions with score &gt;=</option>
<option value="eq">submissions with score =</option>
<option value="lt">submissions with score &lt;=</option>
</select>
<input name="score" id="score" size="2" title="enter a score" onkeypress="return checkNumberFieldKeyPress(event)" />
<br /><br />
<table border=0 cellspacing=1 cellpadding=3><tr class="rowheader"><th scope="col" title="submission selection">&nbsp;</th><th scope="col">' . $pdsort . '</th>';
if ($OC_configAR['OC_paperAdvocates']) {
print '<th scope="col">' . $arsort . '</th>';
}
print '<th scope="col">' . $ssort . '</th><th scope="col">Weight</th><th scope="col">Range</th><th scope="col">' . $psort . '</th>';
if ($OC_trackType) {
print '<th scope="col">' . $stsort . '</th>';
}
if ($OC_configAR['OC_paperAdvocates']) {
print '<th scope="col">' . $asort . '</th>';
}
print '</tr>';
while ($l = ocsql_fetch_array($r)) {
$advpcmatch = '';
$scorelink = 'show_scores.php?pid=' . $l['paperid'] . '&s=' . safeHTMLstr($_GET['s']);
print '<tr';
if (!empty($l['accepted'])) {
print ' bgcolor="#' . (isset($OC_acceptanceColorAR[$l['accepted']]) ? $OC_acceptanceColorAR[$l['accepted']] : 'ffffff') . '"><td style="background-color: #ccdddd"><input type="checkbox" name="subs[]" value="' . $l['paperid'] . '" id="subs' . $l['paperid'] . '" /></td><td align="center" onclick="document.location=\'' . $scorelink .'\'" id="decision' . $l['paperid'] . '">' . safeHTMLstr($l['accepted']) . '</td>';
if (isset($l['adv_recommendation']) && !empty($l['adv_recommendation']) && ($l['adv_recommendation'] != $l['accepted'])) {
$advpcmatch = ' bgcolor="#FFFFCC"';
}
}
else {
print ' style="background-color: #e6e6e6"><td style="background-color: #ccdddd"><input type="checkbox" name="subs[]" value="' . $l['paperid'] . '" id="subs' . $l['paperid'] . '" /></td><td align="center" onclick="document.location=\'' . $scorelink .'\'" id="decision' . $l['paperid'] . '">&nbsp;</td>';
}
if ($l['recavg'] != '') {
$usescore = number_format($l['recavg'], 2);
$useweight = $l['crec'];
if ($l['reviewscomplete'] == 'F') { $useweight .= '*'; }
else { $useweight .= '&nbsp;'; }
} else {
$usescore = '&#8211;';
$useweight = '&nbsp;';
}
if ($l['recmin'] === $l['recmax']) { $userange = $l['recmin']; }
else { $userange = $l['recmin'] . '-' . $l['recmax']; }
if ($OC_configAR['OC_paperAdvocates']) {
print '<td align="center"'. $advpcmatch . '>' . safeHTMLstr($l['adv_recommendation']) . '</td>';
}
print '<td align="center"><a href="show_scores.php?pid=' . $l['paperid'].'&s=' . safeHTMLstr($_GET['s']) . '" id="subscore' . $l['paperid'] . '">' . $usescore . '</a></td><td align="center">' . $useweight . '</td><td align="center">' . $userange . '</td><td align="left" scope="row"><a href="show_paper.php?pid=' . $l['paperid'] . '">' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . '</a></td>';
if ($OC_trackType) {
print '<td>' . safeHTMLstr($l['type']) . '</td>';
}
if ($OC_configAR['OC_paperAdvocates']) {
print '<td title="' . safeHTMLstr($l['username']) . '">' . safeHTMLstr($l['name']) . '</td>';
}
print "</tr>\n";
}
print '
<tr><td colspan="10"><br /><label>Change selected to <select name="subaction">';
foreach ($OC_acceptanceValuesAR as $acc) {
print '<option value="' . safeHTMLstr($acc['value']) . '">' . safeHTMLstr($acc['value']) . '</option>';
}
print '<option value="Pending">Pending</option>';
if ($OC_configAR['OC_paperAdvocates']) {
print '<option value="oc_advrec" title="Advocate Recommendation">Advocate Recom.</option>';
}
print '</select></label> <input type="submit" name="asubmit" value="Set" /><br /><label style="font-style: italic;"><input type="checkbox" name="oc_override" value="1" /> override existing decision if not pending</label></td></tr>
</table>
</form>
';
}
printFooter();
?>
+74
View File
@@ -0,0 +1,74 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("All Submission Topics by Score", 1);
// Get all papers title, keywords, and score
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `keywords`, ABS(FORMAT(AVG(`score`),2)) AS `recavg`, `title` FROM `" . OCC_TABLE_PAPER . "` LEFT JOIN `" . OCC_TABLE_PAPERREVIEWER . "` ON `" . OCC_TABLE_PAPER . "`.`paperid`=`" . OCC_TABLE_PAPERREVIEWER . "`.`paperid` GROUP BY `paperid`, `title`, `keywords` ORDER BY `recavg` DESC, `paperid`";
$r = ocsql_query($q) or err("Unable to get information");
if (ocsql_num_rows($r) == 0) { print '<span class="warn">No papers to display.</span><p>'; }
else {
print '
<dl>
<dt><strong>Functions:</strong></dt>
<dd>Click on <em>Score</em> links to see individual reviewer scores and accept/reject submission</dd>
<dd>Click on <em>Submission ID. Title</em> links to see submission information</dd>
<br />
<dt><strong>Definitions:</strong></dt>
<dd><em>score</em> = average score (if no score, ignored)</dd>
</dl>
';
// Get topic names author listed their paper under
$topicAR = array();
$q2 = "SELECT `" . OCC_TABLE_PAPERTOPIC . "`.`paperid`, `topicname`, `short` FROM `" . OCC_TABLE_PAPERTOPIC . "`, `" . OCC_TABLE_TOPIC . "` WHERE `" . OCC_TABLE_PAPERTOPIC . "`.`topicid`=`" . OCC_TABLE_TOPIC . "`.`topicid` ORDER BY `" . OCC_TABLE_PAPERTOPIC . "`.`paperid`";
$r2 = ocsql_query($q2) or err("Unable to get submission topics");
while ($l2 = ocsql_fetch_array($r2)) {
if (array_key_exists($l2['paperid'],$topicAR)) {
$topicAR[$l2['paperid']] .= "<li>" . useTopic($l2['short'],$l2['topicname']) . "\n";
} else {
$topicAR[$l2['paperid']] = "<li>" . useTopic($l2['short'],$l2['topicname']) . "\n";
}
}
// Get topic (sesion) names reviewers listed papers as belonging to
$sessionAR = array();
$q3 = "SELECT `" . OCC_TABLE_PAPERSESSION . "`.`paperid`, `topicname`, `short` FROM `" . OCC_TABLE_PAPERREVIEWER . "`, `" . OCC_TABLE_PAPERSESSION . "`, `" . OCC_TABLE_TOPIC . "` WHERE `" . OCC_TABLE_PAPERREVIEWER . "`.`score` IS NOT NULL AND `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`=`" . OCC_TABLE_PAPERSESSION . "`.`paperid` AND `" . OCC_TABLE_TOPIC . "`.`topicid`=`" . OCC_TABLE_PAPERSESSION . "`.`topicid` GROUP BY `" . OCC_TABLE_PAPERSESSION . "`.`paperid`, `topicname`, `short` ORDER BY `" . OCC_TABLE_PAPERSESSION . "`.`paperid`";
$r3 = ocsql_query($q3) or err("Unable to get reviewer sessions");
while ($l3 = ocsql_fetch_array($r3)) {
if (array_key_exists($l3['paperid'],$sessionAR)) {
$sessionAR[$l3['paperid']] .= "<li>" . useTopic($l3['short'],$l3['topicname']) . "\n";
} else {
$sessionAR[$l3['paperid']] = "<li>" . useTopic($l3['short'],$l3['topicname']) . "\n";
}
}
while ($l = ocsql_fetch_array($r)) {
if (!empty($l['recavg'])) {
$usescore = number_format($l['recavg'], 2);
} else {
$usescore = '&#8211;';
}
print '<hr><strong><a href="show_paper.php?pid=' . $l['paperid'] . '">' . $l['paperid'] . ". " . safeHTMLstr($l['title']) . '</a></strong><p>Score: <strong><a href="show_scores.php?pid=' . $l['paperid'] . '">' . $usescore . "</a></strong><p>\nKeywords: " . safeHTMLstr($l['keywords']) . "<p>\n" . OCC_WORD_AUTHOR . " Topics:<ul>\n" . varValue($l['paperid'], $topicAR) . "</ul>\n";
print "Reviewer Sessions:<ul>\n" . varValue($l['paperid'], $sessionAR) . "</ul>\n";
}
}
printFooter();
?>
+17
View File
@@ -0,0 +1,17 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
if (!defined('OC'.'C_LICE'.'NSE_TYPE') || !preg_match("/Brand/i",constant('OC'.'C_LICE'.'NSE_TYPE'))) {
print '
<script>oc_' . 'ch' . 'eck' . 'B' . '();</script>
';
}
+101
View File
@@ -0,0 +1,101 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
// accepted or all submissions?
if (isset($_REQUEST['acc']) && preg_match("/\d+/", $_REQUEST['acc']) && isset($OC_acceptanceValuesAR[$_REQUEST['acc']])) {
$accSQL = "AND `" . OCC_TABLE_PAPER . "`.`accepted`='" . safeSQLstr($OC_acceptanceValuesAR[$_REQUEST['acc']]['value']) . "'";
$accURL = 'acc=' . $_REQUEST['acc'];
$accReq = $_REQUEST['acc'];
}
else {
$accSQL = '';
$accURL = '';
$accReq = '';
}
// sort order?
if (isset($_REQUEST['s']) && ($_REQUEST['s'] == 'paperid')) {
$sort = '`paperid`, `topicid`';
$psort = 'Submission ID. Title<br />' . $OC_sortImg;
$tsort = '<a href="' . $_SERVER['PHP_SELF'] . '?s=topicid&' . $accURL . '">Topic (ID)</a>';
$sortfld = 'paperid';
} else {
$sort = '`topicid`, `paperid`';
$psort = '<a href="' . $_SERVER['PHP_SELF'] . '?s=paperid&' . $accURL . '">Submission ID. Title</a>';
$tsort = 'Topic (ID)<br />' . $OC_sortImg;
$sortfld = 'topicid';
}
printHeader("Submission Topics", 1);
$accOptions = '';
foreach ($OC_acceptanceValuesAR as $idx => $acc) {
$accOptions .= '<option value="' . safeHTMLstr($idx) . '">' . safeHTMLstr($acc['value']) . '</option>';
}
print '
<p style="text-align: center"><a href="list_topics_pcount.php?' . $accURL . '">Show Count Only</a></p>
<form method="post" action="list_topics_p.php">
<input type="hidden" name="s" value="' . (isset($_REQUEST['s']) ? safeHTMLstr($_REQUEST['s']) : '') . '" />
<p style="text-align: center;">
<select name="acc">
<option value="">All Submissions</option>
' . preg_replace('/(value="' . preg_quote($accReq) . '")/', "$1 selected", $accOptions) . '
</select>
<input type="submit" value="Filter" />
</p>
</form>
';
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_TOPIC . "`.`topicid`, `" . OCC_TABLE_PAPER . "`.`title`, `" . OCC_TABLE_TOPIC . "`.`topicname`, `" . OCC_TABLE_TOPIC . "`.`short` FROM `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_TOPIC . "`, `" . OCC_TABLE_PAPERTOPIC . "` WHERE `" . OCC_TABLE_PAPERTOPIC . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` AND `" . OCC_TABLE_PAPERTOPIC . "`.`topicid`=`" . OCC_TABLE_TOPIC . "`.`topicid` $accSQL ORDER BY $sort";
$r = ocsql_query($q) or err("Unable to get information");
if (ocsql_num_rows($r) == 0) {
print '<span class="warn">No submissions available</span><p>';
} else {
print '
<table border="0" cellspacing="1" cellpadding="4" cols="2" style="margin: 0 auto">
<tr class="rowheader"><th>' . $tsort . '</th><th colspan=2>' . $psort . '</th></tr>
';
$currid = null;
$row = 1;
if (isset($_REQUEST['s']) && ($_REQUEST['s'] == 'paperid')) {
while ($l = ocsql_fetch_array($r)) {
if ($l['paperid'] == $currid) {
print '<tr class="row' . $row . '"><td>' . safeHTMLstr(useTopic($l['short'], $l['topicname']) . ' (' . $l['topicid'] . ')') . '</td><td>&nbsp;</td></tr>';
} else {
$row = $rowAR[$row];
print '<tr class="row' . $row . '"><td>' . safeHTMLstr(useTopic($l['short'], $l['topicname']) . ' (' . $l['topicid'] . ')') . '</td><td><a href="show_paper.php?pid=' . $l['paperid'] . '">' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . '</a></td></tr>';
}
$currid = $l['paperid'];
}
} else {
while ($l = ocsql_fetch_array($r)) {
if ($l['topicid'] == $currid) {
print '<tr class="row' . $row . '"><td>&nbsp;</td><td><a href="show_paper.php?pid=' . $l['paperid'] . '">' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . '</a></td></tr>';
} else {
$row = $rowAR[$row];
print '<tr class="row' . $row . '"><td>' . safeHTMLstr(useTopic($l['short'], $l['topicname']) . ' (' . $l['topicid'] . ')') . '</td><td><a href="show_paper.php?pid=' . $l['paperid'] . '">' . $l['paperid'] . '. ' . safeHTMLstr($l['title']) . '</a></td></tr>';
}
$currid = $l['topicid'];
}
}
print '</table>';
}
printFooter();
?>
+75
View File
@@ -0,0 +1,75 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
// accepted or all submissions?
if (isset($_REQUEST['acc']) && preg_match("/\d+/", $_REQUEST['acc']) && isset($OC_acceptanceValuesAR[$_REQUEST['acc']])) {
$accSQL = "AND `" . OCC_TABLE_PAPER . "`.`accepted`='" . safeSQLstr($OC_acceptanceValuesAR[$_REQUEST['acc']]['value']) . "'";
$accURL = 'acc=' . $_REQUEST['acc'];
$accReq = $_REQUEST['acc'];
}
else {
$accSQL = '';
$accURL = '';
$accReq = '';
}
printHeader("Submission Topic Count", 1);
$accOptions = '';
foreach ($OC_acceptanceValuesAR as $idx => $acc) {
$accOptions .= '<option value="' . safeHTMLstr($idx) . '">' . safeHTMLstr($acc['value']) . '</option>';
}
print '
<p style="text-align: center"><a href="list_topics_p.php?' . $accURL . '">Show Submissions</a></p>
<form method="post" action="list_topics_pcount.php">
<input type="hidden" name="s" value="' . (isset($_REQUEST['s']) ? safeHTMLstr($_REQUEST['s']) : '') . '" />
<p style="text-align: center;">
<select name="acc">
<option value="">All Submissions</option>
' . preg_replace('/(value="' . preg_quote($accReq) . '")/', "$1 selected", $accOptions) . '
</select>
<input type="submit" value="Filter" />
</p>
</form>
';
$q = "SELECT `" . OCC_TABLE_TOPIC . "`.`topicid`, `" . OCC_TABLE_TOPIC . "`.`topicname`, `" . OCC_TABLE_TOPIC . "`.`short`, COUNT(*) AS `num` FROM `" . OCC_TABLE_TOPIC . "`, `" . OCC_TABLE_PAPERTOPIC . "`, `" . OCC_TABLE_PAPER . "` WHERE `" . OCC_TABLE_TOPIC . "`.`topicid`=`" . OCC_TABLE_PAPERTOPIC . "`.`topicid` AND `" . OCC_TABLE_PAPERTOPIC . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` $accSQL GROUP BY `" . OCC_TABLE_TOPIC . "`.`topicid`, `" . OCC_TABLE_TOPIC . "`.`topicname`, `" . OCC_TABLE_TOPIC . "`.`short` ORDER BY ";
if (!isset($_REQUEST['s']) || ($_REQUEST['s']=="topicname")) {
$q .= "`topicname`";
$tsort = 'Topic<br />' . $OC_sortImg;
$nsort = '<a href="' . $_SERVER['PHP_SELF'] . '?s=num&' . $accURL . '">Count</a>';
} else {
$q .= "`num`";
$nsort = 'Count<br />' . $OC_sortImg;
$tsort = '<a href="' . $_SERVER['PHP_SELF'] . '?s=topicname&' . $accURL . '">Topic</a>';
}
$r = ocsql_query($q) or err('Unable to get information');
if (ocsql_num_rows($r) == 0) {
print '<span class="warn">No submissions available</span><p>';
} else {
print '<table border="0" cellpadding="5" cellspacing="1" style="margin: 0 auto"><tr class="rowheader"><th valign="top">' . $tsort . '</th><th valign="top">' . $nsort .'</th></tr>';
$row = 1;
while ($l = ocsql_fetch_array($r)) {
print '<tr class="row' . $row . '"><td>' . safeHTMLstr(useTopic($l['short'],$l['topicname'])) . '</td><td align="right">' . $l['num'] . "</td></tr>\n";
if ($row==1) { $row=2; } else { $row=1; }
}
print "</table>";
}
printFooter();
?>
+111
View File
@@ -0,0 +1,111 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
if (isset($_REQUEST['cmt']) && ($_REQUEST['cmt'] == "rev")) {
$cmtAdd = " AND `onprogramcommittee`='F'";
$cmt = 'rev';
} elseif (isset($_REQUEST['cmt']) && ($_REQUEST['cmt'] == "pc")) {
$cmtAdd = " AND `onprogramcommittee`='T'";
$cmt = 'pc';
} else {
$cmtAdd = '';
$cmt = '';
}
printHeader('Committee Member Topics', 1);
print '<p style="text-align: center;"><a href="list_topics_rcount.php?cmt=' . $cmt . '">Show Count Only</a></p>';
if ($OC_configAR['OC_paperAdvocates']) {
$options = '<option value="">All Committee Members</option><option value="rev">Review Committee</option><option value="pc">Program Committee (Advocates)</option>';
print '
<form method="post" action="list_topics_r.php">
<input type="hidden" name="s" value="' . (isset($_REQUEST['s']) ? safeHTMLstr($_REQUEST['s']) : '') . '" />
<p style="text-align: center;">
<select name="cmt">' . preg_replace('/(value="' . $cmt . '")/', "$1 selected", $options) . '</select>
<input type="submit" value="Filter" />
</p>
</form>
';
}
if (!isset($_REQUEST['s']) || empty($_REQUEST['s']) || ($_REQUEST['s'] == "topic")) {
$sortby = ($OC_configAR['OC_topicDisplayAlpha'] ? '`short`, `topicname`' : '`topicid`') . ', `reviewerid`';
$topicsortstr = 'Topic ' . $OC_sortImg;
$memberidsortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=memberid&cmt=' . $cmt . '">ID</a>';
$membernamesortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=member&cmt=' . $cmt . '">Name</a>';
} elseif ($_REQUEST['s'] == "memberid") {
$sortby = "`reviewerid`";
$topicsortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=topic&cmt=' . $cmt . '">Topic</a>';
$memberidsortstr = 'ID ' . $OC_sortImg;
$membernamesortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=member&cmt=' . $cmt . '">Name</a>';
} else { // member sort
$sortby = "`name_last`, `name_first`";
$topicsortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=topic&cmt=' . $cmt . '">Topic</a>';
$memberidsortstr = '<a href="' . $_SERVER['PHP_SELF'] . '?s=memberid&cmt=' . $cmt . '">ID</a>';
$membernamesortstr = 'Name ' . $OC_sortImg;
}
$q = "SELECT `" . OCC_TABLE_REVIEWER . "`.`reviewerid`, `" . OCC_TABLE_TOPIC . "`.`topicid`, CONCAT_WS(' ', `" . OCC_TABLE_REVIEWER . "`.`name_first`, `" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, `onprogramcommittee`, `" . OCC_TABLE_TOPIC . "`.`topicname`, `" . OCC_TABLE_TOPIC . "`.`short` FROM `" . OCC_TABLE_REVIEWER . "`, `" . OCC_TABLE_TOPIC . "`, `" . OCC_TABLE_REVIEWERTOPIC . "` WHERE `" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` AND `" . OCC_TABLE_REVIEWERTOPIC . "`.`topicid`=`" . OCC_TABLE_TOPIC . "`.`topicid` $cmtAdd ORDER BY " . $sortby;
$r = ocsql_query($q) or err('Unable to get information ');
if (ocsql_num_rows($r) == 0) {
print '<span class="warn">No committee members with topics found.</span><p>';
} else {
print '
<table border=0 cellspacing="1" cellpadding="4" cols="2" style="margin: 0 auto">
<tr class="rowheader"><th>' . $topicsortstr . '</th><th colspan=2>Committee Member ' . $memberidsortstr . '. ' . $membernamesortstr . '</th></tr>
';
$currid = null;
$row = 2; // Set to 2 to handle same IDs
if (!isset($_REQUEST['s']) || empty($_REQUEST['s']) || ($_REQUEST['s'] == "topic")) {
while ($l = ocsql_fetch_array($r)) {
if ($currid == $l['topicid']) {
print '<tr class="row' . $row . '"><td>&nbsp;</td>';
} else {
$row = $rowAR[$row];
print '<tr class="row' . $row . '"><td>' . safeHTMLstr(useTopic($l['short'],$l['topicname'])) . '</td>';
$currid = $l['topicid'];
}
print '<td><a href="show_reviewer.php?rid=' . $l['reviewerid'] . '">' . $l['reviewerid'] . '. ' . safeHTMLstr($l['name']) . '</a>';
if (($cmt != 'pc') && ($l['onprogramcommittee'] == 'T')) {
print " [PC]";
}
print "</td></tr>\n";
}
} else {
while ($l = ocsql_fetch_array($r)) {
if ($currid == $l['reviewerid']) {
print '<tr class="row' . $row . '"><td>' . safeHTMLstr(useTopic($l['short'],$l['topicname'])) . '</td><td>&nbsp;</td>';
} else {
$row = $rowAR[$row];
$currid = $l['reviewerid'];
print '<tr class="row' . $row . '"><td>' . safeHTMLstr(useTopic($l['short'],$l['topicname'])) . '</td><td><a href="show_reviewer.php?rid=' . $l['reviewerid'] . '">' . $l['reviewerid'] . '. ' . safeHTMLstr($l['name']) . '</a>';
if (($cmt != 'pc') && ($l['onprogramcommittee'] == 'T')) {
print " [PC]";
}
print '</td>';
}
print "</tr>\n";
}
}
print '</table>';
}
printFooter();
?>
+69
View File
@@ -0,0 +1,69 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
if (isset($_REQUEST['cmt']) && ($_REQUEST['cmt'] == "rev")) {
$cmtAdd = " AND `onprogramcommittee`='F'";
$cmt = 'rev';
} elseif (isset($_REQUEST['cmt']) && ($_REQUEST['cmt'] == "pc")) {
$cmtAdd = " AND `onprogramcommittee`='T'";
$cmt = 'pc';
} else {
$cmtAdd = '';
$cmt = '';
}
printHeader("Committee Member Topic Count",1);
print '<p style="text-align: center;"><a href="list_topics_r.php?cmt=' . $cmt . '">Show Committee Members</a></p>';
if ($OC_configAR['OC_paperAdvocates']) {
$options = '<option value="">All Committee Members</option><option value="rev">Review Committee</option><option value="pc">Program Committee (Advocates)</option>';
print '
<form method="post" action="list_topics_rcount.php">
<input type="hidden" name="s" value="' . (isset($_REQUEST['s']) ? safeHTMLstr($_REQUEST['s']) : '') . '" />
<p style="text-align: center;">
<select name="cmt">' . preg_replace('/(value="' . $cmt . '")/', "$1 selected", $options) . '</select>
<input type="submit" value="Filter" />
</p>
</form>
';
}
$q = "SELECT `" . OCC_TABLE_TOPIC . "`.`topicid`, `" . OCC_TABLE_TOPIC . "`.`topicname`, `" . OCC_TABLE_TOPIC . "`.`short`, COUNT(`" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid`) AS `num` FROM `" . OCC_TABLE_TOPIC . "`, `" . OCC_TABLE_REVIEWERTOPIC . "`, `" . OCC_TABLE_REVIEWER . "` WHERE `" . OCC_TABLE_TOPIC . "`.`topicid`=`" . OCC_TABLE_REVIEWERTOPIC . "`.`topicid` AND `" . OCC_TABLE_REVIEWERTOPIC . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` $cmtAdd GROUP BY `" . OCC_TABLE_TOPIC . "`.`topicid`, `" . OCC_TABLE_TOPIC . "`.`topicname`, `" . OCC_TABLE_TOPIC . "`.`short` ORDER BY ";
if (!isset($_REQUEST['s']) || ($_REQUEST['s']=="topic")) {
$q .= "`topicname`";
$tsort = 'Topic<br />' . $OC_sortImg;
$nsort = '<a href="' . $_SERVER['PHP_SELF'] . '?s=num&cmt=' . (isset($_REQUEST['cmt']) ? urlencode($_REQUEST['cmt']) : '') . '">Count</a>';
} else {
$q .= "`num`";
$nsort = 'Count<br />' . $OC_sortImg;
$tsort = '<a href="' . $_SERVER['PHP_SELF'] . '?s=topic&cmt=' . (isset($_REQUEST['cmt']) ? urlencode($_REQUEST['cmt']) : '') . '">Topic</a>';
}
$r = ocsql_query($q) or err("Unable to get information");
if (ocsql_num_rows($r) == 0) {
print '<span class="warn">No reviewers have signed up yet</span><p>';
} else {
print '<table border="0" cellpadding="5" cellspacing="1" style="margin: 0 auto"><tr class="rowheader"><th valign="top">' . $tsort . '</th><th valign="top">' . $nsort .'</th></tr>';
$row = 1;
while ($l = ocsql_fetch_array($r)) {
print '<tr class="row' . $row . '"><td>' . safeHTMLstr(useTopic($l['short'],$l['topicname'])) . '</td><td align="right">' . $l['num'] . "</td></tr>\n";
if ($row==1) { $row=2; } else { $row=1; }
}
print "</table>";
}
printFooter();
?>
+144
View File
@@ -0,0 +1,144 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Log Search", 1);
// Retrieve entry types
$logTypeAR = array();
$r = ocsql_query("SELECT DISTINCT `type` FROM `" . OCC_TABLE_LOG . "` WHERE `type` NOT LIKE '%fail' ORDER BY `type`") or err('Failed to retrieve log types');
while ($l = ocsql_fetch_assoc($r)) {
$logTypeAR[] = $l['type'];
}
if (!isset($_POST['type']) && isset($_GET['type']) && in_array($_GET['type'], $logTypeAR)) {
$_POST['type'] = $_GET['type'];
}
// display search form
print '
<br />
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" id="membersform">
<div style="text-align: center;">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<select id="selfld" name="type" onchange="updateQueueBox();"><option value="">Type (all)</option>' . generateSelectOptions($logTypeAR, varValue('type', $_POST), false) . '</select>
<input name="q" size="20" placeholder="query" value="' . safeHTMLstr(varValue('q', $_POST)) . '" />
<input type="submit" name="subaction" class="submit" value="Search" />
&nbsp;
<label><input id="checkqueue" type="checkbox" name="checkqueue" value="1" ' . ((isset($_POST['checkqueue']) && ($_POST['checkqueue']==1)) ? 'checked ' : '') .' />include email messages</label>
</div>
<script>
var queueObj=document.getElementById("checkqueue"),
selObj=document.getElementById("selfld");
function updateQueueBox() {
var opt=selObj.options[selObj.selectedIndex].text;
if ((opt == "Type (all)") || (opt == "email")) {
queueObj.disabled=false;
queueObj.parentNode.style.color="#000";
} else {
queueObj.checked=false;
queueObj.disabled=true;
queueObj.parentNode.style.color="#999";
}
}
updateQueueBox();
</script>
';
// submission?
if (isset($_POST['subaction'])) {
// delete?
if (($_POST['subaction'] == 'Delete Log Entries') && isset($_POST['logids']) && is_array($_POST['logids']) && !empty($_POST['logids'])) {
foreach ($_POST['logids'] as $id) {
if ( ! ocsql_query("DELETE FROM `" . OCC_TABLE_LOG . "` WHERE `logid`='" . safeSQLstr($id) . "' LIMIT 1") ) {
print '<p class="warn" style="text-align: center;">Failed to delete Log ID ' . safeHTMLstr($id) . '</p>';
}
}
} elseif (($_POST['subaction'] == 'Delete Messages') && isset($_POST['queueids']) && is_array($_POST['queueids']) && !empty($_POST['queueids'])) {
foreach ($_POST['queueids'] as $id) {
if ( ! ocsql_query("DELETE FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE `id`='" . safeSQLstr($id) . "' LIMIT 1") ) {
print '<p class="warn" style="text-align: center;">Failed to delete Message ID ' . safeHTMLstr($id) . '</p>';
}
}
}
// search
if (isset($_POST['q']) && !empty($_POST['q'])) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
print '<p><hr /></p><div style="font-weight: bold; font-size: 1.1em;">Log Entries:</div>';
// log
$r = ocsql_query("SELECT * FROM `" . OCC_TABLE_LOG . "` WHERE " . ((isset($_POST['type']) && !empty($_POST['type'])) ? ("`type`='" . safeSQLstr($_POST['type']) . "' AND ") : "") . "(`entry` LIKE '%" . safeSQLstr($_POST['q']) . "%' OR `extra` LIKE '%" . safeSQLstr($_POST['q']) . "%') ORDER BY `datetime` DESC, `logid` DESC") or err('Unable to search log');
if (ocsql_num_rows($r) > 0) {
print '
<table border="0" cellspacing="1" cellpadding="5">
<tr><td colspan="5" align="right"><table border="0" cellspacing="0" cellpadding="3"><tr><td class="del"><input type="submit" name="subaction" value="Delete Log Entries" onclick="return confirm(\'Entries will be permanently deleted. Proceed?\');" /></td></tr></table></td></tr>
<tr class="rowheader"><th>Log&nbsp;ID</th><th>Date / Time (UTC)</th><th>Type</th><th>Entry</th><th class="del"><input type="checkbox" title="check/uncheck all boxes" onclick="oc_toggleCheckboxes(this.checked, \'logids[]\');" /></th></tr>
';
$row = 1;
while ($l = ocsql_fetch_assoc($r)) {
print '<tr class="row' . $row . '"><td>' . safeHTMLstr($l['logid']) . '</td><td style="white-space: nowrap;"><a href="log.php?id=' . $l['logid'] . (empty($limit) ? '&limit=0' : '') . ((isset($_POST['type']) && !empty($_POST['type'])) ? ('&type=' . safeHTMLstr($_POST['type'])) : '') . '" target="_blank" title="open entry in new window">' . safeHTMLstr($l['datetime']) . '</a></td><td>' . safeHTMLstr($l['type']) . '</td><td>' . safeHTMLstr(substr($l['entry'], 0, 80)) . ((strlen($l['entry']) > 80) ? '&#8230;' : '') . '</td><td class="del"><input type="checkbox" name="logids[]" value="' . safeHTMLstr($l['logid']) . '" /></td></tr>';
if ($row == 1) {
$row = 2;
} else {
$row = 1;
}
}
print '
<tr><td colspan="5" align="right"><table border="0" cellspacing="0" cellpadding="3"><tr><td class="del"><input type="submit" name="subaction" value="Delete Log Entries" onclick="return confirm(\'Entries will be permanently deleted. Proceed?\');" /></td></tr></table></td></tr>
</table>
';
} else {
print '<p class="warn">No log entries found</p>';
}
// queue
if (isset($_POST['checkqueue']) && ($_POST['checkqueue'] == 1)) {
print '<p><hr /></p><div style="font-weight: bold; font-size: 1.1em;">Messages:</div>';
$r = ocsql_query("SELECT * FROM `" . OCC_TABLE_EMAIL_QUEUE . "` WHERE (`to` LIKE '%" . safeSQLstr($_POST['q']) . "%' OR `subject` LIKE '%" . safeSQLstr($_POST['q']) . "%' OR `body` LIKE '%" . safeSQLstr($_POST['q']) . "%') ORDER BY `queued` DESC") or err('Unable to search messages');
if (ocsql_num_rows($r) > 0) {
print '
<table border="0" cellspacing="1" cellpadding="5">
<tr><td colspan="5" align="right"><table border="0" cellspacing="0" cellpadding="3"><tr><td class="del"><input type="submit" name="subaction" value="Delete Messages" onclick="return confirm(\'Messages will be permanently deleted. Proceed?\');" /></td></tr></table></td></tr>
<tr class="rowheader"><th>Msg&nbsp;ID</th><th>Queued (UTC)</th><th>To</th><th>Subject</th><th class="del"><input type="checkbox" title="check/uncheck all boxes" onclick="oc_toggleCheckboxes(this.checked, \'queueids[]\');" /></th></tr>
';
$row = 1;
while ($l = ocsql_fetch_assoc($r)) {
print '<tr class="row' . $row . '"><td>' . safeHTMLstr($l['id']) . '</td><td style="white-space: nowrap;"><a href="email-queue-log.php?lid=&qid=' . $l['id'] . '" target="_blank" title="open entry in new window">' . safeHTMLstr($l['queued']) . '</a></td><td>' . safeHTMLstr($l['to']) . '</td><td>' . safeHTMLstr(substr($l['subject'], 0, 80)) . ((strlen($l['subject']) > 80) ? '&#8230;' : '') . '</td><td class="del"><input type="checkbox" name="queueids[]" value="' . safeHTMLstr($l['id']) . '" /></td></tr>';
if ($row == 1) {
$row = 2;
} else {
$row = 1;
}
}
print '
<tr><td colspan="5" align="right"><table border="0" cellspacing="0" cellpadding="3"><tr><td class="del"><input type="submit" name="subaction" value="Delete Messages" onclick="return confirm(\'Messages will be permanently deleted. Proceed?\');" /></td></tr></table></td></tr>
</table>
';
} else {
print '<p class="warn">No messages found</p>';
}
}
}
}
print '</form>';
printFooter();
?>
+96
View File
@@ -0,0 +1,96 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Log", 1);
if (isset($_GET['type']) && preg_match("/^[\w-]+$/", $_GET['type'])) {
$type = $_GET['type'];
} else {
$type = '';
}
// Single log entry
if (isset($_GET['id']) && ctype_digit($_GET['id'])) {
print '<p style="text-align: center"><a href="' . $_SERVER['PHP_SELF'] . '?' . ((isset($_GET['limit']) && ($_GET['limit'] == 0)) ? 'limit=0&' : '') . (!empty($type) ? ('type=' . safeHTMLstr($type)) : '') . '">show ' . (!empty($type) ? safeHTMLstr($type) : '') . ' entries</a> | <a href="log-search.php?type=' . urlencode($type) . '">search</a></p>';
$q = "SELECT * FROM `" . OCC_TABLE_LOG . "` WHERE `logid`='" . safeSQLstr($_GET['id']) . "'";
$r = ocsql_query($q) or err('Unable to retrieve log entry');
if (ocsql_num_rows($r) == 0) {
warn('Log entry not found');
} else {
$l = ocsql_fetch_assoc($r);
print '<strong>Date/Time:</strong> ' . safeHTMLstr($l['datetime']);
if ($l['type'] == 'email') {
print ' &nbsp; (<a href="email-queue-log.php?lid=' . $l['logid'] . '">view individual messages/status</a>)';
}
print '<br />
<strong>Type:</strong> ' . safeHTMLstr($l['type']) . '<br />
<strong>Entry:</strong> ' . safeHTMLstr($l['entry']) . '<br />
<br /><hr /><br />
' . nl2br(safeHTMLstr($l['extra'])) . '<br />
';
}
} else { // all entries
if (isset($_GET['limit']) && ($_GET['limit'] == 0)) { // limit entries?
$limit = '';
} else {
$limit = ' LIMIT 30';
print '<p style="text-align: center"><a href="' . $_SERVER['PHP_SELF'] . '?limit=0' . (!empty($type) ? ('&type=' . safeHTMLstr($type)) : '') . '">show all ' . safeHTMLstr($type) . ' entries</a> | <a href="log-search.php?type=' . urlencode($type) . '">search</a></p>';
}
// 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 '<p class="note">The Date/Time column is shown in Coordinated Universal Time (UTC).<br />UTC ' . date('P') . ' = ' . safeHTMLstr($GLOBALS['OC_configAR']['OC_timeZone'] ) . '</p>';
}
print '<table border="0" cellspacing="1" cellpadding="5"><tr class="rowheader"><th>Date / Time (UTC)</th><th>Type</th><th>Entry</th></tr>';
$row = 1;
while ($l = ocsql_fetch_assoc($r)) {
print '<tr class="row' . $row . '"><td style="white-space: nowrap;">';
if (!empty($l['extra'])) { // extra stuff? if so link it in
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $l['logid'] . (empty($limit) ? '&limit=0' : '') . (!empty($type) ? ('&type=' . safeHTMLstr($type)) : '') . '">' . safeHTMLstr($l['datetime']) . '</a>';
} else {
print safeHTMLstr($l['datetime']);
}
print '</td><td>' . safeHTMLstr($l['type']);
if (($l['type'] == 'email') && in_array($l['datetime'], $failedMessageAR)) {
print ' &ndash; <a href="email-queue-log.php?lid=' . $l['logid'] . '" style="color: #f00; text-decoration: underline;" title="click to view individual messages/status">failed</a>';
}
print '</td><td>' . safeHTMLstr($l['entry']) . "</td></tr>\n";
if ($row == 1) {
$row = 2;
} else {
$row = 1;
}
}
print '</table>';
}
printFooter();
?>
+144
View File
@@ -0,0 +1,144 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader('Auto-Notification Templates', 1);
// Retrieve templates
$templateAR = array();
$q = "SELECT `templateid`, `name`, `module`, `variables` FROM `" . OCC_TABLE_TEMPLATE . "` WHERE `type`='notification' 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("/advocate/", $l['templateid'])) {
$templateAR[$l['templateid']] = array('name' => $l['name'], 'variables' => $l['variables']);
}
}
$defaultVariables = array(
'OC_pcemail' => 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',
);
clearstatcache();
function oc_templateForm($tid, $subject, $body) {
print '
<p style="text-align: center;"><a href="' . $_SERVER['PHP_SELF'] . '">all templates</a></p>
<br />
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="templateid" value="' . safeHTMLstr($tid) . '" />
<table cellpadding="0" cellspacing="10">
<tr><td valign="top"><b>Template:</b></td><td>' . safeHTMLstr($GLOBALS['templateAR'][$tid]['name']) . '</td><td>&nbsp;</td></tr>
<tr><td><b><label for="subject">Subject:</label></b></td><td><input name="subject" id="subject" size="70" maxlength="70" value="' . safeHTMLstr($subject) . '" /></td><td>&nbsp;</td></tr>
<tr><td colspan="3"><b><label for="body">Message:</label></b></td><td>&nbsp;</td></tr>
<tr>
<td colspan="2"><textarea name="body" id="body" rows="20" cols="70">' . safeHTMLstr($body) . '</textarea></td>
<td valign="top">
';
print '
<b>[:variables:]</b>
<br /><br />
<table border="0" cellspacing="5" callpadding="0">
';
foreach ($GLOBALS['defaultVariables'] as $k => $v) {
print '<tr><td>[:' . safeHTMLstr($k) . ':]</td><td><i>'. safeHTMLstr($v) . '</i></td></tr>';
}
if (!empty($GLOBALS['templateAR'][$tid]['variables'])) {
$vars = json_decode($GLOBALS['templateAR'][$tid]['variables']);
foreach ($vars as $k => $v) {
print '<tr><td>[:' . safeHTMLstr($k) . ':]</td><td><i>'. safeHTMLstr($v) . '</i></td></tr>';
}
}
print '
</table>
</td>
</tr>
<tr><td colspan="2"><input type="submit" name="ocaction" class="submit" value="Save Template" /></td></tr>
</table>
</form>
<p class="note">The variables appearing next to the message field may be used in your email by enclosing each instance in [:<em>variable</em>:] . 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.</p>
';
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 '<p class="warn" style="text-align: center;">Template not found</p>';
}
} 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 '<p class="note2" style="text-align: center;">Template saved</p>';
} else {
print '<p class="warn" style="text-align: center;">' . $err . '</p>';
}
oc_templateForm($templateid, $subject, $body);
exit;
}
print '
<p class="note" style="text-align: center;">click name to edit</p>
<table border="0" cellspacing="1" cellpadding="5" style="margin: 0 auto;">
';
$row = 2;
foreach ($templateAR as $templateID => $templateInfo) {
print '<tr class="row' . $row . '"><td><label for="' . safeHTMLstr($templateID) . '"><a href="' . $_SERVER['PHP_SELF'] . '?ocaction=edit&tid=' . safeHTMLstr($templateID) . '">' . safeHTMLstr($templateInfo['name']) . '</a></label></td></tr>';
$row = $rowAR[$row];
}
print '
</table>
<p style="text-align:center; margin-top:2em;" class="note">If modifying a template and non-English language(s)<br />in use, include translation(s) in the template.</p>
';
printFooter();
?>
+163
View File
@@ -0,0 +1,163 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once '../include.php';
require_once OCC_PLUGINS_DIR . 'ckeditor.inc';
$OC_extraHeaderAR[] = '
<script language="javascript" type="text/javascript">
<!--
function oc_showHideDiv(fldName, divID) {
if (document.getElementById) {
if (document.getElementById(fldName).checked) {
document.getElementById(divID).style.display="block";
} else {
document.getElementById(divID).style.display="none";
}
}
}
// -->
</script>
';
beginChairSession();
printHeader("Privacy Settings", 1);
$OC_configVars = array('OC_privacy_display', 'OC_privacy_link', 'OC_privacy_banner_options');
$OC_privacyDisplayOptionsAR = array(
0 => 'none',
1 => 'menu',
2 => 'page footer'
);
function ef($fsf, $ochsf) {
if (preg_match("/(,?)" . $fsf . "(,?)/", $ochsf, $efmatches)) {
if (($efmatches[1] == ',') && ($efmatches[2] == ',')) {
$efreplace = ',';
} else {
$efreplace = '';
}
$ochsf = preg_replace("/,?" . $fsf . ",?/", $efreplace, $ochsf);
}
return($ochsf);
}
$oc_bannerAR = json_decode($OC_configAR['OC_privacy_banner_options'], true) or err('Invalid banner options setting');
if (isset($_POST['submit']) && ($_POST['submit'] == 'Save Settings')) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
$err = array();
// Check input
if (!preg_match("/^[01]$/", $_POST['OC_privacy_banner_display'])) {
$err[] = 'Banner Display option invalid';
}
if (!isset($_POST['OC_privacy_display']) || !isset($OC_privacyDisplayOptionsAR[$_POST['OC_privacy_display']])) {
$err[] = 'Policy Link Display invalid';
}
if (isset($_POST['OC_privacy_display']) && (oc_strlen($_POST['OC_privacy_display']) > 250)) {
$err[] = 'Policy Web Address too long';
}
if (!empty($err)) {
print '<p class="warn">Please re-enter your settings, noting the following:<ul><li>' . implode('</li><li>', $err) . '</li></ul></p><hr /><br />';
} else {
// Update bannerAR
$oc_bannerAR['display'] = $_POST['OC_privacy_banner_display'];
$oc_bannerAR['message'] = $_POST['OC_privacy_banner_message'];
$oc_bannerAR['dismiss'] = $_POST['OC_privacy_banner_dismiss'];
$_POST['OC_privacy_banner_options'] = json_encode($oc_bannerAR);
// Update config
updateAllConfigSettings($OC_configVars, $_POST, 'OC');
// Update Template
if ( ! ocsql_query("UPDATE `" . OCC_TABLE_TEMPLATE . "` SET `subject`='', `body`='" . safeSQLstr(varValue('OC_privacy_policy', $_POST)) . "', `updated`='" . safeSQLstr(date("Y-m-d")) . "' WHERE `templateid`='privacy_policy' AND `type`='other' LIMIT 1") ) {
warn('Failed to save privacy policy');
}
// Update consent form fields if necessary
if (OCC_LICENSE == 'Public') {
if (($_POST['OC_privacy_display'] == 0)) {
if ( ! preg_match("/fs_consent:consent/", $OC_configAR['OC_hideSubFields']) ) {
ocsql_query("UPDATE `" . OCC_TABLE_CONFIG . "` SET `value`=CONCAT(`value`, ',fs_consent:consent') WHERE `module`='OC' AND `setting`='OC_hideSubFields' LIMIT 1");
}
if ( ! preg_match("/fs_consent:consent/", $OC_configAR['OC_hideCmtFields']) ) {
ocsql_query("UPDATE `" . OCC_TABLE_CONFIG . "` SET `value`=CONCAT(`value`, ',fs_consent:consent') WHERE `module`='OC' AND `setting`='OC_hideCmtFields' LIMIT 1");
}
} else {
if (preg_match("/fs_consent:consent/", $OC_configAR['OC_hideSubFields'])) {
ocsql_query("UPDATE `" . OCC_TABLE_CONFIG . "` SET `value`='" . safeSQLstr(ef('fs_consent:consent', $OC_configAR['OC_hideSubFields'])) . "' WHERE `module`='OC' AND `setting`='OC_hideSubFields' LIMIT 1");
}
if (preg_match("/fs_consent:consent/", $OC_configAR['OC_hideCmtFields'])) {
ocsql_query("UPDATE `" . OCC_TABLE_CONFIG . "` SET `value`='" . safeSQLstr(ef('fs_consent:consent', $OC_configAR['OC_hideCmtFields'])) . "' WHERE `module`='OC' AND `setting`='OC_hideCmtFields' LIMIT 1");
}
}
}
// notify user
print '<p style="text-align: center" class="note">Settings Saved</p>';
}
$OC_privacy_policy = $_POST['OC_privacy_policy'];
} else {
// retrieve policy template
list($none, $OC_privacy_policy) = oc_getTemplate('privacy_policy');
}
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" class="ocform occonfigform">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<script>
document.write(\'<p style="margin: 0 0 2em 1em;"><span style="color: #66f; text-decoration: underline; cursor: pointer;" onclick="oc_fsCollapseExpand(0)">collapse all</span> &nbsp; &nbsp; <span style="color: #66f; text-decoration: underline; cursor: pointer;" onclick="oc_fsCollapseExpand(1)">expand all</span></p>\');
</script>
<fieldset id="oc_fs_banner">
<legend onclick="oc_fsToggle(this)">Banner <span>(collapse)</span></legend>
<div id="oc_fs_banner_div">
<div class="fieldsetnote note">When Display Banner is set to Yes, a banner with the Message below is shown until the Dismiss Button is clicked. If the Privacy Policy is enabled, a link to the policy is automatically included in the banner.</div>
<div class="field"><label for="OC_privacy_banner_display">Display Banner:</label><fieldset class="radio">' . generateRadioOptions('OC_privacy_banner_display', $yesNoAR, $oc_bannerAR['display']) . '</fieldset></div>
<div class="field"><label for="OC_privacy_banner_message">Message:</label><textarea name="OC_privacy_banner_message" id="OC_privacy_banner_message" rows="2" cols="70">' . safeHTMLstr($oc_bannerAR['message']) . '</textarea></div>
<div class="field"><label for="OC_privacy_banner_dismiss">Dismiss Button:</label><input name="OC_privacy_banner_dismiss" id="OC_privacy_banner_dismiss" value="' . safeHTMLstr($oc_bannerAR['dismiss']) . '" size="20" maxlength="20" /></div>
<input type="submit" name="submit" value="Save Settings" class="submit" />
</div>
</fieldset>
<fieldset id="oc_fs_privacy">
<legend onclick="oc_fsToggle(this)">Privacy Policy <span>(collapse)</span></legend>
<div id="oc_fs_privacy_div">
<div class="fieldsetnote note" style="margin-bottom: 2em;">Select whether to include a Privacy Policy link in the menu or page footer, and either provide a link to the policy on your own web site or customize the one below. Although not required, it is strongly recommended that a privacy policy be provided. Translations of the privacy policy are not included, however may be entered below. A Display option other than "none" must be set for the Privacy Policy to be viewed.</div>
<div class="field"><label for="OC_privacy_display">Policy Link Display:</label><fieldset class="radio">' . generateRadioOptions('OC_privacy_display', $OC_privacyDisplayOptionsAR, varValue('OC_privacy_display', $OC_configAR)) . '</fieldset><div class="fieldnote note">Location to display Privacy Policy link.' . ((OCC_LICENSE == 'Public') ? ' If location set, consent fields are added to non-custom forms.' : '') . '</div></div>
<div class="field"><label for="OC_privacy_link">Policy Web Address:</label><input name="OC_privacy_link" id="OC_privacy_link" value="' . safeHTMLstr(varValue('OC_privacy_link', $OC_configAR)) . '" size="80" maxlength="250" placeholder="https://" /><div class="fieldnote note">Enter the full URL of the privacy policy on your web site or leave blank to display the policy below</div></div>
<div class="field"><label for="OC_privacy_policy">Privacy Policy:</label><textarea name="OC_privacy_policy" id="OC_privacy_policy" rows="20" cols="70">' . safeHTMLstr($OC_privacy_policy) . '</textarea></div>
<input type="submit" name="submit" value="Save Settings" class="submit" />
</div>
</fieldset>
</form>
';
oc_replaceCKEditor(array('OC_privacy_policy'), true, 600, 400);
printFooter();
?>
+55
View File
@@ -0,0 +1,55 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
printHeader("Reset Password", 3);
if (! $OC_configAR['OC_chairPasswordForgot']) {
print '<p class="err" style="text-align: center;">Functionality disabled</p>';
}
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 '<p style="text-align: center" class="warn">' . OCC_WORD_CHAIR . ' username entered is invalid.</p>';
}
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 '<p>We have emailed you a new password. Once you receive it, please <a href="signin.php">sign in</a> and change it.</p>';
} else {
warn('We have generated a new password for you, but were unable to email it. Please contact the OpenConf administrator');
}
}
} else {
print '
<p class="note2" style="text-align: center"">Enter ' . OCC_WORD_CHAIR . '\'s username and click the <em>Reset Password</em> button</p>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<table border="0" style="margin: 0 auto">
<tr><td><strong><label for="uname">' . OCC_WORD_CHAIR . ' Username:</label></strong></td><td><input size=20 name="uname" id="uname" value="' . (isset($_POST['uname']) ? safeHTMLstr($_POST['uname']) : '') . '"></td></tr>
<tr><th align="center" colspan=2><br><input type="submit" name="submit" class="submit" value="Reset Password"></th></tr>
</table>
</form>
<p>
';
}
printFooter();
?>
+296
View File
@@ -0,0 +1,296 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
function setupFieldsAR(&$fieldsAR, &$OC_fieldsetAR, &$OC_fieldAR, &$dateFieldsAR, &$skipFieldTypeAR, &$skipFieldIdAR) {
foreach ($OC_fieldsetAR as $fsAR) {
foreach ($fsAR['fields'] as $f) {
if (!in_array($OC_fieldAR[$f]['type'], $skipFieldTypeAR) && !in_array($f, $skipFieldIdAR)) {
$fieldsAR[$f] = array(
'short' => 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 '<html lang="' . $GLOBALS['OC_locale'] . '"' . (OCC_LANGUAGE_LTR ? '' : ' dir="rtl"') . '
<head>
<meta charset="utf-8">
<title>Search</title>
<link rel="stylesheet" type="text/css" href="' . $GLOBALS['pfx'] . 'openconf.css?v=11" />
' .
(
( defined('OCC_LANGUAGE_LTR') && ( ! OCC_LANGUAGE_LTR ) )
?
'<link rel="stylesheet" type="text/css" href="' . $GLOBALS['pfx'] . 'openconf-rtl.css?v=8" />'
:
''
) . '
</head>
<body>
';
}
function displayResultsFooter() {
print '
</body>
</html>
';
}
function validateSearchFields($i, &$fieldsAR, &$intFieldsAR, &$dateFieldsAR, $decFieldsAR=array()) {
if (
// field selected exists and is valid
isset($_POST['searchfield'.$i]) && isset($fieldsAR[$_POST['searchfield'.$i]])
&&
// field operator exists and is valid
isset($_POST['searchoperator'.$i]) && preg_match("/^(?:is|contains|before|after)$/", $_POST['searchoperator'.$i])
&&
// field value entered/selected
isset($_POST['searchvalue'.$i]) && !empty($_POST['searchvalue'.$i])
&&
// field value exists if selection
(
!isset($fieldsAR[$_POST['searchvalue'.$i]]['values'])
||
isset($fieldsAR[$_POST['searchvalue'.$i]]['values'][$_POST['searchvalue'.$i]])
)
&&
// int field format valid
(
!in_array($_POST['searchfield'.$i], $intFieldsAR)
||
preg_match("/^\d+$/", $_POST['searchvalue'.$i])
)
&&
// decimal field format valid
(
!in_array($_POST['searchfield'.$i], $decFieldsAR)
||
preg_match("/^\d+(\.\d{1,2})?$/", $_POST['searchvalue'.$i])
)
&&
// date field format valid
(
!in_array($_POST['searchfield'.$i], $dateFieldsAR)
||
preg_match("/^\d{4}-\d\d-\d\d$/", $_POST['searchvalue'.$i])
)
) {
return(true);
} else {
return(false);
}
}
function displayEmailForm(&$emailAddresses, $recipient, $submitText) {
print '
<form method="post" action="email.php" target="_blank">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="submit" value="Edit Message" />
<input type="hidden" name="recipient" value="' . $recipient . '" />
<input type="hidden" name="template" value="" />
<input type="hidden" name="subject" value="" />
<input type="hidden" name="message" value="" />
<input type="hidden" name="select_recipients" value="1" />
';
foreach ($emailAddresses as $eAddress) {
print '<input type="hidden" name="selected_recipients[]" value="' . safeHTMLstr($eAddress) . '" />';
}
print '
<p><input type="submit" value="' . $submitText . '" title="opens in new tab/window" class="submit" /></p>
</form>
';
}
function displaySearchForm(&$fieldsAR, &$dateFieldsAR, &$intFieldsAR, &$decFieldsAR, &$searchFieldNum) {
print '
<style>
#searchForm input[type=text] { width: 30em; }
#searchForm input[type=date] { font-family: verdana, arial, helvetica, sans-serif; }
#searchForm div { margin: 1em 0; }
#searchResults { border: 0; width: 100%; margin-top: 2em; }
</style>
<script>
var year = new Date().getFullYear(),
dateFieldsAR = [' . ((count($dateFieldsAR) > 0) ? ("'" . implode("','", $dateFieldsAR). "'") : '') . '],
intFieldsAR = [' . ((count($intFieldsAR) > 0) ? ("'" . implode("','", $intFieldsAR). "'") : '') . '],
decFieldsAR = [' . ((count($decFieldsAR) > 0) ? ("'" . implode("','", $decFieldsAR). "'") : '') . '],
fieldOptionsAR = {};
';
$fieldOptions = '';
$fs = '';
foreach ($fieldsAR as $f => $fAR) {
if ($fAR['fieldset'] != $fs) {
$fieldOptions .= '<option value="" disabled>&gt;&gt;' . safeHTMLstr($fAR['fieldset']) . '</option>';
$fs = $fAR['fieldset'];
}
$fieldOptions .= '<option value="' . safeHTMLstr($f) . '">' . safeHTMLstr($fAR['short']) . '</option>';
if (isset($fAR['values'])) {
$jsFieldOptions = '';
foreach ($fAR['values'] as $k => $v) {
$jsFieldOptions .= '<option value="' . preg_replace("/'/", "\\'", safeHTMLstr($k)) . '">' . preg_replace("/'/", "\\'", safeHTMLstr(substr($v, 0, 50))) . '</option>';
}
print "fieldOptionsAR['" . safeHTMLstr($f) . "'] = '" . $jsFieldOptions . "';\n";
}
}
print '
function updateField(searchField, fieldID) {
if (dateFieldsAR.includes(fieldID)) {
document.getElementById("searchvalue" + searchField + "span").innerHTML = \'<input type="date" name="searchvalue\' + searchField + \'" value="" placeholder="\' + year + \'-05-30" pattern="\d{4}-\d{2}-\d{2}">\';
document.getElementById("searchoperator" + searchField + "_is").selected = true;
document.getElementById("searchoperator" + searchField + "_is").innerHTML = "= is";
document.getElementById("searchoperator" + searchField + "_contains").disabled = true;
document.getElementById("searchoperator" + searchField + "_contains").innerHTML = "⊂";
document.getElementById("searchoperator" + searchField + "_before").disabled = false;
document.getElementById("searchoperator" + searchField + "_before").innerHTML = "&lt; before";
document.getElementById("searchoperator" + searchField + "_after").disabled = false;
document.getElementById("searchoperator" + searchField + "_after").innerHTML = "&gt; after";
document.getElementById("searchoperator" + searchField + "_onbefore").disabled = false;
document.getElementById("searchoperator" + searchField + "_onbefore").innerHTML = "&lt;= on or before";
document.getElementById("searchoperator" + searchField + "_onafter").disabled = false;
document.getElementById("searchoperator" + searchField + "_onafter").innerHTML = "&gt;= on or after";
} else if (fieldOptionsAR.hasOwnProperty(fieldID)) {
document.getElementById("searchvalue" + searchField + "span").innerHTML = \'<select name="searchvalue\' + searchField + \'"><option value="" disabled selected hidden>select value</option>\' + fieldOptionsAR[fieldID] + \'</select>\';
document.getElementById("searchoperator" + searchField + "_is").selected = true;
document.getElementById("searchoperator" + searchField + "_is").innerHTML = "= is";
document.getElementById("searchoperator" + searchField + "_contains").disabled = true;
document.getElementById("searchoperator" + searchField + "_contains").innerHTML = "⊂";
document.getElementById("searchoperator" + searchField + "_before").disabled = true;
document.getElementById("searchoperator" + searchField + "_before").innerHTML = "&lt;";
document.getElementById("searchoperator" + searchField + "_after").disabled = true;
document.getElementById("searchoperator" + searchField + "_after").innerHTML = "&gt;";
document.getElementById("searchoperator" + searchField + "_onbefore").disabled = true;
document.getElementById("searchoperator" + searchField + "_onbefore").innerHTML = "&lt;=";
document.getElementById("searchoperator" + searchField + "_onafter").disabled = true;
document.getElementById("searchoperator" + searchField + "_onafter").innerHTML = "&gt;=";
} else {
document.getElementById("searchvalue" + searchField + "span").innerHTML = \'<input type="text" name="searchvalue\' + searchField + \'" value="">\';
document.getElementById("searchoperator" + searchField + "_is").selected = true;
if (intFieldsAR.includes(fieldID) || decFieldsAR.includes(fieldID)) {
document.getElementById("searchoperator" + searchField + "_is").selected = true;
document.getElementById("searchoperator" + searchField + "_is").innerHTML = "= equals";
document.getElementById("searchoperator" + searchField + "_contains").disabled = true;
document.getElementById("searchoperator" + searchField + "_contains").innerHTML = "⊂";
document.getElementById("searchoperator" + searchField + "_before").disabled = false;
document.getElementById("searchoperator" + searchField + "_before").innerHTML = "&lt; less than";
document.getElementById("searchoperator" + searchField + "_after").disabled = false;
document.getElementById("searchoperator" + searchField + "_after").innerHTML = "&gt; more than";
document.getElementById("searchoperator" + searchField + "_onbefore").disabled = false;
document.getElementById("searchoperator" + searchField + "_onbefore").innerHTML = "&lt;= less or equals";
document.getElementById("searchoperator" + searchField + "_onafter").disabled = false;
document.getElementById("searchoperator" + searchField + "_onafter").innerHTML = "&gt;= more or equals";
} else {
document.getElementById("searchoperator" + searchField + "_is").selected = true;
document.getElementById("searchoperator" + searchField + "_is").innerHTML = "= is";
document.getElementById("searchoperator" + searchField + "_contains").disabled = false;
document.getElementById("searchoperator" + searchField + "_contains").innerHTML = "⊂ contains";
document.getElementById("searchoperator" + searchField + "_before").disabled = true;
document.getElementById("searchoperator" + searchField + "_before").innerHTML = "&lt;";
document.getElementById("searchoperator" + searchField + "_after").disabled = true;
document.getElementById("searchoperator" + searchField + "_after").innerHTML = "&gt;";
document.getElementById("searchoperator" + searchField + "_onbefore").disabled = true;
document.getElementById("searchoperator" + searchField + "_onbefore").innerHTML = "&lt;=";
document.getElementById("searchoperator" + searchField + "_onafter").disabled = true;
document.getElementById("searchoperator" + searchField + "_onafter").innerHTML = "&gt;=";
}
}
}
function resizeIFrame(iframeObj) {
iframeObj.style.height = iframeObj.contentWindow.document.documentElement.scrollHeight + "px";
}
</script>
<p>Select one or more fields to search on and enter your query, then click the <i>Search</i> 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.</p>
<form method="post" target="searchResults" action="' . $_SERVER['PHP_SELF'] . '" id="searchForm">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
';
for ($i=1; $i <= $searchFieldNum; $i++) {
print '
<div>
<label>
<select name="searchfield' . $i . '" onchange="updateField(' . $i . ', this.options[this.selectedIndex].value)">
<option value="" selected disabled hidden>select field</option>
' . $fieldOptions . '
</select>
<select name="searchoperator' . $i . '">
<option value="is" id="searchoperator' . $i . '_is">=</option>
<option value="contains" id="searchoperator' . $i . '_contains" disabled>⊂</option>
<option value="before" id="searchoperator' . $i . '_before" disabled>&lt;</option>
<option value="after" id="searchoperator' . $i . '_after" disabled>&gt;</option>
<option value="before" id="searchoperator' . $i . '_onbefore" disabled>&lt;=</option>
<option value="after" id="searchoperator' . $i . '_onafter" disabled>&gt;=</option>
</select>
<span id="searchvalue' . $i . 'span" aria-live="polite">
<input type="text" name="searchvalue' . $i . '" value="" />
</span>
</label>
</div>
';
}
print '
<p><input type="submit" name="ocsubmit" value="Search" class="submit" /></p>
</form>
<iframe name="searchResults" id="searchResults" onload="resizeIFrame(this);" aria-live="polite"></iframe>
';
}
+131
View File
@@ -0,0 +1,131 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession((isset($_POST['ocsubmit']) ? true : false));
require_once 'search.inc';
require_once OCC_COMMITTEE_INC_FILE;
$skipFieldTypeAR = array('password'); // field types to be skipped
$skipFieldIdAR = array('consent'); // field IDs to be skipped
$searchFieldNum = 3; // number of search fields to display
// Setup searchable fields
$fieldsAR = array();
$dateFieldsAR = array();
$intFieldsAR = array();
$decFieldsAR = array();
$fieldsAR['reviewerid'] = array(
'short' => '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 '<p class="warn">Invalid submission</p>';
} 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 '
<p style="font-size: 0.9em">Matches: ' . safeHTMLstr($num) . '</p>
<table border="0" cellspacing="1" cellpadding="4" cols="4">
<tr class="rowheader"><th scope="col" title="Reviewer ID">ID</th><th scope="col" title="On Program Committee">PC</th><th scope="col">Name</th><th scope="col">Username</th></tr>';
$emailAddresses = array();
$row = 1;
while ($l = ocsql_fetch_assoc($r)) {
print '<tr class="row' . $row . '"><td align="right">' . safeHTMLstr($l['reviewerid']) . '</td><td align="center">' . (($l['onprogramcommittee'] == 'T') ? '<span title="on program committee">&#10003</span>' : '') . '</td><td><a href="show_reviewer.php?rid=' . safeHTMLstr($l['reviewerid']) . '" target="_blank" title="open member info page in new tab/window">' . safeHTMLstr($l['name']) . '</a></td><td>' . safeHTMLstr($l['username']) . '</td></tr>';
if ($row==1) { $row=2; } else { $row=1; }
$emailAddresses[] = $l['reviewerid'] . '/' . $l['email'];
}
print '
</table>
';
displayEmailForm($emailAddresses, 'reviewer_pc_all', 'Email Committee Member(s)');
} else {
print '<p class="warn">No matches found</p>';
}
} else {
print '<p class="warn">Error encoutered while searching</p>';
}
} else {
print '<p class="warn">Missing or invalid search parameters</p>';
}
}
displayResultsFooter();
exit;
}
// Display search form
printHeader('Committee Members Search', 1);
displaySearchForm($fieldsAR, $dateFieldsAR, $intFieldsAR, $decFieldsAR, $searchFieldNum);
printFooter();
?>
+182
View File
@@ -0,0 +1,182 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once '../include.php';
beginChairSession((isset($_POST['ocsubmit']) ? true : false));
require_once 'search.inc';
require_once OCC_SUBMISSION_INC_FILE;
$skipFieldTypeAR = array('password', 'file'); // field types to be skipped
$skipFieldIdAR = array('consent', 'contactid'); // field IDs to be skipped
$searchFieldNum = 3; // number of search fields to display
// Setup searchable fields
$fieldsAR = array();
$dateFieldsAR = array();
$intFieldsAR = array();
$decFieldsAR = array();
$fieldsAR['paperid'] = array(
'short' => '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 '<p class="warn">Invalid submission</p>';
} 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 '
<p style="font-size: 0.9em">Matches: ' . safeHTMLstr($num) . '</p>
<table border="0" cellspacing="1" cellpadding="4" cols="4">
<tr class="rowheader"><th scope="col">ID</th><th scope="col">Title</th><th scope="col">Contact</th>' . (isset($fieldsAR['type']) ? '<th scope="col">Type</th>' : '') . '</tr>';
$emailAddresses = array();
$row = 1;
while ($l = ocsql_fetch_assoc($r)) {
print '<tr class="row' . $row . '"><td align="right">' . safeHTMLstr($l['paperid']) . '</td><td><a href="show_paper.php?pid=' . safeHTMLstr($l['paperid']) . '" target="_blank" title="open submission info page in new tab/window">' . safeHTMLstr($l['title']) . '</a></td><td>' . safeHTMLstr($l['name']) . '</td>' . (isset($fieldsAR['type']) ? ('<td>' . safeHTMLstr($l['type']) . '</td>') : '') . '</tr>';
if ($row==1) { $row=2; } else { $row=1; }
$emailAddresses[] = $l['paperid'] . '/' . $l['email'];
}
print '
</table>
';
displayEmailForm($emailAddresses, 'authors_all', 'Email Contact Author(s)');
} else {
print '<p class="warn">No matches found</p>';
}
} else {
print '<p class="warn">Error encoutered while searching</p>';
}
} else {
print '<p class="warn">Missing or invalid search parameters</p>';
}
}
displayResultsFooter();
exit;
}
// Display search form
printHeader('Submissions Search', 1);
displaySearchForm($fieldsAR, $dateFieldsAR, $intFieldsAR, $decFieldsAR, $searchFieldNum);
printFooter();
?>
+585
View File
@@ -0,0 +1,585 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
// Update any settings added/deleted in $settingsAR below
$OC_wordForAuthorAR = array('Applicant', 'Author', 'Contributor', 'Presenter', 'Speaker'); // only use words that 's' can be added at end to make plural
$OC_wordForChairAR = array('Administrator', 'Chair', 'Editor');
if (isset($OC_configAR['OC_wordForAuthor']) && !empty($OC_configAR['OC_wordForAuthor']) && !in_array($OC_configAR['OC_wordForAuthor'], $OC_wordForAuthorAR)) {
$OC_wordForAuthorAR[] = $OC_configAR['OC_wordForAuthor'];
}
if (isset($OC_configAR['OC_wordForChair']) && !empty($OC_configAR['OC_wordForChair']) && !in_array($OC_configAR['OC_wordForChair'], $OC_wordForChairAR)) {
$OC_wordForChairAR[] = $OC_configAR['OC_wordForChair'];
}
$hdr = '';
$hdrfn = 1;
require_once '../include.php';
require_once OCC_ZONE_FILE_EN;
require_once OCC_PLUGINS_DIR . 'ckeditor.inc';
$OC_extraHeaderAR[] = '
<script language="javascript" type="text/javascript">
<!--
function oc_showHideDiv(fldName, divID) {
if (document.getElementById) {
if (document.getElementById(fldName).checked) {
document.getElementById(divID).style.display="block";
} else {
document.getElementById(divID).style.display="none";
}
}
}
// -->
</script>
';
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 .= '<option value="' . $mid . '">' . safeHTMLstr($mname) . '</option>';
}
if (!empty($moduleOptions)) {
print '
<form method="get" action="../modules/request.php">
<p style="text-align: center">
<input type="hidden" name="action" value="settings.inc" />
Config Module: <select name="module">
<option value=""></option>
' . $moduleOptions . '
</select>
<input type="submit" value="Go" />
</p>
</form>
';
}
}
}
// 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 '<p class="note" style="font-weight: bold; text-align: center;">Configuration successfully updated</p>';
// 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 '<p align="center"><strong>Step 3 of 5: Tailor Configuration Settings</strong></p>';
}
if (!empty($e)) {
print '<div class="warn">Please correct the following:<br /><ul><li>' . implode('</li><li>',$e) . '</li></ul></div>';
}
if (!preg_match("/^OpenConf/", $OC_configAR['OC_confNameFull']) && (OCC_LICENSE != 'Public')) {
$checkName = true;
print '
<script>
function oc_checkName(newName) {
alert("Please purchase a new license if this is not ' . safeHTMLstr(OCC_LICENSE_EVENT) . '");
}
</script>
';
} else {
$checkName = false;
}
print '
<form method="post" action="'.$_SERVER['PHP_SELF'].'" class="ocform occonfigform">
<input type="hidden" name="token" value="' . $token . '" />
';
if ((!OCC_INSTALL_COMPLETE) && isset($_REQUEST['install'])) {
print '
<input type="hidden" name="install" value="' . safeHTMLstr($_REQUEST['install']) . '" />
';
}
print '
<script>
document.write(\'<p style="margin: 0 0 1em 1em;"><span style="color: #66f; text-decoration: underline; cursor: pointer;" onclick="oc_fsCollapseExpand(0)">collapse all</span> &nbsp; &nbsp; <span style="color: #66f; text-decoration: underline; cursor: pointer;" onclick="oc_fsCollapseExpand(1)">expand all</span></p>\');
function oc_sampleTextUpdate(id) {
var sampleTextAR = {
"OC_reviewerSignUpNotice": "<p>Thank you for agreeing to be a reviewer. The Review Committee is a key part of the conference organization. Its role is to review and comment on submissions, thus providing the input to the the Program Committee which makes the final decision on which submissions are accepted and rejected.</p>\n\n<p><strong>Note:</strong> Members of the Review Committee see unpublished work of other authors. Your professional ethics preclude disclosure to any other party the contents of the submissions you read.</p>",
"OC_committeeFooter": "<p><strong>Reminder:</strong> By acting as a reviewer, you are seeing unpublished works created by others. Your professional ethics require that you do not distribute these, or discuss their contents with anyone other than fellow reviewers.</p>\n\n<p><strong>Note:</strong> <em>If you will not be able to review all your submissions, please notify us as soon as possible so we can assign additional reviewers.</em> It is unfair to authors and your fellow reviewers if the reviews are not provided. If you have a colleague who would be a good reviewer for a submission, please email their contact information to the Program Chair.</p>",
"OC_programSignUpNotice": "<p>Thank you for agreeing to be a program committee (PC) member. As a PC member, you will have a say on what submissions are included in the conference program and be an advocate (champion) for a set of submissions. You will be provided with all the reviews for submissions you are an advocate for, and if there is a lack of agreement from the reviewers, you will be expected to read the submission and make a recommendation.</p>\n\n<p><strong>Note:</strong> Members of the Program Committee see unpublished work of other authors. Your professional ethics preclude disclosure to any other party the contents of the submissions you read, or the reviews of those submissions.</p>",
"OC_paperSubNote": "<p>Please review the entire form before starting to fill it out to ensure you have all the required information.</p>"
};
if (typeof CKEDITOR !== "undefined"){
CKEDITOR.instances[id].setData(sampleTextAR[id]);
} else {
document.getElementById(id).value = sampleTextAR[id];
}
}
</script>
';
if (!isset($_POST['submit'])) {
print '<p class="note" style="text-align: center;">Make desired changes, then click any <i>Save Settings</i> button</p>';
}
print '
<fieldset id="oc_fs_event" role="header" aria-live="polite">
<legend onclick="oc_fsToggle(this)">General Info <span>(collapse)</span></legend>
<div id="oc_fs_event_div">
';
if ((OCC_LICENSE != 'Public') && defined('OCC_LICENSE_EVENT') && !defined('OCHS')) {
print '
<div class="field"><label>Licensed Entity:</label><b>' . safeHTMLstr(OCC_LICENSE_EVENT) . '</b><div class="fieldnote note">For an entity or year other than the one listed above, please purchase and install a new <a href="https://www.openconf.com/sales/" target="_blank">OpenConf license</a>.<br />Each license permits a single installation of the OpenConf software.</div></div>
';
}
print '
<div class="field"><label for="OC_confNameFull">Full Name/Title:</label><input size="60" name="OC_confNameFull" id="OC_confNameFull" value="' . safeHTMLstr($_POST['OC_confNameFull']) . '" ' . ($checkName ? 'onchange="oc_checkName(this.value)" ' : '') . '/><div class="fieldnote note">Full name of event/journal for use on Web pages and in email messages</div></div>
<div class="field"><label for="OC_confName">Short Name/Title:</label><input size="60" name="OC_confName" id="OC_confName" value="' . safeHTMLstr($_POST['OC_confName']) . '"><div class="fieldnote note">Abbreviated name, primarily used in email from and subject lines. Quotes not permitted.</div></div>
<div class="field"><label for="OC_confURL">Website Address:</label><input size="60" name="OC_confURL" id="OC_confURL" value="' . safeHTMLstr($_POST['OC_confURL']) . '" placeholder="https://"><div class="fieldnote note">Complete website address (including https:// )</div></div>
<div class="field"><label for="OC_headerImage">Header Image:</label><input size="60" name="OC_headerImage" id="OC_headerImage" value="' . safeHTMLstr($_POST['OC_headerImage']) . '" placeholder="https://"><div class="fieldnote note">Complete web address (including https:// ) for image to display atop every page. Leave blank to display Full Name.</div></div>
<div class="field"><label for="OC_homePageNotice">Home Page Notice:<br /><br /><span class="note">Optional notice atop<br />OpenConf home page</span></label><textarea name="OC_homePageNotice" id="OC_homePageNotice" rows="6" cols="70">' . safeHTMLstr($_POST['OC_homePageNotice']) . '</textarea></div>
<input type="submit" name="submit" value="Save Settings" class="submit" />
</div>
</fieldset>
<fieldset id="oc_fs_notification" role="header" aria-live="polite">
<legend onclick="oc_fsToggle(this)">' . safeHTMLstr(OCC_WORD_CHAIR) . ' Email &amp; Notification <span>(collapse)</span></legend>
<div id="oc_fs_notification_div">
<div class="field"><label for="OC_pcemail">' . OCC_WORD_CHAIR . ' Email:</label><input size="50" name="OC_pcemail" id="OC_pcemail" value="' . safeHTMLstr($_POST['OC_pcemail']) . '" onchange="oc_checkEmail(this.value)"><div class="fieldnote note">Used for the From header of outgoing messages, as the general contact email address, and in case of errors or other follow-up. Although a comma-delimited list of addresses (without spaces) is permitted, this is not recommended as mail servers may reject messages with more than one. For any email issues, see the <a href="https://www.openconf.com/documentation/email.php#troubleshooting" target="_blank">troubleshooting guide</a>.</div></div>
<div class="field"><label for="OC_confirmmail">Notification Email:</label><input size="50" name="OC_confirmmail" id="OC_confirmmail" value="' . safeHTMLstr($_POST['OC_confirmmail']) . '"><div class="fieldnote note">Receives a copy of confirmation emails sent to ' . oc_strtolower(OCC_WORD_AUTHOR) . 's and committee members; see options below. A comma-delimited list of addresses (without spaces) is permitted.</div></div>
<label>Notify when:</label>
<div class="subfieldset"><fieldset class="checkbox">
';
foreach ($notifyAR as $nk => $nv) {
print '<label><input type="checkbox" name="' . $nk . '" id="' . $nk . '" value="1" ';
if ($_POST[$nk] == 1) { print 'checked '; }
print '/> ' . safeHTMLstr($nv) . '</label><br />';
}
print '
</fieldset>
<p>Include IP address in notifications?<fieldset class="radio">' . generateRadioOptions('OC_notifyIncludeIP', $yesNoAR, $_POST['OC_notifyIncludeIP']) . '</p>
</fieldset>
</div>
<input type="submit" name="submit" value="Save Settings" class="submit" />
</div>
</fieldset>
<fieldset id="oc_fs_reviewers" role="header" aria-live="polite">
<legend onclick="oc_fsToggle(this)">Reviewers <span>(collapse)</span></legend>
<div id="oc_fs_reviewers_div">
<div class="field"><label for="OC_keycode_reviewer">Sign Up Keycode:</label><input size="20" name="OC_keycode_reviewer" id="OC_keycode_reviewer" value="' . safeHTMLstr($_POST['OC_keycode_reviewer']) . '"><div class="fieldnote note">Keycode for signing up as a review committee member. May enter a comma-delimited list (no spaces).</div></div>
<div class="field"><label for="OC_reviewerSignUpNotice">Sign Up Notice:<br /><br /><span class="note">Optional notice atop<br />reviewer sign up page<br /><br />(<span style="color: #009; text-decoration: underline;" onclick="oc_sampleTextUpdate(\'OC_reviewerSignUpNotice\')" title="overwrites field with sample text">sample text</span>)</span></label><textarea name="OC_reviewerSignUpNotice" id="OC_reviewerSignUpNotice" rows="6" cols="70">' . safeHTMLstr($_POST['OC_reviewerSignUpNotice']) . '</textarea></div>
<div class="field"><label for="OC_committeeFooter">Committee Page Notice:<br /><br /><span class="note">Optional notice at bottom of<br />the main committee page<br /><br />(<span style="color: #009; text-decoration: underline;" onclick="oc_sampleTextUpdate(\'OC_committeeFooter\')" title="overwrites field with sample text">sample text</span>)</span></label><textarea name="OC_committeeFooter" id="OC_committeeFooter" rows="6" cols="70">' . safeHTMLstr($_POST['OC_committeeFooter']) . '</textarea></div>
<div class="field"></div><!-- reset if ckeditor box above -->
<label>Reviewer Permissions:</label>
<div class="subfieldset"><fieldset class="checkbox">
<label><input type="checkbox" value="1" name="OC_reviewerSeeAuthors" id="OC_reviewerSeeAuthors" ' . ((isset($_POST['OC_reviewerSeeAuthors']) && ($_POST['OC_reviewerSeeAuthors'] == 1)) ? 'checked ' : '') . ' /> View ' . oc_strtolower(OCC_WORD_AUTHOR) . 's (i.e., non-blind reviews)</label><br />
<label><input type="checkbox" value="1" name="OC_reviewerSeeOtherReviewers" id="OC_reviewerSeeOtherReviewers" ' . ((isset($_POST['OC_reviewerSeeOtherReviewers']) && ($_POST['OC_reviewerSeeOtherReviewers'] == 1)) ? 'checked ' : '') . ' /> View other reviewers\' contact information (e.g., name, email)</label><br />
';
if ($OC_configAR['OC_paperAdvocates']) {
print '<label><input type="checkbox" value="1" name="OC_reviewerSeeAdvocate" id="OC_reviewerSeeAdvocate" ' . ((isset($_POST['OC_reviewerSeeAdvocate']) && ($_POST['OC_reviewerSeeAdvocate'] == 1)) ? 'checked ' : '') . ' /> View advocate contact information</label><br />';
}
print '
<label><input type="checkbox" value="1" name="OC_reviewerUnassignReviews" id="OC_reviewerUnassignReviews" ' . ((isset($_POST['OC_reviewerUnassignReviews']) && ($_POST['OC_reviewerUnassignReviews'] == 1)) ? 'checked ' : '') . ' /> Unassign (own) reviews, deleting all review data</label><br />
<label><input type="checkbox" value="1" name="OC_reviewerSeeDecision" id="OC_reviewerSeeDecision" ' . ((isset($_POST['OC_reviewerSeeDecision']) && ($_POST['OC_reviewerSeeDecision'] == 1)) ? 'checked ' : '') . ' /> View submission acceptance status</label><br />
<label><input type="checkbox" value="1" name="OC_reviewerReadPapers" id="OC_reviewerReadPapers" ' . ((isset($_POST['OC_reviewerReadPapers']) && ($_POST['OC_reviewerReadPapers'] == 1)) ? 'checked ' : '') . ' /> View all submissions</label><br />
<label style="margin-left: 30px;"><input type="checkbox" value="1" name="OC_reviewerSeeOtherReviews" id="OC_reviewerSeeOtherReviews" ' . ((isset($_POST['OC_reviewerSeeOtherReviews']) && ($_POST['OC_reviewerSeeOtherReviews'] == 1)) ? 'checked ' : '') . ' /> View reviews of non-assigned submissions</label><br />
<label><input type="checkbox" value="1" name="OC_reviewerSeeAssignedReviews" id="OC_reviewerSeeAssignedReviews" ' . ((isset($_POST['OC_reviewerSeeAssignedReviews']) && ($_POST['OC_reviewerSeeAssignedReviews'] == 1)) ? 'checked ' : '') . ' /> View others\' reviews of assigned submissions</label><br />
<label style="margin-left: 30px;"><input type="checkbox" value="1" name="OC_reviewerCompleteBeforeSAR" id="OC_reviewerCompleteBeforeSAR" ' . ((isset($_POST['OC_reviewerCompleteBeforeSAR']) && ($_POST['OC_reviewerCompleteBeforeSAR'] == 1)) ? 'checked ' : '') . ' /> Only after own review is complete</label><br />
</fieldset>
</div>
<input type="submit" name="submit" value="Save Settings" class="submit" />
</div>
</fieldset>
<fieldset id="oc_fs_advocates" role="header" aria-live="polite">
<legend onclick="oc_fsToggle(this)">Advocates (Program Committee) <span>(collapse)</span></legend>
<div id="oc_fs_advocates_div">
<div class="field"><label for="OC_paperAdvocates">Use Advocates?</label><fieldset class="radio">' . generateRadioOptions('OC_paperAdvocates', $yesNoAR, $_POST['OC_paperAdvocates'], 1, 'onclick="oc_showHideDiv(\'OC_paperAdvocates1\', \'advocates\')"') . '</fieldset><div class="fieldnote note">Select whether to make use of Advocates</div></div>
<div id="advocates">
<div class="field"><label for="OC_keycode_program">Sign Up Keycode:</label><input size="20" name="OC_keycode_program" id="OC_keycode_program" value="' . safeHTMLstr($_POST['OC_keycode_program']) . '"><div class="fieldnote note">Keycode for signing up as a program committee member. May enter a comma-delimited list (no spaces).</div></div>
<div class="field"><label for="OC_programSignUpNotice">Sign Up Notice:<br /><br /><span class="note">Optional notice atop<br />advocate sign up page<br /><br />(<span style="color: #009; text-decoration: underline;" onclick="oc_sampleTextUpdate(\'OC_programSignUpNotice\')" title="overwrites field with sample text">sample text</span>)</span></label><textarea name="OC_programSignUpNotice" id="OC_programSignUpNotice" rows="6" cols="70">' . safeHTMLstr($_POST['OC_programSignUpNotice']) . '</textarea></div>
<div class="field"></div><!-- reset if ckeditor box above -->
<label>Advocate Permissions:</label>
<div class="subfieldset"><fieldset class="checkbox">
<label><input type="checkbox" value="1" name="OC_advocateSeeAuthors" id="OC_advocateSeeAuthors" ' . ((isset($_POST['OC_advocateSeeAuthors']) && ($_POST['OC_advocateSeeAuthors'] == 1)) ? 'checked ' : '') . ' /> View ' . oc_strtolower(OCC_WORD_AUTHOR) . 's</label><br />
<label><input type="checkbox" value="1" name="OC_advocateSeeDecision" id="OC_advocateSeeDecision" ' . ((isset($_POST['OC_advocateSeeDecision']) && ($_POST['OC_advocateSeeDecision'] == 1)) ? 'checked ' : '') . ' /> View submission acceptance status</label><br />
<label><input type="checkbox" value="1" name="OC_advocateReadPapers" id="OC_advocateReadPapers" ' . ((isset($_POST['OC_advocateReadPapers']) && ($_POST['OC_advocateReadPapers'] == 1)) ? 'checked ' : '') . ' /> View all submissions</label><br />
<label style="margin-left: 30px;"><input type="checkbox" value="1" name="OC_advocateSeeOtherReviews" id="OC_advocateSeeOtherReviews" ' . ((isset($_POST['OC_advocateSeeOtherReviews']) && ($_POST['OC_advocateSeeOtherReviews'] == 1)) ? 'checked ' : '') . ' /> View reviews of non-assigned submissions</label><br />
<p class="note">NOTE: Reviewer permissions are evaluated before advocate\'s</p>
</fieldset>
</div>
</div>
<input type="submit" name="submit" value="Save Settings" class="submit" />
</fieldset>
<fieldset id="oc_fs_submission" role="header" aria-live="polite">
<legend onclick="oc_fsToggle(this)">Submissions <span>(collapse)</span></legend>
<div id="oc_fs_submission_div">
';
// Allow submission ID auto increment value?
if (isset($_POST['startid'])) {
print '<div class="field"><label for="startid">Starting ID:</label><input type="number" name="startid" id="startid" min="1" max="99999999" step="1" maxlength="5" style="width: 70px; text-align: right;" value="' . safeHTMLstr(varValue('startid', $_POST, '', true)) . '" /><div class="fieldnote note">Starting ID for submissions. Available only if there are no submissions in the system.</div></div>';
}
print '
<div class="field"><label for="OC_paperSubNote">Submission Notice:<br /><br /><span class="note">Optional notice atop<br />submission page<br /><br />(<span style="color: #009; text-decoration: underline;" onclick="oc_sampleTextUpdate(\'OC_paperSubNote\')" title="overwrites field with sample text">sample text</span>)</span></label><textarea name="OC_paperSubNote" id="OC_paperSubNote" rows="8" cols="70">' . safeHTMLstr($_POST['OC_paperSubNote']) . '</textarea></div>
<div class="field"><label for="OC_subConfirmNotice">Confirmation Message:<br /><br /><span class="note">Message displayed upon<br />successful submission<br /><br />Variables:<br /><br />submission ID = [:sid:]<br />form fields = [:formfields:]</span></label><textarea name="OC_subConfirmNotice" id="OC_subConfirmNotice" rows="9" cols="70">' . safeHTMLstr($_POST['OC_subConfirmNotice']) . '</textarea></div>
<div class="field"><label for="OC_authorsMinDisplay">Min. ' . OCC_WORD_AUTHOR . 's to Display:</label><input type="number" name="OC_authorsMinDisplay" id="OC_authorsMinDisplay" min="1" max="99" step="1" maxlength="2" style="width:50px; text-align: right;" value="' . safeHTMLstr($_POST['OC_authorsMinDisplay']) . '" /><div class="fieldnote note">Minimum number of ' . oc_strtolower(OCC_WORD_AUTHOR) . 's to display on submission form</div></div>
<div class="field"><label for="OC_authorsMax">Max. ' . OCC_WORD_AUTHOR . 's Allowed:</label><input type="number" name="OC_authorsMax" id="OC_authorsMax" min="1" max="99" step="1" maxlength="2" style="width:50px; text-align: right;" value="' . safeHTMLstr($_POST['OC_authorsMax']) . '" /><div class="fieldnote note">Maximum number of ' . oc_strtolower(OCC_WORD_AUTHOR) . 's allowed per submission (max: 99)</div></div>
<div class="field"><label for="OC_authorOneContact">Set ' . OCC_WORD_AUTHOR . ' 1 as Contact?</label><fieldset class="radio">' . generateRadioOptions('OC_authorOneContact', $yesNoAR, $_POST['OC_authorOneContact']) . '</fieldset><div class="fieldnote note">Auto set ' . OCC_WORD_AUTHOR . ' 1 as contact and hide Contact ID field on submission form</div></div>
';
if (OCC_ADVANCED_CONFIG) {
print '
<div class="field" id="OC_emailAuthorRecipientsField"><label for="OC_emailAuthorRecipients">' . OCC_WORD_AUTHOR . ' Email Recipients:</label><fieldset class="radio">' . generateRadioOptions('OC_emailAuthorRecipients', $emailAuthorRecipientsAR, $_POST['OC_emailAuthorRecipients']) . '</fieldset><div class="fieldnote note">' . OCC_WORD_AUTHOR . '(s) to receive notices and ' . OCC_WORD_CHAIR . ' emails</div></div>
';
}
print '
<div class="field"><label for="OC_editAcceptedOnly">Edit Accepted Only?</label><fieldset class="radio">' . generateRadioOptions('OC_editAcceptedOnly', $yesNoAR, $_POST['OC_editAcceptedOnly']) . '</fieldset><div class="fieldnote note">Restrict Edit Submission to accepted submissions only</div></div>
<div class="field"><label for="OC_authorViewSubIfEditClosed">View Sub. if Edit Closed?</label><fieldset class="radio">' . generateRadioOptions('OC_authorViewSubIfEditClosed', $yesNoAR, $_POST['OC_authorViewSubIfEditClosed']) . '</fieldset><div class="fieldnote note">Allow ' . oc_strtolower(OCC_WORD_AUTHOR) . ' to view submission if editing is closed</div></div>
<input type="submit" name="submit" value="Save Settings" class="submit" />
</div>
</fieldset>
';
if (oc_hookSet('set-config-fileupload')) {
foreach ($GLOBALS['OC_hooksAR']['set-config-fileupload'] as $hook) {
require_once $hook;
}
} else {
print '
<fieldset id="oc_fs_files" role="header" aria-live="polite">
<legend onclick="oc_fsToggle(this)">Files <span>(collapse)</span></legend>
<div id="oc_fs_files_div">
<div class="field"><label for="OC_extar">File Formats:<br /><br /><span class="note">Available upload formats.<br />Use FileType module to<br />verify file is in proper<br />format</span></label><select name="OC_extar[]" id="OC_extAR" size="7" multiple>' . generateSelectOptions($OC_formatAR, $_POST['OC_extar'], TRUE, TRUE) . '</select></div>
<input type="submit" name="submit" value="Save Settings" class="submit" />
</div>
</fieldset>
';
}
print '
<fieldset id="oc_fs_localization" role="header" aria-live="polite">
<legend onclick="oc_fsToggle(this)">Localization <span>(collapse)</span></legend>
<div id="oc_fs_localization_div">
<div class="note" style="margin-bottom: 2em;">Selecting multiple languages will enable a menu on the main OpenConf page to select one\'s language choice. Both ' . oc_strtolower(OCC_WORD_AUTHOR) . ' and reviewer pages are then displayed in the selected language. For additional information, or to assist with translations, visit <a href="https://www.OpenConf.com/translate/" target="_blank">www.OpenConf.com/translate/</a>.' . (function_exists('gettext') ? '' : ' <strong>PHP must have gettext enabled.</strong>') . '</div>
<div class="field"><label for="OC_locales">Languages:</label><select name="OC_locales[]" id="OC_locales" multiple size="5">
';
foreach ($OC_languageAR as $locale => $localeAR) {
print '<option value="' . safeHTMLstr($locale) . '"' . (in_array($locale, $_POST['OC_locales']) ? ' selected' : '') . '>' . safeHTMLstr($localeAR['language']) . '</option>';
}
print '
</select></div>
<div class="field"><label for="OC_localeDefault">Default Language:</label><select name="OC_localeDefault" id="OC_localeDefault">
';
foreach ($OC_languageAR as $locale => $localeAR) {
print '<option value="' . safeHTMLstr($locale) . '"' . (($locale == $_POST['OC_localeDefault']) ? ' selected' : '') . '>' . safeHTMLstr($localeAR['language']) . '</option>';
}
print '
</select></div>
';
$wordUse = false;
if (in_array(OCC_WORD_AUTHOR, $OC_wordForAuthorAR)) {
$wordUse = true;
print '
<div class="field"><label for="OC_wordForAuthor">Word for <i>Author</i>:</label><select name="OC_wordForAuthor" id="OC_wordForAuthor">
' . generateSelectOptions($OC_wordForAuthorAR, $_POST['OC_wordForAuthor'], FALSE) . '
</select> <span class="note" title="Used for English (US) only. Some Chair features will still show Author.' . (oc_moduleValid('oc_customforms') ? ' If Custom Forms module in use, form fields may need to be manually updated.' : '') . '">***</span></div>
';
}
if (in_array(OCC_WORD_CHAIR, $OC_wordForChairAR)) {
$wordUse = true;
print '
<div class="field"><label for="OC_wordForChair">Word for <i>Chair</i>:</label><select name="OC_wordForChair" id="OC_wordForChair">
' . generateSelectOptions($OC_wordForChairAR, $_POST['OC_wordForChair'], FALSE) . '
</select> <span class="note" title="Used for English (US) only. Some Chair features will still show Chair.' . (oc_moduleValid('oc_customforms') ? ' If Custom Forms module in use, form fields may need to be manually updated.' : '') . '">***</span></div>
';
}
print '
<div class="field"><label for="OC_timeZone">Time Zone:</label><select name="OC_timeZone" id="OC_timeZone">
' . oc_generateSelectTimeZoneOptions($_POST['OC_timeZone']) . '
</select></div>
';
if ($wordUse) {
print '<p class="note">*** Used for English (US) only. Some Chair features will still show Author/Chair.';
if (oc_moduleValid('oc_customforms')) {
print ' If Custom Forms module in use, form fields may need to be manually updated to reflect desired Author/Chair words.';
}
print '</p>';
}
print '
<input type="submit" name="submit" value="Save Settings" class="submit" />
</div>
</fieldset>
</form>
<script language="javascript" type="text/javascript">
<!--
';
if (OCC_INSTALL_COMPLETE) {
print 'oc_fsCollapseExpand(0);';
}
print '
oc_showHideDiv("OC_paperAdvocates1","advocates");
function oc_checkEmail(e) {
if (e.match(/,/)) {
alert("Note that some mail servers may reject messages if the ' . OCC_WORD_CHAIR . ' Email contains multiple addresses. It is recommended only one address be used.");
} else {
alert("Please confirm the new address was entered correctly: " + document.getElementById(\'OC_pcemail\').value.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
}
}
// -->
</script>
';
oc_replaceCKEditor(array('OC_homePageNotice', 'OC_reviewerSignUpNotice', 'OC_committeeFooter', 'OC_programSignUpNotice', 'OC_paperSubNote', 'OC_subConfirmNotice'));
printFooter();
?>
+45
View File
@@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
if (!OCC_ADVANCED_CONFIG) {
$res = array('error' => 'Advanced configuration disabled');
}
elseif (!validToken('chair')) { // Check for valid submission
$res = array('error' => 'Invalid Token');
}
elseif (isset($_POST['m']) && (($_POST['m'] == 'OC') || in_array($_POST['m'], $OC_activeModulesAR))) {
$q = "SELECT `setting` FROM `" . OCC_TABLE_CONFIG . "` WHERE `module`='" . safeSQLstr(urldecode($_POST['m'])) . "' ORDER BY `setting`";
if ($r = ocsql_query($q)) {
if (ocsql_num_rows($r) == 0) {
$res = array('error' => 'Module has no configuration settings');
} else {
$res = array('error' => '', 'settings' => array());
while ($l = ocsql_fetch_assoc($r)) {
if (preg_match("/^OC_hide/", $l['setting'])) { continue; }
$res['settings'][] = $l['setting'];
}
}
} else {
$res = array('error' => 'DB Error: ' . safeHTMLstr(ocsql_error()));
}
} else {
$res = array('error' => 'Invalid module');
}
echo json_encode($res);
exit;
?>
+44
View File
@@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
if (!OCC_ADVANCED_CONFIG) {
$res = array('error' => 'Advanced configuration disabled');
}
elseif (!validToken('chair')) { // Check for valid submission
$res = array('error' => 'Invalid Token');
}
elseif (isset($_POST['m']) && (($_POST['m'] == 'OC') || in_array($_POST['m'], $OC_activeModulesAR)) && isset($_POST['s']) && array_key_exists($_POST['s'], $OC_configAR)) {
$q = "SELECT * FROM `" . OCC_TABLE_CONFIG . "` WHERE `module`='" . safeSQLstr(urldecode($_POST['m'])) . "' AND `setting`='" . safeSQLstr(urldecode($_POST['s'])) . "'";
if ($r = ocsql_query($q)) {
if (ocsql_num_rows($r) != 1) {
$res = array('error' => 'Setting not found');
} else {
$res = array(
'error' => '',
'setting' => ocsql_fetch_assoc($r)
);
}
} else {
$res = array('error' => 'DB Error: ' . safeHTMLstr(ocsql_error()));
}
} else {
$res = array('error' => 'Invalid module or setting');
}
echo json_encode($res);
exit;
?>
+45
View File
@@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
if (!OCC_ADVANCED_CONFIG) {
$res = array('error' => 'Advanced configuration disabled');
}
elseif (!validToken('chair')) { // Check for valid submission
$res = array('error' => 'Invalid Token');
}
elseif (isset($_POST['m']) && (($_POST['m'] == 'OC') || in_array($_POST['m'], $OC_activeModulesAR)) && isset($_POST['s']) && array_key_exists($_POST['s'], $OC_configAR) && isset($_POST['v'])) {
if ($OC_configAR[$_POST['s']] == $_POST['v']) {
$res = array('error' => 'Setting unchanged');
} else {
$q = "UPDATE `" . OCC_TABLE_CONFIG . "` SET `value`='" . safeSQLstr(urldecode($_POST['v'])) . "' WHERE `module`='" . safeSQLstr($_POST['m']) . "' AND `setting`='" . safeSQLstr($_POST['s']) . "' LIMIT 1";
if ($r = ocsql_query($q)) {
if (ocsql_affected_rows() != 1) {
$res = array('error' => 'Setting failed to update properly');
} else {
$res = array('error' => '', 'success' => 'Setting updated');
}
} else {
$res = array('error' => 'DB Error: ' . safeHTMLstr(ocsql_error()));
}
}
} else {
$res = array('error' => 'Invalid module, setting, or value');
}
echo json_encode($res);
exit;
?>
+32
View File
@@ -0,0 +1,32 @@
/*
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
*/
#oc_notice {
position: fixed;
top: 0;
left: 100px;
min-width: 300px;
padding: 10px;
font-weight: bold;
font-size: 1.1em;
border: 4px solid #333;
display: none;
z-index: 100;
}
#oc_notice.ocnotice {
background-color: #9f9;
color: #000;
}
#oc_notice.ocerror {
background-color: #f99;
color: #000;
}
+178
View File
@@ -0,0 +1,178 @@
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
// init http request
var config_http = false;
try {
config_http = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
config_http = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
config_http = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
config_http = false;
}
}
}
// number of notices awaiting call back
var OC_notices = 0;
// notice div ID (see init())
var OC_notice = false;
// default timeout
var TimeOut = 2000;
function oc_init() {
OC_notice = document.getElementById("oc_notice");
}
function hideNotice() {
OC_notices--;
if (OC_notices <= 0) {
document.getElementById("oc_notice").style.display = "none";
}
}
function showNotice(noticeClass, noticeHTML, noticeTimeout) {
OC_notice.className = noticeClass;
OC_notice.innerHTML = noticeHTML;
TimeOut = noticeTimeout;
// display notice
OC_notice.style.display = "block";
// set timeout to hide notice box, but only after last notice done displaying
OC_notices++;
setTimeout('hideNotice()', TimeOut);
}
function clearFields() {
document.getElementById('fields').style.display = 'none';
document.getElementById('name').innerHTML = '';
document.getElementById('description').innherHTML = '';
document.getElementById('parse').innherHTML = '';
document.getElementById('value').value = '';
}
function updateSettingValueCallback() {
if (config_http.readyState == 4) {
// Check for invalid response - likely due to time out?
if ((config_http.status != 200) || (config_http.responseText == '')) {
showNotice('ocerror', 'Unable to update setting.<br />Use standard configuration page or edit value in database config table', 30000);
} else { // display server response as appropriate
var Response = eval("(" + config_http.responseText + ")");
if (Response['error'] == '') {
if (Response['success']) {
showNotice('ocnotice', Response['success'], 3000);
} else {
showNotice('ocerror', 'Unable to update setting', 5000);
}
} else {
showNotice('ocerror', Response['error'], 5000);
}
}
}
}
function updateSettingValue(octoken) {
if (config_http) {
var params = "m=" + encodeURIComponent(document.getElementById('module').value) +
"&s=" + encodeURIComponent(document.getElementById('setting').value) +
"&v=" + encodeURIComponent(document.getElementById('value').value) +
"&token=" + encodeURIComponent(octoken);
config_http.open("POST","set_config_adv-update.php", true);
config_http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
config_http.onreadystatechange = updateSettingValueCallback;
config_http.send(params);
return(false);
} else {
return(true);
}
}
function updateSettingCallback() {
if (config_http.readyState == 4) {
// Check for invalid response - likely due to time out?
if ((config_http.status != 200) || (config_http.responseText == '')) {
showNotice('ocerror', 'Unable to retrieve module settings.<br />Use standard configuration page or edit value in database config table', 30000);
} else { // display server response as appropriate
var Response = eval("(" + config_http.responseText + ")");
if (Response['error'] == "") {
if (Response['setting']) {
document.getElementById('name').innerHTML = Response['setting']['name'];
document.getElementById('description').innerHTML = Response['setting']['description'];
if (Response['setting']['parse'] == 1) {
document.getElementById('parse').innerHTML = 'Yes';
} else {
document.getElementById('parse').innerHTML = 'No';
}
document.getElementById('value').value = Response['setting']['value'];
document.getElementById('fields').style.display = 'block';
}
} else {
showNotice('ocerror', Response['error'], 5000);
}
}
}
}
function updateSetting(obj, octoken) {
clearFields();
document.getElementById("oc_notice").style.display = "none";
if (obj.value != '') {
if (config_http) {
var params = "m=" + encodeURIComponent(document.getElementById('module').value) +
"&s=" + encodeURIComponent(obj.value) +
"&token=" + encodeURIComponent(octoken);
config_http.open("POST","set_config_adv-setting.php", true);
config_http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
config_http.onreadystatechange = updateSettingCallback;
config_http.send(params);
} else {
alert('Your browser has denied this operation. Please use standard config form, or edit values in the database config table');
return(false);
}
}
}
function updateModuleCallback() {
if (config_http.readyState == 4) {
// Check for invalid response - likely due to time out?
if (config_http.status != 200) {
showNotice('ocerror', 'Unable to retrieve module settings. Use standard configuration page or edit value in database config table', 30000);
} else { // display server response as appropriate
var Response = eval("(" + config_http.responseText + ")");
if (Response['error'] == "") {
if (Response['settings']) {
var i = 1;
for (v in Response['settings']) {
document.getElementById('setting').options[i++] = new Option(Response['settings'][v], Response['settings'][v], false, false);
}
document.getElementById('settingMenu').style.display = "block";
}
} else {
showNotice('ocerror', Response['error'], 5000);
}
}
}
}
function updateModule(obj, octoken) {
clearFields();
document.getElementById("oc_notice").style.display = "none";
document.getElementById("settingMenu").style.display = "none";
var settingObj = document.getElementById('setting');
settingObj.options.length = 1;
if (obj.value != '') {
if (config_http) {
var params = "m=" + encodeURIComponent(obj.value) +
"&token=" + encodeURIComponent(octoken);
config_http.open("POST","set_config_adv-module.php", true);
config_http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
config_http.onreadystatechange = updateModuleCallback;
config_http.send(params);
} else {
alert('Your browser has denied this operation. Please use standard config form, or edit values in the database config table');
return(false);
}
}
}
+100
View File
@@ -0,0 +1,100 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require '../include.php';
beginChairSession();
oc_addCSS('chair/set_config_adv.css');
oc_addJS('chair/set_config_adv.js');
oc_addOnLoad('oc_init();');
printHeader("Advanced Configuration", 1);
if (!OCC_ADVANCED_CONFIG) {
warn('Advanced configuration is disabled. Enable it in config.php');
}
// Submission?
if (isset($_POST['submit']) && ($_POST['submit'] == "Update Setting")) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
if (isset($_POST['module']) && (($_POST['module'] == 'OC') || in_array($_POST['module'], $OC_activeModulesAR)) && isset($_POST['setting']) && isset($OC_configAR[$_POST['setting']]) && isset($_POST['value'])) {
if ($OC_configAR[$_POST['setting']] == $_POST['value']) {
print '<p style="text-align: center" class="warn">Setting unchanged</p>';
} else {
$q = "UPDATE `" . OCC_TABLE_CONFIG . "` SET `value`='" . safeSQLstr($_POST['value']) . "' WHERE `module`='" . safeSQLstr($_POST['module']) . "' AND `setting`='" . safeSQLstr($_POST['setting']) . "' LIMIT 1";
$r = ocsql_query($q) or err('Unable to update setting');
if (ocsql_affected_rows() != 1) {
err('Setting failed to update properly');
} else {
print '<p style="text-align: center" class="note2">Setting updated</p>';
}
}
} else {
err('Invalid module, setting, or value');
}
}
print '
<p>Use caution when updating settings through the advanced configuration page as no validation of setting value is provided. If your browser does not support the functionality of this page, you should use the standard configuration update page or edit a setting\'s value in the database config table. A directory of configuration settings is available (<a href="list_config.php" target="_blank">open in new window</a>).</p><br />
<div id="oc_notice" class=""></div>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" onsubmit="return updateSettingValue(\'' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '\')">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<noscript><p class="warn">JavaScript needs to be enabled to use advanced configuration.</p></noscript>
<p><strong>Module:</strong> <select name="module" id="module" onchange="updateModule(this, \'' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '\')" aria-controls="settingMenu">
<option value=""></option>
<option value="OC">OpenConf</option>
';
foreach ($OC_activeModulesAR as $module) {
print '<option value="' . safeHTMLstr($module) . '">' . $OC_modulesAR[$module]['name'] . '</option>';
}
print '
</select>
</p>
<div aria-live="polite">
<p><span id="settingMenu" style="display: none">
<strong>Setting:</strong> <select name="setting" id="setting" onchange="updateSetting(this, \'' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '\')" aria-controls="fields">
<option value=""> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </option>
</select>
</span>
</p>
</div>
<div id="fields" style="display: none" aria-live="polite">
<p><hr /></p>
<p><strong>Name:</strong> <span id="name"></span></p>
<p><strong>Description:</strong> <span id="description"></span></p>
<p><strong>Parse for Settings:</strong> <span id="parse"></span></p>
<p><strong>Value:</strong><br />
<textarea name="value" id="value" rows="7" cols="60" style="background-color: #eee"></textarea>
</p>
<p><input type="submit" name="submit" value="Update Setting" /></p>
</div>
</form>
';
printFooter();
?>
+136
View File
@@ -0,0 +1,136 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Set Conflicts",1);
if (isset($_POST['submit']) && ($_POST['submit'] == "Set Conflicts")) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// Check that we have at least one paper and reviewer
if (empty($_POST['papers']) || empty($_POST['reviewers'])) {
print '<span class="err">Please go back and select at least one submission and one reviewer</span><p>';
} else {
foreach ($_POST['reviewers'] as $i) {
if (!preg_match("/^\d+$/", $i)) {
err('Reviewer ID invalid');
}
foreach ($_POST['papers'] as $j) {
if (!preg_match("/^\d+$/", $j)) {
err('Submission ID invalid');
}
$q = "INSERT INTO `" . OCC_TABLE_CONFLICT . "` (`paperid`, `reviewerid`) VALUES ($j,$i)";
ocsql_query($q);
if (($merr = ocsql_errno()) != 0) {
if ($merr == 1062) { // Duplicate entry
print "<p class=\"warn\">! Submission $j and reviewer $i already registered as a conflict.</p>\n";
} else {
print "<p class=\"err\">! Error registering submission $j and reviewer $i as a conflict</p>\n";
}
} else { print "<p>Submission $j and reviewer $i registered as a conflict.\n"; }
}
}
print '
<p>&#187; <a href="' . $_SERVER['PHP_SELF'] . '">Set additional conflicts</a></p>
<p>&#187; <a href="list_conflicts.php">View conflicts</a></p>
';
}
} else {
$pq = "SELECT `" . OCC_TABLE_PAPER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`title` FROM `" . OCC_TABLE_PAPER . "` ORDER BY `" . OCC_TABLE_PAPER . "`.`paperid`";
$pr = ocsql_query($pq) or err("Unable to get submissions");
// Get pad size for paper id's - yes, we really need the max id, but this should do:)
$rows = ocsql_num_rows($pr);
$psize = oc_strlen((string) $rows);
if ($rows == 0) {
print '<span class="warn">No submissions have been made yet</span><p>';
}
else {
if (!isset($_GET['s']) || ($_GET['s'] == "id")) {
$idsortstr = 'ID';
$nsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=name">Name</a>';
$legend = "[ Reviewer ID - $nsortstr ]";
$sortby = "`" . OCC_TABLE_REVIEWER . "`.`reviewerid`";
} else {
$idsortstr = '<a href="' . $_SERVER['PHP_SELF'].'?s=id">ID</a>';
$nsortstr = 'Name';
$legend = "[ Reviewer Name - $idsortstr ]";
$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` FROM `" . OCC_TABLE_REVIEWER . "` 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 '<span class="warn">No reviewers have signed up yet</span><p>';
}
else {
print '
<form method="post" action="'.$_SERVER['PHP_SELF'].'">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<div style="float: left; margin-right: 50px;">
<p><strong>Select Submission(s):</strong></p>
<p>[ Submission ID - Title ]</p>
<select multiple size="20" name="papers[]">
';
while ($paper = ocsql_fetch_assoc($pr)) {
print '<option value="' . $paper['paperid'].'">' . padNumber($paper['paperid'],$psize) . ' - ' . safeHTMLstr(shortenStr($paper['title'],80)) . "</option>\n";
}
print '
</select>
</div>
<div style="float: left;">
<p><strong>Select Reviewer(s):</strong></p>
<p>' . $legend . '</p>
<select multiple size="20" name="reviewers[]">
';
while ($reviewer = ocsql_fetch_assoc($rr)) {
print '<option value="' . $reviewer['reviewerid'] . '">';
if (!isset($_GET['s']) || ($_GET['s'] == "id")) {
print padNumber($reviewer['reviewerid'],$rsize) . ' - ';
if ($reviewer['onprogramcommittee'] == 'T') {
print "[PC] ";
}
print safeHTMLstr($reviewer['name']) . "</option>\n";
} else {
if ($reviewer['onprogramcommittee'] == 'T') {
print "[PC] ";
}
print safeHTMLstr($reviewer['name']) . " - " . $reviewer['reviewerid'] . "</option>\n";
}
}
print '
</select>
<p class="note">Tip: Click the ID or Name links above<br />to re-sort this list (page will reload)</p>
</div>
<br style="clear: left;" />
<p><input type="submit" name="submit" value="Set Conflicts"></p>
</form>
';
}
}
}
printFooter();
?>
+108
View File
@@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
$formatDBFldName = 'format';
$uploadDir = $OC_configAR['OC_paperDir'];
$extAR = $OC_configAR['OC_extar'];
beginChairSession();
printHeader("Set File Format",1);
if (oc_hookSet('chair-set_format-preprocess')) {
foreach ($GLOBALS['OC_hooksAR']['chair-set_format-preprocess'] as $hook) {
require_once $hook;
}
}
print '<p style="text-align: center"><a href="list_paper_dir.php">List Files Directory</a></p>';
$format = $extAR[0];
if (isset($_POST['submit']) && ($_POST['submit'] == "Set Format")) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// Validate fields
if (!preg_match("/^\d+$/",$_POST['id'])) { // check for valid paper ID format
$e = "Invalid submission ID";
} elseif (!in_array($_POST['format'], $extAR)) { // check for valid paper format
$e = "File format not in list of accepted formats";
} else {
// check paper exists
$q = "SELECT `" . $formatDBFldName . "` FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`='" . safeSQLstr($_POST['id']) . "'";
$r = ocsql_query($q) or err("Unable to retrieve submission ID " . $_POST['id']);
if (ocsql_num_rows($r) != 1) {
$e = "Submission ID not found";
} else {
// rename file? only if file name w/new ext does not exist (but w/old ext does)
$l = ocsql_fetch_array($r);
if (in_array($l[$formatDBFldName], $extAR)) {
$oldFileName = $uploadDir . $_POST['id'] . '.' . $l[$formatDBFldName];
$newFileName = $uploadDir . $_POST['id'] . '.' . $_POST['format'];
if (!oc_isFile($newFileName) && oc_isFile($oldFileName)) {
oc_renameFile($oldFileName, $newFileName) or err("Unable to update file name");
} else {
print '<p class="warn">Failed to update file name</p>';
}
}
// update format in db
$q = "UPDATE `" . OCC_TABLE_PAPER . "` SET `" . $formatDBFldName . "`='" . safeSQLstr($_POST['format']) . "' WHERE `paperid`='" . safeSQLstr($_POST['id']) . "'";
ocsql_query($q) or err("Unable to update submission format");
print '<p class="note">File format has been updated</p>';
}
}
}
if (!empty($e)) { print '<p class="warn">' . $e . "</p>\n"; }
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . safeHTMLstr($_SESSION[OCC_SESSION_VAR_NAME]['chairtoken']) . '" />
<table border="0" cellspacing="10" cellpadding="0" style="margin: 0 auto">
';
if (oc_hookSet('chair-set_format-formtop')) {
foreach ($GLOBALS['OC_hooksAR']['chair-set_format-formtop'] as $hook) {
require_once $hook;
}
}
print '
<tr id="subid">
<td><strong>Submission ID:</strong></td>
<td><input name="id" size="4" value="' . safeHTMLstr(varValue('id', $_POST)) . '" /></td>
</tr>
<tr id="formatrow">
<td><strong>Format:</strong></td>
<td><select name="format" id="format">';
foreach ($extAR as $format) {
print '<option value="' . safeHTMLstr($format) . '">' . safeHTMLstr($OC_formatAR[$format]) . '</option>';
}
print '
</select></td>
</tr>
<tr><td>&nbsp;</td><td style="padding-top: 1em"><input type="submit" name="submit" id="sub" class="submit" value="Set Format" /></td></tr>
</table>
</form>
<p style="text-align: center" class="note">This will set the submission\'s file format in the database.<br />
Also, if a file with the new extension does not already exist,<br />the file is renamed from the old format extension to the new.</p>
';
printFooter();
?>
+166
View File
@@ -0,0 +1,166 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Change Password", 1);
if (! $OC_configAR['OC_chairChangePassword']) {
warn('Config settings do not permit ' . OCC_WORD_CHAIR . ' to change password');
}
$mfaAddresses = array(
'' => 'disabled',
'$OC_pcemail' => 'Chair Email Address: ' . $OC_configAR['OC_pcemail'],
'$OC_confirmmail' => 'Notification Address: ' . $OC_configAR['OC_confirmmail']
);
if (!empty($OC_configAR['OC_chairMFA']) && !isset($mfaAddresses[$OC_configAR['OC_chairMFA']]) && validEmail($OC_configAR['OC_chairMFA'])) {
$mfaAddresses[$OC_configAR['OC_chairMFA']] = $OC_configAR['OC_chairMFA'];
}
// setup mfa?
if (isset($_GET['a']) && ($_GET['a'] == 'mfasetup')) {
if (
isset($_GET['c'])
&& (strlen($_GET['c']) == 32)
&& preg_match("/^SETUP\|\|([^\|]+)\|\|([^\|]+)$/", $OC_configAR['OC_chairMFAcode'], $matches)
&& ($_GET['c'] == $matches[1])
&& isset($mfaAddresses[$matches[2]])
) {
updateConfigSetting('OC_chairMFA', $matches[2]) or err('Unable to configure authentication address');
$OC_configAR['OC_chairMFA'] = $matches[2];
updateConfigSetting('OC_chairMFAcode', '');
print '<p style="text-align: center;" class="note2">Authentication Address Set</p>';
} else {
print '<p style="text-align: center;" class="warn">Authentication Address verification failed</p>';
}
printFooter();
exit;
}
$e = "";
if (isset($_POST['submit']) && ($_POST['submit'] == "Submit Changes")) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
if (!oc_password_verify($_POST['currpwd'], $OC_configAR['OC_chair_pwd'])) {
$e = 'Current password is incorrect';
} else {
// password change?
if (isset($_POST['pwd1']) && !empty($_POST['pwd1']) && isset($_POST['pwd2']) && !empty($_POST['pwd2'])) {
if ($_POST['pwd1'] != $_POST['pwd2']) {
$e = 'New passwords do not match';
} elseif ($_POST['pwd1'] == $OC_configAR['OC_chair_uname']) {
$e = 'Password may not match ' . OCC_WORD_CHAIR . ' username';
} elseif (oc_strlen($_POST['pwd1']) < 10) {
$e = 'Password must be 10+ characters long';
} else {
updateConfigSetting('OC_chair_pwd', oc_password_hash($_POST['pwd1'])) or err('Unable to change password');
print '<p style="text-align: center;" class="note">Password has been changed</p>';
}
}
// auth change?
if (isset($_POST['mfa']) && isset($mfaAddresses[$_POST['mfa']]) && ($_POST['mfa'] != $OC_configAR['OC_chairMFA'])) {
if ($_POST['mfa'] == '') {
updateConfigSetting('OC_chairMFA', '') or err('Unable to remove authentication address');
$OC_configAR['OC_chairMFA'] = '';
} elseif (preg_match("/^\\\$(?:OC_pcemail|OC_confirmmail)$/", $_POST['mfa'])) {
$code = oc_idGen(32);
$link = OCC_BASE_URL . 'chair/set_password.php?a=mfasetup&c=' . urlencode($code);
if (strlen($code) == 32) {
ocsql_query("UPDATE `" . OCC_TABLE_CONFIG . "` SET `value`='SETUP||" . safeHTMLstr($code) . '||' . safeHTMLstr($_POST['mfa']) . "' WHERE `module`='OC' AND `setting`='OC_chairMFAcode' LIMIT 1") or err('Unable to set authentication code');
$subject = $OC_configAR['OC_confName'] . ' Multi-Factor Authentication Setup -- action required';
$body = 'Hello,
A request has been received to setup multi-factor authentication for the ' . $OC_configAR['OC_confName'] . ' ' . OCC_WORD_CHAIR . ' account. In order to complete the request, please click the link below prior to signing out of the account:
' . $link . '
Thank you
';
if (oc_mail($OC_configAR[substr($_POST['mfa'], 1)], $subject, $body)) {
print '<p style="text-align: center;" class="warn">An email has been sent to the Authentication Address below.<br />Click the link in the email prior to signing out.</p>';
} else {
$e .= '<br />Sending of message to complete multi-factor authentication failed';
}
} else {
$e .= '<br />Unable to generate authentication code';
}
} else {
$e .= '<br />Invalid auth setting';
}
// to change to a custom email address, use the advanced settings feature
}
}
}
if (!empty($e)) {
print '<p style="text-align: center;" class="warn">' . $e . '</p>';
}
print '
<br />
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" class="ocform occonfigform">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<fieldset id="oc_fs_pw" role="header">
<legend onclick="oc_fsToggle(this)">New Password <span>(collapse)</span></legend>
<div id="oc_fs_pw_div">
<div class="note" style="margin-bottom: 2em;">Enter your new password twice. May be left blank if only changing multi-factor authentication setting below.</div>
<div class="field"><label for="pwd1">New Password:</label><input type="password" size="60" maxlength="250" name="pwd1" id="pwd1" /><div class="fieldnote note">10+ characters</div></div>
<div class="field"><label for="pwd1">Confirm New:</label><input type="password" size="60" maxlength="250" name="pwd2" id="pwd2" /></div>
</div>
</fieldset>
<fieldset id="oc_fs_mfa" role="header">
<legend id="oc_fs_mfa_legend" onclick="oc_fsToggle(this)">Multi-Factor Authentication <span>(collapse)</span></legend>
<div id="oc_fs_mfa_div">
<div class="note" style="margin-bottom: 2em;">With an authentication address set, when the Chair enters their username and password a code is sent to the selected address which must be entered to complete the sign in process.</div>
<div class="field"><label for="mfa">Authentication Address:</label><select name="mfa" id="mfa">' . generateSelectOptions($mfaAddresses, (!empty($OC_configAR['OC_chairMFA']) ? $OC_configAR['OC_chairMFA'] : 'disabled')) . '</select><div class="fieldnote note">When changing this option to a new address, a message is sent to the address with a link that must be clicked in order to confirm messages are received prior to the new address taking effect; click the link right away and before signing out.</div></div>
</div>
</fieldset>
<fieldset id="oc_fs_submit" role="header">
<legend onclick="oc_fsToggle(this)">Submit <span>(collapse)</span></legend>
<div id="oc_fs_submit_div">
<div class="note" style="margin-bottom: 2em;">Enter your current password and click the Submit Changes button.</div>
<div class="field"><label for="currpwd">Current Password:</label><input type="password" size="60" maxlength="250" name="currpwd" id="currpwd" /></div>
<input type="submit" name="submit" value="Submit Changes" class="submit" style="margin-left: 200px;" />
</div>
</fieldset>
</form>
';
if (empty($OC_configAR['OC_chairMFA'])) {
print '
<script>
oc_fsToggle(document.getElementById("oc_fs_mfa_legend"));
</script>
';
}
printFooter();
?>
+291
View File
@@ -0,0 +1,291 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$hdr = '';
$hdrfn = 1;
require_once '../include.php';
// jQueryUI optionally used for date picker ... until HTML5 datetime becomes cross-browser
oc_addHeader('
<script src="//code.jquery.com/jquery-' . OCC_JQUERY_VERSION . '.min.js"></script>
<script src="//code.jquery.com/ui/' . OCC_JQUERYUI_VERSION . '/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/' . OCC_JQUERYUI_VERSION . '/themes/smoothness/jquery-ui.css">
');
function oc_statusTime($h, $m) {
$time = '';
$ampm = '';
if ($h > 12) {
$time = ($h - 12) . ':' . $m;
$ampm = 'pm';
} elseif ($h == 0) {
if ($m == 0) {
$time = 'midnight';
} else {
$time = '12:30';
$ampm = 'am';
}
} elseif ($h == 12) {
if ($m == 0) {
$time = 'noon';
} else {
$time = '12:30';
$ampm = 'pm';
}
} else {
$time = ltrim($h, '0') . ':' . $m;
$ampm = 'am';
}
return($h . ':' . $m . ' || ' . $time . $ampm);
}
function oc_statusEvent(&$l) {
$ret = '';
if (!empty($l['open'])) {
$opendate = new DateTime($l['open']);
$ret .= '<div class="event" title="' . safeHTMLstr($l['name']) . ' event - click &bigotimes; to delete">&#187; will open on ' . safeHTMLstr($opendate->format('j F Y, H:i / g:ia')) . ' ' . safeHTMLstr($GLOBALS['OC_configAR']['OC_timeZone']) . ' <input type="image" name="deleteevent,open,' . safeHTMLstr($l['module']) . ',' . safeHTMLstr($l['setting']) . '," value="Delete Event" alt="Delete Event" title="Delete Event" src="../images/circlex.png" widht="12" height="10" style="border:none;background:none;" onclick="return(confirm(\'Delete event?\'));" /></div>';
}
if (!empty($l['close'])) {
$closedate = new DateTime($l['close']);
$ret .= '<div class="event" title="' . safeHTMLstr($l['name']) . ' event - click &bigotimes; to delete">&#187; will close on ' . safeHTMLstr($closedate->format('j F Y, H:i / g:ia')) . ' ' . safeHTMLstr($GLOBALS['OC_configAR']['OC_timeZone']) . ' <input type="image" name="deleteevent,close,' . safeHTMLstr($l['module']) . ',' . safeHTMLstr($l['setting']) . '," value="Delete Event" alt="Delete Event" title="Delete Event" src="../images/circlex.png" widht="12" height="10" style="border:none;background:none;" onclick="return(confirm(\'Delete event?\'));" /></div>';
}
return($ret);
}
if (isset($_REQUEST['install']) && ($_REQUEST['install'] == 1)) {
require_once "install-include.php";
$token = '';
} else {
beginChairSession();
printHeader("Open/Close Status",1);
$token = $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'];
}
if (isset($_POST['ocsubmit']) && !empty($_POST['ocsubmit'])) {
// Check for valid submission
if (OCC_INSTALL_COMPLETE && !validToken('chair')) {
warn('Invalid submission');
}
if ($_POST['ocsubmit'] == "Set Status") {
if (preg_match("/deleteevent,((?:open|close)),(\w+),(\w+),_x/", implode("|", array_keys($_POST)), $matches)) { // delete scheduled event
if (ocsql_query("UPDATE `" . OCC_TABLE_STATUS . "` SET `" . safeSQLstr($matches[1]) . "`=NULL WHERE `module`='" . safeSQLstr($matches[2]) . "' AND `setting`='" . safeSQLstr($matches[3]) . "' LIMIT 1")) {
print '<p style="text-align: center; font-weight: bold;" class="note">Event deleted</p>';
} else {
print '<p style="text-align: center;" class="warn">unable to delete event</p>';
}
} else { // regular Set Status
// Update form's OC_ fields - w/exceptions below requiring special handling
if ((!isset($_REQUEST['install'])) && isset($_POST['OC_submissions_open']) && ($_POST['OC_submissions_open'] == 1) && ($OC_statusAR['OC_submissions_open'] == 0) && (defined('OCC_LICENSE_EXPIRES')) && (strtotime(OCC_LICENSE_EXPIRES) < time())) {
unset($_POST['OC_submissions_open']);
print '<p class="warn">' . base64_decode('TmV3IFN1Ym1pc3Npb25zIG1heSBub3QgYmUgb3BlbmVkIGFzIHRoZSBsaWNlbnNlIGhhcyBleHBpcmVkLiAgRXh0ZW5kIHRoZSBzdXBwb3J0IHBlcmlvZCBvciBwdXJjaGFzZSBhIG5ldyBsaWNlbnNlIGlmIHRoaXMgaXMgYSBuZXcgZXZlbnQu') . '</p>';
}
foreach (array_keys($_POST) as $p) {
if (preg_match("/^[\w-]+/",$p) && isset($OC_statusAR[$p]) && preg_match("/^[01]$/i",$_POST[$p]) && ($OC_statusAR[$p] != $_POST[$p])) {
updateStatusSetting($p, $_POST[$p]);
$OC_statusAR[$p] = $_POST[$p];
}
}
// Success - if install, redirect, else let user know
if (isset($_REQUEST['install']) && ($_REQUEST['install'] == 1)) {
header("Location: install-complete.php");
exit;
} else {
print '<p style="text-align: center; font-weight: bold;" class="note">Status saved</p>';
}
}
} elseif ($_POST['ocsubmit'] == "Schedule") { // add an event
if (
isset($_POST['status']) && preg_match("/^([a-z0-9_]+)\:([a-z0-9_]+)$/i", $_POST['status'], $matches)
&& isset($_POST['openclose']) && preg_match("/^(?:open|close)$/", $_POST['openclose'])
&& isset($_POST['day']) && preg_match("/^\d\d$/", $_POST['day'])
&& isset($_POST['month']) && preg_match("/^\d\d$/", $_POST['month'])
&& isset($_POST['year']) && preg_match("/^\d{4}$/", $_POST['year'])
&& isset($_POST['time']) && preg_match("/^\d\d\:\d\d$/", $_POST['time'])
) {
$module = $matches[1];
$setting = $matches[2];
if (($module != 'OC') && !oc_moduleActive($module)) {
print '<p style="text-align: center;" class="warn">module inactive</p>';
} elseif (!isset($OC_statusAR[$setting])) {
print '<p style="text-align: center;" class="warn">status not found</p>';
} else {
$date = $_POST['year'] . '-' . $_POST['month'] . '-' . $_POST['day'];
$todayDT = new DateTime(date('Y-m-d')); // date() used otherwise in case same day which would cause todayDT > dateDT
$dateDT = new DateTime($date);
if ($dateDT < $todayDT) {
print '<p style="text-align: center;" class="warn">event date must be in the future</p>';
} else {
if (ocsql_query("UPDATE `" . OCC_TABLE_STATUS . "` SET `" . (($_POST['openclose'] == 'open') ? 'open' : 'close') . "`='" . safeSQLstr($date . ' ' . $_POST['time'] . ':00') . "' WHERE `module`='" . safeSQLstr($module) . "' AND `setting`='" . safeSQLstr($setting) . "' LIMIT 1")) {
print '<p style="text-align: center; font-weight: bold;" class="note">Event scheduled</p>';
} else {
print '<p style="text-align: center;" class="warn">unable to schedule event</p>';
}
}
}
} else {
print '<p style="text-align: center;" class="warn">invalid event field(s)</p>';
}
} else {
warn('Unknown action');
}
}
if (isset($_REQUEST['install']) && ($_REQUEST['install'] == 1)) {
printHeader($hdr,$hdrfn);
print '<p style="text-align: center; font-weight: bold;">Step 5 of 5: Open Submissions & Sign-Up/In</p>';
$installFields = '<input type="hidden" name="install" value="1" />';
} else {
$installFields = '';
}
$ocq = "SELECT * FROM `" . OCC_TABLE_STATUS . "` WHERE `module`='OC' ORDER BY `order`, `setting`";
$ocr = ocsql_query($ocq) or err('Unable to retrieve status settings');
$nonocq = "SELECT * FROM `" . OCC_TABLE_STATUS . "` WHERE `module`!='OC' ORDER BY `module`, `order`, `setting`";
$nonocr = ocsql_query($nonocq) or err('Unable to retrieve additional status settings');
$divnum = 1;
if (empty($installFields)) { // not installing OC
if (!isset($_POST['ocsubmit'])) {
print '<p class="note" style="text-align: center;">Make desired changes then click any <i>Set Status</i> button, or schedule an event below:</p>';
}
print '
<div style="margin: 0 auto; display: table; border: 1px solid #ddd; padding: 10px; background-color: #eee;">
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $token . '" />
<input type="hidden" name="ocsubmit" value="Schedule" />
Set <select name="status"><option></option>';
while ($ocl = ocsql_fetch_assoc($ocr)) {
print '<option value="' . safeHTMLstr($ocl['module'] . ':' . $ocl['setting']) . '">General: ' . $ocl['name'] . '</option>';
}
ocsql_data_seek($ocr, 0);
while ($nonocl = ocsql_fetch_assoc($nonocr)) {
if (!oc_moduleActive($nonocl['module'])) { continue; }
print '<option value="' . safeHTMLstr($nonocl['module'] . ':' . $nonocl['setting']) . '">' . safeHTMLstr($OC_modulesAR[$nonocl['module']]['name']) . ': ' . $nonocl['name'] . '</option>';
}
ocsql_data_seek($nonocr, 0);
print '</select> to <select name="openclose"><option></option><option value="open">open</option><option value="close">close</option></select><br />on <select id="day" name="day"><option></option>';
for ($i=1;$i<=31;$i++) {
if ($i < 10) { $usei = '0' . $i; } else { $usei = $i; }
print '<option value="' . $usei . '">' . $i . '</option>';
}
print '</select><select id="month" name="month"><option></option>';
for ($m=1; $m<=12; $m++) {
print '<option value="' . (($m < 10) ? "0$m" : $m) . '">' . oc_monthName($m) . '</option>';
}
print '</select><select id="year" name="year"><option></option>';
$thisYear = date('Y');
$endYear = $thisYear + 2;
for ($y = $thisYear; $y <= $endYear; $y++) {
print '<option value="' . $y . '">' . $y . '</option>';
}
print '</select>
<input name="date" id="datepicker" type="hidden" />
<script>
$( function() {
$( "#datepicker" ).datepicker({
showOn: "button",
dateFormat: "yy-mm-dd",
minDate: 0,
maxDate: "+2Y",
changeMonth: true,
changeYear: true,
buttonImage: "../images/calendar.png",
buttonImageOnly: true,
buttonText: "Select date",
onSelect: function(dateText, inst) {
$("#year").val(dateText.split(/-/)[0]);
$("#month").val(dateText.split(/-/)[1]);
$("#day").val(dateText.split(/-/)[2]);
}
});
} );
</script>
<br />
at <select name="time"><option></option>
';
$hstart = 0;
$hend = 23;
for ($h=$hstart;$h<=$hend;$h++) {
if ($h < 10) { $useh = '0' . $h; } else { $useh = $h; }
print '<option value="' . $useh . ':00">' . oc_statusTime($useh, '00') . '</option><option value="' . $useh . ':30">' . oc_statusTime($useh, '30') . '</option>';
}
print '</select> <span title="' . safeHTMLstr($OC_configAR['OC_timeZone']) . ' is the time zone, set under Settings: Configuration in the Localization section">' . safeHTMLstr($OC_configAR['OC_timeZone']) . '</span><br />
<div style="text-align: right; margin-top: 5px;"><input type="submit" value="Schedule" /></div>
</form>
</div>
<br />
';
}
print '
<script>
document.write(\'<p style="margin: 0 0 1em 1em;"><span style="color: #66f; text-decoration: underline; cursor: pointer;" onclick="oc_fsCollapseExpand(0)">collapse all</span> &nbsp; &nbsp; <span style="color: #66f; text-decoration: underline; cursor: pointer;" onclick="oc_fsCollapseExpand(1)">expand all</span></p>\');
</script>
<form method="post" action="' . $_SERVER['PHP_SELF'] . '" class="ocform ocstatusform">
<input type="hidden" name="token" value="' . $token . '" />
<input type="hidden" name="ocsubmit" value="Set Status" />
' . $installFields;
print '
<fieldset id="oc_fs_' . $divnum . '">
<legend onclick="oc_fsToggle(this)">General <span>(collapse)</span></legend>
<div id="oc_fs_' . $divnum++ . '_div">
';
while ($l = ocsql_fetch_assoc($ocr)) {
if (!isset($l['dependency']) || empty($l['dependency']) || $OC_configAR[$l['dependency']]) {
print '<div class="field"><label>' . safeHTMLstr($l['name']) . ':</label><fieldset class="radio">' . generateRadioOptions($l['setting'], $OC_statusValueAR, $l['status']) . '</fieldset>' . oc_statusEvent($l);
if (!empty($l['description'])) {
print '<div class="fieldnote note">' . safeHTMLstr($l['description']) . '</div></div>';
}
}
}
$module = '';
while ($l = ocsql_fetch_assoc($nonocr)) {
// skip inactive modules
if (!oc_moduleActive($l['module'])) {
continue;
}
// show module heading
if ($module != $l['module']) {
$module = $l['module'];
print '<input type="submit" value="Set Status" class="submit" /></div></fieldset><fieldset id="oc_fs_' . $divnum . '"><legend onclick="oc_fsToggle(this)">' . safeHTMLstr($OC_modulesAR[$module]['name']) . ' Module <span>(collapse)</span></legend><div id="oc_fs_' . $divnum++ . '_div">';
}
if (!isset($l['dependency']) || empty($l['dependency']) || $OC_configAR[$l['dependency']]) {
print '<div class="field"><label>' . safeHTMLstr($l['name']) . ':</label><fieldset class="radio">' . generateRadioOptions($l['setting'], $OC_statusValueAR, $l['status']) . '</fieldset>' . oc_statusEvent($l);
if (!empty($l['description'])) {
print '<div class="fieldnote note">' . safeHTMLstr($l['description']) . '</div>';
}
print '</div>';
}
}
print '
<p><input type="submit" value="Set Status" class="submit" /></p>
</div>
<script language="javascript"><!--
'.((OCC_LICENSE!='Public')?('ocsm=new Image();ocsm.src="//openconf.com/images/ocsm.png?l='.urlencode(OCC_LICENSE).'&s='.urlencode(OCC_BASE_URL).'&a='.urlencode(varValue('SERVER_ADDR',$_SERVER).','.varValue('LOCAL_ADDR',$_SERVER)).'";'):'').'
// --></script>
</fieldset>
</form>
';
printFooter();
?>
+188
View File
@@ -0,0 +1,188 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$hdr = '';
$hdrfn = 1;
$minTopics = 10; // min number of fields to display
$topicColAR = array(1, 2);
require_once "../include.php";
if (!OCC_INSTALL_COMPLETE && isset($_REQUEST['install']) && ($_REQUEST['install'] == 1)) {
require_once "install-include.php";
$token = '';
} else {
beginChairSession();
printHeader("Set Topics",1);
$token = $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'];
}
if (isset($_POST['submit']) && ($_POST['submit'] == "Set Topics")) {
// Check for valid submission
if (OCC_INSTALL_COMPLETE && !validToken('chair')) {
warn('Invalid submission');
}
// Check & update topic options
if (isset($_POST['OC_multipleSubmissionTopics']) && preg_match("/^[01]$/", $_POST['OC_multipleSubmissionTopics']) && updateConfigSetting('OC_multipleSubmissionTopics', $_POST['OC_multipleSubmissionTopics'], 'OC')) {
$OC_configAR['OC_multipleSubmissionTopics'] = $_POST['OC_multipleSubmissionTopics'];
}
if (isset($_POST['OC_multipleCommitteeTopics']) && preg_match("/^[01]$/", $_POST['OC_multipleCommitteeTopics']) && updateConfigSetting('OC_multipleCommitteeTopics', $_POST['OC_multipleCommitteeTopics'], 'OC')) {
$OC_configAR['OC_multipleCommitteeTopics'] = $_POST['OC_multipleCommitteeTopics'];
}
if (isset($_POST['OC_topicDisplayAlpha']) && preg_match("/^[01]$/", $_POST['OC_topicDisplayAlpha']) && updateConfigSetting('OC_topicDisplayAlpha', $_POST['OC_topicDisplayAlpha'], 'OC')) {
$OC_configAR['OC_topicDisplayAlpha'] = $_POST['OC_topicDisplayAlpha'];
}
// Delete current list of topics
issueSQL("DELETE FROM `" . OCC_TABLE_TOPIC . "`");
// Parse through submitted topics
$j = 1;
foreach ($_POST as $tid => $tval) {
if (preg_match("/^name-(\d+)$/", $tid, $tmatch) && !empty($tval)) {
$q2 = "INSERT INTO `" . OCC_TABLE_TOPIC . "` (`topicid`, `topicname`, `short`) VALUES ('" . safeSQLstr($j) . "','" . safeSQLstr(substr($tval,0,250)) . "','" . safeSQLstr(substr($_POST["short-".$tmatch[1]],0,20)) . "')";
issueSQL($q2);
$j++;
}
}
// Success - if install, redirect, else let user know
if (isset($_REQUEST['install']) && ($_REQUEST['install'] == 1)) {
header("Location: set_status.php?install=1");
exit;
} else {
print '<p style="text-align: center; font-weight: bold;" class="note">Options successfully updated</p>';
}
}
$displayWarning = false;
if (isset($_REQUEST['install']) && ($_REQUEST['install'] == 1)) {
printHeader($hdr,$hdrfn);
print '<p style="text-align: center; font-weight: bold;">Step 4 of 5: Set Topics</p>';
} else {
$countsr = ocsql_query("SELECT COUNT(*) AS `count` FROM `" . OCC_TABLE_PAPER . "`") or err('Unable to check for existing submissions');
$countsl = ocsql_fetch_assoc($countsr);
$countcr = ocsql_query("SELECT COUNT(*) AS `count` FROM `" . OCC_TABLE_REVIEWER . "`") or err('Unable to check for existing committee member');
$countcl = ocsql_fetch_assoc($countcr);
if (($countsl['count'] > 0) || ($countcl['count'] > 0)) {
$displayWarning = true;
}
}
print '
<form method="post" action="'.$_SERVER['PHP_SELF'].'">
<input type="hidden" name="token" value="' . $token . '" />
<p>Topics are used when making automated assignments. By default, both ' . oc_strtolower(OCC_WORD_AUTHOR) . 's and committee members are asked to select topics. Enter a sequential list of topics below. When you click on <em>Set Topics</em>, topics will be added sequentially regardless of the Topic ID listed, with blank topics skipped; thus topics should only be deleted until a submission has been made or committee member signed up. The <em>Short Name</em> field is optional; if present, it is used where a long topic name may be cumbersome.</p>
';
if ($displayWarning) {
print '<p class="warn">NOTE: As submissions have been made or committee members signed up already, deleting, changing, or re-ordering topics may result in data corruption. Instead, add new topics at the end, and rename topics no longer in use to "N/A" (without quotes) to have it skipped on applicable forms.</p>';
}
if (isset($_REQUEST['install']) && ($_REQUEST['install'] == 1)) {
print '<input type="hidden" name="install" value="1" />';
}
print '
<table border="0" cellspacing="1" cellpadding="8" id="topicTable">
<tr class="rowheader"><th>Topic ID</th><th>Topic Name</th><th title="20 character limit">Short Name*</th></tr>
';
// Display existing topics
$q = "SELECT * FROM `" . OCC_TABLE_TOPIC . "`";
$r = ocsql_query($q) or err("Unable to query topics");
$topicNum = ocsql_num_rows($r);
$tAR = array();
$row=1;
while ($l=ocsql_fetch_array($r)) {
print '<tr class="row' . $row . '"><td style="text-align: center">' . $l['topicid'] . '</td><td><input name="name-' . $l['topicid'] . '" value="' . (isset($l['topicname']) ? safeHTMLstr($l['topicname']) : '') . '" size="100" maxlength="250" /></td><td><input name="short-' . $l['topicid'] . '" value="' . (isset($l['short']) ? safeHTMLstr($l['short']) : '') . '" size="20" maxlength="20" /></td></tr>
';
if ($row==1) { $row=2; } else { $row=1; }
}
// Display additional rows
$addRows = ((($topicNum + 4) < $minTopics) ? ($minTopics - $topicNum) : 4);
for ($i=1; $i <= $addRows; $i++) {
$topicNum++;
print '<tr class="row' . $row . '"><td style="text-align: center">' . $topicNum . '</td><td><input name="name-' . $topicNum . '" value="' . (isset($tAR[$i]['name']) ? safeHTMLstr($tAR[$i]['name']) : '') . '" size="100" maxlength="250" /></td><td><input name="short-' . $topicNum . '" value="' . (isset($tAR[$i]['short']) ? safeHTMLstr($tAR[$i]['short']) : '') . '" size="20" maxlength="20" /></td></tr>
';
if ($row==1) { $row=2; } else { $row=1; }
}
print '
</table>
<style type="text/css">
<!--
.topic_link {
color: #00f; cursor: pointer;
}
-->
</style><script language="javascript">
<!--
var topicNum = ' . ($topicNum+1) . ';
var row = ' . $row . ';
var j;
function addTopicRow() {
if (document.getElementById) {
var topicTable = document.getElementById("topicTable");
if (topicTable) {
for (j=1; j<=5; j++) {
var topicRow = topicTable.insertRow(-1);
topicRow.className = "row" + row;
var idCell = topicRow.insertCell(-1);
idCell.align = "center";
idCell.innerHTML = topicNum;
var nameCell = topicRow.insertCell(-1);
nameCell.innerHTML = "<input name=\"name-" + topicNum + "\" value=\"\" size=\"100\" maxlength=\"250\" />";
var shortCell = topicRow.insertCell(-1);
shortCell.innerHTML = "<input name=\"short-" + topicNum + "\" value=\"\" size=\"20\" maxlength=\"20\" />";
topicNum += 1;
if (row == 1) { row = 2; } else { row = 1; }
}
}
}
}
document.write(\'<span onclick="addTopicRow()" class="topic_link" style="text-decoration: underline">Add More Rows</span>\');
// -->
</script>
<noscript><span class="note">All topics filled in? Click <em>Set Topics</em> to save topics and add more rows</span></noscript>
<br />
';
if (!oc_moduleActive('oc_customforms')) {
print '
<p><strong>Allow ' . oc_strtolower(OCC_WORD_AUTHOR) . 's to select multiple submission topics?</strong> ' . generateRadioOptions('OC_multipleSubmissionTopics', $yesNoAR, $OC_configAR['OC_multipleSubmissionTopics']) . '<br />
<span class="note">Select Yes to allow multiple topics, or No to limit ' . oc_strtolower(OCC_WORD_AUTHOR) . ' to one topic.</span></p>
<p><strong>Allow committee members to select multiple submission topics?</strong> ' . generateRadioOptions('OC_multipleCommitteeTopics', $yesNoAR, $OC_configAR['OC_multipleCommitteeTopics']) . '<br />
<span class="note">Select Yes to allow multiple topics, or No to limit committee member to one topic.</span></p>
';
}
print '
<p><strong>Display topics alphabetically?</strong> ' . generateRadioOptions('OC_topicDisplayAlpha', $yesNoAR, $OC_configAR['OC_topicDisplayAlpha']) . '<br />
<span class="note">Select Yes to display topics alphabetically on submission and committee sign up forms, or No to use order above.</span></p>
<input type="submit" name="submit" class="submit" value="Set Topics" />
</form>
';
printFooter();
?>
+201
View File
@@ -0,0 +1,201 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
$hdr = 'Export Settings';
$hdrfn = 1;
// Settings to exclude from export -- also update in settings-import.php
$excludeSettingsAR = array('OC_chair_pwd', 'OC_chair_uname', 'OC_chairChangePassword', 'OC_chairFailedSignIn', 'OC_confirmmail', 'OC_confName', 'OC_confNameFull', 'OC_confURL', 'OC_mailHeaders', 'OC_mailParams', 'OC_pcemail', 'OC_version', 'OC_versionLatest');
require_once '../include.php';
beginChairSession();
$oc_encryptedSettingsAR = array();
// Module pre hook
if (oc_hookSet('settings-export-pre')) {
foreach ($OC_hooksAR['settings-export-pre'] as $f) {
require_once $f;
}
}
if (isset($_POST['submit']) && ($_POST['submit'] == 'Export Settings')) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
$settings = array(
'options' => array(),
'configuration' => array(),
'license' => ((OCC_LICENSE == 'Public') ? 'Public' : 'PlusPro'),
'version' => $GLOBALS['OC_configAR']['OC_version'],
'modules' => array()
);
// Module prep
if (oc_hookSet('settings-export-prep')) {
foreach ($OC_hooksAR['settings-export-prep'] as $f) {
require_once $f;
}
}
// Check for selected settings
if (!isset($_POST['settings']) || (!is_array($_POST['settings'])) || (count($_POST['settings']) == 0)) {
warn('No settings selected', $hdr, $hdrfn);
exit;
}
// Configuration settings
$settings['options'][] = 'configuration';
$r = ocsql_query("SELECT `module`, `setting`, `value` FROM `" . OCC_TABLE_CONFIG . "` ORDER BY `module`, `setting`");
while ($l = ocsql_fetch_assoc($r)) {
if (((in_array('configuration', $_POST['settings']) && ($l['module'] == 'OC')) || isset($settings['modules'][$l['module']]))
&& !in_array($l['setting'], $excludeSettingsAR)
) {
if (in_array($l['module'] . ':' . $l['setting'], $oc_encryptedSettingsAR)) {
$settings['configuration'][$l['module'] . ':' . $l['setting'] . ':occrypt'] = oc_decrypt($l['value']);
} else {
$settings['configuration'][$l['module'] . ':' . $l['setting']] = $l['value'];
}
}
}
// Topics
if (in_array('topics', $_POST['settings'])) {
$settings['options'][] = 'topics';
$r = ocsql_query("SELECT * FROM `" . OCC_TABLE_TOPIC . "` ORDER BY `topicid`");
$settings['topics'] = array();
while ($l = ocsql_fetch_assoc($r)) {
$settings['topics'][$l['topicid']] = array(
'topicname' => $l['topicname'],
'short' => $l['short']
);
}
}
// Reviewers
if (in_array('reviewers', $_POST['settings'])) {
$settings['options'][] = 'reviewers';
$r = ocsql_query("SELECT * FROM `" . OCC_TABLE_REVIEWER . "` ORDER BY `reviewerid`");
$settings['reviewers'] = array();
while ($l = ocsql_fetch_assoc($r)) {
foreach ($l as $k => $v) {
$settings['reviewers'][$l['reviewerid']][$k] = $v;
}
}
// Reviewer Topics
if (in_array('topics', $_POST['settings'])) {
$settings['options'][] = 'reviewertopics';
$r = ocsql_query("SELECT * FROM `" . OCC_TABLE_REVIEWERTOPIC . "` ORDER BY `reviewerid`, `topicid`");
$settings['reviewertopics'] = array();
while ($l = ocsql_fetch_assoc($r)) {
if (!isset($settings['reviewertopics'][$l['reviewerid']])) {
$settings['reviewertopics'][$l['reviewerid']] = array($l['topicid']);
} else {
$settings['reviewertopics'][$l['reviewerid']][] = $l['topicid'];
}
}
}
}
// Templates
if (in_array('templates', $_POST['settings'])) {
$settings['options'][] = 'templates';
$r = ocsql_query("SELECT * FROM `" . OCC_TABLE_TEMPLATE . "`");
$settings['templates'] = array();
while ($l = ocsql_fetch_assoc($r)) {
foreach ($l as $k => $v) {
$settings['templates'][$l['templateid']][$k] = $v;
}
}
}
// Module settings
if (oc_hookSet('settings-export-process')) {
foreach ($OC_hooksAR['settings-export-process'] as $f) {
require_once $f;
}
}
// Output file
oc_sendNoCacheHeaders();
$fileName = 'openconf-settings';
if (preg_match("/^\w+$/", $GLOBALS['OC_configAR']['OC_confName'])) {
$fileName .= '-' . $GLOBALS['OC_configAR']['OC_confName'];
}
$fileName .= '.oc';
header('Content-Type: application/binary');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
if (isset($_POST['pw2']) && !empty($_POST['pw2'])) {
print oc_encrypt(json_encode($settings), $_POST['pw2']);
} else {
print json_encode($settings);
}
exit;
}
printHeader($hdr, $hdrfn);
print '
<p>In order to save your settings for use in another OpenConf installation, select what you would like exported below, optionally enter an encryption password, then click the <i>Export Settings</i> button. A file dialog box will open up for you to save the settings file on your computer. When importing the settings, the same modules for which settings are exported must be pre-installed, and the same password entered. <b>This file may contain sensitive information and should be protected accordingly.</b></p>
<script language="javascript" type="text/javascript">
<!--
function checkAllBoxes() {
var boxObj = document.getElementsByName(\'settings[]\');
for (var i=0; i<boxObj.length; i++) {
boxObj[i].checked = true;
}
}
document.write(\'<p><a href="#" onclick="checkAllBoxes(); return false;" style="margin-left: 25px; cursor: pointer; padding: 1px 3px; background-color: #eee; color: #00f; text-decoration: underline;">check all</a></p>\');
function settingExportSubmit() {
document.getElementById("pw2").value = document.getElementById("pw").value;
document.getElementById("pw").value = "";
}
// -->
</script>
<form method="post" action="settings-export.php">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" id="pw2" name="pw2" />
<label><input type="checkbox" name="settings[]" value="configuration" checked /> Configuration</label><br />
<br />
<label><input type="checkbox" name="settings[]" value="topics" /> Topics</label><br />
<label><input type="checkbox" name="settings[]" value="reviewers" /> Reviewers</label><br />
<label title="All templates will be included in the export; however for module-specific templates, only those of installed modules will be imported."><input type="checkbox" name="settings[]" value="templates" /> Templates*</label><br />
';
// Module settings
if (oc_hookSet('settings-export-options')) {
foreach ($OC_hooksAR['settings-export-options'] as $f) {
require_once $f;
}
}
print '
<br />
<p><input type="submit" name="submit" value="Export Settings" onclick="settingExportSubmit();" class="submit" /> &nbsp; &nbsp; <input name="pw" id="pw" size="30" placeholder="optional encryption password" style="background-color: #eee;" /> <span class="note">do not forget it!</span></p>
</form>
<p class="note">Save the generated file to your computer instead of trying to open it. The file will have a .oc extension and your computer will likely be unable to open it as it is not intended for human consumption. If you would still like to look at it, use a text editor.</p>
<p class="note">If the optional encryption password is entered, the contents of the settings file will be encrypted. In order to import the settings, you will need to enter the same password. <b>It will not be possible to recover the exported settings if the password is forgotten.</b></p>
';
printFooter();
?>
+201
View File
@@ -0,0 +1,201 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
// Settings to exclude from import -- also update in settings-export.php
$excludeSettingsAR = array('OC_chair_pwd', 'OC_chair_uname', 'OC_chairChangePassword', 'OC_chairFailedSignIn', 'OC_confirmmail', 'OC_confName', 'OC_confNameFull', 'OC_confURL', 'OC_mailHeaders', 'OC_mailParams', 'OC_pcemail', 'OC_version', 'OC_versionLatest');
require_once '../include.php';
beginChairSession();
printHeader('Settings Import', 1);
// Module pre hook
if (oc_hookSet('settings-import-pre')) {
foreach ($OC_hooksAR['settings-import-pre'] as $f) {
require_once $f;
}
}
if (isset($_POST['submit']) && ($_POST['submit'] == 'Import Settings')) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
// File uploaded ok?
if (!isset($_FILES['file']['error']) || $_FILES['file']['error'] || !is_uploaded_file($_FILES['file']['tmp_name']) || ($_FILES['file']['size'] <= 0)) {
warn('The file failed to load.');
}
$file = file_get_contents($_FILES['file']['tmp_name']) or err('Unable to open settings file');
unlink($_FILES['file']['tmp_name']);
if (isset($_POST['pw']) && !empty($_POST['pw'])) {
$file = oc_decrypt($file, $_POST['pw']);
}
// File encoded ok?
$settings = json_decode($file, true);
if (!is_array($settings)) {
warn('Settings file is corrupted');
}
// Check edition
if (!isset($settings['license']) || (($settings['license'] != 'Public') && (OCC_LICENSE == 'Public'))) {
warn('The file is not compatible with OpenConf Community Edition');
}
// Check version
if (isset($settings['version']) && ($settings['version'] > $GLOBALS['OC_configAR']['OC_version'])) {
warn('The file is from a newer version of OpenConf. Upgrade this installation first, then try importing the settings once agian.');
}
// Check modules
if (isset($settings['modules']) && (count($settings['modules']) > 0)) {
$modules = array();
foreach ($settings['modules'] as $module) {
$modules[] = safeHTMLstr($module);
}
sort($modules);
foreach ($settings['modules'] as $moduleID => $moduleName) {
if (!preg_match("/^[\w-]+$/", $moduleID) || !oc_module_installed($moduleID)) {
warn('The file includes settings for uninstalled modules. Please <a href="../modules/modules.php" target="_blank">install</a> the modules first, then import the settings. Modules included in the file are:<ul><li>' . implode('</li><li>', $modules) . '</li></ul>');
}
}
}
// Module prep
if (oc_hookSet('settings-import-prep')) {
foreach ($OC_hooksAR['settings-import-prep'] as $f) {
require_once $f;
}
}
// Configuration settings
if (isset($settings['configuration']) && is_array($settings['configuration']) && (count($settings['configuration']) > 0)) {
foreach($settings['configuration'] as $k => $v) {
if (preg_match("/^([^\:]+)\:([^\:]+)\:?(occrypt|)$/", $k, $matches)
&& !in_array($matches[2], $excludeSettingsAR)
) {
$module = $matches[1];
$setting = $matches[2];
if (isset($matches[3]) && ($matches[3] == 'occrypt')) {
$v = oc_encrypt($v);
}
updateConfigSetting($setting, $v, $module);
}
}
print '<p>Configuration settings imported (including modules) ...</p>';
}
// Topics
if (isset($settings['topics']) && is_array($settings['topics']) && (count($settings['topics']) > 0)) {
ocsql_query("TRUNCATE `" . OCC_TABLE_TOPIC . "`") or err('Unable to reset topic table');
$q = "INSERT INTO `" . OCC_TABLE_TOPIC . "` (`topicid`, `topicname`, `short`) VALUES ";
foreach($settings['topics'] as $k => $kAR) {
$q .= "('" . safeSQLstr($k) . "', '" . safeSQLstr($kAR['topicname']) . "', '" . safeSQLstr($kAR['short']) . "'),";
}
$q = rtrim($q, ',');
ocsql_query($q) or err('Unable to load topics - ' . safeHTMLstr(ocsql_error()));
print '<p>Topics imported ...</p>';
}
// Module settings -- run here in case Custom Forms modifies reviewer table
if (oc_hookSet('settings-import-process')) {
foreach ($OC_hooksAR['settings-import-process'] as $f) {
require_once $f;
}
}
// Reviewers
if (isset($settings['reviewers']) && !empty($settings['reviewers'])) {
ocsql_query("TRUNCATE `" . OCC_TABLE_REVIEWER . "`") or err('Unable to reset reviewer table');
foreach($settings['reviewers'] as $k => $kAR) {
$q = "INSERT INTO `" . OCC_TABLE_REVIEWER . "` SET ";
foreach ($kAR as $fld => $val) {
if ($val === null) { // special case for date fields which cannot be ''
$q .= "`" . $fld . "`=null,";
} else {
$q .= "`" . $fld . "`='" . safeSQLstr($val) . "',";
}
}
$q = rtrim($q, ',');
ocsql_query($q) or err('Unable to import reviewer - ' . safeHTMLstr(ocsql_error()));
}
print '<p>Reviewers imported ...</p>';
}
// Reviewer Topics
if (isset($settings['reviewertopics']) && is_array($settings['reviewertopics']) && (count($settings['reviewertopics']) > 0)) {
ocsql_query("TRUNCATE `" . OCC_TABLE_REVIEWERTOPIC . "`") or err('Unable to reset reviewertopic table');
foreach($settings['reviewertopics'] as $k => $kAR) {
$q = "INSERT INTO `" . OCC_TABLE_REVIEWERTOPIC . "` (`reviewerid`, `topicid`) VALUES ";
foreach ($kAR as $topicid) {
$q .= "('" . safeSQLstr($k) . "', '" . safeSQLstr($topicid) . "'),";
}
$q = rtrim($q, ',');
ocsql_query($q) or err('Unable to import reviewertopics - ' . safeHTMLstr(ocsql_error()));
}
print '<p>Reviewer Topics imported ...</p>';
}
// Templates
if (isset($settings['templates']) && !empty($settings['templates'])) {
foreach($settings['templates'] as $k => $kAR) {
if (
isset($kAR['module'])
&&
(
($kAR['module'] == 'OC')
||
oc_module_installed($kAR['module'])
)
) {
$qflds = '';
foreach ($kAR as $fld => $val) {
if ( ! empty($val) && ($fld != 'templateid')) {
$qflds .= "`" . $fld . "`='" . safeSQLstr($val) . "',";
}
}
$qflds = rtrim($qflds, ',');
$q = "INSERT INTO `" . OCC_TABLE_TEMPLATE . "` SET `templateid`='" . safeSQLstr($kAR['templateid']) . "', " . $qflds . " ON DUPLICATE KEY UPDATE " . $qflds;
ocsql_query($q) or err('Unable to import template - ' . safeHTMLstr(ocsql_error()));
}
}
print '<p>Templates imported ...</p>';
}
// Confirm
print '<p class="note2">Settings have been imported &ndash; be sure to review your configuration.</p>';
} else {
print '
<p style="margin-bottom: 2em;">In order to import settings from another OpenConf installation, select the settings file you previously exported, then click the <i>Import Settings</i> button. If this is not a new installation, you should first backup your database. <b>Existing topics and committee member accounts will be deleted if any are in import file.</b></p>
<form method="post" action="settings-import.php" enctype="multipart/form-data">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<p><label><b>Settings File:</b> <input type="file" name="file" /></label></p>
<p><label><b>File Password:</b> <input type="password" name="pw" id="pw" style="background: #eee" /></label> <span class="note">if password was entered when exporting; leave blank otherwise</span></p>
<br />
<input type="submit" name="submit" value="Import Settings" class="submit" />
</form>
';
}
printFooter();
?>
+44
View File
@@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Advocate Recommendation",1);
if (!isset($_GET['p']) || !preg_match("/^\d+$/", $_GET['p'])) {
err('Submission ID invalid');
}
$q = "SELECT `" . OCC_TABLE_PAPER . "`.`title`, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, `" . OCC_TABLE_PAPERADVOCATE . "`.`adv_recommendation`, `" . OCC_TABLE_PAPERADVOCATE . "`.`adv_comments` FROM `" . OCC_TABLE_PAPERADVOCATE . "`, `" . OCC_TABLE_PAPER . "`, `" . OCC_TABLE_REVIEWER . "` WHERE `" . OCC_TABLE_PAPERADVOCATE . "`.`paperid`='" . safeSQLstr($_GET['p']) . "' AND `" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`='" . safeSQLstr($_GET['a']) . "' AND `" . OCC_TABLE_PAPERADVOCATE . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid` AND `" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid`";
$r = ocsql_query($q) or err("Unable to get advocate review");
if (ocsql_num_rows($r) != 1) { err("Invalid paper/advocate match"); }
$l=ocsql_fetch_array($r);
print '
<table border=1 cellspacing=0 cellpadding=3>
<tr><td>Submission ID:</td><td>' . safeHTMLstr($_GET['p']) . '</td></tr>
<tr><td>Title:</td><td><a href="show_paper.php?pid=' . safeHTMLstr($_GET['p']) . '">' . safeHTMLstr($l['title']) . '</a></td></tr>
<tr><td>Advocate:</td><td><a href="show_reviewer.php?rid=' . safeHTMLstr($_GET['a']) . '">' . safeHTMLstr($l['name']) . '</a></td></tr>
<tr><td>Recommendation:</td><td>'.$l['adv_recommendation'].'</td></tr>
<tr><td>Comments:</td><td>';
if (!empty($l['adv_comments'])) { print safeHTMLstr($l['adv_comments']); } else { print "&nbsp;"; }
print '</td></tr>
</table>
';
print '<p><a href="list_advocates.php">Return to Advocate Listings</a><p>';
printFooter();
?>
+116
View File
@@ -0,0 +1,116 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Submission", 1);
print '<p style="text-align: center"><a href="list_papers.php">View All Submissions</a></p>';
if (!isset($_GET['pid']) || !ctype_digit($_GET['pid'])) {
err("Submission id is invalid");
}
// Get sub info
$spq = "SELECT * FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`='" . safeSQLstr($_GET['pid']) . "'";
$spr = ocsql_query($spq) or err("Unable to get submissions ");
if (ocsql_num_rows($spr)!=1) {
err("There does not appear to be a submission with that id (or there is more than one)");
}
$spl = ocsql_fetch_array($spr);
// Get authors
$oc_authorNum = 0;
$qa = "SELECT * FROM `" . OCC_TABLE_AUTHOR . "` WHERE `paperid`='" . safeSQLstr($_GET['pid']) . "' ORDER BY `position`";
$ra = ocsql_query($qa) or err("Unable to get " . oc_strtolower(OCC_WORD_AUTHOR) . "s ");
while ($a = ocsql_fetch_array($ra)) {
$apos = $a['position'];
foreach ($a as $akey => $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($_GET['pid']) . "'";
$rt = ocsql_query($qt) or err("Unable to get topics ");
$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;
$files = '<tr><th>File</th><td>';
if ($spl['format'] && oc_isFile($pfile = $OC_configAR['OC_paperDir'] . preg_replace("/\D/", "", $_GET['pid']) . "." . $spl['format'])) {
$files .= "<a href=\"../review/paper.php?c=1&p=" . safeHTMLstr($_GET['pid']) . "." . $spl['format']."\">" . safeHTMLstr($_GET['pid']) . ".".$spl['format']."</a> (" . oc_formatNumber(oc_fileSize($pfile)) . ')';
} else {
$files .= "not uploaded";
}
$files .= '</td></tr>';
$advocate = '';
if ($OC_configAR['OC_paperAdvocates']) {
$qadv = "SELECT `" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, `" . OCC_TABLE_REVIEWER . "`.`organization` FROM `" . OCC_TABLE_PAPERADVOCATE . "`, `" . OCC_TABLE_REVIEWER . "` WHERE `" . OCC_TABLE_PAPERADVOCATE . "`.`paperid`='" . safeSQLstr($_GET['pid']) . "' AND `" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid`";
$radv = ocsql_query($qadv) or err("Unable to get advocate info ");
if (ocsql_num_rows($radv) == 1) {
$spladv = ocsql_fetch_array($radv);
$advocate .= '<tr><th>Advocate:</th><td><a href="show_adv_review.php?s=&p=' . safeHTMLstr($_GET['pid']) . '&a=' . $spladv['advocateid'] . '">' . safeHTMLstr($spladv['name']) . '</a>, ' . $spladv['organization'] . '</td></tr>';
}
}
$reviewers = '';
$qrev = "SELECT `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, `" . OCC_TABLE_REVIEWER . "`.`organization` FROM `" . OCC_TABLE_PAPERREVIEWER . "`, `" . OCC_TABLE_REVIEWER . "` WHERE `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`='" . safeSQLstr($_GET['pid']) . "' AND `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid`";
$rrev = ocsql_query($qrev) or err("Unable to get reviewers info ");
if (($rows = ocsql_num_rows($rrev)) > 0) {
$reviewers .= '<tr><th>Reviewer(s):</th><td>';
while ($splrev = ocsql_fetch_array($rrev)) {
$reviewers .= (($rows > 1) ? '&#8226; ' : '') . '<a href="show_review.php?pid=' . safeHTMLstr($_GET['pid']) . '&rid=' . $splrev['reviewerid'] . '">' . safeHTMLstr($splrev['name']) . '</a>, ' . $splrev['organization'] . '<br />';
}
$reviewers .= '</td></tr>';
}
if (OCC_CHAIR_PWD_TRUMPS) {
print '
<div style="text-align: center"><form method="post" action="../author/edit.php" style="display: inline; margin: 0; padding: 0;"><input type="hidden" name="ocaction" value="Edit Submission" /><input type="hidden" name="c" value="1" /><input type="hidden" name="pid" value="' . safeHTMLstr($_GET['pid']) . '" /><input type="submit" name="submit" value="Edit Submission" /></form> &nbsp; &nbsp; &nbsp; <form method="get" action="../author/upload.php" style="display: inline; margin: 0; padding: 0;"><input type="hidden" name="ocaction" value="Upload File" /><input type="hidden" name="c" value="1" /><input type="hidden" name="pid" value="' . safeHTMLstr($_GET['pid']) . '" /><input type="submit" name="submit" value="Upload File" /></form></div>
<br />
';
}
print '
<table class="ocfields">
<tr><th>ID:</th><td>' . safeHTMLstr($_GET['pid']) . '</td></tr>
<tr><th>Submitted:</th><td>' . safeHTMLstr($spl['submissiondate']) . '</td></tr>
<tr><th>Last Updated:</th><td>' . safeHTMLstr($spl['lastupdate']) . '</td></tr>
';
oc_showFieldSet($OC_submissionFieldSetAR, $OC_submissionFieldAR, $spl);
$extra = '';
if (oc_hookSet('chair-show_paper')) {
foreach ($GLOBALS['OC_hooksAR']['chair-show_paper'] as $hook) {
require_once $hook;
}
}
print $files . $extra . $advocate . $reviewers;
print '</table>';
printFooter();
?>
+42
View File
@@ -0,0 +1,42 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
printHeader("Review",1);
if (!isset($_GET['pid']) || !preg_match("/^\d+$/", $_GET['pid'])) {
err('Invalid submission id');
} elseif(!isset($_GET['rid']) || !preg_match("/^\d+$/", $_GET['rid'])) {
err('Invalid reviewer id');
}
$q = "SELECT `" . OCC_TABLE_PAPERREVIEWER . "`.*, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, `" . OCC_TABLE_PAPER . "`.`title`, `" . OCC_TABLE_PAPER . "`.`type` FROM `" . OCC_TABLE_PAPERREVIEWER . "`, `" . OCC_TABLE_REVIEWER . "`, `" . OCC_TABLE_PAPER . "` WHERE `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`='" . safeSQLstr($_GET['rid']) . "' AND `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`='" . safeSQLstr($_GET['pid']) . "' AND `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` AND `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid`";
$r = ocsql_query($q) or err("Unable to get information");
if (ocsql_num_rows($r)!=1) {
err("Review not found");
}
$l = ocsql_fetch_array($r);
require_once OCC_REVIEW_INC_FILE;
print '
<p><strong>Submission:</strong> <a href="show_paper.php?pid=' . safeHTMLstr($_GET['pid']) . '">' . safeHTMLstr($_GET['pid']) . ' - ' . safeHTMLstr($l['title']) . '</a></p>
<p><strong>Reviewer:</strong> <a href="show_reviewer.php?rid=' . safeHTMLstr($_GET['rid']) . '">' . safeHTMLstr($_GET['rid']) . ' - ' . safeHTMLstr($l['name']) . '</a></p>
';
displayReview($l, $_GET['rid'], $l['type']);
printFooter();
?>
+105
View File
@@ -0,0 +1,105 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
$hdr = ''; // set these so req OCC_COMMITTEE_INC_FILE below skips printHeader
$hdrfn = 0;
printHeader("Committee Member Profile",1);
print '<p style="text-align: center"><a href="list_reviewers.php">View All Committee Members</a></p>';
if (!isset($_GET['rid']) || !ctype_digit($_GET['rid'])) {
err('Reviewer ID is invalid');
}
require_once OCC_FORM_INC_FILE;
require_once OCC_COMMITTEE_INC_FILE;
$extra = '';
// Get reviewer
$q = "SELECT * FROM `" . OCC_TABLE_REVIEWER . "` WHERE `reviewerid`='" . safeSQLstr($_GET['rid']) . "'";
$r = ocsql_query($q) or err("Unable to get information");
$l = ocsql_fetch_array($r);
// Get topics
$qt = "SELECT `topicid` FROM `" . OCC_TABLE_REVIEWERTOPIC . "` WHERE `reviewerid`='" . safeSQLstr($_GET['rid']) . "'";
$rt = ocsql_query($qt) or err("Unable to get topics ");
$l['topics'] = array();
while ($t = ocsql_fetch_array($rt)) {
$l['topics'][] = $t['topicid'];
}
$advocating = '';
if ($OC_configAR['OC_paperAdvocates']) {
$aq = "SELECT `" . OCC_TABLE_PAPERADVOCATE . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`title` FROM `" . OCC_TABLE_PAPERADVOCATE . "`, `" . OCC_TABLE_PAPER . "` WHERE `" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`='" . safeSQLstr($_GET['rid']) . "' AND `" . OCC_TABLE_PAPERADVOCATE . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid`";
$ar = ocsql_query($aq) or err("Unable to get advocating info");
if (ocsql_num_rows($ar) > 0) {
$advocating .= '<tr><th>Advocating:</th><td>';
while ($al = ocsql_fetch_array($ar)) {
$advocating .= '<a href="show_adv_review.php?a=' . safeHTMLstr($_GET['rid']) . '&p=' . $al['paperid'] . '">' . $al['paperid'] . '. ' . safeHTMLstr($al['title']) . '</a><br />';
}
$advocating .= '</td></tr>';
}
}
$reviewing = '';
$rq = "SELECT `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`, `" . OCC_TABLE_PAPER . "`.`title` FROM `" . OCC_TABLE_PAPERREVIEWER . "`, `" . OCC_TABLE_PAPER . "` WHERE `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`='" . safeSQLstr($_GET['rid']) . "' AND `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`=`" . OCC_TABLE_PAPER . "`.`paperid`";
$rr = ocsql_query($rq) or err("Unable to get reviewing info");
if (ocsql_num_rows($rr) > 0) {
$reviewing .= '<tr><th>Reviewing:</th><td>';
while ($rl = ocsql_fetch_array($rr)) {
$reviewing .= '<a href="show_review.php?rid=' . safeHTMLstr($_GET['rid']) . '&pid=' . $rl['paperid'] . '">' . $rl['paperid'] . '. ' . safeHTMLstr($rl['title']) . '</a><br />';
}
$reviewing .= '</td></tr>';
}
if (OCC_CHAIR_PWD_TRUMPS) {
print '
<form method="post" action="../review/update.php">
<input type="hidden" name="c" value="1" />
<input type="hidden" name="rid" value="' . safeHTMLstr($_GET['rid']) . '" />
<p style="text-align: center;"><input type="submit" name="submit" value="Edit Profile" /></p>
</form>
<table class="ocfields">
<tr><th>Member ID:</th><td>' . safeHTMLstr($_GET['rid']) . '</td></tr>
<tr><th>Username:</th><td>' . safeHTMLstr($l['username']) . '</td></tr>
<tr><th>Signed Up:</th><td>' . safeHTMLstr($l['signupdate']) . '</td></tr>
<tr><th>Last Signed In:</th><td>' . safeHTMLstr($l['lastsignin']) . '</td></tr>
';
}
if ($OC_configAR['OC_paperAdvocates']) {
print '<tr><th>Advocate/PC:</th><td> ' . (($l['onprogramcommittee'] == 'T') ? 'Yes' : 'No') . '</td></tr>';
}
oc_showFieldSet($OC_reviewerFieldSetAR, $OC_reviewerFieldAR, $l);
$extra = '';
if (oc_hookSet('chair-show_reviewer')) {
foreach ($GLOBALS['OC_hooksAR']['chair-show_reviewer'] as $hook) {
require_once $hook;
}
}
print $extra . $advocating . $reviewing;
print '</table><br />';
printFooter();
?>
+151
View File
@@ -0,0 +1,151 @@
<?php
// +----------------------------------------------------------------------+
// | 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 |
// +----------------------------------------------------------------------+
require_once "../include.php";
beginChairSession();
// Pre-process hooks
if (oc_hookSet('show_scores-pre')) {
foreach ($OC_hooksAR['show_scores-pre'] as $h) {
require_once $h;
}
}
printHeader("Review Scores",1);
print '
<p align="center"><a href="list_scores.php?s=' . safeHTMLstr(varValue('s', $_GET)) . '">List All Submissions by Score</a></p>
';
$pid = $_REQUEST['pid'];
if (!preg_match("/^\d+$/",$pid)) {
warn("Invalid Submission ID");
}
if (isset($_POST['submit']) && !empty($_POST['submit'])) {
// Check for valid submission
if (!validToken('chair')) {
warn('Invalid submission');
}
if ($_POST['submit'] == "Pending") {
$q = "UPDATE `" . OCC_TABLE_PAPER . "` SET `accepted`=NULL WHERE `paperid`='" . $pid . "'";
ocsql_query($q) or err("Unable to set submission acceptance");
} elseif (isset($OC_acceptanceColorAR[$_POST['submit']])) {
$q = "UPDATE `" . OCC_TABLE_PAPER . "` SET `accepted`='" . safeSQLstr($_POST['submit']) . "' WHERE `paperid`='" . $pid . "'";
ocsql_query($q) or err("Unable to set submission acceptance");
} elseif ($_POST['submit'] == "Submit Notes") {
$q = "UPDATE `" . OCC_TABLE_PAPER . "` SET `pcnotes`='" . safeSQLstr($_POST['pcnotes']) . "' WHERE `paperid`='" . $pid . "'";
ocsql_query($q) or err("Unable to update notes");
}
}
$q2 = "SELECT CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name`, `advocateid`, `adv_recommendation`, `adv_comments` FROM `" . OCC_TABLE_PAPERADVOCATE . "`, `" . OCC_TABLE_REVIEWER . "` WHERE `" . OCC_TABLE_PAPERADVOCATE . "`.`paperid`='" . $pid . "' AND `" . OCC_TABLE_PAPERADVOCATE . "`.`advocateid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid`";
$r2 = ocsql_query($q2) or err("Unable to get recommendation");
if (ocsql_num_rows($r2) == 0) {
$l2['adv_recommendation'] = '<em>No advocate was assigned to this submission</em><p>';
$l2['advocateid'] = NULL;
$l2['name'] = NULL;
$advcmts = '';
} else {
$l2=ocsql_fetch_array($r2);
if (empty($l2['adv_recommendation'])) {
$l2['adv_recommendation'] = '<em>Not yet provided</em>';
$advcmts = '';
} else {
$advcmts = safeHTMLstr($l2['adv_comments']);
$advcmts = preg_replace("/\n/","<br>\n",$advcmts);
}
}
$q3 = "SELECT `accepted`, `format`, `title`, `type`, `pcnotes` FROM `" . OCC_TABLE_PAPER . "` WHERE `paperid`='" . $pid . "'";
$r3 = ocsql_query($q3) or err("Unable to get submission info");
if (ocsql_num_rows($r3) != 1) {
warn("Unable to retrieve submission info");
exit;
} else {
$l3 = ocsql_fetch_array($r3);
$q = "SELECT `" . OCC_TABLE_PAPERREVIEWER . "`.*, CONCAT_WS(' ',`" . OCC_TABLE_REVIEWER . "`.`name_first`,`" . OCC_TABLE_REVIEWER . "`.`name_last`) AS `name` FROM `" . OCC_TABLE_PAPERREVIEWER . "`, `" . OCC_TABLE_REVIEWER . "` WHERE `" . OCC_TABLE_PAPERREVIEWER . "`.`paperid`='" . $pid . "' AND `" . OCC_TABLE_PAPERREVIEWER . "`.`reviewerid`=`" . OCC_TABLE_REVIEWER . "`.`reviewerid` ORDER BY `score`, `reviewerid`";
$r = ocsql_query($q) or err("Unable to get scores");
if (oc_hookSet('show_scores')) {
foreach ($OC_hooksAR['show_scores'] as $h) {
require_once $h;
}
}
print '
<strong>Submission ID:</strong> ' . $pid . '<br />
<strong>Title:</strong> <a href="show_paper.php?pid=' . $pid . '">' . safeHTMLstr($l3['title']) . '</a><br />';
if (!empty($l3['type'])) {
print '<strong>Type:</strong> ' . safeHTMLstr($l3['type']) . '<br />';
}
print '
<form method="post" action="' . $_SERVER['PHP_SELF'] . '">
<input type="hidden" name="token" value="' . $_SESSION[OCC_SESSION_VAR_NAME]['chairtoken'] . '" />
<input type="hidden" name="pid" value="' . $pid . '">
<dl>
<dt><strong>Decision:</strong> <em>' . (!empty($l3['accepted']) ? $l3['accepted'] : 'Pending') . '</em>
</dt><dd><br />Change to: &nbsp;
';
foreach ($OC_acceptanceValuesAR as $acc) {
if ($l3['accepted'] != $acc['value']) {
print '<input type="submit" name="submit" value="' . safeHTMLstr($acc['value']) . '"> &nbsp; &nbsp; ';
}
}
if (!empty($l3['accepted'])) {
print '<input type="submit" name="submit" value="Pending">';
}
print '
</dd>
<br />
<dt><strong>' . OCC_WORD_CHAIR . ' Notes:</strong><br /><br /></dt>
<dd><textarea rows=5 cols=60 name="pcnotes">' . safeHTMLstr($l3['pcnotes']) . '</textarea></dd>
<dd><input type="submit" name="submit" value="Submit Notes"></dd></dl>
</form>
';
if ($OC_configAR['OC_paperAdvocates']) {
print '
<p><hr /></p>
<dl>
<dt><strong>Advocate: <a href="show_reviewer.php?rid=' . $l2['advocateid'] . '">'. $l2['advocateid'] . ' - ' . safeHTMLstr($l2['name']) . '</a></strong></dt>
<dt><strong>Recommendation:</strong> ' . $l2['adv_recommendation'] . '</dt>
<dt><strong>Comments:</strong></dt>
<dd>'.$advcmts.'</dd>
</dl>
';
}
require_once OCC_REVIEW_INC_FILE;
displayReviews($pid, $r, $l3['type']);
// Additional data?
if (oc_hookSet('show_scores-bottom')) {
foreach ($OC_hooksAR['show_scores-bottom'] as $h) {
require_once $h;
}
}
} // else show paper info
printFooter();
?>

Some files were not shown because too many files have changed in this diff Show More