POT
POT
POT
Main menu

Download

Forum

SVN

Class: OTS_Ban

Source Location: /classes/OTS_Ban.php

Class OTS_Ban

Class Overview

OTServ ban generic class.

OTServ ban generic class. For particular purpose use OTS_AccountBan, OTS_PlayerBan or OTS_IPBan classes respectively.

Located in /classes/OTS_Ban.php [line 29]

OTS_Base_DAO
   |
   --OTS_Row_DAO
      |
      --OTS_Ban
Author(s):
API Tags:
Property:  int $value: Banned target identifier.
Property:  int $param: Additional parameter (usualy IP mask).
Property:  bool $active: Activation state.
Property:  int $expires: Expiration time.
Property:  int $added: Creation time.
Property:  int $adminId: ID of admin who created ban.
Property:  string $command: Additional comment.
Property:  int $reason: Reason identifier.
Property-read:  bool $loaded: Loaded state check.
Property-read:  int $id: Row ID.
Abstract:  

Information Tags:
Version:  0.1.6
Since:  0.1.5

Properties

Methods

[ Top ]
Descendants
Child Class Description
OTS_AccountBan OTServ account ban.
OTS_IPBan OTServ IP ban.
OTS_PlayerBan OTServ player ban.

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From OTS_Base_DAO

OTS_Base_DAO::$db

Inherited From OTS_Row_DAO

OTS_Row_DAO::__construct()
Handles automatic loading for record.
OTS_Row_DAO::find()
Loads row by it's name.
OTS_Row_DAO::load()
Loads row by it's ID.

Inherited From OTS_Base_DAO

OTS_Base_DAO::__construct()
Sets database connection handler.
OTS_Base_DAO::__clone()
Creates clone of object.
OTS_Base_DAO::__set_state()
Magic PHP5 method.
OTS_Base_DAO::__sleep()
Magic PHP5 method.
OTS_Base_DAO::__wakeup()
Magic PHP5 method.

[ Top ]
Property Summary
array   $data   Ban data.

[ Top ]
Method Summary
void   activate()   Activates ban.
void   deactivate()   Deactivates ban.
void   delete()   Deletes ban.
int   getAdded()   Banned time.
int   getAdminId()   Ban creator.
string   getComment()   Explaination comment.
string   getCustomField()   Reads custom field.
int   getExpires()   Expiration time.
int   getId()   Ban ID.
int   getParam()   Additional parameter.
int   getReason()   Ban reason.
int   getValue()   Banned target.
bool   isActive()   Activation state.
bool   isLoaded()   Checks if object is loaded.
void   load()   Loads ban with given id.
void   save()   Saves ban in database.
void   setAdded()   Sets banned time.
void   setAdminId()   Sets ban creator.
void   setComment()   Sets explaination comment.
void   setCustomField()   Writes custom field.
void   setExpires()   Sets expiration time.
void   setParam()   Sets additional parameter.
void   setReason()   Sets ban reason.
void   setValue()   Sets banned target.
mixed   __get()   Magic PHP5 method.
void   __set()   Magic PHP5 method.

[ Top ]
Properties
array   $data = array('param' => 0, 'active' => true, 'admin_id' => 0, 'comment' => '', 'reason' => 0) [line 38]

Ban data.

Ban data.

API Tags:
Access:  protected

Information Tags:
Version:  0.1.6
Since:  0.1.5

Redefined in descendants as:

[ Top ]
Methods
activate  [line 231]

  void activate( )

Activates ban.

Activates ban. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.


API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Since:  0.1.5

[ Top ]
deactivate  [line 246]

  void deactivate( )

Deactivates ban.

Deactivates ban. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.


API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Since:  0.1.5

[ Top ]
delete  [line 121]

  void delete( )

Deletes ban.

Deletes ban.


API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Throws:  PDOException On PDO operation error.
Since:  0.1.5

[ Top ]
getAdded  [line 293]

  int getAdded( )

Banned time.

Banned time.


API Tags:
Return:  Ban creation time.
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Since:  0.1.5

[ Top ]
getAdminId  [line 327]

  int getAdminId( )

Ban creator.

Ban creator.


API Tags:
Return:  ID of administrator who created ban entry.
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Since:  0.1.5

[ Top ]
getComment  [line 361]

  string getComment( )

Explaination comment.

Explaination comment.


API Tags:
Return:  Ban description.
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Since:  0.1.5

[ Top ]
getCustomField  [line 439]

  string getCustomField( string $field  )

Reads custom field.

Reads custom field. Reads field by it's name. Can read any field of given record that exists in database.

Note: You should use this method only for fields that are not provided in standard setters/getters (SVN fields). This method runs SQL query each time you call it so it highly overloads used resources.

Parameters:
string   $field:  Field name.

API Tags:
Return:  Field value.
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Throws:  PDOException On PDO operation error.
Since:  0.1.5

[ Top ]
getExpires  [line 259]

  int getExpires( )

Expiration time.

Expiration time.


API Tags:
Return:  Ban expiration time (0 - forever).
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Since:  0.1.5

[ Top ]
getId  [line 103]

  int getId( )

Ban ID.

Ban ID.


API Tags:
Return:  Ban ID.
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Since:  0.1.5

[ Top ]
getParam  [line 177]

  int getParam( )

Additional parameter.

Additional parameter.


API Tags:
Return:  Parameter value (usualy used as IP mask).
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Since:  0.1.5

[ Top ]
getReason  [line 395]

  int getReason( )

Ban reason.

Ban reason.


API Tags:
Return:  Reason for which ban was created.
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Since:  0.1.5

[ Top ]
getValue  [line 143]

  int getValue( )

Banned target.

Banned target.


API Tags:
Return:  Target identifier.
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Since:  0.1.5

[ Top ]
isActive  [line 211]

  bool isActive( )

Activation state.

Activation state.


API Tags:
Return:  Is ban active.
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Since:  0.1.5

[ Top ]
isLoaded  [line 61]

  bool isLoaded( )

Checks if object is loaded.

Checks if object is loaded.


API Tags:
Return:  Load state.
Access:  public

Information Tags:
Version:  0.1.5
Since:  0.1.5

[ Top ]
load  [line 48]

  void load( int $id  )

Loads ban with given id.

Loads ban with given id.

Parameters:
int   $id:  Ban ID.

API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Throws:  PDOException On PDO operation error.
Since:  0.1.5

Redefinition of:
OTS_Row_DAO::load()
Loads row by it's ID.

Redefined in descendants as:

[ Top ]
save  [line 77]

  void save( )

Saves ban in database.

Saves ban in database. If object is not loaded to represent any existing ban it will create new row for it.


API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Throws:  PDOException On PDO operation error.
Since:  0.1.5

[ Top ]
setAdded  [line 314]

  void setAdded( int $added  )

Sets banned time.

Sets banned time. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $added:  Ban creation time.

API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Since:  0.1.5

[ Top ]
setAdminId  [line 348]

  void setAdminId( int $adminId  )

Sets ban creator.

Sets ban creator. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $adminId:  ID of administrator who created ban entry.

API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Since:  0.1.5

[ Top ]
setComment  [line 382]

  void setComment( string $comment  )

Sets explaination comment.

Sets explaination comment. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
string   $comment:  Ban description.

API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Since:  0.1.5

[ Top ]
setCustomField  [line 472]

  void setCustomField( string $field, mixed $value  )

Writes custom field.

Writes custom field. Write field by it's name. Can write any field of given record that exists in database.

Note: You should use this method only for fields that are not provided in standard setters/getters (SVN fields). This method runs SQL query each time you call it so it highly overloads used resources.

Note: Make sure that you pass $value argument of correct type. This method determinates whether to quote field name. It is safe - it makes you sure that no unproper queries that could lead to SQL injection will be executed, but it can make your code working wrong way. For example: $object->setCustomField('foo', '1'); will quote 1 as as string ('1') instead of passing it as a integer.

Parameters:
string   $field:  Field name.
mixed   $value:  Field value.

API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If account is not loaded.
Throws:  PDOException On PDO operation error.
Since:  0.1.5

[ Top ]
setExpires  [line 280]

  void setExpires( int $expires  )

Sets expiration time.

Sets expiration time. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $expires:  Ban expiration time (0 - forever).

API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Since:  0.1.5

[ Top ]
setParam  [line 198]

  void setParam( int $param  )

Sets additional parameter.

Sets additional parameter. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $param:  Parameter value (usualy used as IP mask).

API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Since:  0.1.5

[ Top ]
setReason  [line 416]

  void setReason( int $reason  )

Sets ban reason.

Sets ban reason. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $reason:  Reason for which ban was created.

API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Since:  0.1.5

[ Top ]
setValue  [line 164]

  void setValue( int $value  )

Sets banned target.

Sets banned target. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $value:  Banned target identifier.

API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Since:  0.1.5

[ Top ]
__get  [line 499]

  mixed __get( string $name  )

Magic PHP5 method.

Magic PHP5 method.

Parameters:
string   $name:  Property name.

API Tags:
Return:  Property value.
Access:  public

Information Tags:
Version:  0.1.5
Throws:  E_OTS_NotLoaded If ban is not loaded.
Throws:  OutOfBoundsException For non-supported properties.
Throws:  PDOException On PDO operation error.
Since:  0.1.5

[ Top ]
__set  [line 548]

  void __set( string $name, mixed $value  )

Magic PHP5 method.

Magic PHP5 method.

Parameters:
string   $name:  Property name.
mixed   $value:  Property value.

API Tags:
Access:  public

Information Tags:
Version:  0.1.5
Throws:  OutOfBoundsException For non-supported properties.
Throws:  PDOException On PDO operation error.
Since:  0.1.5

[ Top ]