root / tags / release_2_0_1 / phpBB / groupcp.php
History | View | Annotate | Download (44.8 kB)
| 1 | 606 | psotfx | <?php
|
|---|---|---|---|
| 2 | 606 | psotfx | /***************************************************************************
|
| 3 | 606 | psotfx | * groupcp.php |
| 4 | 606 | psotfx | * ------------------- |
| 5 | 606 | psotfx | * begin : Saturday, Feb 13, 2001 |
| 6 | 606 | psotfx | * copyright : (C) 2001 The phpBB Group |
| 7 | 606 | psotfx | * email : support@phpbb.com |
| 8 | 606 | psotfx | * |
| 9 | 606 | psotfx | * $Id$ |
| 10 | 606 | psotfx | * |
| 11 | 606 | psotfx | * |
| 12 | 606 | psotfx | ***************************************************************************/ |
| 13 | 606 | psotfx | |
| 14 | 943 | thefinn | /***************************************************************************
|
| 15 | 943 | thefinn | * |
| 16 | 943 | thefinn | * This program is free software; you can redistribute it and/or modify |
| 17 | 943 | thefinn | * it under the terms of the GNU General Public License as published by |
| 18 | 943 | thefinn | * the Free Software Foundation; either version 2 of the License, or |
| 19 | 943 | thefinn | * (at your option) any later version. |
| 20 | 943 | thefinn | * |
| 21 | 943 | thefinn | ***************************************************************************/ |
| 22 | 943 | thefinn | |
| 23 | 2305 | psotfx | define('IN_PHPBB', true); |
| 24 | 2353 | psotfx | $phpbb_root_path = './'; |
| 25 | 646 | psotfx | include($phpbb_root_path . 'extension.inc'); |
| 26 | 646 | psotfx | include($phpbb_root_path . 'common.'.$phpEx); |
| 27 | 606 | psotfx | |
| 28 | 2448 | psotfx | // -------------------------
|
| 29 | 606 | psotfx | //
|
| 30 | 2471 | psotfx | function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$joined, &$poster_avatar, &$profile_img, &$profile, &$search_img, &$search, &$pm_img, &$pm, &$email_img, &$email, &$www_img, &$www, &$icq_status_img, &$icq_img, &$icq, &$aim_img, &$aim, &$msn_img, &$msn, &$yim_img, &$yim) |
| 31 | 2448 | psotfx | {
|
| 32 | 2491 | psotfx | global $lang, $images, $board_config, $phpEx; |
| 33 | 2448 | psotfx | |
| 34 | 2448 | psotfx | $from = ( !empty($row['user_from']) ) ? $row['user_from'] : ' '; |
| 35 | 2448 | psotfx | $joined = create_date($date_format, $row['user_regdate'], $board_config['board_timezone']); |
| 36 | 2448 | psotfx | $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0; |
| 37 | 2448 | psotfx | |
| 38 | 2448 | psotfx | $poster_avatar = ''; |
| 39 | 2448 | psotfx | if ( $row['user_avatar_type'] && $row['user_id'] != ANONYMOUS && $row['user_allowavatar'] ) |
| 40 | 2448 | psotfx | {
|
| 41 | 2448 | psotfx | switch( $row['user_avatar_type'] ) |
| 42 | 2448 | psotfx | {
|
| 43 | 2448 | psotfx | case USER_AVATAR_UPLOAD: |
| 44 | 2448 | psotfx | $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; |
| 45 | 2448 | psotfx | break;
|
| 46 | 2448 | psotfx | case USER_AVATAR_REMOTE: |
| 47 | 2448 | psotfx | $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : ''; |
| 48 | 2448 | psotfx | break;
|
| 49 | 2448 | psotfx | case USER_AVATAR_GALLERY: |
| 50 | 2448 | psotfx | $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; |
| 51 | 2448 | psotfx | break;
|
| 52 | 2448 | psotfx | } |
| 53 | 2448 | psotfx | } |
| 54 | 2448 | psotfx | |
| 55 | 2471 | psotfx | if ( !empty($row['user_viewemail']) || $group_mod ) |
| 56 | 2448 | psotfx | {
|
| 57 | 2448 | psotfx | $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $row['user_id']) : 'mailto:' . $row['user_email']; |
| 58 | 2448 | psotfx | |
| 59 | 2448 | psotfx | $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>'; |
| 60 | 2448 | psotfx | $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>'; |
| 61 | 2448 | psotfx | } |
| 62 | 2448 | psotfx | else
|
| 63 | 2448 | psotfx | {
|
| 64 | 2448 | psotfx | $email_img = ' '; |
| 65 | 2448 | psotfx | $email = ' '; |
| 66 | 2448 | psotfx | } |
| 67 | 2448 | psotfx | |
| 68 | 2448 | psotfx | $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']); |
| 69 | 2448 | psotfx | $profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>'; |
| 70 | 2448 | psotfx | $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>'; |
| 71 | 2448 | psotfx | |
| 72 | 2448 | psotfx | $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=" . $row['user_id']); |
| 73 | 2448 | psotfx | $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>'; |
| 74 | 2448 | psotfx | $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>'; |
| 75 | 2448 | psotfx | |
| 76 | 2448 | psotfx | $www_img = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : ''; |
| 77 | 2448 | psotfx | $www = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : ''; |
| 78 | 2448 | psotfx | |
| 79 | 2448 | psotfx | if ( !empty($row['user_icq']) ) |
| 80 | 2448 | psotfx | {
|
| 81 | 2448 | psotfx | $icq_status_img = '<a href="http://wwp.icq.com/' . $row['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>'; |
| 82 | 2448 | psotfx | $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>'; |
| 83 | 2448 | psotfx | $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $lang['ICQ'] . '</a>'; |
| 84 | 2448 | psotfx | } |
| 85 | 2448 | psotfx | else
|
| 86 | 2448 | psotfx | {
|
| 87 | 2448 | psotfx | $icq_status_img = ''; |
| 88 | 2448 | psotfx | $icq_img = ''; |
| 89 | 2448 | psotfx | $icq = ''; |
| 90 | 2448 | psotfx | } |
| 91 | 2448 | psotfx | |
| 92 | 2448 | psotfx | $aim_img = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : ''; |
| 93 | 2448 | psotfx | $aim = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : ''; |
| 94 | 2448 | psotfx | |
| 95 | 2448 | psotfx | $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']); |
| 96 | 2448 | psotfx | $msn_img = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : ''; |
| 97 | 2448 | psotfx | $msn = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : ''; |
| 98 | 2448 | psotfx | |
| 99 | 2448 | psotfx | $yim_img = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : ''; |
| 100 | 2448 | psotfx | $yim = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : ''; |
| 101 | 2448 | psotfx | |
| 102 | 2448 | psotfx | $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($username) . "&showresults=posts"); |
| 103 | 2448 | psotfx | $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>'; |
| 104 | 2448 | psotfx | $search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>'; |
| 105 | 2448 | psotfx | |
| 106 | 2448 | psotfx | return;
|
| 107 | 2448 | psotfx | } |
| 108 | 2448 | psotfx | //
|
| 109 | 2448 | psotfx | // --------------------------
|
| 110 | 2448 | psotfx | |
| 111 | 2448 | psotfx | //
|
| 112 | 606 | psotfx | // Start session management
|
| 113 | 606 | psotfx | //
|
| 114 | 2260 | psotfx | $userdata = session_pagestart($user_ip, PAGE_GROUPCP); |
| 115 | 606 | psotfx | init_userprefs($userdata);
|
| 116 | 606 | psotfx | //
|
| 117 | 606 | psotfx | // End session management
|
| 118 | 606 | psotfx | //
|
| 119 | 606 | psotfx | |
| 120 | 2448 | psotfx | $script_name = preg_replace('/^\/?(.*?)\/?$/', "\\1", trim($board_config['script_path'])); |
| 121 | 2183 | psotfx | $script_name = ( $script_name != '' ) ? $script_name . '/groupcp.'.$phpEx : 'groupcp.'.$phpEx; |
| 122 | 2183 | psotfx | $server_name = trim($board_config['server_name']); |
| 123 | 2353 | psotfx | $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://'; |
| 124 | 2183 | psotfx | $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/'; |
| 125 | 2183 | psotfx | |
| 126 | 2191 | psotfx | $server_url = $server_protocol . $server_name . $server_port . $script_name; |
| 127 | 2183 | psotfx | |
| 128 | 2448 | psotfx | if ( isset($HTTP_GET_VARS[POST_GROUPS_URL]) || isset($HTTP_POST_VARS[POST_GROUPS_URL]) ) |
| 129 | 658 | psotfx | {
|
| 130 | 1268 | psotfx | $group_id = ( isset($HTTP_GET_VARS[POST_GROUPS_URL]) ) ? intval($HTTP_GET_VARS[POST_GROUPS_URL]) : intval($HTTP_POST_VARS[POST_GROUPS_URL]); |
| 131 | 658 | psotfx | } |
| 132 | 1268 | psotfx | else
|
| 133 | 1268 | psotfx | {
|
| 134 | 2353 | psotfx | $group_id = ''; |
| 135 | 1268 | psotfx | } |
| 136 | 658 | psotfx | |
| 137 | 2448 | psotfx | if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) ) |
| 138 | 1949 | psotfx | {
|
| 139 | 1949 | psotfx | $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; |
| 140 | 1949 | psotfx | } |
| 141 | 1949 | psotfx | else
|
| 142 | 1949 | psotfx | {
|
| 143 | 2353 | psotfx | $mode = ''; |
| 144 | 1949 | psotfx | } |
| 145 | 1949 | psotfx | |
| 146 | 1268 | psotfx | $confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? TRUE : 0; |
| 147 | 1268 | psotfx | $cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? TRUE : 0; |
| 148 | 1268 | psotfx | |
| 149 | 1268 | psotfx | $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; |
| 150 | 1268 | psotfx | |
| 151 | 1974 | psotfx | //
|
| 152 | 2154 | psotfx | // Default var values
|
| 153 | 2154 | psotfx | //
|
| 154 | 2448 | psotfx | $header_location = ( @preg_match('/Microsoft|WebSTAR/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: '; |
| 155 | 1164 | thefinn | $is_moderator = FALSE; |
| 156 | 606 | psotfx | |
| 157 | 2448 | psotfx | if ( isset($HTTP_POST_VARS['groupstatus']) && $group_id ) |
| 158 | 658 | psotfx | {
|
| 159 | 2448 | psotfx | if ( !$userdata['session_logged_in'] ) |
| 160 | 1268 | psotfx | {
|
| 161 | 2411 | psotfx | header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); |
| 162 | 2575 | psotfx | exit;
|
| 163 | 1268 | psotfx | } |
| 164 | 899 | thefinn | |
| 165 | 1268 | psotfx | $sql = "SELECT group_moderator |
| 166 | 1268 | psotfx | FROM " . GROUPS_TABLE . " |
| 167 | 1268 | psotfx | WHERE group_id = $group_id"; |
| 168 | 2448 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 169 | 896 | thefinn | {
|
| 170 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql); |
| 171 | 896 | thefinn | } |
| 172 | 1268 | psotfx | |
| 173 | 1268 | psotfx | $row = $db->sql_fetchrow($result); |
| 174 | 1268 | psotfx | |
| 175 | 2448 | psotfx | if ( $row['group_moderator'] != $userdata['user_id'] && $userdata['user_level'] != ADMIN ) |
| 176 | 891 | thefinn | {
|
| 177 | 1268 | psotfx | $template->assign_vars(array( |
| 178 | 2448 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') |
| 179 | 1268 | psotfx | ); |
| 180 | 1268 | psotfx | |
| 181 | 2154 | psotfx | $message = $lang['Not_group_moderator'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); |
| 182 | 1268 | psotfx | |
| 183 | 1268 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 184 | 891 | thefinn | } |
| 185 | 658 | psotfx | |
| 186 | 1268 | psotfx | $sql = "UPDATE " . GROUPS_TABLE . " |
| 187 | 1268 | psotfx | SET group_type = " . intval($HTTP_POST_VARS['group_type']) . " |
| 188 | 1268 | psotfx | WHERE group_id = $group_id"; |
| 189 | 2448 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 190 | 891 | thefinn | {
|
| 191 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql); |
| 192 | 891 | thefinn | } |
| 193 | 716 | psotfx | |
| 194 | 1268 | psotfx | $template->assign_vars(array( |
| 195 | 2448 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">') |
| 196 | 1268 | psotfx | ); |
| 197 | 891 | thefinn | |
| 198 | 2448 | psotfx | $message = $lang['Group_type_updated'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); |
| 199 | 891 | thefinn | |
| 200 | 1268 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 201 | 1134 | thefinn | |
| 202 | 1268 | psotfx | } |
| 203 | 2448 | psotfx | else if ( isset($HTTP_POST_VARS['joingroup']) && $group_id ) |
| 204 | 1268 | psotfx | {
|
| 205 | 1268 | psotfx | //
|
| 206 | 1268 | psotfx | // First, joining a group
|
| 207 | 1268 | psotfx | // If the user isn't logged in redirect them to login
|
| 208 | 1268 | psotfx | //
|
| 209 | 2448 | psotfx | if ( !$userdata['session_logged_in'] ) |
| 210 | 1268 | psotfx | {
|
| 211 | 2495 | psotfx | header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); |
| 212 | 2575 | psotfx | exit;
|
| 213 | 1268 | psotfx | } |
| 214 | 1268 | psotfx | |
| 215 | 1268 | psotfx | $sql = "SELECT ug.user_id, g.group_type |
| 216 | 1268 | psotfx | FROM " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g |
| 217 | 1268 | psotfx | WHERE g.group_id = $group_id |
| 218 | 2353 | psotfx | AND g.group_type <> " . GROUP_HIDDEN . " |
| 219 | 1268 | psotfx | AND ug.group_id = g.group_id";
|
| 220 | 2448 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 221 | 1268 | psotfx | {
|
| 222 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not obtain user and group information', '', __LINE__, __FILE__, $sql); |
| 223 | 1268 | psotfx | } |
| 224 | 1268 | psotfx | |
| 225 | 2448 | psotfx | if ( $row = $db->sql_fetchrow($result) ) |
| 226 | 1268 | psotfx | {
|
| 227 | 2353 | psotfx | if ( $row['group_type'] == GROUP_OPEN ) |
| 228 | 1268 | psotfx | {
|
| 229 | 1974 | psotfx | do
|
| 230 | 1268 | psotfx | {
|
| 231 | 2448 | psotfx | if ( $userdata['user_id'] == $row['user_id'] ) |
| 232 | 1974 | psotfx | {
|
| 233 | 1974 | psotfx | $template->assign_vars(array( |
| 234 | 2448 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') |
| 235 | 1974 | psotfx | ); |
| 236 | 1268 | psotfx | |
| 237 | 2448 | psotfx | $message = $lang['Already_member_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); |
| 238 | 1268 | psotfx | |
| 239 | 1974 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 240 | 1974 | psotfx | } |
| 241 | 1974 | psotfx | } while ( $row = $db->sql_fetchrow($result) ); |
| 242 | 1268 | psotfx | } |
| 243 | 1974 | psotfx | else
|
| 244 | 1974 | psotfx | {
|
| 245 | 1974 | psotfx | $template->assign_vars(array( |
| 246 | 2448 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') |
| 247 | 1974 | psotfx | ); |
| 248 | 1974 | psotfx | |
| 249 | 2448 | psotfx | $message = $lang['This_closed_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); |
| 250 | 1974 | psotfx | |
| 251 | 1974 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 252 | 1974 | psotfx | } |
| 253 | 1268 | psotfx | } |
| 254 | 1268 | psotfx | else
|
| 255 | 1268 | psotfx | {
|
| 256 | 1974 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_groups_exist']); |
| 257 | 1268 | psotfx | } |
| 258 | 1268 | psotfx | |
| 259 | 1268 | psotfx | $sql = "INSERT INTO " . USER_GROUP_TABLE . " (group_id, user_id, user_pending) |
| 260 | 1268 | psotfx | VALUES ($group_id, " . $userdata['user_id'] . ", 1)"; |
| 261 | 2448 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 262 | 1268 | psotfx | {
|
| 263 | 1268 | psotfx | message_die(GENERAL_ERROR, "Error inserting user group subscription", "", __LINE__, __FILE__, $sql); |
| 264 | 1268 | psotfx | } |
| 265 | 1268 | psotfx | |
| 266 | 1831 | psotfx | $sql = "SELECT u.user_email, u.username, u.user_lang, g.group_name |
| 267 | 1268 | psotfx | FROM ".USERS_TABLE . " u, " . GROUPS_TABLE . " g |
| 268 | 1268 | psotfx | WHERE u.user_id = g.group_moderator |
| 269 | 1268 | psotfx | AND g.group_id = $group_id"; |
| 270 | 2448 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 271 | 1268 | psotfx | {
|
| 272 | 1268 | psotfx | message_die(GENERAL_ERROR, "Error getting group moderator data", "", __LINE__, __FILE__, $sql); |
| 273 | 1268 | psotfx | } |
| 274 | 1268 | psotfx | |
| 275 | 1268 | psotfx | $moderator = $db->sql_fetchrow($result); |
| 276 | 1268 | psotfx | |
| 277 | 1268 | psotfx | include($phpbb_root_path . 'includes/emailer.'.$phpEx); |
| 278 | 1097 | thefinn | $emailer = new emailer($board_config['smtp_delivery']); |
| 279 | 1268 | psotfx | |
| 280 | 2605 | psotfx | $email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n"; |
| 281 | 1268 | psotfx | |
| 282 | 2448 | psotfx | $emailer->use_template('group_request', $moderator['user_lang']); |
| 283 | 1268 | psotfx | $emailer->email_address($moderator['user_email']); |
| 284 | 2247 | psotfx | $emailer->set_subject();//$lang['Group_request'] |
| 285 | 891 | thefinn | $emailer->extra_headers($email_headers); |
| 286 | 891 | thefinn | |
| 287 | 891 | thefinn | $emailer->assign_vars(array( |
| 288 | 2448 | psotfx | 'SITENAME' => $board_config['sitename'], |
| 289 | 2448 | psotfx | 'GROUP_MODERATOR' => $moderator['username'], |
| 290 | 2448 | psotfx | 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), |
| 291 | 1268 | psotfx | |
| 292 | 2448 | psotfx | 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id&validate=true") |
| 293 | 891 | thefinn | ); |
| 294 | 891 | thefinn | $emailer->send();
|
| 295 | 891 | thefinn | $emailer->reset(); |
| 296 | 891 | thefinn | |
| 297 | 1268 | psotfx | $template->assign_vars(array( |
| 298 | 2448 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') |
| 299 | 1268 | psotfx | ); |
| 300 | 1268 | psotfx | |
| 301 | 2448 | psotfx | $message = $lang['Group_joined'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); |
| 302 | 1268 | psotfx | |
| 303 | 1268 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 304 | 716 | psotfx | } |
| 305 | 2448 | psotfx | else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending']) && $group_id ) |
| 306 | 899 | thefinn | {
|
| 307 | 899 | thefinn | //
|
| 308 | 1268 | psotfx | // Second, unsubscribing from a group
|
| 309 | 899 | thefinn | // Check for confirmation of unsub.
|
| 310 | 899 | thefinn | //
|
| 311 | 2448 | psotfx | if ( $cancel ) |
| 312 | 1268 | psotfx | {
|
| 313 | 2495 | psotfx | header($header_location . append_sid("groupcp.$phpEx", true)); |
| 314 | 2575 | psotfx | exit;
|
| 315 | 1268 | psotfx | } |
| 316 | 2448 | psotfx | elseif ( !$userdata['session_logged_in'] ) |
| 317 | 899 | thefinn | {
|
| 318 | 2411 | psotfx | header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); |
| 319 | 2575 | psotfx | exit;
|
| 320 | 899 | thefinn | } |
| 321 | 899 | thefinn | |
| 322 | 2448 | psotfx | if ( $confirm ) |
| 323 | 899 | thefinn | {
|
| 324 | 1268 | psotfx | $sql = "DELETE FROM " . USER_GROUP_TABLE . " |
| 325 | 1268 | psotfx | WHERE user_id = " . $userdata['user_id'] . " |
| 326 | 1268 | psotfx | AND group_id = $group_id"; |
| 327 | 2448 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 328 | 899 | thefinn | {
|
| 329 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not delete group memebership data', '', __LINE__, __FILE__, $sql); |
| 330 | 899 | thefinn | } |
| 331 | 899 | thefinn | |
| 332 | 2353 | psotfx | if ( $userdata['user_level'] != ADMIN && $userdata['user_level'] == MOD ) |
| 333 | 2353 | psotfx | {
|
| 334 | 2353 | psotfx | $sql = "SELECT COUNT(auth_mod) AS is_auth_mod |
| 335 | 2353 | psotfx | FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug |
| 336 | 2353 | psotfx | WHERE ug.user_id = " . $userdata['user_id'] . " |
| 337 | 2353 | psotfx | AND aa.group_id = ug.group_id |
| 338 | 2353 | psotfx | AND aa.auth_mod = 1";
|
| 339 | 2353 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 340 | 2353 | psotfx | {
|
| 341 | 2353 | psotfx | message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql); |
| 342 | 2353 | psotfx | } |
| 343 | 2353 | psotfx | |
| 344 | 2353 | psotfx | if ( !($row = $db->sql_fetchrow($result)) ) |
| 345 | 2353 | psotfx | {
|
| 346 | 2353 | psotfx | $sql = "UPDATE " . USERS_TABLE . " |
| 347 | 2353 | psotfx | SET user_level = " . USER . " |
| 348 | 2353 | psotfx | WHERE user_id = " . $userdata['user_id']; |
| 349 | 2448 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 350 | 2353 | psotfx | {
|
| 351 | 2353 | psotfx | message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); |
| 352 | 2353 | psotfx | } |
| 353 | 2353 | psotfx | } |
| 354 | 2353 | psotfx | } |
| 355 | 2353 | psotfx | |
| 356 | 1268 | psotfx | $template->assign_vars(array( |
| 357 | 2448 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') |
| 358 | 1268 | psotfx | ); |
| 359 | 899 | thefinn | |
| 360 | 2154 | psotfx | $message = $lang['Usub_success'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); |
| 361 | 1268 | psotfx | |
| 362 | 1268 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 363 | 899 | thefinn | } |
| 364 | 899 | thefinn | else
|
| 365 | 899 | thefinn | {
|
| 366 | 1268 | psotfx | $unsub_msg = ( isset($HTTP_POST_VARS['unsub']) ) ? $lang['Confirm_unsub'] : $lang['Confirm_unsub_pending']; |
| 367 | 1268 | psotfx | |
| 368 | 1268 | psotfx | $s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" /><input type="hidden" name="unsub" value="1" />'; |
| 369 | 1268 | psotfx | |
| 370 | 1268 | psotfx | $page_title = $lang['Group_Control_Panel']; |
| 371 | 899 | thefinn | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 372 | 899 | thefinn | |
| 373 | 1268 | psotfx | $template->set_filenames(array( |
| 374 | 2448 | psotfx | 'confirm' => 'confirm_body.tpl') |
| 375 | 1268 | psotfx | ); |
| 376 | 899 | thefinn | |
| 377 | 1268 | psotfx | $template->assign_vars(array( |
| 378 | 2448 | psotfx | 'MESSAGE_TITLE' => $lang['Confirm'], |
| 379 | 2448 | psotfx | 'MESSAGE_TEXT' => $unsub_msg, |
| 380 | 2448 | psotfx | 'L_YES' => $lang['Yes'], |
| 381 | 2448 | psotfx | 'L_NO' => $lang['No'], |
| 382 | 2448 | psotfx | 'S_CONFIRM_ACTION' => append_sid("groupcp.$phpEx"), |
| 383 | 2448 | psotfx | 'S_HIDDEN_FIELDS' => $s_hidden_fields) |
| 384 | 1268 | psotfx | ); |
| 385 | 1268 | psotfx | |
| 386 | 2448 | psotfx | $template->pparse('confirm'); |
| 387 | 1268 | psotfx | |
| 388 | 899 | thefinn | include($phpbb_root_path . 'includes/page_tail.'.$phpEx); |
| 389 | 899 | thefinn | } |
| 390 | 899 | thefinn | |
| 391 | 899 | thefinn | } |
| 392 | 2448 | psotfx | else if ( $group_id ) |
| 393 | 716 | psotfx | {
|
| 394 | 1164 | thefinn | //
|
| 395 | 2353 | psotfx | // Did the group moderator get here through an email?
|
| 396 | 2353 | psotfx | // If so, check to see if they are logged in.
|
| 397 | 891 | thefinn | //
|
| 398 | 2448 | psotfx | if ( isset($HTTP_GET_VARS['validate']) ) |
| 399 | 891 | thefinn | {
|
| 400 | 2448 | psotfx | if ( !$userdata['session_logged_in'] ) |
| 401 | 1714 | psotfx | {
|
| 402 | 2411 | psotfx | header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); |
| 403 | 2575 | psotfx | exit;
|
| 404 | 1714 | psotfx | } |
| 405 | 2353 | psotfx | } |
| 406 | 1714 | psotfx | |
| 407 | 2353 | psotfx | //
|
| 408 | 2353 | psotfx | // For security, get the ID of the group moderator.
|
| 409 | 2353 | psotfx | //
|
| 410 | 2353 | psotfx | switch(SQL_LAYER) |
| 411 | 2353 | psotfx | {
|
| 412 | 2353 | psotfx | case 'postgresql': |
| 413 | 2353 | psotfx | $sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod |
| 414 | 2353 | psotfx | FROM " . GROUPS_TABLE . " g, " . AUTH_ACCESS_TABLE . " aa |
| 415 | 2353 | psotfx | WHERE g.group_id = $group_id |
| 416 | 2353 | psotfx | AND aa.group_id = g.group_id |
| 417 | 2353 | psotfx | UNION ( |
| 418 | 2353 | psotfx | SELECT g.group_moderator, g.group_type, NULL |
| 419 | 2353 | psotfx | FROM " . GROUPS_TABLE . " g |
| 420 | 2353 | psotfx | WHERE g.group_id = $group_id |
| 421 | 2353 | psotfx | AND NOT EXISTS ( |
| 422 | 2353 | psotfx | SELECT aa.group_id |
| 423 | 2353 | psotfx | FROM " . AUTH_ACCESS_TABLE . " aa |
| 424 | 2353 | psotfx | WHERE aa.group_id = g.group_id |
| 425 | 2353 | psotfx | ) |
| 426 | 2353 | psotfx | )";
|
| 427 | 2353 | psotfx | break;
|
| 428 | 716 | psotfx | |
| 429 | 2353 | psotfx | case 'oracle': |
| 430 | 2353 | psotfx | $sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod |
| 431 | 2353 | psotfx | FROM " . GROUPS_TABLE . " g, " . AUTH_ACCESS_TABLE . " aa |
| 432 | 2353 | psotfx | WHERE g.group_id = $group_id |
| 433 | 2353 | psotfx | AND aa.group_id = g.group_id(+)";
|
| 434 | 2353 | psotfx | break;
|
| 435 | 1268 | psotfx | |
| 436 | 2353 | psotfx | default:
|
| 437 | 2353 | psotfx | $sql = "SELECT g.group_moderator, g.group_type, aa.auth_mod |
| 438 | 2353 | psotfx | FROM ( " . GROUPS_TABLE . " g |
| 439 | 2353 | psotfx | LEFT JOIN " . AUTH_ACCESS_TABLE . " aa ON aa.group_id = g.group_id ) |
| 440 | 2353 | psotfx | WHERE g.group_id = $group_id"; |
| 441 | 2353 | psotfx | break;
|
| 442 | 2353 | psotfx | } |
| 443 | 2353 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 444 | 2353 | psotfx | {
|
| 445 | 2353 | psotfx | message_die(GENERAL_ERROR, 'Could not get moderator information', '', __LINE__, __FILE__, $sql); |
| 446 | 2353 | psotfx | } |
| 447 | 1164 | thefinn | |
| 448 | 2353 | psotfx | if ( $group_info = $db->sql_fetchrow($result) ) |
| 449 | 2353 | psotfx | {
|
| 450 | 2353 | psotfx | $group_moderator = $group_info['group_moderator']; |
| 451 | 2353 | psotfx | |
| 452 | 2448 | psotfx | if ( $group_moderator == $userdata['user_id'] || $userdata['user_level'] == ADMIN ) |
| 453 | 891 | thefinn | {
|
| 454 | 2353 | psotfx | $is_moderator = TRUE; |
| 455 | 2353 | psotfx | } |
| 456 | 1134 | thefinn | |
| 457 | 2353 | psotfx | //
|
| 458 | 2353 | psotfx | // Handle Additions, removals, approvals and denials
|
| 459 | 2353 | psotfx | //
|
| 460 | 2448 | psotfx | if ( !empty($HTTP_POST_VARS['add']) || !empty($HTTP_POST_VARS['remove']) || isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']) ) |
| 461 | 2353 | psotfx | {
|
| 462 | 2448 | psotfx | if ( !$userdata['session_logged_in'] ) |
| 463 | 891 | thefinn | {
|
| 464 | 2411 | psotfx | header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true)); |
| 465 | 2575 | psotfx | exit;
|
| 466 | 891 | thefinn | } |
| 467 | 1268 | psotfx | |
| 468 | 2448 | psotfx | if ( !$is_moderator ) |
| 469 | 1134 | thefinn | {
|
| 470 | 1268 | psotfx | $template->assign_vars(array( |
| 471 | 2448 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("index.$phpEx") . '">') |
| 472 | 1268 | psotfx | ); |
| 473 | 891 | thefinn | |
| 474 | 2353 | psotfx | $message = $lang['Not_group_moderator'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); |
| 475 | 1268 | psotfx | |
| 476 | 1268 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 477 | 899 | thefinn | } |
| 478 | 1714 | psotfx | |
| 479 | 2448 | psotfx | if ( isset($HTTP_POST_VARS['add']) ) |
| 480 | 1714 | psotfx | {
|
| 481 | 2353 | psotfx | $username = ( isset($HTTP_POST_VARS['username']) ) ? $HTTP_POST_VARS['username'] : ""; |
| 482 | 2353 | psotfx | |
| 483 | 2353 | psotfx | $sql = "SELECT user_id, user_email, user_lang, user_level |
| 484 | 2353 | psotfx | FROM " . USERS_TABLE . " |
| 485 | 2353 | psotfx | WHERE username = '" . str_replace("\'", "''", $username) . "'"; |
| 486 | 2448 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 487 | 1134 | thefinn | {
|
| 488 | 2353 | psotfx | message_die(GENERAL_ERROR, "Could not get user information", $lang['Error'], __LINE__, __FILE__, $sql); |
| 489 | 1134 | thefinn | } |
| 490 | 1268 | psotfx | |
| 491 | 2448 | psotfx | if ( !($row = $db->sql_fetchrow($result)) ) |
| 492 | 1134 | thefinn | {
|
| 493 | 2353 | psotfx | $template->assign_vars(array( |
| 494 | 2448 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">') |
| 495 | 2353 | psotfx | ); |
| 496 | 1268 | psotfx | |
| 497 | 2448 | psotfx | $message = $lang['Could_not_add_user'] . "<br /><br />" . sprintf($lang['Click_return_group'], "<a href=\"" . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_index'], "<a href=\"" . append_sid("index.$phpEx") . "\">", "</a>"); |
| 498 | 899 | thefinn | |
| 499 | 2353 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 500 | 1268 | psotfx | } |
| 501 | 1268 | psotfx | |
| 502 | 2353 | psotfx | if ( $row['user_id'] == ANONYMOUS ) |
| 503 | 1268 | psotfx | {
|
| 504 | 2353 | psotfx | $template->assign_vars(array( |
| 505 | 2353 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">') |
| 506 | 2353 | psotfx | ); |
| 507 | 1268 | psotfx | |
| 508 | 2448 | psotfx | $message = $lang['Could_not_anon_user'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); |
| 509 | 2353 | psotfx | |
| 510 | 2353 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 511 | 1268 | psotfx | } |
| 512 | 2353 | psotfx | |
| 513 | 2353 | psotfx | $sql = "SELECT ug.user_id, u.user_level |
| 514 | 2353 | psotfx | FROM " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u |
| 515 | 2353 | psotfx | WHERE u.user_id = " . $row['user_id'] . " |
| 516 | 2353 | psotfx | AND ug.user_id = u.user_id |
| 517 | 2353 | psotfx | AND ug.group_id = $group_id"; |
| 518 | 2353 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 519 | 1268 | psotfx | {
|
| 520 | 2353 | psotfx | message_die(GENERAL_ERROR, 'Could not get user information', '', __LINE__, __FILE__, $sql); |
| 521 | 1268 | psotfx | } |
| 522 | 1268 | psotfx | |
| 523 | 2353 | psotfx | if ( !($db->sql_fetchrow($result)) ) |
| 524 | 1268 | psotfx | {
|
| 525 | 2353 | psotfx | $sql = "INSERT INTO " . USER_GROUP_TABLE . " (user_id, group_id, user_pending) |
| 526 | 2353 | psotfx | VALUES (" . $row['user_id'] . ", $group_id, 0)"; |
| 527 | 2448 | psotfx | if ( !$db->sql_query($sql) ) |
| 528 | 1268 | psotfx | {
|
| 529 | 2353 | psotfx | message_die(GENERAL_ERROR, 'Could not add user to group', '', __LINE__, __FILE__, $sql); |
| 530 | 1268 | psotfx | } |
| 531 | 2353 | psotfx | |
| 532 | 2353 | psotfx | if ( $row['user_level'] != ADMIN && $row['user_level'] != MOD && $group_info['auth_mod'] ) |
| 533 | 1974 | psotfx | {
|
| 534 | 2353 | psotfx | $sql = "UPDATE " . USERS_TABLE . " |
| 535 | 2353 | psotfx | SET user_level = " . MOD . " |
| 536 | 2353 | psotfx | WHERE user_id = " . $row['user_id']; |
| 537 | 2448 | psotfx | if ( !$db->sql_query($sql) ) |
| 538 | 1974 | psotfx | {
|
| 539 | 2353 | psotfx | message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); |
| 540 | 1974 | psotfx | } |
| 541 | 1974 | psotfx | } |
| 542 | 1974 | psotfx | |
| 543 | 1268 | psotfx | //
|
| 544 | 1268 | psotfx | // Get the group name
|
| 545 | 2448 | psotfx | // Email the user and tell them they're in the group
|
| 546 | 1268 | psotfx | //
|
| 547 | 1268 | psotfx | $group_sql = "SELECT group_name |
| 548 | 1268 | psotfx | FROM " . GROUPS_TABLE . " |
| 549 | 1268 | psotfx | WHERE group_id = $group_id"; |
| 550 | 2448 | psotfx | if ( !($result = $db->sql_query($group_sql)) ) |
| 551 | 1268 | psotfx | {
|
| 552 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not get group information', '', __LINE__, __FILE__, $group_sql); |
| 553 | 1268 | psotfx | } |
| 554 | 2448 | psotfx | |
| 555 | 2353 | psotfx | $group_name_row = $db->sql_fetchrow($result); |
| 556 | 1268 | psotfx | |
| 557 | 1268 | psotfx | $group_name = $group_name_row['group_name']; |
| 558 | 1268 | psotfx | |
| 559 | 1268 | psotfx | include($phpbb_root_path . 'includes/emailer.'.$phpEx); |
| 560 | 1268 | psotfx | $emailer = new emailer($board_config['smtp_delivery']); |
| 561 | 1268 | psotfx | |
| 562 | 2605 | psotfx | $email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\n"; |
| 563 | 1268 | psotfx | |
| 564 | 2448 | psotfx | $emailer->use_template('group_added', $row['user_lang']); |
| 565 | 2353 | psotfx | $emailer->email_address($row['user_email']); |
| 566 | 2353 | psotfx | $emailer->set_subject();//$lang['Group_added'] |
| 567 | 1268 | psotfx | $emailer->extra_headers($email_headers); |
| 568 | 1268 | psotfx | |
| 569 | 1268 | psotfx | $emailer->assign_vars(array( |
| 570 | 2448 | psotfx | 'SITENAME' => $board_config['sitename'], |
| 571 | 2448 | psotfx | 'GROUP_NAME' => $group_name, |
| 572 | 2448 | psotfx | 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), |
| 573 | 1268 | psotfx | |
| 574 | 2448 | psotfx | 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id") |
| 575 | 1268 | psotfx | ); |
| 576 | 1268 | psotfx | $emailer->send();
|
| 577 | 1268 | psotfx | $emailer->reset(); |
| 578 | 1268 | psotfx | } |
| 579 | 2353 | psotfx | else
|
| 580 | 2353 | psotfx | {
|
| 581 | 2353 | psotfx | $template->assign_vars(array( |
| 582 | 2448 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">') |
| 583 | 2353 | psotfx | ); |
| 584 | 2353 | psotfx | |
| 585 | 2448 | psotfx | $message = $lang['User_is_member_group'] . '<br /><br />' . sprintf($lang['Click_return_group'], '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); |
| 586 | 2353 | psotfx | |
| 587 | 2353 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 588 | 2353 | psotfx | } |
| 589 | 1268 | psotfx | } |
| 590 | 2353 | psotfx | else
|
| 591 | 2353 | psotfx | {
|
| 592 | 2448 | psotfx | if ( ( ( isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']) ) && isset($HTTP_POST_VARS['pending_members']) ) || ( isset($HTTP_POST_VARS['remove']) && isset($HTTP_POST_VARS['members']) ) ) |
| 593 | 2353 | psotfx | {
|
| 594 | 2353 | psotfx | |
| 595 | 2353 | psotfx | $members = ( isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']) ) ? $HTTP_POST_VARS['pending_members'] : $HTTP_POST_VARS['members']; |
| 596 | 2353 | psotfx | |
| 597 | 2353 | psotfx | $sql_in = ''; |
| 598 | 2353 | psotfx | for($i = 0; $i < count($members); $i++) |
| 599 | 2353 | psotfx | {
|
| 600 | 2353 | psotfx | $sql_in .= ( ( $sql_in != '' ) ? ', ' : '' ) . $members[$i]; |
| 601 | 2353 | psotfx | } |
| 602 | 2353 | psotfx | |
| 603 | 2448 | psotfx | if ( isset($HTTP_POST_VARS['approve']) ) |
| 604 | 2353 | psotfx | {
|
| 605 | 2353 | psotfx | if ( $group_info['auth_mod'] ) |
| 606 | 2353 | psotfx | {
|
| 607 | 2353 | psotfx | $sql = "UPDATE " . USERS_TABLE . " |
| 608 | 2353 | psotfx | SET user_level = " . MOD . " |
| 609 | 2353 | psotfx | WHERE user_id IN ($sql_in) |
| 610 | 2353 | psotfx | AND user_level NOT IN (" . MOD . ", " . ADMIN . ")"; |
| 611 | 2448 | psotfx | if ( !$db->sql_query($sql) ) |
| 612 | 2353 | psotfx | {
|
| 613 | 2353 | psotfx | message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); |
| 614 | 2353 | psotfx | } |
| 615 | 2353 | psotfx | } |
| 616 | 2353 | psotfx | |
| 617 | 2353 | psotfx | $sql = "UPDATE " . USER_GROUP_TABLE . " |
| 618 | 2353 | psotfx | SET user_pending = 0 |
| 619 | 2353 | psotfx | WHERE user_id IN ($sql_in) |
| 620 | 2353 | psotfx | AND group_id = $group_id"; |
| 621 | 2353 | psotfx | $sql_select = "SELECT user_email |
| 622 | 2353 | psotfx | FROM ". USERS_TABLE . " |
| 623 | 2353 | psotfx | WHERE user_id IN ($sql_in)"; |
| 624 | 2353 | psotfx | } |
| 625 | 2353 | psotfx | else if ( isset($HTTP_POST_VARS['deny']) || isset($HTTP_POST_VARS['remove']) ) |
| 626 | 2353 | psotfx | {
|
| 627 | 2353 | psotfx | if ( $group_info['auth_mod'] ) |
| 628 | 2353 | psotfx | {
|
| 629 | 2353 | psotfx | $sql = "SELECT ug.user_id, ug.group_id |
| 630 | 2353 | psotfx | FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug |
| 631 | 2353 | psotfx | WHERE ug.user_id IN ($sql_in) |
| 632 | 2353 | psotfx | AND aa.group_id = ug.group_id |
| 633 | 2353 | psotfx | AND aa.auth_mod = 1 |
| 634 | 2353 | psotfx | GROUP BY ug.user_id, ug.group_id |
| 635 | 2353 | psotfx | ORDER BY ug.user_id, ug.group_id";
|
| 636 | 2353 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 637 | 2353 | psotfx | {
|
| 638 | 2353 | psotfx | message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql); |
| 639 | 2353 | psotfx | } |
| 640 | 2353 | psotfx | |
| 641 | 2353 | psotfx | if ( $row = $db->sql_fetchrow($result) ) |
| 642 | 2353 | psotfx | {
|
| 643 | 2353 | psotfx | $group_check = array(); |
| 644 | 2353 | psotfx | $remove_mod_sql = ''; |
| 645 | 2353 | psotfx | |
| 646 | 2353 | psotfx | do
|
| 647 | 2353 | psotfx | {
|
| 648 | 2353 | psotfx | $group_check[$row['user_id']][] = $row['group_id']; |
| 649 | 2353 | psotfx | } |
| 650 | 2353 | psotfx | while ( $row = $db->sql_fetchrow($result) ); |
| 651 | 2353 | psotfx | |
| 652 | 2353 | psotfx | while( list($user_id, $group_list) = @each($group_check) ) |
| 653 | 2353 | psotfx | {
|
| 654 | 2353 | psotfx | if ( count($group_list) == 1 ) |
| 655 | 2353 | psotfx | {
|
| 656 | 2353 | psotfx | $remove_mod_sql .= ( ( $remove_mod_sql != '' ) ? ', ' : '' ) . $user_id; |
| 657 | 2353 | psotfx | } |
| 658 | 2353 | psotfx | } |
| 659 | 2353 | psotfx | |
| 660 | 2353 | psotfx | if ( $remove_mod_sql != '' ) |
| 661 | 2353 | psotfx | {
|
| 662 | 2353 | psotfx | $sql = "UPDATE " . USERS_TABLE . " |
| 663 | 2353 | psotfx | SET user_level = " . USER . " |
| 664 | 2353 | psotfx | WHERE user_id IN ($remove_mod_sql) |
| 665 | 2353 | psotfx | AND user_level NOT IN (" . ADMIN . ")"; |
| 666 | 2448 | psotfx | if ( !$db->sql_query($sql) ) |
| 667 | 2353 | psotfx | {
|
| 668 | 2353 | psotfx | message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql); |
| 669 | 2353 | psotfx | } |
| 670 | 2353 | psotfx | } |
| 671 | 2353 | psotfx | } |
| 672 | 2353 | psotfx | } |
| 673 | 2353 | psotfx | |
| 674 | 2353 | psotfx | $sql = "DELETE FROM " . USER_GROUP_TABLE . " |
| 675 | 2353 | psotfx | WHERE user_id IN ($sql_in) |
| 676 | 2353 | psotfx | AND group_id = $group_id"; |
| 677 | 2353 | psotfx | } |
| 678 | 2353 | psotfx | |
| 679 | 2448 | psotfx | if ( !$db->sql_query($sql) ) |
| 680 | 2353 | psotfx | {
|
| 681 | 2353 | psotfx | message_die(GENERAL_ERROR, 'Could not update user group table', '', __LINE__, __FILE__, $sql); |
| 682 | 2353 | psotfx | } |
| 683 | 2353 | psotfx | |
| 684 | 2353 | psotfx | //
|
| 685 | 2353 | psotfx | // Email users when they are approved
|
| 686 | 2353 | psotfx | //
|
| 687 | 2353 | psotfx | if ( isset($HTTP_POST_VARS['approve']) ) |
| 688 | 2353 | psotfx | {
|
| 689 | 2448 | psotfx | if ( !($result = $db->sql_query($sql_select)) ) |
| 690 | 2353 | psotfx | {
|
| 691 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not get user email information', '', __LINE__, __FILE__, $sql); |
| 692 | 2353 | psotfx | } |
| 693 | 2353 | psotfx | |
| 694 | 2353 | psotfx | $email_addresses = ''; |
| 695 | 2353 | psotfx | while( $row = $db->sql_fetchrow($result) ) |
| 696 | 2353 | psotfx | {
|
| 697 | 2353 | psotfx | $email_addresses .= ( ( $email_addresses != '' ) ? ', ' : '' ) . $row['user_email']; |
| 698 | 2353 | psotfx | } |
| 699 | 2353 | psotfx | |
| 700 | 2353 | psotfx | //
|
| 701 | 2353 | psotfx | // Get the group name
|
| 702 | 2353 | psotfx | //
|
| 703 | 2353 | psotfx | $group_sql = "SELECT group_name |
| 704 | 2353 | psotfx | FROM " . GROUPS_TABLE . " |
| 705 | 2353 | psotfx | WHERE group_id = $group_id"; |
| 706 | 2353 | psotfx | if ( !($result = $db->sql_query($group_sql)) ) |
| 707 | 2353 | psotfx | {
|
| 708 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Could not get group information', '', __LINE__, __FILE__, $group_sql); |
| 709 | 2353 | psotfx | } |
| 710 | 2353 | psotfx | |
| 711 | 2353 | psotfx | $group_name_row = $db->sql_fetchrow($result); |
| 712 | 2353 | psotfx | $group_name = $group_name_row['group_name']; |
| 713 | 2353 | psotfx | |
| 714 | 2353 | psotfx | include($phpbb_root_path . 'includes/emailer.'.$phpEx); |
| 715 | 2353 | psotfx | $emailer = new emailer($board_config['smtp_delivery']); |
| 716 | 2353 | psotfx | |
| 717 | 2605 | psotfx | $email_headers = 'From: ' . $board_config['board_email'] . "\nReturn-Path: " . $board_config['board_email'] . "\nBcc: " . $email_addresses . "\n"; |
| 718 | 2353 | psotfx | |
| 719 | 2448 | psotfx | $emailer->use_template('group_approved'); |
| 720 | 2353 | psotfx | $emailer->email_address($userdata['user_email']); |
| 721 | 2353 | psotfx | $emailer->set_subject();//$lang['Group_approved'] |
| 722 | 2353 | psotfx | $emailer->extra_headers($email_headers); |
| 723 | 2353 | psotfx | |
| 724 | 2353 | psotfx | $emailer->assign_vars(array( |
| 725 | 2448 | psotfx | 'SITENAME' => $board_config['sitename'], |
| 726 | 2448 | psotfx | 'GROUP_NAME' => $group_name, |
| 727 | 2448 | psotfx | 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']), |
| 728 | 2353 | psotfx | |
| 729 | 2448 | psotfx | 'U_GROUPCP' => $server_url . '?' . POST_GROUPS_URL . "=$group_id") |
| 730 | 2353 | psotfx | ); |
| 731 | 2353 | psotfx | $emailer->send();
|
| 732 | 2353 | psotfx | $emailer->reset(); |
| 733 | 2353 | psotfx | } |
| 734 | 2353 | psotfx | } |
| 735 | 2353 | psotfx | } |
| 736 | 1268 | psotfx | } |
| 737 | 2353 | psotfx | //
|
| 738 | 2353 | psotfx | // END approve or deny
|
| 739 | 2353 | psotfx | //
|
| 740 | 891 | thefinn | } |
| 741 | 2353 | psotfx | else
|
| 742 | 1791 | dougk_ff7 | {
|
| 743 | 2353 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_groups_exist']); |
| 744 | 1791 | dougk_ff7 | } |
| 745 | 1791 | dougk_ff7 | |
| 746 | 1791 | dougk_ff7 | //
|
| 747 | 716 | psotfx | // Get group details
|
| 748 | 716 | psotfx | //
|
| 749 | 891 | thefinn | $sql = "SELECT * |
| 750 | 891 | thefinn | FROM " . GROUPS_TABLE . " |
| 751 | 891 | thefinn | WHERE group_id = $group_id |
| 752 | 716 | psotfx | AND group_single_user = 0";
|
| 753 | 2448 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 754 | 658 | psotfx | {
|
| 755 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql); |
| 756 | 658 | psotfx | } |
| 757 | 1268 | psotfx | |
| 758 | 2448 | psotfx | if ( !($group_info = $db->sql_fetchrow($result)) ) |
| 759 | 658 | psotfx | {
|
| 760 | 1289 | thefinn | message_die(GENERAL_MESSAGE, $lang['Group_not_exist']); |
| 761 | 658 | psotfx | } |
| 762 | 658 | psotfx | |
| 763 | 716 | psotfx | //
|
| 764 | 1469 | psotfx | // Get moderator details for this group
|
| 765 | 1469 | psotfx | //
|
| 766 | 1469 | psotfx | $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm |
| 767 | 1469 | psotfx | FROM " . USERS_TABLE . " |
| 768 | 1469 | psotfx | WHERE user_id = " . $group_info['group_moderator']; |
| 769 | 2448 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 770 | 1469 | psotfx | {
|
| 771 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql); |
| 772 | 1469 | psotfx | } |
| 773 | 1469 | psotfx | |
| 774 | 1469 | psotfx | $group_moderator = $db->sql_fetchrow($result); |
| 775 | 1469 | psotfx | |
| 776 | 1469 | psotfx | //
|
| 777 | 716 | psotfx | // Get user information for this group
|
| 778 | 716 | psotfx | //
|
| 779 | 1268 | psotfx | $sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm, ug.user_pending |
| 780 | 891 | thefinn | FROM " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug |
| 781 | 891 | thefinn | WHERE ug.group_id = $group_id |
| 782 | 891 | thefinn | AND u.user_id = ug.user_id |
| 783 | 1469 | psotfx | AND ug.user_pending = 0 |
| 784 | 1469 | psotfx | AND ug.user_id <> " . $group_moderator['user_id'] . " |
| 785 | 1469 | psotfx | ORDER BY u.username";
|
| 786 | 1974 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 787 | 716 | psotfx | {
|
| 788 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Error getting user list for group', '', __LINE__, __FILE__, $sql); |
| 789 | 716 | psotfx | } |
| 790 | 1268 | psotfx | |
| 791 | 1974 | psotfx | $group_members = $db->sql_fetchrowset($result); |
| 792 | 1996 | psotfx | $members_count = count($group_members); |
| 793 | 1974 | psotfx | $db->sql_freeresult($result); |
| 794 | 716 | psotfx | |
| 795 | 1268 | psotfx | $sql = "SELECT u.username, u.user_id, u.user_viewemail, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_msnm |
| 796 | 1268 | psotfx | FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug, " . USERS_TABLE . " u |
| 797 | 1268 | psotfx | WHERE ug.group_id = $group_id |
| 798 | 1268 | psotfx | AND g.group_id = ug.group_id |
| 799 | 1268 | psotfx | AND ug.user_pending = 1 |
| 800 | 1268 | psotfx | AND u.user_id = ug.user_id |
| 801 | 1469 | psotfx | ORDER BY u.username";
|
| 802 | 1974 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 803 | 1268 | psotfx | {
|
| 804 | 2448 | psotfx | message_die(GENERAL_ERROR, 'Error getting user pending information', '', __LINE__, __FILE__, $sql); |
| 805 | 1268 | psotfx | } |
| 806 | 658 | psotfx | |
| 807 | 1974 | psotfx | $modgroup_pending_list = $db->sql_fetchrowset($result); |
| 808 | 1974 | psotfx | $modgroup_pending_count = count($modgroup_pending_list); |
| 809 | 1974 | psotfx | $db->sql_freeresult($result); |
| 810 | 658 | psotfx | |
| 811 | 716 | psotfx | $is_group_member = 0; |
| 812 | 1974 | psotfx | if ( $members_count ) |
| 813 | 716 | psotfx | {
|
| 814 | 716 | psotfx | for($i = 0; $i < $members_count; $i++) |
| 815 | 716 | psotfx | {
|
| 816 | 1974 | psotfx | if ( $group_members[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] ) |
| 817 | 716 | psotfx | {
|
| 818 | 1268 | psotfx | $is_group_member = TRUE; |
| 819 | 716 | psotfx | } |
| 820 | 716 | psotfx | } |
| 821 | 716 | psotfx | } |
| 822 | 716 | psotfx | |
| 823 | 1268 | psotfx | $is_group_pending_member = 0; |
| 824 | 1974 | psotfx | if ( $modgroup_pending_count ) |
| 825 | 716 | psotfx | {
|
| 826 | 1268 | psotfx | for($i = 0; $i < $modgroup_pending_count; $i++) |
| 827 | 1268 | psotfx | {
|
| 828 | 1974 | psotfx | if ( $modgroup_pending_list[$i]['user_id'] == $userdata['user_id'] && $userdata['session_logged_in'] ) |
| 829 | 1268 | psotfx | {
|
| 830 | 1268 | psotfx | $is_group_pending_member = TRUE; |
| 831 | 1268 | psotfx | } |
| 832 | 1268 | psotfx | } |
| 833 | 1268 | psotfx | } |
| 834 | 1268 | psotfx | |
| 835 | 1974 | psotfx | if ( $userdata['user_level'] == ADMIN ) |
| 836 | 1268 | psotfx | {
|
| 837 | 1134 | thefinn | $is_moderator = TRUE; |
| 838 | 1268 | psotfx | } |
| 839 | 1268 | psotfx | |
| 840 | 1974 | psotfx | if ( $userdata['user_id'] == $group_info['group_moderator'] ) |
| 841 | 1268 | psotfx | {
|
| 842 | 1268 | psotfx | $is_moderator = TRUE; |
| 843 | 1268 | psotfx | |
| 844 | 716 | psotfx | $group_details = $lang['Are_group_moderator']; |
| 845 | 1268 | psotfx | |
| 846 | 2448 | psotfx | $s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />'; |
| 847 | 716 | psotfx | } |
| 848 | 1974 | psotfx | else if ( $is_group_member || $is_group_pending_member ) |
| 849 | 716 | psotfx | {
|
| 850 | 2448 | psotfx | $template->assign_block_vars('switch_unsubscribe_group_input', array()); |
| 851 | 1268 | psotfx | |
| 852 | 1268 | psotfx | $group_details = ( $is_group_pending_member ) ? $lang['Pending_this_group'] : $lang['Member_this_group']; |
| 853 | 1268 | psotfx | |
| 854 | 2448 | psotfx | $s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />'; |
| 855 | 716 | psotfx | } |
| 856 | 1974 | psotfx | else if ( $userdata['user_id'] == ANONYMOUS ) |
| 857 | 1268 | psotfx | {
|
| 858 | 1268 | psotfx | $group_details = $lang['Login_to_join']; |
| 859 | 2448 | psotfx | $s_hidden_fields = ''; |
| 860 | 1268 | psotfx | } |
| 861 | 716 | psotfx | else
|
| 862 | 716 | psotfx | {
|
| 863 | 1974 | psotfx | if ( $group_info['group_type'] == GROUP_OPEN ) |
| 864 | 716 | psotfx | {
|
| 865 | 2448 | psotfx | $template->assign_block_vars('switch_subscribe_group_input', array()); |
| 866 | 1134 | thefinn | |
| 867 | 1268 | psotfx | $group_details = $lang['This_open_group']; |
| 868 | 2448 | psotfx | $s_hidden_fields = '<input type="hidden" name="' . POST_GROUPS_URL . '" value="' . $group_id . '" />'; |
| 869 | 716 | psotfx | } |
| 870 | 1974 | psotfx | else if ( $group_info['group_type'] == GROUP_CLOSED ) |
| 871 | 716 | psotfx | {
|
| 872 | 716 | psotfx | $group_details = $lang['This_closed_group']; |
| 873 | 2448 | psotfx | $s_hidden_fields = ''; |
| 874 | 716 | psotfx | } |
| 875 | 1974 | psotfx | else if ( $group_info['group_type'] == GROUP_HIDDEN ) |
| 876 | 1268 | psotfx | {
|
| 877 | 1268 | psotfx | $group_details = $lang['This_hidden_group']; |
| 878 | 2448 | psotfx | $s_hidden_fields = ''; |
| 879 | 1268 | psotfx | } |
| 880 | 716 | psotfx | } |
| 881 | 716 | psotfx | |
| 882 | 1268 | psotfx | $page_title = $lang['Group_Control_Panel']; |
| 883 | 1268 | psotfx | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 884 | 1268 | psotfx | |
| 885 | 1268 | psotfx | //
|
| 886 | 1268 | psotfx | // Load templates
|
| 887 | 1268 | psotfx | //
|
| 888 | 1268 | psotfx | $template->set_filenames(array( |
| 889 | 2448 | psotfx | 'info' => 'groupcp_info_body.tpl', |
| 890 | 2448 | psotfx | 'pendinginfo' => 'groupcp_pending_info.tpl') |
| 891 | 1268 | psotfx | ); |
| 892 | 2448 | psotfx | make_jumpbox('viewforum.'.$phpEx); |
| 893 | 1268 | psotfx | |
| 894 | 1469 | psotfx | //
|
| 895 | 1469 | psotfx | // Add the moderator
|
| 896 | 1469 | psotfx | //
|
| 897 | 1469 | psotfx | $username = $group_moderator['username']; |
| 898 | 1469 | psotfx | $user_id = $group_moderator['user_id']; |
| 899 | 1469 | psotfx | |
| 900 | 2471 | psotfx | generate_user_info($group_moderator, $board_config['default_dateformat'], $is_moderator, $from, $posts, $joined, $poster_avatar, $profile_img, $profile, $search_img, $search, $pm_img, $pm, $email_img, $email, $www_img, $www, $icq_status_img, $icq_img, $icq, $aim_img, $aim, $msn_img, $msn, $yim_img, $yim); |
| 901 | 1469 | psotfx | |
| 902 | 1268 | psotfx | $template->assign_vars(array( |
| 903 | 2448 | psotfx | 'L_GROUP_INFORMATION' => $lang['Group_Information'], |
| 904 | 2448 | psotfx | 'L_GROUP_NAME' => $lang['Group_name'], |
| 905 | 2448 | psotfx | 'L_GROUP_DESC' => $lang['Group_description'], |
| 906 | 2448 | psotfx | 'L_GROUP_TYPE' => $lang['Group_type'], |
| 907 | 2448 | psotfx | 'L_GROUP_MEMBERSHIP' => $lang['Group_membership'], |
| 908 | 2448 | psotfx | 'L_SUBSCRIBE' => $lang['Subscribe'], |
| 909 | 2448 | psotfx | 'L_UNSUBSCRIBE' => $lang['Unsubscribe'], |
| 910 | 2448 | psotfx | 'L_JOIN_GROUP' => $lang['Join_group'], |
| 911 | 2448 | psotfx | 'L_UNSUBSCRIBE_GROUP' => $lang['Unsubscribe'], |
| 912 | 2448 | psotfx | 'L_GROUP_OPEN' => $lang['Group_open'], |
| 913 | 2448 | psotfx | 'L_GROUP_CLOSED' => $lang['Group_closed'], |
| 914 | 2448 | psotfx | 'L_GROUP_HIDDEN' => $lang['Group_hidden'], |
| 915 | 2448 | psotfx | 'L_UPDATE' => $lang['Update'], |
| 916 | 2448 | psotfx | 'L_GROUP_MODERATOR' => $lang['Group_Moderator'], |
| 917 | 2448 | psotfx | 'L_GROUP_MEMBERS' => $lang['Group_Members'], |
| 918 | 2448 | psotfx | 'L_PENDING_MEMBERS' => $lang['Pending_members'], |
| 919 | 2448 | psotfx | 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], |
| 920 | 2448 | psotfx | 'L_PM' => $lang['Private_Message'], |
| 921 | 2492 | psotfx | 'L_EMAIL' => $lang['Email'], |
| 922 | 2492 | psotfx | 'L_POSTS' => $lang['Posts'], |
| 923 | 2448 | psotfx | 'L_WEBSITE' => $lang['Website'], |
| 924 | 2448 | psotfx | 'L_FROM' => $lang['Location'], |
| 925 | 2448 | psotfx | 'L_ORDER' => $lang['Order'], |
| 926 | 2448 | psotfx | 'L_SORT' => $lang['Sort'], |
| 927 | 2448 | psotfx | 'L_SUBMIT' => $lang['Sort'], |
| 928 | 2448 | psotfx | 'L_AIM' => $lang['AIM'], |
| 929 | 2448 | psotfx | 'L_YIM' => $lang['YIM'], |
| 930 | 2448 | psotfx | 'L_MSNM' => $lang['MSNM'], |
| 931 | 2448 | psotfx | 'L_ICQ' => $lang['ICQ'], |
| 932 | 2448 | psotfx | 'L_SELECT' => $lang['Select'], |
| 933 | 2448 | psotfx | 'L_REMOVE_SELECTED' => $lang['Remove_selected'], |
| 934 | 2448 | psotfx | 'L_ADD_MEMBER' => $lang['Add_member'], |
| 935 | 2448 | psotfx | 'L_FIND_USERNAME' => $lang['Find_username'], |
| 936 | 658 | psotfx | |
| 937 | 2448 | psotfx | 'GROUP_NAME' => $group_info['group_name'], |
| 938 | 2448 | psotfx | 'GROUP_DESC' => $group_info['group_description'], |
| 939 | 2448 | psotfx | 'GROUP_DETAILS' => $group_details, |
| 940 | 2448 | psotfx | 'MOD_ROW_COLOR' => '#' . $theme['td_color1'], |
| 941 | 2448 | psotfx | 'MOD_ROW_CLASS' => $theme['td_class1'], |
| 942 | 2448 | psotfx | 'MOD_USERNAME' => $username, |
| 943 | 2448 | psotfx | 'MOD_FROM' => $from, |
| 944 | 2448 | psotfx | 'MOD_JOINED' => $joined, |
| 945 | 2448 | psotfx | 'MOD_POSTS' => $posts, |
| 946 | 2448 | psotfx | 'MOD_AVATAR_IMG' => $poster_avatar, |
| 947 | 2448 | psotfx | 'MOD_PROFILE_IMG' => $profile_img, |
| 948 | 2448 | psotfx | 'MOD_PROFILE' => $profile, |
| 949 | 2448 | psotfx | 'MOD_SEARCH_IMG' => $search_img, |
| 950 | 2448 | psotfx | 'MOD_SEARCH' => $search, |
| 951 | 2448 | psotfx | 'MOD_PM_IMG' => $pm_img, |
| 952 | 2448 | psotfx | 'MOD_PM' => $pm, |
| 953 | 2448 | psotfx | 'MOD_EMAIL_IMG' => $email_img, |
| 954 | 2448 | psotfx | 'MOD_EMAIL' => $email, |
| 955 | 2448 | psotfx | 'MOD_WWW_IMG' => $www_img, |
| 956 | 2448 | psotfx | 'MOD_WWW' => $www, |
| 957 | 2448 | psotfx | 'MOD_ICQ_STATUS_IMG' => $icq_status_img, |
| 958 | 2448 | psotfx | 'MOD_ICQ_IMG' => $icq_img, |
| 959 | 2448 | psotfx | 'MOD_ICQ' => $icq, |
| 960 | 2448 | psotfx | 'MOD_AIM_IMG' => $aim_img, |
| 961 | 2448 | psotfx | 'MOD_AIM' => $aim, |
| 962 | 2448 | psotfx | 'MOD_MSN_IMG' => $msn_img, |
| 963 | 2448 | psotfx | 'MOD_MSN' => $msn, |
| 964 | 2448 | psotfx | 'MOD_YIM_IMG' => $yim_img, |
| 965 | 2448 | psotfx | 'MOD_YIM' => $yim, |
| 966 | 891 | thefinn | |
| 967 | 2448 | psotfx | 'U_MOD_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"), |
| 968 | 2448 | psotfx | 'U_SEARCH_USER' => append_sid("search.$phpEx?mode=searchuser"), |
| 969 | 658 | psotfx | |
| 970 | 2448 | psotfx | 'S_GROUP_OPEN_TYPE' => GROUP_OPEN, |
| 971 | 2448 | psotfx | 'S_GROUP_CLOSED_TYPE' => GROUP_CLOSED, |
| 972 | 2448 | psotfx | 'S_GROUP_HIDDEN_TYPE' => GROUP_HIDDEN, |
| 973 | 2448 | psotfx | 'S_GROUP_OPEN_CHECKED' => ( $group_info['group_type'] == GROUP_OPEN ) ? ' checked="checked"' : '', |
| 974 | 2448 | psotfx | 'S_GROUP_CLOSED_CHECKED' => ( $group_info['group_type'] == GROUP_CLOSED ) ? ' checked="checked"' : '', |
| 975 | 2448 | psotfx | 'S_GROUP_HIDDEN_CHECKED' => ( $group_info['group_type'] == GROUP_HIDDEN ) ? ' checked="checked"' : '', |
| 976 | 2448 | psotfx | 'S_HIDDEN_FIELDS' => $s_hidden_fields, |
| 977 | 2448 | psotfx | 'S_MODE_SELECT' => $select_sort_mode, |
| 978 | 2448 | psotfx | 'S_ORDER_SELECT' => $select_sort_order, |
| 979 | 2448 | psotfx | 'S_GROUPCP_ACTION' => append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id")) |
| 980 | 1268 | psotfx | ); |
| 981 | 1268 | psotfx | |
| 982 | 1469 | psotfx | //
|
| 983 | 1469 | psotfx | // Dump out the remaining users
|
| 984 | 1469 | psotfx | //
|
| 985 | 1469 | psotfx | for($i = $start; $i < min($board_config['topics_per_page'] + $start, $members_count); $i++) |
| 986 | 658 | psotfx | {
|
| 987 | 1268 | psotfx | $username = $group_members[$i]['username']; |
| 988 | 1268 | psotfx | $user_id = $group_members[$i]['user_id']; |
| 989 | 658 | psotfx | |
| 990 | 2471 | psotfx | generate_user_info($group_members[$i], $board_config['default_dateformat'], $is_moderator, $from, $posts, $joined, $poster_avatar, $profile_img, $profile, $search_img, $search, $pm_img, $pm, $email_img, $email, $www_img, $www, $icq_status_img, $icq_img, $icq, $aim_img, $aim, $msn_img, $msn, $yim_img, $yim); |
| 991 | 891 | thefinn | |
| 992 | 1974 | psotfx | if ( $group_info['group_type'] != GROUP_HIDDEN || $is_group_member || $is_moderator ) |
| 993 | 1268 | psotfx | {
|
| 994 | 1469 | psotfx | $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; |
| 995 | 1469 | psotfx | $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; |
| 996 | 891 | thefinn | |
| 997 | 2448 | psotfx | $template->assign_block_vars('member_row', array( |
| 998 | 2448 | psotfx | 'ROW_COLOR' => '#' . $row_color, |
| 999 | 2448 | psotfx | 'ROW_CLASS' => $row_class, |
| 1000 | 2448 | psotfx | 'USERNAME' => $username, |
| 1001 | 2448 | psotfx | 'FROM' => $from, |
| 1002 | 2448 | psotfx | 'JOINED' => $joined, |
| 1003 | 2448 | psotfx | 'POSTS' => $posts, |
| 1004 | 2448 | psotfx | 'USER_ID' => $user_id, |
| 1005 | 2448 | psotfx | 'AVATAR_IMG' => $poster_avatar, |
| 1006 | 2448 | psotfx | 'PROFILE_IMG' => $profile_img, |
| 1007 | 2448 | psotfx | 'PROFILE' => $profile, |
| 1008 | 2448 | psotfx | 'SEARCH_IMG' => $search_img, |
| 1009 | 2448 | psotfx | 'SEARCH' => $search, |
| 1010 | 2448 | psotfx | 'PM_IMG' => $pm_img, |
| 1011 | 2448 | psotfx | 'PM' => $pm, |
| 1012 | 2448 | psotfx | 'EMAIL_IMG' => $email_img, |
| 1013 | 2448 | psotfx | 'EMAIL' => $email, |
| 1014 | 2448 | psotfx | 'WWW_IMG' => $www_img, |
| 1015 | 2448 | psotfx | 'WWW' => $www, |
| 1016 | 2448 | psotfx | 'ICQ_STATUS_IMG' => $icq_status_img, |
| 1017 | 2448 | psotfx | 'ICQ_IMG' => $icq_img, |
| 1018 | 2448 | psotfx | 'ICQ' => $icq, |
| 1019 | 2448 | psotfx | 'AIM_IMG' => $aim_img, |
| 1020 | 2448 | psotfx | 'AIM' => $aim, |
| 1021 | 2448 | psotfx | 'MSN_IMG' => $msn_img, |
| 1022 | 2448 | psotfx | 'MSN' => $msn, |
| 1023 | 2448 | psotfx | 'YIM_IMG' => $yim_img, |
| 1024 | 2448 | psotfx | 'YIM' => $yim, |
| 1025 | 2448 | psotfx | |
| 1026 | 2448 | psotfx | 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id")) |
| 1027 | 1469 | psotfx | ); |
| 1028 | 1268 | psotfx | |
| 1029 | 1974 | psotfx | if ( $is_moderator ) |
| 1030 | 1469 | psotfx | {
|
| 1031 | 2448 | psotfx | $template->assign_block_vars('member_row.switch_mod_option', array()); |
| 1032 | 658 | psotfx | } |
| 1033 | 658 | psotfx | } |
| 1034 | 1268 | psotfx | } |
| 1035 | 658 | psotfx | |
| 1036 | 1974 | psotfx | if ( !$members_count ) |
| 1037 | 1268 | psotfx | {
|
| 1038 | 1268 | psotfx | //
|
| 1039 | 1268 | psotfx | // No group members
|
| 1040 | 1268 | psotfx | //
|
| 1041 | 2448 | psotfx | $template->assign_block_vars('switch_no_members', array()); |
| 1042 | 658 | psotfx | $template->assign_vars(array( |
| 1043 | 2448 | psotfx | 'L_NO_MEMBERS' => $lang['No_group_members']) |
| 1044 | 658 | psotfx | ); |
| 1045 | 1268 | psotfx | } |
| 1046 | 2448 | psotfx | |
| 1047 | 2448 | psotfx | $current_page = ( !$members_count ) ? 1 : ceil( $members_count / $board_config['topics_per_page'] ); |
| 1048 | 2448 | psotfx | |
| 1049 | 1469 | psotfx | $template->assign_vars(array( |
| 1050 | 2448 | psotfx | 'PAGINATION' => generate_pagination("groupcp.$phpEx?" . POST_GROUPS_URL . "=$group_id", $members_count, $board_config['topics_per_page'], $start), |
| 1051 | 2448 | psotfx | 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), $current_page ), |
| 1052 | 1469 | psotfx | |
| 1053 | 2448 | psotfx | 'L_GOTO_PAGE' => $lang['Goto_page']) |
| 1054 | 1469 | psotfx | ); |
| 1055 | 1469 | psotfx | |
| 1056 | 1974 | psotfx | if ( $group_info['group_type'] == GROUP_HIDDEN && !$is_group_member && !$is_moderator ) |
| 1057 | 658 | psotfx | {
|
| 1058 | 658 | psotfx | //
|
| 1059 | 658 | psotfx | // No group members
|
| 1060 | 658 | psotfx | //
|
| 1061 | 2448 | psotfx | $template->assign_block_vars('switch_hidden_group', array()); |
| 1062 | 891 | thefinn | $template->assign_vars(array( |
| 1063 | 2448 | psotfx | 'L_HIDDEN_MEMBERS' => $lang['Group_hidden_members']) |
| 1064 | 891 | thefinn | ); |
| 1065 | 658 | psotfx | } |
| 1066 | 658 | psotfx | |
| 1067 | 891 | thefinn | //
|
| 1068 | 1268 | psotfx | // We've displayed the members who belong to the group, now we
|
| 1069 | 1268 | psotfx | // do that pending memebers...
|
| 1070 | 891 | thefinn | //
|
| 1071 | 1974 | psotfx | if ( $is_moderator ) |
| 1072 | 891 | thefinn | {
|
| 1073 | 1268 | psotfx | //
|
| 1074 | 1268 | psotfx | // Users pending in ONLY THIS GROUP (which is moderated by this user)
|
| 1075 | 1268 | psotfx | //
|
| 1076 | 1974 | psotfx | if ( $modgroup_pending_count ) |
| 1077 | 891 | thefinn | {
|
| 1078 | 1268 | psotfx | for($i = 0; $i < $modgroup_pending_count; $i++) |
| 1079 | 1268 | psotfx | {
|
| 1080 | 1268 | psotfx | $username = $modgroup_pending_list[$i]['username']; |
| 1081 | 1268 | psotfx | $user_id = $modgroup_pending_list[$i]['user_id']; |
| 1082 | 891 | thefinn | |
| 1083 | 2471 | psotfx | generate_user_info($modgroup_pending_list[$i], $board_config['default_dateformat'], $is_moderator, $from, $posts, $joined, $poster_avatar, $profile_img, $profile, $search_img, $search, $pm_img, $pm, $email_img, $email, $www_img, $www, $icq_status_img, $icq_img, $icq, $aim_img, $aim, $msn_img, $msn, $yim_img, $yim); |
| 1084 | 891 | thefinn | |
| 1085 | 1268 | psotfx | $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; |
| 1086 | 1268 | psotfx | $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; |
| 1087 | 891 | thefinn | |
| 1088 | 1268 | psotfx | $user_select = '<input type="checkbox" name="member[]" value="' . $user_id . '">'; |
| 1089 | 891 | thefinn | |
| 1090 | 2448 | psotfx | $template->assign_block_vars('pending_members_row', array( |
| 1091 | 2448 | psotfx | 'ROW_CLASS' => $row_class, |
| 1092 | 2448 | psotfx | 'ROW_COLOR' => '#' . $row_color, |
| 1093 | 2448 | psotfx | 'USERNAME' => $username, |
| 1094 | 2448 | psotfx | 'FROM' => $from, |
| 1095 | 2448 | psotfx | 'JOINED' => $joined, |
| 1096 | 2448 | psotfx | 'POSTS' => $posts, |
| 1097 | 2448 | psotfx | 'USER_ID' => $user_id, |
| 1098 | 2448 | psotfx | 'AVATAR_IMG' => $poster_avatar, |
| 1099 | 2448 | psotfx | 'PROFILE_IMG' => $profile_img, |
| 1100 | 2448 | psotfx | 'PROFILE' => $profile, |
| 1101 | 2448 | psotfx | 'SEARCH_IMG' => $search_img, |
| 1102 | 2448 | psotfx | 'SEARCH' => $search, |
| 1103 | 2448 | psotfx | 'PM_IMG' => $pm_img, |
| 1104 | 2448 | psotfx | 'PM' => $pm, |
| 1105 | 2448 | psotfx | 'EMAIL_IMG' => $email_img, |
| 1106 | 2448 | psotfx | 'EMAIL' => $email, |
| 1107 | 2448 | psotfx | 'WWW_IMG' => $www_img, |
| 1108 | 2448 | psotfx | 'WWW' => $www, |
| 1109 | 2448 | psotfx | 'ICQ_STATUS_IMG' => $icq_status_img, |
| 1110 | 2448 | psotfx | 'ICQ_IMG' => $icq_img, |
| 1111 | 2448 | psotfx | 'ICQ' => $icq, |
| 1112 | 2448 | psotfx | 'AIM_IMG' => $aim_img, |
| 1113 | 2448 | psotfx | 'AIM' => $aim, |
| 1114 | 2448 | psotfx | 'MSN_IMG' => $msn_img, |
| 1115 | 2448 | psotfx | 'MSN' => $msn, |
| 1116 | 2448 | psotfx | 'YIM_IMG' => $yim_img, |
| 1117 | 2448 | psotfx | 'YIM' => $yim, |
| 1118 | 2448 | psotfx | |
| 1119 | 2448 | psotfx | 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id")) |
| 1120 | 1268 | psotfx | ); |
| 1121 | 1268 | psotfx | } |
| 1122 | 1268 | psotfx | |
| 1123 | 2448 | psotfx | $template->assign_block_vars('switch_pending_members', array() ); |
| 1124 | 1268 | psotfx | |
| 1125 | 1268 | psotfx | $template->assign_vars(array( |
| 1126 | 2448 | psotfx | 'L_SELECT' => $lang['Select'], |
| 1127 | 2448 | psotfx | 'L_APPROVE_SELECTED' => $lang['Approve_selected'], |
| 1128 | 2448 | psotfx | 'L_DENY_SELECTED' => $lang['Deny_selected']) |
| 1129 | 891 | thefinn | ); |
| 1130 | 1268 | psotfx | |
| 1131 | 2448 | psotfx | $template->assign_var_from_handle('PENDING_USER_BOX', 'pendinginfo'); |
| 1132 | 1268 | psotfx | |
| 1133 | 891 | thefinn | } |
| 1134 | 891 | thefinn | } |
| 1135 | 891 | thefinn | |
| 1136 | 1974 | psotfx | if ( $is_moderator ) |
| 1137 | 1268 | psotfx | {
|
| 1138 | 2448 | psotfx | $template->assign_block_vars('switch_mod_option', array()); |
| 1139 | 2448 | psotfx | $template->assign_block_vars('switch_add_member', array()); |
| 1140 | 1268 | psotfx | } |
| 1141 | 891 | thefinn | |
| 1142 | 2448 | psotfx | $template->pparse('info'); |
| 1143 | 658 | psotfx | } |
| 1144 | 891 | thefinn | else
|
| 1145 | 661 | psotfx | {
|
| 1146 | 2353 | psotfx | //
|
| 1147 | 2353 | psotfx | // Show the main groupcp.php screen where the user can select a group.
|
| 1148 | 2353 | psotfx | //
|
| 1149 | 2165 | bartvb | // Select all group that the user is a member of or where the user has
|
| 1150 | 2165 | bartvb | // a pending membership.
|
| 1151 | 2165 | bartvb | //
|
| 1152 | 2353 | psotfx | if ( $userdata['session_logged_in'] ) |
| 1153 | 661 | psotfx | {
|
| 1154 | 2353 | psotfx | $sql = "SELECT g.group_id, g.group_name, g.group_type, ug.user_pending |
| 1155 | 2353 | psotfx | FROM " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug |
| 1156 | 2353 | psotfx | WHERE ug.user_id = " . $userdata['user_id'] . " |
| 1157 | 2353 | psotfx | AND ug.group_id = g.group_id |
| 1158 | 2353 | psotfx | AND g.group_single_user <> " . TRUE . " |
| 1159 | 2353 | psotfx | ORDER BY g.group_name, ug.user_id";
|
| 1160 | 2353 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 1161 | 2353 | psotfx | {
|
| 1162 | 2411 | psotfx | message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql); |
| 1163 | 2353 | psotfx | } |
| 1164 | 1268 | psotfx | |
| 1165 | 2353 | psotfx | if ( $row = $db->sql_fetchrow($result) ) |
| 1166 | 2353 | psotfx | {
|
| 1167 | 2353 | psotfx | $in_group = array(); |
| 1168 | 2411 | psotfx | $s_member_groups_opt = ''; |
| 1169 | 2411 | psotfx | $s_pending_groups_opt = ''; |
| 1170 | 2259 | psotfx | |
| 1171 | 2353 | psotfx | do
|
| 1172 | 2259 | psotfx | {
|
| 1173 | 2353 | psotfx | $in_group[] = $row['group_id']; |
| 1174 | 2353 | psotfx | if ( $row['user_pending'] ) |
| 1175 | 2353 | psotfx | {
|
| 1176 | 2353 | psotfx | $s_pending_groups_opt .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>'; |
| 1177 | 2353 | psotfx | } |
| 1178 | 2353 | psotfx | else
|
| 1179 | 2353 | psotfx | {
|
| 1180 | 2353 | psotfx | $s_member_groups_opt .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>'; |
| 1181 | 2353 | psotfx | } |
| 1182 | 2259 | psotfx | } |
| 1183 | 2353 | psotfx | while( $row = $db->sql_fetchrow($result) ); |
| 1184 | 2353 | psotfx | |
| 1185 | 2359 | psotfx | $s_pending_groups = '<select name="' . POST_GROUPS_URL . '">' . $s_pending_groups_opt . "</select>"; |
| 1186 | 2359 | psotfx | $s_member_groups = '<select name="' . POST_GROUPS_URL . '">' . $s_member_groups_opt . "</select>"; |
| 1187 | 2359 | psotfx | } |
| 1188 | 661 | psotfx | } |
| 1189 | 2259 | psotfx | |
| 1190 | 2165 | bartvb | //
|
| 1191 | 2165 | bartvb | // Select all other groups i.e. groups that this user is not a member of
|
| 1192 | 2165 | bartvb | //
|
| 1193 | 2448 | psotfx | $ignore_group_sql = ( count($in_group) ) ? "AND group_id NOT IN (" . implode(', ', $in_group) . ")" : ''; |
| 1194 | 2353 | psotfx | $sql = "SELECT group_id, group_name, group_type |
| 1195 | 2122 | psotfx | FROM " . GROUPS_TABLE . " g |
| 1196 | 2353 | psotfx | WHERE group_single_user <> " . TRUE . " |
| 1197 | 2154 | psotfx | $ignore_group_sql |
| 1198 | 1974 | psotfx | ORDER BY g.group_name";
|
| 1199 | 1974 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 1200 | 716 | psotfx | {
|
| 1201 | 2353 | psotfx | message_die(GENERAL_ERROR, 'Error getting group information', '', __LINE__, __FILE__, $sql); |
| 1202 | 716 | psotfx | } |
| 1203 | 891 | thefinn | |
| 1204 | 2353 | psotfx | $s_group_list_opt = ''; |
| 1205 | 1974 | psotfx | while( $row = $db->sql_fetchrow($result) ) |
| 1206 | 1974 | psotfx | {
|
| 1207 | 2353 | psotfx | if ( $row['group_type'] != GROUP_HIDDEN || $userdata['user_level'] == ADMIN ) |
| 1208 | 2353 | psotfx | {
|
| 1209 | 2353 | psotfx | $s_group_list_opt .='<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>'; |
| 1210 | 2353 | psotfx | } |
| 1211 | 1974 | psotfx | } |
| 1212 | 2411 | psotfx | $s_group_list = '<select name="' . POST_GROUPS_URL . '">' . $s_group_list_opt . '</select>'; |
| 1213 | 1974 | psotfx | |
| 1214 | 2411 | psotfx | if ( $s_group_list_opt != '' || $s_pending_groups_opt != '' || $s_member_groups_opt != '' ) |
| 1215 | 2411 | psotfx | {
|
| 1216 | 2411 | psotfx | //
|
| 1217 | 2411 | psotfx | // Load and process templates
|
| 1218 | 2411 | psotfx | //
|
| 1219 | 2411 | psotfx | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 1220 | 1268 | psotfx | |
| 1221 | 2411 | psotfx | $template->set_filenames(array( |
| 1222 | 2448 | psotfx | 'user' => 'groupcp_user_body.tpl') |
| 1223 | 2411 | psotfx | ); |
| 1224 | 2448 | psotfx | make_jumpbox('viewforum.'.$phpEx); |
| 1225 | 1268 | psotfx | |
| 1226 | 2411 | psotfx | if ( $s_pending_groups_opt != '' || $s_member_groups_opt != '' ) |
| 1227 | 2411 | psotfx | {
|
| 1228 | 2448 | psotfx | $template->assign_block_vars('switch_groups_joined', array() ); |
| 1229 | 2411 | psotfx | } |
| 1230 | 1268 | psotfx | |
| 1231 | 2411 | psotfx | if ( $s_member_groups_opt != '' ) |
| 1232 | 2411 | psotfx | {
|
| 1233 | 2448 | psotfx | $template->assign_block_vars('switch_groups_joined.switch_groups_member', array() ); |
| 1234 | 2411 | psotfx | } |
| 1235 | 661 | psotfx | |
| 1236 | 2411 | psotfx | if ( $s_pending_groups_opt != '' ) |
| 1237 | 2411 | psotfx | {
|
| 1238 | 2448 | psotfx | $template->assign_block_vars('switch_groups_joined.switch_groups_pending', array() ); |
| 1239 | 2411 | psotfx | } |
| 1240 | 1268 | psotfx | |
| 1241 | 2411 | psotfx | if ( $s_group_list_opt != '' ) |
| 1242 | 2411 | psotfx | {
|
| 1243 | 2448 | psotfx | $template->assign_block_vars('switch_groups_remaining', array() ); |
| 1244 | 2411 | psotfx | } |
| 1245 | 1268 | psotfx | |
| 1246 | 2411 | psotfx | $s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />'; |
| 1247 | 1601 | psotfx | |
| 1248 | 2411 | psotfx | $template->assign_vars(array( |
| 1249 | 2411 | psotfx | 'L_GROUP_MEMBERSHIP_DETAILS' => $lang['Group_member_details'], |
| 1250 | 2411 | psotfx | 'L_JOIN_A_GROUP' => $lang['Group_member_join'], |
| 1251 | 2411 | psotfx | 'L_YOU_BELONG_GROUPS' => $lang['Current_memberships'], |
| 1252 | 2411 | psotfx | 'L_SELECT_A_GROUP' => $lang['Non_member_groups'], |
| 1253 | 2411 | psotfx | 'L_PENDING_GROUPS' => $lang['Memberships_pending'], |
| 1254 | 2411 | psotfx | 'L_SUBSCRIBE' => $lang['Subscribe'], |
| 1255 | 2411 | psotfx | 'L_UNSUBSCRIBE' => $lang['Unsubscribe'], |
| 1256 | 2411 | psotfx | 'L_VIEW_INFORMATION' => $lang['View_Information'], |
| 1257 | 661 | psotfx | |
| 1258 | 2411 | psotfx | 'S_USERGROUP_ACTION' => append_sid("groupcp.$phpEx"), |
| 1259 | 2411 | psotfx | 'S_HIDDEN_FIELDS' => $s_hidden_fields, |
| 1260 | 1598 | psotfx | |
| 1261 | 2411 | psotfx | 'GROUP_LIST_SELECT' => $s_group_list, |
| 1262 | 2411 | psotfx | 'GROUP_PENDING_SELECT' => $s_pending_groups, |
| 1263 | 2411 | psotfx | 'GROUP_MEMBER_SELECT' => $s_member_groups) |
| 1264 | 2411 | psotfx | ); |
| 1265 | 661 | psotfx | |
| 1266 | 2411 | psotfx | $template->pparse('user'); |
| 1267 | 2411 | psotfx | } |
| 1268 | 2411 | psotfx | else
|
| 1269 | 2411 | psotfx | {
|
| 1270 | 2411 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_groups_exist']); |
| 1271 | 2411 | psotfx | } |
| 1272 | 891 | thefinn | |
| 1273 | 661 | psotfx | } |
| 1274 | 661 | psotfx | |
| 1275 | 646 | psotfx | include($phpbb_root_path . 'includes/page_tail.'.$phpEx); |
| 1276 | 606 | psotfx | |
| 1277 | 2247 | psotfx | ?> |

