<?php
if( $details==''){
$showdesc = $text;
} else {
$showdesc = $details;
}
$showdesc = mb_substr(strip_tags($showdesc), 0, 100, 'UTF-8');	   
?>
<li id="listarrayitem_<?php echo $id ?>" title="<?php echo $adminreorder ?>">
<div class="divitem<?php if ($publish=='no') { echo " notpublished"; }?><?php if (preg_match("/ads/", $script)) { echo " bordercolor2"; }?>">
<div class="framerow<?php if (preg_match("/ads/", $script)) { echo " divads"; }?>">
  <table>
    <tr> 
      <td class="divpriority"<?php if ($color==2) { ?> style="background: #<?php echo $color2 ?>; color: #ffffff;"<?php } ?>>  
        <?php echo $priority ?>
      </td>
      <td class="divimage">
      <?php if ($image==1) { ?>
      <a id="thumb<?php echo $id ?>" href="<?php echo $filepath ?>items/<?php echo $id ?>.jpg" onclick="return hs.expand(this)" class="plinks">
      <img src="../includes/image.php?image=<?php echo $filepath ?>items/<?php echo $id ?>.jpg&amp;nwidth=70" alt="<?php echo $name ?>" title="<?php echo $name ?>"></a>
      <?php } ?>          </td>
      <td> 
<?php if (preg_match("/ads/", $script)) { ?>
<a href="edit-item.php?id=<?php echo $id?>" class="color2" title="<?php echo $adminedit ?>"><span class="icon icstyle1 fa-external-link"></span></a>
<?php } ?>
<?php if (preg_match("/(fa fa-|icon fa-|<img|parallax)/i", $details.$text.$script)) { ?>
<a href="edit-item.php?id=<?php echo $id?>" class="color3" title="<?php echo $adminedit ?>"><span class="icon icstyle1 fa-dot-circle-o"></span></a>
<?php } ?>
<?php if (preg_match("/(iframe>)/i", $details.$text.$script)) { ?>
<a href="edit-item.php?id=<?php echo $id?>" class="color3" title="<?php echo $adminedit ?>"><span class="icon icstyle1 fa-youtube-play"></span></a>
<?php } ?>

<a href="edit-item.php?id=<?php echo $id?>" class="titles<?php if (preg_match("/ads/", $script)) { echo " color2"; }?>" title="<?php echo $adminedit ?>"><?php echo $name ?></a> 
&nbsp; <strong><?php echo $code ?></strong> <?php if ($dateitem==1) { ?><div class="divdate"> &nbsp; <?php echo $date ?></div><?php } ?>
<br>

<?php if ($url) { ?>
<a href="<?php echo $url ?>" target="_blank" class="color1" title="website"><span class="icon fa-link"></span></a> 
<?php } ?>
<?php if ($email) { ?>
<a href="mailto:<?php echo $email ?>?subject=<?php echo $firma?>" class="color1" title="email"><span class="icon fa-envelope"></span></a> 
<?php } ?>
<?php if ($file) { ?>
<a href="<?php echo $filepath ?>items/files/<?php echo $id?>.<?php echo $file ?>" target="blank" class="color1" title="file"><span class="icon fa-file-text"></span></a> 
<?php } ?>

<?php echo $showdesc ?>...

        <?php $photovar = "item_id"; ?>        <?php include 'add-photo.php';?>
      </td>
      <?php if ($typec==2) { ?>
      <td class="divpriceitem">
      <div class="padtop4">
       <?php if ($price!='0.00') { ?>
        <span <?php if ($offerprice!='0.00') { ?>class="price notvalid"<?php } else {?>class="price"<?php } php?>> <?php echo $price ?> &#8364; </span>
       <?php } ?>
       <hr>
       <?php if ($offerprice!='0.00') { ?>
         <span class="price"> <?php echo $offerprice ?> &#8364; </span>
       <?php } ?>
       </div>
       <br>
      </td>
     <td class="divextras">
      <?php
		$result3 = $mysqli->query("SELECT * FROM categories WHERE type=3 AND lang_id=$lang ORDER BY priority");
        while($row = $result3->fetch_array()) {
		$scatid=$row['insert_id'];
		$scategory=$row['name'];

		$result4 = $mysqli->query("SELECT * FROM extras WHERE type=1 AND item_id='$id' AND category_id='$scatid' AND lang_id=$lang");
		$nrrows4 = mysqli_num_rows($result4);
?>
   <?php if ($nrrows4>0) {?>
   <a href="list-extras.php?itemid=<?php echo $id ?>" class="links" title="<?php echo $adminlist ?>"><span class="icon fa-navicon"></span> <?php echo $scategory ?> 
   (<?php echo $nrrows4 ?>)</a> 
   <?php } else { ?>
  <span class="links inactive"><span class="icon fa-navicon"></span> <?php echo $scategory ?></span>
   <?php } ?>
   <br>
  
  <?php } ?>
  <hr class="underlinewhite">
  <a href="add-extra.php?itemid=<?php echo $id?>" class="links" title="<?php echo $adminadd ?>"><span class="icon fa-plus-square"></span> <?php echo $adminadd ?></a>
  
<?php if ($reviewsitem==1) { 
$resultrev = $mysqli->query("SELECT id FROM members WHERE item_id=$id");
$nrrowsrev = mysqli_num_rows($resultrev);
?>
<?php if ($nrrowsrev>0) { ?>
<hr class="bordercolor2">
<a href="list-members.php?itemid=<?php echo $id ?>" class="links"><span class="icon fa-comments"></span> <?php echo $adminreviews ?> (<?php echo $nrrowsrev ?>)</a>
<?php } ?>
<?php } ?>
      </td>
   <?php } ?>  
      <td class="divdetails">
     <?php if (preg_match("/1/", $promote)) { ?>
     <span class="icon icstyle1 fa-bookmark color1" title="<?php echo $adminpromote ?>"></span> &nbsp;
     <?php } ?>
     <?php if ($new==1) { ?>
     <span class="icon icstyle1 fa-certificate" title="<?php echo $adminnew ?>"></span> &nbsp;
     <?php } ?>
      <?php if ($available==0 AND $typec==2) { ?>
     <span class="icon icstyle1 fa-ban" title="<?php echo $adminavailable ?> &raquo; <?php echo $adminno ?>"></span> &nbsp;
     <?php } ?>
      <?php if ($publish=='no') { ?>
     <span class="icon icstyle1 fa-eye-slash" title="<?php echo $adminpublish ?> &raquo; <?php echo $adminno ?>"></span> &nbsp;
     <?php } ?>
        <br>

<?php 
if ($type==3 OR $type==5) { 
$weight = intval($weight);
}
if ($weight!='0.00') { ?>
<div class="padtop10">  <b> <?php echo $adminweight ?> <?php echo $weight ?> </b> </div>
<?php } ?>
 </td>

<?php if ($catid>1 AND ($srows>0 OR $groupcat==1 OR $groupitem==1)) { ?> 
<td class="divselect">
<?php include 'groups.php';?>
</td>
<?php } ?>
     
<td class="divoption">
<a href="edit-item.php?id=<?php echo $id?>" class="linkoption" title="<?php echo $adminedit ?>"><span class="icon fa-edit"></span> <?php echo $adminedit ?></a>
</td>
<td class="divoption"> 
<?php
if  (isset($_POST['deleteitem'.$id])) {
$search = $mysqli->real_escape_string(stripslashes($_REQUEST['search']));

$mysqli->query("DELETE FROM cart WHERE item_id='$id'");
$mysqli->query("DELETE FROM groups WHERE item_id='$id' OR item_id2='$id'");
$mysqli->query("ALTER TABLE groups AUTO_INCREMENT = 1");
$mysqli->query("DELETE FROM extras WHERE type=1 AND item_id='$id'");
$mysqli->query("ALTER TABLE extras AUTO_INCREMENT = 1");
$mysqli->query("DELETE FROM prices WHERE item_id='$id'");
$mysqli->query("ALTER TABLE prices AUTO_INCREMENT = 1");

$result10 = $mysqli->query("SELECT id FROM extras WHERE type=0 AND item_id='$id' AND category_id=0");
while($row = $result10->fetch_array()) {
$pid=$row['id'];

if (file_exists("./".$filepath."photos/".$pid.".jpg")) {
unlink("./".$filepath."photos/".$pid.".jpg");
   }
}
$mysqli->query("DELETE FROM extras WHERE type=0 AND item_id='$id' AND category_id=0");
$mysqli->query("UPDATE extras SET item_id=0 WHERE item_id='$id'");
$mysqli->query("ALTER TABLE extras AUTO_INCREMENT = 1");
$mysqli->query("DELETE FROM items WHERE insert_id='$id'");

	if (file_exists("./".$filepath."items/".$id.".jpg")) {
	unlink("./".$filepath."items/".$id.".jpg");
	}
	if (file_exists("./".$filepath."items/files/".$id.".".$file)) {
	unlink("./".$filepath."items/files/".$id.".".$file);
	}
$mysqli->query("ALTER TABLE items AUTO_INCREMENT = 1");
?>
<meta http-equiv="refresh" content="0;URL=list-items.php?catid=<?php echo $category_id ?>&amp;secid=<?php echo $section_id ?>">
<?php } ?>
            <form name="formdelete" method="post">
              <input type="hidden" name="id" value="<?php echo $id ?>">
              <input type="hidden" name="catid" value="<?php echo $category_id ?>">
              <input type="hidden" name="search" value="<?php echo $search ?>">
              <button type="submit" name="deleteitem<?php echo $id ?>" class="linkoption linkdelete" title="<?php echo $admindelete ?>"><span class="icon fa-trash-o"></span> <?php echo $admindelete ?></button>
            </form>
            </td>
      </tr>
    </table>
</div>

<?php include 'prices.php';?>

<!--photos -->
 <div id="contentlisting">
<ul class="nospace"><?php
$result20 = $mysqli->query("SELECT * FROM extras WHERE type=0 AND item_id='$id' AND item_id>0 GROUP BY insert_id ORDER BY priority");
while($row = $result20->fetch_array()) {
$photoid=$row['insert_id'];
$pname=$row['name'];
$ppriority=$row['priority'];
?>
<?php include 'photo.php';?>
<?php } ?>
</ul>
</div>  
<div class="cleared"></div>    
</div>
</li>