Файл: core/adminka/log.php
Строк: 170
<?
require_once ("../../core/cuctema/core.php");
require_once ("../../core/cuctema/adm_check.php");
user_access('adm_log_read',null,'index.php?'.SID);
adm_check();
$set['title']='Действия администрации';
require_once ("../../core/cuctema/head.php");
aut();
err();
if (isset($_GET['id']))$ank=get_user($_GET['id']);else $ank=false;
if ($ank && user_access('adm_log_read') && ($ank['id']==$user['id'] || $ank['level']<$user['level']))
{
echo "<div class='d1'><a href='/id$ank[id]'>$ank[nick]</a> ($ank[group_name])</div>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 "<div class='d2'><span class='ank_n'>Вся активность:</span> <span class='ank_d'>$adm_log_c_all</span></div>n";
echo "<div class='d2'><span class='ank_n'>Активность за месяц:</span> <span class='ank_d'>$adm_log_c_mes</span></div>n";
}
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='d2'><span class='ank_n'>Вся активность:</span> <span class='ank_d'>$adm_log_c_all</span></div>n";
echo "<div class='d2'><span class='ank_n'>Активность за месяц:</span> <span class='ank_d'>$adm_log_c_mes</span></div>n";
}
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'];
echo "<table class='post'>n";
if ($k_post==0)
{
echo "<div class='hide'>Нет действий</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=get_user($post['id_user']);
echo " <div class='d1'>n";
echo "<a href='/id$ank2[id]'>$ank2[nick]</a>".online($ank2['id'])." (".vremja($post['time']).")n";
echo " </div>n";
if ($set['set_show_icon']==1)echo " <td class='p_m' colspan='2'>n"; else echo " <div class='d2'>n";
echo output_text($post['opis'])."n";
echo " </div>n";
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
echo "<div class='d2'>";
echo "«<a href='?id_mod=$mod[id]".($ank?"&id=$ank[id]":null)."'>Список действий</a>n";
echo "«<a href='?$passgen".($ank?"&id=$ank[id]":null)."'>Список модулей</a></div>n";
}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`");
echo "<div class='d1'>n";
if (mysql_num_rows($q)==0)echo "Нет действий в модуле '$mod[name]'";
while($act=mysql_fetch_assoc($q))
echo "<a href='?id_mod=$mod[id]&id_act=$act[id]".($ank?"&id=$ank[id]":null)."'>$act[name]</a> ($act[count])<br />n";
echo "</div>n";
echo "<div class='d2'>«<a href='?$passgen".($ank?"&id=$ank[id]":null)."'>Список модулей</a></div>n";
}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`");
echo "<div class='d2'>n";
if (mysql_num_rows($q)==0)echo "Нет действий в модулях";
while($mod=mysql_fetch_assoc($q))
echo "<a href='?id_mod=$mod[id]".($ank?"&id=$ank[id]":null)."'>$mod[name]</a> ($mod[count])<br />n";
echo "</div>n";
}
if (user_access('adm_panel_show')){
echo "<div class='d1'>n";
if (user_access('adm_show_adm'))echo "»<a href='/adminka/users/?act=admin'>Администрация</a><br />n";
echo "«<a href='/adminka/'>В админку</a><br />n";
echo "</div>n";
}
require_once ("../../core/cuctema/foot.php");
?>