Minor fixes (#654)

* Minor fixes

* Removed WTF statement

* Fixed broken birthday applying in profile.php

* Removed double-quotes
This commit is contained in:
Roman Kelesidis 2023-03-27 14:10:42 +07:00 committed by GitHub
commit 5d9955cd78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 14 deletions

View file

@ -30,7 +30,7 @@
"forum": "https://torrentpier.com" "forum": "https://torrentpier.com"
}, },
"require": { "require": {
"php": "^7.4", "php": "^7.4|^8.0",
"bugsnag/bugsnag": "v3.29.0", "bugsnag/bugsnag": "v3.29.0",
"egulias/email-validator": "^3.2", "egulias/email-validator": "^3.2",
"filp/whoops": "^2.15", "filp/whoops": "^2.15",

6
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "6241213ade775fe6873c1265d649c934", "content-hash": "a0a31557a48a379fcaf7e44571398d48",
"packages": [ "packages": [
{ {
"name": "bugsnag/bugsnag", "name": "bugsnag/bugsnag",
@ -2380,8 +2380,8 @@
"prefer-stable": true, "prefer-stable": true,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": "^7.4" "php": "^7.4|^8.0"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.3.0" "plugin-api-version": "2.2.0"
} }

View file

@ -49,7 +49,6 @@ if (!$torrent) {
if ($torrent['poster_id'] == $userdata['user_id'] && !IS_AM) { if ($torrent['poster_id'] == $userdata['user_id'] && !IS_AM) {
if ($type == 'del_torrent' || $type == 'reg' || $type == 'unreg') { if ($type == 'del_torrent' || $type == 'reg' || $type == 'unreg') {
true;
} else { } else {
$this->ajax_die($lang['ONLY_FOR_MOD']); $this->ajax_die($lang['ONLY_FOR_MOD']);
} }

View file

@ -68,9 +68,9 @@ switch ($field) {
if (!empty($birthday_date['year'])) { if (!empty($birthday_date['year'])) {
if (strtotime($value) >= TIMENOW) { if (strtotime($value) >= TIMENOW) {
$this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']); $this->ajax_die($lang['WRONG_BIRTHDAY_FORMAT']);
} elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] > $bb_cfg['birthday_max_age']) { } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > $bb_cfg['birthday_max_age']) {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age'])); $this->ajax_die(sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']));
} elseif (bb_date(TIMENOW, 'Y', 'false') - $birthday_date['year'] < $bb_cfg['birthday_min_age']) { } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < $bb_cfg['birthday_min_age']) {
$this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age'])); $this->ajax_die(sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']));
} }
} }

View file

@ -23,11 +23,13 @@ switch ($mode) {
'stats', 'stats',
)); ));
$users = [];
if ($stats['birthday_week_list']) { if ($stats['birthday_week_list']) {
foreach ($stats['birthday_week_list'] as $week) { foreach ($stats['birthday_week_list'] as $week) {
$html[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday']) . ')</span>'; $users[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday']) . ')</span>';
} }
$html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $html)); $html = sprintf($lang['BIRTHDAY_WEEK'], $bb_cfg['birthday_check_day'], implode(', ', $users));
} else { } else {
$html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']); $html = sprintf($lang['NOBIRTHDAY_WEEK'], $bb_cfg['birthday_check_day']);
} }
@ -39,11 +41,13 @@ switch ($mode) {
'stats', 'stats',
)); ));
$users = [];
if ($stats['birthday_today_list']) { if ($stats['birthday_today_list']) {
foreach ($stats['birthday_today_list'] as $today) { foreach ($stats['birthday_today_list'] as $today) {
$html[] = profile_url($today) . ' <span class="small">(' . birthday_age($today['user_birthday']) . ')</span>'; $users[] = profile_url($today) . ' <span class="small">(' . birthday_age($today['user_birthday']) . ')</span>';
} }
$html = $lang['BIRTHDAY_TODAY'] . implode(', ', $html); $html = $lang['BIRTHDAY_TODAY'] . implode(', ', $users);
} else { } else {
$html = $lang['NOBIRTHDAY_TODAY']; $html = $lang['NOBIRTHDAY_TODAY'];
} }

View file

@ -32,7 +32,7 @@ switch ($mode) {
$map->createSitemap(); $map->createSitemap();
} }
$map_link = make_url('sitemap/sitemap.xml'); $map_link = make_url(hide_bb_path(SITEMAP_DIR . '/sitemap.xml'));
foreach ($bb_cfg['sitemap_sending'] as $source_name => $source_link) { foreach ($bb_cfg['sitemap_sending'] as $source_name => $source_link) {
if ($map->sendSitemap($source_link, $map_link)) { if ($map->sendSitemap($source_link, $map_link)) {

View file

@ -352,7 +352,7 @@ $bb_cfg['show_sidebar2_on_every_page'] = false;
// Cookie // Cookie
$bb_cfg['cookie_domain'] = in_array($domain_name, [getenv('SERVER_ADDR'), 'localhost'], true) ? '' : ".$domain_name"; $bb_cfg['cookie_domain'] = in_array($domain_name, [getenv('SERVER_ADDR'), 'localhost'], true) ? '' : ".$domain_name";
$bb_cfg['cookie_secure'] = $domain_ssl ? true : (!empty($_SERVER['HTTPS']) ? true : false); $bb_cfg['cookie_secure'] = $domain_ssl ? true : \TorrentPier\Helpers\IsHelper::isHTTPS();
$bb_cfg['cookie_prefix'] = 'bb_'; // 'bb_' $bb_cfg['cookie_prefix'] = 'bb_'; // 'bb_'
// Sessions // Sessions

View file

@ -15,7 +15,7 @@ $map = new TorrentPier\Sitemap();
$map->createSitemap(); $map->createSitemap();
if (file_exists(SITEMAP_DIR . '/sitemap.xml')) { if (file_exists(SITEMAP_DIR . '/sitemap.xml')) {
$map_link = make_url('sitemap/sitemap.xml'); $map_link = make_url(hide_bb_path(SITEMAP_DIR . '/sitemap.xml'));
foreach ($bb_cfg['sitemap_sending'] as $source_name => $source_link) { foreach ($bb_cfg['sitemap_sending'] as $source_name => $source_link) {
$map->sendSitemap($source_link, $map_link); $map->sendSitemap($source_link, $map_link);