[ Index ]

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


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1