Zeile 11 | Zeile 11 |
---|
/** * Checks if a user with uid $uid exists in the database. *
|
/** * Checks if a user with uid $uid exists in the database. *
|
* @param int The uid to check for.
| * @param int $uid The uid to check for.
|
* @return boolean True when exists, false when not. */ function user_exists($uid)
| * @return boolean True when exists, false when not. */ function user_exists($uid)
|
Zeile 32 | Zeile 32 |
---|
/** * Checks if $username already exists in the database. *
|
/** * Checks if $username already exists in the database. *
|
* @param string The username for check for.
| * @param string $username The username for check for.
|
* @return boolean True when exists, false when not. */ function username_exists($username) {
|
* @return boolean True when exists, false when not. */ function username_exists($username) {
|
global $db;
| |
$options = array( 'username_method' => 2 );
| $options = array( 'username_method' => 2 );
|
Zeile 49 | Zeile 47 |
---|
/** * Checks a password with a supplied username. *
|
/** * Checks a password with a supplied username. *
|
* @param string The username of the user. * @param string The plain-text password.
| * @param string $username The username of the user. * @param string $password The plain-text password.
|
* @return boolean|array False when no match, array with user info when match. */ function validate_password_from_username($username, $password) {
|
* @return boolean|array False when no match, array with user info when match. */ function validate_password_from_username($username, $password) {
|
global $db, $mybb;
| global $mybb;
|
$options = array( 'fields' => array('username', 'password', 'salt', 'loginkey', 'coppauser', 'usergroup'),
| $options = array( 'fields' => array('username', 'password', 'salt', 'loginkey', 'coppauser', 'usergroup'),
|
Zeile 63 | Zeile 61 |
---|
);
$user = get_user_by_username($username, $options);
|
);
$user = get_user_by_username($username, $options);
|
|
|
if(!$user['uid']) { return false;
| if(!$user['uid']) { return false;
|
Zeile 75 | Zeile 73 |
---|
/** * Checks a password with a supplied uid. *
|
/** * Checks a password with a supplied uid. *
|
* @param int The user id. * @param string The plain-text password. * @param string An optional user data array.
| * @param int $uid The user id. * @param string $password The plain-text password. * @param array $user An optional user data array.
|
* @return boolean|array False when not valid, user data array when valid.
|
* @return boolean|array False when not valid, user data array when valid.
|
*/
| */
|
function validate_password_from_uid($uid, $password, $user = array()) { global $db, $mybb;
| function validate_password_from_uid($uid, $password, $user = array()) { global $db, $mybb;
|
Zeile 105 | Zeile 103 |
---|
}
if(!$user['loginkey'])
|
}
if(!$user['loginkey'])
|
{
| {
|
$user['loginkey'] = generate_loginkey(); $sql_array = array( "loginkey" => $user['loginkey']
| $user['loginkey'] = generate_loginkey(); $sql_array = array( "loginkey" => $user['loginkey']
|
Zeile 115 | Zeile 113 |
---|
if(salt_password(md5($password), $user['salt']) === $user['password']) { return $user;
|
if(salt_password(md5($password), $user['salt']) === $user['password']) { return $user;
|
} else {
| } else {
|
return false; } }
| return false; } }
|
Zeile 125 | Zeile 123 |
---|
/** * Updates a user's password. *
|
/** * Updates a user's password. *
|
* @param int The user's id. * @param string The md5()'ed password. * @param string (Optional) The salt of the user.
| * @param int $uid The user's id. * @param string $password The md5()'ed password. * @param string $salt (Optional) The salt of the user.
|
* @return array The new password.
|
* @return array The new password.
|
| * @deprecated deprecated since version 1.8.6 Please use other alternatives.
|
*/ function update_password($uid, $password, $salt="") {
| */ function update_password($uid, $password, $salt="") {
|
Zeile 171 | Zeile 170 |
---|
/** * Salts a password based on a supplied salt. *
|
/** * Salts a password based on a supplied salt. *
|
* @param string The md5()'ed password. * @param string The salt.
| * @param string $password The md5()'ed password. * @param string $salt The salt.
|
* @return string The password hash. */ function salt_password($password, $salt)
| * @return string The password hash. */ function salt_password($password, $salt)
|
Zeile 198 | Zeile 197 |
---|
function generate_loginkey() { return random_str(50);
|
function generate_loginkey() { return random_str(50);
|
}
| }
|
/** * Updates a user's salt in the database (does not update a password).
|
/** * Updates a user's salt in the database (does not update a password).
|
* * @param int The uid of the user to update.
| * * @param int $uid The uid of the user to update.
|
* @return string The new salt. */ function update_salt($uid)
|
* @return string The new salt. */ function update_salt($uid)
|
{
| {
|
global $db;
$salt = generate_salt();
| global $db;
$salt = generate_salt();
|
Zeile 222 | Zeile 221 |
---|
/** * Generates a new login key for a user. *
|
/** * Generates a new login key for a user. *
|
* @param int The uid of the user to update.
| * @param int $uid The uid of the user to update.
|
* @return string The new login key. */ function update_loginkey($uid)
| * @return string The new login key. */ function update_loginkey($uid)
|
Zeile 236 | Zeile 235 |
---|
$db->update_query("users", $sql_array, "uid='{$uid}'");
return $loginkey;
|
$db->update_query("users", $sql_array, "uid='{$uid}'");
return $loginkey;
|
}
| }
|
/** * Adds a thread to a user's thread subscription list. * If no uid is supplied, the currently logged in user's id will be used. *
|
/** * Adds a thread to a user's thread subscription list. * If no uid is supplied, the currently logged in user's id will be used. *
|
* @param int The tid of the thread to add to the list. * @param int (Optional) The type of notification to receive for replies (0=none, 1=email, 2=pm) * @param int (Optional) The uid of the user who's list to update.
| * @param int $tid The tid of the thread to add to the list. * @param int $notification (Optional) The type of notification to receive for replies (0=none, 1=email, 2=pm) * @param int $uid (Optional) The uid of the user who's list to update.
|
* @return boolean True when success, false when otherwise. */
|
* @return boolean True when success, false when otherwise. */
|
function add_subscribed_thread($tid, $notification=1, $uid="")
| function add_subscribed_thread($tid, $notification=1, $uid=0)
|
{ global $mybb, $db;
|
{ global $mybb, $db;
|
if(!$uid)
| if(!$uid)
|
{ $uid = $mybb->user['uid']; }
if(!$uid) {
|
{ $uid = $mybb->user['uid']; }
if(!$uid) {
|
return;
| return false;
|
}
$query = $db->simple_select("threadsubscriptions", "*", "tid='".(int)$tid."' AND uid='".(int)$uid."'");
| }
$query = $db->simple_select("threadsubscriptions", "*", "tid='".(int)$tid."' AND uid='".(int)$uid."'");
|
Zeile 270 | Zeile 269 |
---|
'uid' => (int)$uid, 'tid' => (int)$tid, 'notification' => (int)$notification,
|
'uid' => (int)$uid, 'tid' => (int)$tid, 'notification' => (int)$notification,
|
'dateline' => TIME_NOW, 'subscriptionkey' => md5(TIME_NOW.$uid.$tid)
| 'dateline' => TIME_NOW
|
); $db->insert_query("threadsubscriptions", $insert_array); }
| ); $db->insert_query("threadsubscriptions", $insert_array); }
|
Zeile 286 | Zeile 283 |
---|
} return true; }
|
} return true; }
|
/** * Remove a thread from a user's thread subscription list. * If no uid is supplied, the currently logged in user's id will be used. * * @param int The tid of the thread to remove from the list. * @param int (Optional) The uid of the user who's list to update. * @return boolean True when success, false when otherwise. */ function remove_subscribed_thread($tid, $uid="") { global $mybb, $db;
if(!$uid) { $uid = $mybb->user['uid']; }
if(!$uid) { return; } $db->delete_query("threadsubscriptions", "tid='".$tid."' AND uid='{$uid}'");
return true; }
|
|
/**
|
/**
|
* Adds a forum to a user's forum subscription list.
| * Remove a thread from a user's thread subscription list.
|
* If no uid is supplied, the currently logged in user's id will be used. *
|
* If no uid is supplied, the currently logged in user's id will be used. *
|
* @param int The fid of the forum to add to the list. * @param int (Optional) The uid of the user who's list to update.
| * @param int $tid The tid of the thread to remove from the list. * @param int $uid (Optional) The uid of the user who's list to update.
|
* @return boolean True when success, false when otherwise. */
|
* @return boolean True when success, false when otherwise. */
|
function add_subscribed_forum($fid, $uid="")
| function remove_subscribed_thread($tid, $uid=0)
|
{ global $mybb, $db;
| { global $mybb, $db;
|
Zeile 329 | Zeile 300 |
---|
{ $uid = $mybb->user['uid']; }
|
{ $uid = $mybb->user['uid']; }
|
if(!$uid) { return; }
| if(!$uid) { return false; } $db->delete_query("threadsubscriptions", "tid='".$tid."' AND uid='{$uid}'");
return true; }
/** * Adds a forum to a user's forum subscription list. * If no uid is supplied, the currently logged in user's id will be used. * * @param int $fid The fid of the forum to add to the list. * @param int $uid (Optional) The uid of the user who's list to update. * @return boolean True when success, false when otherwise. */ function add_subscribed_forum($fid, $uid=0) { global $mybb, $db;
if(!$uid) { $uid = $mybb->user['uid']; }
if(!$uid) { return false; }
|
$fid = (int)$fid; $uid = (int)$uid;
| $fid = (int)$fid; $uid = (int)$uid;
|
Zeile 347 | Zeile 344 |
---|
'uid' => $uid ); $db->insert_query("forumsubscriptions", $insert_array);
|
'uid' => $uid ); $db->insert_query("forumsubscriptions", $insert_array);
|
}
| }
|
return true; }
| return true; }
|
Zeile 356 | Zeile 353 |
---|
* Removes a forum from a user's forum subscription list. * If no uid is supplied, the currently logged in user's id will be used. *
|
* Removes a forum from a user's forum subscription list. * If no uid is supplied, the currently logged in user's id will be used. *
|
* @param int The fid of the forum to remove from the list. * @param int (Optional) The uid of the user who's list to update.
| * @param int $fid The fid of the forum to remove from the list. * @param int $uid (Optional) The uid of the user who's list to update.
|
* @return boolean True when success, false when otherwise. */
|
* @return boolean True when success, false when otherwise. */
|
function remove_subscribed_forum($fid, $uid="")
| function remove_subscribed_forum($fid, $uid=0)
|
{ global $mybb, $db;
| { global $mybb, $db;
|
Zeile 371 | Zeile 368 |
---|
if(!$uid) {
|
if(!$uid) {
|
return;
| return false;
|
} $db->delete_query("forumsubscriptions", "fid='".$fid."' AND uid='{$uid}'");
| } $db->delete_query("forumsubscriptions", "fid='".$fid."' AND uid='{$uid}'");
|
Zeile 545 | Zeile 542 |
---|
/** * Gets the usertitle for a specific uid. *
|
/** * Gets the usertitle for a specific uid. *
|
* @param int The uid of the user to get the usertitle of.
| * @param int $uid The uid of the user to get the usertitle of.
|
* @return string The usertitle of the user. */
|
* @return string The usertitle of the user. */
|
function get_usertitle($uid="")
| function get_usertitle($uid=0)
|
{ global $db, $mybb;
| { global $db, $mybb;
|
Zeile 585 | Zeile 582 |
---|
/** * Updates a users private message count in the users table with the number of pms they have. *
|
/** * Updates a users private message count in the users table with the number of pms they have. *
|
* @param int The user id to update the count for. If none, assumes currently logged in user. * @param int Bitwise value for what to update. 1 = total, 2 = new, 4 = unread. Combinations accepted. * @param int The unix timestamp the user with uid last visited. If not specified, will be queried.
| * @param int $uid The user id to update the count for. If none, assumes currently logged in user. * @param int $count_to_update Bitwise value for what to update. 1 = total, 2 = new, 4 = unread. Combinations accepted. * @return array The updated counters
|
*/ function update_pm_count($uid=0, $count_to_update=7) {
| */ function update_pm_count($uid=0, $count_to_update=7) {
|
Zeile 632 | Zeile 629 |
---|
/** * Return the language specific name for a PM folder. *
|
/** * Return the language specific name for a PM folder. *
|
* @param int The ID of the folder. * @param string The folder name - can be blank, will use language default.
| * @param int $fid The ID of the folder. * @param string $name The folder name - can be blank, will use language default.
|
* @return string The name of the folder. */ function get_pm_folder_name($fid, $name="")
| * @return string The name of the folder. */ function get_pm_folder_name($fid, $name="")
|
Zeile 667 | Zeile 664 |
---|
/** * Generates a security question for registration. *
|
/** * Generates a security question for registration. *
|
* @param int Optional ID of the old question.
| * @param int $old_qid Optional ID of the old question.
|
* @return string The question session id. */ function generate_question($old_qid=0)
| * @return string The question session id. */ function generate_question($old_qid=0)
|
Zeile 719 | Zeile 716 |
---|
/** * Check whether we can show the Purge Spammer Feature *
|
/** * Check whether we can show the Purge Spammer Feature *
|
* @param int The users post count * @param int The usergroup of our user * @param int The uid of our user
| * @param int $post_count The users post count * @param int $usergroup The usergroup of our user * @param int $uid The uid of our user
|
* @return boolean Whether or not to show the feature */ function purgespammer_show($post_count, $usergroup, $uid)
| * @return boolean Whether or not to show the feature */ function purgespammer_show($post_count, $usergroup, $uid)
|