Minor improvements (#1395)

* Minor improvements

* Updated

* Update functions.php

* Update functions.php

* Update mysql.sql

* Update viewtopic.php

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-02-09 18:43:03 +07:00 committed by GitHub
commit 679d422a2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 43 additions and 36 deletions

View file

@ -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 = '<span title="' . $title . '" class="' . $style . '">' . $username . '</span>';
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 = '<img width="16" height="15" src="' . $images['icon_tor_silver'] . '" alt="' . $lang['SILVER'] . '" title="' . $lang['SILVER'] . '" />&nbsp;';
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));