Vergleich inc/functions.php - 1.8.16 - 1.8.19

  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 1203Zeile 1204
/**
* Fetch the permissions for a specific user
*

/**
* Fetch the permissions for a specific user
*

 * @param int $uid The user ID

 * @param int $uid The user ID, if no user ID is provided then current user's ID will be considered.

 * @return array Array of user permissions for the specified user
*/

 * @return array Array of user permissions for the specified user
*/

function user_permissions($uid=0)

function user_permissions($uid=null)

{
global $mybb, $cache, $groupscache, $user_cache;

// If no user id is specified, assume it is the current user

{
global $mybb, $cache, $groupscache, $user_cache;

// If no user id is specified, assume it is the current user

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

// Its a guest. Return the group permissions directly from cache

	if($uid == 0)
{

	if($uid == 0)
{

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

		return $groupscache[1];

	}

// User id does not match current user, fetch permissions

	}

// User id does not match current user, fetch permissions

Zeile 2035Zeile 2042
		return false;
}


		return false;
}


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

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



/*
* states:


/*
* states:

Zeile 3107Zeile 3113

/**
* Formats an avatar to a certain dimension


/**
* Formats an avatar to a certain dimension

 *

 *

 * @param string $avatar The avatar file name
* @param string $dimensions Dimensions of the avatar, width x height (e.g. 44|44)
* @param string $max_dimensions The maximum dimensions of the formatted avatar

 * @param string $avatar The avatar file name
* @param string $dimensions Dimensions of the avatar, width x height (e.g. 44|44)
* @param string $max_dimensions The maximum dimensions of the formatted avatar

Zeile 3167Zeile 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 3268Zeile 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 3315Zeile 3321
				if(!$smiliecache)
{
if(!isset($smilie_cache) || !is_array($smilie_cache))

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

					{

					{

						$smilie_cache = $cache->read("smilies");
}
foreach($smilie_cache as $smilie)

						$smilie_cache = $cache->read("smilies");
}
foreach($smilie_cache as $smilie)

Zeile 3396Zeile 3402
			if($mybb->settings['allowsizemycode'] == 1)
{
$size = "size,";

			if($mybb->settings['allowsizemycode'] == 1)
{
$size = "size,";

			}


			}


			if($mybb->settings['allowcolormycode'] == 1)
{
$color = "color,";

			if($mybb->settings['allowcolormycode'] == 1)
{
$color = "color,";

			}


			}


			if($mybb->settings['allowfontmycode'] == 1 || $mybb->settings['allowsizemycode'] == 1 || $mybb->settings['allowcolormycode'] == 1)
{
$removeformat = "removeformat|";

			if($mybb->settings['allowfontmycode'] == 1 || $mybb->settings['allowsizemycode'] == 1 || $mybb->settings['allowcolormycode'] == 1)
{
$removeformat = "removeformat|";

			}


			}


			if($mybb->settings['allowemailmycode'] == 1)
{
$email = "email,";

			if($mybb->settings['allowemailmycode'] == 1)
{
$email = "email,";

			}


			}


			if($mybb->settings['allowlinkmycode'] == 1)
{
$link = "link,unlink";

			if($mybb->settings['allowlinkmycode'] == 1)
{
$link = "link,unlink";

			}


			}


			if($mybb->settings['allowlistmycode'] == 1)
{
$list = "bulletlist,orderedlist|";

			if($mybb->settings['allowlistmycode'] == 1)
{
$list = "bulletlist,orderedlist|";

			}


			}


			if($mybb->settings['allowcodemycode'] == 1)
{
$code = "code,php,";

			if($mybb->settings['allowcodemycode'] == 1)
{
$code = "code,php,";

			}


			}


			if($mybb->user['sourceeditor'] == 1)
{
$sourcemode = "MyBBEditor.sourceMode(true);";
}

			if($mybb->user['sourceeditor'] == 1)
{
$sourcemode = "MyBBEditor.sourceMode(true);";
}





			eval("\$codeinsert = \"".$templates->get("codebuttons")."\";");
}
}

			eval("\$codeinsert = \"".$templates->get("codebuttons")."\";");
}
}


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('', '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 4331Zeile 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 4673Zeile 4724
			}
break;
case "post":

			}
break;
case "post":

			$db->update_query("reportedcontent", array('reportstatus' => 1), "id='$id' AND reportstatus='0' AND (type = 'post' OR type = '')");
break;

			$db->update_query("reportedcontent", array('reportstatus' => 1), "id='$id' AND reportstatus='0' AND (type = 'post' OR type = '')");
break;

		case "threads":
if(is_array($id))
{

		case "threads":
if(is_array($id))
{

Zeile 4843Zeile 4894
		else if($days > 1)
{
$nicetime['days'] = $days.$lang_days;

		else if($days > 1)
{
$nicetime['days'] = $days.$lang_days;

		}

		}

	}

if(!isset($options['hours']) || $options['hours'] !== false)
{
if($hours == 1)

	}

if(!isset($options['hours']) || $options['hours'] !== false)
{
if($hours == 1)

		{

		{

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

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

		{

		{

			$nicetime['hours'] = $hours.$lang_hours;
}
}

			$nicetime['hours'] = $hours.$lang_hours;
}
}

Zeile 4863Zeile 4914
		if($minutes == 1)
{
$nicetime['minutes'] = "1".$lang_minute;

		if($minutes == 1)
{
$nicetime['minutes'] = "1".$lang_minute;

		}

		}

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

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

Zeile 4905Zeile 4956
	else
{
$trow = "trow1";

	else
{
$trow = "trow1";

	}

	}


$alttrow = $trow;



$alttrow = $trow;


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

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

	}
else
{

	}
else
{

		$query = $db->simple_select("users", "additionalgroups, usergroup", "uid='".(int)$uid."'");
$user = $db->fetch_array($query);
}

		$query = $db->simple_select("users", "additionalgroups, usergroup", "uid='".(int)$uid."'");
$user = $db->fetch_array($query);
}

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

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


if(is_array($groups))


if(is_array($groups))

	{
$comma = '';
foreach($groups as $gid)
{
if(trim($gid) != "" && $gid != $user['usergroup'] && !isset($donegroup[$gid]))

	{
$comma = '';
foreach($groups as $gid)
{
if(trim($gid) != "" && $gid != $user['usergroup'] && !isset($donegroup[$gid]))

			{
$groupslist .= $comma.$gid;
$comma = ",";
$donegroup[$gid] = 1;
}

			{
$groupslist .= $comma.$gid;
$comma = ",";
$donegroup[$gid] = 1;
}

		}
}


		}
}


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

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

	}
else
{

	}
else
{

		return false;
}
}

		return false;
}
}

Zeile 5013Zeile 5064

/**
* Get the current location taking in to account different web serves and systems


/**
* Get the current location taking in to account different web serves and systems

 *

 *

 * @param boolean $fields True to return as "hidden" fields
* @param array $ignore Array of fields to ignore if first argument is true
* @param boolean $quick True to skip all inputs and return only the file path part of the URL

 * @param boolean $fields True to return as "hidden" fields
* @param array $ignore Array of fields to ignore if first argument is true
* @param boolean $quick True to skip all inputs and return only the file path part of the URL

Zeile 6914Zeile 6965
				else
{
$label .= ":00";

				else
{
$label .= ":00";

				}
}

				}
}

			$time_in_zone = my_date($mybb->settings['timeformat'], TIME_NOW, $timezone);
$label = $lang->sprintf($lang->timezone_gmt_short, $label." ", $time_in_zone);
}

			$time_in_zone = my_date($mybb->settings['timeformat'], TIME_NOW, $timezone);
$label = $lang->sprintf($lang->timezone_gmt_short, $label." ", $time_in_zone);
}

Zeile 7593Zeile 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 8819Zeile 8870
	$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;
}
}

/**
* Performs a timing attack safe string comparison.
*
* @param string $known_string The first string to be compared.
* @param string $user_string The second, user-supplied string to be compared.
* @return bool Result of the comparison.
*/
function my_hash_equals($known_string, $user_string)
{
if(version_compare(PHP_VERSION, '5.6.0', '>='))
{
return hash_equals($known_string, $user_string);
}
else
{
$known_string_length = my_strlen($known_string);
$user_string_length = my_strlen($user_string);

if($user_string_length != $known_string_length)
{
return false;
}

$result = 0;

for($i = 0; $i < $known_string_length; $i++)
{
$result |= ord($known_string[$i]) ^ ord($user_string[$i]);
}

return $result === 0;
}

}

}