<?php
if( $a == 'list' ){
  if( isset( $_POST['sOption'] ) ){
    saveComments( $_POST );
    $sOption = 'save';
  }

  if( isset( $sOption ) ){
    $content .= $oTpl->tbHtml( 'messages.tpl', 'DONE' );
  }

  if( !isset( $iImage ) )
    $iImage = null;

  $content .= $oTpl->tbHtml( 'comments.tpl', 'COMMENTS_TITLE' );
  $sCommentsList = listComments( 'comments.tpl', $iImage, $config['admin_list'] );
  $content .= !empty( $sCommentsList ) ? $sCommentsList : $oTpl->tbHtml( 'messages.tpl', 'EMPTY' );
}
elseif( $a == 'delete' && isset( $iComment ) && is_numeric( $iComment ) ){
  
  if( !isset( $iImage ) )
    $iImage = null;

  deleteComment( $iComment );
  header( 'Location: '.$_SERVER['PHP_SELF'].'?p='.$aActions['f'].'-list&sOption=del&iImage='.$iImage );
  exit;
}
?>