<?php
// Xinfeng Chen, 2002.11.07
// require_once('base_array_file.php');
// require_once('class_forum_base.php');

class CReplySet extends CBaseArrayFile {
 var $_mask=array('NOCODE'=>0x04,'NOSMILE'=>0x08);
 var $id, $replyid, $flag, $ip, $user, $time, $emotion, $title, $body;

 function _explodeRecord($a_line){
  if($a_line=='') return;
  list($this->id,$this->replyid,$this->flag,$this->ip,$this->user,
   $this->time,$this->emotion,$this->title,$this->body)=explode(SP, $a_line);
 }

 function _composeRecord($a_line){
  $a_line=$this->id.SP.$this->replyid.SP.$this->flag.SP.$this->ip.SP.$this->user
   .SP.$this->time.SP.$this->emotion.SP.$this->title.SP.$this->body;
 }

 function _compareRecord($a_key){
  return $this->id == $a_key;
 }

 function load($a_bid,$a_rid){
  $fname=CForumBase::getFilePath('REPLYSET',$a_bid,$a_rid);
  return $this->readFile($fname);
 }

 function store($a_bid,$a_rid){
  $fname=CForumBase::getFilePath('REPLYSET',$a_bid,$a_rid);
  return $this->writeFile($fname);
 }

 function destroy($a_bid,$a_rid){
  $fname=CForumBase::getFilePath('REPLYSET',$a_bid,$a_rid);
  return $this->destroyFile($fname);
 }

 function getFlag($a_flag){
  return (boolean)($this->flag & $this->_mask[$a_flag]);
 }

 function setFlag($a_flag, $a_set=true){
  $mask=$this->_mask[$a_flag];
  $this->flag=($a_set)?($this->flag|$mask):($this->flag&(~$mask));
 }

}
?>