diff -r 32429702305e -r c72b545f1304 plugins/SpecialGroups.php --- a/plugins/SpecialGroups.php Fri Dec 21 19:08:27 2007 -0500 +++ b/plugins/SpecialGroups.php Wed Dec 26 00:37:26 2007 -0500 @@ -20,10 +20,10 @@ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. */ -$plugins->attachHook('base_classes_initted', ' +$plugins->attachHook('session_started', ' global $paths; $paths->add_page(Array( - \'name\'=>\'Group Membership\', + \'name\'=>\'specialpage_groupcp\', \'urlname\'=>\'Usergroups\', \'namespace\'=>\'Special\', \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', @@ -34,6 +34,7 @@ { global $db, $session, $paths, $template, $plugins; // Common objects global $email; // Import e-mail encryption functions + global $lang; if ( !$session->user_logged_in ) { @@ -43,6 +44,7 @@ } $template->header(); + userprefs_show_menu(); if ( isset($_POST['do_view']) || isset($_POST['do_view_n']) || ( isset($_GET['act']) && isset($_POST['group_id']) ) ) { $gid = ( isset ( $_POST['do_view_n'] ) ) ? intval($_POST['group_id_n']) : intval($_POST['group_id']); @@ -102,20 +104,20 @@ } $status = ( $is_member && $is_mod ) - ? 'You are a moderator of this group.' + ? $lang->get('groupcp_status_mod') : ( ( $is_member && !$is_mod ) - ? 'You are a member of this group.' - : 'You are not a member of this group.' + ? $lang->get('groupcp_status_member') + : $lang->get('groupcp_status_not_member') ); $can_do_admin_stuff = ( $is_mod || $session->user_level >= USER_LEVEL_ADMIN ); switch ( $row['group_type'] ) { - case GROUP_HIDDEN: $g_state = 'Hidden group'; break; - case GROUP_CLOSED: $g_state = 'Closed group'; break; - case GROUP_REQUEST: $g_state = 'Members can request to join'; break; - case GROUP_OPEN: $g_state = 'Anyone can join'; break; + case GROUP_HIDDEN: $g_state = $lang->get('groupcp_type_hidden'); break; + case GROUP_CLOSED: $g_state = $lang->get('groupcp_type_closed'); break; + case GROUP_REQUEST: $g_state = $lang->get('groupcp_type_request'); break; + case GROUP_OPEN: $g_state = $lang->get('groupcp_type_open'); break; } if ( isset($_GET['act']) && $can_do_admin_stuff ) @@ -139,7 +141,7 @@ $r = $db->fetchrow(); if ( $r['system_group'] == 1 && ( intval($_POST['group_state']) == GROUP_OPEN || intval($_POST['group_state']) == GROUP_REQUEST ) ) { - echo '
Because this is a system group, you can\'t make it open or allow membership requests.
'; + echo '
' . $lang->get('groupcp_err_state_system_group') . '
'; $error = true; } if ( !$error ) @@ -148,7 +150,7 @@ if (!$q) $db->_die('SpecialGroups.php, line ' . __LINE__); $row['group_type'] = $_POST['group_state']; - echo '
The group state was updated.
'; + echo '
' . $lang->get('groupcp_msg_state_updated') . '
'; } break; case 'adduser': @@ -160,7 +162,7 @@ $db->_die('SpecialGroups.php, line ' . __LINE__); if ($db->numrows() < 1) { - echo '
The username you entered could not be found.
'; + echo '
' . $lang->get('groupcp_err_user_not_found') . '
'; break; } $r = $db->fetchrow(); @@ -184,11 +186,11 @@ if ( $member['member_id'] == $r['member_id'] ) $members[$i]['is_mod'] = (int)$mod; } - echo '
The user "' . $username . '" is already in this group, so their moderator status was updated.
'; + echo '
' . $lang->get('groupcp_msg_user_already_in_mod_updated', array('username' => $username)) . '
'; } else { - echo '
The user "' . $username . '" is already in this group.
'; + echo '
' . $lang->get('groupcp_msg_user_already_in', array('username' => $username)) . '
'; } break; } @@ -198,7 +200,7 @@ $q = $db->sql_query('INSERT INTO '.table_prefix.'group_members(group_id,user_id,is_mod) VALUES(' . intval($_POST['group_id']) . ', ' . $uid . ', ' . $mod . ');'); if (!$q) $db->_die('SpecialGroups.php, line ' . __LINE__); - echo '
The user "' . $username . '" has been added to this usergroup.
'; + echo '
' . $lang->get('groupcp_msg_user_added', array('username' => $username)) . '
'; $q = $db->sql_query('SELECT u.username,u.email,u.reg_time,m.member_id,m.user_id,m.is_mod,COUNT(c.comment_id) AS num_comments FROM '.table_prefix.'users AS u @@ -255,17 +257,17 @@ } } } - echo '
Pending members status updated successfully.
'; + echo '
' . $lang->get('groupcp_msg_pending_updated') . '
'; break; } } - if ( isset($_GET['act']) && $_GET['act'] == 'update' && !$is_member && $row['group_type'] == GROUP_OPEN ) + if ( isset($_GET['act']) && $_GET['act'] == 'update' && !$is_member && $row['group_type'] == GROUP_OPEN && !$can_do_admin_stuff ) { $q = $db->sql_query('INSERT INTO '.table_prefix.'group_members(group_id,user_id) VALUES(' . $gid . ', ' . $session->user_id . ');'); if (!$q) $db->_die('SpecialGroups.php, line ' . __LINE__); - echo '
You have been added to this group.
'; + echo '
' . $lang->get('groupcp_msg_self_added') . '
'; $q = $db->sql_query('SELECT u.username,u.email,u.reg_time,m.member_id,m.user_id,m.is_mod,COUNT(c.comment_id) AS num_comments FROM '.table_prefix.'users AS u @@ -288,55 +290,60 @@ } - if ( isset($_GET['act']) && $_GET['act'] == 'update' && !$is_member && $row['group_type'] == GROUP_REQUEST && !$is_pending ) + if ( isset($_GET['act']) && $_GET['act'] == 'update' && !$is_member && $row['group_type'] == GROUP_REQUEST && !$is_pending && !$can_do_admin_stuff ) { $q = $db->sql_query('INSERT INTO '.table_prefix.'group_members(group_id,user_id,pending) VALUES(' . $gid . ', ' . $session->user_id . ', 1);'); if (!$q) $db->_die('SpecialGroups.php, line ' . __LINE__); - echo '
A request has been sent to the moderator(s) of this group to add you.
'; + echo '
' . $lang->get('groupcp_msg_membership_requested') . '
'; } $state_btns = ( $can_do_admin_stuff ) ? - ' - - - ' + ' + + + ' : $g_state; if ( !$can_do_admin_stuff && $row['group_type'] == GROUP_REQUEST && !$is_member ) { if ( $is_pending ) - $state_btns .= ' (Your request to join is awaiting approval)'; + $state_btns .= ' ' . $lang->get('groupcp_msg_status_pending'); else - $state_btns .= ' '; + $state_btns .= ' '; } if ( !$can_do_admin_stuff && $row['group_type'] == GROUP_OPEN && !$is_member ) { - $state_btns .= ' '; + $state_btns .= ' '; } + $g_name_local = 'groupcp_grp_' . strtolower($row['group_name']); + $str = $lang->get($g_name_local); + if ( $str != $g_name_local ) + $row['group_name'] = $str; + echo '
- + - - + + - + - + ' . ( ( $is_mod || $session->user_level >= USER_LEVEL_ADMIN ) ? ' ' : '' ) . ' @@ -348,15 +355,15 @@ { echo ' -

Pending memberships

+

' . $lang->get('groupcp_th_pending_memberships') . '

Group information' . $lang->get('groupcp_th_group_info') . '
Group name:' . $row['group_name'] . ( $row['system_group'] == 1 ? ' (system group)' : '' ) . '' . $lang->get('groupcp_lbl_group_name') . '' . $row['group_name'] . ( $row['system_group'] == 1 ? ' ' . $lang->get('groupcp_msg_system_group') : '' ) . '
Membership status:' . $lang->get('groupcp_lbl_status') . ' ' . $status . '
Group state:' . $lang->get('groupcp_lbl_state') . ' ' . $state_btns . '
- +
- - - - - + + + + + '; $cls = 'row2'; foreach ( $pending as $member ) @@ -378,26 +385,26 @@
With selected: - - + +
'; } echo ' -

Group members

+

' . $lang->get('groupcp_th_group_members') . '

UsernameE-mailRegisteredTotal commentsSelect' . $lang->get('groupcp_th_username') . '' . $lang->get('groupcp_th_email') . '' . $lang->get('groupcp_th_reg_time') . '' . $lang->get('groupcp_th_comments') . '' . $lang->get('groupcp_th_select') . '
- - - - - ' . ( ( $can_do_admin_stuff ) ? " - - " : '' ) . ' + + + + + ' . ( ( $can_do_admin_stuff ) ? ' + + ' : '' ) . ' - + '; $mod_printed = false; $mem_printed = false; @@ -425,8 +432,8 @@ "; } if (!$mod_printed) - echo ''; - echo ''; + echo ''; + echo ''; foreach ( $members as $member ) { if ( $member['is_mod'] == 1 ) @@ -449,12 +456,12 @@ "; } if (!$mem_printed) - echo ''; + echo ''; echo '
UsernameE-mailRegisteredTotal commentsRemove?' . $lang->get('groupcp_th_username') . '' . $lang->get('groupcp_th_email') . '' . $lang->get('groupcp_th_reg_time') . '' . $lang->get('groupcp_th_comments') . '' . $lang->get('groupcp_th_remove') . '
Group moderators' . $lang->get('groupcp_th_group_mods') . '
This group has no moderators.
Group members
' . $lang->get('groupcp_msg_no_mods') . '
' . $lang->get('groupcp_th_group_members') . '
This group has no members.
' . $lang->get('groupcp_msg_no_members') . '
'; if ( $can_do_admin_stuff ) { - echo "
"; + echo "
get('groupcp_btn_remove_selected') . "\" />
"; } echo ' '; @@ -464,17 +471,17 @@
- + - + - +
Add a new member to this group' . $lang->get('groupcp_th_add_member') . '
Username:' . $template->username_field('add_username') . '' . $lang->get('groupcp_lbl_username') . '' . $template->username_field('add_username') . '
Group moderator:' . $lang->get('groupcp_lbl_moderator') . '
- +
@@ -489,11 +496,11 @@ echo '
- + ';
Group membership details' . $lang->get('groupcp_th_select_group') . '
- Current group memberships: + ' . $lang->get('groupcp_lbl_current_memberships') . ' '; $taboo = Array('Everyone'); @@ -505,11 +512,15 @@ $taboo[] = $group; if ( $group != 'Everyone' ) { + $g_name_local = 'groupcp_grp_' . strtolower($group); + $str = $lang->get($g_name_local); + if ( $str != $g_name_local ) + $group = $str; echo ''; } } echo ' - '; + '; } else { @@ -530,7 +541,7 @@ { echo '
- Non-memberships: + ' . $lang->get('groupcp_lbl_non_memberships') . ' - +