Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: functions_user.php 5380 2011-02-21 12:04:43Z Tomm $
| * $Id$
|
*/
/**
| */
/**
|
Zeile 40 | Zeile 40 |
---|
{ global $db;
|
{ global $db;
|
$query = $db->simple_select("users", "COUNT(*) as user", "LOWER(username)='".$db->escape_string(my_strtolower($username))."'", array('limit' => 1));
| $username = $db->escape_string(my_strtolower($username)); $query = $db->simple_select("users", "COUNT(*) as user", "LOWER(username)='".$username."' OR LOWER(email)='".$username."'", array('limit' => 1));
|
if($db->fetch_field($query, 'user') == 1) {
| if($db->fetch_field($query, 'user') == 1) {
|
Zeile 61 | Zeile 62 |
---|
*/ function validate_password_from_username($username, $password) {
|
*/ function validate_password_from_username($username, $password) {
|
global $db;
| global $db, $mybb;
|
|
|
$query = $db->simple_select("users", "uid,username,password,salt,loginkey,coppauser,usergroup", "LOWER(username)='".$db->escape_string(my_strtolower($username))."'", array('limit' => 1));
| $username = $db->escape_string(my_strtolower($username)); switch($mybb->settings['username_method']) { case 0: $query = $db->simple_select("users", "uid,username,password,salt,loginkey,coppauser,usergroup", "LOWER(username)='".$username."'", array('limit' => 1)); break; case 1: $query = $db->simple_select("users", "uid,username,password,salt,loginkey,coppauser,usergroup", "LOWER(email)='".$username."'", array('limit' => 1)); break; case 2: $query = $db->simple_select("users", "uid,username,password,salt,loginkey,coppauser,usergroup", "LOWER(username)='".$username."' OR LOWER(email)='".$username."'", array('limit' => 1)); break; default: $query = $db->simple_select("users", "uid,username,password,salt,loginkey,coppauser,usergroup", "LOWER(username)='".$username."'", array('limit' => 1)); break; }
|
$user = $db->fetch_array($query); if(!$user['uid'])
| $user = $db->fetch_array($query); if(!$user['uid'])
|
Zeile 160 | Zeile 176 |
---|
$saltedpw = salt_password($password, $salt);
// Generate new login key
|
$saltedpw = salt_password($password, $salt);
// Generate new login key
|
$loginkey = generate_loginkey();
| $loginkey = generate_loginkey();
|
// Update password and login key in database $newpassword['password'] = $saltedpw;
| // Update password and login key in database $newpassword['password'] = $saltedpw;
|
Zeile 209 | Zeile 225 |
---|
* * @param int The uid of the user to update. * @return string The new salt.
|
* * @param int The uid of the user to update. * @return string The new salt.
|
*/
| */
|
function update_salt($uid) { global $db;
| function update_salt($uid) { global $db;
|
Zeile 217 | Zeile 233 |
---|
$salt = generate_salt(); $sql_array = array( "salt" => $salt
|
$salt = generate_salt(); $sql_array = array( "salt" => $salt
|
); $db->update_query("users", $sql_array, "uid='{$uid}'", 1);
| ); $db->update_query("users", $sql_array, "uid='{$uid}'", 1);
|
return $salt; }
/** * Generates a new login key for a user.
|
return $salt; }
/** * Generates a new login key for a user.
|
*
| *
|
* @param int The uid of the user to update. * @return string The new login key. */ function update_loginkey($uid)
|
* @param int The uid of the user to update. * @return string The new login key. */ function update_loginkey($uid)
|
{
| {
|
global $db; $loginkey = generate_loginkey();
| global $db; $loginkey = generate_loginkey();
|
Zeile 253 | Zeile 269 |
---|
* @return boolean True when success, false when otherwise. */ function add_subscribed_thread($tid, $notification=1, $uid="")
|
* @return boolean True when success, false when otherwise. */ function add_subscribed_thread($tid, $notification=1, $uid="")
|
{ global $mybb, $db; if(!$uid) { $uid = $mybb->user['uid']; } if(!$uid) { return; }
| { global $mybb, $db; if(!$uid) { $uid = $mybb->user['uid']; } if(!$uid) { return; }
|
$query = $db->simple_select("threadsubscriptions", "*", "tid='".intval($tid)."' AND uid='".intval($uid)."'", array('limit' => 1)); $subscription = $db->fetch_array($query);
| $query = $db->simple_select("threadsubscriptions", "*", "tid='".intval($tid)."' AND uid='".intval($uid)."'", array('limit' => 1)); $subscription = $db->fetch_array($query);
|
Zeile 276 | Zeile 292 |
---|
'notification' => intval($notification), 'dateline' => TIME_NOW, 'subscriptionkey' => md5(TIME_NOW.$uid.$tid)
|
'notification' => intval($notification), 'dateline' => TIME_NOW, 'subscriptionkey' => md5(TIME_NOW.$uid.$tid)
|
|
|
); $db->insert_query("threadsubscriptions", $insert_array); }
| ); $db->insert_query("threadsubscriptions", $insert_array); }
|
Zeile 300 | Zeile 316 |
---|
* @return boolean True when success, false when otherwise. */ function remove_subscribed_thread($tid, $uid="")
|
* @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)
| { global $mybb, $db; if(!$uid) { $uid = $mybb->user['uid']; } if(!$uid)
|
{ return; }
| { return; }
|
Zeile 406 | Zeile 422 |
---|
global $usercpmenu;
eval("\$usercpnav = \"".$templates->get("usercp_nav")."\";");
|
global $usercpmenu;
eval("\$usercpnav = \"".$templates->get("usercp_nav")."\";");
|
|
|
$plugins->run_hooks("usercp_menu_built"); }
/** * Constructs the usercp messenger menu.
|
$plugins->run_hooks("usercp_menu_built"); }
/** * Constructs the usercp messenger menu.
|
* */
| * */
|
function usercp_menu_messenger() { global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;
| function usercp_menu_messenger() { global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;
|
Zeile 437 | Zeile 453 |
---|
}
$folderlinks .= "<div><a href=\"private.php?fid=$folderinfo[0]\" class=\"usercp_nav_item {$class}\">$folderinfo[1]</a></div>\n";
|
}
$folderlinks .= "<div><a href=\"private.php?fid=$folderinfo[0]\" class=\"usercp_nav_item {$class}\">$folderinfo[1]</a></div>\n";
|
}
| }
|
eval("\$usercpmenu .= \"".$templates->get("usercp_nav_messenger")."\";"); }
| eval("\$usercpmenu .= \"".$templates->get("usercp_nav_messenger")."\";"); }
|
Zeile 449 | Zeile 465 |
---|
function usercp_menu_profile() { global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;
|
function usercp_menu_profile() { global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;
|
|
|
if($mybb->usergroup['canchangename'] != 0)
|
if($mybb->usergroup['canchangename'] != 0)
|
{
| {
|
eval("\$changenameop = \"".$templates->get("usercp_nav_changename")."\";"); }
|
eval("\$changenameop = \"".$templates->get("usercp_nav_changename")."\";"); }
|
if($mybb->user['suspendsignature'] == 0 || $mybb->user['suspendsignature'] == 1 && $mybb->user['suspendsigtime'] > 0 && $mybb->user['suspendsigtime'] < TIME_NOW)
| if($mybb->usergroup['canusesig'] == 1 && ($mybb->usergroup['canusesigxposts'] == 0 || $mybb->usergroup['canusesigxposts'] > 0 && $mybb->user['postnum'] > $mybb->usergroup['canusesigxposts']))
|
{
|
{
|
eval("\$changesigop = \"".$templates->get("usercp_nav_editsignature")."\";");
| if($mybb->user['suspendsignature'] == 0 || $mybb->user['suspendsignature'] == 1 && $mybb->user['suspendsigtime'] > 0 && $mybb->user['suspendsigtime'] < TIME_NOW) { eval("\$changesigop = \"".$templates->get("usercp_nav_editsignature")."\";"); }
|
}
eval("\$usercpmenu .= \"".$templates->get("usercp_nav_profile")."\";");
| }
eval("\$usercpmenu .= \"".$templates->get("usercp_nav_profile")."\";");
|