Файл: panel/accesses.php
Строк: 74
<?php
/* DCMS S (Special)
* Версия файла 0.0.1
* Дата последнего редактирования 15.11.2015
* Модифицировал densnet
*/
require_once '../sys/inc/start.php';
require_once H . 'sys/inc/compress.php';
require_once H . 'sys/inc/sess.php';
require_once H . 'sys/inc/settings.php';
require_once H . 'sys/inc/db_connect.php';
require_once H . 'sys/inc/ipua.php';
require_once H . 'sys/inc/fnc.php';
require_once H . 'sys/inc/adm_check.php';
require_once H . 'sys/inc/user.php';
user::access('adm_accesses', null, 'index.php?' . SID);
adm_check();
if (isset($_GET['id_group']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `user_group` WHERE `id` = '" . intval($_GET['id_group']) . "'"), 0)) {
$group = mysql_fetch_assoc(mysql_query("SELECT * FROM `user_group` WHERE `id` = '" . intval($_GET['id_group']) . "'"));
$set['title'] = text::toOutput('Группа "' . $group['name'] . '" - Привилегии');
require_once H . 'sys/inc/thead.php';
if (isset($_POST['accesses'])) {
mysql_query("DELETE FROM `user_group_access` WHERE `id_group` = '$group[id]'");
$q = mysql_query("SELECT * FROM `all_accesses`");
while ($post = mysql_fetch_assoc($q)) {
$type = $post['type'];
if (isset($_POST[$type]) && $_POST[$type] == 1) {
mysql_query("INSERT INTO `user_group_access` (`id_group`, `id_access`) VALUES ('$group[id]', '$post[type]')");
}
}
msg('Привилегии успешно изменены');
}
title();
aut();
echo "<div class = 'list-group-item'><center><b>Привилегии пользователей</b></center></div>";
echo "<form method = 'post' class = 'list-group-item' action = '?id_group=$group[id]&$passgen'>n";
$q = mysql_query("SELECT * FROM `all_accesses` ORDER BY `name` ASC");
echo "<div class='checkbox'>";
while ($post = mysql_fetch_assoc($q)) {
echo "<label>";
echo "<input type = 'checkbox'" . (mysql_result(mysql_query("SELECT COUNT(*) FROM `user_group_access` WHERE `id_group` = '$group[id]' AND `id_access` = '$post[type]' LIMIT 1"), 0) == 1 ? " checked = 'checked'" : null) . " name = '$post[type]' value = '1' />";
echo $post['name'];
echo "</label><br />n";
}
echo "</div>";
echo "<button name = 'accesses' class = 'btn btn-success'><span class='fa fa-save'></span> Сохранить</button>";
echo "</form>n";
echo "<div class = 'list-group-item'><a href = 'accesses.php'><span class='fa fa-arrow-left'></span> Группы</a></div>";
if (user::access('adm_panel_show')) {
echo "<div class = 'list-group-item'><a href = '/adm_panel/'><span class='fa fa-arrow-left'></span> Панель управления</a></div>";
}
require_once H . 'sys/inc/tfoot.php';
}
$set['title'] = 'Группы пользователей';
require_once H . 'sys/inc/thead.php';
title();
aut();
echo "<div class = 'list-group-item'><center><b>Привилегии пользователей</b></center></div>";
$accesses = mysql_query("SELECT * FROM `user_group` ORDER BY `id` ASC");
while ($res = mysql_fetch_assoc($accesses)) {
echo "<div class = 'list-group-item'>";
echo "<div style = 'float:right;'>";
echo "<font color = 'grey' title = 'Уровень'><small>$res[level]</small></font>";
echo "</div>";
echo "<a href = '?id_group=$res[id]'>$res[name]</a><br />";
echo "<small><font color = 'grey'>Привелегий " . mysql_result(mysql_query("SELECT COUNT(*) FROM `user_group_access` WHERE `id_group` = '$res[id]'"), 0) . "</font></small><br />";
echo "</div>";
}
if (user::access('adm_panel_show')) {
echo "<div class='list-group-item'><a href='/panel/'><span class='fa fa-arrow-left'></span> Панель управления</a></div>";
}
require_once H . 'sys/inc/tfoot.php';