Vergleich admin/modules/forum/management.php - 1.8.22 - 1.8.38

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

if(!$errors)
{


if(!$errors)
{

 
				if($mybb->input['pid'] < 0)
{
$mybb->input['pid'] = 0;
}

				$new_forum = $from_forum;
unset($new_forum['fid'], $new_forum['threads'], $new_forum['posts'], $new_forum['lastpost'], $new_forum['lastposter'], $new_forum['lastposteruid'], $new_forum['lastposttid'], $new_forum['lastpostsubject'], $new_forum['unapprovedthreads'], $new_forum['unapprovedposts']);

				$new_forum = $from_forum;
unset($new_forum['fid'], $new_forum['threads'], $new_forum['posts'], $new_forum['lastpost'], $new_forum['lastposter'], $new_forum['lastposteruid'], $new_forum['lastposttid'], $new_forum['lastpostsubject'], $new_forum['unapprovedthreads'], $new_forum['unapprovedposts']);

				$new_forum['name'] = $db->escape_string($mybb->input['title']);
$new_forum['description'] = $db->escape_string($mybb->input['description']);
$new_forum['type'] = $db->escape_string($mybb->input['type']);

				$new_forum['name'] = $mybb->input['title'];
$new_forum['description'] = $mybb->input['description'];
$new_forum['type'] = $mybb->input['type'];

				$new_forum['pid'] = $mybb->get_input('pid', MyBB::INPUT_INT);

				$new_forum['pid'] = $mybb->get_input('pid', MyBB::INPUT_INT);

				$new_forum['rulestitle'] = $db->escape_string($new_forum['rulestitle']);
$new_forum['rules'] = $db->escape_string($new_forum['rules']);

 
				$new_forum['parentlist'] = '';

				$new_forum['parentlist'] = '';









foreach($new_forum as $key => $value)
{
$new_forum[$key] = $db->escape_string($value);
}


				$to = $db->insert_query("forums", $new_forum);

// Generate parent list

				$to = $db->insert_query("forums", $new_forum);

// Generate parent list

Zeile 112Zeile 119
					'parentlist' => $parentlist
);
$db->update_query("forums", $updatearray, "fid='{$to}'");

					'parentlist' => $parentlist
);
$db->update_query("forums", $updatearray, "fid='{$to}'");

			}
}

			}
}

		elseif($mybb->input['copyforumsettings'] == 1)
{
// Copy settings to existing forum

		elseif($mybb->input['copyforumsettings'] == 1)
{
// Copy settings to existing forum

Zeile 122Zeile 129
			if(!$db->num_rows($query))
{
$errors[] = $lang->error_invalid_destination_forum;

			if(!$db->num_rows($query))
{
$errors[] = $lang->error_invalid_destination_forum;

			}


			}


			if(!$errors)
{
$new_forum = $from_forum;
unset($new_forum['fid'], $new_forum['threads'], $new_forum['posts'], $new_forum['lastpost'], $new_forum['lastposter'], $new_forum['lastposteruid'], $new_forum['lastposttid'], $new_forum['lastpostsubject'], $new_forum['unapprovedthreads'], $new_forum['unapprovedposts']);

			if(!$errors)
{
$new_forum = $from_forum;
unset($new_forum['fid'], $new_forum['threads'], $new_forum['posts'], $new_forum['lastpost'], $new_forum['lastposter'], $new_forum['lastposteruid'], $new_forum['lastposttid'], $new_forum['lastpostsubject'], $new_forum['unapprovedthreads'], $new_forum['unapprovedposts']);

				$new_forum['name'] = $db->escape_string($to_forum['name']);
$new_forum['description'] = $db->escape_string($to_forum['description']);
$new_forum['pid'] = $db->escape_string($to_forum['pid']);
$new_forum['parentlist'] = $db->escape_string($to_forum['parentlist']);
$new_forum['rulestitle'] = $db->escape_string($new_forum['rulestitle']);
$new_forum['rules'] = $db->escape_string($new_forum['rules']);





				$new_forum['name'] = $to_forum['name'];
$new_forum['description'] = $to_forum['description'];
$new_forum['pid'] = $to_forum['pid'];
$new_forum['parentlist'] = $to_forum['parentlist'];

foreach($new_forum as $key => $value)
{
$new_forum[$key] = $db->escape_string($value);
}


				$db->update_query("forums", $new_forum, "fid='{$to}'");
}

				$db->update_query("forums", $new_forum, "fid='{$to}'");
}

 
		}
else
{
$new_forum['name'] = null;

		}

if(!$errors)
{
// Copy permissions

		}

if(!$errors)
{
// Copy permissions

			if(is_array($mybb->input['copygroups']) && count($mybb->input['copygroups'] > 0))

			if(isset($mybb->input['copygroups']) && is_array($mybb->input['copygroups']) && count($mybb->input['copygroups']) > 0)

			{
foreach($mybb->input['copygroups'] as $gid)

			{
foreach($mybb->input['copygroups'] as $gid)

				{

				{

					$groups[] = (int)$gid;
}
$groups = implode(',', $groups);

					$groups[] = (int)$gid;
}
$groups = implode(',', $groups);

Zeile 183Zeile 197
	$page->output_nav_tabs($sub_tabs, 'copy_forum');

$form = new Form("index.php?module=forum-management&amp;action=copy", "post");

	$page->output_nav_tabs($sub_tabs, 'copy_forum');

$form = new Form("index.php?module=forum-management&amp;action=copy", "post");


if($errors)
{
$page->output_inline_error($errors);
$copy_data = $mybb->input;
}





$copy_data['type'] = "f";
$copy_data['title'] = "";
$copy_data['description'] = "";

if(empty($mybb->input['pid']))
{
$copy_data['pid'] = "-1";
}

	else
{

	else
{

		$copy_data['type'] = "f";
$copy_data['title'] = "";
$copy_data['description'] = "";










		$copy_data['pid'] = $mybb->get_input('pid', MyBB::INPUT_INT);
}
$copy_data['disporder'] = "1";
$copy_data['from'] = $mybb->get_input('fid');
$copy_data['to'] = -1;
$copy_data['copyforumsettings'] = 0;
$copy_data['copygroups'] = array();
$copy_data['pid'] = 0;

if($errors)
{
$page->output_inline_error($errors);





		if(!$mybb->input['pid'])

		foreach($copy_data as $key => $value)

		{

		{

			$copy_data['pid'] = "-1";




			if(isset($mybb->input[$key]))
{
$copy_data[$key] = $mybb->input[$key];
}

		}

		}

		else
{
$copy_data['pid'] = $mybb->get_input('pid', MyBB::INPUT_INT);
}
$copy_data['disporder'] = "1";
$copy_data['from'] = $mybb->input['fid'];
$copy_data['copyforumsettings'] = 0;
$copy_data['pid'] = 0;

 
	}

$types = array(

	}

$types = array(

Zeile 225Zeile 246
	if($copy_data['type'] == "f")
{
$create_a_options_f['checked'] = true;

	if($copy_data['type'] == "f")
{
$create_a_options_f['checked'] = true;

	}

	}

	else
{
$create_a_options_c['checked'] = true;
}

	else
{
$create_a_options_c['checked'] = true;
}





	$usergroups = array();

$query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))

	$usergroups = array();

$query = $db->simple_select("usergroups", "gid, title", "gid != '1'", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))

	{

	{

		$usergroups[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
}


		$usergroups[$usergroup['gid']] = htmlspecialchars_uni($usergroup['title']);
}


Zeile 243Zeile 264
	$form_container->output_row($lang->source_forum." <em>*</em>", $lang->source_forum_desc, $form->generate_forum_select('from', $copy_data['from'], array('id' => 'from')), 'from');
$form_container->output_row($lang->destination_forum." <em>*</em>", $lang->destination_forum_desc, $form->generate_forum_select('to', $copy_data['to'], array('id' => 'to', 'main_option' => $lang->copy_to_new_forum)), 'to');
$form_container->output_row($lang->copy_settings_and_properties, $lang->copy_settings_and_properties_desc, $form->generate_yes_no_radio('copyforumsettings', $copy_data['copyforumsettings']));

	$form_container->output_row($lang->source_forum." <em>*</em>", $lang->source_forum_desc, $form->generate_forum_select('from', $copy_data['from'], array('id' => 'from')), 'from');
$form_container->output_row($lang->destination_forum." <em>*</em>", $lang->destination_forum_desc, $form->generate_forum_select('to', $copy_data['to'], array('id' => 'to', 'main_option' => $lang->copy_to_new_forum)), 'to');
$form_container->output_row($lang->copy_settings_and_properties, $lang->copy_settings_and_properties_desc, $form->generate_yes_no_radio('copyforumsettings', $copy_data['copyforumsettings']));

	$form_container->output_row($lang->copy_user_group_permissions, $lang->copy_user_group_permissions_desc, $form->generate_select_box('copygroups[]', $usergroups, $mybb->input['copygroups'], array('id' => 'copygroups', 'multiple' => true, 'size' => 5)), 'copygroups');


	$form_container->output_row($lang->copy_user_group_permissions, $lang->copy_user_group_permissions_desc, $form->generate_select_box('copygroups[]', $usergroups, $copy_data['copygroups'], array('id' => 'copygroups', 'multiple' => true, 'size' => 5)), 'copygroups');


	$form_container->end();

$form_container = new FormContainer($lang->new_forum_settings);

	$form_container->end();

$form_container = new FormContainer($lang->new_forum_settings);

Zeile 266Zeile 287
{
$query = $db->simple_select("moderators", "*", "mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'");
$mod_data = $db->fetch_array($query);

{
$query = $db->simple_select("moderators", "*", "mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'");
$mod_data = $db->fetch_array($query);





	if(!$mod_data['id'])
{
flash_message($lang->error_incorrect_moderator, 'error');
admin_redirect("index.php?module=forum-management");

	if(!$mod_data['id'])
{
flash_message($lang->error_incorrect_moderator, 'error');
admin_redirect("index.php?module=forum-management");

	}

$plugins->run_hooks("admin_forum_management_editmod");

if($mod_data['isgroup'])

	}

$plugins->run_hooks("admin_forum_management_editmod");

if($mod_data['isgroup'])

	{
$fieldname = "title";
}

	{
$fieldname = "title";
}

Zeile 296Zeile 317
		if(!$errors)
{
$fid = $mybb->get_input('fid', MyBB::INPUT_INT);

		if(!$errors)
{
$fid = $mybb->get_input('fid', MyBB::INPUT_INT);

			$forum = get_forum($fid);

			$forum = get_forum($fid, 1);

			if($mod_data['isgroup'])
{
$mod = $groupscache[$mod_data['id']];

			if($mod_data['isgroup'])
{
$mod = $groupscache[$mod_data['id']];

Zeile 355Zeile 376
	{
$query = $db->simple_select("users", "username", "uid='{$mod_data['id']}'");
$mod_data[$fieldname] = $db->fetch_field($query, 'username');

	{
$query = $db->simple_select("users", "username", "uid='{$mod_data['id']}'");
$mod_data[$fieldname] = $db->fetch_field($query, 'username');

	}

	}


$sub_tabs = array();



$sub_tabs = array();


Zeile 427Zeile 448
	$pid = $mybb->get_input('pid', MyBB::INPUT_INT);
$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
$gid = $mybb->get_input('gid', MyBB::INPUT_INT);

	$pid = $mybb->get_input('pid', MyBB::INPUT_INT);
$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
$gid = $mybb->get_input('gid', MyBB::INPUT_INT);


// User clicked no
if($mybb->input['no'])
{
admin_redirect("index.php?module=forum-management&fid={$fid}");
}

$plugins->run_hooks("admin_forum_management_clear_permission");



// User clicked no
if(!empty($mybb->input['no']))
{
admin_redirect("index.php?module=forum-management&fid={$fid}");
}

$plugins->run_hooks("admin_forum_management_clear_permission");


	if($mybb->request_method == "post")
{
if((!$fid || !$gid) && $pid)

	if($mybb->request_method == "post")
{
if((!$fid || !$gid) && $pid)

Zeile 477Zeile 498
		$pid = $mybb->get_input('pid', MyBB::INPUT_INT);
$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
$gid = $mybb->get_input('gid', MyBB::INPUT_INT);

		$pid = $mybb->get_input('pid', MyBB::INPUT_INT);
$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
$gid = $mybb->get_input('gid', MyBB::INPUT_INT);

		$forum = get_forum($fid);

		$forum = get_forum($fid, 1);


if((!$fid || !$gid) && $pid)
{


if((!$fid || !$gid) && $pid)
{

Zeile 485Zeile 506
			$result = $db->fetch_array($query);
$fid = $result['fid'];
$gid = $result['gid'];

			$result = $db->fetch_array($query);
$fid = $result['fid'];
$gid = $result['gid'];

			$forum = get_forum($fid);

			$forum = get_forum($fid, 1);

		}


		}


		$field_list = array();

		$update_array = $field_list = array();

		$fields_array = $db->show_fields_from("forumpermissions");

		$fields_array = $db->show_fields_from("forumpermissions");

		if(is_array($mybb->input['permissions']))

		if(isset($mybb->input['permissions']))

		{
// User has set permissions for this group...

		{
// User has set permissions for this group...

			foreach($fields_array as $field)
{
if(strpos($field['Field'], 'can') !== false || strpos($field['Field'], 'mod') !== false)
{

			foreach($fields_array as $field)
{
if(strpos($field['Field'], 'can') !== false || strpos($field['Field'], 'mod') !== false)
{

					if(array_key_exists($field['Field'], $mybb->input['permissions']))
{
$update_array[$db->escape_string($field['Field'])] = (int)$mybb->input['permissions'][$field['Field']];

					if(array_key_exists($field['Field'], $mybb->input['permissions']))
{
$update_array[$db->escape_string($field['Field'])] = (int)$mybb->input['permissions'][$field['Field']];

Zeile 505Zeile 526
					{
$update_array[$db->escape_string($field['Field'])] = 0;
}

					{
$update_array[$db->escape_string($field['Field'])] = 0;
}

				}
}

				}
}

		}
else
{

		}
else
{

Zeile 516Zeile 537
				if(strpos($field['Field'], 'can') !== false || strpos($field['Field'], 'mod') !== false)
{
$update_array[$db->escape_string($field['Field'])] = 0;

				if(strpos($field['Field'], 'can') !== false || strpos($field['Field'], 'mod') !== false)
{
$update_array[$db->escape_string($field['Field'])] = 0;

				}
}

				}
}

		}

if($fid && !$pid)

		}

if($fid && !$pid)

Zeile 525Zeile 546
			$update_array['fid'] = $fid;
$update_array['gid'] = $mybb->get_input('gid', MyBB::INPUT_INT);
$db->insert_query("forumpermissions", $update_array);

			$update_array['fid'] = $fid;
$update_array['gid'] = $mybb->get_input('gid', MyBB::INPUT_INT);
$db->insert_query("forumpermissions", $update_array);

		}

$plugins->run_hooks("admin_forum_management_permissions_commit");

		}

$plugins->run_hooks("admin_forum_management_permissions_commit");


if(!($fid && !$pid))
{
$db->update_query("forumpermissions", $update_array, "pid='{$pid}'");


if(!($fid && !$pid))
{
$db->update_query("forumpermissions", $update_array, "pid='{$pid}'");

		}

		}


$cache->update_forumpermissions();



$cache->update_forumpermissions();


Zeile 556Zeile 577
		$sub_tabs = array();

if($mybb->input['fid'] && $mybb->input['gid'])

		$sub_tabs = array();

if($mybb->input['fid'] && $mybb->input['gid'])

		{
$sub_tabs['edit_permissions'] = array(

		{
$sub_tabs['edit_permissions'] = array(

				'title' => $lang->forum_permissions,
'link' => "index.php?module=forum-management&amp;action=permissions&amp;fid=".$mybb->input['fid']."&amp;gid=".$mybb->input['gid'],

				'title' => $lang->forum_permissions,
'link' => "index.php?module=forum-management&amp;action=permissions&amp;fid=".$mybb->input['fid']."&amp;gid=".$mybb->input['gid'],

				'description' => $lang->forum_permissions_desc
);


				'description' => $lang->forum_permissions_desc
);


			$page->add_breadcrumb_item($lang->forum_permissions2, "index.php?module=forum-management&amp;fid=".$mybb->input['fid']."#tab_permissions");
}
else

			$page->add_breadcrumb_item($lang->forum_permissions2, "index.php?module=forum-management&amp;fid=".$mybb->input['fid']."#tab_permissions");
}
else

Zeile 575Zeile 596
				'link' => "index.php?module=forum-management&amp;action=permissions&amp;pid=".$mybb->get_input('pid', MyBB::INPUT_INT),
'description' => $lang->forum_permissions_desc
);

				'link' => "index.php?module=forum-management&amp;action=permissions&amp;pid=".$mybb->get_input('pid', MyBB::INPUT_INT),
'description' => $lang->forum_permissions_desc
);





			$page->add_breadcrumb_item($lang->forum_permissions2, "index.php?module=forum-management&amp;fid=".$mybb->input['fid']."#tab_permissions");
}


			$page->add_breadcrumb_item($lang->forum_permissions2, "index.php?module=forum-management&amp;fid=".$mybb->input['fid']."#tab_permissions");
}


Zeile 593Zeile 614
$(function() {
$(\"#modal_form\").on(\"click\", \"#savePermissions\", function(e) {
e.preventDefault();

$(function() {
$(\"#modal_form\").on(\"click\", \"#savePermissions\", function(e) {
e.preventDefault();

		



		var datastring = $(\"#modal_form\").serialize();
$.ajax({
type: \"POST\",

		var datastring = $(\"#modal_form\").serialize();
$.ajax({
type: \"POST\",

Zeile 616Zeile 637
		<div style=\"overflow-y: auto; max-height: 400px\">";
}


		<div style=\"overflow-y: auto; max-height: 400px\">";
}


	if($mybb->input['pid'] || ($mybb->input['gid'] && $mybb->input['fid']))

	if(!empty($mybb->input['pid']) || (!empty($mybb->input['gid']) && !empty($mybb->input['fid'])))

	{

	{

		if($mybb->input['ajax'] != 1)

		if($mybb->get_input('ajax') != 1)

		{
$form = new Form("index.php?module=forum-management&amp;action=permissions", "post");
}

		{
$form = new Form("index.php?module=forum-management&amp;action=permissions", "post");
}

Zeile 637Zeile 658
			$usergroup = $db->fetch_array($query);

$query = $db->simple_select("forums", "*", "fid='{$permission_data['fid']}'");

			$usergroup = $db->fetch_array($query);

$query = $db->simple_select("forums", "*", "fid='{$permission_data['fid']}'");

			$forum = $db->fetch_array($query);
}

			$forum = $db->fetch_array($query);
}

		else
{
$pid = $mybb->get_input('pid', MyBB::INPUT_INT);

		else
{
$pid = $mybb->get_input('pid', MyBB::INPUT_INT);

Zeile 648Zeile 669
			if($pid)
{
$query = $db->simple_select("forumpermissions", "*", "pid='{$pid}'");

			if($pid)
{
$query = $db->simple_select("forumpermissions", "*", "pid='{$pid}'");

			}

			}

			else
{
$query = $db->simple_select("forumpermissions", "*", "fid='{$fid}' AND gid='{$gid}'", array('limit' => 1));

			else
{
$query = $db->simple_select("forumpermissions", "*", "fid='{$fid}' AND gid='{$gid}'", array('limit' => 1));

			}


			}


			$permission_data = $db->fetch_array($query);


			$permission_data = $db->fetch_array($query);


			if(!$fid)

			if(is_array($permission_data))

			{

			{

				$fid = $permission_data['fid'];
}

if(!$gid)
{
$gid = $permission_data['gid'];
}



				if(!$fid)
{
$fid = $permission_data['fid'];
}

if(!$gid)
{
$gid = $permission_data['gid'];
}





			if(!$pid)
{
$pid = $permission_data['pid'];


				if(!$pid)
{
$pid = $permission_data['pid'];
}

			}

$query = $db->simple_select("usergroups", "*", "gid='$gid'");

			}

$query = $db->simple_select("usergroups", "*", "gid='$gid'");

Zeile 682Zeile 706
			$sql = build_parent_list($fid);
$query = $db->simple_select("forumpermissions", "*", "$sql AND gid='$gid'");
$customperms = $db->fetch_array($query);

			$sql = build_parent_list($fid);
$query = $db->simple_select("forumpermissions", "*", "$sql AND gid='$gid'");
$customperms = $db->fetch_array($query);


if($permission_data['pid'])
{


if(!empty($permission_data['pid']))
{

				$permission_data['usecustom'] = 1;
echo $form->generate_hidden_field("pid", $pid);
}

				$permission_data['usecustom'] = 1;
echo $form->generate_hidden_field("pid", $pid);
}

Zeile 692Zeile 716
			{
echo $form->generate_hidden_field("fid", $fid);
echo $form->generate_hidden_field("gid", $gid);

			{
echo $form->generate_hidden_field("fid", $fid);
echo $form->generate_hidden_field("gid", $gid);

				if(!$customperms['pid'])

				if(empty($customperms['pid']))

				{
$permission_data = usergroup_permissions($gid);

				{
$permission_data = usergroup_permissions($gid);

				}

				}

				else
{
$permission_data = forum_permissions($fid, 0, $gid);

				else
{
$permission_data = forum_permissions($fid, 0, $gid);

Zeile 725Zeile 749
			'modthreads' => 'moderate',
'modattachments' => 'moderate',
'mod_edit_posts' => 'moderate',

			'modthreads' => 'moderate',
'modattachments' => 'moderate',
'mod_edit_posts' => 'moderate',





			'canpostpolls' => 'polls',
'canvotepolls' => 'polls',
'cansearch' => 'misc',
);

			'canpostpolls' => 'polls',
'canvotepolls' => 'polls',
'cansearch' => 'misc',
);










$hidefields = array();
if($usergroup['gid'] == 1)
{
$hidefields = array('canonlyviewownthreads', 'canonlyreplyownthreads', 'caneditposts', 'candeleteposts', 'candeletethreads', 'caneditattachments', 'canviewdeletetionnotice');
}


		$groups = $plugins->run_hooks("admin_forum_management_permission_groups", $groups);


		$groups = $plugins->run_hooks("admin_forum_management_permission_groups", $groups);


 
		foreach($hidefields as $field)
{
unset($groups[$field]);
}


		$tabs = array();
foreach(array_unique(array_values($groups)) as $group)

		$tabs = array();
foreach(array_unique(array_values($groups)) as $group)

		{

		{

			$lang_group = "group_".$group;
$tabs[$group] = $lang->$lang_group;
}

			$lang_group = "group_".$group;
$tabs[$group] = $lang->$lang_group;
}

Zeile 745Zeile 780
			$page->output_tab_control($tabs, false, "tabs2");
}
else

			$page->output_tab_control($tabs, false, "tabs2");
}
else

		{

		{

			$page->output_tab_control($tabs);
}


			$page->output_tab_control($tabs);
}


Zeile 753Zeile 788
		$fields_array = $db->show_fields_from("forumpermissions");
foreach($fields_array as $field)
{

		$fields_array = $db->show_fields_from("forumpermissions");
foreach($fields_array as $field)
{

			if(strpos($field['Field'], 'can') !== false || strpos($field['Field'], 'mod') !== false)

			if(!in_array($field['Field'], $hidefields) && (strpos($field['Field'], 'can') !== false || strpos($field['Field'], 'mod') !== false))

			{
if(array_key_exists($field['Field'], $groups))

			{
if(array_key_exists($field['Field'], $groups))

				{

				{

					$field_list[$groups[$field['Field']]][] = $field['Field'];
}
else
{
$field_list['misc'][] = $field['Field'];

					$field_list[$groups[$field['Field']]][] = $field['Field'];
}
else
{
$field_list['misc'][] = $field['Field'];

				}
}
}


				}
}
}


		foreach(array_unique(array_values($groups)) as $group)
{
$lang_group = "group_".$group;

		foreach(array_unique(array_values($groups)) as $group)
{
$lang_group = "group_".$group;

Zeile 775Zeile 810
			foreach($field_list[$group] as $field)
{
$lang_field = $group."_field_".$field;

			foreach($field_list[$group] as $field)
{
$lang_field = $group."_field_".$field;

				$fields[] = $form->generate_check_box("permissions[{$field}]", 1, $lang->$lang_field, array('checked' => $permission_data[$field], 'id' => $field));

				$fields[] = $form->generate_check_box("permissions[{$field}]", 1, $lang->$lang_field, array('checked' => !empty($permission_data[$field]), 'id' => $field));

			}
$form_container->output_row("", "", "<div class=\"forum_settings_bit\">".implode("</div><div class=\"forum_settings_bit\">", $fields)."</div>");
$form_container->end();

			}
$form_container->output_row("", "", "<div class=\"forum_settings_bit\">".implode("</div><div class=\"forum_settings_bit\">", $fields)."</div>");
$form_container->end();

Zeile 862Zeile 897
				"defaultsortby" => $db->escape_string($mybb->input['defaultsortby']),
"defaultsortorder" => $db->escape_string($mybb->input['defaultsortorder']),
);

				"defaultsortby" => $db->escape_string($mybb->input['defaultsortby']),
"defaultsortorder" => $db->escape_string($mybb->input['defaultsortorder']),
);

			$fid = $db->insert_query("forums", $insert_array);





$plugins->run_hooks("admin_forum_management_add_start");

$fid = $db->insert_query("forums", $insert_array);


$parentlist = make_parent_list($fid);
$db->update_query("forums", array("parentlist" => $parentlist), "fid='$fid'");


$parentlist = make_parent_list($fid);
$db->update_query("forums", array("parentlist" => $parentlist), "fid='$fid'");






$cache->update_forums();


			$inherit = $mybb->input['default_permissions'];

foreach($mybb->input as $id => $permission)

			$inherit = $mybb->input['default_permissions'];

foreach($mybb->input as $id => $permission)

Zeile 874Zeile 914
				if(strpos($id, 'fields_') === false)
{
continue;

				if(strpos($id, 'fields_') === false)
{
continue;

				}

list(, $gid) = explode('fields_', $id);


				}

list(, $gid) = explode('fields_', $id);


				// If it isn't an array then it came from the javascript form
if(!is_array($permission))
{

				// If it isn't an array then it came from the javascript form
if(!is_array($permission))
{

Zeile 886Zeile 926
					foreach($permission as $name => $value)
{
$permission[$name] = 1;

					foreach($permission as $name => $value)
{
$permission[$name] = 1;

					}
}

					}
}





				foreach(array('canview','canpostthreads','canpostreplys','canpostpolls') as $name)

				foreach(array('canview','canpostthreads','canpostreplys','canpostpolls','canpostattachments') as $name)

				{

				{

					if(in_array($name, $permission)  || $permission[$name])

					if(in_array($name, $permission) || !empty($permission[$name]))

					{
$permissions[$name][$gid] = 1;

					{
$permissions[$name][$gid] = 1;

					}

					}

					else
{
$permissions[$name][$gid] = 0;

					else
{
$permissions[$name][$gid] = 0;

Zeile 910Zeile 950
			save_quick_perms($fid);

$plugins->run_hooks("admin_forum_management_add_commit");

			save_quick_perms($fid);

$plugins->run_hooks("admin_forum_management_add_commit");


$cache->update_forums();

 

// Log admin action
log_admin_action($fid, $insert_array['name']);

flash_message($lang->success_forum_added, 'success');
admin_redirect("index.php?module=forum-management");


// Log admin action
log_admin_action($fid, $insert_array['name']);

flash_message($lang->success_forum_added, 'success');
admin_redirect("index.php?module=forum-management");

		}
}


		}
}


	$page->extra_header .=  "<script src=\"jscripts/quick_perm_editor.js\" type=\"text/javascript\"></script>\n";

$page->add_breadcrumb_item($lang->add_forum);
$page->output_header($lang->add_forum);
$page->output_nav_tabs($sub_tabs, 'add_forum');

	$page->extra_header .=  "<script src=\"jscripts/quick_perm_editor.js\" type=\"text/javascript\"></script>\n";

$page->add_breadcrumb_item($lang->add_forum);
$page->output_header($lang->add_forum);
$page->output_nav_tabs($sub_tabs, 'add_forum');





	$form = new Form("index.php?module=forum-management&amp;action=add", "post");


	$form = new Form("index.php?module=forum-management&amp;action=add", "post");


	if($errors)





	$forum_data['type'] = "f";
$forum_data['title'] = "";
$forum_data['description'] = "";

if(empty($mybb->input['pid']))

	{

	{

		$page->output_inline_error($errors);
$forum_data = $mybb->input;

		$forum_data['pid'] = "-1";


	}
else
{

	}
else
{

		$forum_data['type'] = "f";
$forum_data['title'] = "";
$forum_data['description'] = "";
























		$forum_data['pid'] = $mybb->get_input('pid', MyBB::INPUT_INT);
}
$forum_data['disporder'] = "1";
$forum_data['linkto'] = "";
$forum_data['password'] = "";
$forum_data['active'] = 1;
$forum_data['open'] = 1;
$forum_data['overridestyle'] = "";
$forum_data['style'] = "";
$forum_data['rulestype'] = "";
$forum_data['rulestitle'] = "";
$forum_data['rules'] = "";
$forum_data['defaultdatecut'] = "";
$forum_data['defaultsortby'] = "";
$forum_data['defaultsortorder'] = "";
$forum_data['allowhtml'] = "";
$forum_data['allowmycode'] = 1;
$forum_data['allowsmilies'] = 1;
$forum_data['allowimgcode'] = 1;
$forum_data['allowvideocode'] = 1;
$forum_data['allowpicons'] = 1;
$forum_data['allowtratings'] = 1;
$forum_data['showinjump'] = 1;
$forum_data['usepostcounts'] = 1;
$forum_data['usethreadcounts'] = 1;
$forum_data['requireprefix'] = 0;





		if(!$mybb->input['pid'])
{
$forum_data['pid'] = "-1";
}
else

	if($errors)
{
$page->output_inline_error($errors);

foreach ($forum_data as $key => $value)

		{

		{

			$forum_data['pid'] = $mybb->get_input('pid', MyBB::INPUT_INT);




			if (isset($mybb->input[$key]))
{
$forum_data[$key] = $mybb->input[$key];
}

		}

		}

		$forum_data['disporder'] = "1";
$forum_data['linkto'] = "";
$forum_data['password'] = "";
$forum_data['active'] = 1;
$forum_data['open'] = 1;
$forum_data['overridestyle'] = "";
$forum_data['style'] = "";
$forum_data['rulestype'] = "";
$forum_data['rulestitle'] = "";
$forum_data['rules'] = "";
$forum_data['defaultdatecut'] = "";
$forum_data['defaultsortby'] = "";
$forum_data['defaultsortorder'] = "";
$forum_data['allowhtml'] = "";
$forum_data['allowmycode'] = 1;
$forum_data['allowsmilies'] = 1;
$forum_data['allowimgcode'] = 1;
$forum_data['allowvideocode'] = 1;
$forum_data['allowpicons'] = 1;
$forum_data['allowtratings'] = 1;
$forum_data['showinjump'] = 1;
$forum_data['usepostcounts'] = 1;
$forum_data['usethreadcounts'] = 1;
$forum_data['requireprefix'] = 0;

 
	}

$types = array(

	}

$types = array(

Zeile 1106Zeile 1149
	echo "</div>";

$query = $db->simple_select("usergroups", "*", "", array("order" => "name"));

	echo "</div>";

$query = $db->simple_select("usergroups", "*", "", array("order" => "name"));

	while($usergroup = $db->fetch_array($query))
{
$usergroups[$usergroup['gid']] = $usergroup;
}

$cached_forum_perms = $cache->read("forumpermissions");
$field_list = array(
'canview' => $lang->permissions_canview,

	while($usergroup = $db->fetch_array($query))
{
$usergroups[$usergroup['gid']] = $usergroup;
}

$cached_forum_perms = $cache->read("forumpermissions");
$field_list = array(
'canview' => $lang->permissions_canview,

		'canpostthreads' => $lang->permissions_canpostthreads,
'canpostreplys' => $lang->permissions_canpostreplys,
'canpostpolls' => $lang->permissions_canpostpolls,

		'canpostthreads' => $lang->permissions_canpostthreads,
'canpostreplys' => $lang->permissions_canpostreplys,
'canpostpolls' => $lang->permissions_canpostpolls,

Zeile 1156Zeile 1199
	foreach($usergroups as $usergroup)
{
$perms = array();

	foreach($usergroups as $usergroup)
{
$perms = array();

		if(isset($mybb->input['default_permissions']) && $mybb->input['default_permissions'][$usergroup['gid']])

		if(!empty($mybb->input['default_permissions'][$usergroup['gid']]))

		{

		{

			if(is_array($existing_permissions) && $existing_permissions[$usergroup['gid']])

			if(isset($existing_permissions) && is_array($existing_permissions) && $existing_permissions[$usergroup['gid']])

			{
$perms = $existing_permissions[$usergroup['gid']];
$default_checked = false;
}

			{
$perms = $existing_permissions[$usergroup['gid']];
$default_checked = false;
}

			elseif(is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['fid']][$usergroup['gid']])

			elseif(is_array($cached_forum_perms) && isset($forum_data['fid']) && !empty($cached_forum_perms[$forum_data['fid']][$usergroup['gid']]))

			{
$perms = $cached_forum_perms[$forum_data['fid']][$usergroup['gid']];
$default_checked = true;
}

			{
$perms = $cached_forum_perms[$forum_data['fid']][$usergroup['gid']];
$default_checked = true;
}

			else if(is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['pid']][$usergroup['gid']])

			else if(is_array($cached_forum_perms) && isset($forum_data['fid']) && !empty($cached_forum_perms[$forum_data['pid']][$usergroup['gid']]))

			{
$perms = $cached_forum_perms[$forum_data['pid']][$usergroup['gid']];
$default_checked = true;

			{
$perms = $cached_forum_perms[$forum_data['pid']][$usergroup['gid']];
$default_checked = true;

Zeile 1182Zeile 1225
		}

foreach($field_list as $forum_permission => $forum_perm_title)

		}

foreach($field_list as $forum_permission => $forum_perm_title)

		{

		{

			if(isset($mybb->input['permissions']))
{

			if(isset($mybb->input['permissions']))
{

				if($mybb->input['default_permissions'][$usergroup['gid']])

				if(!empty($mybb->input['default_permissions'][$usergroup['gid']]))

				{
$default_checked = true;

				{
$default_checked = true;

				}

				}

				else
{
$default_checked = false;

				else
{
$default_checked = false;

				}

if($mybb->input['permissions'][$usergroup['gid']][$forum_permission])
{
$perms_checked[$forum_permission] = 1;
}
else
{
$perms_checked[$forum_permission] = 0;
}
}

				}

if(!empty($mybb->input['permissions'][$usergroup['gid']][$forum_permission]))
{
$perms_checked[$forum_permission] = 1;
}
else
{
$perms_checked[$forum_permission] = 0;
}
}

			else
{
if($perms[$forum_permission] == 1)
{

			else
{
if($perms[$forum_permission] == 1)
{

					$perms_checked[$forum_permission] = 1;

					$perms_checked[$forum_permission] = 1;

				}
else
{

				}
else
{

Zeile 1220Zeile 1263
		if($default_checked)
{
$inherited_text = $lang->inherited_permission;

		if($default_checked)
{
$inherited_text = $lang->inherited_permission;

		}

		}

		else
{
$inherited_text = $lang->custom_permission;
}


		else
{
$inherited_text = $lang->custom_permission;
}


		$form_container->output_cell("<strong>{$usergroup['title']}</strong><br />".$form->generate_check_box("default_permissions[{$usergroup['gid']}]", 1, "", array("id" => "default_permissions_{$usergroup['gid']}", "checked" => $default_checked, "onclick" => $default_click))." <small><label for=\"default_permissions_{$usergroup['gid']}\">{$lang->permissions_use_group_default}</label></small>");

		$form_container->output_cell("<strong>{$usergroup['title']}</strong><br />".$form->generate_check_box("default_permissions[{$usergroup['gid']}]", 1, "", array("id" => "default_permissions_{$usergroup['gid']}", "checked" => $default_checked))." <small><label for=\"default_permissions_{$usergroup['gid']}\">{$lang->permissions_use_group_default}</label></small>");


$field_select = "<div class=\"quick_perm_fields\">\n";
$field_select .= "<div class=\"enabled\"><ul id=\"fields_enabled_{$usergroup['gid']}\">\n";


$field_select = "<div class=\"quick_perm_fields\">\n";
$field_select .= "<div class=\"enabled\"><ul id=\"fields_enabled_{$usergroup['gid']}\">\n";

Zeile 1329Zeile 1372
			$query = $db->simple_select('forums', 'parentlist', "fid='{$pid}'");
$parents = explode(',', $db->fetch_field($query, 'parentlist'));
if(in_array($mybb->input['fid'], $parents))

			$query = $db->simple_select('forums', 'parentlist', "fid='{$pid}'");
$parents = explode(',', $db->fetch_field($query, 'parentlist'));
if(in_array($mybb->input['fid'], $parents))

			{

			{

				$errors[] = $lang->error_forum_parent_child;

				$errors[] = $lang->error_forum_parent_child;

			}
}


			}
}


		$type = $mybb->input['type'];

if($pid <= 0 && $type == "f")

		$type = $mybb->input['type'];

if($pid <= 0 && $type == "f")

		{

		{

			$errors[] = $lang->error_no_parent;

			$errors[] = $lang->error_no_parent;

		}


		}


		if($type == 'c' && $forum_data['type'] == 'f')
{
$query = $db->simple_select('threads', 'COUNT(tid) as num_threads', "fid = '{$fid}'");

		if($type == 'c' && $forum_data['type'] == 'f')
{
$query = $db->simple_select('threads', 'COUNT(tid) as num_threads', "fid = '{$fid}'");

			if($db->fetch_field($query, "num_threads") > 0)

			if($db->fetch_field($query, "num_threads") > 0)

			{
$errors[] = $lang->error_not_empty;

			{
$errors[] = $lang->error_not_empty;

			}
}

			}
}


if(!empty($mybb->input['linkto']) && empty($forum_data['linkto']))


if(!empty($mybb->input['linkto']) && empty($forum_data['linkto']))

		{

		{

			$query = $db->simple_select('threads', 'COUNT(tid) as num_threads', "fid = '{$fid}'", array("limit" => 1));
if($db->fetch_field($query, "num_threads") > 0)
{

			$query = $db->simple_select('threads', 'COUNT(tid) as num_threads', "fid = '{$fid}'", array("limit" => 1));
if($db->fetch_field($query, "num_threads") > 0)
{

Zeile 1359Zeile 1402
			}
}


			}
}


		if(!$errors)
{
if($pid < 0)
{

		if(!$errors) {
if ($pid < 0) {



				$pid = 0;
}
$update_array = array(

				$pid = 0;
}
$update_array = array(

Zeile 1396Zeile 1437
				"defaultsortorder" => $db->escape_string($mybb->input['defaultsortorder']),
);
$db->update_query("forums", $update_array, "fid='{$fid}'");

				"defaultsortorder" => $db->escape_string($mybb->input['defaultsortorder']),
);
$db->update_query("forums", $update_array, "fid='{$fid}'");

			if($pid != $forum_data['pid'])
{

			if ($pid != $forum_data['pid']) {


				// Update the parentlist of this forum.
$db->update_query("forums", array("parentlist" => make_parent_list($fid)), "fid='{$fid}'");

				// Update the parentlist of this forum.
$db->update_query("forums", array("parentlist" => make_parent_list($fid)), "fid='{$fid}'");





				// Rebuild the parentlist of all of the subforums of this forum

				// Rebuild the parentlist of all of the subforums of this forum

				switch($db->type)
{

				switch ($db->type) {


					case "sqlite":
case "pgsql":
$query = $db->simple_select("forums", "fid", "','||parentlist||',' LIKE '%,$fid,%'");
break;
default:
$query = $db->simple_select("forums", "fid", "CONCAT(',',parentlist,',') LIKE '%,$fid,%'");

					case "sqlite":
case "pgsql":
$query = $db->simple_select("forums", "fid", "','||parentlist||',' LIKE '%,$fid,%'");
break;
default:
$query = $db->simple_select("forums", "fid", "CONCAT(',',parentlist,',') LIKE '%,$fid,%'");

				}

while($child = $db->fetch_array($query))
{
$db->update_query("forums", array("parentlist" => make_parent_list($child['fid'])), "fid='{$child['fid']}'");
}
}

$inherit = $mybb->input['default_permissions'];

foreach($mybb->input as $id => $permission)
{
// Make sure we're only skipping inputs that don't start with "fields_" and aren't fields_default_ or fields_inherit_
if(strpos($id, 'fields_') === false || (strpos($id, 'fields_default_') !== false || strpos($id, 'fields_inherit_') !== false))
{
continue;
}

list(, $gid) = explode('fields_', $id);

if($mybb->input['fields_default_'.$gid] == $permission && $mybb->input['fields_inherit_'.$gid] == 1)
{
$inherit[$gid] = 1;
continue;
}
$inherit[$gid] = 0;

// If it isn't an array then it came from the javascript form







				}

while ($child = $db->fetch_array($query)) {
$db->update_query("forums", array("parentlist" => make_parent_list($child['fid'])), "fid='{$child['fid']}'");
}
}

if(!empty($mybb->input['default_permissions']))
{
$inherit = $mybb->input['default_permissions'];
}
else
{
$inherit = array();
}

foreach($mybb->input as $id => $permission)
{
// Make sure we're only skipping inputs that don't start with "fields_" and aren't fields_default_ or fields_inherit_
if(strpos($id, 'fields_') === false || (strpos($id, 'fields_default_') !== false || strpos($id, 'fields_inherit_') !== false))
{
continue;
}

list(, $gid) = explode('fields_', $id);

if($mybb->input['fields_default_'.$gid] == $permission && $mybb->input['fields_inherit_'.$gid] == 1)
{
$inherit[$gid] = 1;
continue;
}
$inherit[$gid] = 0;

// If it isn't an array then it came from the javascript form

				if(!is_array($permission))
{
$permission = explode(',', $permission);

				if(!is_array($permission))
{
$permission = explode(',', $permission);

Zeile 1445Zeile 1490
					foreach($permission as $name => $value)
{
$permission[$name] = 1;

					foreach($permission as $name => $value)
{
$permission[$name] = 1;

					}
}


					}
}


				foreach(array('canview','canpostthreads','canpostreplys','canpostpolls') as $name)
{

				foreach(array('canview','canpostthreads','canpostreplys','canpostpolls') as $name)
{

					if(in_array($name, $permission) || $permission[$name])

					if(in_array($name, $permission) || !empty($permission[$name]))

					{
$permissions[$name][$gid] = 1;

					{
$permissions[$name][$gid] = 1;

					}

					}

					else
{
$permissions[$name][$gid] = 0;
}
}

					else
{
$permissions[$name][$gid] = 0;
}
}

			}

$cache->update_forums();

$canview = $permissions['canview'];
$canpostthreads = $permissions['canpostthreads'];
$canpostpolls = $permissions['canpostpolls'];
$canpostattachments = $permissions['canpostattachments'];
$canpostreplies = $permissions['canpostreplys'];

















			}

$cache->update_forums();

if(isset($permissions['canview']))
{
$canview = $permissions['canview'];
}
if(isset($permissions['canpostthreads']))
{
$canpostthreads = $permissions['canpostthreads'];
}
if(isset($permissions['canpostpolls']))
{
$canpostpolls = $permissions['canpostpolls'];
}
if(isset($permissions['canpostattachments']))
{
$canpostattachments = $permissions['canpostattachments'];
}
if(isset($permissions['canpostreplys']))
{
$canpostreplies = $permissions['canpostreplys'];
}


			save_quick_perms($fid);

$plugins->run_hooks("admin_forum_management_edit_commit");

			save_quick_perms($fid);

$plugins->run_hooks("admin_forum_management_edit_commit");

Zeile 1478Zeile 1538

flash_message($lang->success_forum_updated, 'success');
admin_redirect("index.php?module=forum-management&fid={$fid}");


flash_message($lang->success_forum_updated, 'success');
admin_redirect("index.php?module=forum-management&fid={$fid}");

		}
}

$page->extra_header .= "<script src=\"jscripts/quick_perm_editor.js\" type=\"text/javascript\"></script>\n";


		}
}

$page->extra_header .= "<script src=\"jscripts/quick_perm_editor.js\" type=\"text/javascript\"></script>\n";


	$page->add_breadcrumb_item($lang->edit_forum);
$page->output_header($lang->edit_forum);

$page->output_nav_tabs($sub_tabs, 'edit_forum_settings');

	$page->add_breadcrumb_item($lang->edit_forum);
$page->output_header($lang->edit_forum);

$page->output_nav_tabs($sub_tabs, 'edit_forum_settings');





	$form = new Form("index.php?module=forum-management&amp;action=edit", "post");
echo $form->generate_hidden_field("fid", $fid);

if($errors)

	$form = new Form("index.php?module=forum-management&amp;action=edit", "post");
echo $form->generate_hidden_field("fid", $fid);

if($errors)

	{

	{

		$page->output_inline_error($errors);
$forum_data = $mybb->input;
}

		$page->output_inline_error($errors);
$forum_data = $mybb->input;
}

Zeile 1505Zeile 1565
	while($usergroup = $db->fetch_array($query))
{
$usergroups[$usergroup['gid']] = $usergroup;

	while($usergroup = $db->fetch_array($query))
{
$usergroups[$usergroup['gid']] = $usergroup;

	}


	}


	$query = $db->simple_select("forumpermissions", "*", "fid='{$fid}'");
while($existing = $db->fetch_array($query))
{

	$query = $db->simple_select("forumpermissions", "*", "fid='{$fid}'");
while($existing = $db->fetch_array($query))
{

Zeile 1516Zeile 1576
	$types = array(
'f' => $lang->forum,
'c' => $lang->category

	$types = array(
'f' => $lang->forum,
'c' => $lang->category

	);


	);


	$create_a_options_f = array(
'id' => 'forum'
);

	$create_a_options_f = array(
'id' => 'forum'
);

Zeile 1527Zeile 1587
	);

if($forum_data['type'] == "f")

	);

if($forum_data['type'] == "f")

	{

	{

		$create_a_options_f['checked'] = true;
}
else

		$create_a_options_f['checked'] = true;
}
else

Zeile 1542Zeile 1602
	$form_container->output_row($lang->parent_forum." <em>*</em>", $lang->parent_forum_desc, $form->generate_forum_select('pid', $forum_data['pid'], array('id' => 'pid', 'main_option' => $lang->none)), 'pid');
$form_container->output_row($lang->display_order, "", $form->generate_numeric_field('disporder', $forum_data['disporder'], array('id' => 'disporder', 'min' => 0)), 'disporder');
$form_container->end();

	$form_container->output_row($lang->parent_forum." <em>*</em>", $lang->parent_forum_desc, $form->generate_forum_select('pid', $forum_data['pid'], array('id' => 'pid', 'main_option' => $lang->none)), 'pid');
$form_container->output_row($lang->display_order, "", $form->generate_numeric_field('disporder', $forum_data['disporder'], array('id' => 'disporder', 'min' => 0)), 'disporder');
$form_container->end();





	$form_container = new FormContainer($lang->additional_forum_options);
$form_container->output_row($lang->forum_link, $lang->forum_link_desc, $form->generate_text_box('linkto', $forum_data['linkto'], array('id' => 'linkto')), 'linkto');
$form_container->output_row($lang->forum_password, $lang->forum_password_desc, $form->generate_text_box('password', $forum_data['password'], array('id' => 'password')), 'password');

	$form_container = new FormContainer($lang->additional_forum_options);
$form_container->output_row($lang->forum_link, $lang->forum_link_desc, $form->generate_text_box('linkto', $forum_data['linkto'], array('id' => 'linkto')), 'linkto');
$form_container->output_row($lang->forum_password, $lang->forum_password_desc, $form->generate_text_box('password', $forum_data['password'], array('id' => 'password')), 'password');

Zeile 1556Zeile 1616

$styles = array(
'0' => $lang->use_default


$styles = array(
'0' => $lang->use_default

	);


	);


	$query = $db->simple_select("themes", "tid,name", "name!='((master))' AND name!='((master-backup))'", array('order_by' => 'name'));
while($style = $db->fetch_array($query))
{

	$query = $db->simple_select("themes", "tid,name", "name!='((master))' AND name!='((master-backup))'", array('order_by' => 'name'));
while($style = $db->fetch_array($query))
{

Zeile 1636Zeile 1696
		$form->generate_check_box('usepostcounts', 1, $lang->use_postcounts, array('checked' => $forum_data['usepostcounts'], 'id' => 'usepostcounts')),
$form->generate_check_box('usethreadcounts', 1, $lang->use_threadcounts, array('checked' => $forum_data['usethreadcounts'], 'id' => 'usethreadcounts')),
$form->generate_check_box('requireprefix', 1, $lang->require_thread_prefix, array('checked' => $forum_data['requireprefix'], 'id' => 'requireprefix'))

		$form->generate_check_box('usepostcounts', 1, $lang->use_postcounts, array('checked' => $forum_data['usepostcounts'], 'id' => 'usepostcounts')),
$form->generate_check_box('usethreadcounts', 1, $lang->use_threadcounts, array('checked' => $forum_data['usethreadcounts'], 'id' => 'usethreadcounts')),
$form->generate_check_box('requireprefix', 1, $lang->require_thread_prefix, array('checked' => $forum_data['requireprefix'], 'id' => 'requireprefix'))

	);

	);


$form_container->output_row($lang->misc_options, "", "<div class=\"forum_settings_bit\">".implode("</div><div class=\"forum_settings_bit\">", $misc_options)."</div>");
$form_container->end();


$form_container->output_row($lang->misc_options, "", "<div class=\"forum_settings_bit\">".implode("</div><div class=\"forum_settings_bit\">", $misc_options)."</div>");
$form_container->end();

Zeile 1675Zeile 1735
				{
// Convering the comma separated list from Javascript form into a variable
$input_permissions = explode(',' , $input_permissions);

				{
// Convering the comma separated list from Javascript form into a variable
$input_permissions = explode(',' , $input_permissions);

				}

				}

				foreach($input_permissions as $input_permission)
{
$mybb->input['permissions'][$usergroup['gid']][$input_permission] = 1;

				foreach($input_permissions as $input_permission)
{
$mybb->input['permissions'][$usergroup['gid']][$input_permission] = 1;

				}
}

				}
}

		}
}


		}
}


Zeile 1690Zeile 1750
		if(isset($mybb->input['default_permissions']))
{
if($mybb->input['default_permissions'][$usergroup['gid']])

		if(isset($mybb->input['default_permissions']))
{
if($mybb->input['default_permissions'][$usergroup['gid']])

			{

			{

				if(is_array($existing_permissions) && $existing_permissions[$usergroup['gid']])
{
$perms = $existing_permissions[$usergroup['gid']];
$default_checked = false;

				if(is_array($existing_permissions) && $existing_permissions[$usergroup['gid']])
{
$perms = $existing_permissions[$usergroup['gid']];
$default_checked = false;

				}

				}

				elseif(is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['fid']][$usergroup['gid']])
{
$perms = $cached_forum_perms[$forum_data['fid']][$usergroup['gid']];

				elseif(is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['fid']][$usergroup['gid']])
{
$perms = $cached_forum_perms[$forum_data['fid']][$usergroup['gid']];

					$default_checked = true;
}

					$default_checked = true;
}

				else if(is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['pid']][$usergroup['gid']])
{
$perms = $cached_forum_perms[$forum_data['pid']][$usergroup['gid']];

				else if(is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['pid']][$usergroup['gid']])
{
$perms = $cached_forum_perms[$forum_data['pid']][$usergroup['gid']];

Zeile 1715Zeile 1775
			}
}
else

			}
}
else

		{
if(is_array($existing_permissions) && $existing_permissions[$usergroup['gid']])
{

		{
if(isset($existing_permissions) && is_array($existing_permissions) && !empty($existing_permissions[$usergroup['gid']]))
{

				$perms = $existing_permissions[$usergroup['gid']];
$default_checked = false;

				$perms = $existing_permissions[$usergroup['gid']];
$default_checked = false;

			}
elseif(is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['fid']][$usergroup['gid']])
{

			}
elseif(is_array($cached_forum_perms) && !empty($cached_forum_perms[$forum_data['fid']][$usergroup['gid']]))
{

				$perms = $cached_forum_perms[$forum_data['fid']][$usergroup['gid']];
$default_checked = true;
}

				$perms = $cached_forum_perms[$forum_data['fid']][$usergroup['gid']];
$default_checked = true;
}

			else if(is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['pid']][$usergroup['gid']])

			else if(is_array($cached_forum_perms) && !empty($cached_forum_perms[$forum_data['pid']][$usergroup['gid']]))

			{
$perms = $cached_forum_perms[$forum_data['pid']][$usergroup['gid']];
$default_checked = true;
}

if(!$perms)

			{
$perms = $cached_forum_perms[$forum_data['pid']][$usergroup['gid']];
$default_checked = true;
}

if(!$perms)

			{

			{

				$perms = $usergroup;
$default_checked = true;
}

				$perms = $usergroup;
$default_checked = true;
}

Zeile 1748Zeile 1808
					$perms_checked[$forum_permission] = 1;
}
else

					$perms_checked[$forum_permission] = 1;
}
else

				{

				{

					$perms_checked[$forum_permission] = 0;
}
}

					$perms_checked[$forum_permission] = 0;
}
}

Zeile 1757Zeile 1817
				if($perms[$forum_permission] == 1)
{
$perms_checked[$forum_permission] = 1;

				if($perms[$forum_permission] == 1)
{
$perms_checked[$forum_permission] = 1;

				}

				}

				else
{
$perms_checked[$forum_permission] = 0;

				else
{
$perms_checked[$forum_permission] = 0;

Zeile 1771Zeile 1831
			$inherited_text = $lang->inherited_permission;
}
else

			$inherited_text = $lang->inherited_permission;
}
else

		{

		{

			$inherited_text = $lang->custom_permission;
}

$form_container->output_cell("<strong>{$usergroup['title']}</strong> <small style=\"vertical-align: middle;\">({$inherited_text})</small>");

$field_select = "<div class=\"quick_perm_fields\">\n";

			$inherited_text = $lang->custom_permission;
}

$form_container->output_cell("<strong>{$usergroup['title']}</strong> <small style=\"vertical-align: middle;\">({$inherited_text})</small>");

$field_select = "<div class=\"quick_perm_fields\">\n";

		$field_select .= "<div class=\"enabled\"><div class=\"fields_title\">{$lang->enabled}</div><ul id=\"fields_enabled_{$usergroup['gid']}\">\n";

		$field_select .= "<div class=\"enabled\"><ul id=\"fields_enabled_{$usergroup['gid']}\">\n";

		foreach($perms_checked as $perm => $value)
{
if($value == 1)

		foreach($perms_checked as $perm => $value)
{
if($value == 1)

Zeile 1787Zeile 1847
			}
}
$field_select .= "</ul></div>\n";

			}
}
$field_select .= "</ul></div>\n";

		$field_select .= "<div class=\"disabled\"><div class=\"fields_title\">{$lang->disabled}</div><ul id=\"fields_disabled_{$usergroup['gid']}\">\n";

		$field_select .= "<div class=\"disabled\"><ul id=\"fields_disabled_{$usergroup['gid']}\">\n";

		foreach($perms_checked as $perm => $value)
{
if($value == 0)

		foreach($perms_checked as $perm => $value)
{
if($value == 0)

Zeile 1820Zeile 1880

$field_select .= "<noscript>".$form->generate_select_box('fields_'.$usergroup['gid'].'[]', $field_options, $field_selected, array('id' => 'fields_'.$usergroup['gid'].'[]', 'multiple' => true))."</noscript>\n";
$form_container->output_cell($field_select, array('colspan' => 2));


$field_select .= "<noscript>".$form->generate_select_box('fields_'.$usergroup['gid'].'[]', $field_options, $field_selected, array('id' => 'fields_'.$usergroup['gid'].'[]', 'multiple' => true))."</noscript>\n";
$form_container->output_cell($field_select, array('colspan' => 2));

		



		if(!$default_checked)

		if(!$default_checked)

		{

		{

			$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=permissions&amp;pid={$perms['pid']}\" onclick=\"MyBB.popupWindow('index.php?module=forum-management&action=permissions&pid={$perms['pid']}&ajax=1', null, true); return false;\">{$lang->edit_permissions}</a>", array("class" => "align_center"));
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=clear_permission&amp;pid={$perms['pid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_clear_custom_permission}')\">{$lang->clear_custom_perms}</a>", array("class" => "align_center"));

			$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=permissions&amp;pid={$perms['pid']}\" onclick=\"MyBB.popupWindow('index.php?module=forum-management&action=permissions&pid={$perms['pid']}&ajax=1', null, true); return false;\">{$lang->edit_permissions}</a>", array("class" => "align_center"));
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=clear_permission&amp;pid={$perms['pid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_clear_custom_permission}')\">{$lang->clear_custom_perms}</a>", array("class" => "align_center"));

		}

		}

		else
{
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=permissions&amp;gid={$usergroup['gid']}&amp;fid={$fid}\" onclick=\"MyBB.popupWindow('index.php?module=forum-management&action=permissions&gid={$usergroup['gid']}&fid={$fid}&ajax=1', null, true); return false;\">{$lang->set_custom_perms}</a>", array("class" => "align_center", "colspan" => 2));
}

		else
{
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=permissions&amp;gid={$usergroup['gid']}&amp;fid={$fid}\" onclick=\"MyBB.popupWindow('index.php?module=forum-management&action=permissions&gid={$usergroup['gid']}&fid={$fid}&ajax=1', null, true); return false;\">{$lang->set_custom_perms}</a>", array("class" => "align_center", "colspan" => 2));
}

		



		$form_container->construct_row(array('id' => 'row_'.$usergroup['gid']));

$ids[] = $usergroup['gid'];

		$form_container->construct_row(array('id' => 'row_'.$usergroup['gid']));

$ids[] = $usergroup['gid'];

Zeile 1862Zeile 1922
	$mod = $db->fetch_array($query);

// Does the forum not exist?

	$mod = $db->fetch_array($query);

// Does the forum not exist?

	if(!$mod['mid'])

	if(!$mod)

	{
flash_message($lang->error_invalid_moderator, 'error');
admin_redirect("index.php?module=forum-management&fid={$fid}");
}

// User clicked no

	{
flash_message($lang->error_invalid_moderator, 'error');
admin_redirect("index.php?module=forum-management&fid={$fid}");
}

// User clicked no

	if($mybb->input['no'])

	if(!empty($mybb->input['no']))

	{
admin_redirect("index.php?module=forum-management&fid={$fid}");
}

	{
admin_redirect("index.php?module=forum-management&fid={$fid}");
}

Zeile 1880Zeile 1940
	{
$mid = $mod['mid'];
if($mybb->input['isgroup'])

	{
$mid = $mod['mid'];
if($mybb->input['isgroup'])

		{

		{

			$query = $db->query("
SELECT m.*, g.title
FROM ".TABLE_PREFIX."moderators m
LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=m.id)

			$query = $db->query("
SELECT m.*, g.title
FROM ".TABLE_PREFIX."moderators m
LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=m.id)

				WHERE m.mid='{$mid}'
");
}
else
{

				WHERE m.mid='{$mid}'
");
}
else
{

			$query = $db->query("
SELECT m.*, u.username, u.usergroup
FROM ".TABLE_PREFIX."moderators m

			$query = $db->query("
SELECT m.*, u.username, u.usergroup
FROM ".TABLE_PREFIX."moderators m

Zeile 1898Zeile 1958
			");
}
$mod = $db->fetch_array($query);

			");
}
$mod = $db->fetch_array($query);





		$db->delete_query("moderators", "mid='{$mid}'");

$plugins->run_hooks("admin_forum_management_deletemod_commit");

$cache->update_moderators();


		$db->delete_query("moderators", "mid='{$mid}'");

$plugins->run_hooks("admin_forum_management_deletemod_commit");

$cache->update_moderators();


		$forum = get_forum($fid);

		$forum = get_forum($fid, 1);


// Log admin action
if($isgroup)


// Log admin action
if($isgroup)

		{

		{

			log_admin_action($mid, $mod['title'], $forum['fid'], $forum['name']);
}
else

			log_admin_action($mid, $mod['title'], $forum['fid'], $forum['name']);
}
else

Zeile 1919Zeile 1979

flash_message($lang->success_moderator_deleted, 'success');
admin_redirect("index.php?module=forum-management&fid={$fid}#tab_moderators");


flash_message($lang->success_moderator_deleted, 'success');
admin_redirect("index.php?module=forum-management&fid={$fid}#tab_moderators");

	}
else

	}
else

	{
$page->output_confirm_action("index.php?module=forum-management&amp;action=deletemod&amp;fid={$mod['fid']}&amp;uid={$mod['uid']}", $lang->confirm_moderator_deletion);
}

	{
$page->output_confirm_action("index.php?module=forum-management&amp;action=deletemod&amp;fid={$mod['fid']}&amp;uid={$mod['uid']}", $lang->confirm_moderator_deletion);
}

Zeile 1932Zeile 1992
	$forum = $db->fetch_array($query);

// Does the forum not exist?

	$forum = $db->fetch_array($query);

// Does the forum not exist?

	if(!$forum['fid'])

	if(!$forum)

	{
flash_message($lang->error_invalid_forum, 'error');
admin_redirect("index.php?module=forum-management");
}

// User clicked no

	{
flash_message($lang->error_invalid_forum, 'error');
admin_redirect("index.php?module=forum-management");
}

// User clicked no

	if($mybb->input['no'])

	if($mybb->get_input('no'))

	{
admin_redirect("index.php?module=forum-management");
}

	{
admin_redirect("index.php?module=forum-management");
}

Zeile 1949Zeile 2009
	if($mybb->request_method == "post")
{
$fid = $mybb->get_input('fid', MyBB::INPUT_INT);

	if($mybb->request_method == "post")
{
$fid = $mybb->get_input('fid', MyBB::INPUT_INT);

		$forum_info = get_forum($fid);

		$forum = get_forum($fid, 1);


$delquery = "";
switch($db->type)


$delquery = "";
switch($db->type)

Zeile 2048Zeile 2108
	$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
if($fid)
{

	$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
if($fid)
{

		$forum = get_forum($fid);

		$forum = get_forum($fid, 1);

	}

$plugins->run_hooks("admin_forum_management_start");

if($mybb->request_method == "post")
{

	}

$plugins->run_hooks("admin_forum_management_start");

if($mybb->request_method == "post")
{

		if($mybb->input['update'] == "permissions")

		if($mybb->get_input('update') == "permissions")

		{
$inherit = array();
foreach($mybb->input as $id => $permission)

		{
$inherit = array();
foreach($mybb->input as $id => $permission)

Zeile 2083Zeile 2143
					foreach($permission as $name => $value)
{
$permission[$name] = 1;

					foreach($permission as $name => $value)
{
$permission[$name] = 1;

					}

					}

				}
foreach(array('canview','canpostthreads','canpostreplys','canpostpolls') as $name)
{

				}
foreach(array('canview','canpostthreads','canpostreplys','canpostpolls') as $name)
{

					if($permission[$name])

					if(!empty($permission[$name]))

					{
$permissions[$name][$gid] = 1;
}

					{
$permissions[$name][$gid] = 1;
}

Zeile 2096Zeile 2156
						$permissions[$name][$gid] = 0;
}
}

						$permissions[$name][$gid] = 0;
}
}

			}

			}





			$canview = $permissions['canview'];
$canpostthreads = $permissions['canpostthreads'];
$canpostpolls = $permissions['canpostpolls'];
$canpostattachments = $permissions['canpostattachments'];
$canpostreplies = $permissions['canpostreplys'];
















			if(isset($permissions['canview']))
{
$canview = $permissions['canview'];
}
if(isset($permissions['canpostthreads']))
{
$canpostthreads = $permissions['canpostthreads'];
}
if(isset($permissions['canpostpolls']))
{
$canpostpolls = $permissions['canpostpolls'];
}
if(isset($permissions['canpostattachments']))
{
$canpostattachments = $permissions['canpostattachments'];
}
if(isset($permissions['canpostreplys']))
{
$canpostreplies = $permissions['canpostreplys'];
}


save_quick_perms($fid);



save_quick_perms($fid);


Zeile 2116Zeile 2191
			flash_message($lang->success_forum_permissions_updated, 'success');
admin_redirect("index.php?module=forum-management&fid={$fid}#tab_permissions");
}

			flash_message($lang->success_forum_permissions_updated, 'success');
admin_redirect("index.php?module=forum-management&fid={$fid}#tab_permissions");
}

		elseif($mybb->input['add'] == "moderators")

		elseif($mybb->get_input('add') == "moderators")

		{

		{

			$forum = get_forum($fid);

			$forum = get_forum($fid, 1);

			if(!$forum)
{
flash_message($lang->error_invalid_forum, 'error');

			if(!$forum)
{
flash_message($lang->error_invalid_forum, 'error');

Zeile 2144Zeile 2219
			else
{
$options = array(

			else
{
$options = array(

					'fields' => array('uid AS id', 'username AS name')

					'fields' => array('uid AS id', 'username AS name', 'usergroup', 'additionalgroups')

				);

				);

				$newmod = get_user_by_username($mybb->input['username'], $options);

				$newmod = $newmoduser = get_user_by_username($mybb->input['username'], $options);


if(empty($newmod['id']))
{


if(empty($newmod['id']))
{

Zeile 2196Zeile 2271

if(!$isgroup)
{


if(!$isgroup)
{

						$db->update_query("users", array('usergroup' => 6), "uid='{$newmod['id']}' AND usergroup='2'");
}





















						$newmodgroups = $newmoduser['usergroup'];
if(!empty($newmoduser['additionalgroups']))
{
$newmodgroups .= ','.$newmoduser['additionalgroups'];
}
$groupperms = usergroup_permissions($newmodgroups);

// Check if new moderator already belongs to a moderators group
if($groupperms['canmodcp'] != 1)
{
if($newmoduser['usergroup'] == 2 || $newmoduser['usergroup'] == 5)
{
// Primary group is default registered or awaiting activation group so change primary group to Moderators
$db->update_query("users", array('usergroup' => 6), "uid='{$newmoduser['id']}'");
}
else
{
// Primary group is another usergroup without canmodcp so add Moderators to additional groups
join_usergroup($newmoduser['id'], 6);
}
}
}


$plugins->run_hooks("admin_forum_management_start_moderators_commit");

$cache->update_moderators();


$plugins->run_hooks("admin_forum_management_start_moderators_commit");

$cache->update_moderators();





					// Log admin action
log_admin_action('addmod', $mid, $newmod['name'], $fid, $forum['name']);

flash_message($lang->success_moderator_added, 'success');
admin_redirect("index.php?module=forum-management&action=editmod&mid={$mid}");

					// Log admin action
log_admin_action('addmod', $mid, $newmod['name'], $fid, $forum['name']);

flash_message($lang->success_moderator_added, 'success');
admin_redirect("index.php?module=forum-management&action=editmod&mid={$mid}");

				}

				}

				else
{
flash_message($lang->error_moderator_already_added, 'error');
admin_redirect("index.php?module=forum-management&fid={$fid}#tab_moderators");

				else
{
flash_message($lang->error_moderator_already_added, 'error');
admin_redirect("index.php?module=forum-management&fid={$fid}#tab_moderators");

				}

				}

			}
else
{

			}
else
{

Zeile 2228Zeile 2323
				foreach($mybb->input['disporder'] as $update_fid => $order)
{
$db->update_query("forums", array('disporder' => (int)$order), "fid='".(int)$update_fid."'");

				foreach($mybb->input['disporder'] as $update_fid => $order)
{
$db->update_query("forums", array('disporder' => (int)$order), "fid='".(int)$update_fid."'");

				}


				}


				$plugins->run_hooks("admin_forum_management_start_disporder_commit");

$cache->update_forums();

				$plugins->run_hooks("admin_forum_management_start_disporder_commit");

$cache->update_forums();





				// Log admin action

				// Log admin action

				log_admin_action('orders', $forum['fid'], $forum['name']);








				if(!empty($forum))
{
log_admin_action('orders', $forum['fid'], $forum['name']);
}
else
{
log_admin_action('orders', 0);
}


flash_message($lang->success_forum_disporder_updated, 'success');
admin_redirect("index.php?module=forum-management&fid=".$mybb->input['fid']);


flash_message($lang->success_forum_disporder_updated, 'success');
admin_redirect("index.php?module=forum-management&fid=".$mybb->input['fid']);

Zeile 2248Zeile 2350
	if($fid)
{
$page->add_breadcrumb_item($lang->view_forum, "index.php?module=forum-management");

	if($fid)
{
$page->add_breadcrumb_item($lang->view_forum, "index.php?module=forum-management");

	}

	}


$page->output_header($lang->forum_management);



$page->output_header($lang->forum_management);


Zeile 2286Zeile 2388
		$form_container = new FormContainer($lang->manage_forums);
}
$form_container->output_row_header($lang->forum);

		$form_container = new FormContainer($lang->manage_forums);
}
$form_container->output_row_header($lang->forum);

	$form_container->output_row_header($lang->order, array("class" => "align_center", 'width' => '5%'));

	$form_container->output_row_header($lang->order, array("class" => "align_center", 'width' => '6%'));

	$form_container->output_row_header($lang->controls, array("class" => "align_center", 'style' => 'width: 200px'));

build_admincp_forums_list($form_container, $form, $fid);

$submit_options = array();


	$form_container->output_row_header($lang->controls, array("class" => "align_center", 'style' => 'width: 200px'));

build_admincp_forums_list($form_container, $form, $fid);

$submit_options = array();


 
	$no_results = false;

	if($form_container->num_rows() == 0)
{
$form_container->output_cell($lang->no_forums, array('colspan' => 3));
$form_container->construct_row();

	if($form_container->num_rows() == 0)
{
$form_container->output_cell($lang->no_forums, array('colspan' => 3));
$form_container->construct_row();

		$submit_options = array('disabled' => true);

		$no_results = true;

	}

$form_container->end();


	}

$form_container->end();


	$buttons[] = $form->generate_submit_button($lang->update_forum_orders, $submit_options);
$buttons[] = $form->generate_reset_button($lang->reset);

$form->output_submit_wrapper($buttons);



	if(!$no_results)
{
$buttons[] = $form->generate_submit_button($lang->update_forum_orders, $submit_options);
$buttons[] = $form->generate_reset_button($lang->reset);
$form->output_submit_wrapper($buttons);
}


if(!$fid)
{


if(!$fid)
{

Zeile 2364Zeile 2469
			{
if($mybb->input['default_permissions'][$usergroup['gid']])
{

			{
if($mybb->input['default_permissions'][$usergroup['gid']])
{

					if(is_array($existing_permissions) && $existing_permissions[$usergroup['gid']])

					if(isset($existing_permissions) && is_array($existing_permissions) && $existing_permissions[$usergroup['gid']])

					{
$perms = $existing_permissions[$usergroup['gid']];
$default_checked = false;
}

					{
$perms = $existing_permissions[$usergroup['gid']];
$default_checked = false;
}

					elseif(is_array($cached_forum_perms) && $cached_forum_perms[$forum['fid']][$usergroup['gid']])

					elseif(is_array($cached_forum_perms) && isset($cached_forum_perms[$forum['fid']]) && $cached_forum_perms[$forum['fid']][$usergroup['gid']])

					{
$perms = $cached_forum_perms[$forum['fid']][$usergroup['gid']];

					{
$perms = $cached_forum_perms[$forum['fid']][$usergroup['gid']];

						$default_checked = true;
}
else if(is_array($cached_forum_perms) && $cached_forum_perms[$forum['pid']][$usergroup['gid']])

						$default_checked = true;
}
else if(is_array($cached_forum_perms) && isset($cached_forum_perms[$forum['pid']]) && $cached_forum_perms[$forum['pid']][$usergroup['gid']])

					{
$perms = $cached_forum_perms[$forum['pid']][$usergroup['gid']];
$default_checked = true;
}
}

					{
$perms = $cached_forum_perms[$forum['pid']][$usergroup['gid']];
$default_checked = true;
}
}


if(!$perms)
{
$perms = $usergroup;
$default_checked = true;
}


if(!$perms)
{
$perms = $usergroup;
$default_checked = true;
}

			}
else

			}
else

			{
if(isset($existing_permissions) && is_array($existing_permissions) && $existing_permissions[$usergroup['gid']])
{

			{
if(isset($existing_permissions) && is_array($existing_permissions) && !empty($existing_permissions[$usergroup['gid']]))
{

					$perms = $existing_permissions[$usergroup['gid']];

					$perms = $existing_permissions[$usergroup['gid']];

					$default_checked = false;
}
elseif(is_array($cached_forum_perms) && isset($cached_forum_perms[$forum['fid']]) && $cached_forum_perms[$forum['fid']][$usergroup['gid']])
{
$perms = $cached_forum_perms[$forum['fid']][$usergroup['gid']];

					$default_checked = false;
}
elseif(isset($forum['fid']) && is_array($cached_forum_perms) && isset($cached_forum_perms[$forum['fid']][$usergroup['gid']]) && $cached_forum_perms[$forum['fid']][$usergroup['gid']])
{
$perms = $cached_forum_perms[$forum['fid']][$usergroup['gid']];

					$default_checked = true;
}

					$default_checked = true;
}

				else if(is_array($cached_forum_perms) && $cached_forum_perms[$forum['pid']][$usergroup['gid']])

				else if(isset($forum['pid']) && is_array($cached_forum_perms) && isset($cached_forum_perms[$forum['pid']][$usergroup['gid']]) && $cached_forum_perms[$forum['pid']][$usergroup['gid']])

				{
$perms = $cached_forum_perms[$forum['pid']][$usergroup['gid']];

				{
$perms = $cached_forum_perms[$forum['pid']][$usergroup['gid']];

					$default_checked = true;

					$default_checked = true;

				}

if(!$perms)

				}

if(!$perms)

Zeile 2416Zeile 2521
				if(isset($mybb->input['permissions']))
{
if($mybb->input['permissions'][$usergroup['gid']][$forum_permission])

				if(isset($mybb->input['permissions']))
{
if($mybb->input['permissions'][$usergroup['gid']][$forum_permission])

					{
$perms_checked[$forum_permission] = 1;
}
else
{

					{
$perms_checked[$forum_permission] = 1;
}
else
{

						$perms_checked[$forum_permission] = 0;
}
}
else

						$perms_checked[$forum_permission] = 0;
}
}
else

				{

				{

					if($perms[$forum_permission] == 1)
{
$perms_checked[$forum_permission] = 1;

					if($perms[$forum_permission] == 1)
{
$perms_checked[$forum_permission] = 1;

Zeile 2434Zeile 2539
					{
$perms_checked[$forum_permission] = 0;
}

					{
$perms_checked[$forum_permission] = 0;
}

				}

				}

			}
$usergroup['title'] = htmlspecialchars_uni($usergroup['title']);

if($default_checked == 1)

			}
$usergroup['title'] = htmlspecialchars_uni($usergroup['title']);

if($default_checked == 1)

			{

			{

				$inherited_text = $lang->inherited_permission;
}
else

				$inherited_text = $lang->inherited_permission;
}
else

Zeile 2454Zeile 2559
			foreach($perms_checked as $perm => $value)
{
if($value == 1)

			foreach($perms_checked as $perm => $value)
{
if($value == 1)

				{
$field_select .= "<li id=\"field-{$perm}\">{$field_list2[$perm]}</li>";
}

				{
$field_select .= "<li id=\"field-{$perm}\">{$field_list2[$perm]}</li>";
}

			}
$field_select .= "</ul></div>\n";
$field_select .= "<div class=\"disabled\"><ul id=\"fields_disabled_{$usergroup['gid']}\">\n";

			}
$field_select .= "</ul></div>\n";
$field_select .= "<div class=\"disabled\"><ul id=\"fields_disabled_{$usergroup['gid']}\">\n";

Zeile 2540Zeile 2645
		{
if($moderator['isgroup'])
{

		{
if($moderator['isgroup'])
{

				$moderator['img'] = "<img src=\"styles/{$page->style}/images/icons/group.png\" alt=\"{$lang->group}\" title=\"{$lang->group}\" />";

				$moderator['img'] = "<img src=\"styles/{$page->style}/images/icons/group.png\" alt=\"{$lang->permissions_group}\" title=\"{$lang->permissions_group}\" />";

				$form_container->output_cell("{$moderator['img']} <a href=\"index.php?module=user-groups&amp;action=edit&amp;gid={$moderator['id']}\">".htmlspecialchars_uni($moderator['title'])." ({$lang->usergroup} {$moderator['id']})</a>");
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=editmod&amp;mid={$moderator['mid']}\">{$lang->edit}</a>", array("class" => "align_center"));
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=deletemod&amp;id={$moderator['id']}&amp;isgroup=1&amp;fid={$fid}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_moderator_deletion}')\">{$lang->delete}</a>", array("class" => "align_center"));
}
else
{

				$form_container->output_cell("{$moderator['img']} <a href=\"index.php?module=user-groups&amp;action=edit&amp;gid={$moderator['id']}\">".htmlspecialchars_uni($moderator['title'])." ({$lang->usergroup} {$moderator['id']})</a>");
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=editmod&amp;mid={$moderator['mid']}\">{$lang->edit}</a>", array("class" => "align_center"));
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=deletemod&amp;id={$moderator['id']}&amp;isgroup=1&amp;fid={$fid}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_moderator_deletion}')\">{$lang->delete}</a>", array("class" => "align_center"));
}
else
{

				$moderator['img'] = "<img src=\"styles/{$page->style}/images/icons/user.png\" alt=\"{$lang->user}\" title=\"{$lang->user}\" />";

				$moderator['img'] = "<img src=\"styles/{$page->style}/images/icons/user.png\" alt=\"{$lang->permissions_user}\" title=\"{$lang->permissions_user}\" />";

				$form_container->output_cell("{$moderator['img']} <a href=\"index.php?module=user-users&amp;action=edit&amp;uid={$moderator['id']}\">".htmlspecialchars_uni($moderator['username'])."</a>");
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=editmod&amp;mid={$moderator['mid']}\">{$lang->edit}</a>", array("class" => "align_center"));
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=deletemod&amp;id={$moderator['id']}&amp;isgroup=0&amp;fid={$fid}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_moderator_deletion}')\">{$lang->delete}</a>", array("class" => "align_center"));

				$form_container->output_cell("{$moderator['img']} <a href=\"index.php?module=user-users&amp;action=edit&amp;uid={$moderator['id']}\">".htmlspecialchars_uni($moderator['username'])."</a>");
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=editmod&amp;mid={$moderator['mid']}\">{$lang->edit}</a>", array("class" => "align_center"));
$form_container->output_cell("<a href=\"index.php?module=forum-management&amp;action=deletemod&amp;id={$moderator['id']}&amp;isgroup=0&amp;fid={$fid}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_moderator_deletion}')\">{$lang->delete}</a>", array("class" => "align_center"));

Zeile 2655Zeile 2760
		echo "</div>\n";

$plugins->run_hooks("admin_forum_management_start_graph");

		echo "</div>\n";

$plugins->run_hooks("admin_forum_management_start_graph");

	}


	}


	$page->output_footer();
}

	$page->output_footer();
}





/**
* @param DefaultFormContainer $form_container
* @param DefaultForm $form

/**
* @param DefaultFormContainer $form_container
* @param DefaultForm $form

Zeile 2674Zeile 2779
	if(!is_array($forums_by_parent))
{
$forum_cache = cache_forums();

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





		foreach($forum_cache as $forum)
{
$forums_by_parent[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
}

		foreach($forum_cache as $forum)
{
$forums_by_parent[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;
}

	}

if(!is_array($forums_by_parent[$pid]))

	}

if(!isset($forums_by_parent[$pid]) || !is_array($forums_by_parent[$pid]))

	{
return;
}

	{
return;
}






$donecount = 0;
$comma = '';

	foreach($forums_by_parent[$pid] as $children)
{
foreach($children as $forum)

	foreach($forums_by_parent[$pid] as $children)
{
foreach($children as $forum)

Zeile 2695Zeile 2802
			if($forum['active'] == 0)
{
$forum['name'] = "<em>".$forum['name']."</em>";

			if($forum['active'] == 0)
{
$forum['name'] = "<em>".$forum['name']."</em>";

			}


			}


			if($forum['type'] == "c" && ($depth == 1 || $depth == 2))
{
$sub_forums = '';
if(isset($forums_by_parent[$forum['fid']]) && $depth == 2)

			if($forum['type'] == "c" && ($depth == 1 || $depth == 2))
{
$sub_forums = '';
if(isset($forums_by_parent[$forum['fid']]) && $depth == 2)

				{

				{

					build_admincp_forums_list($form_container, $form, $forum['fid'], $depth+1);
}
if($sub_forums)

					build_admincp_forums_list($form_container, $form, $forum['fid'], $depth+1);
}
if($sub_forums)

Zeile 2718Zeile 2825
				$popup->add_item($lang->subforums, "index.php?module=forum-management&amp;fid={$forum['fid']}");
$popup->add_item($lang->moderators, "index.php?module=forum-management&amp;fid={$forum['fid']}#tab_moderators");
$popup->add_item($lang->permissions, "index.php?module=forum-management&amp;fid={$forum['fid']}#tab_permissions");

				$popup->add_item($lang->subforums, "index.php?module=forum-management&amp;fid={$forum['fid']}");
$popup->add_item($lang->moderators, "index.php?module=forum-management&amp;fid={$forum['fid']}#tab_moderators");
$popup->add_item($lang->permissions, "index.php?module=forum-management&amp;fid={$forum['fid']}#tab_permissions");

 
				$popup->add_item($lang->forum_thread_prefixes, "index.php?module=config-thread_prefixes&amp;fid={$forum['fid']}");

				$popup->add_item($lang->add_child_forum, "index.php?module=forum-management&amp;action=add&amp;pid={$forum['fid']}");
$popup->add_item($lang->copy_forum, "index.php?module=forum-management&amp;action=copy&amp;fid={$forum['fid']}");
$popup->add_item($lang->delete_forum, "index.php?module=forum-management&amp;action=delete&amp;fid={$forum['fid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_forum_deletion}')");

				$popup->add_item($lang->add_child_forum, "index.php?module=forum-management&amp;action=add&amp;pid={$forum['fid']}");
$popup->add_item($lang->copy_forum, "index.php?module=forum-management&amp;action=copy&amp;fid={$forum['fid']}");
$popup->add_item($lang->delete_forum, "index.php?module=forum-management&amp;action=delete&amp;fid={$forum['fid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_forum_deletion}')");





				$form_container->output_cell($popup->fetch(), array("class" => "align_center"));

$form_container->construct_row();

// Does this category have any sub forums?

				$form_container->output_cell($popup->fetch(), array("class" => "align_center"));

$form_container->construct_row();

// Does this category have any sub forums?

				if($forums_by_parent[$forum['fid']])

				if(!empty($forums_by_parent[$forum['fid']]))

				{
build_admincp_forums_list($form_container, $form, $forum['fid'], $depth+1);
}

				{
build_admincp_forums_list($form_container, $form, $forum['fid'], $depth+1);
}

Zeile 2737Zeile 2845
				if($forum['description'])
{
$forum['description'] = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $forum['description']);

				if($forum['description'])
{
$forum['description'] = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $forum['description']);

           			$forum['description'] = "<br /><small>".$forum['description']."</small>";
}

					$forum['description'] = "<br /><small>".$forum['description']."</small>";
}


$sub_forums = '';
if(isset($forums_by_parent[$forum['fid']]) && $depth == 2)


$sub_forums = '';
if(isset($forums_by_parent[$forum['fid']]) && $depth == 2)

Zeile 2758Zeile 2866
				$popup->add_item($lang->subforums, "index.php?module=forum-management&amp;fid={$forum['fid']}");
$popup->add_item($lang->moderators, "index.php?module=forum-management&amp;fid={$forum['fid']}#tab_moderators");
$popup->add_item($lang->permissions, "index.php?module=forum-management&amp;fid={$forum['fid']}#tab_permissions");

				$popup->add_item($lang->subforums, "index.php?module=forum-management&amp;fid={$forum['fid']}");
$popup->add_item($lang->moderators, "index.php?module=forum-management&amp;fid={$forum['fid']}#tab_moderators");
$popup->add_item($lang->permissions, "index.php?module=forum-management&amp;fid={$forum['fid']}#tab_permissions");

 
				$popup->add_item($lang->forum_thread_prefixes, "index.php?module=config-thread_prefixes&amp;fid={$forum['fid']}");

				$popup->add_item($lang->add_child_forum, "index.php?module=forum-management&amp;action=add&amp;pid={$forum['fid']}");
$popup->add_item($lang->copy_forum, "index.php?module=forum-management&amp;action=copy&amp;fid={$forum['fid']}");
$popup->add_item($lang->delete_forum, "index.php?module=forum-management&amp;action=delete&amp;fid={$forum['fid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_forum_deletion}')");

				$popup->add_item($lang->add_child_forum, "index.php?module=forum-management&amp;action=add&amp;pid={$forum['fid']}");
$popup->add_item($lang->copy_forum, "index.php?module=forum-management&amp;action=copy&amp;fid={$forum['fid']}");
$popup->add_item($lang->delete_forum, "index.php?module=forum-management&amp;action=delete&amp;fid={$forum['fid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_forum_deletion}')");

Zeile 2884Zeile 2993
	$form_container->output_cell("<strong>{$usergroup['title']}</strong> <small style=\"vertical-align: middle;\">({$inherited_text})</small>");

$field_select = "<div class=\"quick_perm_fields\">\n";

	$form_container->output_cell("<strong>{$usergroup['title']}</strong> <small style=\"vertical-align: middle;\">({$inherited_text})</small>");

$field_select = "<div class=\"quick_perm_fields\">\n";

	$field_select .= "<div class=\"enabled\"><div class=\"fields_title\">{$lang->enabled}</div><ul id=\"fields_enabled_{$usergroup['gid']}\">\n";

	$field_select .= "<div class=\"enabled\"><ul id=\"fields_enabled_{$usergroup['gid']}\">\n";

	foreach($perms_checked as $perm => $value)
{
if($value == 1)

	foreach($perms_checked as $perm => $value)
{
if($value == 1)

Zeile 2893Zeile 3002
		}
}
$field_select .= "</ul></div>\n";

		}
}
$field_select .= "</ul></div>\n";

	$field_select .= "<div class=\"disabled\"><div class=\"fields_title\">{$lang->disabled}</div><ul id=\"fields_disabled_{$usergroup['gid']}\">\n";

	$field_select .= "<div class=\"disabled\"><ul id=\"fields_disabled_{$usergroup['gid']}\">\n";

	foreach($perms_checked as $perm => $value)
{
if($value == 0)

	foreach($perms_checked as $perm => $value)
{
if($value == 0)