Vergleich inc/functions_user.php - 1.8.2 - 1.8.9

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 11Zeile 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 32Zeile 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 49Zeile 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(


$options = array(

		'fields' => array('username', 'password', 'salt', 'loginkey', 'coppauser', 'usergroup'),

		'fields' => '*',

		'username_method' => $mybb->settings['username_method'],
);

$user = get_user_by_username($username, $options);

if(!$user['uid'])

		'username_method' => $mybb->settings['username_method'],
);

$user = get_user_by_username($username, $options);

if(!$user['uid'])

	{
return false;
}

	{
return false;
}


return validate_password_from_uid($user['uid'], $password, $user);
}


return validate_password_from_uid($user['uid'], $password, $user);
}

Zeile 75Zeile 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.
*/
function validate_password_from_uid($uid, $password, $user = array())

 * @return boolean|array False when not valid, user data array when valid.
*/
function validate_password_from_uid($uid, $password, $user = array())

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

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

	}

	}

	if(!$user['password'])

	if(!$user['password'])

	{
$query = $db->simple_select("users", "uid,username,password,salt,loginkey,usergroup", "uid='".(int)$uid."'");
$user = $db->fetch_array($query);

	{
$user = get_user($uid);


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

	}
if(!$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(

		$user['password'] = create_password_hash($user['password'], $user['salt'], $user);
$sql_array = array(

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

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

Zeile 105Zeile 102
	}

if(!$user['loginkey'])

	}

if(!$user['loginkey'])

	{

	{

		$user['loginkey'] = generate_loginkey();
$sql_array = array(
"loginkey" => $user['loginkey']
);
$db->update_query("users", $sql_array, "uid = ".$user['uid']);

		$user['loginkey'] = generate_loginkey();
$sql_array = array(
"loginkey" => $user['loginkey']
);
$db->update_query("users", $sql_array, "uid = ".$user['uid']);

	}
if(salt_password(md5($password), $user['salt']) == $user['password'])
{

	}
if(verify_user_password($user, $password))
{

		return $user;

		return $user;

	}
else
{
return false;
}
}

	}
else
{
return false;
}
}


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

 */
function update_password($uid, $password, $salt="")
{
global $db, $plugins;





	$newpassword = array();

// If no salt was specified, check in database first, if still doesn't exist, create one

	$newpassword = array();

// If no salt was specified, check in database first, if still doesn't exist, create one

Zeile 142Zeile 140
		$query = $db->simple_select("users", "salt", "uid='$uid'");
$user = $db->fetch_array($query);
if($user['salt'])

		$query = $db->simple_select("users", "salt", "uid='$uid'");
$user = $db->fetch_array($query);
if($user['salt'])

		{

		{

			$salt = $user['salt'];

			$salt = $user['salt'];

		}

		}

		else
{
$salt = generate_salt();
}
$newpassword['salt'] = $salt;

		else
{
$salt = generate_salt();
}
$newpassword['salt'] = $salt;

	}


	}


	// Create new password based on salt
$saltedpw = salt_password($password, $salt);


	// Create new password based on salt
$saltedpw = salt_password($password, $salt);


Zeile 166Zeile 164
	$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.
* @param string The salt.















}

/**
* Salts a password based on a supplied salt.
*
* @param string $password The md5()'ed password.
* @param string $salt The salt.
* @return string The password hash.
* @deprecated deprecated since version 1.8.9 Please use other alternatives.
*/
function salt_password($password, $salt)
{
return md5(md5($salt).$password);
}

/**
* Salts a password based on a supplied salt.
*
* @param string $password The input password.
* @param string $salt The salt used by the MyBB algorithm.
* @param string $user (Optional) An array containing password-related data.

 * @return string The password hash.
*/

 * @return string The password hash.
*/

function salt_password($password, $salt)































































function create_password_hash($password, $salt, $user = false)
{
global $plugins;

$hash = null;

$parameters = compact('password', 'salt', 'user', 'hash');

if(!defined('IN_INSTALL') && !defined('IN_UPGRADE'))
{
$plugins->run_hooks('create_password_hash', $parameters);
}

if(!is_null($parameters['hash']))
{
return $parameters['hash'];
}
else
{
return md5(md5($salt).md5($password));
}
}

/**
* Compares user's password data against provided input.
*
* @param array $user An array containing password-related data.
* @param string $password The plain-text input password.
* @return bool Result of the comparison.
*/
function verify_user_password($user, $password)
{
global $plugins;

$result = null;

$parameters = compact('user', 'password', 'result');

if(!defined('IN_INSTALL') && !defined('IN_UPGRADE'))
{
$plugins->run_hooks('verify_user_password', $parameters);
}

if(!is_null($parameters['result']))
{
return $parameters['result'];
}
else
{
$hashed_password = create_password_hash($password, $user['salt'], $user);

return my_hash_equals($user['password'], $hashed_password);
}
}

/**
* Performs a timing attack safe string comparison.
*
* @param string $known_string The first string to be compared.
* @param string $user_string The second, user-supplied string to be compared.
* @return bool Result of the comparison.
*/
function my_hash_equals($known_string, $user_string)

{

{

	return md5(md5($salt).$password);























	if(version_compare(PHP_VERSION, '5.6.0', '>='))
{
return hash_equals($known_string, $user_string);
}
else
{
$known_string_length = my_strlen($known_string);
$user_string_length = my_strlen($user_string);

if($user_string_length != $known_string_length)
{
return false;
}

$result = 0;

for($i = 0; $i < $known_string_length; $i++)
{
$result |= ord($known_string[$i]) ^ ord($user_string[$i]);
}

return $result === 0;
}

}

/**

}

/**

Zeile 198Zeile 294
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)

Zeile 217Zeile 313
	$db->update_query("users", $sql_array, "uid='{$uid}'");

return $salt;

	$db->update_query("users", $sql_array, "uid='{$uid}'");

return $salt;

}

/**

}

/**

 * 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 243Zeile 339
 * 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 270Zeile 366
			'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 283Zeile 377
			"notification" => (int)$notification
);
$db->update_query("threadsubscriptions", $update_array, "uid='{$uid}' AND tid='{$tid}'");

			"notification" => (int)$notification
);
$db->update_query("threadsubscriptions", $update_array, "uid='{$uid}' AND tid='{$tid}'");

	}

	}

	return true;
}


	return true;
}


Zeile 291Zeile 385
 * 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.
*

 * 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.



























 * @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.
*/
function remove_subscribed_thread($tid, $uid=0)
{
global $mybb, $db;

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

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.
*/

 * @return boolean True when success, false when otherwise.
*/

function remove_subscribed_thread($tid, $uid="")

function add_subscribed_forum($fid, $uid=0)

{
global $mybb, $db;


{
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.
* 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.
* @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)
{
return;
}

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

if(!$uid)
{
return false;
}




























$fid = (int)$fid;
$uid = (int)$uid;


$fid = (int)$fid;
$uid = (int)$uid;

Zeile 351Zeile 445

return true;
}


return true;
}





/**
* 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;


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



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


	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 389Zeile 483
	$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

	if($mybb->settings['enablepms'] != 0)

	if($mybb->settings['enablepms'] != 0 && $mybb->usergroup['canusepms'] == 1)

	{
$plugins->add_hook("usercp_menu", "usercp_menu_messenger", 10);
}


	{
$plugins->add_hook("usercp_menu", "usercp_menu_messenger", 10);
}


	$plugins->add_hook("usercp_menu", "usercp_menu_profile", 20);
$plugins->add_hook("usercp_menu", "usercp_menu_misc", 30);





	if($mybb->usergroup['canusercp'] == 1)
{
$plugins->add_hook("usercp_menu", "usercp_menu_profile", 20);
$plugins->add_hook("usercp_menu", "usercp_menu_misc", 30);
}


	// Run the plugin hooks
$plugins->run_hooks("usercp_menu");
global $usercpmenu;

	// Run the plugin hooks
$plugins->run_hooks("usercp_menu");
global $usercpmenu;

 

if($mybb->usergroup['canusercp'] == 1)
{
eval("\$ucp_nav_home = \"".$templates->get("usercp_nav_home")."\";");
}


eval("\$usercpnav = \"".$templates->get("usercp_nav")."\";");



eval("\$usercpnav = \"".$templates->get("usercp_nav")."\";");


Zeile 447Zeile 549
		else
{
$class = "usercp_nav_pmfolder";

		else
{
$class = "usercp_nav_pmfolder";

		}

		}


$folder_id = $folderinfo[0];
$folder_name = $folderinfo[1];


$folder_id = $folderinfo[0];
$folder_name = $folderinfo[1];

Zeile 466Zeile 568
	}

eval("\$usercpmenu .= \"".$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;


	$changenameop = '';
if($mybb->usergroup['canchangename'] != 0)
{

	$changenameop = '';
if($mybb->usergroup['canchangename'] != 0)
{

Zeile 483Zeile 585
	}

$changesigop = '';

	}

$changesigop = '';

	if($mybb->usergroup['canusesig'] == 1 && ($mybb->usergroup['canusesigxposts'] == 0 || $mybb->usergroup['canusesigxposts'] > 0 && $mybb->user['postnum'] > $mybb->usergroup['canusesigxposts']))
{

	if($mybb->usergroup['canusesig'] == 1 && ($mybb->usergroup['canusesigxposts'] == 0 || $mybb->usergroup['canusesigxposts'] > 0 && $mybb->user['postnum'] > $mybb->usergroup['canusesigxposts']))
{

		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")."\";");

		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")."\";");

Zeile 494Zeile 596
	if(!isset($collapsedimg['usercpprofile']))
{
$collapsedimg['usercpprofile'] = '';

	if(!isset($collapsedimg['usercpprofile']))
{
$collapsedimg['usercpprofile'] = '';

	}

	}


if(!isset($collapsed['usercpprofile_e']))
{


if(!isset($collapsed['usercpprofile_e']))
{

Zeile 503Zeile 605

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 521Zeile 623
	if($count > 0)
{
$draftcount = $lang->sprintf($lang->ucp_nav_drafts_active, my_number_format($count));

	if($count > 0)
{
$draftcount = $lang->sprintf($lang->ucp_nav_drafts_active, my_number_format($count));

	}

	}


if($mybb->settings['enableattachments'] != 0)


if($mybb->settings['enableattachments'] != 0)

	{

	{

		eval("\$attachmentop = \"".$templates->get("usercp_nav_attachments")."\";");
}

if(!isset($collapsedimg['usercpmisc']))
{
$collapsedimg['usercpmisc'] = '';

		eval("\$attachmentop = \"".$templates->get("usercp_nav_attachments")."\";");
}

if(!isset($collapsedimg['usercpmisc']))
{
$collapsedimg['usercpmisc'] = '';

	}

	}


if(!isset($collapsed['usercpmisc_e']))
{


if(!isset($collapsed['usercpmisc_e']))
{

Zeile 540Zeile 642

$profile_link = get_profile_link($mybb->user['uid']);
eval("\$usercpmenu .= \"".$templates->get("usercp_nav_misc")."\";");


$profile_link = get_profile_link($mybb->user['uid']);
eval("\$usercpmenu .= \"".$templates->get("usercp_nav_misc")."\";");

}

}


/**
* 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 559Zeile 661
	else
{
$query = $db->simple_select("users", "usertitle,postnum", "uid='$uid'", array('limit' => 1));

	else
{
$query = $db->simple_select("users", "usertitle,postnum", "uid='$uid'", array('limit' => 1));

		$user = $db->fetch_array($query);
}


		$user = $db->fetch_array($query);
}


	if($user['usertitle'])
{
return $user['usertitle'];

	if($user['usertitle'])
{
return $user['usertitle'];

Zeile 574Zeile 676
			if($title['posts'] <= $user['postnum'])
{
$usertitle = $title;

			if($title['posts'] <= $user['postnum'])
{
$usertitle = $title;

 
				break;

			}
}

return $usertitle['title'];
}
}

			}
}

return $usertitle['title'];
}
}





/**
* 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 601Zeile 704
	$uid = (int)$uid;
$pmcount = array();
if($uid == 0)

	$uid = (int)$uid;
$pmcount = array();
if($uid == 0)

	{

	{

		return $pmcount;
}


		return $pmcount;
}


Zeile 611Zeile 714
		$query = $db->simple_select("privatemessages", "COUNT(pmid) AS pms_total", "uid='".$uid."'");
$total = $db->fetch_array($query);
$pmcount['totalpms'] = $total['pms_total'];

		$query = $db->simple_select("privatemessages", "COUNT(pmid) AS pms_total", "uid='".$uid."'");
$total = $db->fetch_array($query);
$pmcount['totalpms'] = $total['pms_total'];

	}


	}


	// Update number of unread messages.
if($count_to_update & 2 && $db->field_exists("unreadpms", "users") == true)
{
$query = $db->simple_select("privatemessages", "COUNT(pmid) AS pms_unread", "uid='".$uid."' AND status='0' AND folder='1'");
$unread = $db->fetch_array($query);
$pmcount['unreadpms'] = $unread['pms_unread'];

	// Update number of unread messages.
if($count_to_update & 2 && $db->field_exists("unreadpms", "users") == true)
{
$query = $db->simple_select("privatemessages", "COUNT(pmid) AS pms_unread", "uid='".$uid."' AND status='0' AND folder='1'");
$unread = $db->fetch_array($query);
$pmcount['unreadpms'] = $unread['pms_unread'];

	}


	}


	if(!empty($pmcount))
{
$db->update_query("users", $pmcount, "uid='".$uid."'");

	if(!empty($pmcount))
{
$db->update_query("users", $pmcount, "uid='".$uid."'");

Zeile 631Zeile 734
/**
* 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 640Zeile 743
	global $lang;

if($name != '')

	global $lang;

if($name != '')

	{

	{

		return $name;
}


		return $name;
}


Zeile 666Zeile 769
/**
* Generates a security question for registration.
*

/**
* Generates a security question for registration.
*

 
 * @param int $old_qid Optional ID of the old question.

 * @return string The question session id.
*/

 * @return string The question session id.
*/

function generate_question()

function generate_question($old_qid=0)

{
global $db;


{
global $db;


Zeile 679Zeile 783
	else
{
$order_by = 'RAND()';

	else
{
$order_by = 'RAND()';

 
	}

if($old_qid)
{
$excl_old = ' AND qid != '.(int)$old_qid;

	}


	}


	$query = $db->simple_select('questions', 'qid, shown', 'active=1', array('limit' => 1, 'order_by' => $order_by));

	$query = $db->simple_select('questions', 'qid, shown', "active=1{$excl_old}", array('limit' => 1, 'order_by' => $order_by));

	$question = $db->fetch_array($query);

if(!$db->num_rows($query))

	$question = $db->fetch_array($query);

if(!$db->num_rows($query))

Zeile 712Zeile 821
/**
* 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)