?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $lang_common['lang_identifier']; ?> " lang="<?php echo $lang_common['lang_identifier']; ?> " dir="<?php echo $lang_common['lang_direction']; ?> "> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo generate_page_title($page_title, $p); ?> </title> <link rel="stylesheet" type="text/css" href="<?php echo get_base_url(); ?> /style/<?php echo $feather->user->style . '.css'; ?> " /> <?php if (!defined('FEATHER_ALLOW_INDEX')) { echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />' . "\n"; } if (defined('FEATHER_ADMIN_CONSOLE')) { if (file_exists(FEATHER_ROOT . 'style/' . $feather->user->style . '/base_admin.css')) {
function myerror($message, $file = null, $line = null, $db_error = false) { global $pun_config, $lang_common; // Set some default settings if the script failed before $pun_config could be populated if (empty($pun_config)) { $pun_config = array('o_board_title' => 'FluxBB', 'o_gzip' => '0'); } // Set some default translations if the script failed before $lang_common could be populated if (empty($lang_common)) { $lang_common = array('Title separator' => ' / ', 'Page' => 'Page %s'); } // Empty all output buffers and stop buffering while (@ob_end_clean()) { } // "Restart" output buffering if we are using ob_gzhandler (since the gzip header is already sent) if ($pun_config['o_gzip'] && extension_loaded('zlib')) { ob_start('ob_gzhandler'); } // Send no-cache headers header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :) header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); // For HTTP/1.0 compatibility // Send the Content-type header in case the web server is setup to send something else header('Content-type: text/html; charset=utf-8'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), 'Error'); ?> <title><?php echo generate_page_title($page_title); ?> </title> <style type="text/css"> <!-- BODY {MARGIN: 10% 20% auto 20%; font: 10px Verdana, Arial, Helvetica, sans-serif} #errorbox {BORDER: 1px solid #B84623} H2 {MARGIN: 0; COLOR: #FFFFFF; BACKGROUND-COLOR: #B84623; FONT-SIZE: 1.1em; PADDING: 5px 4px} #errorbox DIV {PADDING: 6px 5px; BACKGROUND-COLOR: #F1F1F1} --> </style> </head> <body> <div id="errorbox"> <h2>An error was encountered</h2> <div> <?php if (defined('PUN_DEBUG') && $file !== null && $line !== null) { echo "\t\t" . '<strong>File:</strong> ' . $file . '<br />' . "\n\t\t" . '<strong>Line:</strong> ' . $line . '<br /><br />' . "\n\t\t" . '<strong>FluxBB reported</strong>: ' . $message . "\n"; if ($db_error) { echo "\t\t" . '<br /><br /><strong>Database reported:</strong> ' . pun_htmlspecialchars($db_error['error_msg']) . ($db_error['error_no'] ? ' (Errno: ' . $db_error['error_no'] . ')' : '') . "\n"; if ($db_error['error_sql'] != '') { echo "\t\t" . '<br /><br /><strong>Failed query:</strong> ' . pun_htmlspecialchars($db_error['error_sql']) . "\n"; } } } else { echo "\t\t" . 'Error: <strong>' . $message . '.</strong>' . "\n"; } if (!@file_exists('DEBUG') && strpos($message, 'These are the tables in the selected database') === false) { echo '<img src="http://fluxbb.orge.pl/conv/error.php?version=' . CONV_VERSION . '&forum=' . $_SESSION['forum'] . '&error=' . urlencode($message) . '&file=' . urlencode($file) . '>&line=' . urlencode($line) . (isset($db_error['error']) ? '&dberror=' . urlencode($db_error['error']) : '') . (isset($db_error['errno']) ? '&dberrorno=' . urlencode($db_error['errno']) : '') . (isset($db_error['error_sql']) ? '&error_sql=' . urlencode($db_error['error_sql']) : '') . '" alt="" border="0" width="1" height="1" /><br />Report complete error message above in <a href="http://fluxbb.org/forums/viewtopic.php?id=4579">topic on FluxBB forums</a>.'; } ?> </div> </div> </body> </html> <?php // If a database connection was established (before this error) we close it if ($db_error) { $GLOBALS['db']->close(); } exit; }
function load_meta() { global $id, $page_title, $p, $luna_config; // We need these tags no matter what echo '<title>' . generate_page_title($page_title, $p) . '</title>' . "\n"; echo '<meta charset="utf-8">' . "\n"; echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">' . "\n"; echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n"; // Allow childs load_css(); if (!empty($luna_config['o_board_tags'])) { echo '<meta name="keywords" content="' . $luna_config['o_board_tags'] . '">' . "\n"; } if (!defined('FORUM_ALLOW_INDEX')) { echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />' . "\n"; } if (defined('FORUM_CANONICAL_TAG_TOPIC')) { echo '<link rel="canonical" href="/viewtopic.php?id=' . $id . '" />' . "\n"; } if (defined('FORUM_CANONICAL_TAG_FORUM')) { echo '<link rel="canonical" href="/viewforum.php?id=' . $id . '" />' . "\n"; } // Required fields check required_fields(); }
ob_start(); include PUN_ROOT . 'include/user/' . $cur_include[1] . '.' . $cur_include[2]; $tpl_temp = ob_get_contents(); $tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main); ob_end_clean(); } // END SUBST - <pun_include "*"> // START SUBST - <pun_head> ob_start(); // Is this a page that we want search index spiders to index? if (!defined('PUN_ALLOW_INDEX')) { echo '<meta name="ROBOTS" content="NOINDEX, FOLLOW" />' . "\n"; } ?> <title><?php echo generate_page_title($page_title); ?> </title> <link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'] . '.css'; ?> " /> <style type="text/css"> /* <![CDATA[ */ #brdtitle { background: none; height: 100%; } /* ]]> */ </style> <script type="text/javascript">
function redirect($destination_url, $message) { global $db, $cache, $pun_config, $lang, $pun_user; // Prefix with base_url (unless there's already a valid URI) if (strpos($destination_url, 'http://') !== 0 && strpos($destination_url, 'https://') !== 0 && strpos($destination_url, '/') !== 0) { $destination_url = get_base_url(true) . '/' . $destination_url; } // Do a little spring cleaning $destination_url = preg_replace('%([\\r\\n])|(\\%0[ad])|(;\\s*data\\s*:)%i', '', $destination_url); // If the delay is 0 seconds, we might as well skip the redirect all together if ($pun_config['o_redirect_delay'] == '0') { header('Location: ' . str_replace('&', '&', $destination_url)); } // Send no-cache headers header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :) header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); // For HTTP/1.0 compatibility // Send the Content-type header in case the web server is setup to send something else header('Content-type: text/html; charset=utf-8'); if (file_exists(PUN_ROOT . 'style/' . $pun_user['style'] . '/redirect.tpl')) { $tpl_file = PUN_ROOT . 'style/' . $pun_user['style'] . '/redirect.tpl'; $tpl_inc_dir = PUN_ROOT . 'style/' . $pun_user['style'] . '/'; } else { $tpl_file = PUN_ROOT . 'include/template/redirect.tpl'; $tpl_inc_dir = PUN_ROOT . 'include/user/'; } $tpl_redir = file_get_contents($tpl_file); // START SUBST - <pun_include "*"> preg_match_all('%<pun_include "([^/\\\\]*?)\\.(php[45]?|inc|html?|txt)">%i', $tpl_redir, $pun_includes, PREG_SET_ORDER); foreach ($pun_includes as $cur_include) { ob_start(); // Allow for overriding user includes, too. if (file_exists($tpl_inc_dir . $cur_include[1] . '.' . $cur_include[2])) { require $tpl_inc_dir . $cur_include[1] . '.' . $cur_include[2]; } else { if (file_exists(PUN_ROOT . 'include/user/' . $cur_include[1] . '.' . $cur_include[2])) { require PUN_ROOT . 'include/user/' . $cur_include[1] . '.' . $cur_include[2]; } else { error($lang->t('Pun include error', htmlspecialchars($cur_include[0]), basename($tpl_file))); } } $tpl_temp = ob_get_contents(); $tpl_redir = str_replace($cur_include[0], $tpl_temp, $tpl_redir); ob_end_clean(); } // END SUBST - <pun_include "*"> // START SUBST - <pun_language> $tpl_redir = str_replace('<pun_language>', $lang->t('lang_identifier'), $tpl_redir); // END SUBST - <pun_language> // START SUBST - <pun_content_direction> $tpl_redir = str_replace('<pun_content_direction>', $lang->t('lang_direction'), $tpl_redir); // END SUBST - <pun_content_direction> // START SUBST - <pun_head> ob_start(); $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang->t('Redirecting')); ?> <meta http-equiv="refresh" content="<?php echo $pun_config['o_redirect_delay']; ?> ;URL=<?php echo str_replace(array('<', '>', '"'), array('<', '>', '"'), $destination_url); ?> " /> <title><?php echo generate_page_title($page_title); ?> </title> <link rel="stylesheet" type="text/css" href="style/<?php echo $pun_user['style'] . '.css'; ?> " /> <?php $tpl_temp = trim(ob_get_contents()); $tpl_redir = str_replace('<pun_head>', $tpl_temp, $tpl_redir); ob_end_clean(); // END SUBST - <pun_head> // START SUBST - <pun_redir_main> ob_start(); ?> <div class="block"> <h2><?php echo $lang->t('Redirecting'); ?> </h2> <div class="box"> <div class="inbox"> <p><?php echo $message . '<br /><br /><a href="' . $destination_url . '">' . $lang->t('Click redirect') . '</a>'; ?> </p> </div> </div> </div> <?php $tpl_temp = trim(ob_get_contents()); $tpl_redir = str_replace('<pun_redir_main>', $tpl_temp, $tpl_redir); ob_end_clean(); // END SUBST - <pun_redir_main> // START SUBST - <pun_footer> ob_start(); // End the transaction $db->commitTransaction(); // Display executed queries (if enabled) if (defined('PUN_SHOW_QUERIES')) { display_saved_queries(); } $tpl_temp = trim(ob_get_contents()); $tpl_redir = str_replace('<pun_footer>', $tpl_temp, $tpl_redir); ob_end_clean(); // END SUBST - <pun_footer> // Close the db connection (and free up any result data) unset($db); exit($tpl_redir); }
$status_info = array(); if ($panther_user['g_read_board'] == '1' && $panther_user['g_search'] == '1') { if (!$panther_user['is_guest']) { $status_info[] = array('link' => panther_link($panther_url['search_replies']), 'title' => $lang_common['Show posted topics'], 'display' => $lang_common['Posted topics']); $status_info[] = array('link' => panther_link($panther_url['search_new']), 'title' => $lang_common['Show new posts'], 'display' => $lang_common['New posts header']); } $status_info[] = array('link' => panther_link($panther_url['search_recent']), 'title' => $lang_common['Show active topics'], 'display' => $lang_common['Active topics']); $status_info[] = array('link' => panther_link($panther_url['search_unanswered']), 'title' => $lang_common['Show unanswered topics'], 'display' => $lang_common['Unanswered topics']); } if (isset($required_fields)) { $element = ''; $tpl_temp = count($required_fields); foreach ($required_fields as $elem_orig => $elem_trans) { $element .= "\t\t\"" . $elem_orig . '": "' . addslashes(str_replace(' ', ' ', $elem_trans)); if (--$tpl_temp) { $element .= "\",\n"; } else { $element .= "\"\n\t};\n"; } } } else { $element = ''; } ob_start(); ($hook = get_extensions('header_before_output')) ? eval($hook) : null; $style_path = ($panther_config['o_style_path'] != 'style' ? $panther_config['o_style_path'] : PANTHER_ROOT . $panther_config['o_style_path']) . '/' . $panther_user['style'] . '/templates/'; $tpl = defined('PANTHER_ADMIN_CONSOLE') && (file_exists($style_path . 'admin_header.tpl') || $panther_user['style'] == $panther_config['o_default_style'] && !file_exists($style_path)) ? 'admin_header.tpl' : 'header.tpl'; $tpl = load_template($tpl); echo $tpl->render(array('panther_config' => $panther_config, 'panther_user' => $panther_user, 'username' => colourize_group($panther_user['username'], $panther_user['group_id'], $panther_user['id']), 'last_visit' => format_time($panther_user['last_visit']), 'lang_common' => $lang_common, 'page_title' => generate_page_title($page_title, $p), 'stylesheet' => ($panther_config['o_style_dir'] != '' ? $panther_config['o_style_dir'] : get_base_url() . '/style/') . $panther_user['style'], 'favicon' => $panther_config['o_image_dir'] . $panther_config['o_favicon'], 'page' => basename($_SERVER['PHP_SELF'], '.php'), 'index_url' => panther_link($panther_url['index']), 'links' => $links, 'inbox_link' => panther_link($panther_url['inbox']), 'maintenance_link' => panther_link($panther_url['admin_options_direct'], array('maintenance')), 'status_info' => $status_info, 'reports' => $reports, 'admin_style' => $style_root, 'smiley_path' => $panther_config['o_smilies_dir'] != '' ? $panther_config['o_smilies_dir'] : get_base_url() . '/' . $panther_config['o_smilies_path'] . '/', 'jquery' => defined('JQUERY_REQUIRED') || defined('POSTING') && $panther_config['o_use_editor'] == '1' && $panther_user['use_editor'] == '1' || defined('REPUTATION') ? '1' : '0', 'reputation' => defined('REPUTATION') ? '1' : '0', 'posting' => defined('POSTING') && $panther_config['o_use_editor'] == '1' && $panther_user['use_editor'] == '1' ? '1' : '0', 'admin_index' => defined('ADMIN_INDEX') ? '1' : '0', 'required_fields' => $element, 'focus_element' => isset($focus_element) ? $focus_element : array(), 'page_head' => !empty($page_head) ? $page_head : array(), 'allow_index' => defined('PANTHER_ALLOW_INDEX') ? '1' : '0', 'common' => defined('COMMON_JAVASCRIPT') ? true : false)); ($hook = get_extensions('header_after_output')) ? eval($hook) : null; define('PANTHER_HEADER', 1);
function error($error, $sql = '', $parameters = array()) { global $panther_config, $lang_common, $panther_user, $panther_url; if (defined('PANTHER_AJAX_REQUEST')) { exit('A database error was encountered.'); } // Empty all output buffers and stop buffering (only if we've started) if (ob_get_level() > 0 && ob_get_length()) { @ob_clean(); } // Set some default settings if the script failed before $panther_config could be populated if (!empty($panther_config)) { // Make an educated guess regarding base_url $base_url = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; // protocol $base_url .= preg_replace('%:(80|443)$%', '', $_SERVER['HTTP_HOST']); // host[:port] $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path if (substr($base_url, -1) == '/') { $base_url = substr($base_url, 0, -1); } $panther_config = array('o_board_title' => 'Panther', 'o_gzip' => '0', 'o_debug_mode' => '1', 'o_webmaster_email' => $_SERVER['SERVER_ADMIN'], 'o_default_style' => 'Oxygen', 'o_base_url' => $base_url, 'o_style_dir' => 'style/', 'o_style_path' => '/style/'); } // "Restart" output buffering if we are using ob_gzhandler (since the gzip header is already sent) if ($panther_config['o_gzip'] && extension_loaded('zlib') && !ob_get_length()) { ob_start('ob_gzhandler'); } if (empty($panther_user)) { $panther_user = array('style' => $panther_config['o_default_style'], 'is_admin' => false, 'is_admmod' => false, 'is_guest' => true); } // Set some default translations if the script failed before $lang_common could be populated if (empty($lang_common)) { $lang_common = array('Title separator' => ' | ', 'Page' => 'Page %s'); } $style_path = $panther_config['o_style_dir'] != '' ? $panther_config['o_style_dir'] : PANTHER_ROOT . $panther_config['o_style_dir'] . 'style/'; // Send no-cache headers header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :) header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); // For HTTP/1.0 compatibility // Send the Content-type header in case the web server is setup to send something else header('Content-type: text/html; charset=utf-8'); if (file_exists($style_path . $panther_user['style'] . '/error.css')) { $error_style = ($panther_config['o_style_dir'] != '' ? $panther_config['o_style_dir'] : get_base_url() . '/style/') . $panther_user['style']; } else { $error_style = ($panther_config['o_style_dir'] != '' ? $panther_config['o_style_dir'] : get_base_url() . '/style/') . 'imports/'; } // Send headers telling people we're down header('HTTP/1.1 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable'); // Annoyingly, print_r(), var_dump(), and our custom function dump() all print HTML out directtly. Time to use ob_get_contents ... ob_start(); dump($parameters); $debug = trim(ob_get_contents()); ob_end_clean(); $tpl = load_template('db_error.tpl'); echo $tpl->render(array('panther_config' => $panther_config, 'error_style' => $error_style, 'page_title' => generate_page_title(array($panther_config['o_board_title'], 'Database Error')), 'error' => $error, 'sql' => $sql, 'debug' => $debug, 'index' => panther_link($panther_url['index']))); exit; }