diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 734a9716c8..ca8e71906a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3178,6 +3178,9 @@ function msg_handler($errno, $msg_text, $errfile, $errline) echo ''; 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: @@ -3445,7 +3448,7 @@ function page_header($page_title = '', $display_online_list = true) $s_privmsg_new = false; // Obtain number of new private messages if user is logged in - if (isset($user->data['is_registered']) && $user->data['is_registered']) + if (!empty($user->data['is_registered'])) { if ($user->data['user_new_privmsg']) { @@ -3542,8 +3545,8 @@ function page_header($page_title = '', $display_online_list = true) 'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS) ? true : false, 'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false, 'S_BOARD_DISABLED' => ($config['board_disable']) ? true : false, - 'S_REGISTERED_USER' => $user->data['is_registered'], - 'S_IS_BOT' => $user->data['is_bot'], + 'S_REGISTERED_USER' => (!empty($user->data['is_registered'])) ? true : false, + 'S_IS_BOT' => (!empty($user->data['is_bot'])) ? true : false, 'S_IN_SEARCH' => false, 'S_VIEWTOPIC' => false, 'S_VIEWFORUM' => false, @@ -3558,7 +3561,7 @@ function page_header($page_title = '', $display_online_list = true) 'S_TIMEZONE' => ($user->data['user_dst'] || ($user->data['user_id'] == ANONYMOUS && $config['board_dst'])) ? sprintf($user->lang['ALL_TIMES'], $user->lang['tz'][$tz], $user->lang['tz']['dst']) : sprintf($user->lang['ALL_TIMES'], $user->lang['tz'][$tz], ''), 'S_DISPLAY_ONLINE_LIST' => ($l_online_time) ? 1 : 0, 'S_DISPLAY_SEARCH' => (!$config['load_search']) ? 0 : (isset($auth) ? ($auth->acl_get('u_search') && $auth->acl_getf_global('f_search')) : 1), - 'S_DISPLAY_PM' => ($config['allow_privmsg'] && $user->data['is_registered'] && ($auth->acl_get('u_readpm') || $auth->acl_get('u_sendpm'))) ? true : false, + 'S_DISPLAY_PM' => ($config['allow_privmsg'] && !empty($user->data['is_registered']) && ($auth->acl_get('u_readpm') || $auth->acl_get('u_sendpm'))) ? true : false, 'S_DISPLAY_MEMBERLIST' => (isset($auth)) ? $auth->acl_get('u_viewprofile') : 0, 'S_NEW_PM' => ($s_privmsg_new) ? 1 : 0, 'S_REGISTER_ENABLED' => ($config['require_activation'] != USER_ACTIVATION_DISABLE) ? true : false, @@ -3634,8 +3637,8 @@ function page_footer($run_cron = true) 'DEBUG_OUTPUT' => (defined('DEBUG')) ? $debug_output : '', 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', - 'U_ACP' => ($auth->acl_get('a_') && $user->data['is_registered']) ? append_sid(CONFIG_ADM_FOLDER . '/index', false, true, $user->session_id) : '') - ); + 'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid(CONFIG_ADM_FOLDER . '/index', false, true, $user->session_id) : '', + )); // Call cron-type script if (!defined('IN_CRON') && $run_cron && !$config['board_disable']) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 95364b4f71..d9c07182a5 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -238,7 +238,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po function get_context($text, $words, $length = 400) { // first replace all whitespaces with single spaces - $text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", ' '), $text); + $text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", ' ')); $word_indizes = array(); if (sizeof($words)) diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 7e2d4feb7c..2632ec21e5 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -166,7 +166,7 @@ if ($quickmod) case 'delete_post': case 'delete_topic': $module->load('mcp', 'main', 'quickmod'); - exit; + return; break; case 'topic_logs': @@ -183,7 +183,8 @@ if ($quickmod) break; default: - trigger_error("$action not allowed as quickmod"); + trigger_error("$action not allowed as quickmod", E_USER_ERROR); + break; } } else diff --git a/phpBB/posting.php b/phpBB/posting.php index fc173e7dbd..1ec693e16f 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -120,7 +120,7 @@ switch ($mode) else { upload_popup(); - exit; + return; } break; @@ -151,7 +151,7 @@ if (!$post_data) if ($mode == 'popup') { upload_popup($post_data['forum_style']); - exit; + return; } $user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']); @@ -282,7 +282,7 @@ if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id)) if ($mode == 'delete') { handle_post_delete($forum_id, $topic_id, $post_id, $post_data); - exit; + return; } // Handle bump mode... diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index f41e1abb08..2314794800 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -113,7 +113,7 @@ if ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link']) // We redirect to the url. The third parameter indicates that external redirects are allowed. redirect($forum_data['forum_link'], false, true); - exit; + return; } // Build navigation links