diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_board.php | 4 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 21 | ||||
-rw-r--r-- | phpBB/includes/auth.php | 34 | ||||
-rw-r--r-- | phpBB/includes/auth/auth_apache.php | 104 | ||||
-rw-r--r-- | phpBB/includes/auth/auth_db.php | 4 | ||||
-rw-r--r-- | phpBB/includes/auth/auth_ldap.php | 105 | ||||
-rw-r--r-- | phpBB/includes/constants.php | 1 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 10 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 15 | ||||
-rwxr-xr-x | phpBB/includes/mcp/mcp_reports.php | 19 | ||||
-rwxr-xr-x | phpBB/includes/search/fulltext_native.php | 2 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_register.php | 7 |
12 files changed, 243 insertions, 83 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index be98c6fd49..ab416068c4 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -390,7 +390,7 @@ class acp_board { include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); - $method = 'admin_' . $method; + $method = 'acp_' . $method; if (function_exists($method)) { if ($fields = $method($this->new_config)) @@ -518,7 +518,7 @@ class acp_board { if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) { - $method = 'admin_' . $method; + $method = 'acp_' . $method; if (function_exists($method)) { $fields = $method($this->new_config); diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index a455d664ba..23743824e1 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -483,16 +483,17 @@ pagination_sep = \'{PAGINATION_SEP}\' $filelist = $filelist_cats = array(); - $template_data = (!empty($_POST['template_data'])) ? ((STRIP) ? stripslashes($_POST['template_data']) : $_POST['template_data']) : ''; + // we want newlines no carriage returns! + $_POST['template_data'] = (isset($_POST['template_data']) && !empty($_POST['template_data'])) ? str_replace(array("\n\r", "\r"), array("\n", "\n"), $_POST['template_data']) : ''; + + $template_data = (STRIP) ? stripslashes($_POST['template_data']) : $_POST['template_data']; $template_file = request_var('template_file', ''); $text_rows = max(5, min(999, request_var('text_rows', 20))); $save_changes = (isset($_POST['save'])) ? true : false; // make sure template_file path doesn't go upwards $template_file = str_replace('..', '.', $template_file); - // we want newlines no carriage returns! - $template_data = str_replace(array("\n\r", "\r"), array("\n", "\n"), $template_data); - + // Retrieve some information about the template $sql = 'SELECT template_storedb, template_path, template_name FROM ' . STYLES_TEMPLATE_TABLE . " @@ -815,20 +816,22 @@ pagination_sep = \'{PAGINATION_SEP}\' $this->page_title = 'EDIT_THEME'; + // we want newlines no carriage returns! + $_POST['css_data'] = (isset($_POST['css_data']) && !empty($_POST['css_data'])) ? str_replace(array("\n\r", "\r"), array("\n", "\n"), $_POST['css_data']) : ''; + + $template_data = (STRIP) ? stripslashes($_POST['template_data']) : $_POST['template_data']; + // get user input $text_rows = max(5, min(999, request_var('text_rows', 20))); $hide_css = request_var('hidecss', false); $show_css = !$hide_css && request_var('showcss', false); $edit_class = request_var('css_class', ''); $custom_class = request_var('custom_class', ''); - $css_data = (!empty($_POST['css_data'])) ? ((STRIP) ? stripslashes($_POST['css_data']) : $_POST['css_data']) : ''; + $css_data = (STRIP) ? stripslashes($_POST['css_data']) : $_POST['css_data']; $submit = isset($_POST['submit']) ? true : false; $add_custom = isset($_POST['add_custom']) ? true : false; $matches = array(); - // we want newlines no carriage returns! - $css_data = str_replace(array("\n\r", "\r"), array("\n", "\n"), $css_data); - // Retrieve some information about the theme $sql = 'SELECT theme_storedb, theme_path, theme_name, theme_data FROM ' . STYLES_THEME_TABLE . " @@ -2254,7 +2257,7 @@ pagination_sep = \'{PAGINATION_SEP}\' // heck of a lot of data ... $sql_ary = array( 'template_id' => $style_id, - 'template_filename' => "$template_pathfile$file", + 'template_filename' => "$template_path$pathfile$file", 'template_included' => (isset($includes[$file])) ? implode(':', $includes[$file]) . ':' : '', 'template_mtime' => filemtime("{$phpbb_root_path}styles/$template_path$pathfile$file"), 'template_data' => file_get_contents("{$phpbb_root_path}styles/$template_path$pathfile$file"), diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php index b226f0b13b..06b2ac0689 100644 --- a/phpBB/includes/auth.php +++ b/phpBB/includes/auth.php @@ -717,6 +717,40 @@ class auth { $login = $method($username, $password); + // If the auth module wants us to create an empty profile do so and then treat the status as LOGIN_SUCCESS + if ($login['status'] == LOGIN_SUCCESS_CREATE_PROFILE) + { + // we are going to use the user_add function so include functions_user.php if it wasn't defined yet + if (!function_exists('user_add')) + { + include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + user_add($login['user_row'], (isset($login['cp_data'])) ? $login['cp_data'] : false); + + $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type + FROM ' . USERS_TABLE . " + WHERE username = '" . $db->sql_escape($username) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'AUTH_NO_PROFILE_CREATED', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $login = array( + 'status' => LOGIN_SUCCESS, + 'error_msg' => false, + 'user_row' => $row, + ); + } + // If login succeeded, we will log the user in... else we pass the login array through... if ($login['status'] == LOGIN_SUCCESS) { diff --git a/phpBB/includes/auth/auth_apache.php b/phpBB/includes/auth/auth_apache.php index 410bf1abdb..8556fb5707 100644 --- a/phpBB/includes/auth/auth_apache.php +++ b/phpBB/includes/auth/auth_apache.php @@ -4,13 +4,6 @@ * * Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him. * -* This is for initial authentication via Apaches basic realm authentication methods, -* user data is then obtained from the integrated user table -* -* You can do any kind of checking you like here ... the return data format is -* either the resulting row of user information, an integer zero (indicating an -* inactive user) or some error string -* * @package login * @version $Id$ * @copyright (c) 2005 phpBB Group @@ -19,17 +12,53 @@ */ /** +* Checks whether the user is identified to apache +* Only allow changing authentication to apache if the user is identified +* Called in acp_board while setting authentication plugins +* +* @return boolean|string false if the user is identified and else an error message +*/ +function init_apache() +{ + global $user; + + if (!isset($_SERVER['PHP_AUTH_USER']) || $user->data['username'] !== $_SERVER['PHP_AUTH_USER']) + { + return $user->lang['APACHE_SETUP_BEFORE_USE']; + } + return false; +} + +/** * Login function */ function login_apache(&$username, &$password) { global $db; + if (!isset($_SERVER['PHP_AUTH_USER'])) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + $php_auth_user = $_SERVER['PHP_AUTH_USER']; $php_auth_pw = $_SERVER['PHP_AUTH_PW']; if (!empty($php_auth_user) && !empty($php_auth_pw)) { + if ($php_auth_user !== $username) + { + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type FROM ' . USERS_TABLE . " WHERE username = '" . $db->sql_escape($php_auth_user) . "'"; @@ -57,11 +86,11 @@ function login_apache(&$username, &$password) ); } - // the user does not exist + // this is the user's first login so create an empty profile return array( - 'status' => LOGIN_ERROR_USERNAME, - 'error_msg' => 'LOGIN_ERROR_USERNAME', - 'user_row' => array('user_id' => ANONYMOUS), + 'status' => LOGIN_SUCCESS_CREATE_PROFILE, + 'error_msg' => false, + 'user_row' => user_row_apache($php_auth_user, $php_auth_pw), ); } @@ -82,6 +111,11 @@ function autologin_apache() { global $db; + if (!isset($_SERVER['PHP_AUTH_USER'])) + { + return array(); + } + $php_auth_user = $_SERVER['PHP_AUTH_USER']; $php_auth_pw = $_SERVER['PHP_AUTH_PW']; @@ -98,19 +132,65 @@ function autologin_apache() { return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? array() : $row; } + + // create the user if he does not exist yet + user_add(user_row_apache($php_auth_user, $php_auth_pw)); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . " + WHERE username = '" . $db->sql_escape($php_auth_user) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return $row; + } } return array(); } /** +* This function generates an array which can be passed to the user_add function in order to create a user +*/ +function user_row_apache($username, $password) +{ + global $db, $config, $user; + // first retrieve default group id + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $db->sql_escape('REGISTERED') . "' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_GROUP'); + } + + // generate user account data + return array( + 'username' => $username, + 'user_password' => $password, + 'user_email' => '', + 'group_id' => (int) $row['group_id'], + 'user_type' => USER_NORMAL, + 'user_ip' => $user->ip, + ); +} + +/** * The session validation function checks whether the user is still logged in * * @return boolean true if the given user is authenticated or false if the session should be closed */ function validate_session_apache(&$user) { - return ($_SERVER['PHP_AUTH_USER'] === $user['username']) ? true : false; + return (isset($_SERVER['PHP_AUTH_USER']) && ($_SERVER['PHP_AUTH_USER'] === $user['username'])) ? true : false; } ?>
\ No newline at end of file diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php index 55465ab762..9477fd92c3 100644 --- a/phpBB/includes/auth/auth_db.php +++ b/phpBB/includes/auth/auth_db.php @@ -6,10 +6,6 @@ * * This is for authentication via the integrated user table * -* You can do any kind of checking you like here ... the return data format is -* either the resulting row of user information, an integer zero (indicating an -* inactive user) or some error string -* * @package login * @version $Id$ * @copyright (c) 2005 phpBB Group diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index e9b87bcf44..25c90aeeeb 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -5,13 +5,6 @@ * * Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him. * -* This is for initial authentication via an LDAP server, user information is then -* obtained from the integrated user table -* -* You can do any kind of checking you like here ... the return data format is -* either the resulting row of user information, an integer zero (indicating an -* inactive user) or some error string -* * @package login * @version $Id$ * @copyright (c) 2005 phpBB Group @@ -39,9 +32,17 @@ function init_ldap() } @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); + @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); // ldap_connect only checks whether the specified server is valid, so the connection might still fail - $search = @ldap_search($ldap, $config['ldap_base_dn'], $config['ldap_uid'] . '=' . $user->data['username'], array($config['ldap_uid'])); + $search = @ldap_search( + $ldap, + $config['ldap_base_dn'], + '(' . $config['ldap_uid'] . '=' . $user->data['username'] . ')', + (empty($config['ldap_email'])) ? array($config['ldap_uid']) : array($config['ldap_uid'], $config['ldap_email']), + 0, + 1 + ); if ($search === false) { @@ -52,6 +53,11 @@ function init_ldap() @ldap_close($ldap); + if (!empty($config['ldap_email']) && !isset($result[0][$config['ldap_email']])) + { + return $user->lang['LDAP_NO_EMAIL']; + } + if (is_array($result) && sizeof($result) > 1) { return false; @@ -65,7 +71,7 @@ function init_ldap() */ function login_ldap(&$username, &$password) { - global $db, $config; + global $db, $config, $user; if (!@extension_loaded('ldap')) { @@ -86,13 +92,22 @@ function login_ldap(&$username, &$password) } @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); + @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); + + $search = @ldap_search( + $ldap, + $config['ldap_base_dn'], + '(' . $config['ldap_uid'] . '=' . $username . ')', + (empty($config['ldap_email'])) ? array($config['ldap_uid']) : array($config['ldap_uid'], $config['ldap_email']), + 0, + 1 + ); - $search = @ldap_search($ldap, $config['ldap_base_dn'], $config['ldap_uid'] . '=' . $username, array($config['ldap_uid'])); - $result = @ldap_get_entries($ldap, $search); + $ldap_result = @ldap_get_entries($ldap, $search); - if (is_array($result) && sizeof($result) > 1) + if (is_array($ldap_result) && sizeof($ldap_result) > 1) { - if (@ldap_bind($ldap, $result[0]['dn'], $password)) + if (@ldap_bind($ldap, $ldap_result[0]['dn'], $password)) { @ldap_close($ldap); @@ -105,6 +120,8 @@ function login_ldap(&$username, &$password) if ($row) { + unset($ldap_result); + // User inactive... if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) { @@ -122,9 +139,45 @@ function login_ldap(&$username, &$password) 'user_row' => $row, ); } + else + { + // retrieve default group id + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $db->sql_escape('REGISTERED') . "' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_GROUP'); + } + + // generate user account data + $ldap_user_row = array( + 'username' => $username, + 'user_password' => $password, + 'user_email' => (!empty($config['ldap_email'])) ? $ldap_result[0][$config['ldap_email']][0] : '', + 'group_id' => (int) $row['group_id'], + 'user_type' => USER_NORMAL, + 'user_ip' => $user->ip, + ); + + unset($ldap_result); + + // this is the user's first login so create an empty profile + return array( + 'status' => LOGIN_SUCCESS_CREATE_PROFILE, + 'error_msg' => false, + 'user_row' => $ldap_user_row, + ); + } } else { + unset($ldap_result); @ldap_close($ldap); // Give status about wrong password... @@ -149,14 +202,10 @@ function login_ldap(&$username, &$password) * This function is used to output any required fields in the authentication * admin panel. It also defines any required configuration table fields. */ -function admin_ldap(&$new) +function acp_ldap(&$new) { global $user; - /** - * @todo Using same approach as with cfg_build_template? - */ - $tpl = ' <dl> @@ -171,27 +220,17 @@ function admin_ldap(&$new) <dt><label for="ldap_uid">' . $user->lang['LDAP_UID'] . ':</label><br /><span>' . $user->lang['LDAP_UID_EXPLAIN'] . '</span></dt> <dd><input type="text" id="ldap_uid" size="40" name="config[ldap_uid]" value="' . $new['ldap_uid'] . '" /></dd> </dl> + <dl> + <dt><label for="ldap_uid">' . $user->lang['LDAP_EMAIL'] . ':</label><br /><span>' . $user->lang['LDAP_EMAIL_EXPLAIN'] . '</span></dt> + <dd><input type="text" id="ldap_uid" size="40" name="config[ldap_email]" value="' . $new['ldap_email'] . '" /></dd> + </dl> '; // These are fields required in the config table return array( 'tpl' => $tpl, - 'config' => array('ldap_server', 'ldap_base_dn', 'ldap_uid') + 'config' => array('ldap_server', 'ldap_base_dn', 'ldap_uid', 'ldap_email') ); } -/** -* Would be nice to allow syncing of 'appropriate' data when user updates -* their username, password, etc. ... should be up to the plugin what data -* is updated. -* -* @todo implement this functionality (probably 3.2) -* -* @param new|update|delete $mode defining the action to take on user updates -*/ -function usercp_ldap($mode) -{ - global $db, $config; -} - ?>
\ No newline at end of file diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index c3dfcbeca7..fa6a3903d2 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -39,6 +39,7 @@ define('ACL_NO', -1); define('LOGIN_CONTINUE', 1); define('LOGIN_BREAK', 2); define('LOGIN_SUCCESS', 3); +define('LOGIN_SUCCESS_CREATE_PROFILE', 20); define('LOGIN_ERROR_USERNAME', 10); define('LOGIN_ERROR_PASSWORD', 11); define('LOGIN_ERROR_ACTIVE', 12); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 6bccea43ea..7ae4b1a588 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -148,7 +148,7 @@ function user_add($user_row, $cp_data = false) // These are the additional vars able to be specified $additional_vars = array( 'user_permissions' => '', - 'user_timezone' => 0, + 'user_timezone' => $config['board_timezone'], 'user_dateformat' => $config['default_dateformat'], 'user_lang' => $config['default_lang'], 'user_style' => $config['default_style'], @@ -242,6 +242,14 @@ function user_add($user_row, $cp_data = false) // Now make it the users default group... group_set_user_default($user_row['group_id'], array($user_id)); + // set the newest user and adjust the user count if the user is a normal user and no activation mail is sent + if ($user_row['user_type'] == USER_NORMAL || !$config['email_enable']) + { + set_config('newest_user_id', $user_id, true); + set_config('newest_username', $user_row['username'], true); + set_config('num_users', $config['num_users'] + 1, true); + } + return $user_id; } diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index adb71fda1a..e09dfb4d09 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -181,6 +181,8 @@ class mcp_queue $forum_list[] = $row['forum_id']; } + $global_id = $forum_list[0]; + if (!($forum_list = implode(', ', $forum_list))) { trigger_error('NOT_MODERATOR'); @@ -192,8 +194,6 @@ class mcp_queue $result = $db->sql_query($sql); $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics'); $db->sql_freeresult($result); - - $global_id = $forum_list[0]; } else { @@ -250,7 +250,7 @@ class mcp_queue if (sizeof($post_ids)) { - $sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_username, p.poster_id, p.post_time, u.username + $sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . " u WHERE p.post_id IN (" . implode(', ', $post_ids) . ") AND t.topic_id = p.topic_id @@ -281,7 +281,7 @@ class mcp_queue } else { - $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username + $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username FROM ' . TOPICS_TABLE . " t WHERE topic_approved = 0 AND forum_id IN (0, $forum_list) @@ -336,15 +336,13 @@ class mcp_queue $template->assign_block_vars('postrow', array( 'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', - // Q: Why accessing the topic by a post_id instead of its topic_id? - // A: To prevent the post from being hidden because of wrong encoding or different charset - 'U_VIEWTOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''), + 'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''), 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&start=$start&mode=approve_details&f={$row['forum_id']}&p={$row['post_id']}" . (($mode == 'unapproved_topics') ? "&t={$row['topic_id']}" : '')), 'U_VIEWPROFILE' => ($row['poster_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']) : '', 'POST_ID' => $row['post_id'], 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], - 'TOPIC_TITLE' => $row['topic_title'], + 'POST_SUBJECT' => $row['post_subject'], 'POSTER' => $poster, 'POST_TIME' => $user->format_date($row['post_time'])) ); @@ -360,6 +358,7 @@ class mcp_queue 'S_FORUM_OPTIONS' => $forum_options, 'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')), + 'S_TOPICS' => ($mode == 'unapproved_posts') ? false : true, 'PAGINATION' => generate_pagination($this->u_action . "&f=$forum_id", $total, $config['topics_per_page'], $start), 'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start), diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 6ff8545acc..9bafa6ffeb 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -191,6 +191,8 @@ class mcp_reports $forum_list[] = $row['forum_id']; } + $global_id = $forum_list[0]; + if (!($forum_list = implode(', ', $forum_list))) { trigger_error('NOT_MODERATOR'); @@ -214,6 +216,7 @@ class mcp_reports $forum_info = $forum_info[$forum_id]; $forum_list = $forum_id; + $global_id = $forum_id; } $forum_list .= ', 0'; @@ -297,16 +300,20 @@ class mcp_reports $poster = $row['username']; } + $global_topic = ($row['forum_id']) ? false : true; + if ($global_topic) + { + $row['forum_id'] = $global_id; + } + $template->assign_block_vars('postrow', array( - 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']), - // Q: Why accessing the topic by a post_id instead of its topic_id? - // A: To prevent the post from being hidden because of wrong encoding or different charset - 'U_VIEWTOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'], - 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&start=$start&mode=report_details&f={$forum_id}&p={$row['post_id']}"), + 'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '', + 'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'], + 'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&start=$start&mode=report_details&f={$row['forum_id']}&p={$row['post_id']}"), 'U_VIEW_POSTER_PROFILE' => ($row['poster_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['poster_id']) : '', 'U_VIEW_REPORTER_PROFILE' => ($row['reporter_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['reporter_id']) : '', - 'FORUM_NAME' => ($row['forum_id']) ? $forum_data[$row['forum_id']]['forum_name'] : $user->lang['ALL_FORUMS'], + 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], 'POSTER' => $poster, 'POST_ID' => $row['post_id'], 'POST_SUBJECT' => $row['post_subject'], diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index 873faec291..7224f072b1 100755 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -232,7 +232,7 @@ class fulltext_native extends search_backend for ($i = 0, $n = sizeof($text); $i < $n; $i++) { - if ($lengths[$i] < $config['fulltext_native_min_chars'] || $lengths[$i] > $config['fulltext_native_max_chars']) + if ($lengths[$i] < $config['fulltext_native_min_chars'] || $lengths[$i] > $config['fulltext_native_max_chars'] || strlen($text[$i]) > 252) { unset($text[$i]); } diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 44c15bfb0e..8b199be6ac 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -345,13 +345,6 @@ class ucp_register $db->sql_freeresult($result); } } - - if ($user_type == USER_NORMAL || !$config['email_enable']) - { - set_config('newest_user_id', $user_id, true); - set_config('newest_username', $username, true); - set_config('num_users', $config['num_users'] + 1, true); - } unset($data); $message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'); |