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_main.php

Zuletzt modifiziert: 01.05.2026, 11:25 - Dateigröße: 23.45 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_main
023  {
024      var $u_action;
025      private $php_ini;
026   
027      function main($id, $mode)
028      {
029          global $config, $db, $cache, $user, $auth, $template, $request, $phpbb_log;
030          global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container, $phpbb_dispatcher, $phpbb_filesystem;
031   
032          // Show restore permissions notice
033          if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm'))
034          {
035              $this->tpl_name = 'acp_main';
036              $this->page_title = 'ACP_MAIN';
037   
038              $sql = 'SELECT user_id, username, user_colour
039                  FROM ' . USERS_TABLE . '
040                  WHERE user_id = ' . $user->data['user_perm_from'];
041              $result = $db->sql_query($sql);
042              $user_row = $db->sql_fetchrow($result);
043              $db->sql_freeresult($result);
044   
045              $perm_from = get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']);
046   
047              $template->assign_vars(array(
048                  'S_RESTORE_PERMISSIONS'        => true,
049                  'U_RESTORE_PERMISSIONS'        => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm'),
050                  'PERM_FROM'                    => $perm_from,
051                  'L_PERMISSIONS_TRANSFERRED_EXPLAIN'    => sprintf($user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm')),
052              ));
053   
054              return;
055          }
056   
057          $action = $request->variable('action', '');
058   
059          if ($action)
060          {
061              if ($action === 'admlogout')
062              {
063                  $user->unset_admin();
064                  redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
065              }
066   
067              if (!confirm_box(true))
068              {
069                  switch ($action)
070                  {
071                      case 'online':
072                          $confirm = true;
073                          $confirm_lang = 'RESET_ONLINE_CONFIRM';
074                      break;
075                      case 'stats':
076                          $confirm = true;
077                          $confirm_lang = 'RESYNC_STATS_CONFIRM';
078                      break;
079                      case 'user':
080                          $confirm = true;
081                          $confirm_lang = 'RESYNC_POSTCOUNTS_CONFIRM';
082                      break;
083                      case 'date':
084                          $confirm = true;
085                          $confirm_lang = 'RESET_DATE_CONFIRM';
086                      break;
087                      case 'db_track':
088                          $confirm = true;
089                          $confirm_lang = 'RESYNC_POST_MARKING_CONFIRM';
090                      break;
091                      case 'purge_cache':
092                          $confirm = true;
093                          $confirm_lang = 'PURGE_CACHE_CONFIRM';
094                      break;
095                      case 'purge_sessions':
096                          $confirm = true;
097                          $confirm_lang = 'PURGE_SESSIONS_CONFIRM';
098                      break;
099   
100                      default:
101                          $confirm = true;
102                          $confirm_lang = 'CONFIRM_OPERATION';
103   
104                          /**
105                           * Event to add confirm box for custom ACP quick actions
106                           *
107                           * @event core.acp_main_add_actions_confirm
108                           * @var    string    id                The module ID
109                           * @var    string    mode            The module mode
110                           * @var    string    action            Custom action type name
111                           * @var    boolean    confirm            Do we display the confirm box to run the custom action
112                           * @var    string    confirm_lang    Lang var name to display in confirm box
113                           * @since 3.3.15-RC1
114                           */
115                          $vars = ['id', 'mode', 'action', 'confirm', 'confirm_lang'];
116                          extract($phpbb_dispatcher->trigger_event('core.acp_main_add_actions_confirm', compact($vars)));
117                  }
118   
119                  if ($confirm)
120                  {
121                      confirm_box(false, $user->lang[$confirm_lang], build_hidden_fields(array(
122                          'i'            => $id,
123                          'mode'        => $mode,
124                          'action'    => $action,
125                      )));
126                  }
127              }
128              else
129              {
130                  switch ($action)
131                  {
132   
133                      case 'online':
134                          if (!$auth->acl_get('a_board'))
135                          {
136                              send_status_line(403, 'Forbidden');
137                              trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
138                          }
139   
140                          $config->set('record_online_users', 1, false);
141                          $config->set('record_online_date', time(), false);
142                          $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_ONLINE');
143   
144                          if ($request->is_ajax())
145                          {
146                              trigger_error('RESET_ONLINE_SUCCESS');
147                          }
148                      break;
149   
150                      case 'stats':
151                          if (!$auth->acl_get('a_board'))
152                          {
153                              send_status_line(403, 'Forbidden');
154                              trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
155                          }
156   
157                          $sql = 'SELECT COUNT(post_id) AS stat
158                              FROM ' . POSTS_TABLE . '
159                              WHERE post_visibility = ' . ITEM_APPROVED;
160                          $result = $db->sql_query($sql);
161                          $config->set('num_posts', (int) $db->sql_fetchfield('stat'), false);
162                          $db->sql_freeresult($result);
163   
164                          $sql = 'SELECT COUNT(topic_id) AS stat
165                              FROM ' . TOPICS_TABLE . '
166                              WHERE topic_visibility = ' . ITEM_APPROVED;
167                          $result = $db->sql_query($sql);
168                          $config->set('num_topics', (int) $db->sql_fetchfield('stat'), false);
169                          $db->sql_freeresult($result);
170   
171                          $sql = 'SELECT COUNT(user_id) AS stat
172                              FROM ' . USERS_TABLE . '
173                              WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')';
174                          $result = $db->sql_query($sql);
175                          $config->set('num_users', (int) $db->sql_fetchfield('stat'), false);
176                          $db->sql_freeresult($result);
177   
178                          $sql = 'SELECT COUNT(attach_id) as stat
179                              FROM ' . ATTACHMENTS_TABLE . '
180                              WHERE is_orphan = 0';
181                          $result = $db->sql_query($sql);
182                          $config->set('num_files', (int) $db->sql_fetchfield('stat'), false);
183                          $db->sql_freeresult($result);
184   
185                          $sql = 'SELECT SUM(' . $db->cast_expr_to_bigint('filesize') . ') as stat
186                              FROM ' . ATTACHMENTS_TABLE . '
187                              WHERE is_orphan = 0';
188                          $result = $db->sql_query($sql);
189                          $config->set('upload_dir_size', (float) $db->sql_fetchfield('stat'), false);
190                          $db->sql_freeresult($result);
191   
192                          if (!function_exists('update_last_username'))
193                          {
194                              include($phpbb_root_path . "includes/functions_user.$phpEx");
195                          }
196                          update_last_username();
197   
198                          $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_STATS');
199   
200                          if ($request->is_ajax())
201                          {
202                              trigger_error('RESYNC_STATS_SUCCESS');
203                          }
204                      break;
205   
206                      case 'user':
207                          if (!$auth->acl_get('a_board'))
208                          {
209                              send_status_line(403, 'Forbidden');
210                              trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
211                          }
212   
213                          // Resync post counts
214                          $start = $max_post_id = 0;
215   
216                          // Find the maximum post ID, we can only stop the cycle when we've reached it
217                          $sql = 'SELECT MAX(forum_last_post_id) as max_post_id
218                              FROM ' . FORUMS_TABLE;
219                          $result = $db->sql_query($sql);
220                          $max_post_id = (int) $db->sql_fetchfield('max_post_id');
221                          $db->sql_freeresult($result);
222   
223                          // No maximum post id? :o
224                          if (!$max_post_id)
225                          {
226                              $sql = 'SELECT MAX(post_id) as max_post_id
227                                  FROM ' . POSTS_TABLE;
228                              $result = $db->sql_query($sql);
229                              $max_post_id = (int) $db->sql_fetchfield('max_post_id');
230                              $db->sql_freeresult($result);
231                          }
232   
233                          // Still no maximum post id? Then we are finished
234                          if (!$max_post_id)
235                          {
236                              $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POSTCOUNTS');
237                              break;
238                          }
239   
240                          $step = ($config['num_posts']) ? (max((int) ($config['num_posts'] / 5), 20000)) : 20000;
241                          $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0');
242   
243                          while ($start < $max_post_id)
244                          {
245                              $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id
246                                  FROM ' . POSTS_TABLE . '
247                                  WHERE post_id BETWEEN ' . ($start + 1) . ' AND ' . ($start + $step) . '
248                                      AND post_postcount = 1 AND post_visibility = ' . ITEM_APPROVED . '
249                                  GROUP BY poster_id';
250                              $result = $db->sql_query($sql);
251   
252                              if ($row = $db->sql_fetchrow($result))
253                              {
254                                  do
255                                  {
256                                      $sql = 'UPDATE ' . USERS_TABLE . " SET user_posts = user_posts + {$row['num_posts']} WHERE user_id = {$row['poster_id']}";
257                                      $db->sql_query($sql);
258                                  }
259                                  while ($row = $db->sql_fetchrow($result));
260                              }
261                              $db->sql_freeresult($result);
262   
263                              $start += $step;
264                          }
265   
266                          $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POSTCOUNTS');
267   
268                          if ($request->is_ajax())
269                          {
270                              trigger_error('RESYNC_POSTCOUNTS_SUCCESS');
271                          }
272                      break;
273   
274                      case 'date':
275                          if (!$auth->acl_get('a_board'))
276                          {
277                              send_status_line(403, 'Forbidden');
278                              trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
279                          }
280   
281                          $config->set('board_startdate', time() - 1);
282                          $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_DATE');
283   
284                          if ($request->is_ajax())
285                          {
286                              trigger_error('RESET_DATE_SUCCESS');
287                          }
288                      break;
289   
290                      case 'db_track':
291                          switch ($db->get_sql_layer())
292                          {
293                              case 'sqlite3':
294                                  $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
295                              break;
296   
297                              default:
298                                  $db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE);
299                              break;
300                          }
301   
302                          // This can get really nasty... therefore we only do the last six months
303                          $get_from_time = time() - (6 * 4 * 7 * 24 * 60 * 60);
304   
305                          // Select forum ids, do not include categories
306                          $sql = 'SELECT forum_id
307                              FROM ' . FORUMS_TABLE . '
308                              WHERE forum_type <> ' . FORUM_CAT;
309                          $result = $db->sql_query($sql);
310   
311                          $forum_ids = array();
312                          while ($row = $db->sql_fetchrow($result))
313                          {
314                              $forum_ids[] = $row['forum_id'];
315                          }
316                          $db->sql_freeresult($result);
317   
318                          // Any global announcements? ;)
319                          $forum_ids[] = 0;
320   
321                          // Now go through the forums and get us some topics...
322                          foreach ($forum_ids as $forum_id)
323                          {
324                              $sql = 'SELECT p.poster_id, p.topic_id
325                                  FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t
326                                  WHERE t.forum_id = ' . $forum_id . '
327                                      AND t.topic_moved_id = 0
328                                      AND t.topic_last_post_time > ' . $get_from_time . '
329                                      AND t.topic_id = p.topic_id
330                                      AND p.poster_id <> ' . ANONYMOUS . '
331                                  GROUP BY p.poster_id, p.topic_id';
332                              $result = $db->sql_query($sql);
333   
334                              $posted = array();
335                              while ($row = $db->sql_fetchrow($result))
336                              {
337                                  $posted[$row['poster_id']][] = $row['topic_id'];
338                              }
339                              $db->sql_freeresult($result);
340   
341                              $sql_ary = array();
342                              foreach ($posted as $user_id => $topic_row)
343                              {
344                                  foreach ($topic_row as $topic_id)
345                                  {
346                                      $sql_ary[] = array(
347                                          'user_id'        => (int) $user_id,
348                                          'topic_id'        => (int) $topic_id,
349                                          'topic_posted'    => 1,
350                                      );
351                                  }
352                              }
353                              unset($posted);
354   
355                              if (count($sql_ary))
356                              {
357                                  $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary);
358                              }
359                          }
360   
361                          $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POST_MARKING');
362   
363                          if ($request->is_ajax())
364                          {
365                              trigger_error('RESYNC_POST_MARKING_SUCCESS');
366                          }
367                      break;
368   
369                      case 'purge_cache':
370                          $config->increment('assets_version', 1);
371                          $cache->purge();
372   
373                          // Remove old renderers from the text_formatter service. Since this
374                          // operation is performed after the cache is purged, there is not "current"
375                          // renderer and in effect all renderers will be purged
376                          $phpbb_container->get('text_formatter.cache')->tidy();
377   
378                          // Clear permissions
379                          $auth->acl_clear_prefetch();
380                          phpbb_cache_moderators($db, $cache, $auth);
381   
382                          $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PURGE_CACHE');
383   
384                          if ($request->is_ajax())
385                          {
386                              trigger_error('PURGE_CACHE_SUCCESS');
387                          }
388                      break;
389   
390                      case 'purge_sessions':
391                          if ((int) $user->data['user_type'] !== USER_FOUNDER)
392                          {
393                              send_status_line(403, 'Forbidden');
394                              trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
395                          }
396   
397                          $tables = array(CONFIRM_TABLE, SESSIONS_TABLE);
398   
399                          foreach ($tables as $table)
400                          {
401                              switch ($db->get_sql_layer())
402                              {
403                                  case 'sqlite3':
404                                      $db->sql_query("DELETE FROM $table");
405                                  break;
406   
407                                  default:
408                                      $db->sql_query("TRUNCATE TABLE $table");
409                                  break;
410                              }
411                          }
412   
413                          // let's restore the admin session
414                          $reinsert_ary = array(
415                                  'session_id'            => (string) $user->session_id,
416                                  'session_page'            => (string) substr($user->page['page'], 0, 199),
417                                  'session_forum_id'        => $user->page['forum'],
418                                  'session_user_id'        => (int) $user->data['user_id'],
419                                  'session_start'            => (int) $user->data['session_start'],
420                                  'session_last_visit'    => (int) $user->data['session_last_visit'],
421                                  'session_time'            => (int) $user->time_now,
422                                  'session_browser'        => (string) trim(substr($user->browser, 0, 149)),
423                                  'session_forwarded_for'    => (string) $user->forwarded_for,
424                                  'session_ip'            => (string) $user->ip,
425                                  'session_autologin'        => (int) $user->data['session_autologin'],
426                                  'session_admin'            => 1,
427                                  'session_viewonline'    => (int) $user->data['session_viewonline'],
428                          );
429   
430                          $sql = 'INSERT INTO ' . SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $reinsert_ary);
431                          $db->sql_query($sql);
432   
433                          $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PURGE_SESSIONS');
434   
435                          if ($request->is_ajax())
436                          {
437                              trigger_error('PURGE_SESSIONS_SUCCESS');
438                          }
439                      break;
440   
441                      default:
442                          /**
443                           * Event to add custom ACP quick actions
444                           *
445                           * @event core.acp_main_add_actions
446                           * @var    string    id                The module ID
447                           * @var    string    mode            The module mode
448                           * @var    string    action            Custom action type name
449                           * @since 3.3.15-RC1
450                           */
451                          $vars = ['id', 'mode', 'action'];
452                          extract($phpbb_dispatcher->trigger_event('core.acp_main_add_actions', compact($vars)));
453                  }
454              }
455          }
456   
457          // Version check
458          $user->add_lang('install');
459   
460          if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '7.2.0', '<'))
461          {
462              $template->assign_vars(array(
463                  'S_PHP_VERSION_OLD'    => true,
464                  'L_PHP_VERSION_OLD'    => sprintf($user->lang['PHP_VERSION_OLD'], PHP_VERSION, '7.2.0', '<a href="https://www.phpbb.com/support/docs/en/3.3/ug/quickstart/requirements">', '</a>'),
465              ));
466          }
467   
468          if ($auth->acl_get('a_board'))
469          {
470              /** @var \phpbb\version_helper $version_helper */
471              $version_helper = $phpbb_container->get('version_helper');
472              try
473              {
474                  $recheck = $request->variable('versioncheck_force', false);
475                  $updates_available = $version_helper->get_update_on_branch($recheck);
476                  $upgrades_available = $version_helper->get_suggested_updates();
477                  if (!empty($upgrades_available))
478                  {
479                      $upgrades_available = array_pop($upgrades_available);
480                  }
481   
482                  $template->assign_vars(array(
483                      'S_VERSION_UP_TO_DATE'        => empty($updates_available),
484                      'S_VERSION_UPGRADEABLE'        => !empty($upgrades_available),
485                      'S_VERSIONCHECK_FORCE'        => (bool) $recheck,
486                      'UPGRADE_INSTRUCTIONS'        => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false,
487                  ));
488              }
489              catch (\phpbb\exception\runtime_exception $e)
490              {
491                  $message = call_user_func_array(array($user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
492                  $template->assign_vars(array(
493                      'S_VERSIONCHECK_FAIL'        => true,
494                      'VERSIONCHECK_FAIL_REASON'    => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '',
495                  ));
496              }
497          }
498          else
499          {
500              // We set this template var to true, to not display an outdated version notice.
501              $template->assign_var('S_VERSION_UP_TO_DATE', true);
502          }
503   
504          // Incomplete update?
505          if (phpbb_version_compare($config['version'], PHPBB_VERSION, '<'))
506          {
507              $template->assign_var('S_UPDATE_INCOMPLETE', true);
508          }
509   
510          /**
511          * Notice admin
512          *
513          * @event core.acp_main_notice
514          * @since 3.1.0-RC3
515          */
516          $phpbb_dispatcher->dispatch('core.acp_main_notice');
517   
518          // Get forum statistics
519          $total_posts = $config['num_posts'];
520          $total_topics = $config['num_topics'];
521          $total_users = $config['num_users'];
522          $total_files = $config['num_files'];
523   
524          $start_date = $user->format_date($config['board_startdate']);
525   
526          $boarddays = (time() - (int) $config['board_startdate']) / 86400;
527   
528          $posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
529          $topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
530          $users_per_day = sprintf('%.2f', $total_users / $boarddays);
531          $files_per_day = sprintf('%.2f', $total_files / $boarddays);
532   
533          $upload_dir_size = get_formatted_filesize($config['upload_dir_size']);
534   
535          $avatar_dir_size = 0;
536   
537          if ($avatar_dir = @opendir($phpbb_root_path . $config['avatar_path']))
538          {
539              while (($file = readdir($avatar_dir)) !== false)
540              {
541                  if ($file[0] != '.' && $file != 'CVS' && strpos($file, 'index.') === false)
542                  {
543                      $avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file);
544                  }
545              }
546              closedir($avatar_dir);
547   
548              $avatar_dir_size = get_formatted_filesize($avatar_dir_size);
549          }
550          else
551          {
552              // Couldn't open Avatar dir.
553              $avatar_dir_size = $user->lang['NOT_AVAILABLE'];
554          }
555   
556          if ($posts_per_day > $total_posts)
557          {
558              $posts_per_day = $total_posts;
559          }
560   
561          if ($topics_per_day > $total_topics)
562          {
563              $topics_per_day = $total_topics;
564          }
565   
566          if ($users_per_day > $total_users)
567          {
568              $users_per_day = $total_users;
569          }
570   
571          if ($files_per_day > $total_files)
572          {
573              $files_per_day = $total_files;
574          }
575   
576          $sql = 'SELECT COUNT(attach_id) AS total_orphan
577              FROM ' . ATTACHMENTS_TABLE . '
578              WHERE is_orphan = 1
579                  AND filetime < ' . (time() - 3*60*60);
580          $result = $db->sql_query($sql);
581          $total_orphan = (int) $db->sql_fetchfield('total_orphan');
582          $db->sql_freeresult($result);
583   
584          $dbsize = get_database_size();
585   
586          $template->assign_vars(array(
587              'TOTAL_POSTS'        => $total_posts,
588              'POSTS_PER_DAY'        => $posts_per_day,
589              'TOTAL_TOPICS'        => $total_topics,
590              'TOPICS_PER_DAY'    => $topics_per_day,
591              'TOTAL_USERS'        => $total_users,
592              'USERS_PER_DAY'        => $users_per_day,
593              'TOTAL_FILES'        => $total_files,
594              'FILES_PER_DAY'        => $files_per_day,
595              'START_DATE'        => $start_date,
596              'AVATAR_DIR_SIZE'    => $avatar_dir_size,
597              'DBSIZE'            => $dbsize,
598              'UPLOAD_DIR_SIZE'    => $upload_dir_size,
599              'TOTAL_ORPHAN'        => $total_orphan,
600              'GZIP_COMPRESSION'    => ($config['gzip_compress'] && @extension_loaded('zlib')) ? $user->lang['ON'] : $user->lang['OFF'],
601              'DATABASE_INFO'        => $db->sql_server_info(),
602              'PHP_VERSION_INFO'    => PHP_VERSION,
603              'BOARD_VERSION'        => $config['version'],
604   
605              'U_ACTION'            => $this->u_action,
606              'U_ADMIN_LOG'        => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&amp;mode=admin'),
607              'U_INACTIVE_USERS'    => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&amp;mode=list'),
608              'U_VERSIONCHECK'    => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&amp;mode=version_check'),
609              'U_VERSIONCHECK_FORCE'    => append_sid("{$phpbb_admin_path}index.$phpEx", 'versioncheck_force=1'),
610              'U_ATTACH_ORPHAN'    => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=acp_attachments&mode=orphan'),
611   
612              'S_VERSIONCHECK'    => ($auth->acl_get('a_board')) ? true : false,
613              'S_ACTION_OPTIONS'    => ($auth->acl_get('a_board')) ? true : false,
614              'S_FOUNDER'            => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
615              )
616          );
617   
618          $log_data = array();
619          $log_count = false;
620   
621          if ($auth->acl_get('a_viewlogs'))
622          {
623              view_log('admin', $log_data, $log_count, 5);
624   
625              foreach ($log_data as $row)
626              {
627                  $template->assign_block_vars('log', array(
628                      'USERNAME'    => $row['username_full'],
629                      'IP'        => $row['ip'],
630                      'DATE'        => $user->format_date($row['time']),
631                      'ACTION'    => $row['action'])
632                  );
633              }
634          }
635   
636          if ($auth->acl_get('a_user'))
637          {
638              $user->add_lang('memberlist');
639   
640              $inactive = array();
641              $inactive_count = 0;
642   
643              view_inactive_users($inactive, $inactive_count, 10);
644   
645              foreach ($inactive as $row)
646              {
647                  $template->assign_block_vars('inactive', array(
648                      'INACTIVE_DATE'    => $user->format_date($row['user_inactive_time']),
649                      'REMINDED_DATE'    => $user->format_date($row['user_reminded_time']),
650                      'JOINED'        => $user->format_date($row['user_regdate']),
651                      'LAST_VISIT'    => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']),
652   
653                      'REASON'        => $row['inactive_reason'],
654                      'USER_ID'        => $row['user_id'],
655                      'POSTS'            => ($row['user_posts']) ? $row['user_posts'] : 0,
656                      'REMINDED'        => $row['user_reminded'],
657   
658                      'REMINDED_EXPLAIN'    => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])),
659   
660                      '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')),
661                      'USERNAME'            => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
662                      'USER_COLOR'        => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
663   
664                      'U_USER_ADMIN'    => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"),
665                      'U_SEARCH_USER'    => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&amp;sr=posts") : '',
666                  ));
667              }
668   
669              $option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE');
670              if ($config['email_enable'])
671              {
672                  $option_ary += array('remind' => 'REMIND');
673              }
674   
675              $template->assign_vars(array(
676                  'S_INACTIVE_USERS'        => true,
677                  'S_INACTIVE_OPTIONS'    => build_select($option_ary))
678              );
679          }
680   
681          // Warn if install is still present
682          if (!defined('IN_INSTALL') && !$phpbb_container->getParameter('allow_install_dir') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install'))
683          {
684              $template->assign_var('S_REMOVE_INSTALL', true);
685          }
686   
687          // Warn if no search index is created
688          if ($config['num_posts'] && class_exists($config['search_type']))
689          {
690              $error = false;
691              $search_type = $config['search_type'];
692              $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
693   
694              if (!$search->index_created())
695              {
696                  $template->assign_vars(array(
697                      'S_SEARCH_INDEX_MISSING'    => true,
698                      'L_NO_SEARCH_INDEX'            => $user->lang('NO_SEARCH_INDEX', $search->get_name(), '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=acp_search&amp;mode=index') . '">', '</a>'),
699                  ));
700              }
701          }
702   
703          if (!defined('PHPBB_DISABLE_CONFIG_CHECK'))
704          {
705              // World-Writable? (000x)
706              $template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002));
707          }
708   
709          $this->php_ini            = $phpbb_container->get('php_ini');
710          $func_overload            = $this->php_ini->getNumeric('mbstring.func_overload');
711          $encoding_translation    = $this->php_ini->getString('mbstring.encoding_translation');
712          $http_input                = $this->php_ini->getString('mbstring.http_input');
713          $http_output            = $this->php_ini->getString('mbstring.http_output');
714          $default_charset        = $this->php_ini->getString('default_charset');
715   
716          if (extension_loaded('mbstring'))
717          {
718              /**
719               * “mbstring.http_input” and “mbstring.http_output” are deprecated as of PHP 5.6.0
720               * @link https://www.php.net/manual/mbstring.configuration.php#ini.mbstring.http-input
721               */
722              $template->assign_vars([
723                  'S_MBSTRING_LOADED'                        => true,
724                  'S_MBSTRING_FUNC_OVERLOAD_FAIL'            => $func_overload && ($func_overload & (MB_OVERLOAD_MAIL | MB_OVERLOAD_STRING)),
725                  'S_MBSTRING_ENCODING_TRANSLATION_FAIL'    => $encoding_translation && ($encoding_translation != 0),
726                  'S_MBSTRING_HTTP_INPUT_FAIL'            => !empty($http_input),
727                  'S_MBSTRING_HTTP_OUTPUT_FAIL'            => !empty($http_output),
728                  'S_DEFAULT_CHARSET_FAIL'                => $default_charset !== null && strtolower($default_charset) !== 'utf-8',
729              ]);
730          }
731   
732          // Fill dbms version if not yet filled
733          if (empty($config['dbms_version']))
734          {
735              $config->set('dbms_version', $db->sql_server_info(true));
736          }
737   
738          $this->tpl_name = 'acp_main';
739          $this->page_title = 'ACP_MAIN';
740      }
741  }
742