1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-09 02:06:32 +02:00

- allow user A to have user B as a friend if A is a foe of B

- don't allow users to have the Anonymous user on their foe/friend list [Bug #1205]
- properly hide users on the online/offline friend list in ucp [Bug #1206]


git-svn-id: file:///svn/phpbb/trunk@5836 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Nils Adermann
2006-04-23 13:08:48 +00:00
parent a58fa3a9f2
commit d9576fd70b
3 changed files with 10 additions and 30 deletions

View File

@@ -87,12 +87,15 @@ class ucp_zebra
$user_id_ary = array();
do
{
$user_id_ary[] = $row['user_id'];
if ($row['user_id'] != ANONYMOUS)
{
$user_id_ary[] = $row['user_id'];
}
}
while ($row = $db->sql_fetchrow($result));
// Remove users from foe list if they are admins or moderators
if ($mode == 'foes')
if (($mode == 'foes') && sizeof($user_id_ary))
{
$perms = array();
foreach ($auth->acl_get_list($user_id_ary, array('a_', 'm_')) as $forum_id => $forum_ary)
@@ -108,29 +111,6 @@ class ucp_zebra
unset($perms);
}
// Do not let add users to friends if the user is within the foes list of the to-be-added users
if ($mode == 'friends' && sizeof($user_id_ary))
{
$sql = 'SELECT user_id
FROM ' . ZEBRA_TABLE . '
WHERE user_id IN (' . implode(', ', $user_id_ary) . ')
AND zebra_id = ' . $user->data['user_id'] . '
AND foe = 1';
$result = $db->sql_query($sql);
$remove_user_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$remove_user_ids[] = $row['user_id'];
}
if (sizeof($remove_user_ids))
{
$user_id_ary = array_diff($user_id_ary, $remove_user_ids);
}
unset($remove_user_ids);
}
if (sizeof($user_id_ary))
{
$sql_mode = ($mode == 'friends') ? 'friend' : 'foe';