- fix some group specific bugs

- correctly determining terrafrost's birthday mod


git-svn-id: file:///svn/phpbb/trunk@7143 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2007-03-07 16:55:20 +00:00
parent 4eac4b268b
commit d1e839625e
10 changed files with 60 additions and 24 deletions

View file

@ -65,7 +65,7 @@
<dd><input name="group_legend" type="checkbox" class="radio" id="group_legend"{GROUP_LEGEND} /></dd> <dd><input name="group_legend" type="checkbox" class="radio" id="group_legend"{GROUP_LEGEND} /></dd>
</dl> </dl>
<dl> <dl>
<dt><label for="group_receive_pm">{L_GROUP_RECEIVE_PM}:</label></dt> <dt><label for="group_receive_pm">{L_GROUP_RECEIVE_PM}:</label><br /><span>{L_GROUP_RECEIVE_PM_EXPLAIN}</span></dt>
<dd><input name="group_receive_pm" type="checkbox" class="radio" id="group_receive_pm"{GROUP_RECEIVE_PM} /></dd> <dd><input name="group_receive_pm" type="checkbox" class="radio" id="group_receive_pm"{GROUP_RECEIVE_PM} /></dd>
</dl> </dl>
<dl> <dl>

View file

@ -3151,8 +3151,15 @@ function get_backtrace()
} }
// Strip the current directory from path // Strip the current directory from path
$trace['file'] = str_replace(array($path, '\\'), array('', '/'), $trace['file']); if (empty($trace['file']))
$trace['file'] = substr($trace['file'], 1); {
$trace['file'] = '';
}
else
{
$trace['file'] = str_replace(array($path, '\\'), array('', '/'), $trace['file']);
$trace['file'] = substr($trace['file'], 1);
}
$args = array(); $args = array();
// If include/require/include_once is not called, do not show arguments - they may contain sensible information // If include/require/include_once is not called, do not show arguments - they may contain sensible information
@ -3177,7 +3184,7 @@ function get_backtrace()
$output .= '<br />'; $output .= '<br />';
$output .= '<b>FILE:</b> ' . htmlspecialchars($trace['file']) . '<br />'; $output .= '<b>FILE:</b> ' . htmlspecialchars($trace['file']) . '<br />';
$output .= '<b>LINE:</b> ' . $trace['line'] . '<br />'; $output .= '<b>LINE:</b> ' . ((!empty($trace['line'])) ? $trace['line'] : '') . '<br />';
$output .= '<b>CALL:</b> ' . htmlspecialchars($trace['class'] . $trace['type'] . $trace['function']) . '(' . ((sizeof($args)) ? implode(', ', $args) : '') . ')<br />'; $output .= '<b>CALL:</b> ' . htmlspecialchars($trace['class'] . $trace['type'] . $trace['function']) . '(' . ((sizeof($args)) ? implode(', ', $args) : '') . ')<br />';
} }

View file

@ -2390,7 +2390,7 @@ function get_group_name($group_id)
/** /**
* Obtain either the members of a specified group, the groups the specified user is subscribed to * Obtain either the members of a specified group, the groups the specified user is subscribed to
* or checking if a specified user is in a specified group * or checking if a specified user is in a specified group. This function does not return pending memberships.
* *
* Note: Never use this more than once... first group your users/groups * Note: Never use this more than once... first group your users/groups
*/ */

View file

@ -143,8 +143,22 @@ class ucp_groups
case 'join': case 'join':
if (group_memberships($group_id, $user->data['user_id'], true)) $sql = 'SELECT ug.*, u.username, u.username_clean, u.user_email
FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u
WHERE ug.user_id = u.user_id
AND ug.group_id = ' . $group_id . '
AND ug.user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row)
{ {
if ($row['user_pending'])
{
trigger_error($user->lang['ALREADY_IN_GROUP_PENDING'] . $return_page);
}
trigger_error($user->lang['ALREADY_IN_GROUP'] . $return_page); trigger_error($user->lang['ALREADY_IN_GROUP'] . $return_page);
} }
@ -817,7 +831,7 @@ class ucp_groups
// Approve, demote or promote // Approve, demote or promote
group_user_attributes('approve', $group_id, $mark_ary, false, ($group_id) ? $group_row['group_name'] : false); group_user_attributes('approve', $group_id, $mark_ary, false, ($group_id) ? $group_row['group_name'] : false);
trigger_error($user->lang['USERS_APPROVED'] . $return_page); trigger_error($user->lang['USERS_APPROVED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&amp;action=list&amp;g=' . $group_id . '">', '</a>'));
break; break;
@ -881,7 +895,7 @@ class ucp_groups
$user->add_lang('acp/groups'); $user->add_lang('acp/groups');
trigger_error($user->lang['GROUP_DEFS_UPDATED'] . $return_page); trigger_error($user->lang['GROUP_DEFS_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&amp;action=list&amp;g=' . $group_id . '">', '</a>'));
} }
else else
{ {
@ -924,10 +938,10 @@ class ucp_groups
if ($error) if ($error)
{ {
trigger_error($user->lang[$error] . $return_page); trigger_error($user->lang[$error] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&amp;action=list&amp;g=' . $group_id . '">', '</a>'));
} }
trigger_error($user->lang['GROUP_USERS_REMOVE'] . $return_page); trigger_error($user->lang['GROUP_USERS_REMOVE'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&amp;action=list&amp;g=' . $group_id . '">', '</a>'));
} }
else else
{ {
@ -980,7 +994,7 @@ class ucp_groups
trigger_error($user->lang[$error] . $return_page); trigger_error($user->lang[$error] . $return_page);
} }
trigger_error($user->lang['GROUP_USERS_ADDED'] . $return_page); trigger_error($user->lang['GROUP_USERS_ADDED'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '&amp;action=list&amp;g=' . $group_id . '">', '</a>'));
break; break;

View file

@ -74,7 +74,7 @@ function compose_pm($id, $mode, $action)
{ {
$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 NOT IN (' . GROUP_HIDDEN . ', ' . GROUP_CLOSED . ') WHERE group_type <> ' . GROUP_HIDDEN . '
AND group_receive_pm = 1 AND group_receive_pm = 1
ORDER BY group_type DESC'; ORDER BY group_type DESC';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -730,6 +730,7 @@ function compose_pm($id, $mode, $action)
$sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type $sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type
FROM ' . GROUPS_TABLE . ' FROM ' . GROUPS_TABLE . '
WHERE group_receive_pm = 1 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']))); AND ' . $db->sql_in_set('group_id', array_map('intval', array_keys($address_list['g'])));
$result['g'] = $db->sql_query($sql); $result['g'] = $db->sql_query($sql);
} }

View file

@ -36,16 +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'; $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 group_id, group_name, group_colour, group_type $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id
FROM ' . GROUPS_TABLE . ' FROM ' . GROUPS_TABLE . ' g
WHERE group_legend = 1 LEFT JOIN ' . USER_GROUP_TABLE . ' ug
AND group_type <> ' . GROUP_HIDDEN . ' ON (
ORDER BY group_name ASC'; g.group_id = ug.group_id
AND g.group_type = ' . GROUP_HIDDEN . '
AND ug.user_id = ' . $user->data['user_id'] . '
AND ug.user_pending = 0
)
WHERE g.group_legend = 1
ORDER BY g.group_name ASC';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$legend = ''; $legend = '';
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
if ($row['group_type'] == GROUP_HIDDEN && empty($row['user_id']))
{
continue;
}
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : ''; $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
if ($row['group_name'] == 'BOTS') if ($row['group_name'] == 'BOTS')

View file

@ -158,7 +158,7 @@ if (!$get_info)
} }
// TerraFrost's validated birthday mod // TerraFrost's validated birthday mod
if (get_config_value('bday_required') !== false) if (get_config_value('bday_require') !== false)
{ {
define('MOD_BIRTHDAY_TERRA', true); define('MOD_BIRTHDAY_TERRA', true);
} }

View file

@ -81,6 +81,7 @@ $lang = array_merge($lang, array(
'GROUP_PROMOTE' => 'Promote to group leader', 'GROUP_PROMOTE' => 'Promote to group leader',
'GROUP_RANK' => 'Group rank', 'GROUP_RANK' => 'Group rank',
'GROUP_RECEIVE_PM' => 'Group able to receive private messages', 'GROUP_RECEIVE_PM' => 'Group able to receive private messages',
'GROUP_RECEIVE_PM_EXPLAIN' => 'Please note that hidden groups are not able to be messaged, regardless of this setting.',
'GROUP_REQUEST' => 'Request', 'GROUP_REQUEST' => 'Request',
'GROUP_SETTINGS' => 'Set user preferences', 'GROUP_SETTINGS' => 'Set user preferences',
'GROUP_SETTINGS_EXPLAIN' => 'Here you can force changes in users current preferences. Please note these settings are not saved for the group itself. They are intended as a quick method of altering the preferences of all users in this group.', 'GROUP_SETTINGS_EXPLAIN' => 'Here you can force changes in users current preferences. Please note these settings are not saved for the group itself. They are intended as a quick method of altering the preferences of all users in this group.',

View file

@ -31,10 +31,11 @@ if (empty($lang) || !is_array($lang))
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array( $lang = array_merge($lang, array(
'ALREADY_DEFAULT_GROUP' => 'The selected group is already your default group', 'ALREADY_DEFAULT_GROUP' => 'The selected group is already your default group.',
'ALREADY_IN_GROUP' => 'You are already a member of the selected group', 'ALREADY_IN_GROUP' => 'You are already a member of the selected group.',
'ALREADY_IN_GROUP_PENDING' => 'You already requested joining the selected group.',
'CHANGED_DEFAULT_GROUP' => 'Successfully changed default group', 'CHANGED_DEFAULT_GROUP' => 'Successfully changed default group.',
'GROUP_AVATAR' => 'Group avatar', 'GROUP_AVATAR' => 'Group avatar',
'GROUP_CHANGE_DEFAULT' => 'Are you sure you want to change your default membership to the group “%s”?', 'GROUP_CHANGE_DEFAULT' => 'Are you sure you want to change your default membership to the group “%s”?',

View file

@ -202,13 +202,14 @@ switch ($mode)
} }
} }
// If the mod is only moderating non-viewable forums let us display this circumstance // If the mod is only moderating non-viewable forums we skip the user. There is no gain in displaying the person then...
// instead of saying they are moderating all forums
if (!$s_forum_select && $undisclosed_forum) if (!$s_forum_select && $undisclosed_forum)
{ {
$s_forum_select = '<option value="">' . $user->lang['FORUM_UNDISCLOSED'] . '</option>'; // $s_forum_select = '<option value="">' . $user->lang['FORUM_UNDISCLOSED'] . '</option>';
continue;
} }
// The person is moderating several "public" forums, therefore the person should be listed, but not giving the real group name if hidden.
if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id']) if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id'])
{ {
$group_name = $user->lang['GROUP_UNDISCLOSED']; $group_name = $user->lang['GROUP_UNDISCLOSED'];