Vergleich inc/functions_user.php - 1.6.2 - 1.6.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 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 5219 2010-10-01 17:32:12Z Tomm $

 * $Id$

 */

/**

 */

/**

Zeile 40Zeile 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 61Zeile 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 87Zeile 103
function validate_password_from_uid($uid, $password, $user = array())
{
global $db, $mybb;

function validate_password_from_uid($uid, $password, $user = array())
{
global $db, $mybb;

	if($mybb->user['uid'] == $uid)
{

	if(isset($mybb->user['uid']) && $mybb->user['uid'] == $uid)
{

		$user = $mybb->user;
}
if(!$user['password'])

		$user = $mybb->user;
}
if(!$user['password'])

Zeile 101Zeile 117
		// Generate a salt for this user and assume the password stored in db is a plain md5 password
$user['salt'] = generate_salt();
$user['password'] = salt_password($user['password'], $user['salt']);

		// Generate a salt for this user and assume the password stored in db is a plain md5 password
$user['salt'] = generate_salt();
$user['password'] = salt_password($user['password'], $user['salt']);

		$sql_array = array(

		$sql_array = array(

			"salt" => $user['salt'],
"password" => $user['password']
);

			"salt" => $user['salt'],
"password" => $user['password']
);

Zeile 113Zeile 129
		$user['loginkey'] = generate_loginkey();
$sql_array = array(
"loginkey" => $user['loginkey']

		$user['loginkey'] = generate_loginkey();
$sql_array = array(
"loginkey" => $user['loginkey']

		);

		);

		$db->update_query("users", $sql_array, "uid = ".$user['uid'], 1);
}
if(salt_password(md5($password), $user['salt']) == $user['password'])

		$db->update_query("users", $sql_array, "uid = ".$user['uid'], 1);
}
if(salt_password(md5($password), $user['salt']) == $user['password'])

Zeile 253Zeile 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 276Zeile 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);
}
else

		$db->insert_query("threadsubscriptions", $insert_array);
}
else

Zeile 302Zeile 318
function remove_subscribed_thread($tid, $uid="")
{
global $mybb, $db;

function remove_subscribed_thread($tid, $uid="")
{
global $mybb, $db;

	
if(!$uid)

	
if(!$uid)

	{
$uid = $mybb->user['uid'];
}

	{
$uid = $mybb->user['uid'];
}

Zeile 313Zeile 329
		return;
}
$db->delete_query("threadsubscriptions", "tid='".$tid."' AND uid='{$uid}'");

		return;
}
$db->delete_query("threadsubscriptions", "tid='".$tid."' AND uid='{$uid}'");

	
return true;
}

	
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 The fid of the forum to add to the list.


/**
* 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 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 (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="")
{
global $mybb, $db;

 * @return boolean True when success, false when otherwise.
*/
function add_subscribed_forum($fid, $uid="")
{
global $mybb, $db;

	

	

	if(!$uid)
{
$uid = $mybb->user['uid'];

	if(!$uid)
{
$uid = $mybb->user['uid'];

Zeile 365Zeile 381
 * @return boolean True when success, false when otherwise.
*/
function remove_subscribed_forum($fid, $uid="")

 * @return boolean True when success, false when otherwise.
*/
function remove_subscribed_forum($fid, $uid="")

{

{

	global $mybb, $db;

if(!$uid)
{
$uid = $mybb->user['uid'];

	global $mybb, $db;

if(!$uid)
{
$uid = $mybb->user['uid'];

	}

	}

	
if(!$uid)
{

	
if(!$uid)
{

Zeile 389Zeile 405
function usercp_menu()
{
global $mybb, $templates, $theme, $plugins, $lang, $usercpnav, $usercpmenu;

function usercp_menu()
{
global $mybb, $templates, $theme, $plugins, $lang, $usercpnav, $usercpmenu;





	$lang->load("usercpnav");

// Add the default items as plugins with separated priorities of 10

	$lang->load("usercpnav");

// Add the default items as plugins with separated priorities of 10

Zeile 415Zeile 431
 *
*/
function usercp_menu_messenger()

 *
*/
function usercp_menu_messenger()

{
global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;










{
global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;

$usercp_nav_messenger = $templates->get("usercp_nav_messenger");
// Hide tracking link if no permission
$tracking = '';
if($mybb->usergroup['cantrackpms'])
{
$tracking = $templates->get("usercp_nav_messenger_tracking");
}
eval("\$ucp_nav_tracking = \"". $tracking ."\";");





 
	$folderlinks = '';

	$foldersexploded = explode("$%%$", $mybb->user['pmfolders']);
foreach($foldersexploded as $key => $folders)
{

	$foldersexploded = explode("$%%$", $mybb->user['pmfolders']);
foreach($foldersexploded as $key => $folders)
{

Zeile 434Zeile 460
		else
{
$class = "usercp_nav_pmfolder";

		else
{
$class = "usercp_nav_pmfolder";

		}


		}


		$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 .= \"".$usercp_nav_messenger."\";");
}

/**

 * Constructs the usercp profile menu.
*
*/
function usercp_menu_profile()

 * Constructs the usercp profile menu.
*
*/
function usercp_menu_profile()

{
global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;


{
global $db, $mybb, $templates, $theme, $usercpmenu, $lang, $collapsed, $collapsedimg;


	if($mybb->usergroup['canchangename'] != 0)
{
eval("\$changenameop = \"".$templates->get("usercp_nav_changename")."\";");
}


	if($mybb->usergroup['canchangename'] != 0)
{
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")."\";");

Zeile 470Zeile 499
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;

 

$draftstart = $draftend = $draftcount = '';


$query = $db->simple_select("posts", "COUNT(*) AS draftcount", "visible='-2' AND uid='".$mybb->user['uid']."'");
$count = $db->fetch_array($query);


$query = $db->simple_select("posts", "COUNT(*) AS draftcount", "visible='-2' AND uid='".$mybb->user['uid']."'");
$count = $db->fetch_array($query);