<?php include 'sets.php';?>
<?php
$superuser="0";
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Webadmin <?php echo $domain ?></title>
<?php include 'codes.php';?>
</head>
<body>

<?php include 'navbar.php';?>
    
<div class="container">
<div class="frame">
<div class="frametitles flist">
<?php
$result = $mysqli->query("SELECT id FROM extras WHERE type=0 AND category_id>0 AND name!='' GROUP BY insert_id");
$nrrows = mysqli_num_rows($result);
?>
<a href="list-banners.php">Banners</a> (<?php echo $nrrows ?>)
</div>
<div class="framein">

<?php
$result = $mysqli->query("SELECT * FROM extras WHERE type=0 AND category_id>0 AND name!='' GROUP BY insert_id ORDER BY category_id, priority");
while($row = $result->fetch_array()) {
$id=$row['id'];
$insert_id=$row['insert_id'];
$photoid=$row['insert_id'];
$catid=$row['category_id'];
$priority=$row['priority'];

$resultb = $mysqli->query("SELECT name, text FROM extras WHERE type=0 AND insert_id='$photoid' AND lang_id=$lang");
$row = $resultb->fetch_array(); 
$name=$row['name'];
$text=$row['text'];
$showdesc = mb_substr(strip_tags($text), 0, 100, 'UTF-8');	
?>
  <div class="framerow">
    <table>
      <tr>
        <td width="150">
<?php
$resultc = $mysqli->query("SELECT name FROM categories WHERE insert_id='$catid' AND lang_id=$lang");
$row = $resultc->fetch_array(); 
$bcategory=$row['name'];
?>
<a href="list-items.php?catid=<?php echo $catid ?>" title="<?php echo $adminlist ?>" class="color2"><span class="icon fa-folder"></span> <?php echo $bcategory ?></a>
        </td>
        <td class="divimage">
<a id="thumb<?php echo $photoid ?>" href="<?php echo $filepath ?>photos/<?php echo $photoid ?>.jpg" onclick="return hs.expand(this)" class="plinks"><img src="../includes/image.php?image=<?php echo $filepath ?>photos/<?php echo $photoid ?>.jpg&amp;nwidth=70" class="pphoto" alt="<?php echo $pname ?>" title="<?php echo $ppriority ?> <?php echo $pname ?>"></a> 
        </td>
        <td><a href="edit-photo.php?id=<?php echo $insert_id?>" class="titles"><?php echo $name ?></a><br>
          <?php echo $showdesc ?> 
        </td> 
        <td width="50" align="center">
        <?php if ($publish=='no') { ?>
       <span class="icon icstyle1 fa-eye-slash" title="<?php echo $adminpublish ?> &raquo; <?php echo $adminno ?>"></span>  
       <?php } ?>
        </td>
        <td class="divoption">
          <a href="edit-photo.php?id=<?php echo $insert_id?>" class="linkoption" title="<?php echo $adminedit ?>"><span class="icon fa-edit"></span> <?php echo $adminedit ?></a>
        </td>
        </tr>
    </table>
  </div>
<?php } ?>

</div>
</div>
</div>

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

</body>
</html>