33 $sth =
$dbh->prepare(
"INSERT INTO `groups` (`name`, `owner_group`, `weight`, `path`) VALUES (:name, :owner_group, :weight, :path)");
34 $sth->bindValue(
':name',
$arr[
'name']);
35 $sth->bindValue(
':owner_group',
$arr[
'owner_group']);
36 $sth->bindValue(
':weight',
$arr[
'weight']);
37 $sth->bindValue(
':path',
$arr[
'path']);
40 if ($id =
$dbh->lastInsertId()) {
41 if (!empty(
$arr[
'add-groups'])) {
44 foreach ([
'actions',
'modals',
'selects',
'pages',
'users',
'templates'] as
$table) {
45 foreach (
$dbh->query(
"SELECT * FROM `$table`") as $row) {
46 $array = json_decode($row->groups);
49 $array = array_values(array_unique(array_map(
'intval', $array)));
50 $dbh->query(
"UPDATE `$table` SET `groups` = '" . json_encode($array) .
"' WHERE `id` = $row->id");
55 if (!empty(
$arr[
'add-groups-owner'])) {
58 foreach ([
'actions',
'modals',
'selects',
'pages',
'users',
'templates'] as
$table) {
59 foreach (
$dbh->query(
"SELECT * FROM `$table`") as $row) {
60 $array = json_decode($row->groups);
61 if (in_array(
$arr[
'owner_group'], $array) ||
$arr[
'owner_group'] == $row->owner_group) {
63 $array = array_values(array_unique(array_map(
'intval', $array)));
64 $dbh->query(
"UPDATE `$table` SET `groups` = '" . json_encode($array) .
"' WHERE `id` = $row->id");
if(!($row=Wrong\Models\Crontabs::find($_POST['id']))) if(! $user->access() ->write($row)) $sth
if(!in_array($_POST['table'], Wrong\Database\Controller::$tables)) $table
Connect создает подключение к базе данных
static getInstance($ignore_error=false)
Controller контроллер для запросов к БД
Groups контроллер управления моделями групп пользователей, расширяет Controller.
Group класс, содержащий статические методы, используемые для управления группами пользователей.
static is_not_system($arr)
ModelsInterface интерфейс управления моделями