Some cleanup...😣 (#1488)

* Some cleanup...😣

* Update main.php

* Update CHANGELOG.md

* Update main.php

* Update main.php

* Update main.php

* Update main.php

* Update main.php

* Update main.php

* Update main.php

* Update main.php

* Update main.php

* Update main.php

* Update main.php

* Update main.php

* Update main.php

* Update config.php

* Update Common.php

* Updated

* Update filelist.php

* Update filelist.php

* Update viewtopic_attach.tpl

* Updated
This commit is contained in:
Roman Kelesidis 2024-06-05 12:51:23 +07:00 committed by GitHub
commit 237e7ec6ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 65 additions and 71 deletions

View file

@ -11,6 +11,7 @@
- Added support for APCu caching method [\#1442](https://github.com/torrentpier/torrentpier/pull/1442) ([belomaxorka](https://github.com/belomaxorka))
- Added support for attribute to ignoring auto spoilers opening [\#1466](https://github.com/torrentpier/torrentpier/pull/1466) ([belomaxorka](https://github.com/belomaxorka))
- Some enhancements [\#1445](https://github.com/torrentpier/torrentpier/pull/1445) ([belomaxorka](https://github.com/belomaxorka))
- Some cleanup...😣 [\#1488](https://github.com/torrentpier/torrentpier/pull/1488) ([belomaxorka](https://github.com/belomaxorka))
- Guests can view polls [\#1464](https://github.com/torrentpier/torrentpier/pull/1464) ([belomaxorka](https://github.com/belomaxorka))
- Improved app debug [\#1438](https://github.com/torrentpier/torrentpier/pull/1438) ([belomaxorka](https://github.com/belomaxorka))
- Show client country in seeders / leechers list 🌍 [\#1478](https://github.com/torrentpier/torrentpier/pull/1478) ([belomaxorka](https://github.com/belomaxorka))
@ -21,7 +22,7 @@
- Code refactoring [\#1441](https://github.com/torrentpier/torrentpier/pull/1441) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1435](https://github.com/torrentpier/torrentpier/pull/1435), [\#1443](https://github.com/torrentpier/torrentpier/pull/1443), [\#1446](https://github.com/torrentpier/torrentpier/pull/1446), [\#1450](https://github.com/torrentpier/torrentpier/pull/1450), [\#1452](https://github.com/torrentpier/torrentpier/pull/1452), [\#1458](https://github.com/torrentpier/torrentpier/pull/1458), [\#1461](https://github.com/torrentpier/torrentpier/pull/1461), [\#1462](https://github.com/torrentpier/torrentpier/pull/1462), [\#1467](https://github.com/torrentpier/torrentpier/pull/1467), [\#1469](https://github.com/torrentpier/torrentpier/pull/1469), [\#1472](https://github.com/torrentpier/torrentpier/pull/1472), [\#1477](https://github.com/torrentpier/torrentpier/pull/1477), [\#1480](https://github.com/torrentpier/torrentpier/pull/1480), [\#1481](https://github.com/torrentpier/torrentpier/pull/1481), [\#1482](https://github.com/torrentpier/torrentpier/pull/1482), [\#1484](https://github.com/torrentpier/torrentpier/pull/1484) ([belomaxorka](https://github.com/belomaxorka))
- Updated deps [\#1454](https://github.com/torrentpier/torrentpier/pull/1454), [\#1455](https://github.com/torrentpier/torrentpier/pull/1455), [\#1459](https://github.com/torrentpier/torrentpier/pull/1459), [\#1460](https://github.com/torrentpier/torrentpier/pull/1460), [\#1485](https://github.com/torrentpier/torrentpier/pull/1485), [\#1486](https://github.com/torrentpier/torrentpier/pull/1486) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#1444](https://github.com/torrentpier/torrentpier/pull/1444), [\#1447](https://github.com/torrentpier/torrentpier/pull/1447), [\#1453](https://github.com/torrentpier/torrentpier/pull/1453), [\#1468](https://github.com/torrentpier/torrentpier/pull/1468), [\#1473](https://github.com/torrentpier/torrentpier/pull/1473), [\#1476](https://github.com/torrentpier/torrentpier/pull/1476), [\#1479](https://github.com/torrentpier/torrentpier/pull/1479) ([Exileum](https://github.com/Exileum))
- New Crowdin updates [\#1444](https://github.com/torrentpier/torrentpier/pull/1444), [\#1447](https://github.com/torrentpier/torrentpier/pull/1447), [\#1453](https://github.com/torrentpier/torrentpier/pull/1453), [\#1468](https://github.com/torrentpier/torrentpier/pull/1468), [\#1473](https://github.com/torrentpier/torrentpier/pull/1473), [\#1476](https://github.com/torrentpier/torrentpier/pull/1476), [\#1479](https://github.com/torrentpier/torrentpier/pull/1479), [\#1487](https://github.com/torrentpier/torrentpier/pull/1487) ([Exileum](https://github.com/Exileum))
## [v2.4.2](https://github.com/torrentpier/torrentpier/tree/v2.4.2) (2024-03-30)
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.1...v2.4.2)

View file

@ -14,10 +14,10 @@ if (!empty($setmodules)) {
require __DIR__ . '/pagestart.php';
$datastore->enqueue(array(
$datastore->enqueue([
'moderators',
'cat_forums',
));
]);
$log_action->init();

View file

@ -163,6 +163,10 @@ a {
color: #1d9100;
}
a:hover {
text-decoration: underline;
}
sup {
color: #aa8000;
}
@ -178,7 +182,7 @@ sup {
top: 0;
opacity: 0;
transition: opacity 0.7s;
width: 400px;
width: 200px;
background-color: #111;
color: #acacac;
text-align: left;

View file

@ -32,10 +32,14 @@ $datastore->enqueue([
]);
if ($bb_cfg['show_latest_news']) {
$datastore->enqueue('latest_news');
$datastore->enqueue([
'latest_news'
]);
}
if ($bb_cfg['show_network_news']) {
$datastore->enqueue('network_news');
$datastore->enqueue([
'network_news'
]);
}
// Init userdata

View file

@ -60,13 +60,17 @@ switch ($mode) {
// Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if (isset($news_forums[$t_data['forum_id']]) && $bb_cfg['show_latest_news']) {
$datastore->enqueue('latest_news');
$datastore->enqueue([
'latest_news'
]);
$datastore->update('latest_news');
}
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if (isset($net_forums[$t_data['forum_id']]) && $bb_cfg['show_network_news']) {
$datastore->enqueue('network_news');
$datastore->enqueue([
'network_news'
]);
$datastore->update('network_news');
}

View file

@ -544,6 +544,7 @@ $lang['NO_SEND_ACCOUNT'] = 'Sorry, but your password cannot be retrieved. Please
$lang['ALWAYS_ADD_SIG'] = 'Always attach my signature';
$lang['HIDE_PORN_FORUMS'] = 'Hide content 18+';
$lang['ADD_RETRACKER'] = 'Add retracker in torrent files';
$lang['ALWAYS_NOTIFY'] = 'Always notify me of replies';
$lang['ALWAYS_NOTIFY_EXPLAIN'] = 'Sends an e-mail when someone replies to a topic you have posted in. This can be changed whenever you post.';
@ -2524,48 +2525,6 @@ $lang['RETURN_CONFIG'] = '%sReturn to Configuration%s';
$lang['CONFIG_UPD'] = 'Configuration Updated Successfully';
$lang['SET_DEFAULTS'] = 'Restore defaults';
$lang['OFF_TRACKER'] = 'Disable tracker';
$lang['OFF_REASON'] = 'Disable reason';
$lang['OFF_REASON_EXPL'] = 'this message will be sent to client when the tracker is disabled';
$lang['AUTOCLEAN_EXPL'] = 'autoclean peers table - do not disable without reason';
$lang['COMPACT_MODE'] = 'Compact mode';
$lang['COMPACT_MODE_EXPL'] = '"Yes" - tracker will only accept clients working in compact mode<br />"No" - compatible mode (chosen by client)';
$lang['BROWSER_REDIRECT_URL'] = 'Browser redirect URL';
$lang['BROWSER_REDIRECT_URL_EXPL'] = 'if user tries to open tracker URL in Web browser<br />leave blank to disable';
$lang['ANNOUNCE_INTERVAL_HEAD'] = 'Misc';
$lang['ANNOUNCE_INTERVAL'] = 'Announce interval';
$lang['ANNOUNCE_INTERVAL_EXPL'] = 'peers should wait at least this many seconds between announcements';
$lang['NUMWANT'] = 'Numwant value';
$lang['NUMWANT_EXPL'] = 'number of peers being sent to client';
$lang['EXPIRE_FACTOR'] = 'Peer expire factor';
$lang['EXPIRE_FACTOR_EXPL'] = 'Consider a peer dead if it has not announced in a number of seconds equal to this many times the calculated announce interval at the time of its last announcement (must be greater than 1)';
$lang['IGNORE_GIVEN_IP'] = 'Ignore IP reported by client';
$lang['UPDATE_DLSTAT'] = 'Store users up/down statistics';
$lang['LIMIT_ACTIVE_TOR_HEAD'] = 'Limits';
$lang['LIMIT_ACTIVE_TOR'] = 'Limit active torrents';
$lang['LIMIT_SEED_COUNT'] = 'Seeding limit';
$lang['LIMIT_SEED_COUNT_EXPL'] = '(0 - no limit)';
$lang['LIMIT_LEECH_COUNT'] = 'Leeching limit';
$lang['LIMIT_LEECH_COUNT_EXPL'] = '(0 - no limit)';
$lang['LEECH_EXPIRE_FACTOR'] = 'Leech expire factor';
$lang['LEECH_EXPIRE_FACTOR_EXPL'] = 'Treat a peer as active for this number of minutes even if it sent "stopped" event after starting dl<br />0 - take into account "stopped" event';
$lang['LIMIT_CONCURRENT_IPS'] = "Limit concurrent IP's";
$lang['LIMIT_CONCURRENT_IPS_EXPL'] = 'per torrent limit';
$lang['LIMIT_SEED_IPS'] = 'Seeding IP limit';
$lang['LIMIT_SEED_IPS_EXPL'] = "allow seeding from no more than <i>xx</i> IP's<br />0 - no limit";
$lang['LIMIT_LEECH_IPS'] = 'Leeching IP limit';
$lang['LIMIT_LEECH_IPS_EXPL'] = "allow leeching from no more than <i>xx</i> IP's<br />0 - no limit";
$lang['USE_AUTH_KEY_HEAD'] = 'Authorization';
$lang['USE_AUTH_KEY'] = 'Passkey';
$lang['USE_AUTH_KEY_EXPL'] = 'enable check for passkey';
$lang['AUTH_KEY_NAME'] = 'Passkey name';
$lang['AUTH_KEY_NAME_EXPL'] = 'passkey key name in GET request';
$lang['ALLOW_GUEST_DL'] = 'Allow guest access to tracker';
$lang['ADD_RETRACKER'] = 'Add retracker in torrent files';
// Forum config
$lang['FORUM_CFG_EXPL'] = 'Forum config';

View file

@ -225,13 +225,17 @@ switch ($mode) {
//Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if (isset($news_forums[$forum_id]) && $bb_cfg['show_latest_news'] && $result) {
$datastore->enqueue('latest_news');
$datastore->enqueue([
'latest_news'
]);
$datastore->update('latest_news');
}
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if (isset($net_forums[$forum_id]) && $bb_cfg['show_network_news'] && $result) {
$datastore->enqueue('network_news');
$datastore->enqueue([
'network_news'
]);
$datastore->update('network_news');
}
@ -256,13 +260,17 @@ switch ($mode) {
//Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if ((isset($news_forums[$forum_id]) || isset($news_forums[$new_forum_id])) && $bb_cfg['show_latest_news'] && $result) {
$datastore->enqueue('latest_news');
$datastore->enqueue([
'latest_news'
]);
$datastore->update('latest_news');
}
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if ((isset($net_forums[$forum_id]) || isset($net_forums[$new_forum_id])) && $bb_cfg['show_network_news'] && $result) {
$datastore->enqueue('network_news');
$datastore->enqueue([
'network_news'
]);
$datastore->update('network_news');
}

View file

@ -21,23 +21,25 @@ class Common
* Директория с builder-скриптами (внутри INC_DIR)
*/
public $ds_dir = 'datastore';
/**
* Готовая к употреблению data
* array('title' => data)
*/
public $data = [];
public array $data = [];
/**
* Список элементов, которые будут извлечены из хранилища при первом же запросе get()
* до этого момента они ставятся в очередь $queued_items для дальнейшего извлечения _fetch()'ем
* всех элементов одним запросом
* array('title1', 'title2'...)
*/
public $queued_items = [];
public array $queued_items = [];
/**
* 'title' => 'builder script name' inside "includes/datastore" dir
*/
public $known_items = [
public array $known_items = [
'cat_forums' => 'build_cat_forums.php',
'check_updates' => 'build_check_updates.php',
'jumpbox' => 'build_cat_forums.php',
@ -54,13 +56,13 @@ class Common
];
/**
* @param array (item1_title, item2_title...) or single item's title
* @param array $items
* @return void
*/
public function enqueue($items)
public function enqueue(array $items): void
{
foreach ((array)$items as $item) {
// игнор уже поставленного в очередь либо уже извлеченного
if (!\in_array($item, $this->queued_items) && !isset($this->data[$item])) {
foreach ($items as $item) {
if (!in_array($item, $this->queued_items) && !isset($this->data[$item])) {
$this->queued_items[] = $item;
}
}
@ -69,7 +71,7 @@ class Common
public function &get($title)
{
if (!isset($this->data[$title])) {
$this->enqueue($title);
$this->enqueue([$title]);
$this->_fetch();
}
return $this->data[$title];

View file

@ -201,7 +201,9 @@ class Post
if ($bb_cfg['show_latest_news']) {
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));
if (isset($news_forums[$forum_id]) && $bb_cfg['show_latest_news'] && $mode == 'newtopic') {
$datastore->enqueue('latest_news');
$datastore->enqueue([
'latest_news'
]);
$datastore->update('latest_news');
}
}
@ -209,7 +211,9 @@ class Post
if ($bb_cfg['show_network_news']) {
$net_forums = array_flip(explode(',', $bb_cfg['network_news_forum_id']));
if (isset($net_forums[$forum_id]) && $bb_cfg['show_network_news'] && $mode == 'newtopic') {
$datastore->enqueue('network_news');
$datastore->enqueue([
'network_news'
]);
$datastore->update('network_news');
}
}

View file

@ -997,8 +997,8 @@ class SqlDb
$this->explain_out .= '
<table width="98%" cellpadding="0" cellspacing="0" class="bodyline row2 bCenter" style="border-bottom: 0;">
<tr>
<th style="height: 22px; cursor: pointer;" align="left">&nbsp;' . $dbg['src'] . '&nbsp; [' . sprintf('%.4f', $dbg['time']) . ' s]&nbsp; <i>' . $dbg['info'] . '</i></th>
<th class="copyElement" data-clipboard-target="#' . $htid . '" style="height: 22px; cursor: pointer;" align="right" title="Copy to clipboard">' . "[$this->engine] $this->db_server.$this->selected_db" . ' :: Query #' . ($this->num_queries + 1) . '&nbsp;</th>
<th style="height: 22px;" align="left">&nbsp;' . $dbg['src'] . '&nbsp; [' . sprintf('%.4f', $dbg['time']) . ' s]&nbsp; <i>' . $dbg['info'] . '</i></th>
<th class="copyElement" data-clipboard-target="#' . $htid . '" style="height: 22px;" align="right" title="Copy to clipboard">' . "[$this->engine] $this->db_server.$this->selected_db" . ' :: Query #' . ($this->num_queries + 1) . '&nbsp;</th>
</tr>
<tr><td colspan="2">' . $this->explain_hold . '</td></tr>
</table>

View file

@ -104,3 +104,7 @@ pre, .pre {
border: 2px solid #CC6600;
padding: 8px;
}
.copyElement {
cursor: pointer !important;
}

View file

@ -160,8 +160,8 @@
{postrow.attach.tor_reged.TRACKER_LINK}
[ <span title="{postrow.attach.tor_reged.REGED_DELTA}">{postrow.attach.tor_reged.REGED_TIME}</span> ]
<!-- IF not postrow.attach.tor_reged.TOR_FROZEN -->
<br><!-- IF postrow.attach.tor_reged.HASH --><br>info_hash: {postrow.attach.tor_reged.HASH}<!-- ENDIF -->
<!-- IF postrow.attach.tor_reged.HASH_V2 --><br>info_hash v2: {postrow.attach.tor_reged.HASH_V2}<!-- ENDIF -->
<br><!-- IF postrow.attach.tor_reged.HASH --><br>info_hash: <span class="copyElement" data-clipboard-text="{postrow.attach.tor_reged.HASH}" title="Copy to clipboard">{postrow.attach.tor_reged.HASH}</span><!-- ENDIF -->
<!-- IF postrow.attach.tor_reged.HASH_V2 --><br>info_hash v2: <span class="copyElement" data-clipboard-text="{postrow.attach.tor_reged.HASH_V2}" title="Copy to clipboard">{postrow.attach.tor_reged.HASH_V2}</span><!-- ENDIF -->
<!-- ENDIF -->
</td>
<td width="15%" rowspan="4" class="tCenter pad_6">

View file

@ -119,11 +119,15 @@ if ($t_data['allow_porno_topic'] && bf($userdata['user_opt'], 'user_opt', 'user_
if ($userdata['session_admin'] && !empty($_REQUEST['mod'])) {
if (IS_ADMIN) {
$datastore->enqueue(['viewtopic_forum_select']);
$datastore->enqueue([
'viewtopic_forum_select'
]);
}
}
if ($topic_attachment) {
$datastore->enqueue(['attach_extensions']);
$datastore->enqueue([
'attach_extensions'
]);
}
set_die_append_msg($forum_id);