diff --git a/library/config.php b/library/config.php index e782b10ea..2c9e8ccd2 100644 --- a/library/config.php +++ b/library/config.php @@ -724,6 +724,8 @@ $bb_cfg['tracker'] = [ 'update_dlstat' => true, 'expire_factor' => 2.5, 'compact_mode' => true, + 'upd_user_up_down_stat' => true, + 'browser_redirect_url' => '', 'scrape' => true, 'limit_active_tor' => true, 'limit_seed_count' => 0, diff --git a/library/defines.php b/library/defines.php index df8813a64..0f50090d7 100644 --- a/library/defines.php +++ b/library/defines.php @@ -15,11 +15,13 @@ if (!defined('BB_ROOT')) { define('ADMIN_DIR', BB_PATH . '/admin'); define('DATA_DIR', BB_PATH . '/data'); define('INT_DATA_DIR', BB_PATH . '/internal_data'); +define('AJAX_HTML_DIR', BB_ROOT . '/internal_data/ajax_html/'); define('CACHE_DIR', BB_PATH . '/internal_data/cache'); define('LOG_DIR', BB_PATH . '/internal_data/log'); define('TRIGGERS_DIR', BB_PATH . '/internal_data/triggers'); define('AJAX_DIR', BB_PATH . '/library/ajax'); define('ATTACH_DIR', BB_PATH . '/library/attach_mod'); +define('CFG_DIR', BB_PATH . '/library/config'); define('INC_DIR', BB_PATH . '/library/includes'); define('UCP_DIR', BB_PATH . '/library/includes/ucp'); define('LANG_ROOT_DIR', BB_PATH . '/library/language'); diff --git a/library/includes/cron/jobs/attach_maintenance.php b/library/includes/cron/jobs/attach_maintenance.php index 99e9a7168..d778cb38c 100644 --- a/library/includes/cron/jobs/attach_maintenance.php +++ b/library/includes/cron/jobs/attach_maintenance.php @@ -26,9 +26,9 @@ $posts_without_attach = $topics_without_attach = []; DB()->query(" CREATE TEMPORARY TABLE $tmp_attach_tbl ( - physical_filename VARCHAR(255) NOT NULL default '', + physical_filename VARCHAR(255) NOT NULL default '' COLLATE utf8mb4_unicode_ci, KEY physical_filename (physical_filename(20)) - ) ENGINE = MyISAM DEFAULT CHARSET = utf8 + ) ENGINE = MyISAM DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci "); DB()->add_shutdown_query("DROP TEMPORARY TABLE IF EXISTS $tmp_attach_tbl"); diff --git a/library/includes/functions.php b/library/includes/functions.php index c222ecc39..38db141cd 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -800,6 +800,11 @@ function str_short($text, $max_length, $space = ' ') return $text ?? ''; } +function wbr($text, $max_word_length = HTML_WBR_LENGTH) +{ + return preg_replace("/([\w\->;:.,~!?(){}@#$%^*\/\\\\]{" . $max_word_length . "})/ui", '$1', $text); +} + function generate_user_info($row, bool $have_auth = IS_ADMIN): array { global $userdata, $lang, $images, $bb_cfg; @@ -940,6 +945,47 @@ function bb_update_config($params, $table = BB_CONFIG) bb_get_config($table, true, true); } +function get_db_stat($mode) +{ + switch ($mode) { + case 'usercount': + $sql = "SELECT COUNT(user_id) AS total FROM " . BB_USERS; + break; + + case 'newestuser': + $sql = "SELECT user_id, username FROM " . BB_USERS . " WHERE user_id <> " . GUEST_UID . " ORDER BY user_id DESC LIMIT 1"; + break; + + case 'postcount': + case 'topiccount': + $sql = "SELECT SUM(forum_topics) AS topic_total, SUM(forum_posts) AS post_total FROM " . BB_FORUMS; + break; + } + + if (!($result = DB()->sql_query($sql))) { + return false; + } + + $row = DB()->sql_fetchrow($result); + + switch ($mode) { + case 'usercount': + return $row['total']; + break; + case 'newestuser': + return $row; + break; + case 'postcount': + return $row['post_total']; + break; + case 'topiccount': + return $row['topic_total']; + break; + } + + return false; +} + function clean_username($username) { $username = mb_substr(htmlspecialchars(str_replace("\'", "'", trim($username))), 0, 25, DEFAULT_CHARSET); @@ -949,6 +995,28 @@ function clean_username($username) return $username; } +function bb_ltrim($str, $charlist = false) +{ + if ($charlist === false) { + return ltrim($str); + } + + $str = ltrim($str, $charlist); + + return $str; +} + +function bb_rtrim($str, $charlist = false) +{ + if ($charlist === false) { + return rtrim($str); + } + + $str = rtrim($str, $charlist); + + return $str; +} + /** * Get Userdata * @@ -1094,6 +1162,7 @@ function setup_style() $css_dir = 'styles/' . basename(TEMPLATES_DIR) . '/' . $tpl_dir_name . '/css/'; $template->assign_vars([ + 'BB_ROOT' => BB_ROOT, 'SPACER' => make_url('styles/images/spacer.gif'), 'STYLESHEET' => make_url($css_dir . $stylesheet), 'EXT_LINK_NEW_WIN' => $bb_cfg['ext_link_new_win'], @@ -1412,6 +1481,11 @@ function bb_simple_die($txt, $status_code = null) die($txt); } +function bb_realpath($path) +{ + return realpath($path); +} + function login_redirect($url = '') { redirect(LOGIN_URL . '?redirect=' . (($url) ?: ($_SERVER['REQUEST_URI'] ?? '/'))); diff --git a/library/includes/init_bb.php b/library/includes/init_bb.php index 932dba5a1..1cb8a6c6f 100644 --- a/library/includes/init_bb.php +++ b/library/includes/init_bb.php @@ -293,6 +293,7 @@ define('USER_AGENT', strtolower($_SERVER['HTTP_USER_AGENT'])); define('HTML_SELECT_MAX_LENGTH', 60); define('HTML_SF_SPACER', ' |- '); +define('HTML_WBR_LENGTH', 12); define('HTML_CHECKED', ' checked '); define('HTML_DISABLED', ' disabled '); diff --git a/library/includes/page_header.php b/library/includes/page_header.php index 195bcec10..ad05b8919 100644 --- a/library/includes/page_header.php +++ b/library/includes/page_header.php @@ -194,8 +194,14 @@ $template->assign_vars([ 'BONUS_URL' => BB_ROOT . BONUS_URL, 'TOPIC_URL' => BB_ROOT . TOPIC_URL, + 'AJAX_HTML_DIR' => AJAX_HTML_DIR, + + 'ONLY_NEW_POSTS' => ONLY_NEW_POSTS, + 'ONLY_NEW_TOPICS' => ONLY_NEW_TOPICS, + // Misc 'BOT_UID' => BOT_UID, + 'COOKIE_MARK' => COOKIE_MARK, 'SID' => $userdata['session_id'], 'SID_HIDDEN' => '', diff --git a/posting.php b/posting.php index 39d44c373..b75e17091 100644 --- a/posting.php +++ b/posting.php @@ -625,6 +625,8 @@ $template->assign_vars([ 'POSTER_RGROUPS' => !empty($poster_rgroups) ? $poster_rgroups : '', 'ATTACH_RG_SIG' => $switch_rg_sig ?: false, + 'U_VIEWTOPIC' => ($mode == 'reply') ? TOPIC_URL . "$topic_id&postorder=desc" : '', + 'S_NOTIFY_CHECKED' => $notify_user ? 'checked' : '', 'S_ROBOTS_CHECKED' => $robots_indexing ? 'checked' : '', 'S_TYPE_TOGGLE' => $topic_type_toggle, diff --git a/styles/templates/default/images/icons_sources/icon_large.gif b/styles/templates/default/images/icons_sources/icon_large.gif new file mode 100644 index 000000000..e3d072db6 Binary files /dev/null and b/styles/templates/default/images/icons_sources/icon_large.gif differ diff --git a/styles/templates/default/images/icons_sources/icon_medium.gif b/styles/templates/default/images/icons_sources/icon_medium.gif new file mode 100644 index 000000000..fed70f75e Binary files /dev/null and b/styles/templates/default/images/icons_sources/icon_medium.gif differ diff --git a/styles/templates/default/images/icons_sources/icon_small.gif b/styles/templates/default/images/icons_sources/icon_small.gif new file mode 100644 index 000000000..85b723015 Binary files /dev/null and b/styles/templates/default/images/icons_sources/icon_small.gif differ diff --git a/styles/templates/default/images/icons_sources/info.txt b/styles/templates/default/images/icons_sources/info.txt new file mode 100644 index 000000000..5a3a6608e --- /dev/null +++ b/styles/templates/default/images/icons_sources/info.txt @@ -0,0 +1,2 @@ +Color: #3c618b +Font: Arial (Regular) 11pt diff --git a/viewtopic.php b/viewtopic.php index c059c1b68..7a0aec0bf 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -759,7 +759,9 @@ if (defined('SPLIT_FORM_START')) { $template->assign_vars([ 'SPLIT_FORM' => true, 'START' => $start, - 'S_SPLIT_ACTION' => 'modcp.php' + 'S_SPLIT_ACTION' => 'modcp.php', + 'POST_FORUM_URL' => POST_FORUM_URL, + 'POST_TOPIC_URL' => POST_TOPIC_URL, ]); }