Vergleich inc/functions.php - 1.8.19 - 1.8.21

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 624Zeile 624
	// Guests get a special string
else
{

	// Guests get a special string
else
{

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

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

	}
}


	}
}


Zeile 3489Zeile 3489
			$subscription_method = (int)$subscription['notification'] + 1;
}
}

			$subscription_method = (int)$subscription['notification'] + 1;
}
}

	



	return $subscription_methods[$subscription_method];
}


	return $subscription_methods[$subscription_method];
}


Zeile 3508Zeile 3508
		{
$smilie_cache = $cache->read("smilies");
$smiliecount = count($smilie_cache);

		{
$smilie_cache = $cache->read("smilies");
$smiliecount = count($smilie_cache);

		}


		}


		if(!$smiliecache)
{
if(!is_array($smilie_cache))

		if(!$smiliecache)
{
if(!is_array($smilie_cache))

Zeile 3520Zeile 3520
			{
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
$smiliecache[$smilie['sid']] = $smilie;

			{
$smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
$smiliecache[$smilie['sid']] = $smilie;

			}

			}

		}

unset($smilie);

		}

unset($smilie);

Zeile 3572Zeile 3572
						eval("\$smilies .= \"".$templates->get("smilieinsert_row")."\";");
$smilie_icons = '';
}

						eval("\$smilies .= \"".$templates->get("smilieinsert_row")."\";");
$smilie_icons = '';
}

				}
}


				}
}


			if($counter != 0)
{
$colspan = $mybb->settings['smilieinsertercols'] - $counter;

			if($counter != 0)
{
$colspan = $mybb->settings['smilieinsertercols'] - $counter;

Zeile 3594Zeile 3594
	}

return $clickablesmilies;

	}

return $clickablesmilies;

}

/**

}

/**

 * Builds thread prefixes and returns a selected prefix (or all)
*
* @param int $pid The prefix ID (0 to return all)

 * Builds thread prefixes and returns a selected prefix (or all)
*
* @param int $pid The prefix ID (0 to return all)

Zeile 3606Zeile 3606
{
global $cache;
static $prefixes_cache;

{
global $cache;
static $prefixes_cache;





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

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

		}

return $prefixes_cache;
}

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


if(!is_array($prefix_cache))
{


if(!is_array($prefix_cache))
{

Zeile 3628Zeile 3628
		{
return array();
}

		{
return array();
}

	}

	}


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


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

Zeile 3658Zeile 3658
 *  @return string The thread prefix selection menu
*/
function build_prefix_select($fid, $selected_pid=0, $multiple=0, $previous_pid=0)

 *  @return string The thread prefix selection menu
*/
function build_prefix_select($fid, $selected_pid=0, $multiple=0, $previous_pid=0)

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

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


if($fid != 'all')


if($fid != 'all')

	{

	{

		$fid = (int)$fid;
}


		$fid = (int)$fid;
}


Zeile 3670Zeile 3670
	if(empty($prefix_cache))
{
// We've got no prefixes to show

	if(empty($prefix_cache))
{
// We've got no prefixes to show

		return '';

		return '';

	}

// Go through each of our prefixes and decide which ones we can use

	}

// Go through each of our prefixes and decide which ones we can use

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

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





			if(!in_array($fid, $forums) && $prefix['pid'] != $previous_pid)
{
// This prefix is not in our forum list

			if(!in_array($fid, $forums) && $prefix['pid'] != $previous_pid)
{
// This prefix is not in our forum list

Zeile 3699Zeile 3699
	if(empty($prefixes))
{
return '';

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

	}

$prefixselect = $prefixselect_prefix = '';


	}

$prefixselect = $prefixselect_prefix = '';


	if($multiple == 1)
{
$any_selected = "";

	if($multiple == 1)
{
$any_selected = "";

Zeile 3744Zeile 3744

/**
* Build the thread prefix selection menu for a forum without group permission checks


/**
* Build the thread prefix selection menu for a forum without group permission checks

 *

 *

 *  @param int $fid The forum ID (integer ID)
* @param int $selected_pid The selected prefix ID (integer ID)
* @return string The thread prefix selection menu

 *  @param int $fid The forum ID (integer ID)
* @param int $selected_pid The selected prefix ID (integer ID)
* @return string The thread prefix selection menu

Zeile 3776Zeile 3776
				// This forum can use this prefix!
$prefixes[$prefix['pid']] = $prefix;
}

				// This forum can use this prefix!
$prefixes[$prefix['pid']] = $prefix;
}

		}

		}

		else
{
// This prefix is for anybody to use...

		else
{
// This prefix is for anybody to use...

Zeile 3787Zeile 3787
	if(empty($prefixes))
{
return '';

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

	}

	}


$default_selected = array();
$selected_pid = (int)$selected_pid;


$default_selected = array();
$selected_pid = (int)$selected_pid;

Zeile 3829Zeile 3829
 * @return string The encoded string
*/
function gzip_encode($contents, $level=1)

 * @return string The encoded string
*/
function gzip_encode($contents, $level=1)

{

{

	if(function_exists("gzcompress") && function_exists("crc32") && !headers_sent() && !(ini_get('output_buffering') && my_strpos(' '.ini_get('output_handler'), 'ob_gzhandler')))
{
$httpaccept_encoding = '';

	if(function_exists("gzcompress") && function_exists("crc32") && !headers_sent() && !(ini_get('output_buffering') && my_strpos(' '.ini_get('output_handler'), 'ob_gzhandler')))
{
$httpaccept_encoding = '';

Zeile 3999Zeile 3999
	if($level >= 80)
{
$warning_class = "high_warning";

	if($level >= 80)
{
$warning_class = "high_warning";

	}

	}

	else if($level >= 50)
{
$warning_class = "moderate_warning";

	else if($level >= 50)
{
$warning_class = "moderate_warning";

Zeile 4021Zeile 4021
 * Fetch the IP address of the current user.
*
* @return string The IP address.

 * Fetch the IP address of the current user.
*
* @return string The IP address.

 */

 */

function get_ip()
{
global $mybb, $plugins;

function get_ip()
{
global $mybb, $plugins;





	$ip = strtolower($_SERVER['REMOTE_ADDR']);

if($mybb->settings['ip_forwarded_check'])
{
$addresses = array();

	$ip = strtolower($_SERVER['REMOTE_ADDR']);

if($mybb->settings['ip_forwarded_check'])
{
$addresses = array();





		if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))

		if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))

		{

		{

			$addresses = explode(',', strtolower($_SERVER['HTTP_X_FORWARDED_FOR']));
}
elseif(isset($_SERVER['HTTP_X_REAL_IP']))

			$addresses = explode(',', strtolower($_SERVER['HTTP_X_FORWARDED_FOR']));
}
elseif(isset($_SERVER['HTTP_X_REAL_IP']))

Zeile 4042Zeile 4042
		}

if(is_array($addresses))

		}

if(is_array($addresses))

		{

		{

			foreach($addresses as $val)
{
$val = trim($val);

			foreach($addresses as $val)
{
$val = trim($val);

Zeile 4053Zeile 4053
					break;
}
}

					break;
}
}

		}
}


		}
}


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

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

	}


	}


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

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

Zeile 4084Zeile 4084
	global $lang;

if(!is_numeric($size))

	global $lang;

if(!is_numeric($size))

	{

	{

		return $lang->na;

		return $lang->na;

	}

	}


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


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

Zeile 4095Zeile 4095
	}
// Zetabyte (1024 Exabytes)
elseif($size >= 1180591620717411303424)

	}
// Zetabyte (1024 Exabytes)
elseif($size >= 1180591620717411303424)

	{

	{

		$size = my_number_format(round(($size / 1180591620717411303424), 2))." ".$lang->size_zb;
}
// Exabyte (1024 Petabytes)

		$size = my_number_format(round(($size / 1180591620717411303424), 2))." ".$lang->size_zb;
}
// Exabyte (1024 Petabytes)

Zeile 4127Zeile 4127
	elseif($size >= 1024)
{
$size = my_number_format(round(($size / 1024), 2))." ".$lang->size_kb;

	elseif($size >= 1024)
{
$size = my_number_format(round(($size / 1024), 2))." ".$lang->size_kb;

	}

	}

	elseif($size == 0)

	elseif($size == 0)

	{

	{

		$size = "0 ".$lang->size_bytes;
}
else

		$size = "0 ".$lang->size_bytes;
}
else

Zeile 4138Zeile 4138
	}

return $size;

	}

return $size;

}

}


/**
* Format a decimal number in to microseconds, milliseconds, or seconds.


/**
* Format a decimal number in to microseconds, milliseconds, or seconds.

Zeile 4169Zeile 4169
	}

return $time;

	}

return $time;

}

}


/**
* Get the attachment icon for a specific file extension


/**
* Get the attachment icon for a specific file extension

Zeile 6431Zeile 6431
	}
// This user has a cookie lockout, show waiting time
elseif($mybb->cookies['lockoutexpiry'] && $mybb->cookies['lockoutexpiry'] > $now)

	}
// This user has a cookie lockout, show waiting time
elseif($mybb->cookies['lockoutexpiry'] && $mybb->cookies['lockoutexpiry'] > $now)

	{	

	{

		if($fatal)
{
$secsleft = (int)($mybb->cookies['lockoutexpiry'] - $now);

		if($fatal)
{
$secsleft = (int)($mybb->cookies['lockoutexpiry'] - $now);

Zeile 6440Zeile 6440
			$secsleft = floor($secsleft % 60);

error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft));

			$secsleft = floor($secsleft % 60);

error($lang->sprintf($lang->failed_login_wait, $hoursleft, $minsleft, $secsleft));

		}


		}


		return false;
}


		return false;
}


Zeile 6451Zeile 6451
		if($attempts['loginlockoutexpiry'] == 0)
{
$attempts['loginlockoutexpiry'] = $now + ((int)$mybb->settings['failedlogintime'] * 60);

		if($attempts['loginlockoutexpiry'] == 0)
{
$attempts['loginlockoutexpiry'] = $now + ((int)$mybb->settings['failedlogintime'] * 60);





			// Add a cookie lockout. This is used to prevent access to the login page immediately.
// A deep lockout is issued if he tries to login into a locked out account
my_setcookie('lockoutexpiry', $attempts['loginlockoutexpiry']);

			// Add a cookie lockout. This is used to prevent access to the login page immediately.
// A deep lockout is issued if he tries to login into a locked out account
my_setcookie('lockoutexpiry', $attempts['loginlockoutexpiry']);

Zeile 6466Zeile 6466
			$failedtime = $attempts['loginlockoutexpiry'];
}
else

			$failedtime = $attempts['loginlockoutexpiry'];
}
else

		{

		{

			$failedtime = $mybb->cookies['lockoutexpiry'];
}

// Are we still locked out?
if($attempts['loginlockoutexpiry'] > $now)

			$failedtime = $mybb->cookies['lockoutexpiry'];
}

// Are we still locked out?
if($attempts['loginlockoutexpiry'] > $now)

		{	

		{

			if($fatal)
{
$secsleft = (int)($attempts['loginlockoutexpiry'] - $now);

			if($fatal)
{
$secsleft = (int)($attempts['loginlockoutexpiry'] - $now);

Zeile 7568Zeile 7568
	{
require_once MYBB_ROOT.'inc/datahandlers/warnings.php';
$warningshandler = new WarningsHandler('update');

	{
require_once MYBB_ROOT.'inc/datahandlers/warnings.php';
$warningshandler = new WarningsHandler('update');

	}


	}


	return $warningshandler->expire_warnings();
}


	return $warningshandler->expire_warnings();
}


Zeile 8929Zeile 8929

return $result === 0;
}


return $result === 0;
}

 
}

/**
* Retrieves all referrals for a specified user
*
* @param int uid
* @param int start position
* @param int total entries
* @param bool false (default) only return display info, true for all info
* @return array
*/
function get_user_referrals($uid, $start=0, $limit=0, $full=false)
{
global $db;

$referrals = $query_options = array();
$uid = (int) $uid;

if($uid === 0)
{
return $referrals;
}

if($start && $limit)
{
$query_options['limit_start'] = $start;
}

if($limit)
{
$query_options['limit'] = $limit;
}

$fields = 'uid, username, usergroup, displaygroup, regdate';
if($full === true)
{
$fields = '*';
}

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

while($referral = $db->fetch_array($query))
{
$referrals[] = $referral;
}

return $referrals;

}

}