Zeile 61 | Zeile 61 |
---|
* @var array */ public $return_values = array();
|
* @var array */ public $return_values = array();
|
| /** * @var array */ var $delete_uids = array();
/** * @var int */ var $deleted_users = 0;
|
/** * Verifies if a username is valid or invalid. *
|
/** * Verifies if a username is valid or invalid. *
|
* @param boolean True when valid, false when invalid.
| * @return boolean True when valid, false when invalid.
|
*/ function verify_username() {
| */ function verify_username() {
|
Zeile 106 | Zeile 116 |
---|
if(($mybb->settings['maxnamelength'] != 0 && my_strlen($username) > $mybb->settings['maxnamelength']) || ($mybb->settings['minnamelength'] != 0 && my_strlen($username) < $mybb->settings['minnamelength'])) { $this->set_error('invalid_username_length', array($mybb->settings['minnamelength'], $mybb->settings['maxnamelength']));
|
if(($mybb->settings['maxnamelength'] != 0 && my_strlen($username) > $mybb->settings['maxnamelength']) || ($mybb->settings['minnamelength'] != 0 && my_strlen($username) < $mybb->settings['minnamelength'])) { $this->set_error('invalid_username_length', array($mybb->settings['minnamelength'], $mybb->settings['maxnamelength']));
|
return false; }
return true; }
/**
| return false; }
return true; }
/**
|
* Verifies if a usertitle is valid or invalid. *
|
* Verifies if a usertitle is valid or invalid. *
|
* @param boolean True when valid, false when invalid.
| * @return boolean True when valid, false when invalid.
|
*/ function verify_usertitle() {
| */ function verify_usertitle() {
|
Zeile 160 | Zeile 170 |
---|
/** * Verifies if a new password is valid or not.
|
/** * Verifies if a new password is valid or not.
|
* * @return boolean True when valid, false when invalid. */
| * * @return boolean True when valid, false when invalid. */
|
function verify_password() { global $mybb;
| function verify_password() { global $mybb;
|
Zeile 177 | Zeile 187 |
---|
}
// Has the user tried to use their email address or username as a password?
|
}
// Has the user tried to use their email address or username as a password?
|
if($user['email'] == $user['password'] || $user['username'] == $user['password'])
| if($user['email'] === $user['password'] || $user['username'] === $user['password'])
|
{ $this->set_error('bad_password_security'); return false;
| { $this->set_error('bad_password_security'); return false;
|
Zeile 196 | Zeile 206 |
---|
}
// If we have a "password2" check if they both match
|
}
// If we have a "password2" check if they both match
|
if(isset($user['password2']) && $user['password'] != $user['password2'])
| if(isset($user['password2']) && $user['password'] !== $user['password2'])
|
{ $this->set_error("passwords_dont_match"); return false;
| { $this->set_error("passwords_dont_match"); return false;
|
Zeile 213 | Zeile 223 |
---|
// Generate the user login key $user['loginkey'] = generate_loginkey();
|
// Generate the user login key $user['loginkey'] = generate_loginkey();
|
|
|
return true; }
| return true; }
|
Zeile 224 | Zeile 234 |
---|
*/ function verify_usergroup() {
|
*/ function verify_usergroup() {
|
$user = &$this->data;
| |
return true; } /**
| return true; } /**
|
Zeile 262 | Zeile 271 |
---|
// Check signed up emails // Ignore the ACP because the Merge System sometimes produces users with duplicate email addresses (Not A Bug) if($mybb->settings['allowmultipleemails'] == 0 && !defined("IN_ADMINCP"))
|
// Check signed up emails // Ignore the ACP because the Merge System sometimes produces users with duplicate email addresses (Not A Bug) if($mybb->settings['allowmultipleemails'] == 0 && !defined("IN_ADMINCP"))
|
{
| {
|
$uid = 0; if(isset($user['uid'])) {
| $uid = 0; if(isset($user['uid'])) {
|
Zeile 273 | Zeile 282 |
---|
$this->set_error('email_already_in_use'); return false; }
|
$this->set_error('email_already_in_use'); return false; }
|
}
| }
|
// If we have an "email2", verify it matches the existing email if(isset($user['email2']) && $user['email'] != $user['email2']) { $this->set_error("emails_dont_match");
|
// If we have an "email2", verify it matches the existing email if(isset($user['email2']) && $user['email'] != $user['email2']) { $this->set_error("emails_dont_match");
|
return false; }
return true; }
/**
| return false; }
return true; }
/**
|
* Verifies if a website is valid or not. * * @return boolean True when valid, false when invalid.
| * Verifies if a website is valid or not. * * @return boolean True when valid, false when invalid.
|
Zeile 293 | Zeile 302 |
---|
function verify_website() { $website = &$this->data['website'];
|
function verify_website() { $website = &$this->data['website'];
|
if(empty($website) || my_strtolower($website) == 'http://' || my_strtolower($website) == 'https://') { $website = ''; return true;
| if(!empty($website) && !my_validate_url($website)) { $website = 'http://'.$website;
|
}
|
}
|
// Does the website start with http(s)://? if(my_strtolower(substr($website, 0, 4)) != "http") { // Website does not start with http://, let's see if the user forgot. $website = "http://".$website; }
if(!filter_var($website, FILTER_VALIDATE_URL))
| if(!empty($website) && !my_validate_url($website))
|
{ $this->set_error('invalid_website'); return false;
| { $this->set_error('invalid_website'); return false;
|
Zeile 318 | Zeile 319 |
---|
/** * Verifies if an ICQ number is valid or not.
|
/** * Verifies if an ICQ number is valid or not.
|
* * @return boolean True when valid, false when invalid. */
| * * @return boolean True when valid, false when invalid. */
|
function verify_icq() { $icq = &$this->data['icq'];
| function verify_icq() { $icq = &$this->data['icq'];
|
Zeile 340 | Zeile 341 |
---|
* @return boolean True when valid, false when invalid. */ function verify_birthday()
|
* @return boolean True when valid, false when invalid. */ function verify_birthday()
|
{ global $mybb;
$user = &$this->data;
| { global $mybb;
$user = &$this->data;
|
$birthday = &$user['birthday'];
if(!is_array($birthday))
| $birthday = &$user['birthday'];
if(!is_array($birthday))
|
Zeile 414 | Zeile 415 |
---|
$user['bday'] = $birthday['day']."-".$birthday['month']."-"; } else
|
$user['bday'] = $birthday['day']."-".$birthday['month']."-"; } else
|
{
| {
|
// No field is specified, so return an empty string for an unknown birthday $user['bday'] = ''; }
| // No field is specified, so return an empty string for an unknown birthday $user['bday'] = ''; }
|
Zeile 437 | Zeile 438 |
---|
if(!in_array($birthdayprivacy, $accepted)) { $this->set_error("invalid_birthday_privacy");
|
if(!in_array($birthdayprivacy, $accepted)) { $this->set_error("invalid_birthday_privacy");
|
return false; } return true; }
| return false; } return true; }
|
/** * Verifies if the post count field is filled in correctly.
|
/** * Verifies if the post count field is filled in correctly.
|
*
| *
|
* @return boolean True when valid, false when invalid. */ function verify_postnum() { $user = &$this->data;
|
* @return boolean True when valid, false when invalid. */ function verify_postnum() { $user = &$this->data;
|
|
|
if(isset($user['postnum']) && $user['postnum'] < 0) { $this->set_error("invalid_postnum"); return false; }
|
if(isset($user['postnum']) && $user['postnum'] < 0) { $this->set_error("invalid_postnum"); return false; }
|
|
|
return true; }
/** * Verifies if the thread count field is filled in correctly.
|
return true; }
/** * Verifies if the thread count field is filled in correctly.
|
* * @return boolean True when valid, false when invalid. */
| * * @return boolean True when valid, false when invalid. */
|
function verify_threadnum() { $user = &$this->data;
| function verify_threadnum() { $user = &$this->data;
|
Zeile 491 | Zeile 492 |
---|
$profile_fields = &$this->data['profile_fields'];
// Loop through profile fields checking if they exist or not and are filled in.
|
$profile_fields = &$this->data['profile_fields'];
// Loop through profile fields checking if they exist or not and are filled in.
|
$userfields = array(); $comma = '';
| |
// Fetch all profile fields first. $pfcache = $cache->read('profilefields');
| // Fetch all profile fields first. $pfcache = $cache->read('profilefields');
|
Zeile 519 | Zeile 518 |
---|
}
$profilefield['type'] = htmlspecialchars_uni($profilefield['type']);
|
}
$profilefield['type'] = htmlspecialchars_uni($profilefield['type']);
|
| $profilefield['name'] = htmlspecialchars_uni($profilefield['name']);
|
$thing = explode("\n", $profilefield['type'], "2"); $type = trim($thing[0]); $field = "fid{$profilefield['fid']}";
| $thing = explode("\n", $profilefield['type'], "2"); $type = trim($thing[0]); $field = "fid{$profilefield['fid']}";
|
Zeile 649 | Zeile 649 |
---|
$this->verify_yesno_option($options, 'showquickreply', 1); $this->verify_yesno_option($options, 'showredirect', 1); $this->verify_yesno_option($options, 'showcodebuttons', 1);
|
$this->verify_yesno_option($options, 'showquickreply', 1); $this->verify_yesno_option($options, 'showredirect', 1); $this->verify_yesno_option($options, 'showcodebuttons', 1);
|
$this->verify_yesno_option($options, 'sourceeditor', 1);
| $this->verify_yesno_option($options, 'sourceeditor', 0); $this->verify_yesno_option($options, 'buddyrequestspm', 1); $this->verify_yesno_option($options, 'buddyrequestsauto', 0);
|
if($mybb->settings['postlayout'] == 'classic') {
| if($mybb->settings['postlayout'] == 'classic') {
|
Zeile 848 | Zeile 850 |
---|
}
/**
|
}
/**
|
* Verifies if a langage is valid for this user or not.
| * Verifies if a language is valid for this user or not.
|
* * @return boolean True when valid, false when invalid. */
| * * @return boolean True when valid, false when invalid. */
|
Zeile 864 | Zeile 866 |
---|
$this->set_error("invalid_language"); return false; }
|
$this->set_error("invalid_language"); return false; }
|
| return true; }
/** * Verifies if a style is valid for this user or not. * * @return boolean True when valid, false when invalid. */ function verify_style() { global $lang;
$user = &$this->data;
if($user['style']) { $theme = get_theme($user['style']);
if(empty($theme) || !is_member($theme['allowedgroups'], $user) && $theme['allowedgroups'] != 'all') { $this->set_error('invalid_style'); return false; } }
|
return true; }
| return true; }
|
Zeile 873 | Zeile 900 |
---|
* @return boolean True when valid, false when invalid. */ function verify_checkfields()
|
* @return boolean True when valid, false when invalid. */ function verify_checkfields()
|
{ $user = &$this->data;
| { $user = &$this->data;
|
// An invalid language has been specified? if($user['regcheck1'] !== "" || $user['regcheck2'] !== "true")
| // An invalid language has been specified? if($user['regcheck1'] !== "" || $user['regcheck2'] !== "true")
|
Zeile 882 | Zeile 909 |
---|
$this->set_error("invalid_checkfield"); return false; }
|
$this->set_error("invalid_checkfield"); return false; }
|
return true; }
| return true; }
/** * Verifies if the user timezone is valid. * If the timezone is invalid, the board default is used. * * @return boolean True when timezone was valid, false otherwise */ function verify_timezone() { $user = &$this->data;
$timezones = get_supported_timezones();
if(!array_key_exists($user['timezone'], $timezones)) { $user['timezone'] = $mybb->settings['timezoneoffset']; return false; }
|
|
|
/**
| return true; }
/**
|
* Validate all user assets. * * @return boolean True when valid, false when invalid.
| * Validate all user assets. * * @return boolean True when valid, false when invalid.
|
Zeile 920 | Zeile 968 |
---|
$this->verify_usertitle(); } if($this->method == "insert" || array_key_exists('password', $user))
|
$this->verify_usertitle(); } if($this->method == "insert" || array_key_exists('password', $user))
|
{
| {
|
$this->verify_password(); } if($this->method == "insert" || array_key_exists('usergroup', $user))
| $this->verify_password(); } if($this->method == "insert" || array_key_exists('usergroup', $user))
|
Zeile 972 | Zeile 1020 |
---|
$this->verify_lastvisit(); } if($this->method == "insert" || array_key_exists('lastactive', $user))
|
$this->verify_lastvisit(); } if($this->method == "insert" || array_key_exists('lastactive', $user))
|
{
| {
|
$this->verify_lastactive(); } if($this->method == "insert" || array_key_exists('away', $user))
| $this->verify_lastactive(); } if($this->method == "insert" || array_key_exists('away', $user))
|
Zeile 983 | Zeile 1031 |
---|
{ $this->verify_language(); }
|
{ $this->verify_language(); }
|
if($this->method == "insert" && array_key_exists('regcheck1', $user) && array_key_exists('regcheck2', $user))
| if($this->method == "insert" || array_key_exists('timezone', $user)) { $this->verify_timezone(); } if($this->method == "insert" && array_key_exists('regcheck1', $user) && array_key_exists('regcheck2', $user))
|
{ $this->verify_checkfields(); } if(array_key_exists('birthdayprivacy', $user)) { $this->verify_birthday_privacy();
|
{ $this->verify_checkfields(); } if(array_key_exists('birthdayprivacy', $user)) { $this->verify_birthday_privacy();
|
}
| } if($this->method == "insert" || array_key_exists('style', $user)) { $this->verify_style(); } if($this->method == "insert" || array_key_exists('signature', $user)) { $this->verify_signature(); }
|
$plugins->run_hooks("datahandler_user_validate", $this);
|
$plugins->run_hooks("datahandler_user_validate", $this);
|
|
|
// We are done validating, return. $this->set_validated(true); if(count($this->get_errors()) > 0)
|
// We are done validating, return. $this->set_validated(true); if(count($this->get_errors()) > 0)
|
{
| {
|
return false;
|
return false;
|
}
| }
|
else { return true;
| else { return true;
|
Zeile 1008 | Zeile 1068 |
---|
/** * Inserts a user into the database.
|
/** * Inserts a user into the database.
|
| * * @return array
|
*/ function insert_user() {
| */ function insert_user() {
|
Zeile 1059 | Zeile 1121 |
---|
"google" => $db->escape_string($user['google']), "birthday" => $user['bday'], "signature" => $db->escape_string($user['signature']),
|
"google" => $db->escape_string($user['google']), "birthday" => $user['bday'], "signature" => $db->escape_string($user['signature']),
|
"allownotices" => $user['options']['allownotices'], "hideemail" => $user['options']['hideemail'],
| "allownotices" => (int)$user['options']['allownotices'], "hideemail" => (int)$user['options']['hideemail'],
|
"subscriptionmethod" => (int)$user['options']['subscriptionmethod'],
|
"subscriptionmethod" => (int)$user['options']['subscriptionmethod'],
|
"receivepms" => $user['options']['receivepms'], "receivefrombuddy" => $user['options']['receivefrombuddy'], "pmnotice" => $user['options']['pmnotice'], "pmnotify" => $user['options']['pmnotify'], "showimages" => $user['options']['showimages'], "showvideos" => $user['options']['showvideos'], "showsigs" => $user['options']['showsigs'], "showavatars" => $user['options']['showavatars'], "showquickreply" => $user['options']['showquickreply'], "showredirect" => $user['options']['showredirect'],
| "receivepms" => (int)$user['options']['receivepms'], "receivefrombuddy" => (int)$user['options']['receivefrombuddy'], "pmnotice" => (int)$user['options']['pmnotice'], "pmnotify" => (int)$user['options']['pmnotify'], "showimages" => (int)$user['options']['showimages'], "showvideos" => (int)$user['options']['showvideos'], "showsigs" => (int)$user['options']['showsigs'], "showavatars" => (int)$user['options']['showavatars'], "showquickreply" => (int)$user['options']['showquickreply'], "showredirect" => (int)$user['options']['showredirect'],
|
"tpp" => (int)$user['options']['tpp'], "ppp" => (int)$user['options']['ppp'],
|
"tpp" => (int)$user['options']['tpp'], "ppp" => (int)$user['options']['ppp'],
|
"invisible" => $user['options']['invisible'],
| "invisible" => (int)$user['options']['invisible'],
|
"style" => (int)$user['style'], "timezone" => $db->escape_string($user['timezone']), "dstcorrection" => (int)$user['options']['dstcorrection'],
| "style" => (int)$user['style'], "timezone" => $db->escape_string($user['timezone']), "dstcorrection" => (int)$user['options']['dstcorrection'],
|
Zeile 1084 | Zeile 1146 |
---|
"timeformat" => $db->escape_string($user['timeformat']), "regip" => $db->escape_binary($user['regip']), "language" => $db->escape_string($user['language']),
|
"timeformat" => $db->escape_string($user['timeformat']), "regip" => $db->escape_binary($user['regip']), "language" => $db->escape_string($user['language']),
|
"showcodebuttons" => $user['options']['showcodebuttons'], "sourceeditor" => $user['options']['sourceeditor'], "away" => $user['away']['away'], "awaydate" => $user['away']['date'],
| "showcodebuttons" => (int)$user['options']['showcodebuttons'], "sourceeditor" => (int)$user['options']['sourceeditor'], "buddyrequestspm" => (int)$user['options']['buddyrequestspm'], "buddyrequestsauto" => (int)$user['options']['buddyrequestsauto'], "away" => (int)$user['away']['away'], "awaydate" => (int)$user['away']['date'],
|
"returndate" => $user['away']['returndate'], "awayreason" => $db->escape_string($user['away']['awayreason']), "notepad" => $db->escape_string($user['notepad']),
| "returndate" => $user['away']['returndate'], "awayreason" => $db->escape_string($user['away']['awayreason']), "notepad" => $db->escape_string($user['notepad']),
|
Zeile 1103 | Zeile 1167 |
---|
"suspendposting" => 0, "suspensiontime" => 0, "coppauser" => (int)$user['coppa_user'],
|
"suspendposting" => 0, "suspensiontime" => 0, "coppauser" => (int)$user['coppa_user'],
|
"classicpostbit" => $user['options']['classicpostbit'],
| "classicpostbit" => (int)$user['options']['classicpostbit'],
|
"usernotes" => '' );
| "usernotes" => '' );
|
Zeile 1171 | Zeile 1235 |
---|
/** * Updates a user in the database.
|
/** * Updates a user in the database.
|
| * * @return bool
|
*/ function update_user() {
| */ function update_user() {
|
Zeile 1308 | Zeile 1374 |
---|
} if(isset($user['away'])) {
|
} if(isset($user['away'])) {
|
$this->user_update_data['away'] = $user['away']['away'];
| $this->user_update_data['away'] = (int)$user['away']['away'];
|
$this->user_update_data['awaydate'] = $db->escape_string($user['away']['date']); $this->user_update_data['returndate'] = $db->escape_string($user['away']['returndate']); $this->user_update_data['awayreason'] = $db->escape_string($user['away']['awayreason']);
| $this->user_update_data['awaydate'] = $db->escape_string($user['away']['date']); $this->user_update_data['returndate'] = $db->escape_string($user['away']['returndate']); $this->user_update_data['awayreason'] = $db->escape_string($user['away']['awayreason']);
|
Zeile 1419 | Zeile 1485 |
---|
/** * Provides a method to completely delete a user. *
|
/** * Provides a method to completely delete a user. *
|
* @param array Array of user information * @param integer Whether if delete threads/posts or not * @return boolean True when successful, false if fails
| * @param array $delete_uids Array of user information * @param integer $prunecontent Whether if delete threads/posts or not * @return array
|
*/ function delete_user($delete_uids, $prunecontent=0) {
| */ function delete_user($delete_uids, $prunecontent=0) {
|
Zeile 1447 | Zeile 1513 |
---|
$plugins->run_hooks('datahandler_user_delete_start', $this);
$this->delete_uids = implode(',', $this->delete_uids);
|
$plugins->run_hooks('datahandler_user_delete_start', $this);
$this->delete_uids = implode(',', $this->delete_uids);
|
| if(empty($this->delete_uids)) { $this->deleted_users = 0; $this->return_values = array( "deleted_users" => $this->deleted_users );
return $this->return_values; }
|
$this->delete_content();
// Delete the user
| $this->delete_content();
// Delete the user
|
Zeile 1456 | Zeile 1532 |
---|
// Are we removing the posts/threads of a user? if((int)$prunecontent == 1)
|
// Are we removing the posts/threads of a user? if((int)$prunecontent == 1)
|
{
| {
|
$this->delete_posts();
|
$this->delete_posts();
|
}
| $db->delete_query('announcements', "uid IN({$this->delete_uids})"); }
|
else { // We're just updating the UID
|
else { // We're just updating the UID
|
| $db->update_query('pollvotes', array('uid' => 0), "uid IN({$this->delete_uids})");
|
$db->update_query('posts', array('uid' => 0), "uid IN({$this->delete_uids})"); $db->update_query('threads', array('uid' => 0), "uid IN({$this->delete_uids})");
|
$db->update_query('posts', array('uid' => 0), "uid IN({$this->delete_uids})"); $db->update_query('threads', array('uid' => 0), "uid IN({$this->delete_uids})");
|
| $db->update_query('attachments', array('uid' => 0), "uid IN({$this->delete_uids})"); $db->update_query('announcements', array('uid' => 0), "uid IN({$this->delete_uids})");
|
}
|
}
|
| $db->update_query('privatemessages', array('fromid' => 0), "fromid IN({$this->delete_uids})"); $db->update_query('users', array('referrer' => 0), "referrer IN({$this->delete_uids})");
|
// Update thread ratings $query = $db->query("
| // Update thread ratings $query = $db->query("
|
Zeile 1487 | Zeile 1570 |
---|
// Update forums & threads if user is the lastposter $db->update_query('forums', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})"); $db->update_query('threads', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})");
|
// Update forums & threads if user is the lastposter $db->update_query('forums', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})"); $db->update_query('threads', array('lastposteruid' => 0), "lastposteruid IN({$this->delete_uids})");
|
$cache->update_banned(); $cache->update_moderators();
| |
// Update forum stats update_stats(array('numusers' => '-'.$this->deleted_users));
| // Update forum stats update_stats(array('numusers' => '-'.$this->deleted_users));
|
Zeile 1497 | Zeile 1577 |
---|
$this->return_values = array( "deleted_users" => $this->deleted_users );
|
$this->return_values = array( "deleted_users" => $this->deleted_users );
|
// Update reports cache
| $plugins->run_hooks("datahandler_user_delete_end", $this);
// Update cache $cache->update_banned(); $cache->update_moderators(); $cache->update_forumsdisplay();
|
$cache->update_reportedcontent();
|
$cache->update_reportedcontent();
|
| |
$cache->update_awaitingactivation();
|
$cache->update_awaitingactivation();
|
$plugins->run_hooks("datahandler_user_delete_end", $this);
|
|
return $this->return_values;
|
return $this->return_values;
|
}
/** * Provides a method to delete users' content * * @param array Array of user ids, false if they're already set (eg when using the delete_user function) */
| }
/** * Provides a method to delete users' content * * @param array|bool $delete_uids Array of user ids, false if they're already set (eg when using the delete_user function) */
|
function delete_content($delete_uids=false) {
|
function delete_content($delete_uids=false) {
|
global $db, $plugins;
| global $db, $plugins, $mybb;
|
if($delete_uids != false)
|
if($delete_uids != false)
|
{
| {
|
$this->delete_uids = array_map('intval', (array)$delete_uids);
|
$this->delete_uids = array_map('intval', (array)$delete_uids);
|
|
|
foreach($this->delete_uids as $key => $uid) { if(!$uid || is_super_admin($uid) || $uid == $mybb->user['uid'])
| foreach($this->delete_uids as $key => $uid) { if(!$uid || is_super_admin($uid) || $uid == $mybb->user['uid'])
|
Zeile 1529 | Zeile 1611 |
---|
unset($this->delete_uids[$key]); } }
|
unset($this->delete_uids[$key]); } }
|
|
|
$this->delete_uids = implode(',', $this->delete_uids);
|
$this->delete_uids = implode(',', $this->delete_uids);
|
}
| }
|
$plugins->run_hooks('datahandler_user_delete_content', $this);
|
$plugins->run_hooks('datahandler_user_delete_content', $this);
|
| if(empty($this->delete_uids)) { return; }
|
$db->delete_query('userfields', "ufid IN({$this->delete_uids})"); $db->delete_query('privatemessages', "uid IN({$this->delete_uids})");
| $db->delete_query('userfields', "ufid IN({$this->delete_uids})"); $db->delete_query('privatemessages', "uid IN({$this->delete_uids})");
|
Zeile 1565 | Zeile 1652 |
---|
$db->update_query('reportedcontent', array('uid' => 0), "uid IN({$this->delete_uids})");
// Remove any of the user(s) uploaded avatars
|
$db->update_query('reportedcontent', array('uid' => 0), "uid IN({$this->delete_uids})");
// Remove any of the user(s) uploaded avatars
|
$query = $db->simple_select('users', 'avatar', "uid IN({$this->delete_uids}) AND avatartype='upload'"); while($avatar = $db->fetch_field($query, 'avatar'))
| require_once MYBB_ROOT.'inc/functions_upload.php'; foreach(explode(',', $this->delete_uids) as $uid)
|
{
|
{
|
$avatar = substr($avatar, 2, -20); @unlink(MYBB_ROOT.$avatar);
| remove_avatars($uid);
|
}
|
}
|
| |
}
|
}
|
|
|
/** * Provides a method to delete an users posts and threads *
|
/** * Provides a method to delete an users posts and threads *
|
* @param array Array of user ids, false if they're already set (eg when using the delete_user function)
| * @param array|bool $delete_uids Array of user ids, false if they're already set (eg when using the delete_user function)
|
*/ function delete_posts($delete_uids=false)
|
*/ function delete_posts($delete_uids=false)
|
{ global $db, $plugins;
if($delete_uids != false) { $this->delete_uids = array_map('intval', (array)$delete_uids);
foreach($this->delete_uids as $key => $uid)
| { global $db, $plugins, $mybb;
if($delete_uids != false) { $this->delete_uids = array_map('intval', (array)$delete_uids);
foreach($this->delete_uids as $key => $uid)
|
{ if(!$uid || is_super_admin($uid) || $uid == $mybb->user['uid']) {
| { if(!$uid || is_super_admin($uid) || $uid == $mybb->user['uid']) {
|
Zeile 1597 | Zeile 1682 |
---|
}
$this->delete_uids = implode(',', $this->delete_uids);
|
}
$this->delete_uids = implode(',', $this->delete_uids);
|
}
| }
|
require_once MYBB_ROOT.'inc/class_moderation.php'; $moderation = new Moderation();
|
require_once MYBB_ROOT.'inc/class_moderation.php'; $moderation = new Moderation();
|
|
|
$plugins->run_hooks('datahandler_user_delete_posts', $this);
|
$plugins->run_hooks('datahandler_user_delete_posts', $this);
|
| if(empty($this->delete_uids)) { return; }
|
// Threads $query = $db->simple_select('threads', 'tid', "uid IN({$this->delete_uids})"); while($tid = $db->fetch_field($query, 'tid')) { $moderation->delete_thread($tid);
|
// Threads $query = $db->simple_select('threads', 'tid', "uid IN({$this->delete_uids})"); while($tid = $db->fetch_field($query, 'tid')) { $moderation->delete_thread($tid);
|
}
| }
|
// Posts
|
// Posts
|
$pids = array();
| |
$query = $db->simple_select('posts', 'pid', "uid IN({$this->delete_uids})"); while($pid = $db->fetch_field($query, 'pid')) { $moderation->delete_post($pid);
|
$query = $db->simple_select('posts', 'pid', "uid IN({$this->delete_uids})"); while($pid = $db->fetch_field($query, 'pid')) { $moderation->delete_post($pid);
|
$pids[] = (int)$pid; }
// Delete Reports made to users's posts/threads if(!empty($pids)) { $db->delete_query('reportedcontent', "type='posts' AND id IN(".implode(',', $pids).")");
| |
} }
|
} }
|
|
|
/** * Provides a method to clear an users profile *
|
/** * Provides a method to clear an users profile *
|
* @param array Array of user ids, false if they're already set (eg when using the delete_user function) * @param int The new usergroup if the users should be moved (additional usergroups are always removed)
| * @param array|bool $delete_uids Array of user ids, false if they're already set (eg when using the delete_user function) * @param int $gid The new usergroup if the users should be moved (additional usergroups are always removed)
|
*/ function clear_profile($delete_uids=false, $gid=0) {
|
*/ function clear_profile($delete_uids=false, $gid=0) {
|
global $db, $plugins;
| global $db, $plugins, $mybb;
|
// delete_uids isn't a nice name, but it's used as the functions above use the same if($delete_uids != false)
|
// delete_uids isn't a nice name, but it's used as the functions above use the same if($delete_uids != false)
|
{
| {
|
$this->delete_uids = array_map('intval', (array)$delete_uids);
foreach($this->delete_uids as $key => $uid)
| $this->delete_uids = array_map('intval', (array)$delete_uids);
foreach($this->delete_uids as $key => $uid)
|
Zeile 1681 | Zeile 1763 |
---|
}
$plugins->run_hooks('datahandler_user_clear_profile', $this);
|
}
$plugins->run_hooks('datahandler_user_clear_profile', $this);
|
| if(empty($this->delete_uids)) { return; }
|
$db->update_query("users", $update, "uid IN({$this->delete_uids})"); $db->delete_query('userfields', "ufid IN({$this->delete_uids})");
|
$db->update_query("users", $update, "uid IN({$this->delete_uids})"); $db->delete_query('userfields', "ufid IN({$this->delete_uids})");
|
| // Remove any of the user(s) uploaded avatars require_once MYBB_ROOT.'inc/functions_upload.php'; foreach(explode(',', $this->delete_uids) as $uid) { remove_avatars($uid); } }
public function verify_signature() { global $mybb, $parser;
if(!isset($parser)) { require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser; }
$parser_options = array( 'allow_html' => $mybb->settings['sightml'], 'filter_badwords' => 1, 'allow_mycode' => $mybb->settings['sigmycode'], 'allow_smilies' => $mybb->settings['sigsmilies'], 'allow_imgcode' => $mybb->settings['sigimgcode'], "filter_badwords" => 1 );
$parsed_sig = $parser->parse_message($this->data['signature'], $parser_options);
if((($mybb->settings['sigimgcode'] == 0 && $mybb->settings['sigsmilies'] != 1) && substr_count($parsed_sig, "<img") > 0) || (($mybb->settings['sigimgcode'] == 1 || $mybb->settings['sigsmilies'] == 1) && substr_count($parsed_sig, "<img") > $mybb->settings['maxsigimages']) ) { $imgsallowed = 0; if($mybb->settings['sigimgcode'] == 1) { $imgsallowed = $mybb->settings['maxsigimages']; }
$this->set_error('too_many_sig_images2', array($imgsallowed)); }
if($mybb->settings['sigcountmycode'] == 0) { $parsed_sig = $parser->text_parse_message($this->data['signature']); } else { $parsed_sig = $this->data['signature']; }
$parsed_sig = preg_replace("#\s#", "", $parsed_sig); $sig_length = my_strlen($parsed_sig);
if($sig_length > $mybb->settings['siglength']) { $this->set_error('sig_too_long', array($mybb->settings['siglength']));
if($sig_length - $mybb->settings['siglength'] > 1) { $this->set_error('sig_remove_chars_plural', array($sig_length-$mybb->settings['siglength'])); } else { $this->set_error('sig_remove_chars_singular'); } }
if(count($this->get_errors()) > 0) { return false; } return true;
|
} }
| } }
|