Changeset 702 for trunk/forum/includes/acp/acp_inactive.php
- Timestamp:
- Mar 31, 2010, 6:32:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/forum/includes/acp/acp_inactive.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_inactive.php 8598 2008-06-04 15:37:06Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2006 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 52 52 add_form_key($form_key); 53 53 54 // We build the sort key and per page settings here, because they may be needed later 55 56 // Number of entries to display 57 $per_page = request_var('users_per_page', (int) $config['topics_per_page']); 58 59 // Sorting 60 $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); 61 $sort_by_text = array('i' => $user->lang['SORT_INACTIVE'], 'j' => $user->lang['SORT_REG_DATE'], 'l' => $user->lang['SORT_LAST_VISIT'], 'd' => $user->lang['SORT_LAST_REMINDER'], 'r' => $user->lang['SORT_REASON'], 'u' => $user->lang['SORT_USERNAME'], 'p' => $user->lang['SORT_POSTS'], 'e' => $user->lang['SORT_REMINDER']); 62 $sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'd' => 'user_reminded_time', 'r' => 'user_inactive_reason', 'u' => 'username_clean', 'p' => 'user_posts', 'e' => 'user_reminded'); 63 64 $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; 65 gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); 66 54 67 if ($submit && sizeof($mark)) 55 68 { … … 68 81 WHERE ' . $db->sql_in_set('user_id', $mark); 69 82 $result = $db->sql_query($sql); 70 83 71 84 $user_affected = array(); 72 85 while ($row = $db->sql_fetchrow($result)) … … 78 91 if ($action == 'activate') 79 92 { 80 if ($config['require_activation'] == USER_ACTIVATION_ADMIN) 81 { 82 // Get those 'being activated'... 83 $sql = 'SELECT user_id, username, user_email, user_lang 84 FROM ' . USERS_TABLE . ' 85 WHERE ' . $db->sql_in_set('user_id', $mark) . ' 86 AND user_type = ' . USER_INACTIVE; 87 $result = $db->sql_query($sql); 88 89 $inactive_users = array(); 90 while ($row = $db->sql_fetchrow($result)) 91 { 92 $inactive_users[] = $row; 93 } 94 $db->sql_freeresult($result); 95 } 93 // Get those 'being activated'... 94 $sql = 'SELECT user_id, username' . (($config['require_activation'] == USER_ACTIVATION_ADMIN) ? ', user_email, user_lang' : '') . ' 95 FROM ' . USERS_TABLE . ' 96 WHERE ' . $db->sql_in_set('user_id', $mark) . ' 97 AND user_type = ' . USER_INACTIVE; 98 $result = $db->sql_query($sql); 99 100 $inactive_users = array(); 101 while ($row = $db->sql_fetchrow($result)) 102 { 103 $inactive_users[] = $row; 104 } 105 $db->sql_freeresult($result); 96 106 97 107 user_active_flip('activate', $mark); … … 101 111 include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); 102 112 103 $messenger = new messenger( );113 $messenger = new messenger(false); 104 114 105 115 foreach ($inactive_users as $row) … … 112 122 $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); 113 123 $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); 124 $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); 114 125 115 126 $messenger->assign_vars(array( … … 122 133 $messenger->save_queue(); 123 134 } 135 136 if (!empty($inactive_users)) 137 { 138 foreach ($inactive_users as $row) 139 { 140 add_log('admin', 'LOG_USER_ACTIVE', $row['username']); 141 add_log('user', $row['user_id'], 'LOG_USER_ACTIVE_USER'); 142 } 143 } 144 145 // For activate we really need to redirect, else a refresh can result in users being deactivated again 146 $u_action = $this->u_action . "&$u_sort_param&start=$start"; 147 $u_action .= ($per_page != $config['topics_per_page']) ? "&users_per_page=$per_page" : ''; 148 149 redirect($u_action); 124 150 } 125 151 else if ($action == 'delete') … … 162 188 $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey 163 189 FROM ' . USERS_TABLE . ' 164 WHERE ' . $db->sql_in_set('user_id', $mark); 190 WHERE ' . $db->sql_in_set('user_id', $mark) . ' 191 AND user_inactive_reason'; 192 193 $sql .= ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? ' = ' . INACTIVE_REMIND : ' <> ' . INACTIVE_MANUAL; 194 165 195 $result = $db->sql_query($sql); 166 196 … … 171 201 172 202 $messenger = new messenger(); 173 $usernames = array();203 $usernames = $user_ids = array(); 174 204 175 205 do … … 180 210 $messenger->im($row['user_jabber'], $row['username']); 181 211 212 $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); 213 $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); 214 $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); 215 $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); 216 182 217 $messenger->assign_vars(array( 183 218 'USERNAME' => htmlspecialchars_decode($row['username']), 184 'REGISTER_DATE' => $user->format_date($row['user_regdate'] ),219 'REGISTER_DATE' => $user->format_date($row['user_regdate'], false, true), 185 220 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey']) 186 221 ); … … 189 224 190 225 $usernames[] = $row['username']; 226 $user_ids[] = (int) $row['user_id']; 191 227 } 192 228 while ($row = $db->sql_fetchrow($result)); 193 229 194 230 $messenger->save_queue(); 231 232 // Add the remind state to the database 233 $sql = 'UPDATE ' . USERS_TABLE . ' 234 SET user_reminded = user_reminded + 1, 235 user_reminded_time = ' . time() . ' 236 WHERE ' . $db->sql_in_set('user_id', $user_ids); 237 $db->sql_query($sql); 195 238 196 239 add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames)); … … 198 241 } 199 242 $db->sql_freeresult($result); 200 243 244 // For remind we really need to redirect, else a refresh can result in more than one reminder 245 $u_action = $this->u_action . "&$u_sort_param&start=$start"; 246 $u_action .= ($per_page != $config['topics_per_page']) ? "&users_per_page=$per_page" : ''; 247 248 redirect($u_action); 249 201 250 break; 202 251 } 203 252 } 204 253 205 // Sorting206 $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);207 $sort_by_text = array('i' => $user->lang['SORT_INACTIVE'], 'j' => $user->lang['SORT_REG_DATE'], 'l' => $user->lang['SORT_LAST_VISIT'], 'r' => $user->lang['SORT_REASON'], 'u' => $user->lang['SORT_USERNAME']);208 $sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'r' => 'user_inactive_reason', 'u' => 'username_clean');209 210 $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';211 gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);212 213 254 // Define where and sort sql for use in displaying logs 214 255 $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; … … 218 259 $inactive_count = 0; 219 260 220 $start = view_inactive_users($inactive, $inactive_count, $ config['topics_per_page'], $start, $sql_where, $sql_sort);261 $start = view_inactive_users($inactive, $inactive_count, $per_page, $start, $sql_where, $sql_sort); 221 262 222 263 foreach ($inactive as $row) … … 224 265 $template->assign_block_vars('inactive', array( 225 266 'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']), 267 'REMINDED_DATE' => $user->format_date($row['user_reminded_time']), 226 268 'JOINED' => $user->format_date($row['user_regdate']), 227 269 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']), 270 228 271 'REASON' => $row['inactive_reason'], 229 272 'USER_ID' => $row['user_id'], 230 'USERNAME' => $row['username'], 231 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}")) 232 ); 273 'POSTS' => ($row['user_posts']) ? $row['user_posts'] : 0, 274 'REMINDED' => $row['user_reminded'], 275 276 'REMINDED_EXPLAIN' => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])), 277 278 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview')), 279 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), 280 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), 281 282 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}"), 283 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&sr=posts") : '', 284 )); 233 285 } 234 286 … … 246 298 'S_SORT_KEY' => $s_sort_key, 247 299 'S_SORT_DIR' => $s_sort_dir, 248 'S_ON_PAGE' => on_page($inactive_count, $config['topics_per_page'], $start), 249 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $inactive_count, $config['topics_per_page'], $start, true), 250 300 'S_ON_PAGE' => on_page($inactive_count, $per_page, $start), 301 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param&users_per_page=$per_page", $inactive_count, $per_page, $start, true), 302 'USERS_PER_PAGE' => $per_page, 303 251 304 'U_ACTION' => $this->u_action . '&start=' . $start, 252 305 ));
Note:
See TracChangeset
for help on using the changeset viewer.