Файл: plugins/home.php
Строк: 229
<?PHP
if (isset($_SESSION['guest_theme']) && $_SESSION['guest_theme'] == 'web' && !isset($user)) {
require 'home2.php';
}else
if (isset($user) && $user['design']== 'slate'){
require 'home2.php';
}else{
require SYS . 'header.php';
$count = $sql -> fetch("
SELECT COUNT(*) AS users_all,
(SELECT COUNT(*) FROM `shop_comments` WHERE `time` > '" . mktime(0, 0, 0) . "') AS 'goods_comments',
(SELECT COUNT(*) FROM `shop_goods` WHERE `time` > '" . mktime(0, 0, 0) ."' AND `active` = '1' AND `unlink` = '0') AS 'goods_new',
(SELECT COUNT(*) FROM `gosti_online` WHERE `date_last` > ".(time()-600)." AND `pereh` > '0') AS 'online_gosti',
(SELECT COUNT(*) FROM `news` WHERE `close` = '0' AND `time` > '" . mktime(0, 0, 0) . "') AS 'news_new',
(SELECT COUNT(*) FROM `chat` WHERE `time` > '" . mktime(0, 0, 0) . "') AS 'chat_new',
(SELECT COUNT(*) FROM `users` WHERE `date_last` > '" . (time() - 1800) . "') AS 'users_online',
(SELECT COUNT(*) FROM `users` WHERE `date_reg` > '" . mktime(0, 0, 0) . "') AS 'users_new',
(SELECT COUNT(*) FROM `shop_goods` WHERE `active` = '1' AND `unlink` = '0') AS 'goods',
(SELECT COUNT(*) FROM `news` WHERE `close` = '0') AS 'news',
(SELECT COUNT(*) FROM `votes` WHERE `view` = '1') AS 'votes',
(SELECT COUNT(*) FROM `users` WHERE `garant` = '1') AS 'garant',
(SELECT COUNT(*) FROM `chat`) AS 'chat'
FROM `users`");
?>
<a class="main_razd2 link" href="/news.html"><b>Новости (<?= $count['news']?>) <?= ($count['news_new'] > 0 ? '<span class="off">+' . $count['news_new'] . '</span>' : '')?></b></a>
<?
if ($level == 0 || $user['view_news'] == 0) {
if ($count['news'] > 0) {
?>
<div class="home_menu">
<?
$news = $sql->fetch("SELECT * FROM `news` WHERE `close` = '0' ORDER BY `id` DESC LIMIT 1");
$count_news = $sql -> fetch("
SELECT COUNT(*) AS comments,
(SELECT COUNT(*) FROM `news_comments` WHERE `time` > '" . mktime(0, 0, 0) . "' AND `id_news` = '$news[id]') AS 'comments_new'
FROM `news_comments` WHERE `id_news` = '$news[id]'");
?>
<i class="icon-bullhorn"></i> <a href="/?func=news.comments&id=<?= $news['id']?>"><b><?= text($news['name'])?></b></a> (<?= $count_news['comments']?>) <?= ($count_news['comments_new'] > 0 ? '<span class="off">+' . $count_news['comments_new'] . '</span>' : '')?><br />
<?= text_str($news['msg'], 450, 105)?> <a href="/?func=news.comments&id=<?= $news['id']?>">Читать »</a>
</div>
<?
}
}
?>
<?
if ($level > 0) {
$kgoods = $user['count_goods'];
} else {
$kgoods = 3;
}
////$array = $sql -> select("SELECT * FROM `shop_goods` WHERE `active` != '2' AND `active` != '0' AND `admin_pro` != '1' AND `unlink` = '0' ORDER BY `id` DESC LIMIT $kgoods");
$array = $sql -> select("SELECT * FROM `shop_goods` WHERE `active` != '2' AND `active` != '0' AND `unlink` = '0' ORDER BY `id` DESC LIMIT $kgoods");
$num = 0;
?>
<div class="main_razd2">
Новые товары
</div>
<?
if (is_array($array)) {
foreach ($array AS $post) {
$num++;
if ($post['screens']) {
$screen = unserialize($post['screens']);
if (is_file(SRC . 'screen/shop/' . $screen[0] . '.png')) {
$_src = '/_src/img.php?link=' . base64_encode(SRC.'screen/shop/' . $screen[0] . '.png') . '&width=60&height=60';
}
} else {
$_src = '/_src/img.php?link=' . base64_encode(ROOT.'_images/images/no_image.png') . '&width=60&height=60';
}
$post['msg'] = trim($post['msg']);
$post['msg'] = bbClearTWO($post['msg']);
$post['msg'] = text_str($post['msg'], 15, 60);
//$post['msg'] = text($post['msg']);
?>
<div class="tov">
<div class="tov-screen">
<img class="img-polaroid" src="<?= $_src?>" alt="<?= text($post['name'])?>"/>
</div>
<div class="tov_fon">
<a href="/goods/<?= $post['id']?>"><?= text($post['name'])?></a> <span class="menu-price"><b><?= $post['wmr']?> ₽</b></span><br />
<?= $post['msg']?>
</div>
</div>
<?
}
}
if ($num == 0) {
?>
<div class="nav1">Нет новых товаров</div>
<?
}
$array2 = $sql -> select("SELECT * FROM `shop_goods` WHERE `time_pays` > '0' AND `unlink` != '1' AND `active` = '1' ORDER BY `time_pays` DESC LIMIT $kgoods");
if (is_array($array2)) {
$num = 0;
?>
<div class="main_razd2">
Последние продажи
</div>
<?
foreach ($array2 AS $post) {
$num++;
if ($post['screens']) {
$screen = unserialize($post['screens']);
if (is_file(SRC . 'screen/shop/' . $screen[0] . '.png')) {
$_src = '/_src/img.php?link=' . base64_encode(SRC.'screen/shop/' . $screen[0] . '.png') . '&width=60&height=60';
}
} else {
$_src = '/_src/img.php?link=' . base64_encode(ROOT.'_images/images/no_image.png') . '&width=60&height=60';
}
$post['msg'] = trim($post['msg']);
$post['msg'] = bbClearTWO($post['msg']);
?>
<div class="tov">
<div class="tov-screen">
<img class="img-polaroid" src="<?= $_src?>" alt="<?= text($post['name'])?>"/>
</div>
<div class="tov_fon">
<a href="/goods/<?= $post['id']?>"><?= text($post['name'])?></a> <span class="menu-price"><b><?= $post['wmr']?> ₽</b></span> <br />
<?= text_str($post['msg'], 15, 60)?>
</div>
</div>
<?
}
}
?>
<div class="main_razd2">
<b>Меню Сайта</b>
</div>
<div class="home_menu">
<a class="main_link" href="/shop/"><i class="ic-cart"></i> Магазин (<?= $count['goods']?>) <?= ($count['goods_new'] > 0 ? '<span class="off">+' . $count['goods_new'] . '</span>' : '')?></a>
<a class="main_link" href="/?func=shop.comments.new"><i class="ic-komm"></i> Комментарии (<?= $count['goods_comments']?>)</a>
</div>
<div class="home_menu">
<a class="main_link" href="/?func=chat"><i class="ic-chat"></i> Гостевая (<?= $count['chat']?>) <?= ($count['chat_new'] > 0 ? '<span class="off">+' . $count['chat_new'] . '</span>' : '')?></a>
</div>
<div class="home_menu">
<a class="main_link" href="/?func=site.partner"><i class="ic-thumbs-up"></i> Партнёры сайта</a>
</div>
<div class="home_menu">
<a class="main_link" href="/?func=list.leaders"><i class="ic-crown"></i> Лидеры продаж</a>
<a class="main_link" href="/?func=list.referals" ><i class="ic-star"></i> ТОП - Рефералов</a>
<a class="main_link" href="/?func=shop.statistics"><i class="ic-chart"></i> Статистика магазина</a>
<a class="main_link" href="/?func=new.tovar"><i class="ic-bell-alt"></i> Список Всех Товаров</a>
</div>
<div class="home_menu">
<a class="main_link" href="/?func=faq"><i class="ic-help"></i> Информация</a>
<a class="main_link" href="/?func=contacts"><i class="ic-phone"></i> Наши контакты</a>
<a class="main_link" href="/?func=votes"><i class="ic-star"></i> Отзывы о магазине (<?= $count['votes']?>)</a>
</div>
<div class="home_menu">
<a class="main_link" href="/?func=wap.servis"><i class="ic-th-large"></i> Wap Сервисы</a>
</div>
<div class="home_menu">
<a class="main_link" href="/list.html/page=1"><i class="ic-users"></i> Пользователи (<?= $count['users_all']?>) <?= ($count['users_new'] > 0 ? '<span class="off">+' . $count['users_new'] . '</span>' : '')?></a>
<a class="main_link" href="/online.html/page=1"><i class="ic-podcast"></i> Сейчас на сайте (<?= $count['users_online']?>)</a>
</div>
<div class="home_menu">
<? require '_src/search.php'; ?>
</div>
<?
}