Vergleich inc/functions.php - 1.6.6 - 1.6.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: functions.php 5639 2011-10-26 09:16:47Z Tomm $

 * $Id: functions.php 5765 2012-03-27 09:52:45Z Tomm $

 */

/**

 */

/**

Zeile 92Zeile 92
	echo $contents;

$plugins->run_hooks("post_output_page");

	echo $contents;

$plugins->run_hooks("post_output_page");


// If the use shutdown functionality is turned off, run any shutdown related items now.
if($mybb->settings['useshutdownfunc'] == 0 && $mybb->use_shutdown != true)
{
run_shutdown();
}

 
}

/**

}

/**

Zeile 108Zeile 102
 * @return boolean True if function exists, otherwise false.
*/
function add_shutdown($name, $arguments=array())

 * @return boolean True if function exists, otherwise false.
*/
function add_shutdown($name, $arguments=array())

{

{

	global $shutdown_functions;

if(!is_array($arguments))

	global $shutdown_functions;

if(!is_array($arguments))

Zeile 129Zeile 123

return false;
}


return false;
}





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

Zeile 139Zeile 133
	global $config, $db, $cache, $plugins, $error_handler, $shutdown_functions, $shutdown_queries, $done_shutdown, $mybb;

if($done_shutdown == true || !$config || $error_handler->has_errors)

	global $config, $db, $cache, $plugins, $error_handler, $shutdown_functions, $shutdown_queries, $done_shutdown, $mybb;

if($done_shutdown == true || !$config || $error_handler->has_errors)

	{

	{

		return;
}


		return;
}


Zeile 170Zeile 164
			{
case "sqlite":
$db = new DB_SQLite;

			{
case "sqlite":
$db = new DB_SQLite;

					break;

					break;

				case "pgsql":
$db = new DB_PgSQL;

				case "pgsql":
$db = new DB_PgSQL;

					break;

					break;

				case "mysqli":
$db = new DB_MySQLi;
break;
default:
$db = new DB_MySQL;

				case "mysqli":
$db = new DB_MySQLi;
break;
default:
$db = new DB_MySQL;

			}


			}


			
$db->connect($config['database']);
define("TABLE_PREFIX", $config['database']['table_prefix']);

			
$db->connect($config['database']);
define("TABLE_PREFIX", $config['database']['table_prefix']);

Zeile 220Zeile 214
		foreach($shutdown_functions as $function)
{
call_user_func_array($function['function'], $function['arguments']);

		foreach($shutdown_functions as $function)
{
call_user_func_array($function['function'], $function['arguments']);

		}

		}

	}

$done_shutdown = true;

	}

$done_shutdown = true;

Zeile 262Zeile 256
	}

$plugins->run_hooks("send_mail_queue_end");

	}

$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 284Zeile 278
	else
{
$contents = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n".$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);


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


Zeile 305Zeile 299
	
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 346Zeile 340

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


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

		{

		{

			++$offset;
if(my_substr($offset, 0, 1) != "-")
{

			++$offset;
if(my_substr($offset, 0, 1) != "-")
{

Zeile 509Zeile 503
	else
{
return true;

	else
{
return true;

	}
}


	}
}


/**
* Return a parent list for the specified forum.
*

/**
* Return a parent list for the specified forum.
*

Zeile 522Zeile 516
{
global $forum_cache;
static $forumarraycache;

{
global $forum_cache;
static $forumarraycache;





	if($forumarraycache[$fid])

	if($forumarraycache[$fid])

	{

	{

		return $forumarraycache[$fid]['parentlist'];

		return $forumarraycache[$fid]['parentlist'];

	}

	}

	elseif($forum_cache[$fid])

	elseif($forum_cache[$fid])

	{

	{

		return $forum_cache[$fid]['parentlist'];
}
else

		return $forum_cache[$fid]['parentlist'];
}
else

	{

	{

		cache_forums();
return $forum_cache[$fid]['parentlist'];
}

		cache_forums();
return $forum_cache[$fid]['parentlist'];
}

Zeile 552Zeile 546
	if(!$parentlist)
{
$parentlist = get_parent_list($fid);

	if(!$parentlist)
{
$parentlist = get_parent_list($fid);

	}


	}


	$parentsexploded = explode(",", $parentlist);
$builtlist = "(";
$sep = '';

	$parentsexploded = explode(",", $parentlist);
$builtlist = "(";
$sep = '';

Zeile 562Zeile 556
	{
$builtlist .= "$sep$column='$val'";
$sep = " $joiner ";

	{
$builtlist .= "$sep$column='$val'";
$sep = " $joiner ";

	}


	}


	$builtlist .= ")";

return $builtlist;

	$builtlist .= ")";

return $builtlist;

Zeile 594Zeile 588
		}
}
return $forum_cache;

		}
}
return $forum_cache;

}

}


/**
* Generate an array of all child and descendant forums for a specific forum.


/**
* Generate an array of all child and descendant forums for a specific forum.

Zeile 750Zeile 744
	else
{
// Redirect to where the user came from

	else
{
// Redirect to where the user came from

		if($_SERVER['HTTP_REFERER'])


		$redirect_url = $_SERVER['PHP_SELF'];
if($_SERVER['QUERY_STRING'])

		{

		{

			$redirect_url = htmlentities($_SERVER['HTTP_REFERER']);

			$redirect_url .= '?'.$_SERVER['QUERY_STRING'];

		}

		}

		else





$redirect_url = htmlspecialchars_uni($redirect_url);

switch($mybb->settings['username_method'])

		{

		{

			$redirect_url = '';












			case 0:
$lang_username = $lang->username;
break;
case 1:
$lang_username = $lang->username1;
break;
case 2:
$lang_username = $lang->username2;
break;
default:
$lang_username = $lang->username;
break;

		}

		}

		

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

error($errorpage);

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

error($errorpage);

}

}


/**
* Redirect the user to a given URL with a given message


/**
* Redirect the user to a given URL with a given message

Zeile 930Zeile 938
	}

if($to < $pages)

	}

if($to < $pages)

	{

	{

		if($to+1 == $pages)
{
$lang->multipage_link_end = '';

		if($to+1 == $pages)
{
$lang->multipage_link_end = '';

Zeile 981Zeile 989
		return $url;
}
else if(strpos($url, "{page}") === false)

		return $url;
}
else if(strpos($url, "{page}") === false)

	{

	{

		// If no page identifier is specified we tack it on to the end of the URL
if(strpos($url, "?") === false)
{

		// If no page identifier is specified we tack it on to the end of the URL
if(strpos($url, "?") === false)
{

Zeile 1013Zeile 1021
	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 1025Zeile 1033
		if($user_cache[$uid]['permissions'])
{
return $user_cache[$uid]['permissions'];

		if($user_cache[$uid]['permissions'])
{
return $user_cache[$uid]['permissions'];

		}

		}


// This user was not already cached, fetch their user information.
if(!$user_cache[$uid])


// This user was not already cached, fetch their user information.
if(!$user_cache[$uid])

Zeile 1077Zeile 1085
		{
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 1087Zeile 1095
					$permbit = $usergroup[$perm];
}
else

					$permbit = $usergroup[$perm];
}
else

				{

				{

					$permbit = "";
}


					$permbit = "";
}


Zeile 1097Zeile 1105
					$usergroup[$perm] = 0;
continue;
}

					$usergroup[$perm] = 0;
continue;
}





				if($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) // Keep yes/no for compatibility?
{
$usergroup[$perm] = $access;

				if($access > $permbit || ($access == "yes" && $permbit == "no") || !$permbit) // Keep yes/no for compatibility?
{
$usergroup[$perm] = $access;

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

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

{

{

	global $cache, $groupscache, $displaygroupfields;

	global $cache, $groupscache, $displaygroupfields;





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

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





	$displaygroup = array();
$group = $groupscache[$gid];

	$displaygroup = array();
$group = $groupscache[$gid];





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

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

Zeile 1155Zeile 1163
	if(!$gid || $gid == 0) // If no group, we need to fetch it
{
if($uid != 0 && $uid != $mybb->user['uid'])

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

		{

		{

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

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

Zeile 1175Zeile 1183
			}

$groupperms = $mybb->usergroup;

			}

$groupperms = $mybb->usergroup;

		}
}

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

		}
}

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


if(!$forum_cache)
{


if(!$forum_cache)
{

Zeile 1191Zeile 1199
	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
{

Zeile 1233Zeile 1241
	{
return $groupperms;
}

	{
return $groupperms;
}

	

	

	$current_permissions = array();
$only_view_own_threads = 1;


	$current_permissions = array();
$only_view_own_threads = 1;


Zeile 1264Zeile 1272
					{
$level_permissions = $groupscache[$gid];
}

					{
$level_permissions = $groupscache[$gid];
}

				}

				}

			}

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

			}

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

Zeile 1430Zeile 1438
		foreach($extra_groups as $extra_group)
{
$groups[] = $extra_group;

		foreach($extra_groups as $extra_group)
{
$groups[] = $extra_group;

		}

		}

	}

$mod_cache = $cache->read("moderators");

	}

$mod_cache = $cache->read("moderators");

Zeile 1447Zeile 1455
		if(is_array($forum['users'][$uid]))
{
$perm = $forum['users'][$uid];

		if(is_array($forum['users'][$uid]))
{
$perm = $forum['users'][$uid];

			foreach($perm as $action => $value)
{
if(strpos($action, "can") === false)
{

			foreach($perm as $action => $value)
{
if(strpos($action, "can") === false)
{

					continue;
}


					continue;
}


Zeile 1470Zeile 1478
		foreach($groups as $group)
{
if(!is_array($forum['usergroups'][$group]))

		foreach($groups as $group)
{
if(!is_array($forum['usergroups'][$group]))

			{

			{

				// There are no permissions set for this group
continue;
}

				// There are no permissions set for this group
continue;
}

Zeile 1511Zeile 1519
	}

if($uid == 0)

	}

if($uid == 0)

	{
return false;
}


	{
return false;
}


	$user_perms = user_permissions($uid);
if($user_perms['issupermod'] == 1)
{

	$user_perms = user_permissions($uid);
if($user_perms['issupermod'] == 1)
{

Zeile 1678Zeile 1686
	$mybb->cookies[$name] = $value;

header($cookie, false);

	$mybb->cookies[$name] = $value;

header($cookie, false);

}

/**

}

/**

 * Unset a cookie set by MyBB.
*
* @param string The cookie identifier.
*/
function my_unsetcookie($name)

 * Unset a cookie set by MyBB.
*
* @param string The cookie identifier.
*/
function my_unsetcookie($name)

{
global $mybb;


{
global $mybb;


	$expires = -3600;
my_setcookie($name, "", $expires);


	$expires = -3600;
my_setcookie($name, "", $expires);


Zeile 1703Zeile 1711
 * @return array|boolean The cookie id's content array or false when non-existent.
*/
function my_get_array_cookie($name, $id)

 * @return array|boolean The cookie id's content array or false when non-existent.
*/
function my_get_array_cookie($name, $id)

{
global $mybb;

{
global $mybb;

	
if(!isset($mybb->cookies['mybb'][$name]))
{
return false;
}


	
if(!isset($mybb->cookies['mybb'][$name]))
{
return false;
}


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

	$cookie = my_unserialize($mybb->cookies['mybb'][$name]);


if(is_array($cookie) && isset($cookie[$id]))
{


if(is_array($cookie) && isset($cookie[$id]))
{

Zeile 1720Zeile 1728
	else
{
return 0;

	else
{
return 0;

	}
}

	}
}


/**
* Set a serialised cookie array.


/**
* Set a serialised cookie array.

Zeile 1729Zeile 1737
 * @param string The cookie identifier.
* @param int The cookie content id.
* @param string The value to set the cookie to.

 * @param string The cookie identifier.
* @param int The cookie content id.
* @param string The value to set the cookie to.

 */

 */

function my_set_array_cookie($name, $id, $value, $expires="")
{
global $mybb;

$cookie = $mybb->cookies['mybb'];

function my_set_array_cookie($name, $id, $value, $expires="")
{
global $mybb;

$cookie = $mybb->cookies['mybb'];

	$newcookie = unserialize($cookie[$name]);

if(!is_array($newcookie))
{
// Burnt / malformed cookie - reset
$newcookie = array();
}

	$newcookie = my_unserialize($cookie[$name]);








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


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

	



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

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

 

/**
* Verifies that data passed is an array
*
* @param array Data to unserialize
* @return array Unserialized data array
*/
function my_unserialize($data)
{
$array = unserialize($data);

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

return $array;
}


/**
* Returns the serverload of the system.


/**
* Returns the serverload of the system.

Zeile 1852Zeile 1872
			if($new_stats[$counter] < 0)
{
$new_stats[$counter] = 0;

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

			}

			}

		}
}


		}
}


Zeile 1863Zeile 1883
		$lastmember = $db->fetch_array($query);
$new_stats['lastuid'] = $lastmember['uid'];
$new_stats['lastusername'] = $lastmember['username'];

		$lastmember = $db->fetch_array($query);
$new_stats['lastuid'] = $lastmember['uid'];
$new_stats['lastusername'] = $lastmember['username'];

	}

	}

	
if(empty($new_stats))

	
if(empty($new_stats))

	{

	{

		return;
}

if(is_array($stats))
{
$stats = array_merge($stats, $new_stats);

		return;
}

if(is_array($stats))
{
$stats = array_merge($stats, $new_stats);

	}

	}

	else
{
$stats = $new_stats;

	else
{
$stats = $new_stats;

Zeile 1904Zeile 1924
	$update_query = array();

$counters = array('threads','unapprovedthreads','posts','unapprovedposts');

	$update_query = array();

$counters = array('threads','unapprovedthreads','posts','unapprovedposts');





	// Fetch above counters for this forum
$query = $db->simple_select("forums", implode(",", $counters), "fid='{$fid}'");
$forum = $db->fetch_array($query);

	// Fetch above counters for this forum
$query = $db->simple_select("forums", implode(",", $counters), "fid='{$fid}'");
$forum = $db->fetch_array($query);

Zeile 1915Zeile 1935
		{
// Adding or subtracting from previous value?
if(substr($changes[$counter], 0, 1) == "+" || substr($changes[$counter], 0, 1) == "-")

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

			{

			{

				$update_query[$counter] = $forum[$counter] + $changes[$counter];
}
else

				$update_query[$counter] = $forum[$counter] + $changes[$counter];
}
else

Zeile 1935Zeile 1955
	if(count($update_query) > 0)
{
$db->update_query("forums", $update_query, "fid='".intval($fid)."'");

	if(count($update_query) > 0)
{
$db->update_query("forums", $update_query, "fid='".intval($fid)."'");

	}

	}


// Guess we should update the statistics too?
if(isset($update_query['threads']) || isset($update_query['posts']) || isset($update_query['unapprovedthreads']) || isset($update_query['unapprovedposts']))


// Guess we should update the statistics too?
if(isset($update_query['threads']) || isset($update_query['posts']) || isset($update_query['unapprovedthreads']) || isset($update_query['unapprovedposts']))

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

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

			}

			}

		}

if(array_key_exists('unapprovedposts', $update_query))

		}

if(array_key_exists('unapprovedposts', $update_query))

Zeile 2018Zeile 2038
		ORDER BY lastpost DESC
LIMIT 0, 1
");

		ORDER BY lastpost DESC
LIMIT 0, 1
");

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

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


$updated_forum = array(
"lastpost" => intval($lastpost['lastpost']),


$updated_forum = array(
"lastpost" => intval($lastpost['lastpost']),

Zeile 2029Zeile 2049
	);

$db->update_query("forums", $updated_forum, "fid='{$fid}'");

	);

$db->update_query("forums", $updated_forum, "fid='{$fid}'");

}

}


/**
* Updates the thread counters with a specific value (or addition/subtraction of the previous value)


/**
* Updates the thread counters with a specific value (or addition/subtraction of the previous value)

Zeile 2038Zeile 2058
 * @param array Array of items being updated (replies, unapprovedposts, attachmentcount) and their value (ex, 1, +1, -1)
*/
function update_thread_counters($tid, $changes=array())

 * @param array Array of items being updated (replies, unapprovedposts, attachmentcount) and their value (ex, 1, +1, -1)
*/
function update_thread_counters($tid, $changes=array())

{
global $db;

{
global $db;


$update_query = array();



$update_query = array();


	$counters = array('replies','unapprovedposts','attachmentcount', 'attachmentcount');


	$counters = array('replies','unapprovedposts','attachmentcount', 'attachmentcount');


	// Fetch above counters for this thread
$query = $db->simple_select("threads", implode(",", $counters), "tid='{$tid}'");
$thread = $db->fetch_array($query);

foreach($counters as $counter)

	// Fetch above counters for this thread
$query = $db->simple_select("threads", implode(",", $counters), "tid='{$tid}'");
$thread = $db->fetch_array($query);

foreach($counters as $counter)

	{

	{

		if(array_key_exists($counter, $changes))
{
// Adding or subtracting from previous value?

		if(array_key_exists($counter, $changes))
{
// Adding or subtracting from previous value?

Zeile 2069Zeile 2089
				$update_query[$counter] = 0;
}
}

				$update_query[$counter] = 0;
}
}

	}


	}


	$db->free_result($query);

// Only update if we're actually doing something

	$db->free_result($query);

// Only update if we're actually doing something

Zeile 2092Zeile 2112
function update_thread_data($tid)
{
global $db;

function update_thread_data($tid)
{
global $db;

 

$thread = get_thread($tid);

// If this is a moved thread marker, don't update it - we need it to stay as it is
if(strpos($thread['closed'], 'moved|') !== false)
{
return false;
}


	$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 2101Zeile 2130
		LIMIT 1"
);
$lastpost = $db->fetch_array($query);

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

	

	

	$db->free_result($query);

$query = $db->query("

	$db->free_result($query);

$query = $db->query("

Zeile 2122Zeile 2151
	}

if(!$lastpost['username'])

	}

if(!$lastpost['username'])

	{

	{

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

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

	}


	}


	if(!$lastpost['dateline'])
{
$lastpost['username'] = $firstpost['username'];
$lastpost['uid'] = $firstpost['uid'];
$lastpost['dateline'] = $firstpost['dateline'];

	if(!$lastpost['dateline'])
{
$lastpost['username'] = $firstpost['username'];
$lastpost['uid'] = $firstpost['uid'];
$lastpost['dateline'] = $firstpost['dateline'];

	}


	}


	$lastpost['username'] = $db->escape_string($lastpost['username']);
$firstpost['username'] = $db->escape_string($firstpost['username']);


	$lastpost['username'] = $db->escape_string($lastpost['username']);
$firstpost['username'] = $db->escape_string($firstpost['username']);


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

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

 */

 */

function delete_post($pid, $tid="")
{
global $moderation;

function delete_post($pid, $tid="")
{
global $moderation;

Zeile 2433Zeile 2462
			$editor_language .= "\t{$js_lang_string}: \"{$string}\"";

if($editor_lang_strings[$key+1])

			$editor_language .= "\t{$js_lang_string}: \"{$string}\"";

if($editor_lang_strings[$key+1])

			{

			{

				$editor_language .= ",";
}

				$editor_language .= ",";
}





			$editor_language .= "\n";
}

			$editor_language .= "\n";
}





		$editor_language .= "};";

if(defined("IN_ADMINCP"))

		$editor_language .= "};";

if(defined("IN_ADMINCP"))

		{

		{

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

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

Zeile 2515Zeile 2544
					if($counter == 0)
{
$smilies .= "<tr>\n";

					if($counter == 0)
{
$smilies .= "<tr>\n";

					}


					}


					$find = htmlspecialchars_uni($find);
$smilies .= "<td style=\"text-align: center\"><img src=\"{$image}\" border=\"0\" class=\"smilie\" alt=\"{$find}\" /></td>\n";
++$i;

					$find = htmlspecialchars_uni($find);
$smilies .= "<td style=\"text-align: center\"><img src=\"{$image}\" border=\"0\" class=\"smilie\" alt=\"{$find}\" /></td>\n";
++$i;

Zeile 2535Zeile 2564
				$colspan = $mybb->settings['smilieinsertercols'] - $counter;
$smilies .= "<td colspan=\"{$colspan}\">&nbsp;</td>\n</tr>\n";
}

				$colspan = $mybb->settings['smilieinsertercols'] - $counter;
$smilies .= "<td colspan=\"{$colspan}\">&nbsp;</td>\n</tr>\n";
}





			eval("\$clickablesmilies = \"".$templates->get("smilieinsert")."\";");

			eval("\$clickablesmilies = \"".$templates->get("smilieinsert")."\";");

		}

		}

		else
{
$clickablesmilies = "";

		else
{
$clickablesmilies = "";

Zeile 2546Zeile 2575
	else
{
$clickablesmilies = "";

	else
{
$clickablesmilies = "";

	}

	}


return $clickablesmilies;
}


return $clickablesmilies;
}

Zeile 2587Zeile 2616

$prefixes_cache = array();
foreach($prefix_cache as $prefix)


$prefixes_cache = array();
foreach($prefix_cache as $prefix)

	{

	{

		$prefixes_cache[$prefix['pid']] = $prefix;

		$prefixes_cache[$prefix['pid']] = $prefix;

	}


	}


	if($pid != 0 && is_array($prefixes_cache[$pid]))

	if($pid != 0 && is_array($prefixes_cache[$pid]))

	{

	{

		return $prefixes_cache[$pid];

		return $prefixes_cache[$pid];

	}

	}

	else if(!empty($prefixes_cache))
{
return $prefixes_cache;

	else if(!empty($prefixes_cache))
{
return $prefixes_cache;

	}


	}


	return false;
}


	return false;
}


Zeile 2631Zeile 2660
		$exp = explode(",", $mybb->user['additionalgroups']);

foreach($exp as $group)

		$exp = explode(",", $mybb->user['additionalgroups']);

foreach($exp as $group)

		{

		{

			$groups[] = $group;
}
}

			$groups[] = $group;
}
}

Zeile 2641Zeile 2670
	foreach($prefix_cache as $prefix)
{
if($fid != "all" && $prefix['forums'] != "-1")

	foreach($prefix_cache as $prefix)
{
if($fid != "all" && $prefix['forums'] != "-1")

		{

		{

			// Decide whether this prefix can be used in our forum
$forums = explode(",", $prefix['forums']);

			// Decide whether this prefix can be used in our forum
$forums = explode(",", $prefix['forums']);





			if(!in_array($fid, $forums))
{
// This prefix is not in our forum list
continue;

			if(!in_array($fid, $forums))
{
// This prefix is not in our forum list
continue;

			}
}


			}
}


		if($prefix['groups'] != "-1")
{
$prefix_groups = explode(",", $prefix['groups']);

		if($prefix['groups'] != "-1")
{
$prefix_groups = explode(",", $prefix['groups']);

Zeile 2682Zeile 2711
	if($multiple != 0)
{
$multipleselect = " multiple=\"multiple\" size=\"5\"";

	if($multiple != 0)
{
$multipleselect = " multiple=\"multiple\" size=\"5\"";

	}


	}


	$prefixselect = "<select name=\"threadprefix\"{$multipleselect}>\n";

	$prefixselect = "<select name=\"threadprefix\"{$multipleselect}>\n";





	if($multiple == 1)
{
$any_selected = "";
if($selected_pid == 'any')
{
$any_selected = " selected=\"selected\"";

	if($multiple == 1)
{
$any_selected = "";
if($selected_pid == 'any')
{
$any_selected = " selected=\"selected\"";

		}


		}


		$prefixselect .= "<option value=\"any\"".$any_selected.">".$lang->any_prefix."</option>\n";
}


		$prefixselect .= "<option value=\"any\"".$any_selected.">".$lang->any_prefix."</option>\n";
}


Zeile 2714Zeile 2743
		}

$prefixselect .= "<option value=\"".$prefix['pid']."\"".$selected.">".htmlspecialchars_uni($prefix['prefix'])."</option>\n";

		}

$prefixselect .= "<option value=\"".$prefix['pid']."\"".$selected.">".htmlspecialchars_uni($prefix['prefix'])."</option>\n";

	}

	}


$prefixselect .= "</select>\n&nbsp;";



$prefixselect .= "</select>\n&nbsp;";


Zeile 2745Zeile 2774
		}

if(my_strpos(" ".$httpaccept_encoding, "gzip"))

		}

if(my_strpos(" ".$httpaccept_encoding, "gzip"))

		{

		{

			$encoding = "gzip";
}


			$encoding = "gzip";
}


Zeile 2766Zeile 2795
				$gzdata .= pack("V", $crc);
$gzdata .= pack("V", $size);
$contents = $gzdata;

				$gzdata .= pack("V", $crc);
$gzdata .= pack("V", $size);
$contents = $gzdata;

			}
}
}

			}
}
}


return $contents;
}


return $contents;
}

Zeile 2834Zeile 2863
function get_reputation($reputation, $uid=0)
{
global $theme;

function get_reputation($reputation, $uid=0)
{
global $theme;





	if($uid != 0)

	if($uid != 0)

	{

	{

		$display_reputation = "<a href=\"reputation.php?uid={$uid}\">";

		$display_reputation = "<a href=\"reputation.php?uid={$uid}\">";

	}

$display_reputation .= "<strong class=\"";


	}

$display_reputation .= "<strong class=\"";


	if($reputation < 0)

	if($reputation < 0)

	{

	{

		$display_reputation .= "reputation_negative";

		$display_reputation .= "reputation_negative";

	}

	}

	elseif($reputation > 0)
{
$display_reputation .= "reputation_positive";

	elseif($reputation > 0)
{
$display_reputation .= "reputation_positive";

Zeile 2853Zeile 2882
	else
{
$display_reputation .= "reputation_neutral";

	else
{
$display_reputation .= "reputation_neutral";

	}

$display_reputation .= "\">{$reputation}</strong>";


	}

$display_reputation .= "\">{$reputation}</strong>";


	if($uid != 0)
{
$display_reputation .= "</a>";

	if($uid != 0)
{
$display_reputation .= "</a>";

Zeile 2878Zeile 2907
		return "<span class=\"high_warning\">{$level}%</span>";
}
else if($level >= 50)

		return "<span class=\"high_warning\">{$level}%</span>";
}
else if($level >= 50)

	{

	{

		return "<span class=\"moderate_warning\">{$level}%</span>";
}
else if($level >= 25)

		return "<span class=\"moderate_warning\">{$level}%</span>";
}
else if($level >= 25)

Zeile 2941Zeile 2970

if($plugins)
{


if($plugins)
{

        $plugins->run_hooks("get_ip", array("ip" => $ip));


    	$ip_array = array("ip" => &$ip); // Used for backwards compatibility on this hook with the updated run_hooks() function.
$plugins->run_hooks("get_ip", $ip_array);

    }

return $ip;

    }

return $ip;

} 

}


/**
* Fetch the friendly size (GB, MB, KB, B) for a specified file size.


/**
* Fetch the friendly size (GB, MB, KB, B) for a specified file size.

Zeile 4100Zeile 4130
	}

if($use_iconv || $use_mb)

	}

if($use_iconv || $use_mb)

	{
if($to)
{

	{
if($to)
{

			$from_charset = $lang->settings['charset'];
$to_charset = "UTF-8";
}

			$from_charset = $lang->settings['charset'];
$to_charset = "UTF-8";
}

Zeile 5287Zeile 5317
		}

// Now make PREG compatible

		}

// Now make PREG compatible

		$find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#i";

		$find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#ui";

		$replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>";
$highlight_cache[$find] = $replacement;
}

		$replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>";
$highlight_cache[$find] = $replacement;
}

Zeile 5382Zeile 5412

$banned_cache = $cache->read("bannedemails");



$banned_cache = $cache->read("bannedemails");


	if(!$banned_cache)

	if($banned_cache === false)

	{

	{

 
		// Failed to read cache, see if we can rebuild it

		$cache->update_bannedemails();
$banned_cache = $cache->read("bannedemails");
}


		$cache->update_bannedemails();
$banned_cache = $cache->read("bannedemails");
}


	foreach($banned_cache as $banned_email)

	if(is_array($banned_cache) && !empty($banned_cache))

	{

	{

		// 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)
{
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'");
}
return true;




		foreach($banned_cache as $banned_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)
{
$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'");
}
return true;
}

		}
}

		}
}

 


	// Still here - good email
return false;
}

	// Still here - good email
return false;
}

Zeile 5417Zeile 5452
function is_banned_ip($ip_address, $update_lastuse=false)
{
global $db, $cache;

function is_banned_ip($ip_address, $update_lastuse=false)
{
global $db, $cache;

	

	

	$banned_ips = $cache->read("bannedips");
if(!is_array($banned_ips))
{

	$banned_ips = $cache->read("bannedips");
if(!is_array($banned_ips))
{

Zeile 5429Zeile 5464
		if(!$banned_ip['filter'])
{
continue;

		if(!$banned_ip['filter'])
{
continue;

		}

		}

		
// Make regular expression * match
$banned_ip['filter'] = str_replace('\*', '(.*)', preg_quote($banned_ip['filter'], '#'));

		
// Make regular expression * match
$banned_ip['filter'] = str_replace('\*', '(.*)', preg_quote($banned_ip['filter'], '#'));

		if(preg_match("#{$banned_ip['filter']}#i", $ip_address))

		if(preg_match("#^{$banned_ip['filter']}$#i", $ip_address))

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

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

Zeile 5443Zeile 5478
			return true;
}
}

			return true;
}
}

 


	// Still here - good ip
return false;
}

	// Still here - good ip
return false;
}