diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2007-04-30 13:32:18 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2007-04-30 13:32:18 +0000 |
commit | 816bc5da616f1326d97fa20ccf59f3b1bca9fe1d (patch) | |
tree | 912bfdefef01c5b362af07bce0517cea0a0983d2 /phpBB | |
parent | ef427b6483e89d797fed11485bdc857039d3b61f (diff) | |
download | forums-816bc5da616f1326d97fa20ccf59f3b1bca9fe1d.tar forums-816bc5da616f1326d97fa20ccf59f3b1bca9fe1d.tar.gz forums-816bc5da616f1326d97fa20ccf59f3b1bca9fe1d.tar.bz2 forums-816bc5da616f1326d97fa20ccf59f3b1bca9fe1d.tar.xz forums-816bc5da616f1326d97fa20ccf59f3b1bca9fe1d.zip |
"Ghost" topics in active topics list when shadow topics and corresponding topic in same resultset [#10313]
Find a member supporting hidden groups for those able to see them [#10305]
Display hidden groups for all those able to see them across the board (composing messages, viewonline)
Fix space for sending PM's to groups
Let the permissions_phpbb file be included the same way as all other permission files [#10301]
Add request_a-z+ handling within modules_auth suggested by Pyramide. This will allow modders to directly show/hide their module in addition to !empty() $_REQUEST variables. [#10297]
git-svn-id: file:///svn/phpbb/trunk@7433 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/functions_admin.php | 7 | ||||
-rw-r--r-- | phpBB/includes/functions_module.php | 4 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_compose.php | 51 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_options.php | 2 | ||||
-rw-r--r-- | phpBB/index.php | 32 | ||||
-rw-r--r-- | phpBB/memberlist.php | 25 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/posting_editor.html | 2 | ||||
-rw-r--r-- | phpBB/viewforum.php | 40 | ||||
-rw-r--r-- | phpBB/viewonline.php | 26 |
9 files changed, 125 insertions, 64 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index a96e6f7240..5a45b9f9dc 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2916,12 +2916,9 @@ function add_permission_language() { global $user, $phpEx; - // First of all, our own file. - $user->add_lang('acp/permissions_phpbb'); - $files_to_add = array(); - // Now search in acp and mods folder for permissions_ files. + // Search in acp and mods folder for permissions_ files. foreach (array('acp/', 'mods/') as $path) { $dh = @opendir($user->lang_path . $path); @@ -2930,7 +2927,7 @@ function add_permission_language() { while (($file = readdir($dh)) !== false) { - if (strpos($file, 'permissions_') === 0 && strpos($file, 'permissions_phpbb') === false && substr($file, -(strlen($phpEx) + 1)) === '.' . $phpEx) + if (strpos($file, 'permissions_') === 0 && substr($file, -(strlen($phpEx) + 1)) === '.' . $phpEx) { $files_to_add[] = $path . substr($file, 0, -(strlen($phpEx) + 1)); } diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 86cc93435d..bbb44d4b3d 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -298,7 +298,7 @@ class p_master break; default: - if (!preg_match('#(?:acl_([a-z_]+)(,\$id)?)|(?:\$id)|(?:aclf_([a-z_]+))|(?:cfg_([a-z_]+))#', $token)) + if (!preg_match('#(?:acl_([a-z_]+)(,\$id)?)|(?:\$id)|(?:aclf_([a-z_]+))|(?:cfg_([a-z_]+))|(?:request_([a-z_]+))#', $token)) { $token = ''; } @@ -314,7 +314,7 @@ class p_master $forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id; $is_auth = false; - eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z_]+)#', '#cfg_([a-z_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) $config[\'\\1\']'), $module_auth) . ');'); + eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z_]+)#', '#cfg_([a-z_]+)#', '#request_([a-z_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) $config[\'\\1\']', '!empty($_REQUEST[\'\\1\'])'), $module_auth) . ');'); return $is_auth; } diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 3cf3f41225..cc15cbc264 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -72,11 +72,24 @@ function compose_pm($id, $mode, $action) { if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) { - $sql = 'SELECT group_id, group_name, group_type - FROM ' . GROUPS_TABLE . ' - WHERE group_type <> ' . GROUP_HIDDEN . ' - AND group_receive_pm = 1 - ORDER BY group_type DESC'; + $sql = 'SELECT g.group_id, g.group_name, g.group_type + FROM ' . GROUPS_TABLE . ' g'; + + if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) + { + $sql .= ' LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; + } + + $sql .= ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' WHERE ' : ' AND '; + + $sql .= 'g.group_receive_pm = 1 + ORDER BY g.group_type DESC, g.group_name ASC'; $result = $db->sql_query($sql); $group_options = ''; @@ -731,17 +744,33 @@ function compose_pm($id, $mode, $action) { $sql = 'SELECT user_id as id, username as name, user_colour as colour FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', array_map('intval', array_keys($address_list['u']))); + WHERE ' . $db->sql_in_set('user_id', array_map('intval', array_keys($address_list['u']))) . ' + ORDER BY username_clean ASC'; $result['u'] = $db->sql_query($sql); } if (!empty($address_list['g'])) { - $sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type - FROM ' . GROUPS_TABLE . ' - WHERE group_receive_pm = 1 - AND group_type <> ' . GROUP_HIDDEN . ' - AND ' . $db->sql_in_set('group_id', array_map('intval', array_keys($address_list['g']))); + $sql = 'SELECT g.group_id AS id, g.group_name AS name, g.group_colour AS colour, g.group_type + FROM ' . GROUPS_TABLE . ' g'; + + if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) + { + $sql .= ' LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; + } + + $sql .= ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' WHERE ' : ' AND '; + + $sql .= 'g.group_receive_pm = 1 + AND ' . $db->sql_in_set('g.group_id', array_map('intval', array_keys($address_list['g']))) . ' + ORDER BY g.group_name ASC'; + $result['g'] = $db->sql_query($sql); } diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php index cb55236936..f242c864b6 100644 --- a/phpBB/includes/ucp/ucp_pm_options.php +++ b/phpBB/includes/ucp/ucp_pm_options.php @@ -717,7 +717,7 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule AND ug.user_id = ' . $user->data['user_id'] . ' AND ug.user_pending = 0 ) - WHERE (ug.user_id = ' . $user->data['user_id'] . ' OR g.group_type <> ' . GROUP_HIDDEN . ') + WHERE (ug.user_id = ' . $user->data['user_id'] . ' OR g.group_type <> ' . GROUP_HIDDEN . ') AND'; } else diff --git a/phpBB/index.php b/phpBB/index.php index daa89f2503..209bcfc2bd 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -36,17 +36,27 @@ $l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER' $l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER'; // Grab group details for legend display -$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type - FROM ' . GROUPS_TABLE . ' g - LEFT JOIN ' . USER_GROUP_TABLE . ' ug - ON ( - g.group_id = ug.group_id - AND ug.user_id = ' . $user->data['user_id'] . ' - AND ug.user_pending = 0 - ) - WHERE g.group_legend = 1 - AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ') - ORDER BY g.group_name ASC'; +if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) +{ + $sql = 'SELECT group_id, group_name, group_colour, group_type + FROM ' . GROUPS_TABLE . ' + WHERE group_legend = 1 + ORDER BY group_name ASC'; +} +else +{ + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE g.group_legend = 1 + AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ') + ORDER BY g.group_name ASC'; +} $result = $db->sql_query($sql); $legend = ''; diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index d65ea1a167..11aeda5dca 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -406,7 +406,7 @@ switch ($mode) $sql = 'SELECT g.group_id, g.group_name, g.group_type FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug WHERE ug.user_id = $user_id - AND g.group_id = ug.group_id" . ((!$auth->acl_get('a_group')) ? ' AND g.group_type <> ' . GROUP_HIDDEN : '') . ' + AND g.group_id = ug.group_id" . ((!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' AND g.group_type <> ' . GROUP_HIDDEN : '') . ' AND ug.user_pending = 0 ORDER BY g.group_type, g.group_name'; $result = $db->sql_query($sql); @@ -1180,10 +1180,25 @@ switch ($mode) $group_selected = request_var('search_group_id', 0); $s_group_select = '<option value="0"' . ((!$group_selected) ? ' selected="selected"' : '') . '> </option>'; - $sql = 'SELECT group_id, group_name, group_type - FROM ' . GROUPS_TABLE . ' - WHERE group_type <> ' . GROUP_HIDDEN . ' - ORDER BY group_name ASC'; + if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) + { + $sql = 'SELECT group_id, group_name, group_type + FROM ' . GROUPS_TABLE . ' + ORDER BY group_name ASC'; + } + else + { + $sql = 'SELECT g.group_id, g.group_name, g.group_type + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ') + ORDER BY g.group_name ASC'; + } $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 4c675e4cf8..304deef6ba 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -11,7 +11,7 @@ <dd> <!-- BEGIN to_recipient --> <!-- IF not to_recipient.S_FIRST_ROW and to_recipient.S_ROW_COUNT mod 2 eq 0 --></dd><dd><!-- ENDIF --> - <!-- IF to_recipient.IS_GROUP --><a href="{to_recipient.U_VIEW}"><strong>{to_recipient.NAME}</strong></a><!-- ELSE -->{to_recipient.NAME_FULL} <!-- ENDIF --> + <!-- IF to_recipient.IS_GROUP --><a href="{to_recipient.U_VIEW}"><strong>{to_recipient.NAME}</strong></a> <!-- ELSE -->{to_recipient.NAME_FULL} <!-- ENDIF --> <!-- IF not S_EDIT_POST --><input type="submit" name="remove_{to_recipient.TYPE}[{to_recipient.UG_ID}]" value="x" class="button2" /> <!-- ENDIF --> <!-- END to_recipient --> </dd> diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index ab5150bf8d..554bda47b5 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -410,11 +410,9 @@ $sql_array = array( // Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because // the number of stickies are not known $sql = $db->sql_build_query('SELECT', $sql_array); -//$sql = str_replace('{SQL_TOPIC_TYPE}', ($store_reverse) ? POST_NORMAL : POST_STICKY, $sql); $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); $shadow_topic_list = array(); -//$num_rows = 0; while ($row = $db->sql_fetchrow($result)) { if ($row['topic_status'] == ITEM_MOVED) @@ -424,30 +422,9 @@ while ($row = $db->sql_fetchrow($result)) $rowset[$row['topic_id']] = $row; $topic_list[] = $row['topic_id']; -// $num_rows++; } $db->sql_freeresult($result); -/* If the number of topics exceeds the sql limit then we do not need to retrieve the remaining topic type -if ($num_rows < $sql_limit) -{ - $sql = $db->sql_build_query('SELECT', $sql_array); - $sql = str_replace('{SQL_TOPIC_TYPE}', ($store_reverse) ? POST_STICKY : POST_NORMAL, $sql); - $result = $db->sql_query_limit($sql, $sql_limit - $num_rows, $sql_start); - - while ($row = $db->sql_fetchrow($result)) - { - if ($row['topic_status'] == ITEM_MOVED) - { - $shadow_topic_list[$row['topic_moved_id']] = $row['topic_id']; - } - - $rowset[$row['topic_id']] = $row; - $topic_list[] = $row['topic_id']; - } - $db->sql_freeresult($result); -} -*/ // If we have some shadow topics, update the rowset to reflect their topic information if (sizeof($shadow_topic_list)) { @@ -460,6 +437,17 @@ if (sizeof($shadow_topic_list)) { $orig_topic_id = $shadow_topic_list[$row['topic_id']]; + // If the shadow topic is already listed within the rowset (happens for active topics for example), then do not include it... + if (isset($rowset[$row['topic_id']])) + { + // We need to remove any trace regarding this topic. :) + unset($rowset[$orig_topic_id]); + unset($topic_list[array_search($orig_topic_id, $topic_list)]); + $topics_count--; + + continue; + } + // Do not include those topics the user has no permission to access if (!$auth->acl_get('f_read', $row['forum_id'])) { @@ -483,6 +471,12 @@ if (sizeof($shadow_topic_list)) } unset($shadow_topic_list); +// Ok, adjust topics count for active topics list +if ($s_display_active) +{ + $topics_count = 1; +} + $template->assign_vars(array( 'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&$u_sort_param"), $topics_count, $config['topics_per_page'], $start), 'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start), diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 785dce5229..4a862c4367 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -363,11 +363,27 @@ unset($vars_online); $pagination = generate_pagination(append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir"), $counter, $config['topics_per_page'], $start); // Grab group details for legend display -$sql = 'SELECT group_id, group_name, group_colour, group_type - FROM ' . GROUPS_TABLE . ' - WHERE group_legend = 1 - AND group_type <> ' . GROUP_HIDDEN . ' - ORDER BY group_name ASC'; +if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) +{ + $sql = 'SELECT group_id, group_name, group_colour, group_type + FROM ' . GROUPS_TABLE . ' + WHERE group_legend = 1 + ORDER BY group_name ASC'; +} +else +{ + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE g.group_legend = 1 + AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ') + ORDER BY g.group_name ASC'; +} $result = $db->sql_query($sql); $legend = ''; |