Файл: 3020.ru/file_3020/plugins/home2.php
Строк: 236
<?PHP
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 `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 `time` > '" . mktime(0, 0, 0) . "' AND `active` = '1' AND `unlink` = '0') AS 'goods_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`");
if ($level == 0 || $user['view_news'] == 0) {
if ($count['news'] > 0) {
?>
<div class="main_razd">
Новость
</div>
<div class="home-menu" id="block-news">
<?
$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]'");
?>
<a href="?func=news.comments&id=<?= $news['id']?>"><i class="icon-bullhorn"></i> <b><?= text($news['name'])?></b> (<?= $count_news['comments']?>) <?= ($count_news['comments_new'] > 0 ? '<span class="off">+' . $count_news['comments_new'] . '</span>' : '')?></a>
<?= text_str($news['msg'], 450, 105)?> <a href="/?func=news.comments&id=<?= $news['id']?>">Читать »</a>
</div>
<?
}
}
$kgoods = 6;
$num = 0;
$array = $sql -> select("SELECT * FROM `shop_goods` WHERE `active` = '1' AND `unlink` = '0' ORDER BY `id` DESC LIMIT $kgoods");
?>
<div class="goods-container">
<div class="container-fluid" id="container-goods-new">
<div class="goods-header">
<?= 'Новинки'?>
</div>
<div class="row-fluid" id="row-fluid-new">
<? foreach($array AS $post) {
$num++;
if ($num > 0 && $num <= 3) {
$tooltip = 'right';
} elseif ($num > 3 && $num <= 6) {
$tooltip = 'left';
}
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=120&height=120';
}
} else {
$_src = '/_src/img.php?link=' . base64_encode(ROOT.'_images/images/no_image.png') . '&width=120&height=120';
}
$author = login($post['id_user'], 0);
?>
<div class="span2" title="<?= 'Товар'?> «<?= text($post['name'])?>»">
<a href="/goods/<?= $post['id']?>" rel="tooltip" style="position: relative; display: block;" title="<?= 'Продавец'?> <?= $author?>" data-placement="<?= $tooltip?>">
<img src="/_images/icon/new-goods.png" style="position: absolute; right: 15px; top: 11px;">
<span class="paragraph-screen"><img src="<?= $_src?>" class="img-polaroid" /></span>
<div class="paragraph">
<span class="paragraph-text">
<?= text($post['name'])?><span class="paragraph-end"></span>
</span>
</div>
</a>
<div class="paragraph">
<span class="paragraph-panel">
<span class="paragraph-author">
<a href="/wm/<?= $author?>" title="<?= 'Продавец'?> <?= $author?>"><?= $author?><span class="paragraph-end"></span></a>
</span>
<span class="paragraph-price"><?= round($post['wmr'], 2)?> wmr</span>
</span>
</div>
</div>
<? } ?>
</div>
</div>
</div>
<script>
$('#row-fluid-new').tooltip({
selector: "a[rel=tooltip]"
});
</script>
<?
unset($array);
$num = 0;
$array = $sql -> select("SELECT * FROM `shop_goods` WHERE `time_pays` > '0' AND `unlink` != '1' AND `active` = '1' ORDER BY `time_pays` DESC LIMIT $kgoods");
?>
<div class="goods-container">
<div class="container-fluid" id="container-goods-pay">
<div class="goods-header">
<?= 'Уже купили'?>
</div>
<div class="row-fluid" id="row-fluid-pay">
<? foreach($array AS $post) {
$num++;
if ($num > 0 && $num <= 3) {
$tooltip = 'right';
} elseif ($num > 3 && $num <= 6) {
$tooltip = 'left';
}
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=120&height=120';
}
} else {
$_src = '/_src/img.php?link=' . base64_encode(ROOT.'_images/images/no_image.png') . '&width=120&height=120';
}
$author = login($post['id_user'], 0, 0);
?>
<div class="span2" title="<?= 'Товар'?> «<?= text($post['name'])?>»">
<a href="/goods/<?= $post['id']?>" rel="tooltip" title="<?= 'Продавец'?> <?= $author?>" data-placement="<?= $tooltip?>">
<span class="paragraph-screen"><img src="<?= $_src?>" class="img-polaroid" /></span>
<div class="paragraph">
<span class="paragraph-text">
<?= text($post['name'])?><span class="paragraph-end"></span>
</span>
</div>
</a>
<div class="paragraph">
<span class="paragraph-panel">
<span class="paragraph-author">
<a href="/wm/<?= $author?>" title="<?= 'Продавец'?> <?= $author?>"><?= $author?><span class="paragraph-end"></span></a>
</span>
<span class="paragraph-price"><?= round($post['wmr'], 2)?> wmr</span>
</span>
</div>
</div>
<? } ?>
</div>
</div>
</div>
<script>
$('#row-fluid-pay').tooltip({
selector: "a[rel=tooltip]"
});
</script>
<?
unset($array);
?>
<div class="main_razd">
<?= 'Меню'?>
</div>
<div class="home-menu">
<a href="/?func=new.tovar"><i class="ic-cart"></i> <?= 'Все Товары'?> (<?= $count['goods']?>) <?= ($count['goods_new'] > 0 ? '<span class="off">+' . $count['goods_new'] . '</span>' : '')?></a>
</div>
<div class="home-menu">
<a href="?func=shop.comments.new"><i class="ic-komm"></i> <?= 'Комментарии'?> (<?= $count['goods_comments']?>)</a>
</div>
<div class="home-menu">
<a href="?func=list.leaders"><i class="ic-crown"></i> <?= 'Лидеры продаж'?></a>
</div>
<div class="home-menu">
<a href="/?func=site.partner"><i class="ic-thumbs-up"></i> <?= 'Партнёры сайта'?></a>
</div>
<div class="home-menu">
<a 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 href="/?func=list.referals" ><i class="ic-star"></i> <?= 'ТОП - Рефералов'?></a>
</div>
<div class="home-menu">
<a href="/?func=wap.servis"><i class="ic-th-large"></i> <?= 'Онлайн Сервисы'?></a>
</div>
<div class="home-menu">
<a href="?func=list.users"><i class="ic-users"></i> <?= 'Пользователи'?> (<?= $count['users_all']?>) <?= ($count['users_new'] > 0 ? '<span class="off">+' . $count['users_new'] . '</span>' : '')?></a>
</div>
<div class="home-menu">
<a href="/online.html/page=1"><i class="ic-podcast"></i> <?= 'Сейчас на сайте'?> (<?= $count['users_online']?>)</a>
</div>
<div class="search">
<? require '_src/search.php'; ?>
</div>