edit-cache-time.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 array_walk_recursive($_POST, function (&$item) {
13  $item = trim(htmlspecialchars($item, ENT_QUOTES));
14 });
15 
16 if (!($row = Wrong\Database\Controller::find($_POST['id'], 'id', $_POST['table']))) {
17  exit(json_encode(['error' => 'Ошибка']));
18 }
19 
20 if (!$user->access()->write($row, true)) {
21  exit(json_encode(['error' => 'Недостаточно прав!']));
22 }
23 
24 $sth = $dbh->prepare("UPDATE `{$_POST['table']}` SET `cache_time` = :cache_time WHERE `id` = :id");
25 $sth->bindValue(':cache_time', $_POST['cache_time']);
26 $sth->bindValue(':id', $_POST['id']);
27 $sth->execute();
28 if ($sth->errorCode() == '00000') {
29  exit(json_encode(['result' => 'ok', 'message' => 'Успешно установлено']));
30 }
31 
32 exit(json_encode(['error' => 'Ошибка']));
$_POST['groups']
Definition: add-action.php:16
if(!($row=Wrong\Database\Controller::find($_POST['id'], 'id', $_POST['table']))) if(! $user->access() ->write($row, true)) $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