Revert "Minor improvements (#1395)"

This reverts commit 679d422a2a.
This commit is contained in:
Roman Kelesidis 2024-02-10 21:14:19 +07:00
commit 5e691a0279
5 changed files with 36 additions and 43 deletions

View file

@ -14,7 +14,7 @@
- Fixed issue with poll_users cleaning at every cron job startup [\#1390](https://github.com/torrentpier/torrentpier/pull/1390) ([belomaxorka](https://github.com/belomaxorka))
- Improved word censor 🤐 [\#1393](https://github.com/torrentpier/torrentpier/pull/1393) ([belomaxorka](https://github.com/belomaxorka))
- Used hashing for filenames generation [\#1385](https://github.com/torrentpier/torrentpier/pull/1385) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1382](https://github.com/torrentpier/torrentpier/pull/1382), [\#1383](https://github.com/torrentpier/torrentpier/pull/1383), [\#1391](https://github.com/torrentpier/torrentpier/pull/1391), [\#1394](https://github.com/torrentpier/torrentpier/pull/1394), [\#1395](https://github.com/torrentpier/torrentpier/pull/1395) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1382](https://github.com/torrentpier/torrentpier/pull/1382), [\#1383](https://github.com/torrentpier/torrentpier/pull/1383), [\#1391](https://github.com/torrentpier/torrentpier/pull/1391), [\#1394](https://github.com/torrentpier/torrentpier/pull/1394) ([belomaxorka](https://github.com/belomaxorka))
- Some bugfixes [\#1380](https://github.com/torrentpier/torrentpier/pull/1380) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#1384](https://github.com/torrentpier/torrentpier/pull/1384), [\#1389](https://github.com/torrentpier/torrentpier/pull/1389), [\#1392](https://github.com/torrentpier/torrentpier/pull/1392) ([Exileum](https://github.com/Exileum))

View file

@ -548,9 +548,9 @@ VALUES ('allow_autologin', '1'),
('seed_bonus_points', ''),
('seed_bonus_tor_size', '0'),
('seed_bonus_user_regdate', '0'),
('site_desc', 'Bull-powered BitTorrent tracker engine'),
('site_desc', 'A little text to describe your forum'),
('sitemap_time', ''),
('sitename', 'TorrentPier'),
('sitename', 'TorrentPier - Bull-powered BitTorrent tracker engine'),
('smilies_path', 'styles/images/smiles'),
('static_sitemap', ''),
('topics_per_page', '50'),

View file

@ -2187,28 +2187,19 @@ function profile_url(array $data, bool $target_blank = false): string
$username = $data['username'];
$user_rank = $data['user_rank'];
if (!isset($user_id)) {
throw new InvalidArgumentException('Missing argument: user_id');
}
if (!isset($username)) {
throw new InvalidArgumentException('Missing argument: username');
}
if (!isset($user_rank)) {
throw new InvalidArgumentException('Missing argument: user_rank');
}
if (!$ranks = $datastore->get('ranks')) {
$datastore->update('ranks');
$ranks = $datastore->get('ranks');
}
$title = '';
$style = 'colorUser';
$title = $style = '';
if (isset($ranks[$user_rank])) {
$title = $ranks[$user_rank]['rank_title'];
if ($bb_cfg['color_nick']) {
$style = $ranks[$user_rank]['rank_style'];
}
$style = $ranks[$user_rank]['rank_style'];
}
if (empty($username)) {
$username = $lang['GUEST'];
}
if (empty($title)) {
@ -2219,6 +2210,14 @@ function profile_url(array $data, bool $target_blank = false): string
};
}
if (empty($style)) {
$style = 'colorUser';
}
if (!$bb_cfg['color_nick']) {
$style = '';
}
$profile = '<span title="' . $title . '" class="' . $style . '">' . $username . '</span>';
if (!in_array($user_id, explode(',', EXCLUDED_USERS))) {
$target_blank = $target_blank ? ' target="_blank" ' : '';
@ -2291,24 +2290,20 @@ function is_gold($type): string
case TOR_TYPE_SILVER:
$is_gold = '<img width="16" height="15" src="' . $images['icon_tor_silver'] . '" alt="' . $lang['SILVER'] . '" title="' . $lang['SILVER'] . '" />&nbsp;';
break;
default:
break;
}
return $is_gold;
}
/**
* Update atom feed
*
* @param string $type
* @param $id
* @return void
*/
function update_atom(string $type, $id): void
function update_atom($type, $id)
{
switch ($type) {
case 'user':
\TorrentPier\Legacy\Atom::update_user_feed($id, get_username($id));
break;
case 'topic':
$topic_poster = (int)DB()->fetch_row("SELECT topic_poster FROM " . BB_TOPICS . " WHERE topic_id = $id LIMIT 1", 'topic_poster');
\TorrentPier\Legacy\Atom::update_user_feed($topic_poster, get_username($topic_poster));

View file

@ -72,7 +72,7 @@ if ($show_dl_list) {
$dl_count[$u['user_status']] = $u['username'];
} else {
$u_prof_href = ($u['user_id'] == GUEST_UID) ? '#' : PROFILE_URL . $u['user_id'] . "#torrent";
$dl_cat[$u['user_status']] .= '<nobr><a class="' . $u_link_class . '" href="' . $u_prof_href . '" title="' . $u['last_modified_dlstatus'] . '">' . profile_url(['username' => $u['username'], 'user_id' => $u['user_id'], 'user_rank' => $u['user_rank']]) . '</a></nobr>, ';
$dl_cat[$u['user_status']] .= '<nobr><a class="' . $u_link_class . '" href="' . $u_prof_href . '" title="' . $u['last_modified_dlstatus'] . '">' . profile_url(['username' => $u['username'], 'user_rank' => $u['user_rank']]) . '</a></nobr>, ';
$dl_count[$u['user_status']]++;
}
}

View file

@ -567,6 +567,9 @@ for ($i = 0; $i < $total_posts; $i++) {
$poster_joined = !$poster_guest ? $lang['JOINED'] . ': ' . bb_date($postrow[$i]['user_regdate'], 'Y-m-d H:i') : '';
$poster_longevity = !$poster_guest ? delta_time($postrow[$i]['user_regdate']) : '';
$post_id = $postrow[$i]['post_id'];
$mc_type = (int)$postrow[$i]['mc_type'];
$mc_comment = $postrow[$i]['mc_comment'];
$mc_user_id = profile_url(['username' => $postrow[$i]['mc_username'], 'user_id' => $postrow[$i]['mc_user_id'], 'user_rank' => $postrow[$i]['mc_user_rank']]);
$rg_id = $postrow[$i]['poster_rg_id'] ?: 0;
$rg_avatar = get_avatar(GROUP_AVATAR_MASK . $rg_id, $postrow[$i]['rg_avatar_id']);
@ -655,18 +658,13 @@ for ($i = 0; $i < $total_posts; $i++) {
$pg_row_class = !($i % 2) ? 'row2' : 'row1';
// Mod comment
if ($mc_type = (int)$postrow[$i]['mc_type']) {
$mc_comment = $postrow[$i]['mc_comment'];
$mc_user_id = profile_url(['username' => $postrow[$i]['mc_username'], 'user_id' => $postrow[$i]['mc_user_id'], 'user_rank' => $postrow[$i]['mc_user_rank']]);
$mc_class = match ($mc_type) {
1 => 'success',
2 => 'info',
3 => 'warning',
4 => 'danger',
default => '',
};
}
$mc_class = match ($mc_type) {
1 => 'success',
2 => 'info',
3 => 'warning',
4 => 'danger',
default => '',
};
$mc_select_type = [];
foreach ($lang['MC_COMMENT'] as $key => $value) {
$mc_select_type[$key] = $value['type'];
@ -713,10 +711,10 @@ for ($i = 0; $i < $total_posts; $i++) {
'POSTER_BIRTHDAY' => user_birthday_icon($postrow[$i]['user_birthday'], $postrow[$i]['user_id']),
'MC_COMMENT' => isset($mc_comment) ? bbcode2html($mc_comment) : '',
'MC_BBCODE' => $mc_comment ?? '',
'MC_CLASS' => $mc_class ?? '',
'MC_TITLE' => isset($mc_user_id) ? sprintf($lang['MC_COMMENT'][$mc_type]['title'], $mc_user_id) : '',
'MC_COMMENT' => $mc_type ? bbcode2html($mc_comment) : '',
'MC_BBCODE' => $mc_type ? $mc_comment : '',
'MC_CLASS' => $mc_class,
'MC_TITLE' => sprintf($lang['MC_COMMENT'][$mc_type]['title'], $mc_user_id),
'MC_SELECT_TYPE' => build_select("mc_type_$post_id", array_flip($mc_select_type), $mc_type),
'RG_AVATAR' => $rg_avatar,