Vergleich inc/functions.php - 1.8.34 - 1.8.37

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 2611Zeile 2611
	}

return $out;

	}

return $out;

 
}

/**
* Unserializes data using PHP's `unserialize()`, and its safety options if possible.
* This function should only be used for values from trusted sources.
*
* @param string $str
* @return mixed
*/
function native_unserialize($str)
{
if(version_compare(PHP_VERSION, '7.0.0', '>='))
{
return unserialize($str, array('allowed_classes' => false));
}
else
{
return unserialize($str);
}

}

/**

}

/**

Zeile 2745Zeile 2764
			if(!is_array($serverload))
{
return $lang->unknown;

			if(!is_array($serverload))
{
return $lang->unknown;

			}
}
}
else
{

			}
}
}
else
{

		return $lang->unknown;
}

		return $lang->unknown;
}





	$returnload = trim($serverload[0]);

return $returnload;

	$returnload = trim($serverload[0]);

return $returnload;

}

/**

}

/**

 * Returns the amount of memory allocated to the script.
*
* @return int The amount of memory allocated to the script.

 * Returns the amount of memory allocated to the script.
*
* @return int The amount of memory allocated to the script.

Zeile 2766Zeile 2785
function get_memory_usage()
{
if(function_exists('memory_get_peak_usage'))

function get_memory_usage()
{
if(function_exists('memory_get_peak_usage'))

	{

	{

		return memory_get_peak_usage(true);

		return memory_get_peak_usage(true);

	}

	}

	elseif(function_exists('memory_get_usage'))
{
return memory_get_usage(true);
}
return false;
}

	elseif(function_exists('memory_get_usage'))
{
return memory_get_usage(true);
}
return false;
}





/**
* Updates the forum statistics with specific values (or addition/subtraction of the previous value)
*

/**
* Updates the forum statistics with specific values (or addition/subtraction of the previous value)
*

Zeile 2791Zeile 2810
	{
// Update stats after all changes are done
add_shutdown('update_stats', array(array(), true));

	{
// Update stats after all changes are done
add_shutdown('update_stats', array(array(), true));

	}


	}


	if(empty($stats_changes) || $stats_changes['inserted'])
{
$stats_changes = array(

	if(empty($stats_changes) || $stats_changes['inserted'])
{
$stats_changes = array(

Zeile 2817Zeile 2836
		}
$stats = $cache->read("stats");
$changes = $stats_changes;

		}
$stats = $cache->read("stats");
$changes = $stats_changes;

	}

	}

	else
{
$stats = $stats_changes;

	else
{
$stats = $stats_changes;

Zeile 2938Zeile 2957
				if((int)$changes[$counter] != 0)
{
$update_query[$counter] = $forum[$counter] + $changes[$counter];

				if((int)$changes[$counter] != 0)
{
$update_query[$counter] = $forum[$counter] + $changes[$counter];

				}
}
else
{
$update_query[$counter] = $changes[$counter];
}

// Less than 0? That's bad
if(isset($update_query[$counter]) && $update_query[$counter] < 0)
{
$update_query[$counter] = 0;
}
}
}

// Only update if we're actually doing something

				}
}
else
{
$update_query[$counter] = $changes[$counter];
}

// Less than 0? That's bad
if(isset($update_query[$counter]) && $update_query[$counter] < 0)
{
$update_query[$counter] = 0;
}
}
}

// Only update if we're actually doing something

	if(count($update_query) > 0)
{
$db->update_query("forums", $update_query, "fid='".(int)$fid."'");

	if(count($update_query) > 0)
{
$db->update_query("forums", $update_query, "fid='".(int)$fid."'");

Zeile 2962Zeile 2981
	// Guess we should update the statistics too?
$new_stats = array();
if(array_key_exists('threads', $update_query))

	// Guess we should update the statistics too?
$new_stats = array();
if(array_key_exists('threads', $update_query))

	{

	{

		$threads_diff = $update_query['threads'] - $forum['threads'];
if($threads_diff > -1)
{

		$threads_diff = $update_query['threads'] - $forum['threads'];
if($threads_diff > -1)
{

Zeile 3004Zeile 3023
	{
$unapprovedposts_diff = $update_query['unapprovedposts'] - $forum['unapprovedposts'];
if($unapprovedposts_diff > -1)

	{
$unapprovedposts_diff = $update_query['unapprovedposts'] - $forum['unapprovedposts'];
if($unapprovedposts_diff > -1)

		{

		{

			$new_stats['numunapprovedposts'] = "+{$unapprovedposts_diff}";
}
else

			$new_stats['numunapprovedposts'] = "+{$unapprovedposts_diff}";
}
else

Zeile 3019Zeile 3038
		if($deletedposts_diff > -1)
{
$new_stats['numdeletedposts'] = "+{$deletedposts_diff}";

		if($deletedposts_diff > -1)
{
$new_stats['numdeletedposts'] = "+{$deletedposts_diff}";

		}
else
{

		}
else
{

			$new_stats['numdeletedposts'] = "{$deletedposts_diff}";
}
}

			$new_stats['numdeletedposts'] = "{$deletedposts_diff}";
}
}

Zeile 3158Zeile 3177

// If this is a moved thread marker, don't update it - we need it to stay as it is
if(strpos($thread['closed'], 'moved|') !== false)


// If this is a moved thread marker, don't update it - we need it to stay as it is
if(strpos($thread['closed'], 'moved|') !== false)

	{
return;
}


	{
return;
}


	$query = $db->query("
SELECT u.uid, u.username, p.username AS postusername, p.dateline
FROM ".TABLE_PREFIX."posts p

	$query = $db->query("
SELECT u.uid, u.username, p.username AS postusername, p.dateline
FROM ".TABLE_PREFIX."posts p

Zeile 3236Zeile 3255
	// Fetch above counters for this user
$query = $db->simple_select("users", implode(",", $counters), "uid='{$uid}'");
$user = $db->fetch_array($query);

	// Fetch above counters for this user
$query = $db->simple_select("users", implode(",", $counters), "uid='{$uid}'");
$user = $db->fetch_array($query);


foreach($counters as $counter)

	
if($user)

	{

	{

		if(array_key_exists($counter, $changes))

		foreach($counters as $counter)

		{

		{

			if(substr($changes[$counter], 0, 2) == "+-")
{
$changes[$counter] = substr($changes[$counter], 1);
}
// Adding or subtracting from previous value?
if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")

			if(array_key_exists($counter, $changes))






			{

			{

				if((int)$changes[$counter] != 0)

				if(substr($changes[$counter], 0, 2) == "+-")

				{

				{

					$update_query[$counter] = $user[$counter] + $changes[$counter];













					$changes[$counter] = substr($changes[$counter], 1);
}
// Adding or subtracting from previous value?
if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
{
if((int)$changes[$counter] != 0)
{
$update_query[$counter] = $user[$counter] + $changes[$counter];
}
}
else
{
$update_query[$counter] = $changes[$counter];

				}

				}

			}
else
{
$update_query[$counter] = $changes[$counter];
}

 




			// Less than 0? That's bad
if(isset($update_query[$counter]) && $update_query[$counter] < 0)
{
$update_query[$counter] = 0;


				// Less than 0? That's bad
if(isset($update_query[$counter]) && $update_query[$counter] < 0)
{
$update_query[$counter] = 0;
}

			}
}
}

			}
}
}

Zeile 3270Zeile 3292

// Only update if we're actually doing something
if(count($update_query) > 0)


// Only update if we're actually doing something
if(count($update_query) > 0)

	{

	{

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

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

Zeile 3282Zeile 3304
 * @return bool
*/
function delete_thread($tid)

 * @return bool
*/
function delete_thread($tid)

{
global $moderation;

if(!is_object($moderation))
{
require_once MYBB_ROOT."inc/class_moderation.php";

{
global $moderation;

if(!is_object($moderation))
{
require_once MYBB_ROOT."inc/class_moderation.php";

		$moderation = new Moderation;
}


		$moderation = new Moderation;
}


Zeile 3303Zeile 3325
function delete_post($pid)
{
global $moderation;

function delete_post($pid)
{
global $moderation;





	if(!is_object($moderation))
{
require_once MYBB_ROOT."inc/class_moderation.php";

	if(!is_object($moderation))
{
require_once MYBB_ROOT."inc/class_moderation.php";

Zeile 3311Zeile 3333
	}

return $moderation->delete_post($pid);

	}

return $moderation->delete_post($pid);

}

}


/**
* Builds a forum jump menu


/**
* Builds a forum jump menu

Zeile 3344Zeile 3366
			if($forum['active'] != 0)
{
$jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

			if($forum['active'] != 0)
{
$jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

			}
}

			}
}

	}

if(!is_array($permissioncache))

	}

if(!is_array($permissioncache))

Zeile 3371Zeile 3393
					}

$forum['name'] = htmlspecialchars_uni(strip_tags($forum['name']));

					}

$forum['name'] = htmlspecialchars_uni(strip_tags($forum['name']));





					eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";");

if($forum_cache[$forum['fid']])

					eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";");

if($forum_cache[$forum['fid']])

Zeile 3380Zeile 3402
						$forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);
}
}

						$forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);
}
}

			}
}

			}
}

	}

if($addselect)

	}

if($addselect)

Zeile 3408Zeile 3430
	}

return $forumjump;

	}

return $forumjump;

}

}


/**
* Returns the extension of a file.


/**
* Returns the extension of a file.

Zeile 3451Zeile 3473
	for($i = 0; $i < $length; ++$i)
{
$str[] = $set[my_rand(0, 61)];

	for($i = 0; $i < $length; ++$i)
{
$str[] = $set[my_rand(0, 61)];

	}

	}


// Make sure they're in random order and convert them to a string
shuffle($str);


// Make sure they're in random order and convert them to a string
shuffle($str);

Zeile 3591Zeile 3613
			}
}
}

			}
}
}





	$avatars[$avatar][$key][$key2] = array(
'image' => htmlspecialchars_uni($mybb->get_asset_url($avatar)),
'width_height' => $avatar_width_height

	$avatars[$avatar][$key][$key2] = array(
'image' => htmlspecialchars_uni($mybb->get_asset_url($avatar)),
'width_height' => $avatar_width_height

Zeile 3728Zeile 3750
					{
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
$smiliecache[$smilie['sid']] = $smilie;

					{
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
$smiliecache[$smilie['sid']] = $smilie;

					}
}


					}
}


				if($mybb->settings['smilieinserter'] && $mybb->settings['smilieinsertercols'] && $mybb->settings['smilieinsertertot'] && !empty($smiliecache))
{
$emoticon = ",emoticon";

				if($mybb->settings['smilieinserter'] && $mybb->settings['smilieinsertercols'] && $mybb->settings['smilieinsertertot'] && !empty($smiliecache))
{
$emoticon = ",emoticon";

Zeile 3757Zeile 3779
						$find = str_replace(array('\\', '"'), array('\\\\', '\"'), htmlspecialchars_uni($smilie['find']));
$image = htmlspecialchars_uni($mybb->get_asset_url($smilie['image']));
$image = str_replace(array('\\', '"'), array('\\\\', '\"'), $image);

						$find = str_replace(array('\\', '"'), array('\\\\', '\"'), htmlspecialchars_uni($smilie['find']));
$image = htmlspecialchars_uni($mybb->get_asset_url($smilie['image']));
$image = str_replace(array('\\', '"'), array('\\\\', '\"'), $image);





						if(!$mybb->settings['smilieinserter'] || !$mybb->settings['smilieinsertercols'] || !$mybb->settings['smilieinsertertot'] || !$smilie['showclickable'])
{
$hiddensmilies .= '"'.$find.'": "'.$image.'",';

						if(!$mybb->settings['smilieinserter'] || !$mybb->settings['smilieinsertercols'] || !$mybb->settings['smilieinsertertot'] || !$smilie['showclickable'])
{
$hiddensmilies .= '"'.$find.'": "'.$image.'",';

Zeile 3792Zeile 3814
			if($mybb->settings['allowalignmycode'] == 1)
{
$align = "left,center,right,justify|";

			if($mybb->settings['allowalignmycode'] == 1)
{
$align = "left,center,right,justify|";

			}


			}


			if($mybb->settings['allowfontmycode'] == 1)

			if($mybb->settings['allowfontmycode'] == 1)

			{

			{

				$font = "font,";
}

if($mybb->settings['allowsizemycode'] == 1)

				$font = "font,";
}

if($mybb->settings['allowsizemycode'] == 1)

			{

			{

				$size = "size,";

				$size = "size,";

			}


			}


			if($mybb->settings['allowcolormycode'] == 1)
{
$color = "color,";

			if($mybb->settings['allowcolormycode'] == 1)
{
$color = "color,";

			}


			}


			if($mybb->settings['allowfontmycode'] == 1 || $mybb->settings['allowsizemycode'] == 1 || $mybb->settings['allowcolormycode'] == 1)

			if($mybb->settings['allowfontmycode'] == 1 || $mybb->settings['allowsizemycode'] == 1 || $mybb->settings['allowcolormycode'] == 1)

			{

			{

				$removeformat = "removeformat|";
}

if($mybb->settings['allowemailmycode'] == 1)
{
$email = "email,";

				$removeformat = "removeformat|";
}

if($mybb->settings['allowemailmycode'] == 1)
{
$email = "email,";

			}


			}


			if($mybb->settings['allowlinkmycode'] == 1)
{
$link = "link,unlink";
}

if($mybb->settings['allowlistmycode'] == 1)

			if($mybb->settings['allowlinkmycode'] == 1)
{
$link = "link,unlink";
}

if($mybb->settings['allowlistmycode'] == 1)

			{

			{

				$list = "bulletlist,orderedlist|";
}


				$list = "bulletlist,orderedlist|";
}


Zeile 3869Zeile 3891
	if(!(int)$tid || (int)$tid <= 0)
{
return $subscription_methods[$subscription_method];

	if(!(int)$tid || (int)$tid <= 0)
{
return $subscription_methods[$subscription_method];

	}


	}


	// If method not predefined set using data from database
if(isset($postoptions['subscriptionmethod']))
{

	// If method not predefined set using data from database
if(isset($postoptions['subscriptionmethod']))
{

Zeile 3884Zeile 3906
		$query = $db->simple_select("threadsubscriptions", "tid, notification", "tid='".(int)$tid."' AND uid='".$mybb->user['uid']."'", array('limit' => 1));
$subscription = $db->fetch_array($query);


		$query = $db->simple_select("threadsubscriptions", "tid, notification", "tid='".(int)$tid."' AND uid='".$mybb->user['uid']."'", array('limit' => 1));
$subscription = $db->fetch_array($query);


		if(!empty($subscription) && $subscription['tid'])

		if($subscription)

		{
$subscription_method = (int)$subscription['notification'] + 1;
}

		{
$subscription_method = (int)$subscription['notification'] + 1;
}

Zeile 4010Zeile 4032
	if(is_array($prefixes_cache))
{
if($pid > 0 && is_array($prefixes_cache[$pid]))

	if(is_array($prefixes_cache))
{
if($pid > 0 && is_array($prefixes_cache[$pid]))

		{

		{

			return $prefixes_cache[$pid];

			return $prefixes_cache[$pid];

		}

return $prefixes_cache;
}

$prefix_cache = $cache->read("threadprefixes");


		}

return $prefixes_cache;
}

$prefix_cache = $cache->read("threadprefixes");


	if(!is_array($prefix_cache))
{
// No cache

	if(!is_array($prefix_cache))
{
// No cache

Zeile 4034Zeile 4056
	foreach($prefix_cache as $prefix)
{
$prefixes_cache[$prefix['pid']] = $prefix;

	foreach($prefix_cache as $prefix)
{
$prefixes_cache[$prefix['pid']] = $prefix;

	}


	}


	if($pid != 0 && is_array($prefixes_cache[$pid]))

	if($pid != 0 && is_array($prefixes_cache[$pid]))

	{

	{

		return $prefixes_cache[$pid];
}
else if(!empty($prefixes_cache))
{
return $prefixes_cache;

		return $prefixes_cache[$pid];
}
else if(!empty($prefixes_cache))
{
return $prefixes_cache;

	}

	}


return false;
}


return false;
}

Zeile 4060Zeile 4082
function build_prefix_select($fid, $selected_pid=0, $multiple=0, $previous_pid=0)
{
global $cache, $db, $lang, $mybb, $templates;

function build_prefix_select($fid, $selected_pid=0, $multiple=0, $previous_pid=0)
{
global $cache, $db, $lang, $mybb, $templates;





	if($fid != 'all')
{
$fid = (int)$fid;

	if($fid != 'all')
{
$fid = (int)$fid;

Zeile 4078Zeile 4100
	foreach($prefix_cache as $prefix)
{
if($fid != "all" && $prefix['forums'] != "-1")

	foreach($prefix_cache as $prefix)
{
if($fid != "all" && $prefix['forums'] != "-1")

		{
// Decide whether this prefix can be used in our forum
$forums = explode(",", $prefix['forums']);

		{
// Decide whether this prefix can be used in our forum
$forums = explode(",", $prefix['forums']);


if(!in_array($fid, $forums) && $prefix['pid'] != $previous_pid)
{


if(!in_array($fid, $forums) && $prefix['pid'] != $previous_pid)
{

Zeile 4107Zeile 4129
	{
$any_selected = "";
if($selected_pid == 'any')

	{
$any_selected = "";
if($selected_pid == 'any')

		{

		{

			$any_selected = " selected=\"selected\"";
}
}

			$any_selected = " selected=\"selected\"";
}
}

Zeile 4133Zeile 4155
	if($multiple != 0)
{
eval("\$prefixselect = \"".$templates->get("post_prefixselect_multiple")."\";");

	if($multiple != 0)
{
eval("\$prefixselect = \"".$templates->get("post_prefixselect_multiple")."\";");

	}

	}

	else
{
eval("\$prefixselect = \"".$templates->get("post_prefixselect_single")."\";");

	else
{
eval("\$prefixselect = \"".$templates->get("post_prefixselect_single")."\";");

Zeile 4150Zeile 4172
 *  @return string The thread prefix selection menu
*/
function build_forum_prefix_select($fid, $selected_pid=0)

 *  @return string The thread prefix selection menu
*/
function build_forum_prefix_select($fid, $selected_pid=0)

{

{

	global $cache, $db, $lang, $mybb, $templates;

$fid = (int)$fid;

	global $cache, $db, $lang, $mybb, $templates;

$fid = (int)$fid;

Zeile 4167Zeile 4189
	foreach($prefix_cache as $prefix)
{
if($prefix['forums'] != "-1")

	foreach($prefix_cache as $prefix)
{
if($prefix['forums'] != "-1")

		{

		{

			// Decide whether this prefix can be used in our forum
$forums = explode(",", $prefix['forums']);


			// Decide whether this prefix can be used in our forum
$forums = explode(",", $prefix['forums']);


Zeile 4176Zeile 4198
				// This forum can use this prefix!
$prefixes[$prefix['pid']] = $prefix;
}

				// This forum can use this prefix!
$prefixes[$prefix['pid']] = $prefix;
}

		}

		}

		else
{
// This prefix is for anybody to use...

		else
{
// This prefix is for anybody to use...

Zeile 4193Zeile 4215
	$selected_pid = (int)$selected_pid;

if($selected_pid == 0)

	$selected_pid = (int)$selected_pid;

if($selected_pid == 0)

	{

	{

		$default_selected['all'] = ' selected="selected"';
}
else if($selected_pid == -1)

		$default_selected['all'] = ' selected="selected"';
}
else if($selected_pid == -1)

Zeile 4220Zeile 4242

eval('$prefixselect = "'.$templates->get("forumdisplay_threadlist_prefixes").'";');
return $prefixselect;


eval('$prefixselect = "'.$templates->get("forumdisplay_threadlist_prefixes").'";');
return $prefixselect;

}

}


/**
* Gzip encodes text to a specified level


/**
* Gzip encodes text to a specified level

Zeile 4228Zeile 4250
 * @param string $contents The string to encode
* @param int $level The level (1-9) to encode at
* @return string The encoded string

 * @param string $contents The string to encode
* @param int $level The level (1-9) to encode at
* @return string The encoded string

 */

 */

function gzip_encode($contents, $level=1)
{
if(function_exists("gzcompress") && function_exists("crc32") && !headers_sent() && !(ini_get('output_buffering') && my_strpos(' '.ini_get('output_handler'), 'ob_gzhandler')))

function gzip_encode($contents, $level=1)
{
if(function_exists("gzcompress") && function_exists("crc32") && !headers_sent() && !(ini_get('output_buffering') && my_strpos(' '.ini_get('output_handler'), 'ob_gzhandler')))

Zeile 4289Zeile 4311
	{
$fid = (int)$data['fid'];
unset($data['fid']);

	{
$fid = (int)$data['fid'];
unset($data['fid']);

	}

	}


$tid = 0;
if(isset($data['tid']))


$tid = 0;
if(isset($data['tid']))

Zeile 6524Zeile 6546
 * @return string The URL of the event
*/
function get_event_link($eid)

 * @return string The URL of the event
*/
function get_event_link($eid)

{

{

	$link = str_replace("{eid}", $eid, EVENT_URL);
return htmlspecialchars_uni($link);
}

/**
* Build the link to a specified date on the calendar

	$link = str_replace("{eid}", $eid, EVENT_URL);
return htmlspecialchars_uni($link);
}

/**
* Build the link to a specified date on the calendar

 *
* @param int $calendar The ID of the calendar

 *
* @param int $calendar The ID of the calendar

 * @param int $year The year
* @param int $month The month
* @param int $day The day (optional)

 * @param int $year The year
* @param int $month The month
* @param int $day The day (optional)

Zeile 6541Zeile 6563
function get_calendar_link($calendar, $year=0, $month=0, $day=0)
{
if($day > 0)

function get_calendar_link($calendar, $year=0, $month=0, $day=0)
{
if($day > 0)

	{

	{

		$link = str_replace("{month}", $month, CALENDAR_URL_DAY);
$link = str_replace("{year}", $year, $link);
$link = str_replace("{day}", $day, $link);

		$link = str_replace("{month}", $month, CALENDAR_URL_DAY);
$link = str_replace("{year}", $year, $link);
$link = str_replace("{day}", $day, $link);

Zeile 6594Zeile 6616
{
global $mybb, $db;
static $user_cache;

{
global $mybb, $db;
static $user_cache;





	$uid = (int)$uid;

if(!empty($mybb->user) && $uid == $mybb->user['uid'])

	$uid = (int)$uid;

if(!empty($mybb->user) && $uid == $mybb->user['uid'])

	{

	{

		return $mybb->user;
}
elseif(isset($user_cache[$uid]))

		return $mybb->user;
}
elseif(isset($user_cache[$uid]))

	{

	{

		return $user_cache[$uid];
}
elseif($uid > 0)

		return $user_cache[$uid];
}
elseif($uid > 0)

Zeile 6611Zeile 6633
		$user_cache[$uid] = $db->fetch_array($query);

return $user_cache[$uid];

		$user_cache[$uid] = $db->fetch_array($query);

return $user_cache[$uid];

	}

	}

	return array();
}


	return array();
}


Zeile 6643Zeile 6665
		default:
$field = 'LOWER(username)';
$efield = 'LOWER(email)';

		default:
$field = 'LOWER(username)';
$efield = 'LOWER(email)';

			break;
}


			break;
}


	switch($options['username_method'])
{
case 1:

	switch($options['username_method'])
{
case 1:

Zeile 6663Zeile 6685
	if(isset($options['fields']))
{
$fields = array_merge((array)$options['fields'], $fields);

	if(isset($options['fields']))
{
$fields = array_merge((array)$options['fields'], $fields);

	}


	}


	$query = $db->simple_select('users', implode(',', array_unique($fields)), $sqlwhere, array('limit' => 1));

	$query = $db->simple_select('users', implode(',', array_unique($fields)), $sqlwhere, array('limit' => 1));





	if(isset($options['exists']))
{
return (bool)$db->num_rows($query);

	if(isset($options['exists']))
{
return (bool)$db->num_rows($query);

	}


	}


	return $db->fetch_array($query);
}


	return $db->fetch_array($query);
}


Zeile 6688Zeile 6710
	static $forum_cache;

if(!isset($forum_cache) || !is_array($forum_cache))

	static $forum_cache;

if(!isset($forum_cache) || !is_array($forum_cache))

	{

	{

		$forum_cache = $cache->read("forums");
}


		$forum_cache = $cache->read("forums");
}


Zeile 6714Zeile 6736

return $forum_cache[$fid];
}


return $forum_cache[$fid];
}





/**
* Get the thread of a thread id.
*

/**
* Get the thread of a thread id.
*

Zeile 6732Zeile 6754
	if(isset($thread_cache[$tid]) && !$recache)
{
return $thread_cache[$tid];

	if(isset($thread_cache[$tid]) && !$recache)
{
return $thread_cache[$tid];

	}
else
{

	}
else
{

		$query = $db->simple_select("threads", "*", "tid = '{$tid}'");
$thread = $db->fetch_array($query);


		$query = $db->simple_select("threads", "*", "tid = '{$tid}'");
$thread = $db->fetch_array($query);


Zeile 6742Zeile 6764
		{
$thread_cache[$tid] = $thread;
return $thread;

		{
$thread_cache[$tid] = $thread;
return $thread;

		}
else

		}
else

		{
$thread_cache[$tid] = false;
return false;

		{
$thread_cache[$tid] = false;
return false;

Zeile 6769Zeile 6791
		return $post_cache[$pid];
}
else

		return $post_cache[$pid];
}
else

	{

	{

		$query = $db->simple_select("posts", "*", "pid = '{$pid}'");
$post = $db->fetch_array($query);


		$query = $db->simple_select("posts", "*", "pid = '{$pid}'");
$post = $db->fetch_array($query);


Zeile 6803Zeile 6825
	$inactive = array();

foreach($forum_cache as $fid => $forum)

	$inactive = array();

foreach($forum_cache as $fid => $forum)

	{

	{

		if($forum['active'] == 0)
{
$inactive[] = $fid;

		if($forum['active'] == 0)
{
$inactive[] = $fid;

Zeile 6845Zeile 6867
		if($attempts['loginattempts'] <= 0)
{
return 0;

		if($attempts['loginattempts'] <= 0)
{
return 0;

		}
}

		}
}

	// This user has a cookie lockout, show waiting time
elseif(!empty($mybb->cookies['lockoutexpiry']) && $mybb->cookies['lockoutexpiry'] > $now)
{

	// This user has a cookie lockout, show waiting time
elseif(!empty($mybb->cookies['lockoutexpiry']) && $mybb->cookies['lockoutexpiry'] > $now)
{

Zeile 6873Zeile 6895
			// Add a cookie lockout. This is used to prevent access to the login page immediately.
// A deep lockout is issued if he tries to login into a locked out account
my_setcookie('lockoutexpiry', $attempts['loginlockoutexpiry']);

			// Add a cookie lockout. This is used to prevent access to the login page immediately.
// A deep lockout is issued if he tries to login into a locked out account
my_setcookie('lockoutexpiry', $attempts['loginlockoutexpiry']);





			$db->update_query("users", array(
"loginlockoutexpiry" => $attempts['loginlockoutexpiry']
), "uid='{$uid}'");

			$db->update_query("users", array(
"loginlockoutexpiry" => $attempts['loginlockoutexpiry']
), "uid='{$uid}'");

Zeile 6899Zeile 6921
				$secsleft = floor($secsleft % 60);

error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft));

				$secsleft = floor($secsleft % 60);

error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft));

			}

			}


return false;
}


return false;
}

Zeile 6916Zeile 6938

// Wipe the cookie, no matter if a guest or a member
my_unsetcookie('lockoutexpiry');


// Wipe the cookie, no matter if a guest or a member
my_unsetcookie('lockoutexpiry');





			return 0;
}

			return 0;
}

	}

	}


if(!isset($attempts['loginattempts']))
{
$attempts['loginattempts'] = 0;
}


if(!isset($attempts['loginattempts']))
{
$attempts['loginattempts'] = 0;
}





	// User can attempt another login
return $attempts['loginattempts'];
}

	// User can attempt another login
return $attempts['loginattempts'];
}

Zeile 6943Zeile 6965

/**
* Checks to see if the email is already in use by another


/**
* Checks to see if the email is already in use by another

 *

 *

 * @param string $email The email to check.
* @param int $uid User ID of the user (updating only)
* @return boolean True when in use, false when not.

 * @param string $email The email to check.
* @param int $uid User ID of the user (updating only)
* @return boolean True when in use, false when not.

Zeile 6951Zeile 6973
function email_already_in_use($email, $uid=0)
{
global $db;

function email_already_in_use($email, $uid=0)
{
global $db;





	$uid_string = "";
if($uid)
{

	$uid_string = "";
if($uid)
{

Zeile 6960Zeile 6982
	$query = $db->simple_select("users", "COUNT(email) as emails", "email = '".$db->escape_string($email)."'{$uid_string}");

if($db->fetch_field($query, "emails") > 0)

	$query = $db->simple_select("users", "COUNT(email) as emails", "email = '".$db->escape_string($email)."'{$uid_string}");

if($db->fetch_field($query, "emails") > 0)

	{

	{

		return true;
}

		return true;
}





	return false;
}

/**
* Rebuilds settings.php

	return false;
}

/**
* Rebuilds settings.php

 *

 *

 */
function rebuild_settings()
{

 */
function rebuild_settings()
{

Zeile 7013Zeile 7035
	}

if(is_array($terms))

	}

if(is_array($terms))

	{

	{

		$terms = implode(' ', $terms);
}


		$terms = implode(' ', $terms);
}


Zeile 7026Zeile 7048
		"~"
);
$terms = str_replace($bad_characters, '', $terms);

		"~"
);
$terms = str_replace($bad_characters, '', $terms);

 
	$words = array();


// Check if this is a "series of words" - should be treated as an EXACT match
if(my_strpos($terms, "\"") !== false)
{
$inquote = false;
$terms = explode("\"", $terms);


// Check if this is a "series of words" - should be treated as an EXACT match
if(my_strpos($terms, "\"") !== false)
{
$inquote = false;
$terms = explode("\"", $terms);

		$words = array();

 
		foreach($terms as $phrase)
{
$phrase = htmlspecialchars_uni($phrase);

		foreach($terms as $phrase)
{
$phrase = htmlspecialchars_uni($phrase);

Zeile 7057Zeile 7079
						}
$words[] = trim($word);
}

						}
$words[] = trim($word);
}

				}
}

				}
}

			$inquote = !$inquote;
}
}

			$inquote = !$inquote;
}
}

Zeile 7078Zeile 7100
				$words[] = trim($word);
}
}

				$words[] = trim($word);
}
}

	}

if(!is_array($words))
{
return false;

 
	}

// Sort the word array by length. Largest terms go first and work their way down to the smallest term.
// This resolves problems like "test tes" where "tes" will be highlighted first, then "test" can't be highlighted because of the changed html
usort($words, 'build_highlight_array_sort');

	}

// Sort the word array by length. Largest terms go first and work their way down to the smallest term.
// This resolves problems like "test tes" where "tes" will be highlighted first, then "test" can't be highlighted because of the changed html
usort($words, 'build_highlight_array_sort');

 

$highlight_cache = array();


// Loop through our words to build the PREG compatible strings
foreach($words as $word)


// Loop through our words to build the PREG compatible strings
foreach($words as $word)