Vergleich inc/functions.php - 1.6.2 - 1.6.5

  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 5172 2010-08-02 23:13:03Z RyanGordon $

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

 */

/**

 */

/**

Zeile 197Zeile 197
	}

// And finally.. plugins

	}

// And finally.. plugins

	if(!is_object($plugins) && !defined("NO_PLUGINS"))

	if(!is_object($plugins) && !defined("NO_PLUGINS") && !($mybb->settings['no_plugins'] == 1))

	{
require_once MYBB_ROOT."inc/class_plugins.php";
$plugins = new pluginSystem;

	{
require_once MYBB_ROOT."inc/class_plugins.php";
$plugins = new pluginSystem;

Zeile 246Zeile 246

// Fetch emails for this page view - and send them
$query = $db->simple_select("mailqueue", "*", "", array("order_by" => "mid", "order_dir" => "asc", "limit_start" => 0, "limit" => $count));


// Fetch emails for this page view - and send them
$query = $db->simple_select("mailqueue", "*", "", array("order_by" => "mid", "order_dir" => "asc", "limit_start" => 0, "limit" => $count));


$plugins->run_hooks_by_ref("send_mail_queue_mail", $query);

 

while($email = $db->fetch_array($query))
{
// Delete the message from the queue
$db->delete_query("mailqueue", "mid='{$email['mid']}'");



while($email = $db->fetch_array($query))
{
// Delete the message from the queue
$db->delete_query("mailqueue", "mid='{$email['mid']}'");


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




			if($db->affected_rows() == 1)
{
my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers']);
}

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

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

Zeile 395Zeile 396

if(is_object($plugins))
{


if(is_object($plugins))
{

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

		$date = $plugins->run_hooks("my_date", $date);

	}

return $date;

	}

return $date;

Zeile 502Zeile 503
			else
{
error($lang->invalid_post_code);

			else
{
error($lang->invalid_post_code);

			}
}
}
else
{

			}
}
}
else
{

		return true;
}
}

		return true;
}
}

Zeile 527Zeile 528
		return $forumarraycache[$fid]['parentlist'];
}
elseif($forum_cache[$fid])

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

	{
return $forum_cache[$fid]['parentlist'];

	{
return $forum_cache[$fid]['parentlist'];

	}
else
{

	}
else
{

Zeile 549Zeile 550
function build_parent_list($fid, $column="fid", $joiner="OR", $parentlist="")
{
if(!$parentlist)

function build_parent_list($fid, $column="fid", $joiner="OR", $parentlist="")
{
if(!$parentlist)

	{

	{

		$parentlist = get_parent_list($fid);
}


		$parentlist = get_parent_list($fid);
}


Zeile 590Zeile 591
		{
$cache->update_forums();
$forum_cache = $cache->read("forums", 1);

		{
$cache->update_forums();
$forum_cache = $cache->read("forums", 1);

		}
}

		}
}

	return $forum_cache;
}


	return $forum_cache;
}


Zeile 644Zeile 645
{
global $header, $footer, $theme, $headerinclude, $db, $templates, $lang, $mybb, $plugins;


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


	$plugins->run_hooks_by_ref("error", $error);

	$error = $plugins->run_hooks("error", $error);

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

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

Zeile 732Zeile 733
	);

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

	);

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

	$url = htmlspecialchars_uni("http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);

 

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


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

Zeile 749Zeile 749
	}
else
{

	}
else
{

 
		// Redirect to where the user came from
if($_SERVER['HTTP_REFERER'])
{
$redirect_url = htmlentities($_SERVER['HTTP_REFERER']);
}
else
{
$redirect_url = '';
}


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


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


Zeile 764Zeile 774
function redirect($url, $message="", $title="")
{
global $header, $footer, $mybb, $theme, $headerinclude, $templates, $lang, $plugins;

function redirect($url, $message="", $title="")
{
global $header, $footer, $mybb, $theme, $headerinclude, $templates, $lang, $plugins;





	$redirect_args = array('url' => &$url, 'message' => &$message, 'title' => &$title);


	$redirect_args = array('url' => &$url, 'message' => &$message, 'title' => &$title);


	$plugins->run_hooks_by_ref("redirect", $redirect_args);

	$plugins->run_hooks("redirect", $redirect_args);


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


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

Zeile 787Zeile 797
	}

if(!$message)

	}

if(!$message)

	{

	{

		$message = $lang->redirect;

		$message = $lang->redirect;

	}


	}


	$time = TIME_NOW;
$timenow = my_date($mybb->settings['dateformat'], $time) . " " . my_date($mybb->settings['timeformat'], $time);

if(!$title)
{
$title = $mybb->settings['bbname'];

	$time = TIME_NOW;
$timenow = my_date($mybb->settings['dateformat'], $time) . " " . my_date($mybb->settings['timeformat'], $time);

if(!$title)
{
$title = $mybb->settings['bbname'];

	}


	}


	// Show redirects only if both ACP and UCP settings are enabled, or ACP is enabled, and user is a guest.
if($mybb->settings['redirects'] == 1 && ($mybb->user['showredirect'] != 0 || !$mybb->user['uid']))
{

	// Show redirects only if both ACP and UCP settings are enabled, or ACP is enabled, and user is a guest.
if($mybb->settings['redirects'] == 1 && ($mybb->user['showredirect'] != 0 || !$mybb->user['uid']))
{

Zeile 815Zeile 825

run_shutdown();



run_shutdown();


		if(my_substr($url, 0, 7) !== 'http://')

		if(my_substr($url, 0, 7) !== 'http://' && my_substr($url, 0, 8) !== 'https://')

		{
header("Location: {$mybb->settings['bburl']}/{$url}");
}

		{
header("Location: {$mybb->settings['bburl']}/{$url}");
}

Zeile 852Zeile 862
	$pages = ceil($count / $perpage);

if($page > 1)

	$pages = ceil($count / $perpage);

if($page > 1)

	{

	{

		$prev = $page-1;
$page_url = fetch_page_url($url, $prev);
eval("\$prevpage = \"".$templates->get("multipage_prevpage")."\";");

		$prev = $page-1;
$page_url = fetch_page_url($url, $prev);
eval("\$prevpage = \"".$templates->get("multipage_prevpage")."\";");

	}

	}


// Maximum number of "page bits" to show
if(!$mybb->settings['maxmultipagelinks'])
{
$mybb->settings['maxmultipagelinks'] = 5;


// Maximum number of "page bits" to show
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);





	if($from <= 0)
{
$from = 1;

	if($from <= 0)
{
$from = 1;

Zeile 874Zeile 884
	}

if($to > $pages)

	}

if($to > $pages)

	{

	{

		$to = $pages;
$from = $pages-$mybb->settings['maxmultipagelinks']+1;
if($from <= 0)

		$to = $pages;
$from = $pages-$mybb->settings['maxmultipagelinks']+1;
if($from <= 0)

Zeile 884Zeile 894
	}

if($to == 0)

	}

if($to == 0)

	{

	{

		$to = $pages;
}


		$to = $pages;
}


Zeile 916Zeile 926
		else
{
eval("\$mppage .= \"".$templates->get("multipage_page")."\";");

		else
{
eval("\$mppage .= \"".$templates->get("multipage_page")."\";");

		}

		}

	}

if($to < $pages)

	}

if($to < $pages)

Zeile 937Zeile 947
		eval("\$nextpage = \"".$templates->get("multipage_nextpage")."\";");
}
$lang->multipage_pages = $lang->sprintf($lang->multipage_pages, $pages);

		eval("\$nextpage = \"".$templates->get("multipage_nextpage")."\";");
}
$lang->multipage_pages = $lang->sprintf($lang->multipage_pages, $pages);

	

	

	if($breadcrumb == true)

	if($breadcrumb == true)

	{

	{

		eval("\$multipage = \"".$templates->get("multipage_breadcrumb")."\";");
}
else

		eval("\$multipage = \"".$templates->get("multipage_breadcrumb")."\";");
}
else

Zeile 948Zeile 958
	}

return $multipage;

	}

return $multipage;

}

}


/**
* Generate a page URL for use by the multipage function


/**
* Generate a page URL for use by the multipage function

Zeile 962Zeile 972
 	{
$find = array(
"-page-{page}",

 	{
$find = array(
"-page-{page}",

			"&amp;page={page}"


			"&amp;page={page}",
"{page}"

		);

// Remove "Page 1" to the defacto URL

		);

// Remove "Page 1" to the defacto URL

		$url = str_replace($find, array("", ""), $url);

		$url = str_replace($find, array("", "", $page), $url);

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

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

Zeile 982Zeile 993
		}

$url .= "page=$page";

		}

$url .= "page=$page";

	}

	}

	else
{
$url = str_replace("{page}", $page, $url);

	else
{
$url = str_replace("{page}", $page, $url);

Zeile 1014Zeile 1025
		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 1025Zeile 1036
		// Collect group permissions.
$gid = $user_cache[$uid]['usergroup'].",".$user_cache[$uid]['additionalgroups'];
$groupperms = usergroup_permissions($gid);

		// Collect group permissions.
$gid = $user_cache[$uid]['usergroup'].",".$user_cache[$uid]['additionalgroups'];
$groupperms = usergroup_permissions($gid);





		// Store group permissions in user cache.
$user_cache[$uid]['permissions'] = $groupperms;
return $groupperms;

		// Store group permissions in user cache.
$user_cache[$uid]['permissions'] = $groupperms;
return $groupperms;

Zeile 1224Zeile 1235
	}

$current_permissions = array();

	}

$current_permissions = array();

 
	$only_view_own_threads = 1;

	
foreach($groups as $gid)
{

	
foreach($groups as $gid)
{

Zeile 1262Zeile 1274
					$current_permissions[$permission] = $access;
}
}

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

		}
}













if(!$level_permissions["canonlyviewownthreads"])
{
$only_view_own_threads = 0;
}
}
}

// Figure out if we can view more than our own threads
if($only_view_own_threads == 0)
{
$current_permissions["canonlyviewownthreads"] = 0;
}


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


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

Zeile 1281Zeile 1304
function check_forum_password($fid, $pid=0)
{
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;

function check_forum_password($fid, $pid=0)
{
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;

	

	

	$showform = true;

if(!is_array($forum_cache))

	$showform = true;

if(!is_array($forum_cache))

Zeile 1371Zeile 1394
 */
function get_moderator_permissions($fid, $uid="0", $parentslist="")
{

 */
function get_moderator_permissions($fid, $uid="0", $parentslist="")
{

	global $mybb, $db;

	global $mybb, $cache, $db;

	static $modpermscache;

if($uid < 1)

	static $modpermscache;

if($uid < 1)

	{

	{

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

if($uid == 0)
{
return false;

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

if($uid == 0)
{
return false;

	}

if(!isset($modpermscache[$fid][$uid]))
{
if(!$parentslist)



















	}

if(isset($modpermscache[$fid][$uid]))
{
return $modpermscache[$fid][$uid];
}

if(!$parentslist)
{
$parentslist = explode(',', get_parent_list($fid));
}

// Get user groups
$perms = array();
$user = get_user($uid);

$groups = array($user['usergroup']);

if(!empty($user['additionalgroups']))
{
$extra_groups = explode(",", $user['additionalgroups']);

foreach($extra_groups as $extra_group)

		{

		{

			$parentslist = get_parent_list($fid);

			$groups[] = $extra_group;

		}

		}

		
// Get user groups
$query = $db->simple_select("users", "usergroup,additionalgroups", "uid='{$uid}'");
$usergroups = $db->fetch_array($query);
$groups = "'{$usergroups['usergroup']}'";
if(!empty($usergroups['additionalgroups']))


	}

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

foreach($mod_cache as $fid => $forum)
{
if(!is_array($forum) || !in_array($fid, $parentslist))

		{

		{

			$groups .= ",'{$usergroups['additionalgroups']}'";


























			// No perms or we're not after this forum
continue;
}

// User settings override usergroup settings
if(is_array($forum['users'][$uid]))
{
$perm = $forum['users'][$uid];
foreach($perm as $action => $value)
{
if(strpos($action, "can") === false)
{
continue;
}

// Figure out the user permissions
if($value == 0)
{
// The user doesn't have permission to set this action
$perms[$action] = 0;
}
else
{
$perms[$action] = max($perm[$action], $perms[$action]);
}
}

		}

		}

		
$query = $db->simple_select("moderators", "*", "((id IN ({$groups}) AND isgroup='1') OR (id='{$uid}' AND isgroup='0')) AND fid='$fid'");
while($results = $db->fetch_array($query))


foreach($groups as $group)


		{

		{

			$perms['caneditposts'] = max($perms['caneditposts'], $results['caneditposts']);
$perms['candeleteposts'] = max($perms['candeleteposts'], $results['candeleteposts']);
$perms['canviewips'] = max($perms['canviewips'], $results['canviewips']);
$perms['canopenclosethreads'] = max($perms['canopenclosethreads'], $results['canopenclosethreads']);
$perms['canmanagethreads'] = max($perms['canmanagethreads'], $results['canmanagethreads']);
$perms['canmovetononmodforum'] = max($perms['canmovetononmodforum'], $results['canmovetononmodforum']);











			if(!is_array($forum['usergroups'][$group]))
{
// There are no permissions set for this group
continue;
}

$perm = $forum['usergroups'][$group];
foreach($perm as $action => $value)
{
if(strpos($action, "can") === false)
{
continue;
}

$perms[$action] = max($perm[$action], $perms[$action]);
}

		}

		}

		
$sql = build_parent_list($fid, "fid", "OR", $parentslist);
$query = $db->simple_select("moderators", "*", "((id IN ({$groups}) AND isgroup='1') OR (id='{$uid}' AND isgroup='0')) AND {$sql}");
$uperms = $db->fetch_array($query);

if(!$uperms && !$perms)
{
return false;
}

//Join the group permissions with the user permissions
$perms['caneditposts'] = max($perms['caneditposts'], $uperms['caneditposts']);
$perms['candeleteposts'] = max($perms['candeleteposts'], $uperms['candeleteposts']);
$perms['canviewips'] = max($perms['canviewips'], $uperms['canviewips']);
$perms['canopenclosethreads'] = max($perms['canopenclosethreads'], $uperms['canopenclosethreads']);
$perms['canmanagethreads'] = max($perms['canmanagethreads'], $uperms['canmanagethreads']);
$perms['canmovetononmodforum'] = max($perms['canmovetononmodforum'], $uperms['canmovetononmodforum']);

$modpermscache[$fid][$uid] = $perms;
}
else
{
$perms = $modpermscache[$fid][$uid];

 
	}

	}

 

$modpermscache[$fid][$uid] = $perms;


return $perms;
}


return $perms;
}

Zeile 1537Zeile 1592
	
foreach($posticons as $dbicon)
{

	
foreach($posticons as $dbicon)
{

 
		$dbicon['path'] = htmlspecialchars_uni($dbicon['path']);
$dbicon['name'] = htmlspecialchars_uni($dbicon['name']);


		if($icon == $dbicon['iid'])
{
$iconlist .= "<label><input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\" checked=\"checked\" /> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\" /></label>";

		if($icon == $dbicon['iid'])
{
$iconlist .= "<label><input type=\"radio\" name=\"icon\" value=\"".$dbicon['iid']."\" checked=\"checked\" /> <img src=\"".$dbicon['path']."\" alt=\"".$dbicon['name']."\" /></label>";

Zeile 1556Zeile 1614
	}

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

	}

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





	return $posticons;
}


	return $posticons;
}


Zeile 1567Zeile 1625
 * @param string The cookie value.
* @param int The timestamp of the expiry date.
* @param boolean True if setting a HttpOnly cookie (supported by IE, Opera 9, Konqueror)

 * @param string The cookie value.
* @param int The timestamp of the expiry date.
* @param boolean True if setting a HttpOnly cookie (supported by IE, Opera 9, Konqueror)

 */

 */

function my_setcookie($name, $value="", $expires="", $httponly=false)
{
global $mybb;

function my_setcookie($name, $value="", $expires="", $httponly=false)
{
global $mybb;

Zeile 1618Zeile 1676
	}

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

	}

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





	header($cookie, false);
}


	header($cookie, false);
}


Zeile 1628Zeile 1686
 * @param string The cookie identifier.
*/
function my_unsetcookie($name)

 * @param string The cookie identifier.
*/
function my_unsetcookie($name)

{

{

	global $mybb;

$expires = -3600;

	global $mybb;

$expires = -3600;

Zeile 1649Zeile 1707
	global $mybb;

if(!isset($mybb->cookies['mybb'][$name]))

	global $mybb;

if(!isset($mybb->cookies['mybb'][$name]))

	{
return false;
}


	{
return false;
}


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

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

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

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

Zeile 1672Zeile 1730
 * @param int The cookie content id.
* @param string The value to set the cookie to.
*/

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

function my_set_array_cookie($name, $id, $value)

function my_set_array_cookie($name, $id, $value, $expires="")

{
global $mybb;


{
global $mybb;


Zeile 1687Zeile 1745

$newcookie[$id] = $value;
$newcookie = serialize($newcookie);


$newcookie[$id] = $value;
$newcookie = serialize($newcookie);

	my_setcookie("mybb[$name]", addslashes($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;

Zeile 2347Zeile 2405
			"editor_enter_image",
"editor_enter_video_url",
"editor_video_dailymotion",

			"editor_enter_image",
"editor_enter_video_url",
"editor_video_dailymotion",

			"editor_video_googlevideo",

 
			"editor_video_metacafe",
"editor_video_myspacetv",
"editor_video_vimeo",

			"editor_video_metacafe",
"editor_video_myspacetv",
"editor_video_vimeo",

Zeile 2366Zeile 2423
		);
$editor_language = "var editor_language = {\n";


		);
$editor_language = "var editor_language = {\n";


		$plugins->run_hooks_by_ref("mycode_add_codebuttons", $editor_lang_strings);

		$editor_lang_strings = $plugins->run_hooks("mycode_add_codebuttons", $editor_lang_strings);


foreach($editor_lang_strings as $key => $lang_string)
{


foreach($editor_lang_strings as $key => $lang_string)
{

Zeile 2492Zeile 2549
	}

return $clickablesmilies;

	}

return $clickablesmilies;

 
}

/**
* Builds thread prefixes and returns a selected prefix (or all)
*
* @param int The prefix ID (0 to return all)
* @return array The thread prefix's values (or all thread prefixes)
*/
function build_prefixes($pid=0)
{
global $cache;
static $prefixes_cache;

if(is_array($prefixes_cache))
{
if($pid > 0 && is_array($prefixes_cache[$pid]))
{
return $prefixes_cache[$pid];
}

return $prefixes_cache;
}

$prefix_cache = $cache->read("threadprefixes");

if(!is_array($prefix_cache))
{
// No cache
$prefix_cache = $cache->read("threadprefixes", true);

if(!is_array($prefix_cache))
{
return array();
}
}

$prefixes_cache = array();
foreach($prefix_cache as $prefix)
{
$prefixes_cache[$prefix['pid']] = $prefix;
}

if($pid != 0 && is_array($prefixes_cache[$pid]))
{
return $prefixes_cache[$pid];
}
else if(!empty($prefixes_cache))
{
return $prefixes_cache;
}

return false;

}

/**

}

/**

Zeile 2503Zeile 2612
 */
function build_prefix_select($fid, $selected_pid=0, $multiple=0)
{

 */
function build_prefix_select($fid, $selected_pid=0, $multiple=0)
{

	global $db, $lang, $mybb;

	global $cache, $db, $lang, $mybb;

	
if($fid != 'all')
{
$fid = intval($fid);
}


	
if($fid != 'all')
{
$fid = intval($fid);
}


	// Does this user have additional groups?







	$prefix_cache = build_prefixes(0);
if(!$prefix_cache)
{
return false; // We've got no prefixes to show
}

$groups = array($mybb->user['usergroup']);

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


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


		// Because we like apostrophes...
$imps = array();

 
		foreach($exp as $group)

		foreach($exp as $group)

		{
$imps[] = "'{$group}'";
}

$additional_groups = implode(",", $imps);
$extra_sql = "groups IN ({$additional_groups}) OR ";
}
else
{
$extra_sql = '';

		{
$groups[] = $group;
}








	}

	}


switch($db->type)




// Go through each of our prefixes and decide which ones we can use
$prefixes = array();
foreach($prefix_cache as $prefix)

	{

	{

		case "pgsql":
case "sqlite":
$whereforum = "";
if($fid != 'all')














		if($fid != "all" && $prefix['forums'] != "-1")
{
// 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($prefix['groups'] != "-1")
{
$prefix_groups = explode(",", $prefix['groups']);

foreach($groups as $group)

			{

			{

				$whereforum = " AND (','||forums||',' LIKE '%,{$fid},%' OR ','||forums||',' LIKE '%,-1,%' OR forums='')";





				if(in_array($group, $prefix_groups) && !isset($prefixes[$prefix['pid']]))
{
// Our group can use this prefix!
$prefixes[$prefix['pid']] = $prefix;
}

			}

			}

			
$query = $db->query("
SELECT pid, prefix
FROM ".TABLE_PREFIX."threadprefixes
WHERE ({$extra_sql}','||groups||',' LIKE '%,{$mybb->user['usergroup']},%' OR ','||groups||',' LIKE '%,-1,%' OR groups='')
{$whereforum}
");
break;
default:
$whereforum = "";
if($fid != 'all')
{
$whereforum = " AND (CONCAT(',',forums,',') LIKE '%,{$fid},%' OR CONCAT(',',forums,',') LIKE '%,-1,%' OR forums='')";
}

$query = $db->query("
SELECT pid, prefix
FROM ".TABLE_PREFIX."threadprefixes
WHERE ({$extra_sql}CONCAT(',',groups,',') LIKE '%,{$mybb->user['usergroup']},%' OR CONCAT(',',groups,',') LIKE '%,-1,%' OR groups='')
{$whereforum}
");

		}
else
{
// This prefix is for anybody to use...
$prefixes[$prefix['pid']] = $prefix;
}
}

if(empty($prefixes))
{
return false;











	}

	}

	



	$prefixselect = "";

	$prefixselect = "";

	
if($db->num_rows($query) > 0)
{
$multipleselect = "";
if($multiple != 0)
{
$multipleselect = " multiple=\"multiple\" size=\"5\"";
}

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

if($multiple == 1)

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

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

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

		{

		{

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

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

			$any_selected = " selected=\"selected\"";







		}

		}

		
$default_selected = "";
if((intval($selected_pid) == 0) && $selected_pid != 'any')















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

$default_selected = "";
if((intval($selected_pid) == 0) && $selected_pid != 'any')
{
$default_selected = " selected=\"selected\"";
}

$prefixselect .= "<option value=\"0\"".$default_selected.">".$lang->no_prefix."</option>\n";

foreach($prefixes as $prefix)
{
$selected = "";
if($prefix['pid'] == $selected_pid)

		{

		{

			$default_selected = " selected=\"selected\"";
}

$prefixselect .= "<option value=\"0\"".$default_selected.">".$lang->no_prefix."</option>\n";

while($prefix = $db->fetch_array($query))
{
$selected = "";
if($prefix['pid'] == $selected_pid)
{
$selected = " selected=\"selected\"";
}

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

			$selected = " selected=\"selected\"";














		}

		}

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


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

	}

	}

	




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


	return $prefixselect;

	return $prefixselect;

}


}


/**
* Gzip encodes text to a specified level
*

/**
* Gzip encodes text to a specified level
*

Zeile 2787Zeile 2898
 */
function get_ip()
{

 */
function get_ip()
{

	if(isset($_SERVER['REMOTE_ADDR']))
{
$ip = $_SERVER['REMOTE_ADDR'];
}
elseif(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
if(preg_match_all("#[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#s", $_SERVER['HTTP_X_FORWARDED_FOR'], $addresses))
{















    global $mybb, $plugins;

$ip = 0;

if(!preg_match("#^(10|172\.16|192\.168)\.#", $_SERVER['REMOTE_ADDR']))
{
$ip = $_SERVER['REMOTE_ADDR'];
}

if($mybb->settings['ip_forwarded_check'])
{
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
preg_match_all("#[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#s", $_SERVER['HTTP_X_FORWARDED_FOR'], $addresses);
}
elseif(isset($_SERVER['HTTP_X_REAL_IP']))
{
preg_match_all("#[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}#s", $_SERVER['HTTP_X_REAL_IP'], $addresses);
}

if(is_array($addresses[0]))
{

			foreach($addresses[0] as $key => $val)
{
if(!preg_match("#^(10|172\.16|192\.168)\.#", $val))
{
$ip = $val;
break;

			foreach($addresses[0] as $key => $val)
{
if(!preg_match("#^(10|172\.16|192\.168)\.#", $val))
{
$ip = $val;
break;

				}
}
}
}

if(!isset($ip))
{
if(isset($_SERVER['HTTP_CLIENT_IP']))
{
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
else
{
$ip = '';
}
}


				}
}
}
}

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

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





	$ip = preg_replace("#([^.0-9 ]*)#", "", $ip);
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 3078Zeile 3203
						$sep = $multipage_dropdown.$sep;
}
}

						$sep = $multipage_dropdown.$sep;
}
}

				






// Replace page 1 URLs
$navbit['url'] = str_replace("-page-1.html", ".html", $navbit['url']);
$navbit['url'] = preg_replace("/&amp;page=1$/", "", $navbit['url']);


				eval("\$nav .= \"".$templates->get("nav_bit")."\";");

				eval("\$nav .= \"".$templates->get("nav_bit")."\";");

			}
}

			}
}

	}

$navsize = count($navbits);

	}

$navsize = count($navbits);

Zeile 3168Zeile 3297
					$navbits[$navsize]['url'] = get_forum_link($forumnav['fid'], $multipage['current_page']);

$navbits[$navsize]['multipage'] = $multipage;

					$navbits[$navsize]['url'] = get_forum_link($forumnav['fid'], $multipage['current_page']);

$navbits[$navsize]['multipage'] = $multipage;

					$navbits[$navsize]['multipage']['url'] = get_forum_link($forumnav['fid']);

					$navbits[$navsize]['multipage']['url'] = str_replace('{fid}', $forumnav['fid'], FORUM_URL_PAGED);

				}
else
{

				}
else
{

Zeile 3368Zeile 3497
{
global $mybb;


{
global $mybb;


	if($mybb->settings['nocacheheaders'] == 1 && $mybb->settings['standardheaders'] != 1)

	if($mybb->settings['nocacheheaders'] == 1)

	{
header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");

	{
header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");

Zeile 4022Zeile 4151
	{
$message = convert_through_utf8($message);


	{
$message = convert_through_utf8($message);


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

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

		{

		{

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

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

		}

$new_message = convert_through_utf8($new_message, false);

		}

$new_message = convert_through_utf8($new_message, false);

Zeile 4151Zeile 4280
		'M',
);


		'M',
);


 
	$html = array(
'&#109;',
'&#99;',
'&#68;',
'&#121;',
'&#89;',
'&#106;',
'&#83;',
'&#70;',
'&#108;',
'&#77;',
);

$bdays = str_replace($find, $html, $bdays);
$bmonth = str_replace($find, $html, $bmonth);


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

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

Zeile 4187Zeile 4332
	if(!$bday[2])
{
return;

	if(!$bday[2])
{
return;

	}


	}


	list($day, $month, $year) = explode("-", my_date("j-n-Y", TIME_NOW, 0, 0));

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

	list($day, $month, $year) = explode("-", my_date("j-n-Y", TIME_NOW, 0, 0));

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

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

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

	}

	}

	return $age;

	return $age;

}

/**

}

/**

 * Updates the first posts in a thread.
*
* @param int The thread id for which to update the first post id.

 * Updates the first posts in a thread.
*
* @param int The thread id for which to update the first post id.

Zeile 4219Zeile 4364
		);
$db->update_query("posts", $replyto_update, "pid='{$post['pid']}'");
}

		);
$db->update_query("posts", $replyto_update, "pid='{$post['pid']}'");
}





	$firstpostup = array(
"firstpost" => $post['pid']
);
$db->update_query("threads", $firstpostup, "tid='$tid'");

	$firstpostup = array(
"firstpost" => $post['pid']
);
$db->update_query("threads", $firstpostup, "tid='$tid'");

}

/**

}

/**

 * Checks for the length of a string, mb strings accounted for
*
* @param string The string to check the length of.

 * Checks for the length of a string, mb strings accounted for
*
* @param string The string to check the length of.

Zeile 4339Zeile 4484
	if($needle == '')
{
return false;

	if($needle == '')
{
return false;

	}

	}


if(function_exists("mb_strpos"))
{


if(function_exists("mb_strpos"))
{

Zeile 4446Zeile 4591
 */
function get_event_date($event)
{

 */
function get_event_date($event)
{

 
	global $mybb;


	$event_date = explode("-", $event['date']);
$event_date = mktime(0, 0, 0, $event_date[1], $event_date[0], $event_date[2]);
$event_date = my_date($mybb->settings['dateformat'], $event_date);

return $event_date;

	$event_date = explode("-", $event['date']);
$event_date = mktime(0, 0, 0, $event_date[1], $event_date[0], $event_date[2]);
$event_date = my_date($mybb->settings['dateformat'], $event_date);

return $event_date;

}


}


/**
* Get the profile link.
*

/**
* Get the profile link.
*

Zeile 4460Zeile 4607
 * @return string The url to the profile.
*/
function get_profile_link($uid=0)

 * @return string The url to the profile.
*/
function get_profile_link($uid=0)

{

{

	$link = str_replace("{uid}", $uid, PROFILE_URL);
return htmlspecialchars_uni($link);
}

	$link = str_replace("{uid}", $uid, PROFILE_URL);
return htmlspecialchars_uni($link);
}

Zeile 4470Zeile 4617
 *
* @param int The announement id of the announcement.
* @return string The url to the announcement.

 *
* @param int The announement id of the announcement.
* @return string The url to the announcement.

 */

 */

function get_announcement_link($aid=0)
{
$link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL);

function get_announcement_link($aid=0)
{
$link = str_replace("{aid}", $aid, ANNOUNCEMENT_URL);

Zeile 4489Zeile 4636
function build_profile_link($username="", $uid=0, $target="", $onclick="")
{
global $mybb, $lang;

function build_profile_link($username="", $uid=0, $target="", $onclick="")
{
global $mybb, $lang;





	if(!$username && $uid == 0)

	if(!$username && $uid == 0)

	{

	{

		// Return Guest phrase for no UID, no guest nickname
return $lang->guest;
}

		// Return Guest phrase for no UID, no guest nickname
return $lang->guest;
}

Zeile 4499Zeile 4646
	{
// Return the guest's nickname if user is a guest but has a nickname
return $username;

	{
// Return the guest's nickname if user is a guest but has a nickname
return $username;

	}

	}

	else
{
// Build the profile link for the registered user

	else
{
// Build the profile link for the registered user

Zeile 4529Zeile 4676
	if($page > 0)
{
$link = str_replace("{fid}", $fid, FORUM_URL_PAGED);

	if($page > 0)
{
$link = str_replace("{fid}", $fid, FORUM_URL_PAGED);

		$link = str_replace("{page}", $page, $link);
return htmlspecialchars_uni($link);
}
else
{
$link = str_replace("{fid}", $fid, FORUM_URL);

		$link = str_replace("{page}", $page, $link);
return htmlspecialchars_uni($link);
}
else
{
$link = str_replace("{fid}", $fid, FORUM_URL);

		return htmlspecialchars_uni($link);
}
}

		return htmlspecialchars_uni($link);
}
}

Zeile 4550Zeile 4697
function get_thread_link($tid, $page=0, $action='')
{
if($page > 1)

function get_thread_link($tid, $page=0, $action='')
{
if($page > 1)

	{
if($action)
{
$link = THREAD_URL_ACTION;
$link = str_replace("{action}", $action, $link);
}

	{
if($action)
{
$link = THREAD_URL_ACTION;
$link = str_replace("{action}", $action, $link);
}

		else
{
$link = THREAD_URL_PAGED;
}
$link = str_replace("{tid}", $tid, $link);
$link = str_replace("{page}", $page, $link);

		else
{
$link = THREAD_URL_PAGED;
}
$link = str_replace("{tid}", $tid, $link);
$link = str_replace("{page}", $page, $link);

		return htmlspecialchars_uni($link);
}
else
{

		return htmlspecialchars_uni($link);
}
else
{

		if($action)
{
$link = THREAD_URL_ACTION;

		if($action)
{
$link = THREAD_URL_ACTION;

Zeile 4615Zeile 4762

/**
* Build the link to a specified date on the calendar


/**
* Build the link to a specified date on the calendar

 *
* @param int The ID of the calendar

 *
* @param int The ID of the calendar

 * @param int The year
* @param int The month
* @param int The day (optional)

 * @param int The year
* @param int The month
* @param int The day (optional)

Zeile 4627Zeile 4774
	if($day > 0)
{
$link = str_replace("{month}", $month, CALENDAR_URL_DAY);

	if($day > 0)
{
$link = str_replace("{month}", $month, CALENDAR_URL_DAY);

		$link = str_replace("{year}", $year, $link);

		$link = str_replace("{year}", $year, $link);

		$link = str_replace("{day}", $day, $link);

		$link = str_replace("{day}", $day, $link);

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

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

	}
else if($month > 0)
{
$link = str_replace("{month}", $month, CALENDAR_URL_MONTH);
$link = str_replace("{year}", $year, $link);

	}
else if($month > 0)
{
$link = str_replace("{month}", $month, CALENDAR_URL_MONTH);
$link = str_replace("{year}", $year, $link);

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

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

	}
else if($year > 0)
{

	}
else if($year > 0)
{

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

return $user_cache[$uid];

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

return $user_cache[$uid];

	}

	}

}

}



 

/**
* Get the forum of a specific forum id.


/**
* Get the forum of a specific forum id.

Zeile 5026Zeile 5172
		$mybb->settings[$setting['name']] = $setting['value'];
$setting['value'] = addcslashes($setting['value'], '\\"$');
$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";

		$mybb->settings[$setting['name']] = $setting['value'];
$setting['value'] = addcslashes($setting['value'], '\\"$');
$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";

	}

	}

	
$settings = "<"."?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?".">";
$file = @fopen(MYBB_ROOT."inc/settings.php", $mode);

	
$settings = "<"."?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?".">";
$file = @fopen(MYBB_ROOT."inc/settings.php", $mode);

Zeile 5047Zeile 5193
	global $mybb;

if($mybb->settings['minsearchword'] < 1)

	global $mybb;

if($mybb->settings['minsearchword'] < 1)

	{

	{

		$mybb->settings['minsearchword'] = 3;
}

		$mybb->settings['minsearchword'] = 3;
}

 

if(is_array($terms))
{
$terms = implode(' ', $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 5067Zeile 5218
		$inquote = false;
$terms = explode("\"", $terms);
foreach($terms as $phrase)

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

		{

		{

			$phrase = htmlspecialchars_uni($phrase);
if($phrase != "")
{

			$phrase = htmlspecialchars_uni($phrase);
if($phrase != "")
{

Zeile 5100Zeile 5251
	{
$terms = htmlspecialchars_uni($terms);
$split_words = preg_split("#\s{1,}#", $terms, -1);

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

		if(!is_array($split_words))

		if(is_array($split_words))

		{

		{

			continue;
}
foreach($split_words as $word)
{
if(!$word || strlen($word) < $mybb->settings['minsearchword'])

			foreach($split_words as $word)





			{

			{

				continue;





				if(!$word || strlen($word) < $mybb->settings['minsearchword'])
{
continue;
}
$words[] = trim($word);

			}

			}

			$words[] = trim($word);

 
		}

		}



 
	}

if(!is_array($words))

	}

if(!is_array($words))

Zeile 5147Zeile 5296
}

/**

}

/**

 * Converts a decimal reference of a character to its UTF-8 equivilant

 * Converts a decimal reference of a character to its UTF-8 equivalent

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

Zeile 5229Zeile 5378
 */
function is_banned_email($email, $update_lastuse=false)
{

 */
function is_banned_email($email, $update_lastuse=false)
{

	global $db;
$query = $db->simple_select("banfilters", "*", "type='3'");
while($banned_email = $db->fetch_array($query))









	global $cache, $db;

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

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

foreach($banned_cache as $banned_email)

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

	{
// 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(preg_match("#{$banned_email['filter']}#i", $email))
{
// Updating last use

Zeile 5370Zeile 5528
	}
$select .= "</select>";
return $select;

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

}


}


/**
* Fetch the contents of a remote fle.
*

/**
* Fetch the contents of a remote fle.
*

Zeile 5444Zeile 5602
		}

$headers[] = "Host: {$url['host']}";

		}

$headers[] = "Host: {$url['host']}";

		$headers[] = "Connection: Close";
$headers[] = "\r\n";

		$headers[] = "Connection: Close";
$headers[] = '';

		
if(!empty($post_body))

		
if(!empty($post_body))

		{

		{

			$headers[] = $post_body;

			$headers[] = $post_body;

 
		}
else
{
// If we have no post body, we need to add an empty element to make sure we've got \r\n\r\n before the (non-existent) body starts
$headers[] = '';

		}

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

		}

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

Zeile 5469Zeile 5632
	{
return @implode("", @file($url));
}

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

	else
{
return false;
}

	else
{
return false;
}

}

/**

}

/**

Zeile 5515Zeile 5678
		if(is_array($escape))
{
function escaped_explode_escape($string)

		if(is_array($escape))
{
function escaped_explode_escape($string)

			{

			{

				return preg_quote($string, "#");
}
$escape_preg = "(".implode("|", array_map("escaped_explode_escape", $escape)).")";

				return preg_quote($string, "#");
}
$escape_preg = "(".implode("|", array_map("escaped_explode_escape", $escape)).")";

Zeile 5533Zeile 5696
	foreach($quoted_strings as $string)
{
if($string != "")

	foreach($quoted_strings as $string)
{
if($string != "")

		{

		{

			if($in_escape)
{
$strings[] = trim($string);

			if($in_escape)
{
$strings[] = trim($string);

Zeile 5551Zeile 5714
		$in_escape = !$in_escape;
}
if(!count($strings))

		$in_escape = !$in_escape;
}
if(!count($strings))

	{

	{

		return $original;
}
return $strings;

		return $original;
}
return $strings;

Zeile 5561Zeile 5724
 * Fetch an IPv4 long formatted range for searching IPv4 IP addresses.
*
* @param string The IP address to convert to a range based LONG

 * Fetch an IPv4 long formatted range for searching IPv4 IP addresses.
*
* @param string The IP address to convert to a range based LONG

 * @rturn mixed If a full IP address is provided, the ip2long equivilent, otherwise an array of the upper & lower extremities of the IP

 * @rturn mixed If a full IP address is provided, the ip2long equivalent, otherwise an array of the upper & lower extremities of the IP

 */
function fetch_longipv4_range($ip)
{

 */
function fetch_longipv4_range($ip)
{

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

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

	}

	}


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


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

Zeile 5590Zeile 5753
	{
$sep = "";
foreach($ip_bits as $piece)

	{
$sep = "";
foreach($ip_bits as $piece)

		{

		{

			if($piece == "*")
{
$ip_string1 .= $sep."0";

			if($piece == "*")
{
$ip_string1 .= $sep."0";

Zeile 5606Zeile 5769
		return array(ip2long($ip_string1), ip2long($ip_string2));
}
}

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


/**


/**

 * Fetch a list of ban times for a user account.
*
* @return array Array of ban times

 * Fetch a list of ban times for a user account.
*
* @return array Array of ban times

Zeile 5637Zeile 5800
		"0-0-2" => "2 {$lang->years}"
);


		"0-0-2" => "2 {$lang->years}"
);


	$plugins->run_hooks_by_ref("functions_fetch_ban_times", $ban_times);

	$ban_times = $plugins->run_hooks("functions_fetch_ban_times", $ban_times);


$ban_times['---'] = $lang->permanent;
return $ban_times;


$ban_times['---'] = $lang->permanent;
return $ban_times;

Zeile 5663Zeile 5826
	$n[2] += $d[1];
$n[3] += $d[2];
return mktime(date("G"), date("i"), 0, $n[2], $n[1], $n[3]);

	$n[2] += $d[1];
$n[3] += $d[2];
return mktime(date("G"), date("i"), 0, $n[2], $n[1], $n[3]);

}


}


/**
* Expire old warnings in the database.
*
*/
function expire_warnings()

/**
* Expire old warnings in the database.
*
*/
function expire_warnings()

{

{

	global $db;

$users = array();

	global $db;

$users = array();

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

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

		

		

		if(array_key_exists($warning['uid'], $users))

		if(array_key_exists($warning['uid'], $users))

		{

		{

			$users[$warning['uid']] -= $warning['points'];
}
else

			$users[$warning['uid']] -= $warning['points'];
}
else

		{

		{

			$users[$warning['uid']] = $warning['warningpoints']-$warning['points'];
}
}

			$users[$warning['uid']] = $warning['warningpoints']-$warning['points'];
}
}

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

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

}

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

 
}

/**

}

/**

Zeile 5834Zeile 5964
 */
function my_ip2long($ip)
{

 */
function my_ip2long($ip)
{

	$ip = ip2long($ip);
if($ip >= 2147483648) // Won't occur on 32-bit PHP












	$ip_long = ip2long($ip);

if(!$ip_long)
{
$ip_long = sprintf("%u", ip2long($ip));

if(!$ip_long)
{
return 0;
}
}

if($ip_long >= 2147483648) // Won't occur on 32-bit PHP

	{

	{

		$ip -= 4294967296;

		$ip_long -= 4294967296;

	}

	}

	return $ip;



return $ip_long;

}

/**

}

/**

Zeile 5959Zeile 6101
 * Returns a signed value equal to an integer
*
* @param int The integer

 * Returns a signed value equal to an integer
*
* @param int The integer

 * @return string The signed equivallent

 * @return string The signed equivalent

 */
function signed($int)
{

 */
function signed($int)
{

Zeile 5977Zeile 6119
 * Returns a securely generated seed for PHP's RNG (Random Number Generator)
*
* @param int Length of the seed bytes (8 is default. Provides good cryptographic variance)

 * Returns a securely generated seed for PHP's RNG (Random Number Generator)
*
* @param int Length of the seed bytes (8 is default. Provides good cryptographic variance)

 * @return int An integer equivilent of a secure hexadecimal seed

 * @return int An integer equivalent of a secure hexadecimal seed

 */
function secure_seed_rng($count=8)
{

 */
function secure_seed_rng($count=8)
{

Zeile 6017Zeile 6159
 * @param int Optional lowest value to be returned (default: 0) 
* @param int Optional highest value to be returned (default: mt_getrandmax())
* @param boolean True forces it to reseed the RNG first

 * @param int Optional lowest value to be returned (default: 0) 
* @param int Optional highest value to be returned (default: mt_getrandmax())
* @param boolean True forces it to reseed the RNG first

 * @return int An integer equivilent of a secure hexadecimal seed

 * @return int An integer equivalent of a secure hexadecimal seed

 */
function my_rand($min=null, $max=null, $force_seed=false)
{

 */
function my_rand($min=null, $max=null, $force_seed=false)
{

Zeile 6073Zeile 6215
		0x0A => 1,
0x0D => 1,
0x0B => 1,

		0x0A => 1,
0x0D => 1,
0x0B => 1,

 
		0xAD => 1,
0xC2 => array(0xA0 => 1,
0xAD => 1,
0xBF => 1,
0x81 => 1,
0x8D => 1,
0x90 => 1,
0x9D => 1,),

		0xCC => array(0xB7 => 1, 0xB8 => 1), // \x{0337} or \x{0338}
0xE1 => array(0x85 => array(0x9F => 1, 0xA0 => 1)), // \x{115F} or \x{1160}
0xE2 => array(0x80 => array(0x80 => 1, 0x81 => 1, 0x82 => 1, 0x83 => 1, 0x84 => 1, 0x85 => 1, 0x86 => 1, 0x87 => 1, 0x88 => 1, 0x89 => 1, 0x8A => 1, 0x8B => 1, // \x{2000} to \x{200B}

		0xCC => array(0xB7 => 1, 0xB8 => 1), // \x{0337} or \x{0338}
0xE1 => array(0x85 => array(0x9F => 1, 0xA0 => 1)), // \x{115F} or \x{1160}
0xE2 => array(0x80 => array(0x80 => 1, 0x81 => 1, 0x82 => 1, 0x83 => 1, 0x84 => 1, 0x85 => 1, 0x86 => 1, 0x87 => 1, 0x88 => 1, 0x89 => 1, 0x8A => 1, 0x8B => 1, // \x{2000} to \x{200B}

Zeile 6091Zeile 6241
		0x0A => 1,
0x0D => 1,
0x0B => 1,

		0x0A => 1,
0x0D => 1,
0x0B => 1,

 
		0xA0 => array(0xC2 => 1),
0xAD => array(0xC2 => 1),
0xBF => array(0xC2 => 1),
0x81 => array(0xC2 => 1),
0x8D => array(0xC2 => 1),
0x90 => array(0xC2 => 1),
0x9D => array(0xC2 => 1),

		0xB8 => array(0xCC => 1), // \x{0338}
0xB7 => array(0xCC => 1), // \x{0337}
0xA0 => array(0x85 => array(0xE1 => 1)), // \x{1160}

		0xB8 => array(0xCC => 1), // \x{0338}
0xB7 => array(0xCC => 1), // \x{0337}
0xA0 => array(0x85 => array(0xE1 => 1)), // \x{1160}