diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4a2db135c..fd6e0f645 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,7 +13,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) ([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))
- 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))
diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql
index b79dd72e0..5f98cebda 100644
--- a/install/sql/mysql.sql
+++ b/install/sql/mysql.sql
@@ -548,9 +548,9 @@ VALUES ('allow_autologin', '1'),
('seed_bonus_points', ''),
('seed_bonus_tor_size', '0'),
('seed_bonus_user_regdate', '0'),
- ('site_desc', 'A little text to describe your forum'),
+ ('site_desc', 'Bull-powered BitTorrent tracker engine'),
('sitemap_time', ''),
- ('sitename', 'TorrentPier - Bull-powered BitTorrent tracker engine'),
+ ('sitename', 'TorrentPier'),
('smilies_path', 'styles/images/smiles'),
('static_sitemap', ''),
('topics_per_page', '50'),
diff --git a/library/includes/functions.php b/library/includes/functions.php
index ff43a727c..ec26fcc4a 100644
--- a/library/includes/functions.php
+++ b/library/includes/functions.php
@@ -2187,19 +2187,28 @@ 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 = '';
+ $title = '';
+ $style = 'colorUser';
if (isset($ranks[$user_rank])) {
$title = $ranks[$user_rank]['rank_title'];
- $style = $ranks[$user_rank]['rank_style'];
- }
-
- if (empty($username)) {
- $username = $lang['GUEST'];
+ if ($bb_cfg['color_nick']) {
+ $style = $ranks[$user_rank]['rank_style'];
+ }
}
if (empty($title)) {
@@ -2210,14 +2219,6 @@ function profile_url(array $data, bool $target_blank = false): string
};
}
- if (empty($style)) {
- $style = 'colorUser';
- }
-
- if (!$bb_cfg['color_nick']) {
- $style = '';
- }
-
$profile = '' . $username . '';
if (!in_array($user_id, explode(',', EXCLUDED_USERS))) {
$target_blank = $target_blank ? ' target="_blank" ' : '';
@@ -2290,20 +2291,24 @@ function is_gold($type): string
case TOR_TYPE_SILVER:
$is_gold = '
';
break;
- default:
- break;
}
return $is_gold;
}
-function update_atom($type, $id)
+/**
+ * Update atom feed
+ *
+ * @param string $type
+ * @param $id
+ * @return void
+ */
+function update_atom(string $type, $id): void
{
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));
diff --git a/library/includes/torrent_show_dl_list.php b/library/includes/torrent_show_dl_list.php
index 6a95a72b9..9ab75d8e4 100644
--- a/library/includes/torrent_show_dl_list.php
+++ b/library/includes/torrent_show_dl_list.php
@@ -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']] .= '' . profile_url(['username' => $u['username'], 'user_rank' => $u['user_rank']]) . ', ';
+ $dl_cat[$u['user_status']] .= '' . profile_url(['username' => $u['username'], 'user_id' => $u['user_id'], 'user_rank' => $u['user_rank']]) . ', ';
$dl_count[$u['user_status']]++;
}
}
diff --git a/viewtopic.php b/viewtopic.php
index e55a145ef..a38dc4e81 100644
--- a/viewtopic.php
+++ b/viewtopic.php
@@ -567,9 +567,6 @@ 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']);
@@ -658,13 +655,18 @@ for ($i = 0; $i < $total_posts; $i++) {
$pg_row_class = !($i % 2) ? 'row2' : 'row1';
// Mod comment
- $mc_class = match ($mc_type) {
- 1 => 'success',
- 2 => 'info',
- 3 => 'warning',
- 4 => 'danger',
- default => '',
- };
+ 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_select_type = [];
foreach ($lang['MC_COMMENT'] as $key => $value) {
$mc_select_type[$key] = $value['type'];
@@ -711,10 +713,10 @@ for ($i = 0; $i < $total_posts; $i++) {
'POSTER_BIRTHDAY' => user_birthday_icon($postrow[$i]['user_birthday'], $postrow[$i]['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_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_SELECT_TYPE' => build_select("mc_type_$post_id", array_flip($mc_select_type), $mc_type),
'RG_AVATAR' => $rg_avatar,