mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
"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
This commit is contained in:
parent
ef427b6483
commit
816bc5da61
9 changed files with 125 additions and 64 deletions
|
@ -2916,12 +2916,9 @@ function add_permission_language()
|
||||||
{
|
{
|
||||||
global $user, $phpEx;
|
global $user, $phpEx;
|
||||||
|
|
||||||
// First of all, our own file.
|
|
||||||
$user->add_lang('acp/permissions_phpbb');
|
|
||||||
|
|
||||||
$files_to_add = array();
|
$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)
|
foreach (array('acp/', 'mods/') as $path)
|
||||||
{
|
{
|
||||||
$dh = @opendir($user->lang_path . $path);
|
$dh = @opendir($user->lang_path . $path);
|
||||||
|
@ -2930,7 +2927,7 @@ function add_permission_language()
|
||||||
{
|
{
|
||||||
while (($file = readdir($dh)) !== false)
|
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));
|
$files_to_add[] = $path . substr($file, 0, -(strlen($phpEx) + 1));
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,7 @@ class p_master
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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 = '';
|
$token = '';
|
||||||
}
|
}
|
||||||
|
@ -314,7 +314,7 @@ class p_master
|
||||||
$forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id;
|
$forum_id = ($forum_id === false) ? $this->acl_forum_id : $forum_id;
|
||||||
|
|
||||||
$is_auth = false;
|
$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;
|
return $is_auth;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,11 +72,24 @@ function compose_pm($id, $mode, $action)
|
||||||
{
|
{
|
||||||
if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm'))
|
if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm'))
|
||||||
{
|
{
|
||||||
$sql = 'SELECT group_id, group_name, group_type
|
$sql = 'SELECT g.group_id, g.group_name, g.group_type
|
||||||
FROM ' . GROUPS_TABLE . '
|
FROM ' . GROUPS_TABLE . ' g';
|
||||||
WHERE group_type <> ' . GROUP_HIDDEN . '
|
|
||||||
AND group_receive_pm = 1
|
if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
||||||
ORDER BY group_type DESC';
|
{
|
||||||
|
$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);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$group_options = '';
|
$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
|
$sql = 'SELECT user_id as id, username as name, user_colour as colour
|
||||||
FROM ' . USERS_TABLE . '
|
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);
|
$result['u'] = $db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($address_list['g']))
|
if (!empty($address_list['g']))
|
||||||
{
|
{
|
||||||
$sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type
|
$sql = 'SELECT g.group_id AS id, g.group_name AS name, g.group_colour AS colour, g.group_type
|
||||||
FROM ' . GROUPS_TABLE . '
|
FROM ' . GROUPS_TABLE . ' g';
|
||||||
WHERE group_receive_pm = 1
|
|
||||||
AND group_type <> ' . GROUP_HIDDEN . '
|
if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
||||||
AND ' . $db->sql_in_set('group_id', array_map('intval', array_keys($address_list['g'])));
|
{
|
||||||
|
$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);
|
$result['g'] = $db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,16 @@ $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';
|
$l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
|
||||||
|
|
||||||
// Grab group details for legend display
|
// Grab group details for legend display
|
||||||
$sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
|
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
|
FROM ' . GROUPS_TABLE . ' g
|
||||||
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
|
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
|
||||||
ON (
|
ON (
|
||||||
|
@ -47,6 +56,7 @@ $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
|
||||||
WHERE g.group_legend = 1
|
WHERE g.group_legend = 1
|
||||||
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
|
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
|
||||||
ORDER BY g.group_name ASC';
|
ORDER BY g.group_name ASC';
|
||||||
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$legend = '';
|
$legend = '';
|
||||||
|
|
|
@ -406,7 +406,7 @@ switch ($mode)
|
||||||
$sql = 'SELECT g.group_id, g.group_name, g.group_type
|
$sql = 'SELECT g.group_id, g.group_name, g.group_type
|
||||||
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
|
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
|
||||||
WHERE ug.user_id = $user_id
|
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
|
AND ug.user_pending = 0
|
||||||
ORDER BY g.group_type, g.group_name';
|
ORDER BY g.group_type, g.group_name';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
@ -1180,10 +1180,25 @@ switch ($mode)
|
||||||
$group_selected = request_var('search_group_id', 0);
|
$group_selected = request_var('search_group_id', 0);
|
||||||
$s_group_select = '<option value="0"' . ((!$group_selected) ? ' selected="selected"' : '') . '> </option>';
|
$s_group_select = '<option value="0"' . ((!$group_selected) ? ' selected="selected"' : '') . '> </option>';
|
||||||
|
|
||||||
|
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
||||||
|
{
|
||||||
$sql = 'SELECT group_id, group_name, group_type
|
$sql = 'SELECT group_id, group_name, group_type
|
||||||
FROM ' . GROUPS_TABLE . '
|
FROM ' . GROUPS_TABLE . '
|
||||||
WHERE group_type <> ' . GROUP_HIDDEN . '
|
|
||||||
ORDER BY group_name ASC';
|
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);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<dd>
|
<dd>
|
||||||
<!-- BEGIN to_recipient -->
|
<!-- BEGIN to_recipient -->
|
||||||
<!-- IF not to_recipient.S_FIRST_ROW and to_recipient.S_ROW_COUNT mod 2 eq 0 --></dd><dd><!-- ENDIF -->
|
<!-- 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 -->
|
<!-- 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 -->
|
<!-- END to_recipient -->
|
||||||
</dd>
|
</dd>
|
||||||
|
|
|
@ -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
|
// 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
|
// the number of stickies are not known
|
||||||
$sql = $db->sql_build_query('SELECT', $sql_array);
|
$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);
|
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
|
||||||
|
|
||||||
$shadow_topic_list = array();
|
$shadow_topic_list = array();
|
||||||
//$num_rows = 0;
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($row['topic_status'] == ITEM_MOVED)
|
if ($row['topic_status'] == ITEM_MOVED)
|
||||||
|
@ -424,30 +422,9 @@ while ($row = $db->sql_fetchrow($result))
|
||||||
|
|
||||||
$rowset[$row['topic_id']] = $row;
|
$rowset[$row['topic_id']] = $row;
|
||||||
$topic_list[] = $row['topic_id'];
|
$topic_list[] = $row['topic_id'];
|
||||||
// $num_rows++;
|
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$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 we have some shadow topics, update the rowset to reflect their topic information
|
||||||
if (sizeof($shadow_topic_list))
|
if (sizeof($shadow_topic_list))
|
||||||
{
|
{
|
||||||
|
@ -460,6 +437,17 @@ if (sizeof($shadow_topic_list))
|
||||||
{
|
{
|
||||||
$orig_topic_id = $shadow_topic_list[$row['topic_id']];
|
$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
|
// Do not include those topics the user has no permission to access
|
||||||
if (!$auth->acl_get('f_read', $row['forum_id']))
|
if (!$auth->acl_get('f_read', $row['forum_id']))
|
||||||
{
|
{
|
||||||
|
@ -483,6 +471,12 @@ if (sizeof($shadow_topic_list))
|
||||||
}
|
}
|
||||||
unset($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(
|
$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),
|
'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),
|
'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start),
|
||||||
|
|
|
@ -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);
|
$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
|
// Grab group details for legend display
|
||||||
$sql = 'SELECT group_id, group_name, group_colour, group_type
|
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
|
||||||
|
{
|
||||||
|
$sql = 'SELECT group_id, group_name, group_colour, group_type
|
||||||
FROM ' . GROUPS_TABLE . '
|
FROM ' . GROUPS_TABLE . '
|
||||||
WHERE group_legend = 1
|
WHERE group_legend = 1
|
||||||
AND group_type <> ' . GROUP_HIDDEN . '
|
|
||||||
ORDER BY group_name ASC';
|
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);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$legend = '';
|
$legend = '';
|
||||||
|
|
Loading…
Add table
Reference in a new issue