mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* account management rework: Avatar functionality * show avatar at comments (beckported, because no forums)
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Aowow;
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
|
|
/*
|
|
* accessed via form submit on user settings page
|
|
*/
|
|
|
|
class AccountPremiumborderResponse extends TextResponse
|
|
{
|
|
protected ?string $redirectTo = '?account#premium';
|
|
protected bool $requiresLogin = true;
|
|
protected int $requiredUserGroup = U_GROUP_PREMIUM_PERMISSIONS;
|
|
|
|
protected array $expectedPOST = array(
|
|
'avatarborder' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0, 'max_range' => 4]],
|
|
);
|
|
|
|
protected function generate() : void
|
|
{
|
|
if (User::isBanned())
|
|
return;
|
|
|
|
if (!$this->assertPOST('avatarborder'))
|
|
return;
|
|
|
|
$x = DB::Aowow()->query('UPDATE ?_account SET `avatarborder` = ?d WHERE `id` = ?d', $this->_post['avatarborder'], User::$id);
|
|
if (!is_int($x))
|
|
$_SESSION['msg'] = ['premiumborder', false, Lang::main('genericError')];
|
|
else if (!$x)
|
|
$_SESSION['msg'] = ['premiumborder', true, Lang::account('updateMessage', 'avNoChange')];
|
|
else
|
|
$_SESSION['msg'] = ['premiumborder', true, Lang::account('updateMessage', 'avSuccess')];
|
|
}
|
|
}
|
|
|
|
?>
|