From eabc49f68e8de1fa340c691d39fb496fef1a5b50 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 10 Jun 2023 15:55:53 +0700 Subject: [PATCH] Minor improvements (#801) --- admin/admin_attach_cp.php | 1 + admin/admin_attachments.php | 1 + admin/admin_board.php | 1 + admin/admin_bt_forum_cfg.php | 1 + admin/admin_disallow.php | 1 + admin/admin_forums.php | 1 + admin/admin_groups.php | 1 + admin/admin_rebuild_search.php | 1 + admin/admin_sitemap.php | 1 + admin/admin_terms.php | 1 + admin/admin_ug_auth.php | 1 + admin/admin_user_search.php | 1 + admin/stats/tr_stats.php | 1 + admin/stats/tracker.php | 1 + callseed.php | 2 +- dl.php | 2 +- dl_list.php | 2 +- feed.php | 2 +- group.php | 2 +- group_edit.php | 2 +- index.php | 8 +++++++- info.php | 2 +- library/includes/ucp/topic_watch.php | 3 ++- login.php | 2 +- memberlist.php | 2 +- modcp.php | 2 +- poll.php | 1 + posting.php | 2 +- privmsg.php | 3 ++- profile.php | 2 +- search.php | 3 +-- terms.php | 4 ++-- tracker.php | 2 +- viewforum.php | 2 +- viewtopic.php | 2 +- 35 files changed, 44 insertions(+), 22 deletions(-) diff --git a/admin/admin_attach_cp.php b/admin/admin_attach_cp.php index c260d58f9..fea906603 100644 --- a/admin/admin_attach_cp.php +++ b/admin/admin_attach_cp.php @@ -11,6 +11,7 @@ if (!empty($setmodules)) { $module['ATTACHMENTS']['CONTROL_PANEL'] = basename(__FILE__); return; } + require __DIR__ . '/pagestart.php'; if (($attach_config['upload_dir'][0] == '/') || (($attach_config['upload_dir'][0] != '/') && ($attach_config['upload_dir'][1] == ':'))) { diff --git a/admin/admin_attachments.php b/admin/admin_attachments.php index b4fac4e1d..c08d0e1c9 100644 --- a/admin/admin_attachments.php +++ b/admin/admin_attachments.php @@ -14,6 +14,7 @@ if (!empty($setmodules)) { $module['ATTACHMENTS']['QUOTA_LIMITS'] = $filename . '?mode=quota'; return; } + require __DIR__ . '/pagestart.php'; $error = false; diff --git a/admin/admin_board.php b/admin/admin_board.php index 4b92a5df5..5b5478d8b 100644 --- a/admin/admin_board.php +++ b/admin/admin_board.php @@ -12,6 +12,7 @@ if (!empty($setmodules)) { $module['MODS']['CONFIGURATION'] = basename(__FILE__) . '?mode=config_mods'; return; } + require __DIR__ . '/pagestart.php'; $mode = $_GET['mode'] ?? ''; diff --git a/admin/admin_bt_forum_cfg.php b/admin/admin_bt_forum_cfg.php index 44c714bcb..ade2aed92 100644 --- a/admin/admin_bt_forum_cfg.php +++ b/admin/admin_bt_forum_cfg.php @@ -11,6 +11,7 @@ if (!empty($setmodules)) { $module['TorrentPier']['FORUM_CONFIG'] = basename(__FILE__); return; } + require __DIR__ . '/pagestart.php'; $max_forum_name_len = 30; diff --git a/admin/admin_disallow.php b/admin/admin_disallow.php index 79aa91c9d..503482fb3 100644 --- a/admin/admin_disallow.php +++ b/admin/admin_disallow.php @@ -11,6 +11,7 @@ if (!empty($setmodules)) { $module['USERS']['DISALLOW'] = basename(__FILE__); return; } + require __DIR__ . '/pagestart.php'; $message = ''; diff --git a/admin/admin_forums.php b/admin/admin_forums.php index 4396d5926..4b00eb03b 100644 --- a/admin/admin_forums.php +++ b/admin/admin_forums.php @@ -11,6 +11,7 @@ if (!empty($setmodules)) { $module['FORUMS']['MANAGE'] = basename(__FILE__); return; } + require __DIR__ . '/pagestart.php'; array_deep($_POST, 'trim'); diff --git a/admin/admin_groups.php b/admin/admin_groups.php index 7218bd39c..9118162da 100644 --- a/admin/admin_groups.php +++ b/admin/admin_groups.php @@ -11,6 +11,7 @@ if (!empty($setmodules)) { $module['GROUPS']['MANAGE'] = basename(__FILE__); return; } + require __DIR__ . '/pagestart.php'; $group_id = isset($_REQUEST[POST_GROUPS_URL]) ? (int)$_REQUEST[POST_GROUPS_URL] : 0; diff --git a/admin/admin_rebuild_search.php b/admin/admin_rebuild_search.php index 35224be4c..a815f6e24 100644 --- a/admin/admin_rebuild_search.php +++ b/admin/admin_rebuild_search.php @@ -13,6 +13,7 @@ if (!empty($setmodules)) { } return; } + require __DIR__ . '/pagestart.php'; if (!IS_SUPER_ADMIN) { diff --git a/admin/admin_sitemap.php b/admin/admin_sitemap.php index 7c478a82d..fe2a43018 100644 --- a/admin/admin_sitemap.php +++ b/admin/admin_sitemap.php @@ -11,6 +11,7 @@ if (!empty($setmodules)) { $module['MODS']['SITEMAP'] = basename(__FILE__); return; } + require __DIR__ . '/pagestart.php'; $sql = 'SELECT * FROM ' . BB_CONFIG; diff --git a/admin/admin_terms.php b/admin/admin_terms.php index 5c754f1b9..79ba15b27 100644 --- a/admin/admin_terms.php +++ b/admin/admin_terms.php @@ -11,6 +11,7 @@ if (!empty($setmodules)) { $module['GENERAL']['TERMS'] = basename(__FILE__); return; } + require __DIR__ . '/pagestart.php'; require INC_DIR . '/bbcode.php'; diff --git a/admin/admin_ug_auth.php b/admin/admin_ug_auth.php index 22e9dcdf7..a0ef15776 100644 --- a/admin/admin_ug_auth.php +++ b/admin/admin_ug_auth.php @@ -12,6 +12,7 @@ if (!empty($setmodules)) { $module['GROUPS']['PERMISSIONS'] = basename(__FILE__) . '?mode=group'; return; } + require __DIR__ . '/pagestart.php'; $max_forum_name_length = 50; diff --git a/admin/admin_user_search.php b/admin/admin_user_search.php index b378fef1d..12950df83 100644 --- a/admin/admin_user_search.php +++ b/admin/admin_user_search.php @@ -11,6 +11,7 @@ if (!empty($setmodules)) { $module['USERS']['SEARCH'] = basename(__FILE__); return; } + require __DIR__ . '/pagestart.php'; array_deep($_POST, 'trim'); diff --git a/admin/stats/tr_stats.php b/admin/stats/tr_stats.php index 456905576..941a425fe 100644 --- a/admin/stats/tr_stats.php +++ b/admin/stats/tr_stats.php @@ -9,6 +9,7 @@ define('IN_ADMIN', true); define('BB_ROOT', './../../'); + require BB_ROOT . 'common.php'; $user->session_start(); diff --git a/admin/stats/tracker.php b/admin/stats/tracker.php index 83f3a8501..dbb37cb58 100644 --- a/admin/stats/tracker.php +++ b/admin/stats/tracker.php @@ -9,6 +9,7 @@ define('IN_ADMIN', true); define('BB_ROOT', './../../'); + require BB_ROOT . 'common.php'; $user->session_start(); diff --git a/callseed.php b/callseed.php index 2b81a8924..88b860d40 100644 --- a/callseed.php +++ b/callseed.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'callseed'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; // Init userdata diff --git a/dl.php b/dl.php index 78d2b3745..3d85a4f47 100644 --- a/dl.php +++ b/dl.php @@ -9,7 +9,7 @@ define('BB_SCRIPT', 'dl'); define('NO_GZIP', true); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; require ATTACH_DIR . '/attachment_mod.php'; diff --git a/dl_list.php b/dl_list.php index ee8d6d14a..1e0607e1e 100644 --- a/dl_list.php +++ b/dl_list.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'dl_list'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; $forum_id = isset($_REQUEST[POST_FORUM_URL]) ? (int)$_REQUEST[POST_FORUM_URL] : 0; diff --git a/feed.php b/feed.php index b5342d330..ed975b5df 100644 --- a/feed.php +++ b/feed.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'feed'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; $user->session_start(array('req_login' => true)); diff --git a/group.php b/group.php index ca75e5889..2eb6fb376 100644 --- a/group.php +++ b/group.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'group'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; require INC_DIR . '/bbcode.php'; diff --git a/group_edit.php b/group_edit.php index 81502a9cf..f337666ce 100644 --- a/group_edit.php +++ b/group_edit.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'group_edit'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; $page_cfg['include_bbcode_js'] = true; diff --git a/index.php b/index.php index 73fec4f7e..3a561761d 100644 --- a/index.php +++ b/index.php @@ -8,16 +8,21 @@ */ define('BB_SCRIPT', 'index'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; $page_cfg['load_tpl_vars'] = array( 'post_icons', ); +// Show last topic $show_last_topic = true; $last_topic_max_len = 28; + +// Show online stats $show_online_users = true; + +// Show subforums $show_subforums = true; $datastore->enqueue(array( @@ -25,6 +30,7 @@ $datastore->enqueue(array( 'moderators', 'cat_forums', )); + if ($bb_cfg['show_latest_news']) { $datastore->enqueue('latest_news'); } diff --git a/info.php b/info.php index 5e04a7041..426bb5447 100644 --- a/info.php +++ b/info.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'info'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; // Start session management diff --git a/library/includes/ucp/topic_watch.php b/library/includes/ucp/topic_watch.php index e68697a31..88e5cda51 100644 --- a/library/includes/ucp/topic_watch.php +++ b/library/includes/ucp/topic_watch.php @@ -11,10 +11,11 @@ if (empty($bb_cfg['topic_notify_enabled'])) { bb_die($lang['DISABLED']); } +// Page config $page_cfg['use_tablesorter'] = true; $page_cfg['include_bbcode_js'] = true; -$tracking_topics = get_tracks('topic'); +$tracking_topics = get_tracks('topic'); $user_id = $userdata['user_id']; $start = isset($_GET['start']) ? abs((int)$_GET['start']) : 0; $per_page = $bb_cfg['topics_per_page']; diff --git a/login.php b/login.php index 9faf97494..dcfa71de2 100644 --- a/login.php +++ b/login.php @@ -9,7 +9,7 @@ define('BB_SCRIPT', 'login'); define('IN_LOGIN', true); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; array_deep($_POST, 'trim'); diff --git a/memberlist.php b/memberlist.php index 9c7967013..a4b6f0714 100644 --- a/memberlist.php +++ b/memberlist.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'memberlist'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; $page_cfg['use_tablesorter'] = true; diff --git a/modcp.php b/modcp.php index c2f8c05f9..1e426a040 100644 --- a/modcp.php +++ b/modcp.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'modcp'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; require INC_DIR . '/bbcode.php'; diff --git a/poll.php b/poll.php index 6c4d42834..4455c15e1 100644 --- a/poll.php +++ b/poll.php @@ -8,6 +8,7 @@ */ define('BB_SCRIPT', 'vote'); + require __DIR__ . '/common.php'; $user->session_start(array('req_login' => true)); diff --git a/posting.php b/posting.php index b41d4b818..770bc971d 100644 --- a/posting.php +++ b/posting.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'posting'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; require INC_DIR . '/bbcode.php'; require ATTACH_DIR . '/attachment_mod.php'; diff --git a/privmsg.php b/privmsg.php index 74a024667..5e54d5de9 100644 --- a/privmsg.php +++ b/privmsg.php @@ -9,12 +9,13 @@ define('BB_SCRIPT', 'pm'); define('IN_PM', true); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; require INC_DIR . '/bbcode.php'; $privmsg_sent_id = $l_box_name = $to_username = $privmsg_subject = $privmsg_message = $error_msg = ''; +// Page config $page_cfg['use_tablesorter'] = true; $page_cfg['load_tpl_vars'] = array( 'pm_icons', diff --git a/profile.php b/profile.php index 7031a5a3d..dfd86e4a1 100644 --- a/profile.php +++ b/profile.php @@ -9,7 +9,7 @@ define('IN_PROFILE', true); define('BB_SCRIPT', 'profile'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; // Start session management diff --git a/search.php b/search.php index 2a5799f16..04d5ab31b 100644 --- a/search.php +++ b/search.php @@ -8,9 +8,8 @@ */ define('BB_SCRIPT', 'search'); -define('BB_ROOT', './'); -require __DIR__ . '/common.php'; +require __DIR__ . '/common.php'; require INC_DIR . '/bbcode.php'; $page_cfg['load_tpl_vars'] = array( diff --git a/terms.php b/terms.php index f2c2da064..9179e54d9 100644 --- a/terms.php +++ b/terms.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'terms'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; require INC_DIR . '/bbcode.php'; @@ -20,7 +20,7 @@ if (!$bb_cfg['terms'] && !IS_ADMIN) { } $template->assign_vars(array( - 'TERMS_EDIT' => bbcode2html(sprintf($lang['TERMS_EMPTY_TEXT'], $domain_name)), + 'TERMS_EDIT' => bbcode2html(sprintf($lang['TERMS_EMPTY_TEXT'], $bb_cfg['server_name'])), 'TERMS_HTML' => bbcode2html($bb_cfg['terms']), )); diff --git a/tracker.php b/tracker.php index 4992be642..e965b3294 100644 --- a/tracker.php +++ b/tracker.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'tracker'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; // Page config diff --git a/viewforum.php b/viewforum.php index fa42ffb2b..808c01c25 100644 --- a/viewforum.php +++ b/viewforum.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'forum'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; $page_cfg['include_bbcode_js'] = true; diff --git a/viewtopic.php b/viewtopic.php index 0c618dd61..4eac73369 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -8,7 +8,7 @@ */ define('BB_SCRIPT', 'topic'); -define('BB_ROOT', './'); + require __DIR__ . '/common.php'; require INC_DIR . '/bbcode.php';