Файл: 3020.ru/file_3020/plugins/admin.journal.php
Строк: 194
<?
if ($level < 3) {
header('Location: /index.php');
exit;
}
if (isset($_GET['type']) && preg_match("#^([A-z])+$#ui", $_GET['type'])) {
$type = esc(text($_GET['type']));
} else {
$type = '0';
}
if (isset($_GET['truncate']) AND $_GET['truncate'] == 'yes') {
$sql -> delete("DELETE FROM `admin_journal`");
$_SESSION['message'] = 'Журнал успешно очищен';
header('Location: ?func=' . $func);
exit;
}
$tmp = $system;
if (isset($_GET['set'])) {
$set = esc(text($_GET['set']));
if (isset($tmp[$set])) {
$tmp[$set] = (int) $_GET['elid'];
} else {
$err[] = 'Параметр не существует';
}
if (!isset($err) && save_dat($tmp, 'settings.system')) {
$messages[] = 'Настройки успешно приняты';
}
}
$count = $sql -> fetch("
SELECT COUNT(*) AS other,
(SELECT COUNT(*) FROM `admin_journal` WHERE `type` = 'votes') AS 'votes',
(SELECT COUNT(*) FROM `admin_journal` WHERE `type` = 'goods') AS 'goods',
(SELECT COUNT(*) FROM `admin_journal` WHERE `type` = 'wmid') AS 'wmid',
(SELECT COUNT(*) FROM `admin_journal` WHERE `type` = 'complaint') AS 'complaint',
(SELECT COUNT(*) FROM `admin_journal` WHERE `type` = 'arbitrage') AS 'arbitrage',
(SELECT COUNT(*) FROM `admin_journal` WHERE `type` = 'votes' AND `read` = '0') AS 'votes_new',
(SELECT COUNT(*) FROM `admin_journal` WHERE `type` = 'complaint' AND `read` = '0') AS 'complaint_new',
(SELECT COUNT(*) FROM `admin_journal` WHERE `type` = 'arbitrage' AND `read` = '0') AS 'arbitrage_new',
(SELECT COUNT(*) FROM `admin_journal` WHERE `type` = 'goods' AND `read` = '0') AS 'goods_new',
(SELECT COUNT(*) FROM `admin_journal` WHERE `type` = 'wmid' AND `read` = '0') AS 'wmid_new',
(SELECT COUNT(*) FROM `admin_journal` WHERE `type` = 'other' AND `read` = '0') AS 'other_new'
FROM `admin_journal` WHERE `type` = 'other'");
$system['title'] = 'Админ - Журнал';
require SYS . 'header.php';
if (isset($_GET['truncate'])) {
?>
<div class="div_2">
Вы уверены?
<a class="" href="/?func=admin.journal&truncate=yes">Да</a> |
<a class="" href="/?func=admin.journal">Нет</a>
</div>
<?
}
if ($type != '0') {
$k_post = $sql -> selectCount("SELECT COUNT(*) FROM `admin_journal` WHERE `type` = '$type'");
if ($k_post == 0) {
?>
<div class="alert" style="margin: 2px;">Журнал пуст</div>
<?
} else {
$k_page = k_page($k_post, $system['page_str']);
$page = page($k_page);
$start = $system['page_str'] * $page - $system['page_str'];
$array = $sql -> select("SELECT * FROM `admin_journal` WHERE `type` = '$type' ORDER BY `time` DESC LIMIT $start, $system[page_str]");
$sql -> update("UPDATE `admin_journal` SET `read` = '1' WHERE `read` = '0' AND `type` = '$type'");
foreach ($array AS $post) {
$num++;
?>
<div class="<?= ($num % 2 ? "nav1" : "nav2")?>">
<?= login($post['id_user'], 1, 1)?> <?= ($post['read'] == 0 ? '<span class="off">' . vremja($post['time']) . '</span>' : vremja($post['time']))?> ::
<?= text_out($post['msg'])?><br />
</div>
<?
}
if ($k_page > 1) {
str('?func=' . $func . '&type=' . $type . '&', $k_page, $page);
}
}
?>
<div class="foot">
« <a href="?func=admin.journal">К разделам</a>
</div>
<?
} else {
?>
<div class="nav2">
» Уведомлять о выгрузке нового товара
<a href="?func=<?= $func?>&set=j_newgoods&elid=1">(<?= ($tmp['j_newgoods'] == 1 ? '√ ' : '')?>вкл)</a> <a href="?func=<?= $func?>&set=j_newgoods&elid=0">(<?= ($tmp['j_newgoods'] == 0 ? '√ ' : '')?>выкл)</a><br />
» Уведомлять о замене архива товара
<a href="?func=<?= $func?>&set=j_filegoods&elid=1">(<?= ($tmp['j_filegoods'] == 1 ? '√ ' : '')?>вкл)</a> <a href="?func=<?= $func?>&set=j_filegoods&elid=0">(<?= ($tmp['j_filegoods'] == 0 ? '√ ' : '')?>выкл)</a><br />
» Уведомлять о покупке кем то товара
<a href="?func=<?= $func?>&set=j_paysgoods&elid=1">(<?= ($tmp['j_paysgoods'] == 1 ? '√ ' : '')?>вкл)</a> <a href="?func=<?= $func?>&set=j_paysgoods&elid=0">(<?= ($tmp['j_paysgoods'] == 0 ? '√ ' : '')?>выкл)</a><br />
» Уведомлять о новом сообщении забаненого
<a href="?func=<?= $func?>&set=j_banmess&elid=1">(<?= ($tmp['j_banmess'] == 1 ? '√ ' : '')?>вкл)</a> <a href="?func=<?= $func?>&set=j_banmess&elid=0">(<?= ($tmp['j_banmess'] == 0 ? '√ ' : '')?>выкл)</a><br />
» Уведомлять о подтверждении WMID юзером
<a href="?func=<?= $func?>&set=j_setwmid&elid=1">(<?= ($tmp['j_setwmid'] == 1 ? '√ ' : '')?>вкл)</a> <a href="?func=<?= $func?>&set=j_setwmid&elid=0">(<?= ($tmp['j_setwmid'] == 0 ? '√ ' : '')?>выкл)</a><br />
</div>
<?
if ($count['goods'] > 0) { ?>
<a class="div_1" href="?func=admin.journal&type=goods"><i class="icon-shopping-cart"></i> Товары (<?= $count['goods']?>) <?= ($count['goods_new'] > 0 ? '<span class="off">+' . $count['goods_new'] . '</span>' : '')?></a>
<? $truej = true; }
if ($count['votes'] > 0) { ?>
<a class="div_1" href="?func=admin.journal&type=votes"><i class="icon-comment"></i> Отзывы (<?= $count['votes']?>) <?= ($count['votes_new'] > 0 ? '<span class="off">+' . $count['votes_new'] . '</span>' : '')?></a>
<? $truej = true; }
if ($count['wmid'] > 0) { ?>
<a class="div_1" href="?func=admin.journal&type=wmid"><i class="icon-check"></i> Подтверждение WMID (<?= $count['wmid']?>) <?= ($count['wmid_new'] > 0 ? '<span class="off">+' . $count['wmid_new'] . '</span>' : '')?></a>
<? $truej = true; }
if ($count['arbitrage'] > 0) { ?>
<a class="div_1" href="?func=admin.journal&type=arbitrage"><i class="icon-filter"></i> Арбитраж (<?= $count['arbitrage']?>) <?= ($count['arbitrage_new'] > 0 ? '<span class="off">+' . $count['arbitrage_new'] . '</span>' : '')?></a>
<? $truej = true; }
if ($count['complaint'] > 0) { ?>
<a class="div_1" href="?func=admin.journal&type=complaint"><i class="icon-ban-circle"></i> Жалобы (<?= $count['complaint']?>) <?= ($count['complaint_new'] > 0 ? '<span class="off">+' . $count['complaint_new'] . '</span>' : '')?></a>
<? $truej = true; }
if ($count['other'] > 0) { ?>
<a class="div_1" href="?func=admin.journal&type=other"><i class="icon-question-sign"></i> Разное | Другое (<?= $count['other']?>) <?= ($count['other_new'] > 0 ? '<span class="off">+' . $count['other_new'] . '</span>' : '')?></a>
<? $truej = true; } ?>
<? if (!isset($truej)) { ?>
<div class="alert">
Список уведомлений пуст
</div>
<? } else { ?>
<div class="foot">
<a class="link" href="?func=admin.journal&truncate">» Очистить журнал</a>
</div>
<?
}
}
?>
<div class="foot">
<a class="link" href="?func=admin">« В админку</a>
</div>