Vergleich inc/functions.php - 1.8.21 - 1.8.26

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 224Zeile 224
		// Loop through and run them all
foreach($shutdown_queries as $query)
{

		// Loop through and run them all
foreach($shutdown_queries as $query)
{

			$db->query($query);

			$db->write_query($query);

		}
}


		}
}


Zeile 610Zeile 610
}

/**

}

/**

 * Generates a unique code for POST requests to prevent XSS/CSRF attacks


 * Generates a code for POST requests to prevent XSS/CSRF attacks.
* Unique for each user or guest session and rotated every 6 hours.

 *

 *

 
 * @param int $rotation_shift Adjustment of the rotation number to generate a past/future code

 * @return string The generated code
*/

 * @return string The generated code
*/

function generate_post_check()

function generate_post_check($rotation_shift=0)

{
global $mybb, $session;

{
global $mybb, $session;

 

$rotation_interval = 6 * 3600;
$rotation = floor(TIME_NOW / $rotation_interval) + $rotation_shift;

$seed = $rotation;


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

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

	{
return md5($mybb->user['loginkey'].$mybb->user['salt'].$mybb->user['regdate']);

	{
$seed .= $mybb->user['loginkey'].$mybb->user['salt'].$mybb->user['regdate'];

	}

	}

	// Guests get a special string

 
	else
{

	else
{

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

		$seed .= $session->sid;

	}

	}

 

$seed .= $mybb->settings['internal']['encryption_key'];

return md5($seed);

}

/**

}

/**

 * Verifies a POST check code is valid, if not shows an error (silently returns false on silent parameter)

 * Verifies a POST check code is valid (i.e. generated using a rotation number from the past 24 hours)

 *
* @param string $code The incoming POST check code

 *
* @param string $code The incoming POST check code

 * @param boolean $silent Silent mode or not (silent mode will not show the error to the user but returns false)
* @return bool

 * @param boolean $silent Don't show an error to the user
* @return bool|void Result boolean if $silent is true, otherwise shows an error to the user

 */
function verify_post_check($code, $silent=false)
{
global $lang;

 */
function verify_post_check($code, $silent=false)
{
global $lang;

	if(generate_post_check() !== $code)






	if(
generate_post_check() !== $code &&
generate_post_check(-1) !== $code &&
generate_post_check(-2) !== $code &&
generate_post_check(-3) !== $code
)

	{
if($silent == true)
{

	{
if($silent == true)
{

Zeile 776Zeile 792

foreach($forums_by_parent[$fid] as $forum)
{


foreach($forums_by_parent[$fid] as $forum)
{

		$forums[] = $forum['fid'];

		$forums[] = (int)$forum['fid'];

		$children = get_child_list($forum['fid']);
if(is_array($children))
{

		$children = get_child_list($forum['fid']);
if(is_array($children))
{

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

return $errors;

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

return $errors;

}

}


/**
* Presents the user with a "no permission" page


/**
* Presents the user with a "no permission" page

Zeile 1031Zeile 1047
 */
function multipage($count, $perpage, $page, $url, $breadcrumb=false)
{

 */
function multipage($count, $perpage, $page, $url, $breadcrumb=false)
{

	global $theme, $templates, $lang, $mybb;

	global $theme, $templates, $lang, $mybb, $plugins;


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


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

 

$args = array(
'count' => &$count,
'perpage' => &$perpage,
'page' => &$page,
'url' => &$url,
'breadcrumb' => &$breadcrumb,
);
$plugins->run_hooks('multipage', $args);


$page = (int)$page;



$page = (int)$page;


Zeile 1379Zeile 1404
			}

$groupperms = $mybb->usergroup;

			}

$groupperms = $mybb->usergroup;

		}
}

		}
}


if(!is_array($forum_cache))
{


if(!is_array($forum_cache))
{

Zeile 1509Zeile 1534
		$current_permissions = $groupperms;
}
return $current_permissions;

		$current_permissions = $groupperms;
}
return $current_permissions;

 
}

/**
* Check whether password for given forum was validated for the current user
*
* @param array $forum The forum data
* @param bool $ignore_empty Whether to treat forum password configured as an empty string as validated
* @param bool $check_parents Whether to check parent forums using `parentlist`
* @return bool
*/
function forum_password_validated($forum, $ignore_empty=false, $check_parents=false)
{
global $mybb, $forum_cache;

if($check_parents && isset($forum['parentlist']))
{
if(!is_array($forum_cache))
{
$forum_cache = cache_forums();
if(!$forum_cache)
{
return false;
}
}

$parents = explode(',', $forum['parentlist']);
rsort($parents);

foreach($parents as $parent_id)
{
if($parent_id != $forum['fid'] && !forum_password_validated($forum_cache[$parent_id], true))
{
return false;
}
}
}

return ($ignore_empty && $forum['password'] === '') || (
isset($mybb->cookies['forumpass'][$forum['fid']]) &&
my_hash_equals(
md5($mybb->user['uid'].$forum['password']),
$mybb->cookies['forumpass'][$forum['fid']]
)
);

}

/**

}

/**

Zeile 1549Zeile 1618
				continue;
}


				continue;
}


			if($forum_cache[$parent_id]['password'] != "")

			if($forum_cache[$parent_id]['password'] !== "")

			{
check_forum_password($parent_id, $fid);
}
}
}


			{
check_forum_password($parent_id, $fid);
}
}
}


	if(!empty($forum_cache[$fid]['password']))

	if($forum_cache[$fid]['password'] !== '')

	{

	{

		$password = $forum_cache[$fid]['password'];

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

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

		{
if($password === $mybb->get_input('pwverify'))
{

		{
if(my_hash_equals($forum_cache[$fid]['password'], $mybb->get_input('pwverify')))
{

				my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->get_input('pwverify')), null, true);
$showform = false;

				my_setcookie("forumpass[$fid]", md5($mybb->user['uid'].$mybb->get_input('pwverify')), null, true);
$showform = false;

			}

			}

			else

			else

			{

			{

				eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
$showform = true;

				eval("\$pwnote = \"".$templates->get("forumdisplay_password_wrongpass")."\";");
$showform = true;

			}
}
else
{
if(!$mybb->cookies['forumpass'][$fid] || ($mybb->cookies['forumpass'][$fid] && md5($mybb->user['uid'].$password) !== $mybb->cookies['forumpass'][$fid]))
{
$showform = true;
}

			}
}
else
{
if(!forum_password_validated($forum_cache[$fid]))
{
$showform = true;
}

			else
{
$showform = false;
}
}

			else
{
$showform = false;
}
}

	}

	}

	else

	else

	{

	{

		$showform = false;
}

if($return)
{
return $showform;

		$showform = false;
}

if($return)
{
return $showform;

	}

	}


if($showform)
{


if($showform)
{

Zeile 1607Zeile 1675
			output_page($pwform);
}
exit;

			output_page($pwform);
}
exit;

	}

	}

}

/**

}

/**

Zeile 1622Zeile 1690
{
global $mybb, $cache, $db;
static $modpermscache;

{
global $mybb, $cache, $db;
static $modpermscache;





	if($uid < 1)

	if($uid < 1)

	{

	{

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

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

	}


	}


	if($uid == 0)

	if($uid == 0)

	{

	{

		return false;
}


		return false;
}


	if(isset($modpermscache[$fid][$uid]))
{
return $modpermscache[$fid][$uid];
}


	if(isset($modpermscache[$fid][$uid]))
{
return $modpermscache[$fid][$uid];
}


	if(!$parentslist)
{
$parentslist = explode(',', get_parent_list($fid));

	if(!$parentslist)
{
$parentslist = explode(',', get_parent_list($fid));

Zeile 1648Zeile 1716
	$user = get_user($uid);

$groups = array($user['usergroup']);

	$user = get_user($uid);

$groups = array($user['usergroup']);





	if(!empty($user['additionalgroups']))
{
$extra_groups = explode(",", $user['additionalgroups']);

	if(!empty($user['additionalgroups']))
{
$extra_groups = explode(",", $user['additionalgroups']);

Zeile 1656Zeile 1724
		foreach($extra_groups as $extra_group)
{
$groups[] = $extra_group;

		foreach($extra_groups as $extra_group)
{
$groups[] = $extra_group;

		}
}

$mod_cache = $cache->read("moderators");


		}
}

$mod_cache = $cache->read("moderators");


	foreach($mod_cache as $forumid => $forum)
{
if(!is_array($forum) || !in_array($forumid, $parentslist))

	foreach($mod_cache as $forumid => $forum)
{
if(!is_array($forum) || !in_array($forumid, $parentslist))

		{

		{

			// No perms or we're not after this forum
continue;
}

			// No perms or we're not after this forum
continue;
}





		// User settings override usergroup settings
if(is_array($forum['users'][$uid]))
{
$perm = $forum['users'][$uid];

		// User settings override usergroup settings
if(is_array($forum['users'][$uid]))
{
$perm = $forum['users'][$uid];

			foreach($perm as $action => $value)
{
if(strpos($action, "can") === false)
{
continue;
}


			foreach($perm as $action => $value)
{
if(strpos($action, "can") === false)
{
continue;
}


				// Figure out the user permissions
if($value == 0)

				// Figure out the user permissions
if($value == 0)

				{

				{

					// The user doesn't have permission to set this action
$perms[$action] = 0;
}

					// The user doesn't have permission to set this action
$perms[$action] = 0;
}

Zeile 1698Zeile 1766
			if(!is_array($forum['usergroups'][$group]))
{
// There are no permissions set for this group

			if(!is_array($forum['usergroups'][$group]))
{
// There are no permissions set for this group

				continue;
}

				continue;
}


$perm = $forum['usergroups'][$group];
foreach($perm as $action => $value)


$perm = $forum['usergroups'][$group];
foreach($perm as $action => $value)

Zeile 1728Zeile 1796
 * @return bool Returns true if the user has permission, false if they do not
*/
function is_moderator($fid=0, $action="", $uid=0)

 * @return bool Returns true if the user has permission, false if they do not
*/
function is_moderator($fid=0, $action="", $uid=0)

{
global $mybb, $cache;

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

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

$user_perms = user_permissions($uid);

{
global $mybb, $cache;

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

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

$user_perms = user_permissions($uid);

	if($user_perms['issupermod'] == 1)
{
if($fid)

	if($user_perms['issupermod'] == 1)
{
if($fid)

Zeile 1760Zeile 1828
		if(!$fid)
{
$modcache = $cache->read('moderators');

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

			if(!empty($modcache))
{

			if(!empty($modcache))
{

				foreach($modcache as $modusers)
{
if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'] && (!$action || !empty($modusers['users'][$uid][$action])))

				foreach($modcache as $modusers)
{
if(isset($modusers['users'][$uid]) && $modusers['users'][$uid]['mid'] && (!$action || !empty($modusers['users'][$uid][$action])))

Zeile 1803Zeile 1871
			}
}
}

			}
}
}

 
}

/**
* Get an array of fids that the forum moderator has access to.
* Do not use for administraotrs or global moderators as they moderate any forum and the function will return false.
*
* @param int $uid The user ID (0 assumes current user)
* @return array|bool an array of the fids the user has moderator access to or bool if called incorrectly.
*/
function get_moderated_fids($uid=0)
{
global $mybb, $cache;

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

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

$user_perms = user_permissions($uid);

if($user_perms['issupermod'] == 1)
{
return false;
}

$fids = array();

$modcache = $cache->read('moderators');
if(!empty($modcache))
{
$groups = explode(',', $user_perms['all_usergroups']);

foreach($modcache as $fid => $forum)
{
if(isset($forum['users'][$uid]) && $forum['users'][$uid]['mid'])
{
$fids[] = $fid;
continue;
}

foreach($groups as $group)
{
if(trim($group) != '' && isset($forum['usergroups'][$group]))
{
$fids[] = $fid;
}
}
}
}

return $fids;

}

/**

}

/**

Zeile 4265Zeile 4389
		$permissioncache = forum_permissions();
}


		$permissioncache = forum_permissions();
}


	$password_forums = $unviewable = array();

	$unviewable = array();

	foreach($forum_cache as $fid => $forum)
{
if($permissioncache[$forum['fid']])

	foreach($forum_cache as $fid => $forum)
{
if($permissioncache[$forum['fid']])

Zeile 4279Zeile 4403

$pwverified = 1;



$pwverified = 1;


		if($forum['password'] != "")



if(!forum_password_validated($forum, true))

		{

		{

			if($mybb->cookies['forumpass'][$forum['fid']] !== md5($mybb->user['uid'].$forum['password']))
{
$pwverified = 0;
}

$password_forums[$forum['fid']] = $forum['password'];

			$pwverified = 0;






		}
else
{

		}
else
{

Zeile 4294Zeile 4414
			$parents = explode(",", $forum['parentlist']);
foreach($parents as $parent)
{

			$parents = explode(",", $forum['parentlist']);
foreach($parents as $parent)
{

				if(isset($password_forums[$parent]) && $mybb->cookies['forumpass'][$parent] !== md5($mybb->user['uid'].$password_forums[$parent]))

				if(!forum_password_validated($forum_cache[$parent], true))

				{
$pwverified = 0;

				{
$pwverified = 0;

 
					break;

				}
}
}

				}
}
}

Zeile 4426Zeile 4547
	global $pforumcache, $currentitem, $forum_cache, $navbits, $lang, $base_url, $archiveurl;

if(!$pforumcache)

	global $pforumcache, $currentitem, $forum_cache, $navbits, $lang, $base_url, $archiveurl;

if(!$pforumcache)

	{

	{

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

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

Zeile 4663Zeile 4784
		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-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 "<tr>\n";
echo "<td style=\"background: #fff;\">".implode(", ", array_keys($templates->cache))."</td>\n";
echo "</tr>\n";

		echo "</table>\n";
echo "<br />\n";
}

		echo "</table>\n";
echo "<br />\n";
}

Zeile 4696Zeile 4817

if($mybb->settings['nocacheheaders'] == 1)
{


if($mybb->settings['nocacheheaders'] == 1)
{

		header("Expires: Sat, 1 Jan 2000 01:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");

		header("Cache-Control: no-cache, private");




	}
}


	}
}


Zeile 4839Zeile 4957
	{
$options = array_merge(array(
'minutes' => false,

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

			'seconds' => false
), $options);

			'seconds' => false
), $options);

	}
elseif($days > 0)
{

	}
elseif($days > 0)
{

Zeile 4952Zeile 5070
	if($alttrow == "trow1" && !$reset)
{
$trow = "trow2";

	if($alttrow == "trow1" && !$reset)
{
$trow = "trow2";

	}
else
{

	}
else
{

		$trow = "trow1";

		$trow = "trow1";

	}

	}


$alttrow = $trow;



$alttrow = $trow;


Zeile 4975Zeile 5093
	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 4985Zeile 5103
	}

// Build the new list of additional groups for this user and make sure they're in the right format

	}

// Build the new list of additional groups for this user and make sure they're in the right format

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

if(is_array($groups))
{
$comma = '';
foreach($groups as $gid)
{
if(trim($gid) != "" && $gid != $user['usergroup'] && !isset($donegroup[$gid]))
{
$groupslist .= $comma.$gid;
$comma = ",";
$donegroup[$gid] = 1;
}
}
}

// What's the point in updating if they're the same?
if($groupslist != $user['additionalgroups'])

	$groups = array_map(
'intval',
explode(',', $user['additionalgroups'])
);

if(!in_array((int)$joingroup, $groups))
















	{

	{

 
		$groups[] = (int)$joingroup;
$groups = array_diff($groups, array($user['usergroup']));
$groups = array_unique($groups);

$groupslist = implode(',', $groups);


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

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

Zeile 5028Zeile 5137

$user = get_user($uid);



$user = get_user($uid);


	$groupslist = $comma = '';
$usergroups = $user['additionalgroups'].",";
$donegroup = array();

$groups = explode(",", $user['additionalgroups']);

if(is_array($groups))
{
foreach($groups as $gid)
{
if(trim($gid) != "" && $leavegroup != $gid && empty($donegroup[$gid]))
{
$groupslist .= $comma.$gid;
$comma = ",";
$donegroup[$gid] = 1;
}
}
}


	if($user['usergroup'] == $leavegroup)
{
return false;
}

$groups = array_map(
'intval',
explode(',', $user['additionalgroups'])
);
$groups = array_diff($groups, array($leavegroup));
$groups = array_unique($groups);

$groupslist = implode(',', $groups);







	$dispupdate = "";
if($leavegroup == $user['displaygroup'])
{
$dispupdate = ", displaygroup=usergroup";

	$dispupdate = "";
if($leavegroup == $user['displaygroup'])
{
$dispupdate = ", displaygroup=usergroup";

	}


	}


	$db->write_query("
UPDATE ".TABLE_PREFIX."users
SET additionalgroups='$groupslist' $dispupdate

	$db->write_query("
UPDATE ".TABLE_PREFIX."users
SET additionalgroups='$groupslist' $dispupdate

Zeile 5066Zeile 5170
 * Get the current location taking in to account different web serves and systems
*
* @param boolean $fields True to return as "hidden" fields

 * 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 array $ignore Array of fields to ignore for returning "hidden" fields or URL being accessed

 * @param boolean $quick True to skip all inputs and return only the file path part of the URL

 * @param boolean $quick True to skip all inputs and return only the file path part of the URL

 * @return string The current URL being accessed

 * @return string|array The current URL being accessed or form data if $fields is true

 */
function get_current_location($fields=false, $ignore=array(), $quick=false)
{

 */
function get_current_location($fields=false, $ignore=array(), $quick=false)
{

 
	global $mybb;


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

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

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

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

	{

	{

		$location = htmlspecialchars_uni($_SERVER['SCRIPT_NAME']);
}
elseif(!empty($_SERVER['PHP_SELF']))

		$location = htmlspecialchars_uni($_SERVER['SCRIPT_NAME']);
}
elseif(!empty($_SERVER['PHP_SELF']))

Zeile 5092Zeile 5198
	elseif(!empty($_SERVER['PATH_INFO']))
{
$location = htmlspecialchars_uni($_SERVER['PATH_INFO']);

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

	}
else
{

	}
else
{

		$location = htmlspecialchars_uni($_ENV['PATH_INFO']);
}

if($quick)
{
return $location;

		$location = htmlspecialchars_uni($_ENV['PATH_INFO']);
}

if($quick)
{
return $location;

	}

if($fields == true)

	}

if(!is_array($ignore))

	{

	{

		global $mybb;


		$ignore = array($ignore);
}





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

	if($fields == true)
{




$form_html = '';
if(!empty($mybb->input))


$form_html = '';
if(!empty($mybb->input))

Zeile 5123Zeile 5228
				}

$form_html .= "<input type=\"hidden\" name=\"".htmlspecialchars_uni($name)."\" value=\"".htmlspecialchars_uni($value)."\" />\n";

				}

$form_html .= "<input type=\"hidden\" name=\"".htmlspecialchars_uni($name)."\" value=\"".htmlspecialchars_uni($value)."\" />\n";

			}
}


			}
}


		return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method);
}
else
{

		return array('location' => $location, 'form_html' => $form_html, 'form_method' => $mybb->request_method);
}
else
{

 
		$parameters = array();


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

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

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

		{
$current_query_string = $_SERVER['QUERY_STRING'];
}

		else if(isset($_ENV['QUERY_STRING']))

		else if(isset($_ENV['QUERY_STRING']))

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

if((isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") || (isset($_ENV['REQUEST_METHOD']) && $_ENV['REQUEST_METHOD'] == "POST"))
{
$post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');














		{
$current_query_string = $_ENV['QUERY_STRING'];
} else
{
$current_query_string = '';
}

parse_str($current_query_string, $current_parameters);

foreach($current_parameters as $name => $value)
{
if(!in_array($name, $ignore))
{
$parameters[$name] = $value;
}
}

if($mybb->request_method === 'post')
{
$post_array = array('action', 'fid', 'pid', 'tid', 'uid', 'eid');


foreach($post_array as $var)
{


foreach($post_array as $var)
{

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

				if(isset($_POST[$var]) && !in_array($var, $ignore))

				{

				{

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

					$parameters[$var] = $_POST[$var];

				}
}

				}
}

 
		}





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

		if(!empty($parameters))
{
$location .= '?'.http_build_query($parameters, '', '&amp;');










		}

return $location;

		}

return $location;

Zeile 5796Zeile 5908
	}

return $string;

	}

return $string;

 
}

/**
* Finds a needle in a haystack and returns it position, mb strings accounted for, case insensitive
*
* @param string $haystack String to look in (haystack)
* @param string $needle What to look for (needle)
* @param int $offset (optional) How much to offset
* @return int|bool false on needle not found, integer position if found
*/
function my_stripos($haystack, $needle, $offset=0)
{
if($needle == '')
{
return false;
}

if(function_exists("mb_stripos"))
{
$position = mb_stripos($haystack, $needle, $offset);
}
else
{
$position = stripos($haystack, $needle, $offset);
}

return $position;

}

/**

}

/**

Zeile 6026Zeile 6165
	if($page > 0)
{
$link = str_replace("{fid}", $fid, FORUM_URL_PAGED);

	if($page > 0)
{
$link = str_replace("{fid}", $fid, FORUM_URL_PAGED);

		$link = str_replace("{page}", $page, $link);
return htmlspecialchars_uni($link);
}
else

		$link = str_replace("{page}", $page, $link);
return htmlspecialchars_uni($link);
}
else

	{
$link = str_replace("{fid}", $fid, FORUM_URL);
return htmlspecialchars_uni($link);

	{
$link = str_replace("{fid}", $fid, FORUM_URL);
return htmlspecialchars_uni($link);

Zeile 6259Zeile 6398

/**
* Get the forum of a specific forum id.


/**
* Get the forum of a specific forum id.

 *

 *

 * @param int $fid The forum id of the forum.
* @param int $active_override (Optional) If set to 1, will override the active forum status
* @return array|bool The database row of a forum. False on failure

 * @param int $fid The forum id of the forum.
* @param int $active_override (Optional) If set to 1, will override the active forum status
* @return array|bool The database row of a forum. False on failure

Zeile 6269Zeile 6408
	global $cache;
static $forum_cache;


	global $cache;
static $forum_cache;


	if(!isset($forum_cache) || is_array($forum_cache))

	if(!isset($forum_cache) || !is_array($forum_cache))

	{
$forum_cache = $cache->read("forums");
}

if(empty($forum_cache[$fid]))

	{
$forum_cache = $cache->read("forums");
}

if(empty($forum_cache[$fid]))

	{

	{

		return false;
}


		return false;
}


Zeile 6328Zeile 6467
		else
{
$thread_cache[$tid] = false;

		else
{
$thread_cache[$tid] = false;

			return false;
}
}
}

/**

			return false;
}
}
}

/**

 * Get the post of a post id.
*
* @param int $pid The post id of the post.

 * Get the post of a post id.
*
* @param int $pid The post id of the post.

Zeile 6347Zeile 6486
	$pid = (int)$pid;

if(isset($post_cache[$pid]))

	$pid = (int)$pid;

if(isset($post_cache[$pid]))

	{

	{

		return $post_cache[$pid];
}
else

		return $post_cache[$pid];
}
else

Zeile 6376Zeile 6515
function get_inactive_forums()
{
global $forum_cache, $cache;

function get_inactive_forums()
{
global $forum_cache, $cache;





	if(!$forum_cache)
{
cache_forums();

	if(!$forum_cache)
{
cache_forums();

Zeile 6561Zeile 6700
	while($setting = $db->fetch_array($query))
{
$mybb->settings[$setting['name']] = $setting['value'];

	while($setting = $db->fetch_array($query))
{
$mybb->settings[$setting['name']] = $setting['value'];

 

$setting['name'] = addcslashes($setting['name'], "\\'");

		$setting['value'] = addcslashes($setting['value'], '\\"$');
$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";
}

		$setting['value'] = addcslashes($setting['value'], '\\"$');
$settings .= "\$settings['{$setting['name']}'] = \"{$setting['value']}\";\n";
}

Zeile 6720Zeile 6861
	elseif($src <= 0x07ff)
{
$dest .= chr(0xc0 | ($src >> 6));

	elseif($src <= 0x07ff)
{
$dest .= chr(0xc0 | ($src >> 6));

		$dest .= chr(0x80 | ($src & 0x003f));
}

		$dest .= chr(0x80 | ($src & 0x003f));
}

	elseif($src <= 0xffff)
{
$dest .= chr(0xe0 | ($src >> 12));

	elseif($src <= 0xffff)
{
$dest .= chr(0xe0 | ($src >> 12));

Zeile 7112Zeile 7253

if(in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE), array(301, 302)))
{


if(in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE), array(301, 302)))
{

				preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);

				preg_match('/^Location:(.*?)(?:\n|$)/im', $header, $matches);


if($matches)
{


if($matches)
{

Zeile 7173Zeile 7314
					'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,

					'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,

 
						'peer_name' => $url_components['host'],

					),
));
}

					),
));
}

Zeile 7237Zeile 7379

if($max_redirects > 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 ')))
{


if($max_redirects > 0 && (strstr($status_line, ' 301 ') || strstr($status_line, ' 302 ')))
{

			preg_match('/Location:(.*?)(?:\n|$)/', $header, $matches);

			preg_match('/^Location:(.*?)(?:\n|$)/im', $header, $matches);


if($matches)
{


if($matches)
{

Zeile 8738Zeile 8880

if(file_exists($file_path))
{


if(file_exists($file_path))
{

 

if(is_object($plugins))
{
$hook_args = array(
'file_path' => &$file_path,
'real_file_path' => &$real_file_path,
'file_name' => &$file_name,
'file_dir_path' => &$file_dir_path
);
$plugins->run_hooks('copy_file_to_cdn_start', $hook_args);
}


		if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath']))
{
$cdn_path = rtrim($mybb->settings['cdnpath'], '/\\');

		if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath']))
{
$cdn_path = rtrim($mybb->settings['cdnpath'], '/\\');