Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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: 01.05.2026, 11:25 - Dateigröße: 11.36 KiB


 001  <?php
 002  /**
 003  *
 004  * This file is part of the phpBB Forum Software package.
 005  *
 006  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 007  * @license GNU General Public License, version 2 (GPL-2.0)
 008  *
 009  * For full copyright and license information, please see
 010  * the docs/CREDITS.txt file.
 011  *
 012  */
 013   
 014  /**
 015  * @ignore
 016  */
 017  if (!defined('IN_PHPBB'))
 018  {
 019      exit;
 020  }
 021   
 022  class acp_inactive
 023  {
 024      var $u_action;
 025      var $p_master;
 026   
 027      function __construct($p_master)
 028      {
 029          $this->p_master = $p_master;
 030      }
 031   
 032      function main($id, $mode)
 033      {
 034          global $config, $db, $user, $auth, $template, $phpbb_container, $phpbb_log, $request;
 035          global $phpbb_root_path, $phpbb_admin_path, $phpEx;
 036   
 037          if (!function_exists('user_active_flip'))
 038          {
 039              include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
 040          }
 041   
 042          $user->add_lang('memberlist');
 043   
 044          $action = $request->variable('action', '');
 045          $mark    = (isset($_REQUEST['mark'])) ? $request->variable('mark', array(0)) : array();
 046          $start    = $request->variable('start', 0);
 047          $submit = isset($_POST['submit']);
 048   
 049          // Sort keys
 050          $sort_days    = $request->variable('st', 0);
 051          $sort_key    = $request->variable('sk', 'i');
 052          $sort_dir    = $request->variable('sd', 'd');
 053   
 054          $form_key = 'acp_inactive';
 055          add_form_key($form_key);
 056   
 057          /* @var $pagination \phpbb\pagination */
 058          $pagination = $phpbb_container->get('pagination');
 059   
 060          // We build the sort key and per page settings here, because they may be needed later
 061   
 062          // Number of entries to display
 063          $per_page = $request->variable('users_per_page', (int) $config['topics_per_page']);
 064   
 065          // Sorting
 066          $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']);
 067          $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']);
 068          $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');
 069   
 070          $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
 071          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);
 072   
 073          if ($submit && count($mark))
 074          {
 075              if ($action !== 'delete' && !check_form_key($form_key))
 076              {
 077                  trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
 078              }
 079   
 080              switch ($action)
 081              {
 082                  case 'activate':
 083                  case 'delete':
 084   
 085                      $sql = 'SELECT user_id, username
 086                          FROM ' . USERS_TABLE . '
 087                          WHERE ' . $db->sql_in_set('user_id', $mark);
 088                      $result = $db->sql_query($sql);
 089   
 090                      $user_affected = array();
 091                      while ($row = $db->sql_fetchrow($result))
 092                      {
 093                          $user_affected[$row['user_id']] = $row['username'];
 094                      }
 095                      $db->sql_freeresult($result);
 096   
 097                      if ($action == 'activate')
 098                      {
 099                          // Get those 'being activated'...
 100                          $sql = 'SELECT user_id, username' . (($config['require_activation'] == USER_ACTIVATION_ADMIN) ? ', user_email, user_lang' : '') . '
 101                              FROM ' . USERS_TABLE . '
 102                              WHERE ' . $db->sql_in_set('user_id', $mark) . '
 103                                  AND user_type = ' . USER_INACTIVE;
 104                          $result = $db->sql_query($sql);
 105   
 106                          $inactive_users = array();
 107                          while ($row = $db->sql_fetchrow($result))
 108                          {
 109                              $inactive_users[] = $row;
 110                          }
 111                          $db->sql_freeresult($result);
 112   
 113                          user_active_flip('activate', $mark);
 114   
 115                          if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !empty($inactive_users))
 116                          {
 117                              if (!class_exists('messenger'))
 118                              {
 119                                  include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
 120                              }
 121   
 122                              $messenger = new messenger(false);
 123   
 124                              foreach ($inactive_users as $row)
 125                              {
 126                                  $messenger->template('admin_welcome_activated', $row['user_lang']);
 127   
 128                                  $messenger->set_addresses($row);
 129   
 130                                  $messenger->anti_abuse_headers($config, $user);
 131   
 132                                  $messenger->assign_vars(array(
 133                                      'USERNAME'    => html_entity_decode($row['username'], ENT_COMPAT))
 134                                  );
 135   
 136                                  $messenger->send(NOTIFY_EMAIL);
 137                              }
 138   
 139                              $messenger->save_queue();
 140                          }
 141   
 142                          if (!empty($inactive_users))
 143                          {
 144                              foreach ($inactive_users as $row)
 145                              {
 146                                  $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_ACTIVE', false, array($row['username']));
 147                                  $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_ACTIVE_USER', false, array(
 148                                      'reportee_id' => $row['user_id']
 149                                  ));
 150                              }
 151   
 152                              trigger_error(sprintf($user->lang['LOG_INACTIVE_ACTIVATE'], implode($user->lang['COMMA_SEPARATOR'], $user_affected) . ' ' . adm_back_link($this->u_action)));
 153                          }
 154   
 155                          // For activate we really need to redirect, else a refresh can result in users being deactivated again
 156                          $u_action = $this->u_action . "&amp;$u_sort_param&amp;start=$start";
 157                          $u_action .= ($per_page != $config['topics_per_page']) ? "&amp;users_per_page=$per_page" : '';
 158   
 159                          redirect($u_action);
 160                      }
 161                      else if ($action == 'delete')
 162                      {
 163                          if (confirm_box(true))
 164                          {
 165                              if (!$auth->acl_get('a_userdel'))
 166                              {
 167                                  send_status_line(403, 'Forbidden');
 168                                  trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
 169                              }
 170   
 171                              user_delete('retain', $mark, true);
 172   
 173                              $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_INACTIVE_' . strtoupper($action), false, array(implode(', ', $user_affected)));
 174   
 175                              trigger_error(sprintf($user->lang['LOG_INACTIVE_DELETE'], implode($user->lang['COMMA_SEPARATOR'], $user_affected) . ' ' . adm_back_link($this->u_action)));
 176                          }
 177                          else
 178                          {
 179                              $s_hidden_fields = array(
 180                                  'mode'            => $mode,
 181                                  'action'        => $action,
 182                                  'mark'            => $mark,
 183                                  'submit'        => 1,
 184                                  'start'            => $start,
 185                              );
 186                              confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields));
 187                          }
 188                      }
 189   
 190                  break;
 191   
 192                  case 'remind':
 193                      if (empty($config['email_enable']))
 194                      {
 195                          trigger_error($user->lang['EMAIL_DISABLED'] . adm_back_link($this->u_action), E_USER_WARNING);
 196                      }
 197   
 198                      $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey
 199                          FROM ' . USERS_TABLE . '
 200                          WHERE ' . $db->sql_in_set('user_id', $mark) . '
 201                              AND user_inactive_reason';
 202   
 203                      $sql .= ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? ' = ' . INACTIVE_REMIND : ' <> ' . INACTIVE_MANUAL;
 204   
 205                      $result = $db->sql_query($sql);
 206   
 207                      if ($row = $db->sql_fetchrow($result))
 208                      {
 209                          // Send the messages
 210                          if (!class_exists('messenger'))
 211                          {
 212                              include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
 213                          }
 214   
 215                          $messenger = new messenger();
 216                          $usernames = $user_ids = array();
 217   
 218                          do
 219                          {
 220                              $messenger->template('user_remind_inactive', $row['user_lang']);
 221   
 222                              $messenger->set_addresses($row);
 223   
 224                              $messenger->anti_abuse_headers($config, $user);
 225   
 226                              $messenger->assign_vars(array(
 227                                  'USERNAME'        => html_entity_decode($row['username'], ENT_COMPAT),
 228                                  'REGISTER_DATE'    => $user->format_date($row['user_regdate'], false, true),
 229                                  'U_ACTIVATE'    => generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey'])
 230                              );
 231   
 232                              $messenger->send($row['user_notify_type']);
 233   
 234                              $usernames[] = $row['username'];
 235                              $user_ids[] = (int) $row['user_id'];
 236                          }
 237                          while ($row = $db->sql_fetchrow($result));
 238   
 239                          $messenger->save_queue();
 240   
 241                          // Add the remind state to the database and increase activation expiration by one day
 242                          $sql = 'UPDATE ' . USERS_TABLE . '
 243                              SET user_reminded = user_reminded + 1,
 244                                  user_reminded_time = ' . time() . ',
 245                                  user_actkey_expiration = ' . (int) $user::get_token_expiration() . '
 246                              WHERE ' . $db->sql_in_set('user_id', $user_ids);
 247                          $db->sql_query($sql);
 248   
 249                          $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_INACTIVE_REMIND', false, array(implode(', ', $usernames)));
 250   
 251                          trigger_error(sprintf($user->lang['LOG_INACTIVE_REMIND'], implode($user->lang['COMMA_SEPARATOR'], $usernames) . ' ' . adm_back_link($this->u_action)));
 252                      }
 253                      $db->sql_freeresult($result);
 254   
 255                      // For remind we really need to redirect, else a refresh can result in more than one reminder
 256                      $u_action = $this->u_action . "&amp;$u_sort_param&amp;start=$start";
 257                      $u_action .= ($per_page != $config['topics_per_page']) ? "&amp;users_per_page=$per_page" : '';
 258   
 259                      redirect($u_action);
 260   
 261                  break;
 262              }
 263          }
 264   
 265          // Define where and sort sql for use in displaying logs
 266          $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
 267          $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
 268   
 269          $inactive = array();
 270          $inactive_count = 0;
 271   
 272          $start = view_inactive_users($inactive, $inactive_count, $per_page, $start, $sql_where, $sql_sort);
 273   
 274          foreach ($inactive as $row)
 275          {
 276              $template->assign_block_vars('inactive', array(
 277                  'INACTIVE_DATE'    => $user->format_date($row['user_inactive_time']),
 278                  'REMINDED_DATE'    => $user->format_date($row['user_reminded_time']),
 279                  'JOINED'        => $user->format_date($row['user_regdate']),
 280                  'LAST_VISIT'    => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']),
 281   
 282                  'REASON'        => $row['inactive_reason'],
 283                  'USER_ID'        => $row['user_id'],
 284                  'POSTS'            => ($row['user_posts']) ? $row['user_posts'] : 0,
 285                  'REMINDED'        => $row['user_reminded'],
 286   
 287                  'REMINDED_EXPLAIN'    => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])),
 288   
 289                  'USERNAME_FULL'        => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&amp;mode=overview&amp;redirect=acp_inactive')),
 290                  'USERNAME'            => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
 291                  'USER_COLOR'        => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
 292                  'USER_EMAIL'        => $row['user_email'],
 293   
 294                  'U_USER_ADMIN'    => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"),
 295                  'U_SEARCH_USER'    => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&amp;sr=posts") : '',
 296              ));
 297          }
 298   
 299          $option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE');
 300          if ($config['email_enable'])
 301          {
 302              $option_ary += array('remind' => 'REMIND');
 303          }
 304   
 305          $base_url = $this->u_action . "&amp;$u_sort_param&amp;users_per_page=$per_page";
 306          $pagination->generate_template_pagination($base_url, 'pagination', 'start', $inactive_count, $per_page, $start);
 307   
 308          $template->assign_vars(array(
 309              'S_INACTIVE_USERS'        => true,
 310              'S_INACTIVE_OPTIONS'    => build_select($option_ary),
 311   
 312              'S_LIMIT_DAYS'    => $s_limit_days,
 313              'S_SORT_KEY'    => $s_sort_key,
 314              'S_SORT_DIR'    => $s_sort_dir,
 315              'USERS_PER_PAGE'    => $per_page,
 316   
 317              'U_ACTION'        => $this->u_action . "&amp;$u_sort_param&amp;users_per_page=$per_page&amp;start=$start",
 318          ));
 319   
 320          $this->tpl_name = 'acp_inactive';
 321          $this->page_title = 'ACP_INACTIVE_USERS';
 322      }
 323  }
 324