<?php
/**
* Delete comment
* @return array
* @param int    $iComment
*/
function deleteComment( $iComment ){
 $oFF =& FlatFiles::getInstance( );
 $oFF->deleteInFile( DB_IMAGES_COMMENTS, $iComment, 'iComment' );
} // end function deleteComment

/**
* Save comments
* @return void
* @param array  $aForm
*/
function saveComments( $aForm ){
  $oFF =& FlatFiles::getInstance( );

  $aFile  = $oFF->throwFileArray( DB_IMAGES_COMMENTS );
  $iCount = count( $aFile );
  for( $i = 0; $i < $iCount; $i++ ){
    if( empty( $aFile[$i]['iStatus'] ) )
      $aFile[$i]['iStatus'] = 0;
    if( isset( $aForm['aId'][$aFile[$i]['iComment']] ) ){
      $iStatus = isset( $aForm['aStatus'][$aFile[$i]['iComment']] ) ? 1 : 0;
      if( $iStatus != $aFile[$i]['iStatus'] ){
        $aFile[$i]['iStatus'] = $iStatus;
        $oFF->save( DB_IMAGES_COMMENTS, $aFile[$i], 'iComment' );
      }
    }
  } // end for
} // end function saveComments
?>