'); 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 .= '
Event deleted
'; } else { print 'unable to delete event
'; } } 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 '' . base64_decode('TmV3IFN1Ym1pc3Npb25zIG1heSBub3QgYmUgb3BlbmVkIGFzIHRoZSBsaWNlbnNlIGhhcyBleHBpcmVkLiAgRXh0ZW5kIHRoZSBzdXBwb3J0IHBlcmlvZCBvciBwdXJjaGFzZSBhIG5ldyBsaWNlbnNlIGlmIHRoaXMgaXMgYSBuZXcgZXZlbnQu') . '
'; } 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 'Status saved
'; } } } 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 'module inactive
'; } elseif (!isset($OC_statusAR[$setting])) { print 'status not found
'; } 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 'event date must be in the future
'; } 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 'Event scheduled
'; } else { print 'unable to schedule event
'; } } } } else { print 'invalid event field(s)
'; } } else { warn('Unknown action'); } } if (isset($_REQUEST['install']) && ($_REQUEST['install'] == 1)) { printHeader($hdr,$hdrfn); print 'Step 5 of 5: Open Submissions & Sign-Up/In
'; $installFields = ''; } 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 'Make desired changes then click any Set Status button, or schedule an event below:
'; } print '