Vergleich inc/functions.php - 1.4.4 - 1.4.7

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

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

 * $Id: functions.php 4279 2008-11-26 00:01:25Z Tikitiki $

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

 */

/**

 */

/**

Zeile 454Zeile 454
	}

// Build and send

	}

// Build and send

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

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

	return $mail->send();
}


	return $mail->send();
}


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

	// Guests get a special string
else
{

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

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

	}
}


	}
}


Zeile 494Zeile 494
		}
else
{

		}
else
{

			error($lang->invalid_post_code);








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

		}
}
else

		}
}
else

Zeile 628Zeile 635

/**
* Produce a friendly error message page


/**
* Produce a friendly error message page

 *

 *

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

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

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

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

	}

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

if(!$title)
{

	}

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

if(!$title)
{

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


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


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

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

	}

	}


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


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

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

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

		exit;
}

		exit;
}


foreach($errors as $error)
{


foreach($errors as $error)
{

Zeile 746Zeile 753

error($errorpage);
}


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 762Zeile 769
	$plugins->run_hooks_by_ref("redirect", $redirect_args);

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

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

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

	{

	{

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

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

Zeile 770Zeile 777
		{
echo 'alert("'.addslashes($message).'");';
}

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

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

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

		$url = htmlspecialchars_decode($url);
$url = str_replace(array("\n","\r",";"), "", $url);
echo 'window.location = "'.addslashes($url).'";'."\n";

		$url = htmlspecialchars_decode($url);
$url = str_replace(array("\n","\r",";"), "", $url);
echo 'window.location = "'.addslashes($url).'";'."\n";

Zeile 802Zeile 809
	}
else
{

	}
else
{

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

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


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


Zeile 812Zeile 818

exit;
}


exit;
}





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

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

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

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

	}

	}

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

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

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

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

		{

		{

			$from = 1;
}
}

			$from = 1;
}
}

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

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

	}

	}


if($from > 1)
{


if($from > 1)
{

Zeile 880Zeile 886
	}

for($i = $from; $i <= $to; ++$i)

	}

for($i = $from; $i <= $to; ++$i)

	{

	{

		$page_url = fetch_page_url($url, $i);
if($page == $i)
{

		$page_url = fetch_page_url($url, $i);
if($page == $i)
{

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

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

	}

	}


if($page < $pages)
{


if($page < $pages)
{

Zeile 1000Zeile 1006
	}

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

	}

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



 

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


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

Zeile 1019Zeile 1024
			if(!in_array($perm, $grouppermignore))
{
if(isset($usergroup[$perm]))

			if(!in_array($perm, $grouppermignore))
{
if(isset($usergroup[$perm]))

				{

				{

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

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

				{

				{

					$permbit = "";
}

// 0 represents unlimited for numerical group permissions (i.e. private message limit) so take that into account.

					$permbit = "";
}

// 0 represents unlimited for numerical group permissions (i.e. private message limit) so take that into account.

				if(in_array($perm, $groupzerogreater) && ($access == 0 || $usergroup[$perm] == 0))

				if(in_array($perm, $groupzerogreater) && ($access == 0 || $permbit === 0))

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

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

				} 

				}


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


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

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

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

			if($usercache[$uid])

			if(!$usercache[$uid])

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

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

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

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

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




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

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

}

/**

}

/**

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

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

		if(!$serverload)

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

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

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

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

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

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

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

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

function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $permissions="", $name="fid")

function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $showall=false, $permissions="", $name="fid")

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


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


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


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


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

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

				{
$optionselected = "";


				{
$optionselected = "";


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

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

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

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

					}
}
}

					}
}
}

Zeile 2935Zeile 2944
	else
{
$base_url = $mybb->settings['bburl']."/archive/index.php/";

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

	}

	}


switch($type)
{


switch($type)
{

Zeile 2961Zeile 2970
function debug_page()
{
global $db, $debug, $templates, $templatelist, $mybb, $maintimer, $globaltime, $ptimer, $parsetime;

function debug_page()
{
global $db, $debug, $templates, $templatelist, $mybb, $maintimer, $globaltime, $ptimer, $parsetime;





	$totaltime = $maintimer->totaltime;
$phptime = $maintimer->format($maintimer->totaltime - $db->query_time);
$query_time = $maintimer->format($db->query_time);

	$totaltime = $maintimer->totaltime;
$phptime = $maintimer->format($maintimer->totaltime - $db->query_time);
$query_time = $maintimer->format($db->query_time);

Zeile 3005Zeile 3014
	echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$phptime seconds ($percentphp%)</font></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">DB Processing Time:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$query_time seconds ($percentsql%)</font></td>\n";

	echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$phptime seconds ($percentphp%)</font></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">DB Processing Time:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">$query_time seconds ($percentsql%)</font></td>\n";

	echo "</tr>\n";
echo "<tr>\n";

	echo "</tr>\n";
echo "<tr>\n";

	echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Extensions Used:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$mybb->config['database']['type']}, xml</font></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Global.php Processing Time:</font></b></td>\n";

	echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Extensions Used:</font></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><font face=\"Tahoma\" size=\"2\">{$mybb->config['database']['type']}, xml</font></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><font face=\"Tahoma\" size=\"2\">Global.php Processing Time:</font></b></td>\n";

Zeile 3218Zeile 3227
	else if($years > 1)
{
$nicetime['years'] = $years.$lang_years;

	else if($years > 1)
{
$nicetime['years'] = $years.$lang_years;

	}

	}


if($months == 1)
{


if($months == 1)
{

Zeile 3234Zeile 3243
		$nicetime['weeks'] = "1".$lang_week;
}
else if($weeks > 1)

		$nicetime['weeks'] = "1".$lang_week;
}
else if($weeks > 1)

	{

	{

		$nicetime['weeks'] = $weeks.$lang_weeks;

		$nicetime['weeks'] = $weeks.$lang_weeks;

	}

	}


if($days == 1)


if($days == 1)

	{

	{

		$nicetime['days'] = "1".$lang_day;
}
else if($days > 1)

		$nicetime['days'] = "1".$lang_day;
}
else if($days > 1)

	{

	{

		$nicetime['days'] = $days.$lang_days;
}


		$nicetime['days'] = $days.$lang_days;
}


Zeile 3260Zeile 3269
	}

if($options['minutes'] !== false)

	}

if($options['minutes'] !== false)

	{

	{

		if($minutes == 1)

		if($minutes == 1)

		{

		{

			$nicetime['minutes'] = "1".$lang_minute;

			$nicetime['minutes'] = "1".$lang_minute;

		}

		}

		else if($minutes > 1)
{
$nicetime['minutes'] = $minutes.$lang_minutes;

		else if($minutes > 1)
{
$nicetime['minutes'] = $minutes.$lang_minutes;

		}

		}

	}

if($options['seconds'] !== false)

	}

if($options['seconds'] !== false)

Zeile 3286Zeile 3295
	if(is_array($nicetime))
{
return implode(", ", $nicetime);

	if(is_array($nicetime))
{
return implode(", ", $nicetime);

	}
}

/**

	}
}

/**

 * Select an alternating row colour based on the previous call to this function
*
* @param int 1 to reset the row to trow1.

 * Select an alternating row colour based on the previous call to this function
*
* @param int 1 to reset the row to trow1.

Zeile 3298Zeile 3307
function alt_trow($reset=0)
{
global $alttrow;

function alt_trow($reset=0)
{
global $alttrow;





	if($alttrow == "trow1" && !$reset)

	if($alttrow == "trow1" && !$reset)

	{

	{

		$trow = "trow2";

		$trow = "trow2";

	}

	}

	else
{
$trow = "trow1";

	else
{
$trow = "trow1";

	}


	}


	$alttrow = $trow;

return $trow;

	$alttrow = $trow;

return $trow;

Zeile 3324Zeile 3333
	global $db, $mybb;

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

	global $db, $mybb;

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

	{

	{

		$user = $mybb->user;
}
else

		$user = $mybb->user;
}
else

Zeile 3357Zeile 3366
	{
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='".intval($uid)."'");
return true;

	{
$db->update_query("users", array('additionalgroups' => $groupslist), "uid='".intval($uid)."'");
return true;

	}
else
{

	}
else
{

		return false;
}
}

		return false;
}
}

Zeile 3377Zeile 3386
	if($uid == $mybb->user['uid'])
{
$user = $mybb->user;

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

	}

	}

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

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

Zeile 3430Zeile 3439
	if(defined("MYBB_LOCATION"))
{
return MYBB_LOCATION;

	if(defined("MYBB_LOCATION"))
{
return MYBB_LOCATION;

	}

	}


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


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

	{

	{

		$location = htmlspecialchars_uni($_SERVER['PATH_INFO']);
}
elseif(!empty($_ENV['PATH_INFO']))
{
$location = htmlspecialchars_uni($_ENV['PATH_INFO']);

		$location = htmlspecialchars_uni($_SERVER['PATH_INFO']);
}
elseif(!empty($_ENV['PATH_INFO']))
{
$location = htmlspecialchars_uni($_ENV['PATH_INFO']);

	}

	}

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

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

Zeile 3456Zeile 3465
		if(!is_array($ignore))
{
$ignore = array($ignore);

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

		}


		}


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


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


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

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

		{

		{

			$location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']);
}


			$location .= "?".htmlspecialchars_uni($_ENV['QUERY_STRING']);
}


Zeile 3492Zeile 3501
			$post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');

foreach($post_array as $var)

			$post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');

foreach($post_array as $var)

			{

			{

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

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

				{

				{

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

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

				}

				}

			}

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

			}

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

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









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

			}
}


			}
}


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

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

 
		'D',

		'y',
'Y',
'j',

		'y',
'Y',
'j',

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

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

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

		my_substr($by, 2),
$by,
($bd[0] == 0 ? my_substr($bd, 1) : $bd),
($bd == 1 || $bd == 21 || $bd == 31 ? 'st' : ($bd == 2 || $bd == 22 ? 'nd' : ($bd == 3 || $bd == 23 ? 'rd' : 'th'))),

		my_substr($by, 2),
$by,
($bd[0] == 0 ? my_substr($bd, 1) : $bd),
($bd == 1 || $bd == 21 || $bd == 31 ? 'st' : ($bd == 2 || $bd == 22 ? 'nd' : ($bd == 3 || $bd == 23 ? 'rd' : 'th'))),

		$bdays[$wd],

		$wd,

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

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

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

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

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

Zeile 3940Zeile 3967
        // Get rid of any excess RTL and LTR override for they are the workings of the devil
$string = str_replace(dec_to_utf8(8238), "", $string);
$string = str_replace(dec_to_utf8(8237), "", $string);

        // Get rid of any excess RTL and LTR override for they are the workings of the devil
$string = str_replace(dec_to_utf8(8238), "", $string);
$string = str_replace(dec_to_utf8(8237), "", $string);





        // Remove dodgy whitespaces
$string = str_replace(chr(0xCA), "", $string);
}

        // Remove dodgy whitespaces
$string = str_replace(chr(0xCA), "", $string);
}

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

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

	{
if($length != "")

	{
if($length != "")

		{
$cut_string = mb_substr($string, $start, $length);
}

		{
$cut_string = mb_substr($string, $start, $length);
}

Zeile 4152Zeile 4179

/**
* Get the profile link.


/**
* Get the profile link.

 *
* @param int The user id of the profile.

 *
* @param int The user id of the profile.

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

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

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

 
	$ip_string1 = $ip_string2 = "";





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




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


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


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

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

	// Wildcard based IP provided
else
{

 
		$sep = "";

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

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

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


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

			}
else
{

			}
else
{

				$ip_string .= $piece.".";


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

			}

			}

		}
}
}



			$sep = ".";
}
return array(ip2long($ip_string1), ip2long($ip_string2));
}
}


/**
* Fetch a list of ban times for a user account.


/**
* Fetch a list of ban times for a user account.

Zeile 5331Zeile 5367

/**
* Format a ban length in to a UNIX timestamp.


/**
* Format a ban length in to a UNIX timestamp.

 *

 *

 * @param string The ban length string
* @param int The optional UNIX timestamp, if 0, current time is used.
* @return int The UNIX timestamp when the ban will be lifted

 * @param string The ban length string
* @param int The optional UNIX timestamp, if 0, current time is used.
* @return int The UNIX timestamp when the ban will be lifted

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

function expire_warnings()
{
global $db;

 
	
$users = array();


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

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

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

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

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













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

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

		{

		{

			$warning['warningpoints'] = 0;

			$warningpoints = 0;

		}

		}

 
		

		$updated_user = array(

		$updated_user = array(

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

			"warningpoints" => intval($warningpoints)

		);

		);

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

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

	}
}


	}
}