mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-10-05 04:13:09 -04:00
19 lines
461 B
PHP
19 lines
461 B
PHP
<?php
|
|
|
|
if (!$Viewer->permitted('site_forum_autosub')) {
|
|
json_error('failure', 'forbidden');
|
|
}
|
|
authorize();
|
|
|
|
$forum = (new Gazelle\Manager\Forum)->findById((int)($_POST['id'] ?? 0));
|
|
if (is_null($forum)) {
|
|
json_error('failure', 'not found');
|
|
}
|
|
|
|
$active = (bool)$_POST['active'];
|
|
if ($forum->toggleAutoSubscribe($Viewer->id(), $active)) {
|
|
json_print('success', ['autosub' => $active]);
|
|
} else {
|
|
json_error('failure', ['status' => 'unchanged']);
|
|
}
|