mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Hide vote button in topic if guest (#1507)
* Hide vote button in topic if guest * Update CHANGELOG.md
This commit is contained in:
parent
0ad1ec45bc
commit
75c9f34a73
3 changed files with 28 additions and 26 deletions
|
@ -9,6 +9,7 @@
|
|||
- Some security improvements 🔑 [\#1503](https://github.com/torrentpier/torrentpier/pull/1503) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Some security enhancements (Part 2) [\#1505](https://github.com/torrentpier/torrentpier/pull/1505) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Some improvements for integrity checker [\#1501](https://github.com/torrentpier/torrentpier/pull/1501) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Hide vote button in topic if guest [\#1507](https://github.com/torrentpier/torrentpier/pull/1507) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Minor improvements [\#1502](https://github.com/torrentpier/torrentpier/pull/1502), [\#1506](https://github.com/torrentpier/torrentpier/pull/1506) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- New Crowdin updates [\#1504](https://github.com/torrentpier/torrentpier/pull/1504) ([Exileum](https://github.com/Exileum))
|
||||
|
||||
|
|
|
@ -27,37 +27,36 @@ if (!$topic_id = (int)$this->request['topic_id']) {
|
|||
|
||||
switch ($mode) {
|
||||
case 'add':
|
||||
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']);
|
||||
}
|
||||
|
||||
$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 {
|
||||
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'])) {
|
||||
$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']);
|
||||
}
|
||||
|
||||
$columns = 'topic_id, user_id, time';
|
||||
$values = "$topic_id, {$userdata['user_id']}, " . TIMENOW;
|
||||
DB()->query('INSERT IGNORE INTO ' . BB_THX . " ($columns) VALUES ($values)");
|
||||
break;
|
||||
case 'get':
|
||||
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>';
|
||||
}
|
||||
|
||||
$this->response['html'] = join(', ', $user_list) ?: $lang['NO_LIKES'];
|
||||
break;
|
||||
} else {
|
||||
if (IS_GUEST && !$bb_cfg['tor_thanks_list_guests']) {
|
||||
$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 = [];
|
||||
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;
|
||||
default:
|
||||
$this->ajax_die('Invalid mode: ' . $mode);
|
||||
}
|
||||
|
|
|
@ -459,14 +459,16 @@ $('#tor-filelist-btn').click(function () {
|
|||
}
|
||||
</script>
|
||||
<div id="thx-block">
|
||||
<!-- IF not postrow.attach.tor_reged.TOR_AUTHOR -->
|
||||
<!-- IF not postrow.attach.tor_reged.TOR_AUTHOR and not IS_GUEST -->
|
||||
<div id="thx-btn-div">
|
||||
<input id="thx-btn" type="button" class="bold" style="width: 200px;" value="{L_THANK_TOPIC}">
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF not IS_GUEST or $bb_cfg['tor_thanks_list_guests'] -->
|
||||
<div class="sp-wrap">
|
||||
<div id="thx-list" class="sp-body" data-no-sp-open="true" title="{L_LAST_LIKES}"></div>
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
</div>
|
||||
<!-- ENDIF -->
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue