Vergleich inc/functions.php - 1.2.7 - 1.2.9

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html
*

 * $Id: functions.php 3070 2007-05-18 07:44:28Z chris $

 * $Id: functions.php 3177 2007-06-29 07:51:12Z chris $

 */

/**

 */

/**

Zeile 74Zeile 74
			$contents = gzip_encode($contents);
}
}

			$contents = gzip_encode($contents);
}
}

 

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


	echo $contents;

	echo $contents;





	$plugins->run_hooks("post_output_page");

// If the use shutdown functionality is turned off, run any shutdown related items now.
if(($mybb->settings['useshutdownfunc'] == "no"|| phpversion() >= '5.0.5') && $mybb->use_shutdown != true)

	$plugins->run_hooks("post_output_page");

// If the use shutdown functionality is turned off, run any shutdown related items now.
if(($mybb->settings['useshutdownfunc'] == "no"|| phpversion() >= '5.0.5') && $mybb->use_shutdown != true)

	{

	{

		run_shutdown();
}
}

/**
* Adds a function to the list of functions to run on shutdown.

		run_shutdown();
}
}

/**
* Adds a function to the list of functions to run on shutdown.

 *

 *

 * @param string The name of the function.
*/
function add_shutdown($name)

 * @param string The name of the function.
*/
function add_shutdown($name)

Zeile 107Zeile 110
function run_shutdown()
{
global $db, $cache, $plugins, $shutdown_functions, $done_shutdown;

function run_shutdown()
{
global $db, $cache, $plugins, $shutdown_functions, $done_shutdown;

	

	

	if($done_shutdown == true)
{
return;

	if($done_shutdown == true)
{
return;

Zeile 128Zeile 131
	
// Cache object deconstructed? reconstruct
if(!is_object($cache))

	
// Cache object deconstructed? reconstruct
if(!is_object($cache))

	{

	{

		require_once MYBB_ROOT."inc/class_datacache.php";
$cache = new datacache;
}

		require_once MYBB_ROOT."inc/class_datacache.php";
$cache = new datacache;
}

Zeile 297Zeile 300
		if($todaysdate == $date)
{
$date = $lang->today;

		if($todaysdate == $date)
{
$date = $lang->today;

		}

		}

		elseif($yesterdaysdate == $date)
{
$date = $lang->yesterday;

		elseif($yesterdaysdate == $date)
{
$date = $lang->yesterday;

Zeile 464Zeile 467
	if(!$error)
{
$error = $lang->unknown_error;

	if(!$error)
{
$error = $lang->unknown_error;

	}
if(!$title)
{

	}
if(!$title)
{

		$title = $mybb->settings['bbname'];
}
$timenow = my_date($mybb->settings['dateformat'], time()) . " " . my_date($mybb->settings['timeformat'], time());

		$title = $mybb->settings['bbname'];
}
$timenow = my_date($mybb->settings['dateformat'], time()) . " " . my_date($mybb->settings['timeformat'], time());

Zeile 494Zeile 497
	if(!is_array($errors))
{
$errors = array($errors);

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

	}

	}

	foreach($errors as $error)
{
$errorlist .= "<li>".$error."</li>\n";

	foreach($errors as $error)
{
$errorlist .= "<li>".$error."</li>\n";

Zeile 523Zeile 526
	{
$lang->error_nopermission_user_5 = sprintf($lang->error_nopermission_user_5, $mybb->user['username']);
eval("\$errorpage = \"".$templates->get("error_nopermission_loggedin")."\";");

	{
$lang->error_nopermission_user_5 = sprintf($lang->error_nopermission_user_5, $mybb->user['username']);
eval("\$errorpage = \"".$templates->get("error_nopermission_loggedin")."\";");

	}
else
{

	}
else
{

		eval("\$errorpage = \"".$templates->get("error_nopermission")."\";");
}
error($errorpage);

		eval("\$errorpage = \"".$templates->get("error_nopermission")."\";");
}
error($errorpage);

Zeile 638Zeile 641
 * @return array Array of user permissions for the specified user
*/
function user_permissions($uid=0)

 * @return array Array of user permissions for the specified user
*/
function user_permissions($uid=0)

{

{

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

	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 660Zeile 663
		if(!$user_cache[$uid])
{
$user_cache[$uid] = get_user($uid);

		if(!$user_cache[$uid])
{
$user_cache[$uid] = get_user($uid);

		}

		}


// Collect group permissions.


// Collect group permissions.

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





		$gid = $user_cache[$uid]['usergroup'];
if($user_cache[$uid]['additionalgroups'])
{
$gid .= ",".$user_cache[$uid]['additionalgroups'];
}

		$groupperms = usergroup_permissions($gid);

// Store group permissions in user cache.

		$groupperms = usergroup_permissions($gid);

// Store group permissions in user cache.

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

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

 


	$groups = explode(",", $gid);
if(count($groups) == 1)
{
return $groupscache[$gid];

	$groups = explode(",", $gid);
if(count($groups) == 1)
{
return $groupscache[$gid];

	}
foreach($groups as $gid)

	}
foreach($groups as $gid)

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

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

Zeile 720Zeile 728
					if($access == 0)
{
$usergroup[$perm] = 0;

					if($access == 0)
{
$usergroup[$perm] = 0;

						$zerogreater = 1;

 
					}

					}

 
					$zerogreater = 1;

				}
if(($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) && $zerogreater != 1)
{

				}
if(($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) && $zerogreater != 1)
{

Zeile 767Zeile 775
function forum_permissions($fid=0, $uid=0, $gid=0)
{
global $db, $cache, $groupscache, $forum_cache, $fpermcache, $mybb, $usercache, $fpermissionscache;

function forum_permissions($fid=0, $uid=0, $gid=0)
{
global $db, $cache, $groupscache, $forum_cache, $fpermcache, $mybb, $usercache, $fpermissionscache;



	static $cached_forum_permissions;

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

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

Zeile 777Zeile 785
		if($uid != $mybb->user['uid'])
{
if($usercache[$uid])

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

			{

			{

				$query = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid='$uid'");
$usercache[$uid] = $db->fetch_array($query);
}

				$query = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid='$uid'");
$usercache[$uid] = $db->fetch_array($query);
}

Zeile 792Zeile 800
				$gid .= ",".$mybb->user['additionalgroups'];
}
$groupperms = $mybb->usergroup;

				$gid .= ",".$mybb->user['additionalgroups'];
}
$groupperms = $mybb->usergroup;

		}

		}

	}
if(!is_array($forum_cache))
{

	}
if(!is_array($forum_cache))
{

Zeile 808Zeile 816
	}
if($fid) // Fetch the permissions for a single forum
{

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

		$permissions = fetch_forum_permissions($fid, $gid, $groupperms);
}
else
{
foreach($forum_cache as $forum)

		if(!$cached_forum_permissions[$gid][$fid])





		{

		{

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

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

		}

		}

 
		return $cached_forum_permissions_permissions[$gid][$fid];
}
else
{
if(!$cached_forum_permissions[$gid])
{
foreach($forum_cache as $forum)
{
$cached_forum_permissions[$gid][$forum['fid']] = fetch_forum_permissions($forum['fid'], $gid, $groupperms);
}
}
return $cached_forum_permissions[$gid];

	}

	}

	return $permissions;

 
}

/**

}

/**

Zeile 870Zeile 885

/**
* Check the password given on a certain forum for validity


/**
* Check the password given on a certain forum for validity

 *

 *

 * @param int The forum ID
* @param string The plain text password for the forum
*/

 * @param int The forum ID
* @param string The plain text password for the forum
*/

Zeile 884Zeile 899
		if($mybb->input['pwverify'])
{
if($password == $mybb->input['pwverify'])

		if($mybb->input['pwverify'])
{
if($password == $mybb->input['pwverify'])

			{

			{

				my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']), null, true);
$showform = 0;
}
else
{
eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");

				my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']), null, true);
$showform = 0;
}
else
{
eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");

				$showform = 1;

				$showform = 1;

			}
}
else

			}
}
else

Zeile 905Zeile 920
				$showform = 0;
}
}

				$showform = 0;
}
}

	}

	}

	else
{
$showform = 0;

	else
{
$showform = 0;

Zeile 926Zeile 941
 * @param uid The user ID to fetch permissions for (0 assumes current logged in user)
* @param string The parent list for the forum (if blank, will be fetched)
* @return array Array of moderator permissions for the specific forum

 * @param uid The user ID to fetch permissions for (0 assumes current logged in user)
* @param string The parent list for the forum (if blank, will be fetched)
* @return array Array of moderator permissions for the specific forum

 */

 */

function get_moderator_permissions($fid, $uid="0", $parentslist="")
{
global $mybb, $db;
static $modpermscache;

if($uid < 1)

function get_moderator_permissions($fid, $uid="0", $parentslist="")
{
global $mybb, $db;
static $modpermscache;

if($uid < 1)

	{

	{

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


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


Zeile 968Zeile 983
function is_moderator($fid="0", $action="", $uid="0")
{
global $mybb, $db;

function is_moderator($fid="0", $action="", $uid="0")
{
global $mybb, $db;





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

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

Zeile 982Zeile 997
	else
{
if(!$fid)

	else
{
if(!$fid)

		{

		{

			$query = $db->simple_select(TABLE_PREFIX.'moderators', 'COUNT(*) as count', "uid={$uid}", array('limit' => 1));
$modcheck = $db->fetch_array($query);
if($modcheck['count'] > 0)

			$query = $db->simple_select(TABLE_PREFIX.'moderators', 'COUNT(*) as count', "uid={$uid}", array('limit' => 1));
$modcheck = $db->fetch_array($query);
if($modcheck['count'] > 0)

Zeile 1087Zeile 1102
		else
{
$expires = time() + (60*60*24*365); // Make the cookie expire in a years time

		else
{
$expires = time() + (60*60*24*365); // Make the cookie expire in a years time

		}
}
else

		}
}
else

	{
$expires = time() + intval($expires);
}

	{
$expires = time() + intval($expires);
}

Zeile 1100Zeile 1115
	// Versions of PHP prior to 5.2 do not support HttpOnly cookies and IE is buggy when specifying a blank domain so set the cookie manually
$cookie = "Set-Cookie: {$name}=".urlencode($value);
if($expires > 0)

	// Versions of PHP prior to 5.2 do not support HttpOnly cookies and IE is buggy when specifying a blank domain so set the cookie manually
$cookie = "Set-Cookie: {$name}=".urlencode($value);
if($expires > 0)

	{

	{

		$cookie .= "; expires=".gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires);
}
if(!empty($mybb->settings['cookiepath']))
{
$cookie .= "; path={$mybb->settings['cookiepath']}";

		$cookie .= "; expires=".gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires);
}
if(!empty($mybb->settings['cookiepath']))
{
$cookie .= "; path={$mybb->settings['cookiepath']}";

	}

	}

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

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

	}

	}

	if($httponly == true)
{
$cookie .= "; HttpOnly";
}
header($cookie, false);

	if($httponly == true)
{
$cookie .= "; HttpOnly";
}
header($cookie, false);

}

}


/**
* Unset a cookie set by MyBB.


/**
* Unset a cookie set by MyBB.

Zeile 1178Zeile 1193
function get_server_load()
{
global $lang;

function get_server_load()
{
global $lang;

	if(strtolower(substr(PHP_OS, 0, 3)) === 'win')
{
return $lang->unknown;
}
elseif(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg"))


$serverload = array();

if(my_strtolower(substr(PHP_OS, 0, 3)) !== 'win')


	{

	{

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




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

		if(!$serverload)
{
$load = @exec("uptime");
$load = split("load averages?: ", $load);
$serverload = explode(",", $load[1]);

		if(!$serverload)
{
$load = @exec("uptime");
$load = split("load averages?: ", $load);
$serverload = explode(",", $load[1]);

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

		}
}
else
{

		}
}
else
{

		$load = @exec("uptime");
$load = split("load averages?: ", $load);
$serverload = explode(",", $load[1]);

		return $lang->unknown;



	}

	}

 


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

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

	if(!$returnload)
{
$returnload = $lang->unknown;
}






	return $returnload;
}

	return $returnload;
}

 



/**
* Updates the forum statistics with specific values (or addition/subtraction of the previous value)


/**
* Updates the forum statistics with specific values (or addition/subtraction of the previous value)

Zeile 1707Zeile 1725
			"editor_size_x_small",
"editor_size_small",
"editor_size_medium",

			"editor_size_x_small",
"editor_size_small",
"editor_size_medium",

 
			"editor_size_large",

			"editor_size_x_large",
"editor_size_xx_large",
"editor_color_white",

			"editor_size_x_large",
"editor_size_xx_large",
"editor_color_white",

Zeile 2812Zeile 2831
		}
}


		}
}


	if($tid)

	if($tid == 0)

	{
$themeselect .= "</select>";
}

	{
$themeselect .= "</select>";
}

Zeile 2828Zeile 2847
 */
function htmlspecialchars_uni($message)
{

 */
function htmlspecialchars_uni($message)
{

	$message = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $message); // Fix & but allow unicode

	$message = preg_replace("#&([^\#])(?![a-z1-4]{1,10};)#i", "&#038;$1", $message); // Fix & but allow unicode

	$message = str_replace("<","&lt;",$message);
$message = str_replace(">","&gt;",$message);
$message = str_replace("\"","&quot;",$message);

	$message = str_replace("<","&lt;",$message);
$message = str_replace(">","&gt;",$message);
$message = str_replace("\"","&quot;",$message);

Zeile 2922Zeile 2941
 *
* @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(31, ($in % 4 == 0 && ($in % 100 > 0 || $in % 400 == 0) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));

function get_bdays($in)
{
return(array(31, ($in % 4 == 0 && ($in % 100 > 0 || $in % 400 == 0) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));

Zeile 3031Zeile 3050
    {
$string_length = strlen($string);
}

    {
$string_length = strlen($string);
}





    return $string_length;
}


    return $string_length;
}


Zeile 3140Zeile 3159

/**
* Returns any html entities to their original character


/**
* Returns any html entities to their original character

 *

 *

 * @param string The string to un-htmlentitize.
* @return int The un-htmlentitied' string.
*/

 * @param string The string to un-htmlentitize.
* @return int The un-htmlentitied' string.
*/

Zeile 3188Zeile 3207
	$event_date = explode("-", $event['date']);
$event_date = mktime(0, 0, 0, $event_date[1], $event_date[0], $event_date[2]);
$event_date = my_date($mybb->settings['dateformat'], $event_date);

	$event_date = explode("-", $event['date']);
$event_date = mktime(0, 0, 0, $event_date[1], $event_date[0], $event_date[2]);
$event_date = my_date($mybb->settings['dateformat'], $event_date);





	return $event_date;
}

/**
* Get the profile link.

	return $event_date;
}

/**
* Get the profile link.

 *

 *

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

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

Zeile 3210Zeile 3229
 * @param string The Username of the profile.
* @param int The user id of the profile.
* @param string The target frame

 * @param string The Username of the profile.
* @param int The user id of the profile.
* @param string The target frame

 
 * @param string Any onclick javascript.

 * @return string The url to the profile.
*/

 * @return string The url to the profile.
*/

function build_profile_link($username="", $uid=0, $target="")

function build_profile_link($username="", $uid=0, $target="", $onclick="")

{
global $lang;


{
global $lang;


Zeile 3222Zeile 3242
		return $lang->guest;
}
elseif($uid == 0)

		return $lang->guest;
}
elseif($uid == 0)

	{

	{

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

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

Zeile 3233Zeile 3253
		{
$target = " target=\"{$target}\"";
}

		{
$target = " target=\"{$target}\"";
}

		return "<a href=\"".get_profile_link($uid)."\"{$target}>{$username}</a>";





		if(!empty($onclick))
{
$onclick = " onclick=\"{$onclick}\"";
}
return "<a href=\"".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";

	}
}


	}
}


Zeile 3250Zeile 3274
	{
$forum_link = str_replace("{fid}", $fid, FORUM_URL_PAGED);
return str_replace("{page}", $page, $forum_link);

	{
$forum_link = str_replace("{fid}", $fid, FORUM_URL_PAGED);
return str_replace("{page}", $page, $forum_link);

	}

	}

	else
{
return str_replace("{fid}", $fid, FORUM_URL);

	else
{
return str_replace("{fid}", $fid, FORUM_URL);

	}
}


	}
}


/**
* Build the thread link.
*
* @param int The thread id of the thread.
* @param int (Optional) The page number of the thread.
* @return string The url to the thread.

/**
* Build the thread link.
*
* @param int The thread id of the thread.
* @param int (Optional) The page number of the thread.
* @return string The url to the thread.

 */

 */

function get_thread_link($tid, $page=0)
{
if($page > 0)
{
$thread_link = str_replace("{tid}", $tid, THREAD_URL_PAGED);
return str_replace("{page}", $page, $thread_link);

function get_thread_link($tid, $page=0)
{
if($page > 0)
{
$thread_link = str_replace("{tid}", $tid, THREAD_URL_PAGED);
return str_replace("{page}", $page, $thread_link);

	}

	}

	else
{
return str_replace("{tid}", $tid, THREAD_URL);

	else
{
return str_replace("{tid}", $tid, THREAD_URL);

Zeile 3291Zeile 3315
	if($uid == $mybb->user['uid'])
{
return $mybb->user;

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

	}

	}

	elseif(isset($user_cache[$uid]))
{
return $user_cache[$uid];

	elseif(isset($user_cache[$uid]))
{
return $user_cache[$uid];

Zeile 3305Zeile 3329
		");
$user_cache[$uid] = $db->fetch_array($query);
return $user_cache[$uid];

		");
$user_cache[$uid] = $db->fetch_array($query);
return $user_cache[$uid];

	}
}


	}
}


/**
* Get the forum of a specific forum id.
*

/**
* Get the forum of a specific forum id.
*

Zeile 3518Zeile 3542
*/
function validate_email_format($email)
{

*/
function validate_email_format($email)
{

	if(!preg_match("/^(.+)@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/si", $email) || strpos($email, ' ') !== false)

	if(strpos($email, ' ') !== false)

	{
return false;
}

	{
return false;
}

	else
{
return true;
}

	// Valid local characters for email addresses: http://www.remote.org/jochen/mail/info/chars.html
return preg_match("/^[a-zA-Z0-9&*+\-_.{}~^?=\/]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/si", $email);



}

/**

}

/**

Zeile 3533Zeile 3555
*
*/
function rebuildsettings()

*
*/
function rebuildsettings()

{

{

	global $db, $mybb;

if(!file_exists(MYBB_ROOT."inc/settings.php"))

	global $db, $mybb;

if(!file_exists(MYBB_ROOT."inc/settings.php"))

Zeile 3541Zeile 3563
		$mode = "x";
}
else

		$mode = "x";
}
else

	{

	{

		$mode = "w";
}
$options = array(

		$mode = "w";
}
$options = array(

Zeile 3555Zeile 3577
		$mybb->settings[$setting['name']] = $setting['value'];
$setting['value'] = addcslashes($setting['value'], '\\"$');
$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";

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

	}

	}

	$settings = "<"."?php\n/*********************************\ \n  DO NOT EDIT THIS FILE, PLEASE USE\n  THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?".">";
$file = @fopen(MYBB_ROOT."inc/settings.php", $mode);
@fwrite($file, $settings);

	$settings = "<"."?php\n/*********************************\ \n  DO NOT EDIT THIS FILE, PLEASE USE\n  THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?".">";
$file = @fopen(MYBB_ROOT."inc/settings.php", $mode);
@fwrite($file, $settings);

Zeile 3583Zeile 3605
	elseif($src <= 0x07ff)
{
$dest .= chr(0xc0 | ($src >> 6));

	elseif($src <= 0x07ff)
{
$dest .= chr(0xc0 | ($src >> 6));

		$dest .= chr(0x80 | ($src & 0x003f));

		$dest .= chr(0x80 | ($src & 0x003f));

	}
elseif($src <= 0xffff)
{
$dest .= chr(0xe0 | ($src >> 12));
$dest .= chr(0x80 | (($src >> 6) & 0x003f));
$dest .= chr(0x80 | ($src & 0x003f));

	}
elseif($src <= 0xffff)
{
$dest .= chr(0xe0 | ($src >> 12));
$dest .= chr(0x80 | (($src >> 6) & 0x003f));
$dest .= chr(0x80 | ($src & 0x003f));

	}

	}

	elseif($src <= 0x10ffff)
{
$dest .= chr(0xf0 | ($src >> 18));

	elseif($src <= 0x10ffff)
{
$dest .= chr(0xf0 | ($src >> 18));

Zeile 3610Zeile 3632
 * Return a list of banned usernames.
*
* @return array The array of banned usernames.

 * Return a list of banned usernames.
*
* @return array The array of banned usernames.

 */

 */

function get_banned_usernames()
{
global $mybb;

function get_banned_usernames()
{
global $mybb;

Zeile 3645Zeile 3667
 * @return array The array of banned email addresses.
*/
function get_banned_emails()

 * @return array The array of banned email addresses.
*/
function get_banned_emails()

{
global $mybb;

{
global $mybb;

	$banned_emails = explode(",", $mybb->settings['bannedemails']);
$banned_emails = array_map("trim", $banned_emails);
$banned_emails = array_map("strtolower", $banned_emails);
return $banned_emails;

	$banned_emails = explode(",", $mybb->settings['bannedemails']);
$banned_emails = array_map("trim", $banned_emails);
$banned_emails = array_map("strtolower", $banned_emails);
return $banned_emails;

}

/**

}

/**

 * Check if a specific email address has been banned.
*
* @param string The email address.
* @return boolean True if banned, false if not banned
*/
function is_banned_email($email)

 * Check if a specific email address has been banned.
*
* @param string The email address.
* @return boolean True if banned, false if not banned
*/
function is_banned_email($email)

{

{

	$banned_emails = get_banned_emails();
$email = strtolower($email);
foreach($banned_emails as $banned_email)
{
if($banned_email != "" && strpos($email, $banned_email) !== false)

	$banned_emails = get_banned_emails();
$email = strtolower($email);
foreach($banned_emails as $banned_email)
{
if($banned_email != "" && strpos($email, $banned_email) !== false)

		{
return true;

		{
return true;

		}
}
return false;

		}
}
return false;

Zeile 3688Zeile 3710

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


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

 *

 *

 * @param string The IP address.
* @return boolean True if banned, false if not banned.
*/

 * @param string The IP address.
* @return boolean True if banned, false if not banned.
*/

Zeile 3703Zeile 3725
		}
}
return false;

		}
}
return false;

 
}

/**
* Fetch the contents of a remote fle.
*
* @param string The URL of the remote file
* @return string The remote file contents.
*/
function fetch_remote_file($url)
{
if(function_exists("curl_init"))
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
else if(function_exists("fsockopen"))
{
$url = parse_url($url);
if(!$url['host'])
{
return false;
}
if(!$url['port'])
{
$url['port'] = 80;
}
if(!$url['path'])
{
$url['path'] = "/";
}
if($url['query'])
{
$url['path'] .= "?{$url['path']}";
}
$fp = @fsockopen($url['host'], $url['port'], $error_no, $error, 10);
@stream_set_timeout($fp, 10);
if(!$fp)
{
return false;
}
$headers = "GET {$url['path']} HTTP/1.1\r\n";
$headers .= "Host: {$url['host']}\r\n";
$headers .= "Connection: Close\r\n\r\n";
if(!@fwrite($fp, $headers))
{
return false;
}
while(!feof($fp))
{
$data .= fgets($fp, 12800);
}
fclose($fp);
$data = explode("\r\n\r\n", $data, 2);
return $data[1];
}
else
{
return @implode("", @file($url));
}

}

/**

}

/**