Vergleich inc/functions.php - 1.8.16 - 1.8.22

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 18Zeile 18
	global $db, $lang, $theme, $templates, $plugins, $mybb;
global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;


	global $db, $lang, $theme, $templates, $plugins, $mybb;
global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;


 
	$contents = $plugins->run_hooks("pre_parse_page", $contents);

	$contents = parse_page($contents);
$totaltime = format_time_duration($maintimer->stop());
$contents = $plugins->run_hooks("pre_output_page", $contents);

	$contents = parse_page($contents);
$totaltime = format_time_duration($maintimer->stop());
$contents = $plugins->run_hooks("pre_output_page", $contents);

Zeile 623Zeile 624
	// Guests get a special string
else
{

	// Guests get a special string
else
{

		return md5($session->useragent.$mybb->config['database']['username'].$mybb->settings['internal']['encryption_key']);

		return md5($session->sid.$mybb->config['database']['username'].$mybb->settings['internal']['encryption_key']);

	}
}


	}
}


Zeile 868Zeile 869

foreach($errors as $error)
{


foreach($errors as $error)
{

		$errorlist .= "<li>".$error."</li>\n";

		eval("\$errorlist .= \"".$templates->get("error_inline_item")."\";");

	}

eval("\$errors = \"".$templates->get("error_inline")."\";");

	}

eval("\$errors = \"".$templates->get("error_inline")."\";");

Zeile 1203Zeile 1204
/**
* Fetch the permissions for a specific user
*

/**
* Fetch the permissions for a specific user
*

 * @param int $uid The user ID

 * @param int $uid The user ID, if no user ID is provided then current user's ID will be considered.

 * @return array Array of user permissions for the specified user
*/

 * @return array Array of user permissions for the specified user
*/

function user_permissions($uid=0)

function user_permissions($uid=null)

{
global $mybb, $cache, $groupscache, $user_cache;

// If no user id is specified, assume it is the current user

{
global $mybb, $cache, $groupscache, $user_cache;

// If no user id is specified, assume it is the current user

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

// Its a guest. Return the group permissions directly from cache

	if($uid == 0)
{

	if($uid == 0)
{

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

		return $groupscache[1];

	}

// User id does not match current user, fetch permissions

	}

// User id does not match current user, fetch permissions

Zeile 2035Zeile 2042
		return false;
}


		return false;
}


	$stack = array();
$expected = array();

	$stack = $list = $expected = array();



/*
* states:


/*
* states:

Zeile 3167Zeile 3173

if($dimensions)
{


if($dimensions)
{

		$dimensions = explode("|", $dimensions);

		$dimensions = preg_split('/[|x]/', $dimensions);


if($dimensions[0] && $dimensions[1])
{


if($dimensions[0] && $dimensions[1])
{

			list($max_width, $max_height) = explode('x', $max_dimensions);

			list($max_width, $max_height) = preg_split('/[|x]/', $max_dimensions);


if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height))
{


if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height))
{

Zeile 3268Zeile 3274
			"editor_invalidyoutube" => "Invalid YouTube video",
"editor_dailymotion" => "Dailymotion",
"editor_metacafe" => "MetaCafe",

			"editor_invalidyoutube" => "Invalid YouTube video",
"editor_dailymotion" => "Dailymotion",
"editor_metacafe" => "MetaCafe",

			"editor_veoh" => "Veoh",

			"editor_mixer" => "Mixer",

			"editor_vimeo" => "Vimeo",
"editor_youtube" => "Youtube",
"editor_facebook" => "Facebook",

			"editor_vimeo" => "Vimeo",
"editor_youtube" => "Youtube",
"editor_facebook" => "Facebook",

Zeile 3438Zeile 3444
	}

return $codeinsert;

	}

return $codeinsert;

 
}

/**
* @param int $tid
* @param array $postoptions The options carried with form submit
*
* @return string Predefined / updated subscription method of the thread for the user
*/
function get_subscription_method($tid = 0, $postoptions = array())
{
global $mybb;

$subscription_methods = array('', 'none', 'email', 'pm'); // Define methods
$subscription_method = (int)$mybb->user['subscriptionmethod']; // Set user default

// If no user default method available then reset method
if(!$subscription_method)
{
$subscription_method = 0;
}

// Return user default if no thread id available, in case
if(!(int)$tid || (int)$tid <= 0)
{
return $subscription_methods[$subscription_method];
}

// If method not predefined set using data from database
if(isset($postoptions['subscriptionmethod']))
{
$method = trim($postoptions['subscriptionmethod']);
return (in_array($method, $subscription_methods)) ? $method : $subscription_methods[0];
}
else
{
global $db;

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

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

return $subscription_methods[$subscription_method];

}

/**

}

/**

Zeile 4331Zeile 4384
				eval("\$nav .= \"".$templates->get("nav_bit")."\";");
}
}

				eval("\$nav .= \"".$templates->get("nav_bit")."\";");
}
}

 
		$navsize = count($navbits);
$navbit = $navbits[$navsize-1];

	}

	}


$activesep = '';
$navsize = count($navbits);
$navbit = $navbits[$navsize-1];

 

if($nav)
{
eval("\$activesep = \"".$templates->get("nav_sep_active")."\";");
}


if($nav)
{
eval("\$activesep = \"".$templates->get("nav_sep_active")."\";");
}





	eval("\$activebit = \"".$templates->get("nav_bit_active")."\";");
eval("\$donenav = \"".$templates->get("nav")."\";");

return $donenav;

	eval("\$activebit = \"".$templates->get("nav_bit_active")."\";");
eval("\$donenav = \"".$templates->get("nav")."\";");

return $donenav;

}


}


/**
* Add a breadcrumb menu item to the list.
*

/**
* Add a breadcrumb menu item to the list.
*

Zeile 4357Zeile 4408
function add_breadcrumb($name, $url="")
{
global $navbits;

function add_breadcrumb($name, $url="")
{
global $navbits;





	$navsize = count($navbits);
$navbits[$navsize]['name'] = $name;
$navbits[$navsize]['url'] = $url;

	$navsize = count($navbits);
$navbits[$navsize]['name'] = $name;
$navbits[$navsize]['url'] = $url;

Zeile 4420Zeile 4471

$navbits[$navsize]['multipage'] = $multipage;
$navbits[$navsize]['multipage']['url'] = str_replace('{fid}', $forumnav['fid'], FORUM_URL_PAGED);


$navbits[$navsize]['multipage'] = $multipage;
$navbits[$navsize]['multipage']['url'] = str_replace('{fid}', $forumnav['fid'], FORUM_URL_PAGED);

				}

				}

				else
{
$navbits[$navsize]['url'] = get_forum_link($forumnav['fid']);

				else
{
$navbits[$navsize]['url'] = get_forum_link($forumnav['fid']);

Zeile 4430Zeile 4481
	}

return 1;

	}

return 1;

}

}


/**
* Resets the breadcrumb navigation to the first item, and clears the rest


/**
* Resets the breadcrumb navigation to the first item, and clears the rest

Zeile 4504Zeile 4555

$percentphp = number_format((($phptime/$maintimer->totaltime)*100), 2);
$percentsql = number_format((($query_time/$maintimer->totaltime)*100), 2);


$percentphp = number_format((($phptime/$maintimer->totaltime)*100), 2);
$percentsql = number_format((($query_time/$maintimer->totaltime)*100), 2);





	$phptime = format_time_duration($maintimer->totaltime - $db->query_time);
$query_time = format_time_duration($db->query_time);


	$phptime = format_time_duration($maintimer->totaltime - $db->query_time);
$query_time = format_time_duration($db->query_time);


Zeile 4924Zeile 4975
	global $db, $mybb;

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

	global $db, $mybb;

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

	{

	{

		$user = $mybb->user;
}
else

		$user = $mybb->user;
}
else

Zeile 4945Zeile 4996
		foreach($groups as $gid)
{
if(trim($gid) != "" && $gid != $user['usergroup'] && !isset($donegroup[$gid]))

		foreach($groups as $gid)
{
if(trim($gid) != "" && $gid != $user['usergroup'] && !isset($donegroup[$gid]))

			{

			{

				$groupslist .= $comma.$gid;
$comma = ",";
$donegroup[$gid] = 1;

				$groupslist .= $comma.$gid;
$comma = ",";
$donegroup[$gid] = 1;

Zeile 5009Zeile 5060
	");

$cache->update_moderators();

	");

$cache->update_moderators();

}

/**

}

/**

 * Get the current location taking in to account different web serves and systems
*
* @param boolean $fields True to return as "hidden" fields

 * Get the current location taking in to account different web serves and systems
*
* @param boolean $fields True to return as "hidden" fields

Zeile 5367Zeile 5418
/**
* DEPRECATED! Please use other alternatives.
*

/**
* DEPRECATED! Please use other alternatives.
*

 * @deprecated
* @param string $message
*

 * @deprecated
* @param string $message
*

 * @return string
*/
function my_wordwrap($message)

 * @return string
*/
function my_wordwrap($message)

Zeile 5725Zeile 5776
		$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


/**
* Lowers the case of a string, mb strings accounted for

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

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

	}
else

	}
else

	{
$string = strtolower($string);
}

	{
$string = strtolower($string);
}





	return $string;
}


	return $string;
}


Zeile 5754Zeile 5805
 * @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 $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 5763Zeile 5814
	}

if(function_exists("mb_strpos"))

	}

if(function_exists("mb_strpos"))

	{

	{

		$position = mb_strpos($haystack, $needle, $offset);

		$position = mb_strpos($haystack, $needle, $offset);

	}

	}

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

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

	}


	}


	return $position;
}


	return $position;
}


Zeile 5783Zeile 5834
function my_strtoupper($string)
{
if(function_exists("mb_strtoupper"))

function my_strtoupper($string)
{
if(function_exists("mb_strtoupper"))

	{

	{

		$string = mb_strtoupper($string);
}
else

		$string = mb_strtoupper($string);
}
else

Zeile 5828Zeile 5879
	else if($c <= 0x7FF)
{
return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F);

	else if($c <= 0x7FF)
{
return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F);

	}

	}

	else if($c <= 0xFFFF)

	else if($c <= 0xFFFF)

	{

	{

		return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)

		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
{
return false;

	else
{
return false;

	}
}

/**

	}
}

/**

 * Returns any ascii to it's character (utf-8 safe).
*
* @param array $matches Matches.

 * Returns any ascii to it's character (utf-8 safe).
*
* @param array $matches Matches.

Zeile 5855Zeile 5906
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).
*
* @param array $matches Matches.

 * Returns any ascii to it's character (utf-8 safe).
*
* @param array $matches Matches.

Zeile 5901Zeile 5952

/**
* Get the profile link.


/**
* Get the profile link.

 *

 *

 * @param int $uid The user id of the profile.
* @return string The url to the profile.

 * @param int $uid The user id of the profile.
* @return string The url to the profile.

 */

 */

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);

Zeile 5916Zeile 5967
 *
* @param int $aid The announement id of the announcement.
* @return string The url to the announcement.

 *
* @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 5945Zeile 5996
	{
// Return the guest's nickname if user is a guest but has a nickname
return $username;

	{
// Return the guest's nickname if user is a guest but has a nickname
return $username;

	}

	}

	else
{
// Build the profile link for the registered user
if(!empty($target))
{
$target = " target=\"{$target}\"";

	else
{
// Build the profile link for the registered user
if(!empty($target))
{
$target = " target=\"{$target}\"";

		}

		}


if(!empty($onclick))
{
$onclick = " onclick=\"{$onclick}\"";
}


if(!empty($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>";

	}
}


	}
}


/**
* Build the forum link.
*

/**
* Build the forum link.
*

Zeile 6319Zeile 6370

/**
* Get inactivate forums.


/**
* Get inactivate forums.

 *

 *

 * @return string The comma separated values of the inactivate forum.
*/
function get_inactive_forums()
{
global $forum_cache, $cache;

 * @return string The comma separated values of the inactivate forum.
*/
function get_inactive_forums()
{
global $forum_cache, $cache;





	if(!$forum_cache)
{
cache_forums();

	if(!$forum_cache)
{
cache_forums();

	}

$inactive = array();


	}

$inactive = array();


	foreach($forum_cache as $fid => $forum)
{
if($forum['active'] == 0)

	foreach($forum_cache as $fid => $forum)
{
if($forum['active'] == 0)

Zeile 6369Zeile 6420

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


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

	{

	{

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


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


Zeile 6380Zeile 6431
	}
// This user has a cookie lockout, show waiting time
elseif($mybb->cookies['lockoutexpiry'] && $mybb->cookies['lockoutexpiry'] > $now)

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

	{	

	{

		if($fatal)
{
$secsleft = (int)($mybb->cookies['lockoutexpiry'] - $now);

		if($fatal)
{
$secsleft = (int)($mybb->cookies['lockoutexpiry'] - $now);

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

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

		}

		}


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


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

		{

		{

			$failedtime = $attempts['loginlockoutexpiry'];

			$failedtime = $attempts['loginlockoutexpiry'];

		}

		}

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

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

Zeile 6421Zeile 6472

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


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

		{	

		{

			if($fatal)
{
$secsleft = (int)($attempts['loginlockoutexpiry'] - $now);

			if($fatal)
{
$secsleft = (int)($attempts['loginlockoutexpiry'] - $now);

Zeile 6510Zeile 6561
	while($setting = $db->fetch_array($query))
{
$mybb->settings[$setting['name']] = $setting['value'];

	while($setting = $db->fetch_array($query))
{
$mybb->settings[$setting['name']] = $setting['value'];

 

$setting['name'] = addcslashes($setting['name'], "\\'");

		$setting['value'] = addcslashes($setting['value'], '\\"$');
$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";
}

		$setting['value'] = addcslashes($setting['value'], '\\"$');
$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";
}

Zeile 6534Zeile 6587
	if($mybb->settings['minsearchword'] < 1)
{
$mybb->settings['minsearchword'] = 3;

	if($mybb->settings['minsearchword'] < 1)
{
$mybb->settings['minsearchword'] = 3;

	}

	}


if(is_array($terms))
{
$terms = implode(' ', $terms);
}


if(is_array($terms))
{
$terms = implode(' ', $terms);
}





	// Strip out any characters that shouldn't be included
$bad_characters = array(
"(",

	// Strip out any characters that shouldn't be included
$bad_characters = array(
"(",

Zeile 6558Zeile 6611
		$terms = explode("\"", $terms);
$words = array();
foreach($terms as $phrase)

		$terms = explode("\"", $terms);
$words = array();
foreach($terms as $phrase)

		{

		{

			$phrase = htmlspecialchars_uni($phrase);
if($phrase != "")
{

			$phrase = htmlspecialchars_uni($phrase);
if($phrase != "")
{

Zeile 6796Zeile 6849
		if(is_array($ip_range))
{
if(strcmp($ip_range[0], $ip_address) <= 0 && strcmp($ip_range[1], $ip_address) >= 0)

		if(is_array($ip_range))
{
if(strcmp($ip_range[0], $ip_address) <= 0 && strcmp($ip_range[1], $ip_address) >= 0)

			{

			{

				$banned = true;
}
}

				$banned = true;
}
}

Zeile 6914Zeile 6967
				else
{
$label .= ":00";

				else
{
$label .= ":00";

				}

				}

			}
$time_in_zone = my_date($mybb->settings['timeformat'], TIME_NOW, $timezone);
$label = $lang->sprintf($lang->timezone_gmt_short, $label." ", $time_in_zone);

			}
$time_in_zone = my_date($mybb->settings['timeformat'], TIME_NOW, $timezone);
$label = $lang->sprintf($lang->timezone_gmt_short, $label." ", $time_in_zone);

Zeile 6940Zeile 6993
	global $mybb, $config;

if(!my_validate_url($url, true))

	global $mybb, $config;

if(!my_validate_url($url, true))

	{
return false;
}


	{
return false;
}


	$url_components = @parse_url($url);

if(!isset($url_components['scheme']))

	$url_components = @parse_url($url);

if(!isset($url_components['scheme']))

Zeile 6972Zeile 7025
	if(!empty($config['disallowed_remote_addresses']))
{
foreach($config['disallowed_remote_addresses'] as $disallowed_address)

	if(!empty($config['disallowed_remote_addresses']))
{
foreach($config['disallowed_remote_addresses'] as $disallowed_address)

		{

		{

			$ip_range = fetch_ip_range($disallowed_address);

$packed_address = my_inet_pton($destination_address);

			$ip_range = fetch_ip_range($disallowed_address);

$packed_address = my_inet_pton($destination_address);

Zeile 7032Zeile 7085
		{
// CURLOPT_CONNECT_TO
$curlopt[10243] = array(

		{
// CURLOPT_CONNECT_TO
$curlopt[10243] = array(

				$url_components['host'].':'.$url_components['port'].':'.$destination_address
);

				$url_components['host'].':'.$url_components['port'].':'.$destination_address
);

		}
elseif(version_compare(PHP_VERSION, '5.5', '>=') && version_compare($curl_version, '7.21.3', '>='))
{

		}
elseif(version_compare(PHP_VERSION, '5.5', '>=') && version_compare($curl_version, '7.21.3', '>='))
{

Zeile 7047Zeile 7100
		{
$curlopt[CURLOPT_POST] = 1;
$curlopt[CURLOPT_POSTFIELDS] = $post_body;

		{
$curlopt[CURLOPT_POST] = 1;
$curlopt[CURLOPT_POSTFIELDS] = $post_body;

		}


		}


		curl_setopt_array($ch, $curlopt);

$response = curl_exec($ch);

		curl_setopt_array($ch, $curlopt);

$response = curl_exec($ch);

Zeile 7061Zeile 7114

if(in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE), array(301, 302)))
{


if(in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE), array(301, 302)))
{

				preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);

				preg_match('/^Location:(.*?)(?:\n|$)/im', $header, $matches);


if($matches)
{


if($matches)
{

Zeile 7153Zeile 7206
		$headers[] = "Host: {$url_components['host']}";
$headers[] = "Connection: Close";
$headers[] = '';

		$headers[] = "Host: {$url_components['host']}";
$headers[] = "Connection: Close";
$headers[] = '';





		if(!empty($post_body))

		if(!empty($post_body))

		{

		{

			$headers[] = $post_body;
}
else

			$headers[] = $post_body;
}
else

		{

		{

			// If we have no post body, we need to add an empty element to make sure we've got \r\n\r\n before the (non-existent) body starts
$headers[] = '';
}

$headers = implode("\r\n", $headers);
if(!@fwrite($fp, $headers))

			// If we have no post body, we need to add an empty element to make sure we've got \r\n\r\n before the (non-existent) body starts
$headers[] = '';
}

$headers = implode("\r\n", $headers);
if(!@fwrite($fp, $headers))

		{
return false;

		{
return false;

		}

$data = null;

		}

$data = null;

Zeile 7186Zeile 7239

if($max_redirects > 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 ')))
{


if($max_redirects > 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 ')))
{

			preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);

			preg_match('/^Location:(.*?)(?:\n|$)/im', $header, $matches);


if($matches)
{


if($matches)
{

Zeile 7196Zeile 7249
		else
{
$data = $body;

		else
{
$data = $body;

		}


		}


		return $data;

		return $data;

	}

	}

	else
{
return false;

	else
{
return false;

Zeile 7211Zeile 7264
 *
* @param string $hostname The hostname to be resolved
* @return array|bool The resulting IP addresses. False on failure

 *
* @param string $hostname The hostname to be resolved
* @return array|bool The resulting IP addresses. False on failure

 */

 */

function get_ip_by_hostname($hostname)
{
$addresses = @gethostbynamel($hostname);

function get_ip_by_hostname($hostname)
{
$addresses = @gethostbynamel($hostname);

Zeile 7269Zeile 7322
	}

if(my_strpos(",{$super_admins},", ",{$uid},") === false)

	}

if(my_strpos(",{$super_admins},", ",{$uid},") === false)

	{
return false;
}
else
{

	{
return false;
}
else
{

		return true;
}
}

		return true;
}
}

Zeile 7288Zeile 7341
 * @return array Array of groups specified in the first param to which the user belongs
*/
function is_member($groups, $user = false)

 * @return array Array of groups specified in the first param to which the user belongs
*/
function is_member($groups, $user = false)

{

{

	global $mybb;

if(empty($groups))

	global $mybb;

if(empty($groups))

Zeile 7318Zeile 7371
		else
{
if(is_string($groups))

		else
{
if(is_string($groups))

			{

			{

				$groups = explode(',', $groups);
}
else

				$groups = explode(',', $groups);
}
else

Zeile 7348Zeile 7401
	$original = $string;
$in_escape = false;
if($escape)

	$original = $string;
$in_escape = false;
if($escape)

	{

	{

		if(is_array($escape))
{
function escaped_explode_escape($string)

		if(is_array($escape))
{
function escaped_explode_escape($string)

Zeile 7392Zeile 7445
		return $original;
}
return $strings;

		return $original;
}
return $strings;

}

}


/**
* DEPRECATED! Please use IPv6 compatible fetch_ip_range!


/**
* DEPRECATED! Please use IPv6 compatible fetch_ip_range!

Zeile 7593Zeile 7646
 * @param array $array The array of forums
* @return integer The number of sub forums
*/

 * @param array $array The array of forums
* @return integer The number of sub forums
*/

function subforums_count($array)

function subforums_count($array=array())

{
$count = 0;
foreach($array as $array2)

{
$count = 0;
foreach($array as $array2)

Zeile 7630Zeile 7683
	if($ip_long >= 2147483648) // Won't occur on 32-bit PHP
{
$ip_long -= 4294967296;

	if($ip_long >= 2147483648) // Won't occur on 32-bit PHP
{
$ip_long -= 4294967296;

	}


	}


	return $ip_long;
}


	return $ip_long;
}


Zeile 7868Zeile 7921
 * Time how long it takes for a particular piece of code to run. Place calls above & below the block of code.
*
* @return float The time taken

 * Time how long it takes for a particular piece of code to run. Place calls above & below the block of code.
*
* @return float The time taken

 */

 */

function get_execution_time()
{
static $time_start;

function get_execution_time()
{
static $time_start;

Zeile 7925Zeile 7978
			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;
}


Zeile 7984Zeile 8037
	if($count == 0)
{
return $bad_verify_files;

	if($count == 0)
{
return $bad_verify_files;

	}
}

/**

	}
}

/**

 * Returns a signed value equal to an integer
*
* @param int $int The integer

 * Returns a signed value equal to an integer
*
* @param int $int The integer

Zeile 8461Zeile 8514
			else
{
$string .= $input[$i];

			else
{
$string .= $input[$i];

			}
}

			}
}

		$input = $string;

		$input = $string;

	}

	}

	if($return)
{
if($allow_mb4)
{
return $input;

	if($return)
{
if($allow_mb4)
{
return $input;

		}

		}

		else
{
return preg_replace("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", '?', $input);

		else
{
return preg_replace("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", '?', $input);

		}
}
else
{

		}
}
else
{

		if($allow_mb4)
{
return true;

		if($allow_mb4)
{
return true;

Zeile 8507Zeile 8560
	}

if(!is_array($pm))

	}

if(!is_array($pm))

	{

	{

		return false;
}


		return false;
}


Zeile 8567Zeile 8620
	if(is_array($toid))
{
$recipients_to = $toid;

	if(is_array($toid))
{
$recipients_to = $toid;

	}

	}

	else

	else

	{

	{

		$recipients_to = array($toid);

		$recipients_to = array($toid);

	}

	}


$recipients_bcc = array();



$recipients_bcc = array();


Zeile 8581Zeile 8634
		$fromid = (int)$mybb->user['uid'];
}
elseif((int)$fromid < 0)

		$fromid = (int)$mybb->user['uid'];
}
elseif((int)$fromid < 0)

	{

	{

		$fromid = 0;
}


		$fromid = 0;
}


Zeile 8819Zeile 8872
	$string = str_replace('"', '""', $string);

return $string;

	$string = str_replace('"', '""', $string);

return $string;

 
}

// Fallback function for 'array_column', PHP < 5.5.0 compatibility
if(!function_exists('array_column'))
{
function array_column($input, $column_key)
{
$values = array();
if(!is_array($input))
{
$input = array($input);
}
foreach($input as $val)
{
if(is_array($val) && isset($val[$column_key]))
{
$values[] = $val[$column_key];
}
elseif(is_object($val) && isset($val->$column_key))
{
$values[] = $val->$column_key;
}
}
return $values;
}
}

/**
* 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)
{
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;
}
}

/**
* Retrieves all referrals for a specified user
*
* @param int uid
* @param int start position
* @param int total entries
* @param bool false (default) only return display info, true for all info
* @return array
*/
function get_user_referrals($uid, $start=0, $limit=0, $full=false)
{
global $db;

$referrals = $query_options = array();
$uid = (int) $uid;

if($uid === 0)
{
return $referrals;
}

if($start && $limit)
{
$query_options['limit_start'] = $start;
}

if($limit)
{
$query_options['limit'] = $limit;
}

$fields = 'uid, username, usergroup, displaygroup, regdate';
if($full === true)
{
$fields = '*';
}

$query = $db->simple_select('users', $fields, "referrer='{$uid}'", $query_options);

while($referral = $db->fetch_array($query))
{
$referrals[] = $referral;
}

return $referrals;

}

}