mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* convert comment/reply ajax (add, edit, delete, vote, report and management) and redirects (comment/reply > db-page) * update roles when updating own comment/reply
35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Aowow;
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
|
|
// toggle flag
|
|
class CommentStickyResponse extends TextResponse
|
|
{
|
|
protected int $requiredUserGroup = U_GROUP_MODERATOR;
|
|
|
|
protected array $expectedPOST = array(
|
|
'id' => ['filter' => FILTER_VALIDATE_INT ],
|
|
'sticky' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 1]]
|
|
);
|
|
|
|
protected function generate() : void
|
|
{
|
|
if (!$this->assertPOST('id', 'sticky'))
|
|
{
|
|
trigger_error('CommentStickyResponse - malformed request received', E_USER_ERROR);
|
|
return;
|
|
}
|
|
|
|
if ($this->_post['sticky'])
|
|
DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` | ?d WHERE `id` = ?d', CC_FLAG_STICKY, $this->_post['id']);
|
|
else
|
|
DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` & ~?d WHERE `id` = ?d', CC_FLAG_STICKY, $this->_post['id']);
|
|
}
|
|
}
|
|
|
|
?>
|