diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_email.php | 12 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_permissions.php | 32 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 4 | ||||
-rw-r--r-- | phpBB/includes/constants.php | 143 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 13 | ||||
-rw-r--r-- | phpBB/includes/functions_display.php | 22 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 6 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 7 | ||||
-rw-r--r-- | phpBB/includes/search/fulltext_mysql.php | 2 | ||||
-rw-r--r-- | phpBB/includes/session.php | 24 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 4 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_zebra.php | 50 |
12 files changed, 193 insertions, 126 deletions
diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 1d3149c958..4d254bb084 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -194,14 +194,16 @@ class acp_email } } - // Initial selection - $sql = 'SELECT group_id, group_type, group_name - FROM ' . GROUPS_TABLE . ' - ORDER BY group_type DESC, group_name ASC'; + // Exclude bots... + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'BOTS'"; $result = $db->sql_query($sql); + $bot_group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); $select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>'; - $select_list .= group_select_options($group_id); + $select_list .= group_select_options($group_id, array($bot_group_id)); $s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>'; $s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>'; diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 9ca25c8cf7..f42a03ba15 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -861,14 +861,14 @@ class acp_permissions { foreach ($forum_ary as $auth_option => $user_ary) { - $perms += $user_ary; + $perms = array_merge($perms, $user_ary); } } if (sizeof($perms)) { $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' - WHERE zebra_id IN (' . implode(', ', $perms) . ') + WHERE zebra_id IN (' . implode(', ', array_unique($perms)) . ') AND foe = 1'; $db->sql_query($sql); } @@ -882,21 +882,21 @@ class acp_permissions { global $db, $template, $user, $auth; - $sql = 'SELECT username + $sql = 'SELECT user_id, username, user_type FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user_id; $result = $db->sql_query($sql); - $username = (string) $db->sql_fetchfield('username'); + $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - if (!$username) + if (!$user_row) { trigger_error('NO_USERS'); } $template->assign_vars(array( 'PERMISSION' => $user->lang['acl_' . $permission]['lang'], - 'PERMISSION_USERNAME' => $username) + 'PERMISSION_USERNAME' => $user_row['username']) ); $template->assign_block_vars('trace', array( @@ -990,9 +990,9 @@ class acp_permissions $total = ACL_NO; break; } - + $template->assign_block_vars('trace', array( - 'WHO' => $username, + 'WHO' => $user_row['username'], 'INFORMATION' => $information, 'S_SETTING_UNSET' => ($auth_setting == ACL_UNSET) ? true : false, @@ -1002,6 +1002,22 @@ class acp_permissions 'S_TOTAL_YES' => ($total == ACL_YES) ? true : false, 'S_TOTAL_NO' => ($total == ACL_NO) ? true : false) ); + + // Take founder status into account, overwriting the default values + if ($user_row['user_type'] == USER_FOUNDER && strpos($permission, 'a_') === 0) + { + $template->assign_block_vars('trace', array( + 'WHO' => $user_row['username'], + 'INFORMATION' => $user->lang['TRACE_USER_FOUNDER'], + + 'S_SETTING_UNSET' => ($auth_setting == ACL_UNSET) ? true : false, + 'S_SETTING_YES' => ($auth_setting == ACL_YES) ? true : false, + 'S_SETTING_NO' => ($auth_setting == ACL_NO) ? true : false, + 'S_TOTAL_UNSET' => false, + 'S_TOTAL_YES' => true, + 'S_TOTAL_NO' => false) + ); + } } } diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 75ac50cdcb..7e0601d1dc 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1302,6 +1302,10 @@ class acp_users $filename = ''; $type = $width = $height = 0; } + else + { + $data = array(); + } } if (!sizeof($error)) diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 7e31bea815..da19cfde4d 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -132,78 +132,79 @@ define('FIELD_DATE', 6); // Additional constants -// Table names - do not set if in installation -if (defined('IN_INSTALL')) +// Table names - only set if not in installation +if (!defined('IN_INSTALL')) { - return; + // Table names + define('ACL_GROUPS_TABLE', $table_prefix . 'auth_groups'); + define('ACL_OPTIONS_TABLE', $table_prefix . 'auth_options'); + define('ACL_ROLES_TABLE', $table_prefix . 'auth_roles'); + define('ACL_ROLES_DATA_TABLE', $table_prefix . 'auth_roles_data'); + define('ACL_USERS_TABLE', $table_prefix . 'auth_users'); + define('ATTACHMENTS_TABLE', $table_prefix . 'attachments'); + define('BANLIST_TABLE', $table_prefix . 'banlist'); + define('BBCODES_TABLE', $table_prefix . 'bbcodes'); + define('BOOKMARKS_TABLE', $table_prefix . 'bookmarks'); + define('BOTS_TABLE', $table_prefix . 'bots'); + define('CACHE_TABLE', $table_prefix . 'cache'); + define('CONFIG_TABLE', $table_prefix . 'config'); + define('CONFIRM_TABLE', $table_prefix . 'confirm'); + define('PROFILE_FIELDS_TABLE', $table_prefix . 'profile_fields'); + define('PROFILE_LANG_TABLE', $table_prefix . 'profile_lang'); + define('PROFILE_DATA_TABLE', $table_prefix . 'profile_fields_data'); + define('PROFILE_FIELDS_LANG_TABLE', $table_prefix . 'profile_fields_lang'); + define('DISALLOW_TABLE', $table_prefix . 'disallow'); + define('DRAFTS_TABLE', $table_prefix . 'drafts'); + define('EXTENSIONS_TABLE', $table_prefix . 'extensions'); + define('EXTENSION_GROUPS_TABLE', $table_prefix . 'extension_groups'); + define('FORUMS_TABLE', $table_prefix . 'forums'); + define('FORUMS_ACCESS_TABLE', $table_prefix . 'forum_access'); + define('FORUMS_TRACK_TABLE', $table_prefix . 'forums_marking'); + define('FORUMS_WATCH_TABLE', $table_prefix . 'forums_watch'); + define('GROUPS_TABLE', $table_prefix . 'groups'); + define('ICONS_TABLE', $table_prefix . 'icons'); + define('LANG_TABLE', $table_prefix . 'lang'); + define('LOG_TABLE', $table_prefix . 'log'); + define('MODERATOR_TABLE', $table_prefix . 'moderator_cache'); + define('MODULES_TABLE', $table_prefix . 'modules'); + define('POSTS_TABLE', $table_prefix . 'posts'); + define('PRIVMSGS_TABLE', $table_prefix . 'privmsgs'); + define('PRIVMSGS_TO_TABLE', $table_prefix . 'privmsgs_to'); + define('PRIVMSGS_FOLDER_TABLE', $table_prefix . 'privmsgs_folder'); + define('PRIVMSGS_RULES_TABLE', $table_prefix . 'privmsgs_rules'); + define('RANKS_TABLE', $table_prefix . 'ranks'); + define('RATINGS_TABLE', $table_prefix . 'ratings'); + define('REPORTS_TABLE', $table_prefix . 'reports'); + define('REASONS_TABLE', $table_prefix . 'reports_reasons'); + define('SEARCH_TABLE', $table_prefix . 'search_results'); + define('SEARCH_WORD_TABLE', $table_prefix . 'search_wordlist'); + define('SEARCH_MATCH_TABLE', $table_prefix . 'search_wordmatch'); + define('SESSIONS_TABLE', $table_prefix . 'sessions'); + define('SESSIONS_KEYS_TABLE', $table_prefix . 'sessions_keys'); + define('SITELIST_TABLE', $table_prefix . 'sitelist'); + define('SMILIES_TABLE', $table_prefix . 'smilies'); + define('STYLES_TABLE', $table_prefix . 'styles'); + define('STYLES_TPL_TABLE', $table_prefix . 'styles_template'); + define('STYLES_TPLDATA_TABLE', $table_prefix . 'styles_template_data'); + define('STYLES_CSS_TABLE', $table_prefix . 'styles_theme'); + define('STYLES_IMAGE_TABLE', $table_prefix . 'styles_imageset'); + define('TOPICS_TABLE', $table_prefix . 'topics'); + define('TOPICS_POSTED_TABLE', $table_prefix . 'topics_posted'); + define('TOPICS_WATCH_TABLE', $table_prefix . 'topics_watch'); + define('TOPICS_TRACK_TABLE', $table_prefix . 'topics_marking'); + define('USER_GROUP_TABLE', $table_prefix . 'user_group'); + define('USERS_TABLE', $table_prefix . 'users'); + define('USERS_NOTES_TABLE', $table_prefix . 'users_notes'); + define('WARNINGS_TABLE', $table_prefix . 'warnings'); + define('WORDS_TABLE', $table_prefix . 'words'); + define('POLL_OPTIONS_TABLE', $table_prefix . 'poll_results'); + define('POLL_VOTES_TABLE', $table_prefix . 'poll_voters'); + define('ZEBRA_TABLE', $table_prefix . 'zebra'); + + // Additional tables + + + // Additional tables end } -// Table names -define('ACL_GROUPS_TABLE', $table_prefix.'auth_groups'); -define('ACL_OPTIONS_TABLE', $table_prefix.'auth_options'); -define('ACL_ROLES_TABLE', $table_prefix.'auth_roles'); -define('ACL_ROLES_DATA_TABLE', $table_prefix.'auth_roles_data'); -define('ACL_USERS_TABLE', $table_prefix.'auth_users'); -define('ATTACHMENTS_TABLE', $table_prefix.'attachments'); -define('BANLIST_TABLE', $table_prefix.'banlist'); -define('BBCODES_TABLE', $table_prefix.'bbcodes'); -define('BOOKMARKS_TABLE', $table_prefix.'bookmarks'); -define('BOTS_TABLE', $table_prefix.'bots'); -define('CACHE_TABLE', $table_prefix.'cache'); -define('CONFIG_TABLE', $table_prefix.'config'); -define('CONFIRM_TABLE', $table_prefix.'confirm'); -define('PROFILE_FIELDS_TABLE', $table_prefix.'profile_fields'); -define('PROFILE_LANG_TABLE', $table_prefix.'profile_lang'); -define('PROFILE_DATA_TABLE', $table_prefix.'profile_fields_data'); -define('PROFILE_FIELDS_LANG_TABLE', $table_prefix.'profile_fields_lang'); -define('DISALLOW_TABLE', $table_prefix.'disallow'); // -define('DRAFTS_TABLE', $table_prefix.'drafts'); -define('EXTENSIONS_TABLE', $table_prefix.'extensions'); -define('EXTENSION_GROUPS_TABLE', $table_prefix.'extension_groups'); -define('FORUMS_TABLE', $table_prefix.'forums'); -define('FORUMS_ACCESS_TABLE', $table_prefix.'forum_access'); -define('FORUMS_TRACK_TABLE', $table_prefix.'forums_marking'); -define('FORUMS_WATCH_TABLE', $table_prefix.'forums_watch'); -define('GROUPS_TABLE', $table_prefix.'groups'); -define('ICONS_TABLE', $table_prefix.'icons'); -define('LANG_TABLE', $table_prefix.'lang'); -define('LOG_TABLE', $table_prefix.'log'); -define('MODERATOR_TABLE', $table_prefix.'moderator_cache'); -define('MODULES_TABLE', $table_prefix . 'modules'); -define('POSTS_TABLE', $table_prefix.'posts'); -define('PRIVMSGS_TABLE', $table_prefix.'privmsgs'); -define('PRIVMSGS_TO_TABLE', $table_prefix.'privmsgs_to'); -define('PRIVMSGS_FOLDER_TABLE', $table_prefix.'privmsgs_folder'); -define('PRIVMSGS_RULES_TABLE', $table_prefix.'privmsgs_rules'); -define('RANKS_TABLE', $table_prefix.'ranks'); -define('RATINGS_TABLE', $table_prefix.'ratings'); -define('REPORTS_TABLE', $table_prefix.'reports'); -define('REASONS_TABLE', $table_prefix.'reports_reasons'); -define('SEARCH_TABLE', $table_prefix.'search_results'); -define('SEARCH_WORD_TABLE', $table_prefix.'search_wordlist'); -define('SEARCH_MATCH_TABLE', $table_prefix.'search_wordmatch'); -define('SESSIONS_TABLE', $table_prefix.'sessions'); -define('SESSIONS_KEYS_TABLE', $table_prefix.'sessions_keys'); -define('SITELIST_TABLE', $table_prefix.'sitelist'); -define('SMILIES_TABLE', $table_prefix.'smilies'); -define('STYLES_TABLE', $table_prefix.'styles'); -define('STYLES_TPL_TABLE', $table_prefix.'styles_template'); -define('STYLES_TPLDATA_TABLE', $table_prefix.'styles_template_data'); -define('STYLES_CSS_TABLE', $table_prefix.'styles_theme'); -define('STYLES_IMAGE_TABLE', $table_prefix.'styles_imageset'); -define('TOPICS_TABLE', $table_prefix.'topics'); -define('TOPICS_POSTED_TABLE', $table_prefix.'topics_posted'); -define('TOPICS_WATCH_TABLE', $table_prefix.'topics_watch'); -define('TOPICS_TRACK_TABLE', $table_prefix.'topics_marking'); -define('USER_GROUP_TABLE', $table_prefix.'user_group'); -define('USERS_TABLE', $table_prefix.'users'); -define('USERS_NOTES_TABLE', $table_prefix.'users_notes'); -define('WARNINGS_TABLE', $table_prefix.'warnings'); -define('WORDS_TABLE', $table_prefix.'words'); -define('POLL_OPTIONS_TABLE', $table_prefix.'poll_results'); -define('POLL_VOTES_TABLE', $table_prefix.'poll_voters'); -define('ZEBRA_TABLE', $table_prefix.'zebra'); - -// Additional tables - ?>
\ No newline at end of file diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 83e08a9d9a..4ccdc1b3ec 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -141,8 +141,8 @@ function unique_id($extra = 'c') $val = $config['rand_seed'] . microtime(); $val = md5($val); $config['rand_seed'] = md5($config['rand_seed'] . $val . $extra); - - if($dss_seeded !== true) + + if ($dss_seeded !== true) { set_config('rand_seed', $config['rand_seed']); $dss_seeded = true; @@ -2194,7 +2194,12 @@ function msg_handler($errno, $msg_text, $errfile, $errline) echo ' <h1>General Error</h1>'; echo ' <h2>' . $msg_text . '</h2>'; - echo ' <p>Please notify the board administrator or webmaster : <a href="mailto:' . $config['board_contact'] . '">' . $config['board_contact'] . '</a></p>'; + + 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>'; @@ -2597,7 +2602,7 @@ function page_footer() $db->sql_report('display'); } - $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress']) ? 'On' : 'Off' ) . ' | Load : ' . (($user->load) ? $user->load : 'N/A'), $totaltime); + $debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress']) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime); if ($auth->acl_get('a_') && defined('DEBUG_EXTRA')) { diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index b64e2b2ad0..3292e9a43f 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -396,7 +396,13 @@ function generate_forum_rules(&$forum_data) */ function generate_forum_nav(&$forum_data) { - global $db, $user, $template, $phpEx, $SID, $phpbb_root_path; + global $db, $user, $template, $auth; + global $phpEx, $SID, $phpbb_root_path; + + if (!$auth->acl_get('f_list', $forum_data['forum_id'])) + { + return; + } // Get forum parents $forum_parents = get_forum_parents($forum_data); @@ -406,6 +412,12 @@ function generate_forum_nav(&$forum_data) { list($parent_name, $parent_type) = array_values($parent_data); + // Skip this parent if the user does not have the permission to view it + if (!$auth->acl_get('f_list', $parent_forum_id)) + { + continue; + } + $template->assign_block_vars('navlinks', array( 'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false, 'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false, @@ -575,7 +587,7 @@ function get_moderators(&$forum_moderators, $forum_id = false) */ function gen_forum_auth_level($mode, $forum_id, $forum_status) { - global $SID, $template, $auth, $user; + global $SID, $template, $auth, $user, $config; $locked = ($forum_status == ITEM_LOCKED && !$auth->acl_get('m_edit', $forum_id)) ? true : false; @@ -584,9 +596,13 @@ function gen_forum_auth_level($mode, $forum_id, $forum_status) ($auth->acl_get('f_reply', $forum_id) && !$locked) ? $user->lang['RULES_REPLY_CAN'] : $user->lang['RULES_REPLY_CANNOT'], ($auth->acl_gets('f_edit', 'm_edit', $forum_id) && !$locked) ? $user->lang['RULES_EDIT_CAN'] : $user->lang['RULES_EDIT_CANNOT'], ($auth->acl_gets('f_delete', 'm_delete', $forum_id) && !$locked) ? $user->lang['RULES_DELETE_CAN'] : $user->lang['RULES_DELETE_CANNOT'], - ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && !$locked) ? $user->lang['RULES_ATTACH_CAN'] : $user->lang['RULES_ATTACH_CANNOT'] ); + if ($config['allow_attachments']) + { + $rules[] = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && !$locked) ? $user->lang['RULES_ATTACH_CAN'] : $user->lang['RULES_ATTACH_CANNOT']; + } + foreach ($rules as $rule) { $template->assign_block_vars('rules', array('RULE' => $rule)); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 03f1c962ee..904a56d090 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -810,10 +810,10 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id $poster = $row['username']; // Handle anon users posting with usernames - if ($poster_id == ANONYMOUS && $row['post_username']) + if ($poster_id == ANONYMOUS) { - $poster = $row['post_username']; - $poster_rank = $user->lang['GUEST']; + $poster = ($row['post_username']) ? $row['post_username'] : $user->lang['GUEST']; + $poster_rank = ($row['post_username']) ? $user->lang['GUEST'] : ''; } $post_subject = $row['post_subject']; diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index b94d873a88..59cf1715a4 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -93,6 +93,11 @@ class mcp_queue // Set some vars $poster = ($post_info['user_colour']) ? '<span style="color:#' . $post_info['user_colour'] . '">' . $post_info['username'] . '</span>' : $post_info['username']; + if ($post_info['user_id'] == ANONYMOUS) + { + $poster = ($post_info['post_username']) ? $post_info['post_username'] : $user->lang['GUEST']; + } + // Process message, leave it uncensored $message = $post_info['post_text']; if ($post_info['bbcode_bitfield']) @@ -112,7 +117,7 @@ class mcp_queue 'S_POST_LOCKED' => $post_info['post_edit_locked'], 'S_USER_NOTES' => $auth->acl_gets('m_', 'a_') ? true : false, - 'U_VIEW_PROFILE' => "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $post_info['user_id'], + 'U_VIEW_PROFILE' => ($post_info['user_id'] != ANONYMOUS) ? "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $post_info['user_id'] : '', 'U_MCP_USER_NOTES' => "{$phpbb_root_path}mcp.$phpEx$SID&i=notes&mode=user_notes&u=" . $post_info['user_id'], 'U_MCP_WARN_USER' => "{$phpbb_root_path}mcp.$phpEx$SID&i=warn&mode=warn_user&u=" . $post_info['user_id'], 'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? "{$phpbb_root_path}posting.$phpEx$SID&mode=edit&f={$post_info['forum_id']}&p={$post_info['post_id']}" : '', diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 9b43b4d43c..1fc21ffc8b 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -196,7 +196,7 @@ class fulltext_mysql extends search_backend for ($i = 0, $n = sizeof($text); $i < $n; $i++) { $text[$i] = trim($text[$i]); - if (strlen($text[$i]) < $config['fulltext_mysql_min_word_len'] || strlen($text[$i]) > $this->config['fulltext_mysql_max_word_len']) + if (strlen($text[$i]) < $config['fulltext_mysql_min_word_len'] || strlen($text[$i]) > $config['fulltext_mysql_max_word_len']) { unset($text[$i]); } diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 88a7c6563c..3ea20541ab 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -139,17 +139,29 @@ class session $this->ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : ''; // Load limit check (if applicable) - if (@file_exists('/proc/loadavg') && @is_readable('/proc/loadavg')) + if ($config['limit_load']) { - if ($load = @file_get_contents('/proc/loadavg')) + if (@file_exists('/proc/loadavg') && @is_readable('/proc/loadavg')) { - $this->load = floatval(array_slice(explode(' ', $load), 0, 1)); + if ($load = @file_get_contents('/proc/loadavg')) + { + $this->load = array_slice(explode(' ', $load), 0, 1); + $this->load = floatval($this->load[0]); - if ($config['limit_load'] && $this->load > floatval($config['limit_load'])) + if ($config['limit_load'] && $this->load > floatval($config['limit_load'])) + { + trigger_error('BOARD_UNAVAILABLE'); + } + } + else { - trigger_error('BOARD_UNAVAILABLE'); + set_config('limit_load', '0'); } } + else + { + set_config('limit_load', '0'); + } } // Is session_id is set or session_id is set and matches the url param if required @@ -1075,7 +1087,7 @@ class user extends session { global $SID; - if (strpos($this->page['page_query'], 'mode=reg_details') !== false && $this->page['page_name'] == "ucp.$phpEx") + if (strpos($this->page['query_string'], 'mode=reg_details') !== false && $this->page['page_name'] == "ucp.$phpEx") { redirect("ucp.$phpEx$SID&i=profile&mode=reg_details"); } diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 4f87ba8983..d8a131d09f 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -565,6 +565,10 @@ class ucp_profile $filename = ''; $type = $width = $height = 0; } + else + { + $data = array(); + } } if (!sizeof($error)) diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index e061aa590c..1b42030839 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -70,8 +70,7 @@ class ucp_zebra $db->sql_freeresult($result); $add = array_diff($add, $friends, $foes, array($user->data['username'])); - unset($friends); - unset($foes); + unset($friends, $foes); $add = implode(', ', preg_replace('#^[\s]*?(.*?)[\s]*?$#e', "\"'\" . \$db->sql_escape('\\1') . \"'\"", $add)); @@ -102,10 +101,12 @@ class ucp_zebra { foreach ($forum_ary as $auth_option => $user_ary) { - $perms += $user_ary; + $perms = array_merge($perms, $user_ary); } } + $perms = array_unique($perms); + // This may not be right ... it may yield true when perms equate to deny $user_id_ary = array_diff($user_id_ary, $perms); unset($perms); @@ -115,32 +116,33 @@ class ucp_zebra { $sql_mode = ($mode == 'friends') ? 'friend' : 'foe'; - switch (SQL_LAYER) + $sql_ary = array(); + foreach ($user_id_ary as $zebra_id) { - case 'mysql': - $sql = 'INSERT INTO ' . ZEBRA_TABLE . " (user_id, zebra_id, $sql_mode) - VALUES " . implode(', ', preg_replace('#^([0-9]+)$#', '(' . $user->data['user_id'] . ", \\1, 1)", $user_id_ary)); - $db->sql_query($sql); - break; + $sql_ary[] = array( + 'user_id' => $user->data['user_id'], + 'zebra_id' => (int) $zebra_id, + $sql_mode => 1 + ); + } - case 'mysql4': - case 'mysqli': - case 'mssql': - case 'mssql_odbc': - case 'sqlite': - $sql = 'INSERT INTO ' . ZEBRA_TABLE . " (user_id, zebra_id, $sql_mode) - VALUES " . implode(' UNION ALL ', preg_replace('#^([0-9]+)$#', '(' . $user->data['user_id'] . ", \\1, 1)", $user_id_ary)); - $db->sql_query($sql); + if (sizeof($sql_ary)) + { + switch (SQL_LAYER) + { + case 'mysql': + case 'mysql4': + case 'mysqli': + $db->sql_query('INSERT INTO ' . ZEBRA_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_ary)); break; - default: - foreach ($user_id_ary as $zebra_id) - { - $sql = 'INSERT INTO ' . ZEBRA_TABLE . " (user_id, zebra_id, $sql_mode) - VALUES (" . $user->data['user_id'] . ", $zebra_id, 1)"; - $db->sql_query($sql); - } + default: + foreach ($sql_ary as $ary) + { + $db->sql_query('INSERT INTO ' . ZEBRA_TABLE . ' ' . $db->sql_build_array('INSERT', $ary)); + } break; + } } } else |