/** function get_item * Generate the HTML content portion of the page * * @param string contents * @param string instructions for page * @param string [optional] title for page * @return string HTML content for page */ function get_item($contents, $hint, $title = '', $extra_html = '') { $hint_html = "\n\t\t\t<p><strong>Welcome"; if (!empty($GLOBALS['Player']) && !empty($_SESSION['player_id'])) { $hint_html .= ", {$GLOBALS['Player']->username}"; } $hint_html .= '</strong></p>'; if (is_array($hint)) { foreach ($hint as $line) { $hint_html .= "\n\t\t\t<p>{$line}</p>"; } } else { $hint_html .= "\n\t\t\t<p>{$hint}</p>"; } if ('' != $title) { $title = '<h2>' . $title . '</h2>'; } $long_date = class_exists('Settings') && Settings::test() ? Settings::read('long_date') : 'M j, Y g:i a'; $html = ' <aside id="info"> <div id="notes" class="box"> <div> <div id="date">' . date($long_date) . '</div> ' . $hint_html . ' </div> </div> ' . $extra_html . ' </aside><!-- #info --> <div id="content" class="box"> <div> ' . $title . ' ' . $contents . ' </div> </div><!-- #content --> '; return $html; }
define('DEBUG', (bool) $debug); // set to true for output of debugging code } if (DEBUG) { if (isset($_GET['DEBUG'])) { $GLOBALS['_&_DEBUG_QUERY'] = '&DEBUG=' . $_GET['DEBUG']; $GLOBALS['_?_DEBUG_QUERY'] = '?DEBUG=' . $_GET['DEBUG']; } else { $GLOBALS['_&_DEBUG_QUERY'] = ''; $GLOBALS['_?_DEBUG_QUERY'] = '?z'; } } } $GLOBALS['_LOGGING'] = DEBUG; // do not change, rather, change debug value if (class_exists('Settings') && Settings::test()) { $Mysql->set_settings(array('log_errors' => Settings::read('DB_error_log'), 'email_errors' => Settings::read('DB_error_email'), 'email_from' => Settings::read('from_email'), 'email_to' => Settings::read('to_email'))); } if (defined('DEBUG') && DEBUG) { ini_set('display_errors', 'On'); error_reporting(-1); // everything if (isset($Mysql)) { $Mysql->set_error(3); } } // log the player in if ((!defined('LOGIN') || LOGIN) && isset($Mysql)) { $GLOBALS['Player'] = new GamePlayer(); // this will redirect to login if failed $GLOBALS['Player']->log_in();
/** function test_debug * This function tests the debug given by the * URL and checks it against the globals debug password * and if they do not match, doesn't debug * * @param void * @action tests debug pass * @return bool success */ function test_debug() { if (!isset($_GET['DEBUG'])) { return false; } if (!class_exists('Settings') || !Settings::test()) { return false; } if ('' == trim(Settings::read('debug_pass'))) { return false; } if (0 !== strcmp($_GET['DEBUG'], Settings::read('debug_pass'))) { return false; } return true; }
/** function test_debug * This function tests the debug given by the * URL and checks it against the globals debug password * and if they do not match, doesn't debug * * @param void * @action tests debug pass * @return bool success */ function test_debug() { if (!isset($_GET['DEBUG'])) { return false; } if (!class_exists('Settings') || !Settings::test()) { return false; } if ('' == trim(Settings::read('debug_pass'))) { return false; } if (0 !== strcmp($_GET['DEBUG'], Settings::read('debug_pass'))) { return false; } $GLOBALS['_&_DEBUG_QUERY'] = '&DEBUG=' . $_GET['DEBUG']; $GLOBALS['_?_DEBUG_QUERY'] = '?DEBUG=' . $_GET['DEBUG']; return true; }
<pre><?php require_once 'classes/mysql.class.php'; require_once 'classes/settings.class.php'; var_dump(class_exists('Settings') && Settings::test()); ?> </pre>