Class vB_DataManager_User

Description

Class to do data save/delete operations for USERS

Available info fields: $this->info['coppauser'] - User is COPPA $this->info['override_usergroupid'] - Prevent overwriting of usergroupid (for email validation)

  • version: $Revision: 26548 $
  • date: $Date: 2008-05-05 08:30:35 -0500 (Mon, 05 May 2008) $

Located in /includes/class_dm_user.php (line 31)

vB_DataManager
   |
   --vB_DataManager_User
Variable Summary
Method Summary
 vB_DataManager_User vB_DataManager_User (vB_Registry &$registry, [integer $errtype = ERRTYPE_STANDARD])
 string censor_custom_title (string $usertitle)
 boolean check_password_history (integer $password, integer $historylength)
 integer count_other_admins (integer $userid)
 mixed delete ([ $doquery = true])
 void do_set (string $fieldname, mixed &$value)
 string fetch_user_salt ([integer $length = SALT_LENGTH])
 string hash_password (string $password,  $salt)
 boolean is_admin (integer $usergroupid, string $membergroupids)
 boolean is_supermod (integer $usergroupid, string $membergroupids)
 void post_delete ([Boolean $doquery = true])
 void post_save_each ([boolean $doquery = true])
 boolean pre_save ([boolean $doquery = true])
 integer save ([boolean $doquery = true], [mixed $delayed = false])
 void send_welcomepm ([ $fromuser = null])
 void set_admin (integer $userid, boolean $usergroups_changed, boolean $isadmin, [boolean $wasadmin = false])
 void set_dst (integer &$dst)
 void set_supermod (integer $userid, boolean $usergroups_changed, boolean $issupermod, [boolean $wassupermod = false])
 string set_userfields (array &$values, [bool $verify = true], [string $all_fields = 'normal'])
 void set_usertitle (string $customtext, boolean $reset, array $usergroup, boolean $canusecustomtitle, boolean $isadmin)
 void update_ban_status (integer $userid)
 void update_birthday_datastore (integer $userid)
 void update_language_cookie (integer $userid)
 void update_password_history (integer $userid)
 void update_style_cookie (integer $userid)
 void update_subscriptions (integer $userid)
 void update_threadedmode_cookie (integer $userid)
 void update_username (integer $userid, [string $username = null])
 boolean usergroups_changed ()
 boolean verify_autosubscribe (integer &$autosubscribe)
 boolean verify_birthday (mixed &$birthday)
 boolean verify_displaygroupid (integer &$displaygroupid)
 boolean verify_homepage (string &$homepage)
 boolean verify_maxposts (integer &$maxposts)
 boolean verify_msn (string &$msn)
 boolean verify_parentemail (string &$parentemail)
 boolean verify_password (string &$password)
 boolean verify_referrerid (mixed &$referrerid)
 boolean verify_reputation (integer &$reputation)
 boolean verify_salt (string &$salt)
 boolean verify_skype (string &$skype)
 boolean verify_threadedmode (integer &$threadedmode)
 boolean verify_useremail (string &$email)
 boolean verify_usergroupid (integer &$usergroupid)
 boolean verify_username (string &$username)
Variables
boolean $adminoverride = false (line 173)

Whether or not to skip some checks from the admin cp

array $bitfields = array(
'options' => 'bf_misc_useroptions',
'adminoptions' => 'bf_misc_adminoptions',
)
(line 132)

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


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('userid = %1$d', 'userid') (line 159)

Condition 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.
boolean $insertedadmin = false (line 166)

Whether or not we have inserted an administrator record

array $list_types = array('buddy', 'ignore') (line 180)

Types of lists stored in usertextfield, named <X>list.

string $table = 'user' (line 142)

The main table this class deals with


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

Arrays to store stuff to save to user-related tables

array $userchangelog = array() (line 187)

Arrays to store stuff to save to userchangelog table

array $userfield = array() (line 150)

Arrays to store stuff to save to user-related tables

array $usertextfield = array() (line 151)

Arrays to store stuff to save to user-related tables

array $user_changelog_fields = array('username', 'usergroupid', 'membergroupids', 'email') (line 201)

Which fieldchanges will be logged

boolean $user_changelog_state = true (line 194)

We want to log or not the user changes

array $validfields = array(
'userid' => array(TYPE_UINT, REQ_INCR, VF_METHOD, 'verify_nonzero'),'username'=>array(TYPE_STR,REQ_YES,VF_METHOD),'email'=>array(TYPE_STR,REQ_YES,VF_METHOD,'verify_useremail'),'parentemail'=>array(TYPE_STR,REQ_NO,VF_METHOD),'emailstamp'=>array(TYPE_UNIXTIME,REQ_NO),'password'=>array(TYPE_STR,REQ_YES,VF_METHOD),'passworddate'=>array(TYPE_STR,REQ_AUTO),'salt'=>array(TYPE_STR,REQ_AUTO,VF_METHOD),'usergroupid'=>array(TYPE_UINT,REQ_YES,VF_METHOD),'membergroupids'=>array(TYPE_NOCLEAN,REQ_NO,VF_METHOD,'verify_commalist'),'infractiongroupids'=>array(TYPE_NOCLEAN,REQ_NO,VF_METHOD,'verify_commalist'),'infractiongroupid'=>array(TYPE_UINT,REQ_NO,),'displaygroupid'=>array(TYPE_UINT,REQ_NO,VF_METHOD),'styleid'=>array(TYPE_UINT,REQ_NO),'languageid'=>array(TYPE_UINT,REQ_NO),'options'=>array(TYPE_UINT,REQ_YES),'adminoptions'=>array(TYPE_UINT,REQ_NO),'showvbcode'=>array(TYPE_INT,REQ_NO,'if (!in_array($data, array(0, 1, 2))) { $data = 1; } return true;'),'showbirthday'=>array(TYPE_INT,REQ_NO,'if (!in_array($data, array(0, 1, 2, 3))) { $data = 2; } return true;'),'threadedmode'=>array(TYPE_INT,REQ_NO,VF_METHOD),'maxposts'=>array(TYPE_INT,REQ_NO,VF_METHOD),'ipaddress'=>array(TYPE_STR,REQ_NO,VF_METHOD),'referrerid'=>array(TYPE_NOHTMLCOND,REQ_NO,VF_METHOD),'posts'=>array(TYPE_UINT,REQ_NO),'daysprune'=>array(TYPE_INT,REQ_NO),'startofweek'=>array(TYPE_INT,REQ_NO),'timezoneoffset'=>array(TYPE_STR,REQ_NO),'autosubscribe'=>array(TYPE_INT,REQ_NO,VF_METHOD),'homepage'=>array(TYPE_NOHTML,REQ_NO,VF_METHOD),'icq'=>array(TYPE_NOHTML,REQ_NO),'aim'=>array(TYPE_NOHTML,REQ_NO),'yahoo'=>array(TYPE_NOHTML,REQ_NO),'msn'=>array(TYPE_STR,REQ_NO,VF_METHOD),'skype'=>array(TYPE_NOHTML,REQ_NO,VF_METHOD),'usertitle'=>array(TYPE_STR,REQ_NO),'customtitle'=>array(TYPE_UINT,REQ_NO,'if (!in_array($data, array(0, 1, 2))) { $data = 0; } return true;'),'ipoints'=>array(TYPE_UINT,REQ_NO),'infractions'=>array(TYPE_UINT,REQ_NO),'warnings'=>array(TYPE_UINT,REQ_NO),'joindate'=>array(TYPE_UNIXTIME,REQ_AUTO),'lastvisit'=>array(TYPE_UNIXTIME,REQ_NO),'lastactivity'=>array(TYPE_UNIXTIME,REQ_NO),'lastpost'=>array(TYPE_UNIXTIME,REQ_NO),'lastpostid'=>array(TYPE_UINT,REQ_NO),'birthday'=>array(TYPE_NOCLEAN,REQ_NO,VF_METHOD),'birthday_search'=>array(TYPE_STR,REQ_AUTO),'reputation'=>array(TYPE_NOHTML,REQ_NO,VF_METHOD),'reputationlevelid'=>array(TYPE_UINT,REQ_AUTO),'avatarid'=>array(TYPE_UINT,REQ_NO),'avatarrevision'=>array(TYPE_UINT,REQ_NO),'profilepicrevision'=>array(TYPE_UINT,REQ_NO),'sigpicrevision'=>array(TYPE_UINT,REQ_NO),'pmpopup'=>array(TYPE_INT,REQ_NO),'pmtotal'=>array(TYPE_UINT,REQ_NO),'pmunread'=>array(TYPE_UINT,REQ_NO),// socnet counter fields
'profilevisits'=>array(TYPE_UINT,REQ_NO),'friendcount'=>array(TYPE_UINT,REQ_NO),'friendreqcount'=>array(TYPE_UINT,REQ_NO),'vmunreadcount'=>array(TYPE_UINT,REQ_NO),'vmmoderatedcount'=>array(TYPE_UINT,REQ_NO),'pcunreadcount'=>array(TYPE_UINT,REQ_NO),'pcmoderatedcount'=>array(TYPE_UINT,REQ_NO),// usertextfield fields
'subfolders'=>array(TYPE_NOCLEAN,REQ_NO,VF_METHOD,'verify_serialized'),'pmfolders'=>array(TYPE_NOCLEAN,REQ_NO,VF_METHOD,'verify_serialized'),'searchprefs'=>array(TYPE_NOCLEAN,REQ_NO,VF_METHOD,'verify_serialized'),'buddylist'=>array(TYPE_NOCLEAN,REQ_NO,VF_METHOD,'verify_spacelist'),'ignorelist'=>array(TYPE_NOCLEAN,REQ_NO,VF_METHOD,'verify_spacelist'),'signature'=>array(TYPE_STR,REQ_NO),'rank'=>array(TYPE_STR,REQ_NO),)
(line 38)

Array of recognised and required fields for users, 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::$info
vB_DataManager::$lamda
vB_DataManager::$presave_called
vB_DataManager::$rawfields
vB_DataManager::$registry
vB_DataManager::$setfields
Methods
Constructor vB_DataManager_User (line 209)

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

vB_DataManager_User vB_DataManager_User (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
censor_custom_title (line 1013)

Checks a string for words banned in custom user titles and replaces them with the censor character

  • return: The censored string
string censor_custom_title (string $usertitle)
  • string $usertitle: Custom user title
check_password_history (line 900)

Checks to see if a password is in the user's password history

  • return: Returns true if password is in the history
boolean check_password_history (integer $password, integer $historylength)
  • integer $password: User ID
  • integer $historylength: History time ($permissions['passwordhistory'])
count_other_admins (line 2574)

Counts the number of administrators OTHER THAN the user specified

  • return: The number of administrators excluding the current user
integer count_other_admins (integer $userid)
  • integer $userid: User ID of user to be checked
delete (line 1844)

Deletes a user

  • return: The number of affected rows
mixed delete ([ $doquery = true])
  • $doquery

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

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
fetch_user_salt (line 880)

Generates a new user salt string

string fetch_user_salt ([integer $length = SALT_LENGTH])
  • integer $length: (Optional) the length of the salt string to generate
hash_password (line 858)

Takes a plain text or singly-md5'd password and returns the hashed version for storage in the database

  • return: Hashed password
string hash_password (string $password,  $salt)
  • string $password: Plain text or singly-md5'd password
  • $salt
is_admin (line 2513)

Checks usergroupid and membergroupids to see if the user has admin privileges

  • return: Returns true if user has admin privileges
boolean is_admin (integer $usergroupid, string $membergroupids)
  • integer $usergroupid: Usergroupid
  • string $membergroupids: Membergroupids (comma separated)
is_supermod (line 2544)

Checks usergroupid and membergroupids to see if the user has super moderator privileges

  • return: Returns true if user has super moderator privileges
boolean is_supermod (integer $usergroupid, string $membergroupids)
  • integer $usergroupid: Usergroupid
  • string $membergroupids: Membergroupids (comma separated)
post_delete (line 1880)

Any code to run after deleting

void post_delete ([Boolean $doquery = true])
  • Boolean $doquery: Do the query?

Redefinition of:
vB_DataManager::post_delete()
Additional data to update after a delete call (such as denormalized values in other tables).
post_save_each (line 1735)

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

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).
pre_save (line 1604)

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 1498)

Saves the data from the object into the specified database tables

  • return: Returns the user id of the affected data
integer save ([boolean $doquery = true], [mixed $delayed = false])
  • boolean $doquery: Do the query?
  • mixed $delayed: Whether to run the query now; see db_update() for more info

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

Sends a welcome pm to the user

void send_welcomepm ([ $fromuser = null])
  • $fromuser
set_admin (line 2613)

Inserts or deletes a record from the administrator table if necessary

void set_admin (integer $userid, boolean $usergroups_changed, boolean $isadmin, [boolean $wasadmin = false])
  • integer $userid: User ID of this user
  • boolean $usergroups_changed: Whether or not the usergroups of this user have changed
  • boolean $isadmin: Whether or not the user is now an admin
  • boolean $wasadmin: Whether or not the user was an admin before this update
set_dst (line 1250)

Sets DST options

void set_dst (integer &$dst)
  • integer &$dst: DST choice: (2: automatic; 1: auto-off, dst on; 0: auto-off, dst off)
set_registration_defaults (line 1278)

Sets registration defaults

void set_registration_defaults ()
set_supermod (line 2653)

Inserts or deletes a record from the moderators table if necessary

void set_supermod (integer $userid, boolean $usergroups_changed, boolean $issupermod, [boolean $wassupermod = false])
  • integer $userid: User ID of this user
  • boolean $usergroups_changed: Whether or not the usergroups of this user have changed
  • boolean $issupermod: Whether or not the user is now a super moderator
  • boolean $wassupermod: Whether or not the user was a super moderator before this update
set_userfields (line 1050)

Validates and sets custom user profile fields

  • return: Textual description of set profile fields (for email phrase)
string set_userfields (array &$values, [bool $verify = true], [string $all_fields = 'normal'])
  • array &$values: Array of values for profile fields. Example: array('field1' => 'One', 'field2' => array(0 => 'a', 1 => 'b'), 'field2_opt' => 'c')
  • bool $verify: Whether or not to verify the data actually matches any specified regexes or required fields
  • string $all_fields: What type of editable value to apply (admin, register, normal)
set_usertitle (line 936)

Sets the values for user[usertitle] and user[customtitle]

void set_usertitle (string $customtext, boolean $reset, array $usergroup, boolean $canusecustomtitle, boolean $isadmin)
  • string $customtext: Custom user title text
  • boolean $reset: Whether or not to reset a custom title to the default user title
  • array $usergroup: Array containing all information for the user's primary usergroup
  • boolean $canusecustomtitle: Whether or not a user can use custom user titles ($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canusecustomtitle'])
  • boolean $isadmin: Whether or not the user is an administrator ($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'])
update_ban_status (line 2685)

Bla bla bla

void update_ban_status (integer $userid)
  • integer $userid: User ID
update_birthday_datastore (line 2399)

Rebuilds the birthday datastore if the user's birthday has changed

void update_birthday_datastore (integer $userid)
  • integer $userid: User ID
update_language_cookie (line 2457)

Resets the languageid cookie to the user's profile choice

void update_language_cookie (integer $userid)
  • integer $userid: User ID
update_password_history (line 2419)

Inserts a record into the password history table if the user's password has changed

void update_password_history (integer $userid)
  • integer $userid: User ID
update_style_cookie (line 2436)

Resets the session styleid and styleid cookie to the user's profile choice

void update_style_cookie (integer $userid)
  • integer $userid: User ID
update_subscriptions (line 2288)

Updates user subscribed threads/forums to reflect new permissions

void update_subscriptions (integer $userid)
  • integer $userid: User ID
update_threadedmode_cookie (line 2473)

Resets the threadedmode cookie to the user's profile choice

void update_threadedmode_cookie (integer $userid)
  • integer $userid: User ID
update_username (line 2178)

Updates all denormalized tables that contain a 'username' field (or field that holds a username)

void update_username (integer $userid, [string $username = null])
  • integer $userid: User ID
  • string $username: The user name. Helpful if you want to call this function from outside the DM.
usergroups_changed (line 2489)

Checks to see if a user's usergroup memberships have changed

  • return: Returns true if memberships have changed
boolean usergroups_changed ()
verify_autosubscribe (line 275)

Verifies that an autosubscribe choice is valid and workable

boolean verify_autosubscribe (integer &$autosubscribe)
  • integer &$autosubscribe: Autosubscribe choice: (-1: no subscribe; 0: subscribe, no email; 1: instant email; 2: daily email; 3: weekly email; 4: instant icq notification (dodgy))
verify_birthday (line 519)

Verifies that the provided birthday is valid

boolean verify_birthday (mixed &$birthday)
  • mixed &$birthday: Birthday - can be yyyy-mm-dd, mm-dd-yyyy or an array containing day/month/year and converts it into a valid yyyy-mm-dd
verify_displaygroupid (line 720)

Verifies that the provided displaygroup ID is valid

boolean verify_displaygroupid (integer &$displaygroupid)
  • integer &$displaygroupid: Display group ID
verify_homepage (line 226)

Verifies that the user's homepage is valid

boolean verify_homepage (string &$homepage)
  • string &$homepage: URL
verify_maxposts (line 314)

Verifies the value of user.maxposts, setting the forum default number if the value is invalid

boolean verify_maxposts (integer &$maxposts)
  • integer &$maxposts: Maximum posts per page
verify_msn (line 779)

Verifies an MSN handle

boolean verify_msn (string &$msn)
  • string &$msn: MSN handle (email address)
verify_parentemail (line 676)

Verifies that the provided parent email address is valid

boolean verify_parentemail (string &$parentemail)
  • string &$parentemail: Email address
verify_password (line 823)

Converts a PLAIN TEXT (or valid md5 hash) password into a hashed password

boolean verify_password (string &$password)
  • string &$password: The plain text password to be converted
verify_referrerid (line 740)

Verifies a specified referrer

boolean verify_referrerid (mixed &$referrerid)
  • mixed &$referrerid: Referrer - either a user ID or a user name
verify_reputation (line 331)

Verifies a valid reputation value, and sets the appropriate reputation level

boolean verify_reputation (integer &$reputation)
  • integer &$reputation: Reputation value
verify_salt (line 845)

Verifies that the user salt is valid

boolean verify_salt (string &$salt)
  • string &$salt: The salt string
verify_skype (line 800)

Verifies a Skype name

boolean verify_skype (string &$skype)
  • string &$skype: Skype name
verify_threadedmode (line 238)

Verifies that $threadedmode is a valid value, and sets the appropriate options to support it.

boolean verify_threadedmode (integer &$threadedmode)
  • integer &$threadedmode: Threaded mode: 0 = linear, oldest first; 1 = threaded; 2 = hybrid; 3 = linear, newest first
verify_useremail (line 608)

Verifies that everything is hunky dory with the user's email field

boolean verify_useremail (string &$email)
  • string &$email: Email address
verify_usergroupid (line 696)

Verifies that the usergroup provided is valid

boolean verify_usergroupid (integer &$usergroupid)
  • integer &$usergroupid: Usergroup ID
verify_username (line 366)

Verifies that the provided username is valid, and attempts to correct it if it is not valid

  • return: Returns true if the username is valid, or has been corrected to be valid
boolean verify_username (string &$username)
  • string &$username: Username

Redefinition of:
vB_DataManager::verify_username()
Verifies that the provided username is valid, and attempts to correct it if it is not valid

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_pagetext()
 vB_DataManager::verify_serialized()
 vB_DataManager::verify_spacelist()
 vB_DataManager::verify_userid()
 vB_DataManager::verify_username()

Documentation generated on Fri, 09 May 2008 09:01:07 -0500 by phpDocumentor 1.4.1