Verzeichnisstruktur phpBB-3.0.0


Veröffentlicht
12.12.2007

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

acp_inactive.php

Zuletzt modifiziert: 09.10.2024, 12:51 - Dateigröße: 7.78 KiB


 001  <?php
 002  /**
 003  *
 004  * @package acp
 005  * @version $Id$
 006  * @copyright (c) 2006 phpBB Group
 007  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 008  *
 009  */
 010   
 011  /**
 012  * @ignore
 013  */
 014  if (!defined('IN_PHPBB'))
 015  {
 016      exit;
 017  }
 018   
 019  /**
 020  * @package acp
 021  */
 022  class acp_inactive
 023  {
 024      var $u_action;
 025      var $p_master;
 026   
 027      function acp_inactive(&$p_master)
 028      {
 029          $this->p_master = &$p_master;
 030      }
 031   
 032      function main($id, $mode)
 033      {
 034          global $config, $db, $user, $auth, $template;
 035          global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
 036   
 037          include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
 038   
 039          $user->add_lang('memberlist');
 040   
 041          $action = request_var('action', '');
 042          $mark    = (isset($_REQUEST['mark'])) ? request_var('mark', array(0)) : array();
 043          $start    = request_var('start', 0);
 044          $submit = isset($_POST['submit']);
 045   
 046          // Sort keys
 047          $sort_days    = request_var('st', 0);
 048          $sort_key    = request_var('sk', 'i');
 049          $sort_dir    = request_var('sd', 'd');
 050   
 051          $form_key = 'acp_inactive';
 052          add_form_key($form_key);
 053   
 054          if ($submit && sizeof($mark))
 055          {
 056              if ($action !== 'delete' && !check_form_key($form_key))
 057              {
 058                  trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
 059              }
 060   
 061              switch ($action)
 062              {
 063                  case 'activate':
 064                  case 'delete':
 065   
 066                      $sql = 'SELECT user_id, username
 067                          FROM ' . USERS_TABLE . '
 068                          WHERE ' . $db->sql_in_set('user_id', $mark);
 069                      $result = $db->sql_query($sql);
 070                  
 071                      $user_affected = array();
 072                      while ($row = $db->sql_fetchrow($result))
 073                      {
 074                          $user_affected[$row['user_id']] = $row['username'];
 075                      }
 076                      $db->sql_freeresult($result);
 077   
 078                      if ($action == 'activate')
 079                      {
 080                          if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
 081                          {
 082                              // Get those 'being activated'...
 083                              $sql = 'SELECT user_id, username, user_email, user_lang
 084                                  FROM ' . USERS_TABLE . '
 085                                  WHERE ' . $db->sql_in_set('user_id', $mark) . '
 086                                      AND user_type = ' . USER_INACTIVE;
 087                              $result = $db->sql_query($sql);
 088   
 089                              $inactive_users = array();
 090                              while ($row = $db->sql_fetchrow($result))
 091                              {
 092                                  $inactive_users[] = $row;
 093                              }
 094                              $db->sql_freeresult($result);
 095                          }
 096   
 097                          user_active_flip('activate', $mark);
 098   
 099                          if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !empty($inactive_users))
 100                          {
 101                              include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
 102   
 103                              $messenger = new messenger();
 104   
 105                              foreach ($inactive_users as $row)
 106                              {
 107                                  $messenger->template('admin_welcome_activated', $row['user_lang']);
 108   
 109                                  $messenger->to($row['user_email'], $row['username']);
 110   
 111                                  $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
 112                                  $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
 113                                  $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
 114   
 115                                  $messenger->assign_vars(array(
 116                                      'USERNAME'    => htmlspecialchars_decode($row['username']))
 117                                  );
 118   
 119                                  $messenger->send(NOTIFY_EMAIL);
 120                              }
 121   
 122                              $messenger->save_queue();
 123                          }
 124                      }
 125                      else if ($action == 'delete')
 126                      {
 127                          if (confirm_box(true))
 128                          {
 129                              if (!$auth->acl_get('a_userdel'))
 130                              {
 131                                  trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
 132                              }
 133   
 134                              foreach ($mark as $user_id)
 135                              {
 136                                  user_delete('retain', $user_id, $user_affected[$user_id]);
 137                              }
 138   
 139                              add_log('admin', 'LOG_INACTIVE_' . strtoupper($action), implode(', ', $user_affected));
 140                          }
 141                          else
 142                          {
 143                              $s_hidden_fields = array(
 144                                  'mode'            => $mode,
 145                                  'action'        => $action,
 146                                  'mark'            => $mark,
 147                                  'submit'        => 1,
 148                                  'start'            => $start,
 149                              );
 150                              confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields));
 151                          }
 152                      }
 153   
 154                  break;
 155   
 156                  case 'remind':
 157                      if (empty($config['email_enable']))
 158                      {
 159                          trigger_error($user->lang['EMAIL_DISABLED'] . adm_back_link($this->u_action), E_USER_WARNING);
 160                      }
 161   
 162                      $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey
 163                          FROM ' . USERS_TABLE . '
 164                          WHERE ' . $db->sql_in_set('user_id', $mark);
 165                      $result = $db->sql_query($sql);
 166   
 167                      if ($row = $db->sql_fetchrow($result))
 168                      {
 169                          // Send the messages
 170                          include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
 171   
 172                          $messenger = new messenger();
 173                          $usernames = array();
 174   
 175                          do
 176                          {
 177                              $messenger->template('user_remind_inactive', $row['user_lang']);
 178   
 179                              $messenger->to($row['user_email'], $row['username']);
 180                              $messenger->im($row['user_jabber'], $row['username']);
 181   
 182                              $messenger->assign_vars(array(
 183                                  'USERNAME'        => htmlspecialchars_decode($row['username']),
 184                                  'REGISTER_DATE'    => $user->format_date($row['user_regdate']),
 185                                  'U_ACTIVATE'    => generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey'])
 186                              );
 187   
 188                              $messenger->send($row['user_notify_type']);
 189   
 190                              $usernames[] = $row['username'];
 191                          }
 192                          while ($row = $db->sql_fetchrow($result));
 193   
 194                          $messenger->save_queue();
 195   
 196                          add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames));
 197                          unset($usernames);
 198                      }
 199                      $db->sql_freeresult($result);
 200          
 201                  break;
 202              }
 203          }
 204   
 205          // Sorting
 206          $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          // Define where and sort sql for use in displaying logs
 214          $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
 215          $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
 216   
 217          $inactive = array();
 218          $inactive_count = 0;
 219   
 220          $start = view_inactive_users($inactive, $inactive_count, $config['topics_per_page'], $start, $sql_where, $sql_sort);
 221   
 222          foreach ($inactive as $row)
 223          {
 224              $template->assign_block_vars('inactive', array(
 225                  'INACTIVE_DATE'    => $user->format_date($row['user_inactive_time']),
 226                  'JOINED'        => $user->format_date($row['user_regdate']),
 227                  'LAST_VISIT'    => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']),
 228                  'REASON'        => $row['inactive_reason'],
 229                  'USER_ID'        => $row['user_id'],
 230                  'USERNAME'        => $row['username'],
 231                  'U_USER_ADMIN'    => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
 232              );
 233          }
 234   
 235          $option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE');
 236          if ($config['email_enable'])
 237          {
 238              $option_ary += array('remind' => 'REMIND');
 239          }
 240   
 241          $template->assign_vars(array(
 242              'S_INACTIVE_USERS'        => true,
 243              'S_INACTIVE_OPTIONS'    => build_select($option_ary),
 244   
 245              'S_LIMIT_DAYS'    => $s_limit_days,
 246              'S_SORT_KEY'    => $s_sort_key,
 247              '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 . "&amp;$u_sort_param", $inactive_count, $config['topics_per_page'], $start, true),
 250              
 251              'U_ACTION'        => $this->u_action . '&amp;start=' . $start,
 252          ));
 253   
 254          $this->tpl_name = 'acp_inactive';
 255          $this->page_title = 'ACP_INACTIVE_USERS';
 256      }
 257  }
 258   
 259  ?>