[ Index ]

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


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1