Vergleich inc/functions.php - 1.8.33 - 1.8.34

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 588Zeile 588
			}
}


			}
}


		$plugins->run_hooks('my_mailhandler_builtin_after_init', $my_mailhandler_builtin);




		if(isset($plugins) && is_object($plugins))
{
$plugins->run_hooks('my_mailhandler_builtin_after_init', $my_mailhandler_builtin);
}


return $my_mailhandler_builtin;
}


return $my_mailhandler_builtin;
}

Zeile 598Zeile 601
	{
require_once MYBB_ROOT . "inc/class_mailhandler.php";


	{
require_once MYBB_ROOT . "inc/class_mailhandler.php";


		$plugins->run_hooks('my_mailhandler_init', $my_mailhandler);





		if(isset($plugins) && is_object($plugins))
{
$plugins->run_hooks('my_mailhandler_init', $my_mailhandler);
}


		// If no plugin has ever created the mail handler, resort to use the built-in one.
if(!is_object($my_mailhandler) || !($my_mailhandler instanceof MailHandler))
{
$my_mailhandler = &get_my_mailhandler(true);

		// If no plugin has ever created the mail handler, resort to use the built-in one.
if(!is_object($my_mailhandler) || !($my_mailhandler instanceof MailHandler))
{
$my_mailhandler = &get_my_mailhandler(true);

		}
}


		}
}


	return $my_mailhandler;
}


	return $my_mailhandler;
}


Zeile 664Zeile 670
		'continue_process' => &$continue_process,
);


		'continue_process' => &$continue_process,
);


	$plugins->run_hooks('my_mail_pre_build_message', $my_mail_parameters);




	if(isset($plugins) && is_object($plugins))
{
$plugins->run_hooks('my_mail_pre_build_message', $my_mail_parameters);
}


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



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


	$plugins->run_hooks('my_mail_pre_send', $my_mail_parameters);





	if(isset($plugins) && is_object($plugins))
{
$plugins->run_hooks('my_mail_pre_send', $my_mail_parameters);
}


	// Check if the hooked plugins still suggest to send the mail.
if($continue_process)
{
$is_mail_sent = $mail->send();

	// Check if the hooked plugins still suggest to send the mail.
if($continue_process)
{
$is_mail_sent = $mail->send();

	}

	}





	$plugins->run_hooks('my_mail_post_send', $my_mail_parameters);




	if(isset($plugins) && is_object($plugins))
{
$plugins->run_hooks('my_mail_post_send', $my_mail_parameters);
}


return $is_mail_sent;
}


return $is_mail_sent;
}

Zeile 692Zeile 707
function generate_post_check($rotation_shift=0)
{
global $mybb, $session;

function generate_post_check($rotation_shift=0)
{
global $mybb, $session;





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


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


Zeile 725Zeile 740
 * @return bool|void Result boolean if $silent is true, otherwise shows an error to the user
*/
function verify_post_check($code, $silent=false)

 * @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;
if(
generate_post_check() !== $code &&

	global $lang;
if(
generate_post_check() !== $code &&

Zeile 988Zeile 1003
		"nopermission" => '1',
"location1" => 0,
"location2" => 0

		"nopermission" => '1',
"location1" => 0,
"location2" => 0

	);

$db->update_query("sessions", $noperm_array, "sid='{$session->sid}'");

	);

$db->update_query("sessions", $noperm_array, "sid='{$session->sid}'");


if($mybb->get_input('ajax', MyBB::INPUT_INT))
{


if($mybb->get_input('ajax', MyBB::INPUT_INT))
{

Zeile 1650Zeile 1665
		if(empty($cached_forum_permissions_permissions[$gid][$fid]))
{
$cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);

		if(empty($cached_forum_permissions_permissions[$gid][$fid]))
{
$cached_forum_permissions_permissions[$gid][$fid] = fetch_forum_permissions($fid, $gid, $groupperms);

		}
return $cached_forum_permissions_permissions[$gid][$fid];

		}
return $cached_forum_permissions_permissions[$gid][$fid];

	}
else
{

	}
else
{

Zeile 1663Zeile 1678
			}
}
return $cached_forum_permissions[$gid];

			}
}
return $cached_forum_permissions[$gid];

	}
}

/**

	}
}

/**

 * Fetches the permissions for a specific forum/group applying the inheritance scheme.
* Called by forum_permissions()
*

 * Fetches the permissions for a specific forum/group applying the inheritance scheme.
* Called by forum_permissions()
*

Zeile 1678Zeile 1693
function fetch_forum_permissions($fid, $gid, $groupperms)
{
global $groupscache, $forum_cache, $fpermcache, $mybb, $fpermfields;

function fetch_forum_permissions($fid, $gid, $groupperms)
{
global $groupscache, $forum_cache, $fpermcache, $mybb, $fpermfields;





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

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


if(empty($fpermcache[$fid])) // This forum has no custom or inherited permissions so lets just return the group permissions
{
return $groupperms;
}

 

$current_permissions = array();
$only_view_own_threads = 1;
$only_reply_own_threads = 1;



$current_permissions = array();
$only_view_own_threads = 1;
$only_reply_own_threads = 1;


	foreach($groups as $gid)





	if(empty($fpermcache[$fid])) // This forum has no custom or inherited permissions so lets just return the group permissions
{
$current_permissions = $groupperms;
}
else

	{

	{

		if(!empty($groupscache[$gid]))

		foreach($groups as $gid)

		{

		{

			$level_permissions = array();

// If our permissions arn't inherited we need to figure them out
if(empty($fpermcache[$fid][$gid]))
{
$parents = explode(',', $forum_cache[$fid]['parentlist']);
rsort($parents);
if(!empty($parents))
{
foreach($parents as $parent_id)
{
if(!empty($fpermcache[$parent_id][$gid]))
{
$level_permissions = $fpermcache[$parent_id][$gid];
break;
}
}
}

			// If this forum has custom or inherited permissions for the currently looped group.
if(!empty($fpermcache[$fid][$gid]))
{
$level_permissions = $fpermcache[$fid][$gid];
}
// Or, use the group permission instead, if available. Some forum permissions not existing here will be added back later.
else if(!empty($groupscache[$gid]))
{
$level_permissions = $groupscache[$gid];










			}

			}

 
			// No permission is available for the currently looped group, probably we have bad data here.

			else

			else

			{
$level_permissions = $fpermcache[$fid][$gid];
}

// If we STILL don't have forum permissions we use the usergroup itself
if(empty($level_permissions))
{
$level_permissions = $groupscache[$gid];
}

			{
continue;
}








foreach($level_permissions as $permission => $access)
{


foreach($level_permissions as $permission => $access)
{

Zeile 1735Zeile 1735
			if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"]))
{
$only_view_own_threads = 0;

			if($level_permissions["canview"] && empty($level_permissions["canonlyviewownthreads"]))
{
$only_view_own_threads = 0;

			}


			}


			if($level_permissions["canpostreplys"] && empty($level_permissions["canonlyreplyownthreads"]))
{
$only_reply_own_threads = 0;
}
}

			if($level_permissions["canpostreplys"] && empty($level_permissions["canonlyreplyownthreads"]))
{
$only_reply_own_threads = 0;
}
}

	}







if(count($current_permissions) == 0)
{
$current_permissions = $groupperms;
}
}


// Figure out if we can view more than our own threads


// Figure out if we can view more than our own threads

	if($only_view_own_threads == 0)

	if($only_view_own_threads == 0 || !isset($current_permissions["canonlyviewownthreads"]))

	{
$current_permissions["canonlyviewownthreads"] = 0;
}

// Figure out if we can reply more than our own threads

	{
$current_permissions["canonlyviewownthreads"] = 0;
}

// Figure out if we can reply more than our own threads

	if($only_reply_own_threads == 0)
{

	if($only_reply_own_threads == 0 || !isset($current_permissions["canonlyreplyownthreads"]))
{

		$current_permissions["canonlyreplyownthreads"] = 0;

		$current_permissions["canonlyreplyownthreads"] = 0;

	}

	}





	if(count($current_permissions) == 0)
{
$current_permissions = $groupperms;
}

 
	return $current_permissions;
}


	return $current_permissions;
}


Zeile 1803Zeile 1804
		my_hash_equals(
md5($mybb->user['uid'].$forum['password']),
$mybb->cookies['forumpass'][$forum['fid']]

		my_hash_equals(
md5($mybb->user['uid'].$forum['password']),
$mybb->cookies['forumpass'][$forum['fid']]

		)
);
}

		)
);
}


/**
* Check the password given on a certain forum for validity


/**
* Check the password given on a certain forum for validity

Zeile 1818Zeile 1819
function check_forum_password($fid, $pid=0, $return=false)
{
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;

function check_forum_password($fid, $pid=0, $return=false)
{
global $mybb, $header, $footer, $headerinclude, $theme, $templates, $lang, $forum_cache;





	$showform = true;

if(!is_array($forum_cache))

	$showform = true;

if(!is_array($forum_cache))

	{

	{

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

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

Zeile 1855Zeile 1856
	if($forum_cache[$fid]['password'] !== '')
{
if(isset($mybb->input['pwverify']) && $pid == 0)

	if($forum_cache[$fid]['password'] !== '')
{
if(isset($mybb->input['pwverify']) && $pid == 0)

		{

		{

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

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

Zeile 1887Zeile 1888
	if($return)
{
return $showform;

	if($return)
{
return $showform;

	}

	}


if($showform)
{


if($showform)
{

Zeile 1904Zeile 1905
		exit;
}
}

		exit;
}
}





/**
* Return the permissions for a moderator in a specific forum
*

/**
* Return the permissions for a moderator in a specific forum
*

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

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

	}

	}


// Get user groups
$perms = array();


// Get user groups
$perms = array();

Zeile 2328Zeile 2329
	my_setcookie($name, "", $expires);

unset($mybb->cookies[$name]);

	my_setcookie($name, "", $expires);

unset($mybb->cookies[$name]);

}


}


/**
* Get the contents from a serialised cookie array.
*

/**
* Get the contents from a serialised cookie array.
*

Zeile 2340Zeile 2341
function my_get_array_cookie($name, $id)
{
global $mybb;

function my_get_array_cookie($name, $id)
{
global $mybb;





	if(!isset($mybb->cookies['mybb'][$name]))

	if(!isset($mybb->cookies['mybb'][$name]))

	{
return false;
}

$cookie = my_unserialize($mybb->cookies['mybb'][$name], false);

	{
return false;
}

$cookie = my_unserialize($mybb->cookies['mybb'][$name], false);


if(is_array($cookie) && isset($cookie[$id]))
{


if(is_array($cookie) && isset($cookie[$id]))
{

Zeile 2460Zeile 2461
		{
$value = (float)$matches[1];
$str = $matches[3];

		{
$value = (float)$matches[1];
$str = $matches[3];

		}

		}

		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
{
$value = substr($matches[2], 0, (int)$matches[1]);

		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
{
$value = substr($matches[2], 0, (int)$matches[1]);

Zeile 2723Zeile 2724

// Suhosin likes to throw a warning if exec is disabled then die - weird
if($func_blacklist = @ini_get('suhosin.executor.func.blacklist'))


// Suhosin likes to throw a warning if exec is disabled then die - weird
if($func_blacklist = @ini_get('suhosin.executor.func.blacklist'))

			{
if(strpos(",".$func_blacklist.",", 'exec') !== false)

			{
if(strpos(",".$func_blacklist.",", 'exec') !== false)

				{
return $lang->unknown;
}

				{
return $lang->unknown;
}

Zeile 2989Zeile 2990
	if(array_key_exists('posts', $update_query))
{
$posts_diff = $update_query['posts'] - $forum['posts'];

	if(array_key_exists('posts', $update_query))
{
$posts_diff = $update_query['posts'] - $forum['posts'];

		if($posts_diff > -1)

		if($posts_diff > -1)

		{
$new_stats['numposts'] = "+{$posts_diff}";
}

		{
$new_stats['numposts'] = "+{$posts_diff}";
}

Zeile 3005Zeile 3006
		if($unapprovedposts_diff > -1)
{
$new_stats['numunapprovedposts'] = "+{$unapprovedposts_diff}";

		if($unapprovedposts_diff > -1)
{
$new_stats['numunapprovedposts'] = "+{$unapprovedposts_diff}";

		}

		}

		else
{
$new_stats['numunapprovedposts'] = "{$unapprovedposts_diff}";

		else
{
$new_stats['numunapprovedposts'] = "{$unapprovedposts_diff}";

Zeile 3120Zeile 3121
				if((int)$changes[$counter] != 0)
{
$update_query[$counter] = $thread[$counter] + $changes[$counter];

				if((int)$changes[$counter] != 0)
{
$update_query[$counter] = $thread[$counter] + $changes[$counter];

				}
}
else

				}
}
else

			{
$update_query[$counter] = $changes[$counter];
}

			{
$update_query[$counter] = $changes[$counter];
}

Zeile 3386Zeile 3387
	if($addselect)
{
if($showextras == 0)

	if($addselect)
{
if($showextras == 0)

		{

		{

			$template = "special";
}
else

			$template = "special";
}
else

Zeile 3418Zeile 3419
function get_extension($file)
{
return my_strtolower(my_substr(strrchr($file, "."), 1));

function get_extension($file)
{
return my_strtolower(my_substr(strrchr($file, "."), 1));

}

/**

}

/**

 * Generates a random string.
*
* @param int $length The length of the string to generate.

 * Generates a random string.
*
* @param int $length The length of the string to generate.

Zeile 3503Zeile 3504
		$parameters = $plugins->run_hooks('format_name', $parameters);

$format = $parameters['format'];

		$parameters = $plugins->run_hooks('format_name', $parameters);

$format = $parameters['format'];





		$formattednames[$username] = str_replace("{username}", $username, $format);
}


		$formattednames[$username] = str_replace("{username}", $username, $format);
}


Zeile 3519Zeile 3520
 * @return array Information for the formatted avatar
*/
function format_avatar($avatar, $dimensions = '', $max_dimensions = '')

 * @return array Information for the formatted avatar
*/
function format_avatar($avatar, $dimensions = '', $max_dimensions = '')

{

{

	global $mybb, $theme;
static $avatars;


	global $mybb, $theme;
static $avatars;


Zeile 3783Zeile 3784
			$basic1 = $basic2 = $align = $font = $size = $color = $removeformat = $email = $link = $list = $code = $sourcemode = "";

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

			$basic1 = $basic2 = $align = $font = $size = $color = $removeformat = $email = $link = $list = $code = $sourcemode = "";

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

			{

			{

				$basic1 = "bold,italic,underline,strike|";
$basic2 = "horizontalrule,";
}

				$basic1 = "bold,italic,underline,strike|";
$basic2 = "horizontalrule,";
}

Zeile 5899Zeile 5900
		$lang->thursday,
$lang->friday,
$lang->saturday

		$lang->thursday,
$lang->friday,
$lang->saturday

	);

	);


$bmonth = array(
$lang->month_1,


$bmonth = array(
$lang->month_1,

Zeile 9030Zeile 9031
		}
}


		}
}


	if(!$pm['subject'] ||!$pm['message'] || !$pm['touid'] || (!$pm['receivepms'] && !$admin_override))

	if(empty($pm['subject']) || empty($pm['message']) || empty($pm['touid']) || (empty($pm['receivepms']) && !$admin_override))

	{
return false;
}

	{
return false;
}

Zeile 9054Zeile 9055
	}

$recipients_bcc = array();

	}

$recipients_bcc = array();

 

// Workaround for eliminating PHP warnings in PHP 8. Ref: https://github.com/mybb/mybb/issues/4630#issuecomment-1369144163
if(isset($pm['sender']['uid']) && $pm['sender']['uid'] === -1 && $fromid === -1)
{
$sender = array(
"uid" => 0,
"username" => ''
);
}


// Determine user ID
if((int)$fromid == 0)


// Determine user ID
if((int)$fromid == 0)

	{

	{

		$fromid = (int)$mybb->user['uid'];
}
elseif((int)$fromid < 0)

		$fromid = (int)$mybb->user['uid'];
}
elseif((int)$fromid < 0)

Zeile 9076Zeile 9086
		"do" => '',
"pmid" => ''
);

		"do" => '',
"pmid" => ''
);

 

// (continued) Workaround for eliminating PHP warnings in PHP 8. Ref: https://github.com/mybb/mybb/issues/4630#issuecomment-1369144163
if(isset($sender))
{
$pm['sender'] = $sender;
}


if(isset($session))
{


if(isset($session))
{