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: functions_user.php 5219 2010-10-01 17:32:12Z Tomm $ */
|
/** * 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));
| $query = $db->simple_select("users", "COUNT(*) as user", "LOWER(username)='".$db->escape_string(my_strtolower($username))."'", array('limit' => 1));
|
if($db->fetch_field($query, 'user') == 1) { return true;
| if($db->fetch_field($query, 'user') == 1) { return true;
|
Zeile 51 | Zeile 62 |
---|
function validate_password_from_username($username, $password) { global $db;
|
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));
| $query = $db->simple_select("users", "uid,username,password,salt,loginkey,coppauser,usergroup", "LOWER(username)='".$db->escape_string(my_strtolower($username))."'", array('limit' => 1));
|
$user = $db->fetch_array($query); if(!$user['uid']) {
|
$user = $db->fetch_array($query); if(!$user['uid']) {
|
return false; } else {
| return false; } else {
|
return validate_password_from_uid($user['uid'], $password, $user); } }
| return validate_password_from_uid($user['uid'], $password, $user); } }
|
Zeile 94 | Zeile 106 |
---|
"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 128 |
---|
/** * 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 170 |
---|
$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 186 |
---|
/** * 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 300 |
---|
* @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 455 |
---|
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->user['suspendsignature'] == 0 || $mybb->user['suspendsignature'] == 1 && $mybb->user['suspendsigtime'] > 0 && $mybb->user['suspendsigtime'] < TIME_NOW)
|
{ eval("\$changesigop = \"".$templates->get("usercp_nav_editsignature")."\";"); }
| { eval("\$changesigop = \"".$templates->get("usercp_nav_editsignature")."\";"); }
|
Zeile 458 | Zeile 470 |
---|
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")."\";"); }
|