Vergleich inc/functions.php - 1.4.1 - 1.4.5

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

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: functions.php 4116 2008-08-15 15:37:11Z ybwzrd $

 * $Id: functions.php 4350 2009-04-14 23:14:07Z Tikitiki $

 */

/**

 */

/**

Zeile 409Zeile 409
 * @param string The from address of the email, if blank, the board name will be used.
* @param string The chracter set being used to send this email.
* @param boolean Do we wish to keep the connection to the mail server alive to send more than one message (SMTP only)

 * @param string The from address of the email, if blank, the board name will be used.
* @param string The chracter set being used to send this email.
* @param boolean Do we wish to keep the connection to the mail server alive to send more than one message (SMTP only)

 
 * @param string The format of the email to be sent (text or html). text is default
* @param string The text message of the email if being sent in html format, for email clients that don't support html
* @param string The email address to return to. Defaults to admin return email address.

 */

 */

function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="text", $message_text="")

function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="text", $message_text="", $return_email="")

{
global $mybb;
static $mail;

{
global $mybb;
static $mail;

Zeile 451Zeile 454
	}

// Build and send

	}

// Build and send

	$mail->build_message($to, $subject, $message, $from, $charset, $headers, $format, $message_text);

	$mail->build_message($to, $subject, $message, $from, $charset, $headers, $format, $message_text, $return_email);

	return $mail->send();
}


	return $mail->send();
}


Zeile 470Zeile 473
	// Guests get a special string
else
{

	// Guests get a special string
else
{

		return md5($mybb->config['database']['hostname'].$mybb->config['database']['username'].md5($mybb->config['database']['password']));

		return md5($mybb->settings['bburl'].$mybb->config['database']['username'].$mybb->settings['internal']['encryption_key']);

	}
}


	}
}


Zeile 491Zeile 494
		}
else
{

		}
else
{

			error($lang->invalid_post_code);








			if(defined("IN_ADMINCP"))
{
return false;
}
else
{
error($lang->invalid_post_code);
}

		}
}
else

		}
}
else

Zeile 625Zeile 635

/**
* Produce a friendly error message page


/**
* Produce a friendly error message page

 *

 *

 * @param string The error message to be shown
* @param string The title of the message shown in the title of the page and the error table
*/

 * @param string The error message to be shown
* @param string The title of the message shown in the title of the page and the error table
*/

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

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

	}

// AJAX error message?
if($mybb->input['ajax'])
{
// Send our headers.
@header("Content-type: text/html; charset={$lang->settings['charset']}");
echo "<error>{$error}</error>\n";
exit;
}

if(!$title)
{

	}

// AJAX error message?
if($mybb->input['ajax'])
{
// Send our headers.
@header("Content-type: text/html; charset={$lang->settings['charset']}");
echo "<error>{$error}</error>\n";
exit;
}

if(!$title)
{

		$title = $mybb->settings['bbname'];
}


		$title = $mybb->settings['bbname'];
}


Zeile 682Zeile 692
	if(!is_array($errors))
{
$errors = array($errors);

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

	}

	}


// AJAX error message?
if($mybb->input['ajax'])


// AJAX error message?
if($mybb->input['ajax'])

Zeile 691Zeile 701
		// Send our headers.
@header("Content-type: text/html; charset={$lang->settings['charset']}");
echo "<error>{$error}</error>\n";

		// Send our headers.
@header("Content-type: text/html; charset={$lang->settings['charset']}");
echo "<error>{$error}</error>\n";

		exit;
}

		exit;
}


foreach($errors as $error)
{


foreach($errors as $error)
{

Zeile 765Zeile 775
		echo "<script type=\"text/javascript\">\n";
if($message != "")
{

		echo "<script type=\"text/javascript\">\n";
if($message != "")
{

			echo "alert('{$message}');\n";

			echo 'alert("'.addslashes($message).'");';

		}
$url = str_replace("#", "&#", $url);
$url = htmlspecialchars_decode($url);
$url = str_replace(array("\n","\r",";"), "", $url);

		}
$url = str_replace("#", "&#", $url);
$url = htmlspecialchars_decode($url);
$url = str_replace(array("\n","\r",";"), "", $url);

		echo "window.location = '{$url}';\n";

		echo 'window.location = "'.addslashes($url).'";'."\n";

		echo "</script>\n";
exit;
}

		echo "</script>\n";
exit;
}

Zeile 799Zeile 809
	}
else
{

	}
else
{

		$url = str_replace("#", "&#", $url);

 
		$url = htmlspecialchars_decode($url);
$url = str_replace(array("\n","\r",";"), "", $url);

run_shutdown();
header("Location: $url");

		$url = htmlspecialchars_decode($url);
$url = str_replace(array("\n","\r",";"), "", $url);

run_shutdown();
header("Location: $url");

	}


	}


	exit;
}

	exit;
}





/**
* Generate a listing of page - pagination
*

/**
* Generate a listing of page - pagination
*

Zeile 826Zeile 835
	if($count <= $perpage)
{
return;

	if($count <= $perpage)
{
return;

	}


	}


	$url = str_replace("&amp;", "&", $url);
$url = htmlspecialchars_uni($url);


	$url = str_replace("&amp;", "&", $url);
$url = htmlspecialchars_uni($url);


Zeile 844Zeile 853
	if(!$mybb->settings['maxmultipagelinks'])
{
$mybb->settings['maxmultipagelinks'] = 5;

	if(!$mybb->settings['maxmultipagelinks'])
{
$mybb->settings['maxmultipagelinks'] = 5;

	}

	}


$from = $page-floor($mybb->settings['maxmultipagelinks']/2);
$to = $page+floor($mybb->settings['maxmultipagelinks']/2);


$from = $page-floor($mybb->settings['maxmultipagelinks']/2);
$to = $page+floor($mybb->settings['maxmultipagelinks']/2);

Zeile 853Zeile 862
	{
$from = 1;
$to = $from+$mybb->settings['maxmultipagelinks']-1;

	{
$from = 1;
$to = $from+$mybb->settings['maxmultipagelinks']-1;

	}

	}


if($to > $pages)
{


if($to > $pages)
{

Zeile 868Zeile 877
	if($to == 0)
{
$to = $pages;

	if($to == 0)
{
$to = $pages;

	}


	}


	if($from > 1)
{
$page_url = fetch_page_url($url, 1);

	if($from > 1)
{
$page_url = fetch_page_url($url, 1);

Zeile 893Zeile 902
	{
$page_url = fetch_page_url($url, $pages);
eval("\$end = \"".$templates->get("multipage_end")."\";");

	{
$page_url = fetch_page_url($url, $pages);
eval("\$end = \"".$templates->get("multipage_end")."\";");

	}


	}


	if($page < $pages)
{
$next = $page+1;

	if($page < $pages)
{
$next = $page+1;

Zeile 990Zeile 999
function usergroup_permissions($gid=0)
{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;

function usergroup_permissions($gid=0)
{
global $cache, $groupscache, $grouppermignore, $groupzerogreater;



	

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

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

	}


	}


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

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



 

if(count($groups) == 1)
{


if(count($groups) == 1)
{

Zeile 1010Zeile 1018
		{
continue;
}

		{
continue;
}



		

		foreach($groupscache[$gid] as $perm => $access)
{
if(!in_array($perm, $grouppermignore))

		foreach($groupscache[$gid] as $perm => $access)
{
if(!in_array($perm, $grouppermignore))

Zeile 1024Zeile 1032
					$permbit = "";
}


					$permbit = "";
}


				if(in_array($perm, $groupzerogreater))


				// 0 represents unlimited for numerical group permissions (i.e. private message limit) so take that into account.
if(in_array($perm, $groupzerogreater) && ($access == 0 || $permbit === 0))

				{

				{

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

					$usergroup[$perm] = 0;
continue;




				}

if($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) // Keep yes/no for compatibility?

				}

if($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) // Keep yes/no for compatibility?

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

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

			if($usercache[$uid])

			if(!$usercache[$uid])

			{
$query = $db->simple_select("users", "*", "uid='$uid'");
$usercache[$uid] = $db->fetch_array($query);

			{
$query = $db->simple_select("users", "*", "uid='$uid'");
$usercache[$uid] = $db->fetch_array($query);

Zeile 1592Zeile 1598
	$cookie = $mybb->cookies['mybb'];
$newcookie = unserialize($cookie[$name]);
$newcookie[$id] = $value;

	$cookie = $mybb->cookies['mybb'];
$newcookie = unserialize($cookie[$name]);
$newcookie[$id] = $value;

	$newcookie = addslashes(serialize($newcookie));
my_setcookie("mybb[$name]", $newcookie);




	$newcookie = serialize($newcookie);
my_setcookie("mybb[$name]", addslashes($newcookie));

// Make sure our current viarables are up-to-date as well
$mybb->cookies['mybb'][$name] = $newcookie;

}

/**

}

/**

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

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

		if(!$serverload)

		if(!is_numeric($serverload[0]))

		{
if(@ini_get('safe_mode') == 'On')
{

		{
if(@ini_get('safe_mode') == 'On')
{

Zeile 1897Zeile 1906
			}
}
}

			}
}
}





	
$db->free_result($query);


	// Only update if we're actually doing something
if(count($update_query) > 0)
{
$db->update_query("threads", $update_query, "tid='".intval($tid)."'");

	// Only update if we're actually doing something
if(count($update_query) > 0)
{
$db->update_query("threads", $update_query, "tid='".intval($tid)."'");

	}




	}

unset($update_query, $thread);


	update_thread_data($tid);
}


	update_thread_data($tid);
}


Zeile 1915Zeile 1928
function update_thread_data($tid)
{
global $db;

function update_thread_data($tid)
{
global $db;

	$query = $db->query("

	$query = $db->query("

		SELECT u.uid, u.username, p.username AS postusername, p.dateline
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)

		SELECT u.uid, u.username, p.username AS postusername, p.dateline
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)

Zeile 1924Zeile 1937
		LIMIT 1"
);
$lastpost = $db->fetch_array($query);

		LIMIT 1"
);
$lastpost = $db->fetch_array($query);





	
$db->free_result($query);


	$query = $db->query("
SELECT u.uid, u.username, p.username AS postusername, p.dateline
FROM ".TABLE_PREFIX."posts p

	$query = $db->query("
SELECT u.uid, u.username, p.username AS postusername, p.dateline
FROM ".TABLE_PREFIX."posts p

Zeile 1934Zeile 1949
		LIMIT 1
");
$firstpost = $db->fetch_array($query);

		LIMIT 1
");
$firstpost = $db->fetch_array($query);





	
$db->free_result($query);


	if(!$firstpost['username'])
{
$firstpost['username'] = $firstpost['postusername'];

	if(!$firstpost['username'])
{
$firstpost['username'] = $firstpost['postusername'];

Zeile 1946Zeile 1963
	}

if(!$lastpost['dateline'])

	}

if(!$lastpost['dateline'])

	{

	{

		$lastpost['username'] = $firstpost['username'];
$lastpost['uid'] = $firstpost['uid'];
$lastpost['dateline'] = $firstpost['dateline'];

		$lastpost['username'] = $firstpost['username'];
$lastpost['uid'] = $firstpost['uid'];
$lastpost['dateline'] = $firstpost['dateline'];

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

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

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

}

function update_forum_count($fid)

}

function update_forum_count($fid)

Zeile 1977Zeile 1996
{
die("Deprecated function call: update_thread_attachment_count");
}

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





/**
* Deletes a thread from the database
*

/**
* Deletes a thread from the database
*

Zeile 1994Zeile 2013
	}

return $moderation->delete_thread($tid);

	}

return $moderation->delete_thread($tid);

}


}


/**
* Deletes a post from the database
*
* @param int The thread ID
*/
function delete_post($pid, $tid="")

/**
* Deletes a post from the database
*
* @param int The thread ID
*/
function delete_post($pid, $tid="")

{

{

	global $moderation;

if(!is_object($moderation))

	global $moderation;

if(!is_object($moderation))

Zeile 2022Zeile 2041
 * @param int If we need to add select boxes to this cal or not
* @param int The current depth of forums we're at
* @param int Whether or not to show extra items such as User CP, Forum home

 * @param int If we need to add select boxes to this cal or not
* @param int The current depth of forums we're at
* @param int Whether or not to show extra items such as User CP, Forum home

 
 * @param boolean Ignore the showinjump setting and show all forums (for moderation pages)

 * @param array Array of permissions
* @param string The name of the forum jump
* @return string Forum jump items
*/

 * @param array Array of permissions
* @param string The name of the forum jump
* @return string Forum jump items
*/

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", $showall=false, $permissions="", $name="fid")

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

$pid = intval($pid);

if($permissions)

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

$pid = intval($pid);

if($permissions)

	{

	{

		$permissions = $mybb->usergroup;
}


		$permissions = $mybb->usergroup;
}


Zeile 2045Zeile 2065
		}

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

		}

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

		{

		{

			if($forum['active'] != 0)
{
$jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

			if($forum['active'] != 0)
{
$jumpfcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

Zeile 2066Zeile 2086
			{
$perms = $permissioncache[$forum['fid']];


			{
$perms = $permissioncache[$forum['fid']];


				if($forum['fid'] != "0" && ($perms['canview'] != 0 || $mybb->settings['hideprivateforums'] == 0) && $forum['linkto'] == '' && $forum['showinjump'] != 0)

				if($forum['fid'] != "0" && ($perms['canview'] != 0 || $mybb->settings['hideprivateforums'] == 0) && $forum['linkto'] == '' && ($forum['showinjump'] != 0 || $showall == true))

				{
$optionselected = "";


				{
$optionselected = "";


Zeile 2083Zeile 2103
					if($forum_cache[$forum['fid']])
{
$newdepth = $depth."--";

					if($forum_cache[$forum['fid']])
{
$newdepth = $depth."--";

						$forumjumpbits .= build_forum_jump($forum['fid'], $selitem, 0, $newdepth, $showextras);

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

					}
}
}

					}
}
}

Zeile 2194Zeile 2214
	global $db, $mybb, $theme, $templates, $lang, $plugins;

if($mybb->settings['bbcodeinserter'] != 0)

	global $db, $mybb, $theme, $templates, $lang, $plugins;

if($mybb->settings['bbcodeinserter'] != 0)

	{

	{

		$editor_lang_strings = array(
"editor_title_bold",
"editor_title_italic",

		$editor_lang_strings = array(
"editor_title_bold",
"editor_title_italic",

Zeile 2243Zeile 2263
			if($editor_lang_strings[$key+1])
{
$editor_language .= ",";

			if($editor_lang_strings[$key+1])
{
$editor_language .= ",";

			}

			}


$editor_language .= "\n";
}


$editor_language .= "\n";
}

Zeile 2256Zeile 2276
			$codeinsert = $page->build_codebuttons_editor($bind, $editor_language);
}
else

			$codeinsert = $page->build_codebuttons_editor($bind, $editor_language);
}
else

		{

		{

			eval("\$codeinsert = \"".$templates->get("codebuttons")."\";");
}
}

			eval("\$codeinsert = \"".$templates->get("codebuttons")."\";");
}
}

Zeile 2292Zeile 2312
				if($smilie['showclickable'] != 0)
{
$smiliecache[$smilie['find']] = $smilie['image'];

				if($smilie['showclickable'] != 0)
{
$smiliecache[$smilie['find']] = $smilie['image'];

				}

				}

			}
}


			}
}


Zeile 2938Zeile 2958
			$url = "{$base_url}forum-{$id}.html";
break;
default:

			$url = "{$base_url}forum-{$id}.html";
break;
default:

			$url = $mybb->setings['bburl']."/archive/index.php";

			$url = $mybb->settings['bburl']."/archive/index.php";

	}

return $url;

	}

return $url;

Zeile 3080Zeile 3100
	if($mybb->settings['nocacheheaders'] == 1 && $mybb->settings['standardheaders'] != 1)
{
header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");

	if($mybb->settings['nocacheheaders'] == 1 && $mybb->settings['standardheaders'] != 1)
{
header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");

		header("Last-Modified: ".gmdate("D, d M Y H:i:s")."GMT");

		header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");

		header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
}

		header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
}

Zeile 3310Zeile 3330
 */
function join_usergroup($uid, $joingroup)
{

 */
function join_usergroup($uid, $joingroup)
{

	global $db;


	global $db, $mybb;


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

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

	{

	{

		$user = $mybb->user;

		$user = $mybb->user;

	}

	}

	else

	else

	{
$query = $db->simple_select("users", "additionalgroups, usergroup", "uid='{$uid}'");

	{
$query = $db->simple_select("users", "additionalgroups, usergroup", "uid='".intval($uid)."'");

		$user = $db->fetch_array($query);
}


		$user = $db->fetch_array($query);
}


Zeile 3327Zeile 3347
	$usergroups = $user['additionalgroups'].",".$joingroup;
$groupslist = "";
$groups = explode(",", $usergroups);

	$usergroups = $user['additionalgroups'].",".$joingroup;
$groupslist = "";
$groups = explode(",", $usergroups);


if(is_array($groups))
{
foreach($groups as $gid)
{


if(is_array($groups))
{
foreach($groups as $gid)
{

			if(trim($gid) != "" && $gid != $user['usergroup'] && !$donegroup[$gid])
{
$groupslist .= $comma.$gid;

			if(trim($gid) != "" && $gid != $user['usergroup'] && !$donegroup[$gid])
{
$groupslist .= $comma.$gid;

Zeile 3339Zeile 3359
				$donegroup[$gid] = 1;
}
}

				$donegroup[$gid] = 1;
}
}

	}

	}





	$db->update_query("users", array('additionalgroups' => $groupslist), "uid='$uid'");










	// What's the point in updating if they're the same?
if($groupslist != $user['additionalgroups'])
{
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='".intval($uid)."'");
return true;
}
else
{
return false;
}

}

/**

}

/**

Zeile 3360Zeile 3389
	}
else
{

	}
else
{

		$query = $db->simple_select("users", "*", "uid='{$uid}'");

		$query = $db->simple_select("users", "*", "uid='".intval($uid)."'");

		$user = $db->fetch_array($query);
}

		$user = $db->fetch_array($query);
}





$groupslist = "";

	$usergroups = "";
$usergroups = $user['additionalgroups'].",";


	$usergroups = "";
$usergroups = $user['additionalgroups'].",";


Zeile 3372Zeile 3402
	if(is_array($groups))
{
foreach($groups as $gid)

	if(is_array($groups))
{
foreach($groups as $gid)

		{

		{

			if(trim($gid) != "" && $leavegroup != $gid && !$donegroup[$gid])
{
$groupslist .= $comma.$gid;

			if(trim($gid) != "" && $leavegroup != $gid && !$donegroup[$gid])
{
$groupslist .= $comma.$gid;

Zeile 3381Zeile 3411
			}
}
}

			}
}
}




	
$dispupdate = "";

	if($leavegroup == $user['displaygroup'])
{
$dispupdate = ", displaygroup=usergroup";

	if($leavegroup == $user['displaygroup'])
{
$dispupdate = ", displaygroup=usergroup";

Zeile 3390Zeile 3421
	$db->write_query("
UPDATE ".TABLE_PREFIX."users
SET additionalgroups='$groupslist' $dispupdate

	$db->write_query("
UPDATE ".TABLE_PREFIX."users
SET additionalgroups='$groupslist' $dispupdate

		WHERE uid='$uid'

		WHERE uid='".intval($uid)."'

	");

$cache->update_moderators();

	");

$cache->update_moderators();

Zeile 3412Zeile 3443

if(!empty($_SERVER['PATH_INFO']))
{


if(!empty($_SERVER['PATH_INFO']))
{

		$location = $_SERVER['PATH_INFO'];

		$location = htmlspecialchars_uni($_SERVER['PATH_INFO']);

	}
elseif(!empty($_ENV['PATH_INFO']))

	}
elseif(!empty($_ENV['PATH_INFO']))

	{
$location = $_ENV['PATH_INFO'];

	{
$location = htmlspecialchars_uni($_ENV['PATH_INFO']);

	}
elseif(!empty($_ENV['PHP_SELF']))

	}
elseif(!empty($_ENV['PHP_SELF']))

	{
$location = $_ENV['PHP_SELF'];

	{
$location = htmlspecialchars_uni($_ENV['PHP_SELF']);

	}
else
{

	}
else
{

		$location = $_SERVER['PHP_SELF'];

		$location = htmlspecialchars_uni($_SERVER['PHP_SELF']);

	}

if($fields == true)

	}

if($fields == true)

Zeile 3438Zeile 3469
		
$form_html = "";
$field_parts = explode('&', $field_parts);

		
$form_html = "";
$field_parts = explode('&', $field_parts);

		

		

		if(!empty($mybb->input))

		if(!empty($mybb->input))

		{

		{

			foreach($mybb->input as $name => $value)
{
if(in_array($name, $ignore))

			foreach($mybb->input as $name => $value)
{
if(in_array($name, $ignore))

Zeile 3458Zeile 3489
	{
if(isset($_SERVER['QUERY_STRING']))
{

	{
if(isset($_SERVER['QUERY_STRING']))
{

			$location .= "?".$_SERVER['QUERY_STRING'];
}
else if(isset($_ENV['QUERY_STRING']))
{
$location = "?".$_ENV['QUERY_STRING'];

			$location .= "?".htmlspecialchars_uni($_SERVER['QUERY_STRING']);
}
else if(isset($_ENV['QUERY_STRING']))
{
$location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']);

		}

if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST"))
{
$post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');

		}

if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST"))
{
$post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');

	

	

			foreach($post_array as $var)

			foreach($post_array as $var)

			{

			{

				if(isset($_POST[$var]))

				if(isset($_POST[$var]))

				{
$addloc[] = $var.'='.$_POST[$var];
}

				{
$addloc[] = urlencode($var).'='.urlencode($_POST[$var]);
}

			}

if(isset($addloc) && is_array($addloc))
{

			}

if(isset($addloc) && is_array($addloc))
{

				$location .= "?".implode("&", $addloc);









				if(strpos($location, "?") === false)
{
$location .= "?";
}
else
{
$location .= "&amp;";
}
$location .= implode("&amp;", $addloc);

			}
}

			}
}

	

 
	
return $location;
}

	
return $location;
}

Zeile 3626Zeile 3664
		}

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

		}

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

 
	}
}

function convert_through_utf8($str, $to=true)
{
global $lang;
static $charset;
static $use_mb;
static $use_iconv;

if(!isset($charset))
{
$charset = my_strtolower($lang->settings['charset']);
}

if($charset == "utf-8")
{
return $str;
}

if(!isset($use_iconv))
{
$use_iconv = function_exists("iconv");
}

if(!isset($use_mb))
{
$use_mb = function_exists("mb_convert_encoding");
}

if($use_iconv || $use_mb)
{
if($to)
{
$from_charset = $lang->settings['charset'];
$to_charset = "UTF-8";
}
else
{
$from_charset = "UTF-8";
$to_charset = $lang->settings['charset'];
}
if($use_iconv)
{
return iconv($from_charset, $to_charset."//IGNORE", $str);
}
else
{
return @mb_convert_encoding($str, $to_charset, $from_charset);
}
}
elseif($charset == "iso-8859-1" && function_exists("utf8_encode"))
{
if($to)
{
return utf8_encode($str);
}
else
{
return utf8_decode($str);
}
}
else
{
return $str;

	}
}


	}
}


Zeile 3636Zeile 3739
 * @return string The word wraped string
*/
function my_wordwrap($message)

 * @return string The word wraped string
*/
function my_wordwrap($message)

{

{

	global $mybb;

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

	global $mybb;

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

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

	{
$message = convert_through_utf8($message);

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



		{

		{

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

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

		}

		}

 
		
$new_message = convert_through_utf8($new_message, false);

return $new_message;

	}

return $message;

	}

return $message;

Zeile 3688Zeile 3793
					$h = 7;
}
}

					$h = 7;
}
}

		}
}
}

		}
}
}


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

Zeile 3760Zeile 3865
	$find = array(
'm',
'd',

	$find = array(
'm',
'd',

 
		'D',

		'y',
'Y',
'j',
'S',
'l',
'F',

		'y',
'Y',
'j',
'S',
'l',
'F',

 
		'M',

	);

$replace = array(
sprintf('%02s', $bm),
sprintf('%02s', $bd),

	);

$replace = array(
sprintf('%02s', $bm),
sprintf('%02s', $bd),

 
		($wd == 2 ? my_substr($bdays[$wd], 0, 4) : ($wd == 4 ? my_substr($bdays[$wd], 0, 5) : my_substr($bdays[$wd], 0, 3))),

		my_substr($by, 2),
$by,
($bd[0] == 0 ? my_substr($bd, 1) : $bd),

		my_substr($by, 2),
$by,
($bd[0] == 0 ? my_substr($bd, 1) : $bd),

		($db == 1 || $db == 21 || $db == 31 ? 'st' : ($db == 2 || $db == 22 ? 'nd' : ($db == 3 || $db == 23 ? 'rd' : 'th'))),
$bdays[$wd],

		($bd == 1 || $bd == 21 || $bd == 31 ? 'st' : ($bd == 2 || $bd == 22 ? 'nd' : ($bd == 3 || $bd == 23 ? 'rd' : 'th'))),
$wd,

		$bmonth[$bm-1],

		$bmonth[$bm-1],

 
		($bm == 9 ? my_substr($bmonth[$bm-1], 0, 4) :  my_substr($bmonth[$bm-1], 0, 3)),

	);

	);

 
	
// Do we have the full month in our output?
// If so there's no need for the short month
if(strpos($display, 'F') !== false)
{
array_pop($find);
array_pop($replace);
}

	
return str_replace($find, $replace, $display);
}

	
return str_replace($find, $replace, $display);
}

Zeile 3866Zeile 3983
    }

return $string_length;

    }

return $string_length;

}

}


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


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

Zeile 3878Zeile 3995
 * @return int The cut part of the string.
*/
function my_substr($string, $start, $length="", $handle_entities = false)

 * @return int The cut part of the string.
*/
function my_substr($string, $start, $length="", $handle_entities = false)

{
if($handle_entities)
{

{
if($handle_entities)
{

		$string = unhtmlentities($string);
}
if(function_exists("mb_substr"))

		$string = unhtmlentities($string);
}
if(function_exists("mb_substr"))

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

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

		}
}
else

		}
}
else

	{
if($length != "")
{

	{
if($length != "")
{

Zeile 3909Zeile 4026
	if($handle_entities)
{
$cut_string = htmlspecialchars_uni($cut_string);

	if($handle_entities)
{
$cut_string = htmlspecialchars_uni($cut_string);

	}

	}

	return $cut_string;
}


	return $cut_string;
}


Zeile 3924Zeile 4041
	if(function_exists("mb_strtolower"))
{
$string = mb_strtolower($string);

	if(function_exists("mb_strtolower"))
{
$string = mb_strtolower($string);

	}
else

	}
else

	{
$string = strtolower($string);
}

	{
$string = strtolower($string);
}

Zeile 3987Zeile 4104
 * @return int The un-htmlentitied' string.
*/
function unhtmlentities($string)

 * @return int The un-htmlentitied' string.
*/
function unhtmlentities($string)

{
// Replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);








{	
// Replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'unichr(hexdec("\\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'unichr("\\1")', $string);

// Replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);

return strtr($string, $trans_tbl);
}





   // Replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);

return strtr($string, $trans_tbl);



























/**
* Returns any ascii to it's character (utf-8 safe).
*
* @param string The ascii to characterize.
* @return int The characterized ascii.
*/
function unichr($c)
{
if($c <= 0x7F)
{
return chr($c);
}
else if($c <= 0x7FF)
{
return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F);
}
else if($c <= 0xFFFF)
{
return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);
}
else if($c <= 0x10FFFF)
{
return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F)
. chr(0x80 | $c >> 6 & 0x3F)
. chr(0x80 | $c & 0x3F);
}
else
{
return false;
}

}

/**

}

/**

Zeile 4090Zeile 4240
		// If we're in the archive, link back a directory
if(IN_ARCHIVE == 1)
{

		// If we're in the archive, link back a directory
if(IN_ARCHIVE == 1)
{

			global $mybb;

if($mybb->settings['seourls'] == "yes" || ($mybb->settings['seourls'] == "auto" && $_SERVER['SEO_SUPPORT'] == 1))
{
return "<a href=\"../../".get_profile_link($uid)."\"{$target}{$onclick}>{$username}</a>";
}

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

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








		elseif(IN_ADMINCP == 1)

		elseif(IN_ADMINCP == 1)

		{

		{

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

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

		}

		}

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

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

		}
}
}


		}
}
}


/**
* Build the forum link.
*

/**
* Build the forum link.
*

Zeile 4255Zeile 4398
 */
function get_calendar_week_link($calendar, $week)
{

 */
function get_calendar_week_link($calendar, $week)
{

 
	if($week < 0)
{
$week = str_replace('-', "n", $week);
}

	$link = str_replace("{week}", $week, CALENDAR_URL_WEEK);
$link = str_replace("{calendar}", $calendar, $link);
return htmlspecialchars_uni($link);

	$link = str_replace("{week}", $week, CALENDAR_URL_WEEK);
$link = str_replace("{calendar}", $calendar, $link);
return htmlspecialchars_uni($link);

}

}


/**
* Get the user data of a user id.


/**
* Get the user data of a user id.

Zeile 4287Zeile 4434
		$user_cache[$uid] = $db->fetch_array($query);

return $user_cache[$uid];

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

return $user_cache[$uid];

	}

	}

}



}



Zeile 4333Zeile 4480

/**
* Get the thread of a thread id.


/**
* Get the thread of a thread id.

 *

 *

 * @param int The thread id of the thread.
* @return string The database row of the thread.
*/

 * @param int The thread id of the thread.
* @return string The database row of the thread.
*/

Zeile 4343Zeile 4490
	static $thread_cache;

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

	static $thread_cache;

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

	{

	{

		return $thread_cache[$tid];
}
else

		return $thread_cache[$tid];
}
else

Zeile 4352Zeile 4499
		$thread = $db->fetch_array($query);

if($thread)

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

if($thread)

		{

		{

			$thread_cache[$tid] = $thread;
return $thread;

			$thread_cache[$tid] = $thread;
return $thread;

		}

		}

		else
{
$thread_cache[$tid] = false;

		else
{
$thread_cache[$tid] = false;

			return false;
}
}

			return false;
}
}

}

/**

}

/**

Zeile 4407Zeile 4554
	global $forum_cache, $cache, $inactiveforums;

if(!$forum_cache)

	global $forum_cache, $cache, $inactiveforums;

if(!$forum_cache)

	{

	{

		cache_forums();
}


		cache_forums();
}


Zeile 4508Zeile 4655
		}

// Work out if the user has waited long enough before letting them login again

		}

// Work out if the user has waited long enough before letting them login again

		if($mybb->cookies['failedlogin'] < $now - $mybb->settings['failedlogintime'] * 60)

		if($mybb->cookies['failedlogin'] < ($now - $mybb->settings['failedlogintime'] * 60) && $mybb->user['uid'] != 0)

		{
my_setcookie('loginattempts', 1);
my_unsetcookie('failedlogin');
$update_array = array(
'loginattempts' => 1
);

		{
my_setcookie('loginattempts', 1);
my_unsetcookie('failedlogin');
$update_array = array(
'loginattempts' => 1
);

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

			$db->update_query("users", $update_array, "uid = '{$mybb->user['uid']}'");

			return 1;
}
// Not waited long enough

			return 1;
}
// Not waited long enough

		else

		else if($mybb->cookies['failedlogin'] > ($now - $mybb->settings['failedlogintime'] * 60))

		{
if($fatal)
{

		{
if($fatal)
{

Zeile 4528Zeile 4675

return false;
}


return false;
}

	}


	}


	// User can attempt another login
return $loginattempts;

	// User can attempt another login
return $loginattempts;

}

/**

}

/**

 * Validates the format of an email address.
*
* @param string The string to check.

 * Validates the format of an email address.
*
* @param string The string to check.

Zeile 4558Zeile 4705
 * @return boolean True when in use, false when not.
*/
function email_already_in_use($email, $uid="")

 * @return boolean True when in use, false when not.
*/
function email_already_in_use($email, $uid="")

{

{

	global $db;

$uid_string = "";

	global $db;

$uid_string = "";

Zeile 4567Zeile 4714
		$uid_string = " AND uid != '".intval($uid)."'";
}
$query = $db->simple_select("users", "COUNT(email) as emails", "email = '".$db->escape_string(my_strtolower($email))."'{$uid_string}");

		$uid_string = " AND uid != '".intval($uid)."'";
}
$query = $db->simple_select("users", "COUNT(email) as emails", "email = '".$db->escape_string(my_strtolower($email))."'{$uid_string}");

	

	

	if($db->fetch_field($query, "emails") > 0)
{
return true;

	if($db->fetch_field($query, "emails") > 0)
{
return true;

Zeile 4630Zeile 4777
 */
function build_highlight_array($terms)
{

 */
function build_highlight_array($terms)
{

	$terms = htmlspecialchars_uni($terms);


 
	// Strip out any characters that shouldn't be included
$bad_characters = array(
"(",

	// Strip out any characters that shouldn't be included
$bad_characters = array(
"(",

Zeile 4649Zeile 4794
		$terms = explode("\"", $terms);
foreach($terms as $phrase)
{

		$terms = explode("\"", $terms);
foreach($terms as $phrase)
{

 
			$phrase = htmlspecialchars_uni($phrase);

			if($phrase != "")
{
if($inquote)

			if($phrase != "")
{
if($inquote)

Zeile 4678Zeile 4824
	// Otherwise just a simple search query with no phrases
else
{

	// Otherwise just a simple search query with no phrases
else
{

 
		$terms = htmlspecialchars_uni($terms);

		$split_words = preg_split("#\s{1,}#", $terms, -1);
if(!is_array($split_words))
{

		$split_words = preg_split("#\s{1,}#", $terms, -1);
if(!is_array($split_words))
{

Zeile 4708Zeile 4855
	
// Special boolean operators should be stripped
if($word == "" || $word == "or" || $word == "not" || $word == "and")

	
// Special boolean operators should be stripped
if($word == "" || $word == "or" || $word == "not" || $word == "and")

		{

		{

			continue;
}

			continue;
}





		// Now make PREG compatible
$find = "#(^|>)([^<]*)(".preg_quote($word, "#").")#i";
$replacement = "$1$2<span class=\"highlight\">$3</span>";
$highlight_cache[$find] = $replacement;

		// Now make PREG compatible
$find = "#(^|>)([^<]*)(".preg_quote($word, "#").")#i";
$replacement = "$1$2<span class=\"highlight\">$3</span>";
$highlight_cache[$find] = $replacement;

	}


	}


	return $highlight_cache;
}


	return $highlight_cache;
}


Zeile 4726Zeile 4873
 * (Code by Anne van Kesteren, http://annevankesteren.nl/2005/05/character-references)
*
* @param string Decimal value of a character reference

 * (Code by Anne van Kesteren, http://annevankesteren.nl/2005/05/character-references)
*
* @param string Decimal value of a character reference

 */

 */

function dec_to_utf8($src)
{
$dest = '';

function dec_to_utf8($src)
{
$dest = '';

Zeile 4782Zeile 4929
		// Make regular expression * match
$banned_username['filter'] = str_replace('\*', '(.*)', preg_quote($banned_username['filter'], '#'));
if(preg_match("#{$banned_username['filter']}#i", $username))

		// Make regular expression * match
$banned_username['filter'] = str_replace('\*', '(.*)', preg_quote($banned_username['filter'], '#'));
if(preg_match("#{$banned_username['filter']}#i", $username))

		{
// Updating last use

		{
// Updating last use

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

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

Zeile 4792Zeile 4939
		}
}
// Still here - good username

		}
}
// Still here - good username

	return false;
}

	return false;
}


/**
* Check if a specific email address has been banned.


/**
* Check if a specific email address has been banned.

Zeile 4811Zeile 4958
		// Make regular expression * match
$banned_email['filter'] = str_replace('\*', '(.*)', preg_quote($banned_email['filter'], '#'));
if(preg_match("#{$banned_email['filter']}#i", $email))

		// Make regular expression * match
$banned_email['filter'] = str_replace('\*', '(.*)', preg_quote($banned_email['filter'], '#'));
if(preg_match("#{$banned_email['filter']}#i", $email))

		{

		{

			// Updating last use
if($update_lastuse == true)
{

			// Updating last use
if($update_lastuse == true)
{

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

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

			}
return true;

			}
return true;

		}
}
// Still here - good ip

		}
}
// Still here - good ip

Zeile 4932Zeile 5079
				{
$label = str_replace(".", ":", $label);
$label = str_replace(":5", ":30", $label);

				{
$label = str_replace(".", ":", $label);
$label = str_replace(":5", ":30", $label);

				}

				}

				else
{
$label .= ":00";

				else
{
$label .= ":00";

Zeile 4942Zeile 5089
			$label = $lang->sprintf($lang->timezone_gmt_short, $label." ", $time_in_zone);
}
$select .= "<option value=\"{$timezone}\"{$selected_add}>{$label}</option>\n";

			$label = $lang->sprintf($lang->timezone_gmt_short, $label." ", $time_in_zone);
}
$select .= "<option value=\"{$timezone}\"{$selected_add}>{$label}</option>\n";

	}

	}

	$select .= "</select>";
return $select;
}

	$select .= "</select>";
return $select;
}

Zeile 4953Zeile 5100
 * @param string The URL of the remote file
* @return string The remote file contents.
*/

 * @param string The URL of the remote file
* @return string The remote file contents.
*/

function fetch_remote_file($url)

function fetch_remote_file($url, $post_data=array())

{

{

 
	$post_body = '';
if(!empty($post_data))
{
foreach($post_data as $key => $val)
{
$post_body .= '&'.urlencode($key).'='.urlencode($val);
}
$post_body = ltrim($post_body, '&');
}


	if(function_exists("curl_init"))
{
$ch = curl_init();

	if(function_exists("curl_init"))
{
$ch = curl_init();

Zeile 4962Zeile 5119
		curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

		curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

 
		if(!empty($post_body))
{
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_body);
}

		$data = curl_exec($ch);
curl_close($ch);
return $data;
}

		$data = curl_exec($ch);
curl_close($ch);
return $data;
}

	else if(function_exists("fsockopen"))

 	else if(function_exists("fsockopen"))

	{
$url = @parse_url($url);
if(!$url['host'])

	{
$url = @parse_url($url);
if(!$url['host'])

		{
return false;

		{
return false;

		}
if(!$url['port'])
{

		}
if(!$url['port'])
{

Zeile 4988Zeile 5150
		$fp = @fsockopen($url['host'], $url['port'], $error_no, $error, 10);
@stream_set_timeout($fp, 10);
if(!$fp)

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




















		{
return false;
}
$headers = array();
if(!empty($post_body))
{
$headers[] = "POST {$url['path']} HTTP/1.0";
$headers[] = "Content-Length: ".strlen($post_body);
$headers[] = "Content-Type: application/x-www-form-urlencoded";
}
else
{
$headers[] = "GET {$url['path']} HTTP/1.0";
}

$headers[] = "Host: {$url['host']}";
$headers[] = "Connection: Close";
$headers[] = "\r\n";

if(!empty($post_body))
{
$headers[] = $post_body;
}

$headers = implode("\r\n", $headers);

		if(!@fwrite($fp, $headers))
{
return false;

		if(!@fwrite($fp, $headers))
{
return false;

Zeile 5006Zeile 5187
		$data = explode("\r\n\r\n", $data, 2);
return $data[1];
}

		$data = explode("\r\n\r\n", $data, 2);
return $data[1];
}

	else

	else if(empty($post_data))

	{
return @implode("", @file($url));

	{
return @implode("", @file($url));

	}
}






	}
else
{
return false;
}
}


/**
* Checks if a particular user is a super administrator.
*

/**
* Checks if a particular user is a super administrator.
*

Zeile 5030Zeile 5215
	else
{
return true;

	else
{
return true;

	}

	}

}

/**

}

/**

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

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

		{

		{

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

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

Zeile 5086Zeile 5271
			}
}
$in_escape = !$in_escape;

			}
}
$in_escape = !$in_escape;

	}

	}

	if(!count($strings))
{
return $original;
}
return $strings;
}

	if(!count($strings))
{
return $original;
}
return $strings;
}





/**
* Fetch an IPv4 long formatted range for searching IPv4 IP addresses.
*

/**
* Fetch an IPv4 long formatted range for searching IPv4 IP addresses.
*

Zeile 5103Zeile 5288
function fetch_longipv4_range($ip)
{
$ip_bits = explode(".", $ip);

function fetch_longipv4_range($ip)
{
$ip_bits = explode(".", $ip);

 
	$ip_string1 = $ip_string2 = "";





	if($ip == "*") return array(ip2long(0), ip2long(255));




	if($ip == "*")
{
return array(ip2long('0.0.0.0'), ip2long('255.255.255.255'));
}


if(strpos($ip, ".*") === false)
{


if(strpos($ip, ".*") === false)
{

Zeile 5121Zeile 5310
	// Wildcard based IP provided
else
{

	// Wildcard based IP provided
else
{

 
		$sep = "";

		foreach($ip_bits as $piece)
{
if($piece == "*")
{

		foreach($ip_bits as $piece)
{
if($piece == "*")
{

				return array(ip2long($ip_string."0"), ip2long($ip_string."255"));


				$ip_string1 .= $sep."0";
$ip_string2 .= $sep."255";

			}
else
{

			}
else
{

				$ip_string .= $piece.".";


				$ip_string1 .= $sep.$piece;
$ip_string2 .= $sep.$piece;

			}

			}

 
			$sep = ".";

		}

		}

 
		return array(ip2long($ip_string1), ip2long($ip_string2));

	}
}


	}
}


Zeile 5200Zeile 5394
function expire_warnings()
{
global $db;

function expire_warnings()
{
global $db;

 
	
$users = array();


	$query = $db->query("
SELECT w.wid, w.uid, w.points, u.warningpoints
FROM ".TABLE_PREFIX."warnings w

	$query = $db->query("
SELECT w.wid, w.uid, w.points, u.warningpoints
FROM ".TABLE_PREFIX."warnings w

Zeile 5212Zeile 5409
			"expired" => 1
);
$db->update_query("warnings", $updated_warning, "wid='{$warning['wid']}'");

			"expired" => 1
);
$db->update_query("warnings", $updated_warning, "wid='{$warning['wid']}'");

		$warning['warningpoints'] -= $warning['points'];
if($warning['warningpoints'] < 0)













		
if(array_key_exists($warning['uid'], $users))
{
$users[$warning['uid']] -= $warning['points'];
}
else
{
$users[$warning['uid']] = $warning['warningpoints']-$warning['points'];
}
}

foreach($users as $uid => $warningpoints)
{
if($warningpoints < 0)

		{

		{

			$warning['warningpoints'] = 0;

			$warningpoints = 0;

		}

		}

 
		

		$updated_user = array(

		$updated_user = array(

			"warningpoints" => intval($warning['warningpoints'])

			"warningpoints" => intval($warningpoints)

		);

		);

		$db->update_query("users", $updated_user, "uid='{$warning['uid']}'");

		$db->update_query("users", $updated_user, "uid='".intval($uid)."'");

	}
}


	}
}


Zeile 5243Zeile 5453
    elseif($c <= 0xFFFF)
{
return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)

    elseif($c <= 0xFFFF)
{
return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)

                                    . chr(0x80 | $c & 0x3F);

                                    . chr(0x80 | $c & 0x3F);

    }
elseif($c <= 0x10FFFF)
{

    }
elseif($c <= 0x10FFFF)
{

Zeile 5262Zeile 5472
 *
* @param string The file to chmod
* @param string The mode to chmod(i.e. 0666)

 *
* @param string The file to chmod
* @param string The mode to chmod(i.e. 0666)

 */

 */

function my_chmod($file, $mode)
{
// Passing $mode as an octal number causes strlen and substr to return incorrect values. Instead pass as a string

function my_chmod($file, $mode)
{
// Passing $mode as an octal number causes strlen and substr to return incorrect values. Instead pass as a string

Zeile 5271Zeile 5481
		return false;
}
$old_umask = umask(0);

		return false;
}
$old_umask = umask(0);

	

	

	// We convert the octal string to a decimal number because passing a octal string doesn't work with chmod
// and type casting subsequently removes the prepended 0 which is needed for octal numbers
$result = chmod($file, octdec($mode));

	// We convert the octal string to a decimal number because passing a octal string doesn't work with chmod
// and type casting subsequently removes the prepended 0 which is needed for octal numbers
$result = chmod($file, octdec($mode));

Zeile 5290Zeile 5500
	global $orig_dir;

if(!isset($orig_dir))

	global $orig_dir;

if(!isset($orig_dir))

	{

	{

		$orig_dir = $path;
}


		$orig_dir = $path;
}


Zeile 5318Zeile 5528
    }

return @unlink($path);

    }

return @unlink($path);

 
}

/**
* Counts the number of subforums in a array([pid][disporder][fid]) starting from the pid
*
* @param array The array of forums
* @return integer The number of sub forums
*/
function subforums_count($array)
{
$count = 0;
foreach($array as $array2)
{
$count += count($array2);
}

return $count;

}

?>

}

?>