[ Index ] |
PHP Cross Reference of phpBB 3.0 Beta 3 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * @package acp 5 * @version $Id: acp_inactive.php,v 1.6 2006/11/03 21:04:09 acydburn Exp $ 6 * @copyright (c) 2006 phpBB Group 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 8 * 9 */ 10 11 /** 12 * @package acp 13 */ 14 class acp_inactive 15 { 16 var $u_action; 17 var $p_master; 18 19 function acp_inactive(&$p_master) 20 { 21 $this->p_master = &$p_master; 22 } 23 24 function main($id, $mode) 25 { 26 global $config, $db, $user, $auth, $template; 27 global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; 28 29 $user->add_lang('memberlist'); 30 31 $action = request_var('action', ''); 32 $mark = (isset($_REQUEST['mark'])) ? request_var('mark', array(0)) : array(); 33 $start = request_var('start', 0); 34 35 // Sort keys 36 $sort_days = request_var('st', 0); 37 $sort_key = request_var('sk', 'i'); 38 $sort_dir = request_var('sd', 'd'); 39 40 if (sizeof($mark)) 41 { 42 switch ($action) 43 { 44 case 'activate': 45 case 'delete': 46 $sql = 'SELECT username 47 FROM ' . USERS_TABLE . ' 48 WHERE ' . $db->sql_in_set('user_id', $mark); 49 $result = $db->sql_query($sql); 50 51 $user_affected = array(); 52 while ($row = $db->sql_fetchrow($result)) 53 { 54 $user_affected[] = $row['username']; 55 } 56 $db->sql_freeresult($result); 57 58 if ($action == 'activate') 59 { 60 include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); 61 user_active_flip('activate', $mark); 62 } 63 else if ($action == 'delete') 64 { 65 if (!$auth->acl_get('a_userdel')) 66 { 67 trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); 68 } 69 70 $sql = 'DELETE FROM ' . USER_GROUP_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $mark); 71 $db->sql_query($sql); 72 $sql = 'DELETE FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $mark); 73 $db->sql_query($sql); 74 75 add_log('admin', 'LOG_INACTIVE_' . strtoupper($action), implode(', ', $user_affected)); 76 } 77 78 break; 79 80 case 'remind': 81 if (empty($config['email_enable'])) 82 { 83 trigger_error($user->lang['EMAIL_DISABLED'] . adm_back_link($this->u_action), E_USER_WARNING); 84 } 85 86 $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey 87 FROM ' . USERS_TABLE . ' 88 WHERE ' . $db->sql_in_set('user_id', $mark); 89 $result = $db->sql_query($sql); 90 91 if ($row = $db->sql_fetchrow($result)) 92 { 93 // Send the messages 94 include_once($phpbb_root_path . 'includes/functions_messenger.'.$phpEx); 95 96 $messenger = new messenger(); 97 98 $board_url = generate_board_url() . "/ucp.$phpEx?mode=activate"; 99 100 $usernames = array(); 101 do 102 { 103 $messenger->template('user_remind_inactive', $row['user_lang']); 104 105 $messenger->replyto($config['board_email']); 106 $messenger->to($row['user_email'], $row['username']); 107 $messenger->im($row['user_jabber'], $row['username']); 108 109 $messenger->assign_vars(array( 110 'USERNAME' => htmlspecialchars_decode($row['username']), 111 'REGISTER_DATE' => $user->format_date($row['user_regdate']), 112 'U_ACTIVATE' => "$board_url&mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey']) 113 ); 114 115 $messenger->send($row['user_notify_type']); 116 117 $usernames[] = $row['username']; 118 } 119 while ($row = $db->sql_fetchrow($result)); 120 121 $messenger->save_queue(); 122 123 add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames)); 124 unset($usernames); 125 } 126 $db->sql_freeresult($result); 127 128 break; 129 } 130 } 131 132 // Sorting 133 $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']); 134 $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']); 135 $sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'r' => 'user_inactive_reason', 'u' => 'username'); 136 137 $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; 138 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); 139 140 // Define where and sort sql for use in displaying logs 141 $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; 142 $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); 143 144 $inactive = array(); 145 $inactive_count = 0; 146 147 view_inactive_users($inactive, $inactive_count, $config['topics_per_page'], $start, $sql_where, $sql_sort); 148 149 foreach ($inactive as $row) 150 { 151 $template->assign_block_vars('inactive', array( 152 'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']), 153 'JOINED' => $user->format_date($row['user_regdate']), 154 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']), 155 'REASON' => $row['inactive_reason'], 156 'USER_ID' => $row['user_id'], 157 'USERNAME' => $row['username'], 158 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}")) 159 ); 160 } 161 162 $option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE'); 163 if ($config['email_enable']) 164 { 165 $option_ary += array('remind' => 'REMIND'); 166 } 167 168 $template->assign_vars(array( 169 'S_INACTIVE_USERS' => true, 170 'S_INACTIVE_OPTIONS' => build_select($option_ary), 171 172 'S_LIMIT_DAYS' => $s_limit_days, 173 'S_SORT_KEY' => $s_sort_key, 174 'S_SORT_DIR' => $s_sort_dir, 175 'S_ON_PAGE' => on_page($inactive_count, $config['topics_per_page'], $start), 176 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param", $inactive_count, $config['topics_per_page'], $start, true), 177 )); 178 179 $this->tpl_name = 'acp_inactive'; 180 $this->page_title = 'ACP_INACTIVE_USERS'; 181 } 182 } 183 184 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 22 00:35:05 2006 | Cross-referenced by PHPXref 0.6 |