Vergleich inc/functions.php - 1.8.34 - 1.8.39

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1644Zeile 1644
			$groupperms = $mybb->usergroup;
}
}

			$groupperms = $mybb->usergroup;
}
}







	else 
{
$groupperms = usergroup_permissions($gid);
}


	if(!is_array($forum_cache))
{
$forum_cache = cache_forums();

	if(!is_array($forum_cache))
{
$forum_cache = cache_forums();





		if(!$forum_cache)
{
return false;

		if(!$forum_cache)
{
return false;

		}
}


		}
}


	if(!is_array($fpermcache))

	if(!is_array($fpermcache))

	{

	{

		$fpermcache = $cache->read("forumpermissions");
}


		$fpermcache = $cache->read("forumpermissions");
}


Zeile 1665Zeile 1669
		if(empty($cached_forum_permissions_permissions[$gid][$fid]))
{
$cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);

		if(empty($cached_forum_permissions_permissions[$gid][$fid]))
{
$cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);

		}

		}

		return $cached_forum_permissions_permissions[$gid][$fid];
}
else

		return $cached_forum_permissions_permissions[$gid][$fid];
}
else

Zeile 1694Zeile 1698
{
global $groupscache, $forum_cache, $fpermcache, $mybb, $fpermfields;


{
global $groupscache, $forum_cache, $fpermcache, $mybb, $fpermfields;


	$groups = explode(",", $gid);








    if(isset($gid))
{
$groups = explode(",", $gid);
}
else
{
$groups = array();
}


$current_permissions = array();
$only_view_own_threads = 1;
$only_reply_own_threads = 1;


$current_permissions = array();
$only_view_own_threads = 1;
$only_reply_own_threads = 1;





	if(empty($fpermcache[$fid])) // This forum has no custom or inherited permissions so lets just return the group permissions

	if(empty($fpermcache[$fid])) // This forum has no custom or inherited permissions so lets just return the group permissions

	{

	{

		$current_permissions = $groupperms;
}
else

		$current_permissions = $groupperms;
}
else

Zeile 1710Zeile 1721
		{
// If this forum has custom or inherited permissions for the currently looped group.
if(!empty($fpermcache[$fid][$gid]))

		{
// If this forum has custom or inherited permissions for the currently looped group.
if(!empty($fpermcache[$fid][$gid]))

			{

			{

				$level_permissions = $fpermcache[$fid][$gid];
}
// Or, use the group permission instead, if available. Some forum permissions not existing here will be added back later.

				$level_permissions = $fpermcache[$fid][$gid];
}
// Or, use the group permission instead, if available. Some forum permissions not existing here will be added back later.

Zeile 1733Zeile 1744
			}

if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"]))

			}

if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"]))

			{
$only_view_own_threads = 0;
}


			{
$only_view_own_threads = 0;
}


			if($level_permissions["canpostreplys"] && empty($level_permissions["canonlyreplyownthreads"]))
{
$only_reply_own_threads = 0;

			if($level_permissions["canpostreplys"] && empty($level_permissions["canonlyreplyownthreads"]))
{
$only_reply_own_threads = 0;

Zeile 1746Zeile 1757
		if(count($current_permissions) == 0)
{
$current_permissions = $groupperms;

		if(count($current_permissions) == 0)
{
$current_permissions = $groupperms;

		}
}


		}
}


	// Figure out if we can view more than our own threads
if($only_view_own_threads == 0 || !isset($current_permissions["canonlyviewownthreads"]))

	// Figure out if we can view more than our own threads
if($only_view_own_threads == 0 || !isset($current_permissions["canonlyviewownthreads"]))

	{

	{

		$current_permissions["canonlyviewownthreads"] = 0;
}


		$current_permissions["canonlyviewownthreads"] = 0;
}


Zeile 1759Zeile 1770
	if($only_reply_own_threads == 0 || !isset($current_permissions["canonlyreplyownthreads"]))
{
$current_permissions["canonlyreplyownthreads"] = 0;

	if($only_reply_own_threads == 0 || !isset($current_permissions["canonlyreplyownthreads"]))
{
$current_permissions["canonlyreplyownthreads"] = 0;

	}


	}


	return $current_permissions;
}


	return $current_permissions;
}


Zeile 1770Zeile 1781
 * @param array $forum The forum data
* @param bool $ignore_empty Whether to treat forum password configured as an empty string as validated
* @param bool $check_parents Whether to check parent forums using `parentlist`

 * @param array $forum The forum data
* @param bool $ignore_empty Whether to treat forum password configured as an empty string as validated
* @param bool $check_parents Whether to check parent forums using `parentlist`

 * @return bool
*/

 * @return bool
*/

function forum_password_validated($forum, $ignore_empty=false, $check_parents=false)
{
global $mybb, $forum_cache;

function forum_password_validated($forum, $ignore_empty=false, $check_parents=false)
{
global $mybb, $forum_cache;

Zeile 1782Zeile 1793
		{
$forum_cache = cache_forums();
if(!$forum_cache)

		{
$forum_cache = cache_forums();
if(!$forum_cache)

			{

			{

				return false;
}
}

				return false;
}
}

Zeile 1826Zeile 1837
	{
$forum_cache = cache_forums();
if(!$forum_cache)

	{
$forum_cache = cache_forums();
if(!$forum_cache)

		{
return false;
}

		{
return false;
}

	}

// Loop through each of parent forums to ensure we have a password for them too
if(isset($forum_cache[$fid]['parentlist']))

	}

// Loop through each of parent forums to ensure we have a password for them too
if(isset($forum_cache[$fid]['parentlist']))

	{

	{

		$parents = explode(',', $forum_cache[$fid]['parentlist']);
rsort($parents);
}
if(!empty($parents))
{
foreach($parents as $parent_id)

		$parents = explode(',', $forum_cache[$fid]['parentlist']);
rsort($parents);
}
if(!empty($parents))
{
foreach($parents as $parent_id)

		{

		{

			if($parent_id == $fid || $parent_id == $pid)

			if($parent_id == $fid || $parent_id == $pid)

			{

			{

				continue;

				continue;

			}

			}


if($forum_cache[$parent_id]['password'] !== "")
{
check_forum_password($parent_id, $fid);


if($forum_cache[$parent_id]['password'] !== "")
{
check_forum_password($parent_id, $fid);

			}
}
}

			}
}
}


if($forum_cache[$fid]['password'] !== '')
{
if(isset($mybb->input['pwverify']) && $pid == 0)
{
if(my_hash_equals($forum_cache[$fid]['password'], $mybb->get_input('pwverify')))


if($forum_cache[$fid]['password'] !== '')
{
if(isset($mybb->input['pwverify']) && $pid == 0)
{
if(my_hash_equals($forum_cache[$fid]['password'], $mybb->get_input('pwverify')))

			{

			{

				my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->get_input('pwverify')), null, true);

				my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->get_input('pwverify')), null, true);

				$showform = false;
}
else
{

				$showform = false;
}
else
{

				eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
$showform = true;
}

				eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
$showform = true;
}

Zeile 1886Zeile 1897
	}

if($return)

	}

if($return)

	{

	{

		return $showform;
}


		return $showform;
}


Zeile 1920Zeile 1931
	static $modpermscache;

if($uid < 1)

	static $modpermscache;

if($uid < 1)

	{

	{

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


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


Zeile 2102Zeile 2113
				}
}
return false;

				}
}
return false;

		}
else

		}
else

		{
$modperms = get_moderator_permissions($fid, $uid);


		{
$modperms = get_moderator_permissions($fid, $uid);


Zeile 2120Zeile 2131
				else
{
return false;

				else
{
return false;

				}
}
}
}
}

/**

				}
}
}
}
}

/**

 * Get an array of fids that the forum moderator has access to.
* Do not use for administraotrs or global moderators as they moderate any forum and the function will return false.
*

 * Get an array of fids that the forum moderator has access to.
* Do not use for administraotrs or global moderators as they moderate any forum and the function will return false.
*

Zeile 2136Zeile 2147
function get_moderated_fids($uid=0)
{
global $mybb, $cache;

function get_moderated_fids($uid=0)
{
global $mybb, $cache;


if($uid == 0)
{


if($uid == 0)
{

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


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


Zeile 2194Zeile 2205
	if(isset($mybb->input['icon']))
{
$icon = $mybb->get_input('icon');

	if(isset($mybb->input['icon']))
{
$icon = $mybb->get_input('icon');

	}


	}


	$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

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

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

	}
else

	}
else

	{
$posticons = '';
}

	{
$posticons = '';
}

Zeile 2287Zeile 2298
	}

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";
}

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

		$cookie .= "; HttpOnly";
}

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





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

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

	}


	}


	if($mybb->settings['cookiesecureflag'])
{
$cookie .= "; Secure";

	if($mybb->settings['cookiesecureflag'])
{
$cookie .= "; Secure";

	}

$mybb->cookies[$name] = $value;

	}

$mybb->cookies[$name] = $value;


header($cookie, false);
}


header($cookie, false);
}

Zeile 2322Zeile 2333
 * @param string $name The cookie identifier.
*/
function my_unsetcookie($name)

 * @param string $name The cookie identifier.
*/
function my_unsetcookie($name)

{

{

	global $mybb;

	global $mybb;





	$expires = -3600;
my_setcookie($name, "", $expires);

	$expires = -3600;
my_setcookie($name, "", $expires);





	unset($mybb->cookies[$name]);
}

/**
* Get the contents from a serialised cookie array.

	unset($mybb->cookies[$name]);
}

/**
* Get the contents from a serialised cookie array.

 *

 *

 * @param string $name The cookie identifier.
* @param int $id The cookie content id.
* @return array|boolean The cookie id's content array or false when non-existent.

 * @param string $name The cookie identifier.
* @param int $id The cookie content id.
* @return array|boolean The cookie id's content array or false when non-existent.

Zeile 2356Zeile 2367
	else
{
return 0;

	else
{
return 0;

	}

	}

}

/**

}

/**

Zeile 2378Zeile 2389
	else
{
$newcookie = array();

	else
{
$newcookie = array();

	}

	}


$newcookie[$id] = $value;
$newcookie = my_serialize($newcookie);


$newcookie[$id] = $value;
$newcookie = my_serialize($newcookie);

Zeile 2399Zeile 2410
define('MAX_SERIALIZED_INPUT_LENGTH', 10240);
define('MAX_SERIALIZED_ARRAY_LENGTH', 256);
define('MAX_SERIALIZED_ARRAY_DEPTH', 5);

define('MAX_SERIALIZED_INPUT_LENGTH', 10240);
define('MAX_SERIALIZED_ARRAY_LENGTH', 256);
define('MAX_SERIALIZED_ARRAY_DEPTH', 5);





/**
* Credits go to https://github.com/piwik
* Safe unserialize() replacement

/**
* Credits go to https://github.com/piwik
* Safe unserialize() replacement

Zeile 2420Zeile 2431
	}

if(empty($str) || !is_string($str))

	}

if(empty($str) || !is_string($str))

	{

	{

		return false;
}


		return false;
}


Zeile 2441Zeile 2452
		if($type == '}')
{
$str = substr($str, 1);

		if($type == '}')
{
$str = substr($str, 1);

		}

		}

		else if($type == 'N' && $str[1] == ';')
{
$value = null;
$str = substr($str, 2);

		else if($type == 'N' && $str[1] == ';')
{
$value = null;
$str = substr($str, 2);

		}

		}

		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
{
$value = $matches[1] == '1' ? true : false;
$str = substr($str, 4);

		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
{
$value = $matches[1] == '1' ? true : false;
$str = substr($str, 4);

		}

		}

		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
{
$value = (int)$matches[1];

		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
{
$value = (int)$matches[1];

Zeile 2461Zeile 2472
		{
$value = (float)$matches[1];
$str = $matches[3];

		{
$value = (float)$matches[1];
$str = $matches[3];

		}

		}

		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
{
$value = substr($matches[2], 0, (int)$matches[1]);

		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
{
$value = substr($matches[2], 0, (int)$matches[1]);

Zeile 2496Zeile 2507
					$stack[] = &$list;
$list[$key] = array();
$list = &$list[$key];

					$stack[] = &$list;
$list[$key] = array();
$list = &$list[$key];

					$expected[] = $expectedLength;
$state = 2;
break;
}
if($type != '}')
{
$list[$key] = $value;

					$expected[] = $expectedLength;
$state = 2;
break;
}
if($type != '}')
{
$list[$key] = $value;

					$state = 2;
break;
}

					$state = 2;
break;
}

Zeile 2584Zeile 2595
		return false;
}
return $data;

		return false;
}
return $data;

}

}


/**
* Credits go to https://github.com/piwik


/**
* Credits go to https://github.com/piwik

Zeile 2601Zeile 2612
	{
$mbIntEnc = mb_internal_encoding();
mb_internal_encoding('ASCII');

	{
$mbIntEnc = mb_internal_encoding();
mb_internal_encoding('ASCII');

	}

	}


$out = _safe_unserialize($str, $unlimited);


$out = _safe_unserialize($str, $unlimited);





	if(isset($mbIntEnc))
{
mb_internal_encoding($mbIntEnc);
}

return $out;

	if(isset($mbIntEnc))
{
mb_internal_encoding($mbIntEnc);
}

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 2708Zeile 2738
		{
// sys_getloadavg() will return an array with [0] being load within the last minute.
$serverload = sys_getloadavg();

		{
// sys_getloadavg() will return an array with [0] being load within the last minute.
$serverload = sys_getloadavg();

 

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


			$serverload[0] = round($serverload[0], 4);
}
else if(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg"))

			$serverload[0] = round($serverload[0], 4);
}
else if(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg"))

Zeile 3236Zeile 3272
	// 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 3611Zeile 3650
function build_mycode_inserter($bind="message", $smilies = true)
{
global $db, $mybb, $theme, $templates, $lang, $plugins, $smiliecache, $cache;

function build_mycode_inserter($bind="message", $smilies = true)
{
global $db, $mybb, $theme, $templates, $lang, $plugins, $smiliecache, $cache;

 

$codeinsert = '';


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


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

Zeile 3768Zeile 3809
							++$i;
}
else

							++$i;
}
else

						{

						{

							$moresmilies .= '"'.$find.'": "'.$image.'",';
}


							$moresmilies .= '"'.$find.'": "'.$image.'",';
}


Zeile 3787Zeile 3828
			{
$basic1 = "bold,italic,underline,strike|";
$basic2 = "horizontalrule,";

			{
$basic1 = "bold,italic,underline,strike|";
$basic2 = "horizontalrule,";

			}


			}


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

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

			{

			{

				$align = "left,center,right,justify|";
}

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

				$align = "left,center,right,justify|";
}

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

			}

			}


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


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

Zeile 3815Zeile 3856
			}

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

			}

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

			{

			{

				$email = "email,";

				$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 3844Zeile 3885
	}

return $codeinsert;

	}

return $codeinsert;

}

/**

}

/**

 * @param int $tid
* @param array $postoptions The options carried with form submit
*

 * @param int $tid
* @param array $postoptions The options carried with form submit
*

Zeile 3884Zeile 3925
		$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 5313Zeile 5354
			$nicetime['minutes'] = "1".$lang_minute;
}
else if($minutes > 1)

			$nicetime['minutes'] = "1".$lang_minute;
}
else if($minutes > 1)

		{

		{

			$nicetime['minutes'] = $minutes.$lang_minutes;
}
}

			$nicetime['minutes'] = $minutes.$lang_minutes;
}
}

Zeile 5714Zeile 5755
	}
else
{

	}
else
{

		$parts = explode('.', $number);








        if(isset($number))
{
$parts = explode('.', $number);
}
else
{
$parts = array();
}


if(isset($parts[1]))
{


if(isset($parts[1]))
{

Zeile 6101Zeile 6149

$string = preg_replace("#&\#([0-9]+);#", "-", $string);



$string = preg_replace("#&\#([0-9]+);#", "-", $string);


	if(strtolower($lang->settings['charset']) == "utf-8")

	if(isset($lang->settings['charset']) && strtolower($lang->settings['charset']) == "utf-8")

	{
// Get rid of any excess RTL and LTR override for they are the workings of the devil
$string = str_replace(dec_to_utf8(8238), "", $string);

	{
// Get rid of any excess RTL and LTR override for they are the workings of the devil
$string = str_replace(dec_to_utf8(8238), "", $string);

Zeile 6781Zeile 6829
		else
{
$post_cache[$pid] = false;

		else
{
$post_cache[$pid] = false;

			return false;
}

			return false;
}

	}
}


	}
}


Zeile 6962Zeile 7010
	if($db->fetch_field($query, "emails") > 0)
{
return true;

	if($db->fetch_field($query, "emails") > 0)
{
return true;

	}

return false;
}


	}

return false;
}


/**
* Rebuilds settings.php
*

/**
* Rebuilds settings.php
*

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

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

	}


	}


	$settings = "<"."?php\n/*********************************\ \n  DO NOT EDIT THIS FILE, PLEASE USE\n  THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n";

file_put_contents(MYBB_ROOT.'inc/settings.php', $settings, LOCK_EX);

	$settings = "<"."?php\n/*********************************\ \n  DO NOT EDIT THIS FILE, PLEASE USE\n  THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n";

file_put_contents(MYBB_ROOT.'inc/settings.php', $settings, LOCK_EX);

Zeile 7026Zeile 7074
		"~"
);
$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 7105
						}
$words[] = trim($word);
}

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

				}
}

				}
}

			$inquote = !$inquote;

			$inquote = !$inquote;

		}

		}

	}
// Otherwise just a simple search query with no phrases
else

	}
// Otherwise just a simple search query with no phrases
else

Zeile 7078Zeile 7126
				$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)

Zeile 7243Zeile 7288

/**
* Checks if a specific IP address has been banned.


/**
* Checks if a specific IP address has been banned.

 *

 *

 * @param string $ip_address The IP address.
* @param boolean $update_lastuse True if the 'last used' dateline should be updated if a match is found.
* @return boolean True if banned, false if not banned.

 * @param string $ip_address The IP address.
* @param boolean $update_lastuse True if the 'last used' dateline should be updated if a match is found.
* @return boolean True if banned, false if not banned.

Zeile 7426Zeile 7471
	if(!isset($url_components['scheme']))
{
$url_components['scheme'] = 'https';

	if(!isset($url_components['scheme']))
{
$url_components['scheme'] = 'https';

	}

	}

	if(!isset($url_components['port']))
{
$url_components['port'] = $url_components['scheme'] == 'https' ? 443 : 80;

	if(!isset($url_components['port']))
{
$url_components['port'] = $url_components['scheme'] == 'https' ? 443 : 80;

Zeile 7449Zeile 7494
	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 7472Zeile 7517
	if(!empty($post_data))
{
foreach($post_data as $key => $val)

	if(!empty($post_data))
{
foreach($post_data as $key => $val)

		{

		{

			$post_body .= '&'.urlencode($key).'='.urlencode($val);
}
$post_body = ltrim($post_body, '&');
}

			$post_body .= '&'.urlencode($key).'='.urlencode($val);
}
$post_body = ltrim($post_body, '&');
}





	if(function_exists("curl_init"))
{
$fetch_header = $max_redirects > 0;

$ch = curl_init();

	if(function_exists("curl_init"))
{
$fetch_header = $max_redirects > 0;

$ch = curl_init();





		$curlopt = array(
CURLOPT_URL => $url,
CURLOPT_HEADER => $fetch_header,

		$curlopt = array(
CURLOPT_URL => $url,
CURLOPT_HEADER => $fetch_header,

Zeile 7506Zeile 7551
		$curl_version = $curl_version_info['version'];

if(version_compare(PHP_VERSION, '7.0.7', '>=') && version_compare($curl_version, '7.49', '>='))

		$curl_version = $curl_version_info['version'];

if(version_compare(PHP_VERSION, '7.0.7', '>=') && version_compare($curl_version, '7.49', '>='))

		{

		{

			// 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', '>='))

		{

		{

			// CURLOPT_RESOLVE
$curlopt[10203] = array(
$url_components['host'].':'.$url_components['port'].':'.$destination_address
);

			// CURLOPT_RESOLVE
$curlopt[10203] = array(
$url_components['host'].':'.$url_components['port'].':'.$destination_address
);

 
		}

if(defined('CURLOPT_DISALLOW_USERNAME_IN_URL'))
{
$curlopt[CURLOPT_DISALLOW_USERNAME_IN_URL] = true;

		}

if(!empty($post_body))

		}

if(!empty($post_body))