Vergleich inc/functions.php - 1.2.7 - 1.2.13

  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 3596 2008-01-20 08:27:39Z Tikitiki $

 */

/**

 */

/**

Zeile 18Zeile 18
{
global $db, $lang, $theme, $plugins, $mybb;
global $querytime, $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;

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



 
	$contents = parse_page($contents);
$totaltime = $maintimer->stop();
if($mybb->usergroup['cancp'] == "yes")

	$contents = parse_page($contents);
$totaltime = $maintimer->stop();
if($mybb->usergroup['cancp'] == "yes")

Zeile 38Zeile 37
			$debuglink = htmlspecialchars(getenv("REQUEST_URI")) . "?debug=1";
}
if($mybb->settings['gzipoutput'] != "no")

			$debuglink = htmlspecialchars(getenv("REQUEST_URI")) . "?debug=1";
}
if($mybb->settings['gzipoutput'] != "no")

		{

		{

			$gzipen = "Enabled";
}
else

			$gzipen = "Enabled";
}
else

Zeile 58Zeile 57
		if(isset($mybb->input['debug']))
{
debug_page();

		if(isset($mybb->input['debug']))
{
debug_page();

		}
}

		}
}

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

if($mybb->settings['gzipoutput'] != "no")
{
if(version_compare(PHP_VERSION, '4.2.0', '>='))

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

if($mybb->settings['gzipoutput'] != "no")
{
if(version_compare(PHP_VERSION, '4.2.0', '>='))

		{

		{

			$contents = gzip_encode($contents, $mybb->settings['gziplevel']);

			$contents = gzip_encode($contents, $mybb->settings['gziplevel']);

		}

		}

		else
{
$contents = gzip_encode($contents);
}
}

		else
{
$contents = gzip_encode($contents);
}
}

 

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


	echo $contents;

$plugins->run_hooks("post_output_page");

	echo $contents;

$plugins->run_hooks("post_output_page");

Zeile 131Zeile 133
	{
require_once MYBB_ROOT."inc/class_datacache.php";
$cache = new datacache;

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

	}

	}

	
// And finaly.. we have the PHP developers to thank for this "hack" which fixes a problem THEY created
if(!is_object($plugins) && !defined("NO_PLUGINS"))

	
// And finaly.. we have the PHP developers to thank for this "hack" which fixes a problem THEY created
if(!is_object($plugins) && !defined("NO_PLUGINS"))

Zeile 219Zeile 221
	{
$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;
}

 
	
$contents = str_replace("<html", "<html xmlns=\"http://www.w3.org/1999/xhtml\"", $contents);


	if($lang->settings['rtl'] == 1)
{
$contents = str_replace("<html", "<html dir=\"rtl\"", $contents);

	if($lang->settings['rtl'] == 1)
{
$contents = str_replace("<html", "<html dir=\"rtl\"", $contents);

	}

	}

	if($lang->settings['htmllang'])

	if($lang->settings['htmllang'])

	{
$contents = str_replace("<html", "<html lang=\"".$lang->settings['htmllang']."\"", $contents);
}

	{
$contents = str_replace("<html", "<html xml:lang=\"".$lang->settings['htmllang']."\" lang=\"".$lang->settings['htmllang']."\"", $contents);
}


if($loadpmpopup)
{


if($loadpmpopup)
{

Zeile 246Zeile 251
 * @param int The offset in hours that should be applied to times. (timezones)
* @param int Whether or not to use today/yesterday formatting.
* @return string The formatted timestamp.

 * @param int The offset in hours that should be applied to times. (timezones)
* @param int Whether or not to use today/yesterday formatting.
* @return string The formatted timestamp.

 */

 */

function my_date($format, $stamp="", $offset="", $ty=1)
{
global $mybb, $lang, $mybbadmin, $plugins;

function my_date($format, $stamp="", $offset="", $ty=1)
{
global $mybb, $lang, $mybbadmin, $plugins;

Zeile 273Zeile 278
		{
$offset = $mybb->settings['timezoneoffset'];
$dstcorrection = $mybb->settings['dstcorrection'];

		{
$offset = $mybb->settings['timezoneoffset'];
$dstcorrection = $mybb->settings['dstcorrection'];

		}

		}

		// If DST correction is enabled, add an additional hour to the timezone.
if($dstcorrection == "yes")
{

		// If DST correction is enabled, add an additional hour to the timezone.
if($dstcorrection == "yes")
{

Zeile 287Zeile 292
	if($offset == "-")
{
$offset = 0;

	if($offset == "-")
{
$offset = 0;

	}

	}

	$date = gmdate($format, $stamp + ($offset * 3600));
if($mybb->settings['dateformat'] == $format && $ty)
{

	$date = gmdate($format, $stamp + ($offset * 3600));
if($mybb->settings['dateformat'] == $format && $ty)
{

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

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

		}
}


		}
}


	$plugins->run_hooks_by_ref("my_date", $date);

return $date;

	$plugins->run_hooks_by_ref("my_date", $date);

return $date;

Zeile 353Zeile 358
	$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: MyBB\n";

	$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: MyBB\n";

 
	if(defined("IN_ADMINCP"))
{
$_SERVER['PHP_SELF'] = str_replace($mybb->config['admin_dir']."/", "admin-", $_SERVER['PHP_SELF']);
}

	$headers .= "X-MyBB-Script: {$http_host}{$_SERVER['PHP_SELF']}\n";

// For some reason sendmail/qmail doesn't like \r\n

	$headers .= "X-MyBB-Script: {$http_host}{$_SERVER['PHP_SELF']}\n";

// For some reason sendmail/qmail doesn't like \r\n

Zeile 369Zeile 378
	}

mail($to, $subject, $message, $headers);

	}

mail($to, $subject, $message, $headers);

 
}

/**
* Generates a unique code for POST requests to prevent XSS/CSRF attacks
*
* @return string The generated code
*/
function generate_post_check()
{
global $mybb;
if($mybb->user['uid'])
{
return md5($mybb->user['loginkey'].$mybb->user['salt'].$mybb->user['regdate']);
}
// Guests get a special string
else
{
return md5($mybb->config['hostname'].$mybb->config['username'].$mybb->config['password']);
}
}

/**
* Verifies a POST check code is valid, if not shows an error (silently returns false on silent parameter)
*
* @param string The incoming POST check code
* @param boolean Silent mode or not (silent mode will not show the error to the user but returns false)
*/
function verify_post_check($code, $silent=false)
{
global $lang;
if(generate_post_check() != $code)
{
if($silent == true)
{
return false;
}
else
{
error($lang->invalid_post_code);
}
}
else
{
return true;
}

}

/**

}

/**

Zeile 474Zeile 528
	add_breadcrumb($lang->error);
eval("\$errorpage = \"".$templates->get("error")."\";");
output_page($errorpage);

	add_breadcrumb($lang->error);
eval("\$errorpage = \"".$templates->get("error")."\";");
output_page($errorpage);

	exit;

	exit;

}

/**

}

/**

Zeile 517Zeile 571
		"location1" => 0,
"location2" => 0
);

		"location1" => 0,
"location2" => 0
);

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

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

	$url = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
if($mybb->user['uid'])
{

	$url = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
if($mybb->user['uid'])
{

Zeile 663Zeile 717
		}

// 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 749
	{
$groupscache = $cache->read("usergroups");
}

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

 


	$groups = explode(",", $gid);
if(count($groups) == 1)
{

	$groups = explode(",", $gid);
if(count($groups) == 1)
{

Zeile 714Zeile 773
				{
$permbit = "";
}

				{
$permbit = "";
}

				$zerogreater = 0;



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

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

						$zerogreater = 1;

						continue;

					}

					}

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


				}

if($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit)

				{
$usergroup[$perm] = $access;
}

				{
$usergroup[$perm] = $access;
}

Zeile 740Zeile 800
 * @return array Array of display properties for the group
*/
function usergroup_displaygroup($gid)

 * @return array Array of display properties for the group
*/
function usergroup_displaygroup($gid)

{

{

	global $cache, $groupscache, $displaygroupfields;

if(!is_array($groupscache))
{
$groupscache = $cache->read("usergroups");

	global $cache, $groupscache, $displaygroupfields;

if(!is_array($groupscache))
{
$groupscache = $cache->read("usergroups");

	}

	}

	$displaygroup = array();
$group = $groupscache[$gid];
foreach($displaygroupfields as $field)
{
$displaygroup[$field] = $group[$field];

	$displaygroup = array();
$group = $groupscache[$gid];
foreach($displaygroupfields as $field)
{
$displaygroup[$field] = $group[$field];

	}

	}

	return $displaygroup;
}


	return $displaygroup;
}


Zeile 767Zeile 827
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 792Zeile 852
				$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 805Zeile 865
	if(!is_array($fpermcache))
{
$fpermcache = $cache->read("forumpermissions");

	if(!is_array($fpermcache))
{
$fpermcache = $cache->read("forumpermissions");

	}

	}

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





	{
if(!$cached_forum_permissions[$gid][$fid])
{
$cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);
}
return $cached_forum_permissions_permissions[$gid][$fid];

	}
else
{

	}
else
{

		foreach($forum_cache as $forum)

		if(!$cached_forum_permissions[$gid])

		{

		{

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




			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 848Zeile 915
		{
// If this forum has permissions set
if($fpermcache[$fid][$gid])

		{
// If this forum has permissions set
if($fpermcache[$fid][$gid])

			{

			{

				$level_permissions = $fpermcache[$fid][$gid];
foreach($level_permissions as $permission => $access)
{

				$level_permissions = $fpermcache[$fid][$gid];
foreach($level_permissions as $permission => $access)
{

Zeile 872Zeile 939
 * Check the password given on a certain forum for validity
*
* @param int The forum ID

 * 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 boolean The Parent ID

 */

 */

function check_forum_password($fid, $password="")

function check_forum_password($fid, $pid=0)

{

{

	global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang;
$showform = 1;
































	global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;

$showform = true;

if(!is_array($forum_cache))
{
$forum_cache = cache_forums();
if(!$forum_cache)
{
return false;
}
}

// Loop through each of parent forums to ensure we have a password for them too
$parents = explode(',', $forum_cache[$fid]['parentlist']);
rsort($parents);
if(!empty($parents))
{
foreach($parents as $parent_id)
{
if($parent_id == $fid || $parent_id == $pid)
{
continue;
}

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

$password = $forum_cache[$fid]['password'];

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

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

Zeile 886Zeile 983
			if($password == $mybb->input['pwverify'])
{
my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']), null, true);

			if($password == $mybb->input['pwverify'])
{
my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']), null, true);

				$showform = 0;

				$showform = false;

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

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

				$showform = 1;
}
}

				$showform = true;
}
}

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

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

				$showform = 1;

				$showform = true;

			}
else
{

			}
else
{

				$showform = 0;

				$showform = false;

			}
}
}
else
{

			}
}
}
else
{

		$showform = 0;

		$showform = false;

	}

	}

 


	if($showform)
{
$_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);

	if($showform)
{
$_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);

Zeile 1178Zeile 1276
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)
{

		if(!$serverload)
{

 
			// Suhosin likes to throw a warning if exec is disabled then die - weird
if($func_blacklist = @ini_get('suhosin.executor.func.blacklist'))
{
if(strpos(",".$func_blacklist.",", 'exec') !== false)
{
return $lang->unknown;
}
}
// PHP disabled functions?
if($func_blacklist = @ini_get('disabled_functions'))
{
if(strpos(",".$func_blacklist.",", 'exec') !== false)
{
return $lang->unknown;
}
}

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

			$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)
*

 * @param array Array of items being updated (numthreads,numposts,numusers)

 * @param array Array of items being updated (numthreads,numposts,numusers,lastuser)

 */
function update_stats($changes=array())
{
global $cache, $db;

 */
function update_stats($changes=array())
{
global $cache, $db;





	$stats = $cache->read("stats");


	$stats = $cache->read("stats");


	$counters = array('numthreads','numposts','numusers');

	$counters = array('numthreads', 'numposts', 'numusers');

	$update = array();

	$update = array();

	foreach($counters as $counter)
{
if(array_key_exists($counter, $changes))
{
// Adding or subtracting from previous value?
if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")

	foreach($counters as $counter)
{
if(array_key_exists($counter, $changes))
{
// Adding or subtracting from previous value?
if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")

			{
$new_stats[$counter] = $stats[$counter] + $changes[$counter];
}

			{
$new_stats[$counter] = $stats[$counter] + $changes[$counter];
}

Zeile 1242Zeile 1359
	}

// Fetch latest user if the user count is changing

	}

// Fetch latest user if the user count is changing

	if(array_key_exists('numusers', $changes))

	if(array_key_exists('numusers', $changes) || array_key_exists('lastuser', $changes))

	{
$query = $db->simple_select(TABLE_PREFIX."users", "uid, username", "", array('order_by' => 'uid', 'order_dir' => 'DESC', 'limit' => 1));
$lastmember = $db->fetch_array($query);

	{
$query = $db->simple_select(TABLE_PREFIX."users", "uid, username", "", array('order_by' => 'uid', 'order_dir' => 'DESC', 'limit' => 1));
$lastmember = $db->fetch_array($query);

Zeile 1295Zeile 1412
			if($update_query[$counter] < 0)
{
$update_query[$counter] = 0;

			if($update_query[$counter] < 0)
{
$update_query[$counter] = 0;

			}
}
}


			}
}
}


	// Only update if we're actually doing something
if(count($update_query) > 0)

	// Only update if we're actually doing something
if(count($update_query) > 0)

	{

	{

		$db->update_query(TABLE_PREFIX."forums", $update_query, "fid='".intval($fid)."'");
}

// Guess we should update the statistics too?

		$db->update_query(TABLE_PREFIX."forums", $update_query, "fid='".intval($fid)."'");
}

// Guess we should update the statistics too?

	if($update_query['threads'] || $update_query['posts'])

	if(isset($update_query['threads']) || isset($update_query['posts']))

	{
$new_stats = array();
if(array_key_exists('threads', $update_query))

	{
$new_stats = array();
if(array_key_exists('threads', $update_query))

Zeile 1315Zeile 1432
			if($threads_diff > -1)
{
$new_stats['numthreads'] = "+{$threads_diff}";

			if($threads_diff > -1)
{
$new_stats['numthreads'] = "+{$threads_diff}";

			}
else
{

			}
else
{

				$new_stats['numthreads'] = "{$threads_diff}";
}
}

				$new_stats['numthreads'] = "{$threads_diff}";
}
}

Zeile 1332Zeile 1449
			{
$new_stats['numposts'] = "{$posts_diff}";
}

			{
$new_stats['numposts'] = "{$posts_diff}";
}

		}


		}	


		update_stats($new_stats);
}

		update_stats($new_stats);
}



	

	// Update last post info
update_forum_lastpost($fid);
}

	// Update last post info
update_forum_lastpost($fid);
}

Zeile 1535Zeile 1653
 */
function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $permissions="", $name="fid")
{

 */
function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $permissions="", $name="fid")
{

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

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


$pid = intval($pid);
if($permissions)


$pid = intval($pid);
if($permissions)

Zeile 1575Zeile 1693
						$optionselected = "selected=\"selected\"";
$selecteddone = 1;
}

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

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


					eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";");
if($forum_cache[$forum['fid']])
{

					eval("\$forumjumpbits .= \"".$templates->get("forumjump_bit")."\";");
if($forum_cache[$forum['fid']])
{

Zeile 1707Zeile 1828
			"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 1871Zeile 1993
		}
}
return $contents;

		}
}
return $contents;

}

}


/**
* Log the actions of a moderator.


/**
* Log the actions of a moderator.

Zeile 1957Zeile 2079
		$display_reputation .= "</a>";
}
return $display_reputation;

		$display_reputation .= "</a>";
}
return $display_reputation;

}

}


/**
* Fetch the IP address of the current user.


/**
* Fetch the IP address of the current user.

Zeile 1978Zeile 2100
					break;
}
}

					break;
}
}

		}
}

		}
}

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

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

Zeile 2022Zeile 2144
	elseif($size == 0)
{
$size = "0 ".$lang->size_bytes;

	elseif($size == 0)
{
$size = "0 ".$lang->size_bytes;

	}

	}

	else
{
$size = $size . " " . $lang->size_bytes;

	else
{
$size = $size . " " . $lang->size_bytes;

Zeile 2041Zeile 2163
	global $cache, $attachtypes;

if(!$attachtypes)

	global $cache, $attachtypes;

if(!$attachtypes)

	{

	{

		$attachtypes = $cache->read("attachtypes");
}

		$attachtypes = $cache->read("attachtypes");
}

 
	
$directory = "";

if(defined("IN_PORTAL"))
{
global $change_dir;
$directory = $change_dir."/";
}


	$ext = strtolower($ext);
if($attachtypes[$ext]['icon'])
{

	$ext = strtolower($ext);
if($attachtypes[$ext]['icon'])
{

		return "<img src=\"".$attachtypes[$ext]['icon']."\" border=\"0\" alt=\".$ext File\" />";

		return "<img src=\"{$directory}".$attachtypes[$ext]['icon']."\" border=\"0\" alt=\".$ext File\" />";

	}
else
{

	}
else
{

		return "<img src=\"images/attachtypes/unknown.gif\" border=\"0\" alt=\".$ext File\" />";

		return "<img src=\"{$directory}images/attachtypes/unknown.gif\" border=\"0\" alt=\".$ext File\" />";

	}
}


	}
}


Zeile 2300Zeile 2431
		$gzipen = "Disabled";
}
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";

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

	echo "<html lang=\"en\">";

	echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">";

	echo "<head>";
echo "<title>MyBB Debug Information</title>";
echo "</head>";

	echo "<head>";
echo "<title>MyBB Debug Information</title>";
echo "</head>";

Zeile 2812Zeile 2943
		}
}


		}
}


	if($tid)

	if($tid == 0)

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

return $themeselect;

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

return $themeselect;

}

}


/**
* Custom function for htmlspecialchars which takes in to account unicode


/**
* Custom function for htmlspecialchars which takes in to account unicode

Zeile 2864Zeile 2995
			$decimals = 0;
}
return number_format($number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);

			$decimals = 0;
}
return number_format($number, $decimals, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);

	}
}

	}
}


/**
* Replacement function for PHP's wordwrap(). This version does not break up HTML tags, URLs or unicode references.


/**
* Replacement function for PHP's wordwrap(). This version does not break up HTML tags, URLs or unicode references.

Zeile 2879Zeile 3010

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


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

		$message = preg_replace("#(?>[^\s&/<>\"\\-\.\[\]]{{$mybb->settings['wordwrap']}})#", "$0 ", $message);








		if($mybb->config['db_encoding'] == "utf8")
{
$message = preg_replace("#(?>[^\s&/<>\"\\-\.\[\]]{{$mybb->settings['wordwrap']}})#u", "$0 ", $message);
}
else
{
$message = preg_replace("#(?>[^\s&/<>\"\\-\.\[\]]{{$mybb->settings['wordwrap']}})#", "$0 ", $message);
}

	}
return $message;
}

	}
return $message;
}

Zeile 2970Zeile 3108
	if(($month == $bday[1] && $day < $bday[1]) || $month < $bday[1])
{
--$age;

	if(($month == $bday[1] && $day < $bday[1]) || $month < $bday[1])
{
--$age;

	}

	}

	return $age;
}


	return $age;
}


Zeile 3009Zeile 3147
function my_strlen($string)
{
global $lang;

function my_strlen($string)
{
global $lang;





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

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

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

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

Zeile 3022Zeile 3160
        $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 3210Zeile 3348
 * @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 3233Zeile 3372
		{
$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 3278Zeile 3421
}

/**

}

/**

 * Get the username of a user id.

 * Get the user data of a user id.

 *
* @param int The user id of the user.

 *
* @param int The user id of the user.

 * @return string The username of the user.

 * @return array The user data.

 */
function get_user($uid)
{

 */
function get_user($uid)
{

Zeile 3518Zeile 3661
*/
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 3612Zeile 3753
 * @return array The array of banned usernames.
*/
function get_banned_usernames()

 * @return array The array of banned usernames.
*/
function get_banned_usernames()

{

{

	global $mybb;
$banned_usernames = explode(",", $mybb->settings['bannedusernames']);
$banned_usernames = array_map("trim", $banned_usernames);

	global $mybb;
$banned_usernames = explode(",", $mybb->settings['bannedusernames']);
$banned_usernames = array_map("trim", $banned_usernames);

Zeile 3703Zeile 3844
		}
}
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));
}
}

/**
* Unicode function for php function chr()
*
* @param string The character
* @return mixed The unicoded chr()
*/
function unicode_chr($c)
{
if($c <= 0x7F)
{
return chr($c);
}
elseif($c <= 0x7FF)
{
return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F);
}
elseif($c <= 0xFFFF)
{
return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);
}
elseif($c <= 0x10FFFF)
{
return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F)
. chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);
}
else
{
return false;
}

}

/**

}

/**