Minor improvements (#1523)

* Minor improvements

* Update CHANGELOG.md

* Update composer.lock

* Update User.php

* Updated

* Update Torrent.php

* Update Template.php

* Updated

* Update SqlDb.php

* Update Select.php

* Updated

* Updated

* Update viewtopic.tpl

* Updated

* Update viewforum.tpl
This commit is contained in:
Roman Kelesidis 2024-06-22 11:39:33 +07:00 committed by GitHub
commit b37f2d3666
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 116 additions and 240 deletions

View file

@ -15,7 +15,7 @@
- Some security enhancements (Part 2) [\#1505](https://github.com/torrentpier/torrentpier/pull/1505) ([belomaxorka](https://github.com/belomaxorka)) - Some security enhancements (Part 2) [\#1505](https://github.com/torrentpier/torrentpier/pull/1505) ([belomaxorka](https://github.com/belomaxorka))
- Some improvements for integrity checker [\#1501](https://github.com/torrentpier/torrentpier/pull/1501) ([belomaxorka](https://github.com/belomaxorka)) - Some improvements for integrity checker [\#1501](https://github.com/torrentpier/torrentpier/pull/1501) ([belomaxorka](https://github.com/belomaxorka))
- Hide vote button in topic if guest [\#1507](https://github.com/torrentpier/torrentpier/pull/1507) ([belomaxorka](https://github.com/belomaxorka)) - Hide vote button in topic if guest [\#1507](https://github.com/torrentpier/torrentpier/pull/1507) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1502](https://github.com/torrentpier/torrentpier/pull/1502), [\#1506](https://github.com/torrentpier/torrentpier/pull/1506), [\#1509](https://github.com/torrentpier/torrentpier/pull/1509), [\#1511](https://github.com/torrentpier/torrentpier/pull/1511), [\#1515](https://github.com/torrentpier/torrentpier/pull/1515), [\#1516](https://github.com/torrentpier/torrentpier/pull/1516), [\#1517](https://github.com/torrentpier/torrentpier/pull/1517), [\#1519](https://github.com/torrentpier/torrentpier/pull/1519) ([belomaxorka](https://github.com/belomaxorka)) - Minor improvements [\#1502](https://github.com/torrentpier/torrentpier/pull/1502), [\#1506](https://github.com/torrentpier/torrentpier/pull/1506), [\#1509](https://github.com/torrentpier/torrentpier/pull/1509), [\#1511](https://github.com/torrentpier/torrentpier/pull/1511), [\#1515](https://github.com/torrentpier/torrentpier/pull/1515), [\#1516](https://github.com/torrentpier/torrentpier/pull/1516), [\#1517](https://github.com/torrentpier/torrentpier/pull/1517), [\#1519](https://github.com/torrentpier/torrentpier/pull/1519), [\#1523](https://github.com/torrentpier/torrentpier/pull/1523) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#1504](https://github.com/torrentpier/torrentpier/pull/1504), [\#1513](https://github.com/torrentpier/torrentpier/pull/1513) ([Exileum](https://github.com/Exileum)) - New Crowdin updates [\#1504](https://github.com/torrentpier/torrentpier/pull/1504), [\#1513](https://github.com/torrentpier/torrentpier/pull/1513) ([Exileum](https://github.com/Exileum))
## [v2.4.3](https://github.com/torrentpier/torrentpier/tree/v2.4.3) (2024-06-09) ## [v2.4.3](https://github.com/torrentpier/torrentpier/tree/v2.4.3) (2024-06-09)

View file

@ -52,7 +52,7 @@ $stat += DB()->fetch_row('SELECT COUNT(DISTINCT user_id) AS u_bt_active FROM ' .
// All bt-users // All bt-users
$stat += DB()->fetch_row('SELECT COUNT(*) AS u_bt_all FROM ' . BB_BT_USERS); $stat += DB()->fetch_row('SELECT COUNT(*) AS u_bt_all FROM ' . BB_BT_USERS);
// All bb-users // All bb-users
$stat += DB()->fetch_row('SELECT COUNT(*) AS u_bb_all FROM ' . BB_USERS); $stat += DB()->fetch_row('SELECT COUNT(*) AS u_bb_all FROM ' . BB_USERS . ' WHERE user_id != ' . BOT_UID);
// Active torrents // Active torrents
$stat += DB()->fetch_row('SELECT COUNT(DISTINCT topic_id) AS tor_active FROM ' . TMP_TRACKER_TABLE); $stat += DB()->fetch_row('SELECT COUNT(DISTINCT topic_id) AS tor_active FROM ' . TMP_TRACKER_TABLE);
// With seeder // With seeder
@ -70,7 +70,7 @@ foreach ($peers_in_last_minutes as $t) {
} }
// Last xx seconds // Last xx seconds
$peers_in_last_sec = []; $peers_in_last_sec = [];
$rowset = DB()->fetch_rowset('SELECT COUNT(*) AS peers FROM ' . TMP_TRACKER_TABLE . ' GROUP BY update_time ORDER BY update_time DESC LIMIT ' . $peers_in_last_sec_limit); $rowset = DB()->fetch_rowset('SELECT COUNT(*) AS peers FROM ' . TMP_TRACKER_TABLE . ' ORDER BY update_time DESC LIMIT ' . $peers_in_last_sec_limit);
foreach ($rowset as $cnt => $row) { foreach ($rowset as $cnt => $row) {
$peers_in_last_sec[] = sprintf('%3s', $row['peers']) . (($cnt && !(++$cnt % 15)) ? " \n" : ''); $peers_in_last_sec[] = sprintf('%3s', $row['peers']) . (($cnt && !(++$cnt % 15)) ? " \n" : '');
} }

105
composer.lock generated
View file

@ -1521,16 +1521,16 @@
}, },
{ {
"name": "nikic/iter", "name": "nikic/iter",
"version": "v2.4.0", "version": "v2.4.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/iter.git", "url": "https://github.com/nikic/iter.git",
"reference": "09cd930fa9ff55747f34c7184532a5a1bd2385b1" "reference": "3f031ae08d82c4394410e76b88b441331a6fa15f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/iter/zipball/09cd930fa9ff55747f34c7184532a5a1bd2385b1", "url": "https://api.github.com/repos/nikic/iter/zipball/3f031ae08d82c4394410e76b88b441331a6fa15f",
"reference": "09cd930fa9ff55747f34c7184532a5a1bd2385b1", "reference": "3f031ae08d82c4394410e76b88b441331a6fa15f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1567,9 +1567,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nikic/iter/issues", "issues": "https://github.com/nikic/iter/issues",
"source": "https://github.com/nikic/iter/tree/v2.4.0" "source": "https://github.com/nikic/iter/tree/v2.4.1"
}, },
"time": "2023-12-10T20:43:19+00:00" "time": "2024-03-19T20:45:05+00:00"
}, },
{ {
"name": "phpoption/phpoption", "name": "phpoption/phpoption",
@ -2335,23 +2335,25 @@
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v6.4.7", "version": "v6.4.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4" "reference": "4d37529150e7081c51b3c5d5718c55a04a9503f3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/78dde75f8f6dbbca4ec436a4b0087f7af02076d4", "url": "https://api.github.com/repos/symfony/filesystem/zipball/4d37529150e7081c51b3c5d5718c55a04a9503f3",
"reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4", "reference": "4d37529150e7081c51b3c5d5718c55a04a9503f3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=8.1", "php": ">=8.1",
"symfony/polyfill-ctype": "~1.8", "symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.8", "symfony/polyfill-mbstring": "~1.8"
"symfony/process": "^5.4|^6.4" },
"require-dev": {
"symfony/process": "^5.4|^6.4|^7.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -2379,7 +2381,7 @@
"description": "Provides basic utilities for the filesystem", "description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/filesystem/tree/v6.4.7" "source": "https://github.com/symfony/filesystem/tree/v6.4.8"
}, },
"funding": [ "funding": [
{ {
@ -2395,20 +2397,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-04-18T09:22:46+00:00" "time": "2024-05-31T14:49:08+00:00"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v6.4.7", "version": "v6.4.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "511c48990be17358c23bf45c5d71ab85d40fb764" "reference": "3ef977a43883215d560a2cecb82ec8e62131471c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/511c48990be17358c23bf45c5d71ab85d40fb764", "url": "https://api.github.com/repos/symfony/finder/zipball/3ef977a43883215d560a2cecb82ec8e62131471c",
"reference": "511c48990be17358c23bf45c5d71ab85d40fb764", "reference": "3ef977a43883215d560a2cecb82ec8e62131471c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2443,7 +2445,7 @@
"description": "Finds files and directories via an intuitive fluent interface", "description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/finder/tree/v6.4.7" "source": "https://github.com/symfony/finder/tree/v6.4.8"
}, },
"funding": [ "funding": [
{ {
@ -2459,7 +2461,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-04-23T10:36:43+00:00" "time": "2024-05-31T14:49:08+00:00"
}, },
{ {
"name": "symfony/mailer", "name": "symfony/mailer",
@ -3103,67 +3105,6 @@
], ],
"time": "2024-01-29T20:11:03+00:00" "time": "2024-01-29T20:11:03+00:00"
}, },
{
"name": "symfony/process",
"version": "v6.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "cdb1c81c145fd5aa9b0038bab694035020943381"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/cdb1c81c145fd5aa9b0038bab694035020943381",
"reference": "cdb1c81c145fd5aa9b0038bab694035020943381",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v6.4.7"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-04-18T09:22:46+00:00"
},
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",
"version": "v3.5.0", "version": "v3.5.0",
@ -3428,5 +3369,5 @@
"php": "^8.1" "php": "^8.1"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.6.0" "plugin-api-version": "2.3.0"
} }

View file

@ -693,6 +693,7 @@ $bb_cfg['tracker'] = [
'retracker_host' => 'http://retracker.local/announce', 'retracker_host' => 'http://retracker.local/announce',
'guest_tracker' => true, 'guest_tracker' => true,
'search_by_tor_status' => true, 'search_by_tor_status' => true,
'random_release_button' => true,
'freeleech' => false, // freeleech mode (If enabled, then disable "gold_silver_enabled") 'freeleech' => false, // freeleech mode (If enabled, then disable "gold_silver_enabled")
'gold_silver_enabled' => true, // golden / silver days mode (If enabled, then disable "freeleech") 'gold_silver_enabled' => true, // golden / silver days mode (If enabled, then disable "freeleech")
'hybrid_stat_protocol' => 1, // For hybrid torrents there are two identical requests sent by clients, for counting stats we gotta choose one, you can change this to '2' in future, when v1 protocol is outdated 'hybrid_stat_protocol' => 1, // For hybrid torrents there are two identical requests sent by clients, for counting stats we gotta choose one, you can change this to '2' in future, when v1 protocol is outdated

View file

@ -61,6 +61,7 @@ $lang['DISABLED'] = 'Disabled';
$lang['ERROR'] = 'Error'; $lang['ERROR'] = 'Error';
$lang['SELECT_ACTION'] = 'Select action'; $lang['SELECT_ACTION'] = 'Select action';
$lang['CLEAR'] = 'Clear'; $lang['CLEAR'] = 'Clear';
$lang['MOVE_TO_TOP'] = 'Move to top';
$lang['UNKNOWN'] = 'Unknown'; $lang['UNKNOWN'] = 'Unknown';
$lang['NEXT_PAGE'] = 'Next'; $lang['NEXT_PAGE'] = 'Next';

View file

@ -11,8 +11,6 @@ namespace TorrentPier\Helpers;
use Longman\IPTools\Ip; use Longman\IPTools\Ip;
use function strlen;
/** /**
* Class IPHelper * Class IPHelper
* @package TorrentPier\Helpers * @package TorrentPier\Helpers

View file

@ -9,8 +9,6 @@
namespace TorrentPier\Legacy\Cache; namespace TorrentPier\Legacy\Cache;
use TorrentPier\Dev;
/** /**
* Class APCu * Class APCu
* @package TorrentPier\Legacy\Cache * @package TorrentPier\Legacy\Cache

View file

@ -9,8 +9,6 @@
namespace TorrentPier\Legacy\Cache; namespace TorrentPier\Legacy\Cache;
use TorrentPier\Dev;
/** /**
* Class Common * Class Common
* @package TorrentPier\Legacy\Cache * @package TorrentPier\Legacy\Cache

View file

@ -9,8 +9,6 @@
namespace TorrentPier\Legacy\Cache; namespace TorrentPier\Legacy\Cache;
use TorrentPier\Dev;
/** /**
* Class File * Class File
* @package TorrentPier\Legacy\Cache * @package TorrentPier\Legacy\Cache

View file

@ -9,8 +9,6 @@
namespace TorrentPier\Legacy\Cache; namespace TorrentPier\Legacy\Cache;
use TorrentPier\Dev;
/** /**
* Class Memcache * Class Memcache
* @package TorrentPier\Legacy\Cache * @package TorrentPier\Legacy\Cache

View file

@ -9,8 +9,6 @@
namespace TorrentPier\Legacy\Cache; namespace TorrentPier\Legacy\Cache;
use TorrentPier\Dev;
/** /**
* Class Redis * Class Redis
* @package TorrentPier\Legacy\Cache * @package TorrentPier\Legacy\Cache

View file

@ -10,7 +10,6 @@
namespace TorrentPier\Legacy\Cache; namespace TorrentPier\Legacy\Cache;
use SQLite3; use SQLite3;
use TorrentPier\Dev;
/** /**
* Class SqliteCommon * Class SqliteCommon

View file

@ -10,8 +10,11 @@
namespace TorrentPier\Legacy\Common; namespace TorrentPier\Legacy\Common;
use TorrentPier\Legacy\DateDelta; use TorrentPier\Legacy\DateDelta;
use TorrentPier\Legacy\Torrent;
use TorrentPier\Sessions; use TorrentPier\Sessions;
use Exception;
/** /**
* Class User * Class User
* @package TorrentPier\Legacy\Common * @package TorrentPier\Legacy\Common
@ -161,8 +164,8 @@ class User
$ip_check_u = substr(USER_IP, 0, 6); $ip_check_u = substr(USER_IP, 0, 6);
if ($ip_check_s == $ip_check_u) { if ($ip_check_s == $ip_check_u) {
if ($this->data['user_id'] != GUEST_UID && \defined('IN_ADMIN')) { if ($this->data['user_id'] != GUEST_UID && defined('IN_ADMIN')) {
\define('SID_GET', "sid={$this->data['session_id']}"); define('SID_GET', "sid={$this->data['session_id']}");
} }
$session_id = $this->sessiondata['sid'] = $this->data['session_id']; $session_id = $this->sessiondata['sid'] = $this->data['session_id'];
@ -200,13 +203,13 @@ class User
$this->session_create($userdata, true); $this->session_create($userdata, true);
} }
\define('IS_GUEST', !$this->data['session_logged_in']); define('IS_GUEST', !$this->data['session_logged_in']);
\define('IS_ADMIN', !IS_GUEST && (int)$this->data['user_level'] === ADMIN); define('IS_ADMIN', !IS_GUEST && (int)$this->data['user_level'] === ADMIN);
\define('IS_MOD', !IS_GUEST && (int)$this->data['user_level'] === MOD); define('IS_MOD', !IS_GUEST && (int)$this->data['user_level'] === MOD);
\define('IS_GROUP_MEMBER', !IS_GUEST && (int)$this->data['user_level'] === GROUP_MEMBER); define('IS_GROUP_MEMBER', !IS_GUEST && (int)$this->data['user_level'] === GROUP_MEMBER);
\define('IS_USER', !IS_GUEST && (int)$this->data['user_level'] === USER); define('IS_USER', !IS_GUEST && (int)$this->data['user_level'] === USER);
\define('IS_SUPER_ADMIN', IS_ADMIN && isset($bb_cfg['super_admins'][$this->data['user_id']])); define('IS_SUPER_ADMIN', IS_ADMIN && isset($bb_cfg['super_admins'][$this->data['user_id']]));
\define('IS_AM', IS_ADMIN || IS_MOD); define('IS_AM', IS_ADMIN || IS_MOD);
$this->set_shortcuts(); $this->set_shortcuts();
@ -255,8 +258,8 @@ class User
$mod_admin_session = ((int)$this->data['user_level'] === ADMIN || (int)$this->data['user_level'] === MOD); $mod_admin_session = ((int)$this->data['user_level'] === ADMIN || (int)$this->data['user_level'] === MOD);
// Generate passkey // Generate passkey
if (!\TorrentPier\Legacy\Torrent::getPasskey($this->data['user_id'])) { if (!Torrent::getPasskey($this->data['user_id'])) {
if (!\TorrentPier\Legacy\Torrent::generate_passkey($this->data['user_id'], true)) { if (!Torrent::generate_passkey($this->data['user_id'], true)) {
bb_simple_die('Could not generate passkey'); bb_simple_die('Could not generate passkey');
} }
} }
@ -289,7 +292,7 @@ class User
if (!$session_time = $this->data['user_session_time']) { if (!$session_time = $this->data['user_session_time']) {
$last_visit = TIMENOW; $last_visit = TIMENOW;
\define('FIRST_LOGON', true); define('FIRST_LOGON', true);
} elseif ($session_time < (TIMENOW - $bb_cfg['last_visit_update_intrv'])) { } elseif ($session_time < (TIMENOW - $bb_cfg['last_visit_update_intrv'])) {
$last_visit = max($session_time, (TIMENOW - 86400 * $bb_cfg['max_last_visit_days'])); $last_visit = max($session_time, (TIMENOW - 86400 * $bb_cfg['max_last_visit_days']));
} }
@ -329,8 +332,8 @@ class User
$this->set_session_cookies($user_id); $this->set_session_cookies($user_id);
if ($login && (\defined('IN_ADMIN') || $mod_admin_session)) { if ($login && (defined('IN_ADMIN') || $mod_admin_session)) {
\define('SID_GET', "sid=$session_id"); define('SID_GET', "sid=$session_id");
} }
Sessions::cache_set_userdata($this->data); Sessions::cache_set_userdata($this->data);
@ -527,7 +530,7 @@ class User
* @param bool $create_new * @param bool $create_new
* *
* @return string * @return string
* @throws \Exception * @throws Exception
*/ */
public function create_autologin_id(array $userdata, bool $create_new = true): string public function create_autologin_id(array $userdata, bool $create_new = true): string
{ {
@ -565,7 +568,7 @@ class User
{ {
global $bb_cfg, $theme, $source_lang, $DeltaTime; global $bb_cfg, $theme, $source_lang, $DeltaTime;
if (\defined('LANG_DIR')) { if (defined('LANG_DIR')) {
return; return;
} // prevent multiple calling } // prevent multiple calling
@ -576,13 +579,13 @@ class User
} }
} }
\define('DEFAULT_LANG_DIR', LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/'); define('DEFAULT_LANG_DIR', LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/');
\define('SOURCE_LANG_DIR', LANG_ROOT_DIR . '/source/'); define('SOURCE_LANG_DIR', LANG_ROOT_DIR . '/source/');
if ($this->data['user_id'] != GUEST_UID) { if ($this->data['user_id'] != GUEST_UID) {
if ($this->data['user_lang'] && $this->data['user_lang'] != $bb_cfg['default_lang']) { if ($this->data['user_lang'] && $this->data['user_lang'] != $bb_cfg['default_lang']) {
$bb_cfg['default_lang'] = basename($this->data['user_lang']); $bb_cfg['default_lang'] = basename($this->data['user_lang']);
\define('LANG_DIR', LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/'); define('LANG_DIR', LANG_ROOT_DIR . '/' . $bb_cfg['default_lang'] . '/');
} }
if (isset($this->data['user_timezone'])) { if (isset($this->data['user_timezone'])) {
@ -593,8 +596,8 @@ class User
$this->data['user_lang'] = $bb_cfg['default_lang']; $this->data['user_lang'] = $bb_cfg['default_lang'];
$this->data['user_timezone'] = $bb_cfg['board_timezone']; $this->data['user_timezone'] = $bb_cfg['board_timezone'];
if (!\defined('LANG_DIR')) { if (!defined('LANG_DIR')) {
\define('LANG_DIR', DEFAULT_LANG_DIR); define('LANG_DIR', DEFAULT_LANG_DIR);
} }
/** Temporary place source language to the global */ /** Temporary place source language to the global */
@ -663,7 +666,7 @@ class User
} elseif (!empty($_COOKIE['opt_js'])) { } elseif (!empty($_COOKIE['opt_js'])) {
$opt_js = json_decode($_COOKIE['opt_js'], true, 512, JSON_THROW_ON_ERROR); $opt_js = json_decode($_COOKIE['opt_js'], true, 512, JSON_THROW_ON_ERROR);
if (\is_array($opt_js)) { if (is_array($opt_js)) {
$this->opt_js = array_merge($this->opt_js, $opt_js); $this->opt_js = array_merge($this->opt_js, $opt_js);
} }
} }

View file

@ -9,8 +9,6 @@
namespace TorrentPier\Legacy\Datastore; namespace TorrentPier\Legacy\Datastore;
use TorrentPier\Dev;
/** /**
* Class APCu * Class APCu
* @package TorrentPier\Legacy\Datastore * @package TorrentPier\Legacy\Datastore

View file

@ -9,8 +9,6 @@
namespace TorrentPier\Legacy\Datastore; namespace TorrentPier\Legacy\Datastore;
use TorrentPier\Dev;
/** /**
* Class Common * Class Common
* @package TorrentPier\Legacy\Datastore * @package TorrentPier\Legacy\Datastore

View file

@ -9,8 +9,6 @@
namespace TorrentPier\Legacy\Datastore; namespace TorrentPier\Legacy\Datastore;
use TorrentPier\Dev;
/** /**
* Class File * Class File
* @package TorrentPier\Legacy\Datastore * @package TorrentPier\Legacy\Datastore

View file

@ -9,8 +9,6 @@
namespace TorrentPier\Legacy\Datastore; namespace TorrentPier\Legacy\Datastore;
use TorrentPier\Dev;
/** /**
* Class Memcache * Class Memcache
* @package TorrentPier\Legacy\Datastore * @package TorrentPier\Legacy\Datastore

View file

@ -9,8 +9,6 @@
namespace TorrentPier\Legacy\Datastore; namespace TorrentPier\Legacy\Datastore;
use TorrentPier\Dev;
/** /**
* Class Redis * Class Redis
* @package TorrentPier\Legacy\Datastore * @package TorrentPier\Legacy\Datastore

View file

@ -10,7 +10,6 @@
namespace TorrentPier\Legacy\Datastore; namespace TorrentPier\Legacy\Datastore;
use SQLite3; use SQLite3;
use TorrentPier\Dev;
/** /**
* Class SqliteCommon * Class SqliteCommon

View file

@ -20,13 +20,13 @@ class Select
* *
* @param string $default_lang * @param string $default_lang
* @param string $select_name * @param string $select_name
* @return string *
* @return mixed
*/ */
public static function language(string $default_lang, string $select_name = 'language') public static function language(string $default_lang, string $select_name = 'language'): mixed
{ {
global $bb_cfg; global $bb_cfg;
$lang_default = reset($bb_cfg['lang']);
$lang_select = '<select name="' . $select_name . '">'; $lang_select = '<select name="' . $select_name . '">';
$x = 0; $x = 0;
foreach ($bb_cfg['lang'] as $key => $data) { foreach ($bb_cfg['lang'] as $key => $data) {
@ -38,7 +38,7 @@ class Select
$x++; $x++;
} }
$lang_select .= '</select>'; $lang_select .= '</select>';
return ($x > 1) ? $lang_select : $lang_default['name']; return ($x > 1) ? $lang_select : reset($bb_cfg['lang']);
} }
/** /**
@ -73,9 +73,9 @@ class Select
* @param string $default_style * @param string $default_style
* @param string $select_name * @param string $select_name
* *
* @return string * @return mixed
*/ */
public static function template(string $default_style, string $select_name = 'tpl_name') public static function template(string $default_style, string $select_name = 'tpl_name'): mixed
{ {
global $bb_cfg; global $bb_cfg;

View file

@ -11,8 +11,6 @@ namespace TorrentPier\Legacy;
use mysqli_result; use mysqli_result;
use TorrentPier\Dev;
/** /**
* Class SqlDb * Class SqlDb
* @package TorrentPier\Legacy * @package TorrentPier\Legacy
@ -125,7 +123,7 @@ class SqlDb
if (!$this->link) { if (!$this->link) {
$this->init(); $this->init();
} }
if (\is_array($query)) { if (is_array($query)) {
$query = $this->build_sql($query); $query = $this->build_sql($query);
} }
$query = '/* ' . $this->debug_find_source() . ' */ ' . $query; $query = '/* ' . $this->debug_find_source() . ' */ ' . $query;
@ -191,43 +189,6 @@ class SqlDb
return mysqli_affected_rows($this->link); return mysqli_affected_rows($this->link);
} }
/**
* Fetch current field
*
* @param $field
* @param int $rownum
* @param int $query_id
*
* @return bool
*/
public function sql_fetchfield($field, $rownum = -1, $query_id = 0)
{
$result = null;
if (!$query_id) {
$query_id = $this->query_result;
}
if ($query_id) {
if ($rownum > -1) {
$result = $this->sql_result($query_id, $rownum, $field);
} else {
if (empty($this->row[$query_id]) && empty($this->rowset[$query_id])) {
if ($this->sql_fetchrow()) {
$result = $this->row[$query_id][$field];
}
} else {
if ($this->rowset[$query_id]) {
$result = $this->rowset[$query_id][0][$field];
} elseif ($this->row[$query_id]) {
$result = $this->row[$query_id][$field];
}
}
}
return $result;
}
return false;
}
/** /**
* @param mysqli_result $res * @param mysqli_result $res
* @param $row * @param $row
@ -324,23 +285,6 @@ class SqlDb
return $this->sql_fetchrowset($result, $field_name); return $this->sql_fetchrowset($result, $field_name);
} }
/**
* Fetch all rows WRAPPER (with error handling)
*
* @param $query
* @param string $field_name
*
* @return array
*/
public function fetch_all($query, $field_name = '')
{
if (!$result = $this->sql_query($query)) {
$this->trigger_error();
}
return $this->sql_fetchrowset($result, $field_name);
}
/** /**
* Get last inserted id after insert statement * Get last inserted id after insert statement
* *
@ -386,13 +330,13 @@ class SqlDb
} }
switch (true) { switch (true) {
case \is_string($v): case is_string($v):
return "'" . $this->escape_string($v) . "'"; return "'" . $this->escape_string($v) . "'";
case \is_int($v): case is_int($v):
return (string)$v; return (string)$v;
case \is_bool($v): case is_bool($v):
return ($v) ? '1' : '0'; return ($v) ? '1' : '0';
case \is_float($v): case is_float($v):
return "'$v'"; return "'$v'";
case null === $v: case null === $v:
return 'NULL'; return 'NULL';
@ -434,7 +378,7 @@ class SqlDb
$dont_escape = $data_already_escaped; $dont_escape = $data_already_escaped;
$check_type = $check_data_type_in_escape; $check_type = $check_data_type_in_escape;
if (empty($input_ary) || !\is_array($input_ary)) { if (empty($input_ary) || !is_array($input_ary)) {
$this->trigger_error(__FUNCTION__ . ' - wrong params: $input_ary'); $this->trigger_error(__FUNCTION__ . ' - wrong params: $input_ary');
} }
@ -764,8 +708,8 @@ class SqlDb
} }
} }
if (!\defined('IN_FIRST_SLOW_QUERY')) { if (!defined('IN_FIRST_SLOW_QUERY')) {
\define('IN_FIRST_SLOW_QUERY', true); define('IN_FIRST_SLOW_QUERY', true);
} }
CACHE('bb_cache')->set('dont_log_slow_query', $new_priority, $ignoring_time); CACHE('bb_cache')->set('dont_log_slow_query', $new_priority, $ignoring_time);
@ -899,7 +843,7 @@ class SqlDb
$msg = implode(LOG_SEPR, $msg); $msg = implode(LOG_SEPR, $msg);
$msg .= ($info = $this->query_info()) ? ' # ' . $info : ''; $msg .= ($info = $this->query_info()) ? ' # ' . $info : '';
$msg .= ' # ' . $this->debug_find_source() . ' '; $msg .= ' # ' . $this->debug_find_source() . ' ';
$msg .= \defined('IN_CRON') ? 'cron' : basename($_SERVER['REQUEST_URI']); $msg .= defined('IN_CRON') ? 'cron' : basename($_SERVER['REQUEST_URI']);
bb_log($msg . LOG_LF, $log_file); bb_log($msg . LOG_LF, $log_file);
} }
@ -910,7 +854,7 @@ class SqlDb
*/ */
public function log_slow_query($log_file = 'sql_slow_bb') public function log_slow_query($log_file = 'sql_slow_bb')
{ {
if (!\defined('IN_FIRST_SLOW_QUERY') && CACHE('bb_cache')->get('dont_log_slow_query')) { if (!defined('IN_FIRST_SLOW_QUERY') && CACHE('bb_cache')->get('dont_log_slow_query')) {
return; return;
} }
$this->log_query($log_file); $this->log_query($log_file);

View file

@ -271,7 +271,7 @@ class Template
die("Template->loadfile(): No files found for handle $handle"); die("Template->loadfile(): No files found for handle $handle");
} }
$this->xs_startup(); $this->xs_startup();
$force_recompile = empty($this->uncompiled_code[$handle]) ? false : true; $force_recompile = !empty($this->uncompiled_code[$handle]);
// checking if php file exists. // checking if php file exists.
if (!empty($this->files_cache[$handle]) && !$force_recompile) { if (!empty($this->files_cache[$handle]) && !$force_recompile) {
// php file exists - running it instead of tpl // php file exists - running it instead of tpl
@ -313,12 +313,12 @@ class Template
if (str_contains($blockname, '.')) { if (str_contains($blockname, '.')) {
// Nested block. // Nested block.
$blocks = explode('.', $blockname); $blocks = explode('.', $blockname);
$blockcount = \count($blocks) - 1; $blockcount = count($blocks) - 1;
$str = &$this->_tpldata; $str = &$this->_tpldata;
for ($i = 0; $i < $blockcount; $i++) { for ($i = 0; $i < $blockcount; $i++) {
$str = &$str[$blocks[$i] . '.']; $str = &$str[$blocks[$i] . '.'];
$str = &$str[(is_countable($str) ? \count($str) : 0) - 1]; $str = &$str[(is_countable($str) ? count($str) : 0) - 1];
} }
// Now we add the block that we're actually assigning to. // Now we add the block that we're actually assigning to.
// We're adding a new iteration to this block with the given // We're adding a new iteration to this block with the given
@ -441,7 +441,7 @@ class Template
{ {
// Get an array of the blocks involved. // Get an array of the blocks involved.
$blocks = explode('.', $blockname); $blocks = explode('.', $blockname);
$blockcount = \count($blocks) - 1; $blockcount = count($blocks) - 1;
if ($include_last_iterator) { if ($include_last_iterator) {
return '$' . $blocks[$blockcount] . '_item'; return '$' . $blocks[$blockcount] . '_item';
} }
@ -467,7 +467,7 @@ class Template
// Break it up into lines and put " -->" back. // Break it up into lines and put " -->" back.
$code_lines = explode(' -->', $code); $code_lines = explode(' -->', $code);
$count = \count($code_lines); $count = count($code_lines);
for ($i = 0; $i < ($count - 1); $i++) { for ($i = 0; $i < ($count - 1); $i++) {
$code_lines[$i] .= ' -->'; $code_lines[$i] .= ' -->';
} }
@ -486,7 +486,7 @@ class Template
// replace all short php tags // replace all short php tags
$new_code = []; $new_code = [];
$line_count = \count($code_lines); $line_count = count($code_lines);
for ($i = 0; $i < $line_count; $i++) { for ($i = 0; $i < $line_count; $i++) {
$line = $code_lines[$i]; $line = $code_lines[$i];
$pos = strpos($line, '<?'); $pos = strpos($line, '<?');
@ -509,7 +509,7 @@ class Template
$code_lines = $new_code; $code_lines = $new_code;
// main loop // main loop
$line_count = \count($code_lines); $line_count = count($code_lines);
for ($i = 0; $i < $line_count; $i++) { for ($i = 0; $i < $line_count; $i++) {
$line = $code_lines[$i]; $line = $code_lines[$i];
// reset keyword type // reset keyword type
@ -571,7 +571,7 @@ class Template
*/ */
if ($keyword_type == XS_TAG_BEGIN) { if ($keyword_type == XS_TAG_BEGIN) {
$params = explode(' ', $params_str); $params = explode(' ', $params_str);
$num_params = \count($params); $num_params = count($params);
// get variable name // get variable name
if ($num_params == 1) { if ($num_params == 1) {
$var = $params[0]; $var = $params[0];
@ -635,7 +635,7 @@ class Template
*/ */
if ($keyword_type == XS_TAG_END) { if ($keyword_type == XS_TAG_END) {
$params = explode(' ', $params_str); $params = explode(' ', $params_str);
$num_params = \count($params); $num_params = count($params);
if ($num_params == 1) { if ($num_params == 1) {
$var = $params[0]; $var = $params[0];
} elseif ($num_params == 2 && $params[0] === '') { } elseif ($num_params == 2 && $params[0] === '') {
@ -678,7 +678,7 @@ class Template
*/ */
if ($keyword_type == XS_TAG_INCLUDE) { if ($keyword_type == XS_TAG_INCLUDE) {
$params = explode(' ', $params_str); $params = explode(' ', $params_str);
$num_params = \count($params); $num_params = count($params);
if ($num_params != 1) { if ($num_params != 1) {
$compiled[] = $keyword_str; $compiled[] = $keyword_str;
continue; continue;
@ -743,14 +743,14 @@ class Template
*/ */
public function _compile_text($code) public function _compile_text($code)
{ {
if (\strlen($code) < 3) { if (strlen($code) < 3) {
return $code; return $code;
} }
// change template varrefs into PHP varrefs // change template varrefs into PHP varrefs
// This one will handle varrefs WITH namespaces // This one will handle varrefs WITH namespaces
$varrefs = []; $varrefs = [];
preg_match_all('#\{(([a-z0-9\-_]+?\.)+)([a-z0-9\-_]+?)\}#is', $code, $varrefs); preg_match_all('#\{(([a-z0-9\-_]+?\.)+)([a-z0-9\-_]+?)\}#is', $code, $varrefs);
$varcount = is_countable($varrefs[1]) ? \count($varrefs[1]) : 0; $varcount = is_countable($varrefs[1]) ? count($varrefs[1]) : 0;
$search = []; $search = [];
$replace = []; $replace = [];
for ($i = 0; $i < $varcount; $i++) { for ($i = 0; $i < $varcount; $i++) {
@ -760,7 +760,7 @@ class Template
$search[] = $varrefs[0][$i]; $search[] = $varrefs[0][$i];
$replace[] = $new; $replace[] = $new;
} }
if (\count($search) > 0) { if (count($search) > 0) {
$code = str_replace($search, $replace, $code); $code = str_replace($search, $replace, $code);
} }
// This will handle the remaining root-level varrefs // This will handle the remaining root-level varrefs
@ -788,7 +788,7 @@ class Template
[^\s(),]+)/x', $tag_args, $match); [^\s(),]+)/x', $tag_args, $match);
$tokens = $match[0]; $tokens = $match[0];
$tokens_cnt = is_countable($tokens) ? \count($tokens) : 0; $tokens_cnt = is_countable($tokens) ? count($tokens) : 0;
$is_arg_stack = []; $is_arg_stack = [];
for ($i = 0; $i < $tokens_cnt; $i++) { for ($i = 0; $i < $tokens_cnt; $i++) {
@ -845,11 +845,11 @@ class Template
case 'is': case 'is':
$is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1; $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1;
$is_arg = implode(' ', \array_slice($tokens, $is_arg_start, $i - $is_arg_start)); $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
$new_tokens = $this->_parse_is_expr($is_arg, \array_slice($tokens, $i + 1)); $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1));
array_splice($tokens, $is_arg_start, is_countable($tokens) ? \count($tokens) : 0, $new_tokens); array_splice($tokens, $is_arg_start, is_countable($tokens) ? count($tokens) : 0, $new_tokens);
$i = $is_arg_start; $i = $is_arg_start;
break; break;
@ -995,7 +995,7 @@ class Template
// adding current template // adding current template
$tpl = $this->root . '/'; $tpl = $this->root . '/';
if (str_starts_with($tpl, './')) { if (str_starts_with($tpl, './')) {
$tpl = substr($tpl, 2, \strlen($tpl)); $tpl = substr($tpl, 2, strlen($tpl));
} }
$this->vars['TEMPLATE'] ??= $tpl; $this->vars['TEMPLATE'] ??= $tpl;
$this->vars['TEMPLATE_NAME'] ??= $this->tpl; $this->vars['TEMPLATE_NAME'] ??= $this->tpl;

View file

@ -9,6 +9,10 @@
namespace TorrentPier\Legacy; namespace TorrentPier\Legacy;
use Arokettu\Bencode\Bencode;
use Arokettu\Bencode\Bencode\Collection;
use Exception;
/** /**
* Class Torrent * Class Torrent
* @package TorrentPier\Legacy * @package TorrentPier\Legacy
@ -318,15 +322,15 @@ class Torrent
$file_contents = file_get_contents($filename); $file_contents = file_get_contents($filename);
try { try {
$tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY); $tor = Bencode::decode($file_contents, dictType: Collection::ARRAY);
} catch (\Exception $e) { } catch (Exception $e) {
self::torrent_error_exit(htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}")); self::torrent_error_exit(htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}"));
} }
if ($bb_cfg['bt_disable_dht']) { if ($bb_cfg['bt_disable_dht']) {
$tor['info']['private'] = (int)1; $tor['info']['private'] = (int)1;
$fp = fopen($filename, 'wb+'); $fp = fopen($filename, 'wb+');
fwrite($fp, \Arokettu\Bencode\Bencode::encode($tor)); fwrite($fp, Bencode::encode($tor));
fclose($fp); fclose($fp);
} }
@ -337,7 +341,7 @@ class Torrent
$ann = $tor['announce'] ?? ''; $ann = $tor['announce'] ?? '';
$announce_urls['main_url'] = $bb_cfg['bt_announce_url']; $announce_urls['main_url'] = $bb_cfg['bt_announce_url'];
if (!$ann || !\in_array($ann, $announce_urls)) { if (!$ann || !in_array($ann, $announce_urls)) {
$msg = sprintf($lang['INVALID_ANN_URL'], htmlspecialchars($ann), $announce_urls['main_url']); $msg = sprintf($lang['INVALID_ANN_URL'], htmlspecialchars($ann), $announce_urls['main_url']);
self::torrent_error_exit($msg); self::torrent_error_exit($msg);
} }
@ -371,14 +375,14 @@ class Torrent
// Getting info_hash v1 // Getting info_hash v1
if (isset($bt_v1)) { if (isset($bt_v1)) {
$info_hash = hash('sha1', \Arokettu\Bencode\Bencode::encode($info), true); $info_hash = hash('sha1', Bencode::encode($info), true);
$info_hash_sql = rtrim(DB()->escape($info_hash), ' '); $info_hash_sql = rtrim(DB()->escape($info_hash), ' ');
$info_hash_where = "WHERE info_hash = '$info_hash_sql'"; $info_hash_where = "WHERE info_hash = '$info_hash_sql'";
} }
// Getting info_hash v2 // Getting info_hash v2
if (isset($bt_v2)) { if (isset($bt_v2)) {
$info_hash_v2 = hash('sha256', \Arokettu\Bencode\Bencode::encode($info), true); $info_hash_v2 = hash('sha256', Bencode::encode($info), true);
$info_hash_v2_sql = rtrim(DB()->escape($info_hash_v2), ' '); $info_hash_v2_sql = rtrim(DB()->escape($info_hash_v2), ' ');
$info_hash_where = "WHERE info_hash_v2 = '$info_hash_v2_sql'"; $info_hash_where = "WHERE info_hash_v2 = '$info_hash_v2_sql'";
} }
@ -398,7 +402,7 @@ class Torrent
if (isset($info['length'])) { if (isset($info['length'])) {
$totallen = (float)$info['length']; $totallen = (float)$info['length'];
} elseif (isset($bt_v1, $info['files']) && !isset($bt_v2) && \is_array($info['files'])) { } elseif (isset($bt_v1, $info['files']) && !isset($bt_v2) && is_array($info['files'])) {
foreach ($info['files'] as $fn => $f) { foreach ($info['files'] as $fn => $f) {
// Exclude padding files // Exclude padding files
if (!isset($f['attr']) || $f['attr'] !== 'p') { if (!isset($f['attr']) || $f['attr'] !== 'p') {
@ -561,8 +565,8 @@ class Torrent
// Torrent decoding // Torrent decoding
$file_contents = file_get_contents($filename); $file_contents = file_get_contents($filename);
try { try {
$tor = \Arokettu\Bencode\Bencode::decode($file_contents, dictType: \Arokettu\Bencode\Bencode\Collection::ARRAY); $tor = Bencode::decode($file_contents, dictType: Collection::ARRAY);
} catch (\Exception $e) { } catch (Exception $e) {
bb_die(htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}")); bb_die(htmlCHR("{$lang['TORFILE_INVALID']}: {$e->getMessage()}"));
} }
@ -639,13 +643,13 @@ class Torrent
unset($tor['comment.utf-8']); unset($tor['comment.utf-8']);
// Send torrent // Send torrent
$output = \Arokettu\Bencode\Bencode::encode($tor); $output = Bencode::encode($tor);
$dl_fname = html_entity_decode($topic_title, ENT_QUOTES, 'UTF-8') . ' [' . $bb_cfg['server_name'] . '-' . $topic_id . ']' . '.' . TORRENT_EXT; $dl_fname = html_entity_decode($topic_title, ENT_QUOTES, 'UTF-8') . ' [' . $bb_cfg['server_name'] . '-' . $topic_id . ']' . '.' . TORRENT_EXT;
if (!empty($_COOKIE['explain'])) { if (!empty($_COOKIE['explain'])) {
$out = "attach path: $filename<br /><br />"; $out = "attach path: $filename<br /><br />";
$tor['info']['pieces'] = '[...] ' . \strlen($tor['info']['pieces']) . ' bytes'; $tor['info']['pieces'] = '[...] ' . strlen($tor['info']['pieces']) . ' bytes';
$out .= print_r($tor, true); $out .= print_r($tor, true);
bb_die("<pre>$out</pre>"); bb_die("<pre>$out</pre>");
} }

View file

@ -79,7 +79,7 @@ class TorrentFileList
$info['name'] =& $info['name.utf-8']; $info['name'] =& $info['name.utf-8'];
} }
if (isset($info['files']) && \is_array($info['files'])) { if (isset($info['files']) && is_array($info['files'])) {
$this->root_dir = isset($info['name']) ? clean_tor_dirname($info['name']) : '...'; $this->root_dir = isset($info['name']) ? clean_tor_dirname($info['name']) : '...';
$this->multiple = true; $this->multiple = true;
@ -87,7 +87,7 @@ class TorrentFileList
if (isset($f['path.utf-8'])) { if (isset($f['path.utf-8'])) {
$f['path'] =& $f['path.utf-8']; $f['path'] =& $f['path.utf-8'];
} }
if (!isset($f['path']) || !\is_array($f['path'])) { if (!isset($f['path']) || !is_array($f['path'])) {
continue; continue;
} }
// Exclude padding files // Exclude padding files
@ -101,7 +101,7 @@ class TorrentFileList
} }
$length = isset($f['length']) ? (float)$f['length'] : 0; $length = isset($f['length']) ? (float)$f['length'] : 0;
$subdir_count = \count($f['path']) - 1; $subdir_count = count($f['path']) - 1;
if ($subdir_count > 0) { if ($subdir_count > 0) {
$name = array_pop($f['path']); $name = array_pop($f['path']);
@ -116,7 +116,7 @@ class TorrentFileList
$cur_files_ary =& $cur_files_ary[$subdir]; $cur_files_ary =& $cur_files_ary[$subdir];
if ($j === $subdir_count) { if ($j === $subdir_count) {
if (\is_string($cur_files_ary)) { if (is_string($cur_files_ary)) {
$GLOBALS['bnc_error'] = 1; $GLOBALS['bnc_error'] = 1;
break; break;
} }

View file

@ -46,7 +46,7 @@ class WordsRate
$this->del_text_hl = $text; $this->del_text_hl = $text;
// Long text // Long text
if (\strlen($text) > 600) { if (strlen($text) > 600) {
return $this->words_rate; return $this->words_rate;
} }
// Crop quotes if contains +1 // Crop quotes if contains +1

View file

@ -62,11 +62,11 @@ ajax.callback.view_post = function(data) {
<!-- ENDIF / AJAX_TOPICS --> <!-- ENDIF / AJAX_TOPICS -->
<a name="start"></a> <a name="start"></a>
<h1 class="pagetitle">{PAGE_TITLE}&nbsp;&middot;&nbsp;<a href="{U_TRACKER}?random_release=1">{L_RANDOM_RELEASE}</a></h1> <h1 class="pagetitle">{PAGE_TITLE}</h1>
<div class="nav"> <div class="nav">
<p class="floatL"><a href="{U_INDEX}">{T_INDEX}</a></p> <p class="floatL"><a href="{U_INDEX}">{T_INDEX}</a></p>
<!-- IF MATCHES --><p class="floatR">{MATCHES} {SERACH_MAX}</p><!-- ENDIF --> <p class="floatR"><!-- IF $bb_cfg['tracker']['random_release_button'] --><a href="{U_TRACKER}?random_release=1">{L_RANDOM_RELEASE}</a><!-- ENDIF --><!-- IF MATCHES -->&nbsp;&middot;&nbsp;{MATCHES}{SERACH_MAX}<!-- ENDIF --></p>
<div class="clear"></div> <div class="clear"></div>
</div> </div>

View file

@ -512,6 +512,9 @@ td.topic_id { cursor: pointer; }
<!-- ELSE --> <!-- ELSE -->
&nbsp; &nbsp;
<!-- ENDIF --> <!-- ENDIF -->
<div style="margin-top: 5px;">
<a href="#" onclick="$.scrollTo('#forum-table', {duration: 200, axis: 'y'}); return false;">{L_MOVE_TO_TOP}</a>
</div>
</td> </td>
</tr> </tr>
</table> </table>

View file

@ -576,6 +576,9 @@ function build_poll_add_form (src_el)
{S_SELECT_POST_ORDER}&nbsp; {S_SELECT_POST_ORDER}&nbsp;
<input type="submit" value="{L_GO}" class="lite" name="submit" /> <input type="submit" value="{L_GO}" class="lite" name="submit" />
</form> </form>
<div style="margin-top: 5px;">
<a href="#" onclick="$.scrollTo('#topic_main', {duration: 200, axis: 'y'}); return false;">{L_MOVE_TO_TOP}</a>
</div>
</td> </td>
</tr> </tr>
</table> </table>

View file

@ -299,7 +299,7 @@ if (isset($_GET[$user_releases_key])) {
} }
// Random release // Random release
if (isset($_GET['random_release'])) { if ($bb_cfg['tracker']['random_release_button'] && isset($_GET['random_release'])) {
if ($random_release = DB()->fetch_row("SELECT topic_id FROM " . BB_BT_TORRENTS . " WHERE tor_status NOT IN(" . implode(', ', array_keys($bb_cfg['tor_frozen'])) . ") ORDER BY RAND() LIMIT 1")) { if ($random_release = DB()->fetch_row("SELECT topic_id FROM " . BB_BT_TORRENTS . " WHERE tor_status NOT IN(" . implode(', ', array_keys($bb_cfg['tor_frozen'])) . ") ORDER BY RAND() LIMIT 1")) {
redirect(TOPIC_URL . $random_release['topic_id']); redirect(TOPIC_URL . $random_release['topic_id']);
} else { } else {