mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
* account management rework: Base * create proper account settings page - modelviewer preferences - show ids in lists - announcement purge - public description * fix broken FKs between aowow_user_ratings and aowow_account
49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Aowow;
|
|
|
|
if (!defined('AOWOW_REVISION'))
|
|
die('illegal access');
|
|
|
|
|
|
/*
|
|
* accessed via account settings form submit
|
|
* write status to session and redirect to account settings
|
|
*/
|
|
|
|
class AccountUpdatecommunitysettingsResponse extends TextResponse
|
|
{
|
|
protected ?string $redirectTo = '?account#community';
|
|
protected bool $requiresLogin = true;
|
|
|
|
protected array $expectedPOST = array(
|
|
'desc' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkTextBlob']]
|
|
);
|
|
|
|
private bool $success = false;
|
|
|
|
protected function generate() : void
|
|
{
|
|
if (User::isBanned())
|
|
return;
|
|
|
|
if ($message = $this->updateSettings())
|
|
$_SESSION['msg'] = ['community', $this->success, $message];
|
|
}
|
|
|
|
protected function updateSettings()
|
|
{
|
|
if (is_null($this->_post['desc'])) // assertPOST tests for empty string which is valid here
|
|
return Lang::main('genericError');
|
|
|
|
// description - 0 modified rows is still success
|
|
if (!is_int(DB::Aowow()->query('UPDATE ?_account SET `description` = ? WHERE `id` = ?d', $this->_post['desc'], User::$id)))
|
|
return Lang::main('genericError');
|
|
|
|
$this->success = true;
|
|
return Lang::account('updateMessage', 'community');
|
|
}
|
|
}
|
|
|
|
?>
|