[ Index ]

PHP Cross Reference of phpBB-3.3.10-deutsch

title

Body

[close]

/includes/acp/ -> acp_main.php (source)

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


Generated: Wed Feb 22 20:16:20 2023 Cross-referenced by PHPXref 0.7.1