Файл: groups/shop.php
Строк: 79
<?php
require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';
if (!empty($_GET['id']) && is_numeric($_GET['id']))
{
$id = abs(intval($_GET['id']));
$result = mysql_query("SELECT * FROM `groups` WHERE `id` = '".$id."' LIMIT 1");
if (mysql_num_rows($result) == true) $arr_group = mysql_fetch_array($result);
else go(URL);
}
else go(URL);
$title = checkout($arr_group['name']).' :: '.lang('Магазин :: Каталог','Магазин :: Каталог');
if ($window==false) require_once '../incfiles/head.php';
echo '<div class="title">'.($window==true?'<div class="for_pc right"><a href="" onclick="Window.Close(); return false"><img src="'.URL.'/design/img/del.png"/></a></div>'.lang('Информация','Інформація'):'<a href="'.URL.'/groups/?id='.$id.'" onclick="Page.Go(this.href); return false">'.lang('Сообщество','Спільнота').'</a> <a class="title_a_hover" href="'.URL.'/groups/info.php?id='.$id.'" onclick="Page.Go(this.href); return false">'.lang('Информация','Інформація').'</a>').'
</div>';
if (!empty($user_id) && in_array($user_id, explode("||", substr($arr_group['blacklist'], 1, -1)))) {echo err(lang('Вы заблокированы администрацией сообщества','Ви заблоковані адміністрацією спільноти')); require_once '../incfiles/foot.php';exit;}
$cp = ceil($all/30);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*30-30;
$sql = DB::$dbs->query("SELECT * FROM groups_shop_category WHERE `group_id` = ? ORDER BY `time` DESC LIMIT {$start}, 30", array($id));
echo'<div class="title">';
echo'<a class="title_a_hover" href="'.URL.'/groups/shop.php?id='.$id.'" onclick="Page.Go(this.href); return false">'.lang('Все товары','Всі товари').'</a>';
while($post = $sql -> fetch())
{
echo' <a class="title_a_hover" href="'.URL.'/groups/shop.php?id='.$id.'&cat='.$post['id'].'" onclick="Page.Go(this.href); return false">'.$post['name'].'</a>';
}
echo '</div>';
if (!empty($_GET['cat']) && is_numeric($_GET['cat']))
{
$cat = abs(intval($_GET['cat']));
if($cat<=0) go(URL);
$cp = ceil($all/30);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*30-30;
$sql = DB::$dbs->query("SELECT * FROM groups_shop_goods WHERE `group_id` = ? AND `cat_id` = ? ORDER BY `time` DESC LIMIT {$start}, 30", array($id,$cat));
while($post = $sql -> fetch())
{
$g_info = DB::$dbs->queryFetch("SELECT * FROM groups_shop_file WHERE `fid` = ? LIMIT 1 ",array($post['id']));
if ($g_info)$img = ''.URL.'/files/shop/photos/'.$g_info['url'].'';
else $img = ''.URL.'/design/img/no-image-300x300-300x220.png';
echo '<div class="shop"><a href="'.URL.'/groups/shop/view.php?id='.$id.'&gid='.$post['id'].'" onclick="Page.Go(this.href); return false;"><div class="shop_block"><img src="'.$img.'"/><div class="shop_title">'.$post['name'].' <br />'.lang('Цена','Ціна').': '.$post['price'].' '.$post['price_v'].'</div></div></a></div>';
}
}else{
$cp = ceil($all/30);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*30-30;
$sql = DB::$dbs->query("SELECT * FROM groups_shop_goods WHERE `group_id` = ? ORDER BY `time` DESC LIMIT {$start}, 30", array($id));
while($post = $sql -> fetch())
{
$g_info = DB::$dbs->queryFetch("SELECT * FROM groups_shop_file WHERE `fid` = ? LIMIT 1 ",array($post['id']));
if ($g_info)$img = ''.URL.'/files/shop/photos/'.$g_info['url'].'';
else
$img = ''.URL.'/design/img/no-image-300x300-300x220.png';
echo '<div class="shop"><a href="'.URL.'/groups/shop/view.php?id='.$id.'&gid='.$post['id'].'" onclick="Page.Go(this.href); return false;"><div class="shop_block"><img src="'.$img.'"/><div class="shop_title">'.$post['name'].' <br />'.lang('Цена','Ціна').': '.$post['price'].' '.$post['price_v'].'</div></div></a></div>';
}
}
navi($p,$cp,''.URL.'/groups/shop.php?id='.$id.'&cat='.$cat.'');
require_once '../incfiles/foot.php';
?>