Minor improvements (#297)

* Minor improvements

* Update CHANGELOG.md

* Update config.php

* Update admin_ug_auth.php

* Updated

* Update admin_disallow.php

* Update admin_ranks.php

* Update admin_smilies.php

* Update scrape.php

* Update scrape.php

* Update view_torrent.php
This commit is contained in:
Roman Kelesidis 2023-10-04 23:26:47 +07:00 committed by GitHub
parent 4d99225376
commit 933e4b3283
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 79 additions and 47 deletions

View File

@ -1,5 +1,13 @@
# 📖 Change Log
## [v2.1.5-2023.10](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.10) (2023-11-04)
[Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.09...v2.1.5-2023.10)
**Merged pull requests:**
- Release v2.1.5-2023.10 🎉
- Minor improvements [\#297](https://github.com/torrentpier/torrentpier-lts/pull/297) ([belomaxorka](https://github.com/belomaxorka))
## [v2.1.5-2023.09](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.09) (2023-10-04)
[Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.08-HotFix...v2.1.5-2023.09)

View File

@ -302,7 +302,7 @@ if ($view == 'search')
}
$s_forums = '';
$list_cat = [];
$list_cat = array();
while ($row = DB()->sql_fetchrow($result))
{ //sf
$s_forums .= '<option value="' . $row['forum_id'] . '">' . (($row['forum_parent']) ? HTML_SF_SPACER : '') . htmlCHR($row['forum_name']) . '</option>';

View File

@ -17,7 +17,7 @@ if (isset($_POST['add_name']))
if ($disallowed_user == '')
{
bb_die($lang['FIELDS_EMPTY']);
bb_die($lang['FIELDS_EMPTY'] . '<br /><br />'. sprintf($lang['CLICK_RETURN_DISALLOWADMIN'], '<a href="admin_disallow.php">', '</a>') . '<br /><br />'. sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
if( validate_username($disallowed_user) )
{
@ -94,4 +94,4 @@ $template->assign_vars(array(
'S_FORM_ACTION' => 'admin_disallow.php',
));
print_page('admin_disallow.tpl', 'admin');
print_page('admin_disallow.tpl', 'admin');

View File

@ -48,7 +48,7 @@ if ($mode != '')
{
if (empty($rank_id))
{
bb_die($lang['MUST_SELECT_RANK']);
bb_die($lang['MUST_SELECT_RANK'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
$sql = "SELECT * FROM " . BB_RANKS . " WHERE rank_id = $rank_id";
@ -100,7 +100,7 @@ if ($mode != '')
if ($rank_title == '')
{
bb_die($lang['MUST_SELECT_RANK']);
bb_die($lang['MUST_SELECT_RANK'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
if ($special_rank == 1)
@ -127,7 +127,7 @@ if ($mode != '')
$sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
if (!$result = DB()->sql_query($sql))
{
bb_die($lang['NO_UPDATE_RANKS']);
bb_die($lang['NO_UPDATE_RANKS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
}
$sql = "UPDATE " . BB_RANKS . "
@ -186,7 +186,7 @@ if ($mode != '')
$sql = "UPDATE " . BB_USERS . " SET user_rank = 0 WHERE user_rank = $rank_id";
if (!$result = DB()->sql_query($sql))
{
bb_die($lang['NO_UPDATE_RANKS']);
bb_die($lang['NO_UPDATE_RANKS'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
$datastore->update('ranks');
@ -195,7 +195,7 @@ if ($mode != '')
}
else
{
bb_die($lang['MUST_SELECT_RANK']);
bb_die($lang['MUST_SELECT_RANK'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_RANKADMIN'], '<a href="admin_ranks.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
}
else
@ -251,4 +251,4 @@ else
}
}
print_page('admin_ranks.tpl', 'admin');
print_page('admin_ranks.tpl', 'admin');

View File

@ -20,7 +20,7 @@ else
$delimeter = '=+:';
$s_hidden_fields = '';
$smiley_paks = [];
$smiley_paks = array();
// Read a listing of uploaded smilies for use in the add or edit smliey code
$dir = @opendir(BB_ROOT . $bb_cfg['smilies_path']);
@ -277,7 +277,7 @@ else if ( $mode != '' )
// If no code was entered complain
if ($smile_code == '' || $smile_url == '')
{
bb_die($lang['FIELDS_EMPTY']);
bb_die($lang['FIELDS_EMPTY'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
// Convert < and > to proper htmlentities for parsing
@ -309,7 +309,7 @@ else if ( $mode != '' )
// If no code was entered complain
if ($smile_code == '' || $smile_url == '')
{
bb_die($lang['FIELDS_EMPTY']);
bb_die($lang['FIELDS_EMPTY'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_SMILEADMIN'], '<a href="admin_smilies.php">', '</a>') . '<br /><br />' . sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>'));
}
// Convert < and > to proper htmlentities for parsing

View File

@ -75,7 +75,12 @@ if ($submit && $mode == 'user')
{
if ($userdata['user_id'] == $user_id || $user_id == GUEST_UID || $user_id == BOT_UID)
{
bb_die($lang['AUTH_GENERAL_ERROR']);
$message = $lang['AUTH_GENERAL_ERROR'] .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode='. $mode .'">', '</a>') .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
unset($message);
}
DB()->query("UPDATE ". BB_USERS ." SET user_level = ". ADMIN ." WHERE user_id = $user_id LIMIT 1");
@ -95,7 +100,12 @@ if ($submit && $mode == 'user')
// ignore if you're trying to change yourself from an admin to user!
if ($userdata['user_id'] == $user_id)
{
bb_die($lang['AUTH_SELF_ERROR']);
$message = $lang['AUTH_SELF_ERROR'] .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_USERAUTH'], '<a href="admin_ug_auth.php?mode='. $mode .'">', '</a>') .'<br /><br />';
$message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
bb_die($message);
unset($message);
}
// Update users level, reset to USER
DB()->query("UPDATE ". BB_USERS ." SET user_level = ". USER ." WHERE user_id = $user_id LIMIT 1");

View File

@ -5,7 +5,7 @@ require('./pagestart.php');
// Generate relevant output
if (isset($_GET['pane']) && $_GET['pane'] == 'left')
{
$module = [];
$module = array();
if (!$module = CACHE('bb_cache')->get('admin_module_' . $user->id))
{
$dir = @opendir('.');

View File

@ -12,11 +12,7 @@ if (isset($_GET['?info_hash']) && !isset($_GET['info_hash']))
$_GET['info_hash'] = $_GET['?info_hash'];
}
if (!isset($_GET['info_hash']))
{
msg_die('info_hash was not provided');
}
if (strlen($_GET['info_hash']) != 20)
if (!isset($_GET['info_hash']) || strlen($_GET['info_hash']) != 20)
{
msg_die('Invalid info_hash: ' . bin2hex($_GET['info_hash']));
}
@ -50,9 +46,9 @@ $row = DB()->fetch_row("
");
$output['files'][$info_hash] = array(
'complete' => (int) $row['seeders'],
'downloaded' => (int) $row['complete_count'],
'incomplete' => (int) $row['leechers'],
'complete' => (int) $row['seeders'],
'downloaded' => (int) $row['complete_count'],
'incomplete' => (int) $row['leechers'],
);
echo bencode($output);

View File

@ -1,5 +1,6 @@
<?php
if (!(PHP_VERSION_ID >= 50303)) die('TorrentPier II requires PHP version 5.3.3+. Your PHP version '. PHP_VERSION);
if (isset($_REQUEST['GLOBALS'])) die();
ignore_user_abort(true);
@ -30,11 +31,13 @@ if (file_exists(BB_ROOT . 'library/config.local.php'))
{
require(BB_ROOT . 'library/config.local.php');
}
elseif (file_exists(BB_ROOT . 'library/config.php'))
else
{
require(BB_ROOT . 'library/config.php');
}
if (!defined('BB_CFG_LOADED')) trigger_error('Configuration file could not be loaded', E_USER_ERROR);
// Get mods config
if (file_exists(BB_ROOT . 'library/config.mods.php'))
{

View File

@ -4,7 +4,10 @@ if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $lang, $bb_cfg;
$mode = (string) $this->request['mode'];
if (!$mode = (string) $this->request['mode'])
{
$this->ajax_die('invalid mode (empty)');
}
switch ($mode)
{
@ -59,7 +62,7 @@ switch ($mode)
if (!is_file($bb_cfg['sphinx_config_path'].".log"))
{
file_put_contents($bb_cfg['sphinx_config_path'].".log", "##############################".date("H:i:s", TIMENOW)."##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
file_put_contents($bb_cfg['sphinx_config_path'].".log", "####Logger from dimka3210.####".date("H:i:s", TIMENOW)."##############################\r\n\r\n\r\n\r\n", FILE_APPEND);
}
file_put_contents($bb_cfg['sphinx_config_path'].".log", "##############################".date("H:i:s", TIMENOW)."##############################\r\n", FILE_APPEND);
@ -116,4 +119,4 @@ switch ($mode)
$this->ajax_die('Invalid mode');
}
$this->response['mode'] = $mode;
$this->response['mode'] = $mode;

View File

@ -4,7 +4,7 @@ if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $lang, $bb_cfg;
if (!$user_id = $this->request['user_id'])
if (!$user_id = intval($this->request['user_id']))
{
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
}

View File

@ -4,7 +4,10 @@ if (!defined('IN_AJAX')) die(basename(__FILE__));
global $userdata, $bb_cfg, $lang, $datastore, $log_action;
$mode = (string) $this->request['mode'];
if (!$mode = (string) $this->request['mode'])
{
$this->ajax_die('invalid mode (empty)');
}
switch ($mode)
{

View File

@ -4,7 +4,10 @@ if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg, $lang;
$mode = (string) $this->request['mode'];
if (!$mode = (string) $this->request['mode'])
{
$this->ajax_die('invalid mode (empty)');
}
$map = new sitemap();
$html = '';
@ -43,4 +46,4 @@ switch ($mode)
}
$this->response['html'] = $html;
$this->response['mode'] = $mode;
$this->response['mode'] = $mode;

View File

@ -4,7 +4,10 @@ if (!defined('IN_AJAX')) die(basename(__FILE__));
global $bb_cfg, $lang, $userdata;
$mode = (string) $this->request['mode'];
if (!$mode = (string) $this->request['mode'])
{
$this->ajax_die('invalid mode (empty)');
}
$html = '<img src="./styles/images/good.gif">';
switch($mode)
@ -72,4 +75,4 @@ switch($mode)
}
$this->response['html'] = $html;
$this->response['mode'] = $mode;
$this->response['mode'] = $mode;

View File

@ -17,7 +17,7 @@ $torrent = DB()->fetch_row("SELECT at.attach_id, at.physical_filename FROM ". BB
if (!$torrent) $this->ajax_die($lang['EMPTY_ATTACH_ID']);
$filename = get_attachments_dir() .'/'. $torrent['physical_filename'];
if (!file_exists($filename) || (false === ($file_contents = file_get_contents($filename))))
if (!@file_exists($filename) || (false === ($file_contents = @file_get_contents($filename))))
{
if (IS_AM)
{

View File

@ -15,8 +15,8 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? idn_to_utf8($_SERVER['SERVER_
$domain_ssl = false;
// Version info
$bb_cfg['tp_version'] = '2.1.5-2023.09';
$bb_cfg['tp_release_date'] = '04-10-2023';
$bb_cfg['tp_version'] = '2.1.5-2023.10';
$bb_cfg['tp_release_date'] = '04-11-2023';
$bb_cfg['tp_release_state'] = 'LTS';
$bb_cfg['tp_zf_version'] = '2.4.13';
@ -281,6 +281,8 @@ $bb_cfg['user_session_gc_ttl'] = 1800; // number of seconds that a s
$bb_cfg['session_cache_gc_ttl'] = 1200; // sec
$bb_cfg['max_last_visit_days'] = 14; // days
$bb_cfg['last_visit_update_intrv'] = 3600; // sec
$bb_cfg['last_visit_date_format'] = 'Y-m-d H:i'; // формат даты последнего визита на сайте
$bb_cfg['last_activity_date_format'] = 'Y-m-d H:i'; // формат даты последней активности на сайте
// Registration
$bb_cfg['invalid_logins'] = 5; // Количество неверных попыток ввода пароля, перед выводом проверки капчей
@ -288,6 +290,7 @@ $bb_cfg['new_user_reg_disabled'] = false; // Запретить рег
$bb_cfg['unique_ip'] = false; // Запретить регистрацию нескольких учетных записей с одного ip
$bb_cfg['new_user_reg_restricted'] = false; // Ограничить регистрацию новых пользователей по времени с 01:00 до 17:00
$bb_cfg['reg_email_activation'] = true; // Требовать активацию учетной записи по email
$bb_cfg['reg_date_format'] = 'Y-m-d H:i'; // формат даты регистрации / даты вступления пользователя
// Email
$bb_cfg['emailer_disabled'] = false; // отключить ли отправку почты с сайта
@ -382,18 +385,14 @@ define('CRON_ALLOWED', TRIGGERS_DIR .'cron_allowed');
define('CRON_RUNNING', TRIGGERS_DIR .'cron_running');
// Date format
$bb_cfg['date_format'] = 'Y-m-d'; // общий формат даты (оставлено для обратной совместимости. Если есть возможность, то используйте лучше одну из переменных ниже, исходя из целей)
$bb_cfg['current_time_date_format'] = 'd-M H:i'; // формат блока "текущее время" на сайте
$bb_cfg['reg_date_format'] = 'Y-m-d H:i'; // формат даты регистрации / даты вступления пользователя
$bb_cfg['last_visit_date_format'] = 'Y-m-d H:i'; // формат даты последнего визита на сайте
$bb_cfg['last_activity_date_format'] = 'Y-m-d H:i'; // формат даты последней активности на сайте
$bb_cfg['last_post_date_format'] = 'd-M-y H:i'; // формат даты последнего поста (на странице просмотра форума и на главной)
$bb_cfg['date_format'] = 'Y-m-d'; // общий формат даты (оставлено для обратной совместимости)
// Subforums
$bb_cfg['sf_on_first_page_only'] = true;
// Forums
$bb_cfg['allowed_topics_per_page'] = array(50, 100, 150, 200, 250, 300);
$bb_cfg['last_post_date_format'] = 'd-M-y H:i'; // формат даты последнего поста (на странице просмотра форума и на главной)
// Topics
$bb_cfg['show_quick_reply'] = true; // показывать форму быстрого ответа
@ -499,6 +498,7 @@ $bb_cfg['mem_on_start'] = (MEM_USAGE) ? memory_get_usage() : 0;
$bb_cfg['translate_dates'] = true; // in displaying time
$bb_cfg['use_word_censor'] = true; // использовать цензор слов
$bb_cfg['show_jumpbox'] = true; // показывать ли jumpbox
$bb_cfg['current_time_date_format'] = 'd-M H:i'; // формат блока "текущее время" на сайте
$bb_cfg['allow_change'] = array(
'language' => true,

View File

@ -732,8 +732,10 @@ class sql_db
}
}
@define('IN_FIRST_SLOW_QUERY', true);
if (!defined('IN_FIRST_SLOW_QUERY'))
{
define('IN_FIRST_SLOW_QUERY', true);
}
CACHE('bb_cache')->set('dont_log_slow_query', $new_priority, $ignoring_time);
}

View File

@ -30,7 +30,10 @@ function cron_get_file_lock ()
function cron_track_running ($mode)
{
@define('CRON_STARTMARK', TRIGGERS_DIR .'cron_started_at_'. date('Y-m-d_H-i-s') .'_by_pid_'. getmypid());
if (!defined('CRON_STARTMARK'))
{
define('CRON_STARTMARK', TRIGGERS_DIR . 'cron_started_at_' . date('Y-m-d_H-i-s') . '_by_pid_' . getmypid());
}
if ($mode == 'start')
{

View File

@ -1,8 +1,6 @@
<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
if (!(PHP_VERSION_ID >= 50303)) die('TorrentPier II requires PHP version 5.3.3+. Your PHP version '. PHP_VERSION);
if (!defined('BB_CFG_LOADED')) trigger_error('Configuration file could not be loaded', E_USER_ERROR);
// Define some basic configuration arrays
unset($stopwords, $synonyms_match, $synonyms_replace);