Vergleich inc/functions.php - 1.2.8 - 1.2.14

  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 3845 2008-05-18 17:50:09Z 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 32Zeile 31
		if(strstr(getenv("REQUEST_URI"), "?"))
{
$debuglink = htmlspecialchars(getenv("REQUEST_URI")) . "&debug=1";

		if(strstr(getenv("REQUEST_URI"), "?"))
{
$debuglink = htmlspecialchars(getenv("REQUEST_URI")) . "&debug=1";

		}

		}

		else

		else

		{

		{

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

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

Zeile 72Zeile 71
		else
{
$contents = gzip_encode($contents);

		else
{
$contents = gzip_encode($contents);

		}
}

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

echo $contents;

		}
}

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

echo $contents;


$plugins->run_hooks("post_output_page");



$plugins->run_hooks("post_output_page");


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

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

Zeile 215Zeile 214
	$contents = str_replace('<archive_url>', $archive_url, $contents);

if($htmldoctype)

	$contents = str_replace('<archive_url>', $archive_url, $contents);

if($htmldoctype)

	{

	{

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

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

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

// 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 372Zeile 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 488Zeile 539
 * @return string The inline error HTML
*/
function inline_error($errors, $title="")

 * @return string The inline error HTML
*/
function inline_error($errors, $title="")

{

{

	global $theme, $mybb, $db, $lang, $templates;
if(!$title)
{
$title = $lang->please_correct_errors;
}
if(!is_array($errors))

	global $theme, $mybb, $db, $lang, $templates;
if(!$title)
{
$title = $lang->please_correct_errors;
}
if(!is_array($errors))

	{

	{

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

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

	}

	}

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

/**
* Presents the user with a "no permission" page

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

/**
* Presents the user with a "no permission" page

 */

 */

function error_no_permission()
{
global $mybb, $theme, $templates, $db, $lang, $plugins, $session;

function error_no_permission()
{
global $mybb, $theme, $templates, $db, $lang, $plugins, $session;

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 541Zeile 592
 * @param string The redirection message to be shown
*/
function redirect($url, $message="", $title="")

 * @param string The redirection message to be shown
*/
function redirect($url, $message="", $title="")

{

{

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

$loadpmpopup = false;

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

$loadpmpopup = false;

Zeile 645Zeile 696
	global $mybb, $cache, $groupscache, $user_cache;

// If no user id is specified, assume it is the current user

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

// If no user id is specified, assume it is the current user

	if($uid == 0)

	if($uid == 0)

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

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

Zeile 694Zeile 745
{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;


{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;


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


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


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

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

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 740Zeile 792
	}
return $usergroup;
}

	}
return $usergroup;
}





/**
* Fetch the display group properties for a specific display group
*

/**
* Fetch the display group properties for a specific display group
*

Zeile 752Zeile 804
	global $cache, $groupscache, $displaygroupfields;

if(!is_array($groupscache))

	global $cache, $groupscache, $displaygroupfields;

if(!is_array($groupscache))

	{

	{

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

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

Zeile 781Zeile 833
		$uid = $mybb->user['uid'];
}
if(!$gid || $gid == 0) // If no group, we need to fetch it

		$uid = $mybb->user['uid'];
}
if(!$gid || $gid == 0) // If no group, we need to fetch it

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

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

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

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

			}

			}

			$gid = $usercache[$uid]['usergroup'].",".$usercache[$uid]['additionalgroups'];
$groupperms = usergroup_permissions($gid);
}

			$gid = $usercache[$uid]['usergroup'].",".$usercache[$uid]['additionalgroups'];
$groupperms = usergroup_permissions($gid);
}

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

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

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

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

		{
return false;
}
}
if(!is_array($fpermcache))

		{
return false;
}
}
if(!is_array($fpermcache))

	{

	{

		$fpermcache = $cache->read("forumpermissions");
}
if($fid) // Fetch the permissions for a single forum

		$fpermcache = $cache->read("forumpermissions");
}
if($fid) // Fetch the permissions for a single forum

Zeile 849Zeile 901
	global $groupscache, $forum_cache, $fpermcache, $mybb, $fpermfields;

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

	global $groupscache, $forum_cache, $fpermcache, $mybb, $fpermfields;

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



	

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

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

 
		$groupperms['fid'] = $fid;
$groupperms['gid'] = $gid;

		return $groupperms;
}


		return $groupperms;
}


Zeile 861Zeile 915
	{
if($groupscache[$gid])
{

	{
if($groupscache[$gid])
{

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


























			$level_permissions = $fpermcache[$fid][$gid];

// If our permissions arn't inherited we need to figure them out
if(empty($level_permissions))
{
$parents = explode(',', $forum_cache[$fid]['parentlist']);
rsort($parents);
if(!empty($parents))
{
foreach($parents as $parent_id)
{
if(!empty($fpermcache[$parent_id][$gid]))
{
$level_permissions = $fpermcache[$parent_id][$gid];
break;
}
}

// If we STILL don't have forum permissions we use the usergroup itself
if(empty($level_permissions))
{
$level_permissions = $groupscache[$gid];
}
}
}

foreach($level_permissions as $permission => $access)

			{

			{

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

				if($access >= $current_permissions[$permission] || ($access == "yes" && $current_permissions[$permission] == "no") || !$current_permissions[$permission])


				{

				{

					if($access >= $current_permissions[$permission] || ($access == "yes" && $current_permissions[$permission] == "no") || !$current_permissions[$permission])
{
$current_permissions[$permission] = $access;
}

					$current_permissions[$permission] = $access;




				}

				}

			}
}

			}
}

	}

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

	}

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

	}

	}

	return $current_permissions;
}


	return $current_permissions;
}


Zeile 887Zeile 962
 * 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;
}
}





	if($password)





















	// 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 == $mybb->input['pwverify'])
{
my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->input['pwverify']), null, true);

	{
if($mybb->input['pwverify'])
{
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 1205Zeile 1311
		}
if(!$serverload)
{

		}
if(!$serverload)
{

 
			if(@ini_get('safe_mode') == 'On')
{
return $lang->unknown;
}

// 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('disable_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 1340
				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 1254Zeile 1349
	$returnload = trim($serverload[0]);

return $returnload;

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

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

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

Zeile 1268Zeile 1363

$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 1292Zeile 1387
	}

// 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 1336Zeile 1431
			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];
}
// Less than 0? That's bad
if($update_query[$counter] < 0)
{
$update_query[$counter] = 0;
}
}

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

	}

// Only update if we're actually doing something

	}

// Only update if we're actually doing something

Zeile 1356Zeile 1451
	}

// 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 1377Zeile 1472
			if($posts_diff > -1)
{
$new_stats['numposts'] = "+{$posts_diff}";

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

			}

			}

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

			else
{
$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 1466Zeile 1562
	}

update_thread_data($tid);

	}

update_thread_data($tid);

}

}


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


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

Zeile 1502Zeile 1598
	}

if(!$lastpost['username'])

	}

if(!$lastpost['username'])

	{

	{

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


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


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

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

}


}


function update_forum_count($fid)

function update_forum_count($fid)

{

{

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

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

}

}

function update_thread_attachment_count($tid)
{
die("Depreciated function call: update_thread_attachment_count");

function update_thread_attachment_count($tid)
{
die("Depreciated function call: update_thread_attachment_count");

Zeile 1545Zeile 1641
 * @param int The thread ID
*/
function delete_thread($tid)

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

{
global $moderation;
if(!is_object($moderation))
{

{
global $moderation;
if(!is_object($moderation))
{

		require_once MYBB_ROOT."inc/class_moderation.php";
$moderation = new Moderation;
}
return $moderation->delete_thread($tid);

		require_once MYBB_ROOT."inc/class_moderation.php";
$moderation = new Moderation;
}
return $moderation->delete_thread($tid);

}

/**

}

/**

 * Deletes a post from the database
*
* @param int The thread ID

 * Deletes a post from the database
*
* @param int The thread ID

Zeile 1584Zeile 1680
 * @return string Forum jump items
*/
function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $permissions="", $name="fid")

 * @return string Forum jump items
*/
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 1721
						$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 1702Zeile 1801
	if(!is_array($groupscache))
{
$groupscache = $cache->read("usergroups");

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

	}

	}


if($displaygroup != 0)
{


if($displaygroup != 0)
{

Zeile 1876Zeile 1975
		$clickablesmilies = "";
}
return $clickablesmilies;

		$clickablesmilies = "";
}
return $clickablesmilies;

}

/**

}

/**

 * Gzip encodes text to a specified level
*
* @param string The string to encode

 * Gzip encodes text to a specified level
*
* @param string The string to encode

Zeile 1886Zeile 1985
 * @return string The encoded string
*/
function gzip_encode($contents, $level=1)

 * @return string The encoded string
*/
function gzip_encode($contents, $level=1)

{

{

	if(function_exists("gzcompress") && function_exists("crc32") && !headers_sent() && !(ini_get('output_buffering') && strpos(' '.ini_get('output_handler'), 'ob_gzhandler')))
{
$httpaccept_encoding = '';
if(isset($_SERVER['HTTP_ACCEPT_ENCODING']))
{
$httpaccept_encoding = $_SERVER['HTTP_ACCEPT_ENCODING'];

	if(function_exists("gzcompress") && function_exists("crc32") && !headers_sent() && !(ini_get('output_buffering') && strpos(' '.ini_get('output_handler'), 'ob_gzhandler')))
{
$httpaccept_encoding = '';
if(isset($_SERVER['HTTP_ACCEPT_ENCODING']))
{
$httpaccept_encoding = $_SERVER['HTTP_ACCEPT_ENCODING'];

		}

		}

		if(strpos(" ".$httpaccept_encoding, "x-gzip"))
{
$encoding = "x-gzip";

		if(strpos(" ".$httpaccept_encoding, "x-gzip"))
{
$encoding = "x-gzip";

Zeile 1936Zeile 2035

/* 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'] == '')

	{

	{

		$fid = 0;

		$fid = 0;

	}
else

	}
else

	{
$fid = $data['fid'];
unset($data['fid']);

	{
$fid = $data['fid'];
unset($data['fid']);

Zeile 1956Zeile 2055

// Any remaining extra data - we serialize and insert in to its own column
if(is_array($data))


// Any remaining extra data - we serialize and insert in to its own column
if(is_array($data))

	{

	{

		$data = serialize($data);
}


		$data = serialize($data);
}


	$time = time();


	$time = time();


	$sql_array = array(
"uid" => $mybb->user['uid'],
"dateline" => $time,

	$sql_array = array(
"uid" => $mybb->user['uid'],
"dateline" => $time,

Zeile 1976Zeile 2075

/**
* Get the formatted reputation for a user.


/**
* Get the formatted reputation for a user.

 *

 *

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

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

Zeile 2055Zeile 2154
 * @return string The friendly file size
*/
function get_friendly_size($size)

 * @return string The friendly file size
*/
function get_friendly_size($size)

{

{

	global $lang;

if($size >= 1073741824)

	global $lang;

if($size >= 1073741824)

Zeile 2063Zeile 2162
		$size = round(($size / 1073741824), 2) . " " . $lang->size_gb;
}
elseif($size >= 1048576)

		$size = round(($size / 1073741824), 2) . " " . $lang->size_gb;
}
elseif($size >= 1048576)

	{

	{

		$size = round(($size / 1048576), 2) . " " . $lang->size_mb;

		$size = round(($size / 1048576), 2) . " " . $lang->size_mb;

	}

	}

	elseif($size >= 1024)
{
$size = round(($size / 1024), 2) . " " . $lang->size_kb;

	elseif($size >= 1024)
{
$size = round(($size / 1024), 2) . " " . $lang->size_kb;

Zeile 2075Zeile 2174
		$size = "0 ".$lang->size_bytes;
}
else

		$size = "0 ".$lang->size_bytes;
}
else

	{

	{

		$size = $size . " " . $lang->size_bytes;
}
return $size;
}

		$size = $size . " " . $lang->size_bytes;
}
return $size;
}





/**
* Get the attachment icon for a specific file extension
*

/**
* Get the attachment icon for a specific file extension
*

Zeile 2092Zeile 2191
	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 2351Zeile 2459
		$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 2879Zeile 2987
 */
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);

Zeile 2930Zeile 3038

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" && !preg_match("#[\x80-\xFF]#", $message))
{
$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 3018Zeile 3133

$age = $year-$bday[2];



$age = $year-$bday[2];


	if(($month == $bday[1] && $day < $bday[1]) || $month < $bday[1])

	if(($month == $bday[1] && $day < $bday[0]) || $month < $bday[1])

	{
--$age;
}

	{
--$age;
}

Zeile 3088Zeile 3203

/**
* Cuts a string at a specified point, mb strings accounted for


/**
* Cuts a string at a specified point, mb strings accounted for

 *

 *

 * @param string The string to cut.
* @param int Where to cut
* @param int (optional) How much to cut

 * @param string The string to cut.
* @param int Where to cut
* @param int (optional) How much to cut

Zeile 3105Zeile 3220
		else
{
$cut_string = mb_substr($string, $start);

		else
{
$cut_string = mb_substr($string, $start);

		}
}

		}
}

	else
{
if($length != "")
{
$cut_string = substr($string, $start, $length);

	else
{
if($length != "")
{
$cut_string = substr($string, $start, $length);

		}

		}

		else
{
$cut_string = substr($string, $start);
}

		else
{
$cut_string = substr($string, $start);
}

	}


	}


	return $cut_string;
}


	return $cut_string;
}


Zeile 3137Zeile 3252
	else
{
$string = strtolower($string);

	else
{
$string = strtolower($string);

	}

return $string;
}

	}

return $string;
}


/**
* Finds a needle in a haystack and returns it position, mb strings accounted for


/**
* Finds a needle in a haystack and returns it position, mb strings accounted for

Zeile 3245Zeile 3360

/**
* Get the profile link.


/**
* 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 3334Zeile 3449
}

/**

}

/**

 * 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 3464
		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
{
$query = $db->query("

	else
{
$query = $db->query("

Zeile 3469Zeile 3584

/**
* Get inactivate forums.


/**
* Get inactivate forums.

 *

 *

 * @return string The comma seperated values of the inactivate forum.
*/
function get_inactive_forums()

 * @return string The comma seperated values of the inactivate forum.
*/
function get_inactive_forums()

Zeile 3579Zeile 3694
		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 3587Zeile 3702
*
*/
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 3595Zeile 3710
		$mode = "x";
}
else

		$mode = "x";
}
else

	{

	{

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

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

Zeile 3646Zeile 3761
		$dest .= chr(0x80 | ($src & 0x003f));
}
elseif($src <= 0x10ffff)

		$dest .= chr(0x80 | ($src & 0x003f));
}
elseif($src <= 0x10ffff)

	{

	{

		$dest .= chr(0xf0 | ($src >> 18));
$dest .= chr(0x80 | (($src >> 12) & 0x3f));
$dest .= chr(0x80 | (($src >> 6) & 0x3f));

		$dest .= chr(0xf0 | ($src >> 18));
$dest .= chr(0x80 | (($src >> 12) & 0x3f));
$dest .= chr(0x80 | (($src >> 6) & 0x3f));

Zeile 3822Zeile 3937
	{
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;
}

}

/**

}

/**