Файл: panel/accesses.php
Строк: 83
<?php
/* DCMS Special
* Дата последнего редактирования 18.02.2016
* Модифицировал densnet
*/
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'adm_check', 'user') as $inc) {
require_once "../sys/inc/$inc.php";
}
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'] = 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]')");
}
}
$_SESSION['message'] = lang('Изменения сохранены');
header("Location: ?id_group=$group[id]");
exit();
}
aut();
#Навигация
echo "<div class='card-header'>";
echo "<a href='/' class='hint--right' data-hint='" . lang('На главную') . "'><i class='fa fa-home fa-lg'></i></a> <i class='fa fa-angle-right fa-fw'></i> ";
echo "<a href='/panel/'>" . lang('Панель управления') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo "<a href='/panel/accesses.php'>" . lang('Привилегии') . "</a>";
echo "</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");
while ($post = mysql_fetch_assoc($q)) {
echo "<label class='custom-control custom-checkbox'><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' class='custom-control-input'/><span class='custom-control-indicator'></span> <span class='custom-control-description'>$post[name]</span></label><br />n";
}
echo "<button class='btn btn-success btn-sm' name='accesses'><i class='fa fa-save fa-fw'></i> " . lang('Сохранить') . "</button>";
echo "</form>n";
require_once H . 'sys/inc/tfoot.php';
exit();
}
$set['title'] = lang('Группы пользователей');
require_once H . 'sys/inc/thead.php';
aut();
#Навигация
echo "<div class='list-group-item-null list-group-item-info'><small>";
echo "<a href='/' class='hint--right' data-hint='" . lang('На главную') . "'><i class='fa fa-home fa-lg'></i></a> <i class='fa fa-angle-right fa-fw'></i> ";
echo "<a href='/panel/'>" . lang('Панель управления') . "</a> <i class='fa fa-angle-right fa-fw'></i> ";
echo lang('Привилегии');
echo "</small></div>";
$accesses = mysql_query("SELECT * FROM `user_group` ORDER BY `id` ASC");
while ($res = mysql_fetch_assoc($accesses)) {
echo "<table class='list-group-item-komm'><tr><td class='icon14'>";
echo "<i class='fa fa-user-secret fa-3x'></i>";
echo "</td><td class='null'>";
echo "<div style='float:right;'>";
echo "<font color='grey' title='" . lang('Уровень') . "'><small>$res[level]</small></font>";
echo "</div>";
echo "<a href='?id_group=$res[id]'>$res[name]</a><br />";
echo "<small><font color='grey'>" . lang('Привелегий') . " " . mysql_result(mysql_query("SELECT COUNT(*) FROM `user_group_access` WHERE `id_group` = '$res[id]'"), 0) . "</font></small><br />";
echo "</td></tr></table>";
}
require_once H . 'sys/inc/tfoot.php';