Location: PHPKode > projects > Jarida > jarida_1.0/classes/Censor.php
<?php
                                                                                                                       
/*
                                                                                                                             
-------------------------------------------------------------------------
                                                                                                                             
Censor Class
      A class to be used to handle Censors (Bad Words).
                                                                                                                             
-------------------------------------------------------------------------
                                                                                                                             
Developer
      Name -- Haddad Said.
      Date -- 24-08-2004
      Version -- 0.2
                                                                                                                             
-------------------------------------------------------------------------
                                                                                                                             
Member Functions
      
      1.edit
      2.delete
      3.setWord
      4.getWord
      5.setReplace
      6.getReplace
      

-------------------------------------------------------------------------
                                                                                                                             
*/


class Censor extends Entry
{

  //Vars to hold attributes of the censor
  var $word;
  var $replace;



  /*

-------------------------------------------------------------------------
Class Constructor
      
Parameters:
      &db
      id

Notes:
      

Example Usage:
      $word = new Censor($db, $id);
-------------------------------------------------------------------------

  */

  function Censor(&$db, $id)
  {
    parent::Entry($db, $id);
    $query = "SELECT censor_word, censor_replace FROM tblCensor WHERE censor_id = " . $this->getId();

    if($this->result = $this->db->doQuery($query))
      {
	$row = $this->result->getArray();
	$this->setWord($row['censor_word']);
	$this->setReplace($row['censor_replace']);
      }
    else
      {
	return false;
      }
  }



  /*

-------------------------------------------------------------------------
Function edit
      
Parameters:


Notes:
      

Example Usage:
      $word->edit();
-------------------------------------------------------------------------

  */

  function edit()
  {
    $query = "UPDATE tblCensor SET censor_word = '" . $this->getWord() . "', censor_replace = '" . 
      $this->getReplace() . "' WHERE censor_id = " . $this->getId();

    if($this->result = $this->db->doQuery($query))
      {
		return true;
      }
    else
      {
		return false;
      }
  }


  /*

-------------------------------------------------------------------------
Function delete
      
Parameters:
      

Notes:
      

Example Usage:
      $word->delete();
-------------------------------------------------------------------------

  */

  function delete()
  {
    return(parent::delete("tblCensor", "censor_id"));
  }



  /*

-------------------------------------------------------------------------
Function setWord
      
Parameters:
      word

Notes:
      

Example Usage:
      $word->setWord($word);
-------------------------------------------------------------------------

  */

  function setWord($word)
  {
    $this->word = $word;
  }


  /*

-------------------------------------------------------------------------
Function getWord
      
Parameters:
      

Notes:
      

Example Usage:
      $word = $word->getWord($word);
-------------------------------------------------------------------------

  */

  function getWord()
  {
    return $this->word;
  }



  /*

-------------------------------------------------------------------------
Function setReplace
      
Parameters:
      replace

Notes:
      

Example Usage:
      $word->setReplace($replace);
-------------------------------------------------------------------------

  */

  function setReplace($replace)
  {
    $this->replace = $replace;
  }



  /*

-------------------------------------------------------------------------
Function getReplace
      
Parameters:
      

Notes:
      

Example Usage:
      $replace = $word->getReplace();
-------------------------------------------------------------------------

  */


  function getReplace()
  {
    return $this->replace;
  }



}


?>
Return current item: Jarida