Vergleich inc/functions.php - 1.8.15 - 1.8.16

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1036Zeile 1036
	{
return '';
}

	{
return '';
}

 

$page = (int)$page;


$url = str_replace("&", "&", $url);
$url = htmlspecialchars_uni($url);


$url = str_replace("&", "&", $url);
$url = htmlspecialchars_uni($url);

Zeile 1063Zeile 1065
	{
$from = 1;
$to = $from+$mybb->settings['maxmultipagelinks']-1;

	{
$from = 1;
$to = $from+$mybb->settings['maxmultipagelinks']-1;

	}


	}


	if($to > $pages)
{
$to = $pages;

	if($to > $pages)
{
$to = $pages;

Zeile 1090Zeile 1092

$page_url = fetch_page_url($url, 1);
eval("\$start = \"".$templates->get("multipage_start")."\";");


$page_url = fetch_page_url($url, 1);
eval("\$start = \"".$templates->get("multipage_start")."\";");

	}


	}


	$mppage = '';
for($i = $from; $i <= $to; ++$i)
{

	$mppage = '';
for($i = $from; $i <= $to; ++$i)
{

Zeile 1131Zeile 1133
		$next = $page+1;
$page_url = fetch_page_url($url, $next);
eval("\$nextpage = \"".$templates->get("multipage_nextpage")."\";");

		$next = $page+1;
$page_url = fetch_page_url($url, $next);
eval("\$nextpage = \"".$templates->get("multipage_nextpage")."\";");

	}


	}


	$jumptopage = '';
if($pages > ($mybb->settings['maxmultipagelinks']+1) && $mybb->settings['jumptopagemultipage'] == 1)
{

	$jumptopage = '';
if($pages > ($mybb->settings['maxmultipagelinks']+1) && $mybb->settings['jumptopagemultipage'] == 1)
{

Zeile 1141Zeile 1143
		eval("\$jumptopage = \"".$templates->get("multipage_jump_page")."\";");
}


		eval("\$jumptopage = \"".$templates->get("multipage_jump_page")."\";");
}


	$lang->multipage_pages = $lang->sprintf($lang->multipage_pages, $pages);


	$multipage_pages = $lang->sprintf($lang->multipage_pages, $pages);


	if($breadcrumb == true)
{
eval("\$multipage = \"".$templates->get("multipage_breadcrumb")."\";");

	if($breadcrumb == true)
{
eval("\$multipage = \"".$templates->get("multipage_breadcrumb")."\";");

	}

	}

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

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

Zeile 1186Zeile 1188
		else
{
$url .= "&amp;";

		else
{
$url .= "&amp;";

		}

		}


$url .= "page=$page";
}


$url .= "page=$page";
}

Zeile 1212Zeile 1214
	if($uid == 0)
{
$uid = $mybb->user['uid'];

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

	}

	}


// User id does not match current user, fetch permissions
if($uid != $mybb->user['uid'])


// User id does not match current user, fetch permissions
if($uid != $mybb->user['uid'])

Zeile 1253Zeile 1255
function usergroup_permissions($gid=0)
{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;

function usergroup_permissions($gid=0)
{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;


if(!is_array($groupscache))


if(!is_array($groupscache))

	{
$groupscache = $cache->read("usergroups");
}

	{
$groupscache = $cache->read("usergroups");
}

Zeile 1282Zeile 1284
			if(!in_array($perm, $grouppermignore))
{
if(isset($usergroup[$perm]))

			if(!in_array($perm, $grouppermignore))
{
if(isset($usergroup[$perm]))

				{

				{

					$permbit = $usergroup[$perm];

					$permbit = $usergroup[$perm];

				}

				}

				else

				else

				{

				{

					$permbit = "";
}


					$permbit = "";
}


Zeile 1295Zeile 1297
				{
$usergroup[$perm] = 0;
continue;

				{
$usergroup[$perm] = 0;
continue;

				}

				}


if($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) // Keep yes/no for compatibility?
{


if($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) // Keep yes/no for compatibility?
{

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

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





	if(!$gid || $gid == 0) // If no group, we need to fetch it
{
if($uid != 0 && $uid != $mybb->user['uid'])

	if(!$gid || $gid == 0) // If no group, we need to fetch it
{
if($uid != 0 && $uid != $mybb->user['uid'])

		{

		{

			$user = get_user($uid);

$gid = $user['usergroup'].",".$user['additionalgroups'];

			$user = get_user($uid);

$gid = $user['usergroup'].",".$user['additionalgroups'];

Zeile 1363Zeile 1365
		else
{
$gid = $mybb->user['usergroup'];

		else
{
$gid = $mybb->user['usergroup'];





			if(isset($mybb->user['additionalgroups']))
{
$gid .= ",".$mybb->user['additionalgroups'];

			if(isset($mybb->user['additionalgroups']))
{
$gid .= ",".$mybb->user['additionalgroups'];

Zeile 1578Zeile 1580
	else
{
$showform = false;

	else
{
$showform = false;

	}


	}


	if($return)
{
return $showform;

	if($return)
{
return $showform;

Zeile 1792Zeile 1794
					return false;
}
}

					return false;
}
}

		}
}
}

/**

		}
}
}

/**

 * Generate a list of the posticons.
*
* @return string The template of posticons.

 * Generate a list of the posticons.
*
* @return string The template of posticons.

Zeile 1813Zeile 1815
	$iconlist = '';
$no_icons_checked = " checked=\"checked\"";
// read post icons from cache, and sort them accordingly

	$iconlist = '';
$no_icons_checked = " checked=\"checked\"";
// read post icons from cache, and sort them accordingly

	$posticons_cache = $cache->read("posticons");

	$posticons_cache = (array)$cache->read("posticons");

	$posticons = array();
foreach($posticons_cache as $posticon)
{

	$posticons = array();
foreach($posticons_cache as $posticon)
{

Zeile 1838Zeile 1840
		}

eval("\$iconlist .= \"".$templates->get("posticons_icon")."\";");

		}

eval("\$iconlist .= \"".$templates->get("posticons_icon")."\";");

	}

	}


if(!empty($iconlist))
{
eval("\$posticons = \"".$templates->get("posticons")."\";");


if(!empty($iconlist))
{
eval("\$posticons = \"".$templates->get("posticons")."\";");

	}

	}

	else
{
$posticons = '';

	else
{
$posticons = '';

Zeile 1851Zeile 1853

return $posticons;
}


return $posticons;
}





/**
* MyBB setcookie() wrapper.
*

/**
* MyBB setcookie() wrapper.
*

Zeile 1859Zeile 1861
 * @param string $value The cookie value.
* @param int|string $expires The timestamp of the expiry date.
* @param boolean $httponly True if setting a HttpOnly cookie (supported by the majority of web browsers)

 * @param string $value The cookie value.
* @param int|string $expires The timestamp of the expiry date.
* @param boolean $httponly True if setting a HttpOnly cookie (supported by the majority of web browsers)

 
 * @param string $samesite The samesite attribute to prevent CSRF.

 */

 */

function my_setcookie($name, $value="", $expires="", $httponly=false)

function my_setcookie($name, $value="", $expires="", $httponly=false, $samesite="")

{
global $mybb;


{
global $mybb;


Zeile 1892Zeile 1895
	if($expires > 0)
{
$cookie .= "; expires=".@gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires);

	if($expires > 0)
{
$cookie .= "; expires=".@gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires);

	}


	}


	if(!empty($mybb->settings['cookiepath']))

	if(!empty($mybb->settings['cookiepath']))

	{

	{

		$cookie .= "; path={$mybb->settings['cookiepath']}";

		$cookie .= "; path={$mybb->settings['cookiepath']}";

	}


	}


	if(!empty($mybb->settings['cookiedomain']))

	if(!empty($mybb->settings['cookiedomain']))

	{

	{

		$cookie .= "; domain={$mybb->settings['cookiedomain']}";

		$cookie .= "; domain={$mybb->settings['cookiedomain']}";

	}


	}


	if($httponly == true)

	if($httponly == true)

	{

	{

		$cookie .= "; HttpOnly";

		$cookie .= "; HttpOnly";

 
	}

if($samesite != "" && $mybb->settings['cookiesamesiteflag'])
{
$samesite = strtolower($samesite);

if($samesite == "lax" || $samesite == "strict")
{
$cookie .= "; SameSite=".$samesite;
}

	}

if($mybb->settings['cookiesecureflag'])

	}

if($mybb->settings['cookiesecureflag'])

Zeile 5466Zeile 5479
		$lang->month_11,
$lang->month_12
);

		$lang->month_11,
$lang->month_12
);



 

// This needs to be in this specific order
$find = array(


// This needs to be in this specific order
$find = array(

Zeile 5495Zeile 5507
		'&#70;',
'&#108;',
'&#77;',

		'&#70;',
'&#108;',
'&#77;',

	);

	);


$bdays = str_replace($find, $html, $bdays);
$bmonth = str_replace($find, $html, $bmonth);


$bdays = str_replace($find, $html, $bdays);
$bmonth = str_replace($find, $html, $bmonth);

Zeile 5512Zeile 5524
		$bmonth[$bm-1],
$wd,
($bm == 9 ? my_substr($bmonth[$bm-1], 0, 4) : my_substr($bmonth[$bm-1], 0, 3)),

		$bmonth[$bm-1],
$wd,
($bm == 9 ? my_substr($bmonth[$bm-1], 0, 4) : my_substr($bmonth[$bm-1], 0, 3)),

	);

	);


// Do we have the full month in our output?
// If so there's no need for the short month
if(strpos($display, 'F') !== false)


// Do we have the full month in our output?
// If so there's no need for the short month
if(strpos($display, 'F') !== false)

	{

	{

		array_pop($find);
array_pop($replace);
}

		array_pop($find);
array_pop($replace);
}

Zeile 5537Zeile 5549
	if(!$bday[2])
{
return;

	if(!$bday[2])
{
return;

	}

list($day, $month, $year) = explode("-", my_date("j-n-Y", TIME_NOW, 0, 0));

	}

list($day, $month, $year) = explode("-", my_date("j-n-Y", TIME_NOW, 0, 0));


$age = $year-$bday[2];



$age = $year-$bday[2];


Zeile 5556Zeile 5568
 * @param int $tid The thread id for which to update the first post id.
*/
function update_first_post($tid)

 * @param int $tid The thread id for which to update the first post id.
*/
function update_first_post($tid)

{
global $db;

{
global $db;


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


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

Zeile 5574Zeile 5586
		$firstpost['username'] = $firstpost['postusername'];
}
$firstpost['username'] = $db->escape_string($firstpost['username']);

		$firstpost['username'] = $firstpost['postusername'];
}
$firstpost['username'] = $db->escape_string($firstpost['username']);





	$update_array = array(
'firstpost' => (int)$firstpost['pid'],
'username' => $firstpost['username'],
'uid' => (int)$firstpost['uid'],
'dateline' => (int)$firstpost['dateline']

	$update_array = array(
'firstpost' => (int)$firstpost['pid'],
'username' => $firstpost['username'],
'uid' => (int)$firstpost['uid'],
'dateline' => (int)$firstpost['dateline']

	);

	);

	$db->update_query("threads", $update_array, "tid='{$tid}'");
}


	$db->update_query("threads", $update_array, "tid='{$tid}'");
}


Zeile 5602Zeile 5614
		LIMIT 1"
);
$lastpost = $db->fetch_array($query);

		LIMIT 1"
);
$lastpost = $db->fetch_array($query);





	if(empty($lastpost['username']))
{
$lastpost['username'] = $lastpost['postusername'];

	if(empty($lastpost['username']))
{
$lastpost['username'] = $lastpost['postusername'];

Zeile 5690Zeile 5702
		if($length != null)
{
$cut_string = mb_substr($string, $start, $length);

		if($length != null)
{
$cut_string = mb_substr($string, $start, $length);

		}
else
{

		}
else
{

			$cut_string = mb_substr($string, $start);
}
}

			$cut_string = mb_substr($string, $start);
}
}

Zeile 5709Zeile 5721
	}

if($handle_entities)

	}

if($handle_entities)

	{

	{

		$cut_string = htmlspecialchars_uni($cut_string);
}
return $cut_string;

		$cut_string = htmlspecialchars_uni($cut_string);
}
return $cut_string;

}

/**

}

/**

 * Lowers the case of a string, mb strings accounted for
*
* @param string $string The string to lower.

 * Lowers the case of a string, mb strings accounted for
*
* @param string $string The string to lower.

Zeile 5726Zeile 5738
	if(function_exists("mb_strtolower"))
{
$string = mb_strtolower($string);

	if(function_exists("mb_strtolower"))
{
$string = mb_strtolower($string);

	}

	}

	else
{
$string = strtolower($string);

	else
{
$string = strtolower($string);

Zeile 5737Zeile 5749

/**
* Finds a needle in a haystack and returns it position, mb strings accounted for


/**
* Finds a needle in a haystack and returns it position, mb strings accounted for

 *

 *

 * @param string $haystack String to look in (haystack)
* @param string $needle What to look for (needle)
* @param int $offset (optional) How much to offset
* @return int|bool false on needle not found, integer position if found

 * @param string $haystack String to look in (haystack)
* @param string $needle What to look for (needle)
* @param int $offset (optional) How much to offset
* @return int|bool false on needle not found, integer position if found

 */

 */

function my_strpos($haystack, $needle, $offset=0)
{
if($needle == '')

function my_strpos($haystack, $needle, $offset=0)
{
if($needle == '')

Zeile 5753Zeile 5765
	if(function_exists("mb_strpos"))
{
$position = mb_strpos($haystack, $needle, $offset);

	if(function_exists("mb_strpos"))
{
$position = mb_strpos($haystack, $needle, $offset);

	}

	}

	else
{
$position = strpos($haystack, $needle, $offset);

	else
{
$position = strpos($haystack, $needle, $offset);

	}


	}


	return $position;
}


	return $position;
}


Zeile 5780Zeile 5792
	}

return $string;

	}

return $string;

}

/**

}

/**

 * Returns any html entities to their original character
*
* @param string $string The string to un-htmlentitize.

 * Returns any html entities to their original character
*
* @param string $string The string to un-htmlentitize.

Zeile 5793Zeile 5805
	// Replace numeric entities
$string = preg_replace_callback('~&#x([0-9a-f]+);~i', 'unichr_callback1', $string);
$string = preg_replace_callback('~&#([0-9]+);~', 'unichr_callback2', $string);

	// Replace numeric entities
$string = preg_replace_callback('~&#x([0-9a-f]+);~i', 'unichr_callback1', $string);
$string = preg_replace_callback('~&#([0-9]+);~', 'unichr_callback2', $string);





	// Replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);

	// Replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);

Zeile 5810Zeile 5822
function unichr($c)
{
if($c <= 0x7F)

function unichr($c)
{
if($c <= 0x7F)

	{

	{

		return chr($c);
}
else if($c <= 0x7FF)

		return chr($c);
}
else if($c <= 0x7FF)

Zeile 5820Zeile 5832
	else if($c <= 0xFFFF)
{
return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)

	else if($c <= 0xFFFF)
{
return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)

									. chr(0x80 | $c & 0x3F);
}

									. chr(0x80 | $c & 0x3F);
}

	else if($c <= 0x10FFFF)

	else if($c <= 0x10FFFF)

	{

	{

		return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F)
. chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);

		return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F)
. chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);

	}
else
{

	}
else
{

		return false;
}

		return false;
}

}

/**
* Returns any ascii to it's character (utf-8 safe).

}

/**
* Returns any ascii to it's character (utf-8 safe).

 *
* @param array $matches Matches.
* @return string|bool The characterized ascii. False on failure

 *
* @param array $matches Matches.
* @return string|bool The characterized ascii. False on failure

Zeile 5843Zeile 5855
function unichr_callback1($matches)
{
return unichr(hexdec($matches[1]));

function unichr_callback1($matches)
{
return unichr(hexdec($matches[1]));

}


}


/**
* Returns any ascii to it's character (utf-8 safe).
*

/**
* Returns any ascii to it's character (utf-8 safe).
*

Zeile 5852Zeile 5864
 * @return string|bool The characterized ascii. False on failure
*/
function unichr_callback2($matches)

 * @return string|bool The characterized ascii. False on failure
*/
function unichr_callback2($matches)

{

{

	return unichr($matches[1]);
}


	return unichr($matches[1]);
}


Zeile 5861Zeile 5873
 *
* @param array $event The event data array.
* @return string The link to the event poster.

 *
* @param array $event The event data array.
* @return string The link to the event poster.

 */

 */

function get_event_poster($event)
{
$event['username'] = htmlspecialchars_uni($event['username']);
$event['username'] = format_name($event['username'], $event['usergroup'], $event['displaygroup']);
$event_poster = build_profile_link($event['username'], $event['author']);
return $event_poster;

function get_event_poster($event)
{
$event['username'] = htmlspecialchars_uni($event['username']);
$event['username'] = format_name($event['username'], $event['usergroup'], $event['displaygroup']);
$event_poster = build_profile_link($event['username'], $event['author']);
return $event_poster;

}

/**

}

/**

 * Get the event date.
*
* @param array $event The event data array.

 * Get the event date.
*
* @param array $event The event data array.

Zeile 5885Zeile 5897
	$event_date = my_date($mybb->settings['dateformat'], $event_date);

return $event_date;

	$event_date = my_date($mybb->settings['dateformat'], $event_date);

return $event_date;

}

/**

}

/**

 * Get the profile link.
*
* @param int $uid The user id of the profile.

 * Get the profile link.
*
* @param int $uid The user id of the profile.

Zeile 5896Zeile 5908
function get_profile_link($uid=0)
{
$link = str_replace("{uid}", $uid, PROFILE_URL);

function get_profile_link($uid=0)
{
$link = str_replace("{uid}", $uid, PROFILE_URL);

	return htmlspecialchars_uni($link);
}

/**

	return htmlspecialchars_uni($link);
}

/**

 * Get the announcement link.
*
* @param int $aid The announement id of the announcement.
* @return string The url to the announcement.

 * Get the announcement link.
*
* @param int $aid The announement id of the announcement.
* @return string The url to the announcement.

 */

 */

function get_announcement_link($aid=0)
{
$link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL);

function get_announcement_link($aid=0)
{
$link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL);

Zeile 5921Zeile 5933
 * @return string The complete profile link.
*/
function build_profile_link($username="", $uid=0, $target="", $onclick="")

 * @return string The complete profile link.
*/
function build_profile_link($username="", $uid=0, $target="", $onclick="")

{

{

	global $mybb, $lang;

if(!$username && $uid == 0)

	global $mybb, $lang;

if(!$username && $uid == 0)

Zeile 5946Zeile 5958
		{
$onclick = " onclick=\"{$onclick}\"";
}

		{
$onclick = " onclick=\"{$onclick}\"";
}





		return "<a href=\"{$mybb->settings['bburl']}/".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
}
}

		return "<a href=\"{$mybb->settings['bburl']}/".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
}
}

Zeile 5963Zeile 5975
	if($page > 0)
{
$link = str_replace("{fid}", $fid, FORUM_URL_PAGED);

	if($page > 0)
{
$link = str_replace("{fid}", $fid, FORUM_URL_PAGED);

		$link = str_replace("{page}", $page, $link);
return htmlspecialchars_uni($link);
}
else
{
$link = str_replace("{fid}", $fid, FORUM_URL);
return htmlspecialchars_uni($link);

		$link = str_replace("{page}", $page, $link);
return htmlspecialchars_uni($link);
}
else
{
$link = str_replace("{fid}", $fid, FORUM_URL);
return htmlspecialchars_uni($link);

	}
}


	}
}


Zeile 6107Zeile 6119
 * Get the user data of an user id.
*
* @param int $uid The user id of the user.

 * Get the user data of an user id.
*
* @param int $uid The user id of the user.

 * @return array The users data
*/

 * @return array The users data
*/

function get_user($uid)
{
global $mybb, $db;

function get_user($uid)
{
global $mybb, $db;

Zeile 6317Zeile 6329
	if(!$forum_cache)
{
cache_forums();

	if(!$forum_cache)
{
cache_forums();

	}


	}


	$inactive = array();

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

	$inactive = array();

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

Zeile 6327Zeile 6339
		{
$inactive[] = $fid;
foreach($forum_cache as $fid1 => $forum1)

		{
$inactive[] = $fid;
foreach($forum_cache as $fid1 => $forum1)

			{

			{

				if(my_strpos(",".$forum1['parentlist'].",", ",".$fid.",") !== false && !in_array($fid1, $inactive))
{
$inactive[] = $fid1;
}

				if(my_strpos(",".$forum1['parentlist'].",", ",".$fid.",") !== false && !in_array($fid1, $inactive))
{
$inactive[] = $fid1;
}

			}
}
}

$inactiveforums = implode(",", $inactive);

			}
}
}

$inactiveforums = implode(",", $inactive);


return $inactiveforums;
}


return $inactiveforums;
}

Zeile 6347Zeile 6359
 * @param bool $fatal (Optional) Stop execution if it finds an error with the login. Default is True
* @return bool|int Number of logins when success, false if failed.
*/

 * @param bool $fatal (Optional) Stop execution if it finds an error with the login. Default is True
* @return bool|int Number of logins when success, false if failed.
*/

function login_attempt_check($fatal = true)

function login_attempt_check($uid = 0, $fatal = true)

{

{

	global $mybb, $lang, $session, $db;

if($mybb->settings['failedlogincount'] == 0)
{
return 1;
}
// Note: Number of logins is defaulted to 1, because using 0 seems to clear cookie data. Not really a problem as long as we account for 1 being default.

// Use cookie if possible, otherwise use session
// Find better solution to prevent clearing cookies
$loginattempts = 0;
$failedlogin = 0;

if(!empty($mybb->cookies['loginattempts']))
{
$loginattempts = $mybb->cookies['loginattempts'];
}

if(!empty($mybb->cookies['failedlogin']))
{
$failedlogin = $mybb->cookies['failedlogin'];
}

// Work out if the user has had more than the allowed number of login attempts
if($loginattempts > $mybb->settings['failedlogincount'])

	global $mybb, $lang, $db;

$attempts = array();
$uid = (int)$uid;
$now = TIME_NOW;

// Get this user's login attempts and eventual lockout, if a uid is provided
if($uid > 0)


















	{

	{

		// If so, then we need to work out if they can try to login again
// Some maths to work out how long they have left and display it to them
$now = TIME_NOW;

if(empty($mybb->cookies['failedlogin']))








		$query = $db->simple_select("users", "loginattempts, loginlockoutexpiry", "uid='{$uid}'", 1);
$attempts = $db->fetch_array($query);

if($attempts['loginattempts'] <= 0)
{
return 0;
}
}
// This user has a cookie lockout, show waiting time
elseif($mybb->cookies['lockoutexpiry'] && $mybb->cookies['lockoutexpiry'] > $now)
{
if($fatal)

		{

		{

			$failedtime = $now;






























			$secsleft = (int)($mybb->cookies['lockoutexpiry'] - $now);
$hoursleft = floor($secsleft / 3600);
$minsleft = floor(($secsleft / 60) % 60);
$secsleft = floor($secsleft % 60);

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

return false;
}

if($mybb->settings['failedlogincount'] > 0 && $attempts['loginattempts'] >= $mybb->settings['failedlogincount'])
{
// Set the expiry dateline if not set yet
if($attempts['loginlockoutexpiry'] == 0)
{
$attempts['loginlockoutexpiry'] = $now + ((int)$mybb->settings['failedlogintime'] * 60);

// 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}'");
}

if(empty($mybb->cookies['lockoutexpiry']))
{
$failedtime = $attempts['loginlockoutexpiry'];

		}
else
{

		}
else
{

			$failedtime = $mybb->cookies['failedlogin'];

			$failedtime = $mybb->cookies['lockoutexpiry'];

		}


		}


		$secondsleft = $mybb->settings['failedlogintime'] * 60 + $failedtime - $now;
$hoursleft = floor($secondsleft / 3600);
$minsleft = floor(($secondsleft / 60) % 60);
$secsleft = floor($secondsleft % 60);

// This value will be empty the first time the user doesn't login in, set it
if(empty($failedlogin))
{
my_setcookie('failedlogin', $now);

		// Are we still locked out?
if($attempts['loginlockoutexpiry'] > $now)
{







			if($fatal)

			if($fatal)

			{






			{
$secsleft = (int)($attempts['loginlockoutexpiry'] - $now);
$hoursleft = floor($secsleft / 3600);
$minsleft = floor(($secsleft / 60) % 60);
$secsleft = floor($secsleft % 60);


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

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





			return false;
}

			return false;
}

 
		// Unlock if enough time has passed
else {





		// Work out if the user has waited long enough before letting them login again
if($mybb->cookies['failedlogin'] < ($now - $mybb->settings['failedlogintime'] * 60))
{
my_setcookie('loginattempts', 1);
my_unsetcookie('failedlogin');
if($mybb->user['uid'] != 0)

			if($uid > 0)






			{

			{

				$update_array = array(
'loginattempts' => 1
);
$db->update_query("users", $update_array, "uid = '{$mybb->user['uid']}'");
}
return 1;
}
// Not waited long enough
else if($mybb->cookies['failedlogin'] > ($now - $mybb->settings['failedlogintime'] * 60))
{
if($fatal)
{
error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft));

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










			}


			}


			return false;




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

return 0;

		}
}

// User can attempt another login

		}
}

// User can attempt another login

	return $loginattempts;

	return $attempts['loginattempts'];

}

/**

}

/**

Zeile 7786Zeile 7807
			{
// Invalid IP address
return false;

			{
// Invalid IP address
return false;

			}

			}

		}

/**

		}

/**

Zeile 7815Zeile 7836
		// Some calculations
$ip_lower_bits = str_pad($ip_bits, $ip_bits_size, '0', STR_PAD_RIGHT);
$ip_higher_bits = str_pad($ip_bits, $ip_bits_size, '1', STR_PAD_RIGHT);

		// Some calculations
$ip_lower_bits = str_pad($ip_bits, $ip_bits_size, '0', STR_PAD_RIGHT);
$ip_higher_bits = str_pad($ip_bits, $ip_bits_size, '1', STR_PAD_RIGHT);





		// Lower IP
$ip_lower_pack = '';
for($i=0; $i < $ip_bits_size; $i=$i+8)

		// Lower IP
$ip_lower_pack = '';
for($i=0; $i < $ip_bits_size; $i=$i+8)

Zeile 7853Zeile 7874
	static $time_start;

$time = microtime(true);

	static $time_start;

$time = microtime(true);



 

// Just starting timer, init and return
if(!$time_start)
{
$time_start = $time;
return;


// Just starting timer, init and return
if(!$time_start)
{
$time_start = $time;
return;

	}

	}

	// Timer has run, return execution time
else
{

	// Timer has run, return execution time
else
{

Zeile 7889Zeile 7909
	if(substr($path, -1, 1) == "/")
{
$path = substr($path, 0, -1);

	if(substr($path, -1, 1) == "/")
{
$path = substr($path, 0, -1);

	}


	}


	if(!is_array($bad_verify_files))

	if(!is_array($bad_verify_files))

	{

	{

		$bad_verify_files = array();
}


		$bad_verify_files = array();
}


Zeile 7905Zeile 7925
			while(($file = @readdir($dh)) !== false)
{
if(in_array($file, $ignore) || in_array(get_extension($file), $ignore_ext))

			while(($file = @readdir($dh)) !== false)
{
if(in_array($file, $ignore) || in_array(get_extension($file), $ignore_ext))

				{
continue;

				{
continue;

				}

// Recurse through the directory tree

				}

// Recurse through the directory tree

Zeile 8385Zeile 8405
					}
}
elseif($c > 239)

					}
}
elseif($c > 239)

				{

				{

					$bytes = 4;
}
elseif($c > 223)

					$bytes = 4;
}
elseif($c > 223)

Zeile 8583Zeile 8603
	}

$pm['options'] = array(

	}

$pm['options'] = array(

		"signature" => 0,

 
		"disablesmilies" => 0,
"savecopy" => 0,
"readreceipt" => 0

		"disablesmilies" => 0,
"savecopy" => 0,
"readreceipt" => 0

Zeile 8745Zeile 8764
/**
* Strip html tags from string, also removes <script> and <style> contents.
*

/**
* Strip html tags from string, also removes <script> and <style> contents.
*

 
 * @deprecated

 * @param  string $string         String to stripe
* @param string $allowable_tags Allowed html tags
*

 * @param  string $string         String to stripe
* @param string $allowable_tags Allowed html tags
*