mirror of
https://github.com/torrentpier/torrentpier
synced 2025-07-05 12:36:12 -07:00
feat: Restore some deprecated code for backward compatibility (#2028)
* feat: Restore some deprecated code for backward compatibility * feat: Restore some constants * feat: Restore `commify()` function * feat: Restored functions: `bb_ltrim`, `bb_rtrim`, `get_db_stat` * feat: Restore `bb_realpath` * Update functions.php * feat: Restore `AJAX_HTML_DIR` constant * Update defines.php * Update attach_maintenance.php * Update viewtopic.php
This commit is contained in:
parent
90121aa21d
commit
695864ef69
12 changed files with 94 additions and 3 deletions
|
@ -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,
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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<wbr>', $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'] ?? '/')));
|
||||
|
|
|
@ -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 ');
|
||||
|
|
|
@ -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' => '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />',
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
BIN
styles/templates/default/images/icons_sources/icon_large.gif
Normal file
BIN
styles/templates/default/images/icons_sources/icon_large.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
BIN
styles/templates/default/images/icons_sources/icon_medium.gif
Normal file
BIN
styles/templates/default/images/icons_sources/icon_medium.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
styles/templates/default/images/icons_sources/icon_small.gif
Normal file
BIN
styles/templates/default/images/icons_sources/icon_small.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
2
styles/templates/default/images/icons_sources/info.txt
Normal file
2
styles/templates/default/images/icons_sources/info.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
Color: #3c618b
|
||||
Font: Arial (Regular) 11pt
|
|
@ -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,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue