<?php require_once('../Connections/telmanik_press.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_deleteads = 10;
$pageNum_deleteads = 0;
if (isset($_GET['pageNum_deleteads'])) {
  $pageNum_deleteads = $_GET['pageNum_deleteads'];
}
$startRow_deleteads = $pageNum_deleteads * $maxRows_deleteads;

mysql_select_db($database_telmanik_press, $telmanik_press);
$query_deleteads = "SELECT * FROM gallerys";
$query_limit_deleteads = sprintf("%s LIMIT %d, %d", $query_deleteads, $startRow_deleteads, $maxRows_deleteads);
$deleteads = mysql_query($query_limit_deleteads, $telmanik_press) or die(mysql_error());
$row_deleteads = mysql_fetch_assoc($deleteads);

if (isset($_GET['totalRows_deleteads'])) {
  $totalRows_deleteads = $_GET['totalRows_deleteads'];
} else {
  $all_deleteads = mysql_query($query_deleteads);
  $totalRows_deleteads = mysql_num_rows($all_deleteads);
}
$totalPages_deleteads = ceil($totalRows_deleteads/$maxRows_deleteads)-1;

$queryString_deleteads = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_deleteads") == false && 
        stristr($param, "totalRows_deleteads") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_deleteads = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_deleteads = sprintf("&totalRows_deleteads=%d%s", $totalRows_deleteads, $queryString_deleteads);
?>
<?php require("assets/wrapper/header.php"); ?>
<div class="mainlayout">
 
 <div id="edithead"><div id="editload">
  <p>&nbsp;</p><?php echo $translate->__('Delete a gallery -');?>
   <p>&nbsp;</p><form action="" method="get" name="delete">
   <?php do { ?>
   
	
	<?php echo' <a href="../photo_gallery_view.php?gallery='.$row_deleteads['gallery_name'].'" border="0" target="_new"> 
	
	'.$row_deleteads['gallery_name'].'</a> '; ?> <button onclick="window.location='delete_gallerys_confirm.php?id=<?php echo $row_deleteads['id']; ?>&amp;<?php echo $_SERVER['QUERY_STRING'];?>'; return false;" class="submit"><?php echo $translate->__('Delete');?></button></p>
     
     
     <?php } while ($row_deleteads = mysql_fetch_assoc($deleteads)); ?>
   </form>
<?php echo $translate->__('Records');?> <?php echo ($startRow_deleteads + 1) ?> <?php echo $translate->__('to');?> <?php echo min($startRow_deleteads + $maxRows_deleteads, $totalRows_deleteads) ?> <?php echo $translate->__('of');?> <?php echo $totalRows_deleteads ?>
<table border="0">
  <tr>
    <td><?php if ($pageNum_deleteads > 0) { // Show if not first page ?>
        <a href="<?php printf("%s?pageNum_deleteads=%d%s", $currentPage, 0, $queryString_deleteads); ?>"><?php echo $translate->__('First');?></a>
        <?php } // Show if not first page ?></td>
    <td><?php if ($pageNum_deleteads > 0) { // Show if not first page ?>
        <a href="<?php printf("%s?pageNum_deleteads=%d%s", $currentPage, max(0, $pageNum_deleteads - 1), $queryString_deleteads); ?>"><?php echo $translate->__('Previous');?></a>
        <?php } // Show if not first page ?></td>
    <td><?php if ($pageNum_deleteads < $totalPages_deleteads) { // Show if not last page ?>
        <a href="<?php printf("%s?pageNum_deleteads=%d%s", $currentPage, min($totalPages_deleteads, $pageNum_deleteads + 1), $queryString_deleteads); ?>"><?php echo $translate->__('Next');?></a>
        <?php } // Show if not last page ?></td>
    <td><?php if ($pageNum_deleteads < $totalPages_deleteads) { // Show if not last page ?>
        <a href="<?php printf("%s?pageNum_deleteads=%d%s", $currentPage, $totalPages_deleteads, $queryString_deleteads); ?>"><?php echo $translate->__('Last');?></a>
        <?php } // Show if not last page ?></td>
  </tr>
</table><p>&nbsp;</p>
   <p>&nbsp;</p>
 </div></div></div>
</div>
<?php require("assets/wrapper/footer.php"); ?>
<?php
mysql_free_result($deleteads);
?>
