<?php

/*++++++++++++++++++++++++++++++++++++++++

  Script: Maian Gallery v2.0
  Written by: David Ian Bennett
  E-Mail: support@maianscriptworld.co.uk
  Website: http://www.maianscriptworld.co.uk

  ++++++++++++++++++++++++++++++++++++++++
  
  This File: comments.php
  Description: Approve Comments

  ++++++++++++++++++++++++++++++++++++++++*/

// Make sure that this file is being called from parent file
if (!defined('INCLUDE_FILES')) {
  accessDenied($msg_script18,$msg_script19);
  exit;
}
 
?>
<div align="center">
<table width="100%" border="0" cellpadding="0" cellspacing="1" style="border: 2px solid #083253">
<tr>
    <td align="left" class="msgBox">&raquo; <b><?php echo $msg_comments; ?></b><br><br><?php echo $msg_comments2; ?></td>
</tr>
</table>
<form method="post" name="MyForm" action="index.php?cmd=comments" onsubmit="return delete_confirm('<?php echo $msg_javascript36; ?>')">
<input type="hidden" name="process" value="1">
<table width="100%" cellpadding="0" cellspacing="0" class="menutable">
<tr>
    <td align="left" class="leftPad" width="95%" style="border-right:0">&raquo; <b><?php echo strtoupper(str_replace("{count}",rowCount('comments',' WHERE is_active = \'0\' AND is_approved = \'1\''),$msg_comments3)); ?></b></td>
    <td align="center" class="leftPad" width="5%" style="border-left:0"><input type="checkbox" name="log" onclick="selectAll()"></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" style="border: 2px solid #083253">
<?php

$q_comments = mysql_query("SELECT *,".$database['prefix']."comments.name AS cname,
                           ".$database['prefix']."images.name AS iname,
                           ".$database['prefix']."comments.id AS cid,
                           ".$database['prefix']."images.id AS iid,
                           DATE_FORMAT(".$database['prefix']."comments.addDate,'".$SETTINGS->mysql_date."') AS cdate 
                           FROM ".$database['prefix']."comments
                           LEFT JOIN ".$database['prefix']."images
                           ON ".$database['prefix']."comments.imageID = ".$database['prefix']."images.id
                           WHERE ".$database['prefix']."comments.is_active = '0'
                           AND ".$database['prefix']."comments.is_approved = '1'
                           ORDER BY cname
                           LIMIT $limitvalue,$limit
                           ") or die(mysql_error());

if (mysql_num_rows($q_comments)>0)
{
  while ($COMMENTS = mysql_fetch_object($q_comments))
  {
  ?>
  <tr>
    <td align="center" class="msgBox" style="line-height:20px">
    <table width="100%" cellspacing="0" cellpadding="0">
    <tr>
      <td align="left" width="15%" class="tdHeight"><a href="index.php?cmd=cat_images&amp;img=<?php echo $COMMENTS->imageID; ?>" rel="gb_page_center[680, 540]" title="<?php echo cleanData($COMMENTS->iname); ?>"><img src="<?php echo $SETTINGS->folder; ?>/galleries/<?php echo $SETTINGS->folder_name; ?>/<?php echo getFolderName($COMMENTS->catID); ?>/<?php echo $COMMENTS->thumbpath; ?>" alt="<?php echo cleanData($COMMENTS->iname); ?>" height="<?php echo ADD_IMG_HGHT; ?>" width="<?php echo ADD_IMG_WDTH; ?>" class="image_pad" title="<?php echo cleanData($COMMENTS->iname); ?>"></a></td>
      <td align="left" width="65%" class="tdHeight">
      <?php echo $msg_comments6.': <b>'.cleanData($COMMENTS->cname); ?></b><br>
      <?php echo $msg_comments7.': '.$COMMENTS->cdate; ?>
      </td>
      <td align="center" width="15%" class="tdHeight" style="border:2px solid #083253"><a href="index.php?cmd=comments&amp;cid=<?php echo $COMMENTS->cid; ?>" rel="gb_page_center[680, 400]" title="<?php echo $msg_comments5; ?>"><?php echo $msg_comments5; ?></a></td>
      <td align="center" class="tdHeight"><input type="checkbox" name="comment[]" value="<?php echo $COMMENTS->cid; ?>##<?php echo $COMMENTS->iid; ?>"></td>
    </tr>
    </table>
    </td>
  </tr>
  <?php
  }
}
else
{

?>
<tr>
    <td align="center" class="msgBox">[ <?php echo $msg_comments4; ?> ]</td>
</tr>
<?php
}
?>
</table>
<?php
// page numbers..
if (rowCount('comments',' WHERE is_active = \'0\' AND is_approved = \'1\'')>0) {
?>
<p align="right" class="pbutton"><input onclick="processBoxes()" type="checkbox" name="approve" value="1"> <b><?php echo $msg_comments9; ?></b>&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" onclick="processBoxes()" name="reject" value="1"> <b><?php echo $msg_comments10; ?></b>&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="mail" value="1"> <?php echo $msg_comments11; ?></p>
<p align="right" class="pbutton"><input class="formbutton" type="submit" value="<?php echo $msg_comments8; ?>" title="<?php echo $msg_comments8; ?>"></p>
<?php  
echo admin_page_numbers(rowCount('comments',' WHERE is_active = \'0\' AND is_approved = \'1\''),$limit,$page);
}
?>    
</form>
</div>

