Vergleich admin/inc/functions.php - 1.8.15 - 1.8.34

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 205Zeile 205

reset($pforumcache);
reset($pforumcache[$fid]);


reset($pforumcache);
reset($pforumcache[$fid]);

 

$navigation = '';


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


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

			if($pforumcache[$forum['pid']])

			if(!empty($pforumcache[$forum['pid']]))

			{
$navigation = make_parent_list($forum['pid'], $navsep).$navigation;
}

if($navigation)

			{
$navigation = make_parent_list($forum['pid'], $navsep).$navigation;
}

if($navigation)

			{

			{

				$navigation .= $navsep;
}
$navigation .= $forum['fid'];

				$navigation .= $navsep;
}
$navigation .= $forum['fid'];

Zeile 255Zeile 257
		$existing_permissions = $db->fetch_array($query2);

if(!$existing_permissions)

		$existing_permissions = $db->fetch_array($query2);

if(!$existing_permissions)

		{

		{

			$query2 = $db->simple_select("usergroups", $db->escape_string(implode(',', array_keys($usergroup_permission_fields))), "gid='{$usergroup['gid']}'", array('limit' => 1));
$existing_permissions = $db->fetch_array($query2);
}

			$query2 = $db->simple_select("usergroups", $db->escape_string(implode(',', array_keys($usergroup_permission_fields))), "gid='{$usergroup['gid']}'", array('limit' => 1));
$existing_permissions = $db->fetch_array($query2);
}

Zeile 264Zeile 266
		$db->delete_query("forumpermissions", "fid='{$fid}' AND gid='{$usergroup['gid']}'");

// Only insert the new ones if we're using custom permissions

		$db->delete_query("forumpermissions", "fid='{$fid}' AND gid='{$usergroup['gid']}'");

// Only insert the new ones if we're using custom permissions

		if($inherit[$usergroup['gid']] != 1)

		if(empty($inherit[$usergroup['gid']]))

		{

		{

			if($canview[$usergroup['gid']] == 1)

			if(!empty($canview[$usergroup['gid']]))

			{
$pview = 1;
}

			{
$pview = 1;
}

Zeile 275Zeile 277
				$pview = 0;
}


				$pview = 0;
}


			if($canpostthreads[$usergroup['gid']] == 1)

			if(!empty($canpostthreads[$usergroup['gid']]))

			{
$pthreads = 1;
}

			{
$pthreads = 1;
}

Zeile 284Zeile 286
				$pthreads = 0;
}


				$pthreads = 0;
}


			if($canpostreplies[$usergroup['gid']] == 1)

			if(!empty($canpostreplies[$usergroup['gid']]))

			{
$preplies = 1;

			{
$preplies = 1;

			}
else
{

			}
else
{

				$preplies = 0;

				$preplies = 0;

			}

if($canpostpolls[$usergroup['gid']] == 1)

			}

if(!empty($canpostpolls[$usergroup['gid']]))

			{
$ppolls = 1;
}

			{
$ppolls = 1;
}

			else
{
$ppolls = 0;
}

			else
{
$ppolls = 0;
}


if(!$preplies && !$pthreads)
{
$ppost = 0;
}
else


if(!$preplies && !$pthreads)
{
$ppost = 0;
}
else

			{

			{

				$ppost = 1;
}


				$ppost = 1;
}


Zeile 326Zeile 328
				{
continue;
}

				{
continue;
}


$insertquery[$db->escape_string($field)] = (int)$existing_permissions[$field];


$insertquery[$db->escape_string($field)] = isset($existing_permissions[$field]) ? (int)$existing_permissions[$field] : 0;

			}

$db->insert_query("forumpermissions", $insertquery);

			}

$db->insert_query("forumpermissions", $insertquery);

Zeile 346Zeile 348
function check_admin_permissions($action, $error = true)
{
global $mybb, $page, $lang, $modules_dir;

function check_admin_permissions($action, $error = true)
{
global $mybb, $page, $lang, $modules_dir;





	if(is_super_admin($mybb->user['uid']))
{
return true;

	if(is_super_admin($mybb->user['uid']))
{
return true;

Zeile 357Zeile 359
	{
$func = $action['module']."_admin_permissions";
$permissions = $func();

	{
$func = $action['module']."_admin_permissions";
$permissions = $func();

		if($permissions['permissions'][$action['action']] && $mybb->admin['permissions'][$action['module']][$action['action']] != 1)




		if(
!empty($permissions['permissions'][$action['action']]) &&
empty($mybb->admin['permissions'][$action['module']][$action['action']])
)

		{
if($error)
{

		{
if($error)
{

Zeile 366Zeile 371
				$page->output_error("<b>{$lang->access_denied}</b><ul><li style=\"list-style-type: none;\">{$lang->access_denied_desc}</li></ul>");
$page->output_footer();
exit;

				$page->output_error("<b>{$lang->access_denied}</b><ul><li style=\"list-style-type: none;\">{$lang->access_denied_desc}</li></ul>");
$page->output_footer();
exit;

			}

			}

			else
{
return false;

			else
{
return false;

Zeile 502Zeile 507
		{
return $final_group_perms;
}

		{
return $final_group_perms;
}

		else

		elseif(isset($perms_def))

		{
return $perms_def;
}

		{
return $perms_def;
}

 

return array();

	}
}


	}
}


Zeile 596Zeile 603
 * @return mixed Return an array if the second parameter is true, boolean otherwise.
*/
function login_attempt_check_acp($uid=0, $return_num=false)

 * @return mixed Return an array if the second parameter is true, boolean otherwise.
*/
function login_attempt_check_acp($uid=0, $return_num=false)

{

{

	global $db, $mybb;

	global $db, $mybb;





	$attempts['loginattempts'] = 0;

	$attempts['loginattempts'] = 0;





	if($uid > 0)
{
$query = $db->simple_select("adminoptions", "loginattempts, loginlockoutexpiry", "uid='".(int)$uid."'", 1);
$attempts = $db->fetch_array($query);

	if($uid > 0)
{
$query = $db->simple_select("adminoptions", "loginattempts, loginlockoutexpiry", "uid='".(int)$uid."'", 1);
$attempts = $db->fetch_array($query);

	}








if(!$attempts)
{
return false;
}
}


	if($attempts['loginattempts'] <= 0)
{
return false;

	if($attempts['loginattempts'] <= 0)
{
return false;

Zeile 633Zeile 645
	}

return false;

	}

return false;

}


}


/**
* Checks whether the administrator is on a mobile device
*

/**
* Checks whether the administrator is on a mobile device
*

Zeile 662Zeile 674

// System calls via backtick
if(preg_match('#\$\s*\{#', $template))


// System calls via backtick
if(preg_match('#\$\s*\{#', $template))

	{
return true;

	{
return true;

	}

// Any other malicious acts?

	}

// Any other malicious acts?

Zeile 671Zeile 683
	if(preg_match("~\\{\\$.+?\\}~s", preg_replace('~\\{\\$+[a-zA-Z_][a-zA-Z_0-9]*((?:-\\>|\\:\\:)\\$*[a-zA-Z_][a-zA-Z_0-9]*|\\[\s*\\$*([\'"]?)[a-zA-Z_ 0-9 ]+\\2\\]\s*)*\\}~', '', $template)))
{
return true;

	if(preg_match("~\\{\\$.+?\\}~s", preg_replace('~\\{\\$+[a-zA-Z_][a-zA-Z_0-9]*((?:-\\>|\\:\\:)\\$*[a-zA-Z_][a-zA-Z_0-9]*|\\[\s*\\$*([\'"]?)[a-zA-Z_ 0-9 ]+\\2\\]\s*)*\\}~', '', $template)))
{
return true;

	}


	}


	return false;
}


	return false;
}


Zeile 692Zeile 704
	$postcache = array();
$query = $db->simple_select("posts", "pid", "uid = '".$uid."' AND dateline < '".$date."'");
while($post = $db->fetch_array($query))

	$postcache = array();
$query = $db->simple_select("posts", "pid", "uid = '".$uid."' AND dateline < '".$date."'");
while($post = $db->fetch_array($query))

	{

	{

		$postcache[] = $post['pid'];
}


		$postcache[] = $post['pid'];
}


Zeile 711Zeile 723
			LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE p.pid IN ({$user_posts})
");

			LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE p.pid IN ({$user_posts})
");





		$post_count = 0; // Collect the post number to deduct from the user's postcount
$thread_list = array();
$forum_list = array();

		$post_count = 0; // Collect the post number to deduct from the user's postcount
$thread_list = array();
$forum_list = array();

Zeile 724Zeile 736
		{
while($post = $db->fetch_array($query))
{

		{
while($post = $db->fetch_array($query))
{

				if($post['usepostcounts'] != 0 && $post['visible'] != 0)

				if($post['usepostcounts'] != 0 && $post['visible'] == 1)

				{
++$post_count;
}

				{
++$post_count;
}

Zeile 750Zeile 762
			}

$db->update_query("users", array("postnum" => "postnum-".$post_count.""), "uid='".$uid."'", 1, true);

			}

$db->update_query("users", array("postnum" => "postnum-".$post_count.""), "uid='".$uid."'", 1, true);





			$to_return = array(
'to_delete' => $delete_thread_list,
'thread_update' => $thread_list,

			$to_return = array(
'to_delete' => $delete_thread_list,
'thread_update' => $thread_list,

Zeile 758Zeile 770
			);

return $to_return;

			);

return $to_return;

		}
}
}

		}
}
}


/**
* Prints a selection JavaScript code for selectable groups/forums fields.


/**
* Prints a selection JavaScript code for selectable groups/forums fields.

Zeile 786Zeile 798
			if($(this).prop('checked') == true)
{
checked = $(this).val();

			if($(this).prop('checked') == true)
{
checked = $(this).val();

			}
});


			}
});


		$('.'+id+'_forums_groups').each(function(e)

		$('.'+id+'_forums_groups').each(function(e)

		{

		{

			$(this).hide();
});

if($('#'+id+'_forums_groups_'+checked))
{
$('#'+id+'_forums_groups_'+checked).show();

			$(this).hide();
});

if($('#'+id+'_forums_groups_'+checked))
{
$('#'+id+'_forums_groups_'+checked).show();

		}
}

		}
}

</script>";
}


</script>";
}


Zeile 807Zeile 819
	function array_column($input, $column_key)
{
$values = array();

	function array_column($input, $column_key)
{
$values = array();





		if(!is_array($input))
{
$input = array($input);

		if(!is_array($input))
{
$input = array($input);

Zeile 827Zeile 839

return $values;
}


return $values;
}

 
}

/**
* Output the auto redirect block.
*
* @param \Form $form An existing form instance to wrap the redirect within.
* @param string $prompt The prompt to show.
*/
function output_auto_redirect($form, $prompt)
{
global $lang;

echo <<<HTML
<div class="confirm_action">
<p>{$prompt}</p>
<br />
<script type="text/javascript">
$(function() {
var button = $("#proceed_button");
if (button.length > 0) {
// create a temporary div element to render the text within, un-escaping HTML entities
var textElement = $('<div/>').html('{$lang->automatically_redirecting}');

button.val(textElement.text());
button.attr("disabled", true);
button.css("color", "#aaa");
button.css("borderColor", "#aaa");

var parent_form = button.closest('form');

if (parent_form.length > 0) {
parent_form.submit();
}
}
});
</script>
<p class="buttons">
{$form->generate_submit_button($lang->proceed, array('class' => 'button_yes', 'id' => 'proceed_button'))}
</p>
</div>
HTML;

}

}