trigger_error($user->lang['NO_WORD']); } $sql = 'SELECT word FROM ' . WORDS_TABLE . "\r\n\t\t\t\tWHERE word_id = {$word_id}"; $result = $db->sql_query($sql); $deleted_word = $db->sql_fetchfield('word', 0, $result); $db->sql_freeresult($result); $sql = 'DELETE FROM ' . WORDS_TABLE . "\r\n\t\t\t\tWHERE word_id = {$word_id}"; $db->sql_query($sql); $cache->destroy('word_censors'); add_log('admin', 'LOG_DELETE_WORD', $deleted_word); $message = $user->lang['WORD_REMOVE']; trigger_error($message); break; default: adm_page_header($user->lang['WORDS_TITLE']); ?> <h1><?php echo $user->lang['WORDS_TITLE']; ?> </h1> <p><?php echo $user->lang['WORDS_EXPLAIN']; ?> </p> <form method="post" action="admin_words.<?php echo $phpEx . $SID; ?>
/** * Display progress bar for syncinc categories * * @return null */ public function action_progress_bar() { $start = $this->request->variable('start', 0); $total = $this->request->variable('total', 0); adm_page_header($this->user->lang['SYNC_IN_PROGRESS']); $this->template->set_filenames(array('body' => 'progress_bar.html')); $this->template->assign_vars(array('L_PROGRESS' => $this->user->lang['SYNC_IN_PROGRESS'], 'L_PROGRESS_EXPLAIN' => $start && $total ? $this->user->lang('SYNC_IN_PROGRESS_EXPLAIN', $start, $total) : $this->user->lang['SYNC_IN_PROGRESS'])); adm_page_footer(); }
echo $_CLASS['core_user']->lang['NO_PRUNE']; ?> </td> </tr> <?php } $_CLASS['core_db']->sql_freeresult($result); ?> </table> <br clear="all" /> <?php adm_page_footer(); } adm_page_header($_CLASS['core_user']->lang['PRUNE']); ?> <h1><?php echo $_CLASS['core_user']->lang['PRUNE']; ?> </h1> <p><?php echo $_CLASS['core_user']->lang['FORUM_PRUNE_EXPLAIN']; ?> </p> <?php // If they haven't selected a forum for pruning yet then // display a select box to use for pruning.
?> <h1><?php echo $_CLASS['core_user']->lang['SEARCH_INDEX']; ?> </h1> <p><?php echo $_CLASS['core_user']->lang['SEARCH_INDEX_CANCEL']; ?> </p> <?php adm_page_footer(); } else { adm_page_header($_CLASS['core_user']->lang['SEARCH_INDEX']); ?> <h1><?php echo $_CLASS['core_user']->lang['SEARCH_INDEX']; ?> </h1> <p><?php echo $_CLASS['core_user']->lang['SEARCH_INDEX_EXPLAIN']; ?> </p> <form method="post" action="<?php echo adminlink('forums&file=admin_search'); ?>
/** * Display progress bar for syncinc forums */ function display_progress_bar($start, $total) { global $template, $user; adm_page_header($user->lang['SYNC_IN_PROGRESS']); $template->set_filenames(array('body' => 'progress_bar.html')); $template->assign_vars(array('L_PROGRESS' => $user->lang['SYNC_IN_PROGRESS'], 'L_PROGRESS_EXPLAIN' => $start && $total ? sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $start, $total) : $user->lang['SYNC_IN_PROGRESS'])); adm_page_footer(); }
/** * Error and message handler, call with trigger_error if read */ function msg_handler($errno, $msg_text, $errfile, $errline) { global $cache, $db, $auth, $template, $config, $user, $request; global $phpEx, $phpbb_root_path, $msg_title, $msg_long_text; // Do not display notices if we suppress them via @ if (error_reporting() == 0 && $errno != E_USER_ERROR && $errno != E_USER_WARNING && $errno != E_USER_NOTICE) { return; } // Message handler is stripping text. In case we need it, we are possible to define long text... if (isset($msg_long_text) && $msg_long_text && !$msg_text) { $msg_text = $msg_long_text; } if (!defined('E_DEPRECATED')) { define('E_DEPRECATED', 8192); } switch ($errno) { case E_NOTICE: case E_WARNING: // Check the error reporting level and return if the error level does not match // If DEBUG is defined the default level is E_ALL if (($errno & (defined('DEBUG') ? E_ALL : error_reporting())) == 0) { return; } if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) { $errfile = phpbb_filter_root_path($errfile); $msg_text = phpbb_filter_root_path($msg_text); $error_name = $errno === E_WARNING ? 'PHP Warning' : 'PHP Notice'; echo '<b>[phpBB Debug] ' . $error_name . '</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $msg_text . '</b><br />' . "\n"; // we are writing an image - the user won't see the debug, so let's place it in the log if (defined('IMAGE_OUTPUT') || defined('IN_CRON')) { add_log('critical', 'LOG_IMAGE_GENERATION_ERROR', $errfile, $errline, $msg_text); } // echo '<br /><br />BACKTRACE<br />' . get_backtrace() . '<br />' . "\n"; } return; break; case E_USER_ERROR: if (!empty($user) && !empty($user->lang)) { $msg_text = !empty($user->lang[$msg_text]) ? $user->lang[$msg_text] : $msg_text; $msg_title = !isset($msg_title) ? $user->lang['GENERAL_ERROR'] : (!empty($user->lang[$msg_title]) ? $user->lang[$msg_title] : $msg_title); $l_return_index = sprintf($user->lang['RETURN_INDEX'], '<a href="' . $phpbb_root_path . '">', '</a>'); $l_notify = ''; if (!empty($config['board_contact'])) { $l_notify = '<p>' . sprintf($user->lang['NOTIFY_ADMIN_EMAIL'], $config['board_contact']) . '</p>'; } } else { $msg_title = 'General Error'; $l_return_index = '<a href="' . $phpbb_root_path . '">Return to index page</a>'; $l_notify = ''; if (!empty($config['board_contact'])) { $l_notify = '<p>Please notify the board administrator or webmaster: <a href="mailto:' . $config['board_contact'] . '">' . $config['board_contact'] . '</a></p>'; } } $log_text = $msg_text; $backtrace = get_backtrace(); if ($backtrace) { $log_text .= '<br /><br />BACKTRACE<br />' . $backtrace; } if (defined('IN_INSTALL') || defined('DEBUG') || isset($auth) && $auth->acl_get('a_')) { $msg_text = $log_text; // If this is defined there already was some output // So let's not break it if (defined('IN_DB_UPDATE')) { echo '<div class="errorbox">' . $msg_text . '</div>'; $db->sql_return_on_error(true); phpbb_end_update($cache, $config); } } if ((defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db)) { // let's avoid loops $db->sql_return_on_error(true); add_log('critical', 'LOG_GENERAL_ERROR', $msg_title, $log_text); $db->sql_return_on_error(false); } // Do not send 200 OK, but service unavailable on errors send_status_line(503, 'Service Unavailable'); garbage_collection(); // Try to not call the adm page data... echo '<!DOCTYPE html>'; echo '<html dir="ltr">'; echo '<head>'; echo '<meta charset="utf-8">'; echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">'; echo '<title>' . $msg_title . '</title>'; echo '<style type="text/css">' . "\n" . '/* <![CDATA[ */' . "\n"; echo '* { margin: 0; padding: 0; } html { font-size: 100%; height: 100%; margin-bottom: 1px; background-color: #E4EDF0; } body { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; color: #536482; background: #E4EDF0; font-size: 62.5%; margin: 0; } '; echo 'a:link, a:active, a:visited { color: #006699; text-decoration: none; } a:hover { color: #DD6900; text-decoration: underline; } '; echo '#wrap { padding: 0 20px 15px 20px; min-width: 615px; } #page-header { text-align: right; height: 40px; } #page-footer { clear: both; font-size: 1em; text-align: center; } '; echo '.panel { margin: 4px 0; background-color: #FFFFFF; border: solid 1px #A9B8C2; } '; echo '#errorpage #page-header a { font-weight: bold; line-height: 6em; } #errorpage #content { padding: 10px; } #errorpage #content h1 { line-height: 1.2em; margin-bottom: 0; color: #DF075C; } '; echo '#errorpage #content div { margin-top: 20px; margin-bottom: 5px; border-bottom: 1px solid #CCCCCC; padding-bottom: 5px; color: #333333; font: bold 1.2em "Lucida Grande", Arial, Helvetica, sans-serif; text-decoration: none; line-height: 120%; text-align: left; } '; echo "\n" . '/* ]]> */' . "\n"; echo '</style>'; echo '</head>'; echo '<body id="errorpage">'; echo '<div id="wrap">'; echo ' <div id="page-header">'; echo ' ' . $l_return_index; echo ' </div>'; echo ' <div id="acp">'; echo ' <div class="panel">'; echo ' <div id="content">'; echo ' <h1>' . $msg_title . '</h1>'; echo ' <div>' . $msg_text . '</div>'; echo $l_notify; echo ' </div>'; echo ' </div>'; echo ' </div>'; echo ' <div id="page-footer">'; echo ' Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited'; echo ' </div>'; echo '</div>'; echo '</body>'; echo '</html>'; exit_handler(); // On a fatal error (and E_USER_ERROR *is* fatal) we never want other scripts to continue and force an exit here. exit; break; case E_USER_WARNING: case E_USER_NOTICE: define('IN_ERROR_HANDLER', true); if (empty($user->data)) { $user->session_begin(); } // We re-init the auth array to get correct results on login/logout $auth->acl($user->data); if (empty($user->lang)) { $user->setup(); } if ($msg_text == 'ERROR_NO_ATTACHMENT' || $msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') { send_status_line(404, 'Not Found'); } $msg_text = !empty($user->lang[$msg_text]) ? $user->lang[$msg_text] : $msg_text; $msg_title = !isset($msg_title) ? $user->lang['INFORMATION'] : (!empty($user->lang[$msg_title]) ? $user->lang[$msg_title] : $msg_title); if (!defined('HEADER_INC')) { if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_header($msg_title); } else { page_header($msg_title); } } $template->set_filenames(array('body' => 'message_body.html')); $template->assign_vars(array('MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text, 'S_USER_WARNING' => $errno == E_USER_WARNING ? true : false, 'S_USER_NOTICE' => $errno == E_USER_NOTICE ? true : false)); if ($request->is_ajax()) { global $refresh_data; $json_response = new \phpbb\json_response(); $json_response->send(array('MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text, 'S_USER_WARNING' => $errno == E_USER_WARNING ? true : false, 'S_USER_NOTICE' => $errno == E_USER_NOTICE ? true : false, 'REFRESH_DATA' => !empty($refresh_data) ? $refresh_data : null)); } // We do not want the cron script to be called on error messages define('IN_CRON', true); if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_footer(); } else { page_footer(); } exit_handler(); break; // PHP4 compatibility // PHP4 compatibility case E_DEPRECATED: return true; break; } // If we notice an error not handled here we pass this back to PHP by returning false // This may not work for all php versions return false; }
default: // By default, check that image_order is valid and fix it if necessary $sql = "SELECT {$fields}_id AS order_id, {$fields}_order AS fields_order\r\n\t\t\tFROM {$table}\r\n\t\t\tORDER BY {$fields}_order"; $result = $_CLASS['core_db']->query($sql); if ($row = $_CLASS['core_db']->fetch_row_assoc($result)) { $order = 0; do { ++$order; if ($row['fields_order'] != $order) { $_CLASS['core_db']->query("UPDATE {$table}\r\n\t\t\t\t\t\tSET {$fields}_order = {$order}\r\n\t\t\t\t\t\tWHERE {$fields}_id = " . $row['order_id']); } } while ($row = $_CLASS['core_db']->fetch_row_assoc($result)); } $_CLASS['core_db']->free_result($result); // Output the page adm_page_header($_CLASS['core_user']->lang[$lang]); ?> <h1><?php echo $_CLASS['core_user']->lang[$lang]; ?> </h1> <p><?php echo $_CLASS['core_user']->lang[$lang . '_EXPLAIN']; ?> </p> <?php if ($notice != '') { ?>
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); // the acp template is never stored in the database $user->theme['template_storedb'] = false; // Instantiate new module $module = new p_master(); // Instantiate module system and generate list of available modules $module->list_modules('acp'); // Select the active module $module->set_active($module_id, $mode); // Assign data to the template engine for the list of modules // We do this before loading the active module for correct menu display in trigger_error $module->assign_tpl_vars(append_sid("{$phpbb_admin_path}index.{$phpEx}")); // Load and execute the relevant module $module->load_active(); // Generate the page adm_page_header($module->get_page_title()); $template->set_filenames(array('body' => $module->get_tpl_name())); adm_page_footer(); /** * Header for acp pages */ function adm_page_header($page_title) { global $config, $db, $user, $template; global $phpbb_root_path, $phpbb_admin_path, $phpEx, $SID, $_SID; if (defined('HEADER_INC')) { return; } define('HEADER_INC', true); // gzip_compression if ($config['gzip_compress']) {
$selected = $key == 'eq' ? ' selected="selected"' : ''; $s_find_count .= '<option value="' . $key . '"' . $selected . '>' . $value . '</option>'; } $find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']); $s_find_join_time = ''; foreach ($find_time as $key => $value) { $s_find_join_time .= '<option value="' . $key . '">' . $value . '</option>'; } $s_find_active_time = ''; foreach ($find_time as $key => $value) { $s_find_active_time .= '<option value="' . $key . '">' . $value . '</option>'; } // // // adm_page_header($user->lang['PRUNE_USERS']); ?> <h1><?php echo $user->lang['PRUNE_USERS']; ?> </h1> <p><?php echo $user->lang['PRUNE_USERS_EXPLAIN']; ?> </p> <form method="post" name="post" action="<?php echo "admin_prune_users.{$phpEx}{$SID}"; ?>
$sql = 'SELECT group_id, group_type, group_name FROM ' . GROUPS_TABLE . ' ORDER BY group_type DESC, group_name ASC'; $result = $_CLASS['core_db']->sql_query($sql); $select_list = '<option value="0"' . (!$group_id ? ' selected="selected"' : '') . '>' . $_CLASS['core_user']->lang['ALL_USERS'] . '</option>'; if ($row = $_CLASS['core_db']->sql_fetchrow($result)) { do { $selected = $group_id == $row['group_id'] ? ' selected="selected"' : ''; $select_list .= '<option value = "' . $row['group_id'] . '"' . ($row['group_type'] == GROUP_SPECIAL ? ' class="blue"' : '') . $selected . '>' . ($row['group_type'] == GROUP_SPECIAL ? $_CLASS['core_user']->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; } while ($row = $_CLASS['core_db']->sql_fetchrow($result)); } $_CLASS['core_db']->sql_freeresult($result); $s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $_CLASS['core_user']->lang['MAIL_LOW_PRIORITY'] . '</option>'; $s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $_CLASS['core_user']->lang['MAIL_NORMAL_PRIORITY'] . '</option>'; $s_priority_options .= '<option value="' . MAIL_HIGH_PRIORITY . '">' . $_CLASS['core_user']->lang['MAIL_HIGH_PRIORITY'] . '</option>'; adm_page_header($_CLASS['core_user']->lang['MASS_EMAIL']); ?> <h1><?php echo $_CLASS['core_user']->lang['MASS_EMAIL']; ?> </h1> <p><?php echo $_CLASS['core_user']->lang['MASS_EMAIL_EXPLAIN']; ?> </p> <form method="post" action="<?php echo generate_link('Forums&file=admin_email', array('admin' => true)); ?>
continue; } $config_value = $cfg_array[$config_name]; $new[$config_name] = $config_value; if ($config_name == 'email_function_name') { $new['email_function_name'] = empty($new['email_function_name']) || !function_exists($new['email_function_name']) ? 'mail' : str_replace(array('(', ')'), array('', ''), trim($new['email_function_name'])); } if ($submit) { set_config($config_name, $config_value); } } if ($submit) { add_log('admin', 'LOG_' . strtoupper($mode) . '_CONFIG'); trigger_error($_CLASS['core_user']->lang['CONFIG_UPDATED']); } adm_page_header($_CLASS['core_user']->lang[$display_vars['title']]); ?> <h1><?php echo $_CLASS['core_user']->lang[$display_vars['title']]; ?> </h1> <p><?php echo $_CLASS['core_user']->lang[$display_vars['title'] . '_EXPLAIN']; ?> </p> <form action="<?php echo generate_link('forums&file=admin_board&mode=' . $mode, array('admin' => true)); ?>
} if ($posts_per_day > $total_posts) { $posts_per_day = $total_posts; } if ($topics_per_day > $total_topics) { $topics_per_day = $total_topics; } if ($users_per_day > $total_users) { $users_per_day = $total_users; } if ($files_per_day > $total_files) { $files_per_day = $total_files; } // Remove $dbsize = $_CLASS['core_user']->lang['NOT_AVAILABLE']; adm_page_header($_CLASS['core_user']->lang['ADMIN_INDEX']); ?> <script language="Javascript" type="text/javascript"> <!-- function marklist(status) { for (i = 0; i < document.inactive.length; i++) { document.inactive.elements[i].checked = status; } } //--> </script> <h1><?php
$pieces = split_sql_file($sql_query, ';'); $sql_count = count($pieces); for ($i = 0; $i < $sql_count; $i++) { $sql = trim($pieces[$i]); if (!empty($sql) && $sql[0] != '#') { $db->sql_query($sql); } } } add_log('admin', 'log_db_restore'); trigger_error($user->lang['Restore_success']); } // // Restore page // adm_page_header($user->lang['DB_RESTORE']); ?> <h1><?php echo $user->lang['DB_RESTORE']; ?> </h1> <p><?php echo $user->lang['Restore_explain']; ?> </p> <form enctype="multipart/form-data" method="post" action="<?php echo "admin_database.{$phpEx}{$SID}&mode={$mode}"; ?>
/** * Outputs the page as Ajax response. * * @param string $status Page status. * @param string $action Page action. */ protected function output_response($status, $action) { adm_page_header(''); $output = ob_get_contents(); @ob_end_clean(); $json_response = new \phpbb\json_response(); $json_response->send(array('status' => $status, 'action' => $action, 'result' => objects::$template->assign_display($this->tpl_name . '.html', '', true), 'output' => $output)); }
case 'delete': // Ok, they want to delete their rank $rank_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; if ($rank_id) { $sql = "DELETE FROM " . FORUMS_RANKS_TABLE . "\r\n\t\t\t\tWHERE rank_id = {$rank_id}"; $_CLASS['core_db']->query($sql); $sql = "UPDATE " . USERS_TABLE . "\r\n\t\t\t\tSET user_rank = 0\r\n\t\t\t\tWHERE user_rank = {$rank_id}"; $_CLASS['core_db']->query($sql); $_CLASS['core_cache']->destroy('ranks'); trigger_error($_CLASS['core_user']->lang['RANK_REMOVED']); } else { trigger_error($_CLASS['core_user']->lang['MUST_SELECT_RANK']); } break; default: adm_page_header($_CLASS['core_user']->lang['RANKS']); ?> <h1><?php echo $_CLASS['core_user']->lang['RANKS']; ?> </h1> <p><?php echo $_CLASS['core_user']->lang['RANKS_EXPLAIN']; ?> </p> <form method="post" action="<?php echo generate_link('forums&file=admin_ranks', array('admin' => true)); ?>
$_CLASS['core_db']->sql_query($sql); add_log('admin', 'LOG_' . strtoupper($mode) . '_CLEAR'); } // Sorting $limit_days = array(0 => $_CLASS['core_user']->lang['ALL_ENTRIES'], 1 => $_CLASS['core_user']->lang['1_DAY'], 7 => $_CLASS['core_user']->lang['7_DAYS'], 14 => $_CLASS['core_user']->lang['2_WEEKS'], 30 => $_CLASS['core_user']->lang['1_MONTH'], 90 => $_CLASS['core_user']->lang['3_MONTHS'], 180 => $_CLASS['core_user']->lang['6_MONTHS'], 364 => $_CLASS['core_user']->lang['1_YEAR']); $sort_by_text = array('u' => $_CLASS['core_user']->lang['SORT_USERNAME'], 't' => $_CLASS['core_user']->lang['SORT_DATE'], 'i' => $_CLASS['core_user']->lang['SORT_IP'], 'o' => $_CLASS['core_user']->lang['SORT_ACTION']); $sort_by_sql = array('u' => 'l.user_id', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); // Define where and sort sql for use in displaying logs $sql_where = $sort_days ? time() - $sort_days * 86400 : 0; $sql_sort = $sort_by_sql[$sort_key] . ' ' . ($sort_dir == 'd' ? 'DESC' : 'ASC'); $l_title = $_CLASS['core_user']->lang[strtoupper($mode) . '_LOGS']; $l_title_explain = $_CLASS['core_user']->lang[strtoupper($mode) . '_LOGS_EXPLAIN']; // Output page adm_page_header($l_title); ?> <h1><?php echo $l_title; ?> </h1> <p><?php echo $l_title_explain; ?> </p> <form name="list" method="post" action="<?php echo generate_link('Forums&file=admin_viewlogs&mode=' . $mode, array('admin' => true)); ?>
$navigation = $_CLASS['core_user']->lang['FORUM_INDEX']; } else { $navigation = '<a href="' . generate_link('Forums&file=admin_forums', array('admin' => true)) . '">' . $_CLASS['core_user']->lang['FORUM_INDEX'] . '</a>'; $forums_nav = get_forum_branch($parent_id, 'parents', 'descending'); foreach ($forums_nav as $row) { if ($row['forum_id'] == $parent_id) { $navigation .= ' -> ' . $row['forum_name']; } else { $navigation .= ' -> <a href="' . generate_link('Forums&file=admin_forums&parent_id=' . $row['forum_id'], array('admin' => true)) . '">' . $row['forum_name'] . '</a>'; } } } // Jumpbox $forum_box = make_forum_select($parent_id); // Front end adm_page_header($_CLASS['core_user']->lang['MANAGE']); ?> <h1><?php echo $_CLASS['core_user']->lang['MANAGE']; ?> </h1> <p><?php echo $_CLASS['core_user']->lang['FORUM_ADMIN_EXPLAIN']; ?> </p><?php if ($mode == 'sync') { echo '<br /><div class="gen" align="center"><b>' . $_CLASS['core_user']->lang['FORUM_RESYNCED'] . '</b></div>'; } ?>
/** * Display module */ function display($page_title, $display_online_list = false) { global $template, $user; // Generate the page if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_header($page_title); } else { page_header($page_title, $display_online_list); } $template->set_filenames(array('body' => $this->get_tpl_name())); if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_footer(); } else { page_footer(); } }
// Include files $phpbb_root_path = './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); require 'pagestart.' . $phpEx; include $phpbb_root_path . 'includes/functions_posting.' . $phpEx; include $phpbb_root_path . 'includes/functions_user.' . $phpEx; include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx; if (!$auth->acl_get('a_user')) { trigger_error($user->lang['NO_ADMIN']); } $user->add_lang('ucp'); $mode = isset($_POST['add']) ? 'create' : request_var('mode', ''); $submit = isset($_POST['submit']) ? TRUE : FALSE; $create = isset($_POST['create']) ? TRUE : FALSE; $error = $notify = array(); adm_page_header($user->lang['CUSTOM_PROFILE_FIELDS']); // Define some default values for each field type $default_values = array(FIELD_STRING => array('field_length' => 10, 'field_minlen' => 0, 'field_maxlen' => 20, 'field_validation' => '.*', 'field_novalue' => '', 'field_default_value' => ''), FIELD_TEXT => array('field_length' => '5|80', 'field_minlen' => 0, 'field_maxlen' => 1000, 'field_validation' => '.*', 'field_novalue' => '', 'field_default_value' => ''), FIELD_INT => array('field_length' => 5, 'field_minlen' => 0, 'field_maxlen' => 100, 'field_validation' => '', 'field_novalue' => 0, 'field_default_value' => 0), FIELD_DATE => array('field_length' => 10, 'field_minlen' => 10, 'field_maxlen' => 10, 'field_validation' => '', 'field_novalue' => ' 0- 0- 0', 'field_default_value' => ' 0- 0- 0'), FIELD_BOOL => array('field_length' => 1, 'field_minlen' => 0, 'field_maxlen' => 0, 'field_validation' => '', 'field_novalue' => 0, 'field_default_value' => 0), FIELD_DROPDOWN => array('field_length' => 0, 'field_minlen' => 0, 'field_maxlen' => 5, 'field_validation' => '', 'field_novalue' => 1, 'field_default_value' => 1)); $cp = new custom_profile_admin(); // Build Language array // Based on this, we decide which elements need to be edited later and which language items are missing $lang_defs = array(); $sql = 'SELECT lang_id, lang_iso FROM ' . LANG_TABLE; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $lang_defs['id'][] = $row['lang_id']; $lang_defs['iso'][$row['lang_iso']] = $row['lang_id']; } $db->sql_freeresult($result); $sql = 'SELECT field_id, lang_id
function display_progress_bar($type) { global $template, $user; $l_type = $type == 'create' ? 'INDEXING_IN_PROGRESS' : 'DELETING_INDEX_IN_PROGRESS'; adm_page_header($user->lang[$l_type]); $template->set_filenames(array('body' => 'progress_bar.html')); $template->assign_vars(array('L_PROGRESS' => $user->lang[$l_type], 'L_PROGRESS_EXPLAIN' => $user->lang[$l_type . '_EXPLAIN'])); adm_page_footer(); }
trigger_error($lang); break; case 'delete': $sql = 'SELECT bbcode_tag FROM ' . BBCODES_TABLE . "\r\n\t\t\tWHERE bbcode_id = {$bbcode_id}"; $result = $_CLASS['core_db']->sql_query($sql); $row = $_CLASS['core_db']->sql_fetchrow($result); $_CLASS['core_db']->sql_freeresult($result); if ($row) { $_CLASS['core_db']->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = {$bbcode_id}"); add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']); } // No break here // No break here default: adm_page_header($_CLASS['core_user']->lang['BBCODES']); ?> <h1><?php echo $_CLASS['core_user']->lang['BBCODES']; ?> </h1> <p><?php echo $_CLASS['core_user']->lang['BBCODES_EXPLAIN']; ?> </p> <form method="post" action="<?php echo generate_link('forums&file=admin_bbcodes&mode=add', array('admin' => true));
add_log('admin', 'log_disallow_delete'); trigger_error($_CLASS['core_user']->lang['Disallowed_deleted']); } } // Grab the current list of disallowed usernames... $sql = 'SELECT * FROM ' . DISALLOW_TABLE; $result = $_CLASS['core_db']->sql_query($sql); $disallow_select = ''; if ($row = $_CLASS['core_db']->sql_fetchrow($result)) { do { $disallow_select .= '<option value="' . $row['disallow_id'] . '">' . str_replace('%', '*', $row['disallow_username']) . '</option>'; } while ($row = $_CLASS['core_db']->sql_fetchrow($result)); } // Output page adm_page_header($_CLASS['core_user']->lang['DISALLOW']); ?> <h1><?php echo $_CLASS['core_user']->lang['DISALLOW']; ?> </h1> <p><?php echo $_CLASS['core_user']->lang['Disallow_explain']; ?> </p> <form method="post" action="<?php echo generate_link('Forums&file=admin_disallow', array('admin' => true)); ?>
/** * Error and message handler, call with trigger_error if reqd */ function msg_handler($errno, $msg_text, $errfile, $errline) { global $cache, $db, $auth, $template, $config, $user; global $phpEx, $phpbb_root_path, $starttime, $msg_title, $msg_long_text; // Message handler is stripping text. In case we need it, we are possible to define long text... if (isset($msg_long_text) && $msg_long_text && !$msg_text) { $msg_text = $msg_long_text; } switch ($errno) { case E_NOTICE: case E_WARNING: // Check the error reporting level and return if the error level does not match // Additionally do not display notices if we suppress them via @ // If DEBUG_EXTRA is defined the default level is E_ALL if (($errno & (defined('DEBUG_EXTRA') && error_reporting() ? E_ALL : error_reporting())) == 0) { return; } /** * @todo Think about removing the if-condition within the final product, since we no longer enable DEBUG by default and we will maybe adjust the error reporting level */ if (defined('DEBUG')) { if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) { // remove complete path to installation, with the risk of changing backslashes meant to be there $errfile = str_replace(array(realpath($phpbb_root_path), '\\'), array('', '/'), $errfile); $msg_text = str_replace(array(realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text); echo '<b>[phpBB Debug] PHP Notice</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $msg_text . '</b><br />' . "\n"; } } break; case E_USER_ERROR: if (isset($db)) { $db->sql_close(); } if (isset($cache)) { $cache->unload(); } echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">'; echo '<head>'; echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'; echo '<title>' . $msg_title . '</title>'; echo '<link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />'; echo '</head>'; echo '<body id="errorpage">'; echo '<div id="wrap">'; echo ' <div id="page-header">'; echo ' <a href="' . $phpbb_root_path . '">Return to forum index</a>'; echo ' </div>'; echo ' <div id="page-body">'; echo ' <div class="panel">'; echo ' <span class="corners-top"><span></span></span>'; echo ' <div id="content">'; echo ' <h1>General Error</h1>'; echo ' <h2>' . $msg_text . '</h2>'; if (!empty($config['board_contact'])) { echo ' <p>Please notify the board administrator or webmaster : <a href="mailto:' . $config['board_contact'] . '">' . $config['board_contact'] . '</a></p>'; } echo ' </div>'; echo ' <span class="corners-bottom"><span></span></span>'; echo ' </div>'; echo ' </div>'; echo ' <div id="page-footer">'; echo ' Powered by phpBB © ' . date('Y') . ' <a href="http://www.phpbb.com/">phpBB Group</a>'; echo ' </div>'; echo '</div>'; echo '</body>'; echo '</html>'; exit; break; case E_USER_WARNING: case E_USER_NOTICE: define('IN_ERROR_HANDLER', true); if (empty($user->data)) { $user->session_begin(); } // We re-init the auth array to get correct results on login/logout $auth->acl($user->data); if (empty($user->lang)) { $user->setup(); } $msg_text = !empty($user->lang[$msg_text]) ? $user->lang[$msg_text] : $msg_text; $msg_title = !isset($msg_title) ? $user->lang['INFORMATION'] : (!empty($user->lang[$msg_title]) ? $user->lang[$msg_title] : $msg_title); if (!defined('HEADER_INC')) { if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_header($msg_title); } else { page_header($msg_title); } } $template->set_filenames(array('body' => 'message_body.html')); $template->assign_vars(array('MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text)); // We do not want the cron script to be called on error messages define('IN_CRON', true); if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_footer(); } else { page_footer(); } exit; break; } }
/** * Allows the admin to view cached versions of template files and clear single template cache files * * @param int $template_id specifies which template's cache is shown */ function template_cache($template_id) { global $phpbb_root_path, $phpEx, $config, $db, $cache, $user, $template; $source = str_replace('/', '.', request_var('source', '')); $file_ary = array_diff(request_var('delete', array('')), array('')); $submit = isset($_POST['submit']) ? true : false; $sql = 'SELECT * FROM ' . STYLES_TEMPLATE_TABLE . "\n\t\t\tWHERE template_id = {$template_id}"; $result = $db->sql_query($sql); $template_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$template_row) { trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); } // User wants to delete one or more files ... if ($submit && $file_ary) { $this->clear_template_cache($template_row, $file_ary); trigger_error($user->lang['TEMPLATE_CACHE_CLEARED'] . adm_back_link($this->u_action . "&action=cache&id={$template_id}")); } $cache_prefix = 'tpl_' . str_replace('_', '-', $template_row['template_path']); // Someone wants to see the cached source ... so we'll highlight it, // add line numbers and indent it appropriately. This could be nasty // on larger source files ... if ($source && file_exists("{$phpbb_root_path}cache/{$cache_prefix}_{$source}.html.{$phpEx}")) { adm_page_header($user->lang['TEMPLATE_CACHE']); $template->set_filenames(array('body' => 'viewsource.html')); $template->assign_vars(array('FILENAME' => str_replace('.', '/', $source) . '.html')); $code = str_replace(array("\r\n", "\r"), array("\n", "\n"), file_get_contents("{$phpbb_root_path}cache/{$cache_prefix}_{$source}.html.{$phpEx}")); $conf = array('highlight.bg', 'highlight.comment', 'highlight.default', 'highlight.html', 'highlight.keyword', 'highlight.string'); foreach ($conf as $ini_var) { @ini_set($ini_var, str_replace('highlight.', 'syntax', $ini_var)); } $marker = 'MARKER' . time(); $code = highlight_string(str_replace("\n", $marker, $code), true); $code = str_replace($marker, "\n", $code); $str_from = array('<span style="color: ', '<font color="syntax', '</font>', '<code>', '</code>', '[', ']', '.', ':'); $str_to = array('<span class="', '<span class="syntax', '</span>', '', '', '[', ']', '.', ':'); $code = str_replace($str_from, $str_to, $code); $code = preg_replace('#^(<span class="[a-z_]+">)\\n?(.*?)\\n?(</span>)$#ism', '$1$2$3', $code); $code = substr($code, strlen('<span class="syntaxhtml">')); $code = substr($code, 0, -1 * strlen('</ span>')); $code = explode("\n", $code); foreach ($code as $key => $line) { $template->assign_block_vars('source', array('LINENUM' => $key + 1, 'LINE' => preg_replace('#([^ ;]) ([^ &])#', '$1 $2', $line))); unset($code[$key]); } adm_page_footer(); } $filemtime = array(); if ($template_row['template_storedb']) { $ids = array(); if (isset($template_row['template_inherits_id']) && $template_row['template_inherits_id']) { $ids[] = $template_row['template_inherits_id']; } $ids[] = $template_row['template_id']; $filemtime = array(); $file_template_db = array(); foreach ($ids as $id) { $sql = 'SELECT template_filename, template_mtime FROM ' . STYLES_TEMPLATE_DATA_TABLE . "\n\t\t\t\t\tWHERE template_id = {$id}"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $filemtime[$row['template_filename']] = $row['template_mtime']; $file_template_db[$row['template_filename']] = $id; } $db->sql_freeresult($result); } } // Get a list of cached template files and then retrieve additional information about them $file_ary = $this->template_cache_filelist($template_row['template_path']); foreach ($file_ary as $file) { $file = str_replace('/', '.', $file); // perform some dirty guessing to get the path right. // We assume that three dots in a row were '../' $tpl_file = str_replace('.', '/', $file); $tpl_file = str_replace('///', '../', $tpl_file); $filename = "{$cache_prefix}_{$file}.html.{$phpEx}"; if (!file_exists("{$phpbb_root_path}cache/{$filename}")) { continue; } $file_tpl = "{$phpbb_root_path}styles/{$template_row['template_path']}/template/{$tpl_file}.html"; $inherited = false; if (isset($template_row['template_inherits_id']) && $template_row['template_inherits_id']) { if (!$template_row['template_storedb']) { if (!file_exists($file_tpl)) { $file_tpl = "{$phpbb_root_path}styles/{$template_row['template_inherit_path']}/template/{$tpl_file}.html"; $inherited = true; } } else { if ($file_template_db[$file . '.html'] == $template_row['template_inherits_id']) { $file_tpl = "{$phpbb_root_path}styles/{$template_row['template_inherit_path']}/template/{$tpl_file}.html"; $inherited = true; } } } // Correct the filename if it is stored in database and the file is in a subfolder. if ($template_row['template_storedb']) { $file = str_replace('.', '/', $file); } $template->assign_block_vars('file', array('U_VIEWSOURCE' => $this->u_action . "&action=cache&id={$template_id}&source={$file}", 'CACHED' => $user->format_date(filemtime("{$phpbb_root_path}cache/{$filename}")), 'FILENAME' => $file, 'FILENAME_PATH' => $file_tpl, 'FILESIZE' => get_formatted_filesize(filesize("{$phpbb_root_path}cache/{$filename}")), 'MODIFIED' => $user->format_date(!$template_row['template_storedb'] ? filemtime($file_tpl) : $filemtime[$file . '.html']))); } unset($filemtime); $template->assign_vars(array('S_CACHE' => true, 'S_TEMPLATE' => true, 'U_ACTION' => $this->u_action . "&action=cache&id={$template_id}", 'U_BACK' => $this->u_action)); }
/** * Support Toolkit Error handler * * A wrapper for the phpBB `msg_handler` function, which is mainly used * to update variables before calling the actual msg_handler and is able * to handle various special cases. * * @global type $stk_no_error * @global string $phpbb_root_path * @param type $errno * @param string $msg_text * @param type $errfile * @param type $errline * @return boolean */ function stk_msg_handler($errno, $msg_text, $errfile, $errline) { // First and foremost handle the case where phpBB calls trigger error // but the STK really needs to continue. global $critical_repair, $stk_no_error, $user; if (!isset($user->lang['STK_FATAL_ERROR'])) { stk_add_lang('common'); } if ($stk_no_error === true) { return true; } // Do not display notices if we suppress them via @ if (error_reporting() == 0 && $errno != E_USER_ERROR && $errno != E_USER_WARNING && $errno != E_USER_NOTICE) { return; } if (!defined('E_DEPRECATED')) { define('E_DEPRECATED', 8192); } // Ignore Strict and Deprecated notices if (in_array($errno, array(E_STRICT, E_DEPRECATED))) { return true; } // We encounter an error while in the ERK, this need some special treatment $error_level = array(E_ERROR => 'Fatal error', E_WARNING => 'Runtime Error', E_PARSE => 'Parse error', E_NOTICE => 'Notice'); switch ($errno) { case E_ERROR: case E_PARSE: case E_WARNING: case E_NOTICE: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: case E_RECOVERABLE_ERROR: $backtrace = get_backtrace(); $msg_text = '<br /><b>[phpBB Debug] PHP ' . $error_level[$errno] . ':</b> in file ' . phpbb_filter_root_path($errfile) . ' on line <b>' . $errline . ': ' . $msg_text . '</b><br />' . $backtrace . ''; break; default: break; } if (defined('IN_ERK')) { $critical_repair->trigger_error($msg_text, $errno == E_USER_ERROR ? false : true); } else { if (!defined('IN_STK')) { // We're encountering an error before the STK is fully loaded // Set out own message if needed if ($errno == E_USER_ERROR) { $msg_text = $user->lang['STK_FATAL_ERROR']; } if (!isset($critical_repair)) { $critical_repair = new critical_repair(); } $critical_repair->trigger_error($msg_text, $errno == E_USER_ERROR ? false : true); } } //-- Normal phpBB msg_handler global $cache, $db, $auth, $template, $config, $user; global $phpEx, $phpbb_root_path, $msg_title, $msg_long_text; // Message handler is stripping text. In case we need it, we are possible to define long text... if (isset($msg_long_text) && $msg_long_text && !$msg_text) { $msg_text = $msg_long_text; } if (!defined('E_DEPRECATED')) { define('E_DEPRECATED', 8192); } switch ($errno) { case E_NOTICE: case E_WARNING: // Check the error reporting level and return if the error level does not match // If DEBUG is defined the default level is E_ALL if (($errno & (defined('DEBUG') ? E_ALL : error_reporting())) == 0) { return; } if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) { $errfile = stk_filter_root_path($errfile); $msg_text = stk_filter_root_path($msg_text); $error_name = $errno === E_WARNING ? 'PHP Warning' : 'PHP Notice'; echo '<b>[phpBB Debug] ' . $error_name . '</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $msg_text . '</b><br />' . "\n"; // we are writing an image - the user won't see the debug, so let's place it in the log if (defined('IMAGE_OUTPUT') || defined('IN_CRON')) { add_log('critical', 'LOG_IMAGE_GENERATION_ERROR', $errfile, $errline, $msg_text); } echo '<br /><br />BACKTRACE<br />' . get_backtrace() . '<br />' . "\n"; } return; break; case E_USER_ERROR: if (!empty($user) && !empty($user->lang)) { $msg_text = !empty($user->lang[$msg_text]) ? $user->lang[$msg_text] : $msg_text; $msg_title = !isset($msg_title) ? $user->lang['GENERAL_ERROR'] : (!empty($user->lang[$msg_title]) ? $user->lang[$msg_title] : $msg_title); $l_return_index = sprintf($user->lang['RETURN_INDEX'], '<a href="' . $phpbb_root_path . '">', '</a>'); $l_notify = ''; if (!empty($config['board_contact'])) { $l_notify = '<p>' . sprintf($user->lang['NOTIFY_ADMIN_EMAIL'], $config['board_contact']) . '</p>'; } } else { $msg_title = 'General Error'; $l_return_index = '<a href="' . $phpbb_root_path . '">Return to index page</a>'; $l_notify = ''; if (!empty($config['board_contact'])) { $l_notify = '<p>Please notify the board administrator or webmaster: <a href="mailto:' . $config['board_contact'] . '">' . $config['board_contact'] . '</a></p>'; } } $log_text = $msg_text; $backtrace = get_backtrace(); if ($backtrace) { $log_text .= '<br /><br />BACKTRACE<br />' . $backtrace; } if (defined('IN_INSTALL') || defined('DEBUG_EXTRA') || isset($auth) && $auth->acl_get('a_')) { $msg_text = $log_text; } if ((defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db)) { // let's avoid loops $db->sql_return_on_error(true); add_log('critical', 'LOG_GENERAL_ERROR', $msg_title, $log_text); $db->sql_return_on_error(false); } // Do not send 200 OK, but service unavailable on errors stk_send_status_line(503, 'Service Unavailable'); garbage_collection(); // Try to not call the adm page data... echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="' . $user->lang['DIRECTION'] . '" lang="' . $user->lang['USER_LANG'] . '" xml:lang="' . $user->lang['USER_LANG'] . '">'; echo '<head>'; echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'; echo '<title>' . $msg_title . '</title>'; echo '<style type="text/css">' . "\n" . '/* <![CDATA[ */' . "\n"; echo '* { margin: 0; padding: 0; } html { font-size: 100%; height: 100%; margin-bottom: 1px; background-color: #E4EDF0; } body { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; color: #536482; background: #E4EDF0; font-size: 62.5%; margin: 0; } '; echo 'a:link, a:active, a:visited { color: #006699; text-decoration: none; } a:hover { color: #DD6900; text-decoration: underline; } '; echo '#wrap { padding: 0 20px 15px 20px; min-width: 615px; } #page-header { text-align: right; height: 40px; } #page-footer { clear: both; font-size: 1em; text-align: center; } '; echo '.panel { margin: 4px 0; background-color: #FFFFFF; border: solid 1px #A9B8C2; } '; echo '#errorpage #page-header a { font-weight: bold; line-height: 6em; } #errorpage #content { padding: 10px; } #errorpage #content h1 { line-height: 1.2em; margin-bottom: 0; color: #DF075C; } '; echo '#errorpage #content div { margin-top: 20px; margin-bottom: 5px; border-bottom: 1px solid #CCCCCC; padding-bottom: 5px; color: #333333; font: bold 1.2em "Lucida Grande", Arial, Helvetica, sans-serif; text-decoration: none; line-height: 120%; text-align: left; } '; echo "\n" . '/* ]]> */' . "\n"; echo '</style>'; echo '</head>'; echo '<body id="errorpage">'; echo '<div id="wrap">'; echo ' <div id="page-header">'; echo ' ' . $l_return_index; echo ' </div>'; echo ' <div id="acp">'; echo ' <div class="panel">'; echo ' <div id="content">'; echo ' <h1>' . $msg_title . '</h1>'; echo ' <div>' . $msg_text . '</div>'; echo $l_notify; echo ' </div>'; echo ' </div>'; echo ' </div>'; echo ' <div id="page-footer">'; echo ' Powered by <a href="http://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Group'; echo ' </div>'; echo '</div>'; echo '</body>'; echo '</html>'; exit_handler(); // On a fatal error (and E_USER_ERROR *is* fatal) we never want other scripts to continue and force an exit here. exit; break; case E_USER_WARNING: case E_USER_NOTICE: define('IN_ERROR_HANDLER', true); if (empty($user->data)) { $user->session_begin(); } // We re-init the auth array to get correct results on login/logout $auth->acl($user->data); if (empty($user->lang)) { $user->setup(); } if ($msg_text == 'ERROR_NO_ATTACHMENT' || $msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') { stk_send_status_line(404, 'Not Found'); } $msg_text = !empty($user->lang[$msg_text]) ? $user->lang[$msg_text] : $msg_text; $msg_title = !isset($msg_title) ? $user->lang['INFORMATION'] : (!empty($user->lang[$msg_title]) ? $user->lang[$msg_title] : $msg_title); if (!defined('HEADER_INC')) { if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_header($msg_title); } else { page_header($msg_title, false); } } $template->set_filenames(array('body' => 'message_body.html')); $template->assign_vars(array('MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text, 'S_USER_WARNING' => $errno == E_USER_WARNING ? true : false, 'S_USER_NOTICE' => $errno == E_USER_NOTICE ? true : false)); // We do not want the cron script to be called on error messages define('IN_CRON', true); if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_footer(); } else { page_footer(); } exit_handler(); break; // PHP4 compatibility // PHP4 compatibility case E_DEPRECATED: return true; break; } // If we notice an error not handled here we pass this back to PHP by returning false // This may not work for all php versions return false; }
/** * Error and message handler, call with trigger_error if reqd */ function msg_handler($errno, $msg_text, $errfile, $errline) { global $cache, $db, $auth, $template, $config, $user; global $phpEx, $phpbb_root_path, $msg_title, $msg_long_text; // Do not display notices if we suppress them via @ if (error_reporting() == 0) { return; } // Message handler is stripping text. In case we need it, we are possible to define long text... if (isset($msg_long_text) && $msg_long_text && !$msg_text) { $msg_text = $msg_long_text; } switch ($errno) { case E_NOTICE: case E_WARNING: // Check the error reporting level and return if the error level does not match // If DEBUG is defined the default level is E_ALL if (($errno & (defined('DEBUG') ? E_ALL : error_reporting())) == 0) { return; } if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) { // flush the content, else we get a white page if output buffering is on if ((int) @ini_get('output_buffering') === 1 || strtolower(@ini_get('output_buffering')) === 'on') { @ob_flush(); } // Another quick fix for those having gzip compression enabled, but do not flush if the coder wants to catch "something". ;) if (!empty($config['gzip_compress'])) { if (@extension_loaded('zlib') && !headers_sent() && !ob_get_level()) { @ob_flush(); } } // remove complete path to installation, with the risk of changing backslashes meant to be there $errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile); $msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text); echo '<b>[phpBB Debug] PHP Notice</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $msg_text . '</b><br />' . "\n"; } return; break; case E_USER_ERROR: if (!empty($user) && !empty($user->lang)) { $msg_text = !empty($user->lang[$msg_text]) ? $user->lang[$msg_text] : $msg_text; $msg_title = !isset($msg_title) ? $user->lang['GENERAL_ERROR'] : (!empty($user->lang[$msg_title]) ? $user->lang[$msg_title] : $msg_title); $l_return_index = sprintf($user->lang['RETURN_INDEX'], '<a href="' . $phpbb_root_path . '">', '</a>'); $l_notify = ''; if (!empty($config['board_contact'])) { $l_notify = '<p>' . sprintf($user->lang['NOTIFY_ADMIN_EMAIL'], $config['board_contact']) . '</p>'; } } else { $msg_title = 'General Error'; $l_return_index = '<a href="' . $phpbb_root_path . '">Return to index page</a>'; $l_notify = ''; if (!empty($config['board_contact'])) { $l_notify = '<p>Please notify the board administrator or webmaster: <a href="mailto:' . $config['board_contact'] . '">' . $config['board_contact'] . '</a></p>'; } } garbage_collection(); // Try to not call the adm page data... echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">'; echo '<head>'; echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'; echo '<title>' . $msg_title . '</title>'; echo '<style type="text/css">' . "\n" . '/* <![CDATA[ */' . "\n"; echo '* { margin: 0; padding: 0; } html { font-size: 100%; height: 100%; margin-bottom: 1px; background-color: #E4EDF0; } body { font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; color: #536482; background: #E4EDF0; font-size: 62.5%; margin: 0; } '; echo 'a:link, a:active, a:visited { color: #006699; text-decoration: none; } a:hover { color: #DD6900; text-decoration: underline; } '; echo '#wrap { padding: 0 20px 15px 20px; min-width: 615px; } #page-header { text-align: right; height: 40px; } #page-footer { clear: both; font-size: 1em; text-align: center; } '; echo '.panel { margin: 4px 0; background-color: #FFFFFF; border: solid 1px #A9B8C2; } '; echo '#errorpage #page-header a { font-weight: bold; line-height: 6em; } #errorpage #content { padding: 10px; } #errorpage #content h1 { line-height: 1.2em; margin-bottom: 0; color: #DF075C; } '; echo '#errorpage #content div { margin-top: 20px; margin-bottom: 5px; border-bottom: 1px solid #CCCCCC; padding-bottom: 5px; color: #333333; font: bold 1.2em "Lucida Grande", Arial, Helvetica, sans-serif; text-decoration: none; line-height: 120%; text-align: left; } '; echo "\n" . '/* ]]> */' . "\n"; echo '</style>'; echo '</head>'; echo '<body id="errorpage">'; echo '<div id="wrap">'; echo ' <div id="page-header">'; echo ' ' . $l_return_index; echo ' </div>'; echo ' <div id="acp">'; echo ' <div class="panel">'; echo ' <div id="content">'; echo ' <h1>' . $msg_title . '</h1>'; echo ' <div>' . $msg_text . '</div>'; echo $l_notify; echo ' </div>'; echo ' </div>'; echo ' </div>'; echo ' <div id="page-footer">'; echo ' Powered by phpBB © 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>'; echo ' </div>'; echo '</div>'; echo '</body>'; echo '</html>'; exit_handler(); // On a fatal error (and E_USER_ERROR *is* fatal) we never want other scripts to continue and force an exit here. exit; break; case E_USER_WARNING: case E_USER_NOTICE: define('IN_ERROR_HANDLER', true); if (empty($user->data)) { $user->session_begin(); } // We re-init the auth array to get correct results on login/logout $auth->acl($user->data); if (empty($user->lang)) { $user->setup(); } $msg_text = !empty($user->lang[$msg_text]) ? $user->lang[$msg_text] : $msg_text; $msg_title = !isset($msg_title) ? $user->lang['INFORMATION'] : (!empty($user->lang[$msg_title]) ? $user->lang[$msg_title] : $msg_title); if (!defined('HEADER_INC')) { if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_header($msg_title); } else { page_header($msg_title); } } $template->set_filenames(array('body' => 'message_body.html')); $template->assign_vars(array('MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text, 'S_USER_WARNING' => $errno == E_USER_WARNING ? true : false, 'S_USER_NOTICE' => $errno == E_USER_NOTICE ? true : false)); // We do not want the cron script to be called on error messages define('IN_CRON', true); if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) { adm_page_footer(); } else { page_footer(); } exit_handler(); break; } // If we notice an error not handled here we pass this back to PHP by returning false // This may not work for all php versions return false; }
$output = preg_replace('#(\\w),(\\w)#', '\\1, \\2', $output); $output = preg_replace('#border="0" cellpadding="3" cellspacing="1" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output); $output = preg_replace('#<tr valign="top"><td align="left">(.*?<a .*?</a>)(.*?)</td></tr>#s', '<tr class="row1"><td style="{background-color: #9999cc;}"><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td style="{background-color: #9999cc;}">\\2</td><td style="{background-color: #9999cc;}">\\1</td></tr></table></td></tr>', $output); $output = preg_replace('#<tr valign="baseline"><td[ ]{0,1}><b>(.*?)</b>#', '<tr><td class="row1" nowrap="nowrap">\\1', $output); $output = preg_replace('#<td align="(center|left)">#', '<td class="row2">', $output); $output = preg_replace('#<td>#', '<td class="row2">', $output); $output = preg_replace('#valign="middle"#', '', $output); $output = preg_replace('#<tr >#', '<tr>', $output); $output = preg_replace('#<hr(.*?)>#', '', $output); $output = preg_replace('#<h1 align="center">#i', '<h1>', $output); $output = preg_replace('#<h2 align="center">#i', '<h2>', $output); break; case 'new': $output = preg_replace('#<table#', '<table class="tablebg" align="center"', $output[1][0]); $output = preg_replace('#(\\w),(\\w)#', '\\1, \\2', $output); $output = preg_replace('#border="0" cellpadding="3" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output); $output = preg_replace('#<tr class="v"><td>(.*?<a .*?</a>)(.*?)</td></tr>#s', '<tr class="row1"><td><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td>\\2</td><td>\\1</td></tr></table></td></tr>', $output); $output = preg_replace('#<td>#', '<td style="{background-color: #9999cc;}">', $output); $output = preg_replace('#class="e"#', 'class="row1" nowrap="nowrap"', $output); $output = preg_replace('#class="v"#', 'class="row2"', $output); $output = preg_replace('# class="h"#', '', $output); $output = preg_replace('#<hr />#', '', $output); preg_match_all('#<div class="center">(.*)</div>#siU', $output, $output); $output = $output[1][0]; break; } adm_page_header($_CLASS['core_user']->lang['PHP_INFO']); echo '<h1>' . $_CLASS['core_user']->lang['PHP_INFO'] . '</h1>'; echo '<p>' . $_CLASS['core_user']->lang['PHP_INFO_EXPLAIN'] . '</p>'; echo $output; adm_page_footer();