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