function errorHandler($errno, $errstr, $errfile = NULL, $errline = NULL, $errcontext = NULL) { global $user; if (!ONLINEDEBUG || !checkUserHasPerm('View Debug Information')) { cleanSemaphore(); dbDisconnect(); printHTMLFooter(); exit; } print "Error encountered<br>\n"; switch ($errno) { case E_USER_ERROR: echo "<b>FATAL</b> [{$errno}] {$errstr}<br />\n"; echo " Fatal error in line {$errline} of file {$errfile}"; echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; echo "Aborting...<br />\n"; cleanSemaphore(); dbDisconnect(); exit(1); break; case E_USER_WARNING: echo "<b>ERROR</b> [{$errno}] {$errstr}<br />\n"; break; case E_USER_NOTICE: echo "<b>WARNING</b> [{$errno}] {$errstr}<br />\n"; break; default: echo "Unkown error type: [{$errno}] {$errstr}<br />\n"; break; } if (!empty($errfile) && !empty($errline)) { print "Error at {$errline} in {$errfile}<br>\n"; } if (!empty($errcontext)) { print "<pre>\n"; print_r($errcontext); print "</pre>\n"; } print "<br><br><br>\n"; print "<pre>\n"; print getBacktraceString(); print "</pre>\n"; cleanSemaphore(); dbDisconnect(); printHTMLFooter(); exit; }
function errorHandler($errno, $errstr, $errfile = NULL, $errline = NULL, $errcontext = NULL) { global $user; if ($user["adminlevel"] != "developer") { dbDisconnect(); printHTMLFooter(); semUnlock(); exit; } print "Error encountered<br>\n"; switch ($errno) { case E_USER_ERROR: echo "<b>FATAL</b> [{$errno}] {$errstr}<br />\n"; echo " Fatal error in line {$errline} of file {$errfile}"; echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; echo "Aborting...<br />\n"; semUnlock(); exit(1); break; case E_USER_WARNING: echo "<b>ERROR</b> [{$errno}] {$errstr}<br />\n"; break; case E_USER_NOTICE: echo "<b>WARNING</b> [{$errno}] {$errstr}<br />\n"; break; default: echo "Unkown error type: [{$errno}] {$errstr}<br />\n"; break; } if (!empty($errfile) && !empty($errline)) { print "Error at {$errline} in {$errfile}<br>\n"; } if (!empty($errcontext)) { print "<pre>\n"; print_r($errcontext); print "</pre>\n"; } print "<br><br><br>\n"; print "<pre>\n"; print getBacktraceString(); print "</pre>\n"; dbDisconnect(); printHTMLFooter(); semUnlock(); exit; }
function checkExpiredDemoUser($userid, $groups = 0) { global $mode, $skin, $noHTMLwrappers; if ($groups == 0) { $groups = getUsersGroups($userid, 1); } if (count($groups) != 1) { return; } $tmp = array_values($groups); if ($tmp[0] != 'demo') { return; } $query = "SELECT start " . "FROM log " . "WHERE userid = {$userid} " . "AND finalend < NOW() " . "ORDER BY start " . "LIMIT 3"; $qh = doQuery($query, 101); $expire = time() - SECINDAY * 3; $rows = mysql_num_rows($qh); if ($row = mysql_fetch_assoc($qh)) { if ($rows >= 3 || datetimeToUnix($row['start']) < $expire) { if (in_array($mode, $noHTMLwrappers)) { # do a redirect and handle removal on next page load so user can # be notified - doesn't always work, but handles a few extra # cases header("Location: " . BASEURL . SCRIPT); } else { $nodemoid = getUserGroupID('nodemo', getAffiliationID('ITECS')); $query = "DELETE FROM usergroupmembers " . "WHERE userid = {$userid}"; # because updateGroups doesn't # delete from custom groups doQuery($query, 101); updateGroups(array($nodemoid), $userid); checkUpdateServerRequestGroups($groupid); if (empty($skin)) { $skin = 'default'; require_once "themes/{$skin}/page.php"; } $mode = 'expiredemouser'; printHTMLHeader(); print "<h2>Account Expired</h2>\n"; print "The account you are using is a demo account that has now expired. "; print "You cannot make any more reservations. Please contact <a href=\""; print "mailto:" . HELPEMAIL . "\">" . HELPEMAIL . "</a> if you need "; print "further access to VCL.<br>\n"; } cleanSemaphore(); # probably not needed but ensures we do not leave stale entries printHTMLFooter(); dbDisconnect(); exit; } } }
require_once ".ht-inc/states.php"; require_once '.ht-inc/errors.php'; require_once '.ht-inc/utils.php'; dbConnect(); initGlobals(); $modes = array_keys($actions['mode']); $args = array_keys($actions['args']); $hasArg = 0; if (in_array($mode, $modes)) { $actionFunction = $actions['mode'][$mode]; if (in_array($mode, $args)) { $hasArg = 1; $arg = $actions['args'][$mode]; } } else { $actionFunction = "main"; } checkAccess(); sendHeaders(); printHTMLHeader(); if ($viewmode == ADMIN_DEVELOPER) { set_error_handler("errorHandler"); } if ($hasArg) { $actionFunction($arg); } else { $actionFunction(); } printHTMLFooter(); dbDisconnect(); semUnlock();
/** * Displays both the "List of current recipes" and * "Insert a new recipe" panels in a single table. * @param string $tableTitle The title to display in the html table * @param string $sessionToken A session token * @return void */ function showMainMenu($tableTitle, $sessionToken) { printHTMLHeader(); print '<table style="width: 75%;text-align:center">' . "\n" . '<tr>' . "\n" . '<th colspan="2" style="text-align:center;">' . 'PHP Demo: Google Base data API<br />' . '<font size="-1">' . '<span style="font-variant: small-caps;">Powered By</span> ' . '<a href="http://framework.zend.com/download/gdata">' . 'Zend Google Data Client Library</a></font></th>' . "\n" . '</tr>' . "\n" . '<tr><td colspan="2" align="center">' . $tableTitle . "</td></tr>\n" . '<tr>' . "\n"; // Create the two sub-tables. showRecipeListPane($sessionToken); showRecipeInsertPane($sessionToken); // Add a "Sign out" link. print '<tr><th colspan="2" style="text-align: center">Or click here to' . ' <a href="http://www.google.com/accounts/Logout">sign out</a>' . ' of your Google account.</th></tr>' . "\n"; // Close the master table. print '</table>' . "\n"; printHTMLFooter(); }
function continuationsError() { global $contdata, $printedHTMLheader, $HTMLheader; if (empty($HTMLheader)) { printHTMLHeader(); } if (!$printedHTMLheader) { $printedHTMLheader = 1; print $HTMLheader; } if (array_key_exists('error', $contdata)) { switch ($contdata['error']) { case 'invalid input': print "<h2>Error: Invalid Input</h2><br>\n"; print "You submitted input invalid for this web site. If you have no "; print "idea why this happened and the problem persists, please email "; print "<a href=\"mailto:" . HELPEMAIL . "?Subject=Problem%20With%20VCL\">"; print HELPEMAIL . "</a> for further assistance. Please include the "; print "steps you took that led up to this problem in your email message."; break; case 'continuation does not exist': case 'expired': print "<h2>Error: Invalid Input</h2><br>\n"; print "You submitted expired data to this web site. Please restart the "; print "steps you were following without using your browser's <strong>"; print "Back</strong> button."; break; default: print "<h2>Error: Invalid Input</h2><br>\n"; print "An error has occurred. If this problem persists, please email "; print "<a href=\"mailto:" . HELPEMAIL . "?Subject=Problem%20With%20VCL\">"; print HELPEMAIL . "</a> for further assistance. Please include the "; print "steps you took that led up to this problem in your email message."; } } printHTMLFooter(); dbDisconnect(); exit; }
function continuationsError() { global $contdata, $printedHTMLheader, $HTMLheader; if (!array_key_exists('noHTMLwrappers', $contdata) || $contdata['noHTMLwrappers'] == 0) { if (empty($HTMLheader)) { printHTMLHeader(); } if (!$printedHTMLheader) { $printedHTMLheader = 1; print $HTMLheader; } } if (array_key_exists('error', $contdata)) { print "<!-- continuationserror -->\n"; print "<div id=\"continuationserrormessage\">\n"; $subj = rawurlencode(i("Problem With VCL")); $href = "<a href=\"mailto:" . HELPEMAIL . "?Subject={$subj}\">" . HELPEMAIL . "</a>"; switch ($contdata['error']) { case 'invalid input': print "<h2>" . i("Error: Invalid Input") . "</h2><br>\n"; printf(i("You submitted input invalid for this web site. If you have no idea why this happened and the problem persists, please email %s for further assistance. Please include the steps you took that led up to this problem in your email message."), $href); break; case 'continuation does not exist': case 'expired': print "<h2>" . i("Error: Invalid Input") . "</h2><br>\n"; print i("You submitted expired data to this web site. Please restart the steps you were following without using your browser's <strong>Back</strong> button."); break; default: print "<h2>" . i("Error: Invalid Input") . "</h2><br>\n"; printf(i("An error has occurred. If this problem persists, please email %s for further assistance. Please include the steps you took that led up to this problem in your email message."), $href); } print "</div>\n"; } if (!array_key_exists('noHTMLwrappers', $contdata) || $contdata['noHTMLwrappers'] == 0) { printHTMLFooter(); } dbDisconnect(); exit; }