Zeile 1 | Zeile 1 |
---|
<?php
|
<?php
|
| /** * MyBB 1.6 * Copyright 2010 MyBB Group, All Rights Reserved * * Website: http://mybb.com * License: http://mybb.com/about/license * * $Id$ */
|
/** * Checks if a user with uid $uid exists in the database.
| /** * Checks if a user with uid $uid exists in the database.
|
Zeile 11 | Zeile 20 |
---|
global $db; $query = $db->simple_select("users", "COUNT(*) as user", "uid='".intval($uid)."'", array('limit' => 1));
|
global $db; $query = $db->simple_select("users", "COUNT(*) as user", "uid='".intval($uid)."'", array('limit' => 1));
|
if($db->fetch_field($query, 'user') == 1) { return true; } else { return false; } }
| if($db->fetch_field($query, 'user') == 1) { return true; } else { return false; } }
|
/** * Checks if $username already exists in the database. *
| /** * Checks if $username already exists in the database. *
|
Zeile 30 | Zeile 39 |
---|
function username_exists($username) { global $db;
|
function username_exists($username) { global $db;
|
$query = $db->simple_select("users", "COUNT(*) as user", "username='".$db->escape_string($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) { return true;
| if($db->fetch_field($query, 'user') == 1) { return true;
|
Zeile 50 | Zeile 62 |
---|
*/ function validate_password_from_username($username, $password) {
|
*/ function validate_password_from_username($username, $password) {
|
global $db; $query = $db->simple_select("users", "uid,username,password,salt,loginkey,coppauser,usergroup", "username='".$db->escape_string($username)."'", array('limit' => 1)); $user = $db->fetch_array($query); if(!$user['uid'])
| global $db, $mybb;
$username = $db->escape_string(my_strtolower($username)); switch($mybb->settings['username_method'])
|
{
|
{
|
return false;
| 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;
|
}
|
}
|
else
| $user = $db->fetch_array($query); if(!$user['uid']) { return false; } else
|
{ return validate_password_from_uid($user['uid'], $password, $user); }
| { return validate_password_from_uid($user['uid'], $password, $user); }
|
Zeile 94 | Zeile 122 |
---|
"password" => $user['password'] ); $db->update_query("users", $sql_array, "uid='".$user['uid']."'", 1);
|
"password" => $user['password'] ); $db->update_query("users", $sql_array, "uid='".$user['uid']."'", 1);
|
}
| }
|
if(!$user['loginkey']) { $user['loginkey'] = generate_loginkey();
| if(!$user['loginkey']) { $user['loginkey'] = generate_loginkey();
|
Zeile 116 | Zeile 144 |
---|
/** * 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 The user's id. * @param string The md5()'ed password. * @param string (Optional) The salt of the user.
|
Zeile 158 | Zeile 186 |
---|
$plugins->run_hooks("password_changed");
return $newpassword;
|
$plugins->run_hooks("password_changed");
return $newpassword;
|
}
/**
| }
/**
|
* Salts a password based on a supplied salt. * * @param string The md5()'ed password.
| * Salts a password based on a supplied salt. * * @param string The md5()'ed password.
|
Zeile 174 | Zeile 202 |
---|
/** * Generates a random salt
|
/** * Generates a random salt
|
*
| *
|
* @return string The salt. */ function generate_salt()
| * @return string The salt. */ function generate_salt()
|
Zeile 288 | 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;
| { global $mybb, $db;
|
if(!$uid) { $uid = $mybb->user['uid'];
| if(!$uid) { $uid = $mybb->user['uid'];
|
Zeile 443 | Zeile 471 |
---|
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'] < 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")."\";"); }
|
|
|
/** * Constructs the usercp misc menu. *
| /** * Constructs the usercp misc menu. *
|
Zeile 458 | Zeile 489 |
---|
function usercp_menu_misc() { global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;
|
function usercp_menu_misc() { global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;
|
| $query = $db->simple_select("posts", "COUNT(*) AS draftcount", "visible='-2' AND uid='".$mybb->user['uid']."'"); $count = $db->fetch_array($query);
|
if($count['draftcount'] > 0) { $draftstart = "<strong>"; $draftend = "</strong>";
|
if($count['draftcount'] > 0) { $draftstart = "<strong>"; $draftend = "</strong>";
|
| $draftcount = "(".my_number_format($count['draftcount']).")";
|
}
|
}
|
|
|
$profile_link = get_profile_link($mybb->user['uid']);
|
$profile_link = get_profile_link($mybb->user['uid']);
|
| |
eval("\$usercpmenu .= \"".$templates->get("usercp_nav_misc")."\";"); }
| eval("\$usercpmenu .= \"".$templates->get("usercp_nav_misc")."\";"); }
|