Vergleich inc/functions.php - 1.8.3 - 1.8.4

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 173Zeile 173

if(isset($config))
{


if(isset($config))
{

 
			// Load DB interface
require_once MYBB_ROOT."inc/db_base.php";


			require_once MYBB_ROOT."inc/db_".$config['database']['type'].".php";
switch($config['database']['type'])
{

			require_once MYBB_ROOT."inc/db_".$config['database']['type'].".php";
switch($config['database']['type'])
{

Zeile 216Zeile 219

// We have some shutdown queries needing to be run
if(is_array($shutdown_queries))


// We have some shutdown queries needing to be run
if(is_array($shutdown_queries))

	{

	{

		// Loop through and run them all
foreach($shutdown_queries as $query)

		// Loop through and run them all
foreach($shutdown_queries as $query)

		{

		{

			$db->query($query);

			$db->query($query);

		}

		}

	}

// Run any shutdown functions if we have them

	}

// Run any shutdown functions if we have them

Zeile 230Zeile 233
		foreach($shutdown_functions as $function)
{
call_user_func_array($function['function'], $function['arguments']);

		foreach($shutdown_functions as $function)
{
call_user_func_array($function['function'], $function['arguments']);

		}

		}

	}

$done_shutdown = true;
}

	}

$done_shutdown = true;
}





/**
* Sends a specified amount of messages from the mail queue
*

/**
* Sends a specified amount of messages from the mail queue
*

Zeile 244Zeile 247
function send_mail_queue($count=10)
{
global $db, $cache, $plugins;

function send_mail_queue($count=10)
{
global $db, $cache, $plugins;


$plugins->run_hooks("send_mail_queue_start");


$plugins->run_hooks("send_mail_queue_start");


// Check to see if the mail queue has messages needing to be sent
$mailcache = $cache->read("mailqueue");


// Check to see if the mail queue has messages needing to be sent
$mailcache = $cache->read("mailqueue");

Zeile 290Zeile 293
	if($htmldoctype)
{
$contents = $htmldoctype.$contents;

	if($htmldoctype)
{
$contents = $htmldoctype.$contents;

	}
else

	}
else

	{
$contents = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".$contents;
}

	{
$contents = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".$contents;
}

Zeile 397Zeile 400
	if($format == 'relative')
{
// Relative formats both date and time

	if($format == 'relative')
{
// Relative formats both date and time

		if($ty != 2 && (TIME_NOW - $stamp) < 3600)

		if($ty != 2 && abs(TIME_NOW - $stamp) < 3600)

		{
$diff = TIME_NOW - $stamp;
$relative = array('prefix' => '', 'minute' => 0, 'plural' => $lang->rel_minutes_plural, 'suffix' => $lang->rel_ago);

		{
$diff = TIME_NOW - $stamp;
$relative = array('prefix' => '', 'minute' => 0, 'plural' => $lang->rel_minutes_plural, 'suffix' => $lang->rel_ago);

Zeile 425Zeile 428

$date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['minute'], $relative['plural'], $relative['suffix']);
}


$date = $lang->sprintf($lang->rel_time, $relative['prefix'], $relative['minute'], $relative['plural'], $relative['suffix']);
}

		elseif($ty != 2 && (TIME_NOW - $stamp) >= 3600 && (TIME_NOW - $stamp) < 43200)

		elseif($ty != 2 && abs(TIME_NOW - $stamp) < 43200)

		{
$diff = TIME_NOW - $stamp;
$relative = array('prefix' => '', 'hour' => 0, 'plural' => $lang->rel_hours_plural, 'suffix' => $lang->rel_ago);

		{
$diff = TIME_NOW - $stamp;
$relative = array('prefix' => '', 'hour' => 0, 'plural' => $lang->rel_hours_plural, 'suffix' => $lang->rel_ago);

Zeile 756Zeile 759
	}

// AJAX error message?

	}

// AJAX error message?

	if($mybb->get_input('ajax', 1))

	if($mybb->get_input('ajax', MyBB::INPUT_INT))

	{
// Send our headers.
@header("Content-type: application/json; charset={$lang->settings['charset']}");

	{
// Send our headers.
@header("Content-type: application/json; charset={$lang->settings['charset']}");

Zeile 802Zeile 805
	}

// AJAX error message?

	}

// AJAX error message?

	if($mybb->get_input('ajax', 1))

	if($mybb->get_input('ajax', MyBB::INPUT_INT))

	{
// Send our headers.
@header("Content-type: application/json; charset={$lang->settings['charset']}");

	{
// Send our headers.
@header("Content-type: application/json; charset={$lang->settings['charset']}");

Zeile 848Zeile 851

$db->update_query("sessions", $noperm_array, "sid='{$session->sid}'");



$db->update_query("sessions", $noperm_array, "sid='{$session->sid}'");


	if($mybb->get_input('ajax', 1))

	if($mybb->get_input('ajax', MyBB::INPUT_INT))

	{
// Send our headers.
header("Content-type: application/json; charset={$lang->settings['charset']}");

	{
// Send our headers.
header("Content-type: application/json; charset={$lang->settings['charset']}");

Zeile 909Zeile 912

$plugins->run_hooks("redirect", $redirect_args);



$plugins->run_hooks("redirect", $redirect_args);


	if($mybb->get_input('ajax', 1))

	if($mybb->get_input('ajax', MyBB::INPUT_INT))

	{
// Send our headers.
//@header("Content-type: text/html; charset={$lang->settings['charset']}");

	{
// Send our headers.
//@header("Content-type: text/html; charset={$lang->settings['charset']}");

Zeile 1128Zeile 1131
		// Remove "Page 1" to the defacto URL
$url = str_replace($find, array("", "", $page), $url);
return $url;

		// Remove "Page 1" to the defacto URL
$url = str_replace($find, array("", "", $page), $url);
return $url;

	}

	}

	else if(strpos($url, "{page}") === false)
{
// If no page identifier is specified we tack it on to the end of the URL

	else if(strpos($url, "{page}") === false)
{
// If no page identifier is specified we tack it on to the end of the URL

Zeile 1153Zeile 1156

/**
* Fetch the permissions for a specific user


/**
* Fetch the permissions for a specific user

 *

 *

 * @param int The user ID
* @return array Array of user permissions for the specified user
*/
function user_permissions($uid=0)
{
global $mybb, $cache, $groupscache, $user_cache;

 * @param int The user ID
* @return array Array of user permissions for the specified user
*/
function user_permissions($uid=0)
{
global $mybb, $cache, $groupscache, $user_cache;





	// If no user id is specified, assume it is the current user
if($uid == 0)
{
$uid = $mybb->user['uid'];

	// If no user id is specified, assume it is the current user
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 1178Zeile 1181

// This user was not already cached, fetch their user information.
if(!$user_cache[$uid])


// This user was not already cached, fetch their user information.
if(!$user_cache[$uid])

		{

		{

			$user_cache[$uid] = get_user($uid);
}


			$user_cache[$uid] = get_user($uid);
}


Zeile 1198Zeile 1201
}

/**

}

/**

 * Fetch the usergroup permissions for a specic group or series of groups combined

 * Fetch the usergroup permissions for a specific group or series of groups combined

 *
* @param mixed A list of groups (Can be a single integer, or a list of groups separated by a comma)
* @return array Array of permissions generated for the groups

 *
* @param mixed A list of groups (Can be a single integer, or a list of groups separated by a comma)
* @return array Array of permissions generated for the groups

Zeile 1213Zeile 1216
	}

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

	}

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



 

if(count($groups) == 1)


if(count($groups) == 1)

	{

	{

		return $groupscache[$gid];
}

		return $groupscache[$gid];
}





	
$usergroup = array();


	foreach($groups as $gid)
{
if(trim($gid) == "" || !$groupscache[$gid])

	foreach($groups as $gid)
{
if(trim($gid) == "" || !$groupscache[$gid])

Zeile 1228Zeile 1232
		}

foreach($groupscache[$gid] as $perm => $access)

		}

foreach($groupscache[$gid] as $perm => $access)

		{

		{

			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
{
$permbit = "";

				else
{
$permbit = "";

				}


				}


				// 0 represents unlimited for numerical group permissions (i.e. private message limit) so take that into account.
if(in_array($perm, $groupzerogreater) && ($access == 0 || $permbit === 0))
{

				// 0 represents unlimited for numerical group permissions (i.e. private message limit) so take that into account.
if(in_array($perm, $groupzerogreater) && ($access == 0 || $permbit === 0))
{

Zeile 1320Zeile 1324
			}

$groupperms = $mybb->usergroup;

			}

$groupperms = $mybb->usergroup;

		}
}

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

Zeile 1339Zeile 1343
	}

if($fid) // Fetch the permissions for a single forum

	}

if($fid) // Fetch the permissions for a single forum

	{

	{

		if(empty($cached_forum_permissions_permissions[$gid][$fid]))

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

			$cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);
}
return $cached_forum_permissions_permissions[$gid][$fid];

Zeile 1351Zeile 1355
		if(empty($cached_forum_permissions[$gid]))
{
foreach($forum_cache as $forum)

		if(empty($cached_forum_permissions[$gid]))
{
foreach($forum_cache as $forum)

			{

			{

				$cached_forum_permissions[$gid][$forum['fid']] = fetch_forum_permissions($forum['fid'], $gid, $groupperms);
}
}

				$cached_forum_permissions[$gid][$forum['fid']] = fetch_forum_permissions($forum['fid'], $gid, $groupperms);
}
}

Zeile 1375Zeile 1379
	$groups = explode(",", $gid);

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

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

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

	{

	{

		return $groupperms;
}

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

		return $groupperms;
}

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

 
	$only_reply_own_threads = 1;


foreach($groups as $gid)
{


foreach($groups as $gid)
{

Zeile 1423Zeile 1428
			if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"]))
{
$only_view_own_threads = 0;

			if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"]))
{
$only_view_own_threads = 0;

			}
}
}







			}

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


	// Figure out if we can view more than our own threads
if($only_view_own_threads == 0)

	// Figure out if we can view more than our own threads
if($only_view_own_threads == 0)

	{

	{

		$current_permissions["canonlyviewownthreads"] = 0;

		$current_permissions["canonlyviewownthreads"] = 0;

 
	}

// Figure out if we can reply more than our own threads
if($only_reply_own_threads == 0)
{
$current_permissions["canonlyreplyownthreads"] = 0;

	}

if(count($current_permissions) == 0)

	}

if(count($current_permissions) == 0)

Zeile 1449Zeile 1465
function check_forum_password($fid, $pid=0)
{
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;

function check_forum_password($fid, $pid=0)
{
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;





	$showform = true;

if(!is_array($forum_cache))

	$showform = true;

if(!is_array($forum_cache))

Zeile 1496Zeile 1512
			else
{
eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");

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

				$showform = true;
}
}

				$showform = true;
}
}

		else
{
if(!$mybb->cookies['forumpass'][$fid] || ($mybb->cookies['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $mybb->cookies['forumpass'][$fid]))
{
$showform = true;

		else
{
if(!$mybb->cookies['forumpass'][$fid] || ($mybb->cookies['forumpass'][$fid] && md5($mybb->user['uid'].$password) != $mybb->cookies['forumpass'][$fid]))
{
$showform = true;

			}

			}

			else
{
$showform = false;
}
}

			else
{
$showform = false;
}
}

	}

	}

	else

	else

	{

	{

		$showform = false;
}


		$showform = false;
}


Zeile 1521Zeile 1537
		if($pid)
{
header("Location: ".$mybb->settings['bburl']."/".get_forum_link($fid));

		if($pid)
{
header("Location: ".$mybb->settings['bburl']."/".get_forum_link($fid));

		}
else

		}
else

		{
$_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
eval("\$pwform = \"".$templates->get("forumdisplay_password")."\";");

		{
$_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
eval("\$pwform = \"".$templates->get("forumdisplay_password")."\";");

Zeile 1572Zeile 1588
	$groups = array($user['usergroup']);

if(!empty($user['additionalgroups']))

	$groups = array($user['usergroup']);

if(!empty($user['additionalgroups']))

	{

	{

		$extra_groups = explode(",", $user['additionalgroups']);

foreach($extra_groups as $extra_group)

		$extra_groups = explode(",", $user['additionalgroups']);

foreach($extra_groups as $extra_group)

Zeile 1621Zeile 1637
			{
// There are no permissions set for this group
continue;

			{
// There are no permissions set for this group
continue;

			}

			}


$perm = $forum['usergroups'][$group];
foreach($perm as $action => $value)


$perm = $forum['usergroups'][$group];
foreach($perm as $action => $value)

Zeile 1632Zeile 1648
				}

$perms[$action] = max($perm[$action], $perms[$action]);

				}

$perms[$action] = max($perm[$action], $perms[$action]);

			}
}

			}
}

	}

$modpermscache[$fid][$uid] = $perms;

	}

$modpermscache[$fid][$uid] = $perms;

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

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

	}


	}


	if($uid == 0)
{
return false;

	if($uid == 0)
{
return false;

Zeile 1718Zeile 1734
					return false;
}
}

					return false;
}
}

		}
}

		}
}

}

/**

}

/**

Zeile 1750Zeile 1766
	foreach($posticons as $dbicon)
{
$dbicon['path'] = str_replace("{theme}", $theme['imgdir'], $dbicon['path']);

	foreach($posticons as $dbicon)
{
$dbicon['path'] = str_replace("{theme}", $theme['imgdir'], $dbicon['path']);

		$dbicon['path'] = htmlspecialchars_uni($dbicon['path']);

		$dbicon['path'] = htmlspecialchars_uni($mybb->get_asset_url($dbicon['path']));

		$dbicon['name'] = htmlspecialchars_uni($dbicon['name']);

if($icon == $dbicon['iid'])

		$dbicon['name'] = htmlspecialchars_uni($dbicon['name']);

if($icon == $dbicon['iid'])

Zeile 1899Zeile 1915
	}

$newcookie[$id] = $value;

	}

$newcookie[$id] = $value;

	$newcookie = serialize($newcookie);

	$newcookie = my_serialize($newcookie);

	my_setcookie("mybb[$name]", addslashes($newcookie), $expires);

// Make sure our current viarables are up-to-date as well
$mybb->cookies['mybb'][$name] = $newcookie;

	my_setcookie("mybb[$name]", addslashes($newcookie), $expires);

// Make sure our current viarables are up-to-date as well
$mybb->cookies['mybb'][$name] = $newcookie;

 
}

/*
* Arbitrary limits for _safe_unserialize()
*/
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
* - accepts a strict subset of PHP's native my_serialized representation
* - does not unserialize objects
*
* @param string $str
* @return mixed
* @throw Exception if $str is malformed or contains unsupported types (e.g., resources, objects)
*/
function _safe_unserialize($str)
{
if(strlen($str) > MAX_SERIALIZED_INPUT_LENGTH)
{
// input exceeds MAX_SERIALIZED_INPUT_LENGTH
return false;
}

if(empty($str) || !is_string($str))
{
return false;
}

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

/*
* states:
* 0 - initial state, expecting a single value or array
* 1 - terminal state
* 2 - in array, expecting end of array or a key
* 3 - in array, expecting value or another array
*/
$state = 0;
while($state != 1)
{
$type = isset($str[0]) ? $str[0] : '';

if($type == '}')
{
$str = substr($str, 1);
}
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 == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
{
$value = (int)$matches[1];
$str = $matches[2];
}
else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
{
$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]);
$str = substr($matches[2], (int)$matches[1] + 2);
}
else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches) && $matches[1] < MAX_SERIALIZED_ARRAY_LENGTH)
{
$expectedLength = (int)$matches[1];
$str = $matches[2];
}
else
{
// object or unknown/malformed type
return false;
}

switch($state)
{
case 3: // in array, expecting value or another array
if($type == 'a')
{
if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
{
// array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH
return false;
}

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

// missing array value
return false;

case 2: // in array, expecting end of array or a key
if($type == '}')
{
if(count($list) < end($expected))
{
// array size less than expected
return false;
}

unset($list);
$list = &$stack[count($stack)-1];
array_pop($stack);

// go to terminal state if we're at the end of the root array
array_pop($expected);
if(count($expected) == 0) {
$state = 1;
}
break;
}
if($type == 'i' || $type == 's')
{
if(count($list) >= MAX_SERIALIZED_ARRAY_LENGTH)
{
// array size exceeds MAX_SERIALIZED_ARRAY_LENGTH
return false;
}
if(count($list) >= end($expected))
{
// array size exceeds expected length
return false;
}

$key = $value;
$state = 3;
break;
}

// illegal array index type
return false;

case 0: // expecting array or value
if($type == 'a')
{
if(count($stack) >= MAX_SERIALIZED_ARRAY_DEPTH)
{
// array nesting exceeds MAX_SERIALIZED_ARRAY_DEPTH
return false;
}

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

// not in array
return false;
}
}

if(!empty($str))
{
// trailing data in input
return false;
}
return $data;
}

/**
* Credits go to https://github.com/piwik
* Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue
*
* @param string $str
* @return mixed
*/
function my_unserialize($str)
{
// Ensure we use the byte count for strings even when strlen() is overloaded by mb_strlen()
if(function_exists('mb_internal_encoding') && (((int)ini_get('mbstring.func_overload')) & 2))
{
$mbIntEnc = mb_internal_encoding();
mb_internal_encoding('ASCII');
}

$out = _safe_unserialize($str);

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

return $out;
}

/**
* Credits go to https://github.com/piwik
* Safe serialize() replacement
* - output a strict subset of PHP's native serialized representation
* - does not my_serialize objects
*
* @param mixed $value
* @return string
* @throw Exception if $value is malformed or contains unsupported types (e.g., resources, objects)
*/
function _safe_serialize( $value )
{
if(is_null($value))
{
return 'N;';
}

if(is_bool($value))
{
return 'b:'.(int)$value.';';
}

if(is_int($value))
{
return 'i:'.$value.';';
}

if(is_float($value))
{
return 'd:'.str_replace(',', '.', $value).';';
}

if(is_string($value))
{
return 's:'.strlen($value).':"'.$value.'";';
}

if(is_array($value))
{
$out = '';
foreach($value as $k => $v)
{
$out .= _safe_serialize($k) . _safe_serialize($v);
}

return 'a:'.count($value).':{'.$out.'}';
}

// safe_serialize cannot my_serialize resources or objects
return false;

}

/**

}

/**

 * Verifies that data passed is an array


 * Credits go to https://github.com/piwik
* Wrapper for _safe_serialize() that handles exceptions and multibyte encoding issue

 *

 *

 * @param array Data to unserialize
* @return array Unserialized data array
*/
function my_unserialize($data)

 * @param mixed $value
* @return string
*/
function my_serialize($value)

{

{

	// Do no unserialize objects
if(substr($data, 0, 1) == 'O')








	// ensure we use the byte count for strings even when strlen() is overloaded by mb_strlen()
if(function_exists('mb_internal_encoding') && (((int)ini_get('mbstring.func_overload')) & 2))
{
$mbIntEnc = mb_internal_encoding();
mb_internal_encoding('ASCII');
}

$out = _safe_serialize($value);
if(isset($mbIntEnc))

	{

	{

		return array();

		mb_internal_encoding($mbIntEnc);

	}

	}


$array = unserialize($data);

if(!is_array($array))
{
$array = array();
}

return $array;

	
return $out;








}

/**

}

/**

Zeile 2547Zeile 2831
 * @param int The current depth of forums we're at
* @param int Whether or not to show extra items such as User CP, Forum home
* @param boolean Ignore the showinjump setting and show all forums (for moderation pages)

 * @param int The current depth of forums we're at
* @param int Whether or not to show extra items such as User CP, Forum home
* @param boolean Ignore the showinjump setting and show all forums (for moderation pages)

 * @param array Array of permissions

 * @param unknown_type deprecated

 * @param string The name of the forum jump
* @return string Forum jump items
*/
function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $showall=false, $permissions="", $name="fid")
{

 * @param string The name of the forum jump
* @return string Forum jump items
*/
function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $showall=false, $permissions="", $name="fid")
{

	global $forum_cache, $jumpfcache, $permissioncache, $mybb, $selecteddone, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;

	global $forum_cache, $jumpfcache, $permissioncache, $mybb, $forumjump, $forumjumpbits, $gobutton, $theme, $templates, $lang;


$pid = (int)$pid;


$pid = (int)$pid;

	$jumpsel['default'] = '';

if($permissions)
{
$permissions = $mybb->usergroup;
}

 

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


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

		}


		}


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

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

			}
}

			}
}

	}

if(!is_array($permissioncache))
{
$permissioncache = forum_permissions();

	}

if(!is_array($permissioncache))
{
$permissioncache = forum_permissions();

	}

	}


if(isset($jumpfcache[$pid]) && is_array($jumpfcache[$pid]))
{
foreach($jumpfcache[$pid] as $main)
{
foreach($main as $forum)


if(isset($jumpfcache[$pid]) && is_array($jumpfcache[$pid]))
{
foreach($jumpfcache[$pid] as $main)
{
foreach($main as $forum)

			{

			{

				$perms = $permissioncache[$forum['fid']];

if($forum['fid'] != "0" && ($perms['canview'] != 0 || $mybb->settings['hideprivateforums'] == 0) && $forum['linkto'] == '' && ($forum['showinjump'] != 0 || $showall == true))

				$perms = $permissioncache[$forum['fid']];

if($forum['fid'] != "0" && ($perms['canview'] != 0 || $mybb->settings['hideprivateforums'] == 0) && $forum['linkto'] == '' && ($forum['showinjump'] != 0 || $showall == true))

Zeile 2598Zeile 2876

if($selitem == $forum['fid'])
{


if($selitem == $forum['fid'])
{

						$optionselected = "selected=\"selected\"";
$selecteddone = 1;

						$optionselected = 'selected="selected"';


					}

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

					}

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

Zeile 2618Zeile 2895

if($addselect)
{


if($addselect)
{

		if(!$selecteddone)
{
if(!$selitem)
{
$selitem = "default";
}

$jumpsel[$selitem] = 'selected="selected"';
}


 
		if($showextras == 0)
{
$template = "special";

		if($showextras == 0)
{
$template = "special";

Zeile 2638Zeile 2905

if(strpos(FORUM_URL, '.html') !== false)
{


if(strpos(FORUM_URL, '.html') !== false)
{

				$forum_link = "'".str_replace('{fid}', "'+this.options[this.selectedIndex].value+'", FORUM_URL)."'";

				$forum_link = "'".str_replace('{fid}', "'+option+'", FORUM_URL)."'";

			}
else
{

			}
else
{

				$forum_link = "'".str_replace('{fid}', "'+this.options[this.selectedIndex].value", FORUM_URL);

				$forum_link = "'".str_replace('{fid}', "'+option", FORUM_URL);

			}
}


			}
}


Zeile 2752Zeile 3019
	if(!$max_dimensions)
{
$max_dimensions = $mybb->settings['maxavatardims'];

	if(!$max_dimensions)
{
$max_dimensions = $mybb->settings['maxavatardims'];

	}

$avatar_width_height = '';

	}

$avatar_width_height = '';


if($dimensions)
{


if($dimensions)
{

Zeile 2778Zeile 3045
	}

$avatars[$avatar] = array(

	}

$avatars[$avatar] = array(

		'image' => $mybb->get_asset_url($avatar),

		'image' => htmlspecialchars_uni($mybb->get_asset_url($avatar)),

		'width_height' => $avatar_width_height
);


		'width_height' => $avatar_width_height
);


Zeile 2939Zeile 3206
						// Only show the first text to replace in the box
$smilie['find'] = $finds[0];


						// Only show the first text to replace in the box
$smilie['find'] = $finds[0];


						$find = htmlspecialchars_uni($smilie['find']);
$image = $mybb->get_asset_url($smilie['image']);
$image = htmlspecialchars_uni($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($i < $mybb->settings['smilieinsertertot'])
{
$dropdownsmilies .= '"'.$find.'": "'.$image.'",';

						if($i < $mybb->settings['smilieinsertertot'])
{
$dropdownsmilies .= '"'.$find.'": "'.$image.'",';

Zeile 2953Zeile 3221

for($j = 1; $j < $finds_count; ++$j)
{


for($j = 1; $j < $finds_count; ++$j)
{

							$find = htmlspecialchars_uni($finds[$j]);

							$find = str_replace(array('\\', '"'), array('\\\\', '\"'), htmlspecialchars_uni($finds[$j]));

							$hiddensmilies .= '"'.$find.'": "'.$image.'",';
}
++$i;
}
}

							$hiddensmilies .= '"'.$find.'": "'.$image.'",';
}
++$i;
}
}

			}

$basic1 = $basic2 = $align = $font = $size = $color = $removeformat = $email = $link = $list = $code = $sourcemode = "";


			}

$basic1 = $basic2 = $align = $font = $size = $color = $removeformat = $email = $link = $list = $code = $sourcemode = "";


			if($mybb->settings['allowbasicmycode'] == 1)
{
$basic1 = "bold,italic,underline,strike|";
$basic2 = "horizontalrule,";

			if($mybb->settings['allowbasicmycode'] == 1)
{
$basic1 = "bold,italic,underline,strike|";
$basic2 = "horizontalrule,";

			}


			}


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

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

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

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

			{

			{

				$font = "font,";
}


				$font = "font,";
}


Zeile 2987Zeile 3255
			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)

				$removeformat = "removeformat|";
}

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

			{

			{

				$email = "email,";

				$email = "email,";

			}


			}


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

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

			}


			}


			if($mybb->settings['allowlistmycode'] == 1)
{
$list = "bulletlist,orderedlist|";
}

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

			if($mybb->settings['allowlistmycode'] == 1)
{
$list = "bulletlist,orderedlist|";
}

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

			{

			{

				$code = "code,php,";

				$code = "code,php,";

			}


			}


			if($mybb->user['sourceeditor'] == 1)
{
$sourcemode = "MyBBEditor.sourceMode(true);";

			if($mybb->user['sourceeditor'] == 1)
{
$sourcemode = "MyBBEditor.sourceMode(true);";

			}


			}


			eval("\$codeinsert = \"".$templates->get("codebuttons")."\";");
}
}

return $codeinsert;
}

			eval("\$codeinsert = \"".$templates->get("codebuttons")."\";");
}
}

return $codeinsert;
}





/**
* Build the javascript clickable smilie inserter
*

/**
* Build the javascript clickable smilie inserter
*

Zeile 3055Zeile 3323
				{
$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;

				}
}
}

				}
}
}


unset($smilie);



unset($smilie);


Zeile 3069Zeile 3337
			if($mybb->settings['smilieinsertertot'] >= $smiliecount)
{
$mybb->settings['smilieinsertertot'] = $smiliecount;

			if($mybb->settings['smilieinsertertot'] >= $smiliecount)
{
$mybb->settings['smilieinsertertot'] = $smiliecount;

			}

			}

			else if($mybb->settings['smilieinsertertot'] < $smiliecount)
{
$smiliecount = $mybb->settings['smilieinsertertot'];

			else if($mybb->settings['smilieinsertertot'] < $smiliecount)
{
$smiliecount = $mybb->settings['smilieinsertertot'];

Zeile 3089Zeile 3357
					{
$smilies .= "<tr>\n";
}

					{
$smilies .= "<tr>\n";
}







					
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
$smilie['image'] = htmlspecialchars_uni($mybb->get_asset_url($smilie['image']));
$smilie['name'] = htmlspecialchars_uni($smilie['name']);


					// Only show the first text to replace in the box
$temp = explode("\n", $smilie['find']); // assign to temporary variable for php 5.3 compatibility
$smilie['find'] = $temp[0];


					// Only show the first text to replace in the box
$temp = explode("\n", $smilie['find']); // assign to temporary variable for php 5.3 compatibility
$smilie['find'] = $temp[0];


					$find = htmlspecialchars_uni($smilie['find']);

					$find = str_replace(array('\\', "'"), array('\\\\', "\'"), htmlspecialchars_uni($smilie['find']));





					$onclick = ' onclick="MyBBEditor.insertText(\' '.$smilie['find'].' \');"';

					$onclick = " onclick=\"MyBBEditor.insertText(' $find ');\"";

					$extra_class = ' smilie_pointer';
eval('$smilie = "'.$templates->get('smilie', 1, 0).'";');
eval("\$smilies .= \"".$templates->get("smilieinsert_smilie")."\";");

					$extra_class = ' smilie_pointer';
eval('$smilie = "'.$templates->get('smilie', 1, 0).'";');
eval("\$smilies .= \"".$templates->get("smilieinsert_smilie")."\";");

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

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

	}
else

	}
else

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

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





	return $prefixselect;
}


	return $prefixselect;
}


Zeile 3307Zeile 3579
 *  @param mixed The selected prefix ID (integer ID)
*/
function build_forum_prefix_select($fid, $selected_pid=0)

 *  @param mixed The selected prefix ID (integer ID)
*/
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 3337Zeile 3609
		{
// This prefix is for anybody to use...
$prefixes[$prefix['pid']] = $prefix;

		{
// This prefix is for anybody to use...
$prefixes[$prefix['pid']] = $prefix;

		}
}

		}
}


if(empty($prefixes))
{
return false;


if(empty($prefixes))
{
return false;

	}

	}


$default_selected = array();
$selected_pid = (int)$selected_pid;


$default_selected = array();
$selected_pid = (int)$selected_pid;

Zeile 3351Zeile 3623
	if($selected_pid == 0)
{
$default_selected['all'] = ' selected="selected"';

	if($selected_pid == 0)
{
$default_selected['all'] = ' selected="selected"';

	}

	}

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

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

Zeile 3396Zeile 3668
		}

if(my_strpos(" ".$httpaccept_encoding, "x-gzip"))

		}

if(my_strpos(" ".$httpaccept_encoding, "x-gzip"))

		{

		{

			$encoding = "x-gzip";

			$encoding = "x-gzip";

		}


		}


		if(my_strpos(" ".$httpaccept_encoding, "gzip"))

		if(my_strpos(" ".$httpaccept_encoding, "gzip"))

		{

		{

			$encoding = "gzip";
}

			$encoding = "gzip";
}





		if(isset($encoding))
{
header("Content-Encoding: $encoding");

if(function_exists("gzencode"))

		if(isset($encoding))
{
header("Content-Encoding: $encoding");

if(function_exists("gzencode"))

			{

			{

				$contents = gzencode($contents, $level);

				$contents = gzencode($contents, $level);

			}

			}

			else
{
$size = strlen($contents);

			else
{
$size = strlen($contents);

Zeile 3424Zeile 3696
				$contents = $gzdata;
}
}

				$contents = $gzdata;
}
}

	}

	}


return $contents;
}


return $contents;
}

Zeile 3460Zeile 3732
		unset($data['pid']);
}


		unset($data['pid']);
}


	// Any remaining extra data - we serialize and insert in to its own column

	// Any remaining extra data - we my_serialize and insert in to its own column

	if(is_array($data))
{

	if(is_array($data))
{

		$data = serialize($data);

		$data = my_serialize($data);

	}

$sql_array = array(

	}

$sql_array = array(

Zeile 3485Zeile 3757
 * @param int The reputation value
* @param int The user ID (if not specified, the generated reputation will not be a link)
* @return string The formatted repuation

 * @param int The reputation value
* @param int The user ID (if not specified, the generated reputation will not be a link)
* @return string The formatted repuation

 */

 */

function get_reputation($reputation, $uid=0)
{
global $theme, $templates;

function get_reputation($reputation, $uid=0)
{
global $theme, $templates;

Zeile 3494Zeile 3766
	if($reputation < 0)
{
$reputation_class = "reputation_negative";

	if($reputation < 0)
{
$reputation_class = "reputation_negative";

	}

	}

	elseif($reputation > 0)

	elseif($reputation > 0)

	{

	{

		$reputation_class = "reputation_positive";
}

		$reputation_class = "reputation_positive";
}

	else
{
$reputation_class = "reputation_neutral";
}

	else
{
$reputation_class = "reputation_neutral";
}


if($uid != 0)
{


if($uid != 0)
{

Zeile 3515Zeile 3787

return $display_reputation;
}


return $display_reputation;
}





/**
* Fetch a color coded version of a warning level (based on it's percentage)
*

/**
* Fetch a color coded version of a warning level (based on it's percentage)
*

Zeile 3530Zeile 3802
	if($level >= 80)
{
$warning_class = "high_warning";

	if($level >= 80)
{
$warning_class = "high_warning";

	}

	}

	else if($level >= 50)
{
$warning_class = "moderate_warning";

	else if($level >= 50)
{
$warning_class = "moderate_warning";

Zeile 3557Zeile 3829
{
global $mybb, $plugins;


{
global $mybb, $plugins;


	$ip = $_SERVER['REMOTE_ADDR'];

	$ip = strtolower($_SERVER['REMOTE_ADDR']);


if($mybb->settings['ip_forwarded_check'])
{


if($mybb->settings['ip_forwarded_check'])
{

Zeile 3565Zeile 3837

if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{


if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{

			$addresses = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);

			$addresses = explode(',', strtolower($_SERVER['HTTP_X_FORWARDED_FOR']));

		}
elseif(isset($_SERVER['HTTP_X_REAL_IP']))
{

		}
elseif(isset($_SERVER['HTTP_X_REAL_IP']))
{

			$addresses = explode(',', $_SERVER['HTTP_X_REAL_IP']);

			$addresses = explode(',', strtolower($_SERVER['HTTP_X_REAL_IP']));

		}

if(is_array($addresses))

		}

if(is_array($addresses))

Zeile 3591Zeile 3863
	{
if(isset($_SERVER['HTTP_CLIENT_IP']))
{

	{
if(isset($_SERVER['HTTP_CLIENT_IP']))
{

			$ip = $_SERVER['HTTP_CLIENT_IP'];

			$ip = strtolower($_SERVER['HTTP_CLIENT_IP']);

		}
}


		}
}


Zeile 3710Zeile 3982
 */
function get_attachment_icon($ext)
{

 */
function get_attachment_icon($ext)
{

	global $cache, $attachtypes, $theme, $templates, $lang;

	global $cache, $attachtypes, $theme, $templates, $lang, $mybb;


if(!$attachtypes)
{


if(!$attachtypes)
{

Zeile 3733Zeile 4005
		{
global $change_dir;
$icon = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);

		{
global $change_dir;
$icon = $change_dir."/".str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);

 
			$icon = $mybb->get_asset_url($icon);

		}
else
{
$icon = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);

		}
else
{
$icon = str_replace("{theme}", $theme['imgdir'], $attachtypes[$ext]['icon']);

 
			$icon = $mybb->get_asset_url($icon);

		}

$name = htmlspecialchars_uni($attachtypes[$ext]['name']);

		}

$name = htmlspecialchars_uni($attachtypes[$ext]['name']);

Zeile 3757Zeile 4031
		$name = $lang->unknown;
}


		$name = $lang->unknown;
}


 
	$icon = htmlspecialchars_uni($icon);

	eval("\$attachment_icon = \"".$templates->get("attachment_icon")."\";");
return $attachment_icon;
}

	eval("\$attachment_icon = \"".$templates->get("attachment_icon")."\";");
return $attachment_icon;
}

Zeile 3769Zeile 4044
 */
function get_unviewable_forums($only_readable_threads=false)
{

 */
function get_unviewable_forums($only_readable_threads=false)
{

	global $forum_cache, $permissioncache, $mybb, $unviewable, $templates, $forumpass;

	global $forum_cache, $permissioncache, $mybb;





	if(!isset($permissions))
{
$permissions = $mybb->usergroup;
}

if(!is_array($forum_cache))

	if(!is_array($forum_cache))






	{
cache_forums();

	{
cache_forums();

	}

	}


if(!is_array($permissioncache))
{
$permissioncache = forum_permissions();


if(!is_array($permissioncache))
{
$permissioncache = forum_permissions();

	}

	}





	$unviewableforums = '';
$password_forums = array();

	$password_forums = $unviewable = array();


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

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

Zeile 3797Zeile 4066
		else
{
$perms = $mybb->usergroup;

		else
{
$perms = $mybb->usergroup;

		}


		}


		$pwverified = 1;

if($forum['password'] != "")
{
if($mybb->cookies['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password']))

		$pwverified = 1;

if($forum['password'] != "")
{
if($mybb->cookies['forumpass'][$forum['fid']] != md5($mybb->user['uid'].$forum['password']))

			{

			{

				$pwverified = 0;
}


				$pwverified = 0;
}


Zeile 3820Zeile 4089
				{
$pwverified = 0;
}

				{
$pwverified = 0;
}

			}
}


			}
}


		if($perms['canview'] == 0 || $pwverified == 0 || ($only_readable_threads == true && $perms['canviewthreads'] == 0))
{

		if($perms['canview'] == 0 || $pwverified == 0 || ($only_readable_threads == true && $perms['canviewthreads'] == 0))
{

			if($unviewableforums)
{
$unviewableforums .= ",";
}

$unviewableforums .= "'".$forum['fid']."'";

			$unviewable[] = $forum['fid'];






		}
}

		}
}


if(isset($unviewableforums))
{
return $unviewableforums;
}

	
$unviewableforums = implode(',', $unviewable);

return $unviewableforums;


}

/**

}

/**

Zeile 4024Zeile 4287
	if(!empty($navbits[0]['options']))
{
$newnav[0]['options'] = $navbits[0]['options'];

	if(!empty($navbits[0]['options']))
{
$newnav[0]['options'] = $navbits[0]['options'];

	}


	}


	unset($GLOBALS['navbits']);
$GLOBALS['navbits'] = $newnav;
}

	unset($GLOBALS['navbits']);
$GLOBALS['navbits'] = $newnav;
}

Zeile 4040Zeile 4303
function build_archive_link($type="", $id="")
{
global $mybb;

function build_archive_link($type="", $id="")
{
global $mybb;





	// If the server OS is not Windows and not Apache or the PHP is running as a CGI or we have defined ARCHIVE_QUERY_STRINGS, use query strings - DIRECTORY_SEPARATOR checks if running windows
//if((DIRECTORY_SEPARATOR == '\\' && is_numeric(stripos($_SERVER['SERVER_SOFTWARE'], "apache")) == false) || is_numeric(stripos(SAPI_NAME, "cgi")) !== false || defined("ARCHIVE_QUERY_STRINGS"))
if($mybb->settings['seourls_archive'] == 1)

	// If the server OS is not Windows and not Apache or the PHP is running as a CGI or we have defined ARCHIVE_QUERY_STRINGS, use query strings - DIRECTORY_SEPARATOR checks if running windows
//if((DIRECTORY_SEPARATOR == '\\' && is_numeric(stripos($_SERVER['SERVER_SOFTWARE'], "apache")) == false) || is_numeric(stripos(SAPI_NAME, "cgi")) !== false || defined("ARCHIVE_QUERY_STRINGS"))
if($mybb->settings['seourls_archive'] == 1)

Zeile 4097Zeile 4360
	if($mybb->settings['gzipoutput'] != 0)
{
$gzipen = "Enabled";

	if($mybb->settings['gzipoutput'] != 0)
{
$gzipen = "Enabled";

	}

	}

	else
{
$gzipen = "Disabled";

	else
{
$gzipen = "Disabled";

Zeile 4140Zeile 4403
	echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phpversion</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Server Load:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$serverload</span></td>\n";

	echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phpversion</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Server Load:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$serverload</span></td>\n";

	echo "</tr>\n";
echo "<tr>\n";

	echo "</tr>\n";
echo "<tr>\n";

	echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">GZip Encoding Status:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$gzipen</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">No. Templates Used:</span></b></td>\n";

	echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">GZip Encoding Status:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$gzipen</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">No. Templates Used:</span></b></td>\n";

Zeile 4376Zeile 4639
	if($days == 1)
{
$nicetime['days'] = "1".$lang_day;

	if($days == 1)
{
$nicetime['days'] = "1".$lang_day;

	}

	}

	else if($days > 1)
{
$nicetime['days'] = $days.$lang_days;

	else if($days > 1)
{
$nicetime['days'] = $days.$lang_days;

Zeile 4403Zeile 4666
		else if($minutes > 1)
{
$nicetime['minutes'] = $minutes.$lang_minutes;

		else if($minutes > 1)
{
$nicetime['minutes'] = $minutes.$lang_minutes;

		}
}

		}
}


if(!isset($options['seconds']) || $options['seconds'] !== false)
{


if(!isset($options['seconds']) || $options['seconds'] !== false)
{

Zeile 4419Zeile 4682
	}

if(is_array($nicetime))

	}

if(is_array($nicetime))

	{

	{

		return implode(", ", $nicetime);
}
}

		return implode(", ", $nicetime);
}
}

Zeile 4433Zeile 4696
function alt_trow($reset=0)
{
global $alttrow;

function alt_trow($reset=0)
{
global $alttrow;





	if($alttrow == "trow1" && !$reset)
{
$trow = "trow2";

	if($alttrow == "trow1" && !$reset)
{
$trow = "trow2";

Zeile 4461Zeile 4724
	if($uid == $mybb->user['uid'])
{
$user = $mybb->user;

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

	}
else

	}
else

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

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

Zeile 4492Zeile 4755
	if($groupslist != $user['additionalgroups'])
{
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='".(int)$uid."'");

	if($groupslist != $user['additionalgroups'])
{
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='".(int)$uid."'");

		return true;
}
else

		return true;
}
else

	{
return false;
}

	{
return false;
}

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

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

			}

			}

		}
}


		}
}


Zeile 4558Zeile 4821
 *
* @param boolean True to return as "hidden" fields
* @param array Array of fields to ignore if first argument is true

 *
* @param boolean True to return as "hidden" fields
* @param array Array of fields to ignore if first argument is true

 
 * @param boolean True to skip all inputs and return only the file path part of the URL

 * @return string The current URL being accessed
*/

 * @return string The current URL being accessed
*/

function get_current_location($fields=false, $ignore=array())

function get_current_location($fields=false, $ignore=array(), $quick=false)

{
if(defined("MYBB_LOCATION"))

{
if(defined("MYBB_LOCATION"))

	{

	{

		return MYBB_LOCATION;

		return MYBB_LOCATION;

	}

	}





	if(!empty($_SERVER['PATH_INFO']))
{
$location = htmlspecialchars_uni($_SERVER['PATH_INFO']);
}
elseif(!empty($_ENV['PATH_INFO']))
{
$location = htmlspecialchars_uni($_ENV['PATH_INFO']);

	if(!empty($_SERVER['SCRIPT_NAME']))
{
$location = htmlspecialchars_uni($_SERVER['SCRIPT_NAME']);
}
elseif(!empty($_SERVER['PHP_SELF']))
{
$location = htmlspecialchars_uni($_SERVER['PHP_SELF']);

	}
elseif(!empty($_ENV['PHP_SELF']))
{
$location = htmlspecialchars_uni($_ENV['PHP_SELF']);

	}
elseif(!empty($_ENV['PHP_SELF']))
{
$location = htmlspecialchars_uni($_ENV['PHP_SELF']);

	}
else










	}
elseif(!empty($_SERVER['PATH_INFO']))
{
$location = htmlspecialchars_uni($_SERVER['PATH_INFO']);
}
else
{
$location = htmlspecialchars_uni($_ENV['PATH_INFO']);
}

if($quick)

	{

	{

		$location = htmlspecialchars_uni($_SERVER['PHP_SELF']);

		return $location;

	}

if($fields == true)

	}

if($fields == true)

Zeile 4608Zeile 4881
		}

return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method);

		}

return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method);

	}
else

	}
else

	{
if(isset($_SERVER['QUERY_STRING']))
{
$location .= "?".htmlspecialchars_uni($_SERVER['QUERY_STRING']);

	{
if(isset($_SERVER['QUERY_STRING']))
{
$location .= "?".htmlspecialchars_uni($_SERVER['QUERY_STRING']);

		}

		}

		else if(isset($_ENV['QUERY_STRING']))
{
$location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']);

		else if(isset($_ENV['QUERY_STRING']))
{
$location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']);

		}

		}


if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST"))
{


if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST"))
{

Zeile 4629Zeile 4902
				if(isset($_POST[$var]))
{
$addloc[] = urlencode($var).'='.urlencode($_POST[$var]);

				if(isset($_POST[$var]))
{
$addloc[] = urlencode($var).'='.urlencode($_POST[$var]);

				}
}


				}
}


			if(isset($addloc) && is_array($addloc))
{
if(strpos($location, "?") === false)

			if(isset($addloc) && is_array($addloc))
{
if(strpos($location, "?") === false)

				{

				{

					$location .= "?";
}
else

					$location .= "?";
}
else

Zeile 4644Zeile 4917
				}
$location .= implode("&amp;", $addloc);
}

				}
$location .= implode("&amp;", $addloc);
}

		}

if(strlen($location) > 150)
{
$location = substr($location, 0, 150);

 
		}

return $location;

		}

return $location;

Zeile 4888Zeile 5156
}

/**

}

/**

 * Replacement function for PHP's wordwrap(). This version does not break up HTML tags, URLs or unicode references.
*
* @param string The string to be word wrapped
* @return string The word wraped string

 * DEPRECATED! Please use other alternatives.




 */
function my_wordwrap($message)
{

 */
function my_wordwrap($message)
{

	global $mybb;

if($mybb->settings['wordwrap'] > 0)
{
$message = convert_through_utf8($message);

if(!($new_message = @preg_replace("#(((?>[^\s&/<>\"\\-\[\]])|(&\#[a-z0-9]{1,10};)){{$mybb->settings['wordwrap']}})#u", "$0&#8203;", $message)))
{
$new_message = preg_replace("#(((?>[^\s&/<>\"\\-\[\]])|(&\#[a-z0-9]{1,10};)){{$mybb->settings['wordwrap']}})#", "$0&#8203;", $message);
}

$new_message = convert_through_utf8($new_message, false);

return $new_message;
}

	return $message;
}


















	return $message;
}

/**
* Workaround for date limitation in PHP to establish the day of a birthday (Provided by meme)
*
* @param int The month of the birthday

/**
* Workaround for date limitation in PHP to establish the day of a birthday (Provided by meme)
*
* @param int The month of the birthday




 * @param int The day of the birthday
* @param int The year of the bithday
* @return int The numeric day of the week for the birthday

 * @param int The day of the birthday
* @param int The year of the bithday
* @return int The numeric day of the week for the birthday

Zeile 4937Zeile 5186
			for($m = $j[$k]; $m >= 1; $m--)
{
$h--;

			for($m = $j[$k]; $m >= 1; $m--)
{
$h--;





				if($i == $year && $l == $month && $m == $day)
{
return $h;

				if($i == $year && $l == $month && $m == $day)
{
return $h;

Zeile 4957Zeile 5206
 *
* @param int The year.
* @return array The number of days in each month of that year

 *
* @param int The year.
* @return array The number of days in each month of that year

 */

 */

function get_bdays($in)
{
return array(

function get_bdays($in)
{
return array(

		31,

		31,

		($in % 4 == 0 && ($in % 100 > 0 || $in % 400 == 0) ? 29 : 28),

		($in % 4 == 0 && ($in % 100 > 0 || $in % 400 == 0) ? 29 : 28),

		31,
30,
31,

		31,



		30,

		30,

		31,



		31,
30,
31,

		31,
30,
31,

		31,
30,
31,

Zeile 4987Zeile 5236
 * @return string The formatted birthday
*/
function format_bdays($display, $bm, $bd, $by, $wd)

 * @return string The formatted birthday
*/
function format_bdays($display, $bm, $bd, $by, $wd)

{
global $lang;

{
global $lang;


$bdays = array(
$lang->sunday,


$bdays = array(
$lang->sunday,

Zeile 5013Zeile 5262
		$lang->month_10,
$lang->month_11,
$lang->month_12

		$lang->month_10,
$lang->month_11,
$lang->month_12

	);

	);



// This needs to be in this specific order



// This needs to be in this specific order

Zeile 5065Zeile 5314
	{
array_pop($find);
array_pop($replace);

	{
array_pop($find);
array_pop($replace);

	}


	}


	return str_replace($find, $replace, $display);
}


	return str_replace($find, $replace, $display);
}


Zeile 5093Zeile 5342
		--$age;
}
return $age;

		--$age;
}
return $age;

}

/**

}

/**

 * Updates the first posts in a thread.
*
* @param int The thread id for which to update the first post id.

 * Updates the first posts in a thread.
*
* @param int The thread id for which to update the first post id.

Zeile 5149Zeile 5398
	$lastpost = $db->fetch_array($query);

if(empty($lastpost['username']))

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

if(empty($lastpost['username']))

	{

	{

		$lastpost['username'] = $lastpost['postusername'];
}


		$lastpost['username'] = $lastpost['postusername'];
}


Zeile 5190Zeile 5439
{
global $lang;


{
global $lang;


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


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


	if(strtolower($lang->settings['charset']) == "utf-8")
{
// Get rid of any excess RTL and LTR override for they are the workings of the devil

	if(strtolower($lang->settings['charset']) == "utf-8")
{
// Get rid of any excess RTL and LTR override for they are the workings of the devil

Zeile 5202Zeile 5451
		$string = str_replace(chr(0xCA), "", $string);
}
$string = trim($string);

		$string = str_replace(chr(0xCA), "", $string);
}
$string = trim($string);





	if(function_exists("mb_strlen"))
{
$string_length = mb_strlen($string);

	if(function_exists("mb_strlen"))
{
$string_length = mb_strlen($string);

Zeile 5628Zeile 5877

/**
* Get the user data of an user id.


/**
* Get the user data of an user id.

 *

 *

 * @param int The user id of the user.
* @return array The users data
*/

 * @param int The user id of the user.
* @return array The users data
*/

Zeile 5642Zeile 5891
	if(!empty($mybb->user) && $uid == $mybb->user['uid'])
{
return $mybb->user;

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

	}

	}

	elseif(isset($user_cache[$uid]))

	elseif(isset($user_cache[$uid]))

	{
return $user_cache[$uid];
}

	{
return $user_cache[$uid];
}

	elseif($uid > 0)
{
$query = $db->simple_select("users", "*", "uid = '{$uid}'");

	elseif($uid > 0)
{
$query = $db->simple_select("users", "*", "uid = '{$uid}'");

Zeile 5655Zeile 5904
		return $user_cache[$uid];
}
return array();

		return $user_cache[$uid];
}
return array();

}

}


/**
* Get the user data of an user username.


/**
* Get the user data of an user username.

Zeile 5672Zeile 5921
	if(!isset($options['username_method']))
{
$options['username_method'] = 0;

	if(!isset($options['username_method']))
{
$options['username_method'] = 0;

 
	}

switch($db->type)
{
case 'mysql':
case 'mysqli':
$field = 'username';
$efield = 'email';
break;
default:
$field = 'LOWER(username)';
$efield = 'LOWER(email)';
break;

	}

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

	}

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

			$sqlwhere = 'LOWER(email)=\''.$username.'\'';
break;

			$sqlwhere = "{$efield}='{$username}'";
break;

		case 2:

		case 2:

			$sqlwhere = 'LOWER(username)=\''.$username.'\' OR LOWER(email)=\''.$username.'\'';
break;

			$sqlwhere = "{$field}='{$username}' OR {$efield}='{$username}'";
break;

		default:

		default:

			$sqlwhere = 'LOWER(username)=\''.$username.'\'';

			$sqlwhere = "{$field}='{$username}'";

			break;

			break;

	}

	}


$fields = array('uid');
if(isset($options['fields']))


$fields = array('uid');
if(isset($options['fields']))

	{

	{

		$fields = array_merge((array)$options['fields'], $fields);
}

		$fields = array_merge((array)$options['fields'], $fields);
}





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

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

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

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

	}

	}


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


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

Zeile 5735Zeile 5997
				if($forum_cache[$parent]['active'] == 0)
{
return false;

				if($forum_cache[$parent]['active'] == 0)
{
return false;

				}
}
}
}

				}
}
}
}


return $forum_cache[$fid];
}


return $forum_cache[$fid];
}

Zeile 5751Zeile 6013
 * @return string The database row of the thread.
*/
function get_thread($tid, $recache = false)

 * @return string The database row of the thread.
*/
function get_thread($tid, $recache = false)

{
global $db;

{
global $db;

	static $thread_cache;

	static $thread_cache;





	$tid = (int)$tid;

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

	$tid = (int)$tid;

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

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

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





		if($thread)

		if($thread)

		{

		{

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

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

		}

		}

		else
{
$thread_cache[$tid] = false;

		else
{
$thread_cache[$tid] = false;

			return false;
}
}
}


			return false;
}
}
}


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

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

Zeile 5791Zeile 6053
{
global $db;
static $post_cache;

{
global $db;
static $post_cache;





	$pid = (int)$pid;

if(isset($post_cache[$pid]))

	$pid = (int)$pid;

if(isset($post_cache[$pid]))

Zeile 5823Zeile 6085
 */
function get_inactive_forums()
{

 */
function get_inactive_forums()
{

	global $forum_cache, $cache, $inactiveforums;

	global $forum_cache, $cache;


if(!$forum_cache)
{


if(!$forum_cache)
{

Zeile 5846Zeile 6108
			}
}
}

			}
}
}

 
	

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

return $inactiveforums;

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

return $inactiveforums;

Zeile 6287Zeile 6550
		$ip_range = fetch_ip_range($banned_ip['filter']);
if(is_array($ip_range))
{

		$ip_range = fetch_ip_range($banned_ip['filter']);
if(is_array($ip_range))
{

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

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

			{
$banned = true;
}

			{
$banned = true;
}

Zeile 6405Zeile 6668
}

/**

}

/**

 * Fetch the contents of a remote fle.

 * Fetch the contents of a remote file.

 *
* @param string The URL of the remote file
* @param array The array of post data

 *
* @param string The URL of the remote file
* @param array The array of post data

Zeile 6430Zeile 6693
		curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

		curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

 
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

		if(!empty($post_body))
{
curl_setopt($ch, CURLOPT_POST, 1);

		if(!empty($post_body))
{
curl_setopt($ch, CURLOPT_POST, 1);

Zeile 6458Zeile 6722
		{
$url['path'] .= "?{$url['query']}";
}

		{
$url['path'] .= "?{$url['query']}";
}

		$fp = @fsockopen($url['host'], $url['port'], $error_no, $error, 10);














$scheme = '';

if($url['scheme'] == 'https')
{
$scheme = 'ssl://';
if($url['port'] == 80)
{
$url['port'] = 443;
}
}

$fp = @fsockopen($scheme.$url['host'], $url['port'], $error_no, $error, 10);

		@stream_set_timeout($fp, 10);
if(!$fp)
{

		@stream_set_timeout($fp, 10);
if(!$fp)
{

Zeile 6470Zeile 6746
			$headers[] = "POST {$url['path']} HTTP/1.0";
$headers[] = "Content-Length: ".strlen($post_body);
$headers[] = "Content-Type: application/x-www-form-urlencoded";

			$headers[] = "POST {$url['path']} HTTP/1.0";
$headers[] = "Content-Length: ".strlen($post_body);
$headers[] = "Content-Type: application/x-www-form-urlencoded";

		}
else
{

		}
else
{

			$headers[] = "GET {$url['path']} HTTP/1.0";
}


			$headers[] = "GET {$url['path']} HTTP/1.0";
}


Zeile 6506Zeile 6782
	else if(empty($post_data))
{
return @implode("", @file($url));

	else if(empty($post_data))
{
return @implode("", @file($url));

	}
else
{
return false;
}
}

/**

	}
else
{
return false;
}
}

/**

 * Checks if a particular user is a super administrator.
*
* @param int The user ID to check against the list of super admins

 * Checks if a particular user is a super administrator.
*
* @param int The user ID to check against the list of super admins

Zeile 6527Zeile 6803
	{
global $mybb;
$super_admins = str_replace(" ", "", $mybb->config['super_admins']);

	{
global $mybb;
$super_admins = str_replace(" ", "", $mybb->config['super_admins']);

	}

	}


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


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

Zeile 6544Zeile 6820
 * Originates from frostschutz's PluginLibrary
* github.com/frostschutz
*

 * Originates from frostschutz's PluginLibrary
* github.com/frostschutz
*

 * @param mixed A selection of groups to check

 * @param mixed A selection of groups to check or -1 for any group

 * @param mixed User to check selection against

 * @param mixed User to check selection against

 * @return mixed Array of groups this user belongs to

 * @return array Array of groups specified in the first param to which the user belongs

 */
function is_member($groups, $user = false)
{
global $mybb;

 */
function is_member($groups, $user = false)
{
global $mybb;

 
	
if(empty($groups))
{
return array();
}


if($user == false)
{
$user = $mybb->user;
}
else if(!is_array($user))


if($user == false)
{
$user = $mybb->user;
}
else if(!is_array($user))

	{

	{

		// Assume it's a UID
$user = get_user($user);
}

		// Assume it's a UID
$user = get_user($user);
}





	$memberships = array_map('intval', explode(',', $user['additionalgroups']));
$memberships[] = $user['usergroup'];

if(!is_array($groups))
{

	$memberships = array_map('intval', explode(',', $user['additionalgroups']));
$memberships[] = $user['usergroup'];

if(!is_array($groups))
{

		if(is_string($groups))
{
$groups = explode(',', $groups);

		if((int)$groups == -1)
{
return $memberships;

		}
else
{

		}
else
{

			$groups = (array)$groups;








			if(is_string($groups))
{
$groups = explode(',', $groups);
}
else
{
$groups = (array)$groups;
}

		}
}


		}
}


Zeile 7012Zeile 7300
		else
{
// IPv4

		else
{
// IPv4

 
			$ip_bits = count(explode('.', $ipaddress));
if($ip_bits < 4)
{
// Support for 127.0.*
$replacement = str_repeat('.*', 4-$ip_bits);
$ipaddress = substr_replace($ipaddress, $replacement, strrpos($ipaddress, '*')+1, 0);
}

			$upper = str_replace('*', '255', $ipaddress);
$lower = str_replace('*', '0', $ipaddress);
}

			$upper = str_replace('*', '255', $ipaddress);
$lower = str_replace('*', '0', $ipaddress);
}

Zeile 7025Zeile 7320
	}
// CIDR notation
elseif(strpos($ipaddress, '/') !== false)

	}
// CIDR notation
elseif(strpos($ipaddress, '/') !== false)

	{

	{

		$ipaddress = explode('/', $ipaddress);
$ip_address = $ipaddress[0];
$ip_range = (int)$ipaddress[1];

		$ipaddress = explode('/', $ipaddress);
$ip_address = $ipaddress[0];
$ip_range = (int)$ipaddress[1];

Zeile 7038Zeile 7333
		else
{
$ip_address = my_inet_pton($ip_address);

		else
{
$ip_address = my_inet_pton($ip_address);





			if(!$ip_address)
{
// Invalid IP address

			if(!$ip_address)
{
// Invalid IP address

Zeile 7051Zeile 7346
		 * Author: NewEraCracker
* License: Public Domain
*/

		 * Author: NewEraCracker
* License: Public Domain
*/





		// Pack IP, Set some vars
$ip_pack = $ip_address;
$ip_pack_size = strlen($ip_pack);

		// Pack IP, Set some vars
$ip_pack = $ip_address;
$ip_pack_size = strlen($ip_pack);

Zeile 7064Zeile 7359
			$bit = decbin(ord($ip_pack[$i]));
$bit = str_pad($bit, 8, '0', STR_PAD_LEFT);
$ip_bits .= $bit;

			$bit = decbin(ord($ip_pack[$i]));
$bit = str_pad($bit, 8, '0', STR_PAD_LEFT);
$ip_bits .= $bit;

		}

		}


// Significative bits (from the ip range)
$ip_bits = substr($ip_bits, 0, $ip_range);


// Significative bits (from the ip range)
$ip_bits = substr($ip_bits, 0, $ip_range);

Zeile 7090Zeile 7385
			$chr = chr( bindec($chr) );
$ip_higher_pack .= $chr;
}

			$chr = chr( bindec($chr) );
$ip_higher_pack .= $chr;
}





		return array($ip_lower_pack, $ip_higher_pack);
}
// Just on IP address

		return array($ip_lower_pack, $ip_higher_pack);
}
// Just on IP address

Zeile 7116Zeile 7411
	if(!$time_start)
{
$time_start = $time;

	if(!$time_start)
{
$time_start = $time;

		return;

		return;

	}
// Timer has run, return execution time
else

	}
// Timer has run, return execution time
else

Zeile 7534Zeile 7829
	static $gd_version;

if($gd_version)

	static $gd_version;

if($gd_version)

	{

	{

		return $gd_version;

		return $gd_version;

	}

	}

	if(!extension_loaded('gd'))

	if(!extension_loaded('gd'))

	{

	{

		return;
}


		return;
}


Zeile 7546Zeile 7841
	{
$gd_info = gd_info();
preg_match('/\d/', $gd_info['GD Version'], $gd);

	{
$gd_info = gd_info();
preg_match('/\d/', $gd_info['GD Version'], $gd);

		$gd_version = $gd[0];
}

		$gd_version = $gd[0];
}

	else
{
ob_start();

	else
{
ob_start();

Zeile 7583Zeile 7878
			if($c > 128)
{
if($c > 247 || $c <= 191)

			if($c > 128)
{
if($c > 247 || $c <= 191)

				{
if($return)
{
$string .= '?';

				{
if($return)
{
$string .= '?';

						continue;

						continue;

					}

					}

					else
{
return false;
}

					else
{
return false;
}

				}

				}

				elseif($c > 239)

				elseif($c > 239)

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

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

				}
elseif($c > 191)

				}
elseif($c > 191)

				{

				{

					$bytes = 2;
}
if(($i + $bytes) > $len)

					$bytes = 2;
}
if(($i + $bytes) > $len)

Zeile 7612Zeile 7907
					{
$string .= '?';
break;

					{
$string .= '?';
break;

					}

					}

					else
{
return false;

					else
{
return false;

Zeile 7638Zeile 7933
						}
}
else

						}
}
else

					{

					{

						$multibytes .= $input[$i];
}
$bytes--;

						$multibytes .= $input[$i];
}
$bytes--;

Zeile 7675Zeile 7970
		else
{
return !preg_match("#[^\\x00-\\x7F][\\x80-\\xBF]{3,}#", $input);

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

		}
}

		}
}

}

/**

}

/**

Zeile 7702Zeile 7997
	}

if(isset($pm['language']))

	}

if(isset($pm['language']))

	{

	{

		if($pm['language'] != $mybb->user['language'] && $lang->language_exists($pm['language']))
{
// Load user language

		if($pm['language'] != $mybb->user['language'] && $lang->language_exists($pm['language']))
{
// Load user language

Zeile 7728Zeile 8023
			}

$pm[$key] = $lang->{$lang_string};

			}

$pm[$key] = $lang->{$lang_string};

		}

		}


if(isset($revert))
{


if(isset($revert))
{

Zeile 7736Zeile 8031
			$lang->set_language($mybb->user['language']);
$lang->load($pm['language_file']);
}

			$lang->set_language($mybb->user['language']);
$lang->load($pm['language_file']);
}

	}


	}


	if(!$pm['subject'] ||!$pm['message'] || !$pm['touid'] || (!$pm['receivepms'] && !$admin_override))
{
return false;

	if(!$pm['subject'] ||!$pm['message'] || !$pm['touid'] || (!$pm['receivepms'] && !$admin_override))
{
return false;

	}

$lang->load('messages');

	}

$lang->load('messages');


require_once MYBB_ROOT."inc/datahandlers/pm.php";



require_once MYBB_ROOT."inc/datahandlers/pm.php";


Zeile 7769Zeile 8064
	if((int)$fromid == 0)
{
$fromid = (int)$mybb->user['uid'];

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

	}

	}

	elseif((int)$fromid < 0)
{
$fromid = 0;

	elseif((int)$fromid < 0)
{
$fromid = 0;

Zeile 7834Zeile 8129
	}

if(!$ip_address)

	}

if(!$ip_address)

	{

	{

		$ip_address = get_ip();

		$ip_address = get_ip();

	}

$ip_address = my_inet_pton($ip_address);


	}

$ip_address = my_inet_pton($ip_address);


	$insert_array = array(
'username' => $db->escape_string($username),
'email' => $db->escape_string($email),
'ipaddress' => $db->escape_binary($ip_address),
'dateline' => (int)TIME_NOW,

	$insert_array = array(
'username' => $db->escape_string($username),
'email' => $db->escape_string($email),
'ipaddress' => $db->escape_binary($ip_address),
'dateline' => (int)TIME_NOW,

		'data'      => $db->escape_string(@serialize($data)),

		'data'      => $db->escape_string(@my_serialize($data)),

	);

	);





	return (bool)$db->insert_query('spamlog', $insert_array);

	return (bool)$db->insert_query('spamlog', $insert_array);

 
}

/**
* Copy a file to the CDN.
*
* @param string $file_path The path to the file to upload to the CDN.
*
* @param string $uploaded_path The path the file was uploaded to, reference parameter for when this may be needed.
*
* @return bool Whether the file was copied successfully.
*/
function copy_file_to_cdn($file_path = '', &$uploaded_path = null)
{
global $mybb, $plugins;

$success = false;

$file_path = (string)$file_path;

$real_file_path = realpath($file_path);

$file_dir_path = dirname($real_file_path);
$file_dir_path = str_replace(MYBB_ROOT, '', $file_dir_path);
$file_dir_path = ltrim($file_dir_path, './\\');

$file_name = basename($real_file_path);

if(file_exists($file_path))
{
if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath']))
{
$cdn_path = rtrim($mybb->settings['cdnpath'], '/\\');

if(substr($file_dir_path, 0, my_strlen(MYBB_ROOT)) == MYBB_ROOT)
{
$file_dir_path = str_replace(MYBB_ROOT, '', $file_dir_path);
}

$cdn_upload_path = $cdn_path . DIRECTORY_SEPARATOR . $file_dir_path;

if(!($dir_exists = is_dir($cdn_upload_path)))
{
$dir_exists = @mkdir($cdn_upload_path, 0777, true);
}

if($dir_exists)
{
if(($cdn_upload_path = realpath($cdn_upload_path)) !== false)
{
$success = @copy($file_path, $cdn_upload_path.DIRECTORY_SEPARATOR.$file_name);

if($success)
{
$uploaded_path = $cdn_upload_path;
}
}
}
}

if(is_object($plugins))
{
$hook_args = array(
'file_path' => &$file_path,
'real_file_path' => &$real_file_path,
'file_name' => &$file_name,
'uploaded_path' => &$uploaded_path,
'success' => &$success,
);

$plugins->run_hooks('copy_file_to_cdn_end', $hook_args);
}
}

return $success;

}

}