<?php require_once 'protect.php'; ?>
<?php
if($priority&1){
$imgclass = "imgright";
} else {
$imgclass = "imgleft";
}
if($pagename=='index.php' && $category_id>1){
$imgclass = "imgleft";
}
?>
<div class="bgrstyle<?php echo $color ?>">
<div <?php if ($size==1 OR $pagename=='search.php' OR $pagename=='rates.php') { ?>class="pad0 wp4"<?php } else {?>class="content boxinfo<?php if ($pagename=='index.php' OR $color==2) { echo "1 wp4"; }?><?php if ($count==1 AND $color!=2) { echo " padtop0"; }?>"<?php } php?>>
<?php if ($image==1) { list($width, $height) = getimagesize($imgsize."items/".$id.".jpg"); ?>
<div class="boximage <?php echo $imgclass ?>">
<?php if ($width>500 OR $height>500) { ?>
<a id="thumb<?php echo $id ?>i" href="<?php echo $filepath ?>items/<?php echo $id ?>.jpg" onclick="return hs.expand(this)" 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-info<?php if ($pagename=='index.php') { echo " img-info1"; }?>" alt="<?php echo $name ?> - <?php echo $sitecompany ?>">
</a>
<?php }else{?>
<img src="<?php echo $codepath ?>includes/image.php?image=<?php echo $imagepath ?>items/<?php echo $id ?>.jpg&amp;nwidth=600" class="img-info<?php if ($pagename=='index.php') { echo " img-info1"; }?>" alt="<?php echo $name ?> - <?php echo $sitecompany ?>">
<?php } ?>
<?php if ($extra) { ?><div class="titleextra"><?php echo $extra ?></div><?php } ?>
</div>
<?php } ?>
<div<?php if ($pagename!='index.php' && $image==1) {?> class="boxinfotext"<?php } ?>>
<?php if ($name) { ?>
<div class="titles<?php if ($pagename=='index.php' OR $color==2) { echo "1"; } if ($size==1) { echo " titlesfs"; } ?>"><?php if ($file) { ?>
<a href="<?php echo $filepath ?>items/files/<?php echo $id?>.<?php echo $file ?>" target="blank" class="titles"><?php echo $name ?> <span class="icon fa-file-text-o icstyle color3 margleft10"></span></a>
<?php }else{?>
<?php if ($details AND $text) { ?><a href="<?php echo $pagesiteitem ?>" class="titles"><?php echo $name ?></a><?php }else{?><?php echo $name ?><?php } ?>
<?php } ?></div>
<?php if ($itemdate) { ?><div class="divdate"><?php echo $itemdate ?></div><?php } ?>
<?php } ?>
<div<?php if ($pagename=='index.php') { ?> class="colorinfo<?php if ($size==1 && $image==0) { echo ' boxfs'; } if ($size==1 && $image==1) { echo ' boxfs1'; } ?>"<?php } ?>>
<?php if ($details) { ?><?php echo $details ?><?php }else{?><?php echo $text ?><?php } ?>
</div>
<?php if ($url) { ?><div class="margtop20"><a href="<?php echo $url ?>" target="_blank" class="links"><span class="icon fa-link"></span> <?php echo str_replace(array('http://', 'https://'), '', $url); ?></a></div><?php } ?>
</div><div class="cleared"></div>
<?php
$resultph = $mysqli->query("SELECT COUNT(id) FROM extras WHERE type=0 AND item_id=$id");
$rows = $resultph->fetch_row();
$rowsph = $rows[0];
?>
<?php if ($rowsph>0 AND (!$details OR !$text)) { ?>
<div class="colscontenti <?php if ($rowsph>0 && $pagename!='index.php') { echo 'margtop20 margbottom20'; }?>">
<?php
$result20 = $mysqli->query("SELECT * FROM extras WHERE type=0 AND item_id=$id GROUP BY insert_id ORDER BY priority");
while($row = $result20->fetch_array()) {
$phcount++;
$photoid=$row['insert_id'];
$ppriority=$row['priority'];

$result = $mysqli->query("SELECT name FROM extras WHERE insert_id='$photoid' AND lang_id=$lang");
$row = $result->fetch_array(); 
$pname=$row['name'];
$photo=$row['name'];

if ($photo=='') { 
$photo=$sitecompany;
}
?>
<?php include 'photo.php';?>
<?php } ?>
</div><div class="cleared"></div>
<?php } ?>
<?php if ($script AND (!$details OR !$text)) { ?><div class="divscript"><?php echo $script ?></div><?php } ?>
<?php if ($details AND $text) { ?><div class="margtop20"><a href="<?php echo $pagesiteitem ?>" class="button button1"><?php echo $textmore ?></a> <hr></div><?php } ?>
</div></div>