Timeline — 2.4.1 (#1340)

This commit is contained in:
Cønstantine Kovalensky 2024-01-26 23:19:25 +04:00 committed by GitHub
commit 306994f629
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
295 changed files with 130 additions and 101 deletions

View file

@ -27,32 +27,41 @@ if (!$topic_id = (int)$this->request['topic_id']) {
switch ($mode) {
case 'add':
if (DB()->fetch_row('SELECT poster_id FROM ' . BB_BT_TORRENTS . " WHERE topic_id = $topic_id AND poster_id = " . $userdata['user_id'])) {
$this->ajax_die($lang['LIKE_OWN_POST']);
}
if (!IS_GUEST) {
if (DB()->fetch_row('SELECT poster_id FROM ' . BB_BT_TORRENTS . " WHERE topic_id = $topic_id AND poster_id = " . $userdata['user_id'])) {
$this->ajax_die($lang['LIKE_OWN_POST']);
}
if (DB()->fetch_row('SELECT topic_id FROM ' . BB_THX . " WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id'])) {
$this->ajax_die($lang['LIKE_ALREADY']);
}
if (DB()->fetch_row('SELECT topic_id FROM ' . BB_THX . " WHERE topic_id = $topic_id AND user_id = " . $userdata['user_id'])) {
$this->ajax_die($lang['LIKE_ALREADY']);
}
$columns = 'topic_id, user_id, time';
$values = "$topic_id, {$userdata['user_id']}, " . TIMENOW;
DB()->query('INSERT IGNORE INTO ' . BB_THX . " ($columns) VALUES ($values)");
break;
$columns = 'topic_id, user_id, time';
$values = "$topic_id, {$userdata['user_id']}, " . TIMENOW;
DB()->query('INSERT IGNORE INTO ' . BB_THX . " ($columns) VALUES ($values)");
break;
}
else {
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
case 'get':
$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");
if (!IS_GUEST || $bb_cfg['tor_thanks_list_guests']) {
$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 = [];
foreach ($sql as $row) {
$user_list[] = '<b>' . profile_url($row) . ' <i>(' . bb_date($row['time']) . ')</i></b>';
$user_list = [];
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'];
break;
}
$this->response['html'] = join(', ', $user_list) ?: $lang['NO_LIKES'];
break;
default:
$this->ajax_die('Invalid mode: ' . $mode);
else {
$this->ajax_die($lang['NEED_TO_LOGIN_FIRST']);
}
default:
$this->ajax_die('Invalid mode: ' . $mode);
}
$this->response['mode'] = $mode;