Vergleich inc/functions.php - 1.6.13 - 1.6.17

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

$contents = parse_page($contents);
$totaltime = $maintimer->stop();


$contents = parse_page($contents);
$totaltime = $maintimer->stop();

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


if($mybb->usergroup['cancp'] == 1)
{


if($mybb->usergroup['cancp'] == 1)
{

Zeile 83Zeile 84
			$other = "PHP version: $phpversion / Server Load: $serverload / GZip Compression: $gzipen";
$debugstuff = "Generated in $totaltime seconds ($percentphp% PHP / $percentsql% ".$database_server.")<br />SQL Queries: $db->query_count / Global Parsing Time: $globaltime$memory_usage<br />$other<br />[<a href=\"$debuglink\" target=\"_blank\">advanced details</a>]<br />";
$contents = str_replace("<debugstuff>", $debugstuff, $contents);

			$other = "PHP version: $phpversion / Server Load: $serverload / GZip Compression: $gzipen";
$debugstuff = "Generated in $totaltime seconds ($percentphp% PHP / $percentsql% ".$database_server.")<br />SQL Queries: $db->query_count / Global Parsing Time: $globaltime$memory_usage<br />$other<br />[<a href=\"$debuglink\" target=\"_blank\">advanced details</a>]<br />";
$contents = str_replace("<debugstuff>", $debugstuff, $contents);

		}

		}


if($mybb->debug_mode == true)
{


if($mybb->debug_mode == true)
{

Zeile 92Zeile 93
	}

$contents = str_replace("<debugstuff>", "", $contents);

	}

$contents = str_replace("<debugstuff>", "", $contents);

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

 

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


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

Zeile 743Zeile 743
		"location2" => 0
);


		"location2" => 0
);


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

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


if($mybb->input['ajax'])
{


if($mybb->input['ajax'])
{

Zeile 1466Zeile 1466

$mod_cache = $cache->read("moderators");



$mod_cache = $cache->read("moderators");


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

	foreach($mod_cache as $forumid => $forum)

	{

	{

		if(!is_array($forum) || !in_array($fid, $parentslist))

		if(!is_array($forum) || !in_array($forumid, $parentslist))

		{
// No perms or we're not after this forum
continue;

		{
// No perms or we're not after this forum
continue;

Zeile 1549Zeile 1549
	$user_perms = user_permissions($uid);
if($user_perms['issupermod'] == 1)
{

	$user_perms = user_permissions($uid);
if($user_perms['issupermod'] == 1)
{

 
		if($fid)
{
$forumpermissions = forum_permissions($fid);
if($forumpermissions['canview'] && $forumpermissions['canviewthreads'] && !$forumpermissions['canonlyviewownthreads'])
{
return true;
}
return false;
}

		return true;
}
else

		return true;
}
else

Zeile 1561Zeile 1570
				foreach($modcache as $modusers)
{
if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'])

				foreach($modcache as $modusers)
{
if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'])

					{
return true;

					{
return true;

					}
elseif(isset($modusers['usergroups'][$user_perms['gid']]))
{
// Moderating usergroup
return true;

					}
elseif(isset($modusers['usergroups'][$user_perms['gid']]))
{
// Moderating usergroup
return true;

					}
}

					}
}

			}
return false;
}

			}
return false;
}

Zeile 1592Zeile 1601
					return false;
}
}

					return false;
}
}

		}
}
}

		}
}
}


/**
* Generate a list of the posticons.


/**
* Generate a list of the posticons.

Zeile 1665Zeile 1674
	if(!$mybb->settings['cookiepath'])
{
$mybb->settings['cookiepath'] = "/";

	if(!$mybb->settings['cookiepath'])
{
$mybb->settings['cookiepath'] = "/";

	}


	}


	if($expires == -1)

	if($expires == -1)

	{

	{

		$expires = 0;

		$expires = 0;

	}

	}

	elseif($expires == "" || $expires == null)
{
$expires = TIME_NOW + (60*60*24*365); // Make the cookie expire in a years time

	elseif($expires == "" || $expires == null)
{
$expires = TIME_NOW + (60*60*24*365); // Make the cookie expire in a years time

Zeile 1678Zeile 1687
	else
{
$expires = TIME_NOW + intval($expires);

	else
{
$expires = TIME_NOW + intval($expires);

	}


	}


	$mybb->settings['cookiepath'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiepath']);
$mybb->settings['cookiedomain'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiedomain']);
$mybb->settings['cookieprefix'] = str_replace(array("\n","\r", " "), "", $mybb->settings['cookieprefix']);

	$mybb->settings['cookiepath'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiepath']);
$mybb->settings['cookiedomain'] = str_replace(array("\n","\r"), "", $mybb->settings['cookiedomain']);
$mybb->settings['cookieprefix'] = str_replace(array("\n","\r", " "), "", $mybb->settings['cookieprefix']);

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

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

	}


	}


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

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

	{

	{

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

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

	}


	}


	if(!empty($mybb->settings['cookiedomain']))
{
$cookie .= "; domain={$mybb->settings['cookiedomain']}";
}

if($httponly == true)

	if(!empty($mybb->settings['cookiedomain']))
{
$cookie .= "; domain={$mybb->settings['cookiedomain']}";
}

if($httponly == true)

	{

	{

		$cookie .= "; HttpOnly";
}

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

		$cookie .= "; HttpOnly";
}

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





	header($cookie, false);
}

/**
* Unset a cookie set by MyBB.

	header($cookie, false);
}

/**
* Unset a cookie set by MyBB.

 *
* @param string The cookie identifier.

 *
* @param string The cookie identifier.

 */
function my_unsetcookie($name)
{
global $mybb;

 */
function my_unsetcookie($name)
{
global $mybb;





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

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





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

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

}

/**

}

/**

 * Get the contents from a serialised cookie array.
*
* @param string The cookie identifier.

 * Get the contents from a serialised cookie array.
*
* @param string The cookie identifier.

Zeile 1739Zeile 1748
	global $mybb;

if(!isset($mybb->cookies['mybb'][$name]))

	global $mybb;

if(!isset($mybb->cookies['mybb'][$name]))

	{

	{

		return false;
}


		return false;
}


Zeile 1763Zeile 1772
 * @param string The value to set the cookie to.
*/
function my_set_array_cookie($name, $id, $value, $expires="")

 * @param string The value to set the cookie to.
*/
function my_set_array_cookie($name, $id, $value, $expires="")

{

{

	global $mybb;

$cookie = $mybb->cookies['mybb'];

	global $mybb;

$cookie = $mybb->cookies['mybb'];

Zeile 1784Zeile 1793
 * @return array Unserialized data array
*/
function my_unserialize($data)

 * @return array Unserialized data array
*/
function my_unserialize($data)

{







{
// Do no unserialize objects
if(substr($data, 0, 1) == 'O')
{
return array();
}


	$array = unserialize($data);

	$array = unserialize($data);





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

return $array;

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

return $array;

}

}


/**
* Returns the serverload of the system.


/**
* Returns the serverload of the system.

Zeile 1816Zeile 1831
			$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"))

		{

		{

			$serverload = explode(" ", $load);
$serverload[0] = round($serverload[0], 4);
}

			$serverload = explode(" ", $load);
$serverload[0] = round($serverload[0], 4);
}

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

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

			}
}
}
else
{
return $lang->unknown;
}

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


			}
}
}
else
{
return $lang->unknown;
}

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


	return $returnload;
}


	return $returnload;
}


Zeile 1920Zeile 1935

// Fetch latest user if the user count is changing
if(array_key_exists('numusers', $changes))


// Fetch latest user if the user count is changing
if(array_key_exists('numusers', $changes))

	{

	{

		$query = $db->simple_select("users", "uid, username", "", array('order_by' => 'regdate', 'order_dir' => 'DESC', 'limit' => 1));
$lastmember = $db->fetch_array($query);
$new_stats['lastuid'] = $lastmember['uid'];

		$query = $db->simple_select("users", "uid, username", "", array('order_by' => 'regdate', 'order_dir' => 'DESC', 'limit' => 1));
$lastmember = $db->fetch_array($query);
$new_stats['lastuid'] = $lastmember['uid'];

Zeile 1955Zeile 1970

/**
* Updates the forum counters with a specific value (or addition/subtraction of the previous value)


/**
* Updates the forum counters with a specific value (or addition/subtraction of the previous value)

 *
* @param int The forum ID

 *
* @param int The forum ID

 * @param array Array of items being updated (threads, posts, unapprovedthreads, unapprovedposts) and their value (ex, 1, +1, -1)
*/
function update_forum_counters($fid, $changes=array())

 * @param array Array of items being updated (threads, posts, unapprovedthreads, unapprovedposts) and their value (ex, 1, +1, -1)
*/
function update_forum_counters($fid, $changes=array())

Zeile 2149Zeile 2164

/**
* Update the first post and lastpost data for a specific thread


/**
* Update the first post and lastpost data for a specific thread

 *

 *

 * @param int The thread ID
*/
function update_thread_data($tid)

 * @param int The thread ID
*/
function update_thread_data($tid)

Zeile 2160Zeile 2175

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


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

	{

	{

		return false;
}


		return false;
}


Zeile 2171Zeile 2186
		WHERE p.tid='$tid' AND p.visible='1'
ORDER BY p.dateline DESC
LIMIT 1"

		WHERE p.tid='$tid' AND p.visible='1'
ORDER BY p.dateline DESC
LIMIT 1"

	);

	);

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

$db->free_result($query);

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

$db->free_result($query);

Zeile 2194Zeile 2209
	}

if(!$lastpost['username'])

	}

if(!$lastpost['username'])

	{

	{

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


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


Zeile 2217Zeile 2232
		'lastposteruid' => intval($lastpost['uid']),
);
$db->update_query("threads", $update_array, "tid='{$tid}'");

		'lastposteruid' => intval($lastpost['uid']),
);
$db->update_query("threads", $update_array, "tid='{$tid}'");





	unset($firstpost, $lastpost, $update_array);

	unset($firstpost, $lastpost, $update_array);

}

}


function update_forum_count($fid)


function update_forum_count($fid)

{

{

	die("Deprecated function call: update_forum_count");
}
function update_thread_count($tid)
{
die("Deprecated function call: update_thread_count");

	die("Deprecated function call: update_forum_count");
}
function update_thread_count($tid)
{
die("Deprecated function call: update_thread_count");

}

}

function update_thread_attachment_count($tid)

function update_thread_attachment_count($tid)

{

{

	die("Deprecated function call: update_thread_attachment_count");
}

	die("Deprecated function call: update_thread_attachment_count");
}





/**
* Deletes a thread from the database
*
* @param int The thread ID
*/
function delete_thread($tid)

/**
* Deletes a thread from the database
*
* @param int The thread ID
*/
function delete_thread($tid)

{
global $moderation;

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

{
global $moderation;

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


return $moderation->delete_thread($tid);
}


return $moderation->delete_thread($tid);
}

Zeile 2258Zeile 2273
 * @param int The thread ID
*/
function delete_post($pid, $tid="")

 * @param int The thread ID
*/
function delete_post($pid, $tid="")

{

{

	global $moderation;

if(!is_object($moderation))

	global $moderation;

if(!is_object($moderation))

Zeile 2293Zeile 2308
	if($permissions)
{
$permissions = $mybb->usergroup;

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

	}


	}


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

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

Zeile 2342Zeile 2357
					{
$newdepth = $depth."--";
$forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);

					{
$newdepth = $depth."--";
$forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras, $showall);

					}

					}

				}
}
}

				}
}
}

Zeile 2536Zeile 2551
	}

return $codeinsert;

	}

return $codeinsert;

}

}


/**
* Build the javascript clickable smilie inserter


/**
* Build the javascript clickable smilie inserter

Zeile 2548Zeile 2563
	global $cache, $smiliecache, $theme, $templates, $lang, $mybb, $smiliecount;

if($mybb->settings['smilieinserter'] != 0 && $mybb->settings['smilieinsertercols'] && $mybb->settings['smilieinsertertot'])

	global $cache, $smiliecache, $theme, $templates, $lang, $mybb, $smiliecount;

if($mybb->settings['smilieinserter'] != 0 && $mybb->settings['smilieinsertercols'] && $mybb->settings['smilieinsertertot'])

	{

	{

		if(!$smiliecount)

		if(!$smiliecount)

		{

		{

			$smilie_cache = $cache->read("smilies");
$smiliecount = count($smilie_cache);
}

			$smilie_cache = $cache->read("smilies");
$smiliecount = count($smilie_cache);
}

Zeile 2560Zeile 2575
			if(!is_array($smilie_cache))
{
$smilie_cache = $cache->read("smilies");

			if(!is_array($smilie_cache))
{
$smilie_cache = $cache->read("smilies");

			}

			}

			foreach($smilie_cache as $smilie)
{
if($smilie['showclickable'] != 0)

			foreach($smilie_cache as $smilie)
{
if($smilie['showclickable'] != 0)

Zeile 2596Zeile 2611
				if($i < $mybb->settings['smilieinsertertot'])
{
if($counter == 0)

				if($i < $mybb->settings['smilieinsertertot'])
{
if($counter == 0)

					{

					{

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


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


Zeile 2620Zeile 2635
			}

eval("\$clickablesmilies = \"".$templates->get("smilieinsert")."\";");

			}

eval("\$clickablesmilies = \"".$templates->get("smilieinsert")."\";");

		}

		}

		else
{
$clickablesmilies = "";
}

		else
{
$clickablesmilies = "";
}

	}

	}

	else
{
$clickablesmilies = "";
}

return $clickablesmilies;

	else
{
$clickablesmilies = "";
}

return $clickablesmilies;

}

}


/**
* Builds thread prefixes and returns a selected prefix (or all)


/**
* Builds thread prefixes and returns a selected prefix (or all)

Zeile 2669Zeile 2684
	}

$prefixes_cache = array();

	}

$prefixes_cache = array();

	foreach($prefix_cache as $prefix)

	foreach($prefix_cache as $prefix)

	{
$prefixes_cache[$prefix['pid']] = $prefix;

	{
$prefixes_cache[$prefix['pid']] = $prefix;

	}

	}


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


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

	{

	{

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

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

	}

	}


return false;
}


return false;
}

Zeile 2729Zeile 2744
			$forums = explode(",", $prefix['forums']);

if(!in_array($fid, $forums))

			$forums = explode(",", $prefix['forums']);

if(!in_array($fid, $forums))

			{

			{

				// This prefix is not in our forum list
continue;

				// This prefix is not in our forum list
continue;

			}
}

if($prefix['groups'] != "-1")
{
$prefix_groups = explode(",", $prefix['groups']);

			}
}

if($prefix['groups'] != "-1")
{
$prefix_groups = explode(",", $prefix['groups']);


foreach($groups as $group)
{


foreach($groups as $group)
{

Zeile 2747Zeile 2762
					$prefixes[$prefix['pid']] = $prefix;
}
}

					$prefixes[$prefix['pid']] = $prefix;
}
}

		}

		}

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

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

Zeile 2756Zeile 2771
	}

if(empty($prefixes))

	}

if(empty($prefixes))

	{

	{

		return false;
}

$prefixselect = "";

		return false;
}

$prefixselect = "";

	$multipleselect = "";

 
	if($multiple != 0)
{

	if($multiple != 0)
{

		$multipleselect = " multiple=\"multiple\" size=\"5\"";





		$prefixselect = "<select name=\"threadprefix[]\" multiple=\"multiple\" size=\"5\">\n";
}
else
{
$prefixselect = "<select name=\"threadprefix\">\n";

	}

	}


$prefixselect = "<select name=\"threadprefix\"{$multipleselect}>\n";

 

if($multiple == 1)
{


if($multiple == 1)
{

Zeile 2923Zeile 2939
	if($uid != 0)
{
$display_reputation = "<a href=\"reputation.php?uid={$uid}\">";

	if($uid != 0)
{
$display_reputation = "<a href=\"reputation.php?uid={$uid}\">";

	}

$display_reputation .= "<strong class=\"";

	}

$display_reputation .= "<strong class=\"";


if($reputation < 0)
{


if($reputation < 0)
{

Zeile 2987Zeile 3003

$ip = 0;



$ip = 0;


	if(!preg_match("#^(10|172\.16|192\.168)\.#", $_SERVER['REMOTE_ADDR']))

	if(!preg_match("#^(10|172\.(1[6-9]|2[0-9]|3[0-1])|192\.168)\.#", $_SERVER['REMOTE_ADDR']))

	{
$ip = $_SERVER['REMOTE_ADDR'];
}

	{
$ip = $_SERVER['REMOTE_ADDR'];
}

Zeile 3007Zeile 3023
		{
foreach($addresses[0] as $key => $val)
{

		{
foreach($addresses[0] as $key => $val)
{

				if(!preg_match("#^(10|172\.16|192\.168)\.#", $val))

				if(!preg_match("#^(10|172\.(1[6-9]|2[0-9]|3[0-1])|192\.168)\.#", $val))

				{
$ip = $val;
break;

				{
$ip = $val;
break;

Zeile 3118Zeile 3134
	$ext = my_strtolower($ext);

if($attachtypes[$ext]['icon'])

	$ext = my_strtolower($ext);

if($attachtypes[$ext]['icon'])

	{
if(defined("IN_ADMINCP"))
{

	{
if(defined("IN_ADMINCP"))
{

			$icon = str_replace("{theme}", "", $attachtypes[$ext]['icon']);
if(my_substr($icon, 0, 1) != "/" && my_substr($icon, 0, 7) != "http://")
{

			$icon = str_replace("{theme}", "", $attachtypes[$ext]['icon']);
if(my_substr($icon, 0, 1) != "/" && my_substr($icon, 0, 7) != "http://")
{

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

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

 
		$icon = htmlspecialchars_uni($icon);

		return "<img src=\"{$icon}\" border=\"0\" alt=\".{$ext}\" />";
}
else

		return "<img src=\"{$icon}\" border=\"0\" alt=\".{$ext}\" />";
}
else

Zeile 3147Zeile 3164
		else if(defined("IN_PORTAL"))
{
global $change_dir;

		else if(defined("IN_PORTAL"))
{
global $change_dir;

			$theme['imgdir'] = "{$change_dir}/images";

			$theme['imgdir'] = htmlspecialchars_uni("{$change_dir}/images");

		}

return "<img src=\"{$theme['imgdir']}/attachtypes/unknown.gif\" border=\"0\" alt=\".{$ext}\" />";

		}

return "<img src=\"{$theme['imgdir']}/attachtypes/unknown.gif\" border=\"0\" alt=\".{$ext}\" />";

Zeile 3180Zeile 3197
		if($permissioncache[$forum['fid']])
{
$perms = $permissioncache[$forum['fid']];

		if($permissioncache[$forum['fid']])
{
$perms = $permissioncache[$forum['fid']];

		}

		}

		else
{
$perms = $mybb->usergroup;

		else
{
$perms = $mybb->usergroup;

Zeile 3219Zeile 3236

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


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

	}

	}


if(isset($unviewableforums))
{


if(isset($unviewableforums))
{

Zeile 3278Zeile 3295
				$multipage_dropdown = null;
if(!empty($navbit['multipage']))
{

				$multipage_dropdown = null;
if(!empty($navbit['multipage']))
{

 
					if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
{
$mybb->settings['threadsperpage'] = 20;
}


					$multipage = multipage($navbit['multipage']['num_threads'], $mybb->settings['threadsperpage'], $navbit['multipage']['current_page'], $navbit['multipage']['url'], true);
if($multipage)
{

					$multipage = multipage($navbit['multipage']['num_threads'], $mybb->settings['threadsperpage'], $navbit['multipage']['current_page'], $navbit['multipage']['url'], true);
if($multipage)
{

Zeile 5440Zeile 5462
			if($update_lastuse == true)
{
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'");

			if($update_lastuse == true)
{
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'");

			}

			}

			return true;
}
}

			return true;
}
}

Zeile 5634Zeile 5656
	}

if(function_exists("curl_init"))

	}

if(function_exists("curl_init"))

	{

	{

		$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);

		$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);

Zeile 5680Zeile 5702
			$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 5730Zeile 5752
 * @return boolean True if a super admin, false if not
*/
function is_super_admin($uid)

 * @return boolean True if a super admin, false if not
*/
function is_super_admin($uid)

{
global $mybb;

$mybb->config['super_admins'] = str_replace(" ", "", $mybb->config['super_admins']);
if(my_strpos(",{$mybb->config['super_admins']},", ",{$uid},") === false)
{






{
static $super_admins;

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

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

		return false;

		return false;

	}

	}

	else

	else

	{

	{

		return true;
}

		return true;
}

 
}

/**
* Prevents super administrators being selected in a SELECT.
*
* @param boolean Prefix with an AND?
* @param string The prefix to add to uid when used in a JOIN (e.g. SELECTing users u would mean using 'u' in this argument).
* @return string An addition to the WHERE statement
*/
function not_super_admins($use_and = false, $uid_prefix = '')
{
static $super_admins;

if(!isset($super_admins))
{
global $mybb, $db;
$super_admins = $db->escape_string(str_replace(" ", "", $mybb->config['super_admins']));
}

if($super_admins)
{
$sql_where = '';
if($use_and)
{
$sql_where .= ' AND ';
}

if($uid_prefix != '')
{
$sql_where .= $uid_prefix.'.';
}

$sql_where .= "uid NOT IN({$super_admins})";

return $sql_where;
}
return '';

}

/**

}

/**

Zeile 5769Zeile 5833
			$escape_preg = "(".implode("|", array_map("escaped_explode_escape", $escape)).")";
}
else

			$escape_preg = "(".implode("|", array_map("escaped_explode_escape", $escape)).")";
}
else

		{

		{

			$escape_preg = preg_quote($escape, "#");
}
$quoted_strings = preg_split("#(?<!\\\){$escape_preg}#", $string);
}
else

			$escape_preg = preg_quote($escape, "#");
}
$quoted_strings = preg_split("#(?<!\\\){$escape_preg}#", $string);
}
else

	{

	{

		$quoted_strings = array($string);
}
foreach($quoted_strings as $string)
{
if($string != "")

		$quoted_strings = array($string);
}
foreach($quoted_strings as $string)
{
if($string != "")

		{

		{

			if($in_escape)
{
$strings[] = trim($string);

			if($in_escape)
{
$strings[] = trim($string);

Zeile 5817Zeile 5881
	$ip_string1 = $ip_string2 = "";

if($ip == "*")

	$ip_string1 = $ip_string2 = "";

if($ip == "*")

	{

	{

		return array(my_ip2long('128.0.0.0'), my_ip2long('127.255.255.255'));
}


		return array(my_ip2long('128.0.0.0'), my_ip2long('127.255.255.255'));
}


Zeile 5825Zeile 5889
	{
$ip = str_replace("*", "", $ip);
if(count($ip_bits) == 4)

	{
$ip = str_replace("*", "", $ip);
if(count($ip_bits) == 4)

		{

		{

			return my_ip2long($ip);

			return my_ip2long($ip);

		}
else
{

		}
else
{

			return array(my_ip2long($ip.".0"), my_ip2long($ip.".255"));
}
}

			return array(my_ip2long($ip.".0"), my_ip2long($ip.".255"));
}
}

Zeile 6021Zeile 6085
	}

return @unlink($path);

	}

return @unlink($path);

}


}


/**
* Counts the number of subforums in a array([pid][disporder][fid]) starting from the pid
*

/**
* Counts the number of subforums in a array([pid][disporder][fid]) starting from the pid
*

Zeile 6209Zeile 6273
function secure_seed_rng($count=8)
{
$output = '';

function secure_seed_rng($count=8)
{
$output = '';


// Use OpenSSL when available
// PHP <5.3.4 had a bug which makes that function unusable on Windows
if(function_exists('openssl_random_pseudo_bytes') && version_compare(PHP_VERSION, '5.3.4', '>='))
{
$output = openssl_random_pseudo_bytes($count);















	// DIRECTORY_SEPARATOR checks if running windows
if(DIRECTORY_SEPARATOR != '\\')
{
// Unix/Linux
// Use OpenSSL when available
if(function_exists('openssl_random_pseudo_bytes'))
{
$output = openssl_random_pseudo_bytes($count);
}
// Try mcrypt
elseif(function_exists('mcrypt_create_iv'))
{
$output = mcrypt_create_iv($count, MCRYPT_DEV_URANDOM);
}
// Try /dev/urandom
elseif(@is_readable('/dev/urandom') && ($handle = @fopen('/dev/urandom', 'rb')))
{
$output = @fread($handle, $count);
@fclose($handle);
}

	}

	}

	// Try the unix/linux method
elseif(@is_readable('/dev/urandom') && ($handle = @fopen('/dev/urandom', 'rb')))

	else


	{

	{

		$output = @fread($handle, $count);
@fclose($handle);
}
// Try Windows CAPICOM before using our own generator
elseif(class_exists('COM'))
{
try

		// Windows
// Use OpenSSL when available
// PHP <5.3.4 had a bug which makes that function unusable on Windows
if(function_exists('openssl_random_pseudo_bytes') && version_compare(PHP_VERSION, '5.3.4', '>='))




		{

		{

			$CAPI_Util = new COM('CAPICOM.Utilities.1');
$output = $CAPI_Util->GetRandom($count, 0);
} catch (Exception $ex) {

















			$output = openssl_random_pseudo_bytes($count);
}
// Try mcrypt
elseif(function_exists('mcrypt_create_iv'))
{
$output = mcrypt_create_iv($count, MCRYPT_RAND);
}
// Try Windows CAPICOM before using our own generator
elseif(class_exists('COM'))
{
try
{
$CAPI_Util = new COM('CAPICOM.Utilities.1');
if(is_callable(array($CAPI_Util, 'GetRandom')))
{
$output = $CAPI_Util->GetRandom($count, 0);
}
} catch (Exception $e) {
}

		}
}


		}
}


Zeile 6301Zeile 6391
}

/**

}

/**

 * More robust version of PHP's trim() function. It includes a list of UTF-16 blank characters

 * More robust version of PHP's trim() function. It includes a list of UTF-8 blank characters

 * from http://kb.mozillazine.org/Network.IDN.blacklist_chars
*
* @param string The string to trim from

 * from http://kb.mozillazine.org/Network.IDN.blacklist_chars
*
* @param string The string to trim from

Zeile 6311Zeile 6401
function trim_blank_chrs($string, $charlist=false)
{
$hex_chrs = array(

function trim_blank_chrs($string, $charlist=false)
{
$hex_chrs = array(

		0x20 => 1,
0x09 => 1,
0x0A => 1,
0x0D => 1,
0x0B => 1,
0xAD => 1,
0xA0 => 1,
0xAD => 1,
0xBF => 1,
0x81 => 1,
0x8D => 1,
0x90 => 1,
0x9D => 1,
0xCC => array(0xB7 => 1, 0xB8 => 1), // \x{0337} or \x{0338}
0xE1 => array(0x85 => array(0x9F => 1, 0xA0 => 1)), // \x{115F} or \x{1160}
0xE2 => array(0x80 => array(0x80 => 1, 0x81 => 1, 0x82 => 1, 0x83 => 1, 0x84 => 1, 0x85 => 1, 0x86 => 1, 0x87 => 1, 0x88 => 1, 0x89 => 1, 0x8A => 1, 0x8B => 1, // \x{2000} to \x{200B}
0xA8 => 1, 0xA9 => 1, 0xAA => 1, 0xAB => 1, 0xAC => 1, 0xAD => 1, 0xAE => 1, 0xAF => 1), // \x{2028} to \x{202F}
0x81 => array(0x9F => 1)), // \x{205F}

		0x09 => 1, // \x{0009}
0x0A => 1, // \x{000A}
0x0B => 1, // \x{000B}
0x0D => 1, // \x{000D}
0x20 => 1, // \x{0020}
0xC2 => array(0x81 => 1, 0x8D => 1, 0x90 => 1, 0x9D => 1, 0xA0 => 1, 0xAD => 1), // \x{0081}, \x{008D}, \x{0090}, \x{009D}, \x{00A0}, \x{00AD}
0xCC => array(0xB7 => 1, 0xB8 => 1), // \x{0337}, \x{0338}
0xE1 => array(0x85 => array(0x9F => 1, 0xA0 => 1), 0x9A => array(0x80 => 1), 0xA0 => array(0x8E => 1)), // \x{115F}, \x{1160}, \x{1680}, \x{180E}
0xE2 => array(0x80 => array(0x80 => 1, 0x81 => 1, 0x82 => 1, 0x83 => 1, 0x84 => 1, 0x85 => 1, 0x86 => 1, 0x87 => 1, 0x88 => 1, 0x89 => 1, 0x8A => 1, 0x8B => 1, 0x8C => 1, 0x8D => 1, 0x8E => 1, 0x8F => 1, // \x{2000} - \x{200F}
0xA8 => 1, 0xA9 => 1, 0xAA => 1, 0xAB => 1, 0xAC => 1, 0xAD => 1, 0xAE => 1, 0xAF => 1), // \x{2028} - \x{202F}
0x81 => array(0x9F => 1)), // \x{205F}








		0xE3 => array(0x80 => array(0x80 => 1), // \x{3000}

		0xE3 => array(0x80 => array(0x80 => 1), // \x{3000}

					  0x85 => array(0xA4 => 1)), // \x{3164}

			0x85 => array(0xA4 => 1)), // \x{3164}

		0xEF => array(0xBB => array(0xBF => 1), // \x{FEFF}

		0xEF => array(0xBB => array(0xBF => 1), // \x{FEFF}

					  0xBE => array(0xA0 => 1), // \x{FFA0}
0xBF => array(0xB9 => 1, 0xBA => 1, 0xBB => 1)), // \x{FFF9} to \x{FFFB}

			0xBE => array(0xA0 => 1), // \x{FFA0}
0xBF => array(0xB9 => 1, 0xBA => 1, 0xBB => 1)), // \x{FFF9} - \x{FFFB}

	);

$hex_chrs_rev = array(

	);

$hex_chrs_rev = array(

		0x20 => 1,
0x09 => 1,
0x0A => 1,
0x0D => 1,
0x0B => 1,
0xA0 => array(0xC2 => 1),
0xAD => array(0xC2 => 1),
0xBF => array(0xC2 => 1),
0x81 => array(0xC2 => 1),
0x8D => array(0xC2 => 1),
0x90 => array(0xC2 => 1),
0x9D => array(0xC2 => 1),

		0x09 => 1, // \x{0009}
0x0A => 1, // \x{000A}
0x0B => 1, // \x{000B}
0x0D => 1, // \x{000D}
0x20 => 1, // \x{0020}
0x81 => array(0xC2 => 1, 0x80 => array(0xE2 => 1)), // \x{0081}, \x{2001}
0x8D => array(0xC2 => 1, 0x80 => array(0xE2 => 1)), // \x{008D}, \x{200D}
0x90 => array(0xC2 => 1), // \x{0090}
0x9D => array(0xC2 => 1), // \x{009D}
0xA0 => array(0xC2 => 1, 0x85 => array(0xE1 => 1), 0x81 => array(0xE2 => 1), 0xBE => array(0xEF => 1)), // \x{00A0}, \x{1160}, \x{2060}, \x{FFA0}
0xAD => array(0xC2 => 1, 0x80 => array(0xE2 => 1)), // \x{00AD}, \x{202D}


		0xB8 => array(0xCC => 1), // \x{0338}
0xB7 => array(0xCC => 1), // \x{0337}

		0xB8 => array(0xCC => 1), // \x{0338}
0xB7 => array(0xCC => 1), // \x{0337}

		0xA0 => array(0x85 => array(0xE1 => 1)), // \x{1160}
0x9F => array(0x85 => array(0xE1 => 1), // \x{115F}
0x81 => array(0xE2 => 1)), // \x{205F}
0x80 => array(0x80 => array(0xE3 => 1, 0xE2 => 1)), // \x{3000}, \x{2000}
0x81 => array(0x80 => array(0xE2 => 1)), // \x{2001}

		0x9F => array(0x85 => array(0xE1 => 1), 0x81 => array(0xE2 => 1)), // \x{115F}, \x{205F}
0x80 => array(0x9A => array(0xE1 => 1), 0x80 => array(0xE2 => 1, 0xE3 => 1)), // \x{1680}, \x{2000}, \x{3000}
0x8E => array(0xA0 => array(0xE1 => 1), 0x80 => array(0xE2 => 1)), // \x{180E}, \x{200E}



		0x82 => array(0x80 => array(0xE2 => 1)), // \x{2002}
0x83 => array(0x80 => array(0xE2 => 1)), // \x{2003}
0x84 => array(0x80 => array(0xE2 => 1)), // \x{2004}

		0x82 => array(0x80 => array(0xE2 => 1)), // \x{2002}
0x83 => array(0x80 => array(0xE2 => 1)), // \x{2003}
0x84 => array(0x80 => array(0xE2 => 1)), // \x{2004}

Zeile 6366Zeile 6446
		0x89 => array(0x80 => array(0xE2 => 1)), // \x{2009}
0x8A => array(0x80 => array(0xE2 => 1)), // \x{200A}
0x8B => array(0x80 => array(0xE2 => 1)), // \x{200B}

		0x89 => array(0x80 => array(0xE2 => 1)), // \x{2009}
0x8A => array(0x80 => array(0xE2 => 1)), // \x{200A}
0x8B => array(0x80 => array(0xE2 => 1)), // \x{200B}

 
		0x8C => array(0x80 => array(0xE2 => 1)), // \x{200C}
0x8F => array(0x80 => array(0xE2 => 1)), // \x{200F}

		0xA8 => array(0x80 => array(0xE2 => 1)), // \x{2028}
0xA9 => array(0x80 => array(0xE2 => 1)), // \x{2029}
0xAA => array(0x80 => array(0xE2 => 1)), // \x{202A}
0xAB => array(0x80 => array(0xE2 => 1)), // \x{202B}
0xAC => array(0x80 => array(0xE2 => 1)), // \x{202C}

		0xA8 => array(0x80 => array(0xE2 => 1)), // \x{2028}
0xA9 => array(0x80 => array(0xE2 => 1)), // \x{2029}
0xAA => array(0x80 => array(0xE2 => 1)), // \x{202A}
0xAB => array(0x80 => array(0xE2 => 1)), // \x{202B}
0xAC => array(0x80 => array(0xE2 => 1)), // \x{202C}

		0xAD => array(0x80 => array(0xE2 => 1)), // \x{202D}

 
		0xAE => array(0x80 => array(0xE2 => 1)), // \x{202E}
0xAF => array(0x80 => array(0xE2 => 1)), // \x{202F}
0xA4 => array(0x85 => array(0xE3 => 1)), // \x{3164}
0xBF => array(0xBB => array(0xEF => 1)), // \x{FEFF}

		0xAE => array(0x80 => array(0xE2 => 1)), // \x{202E}
0xAF => array(0x80 => array(0xE2 => 1)), // \x{202F}
0xA4 => array(0x85 => array(0xE3 => 1)), // \x{3164}
0xBF => array(0xBB => array(0xEF => 1)), // \x{FEFF}

		0xA0 => array(0xBE => array(0xEF => 1)), // \x{FFA0}

 
		0xB9 => array(0xBF => array(0xEF => 1)), // \x{FFF9}
0xBA => array(0xBF => array(0xEF => 1)), // \x{FFFA}
0xBB => array(0xBF => array(0xEF => 1)), // \x{FFFB}

		0xB9 => array(0xBF => array(0xEF => 1)), // \x{FFF9}
0xBA => array(0xBF => array(0xEF => 1)), // \x{FFFA}
0xBB => array(0xBF => array(0xEF => 1)), // \x{FFFB}

Zeile 6385Zeile 6465
	// Start from the beginning and work our way in
do
{

	// Start from the beginning and work our way in
do
{

		// Check to see if we have matched a first character in our utf-16 array

		// Check to see if we have matched a first character in our utf-8 array

		$offset = match_sequence($string, $hex_chrs);
if(!$offset)
{

		$offset = match_sequence($string, $hex_chrs);
if(!$offset)
{

Zeile 6400Zeile 6480
	$string = strrev($string);
do
{

	$string = strrev($string);
do
{

		// Check to see if we have matched a first character in our utf-16 array

		// Check to see if we have matched a first character in our utf-8 array

		$offset = match_sequence($string, $hex_chrs_rev);
if(!$offset)
{

		$offset = match_sequence($string, $hex_chrs_rev);
if(!$offset)
{