Файл: adm_panel/adm_log.php
Строк: 155
<?php
/* Мод "Панель управления"
* Версия v0.0.1
* Дата последнего редактирования 31.01.2015
* Двиг DCMS Special
* Модифицировал densnet
* Файл adm_log.php
* Описание: Действия администрации
*/
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_log_read', null, 'index.php?' . SID);
adm_check();
$set['title'] = 'Действия администрации';
require_once H . 'sys/inc/thead.php';
title();
aut();
err();
if (isset($_GET['id'])) {
$ank = get_user($_GET['id']);
} else {
$ank = false;
}
echo "<div style = 'font-size: 18px;font-weight: bold;' class = 'razd'>" . img24('panel.png') . " Действия администрации</div>";
if ($ank && user::access('adm_log_read') && ($ank['id'] == $user['id'] || $ank['level'] < $user['level'])) {
echo "<div class = 'razd'>";
echo "<a href='/info.php?id=$ank[id]'>$ank[nick]</a> ($ank[group_name])<br />n";
$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 "Вся активность: $adm_log_c_all<br />";
echo "Активность за месяц: $adm_log_c_mes";
echo "</div>";
} else {
echo "<div class = 'razd'>";
$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 "Вся активность: $adm_log_c_all<br />";
echo "Активность за месяц: $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) {
echo "<div class = 'errs'>";
echo img16('error.png') . " Нет результатов";
echo "</div>";
}
$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 = user::get_user($post['id_user']);
echo "<table class = 'razd'><tr><td class = 'icon14'>";
avatar($ank2['id'], '30');
echo "</td><td class = 'null'>";
echo "<span style = 'float:right;'>";
echo date::time($post['time']);
echo "</span>";
user($ank2['id']);
echo "<br />";
echo text::toOutput($post['opis']);
echo "</td></tr></table>";
}
if ($k_page > 1) {
str('?', $k_page, $page);
}
echo "<a href = '?id_mod=$mod[id]" . ($ank ? "&id=$ank[id]" : null) . "'><div class = 'razd'>" . img16('left.png') . " Список действий</div></a>";
echo "<a href = '?$passgen" . ($ank ? "&id=$ank[id]" : null) . "'><div class = 'razd'>" . img16('left.png') . " Список модулей</div></a>";
} 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) {
echo "<div class = 'errs'>";
echo img16('error.png') . " Нет результатов";
echo "</div>";
}
while ($act = mysql_fetch_assoc($q)) {
echo "<div class = 'razd'>";
echo img16('romb.png') . " <a href='?id_mod=$mod[id]&id_act=$act[id]" . ($ank ? "&id=$ank[id]" : null) . "'>$act[name]</a> ($act[count])<br />n";
echo "</div>";
}
echo "<a href = '?$passgen" . ($ank ? "&id=$ank[id]" : null) . "'><div class = 'razd'>" . img16('left.png') . " Список модулей</div></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) {
echo "<div class = 'errs'>";
echo img16('error.png') . " Нет результатов";
echo "</div>";
}
while ($mod = mysql_fetch_assoc($q)) {
echo "<div class = 'razd'>";
echo img16('romb.png') . " <a href = '?id_mod=$mod[id]" . ($ank ? "&id=$ank[id]" : null) . "'>$mod[name]</a> ($mod[count])<br />n";
echo "</div>";
}
}
if (user::access('adm_show_adm')) {
echo "<a href = 'administration.php'><div class = 'razd'>" . img16('left.png') . " Администрация</div></a>";
}
if (user::access('adm_panel_show')) {
echo "<div class = 'razd'><a href = '/adm_panel/' class = 'add'>" . img16('left.png') . " Панель управления</a></div>";
}
require_once H . 'sys/inc/tfoot.php';