edit-models-limit.php
См. документацию.
1 <?php
2 
3 /**
4  * @file
5  * @brief обработчик установки лимита моделей для группы
6  */
7 
8 isset($user) or require $_SERVER['DOCUMENT_ROOT'] . '/page/404.php';
9 
10 header("Content-type: application/json");
11 
12 if (!($row = Wrong\Models\Groups::find($_POST['id']))) {
13  exit(json_encode(['error' => 'Ошибка']));
14 }
15 
16 if ($user->access()->is_system($row)) {
17  exit(json_encode(['error' => 'Изменить лимит системного функционала нельзя!']));
18 }
19 
20 if (!$user->access()->write($row)) {
21  exit(json_encode(['error' => 'Недостаточно прав!']));
22 }
23 
24 
25 $sth = $dbh->prepare("UPDATE `groups` SET `models_limit` = :models_limit WHERE `id` = :id");
26 $sth->bindValue(':models_limit', $_POST['models_limit']);
27 $sth->bindValue(':id', $row->id);
28 $sth->execute();
29 if ($sth->errorCode() == '00000') {
30  exit(json_encode(['result' => 'ok', 'message' => 'Лимит успешно установлен']));
31 }
32 
33 exit(json_encode(['error' => 'Ошибка']));
$_POST['groups']
Definition: add-action.php:16
if(!($row=Wrong\Models\Groups::find($_POST['id']))) if($user->access() ->is_system($row)) if(! $user->access() ->write($row)) $sth
$user
Definition: from-user.php:38
setcookie('FROM_UID', $uid, [ 'expires'=> time()+31536000, 'path'=> '/', 'domain'=> $_SERVER['HTTP_HOST'], 'secure'=> Wrong\Start\Env::$e->IS_SECURE, 'httponly'=> false, 'samesite'=> Wrong\Start\Env::$e->IS_SECURE ? 'None' :'Lax']) or setcookie('FROM_UID' $_SERVER['HTTP_HOST']
Definition: from-user.php:36
if(($dbh=Connect::getInstance(true) ->dbh) && $dbh->query("SHOW TABLES") ->fetchAll() && $dbh->query("SELECT COUNT(*) FROM `users`") ->fetchColumn()) if(!empty($_POST)) exit
Definition: install.php:198
$dbh
Definition: session.php:19