Vergleich inc/functions.php - 1.4.8 - 1.4.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1Zeile 1
<?php
/**
* MyBB 1.4

<?php
/**
* MyBB 1.4

 * Copyright � 2008 MyBB Group, All Rights Reserved

 * Copyright © 2008 MyBB Group, All Rights Reserved

 *
* 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 4377 2009-06-04 11:33:13Z Tomm $

 * $Id: functions.php 4562 2009-11-29 22:04:37Z RyanGordon $

 */

/**

 */

/**

Zeile 228Zeile 228
/**
* Sends a specified amount of messages from the mail queue
*

/**
* Sends a specified amount of messages from the mail queue
*

 * @param int The number of messages to send (Defaults to 20)

 * @param int The number of messages to send (Defaults to 10)

 */
function send_mail_queue($count=10)
{

 */
function send_mail_queue($count=10)
{

Zeile 1267Zeile 1267
	$password = $forum_cache[$fid]['password'];
if($password)
{

	$password = $forum_cache[$fid]['password'];
if($password)
{

		if($mybb->input['pwverify'])

		if($mybb->input['pwverify'] && $pid == 0)

		{
if($password == $mybb->input['pwverify'])
{

		{
if($password == $mybb->input['pwverify'])
{

Zeile 1299Zeile 1299

if($showform)
{


if($showform)
{

		$_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
eval("\$pwform = \"".$templates->get("forumdisplay_password")."\";");
output_page($pwform);








		if($pid)
{
header("Location: ".$mybb->settings['bburl']."/".get_forum_link($fid));
}
else
{
$_SERVER['REQUEST_URI'] = htmlspecialchars_uni($_SERVER['REQUEST_URI']);
eval("\$pwform = \"".$templates->get("forumdisplay_password")."\";");
output_page($pwform);
}

		exit;
}
}

		exit;
}
}

Zeile 1322Zeile 1329
	if($uid < 1)
{
$uid = $mybb->user['uid'];

	if($uid < 1)
{
$uid = $mybb->user['uid'];

	}

	}

	
if($uid == 0)
{

	
if($uid == 0)
{

Zeile 1357Zeile 1364

/**
* Checks if a moderator has permissions to perform an action in a specific forum


/**
* Checks if a moderator has permissions to perform an action in a specific forum

 *

 *

 * @param int The forum ID (0 assumes global)
* @param string The action tyring to be performed. (blank assumes any action at all)
* @param int The user ID (0 assumes current user)

 * @param int The forum ID (0 assumes global)
* @param string The action tyring to be performed. (blank assumes any action at all)
* @param int The user ID (0 assumes current user)

Zeile 1385Zeile 1392
	else
{
if(!$fid)

	else
{
if(!$fid)

		{

		{

			$modcache = $cache->read('moderators');
if(!empty($modcache))
{

			$modcache = $cache->read('moderators');
if(!empty($modcache))
{

Zeile 1412Zeile 1419
				if($modperms[$action] == 1)
{
return true;

				if($modperms[$action] == 1)
{
return true;

				}

				}

				else
{
return false;
}
}

				else
{
return false;
}
}

		}

		}

	}
}


	}
}


Zeile 1444Zeile 1451
	foreach($posticons_cache as $posticon)
{
$posticons[$posticon['name']] = $posticon;

	foreach($posticons_cache as $posticon)
{
$posticons[$posticon['name']] = $posticon;

	}

	}

	krsort($posticons);

foreach($posticons as $dbicon)
{
if($icon == $dbicon['iid'])

	krsort($posticons);

foreach($posticons as $dbicon)
{
if($icon == $dbicon['iid'])

		{

		{

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

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

		}

		}

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

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

		}


		}


		++$listed;
if($listed == 10)
{
$iconlist .= "<br />";
$listed = 0;

		++$listed;
if($listed == 10)
{
$iconlist .= "<br />";
$listed = 0;

		}
}

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

		}
}

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


return $posticons;
}


return $posticons;
}

Zeile 1487Zeile 1494
	if(!$mybb->settings['cookiepath'])
{
$mybb->settings['cookiepath'] = "/";

	if(!$mybb->settings['cookiepath'])
{
$mybb->settings['cookiepath'] = "/";

	}


	}


	if($expires == -1)
{
$expires = 0;

	if($expires == -1)
{
$expires = 0;

Zeile 1522Zeile 1529
	}

if(!empty($mybb->settings['cookiepath']))

	}

if(!empty($mybb->settings['cookiepath']))

	{

	{

		$cookie .= "; path={$mybb->settings['cookiepath']}";
}


		$cookie .= "; path={$mybb->settings['cookiepath']}";
}


Zeile 1534Zeile 1541
	if($httponly == true)
{
$cookie .= "; HttpOnly";

	if($httponly == true)
{
$cookie .= "; HttpOnly";

	}


	}


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

header($cookie, false);

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

header($cookie, false);

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

 * @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 1570Zeile 1577
	if(!isset($mybb->cookies['mybb'][$name]))
{
return false;

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

	}


	}


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

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

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

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

	}
else

	}
else

	{
return 0;
}

	{
return 0;
}

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

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

{

{

	global $mybb;

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

	global $mybb;

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

Zeile 1613Zeile 1620
function get_server_load()
{
global $lang;

function get_server_load()
{
global $lang;





	$serverload = array();

// DIRECTORY_SEPARATOR checks if running windows
if(DIRECTORY_SEPARATOR != '\\')
{
if(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg"))

	$serverload = array();

// DIRECTORY_SEPARATOR checks if running windows
if(DIRECTORY_SEPARATOR != '\\')
{
if(@file_exists("/proc/loadavg") && $load = @file_get_contents("/proc/loadavg"))

		{

		{

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

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

Zeile 1633Zeile 1640
			
// Suhosin likes to throw a warning if exec is disabled then die - weird
if($func_blacklist = @ini_get('suhosin.executor.func.blacklist'))

			
// Suhosin likes to throw a warning if exec is disabled then die - weird
if($func_blacklist = @ini_get('suhosin.executor.func.blacklist'))

			{

			{

				if(strpos(",".$func_blacklist.",", 'exec') !== false)
{
return $lang->unknown;

				if(strpos(",".$func_blacklist.",", 'exec') !== false)
{
return $lang->unknown;

Zeile 1649Zeile 1656
			}

$load = @exec("uptime");

			}

$load = @exec("uptime");

			$load = split("load averages?: ", $load);

			$load = explode("load average: ", $load);

			$serverload = explode(",", $load[1]);
if(!is_array($serverload))
{

			$serverload = explode(",", $load[1]);
if(!is_array($serverload))
{

Zeile 1744Zeile 1751
	$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);

foreach($counters as $counter)

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

foreach($counters as $counter)

	{

	{

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

		if(array_key_exists($counter, $changes))
{
// 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

			else

			{

			{

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

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

			{

			{

				$update_query[$counter] = 0;
}
}

				$update_query[$counter] = 0;
}
}

Zeile 1799Zeile 1806
			if($unapprovedthreads_diff > -1)
{
$new_stats['numunapprovedthreads'] = "+{$unapprovedthreads_diff}";

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

			}
else

			}
else

			{
$new_stats['numunapprovedthreads'] = "{$unapprovedthreads_diff}";
}
}

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

			{
$new_stats['numunapprovedthreads'] = "{$unapprovedthreads_diff}";
}
}

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

		{

		{

			$posts_diff = $update_query['posts'] - $forum['posts'];
if($posts_diff > -1)

			$posts_diff = $update_query['posts'] - $forum['posts'];
if($posts_diff > -1)

			{

			{

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

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

			}
else
{

			}
else
{

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

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

Zeile 1836Zeile 1843

// Update last post info
update_forum_lastpost($fid);


// Update last post info
update_forum_lastpost($fid);

 
	
$cache->update_forums();

}

/**

}

/**

Zeile 1854Zeile 1863
		WHERE fid='{$fid}' AND visible='1' AND closed NOT LIKE 'moved|%'
ORDER BY lastpost DESC
LIMIT 0, 1

		WHERE fid='{$fid}' AND visible='1' AND closed NOT LIKE 'moved|%'
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 1975Zeile 1984
	$update_array = array(
'username' => $firstpost['username'],
'uid' => intval($firstpost['uid']),

	$update_array = array(
'username' => $firstpost['username'],
'uid' => intval($firstpost['uid']),

 
		'dateline' => intval($firstpost['dateline']),

		'lastpost' => intval($lastpost['dateline']),
'lastposter' => $lastpost['username'],
'lastposteruid' => intval($lastpost['uid']),

		'lastpost' => intval($lastpost['dateline']),
'lastposter' => $lastpost['username'],
'lastposteruid' => intval($lastpost['uid']),

Zeile 2021Zeile 2031
 * @param int The thread ID
*/
function delete_post($pid, $tid="")

 * @param int The thread ID
*/
function delete_post($pid, $tid="")

{

{

	global $moderation;

if(!is_object($moderation))
{
require_once MYBB_ROOT."inc/class_moderation.php";
$moderation = new Moderation;

	global $moderation;

if(!is_object($moderation))
{
require_once MYBB_ROOT."inc/class_moderation.php";
$moderation = new Moderation;

	}

	}


return $moderation->delete_post($pid);
}


return $moderation->delete_post($pid);
}

Zeile 2049Zeile 2059
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;

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

	$pid = intval($pid);





	if($permissions)
{
$permissions = $mybb->usergroup;

	if($permissions)
{
$permissions = $mybb->usergroup;

	}


	}


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

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

		}


		}


		foreach($forum_cache as $fid => $forum)
{
if($forum['active'] != 0)

		foreach($forum_cache as $fid => $forum)
{
if($forum['active'] != 0)

Zeile 2076Zeile 2086
	if(!is_array($permissioncache))
{
$permissioncache = forum_permissions();

	if(!is_array($permissioncache))
{
$permissioncache = forum_permissions();

	}

	}


if(is_array($jumpfcache[$pid]))
{


if(is_array($jumpfcache[$pid]))
{

Zeile 2186Zeile 2196
	}

if($displaygroup != 0)

	}

if($displaygroup != 0)

	{

	{

		$usergroup = $displaygroup;
}


		$usergroup = $displaygroup;
}


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

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

	}

	}


return $display_reputation;
}


return $display_reputation;
}

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

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

	}

	}

	else if($level >= 25)

	else if($level >= 25)

	{

	{

		return "<span class=\"low_warning\">{$level}%</span>";
}
else

		return "<span class=\"low_warning\">{$level}%</span>";
}
else

	{

	{

		return $level."%";
}
}

		return $level."%";
}
}

Zeile 2572Zeile 2582
					break;
}
}

					break;
}
}

		}
}

		}
}


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


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

		}

		}

		else
{
$ip = '';

		else
{
$ip = '';

Zeile 2608Zeile 2618
	
// Yottabyte (1024 Zettabytes)
if($size >= 1208925819614629174706176)

	
// Yottabyte (1024 Zettabytes)
if($size >= 1208925819614629174706176)

	{

	{

		$size = my_number_format(round(($size / 1208925819614629174706176), 2))." ".$lang->size_yb;
}
// Zetabyte (1024 Exabytes)
elseif($size >= 1180591620717411303424)
{
$size = my_number_format(round(($size / 1180591620717411303424), 2))." ".$lang->size_zb;

		$size = my_number_format(round(($size / 1208925819614629174706176), 2))." ".$lang->size_yb;
}
// Zetabyte (1024 Exabytes)
elseif($size >= 1180591620717411303424)
{
$size = my_number_format(round(($size / 1180591620717411303424), 2))." ".$lang->size_zb;

	}

	}

	// Exabyte (1024 Petabytes)
elseif($size >= 1152921504606846976)
{

	// Exabyte (1024 Petabytes)
elseif($size >= 1152921504606846976)
{

Zeile 2628Zeile 2638
	}
// Terabyte (1024 Gigabytes)
elseif($size >= 1099511627776)

	}
// Terabyte (1024 Gigabytes)
elseif($size >= 1099511627776)

	{

	{

		$size = my_number_format(round(($size / 1099511627776), 2))." ".$lang->size_tb;
}
// Gigabyte (1024 Megabytes)

		$size = my_number_format(round(($size / 1099511627776), 2))." ".$lang->size_tb;
}
// Gigabyte (1024 Megabytes)

Zeile 2789Zeile 2799
	$format = str_replace("y", my_substr($year, -2), $format);

return $format;

	$format = str_replace("y", my_substr($year, -2), $format);

return $format;

}

/**

}

/**

 * Build the breadcrumb navigation trail from the specified items
*
* @return The formatted breadcrumb navigation trail

 * Build the breadcrumb navigation trail from the specified items
*
* @return The formatted breadcrumb navigation trail

Zeile 2812Zeile 2822
				if(isset($navbits[$key+2]))
{
$sep = $navsep;

				if(isset($navbits[$key+2]))
{
$sep = $navsep;

				}

				}

				else
{
$sep = "";

				else
{
$sep = "";

Zeile 2825Zeile 2835

$navsize = count($navbits);
$navbit = $navbits[$navsize-1];


$navsize = count($navbits);
$navbit = $navbits[$navsize-1];





	if($nav)
{
eval("\$activesep = \"".$templates->get("nav_sep_active")."\";");

	if($nav)
{
eval("\$activesep = \"".$templates->get("nav_sep_active")."\";");

Zeile 2844Zeile 2854
 * @param string The URL of the item to add
*/
function add_breadcrumb($name, $url="")

 * @param string The URL of the item to add
*/
function add_breadcrumb($name, $url="")

{
global $navbits;

{
global $navbits;


$navsize = count($navbits);
$navbits[$navsize]['name'] = $name;


$navsize = count($navbits);
$navbits[$navsize]['name'] = $name;

Zeile 2886Zeile 2896
				}

$navsize = count($navbits);

				}

$navsize = count($navbits);

				$navbits[$navsize]['name'] = htmlspecialchars_uni($forumnav['name']);


				// Convert & to &amp;
$navbits[$navsize]['name'] = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $forumnav['name']);


if(IN_ARCHIVE == 1)
{


if(IN_ARCHIVE == 1)
{

Zeile 3065Zeile 3076
		echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td style=\"background-color: #ccc;\"><strong>Templates Used (Loaded for this Page) - ".count($templates->cache)." Total</strong></td>\n";

		echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td style=\"background-color: #ccc;\"><strong>Templates Used (Loaded for this Page) - ".count($templates->cache)." Total</strong></td>\n";

		echo "</tr>\n";
echo "<tr>\n";
echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";
}

		echo "</tr>\n";
echo "<tr>\n";
echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";
}


if(count($templates->uncached_templates > 0))
{
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td style=\"background-color: #ccc;\"><strong>Templates Requiring Additional Calls (Not Cached at Startup) - ".count($templates->uncached_templates)." Total</strong></td>\n";


if(count($templates->uncached_templates > 0))
{
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";
echo "<tr>\n";
echo "<td style=\"background-color: #ccc;\"><strong>Templates Requiring Additional Calls (Not Cached at Startup) - ".count($templates->uncached_templates)." Total</strong></td>\n";

		echo "</tr>\n";

		echo "</tr>\n";

		echo "<tr>\n";
echo "<td style=\"background: #fff;\">".implode(", ", $templates->uncached_templates)."</td>\n";
echo "</tr>\n";

		echo "<tr>\n";
echo "<td style=\"background: #fff;\">".implode(", ", $templates->uncached_templates)."</td>\n";
echo "</tr>\n";

Zeile 3092Zeile 3103

/**
* Outputs the correct page headers.


/**
* Outputs the correct page headers.

 */

 */

function send_page_headers()
{
global $mybb;

function send_page_headers()
{
global $mybb;

Zeile 3127Zeile 3138
			}
break;
case "post":

			}
break;
case "post":

			$db->update_query("reportedposts", array('reportstatus' => 1), "pid='$id' AND reportstatus='0'");

			$db->update_query("reportedposts", array('reportstatus' => 1), "pid='$id' AND reportstatus='0'");

			break;
case "threads":
if(is_array($id))

			break;
case "threads":
if(is_array($id))

Zeile 3236Zeile 3247
	else if($months > 1)
{
$nicetime['months'] = $months.$lang_months;

	else if($months > 1)
{
$nicetime['months'] = $months.$lang_months;

	}


	}


	if($weeks == 1)
{
$nicetime['weeks'] = "1".$lang_week;

	if($weeks == 1)
{
$nicetime['weeks'] = "1".$lang_week;

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

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


if(is_array($groups))


if(is_array($groups))

	{
foreach($groups as $gid)
{

	{
foreach($groups as $gid)
{

Zeile 3513Zeile 3524
				if(strpos($location, "?") === false)
{
$location .= "?";

				if(strpos($location, "?") === false)
{
$location .= "?";

				}

				}

				else
{
$location .= "&amp;";

				else
{
$location .= "&amp;";

Zeile 3663Zeile 3674
			$decimals = 0;
}


			$decimals = 0;
}


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

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

	}
}


	}
}


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

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

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

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

}

/**

}

/**

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

 */
function build_highlight_array($terms)
{

 
	global $mybb;

if($mybb->settings['minsearchword'] < 1)
{
$mybb->settings['minsearchword'] = 3;
}


	// 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 4793Zeile 4811
		$inquote = false;
$terms = explode("\"", $terms);
foreach($terms as $phrase)

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

		{

		{

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

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

					$words[] = "\"".trim($phrase)."\"";

					$words[] = trim($phrase);

				}
else
{

				}
else
{

Zeile 4810Zeile 4828
					}
foreach($split_words as $word)
{

					}
foreach($split_words as $word)
{

						if(!$word)

						if(!$word || strlen($word) < $mybb->settings['minsearchword'])

						{
continue;
}

						{
continue;
}

Zeile 4819Zeile 4837
				}
}
$inquote = !$inquote;

				}
}
$inquote = !$inquote;

		}

		}

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

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

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

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

		{

		{

			continue;
}
foreach($split_words as $word)
{

			continue;
}
foreach($split_words as $word)
{

			if(!$word)

			if(!$word || strlen($word) < $mybb->settings['minsearchword'])

			{
continue;
}

			{
continue;
}

Zeile 4845Zeile 4863
	{
return false;
}

	{
return false;
}

 
	
// Sort the word array by length. Largest terms go first and work their way down to the smallest term.
// This resolves problems like "test tes" where "tes" will be highlighted first, then "test" can't be highlighted because of the changed html
usort($words, create_function('$a,$b','return strlen($b) - strlen($a);'));


// Loop through our words to build the PREG compatible strings
foreach($words as $word)


// Loop through our words to build the PREG compatible strings
foreach($words as $word)

Zeile 4860Zeile 4882
		}

// Now make PREG compatible

		}

// Now make PREG compatible

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

		$find = "#(?!<.*?)(".preg_quote($word, "#").")(?![^<>]*?>)#i";
$replacement = "<span class=\"highlight\" style=\"padding-left: 0px; padding-right: 0px;\">$1</span>";

		$highlight_cache[$find] = $replacement;
}


		$highlight_cache[$find] = $replacement;
}