Class vB_DataManager_Forum

Description

Class to do data save/delete operations for FORUMS

Example usage (updates forum with forumid = 12):

$f = new vB_DataManager_Forum(); $f->set_condition('forumid = 12'); $f->set_info('forumid', 12); $f->set('parentid', 5); $f->set('title', 'Forum with changed parent'); $f->save();

  • version: $Revision: 32878 $
  • date: $Date: 2009-10-28 13:38:49 -0500 (Wed, 28 Oct 2009) $

Located in /includes/class_dm_forum.php (line 37)

vB_DataManager
   |
   --vB_DataManager_Forum
Variable Summary
Method Summary
 vB_DataManager_Forum vB_DataManager_Forum (vB_Registry &$registry, [integer $errtype = ERRTYPE_STANDARD])
 void delete ()
 void do_set (string $fieldname, mixed &$value)
 boolean is_subforum_of (integer $forumid, integer $parentid)
 void post_save_each ([boolean $doquery = true])
 void post_save_once ([boolean $doquery = true])
 boolean pre_save ([boolean $doquery = true])
 mixed save ([boolean $doquery = true], [mixed $delayed = false], [bool $affected_rows = false], [bool $replace = false], [ $ignore = false])
 boolean verify_description (string &$description)
 boolean verify_emaillist (string &$emails)
 boolean verify_imageprefix (string &$prefix)
 boolean verify_options (array &$options)
 boolean verify_parentid (integer &$parentid)
 boolean verify_title (string &$title)
Variables
array $bitfields = array('options' => 'bf_misc_forumoptions') (line 83)

Array of field names that are bitfields, together with the name of the variable in the registry with the definitions.

For example: var $bitfields = array('options' => 'bf_misc_useroptions', 'permissions' => 'bf_misc_moderatorpermissions')


Redefinition of:
vB_DataManager::$bitfields
Array of field names that are bitfields, together with the name of the variable in the registry with the definitions.
array $condition_construct = array('forumid = %1$d', 'forumid') (line 111)

Condition template for update query


Redefinition of:
vB_DataManager::$condition_construct
Condition template for update query This is for use with sprintf(). First key is the where clause, further keys are the field names of the data to be used.
array $forum = array() (line 97)

Array to store stuff to save to forum table

string $table = 'forum' (line 90)

The main table this class deals with


Redefinition of:
vB_DataManager::$table
Default table to be used in queries
array $tachyforumcounter = array() (line 104)

Array to store stuff to save to tachyforumcounter table

array $validfields = array(
'forumid' => array(TYPE_UINT, REQ_INCR, VF_METHOD, 'verify_nonzero'),'styleid'=>array(TYPE_INT,REQ_NO,'if ($data < 0) { $data = 0; } return true;'),'title'=>array(TYPE_STR,REQ_YES,VF_METHOD),'title_clean'=>array(TYPE_STR,REQ_YES),'description'=>array(TYPE_STR,REQ_NO,VF_METHOD),'description_clean'=>array(TYPE_STR,REQ_NO),'options'=>array(TYPE_ARRAY_BOOL,REQ_AUTO),'displayorder'=>array(TYPE_UINT,REQ_NO),'replycount'=>array(TYPE_UINT,REQ_NO),'lastpost'=>array(TYPE_UINT,REQ_NO),'lastposter'=>array(TYPE_STR,REQ_NO),'lastposterid'=>array(TYPE_STR,REQ_NO),'lastpostid'=>array(TYPE_UINT,REQ_NO),'lastthread'=>array(TYPE_STR,REQ_NO),'lastthreadid'=>array(TYPE_UINT,REQ_NO),'lasticonid'=>array(TYPE_INT,REQ_NO),'lastprefixid'=>array(TYPE_NOHTML,REQ_NO),'threadcount'=>array(TYPE_UINT,REQ_NO),'daysprune'=>array(TYPE_INT,REQ_AUTO,'if ($data == 0) { $data = -1; } return true;'),'newpostemail'=>array(TYPE_STR,REQ_NO,VF_METHOD,'verify_emaillist'),'newthreademail'=>array(TYPE_STR,REQ_NO,VF_METHOD,'verify_emaillist'),'parentid'=>array(TYPE_INT,REQ_YES,VF_METHOD),'password'=>array(TYPE_NOTRIM,REQ_NO),'link'=>array(TYPE_STR,REQ_NO),// do not use verify_link on this -- relative redirects are prefectly valid
'parentlist'=>array(TYPE_STR,REQ_AUTO,'return preg_match(\'#^(\d+,)*-1$#\', $data);'),'childlist'=>array(TYPE_STR,REQ_AUTO),'showprivate'=>array(TYPE_UINT,REQ_NO,'if ($data > 3) { $data = 0; } return true;'),'defaultsortfield'=>array(TYPE_STR,REQ_NO),'defaultsortorder'=>array(TYPE_STR,REQ_NO,'if ($data != "asc") { $data = "desc"; } return true;'),'imageprefix'=>array(TYPE_NOHTML,REQ_NO,VF_METHOD))
(line 44)

Array of recognised and required fields for forums, and their types


Redefinition of:
vB_DataManager::$validfields
Array of field names that are valid for this data object

Inherited Variables

Inherited from vB_DataManager

vB_DataManager::$condition
vB_DataManager::$dbobject
vB_DataManager::$errors
vB_DataManager::$error_handler
vB_DataManager::$existing
vB_DataManager::$failure_callback
vB_DataManager::$hook_delete
vB_DataManager::$hook_postsave
vB_DataManager::$hook_presave
vB_DataManager::$hook_start
vB_DataManager::$info
vB_DataManager::$lamda
vB_DataManager::$presave_called
vB_DataManager::$rawfields
vB_DataManager::$registry
vB_DataManager::$setfields
Methods
Constructor vB_DataManager_Forum (line 119)

Constructor - checks that the registry object has been passed correctly.

vB_DataManager_Forum vB_DataManager_Forum (vB_Registry &$registry, [integer $errtype = ERRTYPE_STANDARD])
  • vB_Registry &$registry: Instance of the vBulletin data registry object - expected to have the database object as one of its $this->db member.
  • integer $errtype: One of the ERRTYPE_x constants
delete (line 521)

Deletes a forum and its associated data from the database

void delete ()

Redefinition of:
vB_DataManager::delete()
Deletes the specified data item from the database
do_set (line 133)

Takes valid data and sets it as part of the data to be saved

void do_set (string $fieldname, mixed &$value)
  • string $fieldname: The name of the field to which the supplied data should be applied
  • mixed &$value: The data itself

Redefinition of:
vB_DataManager::do_set()
Takes valid data and sets it as part of the data to be saved
is_subforum_of (line 302)

Verifies that a given forum parent id is not one of its own children

  • return: Returns true if the children of the given parent forum does not include the specified forum... or something
boolean is_subforum_of (integer $forumid, integer $parentid)
  • integer $forumid: The ID of the current forum
  • integer $parentid: The ID of the forum's proposed parentid
post_save_each (line 368)

Additional data to update after a save call (such as denormalized values in other tables).

In batch updates, is executed for each record updated.

void post_save_each ([boolean $doquery = true])
  • boolean $doquery: Do the query?

Redefinition of:
vB_DataManager::post_save_each()
Additional data to update after a save call (such as denormalized values in other tables).
post_save_once (line 484)

Additional data to update after a save call (such as denormalized values in other tables).

In batch updates, is executed once after all records are updated.

void post_save_once ([boolean $doquery = true])
  • boolean $doquery: Do the query?

Redefinition of:
vB_DataManager::post_save_once()
Additional data to update after a save call (such as denormalized values in other tables).
pre_save (line 348)

Any checks to run immediately before saving. If returning false, the save will not take place.

  • return: True on success; false if an error occurred
boolean pre_save ([boolean $doquery = true])
  • boolean $doquery: Do the query?

Redefinition of:
vB_DataManager::pre_save()
Any checks to run immediately before saving. If returning false, the save will not take place.
save (line 505)

Overridding parent function to add search index updates

  • return: If this was an INSERT query, the INSERT ID is returned
mixed save ([boolean $doquery = true], [mixed $delayed = false], [bool $affected_rows = false], [bool $replace = false], [ $ignore = false])
  • boolean $doquery: Do the query?
  • mixed $delayed: Whether to run the query now; see db_update() for more info
  • bool $affected_rows: Whether to return the number of affected rows.
  • bool $replace: Perform REPLACE INTO instead of INSERT
  • $ignore

Redefinition of:
vB_DataManager::save()
Saves the data from the object into the specified database tables
verify_description (line 213)

Converts & to &amp; and sets description_clean for use in meta tags

boolean verify_description (string &$description)
  • string &$description: Title
verify_emaillist (line 242)

Validates a space-separated list of email addresses, prevents duplicates etc.

boolean verify_emaillist (string &$emails)
  • string &$emails: Whitespace-separated list of email addresses
verify_imageprefix (line 331)

Verifies that an image filename prefix is valid

boolean verify_imageprefix (string &$prefix)
  • string &$prefix: The image prefix filename
verify_options (line 228)

Converts an array of 1/0 options into the options bitfield

  • return: Returns true on success
boolean verify_options (array &$options)
  • array &$options: Array of 1/0 values keyed with the bitfield names for the forum options bitfield
verify_parentid (line 266)

Verifies that the parent forum specified exists and is a valid parent for this forum

  • return: Returns true if the parent id is valid, and the parent forum specified exists
boolean verify_parentid (integer &$parentid)
  • integer &$parentid: Parent forum ID
verify_title (line 189)

Verifies that the given forum title is valid

boolean verify_title (string &$title)
  • string &$title: Title

Inherited Methods

Inherited From vB_DataManager

 vB_DataManager::vB_DataManager()
 vB_DataManager::check_required()
 vB_DataManager::db_delete()
 vB_DataManager::db_insert()
 vB_DataManager::db_insert_ignore()
 vB_DataManager::db_update()
 vB_DataManager::delete()
 vB_DataManager::do_set()
 vB_DataManager::do_unset()
 vB_DataManager::error()
 vB_DataManager::fetch_field()
 vB_DataManager::fetch_insert_sql()
 vB_DataManager::fetch_update_sql()
 vB_DataManager::has_errors()
 vB_DataManager::post_delete()
 vB_DataManager::post_save_each()
 vB_DataManager::post_save_once()
 vB_DataManager::pre_delete()
 vB_DataManager::pre_save()
 vB_DataManager::save()
 vB_DataManager::set()
 vB_DataManager::setr()
 vB_DataManager::setr_info()
 vB_DataManager::set_bitfield()
 vB_DataManager::set_condition()
 vB_DataManager::set_error_handler()
 vB_DataManager::set_existing()
 vB_DataManager::set_failure_callback()
 vB_DataManager::set_info()
 vB_DataManager::strip_empty_bbcode()
 vB_DataManager::strip_empty_bbcode_callback()
 vB_DataManager::verify()
 vB_DataManager::verify_commalist()
 vB_DataManager::verify_date_array()
 vB_DataManager::verify_email()
 vB_DataManager::verify_image_count()
 vB_DataManager::verify_ipaddress()
 vB_DataManager::verify_link()
 vB_DataManager::verify_list()
 vB_DataManager::verify_md5()
 vB_DataManager::verify_nonempty()
 vB_DataManager::verify_nonzero()
 vB_DataManager::verify_nonzero_or_negone()
 vB_DataManager::verify_pagetext()
 vB_DataManager::verify_serialized()
 vB_DataManager::verify_spacelist()
 vB_DataManager::verify_userid()
 vB_DataManager::verify_username()

Documentation generated on Tue, 26 Jan 2010 15:15:15 -0600 by phpDocumentor 1.4.3