Файл: panel/adm_log.php
Строк: 158
<?php
/* DCMS Special
* Дата последнего редактирования 21.12.2015
* Модифицировал densnet
*/
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'adm_check', 'user') as $inc) {
require_once "../sys/inc/$inc.php";
}
access('adm_log_read', null, 'index.php?' . SID);
adm_check();
$set['title'] = lang('Действия администрации');
require_once H . 'sys/inc/thead.php';
aut();
err();
if (isset($_GET['id'])) {
$ank = get_user($_GET['id']);
} else {
$ank = false;
}
#Навигация
echo "<div class='list-group-item-null list-group-item-grey'><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><br />";
if ($ank && access('adm_log_read') && ($ank['id'] == $user['id'] || $ank['level'] < $user['level'])) {
$adm_log_c_all = mysql_result(mysql_query("SELECT COUNT(*) FROM `admin_log` WHERE `id_user` = '$ank[id]'"), 0);
$mes = mktime(0, 0, 0, date('m') - 1);
$adm_log_c_mes = mysql_result(mysql_query("SELECT COUNT(*) FROM `admin_log` WHERE `id_user` = '$ank[id]' AND `time` > '$mes'"), 0);
echo "<div class='list-group-item-null'>";
echo "<a href='/info.php?id=$ank[id]'>$ank[nick]</a> ($ank[group_name])<br />n";
echo lang('Вся активность') . ": $adm_log_c_all<br />";
echo lang('Активность за месяц') . ": $adm_log_c_mes";
echo "</div>";
} else {
$adm_log_c_all = mysql_result(mysql_query("SELECT COUNT(*) FROM `admin_log`"), 0);
$mes = mktime(0, 0, 0, date('m') - 1); // время месяц назад
$adm_log_c_mes = mysql_result(mysql_query("SELECT COUNT(*) FROM `admin_log` WHERE `time` > '$mes'"), 0);
echo "<div class='list-group-item-null'>";
echo lang('Вся активность') . ": $adm_log_c_all<br />";
echo lang('Активность за месяц') . ": $adm_log_c_mes";
echo "</div>";
}
if (isset($_GET['id_mod']) && isset($_GET['id_act']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `admin_log` WHERE `mod` = '" . intval($_GET['id_mod']) . "' AND `act` = '" . intval($_GET['id_act']) . "'" . ($ank ? " AND `id_user` = '$ank[id]'" : null)), 0) != 0) {
$mod = mysql_fetch_assoc(mysql_query("SELECT * FROM `admin_log_mod` WHERE `id` = '" . intval($_GET['id_mod']) . "' LIMIT 1"));
$act = mysql_fetch_assoc(mysql_query("SELECT * FROM `admin_log_act` WHERE `id` = '" . intval($_GET['id_act']) . "' LIMIT 1"));
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `admin_log` WHERE `mod` = '$mod[id]' AND `act` = '$act[id]'" . ($ank ? " AND `admin_log`.`id_user` = '$ank[id]'" : null)), 0);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
if ($k_post == 0) {
$doc->NoResult();
}
$q = mysql_query("SELECT * FROM `admin_log` WHERE `mod` = '$mod[id]' AND `act` = '$act[id]'" . ($ank ? " AND `admin_log`.`id_user` = '$ank[id]'" : null) . " ORDER BY id DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q)) {
$ank2 = get_user($post['id_user']);
echo "<table class='list-group-item-null list-group-item-grey'><tr><td class='icon14'>";
avatar($ank2['id'], '40', 'border-radius: 2px;');
echo "</td><td class='null'>";
echo "<span style='float:right;'><small><font color='grey'>";
echo "<span title='" . date::time($post['time']) . "'>" . date::timek($post['time']) . "</span>";
echo "</font></small></span>";
user($ank2['id']);
echo "<br /><small><font color = 'grey'>";
echo toOutput($post['opis']);
echo "</font></small></td></tr></table><hr>";
}
if ($k_page > 1) {
str('?', $k_page, $page);
}
echo "<div class='list-group-item-null'>";
echo "<a href='?id_mod=$mod[id]" . ($ank ? "&id=$ank[id]" : null) . "'><i class='fa fa-arrow-left fa-fw'></i> " . lang('Список действий') . "</a><br />";
echo "<a href='?$passgen" . ($ank ? "&id=$ank[id]" : null) . "'><i class='fa fa-arrow-left fa-fw'></i> " . lang('Список модулей') . "</a>";
echo "</div>";
} elseif (isset($_GET['id_mod']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `admin_log` WHERE `mod` = '" . intval($_GET['id_mod']) . "'" . ($ank ? " AND `id_user` = '$ank[id]'" : null)), 0) != 0) {
#действия в модуле
$mod = mysql_fetch_assoc(mysql_query("SELECT * FROM `admin_log_mod` WHERE `id` = '" . intval($_GET['id_mod']) . "' LIMIT 1"));
$q = mysql_query("SELECT `admin_log_act`.`name`, `admin_log_act`.`id`, COUNT(`admin_log`.`id`) AS `count` FROM `admin_log` LEFT JOIN `admin_log_act` ON `admin_log`.`act` = `admin_log_act`.`id` WHERE `admin_log`.`mod` = '$mod[id]'" . ($ank ? " AND `admin_log`.`id_user` = '$ank[id]'" : null) . " GROUP BY `admin_log`.`act`");
if (mysql_num_rows($q) == 0) {
$doc->NoResult();
}
while ($act = mysql_fetch_assoc($q)) {
echo "<a href='?id_mod=$mod[id]&id_act=$act[id]" . ($ank ? "&id=$ank[id]" : null) . "'><i class='fa fa-chevron-right fa-fw'></i> $act[name]</a> <span class='count' style='float: right'>$act[count]</span>n";
echo "<hr>";
}
echo "<a href = '?$passgen" . ($ank ? "&id=$ank[id]" : null) . "'><i class='fa fa-arrow-left fa-fw'></i> " . lang('Список модулей') . "</a>";
} else {
#действия по модулям
$q = mysql_query("SELECT `admin_log_mod`.`name`, `admin_log_mod`.`id`, COUNT(`admin_log`.`id`) AS `count` FROM `admin_log` LEFT JOIN `admin_log_mod` ON `admin_log`.`mod` = `admin_log_mod`.`id`" . ($ank ? " WHERE `admin_log`.`id_user` = '$ank[id]'" : null) . " GROUP BY `admin_log`.`mod`");
if (mysql_num_rows($q) == 0) {
$doc->NoResult();
}
while ($mod = mysql_fetch_assoc($q)) {
echo "<a href='?id_mod=$mod[id]" . ($ank ? "&id=$ank[id]" : null) . "'><i class='fa fa-chevron-right fa-fw'></i> $mod[name]</a> <span class='count' style='float: right'>$mod[count]</span>n";
echo "<hr>";
}
}
require_once H . 'sys/inc/tfoot.php';