';
$OC_sortImgAsc = '
';
$OC_translate = true;
$OC_translationExtrasAR = array();
$OC_db = NULL;
$OC_db_error = NULL;
$OC_db_errno = NULL;
// Init arrays
$OC_hooksAR = array();
$OC_cssAR = array();
$OC_jsAR = array();
$OC_extraHeaderAR = array();
$OC_onloadAR = array();
$OC_configAR = array();
$OC_statusAR = array();
$OC_modulesAR = array();
$OC_activeModulesAR = array();
$OC_languageAR = array();
$OC_httpHeaders = array('Content-type: text/html; charset=utf-8');
// Sanitize PHP_SELF
$_SERVER['PHP_SELF'] = htmlspecialchars($_SERVER['PHP_SELF']);
// Baseline version - set for install, updated from db below once installed
$GLOBALS['OC_configAR']['OC_version'] = '7.x'; ###
// Check whether it's home page or a subdir we're in
if (preg_match("/(?:privacy_policy|openconf)\.php/", basename($_SERVER['PHP_SELF']))) {
$pfx = "";
$OC_basepath = dirname($_SERVER['PHP_SELF']);
} else {
$pfx = "../";
$OC_basepath = dirname(dirname($_SERVER['PHP_SELF']));
}
// Define constants
define('OCC_DB_ENCODING', 'utf8mb4'); // Database encoding
define('OCC_DB_COLLATION', 'utf8mb4_unicode_520_ci'); // Database collation
define('OCC_BASE_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']) : '') . $OC_basepath . '/');
define('OCC_LIB_DIR', $pfx . 'lib/'); // lib dir
define('OCC_PLUGINS_DIR', $pfx . 'plugins/'); // plugins dir
define('OCC_CONFIG_FILE', $pfx . 'config.php'); // config file location
define('OCC_FORM_INC_FILE', $pfx . 'include-forms.inc'); // forms include file location
define('OCC_SUBMISSION_INC_FILE', $pfx . 'author/submission.inc'); // submission include file
define('OCC_ADVOCATE_INC_FILE', $pfx . 'review/advocate.inc'); // advocate include file
define('OCC_REVIEW_INC_FILE', $pfx . 'review/review.inc'); // review include file
define('OCC_COMMITTEE_INC_FILE', $pfx . 'review/committee.inc'); // review include file
define('OCC_MIME_FILE', OCC_LIB_DIR . 'mime.php'); // mime types file location
define('OCC_ZONE_FILE_EN', OCC_LIB_DIR . 'locale/en/zones.php');
define('OCC_UTF8CASECONV_FILE', OCC_LIB_DIR . 'UTF8CaseConv.php'); // UTF8CaseConv file location
/* DO NOT MODIFY THIS LINE OR OTHERWISE FALSELY DEFINE OR MAKE UP OCC_LICENSE */ (file_exists($pfx . 'license.php') ? require_once($pfx . 'license.php') : define('OCC_LICENSE', 'Public')); // License type /* DO NOT MODIFY THIS LINE */
define('OCC_JQUERY_VERSION', '3.5.0'); // jQuery version
define('OCC_JQUERYUI_VERSION', '1.12.1'); // jQueryUI version - also update oc_customforms.js
// Set OC_formatAR with mime types - moved to OCC_MIME_FILE in 4.00
require_once OCC_MIME_FILE;
// Row Array - used for toggling row style
$rowAR = array();
$rowAR[1] = 2;
$rowAR[2] = 1;
// Yes/No Array
$yesNoAR = array(
1 => 'Yes',
0 => 'No'
);
// Status Array
$OC_statusValueAR = array(
1 => 'Open',
0 => 'Closed',
);
// Context
$OC_context = stream_context_create(array('http'=>array('timeout'=>20)));
// i18n routines
// params: s|ource, d|omain, override-translate even if Chair (i.e.,OC_translate=false)
function oc_($s, $d='', $override=false) {
if ($s == '') {
return('');
}
if (($GLOBALS['OC_locale'] == 'en') || (!$GLOBALS['OC_translate'] && !$override)) {
if (isset($GLOBALS['OC_translationExtrasAR'][$GLOBALS['OC_locale']][$s])) {
return ($GLOBALS['OC_translationExtrasAR'][$GLOBALS['OC_locale']][$s]);
} else {
if ( defined('OCC_WORD_AUTHOR') && (OCC_WORD_AUTHOR != 'Author')) {
$from = array('/Author/', '/author/');
$to = array(OCC_WORD_AUTHOR, oc_strtolower(OCC_WORD_AUTHOR));
} else {
$from = array();
$to = array();
}
if ( defined('OCC_WORD_CHAIR') && (OCC_WORD_CHAIR != 'Chair') ) {
$from[] = '/(? 0) {
return(preg_replace($from, $to, $s));
} else {
return($s);
}
}
} elseif (isset($GLOBALS['OC_translationExtrasAR'][$GLOBALS['OC_locale']][$s])) {
return ($GLOBALS['OC_translationExtrasAR'][$GLOBALS['OC_locale']][$s]);
} elseif ( ( $shash = hash("md5", $s) ) && isset($GLOBALS['OC_translationExtrasAR'][$GLOBALS['OC_locale']][$shash])) {
return ($GLOBALS['OC_translationExtrasAR'][$GLOBALS['OC_locale']][$shash]);
} elseif (function_exists('gettext')) {
if (!empty($d)) {
return(dgettext($d, $s));
} else {
return(_($s));
}
}
else { return($s); }
/*
elseif (empty($t)) {
return(T_($s));
} else {
return(T_dgettext($domain, $s));
}
*/
}
function oc_n($s, $p, $c, $d='') { // s|ource p|lural c|ount d|omain
if ($s == '') {
return('');
}
if (function_exists('ngettext')) {
if (!empty($d)) {
return(dngettext($d, $s, $p, $c));
} else {
return(ngettext($s, $p, $c));
}
}
elseif ($c > 1) { return $p; }
else { return $s; }
/*
elseif (empty($d)) {
return(T_ngettext($s, $p, $c));
} else {
return(T_dngettext($d, $s, $p, $c));
}
*/
}
// Returns a string with double-quotes (only) slashes
function slashQuote($s) {
return(preg_replace('/"/','\\"',$s));
}
// Checks whether the script is close to timing out
function oc_checkTimeout() {
if (($GLOBALS['OC_timeStamp'] > 0)
&& ((time() - $GLOBALS['OC_timeStamp']) > ($GLOBALS['OC_maxRunTime'] - 5)) // timeout if within 5 seconds
) {
return TRUE;
}
return FALSE;
}
// Returns a string containing define statements with an updated constant value
function replaceConstantValue($constName, $newValue, &$string) {
$newValue = str_replace("'", "\\'", $newValue);
$string = preg_replace("/(define\('" . $constName . "',\s?'?).*?('?\);)/", '${1}' . $newValue . '${2}', $string);
}
// Returns true/false on whether a named hook is set
function oc_hookSet($hook) {
if (isset($GLOBALS['OC_hooksAR'][$hook]) && !empty($GLOBALS['OC_hooksAR'][$hook])) {
return true;
} else {
return false;
}
}
// Adds a hook for additional functionality; typically used with modules
function oc_addHook($name, $value) {
if (!isset($GLOBALS['OC_hooksAR'][$name])) { // init if first hook for name
$GLOBALS['OC_hooksAR'][$name] = array($value);
} elseif (!in_array($value, $GLOBALS['OC_hooksAR'][$name])) { // add only if not duplicate
$GLOBALS['OC_hooksAR'][$name][] = $value;
}
}
// Add CSS file to be read in by header
function oc_addCSS($file,$moduleId='') {
if (!empty($moduleId)) {
$GLOBALS['OC_cssAR'][] = 'modules/' . $moduleId . '/' . $file;
} else {
$GLOBALS['OC_cssAR'][] = $file;
}
}
// Add JS file to be read in by header
function oc_addJS($file,$moduleId='') {
if (!empty($moduleId)) {
$GLOBALS['OC_jsAR'][] = 'modules/' . $moduleId . '/' . $file;
} else {
$GLOBALS['OC_jsAR'][] = $file;
}
}
// Add body onLoad to be included in header
function oc_addOnLoad($js) {
$GLOBALS['OC_onloadAR'][] = $js;
}
// Add extra headers
function oc_addHeader($hdr) {
$GLOBALS['OC_extraHeaderAR'][] = $hdr;
}
// Returns an array of database tables
function getTables() {
$constAR = get_defined_constants();
preg_match_all("/(OCC_TABLE_\w+)/",implode('\0',array_keys($constAR)),$tAR);
foreach ($tAR[0] as $t) { $tableAR[] = constant($t); }
return($tableAR);
}
// oc_encrypt - encrypts string
function oc_encrypt($s, $key='') {
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('AES-256-CBC'));
if (empty($key)) {
$key = ((defined('OCC_ENC_KEY') && (OCC_ENC_KEY != '')) ? OCC_ENC_KEY : pack('H*', md5(OCC_LICENSE))); // fallback for upgrade error
}
return(base64_encode($iv) . '|' . base64_encode(openssl_encrypt($s, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv)));
}
// oc_decrypt - decrypts encrypted string
function oc_decrypt($e, $key='') {
if (empty($key)) {
$key = ((defined('OCC_ENC_KEY') && (OCC_ENC_KEY != '')) ? OCC_ENC_KEY : pack('H*', md5(OCC_LICENSE))); // fallback for upgrade error
}
list($e1, $e2) = explode('|', $e);
return(trim(openssl_decrypt(base64_decode($e2), 'AES-256-CBC', $key, OPENSSL_RAW_DATA, base64_decode($e1))));
}
// oc_password_hash - hashes password
function oc_password_hash($pw) {
return(password_hash($pw, PASSWORD_DEFAULT));
}
// oc_password_needs_rehash - checks whether password hash is outdated & new format available
function oc_password_needs_rehash($hash) {
return(password_needs_rehash($hash, PASSWORD_DEFAULT));
}
// oc_password_verify - verifies password and updates hash if needed
function oc_password_verify($pw, $hash, $type=null, $id=null) {
$verified = false;
if (oc_hookSet('password-verify')) {
foreach ($GLOBALS['OC_hooksAR']['password-verify'] as $hook) {
require_once $hook;
}
} else {
// verify hash
if (preg_match("/^\\$/", $hash)) { // new school
if (password_verify($pw, $hash)) {
$verified = true;
}
} else { // old school
$salt = substr($hash, 0, 10);
if ($hash == ($salt . sha1($salt . $pw))) {
$verified = true;
}
}
// update hash?
if ($verified && preg_match("/^\w+$/", $type) && oc_password_needs_rehash($hash)) {
if (($type == 'submission') && preg_match("/^\d+$/", $id)) {
ocsql_query("UPDATE `" . OCC_TABLE_PAPER . "` SET `password`='" . safeSQLstr(oc_password_hash($pw)) . "' WHERE `paperid`='" . safeSQLstr($id) . "'");
} elseif (($type == 'committee') && preg_match("/^\d+$/", $id)) {
ocsql_query("UPDATE `" . OCC_TABLE_REVIEWER . "` SET `password`='" . safeSQLstr(oc_password_hash($pw)) . "' WHERE `reviewerid`='" . safeSQLstr($id) . "'");
} elseif ($type == 'chair') {
updateConfigSetting('OC_chair_pwd', oc_password_hash($pw));
}
}
// check for chair pwd if not verified
if (!$verified && ($type != 'chair') && ($type != 'trump') && OCC_CHAIR_PWD_TRUMPS && oc_password_verify($pw, $GLOBALS['OC_configAR']['OC_chair_pwd'], 'trump')) {
$verified=true;
}
}
return($verified);
}
// oc_password_generate - creates and returns a new random password
function oc_password_generate() {
$validChars = 'bcdfghjkmnpqrtvwxyzBCDFGHJKLMNPQRTVWXYZ2346789'; // available chars for pwd
$cmax = strlen($validChars);
$ctot = rand(10, 14); // pwd length
$p = ''; // pwd
$c = 0; // number of chars in pwd
while ($c < $ctot) {
$p .= substr($validChars, mt_rand(0, ($cmax - 1)), 1);
$c++;
}
return($p);
}
// Format number
// $n = number of bytes
function oc_formatNumber($n) {
if ($n > 1048576) { // > 1 MB
return(number_format(($n/1048576),1) . "MB");
} else {
return(number_format(($n/1024),0) . "KB");
}
}
// Convert units
function toMB($n) {
if (preg_match("/^(\d+)(\w?)[bB]?$/",$n,$matches)) {
switch (strtoupper($matches[2])) {
case '':
case 'B': return((($matches[1] >= 105000) ? (number_format(($matches[1]/1048576),1) . "MB") : (number_format(($matches[1]/1024),1) . "KB"))); break;
case 'K': return((($matches[1] >= 103) ? (number_format(($matches[1]/1024),1) . "MB") : (number_format($matches[1],1) . "KB"))); break;
case 'M': return($matches[1] . "MB"); break;
}
}
return($n);
}
// Returns the value of a var if it exists in the specified array, or a default value
// if safe=true and array value exists, it's returned safeHTMLstr()
function varValue($varName, &$ar, $default='', $safe=false) {
if (isset($ar[$varName])) {
if ($safe) {
return(safeHTMLstr($ar[$varName]));
} else {
return($ar[$varName]);
}
}
return($default);
}
// Displays page header
function printHeader($what, $function="0") {
global $pfx;
// CHANGES TO MENU ITEMS MAY REQUIRE UPDATE TO PLACEMENT OF PRIVACY POLICY BELOW
$menusAR = array(
0 => array( // none of the below
safeHTMLstr(sprintf(oc_('%s Home'), 'OpenConf')),
'',
),
1 => array( // chair
'',
'',
'',
),
2 => array( // committee
//T: Member Home = Committee Member Home Page (e.g., Reviewer Home Page)
'',
'',
'',
'',
),
3 => array( // author, sign in/up, other
//T: %s = OpenConf
'',
'',
),
4 => array( // install
'Restart Install',
),
);
$menusFillerAR = array(
1 => 'Signed in as: ' . safeHTMLstr($GLOBALS['OC_configAR']['OC_chair_uname']),
2 => safeHTMLstr(sprintf(oc_('Signed in as: %1$s (%2$d)'), safeHTMLstr($_SESSION[OCC_SESSION_VAR_NAME]['acusername']), $_SESSION[OCC_SESSION_VAR_NAME]['acreviewerid'])),
);
// privacy policy?
if ($GLOBALS['OC_configAR']['OC_privacy_display'] == 1) {
$privacyMenu = '';
array_splice($menusAR[0], 1, 0, $privacyMenu);
array_splice($menusAR[1], 1, 0, $privacyMenu);
array_splice($menusAR[2], 2, 0, $privacyMenu);
array_splice($menusAR[3], 1, 0, $privacyMenu);
}
if (oc_hookSet('header-top-pre')) {
foreach ($GLOBALS['OC_hooksAR']['header-top-pre'] as $hook) {
require_once $hook;
}
}
require_once $GLOBALS['pfx'] . (isset($GLOBALS['OC_configAR']['OC_headerFile']) ? $GLOBALS['OC_configAR']['OC_headerFile'] : 'header.php');
print '
';
if (oc_hookSet('header-top')) {
foreach ($GLOBALS['OC_hooksAR']['header-top'] as $hook) {
require_once $hook;
}
}
if (isset($GLOBALS['OC_displayTop']) && !empty($GLOBALS['OC_displayTop'])) {
print $GLOBALS['OC_displayTop'];
}
if (!empty($what)) {
print '
';
}
unset($menusAR);
unset($menusFillerAR);
}
// Displays page footer
function printFooter() {
global $pfx;
if (oc_hookSet('footer-top')) {
foreach ($GLOBALS['OC_hooksAR']['footer-top'] as $hook) {
require_once $hook;
}
}
print '
';
if ($GLOBALS['OC_configAR']['OC_privacy_display'] == 2) {
print '';
}
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// IT IS A VIOLATION OF THE OPENCONF LICENSE TO
// MODIFY OR HIDE THE PRINT STATEMENT BELOW OR ITS ASSOCIATED CSS STYLES
// WITHOUT HAVING FIRST PURCHASED AN OPENCONF BRANDING-FREE LICENSE FOR THIS INSTALLATION
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
print '
' .
//T: %2s = OpenConf
/* DO NOT REMOVE, ALTER, OR HIDE THIS COPYRIGHT NOTICE */sprintf(oc_('Powered by
%2$s®'), 'https://www.OpenConf.com', 'OpenConf') . '
' .
//T: %1s-%2s = YYYY-YYYY, %4$s = Zakon Group LLC
/* DO NOT REMOVE, ALTER, OR HIDE THIS COPYRIGHT NOTICE */sprintf(oc_('Copyright ©%1$s-%2$s
%4$s'), '2002', '2020', 'https://www.ZakonGroup.com/', 'Zakon Group LLC') . '
';
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// IT IS A VIOLATION OF THE OPENCONF LICENSE TO
// MODIFY OR HIDE THE PRINT STATEMENT ABOVE OR ITS ASSOCIATED CSS STYLES
// WITHOUT HAVING FIRST PURCHASED AN OPENCONF BRANDING-FREE LICENSE FOR THIS INSTALLATION
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// include Google Analytics tag if it starts with