Minor improvements (#1536)

* Minor improvements

* Update viewtopic_attach.tpl

* Update viewtopic_attach.tpl

* Update viewforum.tpl

* Update viewforum.tpl

* Update viewtopic.tpl

* Update viewtopic.tpl

* Update CHANGELOG.md

* Updated

* Update defines.php
This commit is contained in:
Roman Kelesidis 2024-07-12 23:05:14 +07:00 committed by GitHub
commit 126c75cd57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 29 additions and 25 deletions

View file

@ -25,13 +25,17 @@ if (!$topic_id = (int)$this->request['topic_id']) {
$this->ajax_die($lang['INVALID_TOPIC_ID']);
}
if (!$poster_id = (int)$this->request['poster_id']) {
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
}
switch ($mode) {
case 'add':
if (IS_GUEST) {
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
if (DB()->fetch_row('SELECT poster_id FROM ' . BB_BT_TORRENTS . " WHERE topic_id = $topic_id AND poster_id = " . $userdata['user_id'])) {
if ($poster_id == $userdata['user_id']) {
$this->ajax_die($lang['LIKE_OWN_POST']);
}
@ -48,14 +52,13 @@ switch ($mode) {
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
$sql = DB()->fetch_rowset('SELECT u.username, u.user_rank, u.user_id, t.* FROM ' . BB_THX . ' t, ' . BB_USERS . " u WHERE t.topic_id = $topic_id AND t.user_id = u.user_id");
$user_list = [];
$sql = DB()->fetch_rowset('SELECT u.username, u.user_rank, u.user_id, t.* FROM ' . BB_THX . ' t, ' . BB_USERS . " u WHERE t.topic_id = $topic_id AND t.user_id = u.user_id");
foreach ($sql as $row) {
$user_list[] = '<b>' . profile_url($row) . ' <i>(' . bb_date($row['time']) . ')</i></b>';
}
$this->response['html'] = join(', ', $user_list) ?: $lang['NO_LIKES'];
$this->response['html'] = implode(', ', $user_list) ?: $lang['NO_LIKES'];
break;
default:
$this->ajax_die('Invalid mode: ' . $mode);