Vergleich inc/functions.php - 1.2.8 - 1.2.12

  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 3177 2007-06-29 07:51:12Z 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 75Zeile 74
		}
}


		}
}


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

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


echo $contents;



echo $contents;


Zeile 105Zeile 104

/**
* Runs the shutdown items after the page has been sent to the browser.


/**
* Runs the shutdown items after the page has been sent to the browser.

 *
*/

 *
*/

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

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

Zeile 194Zeile 193
			$db->delete_query(TABLE_PREFIX."mailqueue", "mid='{$email['mid']}'");

my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers']);

			$db->delete_query(TABLE_PREFIX."mailqueue", "mid='{$email['mid']}'");

my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers']);

		}

		}

		// Update the mailqueue cache and remove the lock
$cache->updatemailqueue(time(), 0);
}
$plugins->run_hooks("send_mail_queue_end");
}

		// Update the mailqueue cache and remove the lock
$cache->updatemailqueue(time(), 0);
}
$plugins->run_hooks("send_mail_queue_end");
}





/**
* Parses the contents of a page before outputting it.
*

/**
* Parses the contents of a page before outputting it.
*

Zeile 222Zeile 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['htmllang'])

	if($lang->settings['rtl'] == 1)
{
$contents = str_replace("<html", "<html dir=\"rtl\"", $contents);
}
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 239Zeile 241
		}
}
return $contents;

		}
}
return $contents;

}

}


/**
* Turn a unix timestamp in to a "friendly" date/time format for the user.


/**
* Turn a unix timestamp in to a "friendly" date/time format for the user.

Zeile 356Zeile 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";

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





	// For some reason sendmail/qmail doesn't like \r\n
$sendmail = @ini_get('sendmail_path');
if($sendmail)

	// For some reason sendmail/qmail doesn't like \r\n
$sendmail = @ini_get('sendmail_path');
if($sendmail)

	{

	{

		$headers = preg_replace("#(\r\n|\r|\n)#s", "\n", $headers);
$message = preg_replace("#(\r\n|\r|\n)#s", "\n", $message);

		$headers = preg_replace("#(\r\n|\r|\n)#s", "\n", $headers);
$message = preg_replace("#(\r\n|\r|\n)#s", "\n", $message);

	}
else

	}
else

	{
$headers = preg_replace("#(\r\n|\r|\n)#s", "\r\n", $headers);
$message = preg_replace("#(\r\n|\r|\n)#s", "\r\n", $message);

	{
$headers = preg_replace("#(\r\n|\r|\n)#s", "\r\n", $headers);
$message = preg_replace("#(\r\n|\r|\n)#s", "\r\n", $message);

	}


	}


	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 520Zeile 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 722Zeile 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;

 
						continue;

					}

					}

					$zerogreater = 1;

 
				}

				}

				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 754Zeile 806
	if(!is_array($groupscache))
{
$groupscache = $cache->read("usergroups");

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

	}

	}

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

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

Zeile 813Zeile 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

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

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

Zeile 872Zeile 924
						$current_permissions[$permission] = $access;
}
}

						$current_permissions[$permission] = $access;
}
}

			}
}
}

			}
}
}

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

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

Zeile 882Zeile 934
	}
return $current_permissions;
}

	}
return $current_permissions;
}





/**
* 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 901Zeile 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

			}
}
else

		{

		{

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

			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 970Zeile 1053
	}

return $perms;

	}

return $perms;

}

/**

}

/**

 * Checks if a moderator has permissions to perform an action in a specific forum
*
* @param int The forum ID (0 assumes global)

 * Checks if a moderator has permissions to perform an action in a specific forum
*
* @param int The forum ID (0 assumes global)

Zeile 1115Zeile 1198
	// 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 .= "; expires=".gmdate('D, d-M-Y H:i:s \\G\\M\\T', $expires);
}
if(!empty($mybb->settings['cookiepath']))

Zeile 1131Zeile 1214
		$cookie .= "; HttpOnly";
}
header($cookie, false);

		$cookie .= "; HttpOnly";
}
header($cookie, false);

}


}


/**
* Unset a cookie set by MyBB.
*

/**
* Unset a cookie set by MyBB.
*

Zeile 1162Zeile 1245
	if(isset($cookie[$id]))
{
return $cookie[$id];

	if(isset($cookie[$id]))
{
return $cookie[$id];

	}
else

	}
else

	{
return 0;
}

	{
return 0;
}

}

}


/**
* Set a serialised cookie array.


/**
* Set a serialised cookie array.

Zeile 1177Zeile 1260
 * @param string The value to set the cookie to.
*/
function my_set_array_cookie($name, $id, $value)

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

{

{

	$cookie = $_COOKIE['mybb'];
$newcookie = unserialize($cookie[$name]);
$newcookie[$id] = $value;

	$cookie = $_COOKIE['mybb'];
$newcookie = unserialize($cookie[$name]);
$newcookie[$id] = $value;

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

function get_server_load()
{
global $lang;





	$serverload = array();

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

	$serverload = array();

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

Zeile 1204Zeile 1287
			$serverload[0] = round($serverload[0], 4);
}
if(!$serverload)

			$serverload[0] = round($serverload[0], 4);
}
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]);

Zeile 1213Zeile 1312
				return $lang->unknown;
}
}

				return $lang->unknown;
}
}

	}
else if(class_exists('COM'))
{
$wmi = new COM("WinMgmts:\\\\.");
$cpus = $wmi->InstancesOf("Win32_Processor");

$cpu_count = 0;

if(version_compare(PHP_VERSION, '5.0.0', '>='))
{
// PHP 5
foreach($cpus as $cpu)
{
$serverload[0] += $cpu->LoadPercentage;
++$cpu_count;
}
}
else
{
// PHP 4
while ($cpu = $cpus->Next())
{
$serverload[0] += $cpu->LoadPercentage;
++$cpu_count;
}
}

if($cpu_count > 1)
{
$serverload[0] = round($serverload[0] / $cpu_count, 2);
}
$serverload[0] .= "%";

 
	}
else
{

	}
else
{

Zeile 1260Zeile 1327
/**
* 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())
{

 */
function update_stats($changes=array())
{

Zeile 1268Zeile 1335

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



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


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

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

	$update = array();
foreach($counters as $counter)
{

	$update = array();
foreach($counters as $counter)
{

Zeile 1282Zeile 1349
			else
{
$new_stats[$counter] = $changes[$counter];

			else
{
$new_stats[$counter] = $changes[$counter];

			}
// Less than 0? That's bad
if($new_stats[$counter] < 0)
{
$new_stats[$counter] = 0;

			}
// Less than 0? That's bad
if($new_stats[$counter] < 0)
{
$new_stats[$counter] = 0;

			}
}
}

// 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 1300Zeile 1367
		$new_stats['lastusername'] = $lastmember['username'];
}
if(is_array($stats))

		$new_stats['lastusername'] = $lastmember['username'];
}
if(is_array($stats))

	{

	{

		$stats = array_merge($stats, $new_stats);
}
else

		$stats = array_merge($stats, $new_stats);
}
else

Zeile 1336Zeile 1403
			if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
{
$update_query[$counter] = $forum[$counter] + $changes[$counter];

			if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")
{
$update_query[$counter] = $forum[$counter] + $changes[$counter];

			}

			}

			else
{
$update_query[$counter] = $changes[$counter];

			else
{
$update_query[$counter] = $changes[$counter];

Zeile 1345Zeile 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)
{
$db->update_query(TABLE_PREFIX."forums", $update_query, "fid='".intval($fid)."'");

	// 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?

	// 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 1365Zeile 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 1382Zeile 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 1585Zeile 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 1625Zeile 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 1933Zeile 2004
function log_moderator_action($data, $action="")
{
global $mybb, $db, $session;

function log_moderator_action($data, $action="")
{
global $mybb, $db, $session;





	/* If the fid or tid is not set, set it at 0 so MySQL doesn't choke on it. */
if($data['fid'] == '')
{

	/* If the fid or tid is not set, set it at 0 so MySQL doesn't choke on it. */
if($data['fid'] == '')
{

Zeile 1972Zeile 2043
		"ipaddress" => $db->escape_string($session->ipaddress)
);
$db->insert_query(TABLE_PREFIX."moderatorlog", $sql_array);

		"ipaddress" => $db->escape_string($session->ipaddress)
);
$db->insert_query(TABLE_PREFIX."moderatorlog", $sql_array);

}

/**

}

/**

 * Get the formatted reputation for a user.
*
* @param int The reputation value

 * Get the formatted reputation for a user.
*
* @param int The reputation value

Zeile 2014Zeile 2085
 * Fetch the IP address of the current user.
*
* @return string The IP address.

 * Fetch the IP address of the current user.
*
* @return string The IP address.

 */

 */

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

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

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

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

		{

		{

			$ip = $_SERVER['HTTP_CLIENT_IP'];
}
else

			$ip = $_SERVER['HTTP_CLIENT_IP'];
}
else

Zeile 2095Zeile 2166
	{
$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 2351Zeile 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 2876Zeile 2956
 *
* @param string The string to format
* @return string The string with htmlspecialchars applied

 *
* @param string The string to format
* @return string The string with htmlspecialchars applied

 */

 */

function htmlspecialchars_uni($message)
{

function htmlspecialchars_uni($message)
{

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

	$message = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $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);

	return $message;
}


	return $message;
}


/**
* Custom function for formatting numbers.
*

/**
* Custom function for formatting numbers.
*

Zeile 2900Zeile 2980
		return $number;
}
if(is_int($number))

		return $number;
}
if(is_int($number))

	{

	{

		return number_format($number, 0, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);
}
else
{
$parts = explode('.', $number);
if(isset($parts[1]))

		return number_format($number, 0, $mybb->settings['decpoint'], $mybb->settings['thousandssep']);
}
else
{
$parts = explode('.', $number);
if(isset($parts[1]))

		{

		{

			$decimals = my_strlen($parts[1]);
}
else

			$decimals = my_strlen($parts[1]);
}
else

Zeile 2930Zeile 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;

}

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

}

/**
* 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

 * @param int The month of the birthday
* @param int The day of the birthday
* @param int The year of the bithday

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

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

	}

	}

}

/**

}

/**

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

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

	}
}

	}
}


/**
* Build the thread link.


/**
* Build the thread link.

Zeile 3332Zeile 3419
		return str_replace("{tid}", $tid, THREAD_URL);
}
}

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





/**

/**

 * 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 3349Zeile 3436
		return $mybb->user;
}
elseif(isset($user_cache[$uid]))

		return $mybb->user;
}
elseif(isset($user_cache[$uid]))

	{
return $user_cache[$uid];

	{
return $user_cache[$uid];

	}
else
{

	}
else
{

Zeile 3408Zeile 3495
 * @return string The database row of the thread.
*/
function get_thread($tid)

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

{
global $db;

{
global $db;

	static $thread_cache;

if(isset($thread_cache[$tid]))

	static $thread_cache;

if(isset($thread_cache[$tid]))

Zeile 3579Zeile 3666
		return false;
}
// Valid local characters for email addresses: http://www.remote.org/jochen/mail/info/chars.html

		return false;
}
// 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);

	return preg_match("/^[a-zA-Z0-9&*+\-_.{}~^\?=\/]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/si", $email);

}

/**

}

/**

Zeile 3822Zeile 3909
	{
return @implode("", @file($url));
}

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

}

/**

}

/**