<?php require_once 'protect.php'; ?>
<?php 
$resultgcat = $mysqli->query("SELECT name, page, discount, publish FROM categories WHERE insert_id=$category_id AND lang_id=$lang");
$row = $resultgcat->fetch_array(); 
$gcategory=$row['name'];
$gpage=$row['page'];
$discount=$row['discount'];
$gpromote=$row['promote'];

$result5 = $mysqli->query("SELECT id FROM prices WHERE item_id=$id");
$rowspr = mysqli_num_rows($result5);
?>
<div class="boxitem wp1"><div class="boxin">
<div class="boximage-item bordercolor3">
<?php 
if ($description=='' AND $details=='' AND $text=='' AND $url=='' AND $itemail=='' AND $script=='' AND $file=='' AND $price=='0.00' AND $offerprice=='0.00' AND $nrrows1s==0 AND $nrrows1p==0 AND $rowspr==0) { 
$showpage=0;
}?>
<?php if ($image==1) { list($width, $height) = getimagesize($imgsize."items/".$id.".jpg"); ?>
<a <?php if ($showpage==1) { ?>href="<?php echo $pagesiteitem ?>"<?php }else{ if ($url) { ?>href="<?php echo $url ?>" target="_blank"<?php }else{ if ($width>500 OR $height>500) { ?>id="thumb<?php echo $id ?>" href="<?php echo $filepath ?>items/<?php echo $id ?>.jpg" onclick="return hs.expand(this)"<?php }}}?>  title="<?php echo $name ?>">
<img src="<?php echo $codepath ?>includes/image.php?image=<?php echo $imagepath ?>items/<?php echo $id ?>.jpg&amp;nwidth=600" class="img-item" alt="<?php echo $name ?> - <?php echo $category ?>"></a>
<?php } ?>
</div>
<div class="boxtext">
<div class="boxtitles color1"><?php if ($showpage==1) { ?><a href="<?php echo $pagesiteitem ?>"><?php echo $name ?></a><?php }else{ if ($url) { ?><a href="<?php echo $url ?>" target="_blank"><?php echo $name ?></a><?php }else{?><?php echo $name ?><?php }} ?></div>
<div class="boxdetails bordercolor3">
<?php if ($section_id>0) {?><div class="titlesec color2"><?php echo $secategory ?> <?php if ($secategory) { echo '&raquo;'; } ?> <?php echo $secategory2 ?></div><?php } ?>
<div class="boxdin">
<?php
// specs
if ($type!=2) { ?>
<?php
$result11 = $mysqli->query("SELECT insert_id, name FROM categories WHERE type=3 AND lang_id=$lang AND active=1 AND publish='yes' ORDER BY priority");
while($row = $result11->fetch_array()) {
$scatid=$row['insert_id'];
$scategory=$row['name'];

$result12 = $mysqli->query("SELECT id FROM extras WHERE type=1 AND item_id=$id AND category_id='$scatid' AND lang_id=$lang");
$nrrows12 = mysqli_num_rows($result12);
?>
<?php if  ($nrrows12>0) {?>
<div class="divextras">
<div class="extrascat"><?php echo $scategory ?></div>
<div class="arrowcat"></div>
<?php
$result13 = $mysqli->query("SELECT name FROM extras WHERE type=1 AND item_id=$id AND category_id='$scatid' AND lang_id=$lang ORDER BY priority");
while($row = $result13->fetch_array()) {
$extra=$row['name'];
?>
<div class="divextra"><?php echo $extra ?></div>
<?php } ?>
</div>
<?php } ?>
<?php 
// end specs
} ?>
<?php } ?>
<?php if ($code) { ?><div class="color3 divcode"><?php echo $textcode ?> <?php echo $code ?></div><?php } ?>
<?php echo $details ?>
<?php if ($boxprices==1 AND $rowspr>0) { ?><div class="boxprices"><?php include 'prices.php';?></div><?php } ?>
</div>
<?php if ($extra) { ?><div class="boxextra"><?php echo $textextra ?> <?php echo $extra ?></div><?php } ?>
<?php if ($reviewsitem==1) { 
$resultrev = $mysqli->query("SELECT id FROM members WHERE item_id=$id AND publish='yes'");
$nrrowsrev = mysqli_num_rows($resultrev);
?><div class="divreviews color2"><?php if ($nrrowsrev>0) { ?>
<span class="icon fa-comments-o"></span> <?php echo $nrrowsrev ?>
<?php } ?></div><?php } ?>
</div>
<?php if ($type!=4) { ?><div class="boxcart<?php if ($type==2) { echo " boxcart2"; }?>"><?php include 'itemcart.php';?></div><?php } ?>
<div class="boxmore"><?php if ($showpage==1) { ?><a href="<?php echo $pagesiteitem ?>" class="button button1"><?php echo $textmore ?></a><?php } ?></div>
<?php if ($type!=4 AND $gpromote!='0' AND ($category_id!=$catid OR $pagename=='index.php' OR $pagename=='search.php')) { ?><div class="divcat"><a href="<?php echo $gpage ?>">&raquo; <?php echo $gcategory ?></a></div><?php } ?>
</div>
<div class="cleared"></div>
</div></div>