Location: PHPKode > projects > Havalite > havalite/hava_img.php
<?php 
include("hava_head.php"); 

$myCount = $imageCount;
if(isset($_GET['del'])){
	if($userLvl >1) echo "DELETE IS NOT ALLOWED!";
	else{
		$del = $_GET['del'];
		saveSqlite("DELETE FROM images WHERE id = ?", array($del));
	}
}

?>
<script language="javascript">

$(document).ready(function()
{
	$("#allpost").tablesorter({widthFixed: true, widgets: ['zebra']} );	}
);
</script>

<div id="admin_index">
<div id="upper_title">
<table width="100%" border="0" cellspacing="3" cellpadding="0">
  <tr>
    <td width="1"><img src="sys/img/image.png" width="32" height="32" border="0" /></td>
    <td><a href="hava_img.php"><?=$imageCount; ?> <?php echo $hava_lang['images']; ?></a>, <?=$imageCatCount; ?> <?=$hava_lang['categories']; ?></td>
  </tr>
</table>
</div>


<table id="tablesorter" class="tablesorter" border="0" width="100%">
<thead>
<tr>
	<th width="50" valign="top"><?=$hava_lang['images']; ?></th>
	<th valign="top" width="100%"><?=$hava_lang['description']; ?></th>
	<th width="76" valign="top"><?=$hava_lang['category']; ?></th>
	<th width="50" align="center" valign="top"><?=$hava_lang['edit']; ?></th>
</tr>
</thead>
<tbody>
<?php

$fLimit = 0;
if(isset($fpage)) $fLimit = $fpage*$limit_res;

$myCount = hava_num_rows("SELECT * FROM images"); // for down navigation -----------------
$imgRes = hava_all_queries("SELECT * FROM images ORDER BY date DESC LIMIT ".$fLimit.", ".$limit_res);

if(isset($_GET['cat'])){
	$myCount = hava_num_rows("SELECT * FROM images WHERE cat = ?", array($_GET['cat'])); // for down navigation -----------------
	$imgRes = hava_all_queries("SELECT * FROM images WHERE cat = ? ORDER BY date DESC LIMIT ".$fLimit.", ".$limit_res, array($_GET['cat']));
}

$wh ='';
foreach($imgRes as $row){
	$thumb_wh = hava_options('thumbnail');
	if($row['w']){ $wh = '('.$row['w'].'x'.$row['h'].')'; }
	if($row['type'] == 'img'){ 
		$imgSrc = 'img.php?thumb='.$row['id']; 
		
		$imgUrl = hava_options('url').'/havalite/img.php?id='.$row['id'].'&type=x.png';
	}
	else { 
		$imgSrc = 'sys/img/swf_small.png'; 
		$imgUrl = hava_options('url').'/havalite/swf.php?id='.$row['id'].'&type=x.swf';
	}
?>
	<tr>
	<td><a rel="img_group" href="<?=$imgUrl; ?>" title="(id = <?=$row['id'].', name = '.$row['name'].') ('.$row['w'].'x'.$row['h'].') '.$row['desc']; ?>"><img  src="<?=$imgSrc; ?>" border="0" style="max-height:<?=hava_options('thumbnail'); ?>px; max-width:<?=hava_options('thumbnail'); ?>px;" /></a></td>
	<td><a href="hava_img_upload.php?edit=<?=$row['id']; ?>" title="edit"><?=$row['name']; ?></a> <span id="small"><?=$wh; ?></span><br /><?php if($row['desc']){ echo $row['desc']; } ?> <span id="expl"><?=hava_date($row['date']); ?></span></td>
	<td align="center"><a href="?cat=<?=$row['cat']; ?>"><?=$row['cat']; ?></a></td>
	<td align="center"><span style="display:block;width:60px;"><a href="hava_img_upload.php?edit=<?=$row['id']; ?>"><img src="sys/img/editpost.png" border="0" title="<?=$hava_lang['edit']; ?>" /></a> &nbsp;
	<a href="#" onclick="zebraConfirm('<?=$hava_lang['deleted']; ?><br><br><span style=\'color:red;\'><?=$hava_lang['deleted1']; ?></span><br>', '<?=$row['name']; ?>', '?del=<?=$row['id']; ?>', 'warning', true); return false;"><img src="sys/img/imgDel.png" border="0" /></a></td>
	</tr>
<?php
}
?>

</tbody>
</table>

</div>

<?php include('hava_foot.php'); ?>
Return current item: Havalite