Vergleich inc/functions.php - 1.8.17 - 1.8.18

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 18Zeile 18
	global $db, $lang, $theme, $templates, $plugins, $mybb;
global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;


	global $db, $lang, $theme, $templates, $plugins, $mybb;
global $debug, $templatecache, $templatelist, $maintimer, $globaltime, $parsetime;


 
	$contents = $plugins->run_hooks("pre_parse_page", $contents);

	$contents = parse_page($contents);
$totaltime = format_time_duration($maintimer->stop());
$contents = $plugins->run_hooks("pre_output_page", $contents);

	$contents = parse_page($contents);
$totaltime = format_time_duration($maintimer->stop());
$contents = $plugins->run_hooks("pre_output_page", $contents);

Zeile 868Zeile 869

foreach($errors as $error)
{


foreach($errors as $error)
{

		$errorlist .= "<li>".$error."</li>\n";

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

	}

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

	}

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

Zeile 2041Zeile 2042
		return false;
}


		return false;
}


	$stack = array();
$expected = array();

	$stack = $list = $expected = array();



/*
* states:


/*
* states:

Zeile 3173Zeile 3173

if($dimensions)
{


if($dimensions)
{

		$dimensions = explode("|", $dimensions);

		$dimensions = preg_split('/[|x]/', $dimensions);


if($dimensions[0] && $dimensions[1])
{


if($dimensions[0] && $dimensions[1])
{

			list($max_width, $max_height) = explode('x', $max_dimensions);

			list($max_width, $max_height) = preg_split('/[|x]/', $max_dimensions);


if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height))
{


if(!empty($max_dimensions) && ($dimensions[0] > $max_width || $dimensions[1] > $max_height))
{

Zeile 3274Zeile 3274
			"editor_invalidyoutube" => "Invalid YouTube video",
"editor_dailymotion" => "Dailymotion",
"editor_metacafe" => "MetaCafe",

			"editor_invalidyoutube" => "Invalid YouTube video",
"editor_dailymotion" => "Dailymotion",
"editor_metacafe" => "MetaCafe",

			"editor_veoh" => "Veoh",

			"editor_mixer" => "Mixer",

			"editor_vimeo" => "Vimeo",
"editor_youtube" => "Youtube",
"editor_facebook" => "Facebook",

			"editor_vimeo" => "Vimeo",
"editor_youtube" => "Youtube",
"editor_facebook" => "Facebook",

Zeile 3444Zeile 3444
	}

return $codeinsert;

	}

return $codeinsert;

 
}

/**
* @param int $tid
* @param array $postoptions The options carried with form submit
*
* @return string Predefined / updated subscription method of the thread for the user
*/
function get_subscription_method($tid = 0, $postoptions = array())
{
global $mybb;

$subscription_methods = array('dont', 'none', 'email', 'pm'); // Define methods
$subscription_method = (int)$mybb->user['subscriptionmethod']; // Set user default

// If no user default method available then reset method
if(!$subscription_method)
{
$subscription_method = 0;
}

// Return user default if no thread id available, in case
if(!(int)$tid || (int)$tid <= 0)
{
return $subscription_methods[$subscription_method];
}

// If method not predefined set using data from database
if(isset($postoptions['subscriptionmethod']))
{
$method = trim($postoptions['subscriptionmethod']);
return (in_array($method, $subscription_methods)) ? $method : $subscription_methods[0];
}
else
{
global $db;

$query = $db->simple_select("threadsubscriptions", "tid, notification", "tid='".(int)$tid."' AND uid='".$mybb->user['uid']."'", array('limit' => 1));
$subscription = $db->fetch_array($query);

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

return $subscription_methods[$subscription_method];

}

/**

}

/**

Zeile 4337Zeile 4384
				eval("\$nav .= \"".$templates->get("nav_bit")."\";");
}
}

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

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

	}

	}


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

 

if($nav)
{


if($nav)
{

Zeile 4356Zeile 4401

/**
* Add a breadcrumb menu item to the list.


/**
* Add a breadcrumb menu item to the list.

 *

 *

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

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





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

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

Zeile 4398Zeile 4443
		foreach($pforumcache[$fid] as $key => $forumnav)
{
if($fid == $forumnav['fid'])

		foreach($pforumcache[$fid] as $key => $forumnav)
{
if($fid == $forumnav['fid'])

			{

			{

				if(!empty($pforumcache[$forumnav['pid']]))
{
build_forum_breadcrumb($forumnav['pid']);

				if(!empty($pforumcache[$forumnav['pid']]))
{
build_forum_breadcrumb($forumnav['pid']);

Zeile 4454Zeile 4499

unset($GLOBALS['navbits']);
$GLOBALS['navbits'] = $newnav;


unset($GLOBALS['navbits']);
$GLOBALS['navbits'] = $newnav;

}

}


/**
* Builds a URL to an archive mode page


/**
* Builds a URL to an archive mode page

Zeile 4474Zeile 4519
		$base_url = $mybb->settings['bburl']."/archive/index.php/";
}
else

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

	{

	{

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


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


Zeile 4495Zeile 4540

return $url;
}


return $url;
}





/**
* Prints a debug information page
*/
function debug_page()
{
global $db, $debug, $templates, $templatelist, $mybb, $maintimer, $globaltime, $ptimer, $parsetime, $lang, $cache;

/**
* Prints a debug information page
*/
function debug_page()
{
global $db, $debug, $templates, $templatelist, $mybb, $maintimer, $globaltime, $ptimer, $parsetime, $lang, $cache;





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

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





	$percentphp = number_format((($phptime/$maintimer->totaltime)*100), 2);
$percentsql = number_format((($query_time/$maintimer->totaltime)*100), 2);

	$percentphp = number_format((($phptime/$maintimer->totaltime)*100), 2);
$percentsql = number_format((($query_time/$maintimer->totaltime)*100), 2);





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


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


Zeile 4523Zeile 4568
	if($mybb->settings['gzipoutput'] != 0)
{
$gzipen = "Enabled";

	if($mybb->settings['gzipoutput'] != 0)
{
$gzipen = "Enabled";

	}

	}

	else
{
$gzipen = "Disabled";

	else
{
$gzipen = "Disabled";

Zeile 4566Zeile 4611
	echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phpversion</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Server Load:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$serverload</span></td>\n";

	echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$phpversion</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Server Load:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$serverload</span></td>\n";

	echo "</tr>\n";

	echo "</tr>\n";

	echo "<tr>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">GZip Encoding Status:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$gzipen</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">No. Templates Used:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">".count($templates->cache)." (".(int)count(explode(",", $templatelist))." Cached / ".(int)count($templates->uncached_templates)." Manually Loaded)</span></td>\n";

	echo "<tr>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">GZip Encoding Status:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">$gzipen</span></td>\n";
echo "<td bgcolor=\"#efefef\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">No. Templates Used:</span></b></td>\n";
echo "<td bgcolor=\"#fefefe\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">".count($templates->cache)." (".(int)count(explode(",", $templatelist))." Cached / ".(int)count($templates->uncached_templates)." Manually Loaded)</span></td>\n";

	echo "</tr>\n";

	echo "</tr>\n";


$memory_usage = get_memory_usage();
if(!$memory_usage)
{
$memory_usage = $lang->unknown;


$memory_usage = get_memory_usage();
if(!$memory_usage)
{
$memory_usage = $lang->unknown;

	}

	}

	else
{
$memory_usage = get_friendly_size($memory_usage)." ({$memory_usage} bytes)";

	else
{
$memory_usage = get_friendly_size($memory_usage)." ({$memory_usage} bytes)";

Zeile 4589Zeile 4634
	echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_usage}</span></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Memory Limit:</span></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_limit}</span></td>\n";

	echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_usage}</span></td>\n";
echo "<td bgcolor=\"#EFEFEF\" width=\"25%\"><b><span style=\"font-family: tahoma; font-size: 12px;\">Memory Limit:</span></b></td>\n";
echo "<td bgcolor=\"#FEFEFE\" width=\"25%\"><span style=\"font-family: tahoma; font-size: 12px;\">{$memory_limit}</span></td>\n";

	echo "</tr>\n";

echo "</table>\n";

	echo "</tr>\n";

echo "</table>\n";


echo "<h2>Database Connections (".count($db->connections)." Total) </h2>\n";
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";


echo "<h2>Database Connections (".count($db->connections)." Total) </h2>\n";
echo "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n";

Zeile 4617Zeile 4662
		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)

	}

if(count($templates->uncached_templates) > 0)

Zeile 4791Zeile 4836
		), $options);
}
elseif($weeks > 0)

		), $options);
}
elseif($weeks > 0)

	{

	{

		$options = array_merge(array(
'minutes' => false,
'seconds' => false

		$options = array_merge(array(
'minutes' => false,
'seconds' => false

Zeile 6135Zeile 6180
	$uid = (int)$uid;

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

	$uid = (int)$uid;

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

	{

	{

		return $mybb->user;
}
elseif(isset($user_cache[$uid]))

		return $mybb->user;
}
elseif(isset($user_cache[$uid]))

Zeile 6471Zeile 6516
function validate_email_format($email)
{
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;

function validate_email_format($email)
{
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;

}

}


/**
* Checks to see if the email is already in use by another


/**
* Checks to see if the email is already in use by another

Zeile 6639Zeile 6684
	}

return $highlight_cache;

	}

return $highlight_cache;

}

}


/**
* Sort the word array by length. Largest terms go first and work their way down to the smallest term.


/**
* Sort the word array by length. Largest terms go first and work their way down to the smallest term.

Zeile 6649Zeile 6694
 * @return integer Result of comparison function.
*/
function build_highlight_array_sort($a, $b)

 * @return integer Result of comparison function.
*/
function build_highlight_array_sort($a, $b)

{

{

	return strlen($b) - strlen($a);
}


	return strlen($b) - strlen($a);
}


Zeile 6659Zeile 6704
 *
* @param int $src Decimal value of a character reference
* @return string|bool

 *
* @param int $src Decimal value of a character reference
* @return string|bool

 */

 */

function dec_to_utf8($src)
{
$dest = '';

function dec_to_utf8($src)
{
$dest = '';

Zeile 6722Zeile 6767
				$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'");
}
return true;

				$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_username['fid']}'");
}
return true;

		}
}

		}
}

	// Still here - good username
return false;
}

	// Still here - good username
return false;
}

Zeile 6734Zeile 6779
 * @param string $email The email address.
* @param boolean $update_lastuse True if the 'last used' dateline should be updated if a match is found.
* @return boolean True if banned, false if not banned

 * @param string $email The email address.
* @param boolean $update_lastuse True if the 'last used' dateline should be updated if a match is found.
* @return boolean True if banned, false if not banned

 */

 */

function is_banned_email($email, $update_lastuse=false)
{
global $cache, $db;

function is_banned_email($email, $update_lastuse=false)
{
global $cache, $db;

Zeile 6763Zeile 6808
					$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'");
}
return true;

					$db->update_query("banfilters", array("lastuse" => TIME_NOW), "fid='{$banned_email['fid']}'");
}
return true;

			}
}
}

			}
}
}


// Still here - good email
return false;


// Still here - good email
return false;

Zeile 6807Zeile 6852
			}
}
elseif($ip_address == $ip_range)

			}
}
elseif($ip_address == $ip_range)

		{

		{

			$banned = true;
}
if($banned)

			$banned = true;
}
if($banned)

Zeile 7599Zeile 7644
 * @param array $array The array of forums
* @return integer The number of sub forums
*/

 * @param array $array The array of forums
* @return integer The number of sub forums
*/

function subforums_count($array)

function subforums_count($array=array())

{
$count = 0;
foreach($array as $array2)

{
$count = 0;
foreach($array as $array2)

Zeile 8152Zeile 8197
		{
$elements = unpack('N2', $output);
$output = abs($elements[1] << 32 | $elements[2]);

		{
$elements = unpack('N2', $output);
$output = abs($elements[1] << 32 | $elements[2]);

		}

		}


} while($output > PHP_INT_MAX);



} while($output > PHP_INT_MAX);


Zeile 8320Zeile 8365
function match_sequence($string, $array, $i=0, $n=0)
{
if($string === "")

function match_sequence($string, $array, $i=0, $n=0)
{
if($string === "")

	{

	{

		return 0;
}


		return 0;
}


Zeile 8352Zeile 8397
	if($gd_version)
{
return $gd_version;

	if($gd_version)
{
return $gd_version;

	}

	}

	if(!extension_loaded('gd'))

	if(!extension_loaded('gd'))

	{

	{

		return;
}


		return;
}


Zeile 8362Zeile 8407
	{
$gd_info = gd_info();
preg_match('/\d/', $gd_info['GD Version'], $gd);

	{
$gd_info = gd_info();
preg_match('/\d/', $gd_info['GD Version'], $gd);

		$gd_version = $gd[0];

		$gd_version = $gd[0];

	}
else
{

	}
else
{

Zeile 8404Zeile 8449
					{
$string .= '?';
continue;

					{
$string .= '?';
continue;

					}

					}

					else
{
return false;

					else
{
return false;

Zeile 8738Zeile 8783
	}

return $success;

	}

return $success;

}

/**

}

/**

 * Validate an url
*
* @param string $url The url to validate.

 * Validate an url
*
* @param string $url The url to validate.

Zeile 8761Zeile 8806
	}

if($relative_path && my_substr($url, 0, 1) == '/' || preg_match($regex, $url))

	}

if($relative_path && my_substr($url, 0, 1) == '/' || preg_match($regex, $url))

	{

	{

		return true;
}
return false;

		return true;
}
return false;

Zeile 8814Zeile 8859
		}

foreach($delimiters as $delimiter)

		}

foreach($delimiters as $delimiter)

		{

		{

			foreach($active_content_triggers as $trigger)

			foreach($active_content_triggers as $trigger)

			{

			{

				$string = str_replace($delimiter.$trigger, $delimiter."'".$trigger, $string);
}
}
}

				$string = str_replace($delimiter.$trigger, $delimiter."'".$trigger, $string);
}
}
}


$string = str_replace('"', '""', $string);

return $string;



























$string = str_replace('"', '""', $string);

return $string;
}

// Fallback function for 'array_column', PHP < 5.5.0 compatibility
if(!function_exists('array_column'))
{
function array_column($input, $column_key)
{
$values = array();
if(!is_array($input))
{
$input = array($input);
}
foreach($input as $val)
{
if(is_array($val) && isset($val[$column_key]))
{
$values[] = $val[$column_key];
}
elseif(is_object($val) && isset($val->$column_key))
{
$values[] = $val->$column_key;
}
}
return $values;
}

}

}