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

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

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


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

		$from = (int)$mybb->input['from'];
$to = (int)$mybb->input['to'];

		$from = $mybb->get_input('from', MyBB::INPUT_INT);
$to = $mybb->get_input('to', MyBB::INPUT_INT);


// Find the source forum
$query = $db->simple_select("forums", '*', "fid='{$from}'");


// Find the source forum
$query = $db->simple_select("forums", '*', "fid='{$from}'");

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['pid'] = $mybb->get_input('pid', 1);
$new_forum['rulestitle'] = $db->escape_string($new_forum['rulestitle']);
$new_forum['rules'] = $db->escape_string($new_forum['rules']);

				$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['parentlist'] = '';


				$new_forum['parentlist'] = '';


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







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

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


				// Generate parent list
$parentlist = make_parent_list($to);
$updatearray = array(

				// Generate parent list
$parentlist = make_parent_list($to);
$updatearray = array(

Zeile 128Zeile 135
			{
$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($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 155Zeile 169
				{
unset($permissions['pid']);
$permissions['fid'] = $to;

				{
unset($permissions['pid']);
$permissions['fid'] = $to;





					$db->insert_query("forumpermissions", $permissions);
}


					$db->insert_query("forumpermissions", $permissions);
}


Zeile 167Zeile 181
				// Log admin action (no group permissions)
log_admin_action($from, $from_forum['name'], $to, $new_forum['name']);
}

				// Log admin action (no group permissions)
log_admin_action($from, $from_forum['name'], $to, $new_forum['name']);
}

 

$plugins->run_hooks("admin_forum_management_copy_commit");


			$cache->update_forums();
$cache->update_forumpermissions();

			$cache->update_forums();
$cache->update_forumpermissions();


$plugins->run_hooks("admin_forum_management_copy_commit");

 

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


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

Zeile 182Zeile 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";
}
else
{
$copy_data['pid'] = $mybb->get_input('pid', 1);

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


		}

		}

		$copy_data['disporder'] = "1";
$copy_data['from'] = $mybb->input['fid'];
$copy_data['copyforumsettings'] = 0;
$copy_data['pid'] = 0;

 
	}

$types = array(

	}

$types = array(

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

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

		$usergroups[$usergroup['gid']] = $usergroup['title'];

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

	}

$form_container = new FormContainer($lang->copy_forum);
$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 = new FormContainer($lang->copy_forum);
$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->end();


Zeile 263Zeile 285

if($mybb->input['action'] == "editmod")
{


if($mybb->input['action'] == "editmod")
{

	$query = $db->simple_select("moderators", "*", "mid='".$mybb->get_input('mid', 1)."'");

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

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

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";
}
else

	{
$fieldname = "title";
}
else

	{

	{

		$fieldname = "username";
}

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

		$fieldname = "username";
}

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

		$mid = $mybb->get_input('mid', 1);

		$mid = $mybb->get_input('mid', MyBB::INPUT_INT);

		if(!$mid)
{
flash_message($lang->error_incorrect_moderator, 'error');

		if(!$mid)
{
flash_message($lang->error_incorrect_moderator, 'error');

Zeile 294Zeile 316

if(!$errors)
{


if(!$errors)
{

			$fid = $mybb->get_input('fid', 1);
$forum = get_forum($fid);

			$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
$forum = get_forum($fid, 1);

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

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

Zeile 306Zeile 328
			}
$update_array = array(
'fid' => (int)$fid,

			}
$update_array = array(
'fid' => (int)$fid,

				'caneditposts' => (int)$mybb->input['caneditposts'],
'cansoftdeleteposts' => (int)$mybb->input['cansoftdeleteposts'],
'canrestoreposts' => (int)$mybb->input['canrestoreposts'],
'candeleteposts' => (int)$mybb->input['candeleteposts'],
'cansoftdeletethreads' => (int)$mybb->input['cansoftdeletethreads'],
'canrestorethreads' => (int)$mybb->input['canrestorethreads'],
'candeletethreads' => (int)$mybb->input['candeletethreads'],
'canviewips' => (int)$mybb->input['canviewips'],
'canviewunapprove' => (int)$mybb->input['canviewunapprove'],
'canviewdeleted' => (int)$mybb->input['canviewdeleted'],
'canopenclosethreads' => (int)$mybb->input['canopenclosethreads'],
'canstickunstickthreads' => (int)$mybb->input['canstickunstickthreads'],
'canapproveunapprovethreads' => (int)$mybb->input['canapproveunapprovethreads'],
'canapproveunapproveposts' => (int)$mybb->input['canapproveunapproveposts'],
'canapproveunapproveattachs' => (int)$mybb->input['canapproveunapproveattachs'],
'canmanagethreads' => (int)$mybb->input['canmanagethreads'],
'canmanagepolls' => (int)$mybb->input['canmanagepolls'],
'canpostclosedthreads' => (int)$mybb->input['canpostclosedthreads'],
'canmovetononmodforum' => (int)$mybb->input['canmovetononmodforum'],
'canusecustomtools' => (int)$mybb->input['canusecustomtools'],
'canmanageannouncements' => (int)$mybb->input['canmanageannouncements'],
'canmanagereportedposts' => (int)$mybb->input['canmanagereportedposts'],
'canviewmodlog' => (int)$mybb->input['canviewmodlog']

				'caneditposts' => $mybb->get_input('caneditposts', MyBB::INPUT_INT),
'cansoftdeleteposts' => $mybb->get_input('cansoftdeleteposts', MyBB::INPUT_INT),
'canrestoreposts' => $mybb->get_input('canrestoreposts', MyBB::INPUT_INT),
'candeleteposts' => $mybb->get_input('candeleteposts', MyBB::INPUT_INT),
'cansoftdeletethreads' => $mybb->get_input('cansoftdeletethreads', MyBB::INPUT_INT),
'canrestorethreads' => $mybb->get_input('canrestorethreads', MyBB::INPUT_INT),
'candeletethreads' => $mybb->get_input('candeletethreads', MyBB::INPUT_INT),
'canviewips' => $mybb->get_input('canviewips', MyBB::INPUT_INT),
'canviewunapprove' => $mybb->get_input('canviewunapprove', MyBB::INPUT_INT),
'canviewdeleted' => $mybb->get_input('canviewdeleted', MyBB::INPUT_INT),
'canopenclosethreads' => $mybb->get_input('canopenclosethreads', MyBB::INPUT_INT),
'canstickunstickthreads' => $mybb->get_input('canstickunstickthreads', MyBB::INPUT_INT),
'canapproveunapprovethreads' => $mybb->get_input('canapproveunapprovethreads', MyBB::INPUT_INT),
'canapproveunapproveposts' => $mybb->get_input('canapproveunapproveposts', MyBB::INPUT_INT),
'canapproveunapproveattachs' => $mybb->get_input('canapproveunapproveattachs', MyBB::INPUT_INT),
'canmanagethreads' => $mybb->get_input('canmanagethreads', MyBB::INPUT_INT),
'canmanagepolls' => $mybb->get_input('canmanagepolls', MyBB::INPUT_INT),
'canpostclosedthreads' => $mybb->get_input('canpostclosedthreads', MyBB::INPUT_INT),
'canmovetononmodforum' => $mybb->get_input('canmovetononmodforum', MyBB::INPUT_INT),
'canusecustomtools' => $mybb->get_input('canusecustomtools', MyBB::INPUT_INT),
'canmanageannouncements' => $mybb->get_input('canmanageannouncements', MyBB::INPUT_INT),
'canmanagereportedposts' => $mybb->get_input('canmanagereportedposts', MyBB::INPUT_INT),
'canviewmodlog' => $mybb->get_input('canviewmodlog', MyBB::INPUT_INT)

			);

			);

			$db->update_query("moderators", $update_array, "mid='".$mybb->get_input('mid', 1)."'");

$cache->update_moderators();

 

$plugins->run_hooks("admin_forum_management_editmod_commit");


$plugins->run_hooks("admin_forum_management_editmod_commit");

 

$db->update_query("moderators", $update_array, "mid='".$mybb->get_input('mid', MyBB::INPUT_INT)."'");

$cache->update_moderators();


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

flash_message($lang->success_moderator_updated, 'success');


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

flash_message($lang->success_moderator_updated, 'success');

			admin_redirect("index.php?module=forum-management&fid=".$mybb->get_input('fid', 1)."#tab_moderators");

			admin_redirect("index.php?module=forum-management&fid=".$mybb->get_input('fid', MyBB::INPUT_INT)."#tab_moderators");

		}
}


		}
}


Zeile 379Zeile 402

$form_container = new FormContainer($lang->sprintf($lang->edit_mod_for, $mod_data[$fieldname]));
$form_container->output_row($lang->forum, $lang->forum_desc, $form->generate_forum_select('fid', $mod_data['fid'], array('id' => 'fid')), 'fid');


$form_container = new FormContainer($lang->sprintf($lang->edit_mod_for, $mod_data[$fieldname]));
$form_container->output_row($lang->forum, $lang->forum_desc, $form->generate_forum_select('fid', $mod_data['fid'], array('id' => 'fid')), 'fid');





	$moderator_permissions = array(
$form->generate_check_box('caneditposts', 1, $lang->can_edit_posts, array('checked' => $mod_data['caneditposts'], 'id' => 'caneditposts')),
$form->generate_check_box('cansoftdeleteposts', 1, $lang->can_soft_delete_posts, array('checked' => $mod_data['cansoftdeleteposts'], 'id' => 'cansoftdeleteposts')),

	$moderator_permissions = array(
$form->generate_check_box('caneditposts', 1, $lang->can_edit_posts, array('checked' => $mod_data['caneditposts'], 'id' => 'caneditposts')),
$form->generate_check_box('cansoftdeleteposts', 1, $lang->can_soft_delete_posts, array('checked' => $mod_data['cansoftdeleteposts'], 'id' => 'cansoftdeleteposts')),

Zeile 422Zeile 445

if($mybb->input['action'] == "clear_permission")
{


if($mybb->input['action'] == "clear_permission")
{

	$pid = $mybb->get_input('pid', 1);
$fid = $mybb->get_input('fid', 1);
$gid = (int)$mybb->input['gid'];

	$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


// 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}");
}


	$plugins->run_hooks("admin_forum_management_deletemod");

	$plugins->run_hooks("admin_forum_management_clear_permission");


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


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

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

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

		}

		}


if($pid)


if($pid)

		{

		{

			$db->delete_query("forumpermissions", "pid='{$pid}'");
}
else
{
$db->delete_query("forumpermissions", "gid='{$gid}' AND fid='{$fid}'");
}

			$db->delete_query("forumpermissions", "pid='{$pid}'");
}
else
{
$db->delete_query("forumpermissions", "gid='{$gid}' AND fid='{$fid}'");
}

 

$plugins->run_hooks('admin_forum_management_clear_permission_commit');


$cache->update_forumpermissions();

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


$cache->update_forumpermissions();

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

	}
else
{

	}
else
{

		$page->output_confirm_action("index.php?module=forum-management&amp;action=clear_permission&amp;pid={$pid}&amp;gid={$gid}&amp;fid={$fid}", $lang->confirm_clear_custom_permission);
}
}

		$page->output_confirm_action("index.php?module=forum-management&amp;action=clear_permission&amp;pid={$pid}&amp;gid={$gid}&amp;fid={$fid}", $lang->confirm_clear_custom_permission);
}
}

Zeile 470Zeile 495

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


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

		$pid = $mybb->get_input('pid', 1);
$fid = $mybb->get_input('fid', 1);
$gid = (int)$mybb->input['gid'];
$forum = get_forum($fid);


		$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, 1);


		if((!$fid || !$gid) && $pid)
{
$query = $db->simple_select("forumpermissions", "fid, gid", "pid='{$pid}'");
$result = $db->fetch_array($query);
$fid = $result['fid'];
$gid = $result['gid'];

		if((!$fid || !$gid) && $pid)
{
$query = $db->simple_select("forumpermissions", "fid, gid", "pid='{$pid}'");
$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...
foreach($fields_array as $field)

		{
// User has set permissions for this group...
foreach($fields_array as $field)

Zeile 496Zeile 521
					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']];

					}

					}

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

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

				}
}
}
else

				}
}
}
else

		{
// Else, we assume that the group has no permissions...
foreach($fields_array as $field)

		{
// Else, we assume that the group has no permissions...
foreach($fields_array as $field)

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

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

		}

		}


if($fid && !$pid)
{
$update_array['fid'] = $fid;


if($fid && !$pid)
{
$update_array['fid'] = $fid;

			$update_array['gid'] = (int)$mybb->input['gid'];

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

			$db->insert_query("forumpermissions", $update_array);
}

			$db->insert_query("forumpermissions", $update_array);
}

		else





$plugins->run_hooks("admin_forum_management_permissions_commit");

if(!($fid && !$pid))

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

$cache->update_forumpermissions();

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

$cache->update_forumpermissions();


$plugins->run_hooks("admin_forum_management_permissions_commit");

 

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


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

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

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

		}

		}

	}

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

	}

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

Zeile 562Zeile 588
		}
else
{

		}
else
{

			$query = $db->simple_select("forumpermissions", "fid", "pid='".$mybb->get_input('pid', 1)."'");

			$query = $db->simple_select("forumpermissions", "fid", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");

			$mybb->input['fid'] = $db->fetch_field($query, "fid");

$sub_tabs['edit_permissions'] = array(
'title' => $lang->forum_permissions,

			$mybb->input['fid'] = $db->fetch_field($query, "fid");

$sub_tabs['edit_permissions'] = array(
'title' => $lang->forum_permissions,

				'link' => "index.php?module=forum-management&amp;action=permissions&amp;pid=".$mybb->get_input('pid', 1),

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

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


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


Zeile 585Zeile 611
		<script src=\"jscripts/tabs.js\" type=\"text/javascript\"></script>\n
<script type=\"text/javascript\">
<!--

		<script src=\"jscripts/tabs.js\" type=\"text/javascript\"></script>\n
<script type=\"text/javascript\">
<!--

$(document).ready(function() {

$(function() {

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

	$(\"#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 611Zeile 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");
}
else
{

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

			$form = new Form("index.php?module=forum-management&amp;action=permissions&amp;ajax=1&amp;pid=".$mybb->get_input('pid', 1)."&amp;gid=".(int)$mybb->input['gid']."&amp;fid=".(int)$mybb->input['gid'], "post", "modal_form");

			$form = new Form("index.php?module=forum-management&amp;action=permissions&amp;ajax=1&amp;pid=".$mybb->get_input('pid', MyBB::INPUT_INT)."&amp;gid=".$mybb->get_input('gid', MyBB::INPUT_INT)."&amp;fid=".$mybb->get_input('gid', MyBB::INPUT_INT), "post", "modal_form");

		}
echo $form->generate_hidden_field("usecustom", "1");


		}
echo $form->generate_hidden_field("usecustom", "1");


Zeile 636Zeile 662
		}
else
{

		}
else
{

			$pid = $mybb->get_input('pid', 1);
$gid = (int)$mybb->input['gid'];
$fid = $mybb->get_input('fid', 1);

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


if($pid)
{


if($pid)
{

Zeile 651Zeile 677

$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(!$pid)
{
$pid = $permission_data['pid'];
}




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

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

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


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


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

Zeile 673Zeile 702
			$forum = $db->fetch_array($query);

$sperms = $permission_data;

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

$sperms = $permission_data;





			$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 687Zeile 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 714Zeile 743
			'candeleteposts' => 'editing',
'candeletethreads' => 'editing',
'caneditattachments' => 'editing',

			'candeleteposts' => 'editing',
'candeletethreads' => 'editing',
'caneditattachments' => 'editing',




			'canviewdeletionnotice' => 'editing',


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

			'modposts' => '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)
{

Zeile 747Zeile 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))
{

Zeile 769Zeile 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 778Zeile 819

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


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

			$buttons[] = $form->generate_submit_button($lang->cancel, array('onclick' => '$.modal.close();'));

			$buttons[] = $form->generate_submit_button($lang->cancel, array('onclick' => '$.modal.close(); return false;'));

			$buttons[] = $form->generate_submit_button($lang->save_permissions, array('id' => 'savePermissions'));
$form->output_submit_wrapper($buttons);
$form->end();

			$buttons[] = $form->generate_submit_button($lang->save_permissions, array('id' => 'savePermissions'));
$form->output_submit_wrapper($buttons);
$form->end();

Zeile 789Zeile 830
		{
$buttons[] = $form->generate_submit_button($lang->save_permissions);
$form->output_submit_wrapper($buttons);

		{
$buttons[] = $form->generate_submit_button($lang->save_permissions);
$form->output_submit_wrapper($buttons);


$form->end();
}
}



$form->end();
}
}


	if($mybb->input['ajax'] != 1)
{
$page->output_footer();

	if($mybb->input['ajax'] != 1)
{
$page->output_footer();

Zeile 811Zeile 852
			$errors[] = $lang->error_missing_title;
}


			$errors[] = $lang->error_missing_title;
}


		$pid = $mybb->get_input('pid', 1);

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

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

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

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

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

Zeile 832Zeile 873
				"type" => $db->escape_string($type),
"pid" => $pid,
"parentlist" => '',

				"type" => $db->escape_string($type),
"pid" => $pid,
"parentlist" => '',

				"disporder" => (int)$mybb->input['disporder'],
"active" => (int)$mybb->input['active'],
"open" => (int)$mybb->input['open'],
"allowhtml" => (int)$mybb->input['allowhtml'],
"allowmycode" => (int)$mybb->input['allowmycode'],
"allowsmilies" => (int)$mybb->input['allowsmilies'],
"allowimgcode" => (int)$mybb->input['allowimgcode'],
"allowvideocode" => (int)$mybb->input['allowvideocode'],
"allowpicons" => (int)$mybb->input['allowpicons'],
"allowtratings" => (int)$mybb->input['allowtratings'],
"usepostcounts" => (int)$mybb->input['usepostcounts'],
"usethreadcounts" => (int)$mybb->input['usethreadcounts'],
"requireprefix" => (int)$mybb->input['requireprefix'],

				"disporder" => $mybb->get_input('disporder', MyBB::INPUT_INT),
"active" => $mybb->get_input('active', MyBB::INPUT_INT),
"open" => $mybb->get_input('open', MyBB::INPUT_INT),
"allowhtml" => $mybb->get_input('allowhtml', MyBB::INPUT_INT),
"allowmycode" => $mybb->get_input('allowmycode', MyBB::INPUT_INT),
"allowsmilies" => $mybb->get_input('allowsmilies', MyBB::INPUT_INT),
"allowimgcode" => $mybb->get_input('allowimgcode', MyBB::INPUT_INT),
"allowvideocode" => $mybb->get_input('allowvideocode', MyBB::INPUT_INT),
"allowpicons" => $mybb->get_input('allowpicons', MyBB::INPUT_INT),
"allowtratings" => $mybb->get_input('allowtratings', MyBB::INPUT_INT),
"usepostcounts" => $mybb->get_input('usepostcounts', MyBB::INPUT_INT),
"usethreadcounts" => $mybb->get_input('usethreadcounts', MyBB::INPUT_INT),
"requireprefix" => $mybb->get_input('requireprefix', MyBB::INPUT_INT),

				"password" => $db->escape_string($mybb->input['password']),

				"password" => $db->escape_string($mybb->input['password']),

				"showinjump" => (int)$mybb->input['showinjump'],
"style" => (int)$mybb->input['style'],
"overridestyle" => (int)$mybb->input['overridestyle'],
"rulestype" => (int)$mybb->input['rulestype'],

				"showinjump" => $mybb->get_input('showinjump', MyBB::INPUT_INT),
"style" => $mybb->get_input('style', MyBB::INPUT_INT),
"overridestyle" => $mybb->get_input('overridestyle', MyBB::INPUT_INT),
"rulestype" => $mybb->get_input('rulestype', MyBB::INPUT_INT),

				"rulestitle" => $db->escape_string($mybb->input['rulestitle']),
"rules" => $db->escape_string($mybb->input['rules']),

				"rulestitle" => $db->escape_string($mybb->input['rulestitle']),
"rules" => $db->escape_string($mybb->input['rules']),

				"defaultdatecut" => (int)$mybb->input['defaultdatecut'],

				"defaultdatecut" => $mybb->get_input('defaultdatecut', MyBB::INPUT_INT),

				"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']),
);

 

$plugins->run_hooks("admin_forum_management_add_start");


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

			$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'];



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


Zeile 883Zeile 929
					}
}


					}
}


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

Zeile 895Zeile 941
					}
}
}

					}
}
}


$cache->update_forums();






			$canview = $permissions['canview'];
$canpostthreads = $permissions['canpostthreads'];
$canpostpolls = $permissions['canpostpolls'];
$canpostattachments = $permissions['canpostattachments'];
$canpostreplies = $permissions['canpostreplys'];
save_quick_perms($fid);

			$canview = $permissions['canview'];
$canpostthreads = $permissions['canpostthreads'];
$canpostpolls = $permissions['canpostpolls'];
$canpostattachments = $permissions['canpostattachments'];
$canpostreplies = $permissions['canpostreplys'];
save_quick_perms($fid);





			$plugins->run_hooks("admin_forum_management_add_commit");

// Log admin action

			$plugins->run_hooks("admin_forum_management_add_commit");

// Log admin action

Zeile 912Zeile 956

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


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









































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

if(empty($mybb->input['pid']))
{
$forum_data['pid'] = "-1";
}
else
{
$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($errors)
{

	if($errors)
{

		$page->output_inline_error($errors);
$forum_data = $mybb->input;
}
else
{
$forum_data['type'] = "f";
$forum_data['title'] = "";
$forum_data['description'] = "";

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

		$page->output_inline_error($errors);

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












		{

		{

			$forum_data['pid'] = $mybb->get_input('pid', 1);




			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 979Zeile 1028

$create_a_options_c = array(
'id' => 'category'


$create_a_options_c = array(
'id' => 'category'

	);

	);


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


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

Zeile 995Zeile 1044
	$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $forum_data['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->description, "", $form->generate_text_area('description', $forum_data['description'], array('id' => 'description')), 'description');
$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->title." <em>*</em>", "", $form->generate_text_box('title', $forum_data['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->description, "", $form->generate_text_area('description', $forum_data['description'], array('id' => 'description')), 'description');
$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_text_box('disporder', $forum_data['disporder'], array('id' => 'disporder')), 'disporder');

	$form_container->output_row($lang->display_order, "", $form->generate_numeric_field('disporder', $forum_data['disporder'], array('id' => 'disporder', 'min' => 0)), 'disporder');

	$form_container->end();

echo "<div id=\"additional_options_link\"><strong><a href=\"#\" onclick=\"$('#additional_options_link').toggle(); $('#additional_options').fadeToggle('fast'); return false;\">{$lang->show_additional_options}</a></strong><br /><br /></div>";

	$form_container->end();

echo "<div id=\"additional_options_link\"><strong><a href=\"#\" onclick=\"$('#additional_options_link').toggle(); $('#additional_options').fadeToggle('fast'); return false;\">{$lang->show_additional_options}</a></strong><br /><br /></div>";

Zeile 1124Zeile 1173

$form_container = new FormContainer($lang->forum_permissions);
$form_container->output_row_header($lang->permissions_group, array("class" => "align_center", 'style' => 'width: 40%'));


$form_container = new FormContainer($lang->forum_permissions);
$form_container->output_row_header($lang->permissions_group, array("class" => "align_center", 'style' => 'width: 40%'));

	$form_container->output_row_header($lang->overview_allowed_actions, array("class" => "align_center"));
$form_container->output_row_header($lang->overview_disallowed_actions, array("class" => "align_center"));

if($mybb->request_method == "post")
{
foreach($usergroups as $usergroup)
{
if(isset($mybb->input['fields_'.$usergroup['gid']]))
{
$input_permissions = $mybb->input['fields_'.$usergroup['gid']];
if(!is_array($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($usergroups as $usergroup)
{
$perms = array();
if(isset($mybb->input['default_permissions']) && $mybb->input['default_permissions'][$usergroup['gid']])
{
if(is_array($existing_permissions) && $existing_permissions[$usergroup['gid']])
{

	$form_container->output_row_header($lang->overview_allowed_actions, array("class" => "align_center"));
$form_container->output_row_header($lang->overview_disallowed_actions, array("class" => "align_center"));

if($mybb->request_method == "post")
{
foreach($usergroups as $usergroup)
{
if(isset($mybb->input['fields_'.$usergroup['gid']]))
{
$input_permissions = $mybb->input['fields_'.$usergroup['gid']];
if(!is_array($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($usergroups as $usergroup)
{
$perms = array();
if(!empty($mybb->input['default_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 1179Zeile 1228
		{
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;
}

Zeile 1187Zeile 1236
				{
$default_checked = false;
}

				{
$default_checked = false;
}


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


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

				else
{
$perms_checked[$forum_permission] = 0;

				else
{
$perms_checked[$forum_permission] = 0;

Zeile 1220Zeile 1269
			$inherited_text = $lang->custom_permission;
}


			$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 1296Zeile 1345
	$query = $db->simple_select("forums", "*", "fid='{$mybb->input['fid']}'");
$forum_data = $db->fetch_array($query);
if(!$forum_data)

	$query = $db->simple_select("forums", "*", "fid='{$mybb->input['fid']}'");
$forum_data = $db->fetch_array($query);
if(!$forum_data)

	{

	{

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

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


$fid = $mybb->get_input('fid', 1);



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


	$plugins->run_hooks("admin_forum_management_edit");

if($mybb->request_method == "post")
{
if(!trim($mybb->input['title']))

	$plugins->run_hooks("admin_forum_management_edit");

if($mybb->request_method == "post")
{
if(!trim($mybb->input['title']))

		{

		{

			$errors[] = $lang->error_missing_title;

			$errors[] = $lang->error_missing_title;

		}

$pid = $mybb->get_input('pid', 1);

		}

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


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


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

		{

		{

			$errors[] = $lang->error_forum_parent_itself;
}
else
{

			$errors[] = $lang->error_forum_parent_itself;
}
else
{

			$query = $db->simple_select("forums", "*", "pid='{$mybb->input['fid']}'");
while($child = $db->fetch_array($query))


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

			{

			{

				if($child['fid'] == $pid)
{
$errors[] = $lang->error_forum_parent_child;
break;
}

				$errors[] = $lang->error_forum_parent_child;





			}
}


			}
}


Zeile 1356Zeile 1402
			}
}


			}
}


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

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



				$pid = 0;
}
$update_array = array(

				$pid = 0;
}
$update_array = array(

Zeile 1368Zeile 1412
				"linkto" => $db->escape_string($mybb->input['linkto']),
"type" => $db->escape_string($type),
"pid" => $pid,

				"linkto" => $db->escape_string($mybb->input['linkto']),
"type" => $db->escape_string($type),
"pid" => $pid,

				"disporder" => (int)$mybb->input['disporder'],
"active" => (int)$mybb->input['active'],
"open" => (int)$mybb->input['open'],
"allowhtml" => (int)$mybb->input['allowhtml'],
"allowmycode" => (int)$mybb->input['allowmycode'],
"allowsmilies" => (int)$mybb->input['allowsmilies'],
"allowimgcode" => (int)$mybb->input['allowimgcode'],
"allowvideocode" => (int)$mybb->input['allowvideocode'],
"allowpicons" => (int)$mybb->input['allowpicons'],
"allowtratings" => (int)$mybb->input['allowtratings'],
"usepostcounts" => (int)$mybb->input['usepostcounts'],
"usethreadcounts" => (int)$mybb->input['usethreadcounts'],
"requireprefix" => (int)$mybb->input['requireprefix'],

				"disporder" => $mybb->get_input('disporder', MyBB::INPUT_INT),
"active" => $mybb->get_input('active', MyBB::INPUT_INT),
"open" => $mybb->get_input('open', MyBB::INPUT_INT),
"allowhtml" => $mybb->get_input('allowhtml', MyBB::INPUT_INT),
"allowmycode" => $mybb->get_input('allowmycode', MyBB::INPUT_INT),
"allowsmilies" => $mybb->get_input('allowsmilies', MyBB::INPUT_INT),
"allowimgcode" => $mybb->get_input('allowimgcode', MyBB::INPUT_INT),
"allowvideocode" => $mybb->get_input('allowvideocode', MyBB::INPUT_INT),
"allowpicons" => $mybb->get_input('allowpicons', MyBB::INPUT_INT),
"allowtratings" => $mybb->get_input('allowtratings', MyBB::INPUT_INT),
"usepostcounts" => $mybb->get_input('usepostcounts', MyBB::INPUT_INT),
"usethreadcounts" => $mybb->get_input('usethreadcounts', MyBB::INPUT_INT),
"requireprefix" => $mybb->get_input('requireprefix', MyBB::INPUT_INT),

				"password" => $db->escape_string($mybb->input['password']),

				"password" => $db->escape_string($mybb->input['password']),

				"showinjump" => (int)$mybb->input['showinjump'],
"style" => (int)$mybb->input['style'],
"overridestyle" => (int)$mybb->input['overridestyle'],
"rulestype" => (int)$mybb->input['rulestype'],

				"showinjump" => $mybb->get_input('showinjump', MyBB::INPUT_INT),
"style" => $mybb->get_input('style', MyBB::INPUT_INT),
"overridestyle" => $mybb->get_input('overridestyle', MyBB::INPUT_INT),
"rulestype" => $mybb->get_input('rulestype', MyBB::INPUT_INT),

				"rulestitle" => $db->escape_string($mybb->input['rulestitle']),
"rules" => $db->escape_string($mybb->input['rules']),

				"rulestitle" => $db->escape_string($mybb->input['rulestitle']),
"rules" => $db->escape_string($mybb->input['rules']),

				"defaultdatecut" => (int)$mybb->input['defaultdatecut'],

				"defaultdatecut" => $mybb->get_input('defaultdatecut', MyBB::INPUT_INT),

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

				"defaultsortby" => $db->escape_string($mybb->input['defaultsortby']),
"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}'");

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

				// 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

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

				}

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


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

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

			}

			}





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








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


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


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

Zeile 1447Zeile 1495

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

Zeile 1460Zeile 1508

$cache->update_forums();



$cache->update_forums();


			$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 1537Zeile 1600
	$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $forum_data['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->description, "", $form->generate_text_area('description', $forum_data['description'], array('id' => 'description')), 'description');
$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->title." <em>*</em>", "", $form->generate_text_box('title', $forum_data['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->description, "", $form->generate_text_area('description', $forum_data['description'], array('id' => 'description')), 'description');
$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_text_box('disporder', $forum_data['disporder'], array('id' => 'disporder')), 'disporder');

	$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->end();

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

Zeile 1713Zeile 1776
		}
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;

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

Zeile 1775Zeile 1838
		$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)

			{
$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 .= "</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 1800Zeile 1863
		$field_select = str_replace("\n", "", $field_select);

$field_select = "<script type=\"text/javascript\">

		$field_select = str_replace("\n", "", $field_select);

$field_select = "<script type=\"text/javascript\">

//<![CDATA[
document.write('".str_replace("/", "\/", $field_select)."');
//]]>
</script>\n";


//<![CDATA[
document.write('".str_replace("/", "\/", $field_select)."');
//]]>
</script>\n";


		$field_selected = array();
foreach($field_list as $forum_permission => $permission_title)

		$field_selected = array();
foreach($field_list as $forum_permission => $permission_title)

		{

		{

			$field_options[$forum_permission] = $permission_title;
if($perms_checked[$forum_permission])
{
$field_selected[] = $forum_permission;
}

			$field_options[$forum_permission] = $permission_title;
if($perms_checked[$forum_permission])
{
$field_selected[] = $forum_permission;
}

		}

		}


$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 1851Zeile 1914

if($mybb->input['action'] == "deletemod")
{


if($mybb->input['action'] == "deletemod")
{

	$modid = (int)$mybb->input['id'];
$isgroup = (int)$mybb->input['isgroup'];
$fid = $mybb->get_input('fid', 1);

	$modid = $mybb->get_input('id', MyBB::INPUT_INT);
$isgroup = $mybb->get_input('isgroup', MyBB::INPUT_INT);
$fid = $mybb->get_input('fid', MyBB::INPUT_INT);


$query = $db->simple_select("moderators", "*", "id='{$modid}' AND isgroup = '{$isgroup}' AND fid='{$fid}'");
$mod = $db->fetch_array($query);

// Does the forum not exist?


$query = $db->simple_select("moderators", "*", "id='{$modid}' AND isgroup = '{$isgroup}' AND fid='{$fid}'");
$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}");

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

	}

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

$plugins->run_hooks("admin_forum_management_deletemod");


	}

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

$plugins->run_hooks("admin_forum_management_deletemod");


	if($mybb->request_method == "post")
{
$mid = $mod['mid'];

	if($mybb->request_method == "post")
{
$mid = $mod['mid'];

Zeile 1882Zeile 1945
				SELECT m.*, g.title
FROM ".TABLE_PREFIX."moderators m
LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=m.id)

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

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

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

		}
else
{

		}
else
{

Zeile 1897Zeile 1960
		$mod = $db->fetch_array($query);

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

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

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

		$cache->update_moderators();





		$plugins->run_hooks("admin_forum_management_deletemod_commit");


		$plugins->run_hooks("admin_forum_management_deletemod_commit");


		$forum = get_forum($fid);



		$cache->update_moderators();

$forum = get_forum($fid, 1);


// Log admin action
if($isgroup)


// Log admin action
if($isgroup)

Zeile 1928Zeile 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'])
{
admin_redirect("index.php?module=forum-management");

	if($mybb->get_input('no'))
{
admin_redirect("index.php?module=forum-management");

	}

$plugins->run_hooks("admin_forum_management_delete");

	}

$plugins->run_hooks("admin_forum_management_delete");





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

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

		$fid = $mybb->get_input('fid', 1);
$forum_info = get_forum($fid);

$query = $db->simple_select("forums", "posts,unapprovedposts,threads,unapprovedthreads", "fid='{$fid}'");
$stats = $db->fetch_array($query);

// Delete the forum
$db->delete_query("forums", "fid='$fid'");

		$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
$forum = get_forum($fid, 1);











 
		$delquery = "";

		switch($db->type)

		switch($db->type)

		{

		{

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

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

		}

		}

		while($forum = $db->fetch_array($query))
{
$fids[$forum['fid']] = $fid;
$delquery .= " OR fid='{$forum['fid']}'";

		while($forum = $db->fetch_array($query))
{
$fids[$forum['fid']] = $fid;
$delquery .= " OR fid='{$forum['fid']}'";


$stats['posts'] += $forum['posts'];
$stats['unapprovedposts'] += $forum['unapprovedposts'];
$stats['threads'] += $forum['threads'];
$stats['unapprovedthreads'] += $forum['unapprovedthreads'];

 
		}


		}


 
		require_once MYBB_ROOT.'inc/class_moderation.php';
$moderation = new Moderation();

// Start pagination. Limit results to 50
$query = $db->simple_select("threads", "tid", "fid='{$fid}' {$delquery}", array("limit" => 50));

while($tid = $db->fetch_field($query, 'tid'))
{
$moderation->delete_thread($tid);
}

// Check whether all threads have been deleted
$query = $db->simple_select("threads", "tid", "fid='{$fid}' {$delquery}");

if($db->num_rows($query) > 0)
{
$page->output_header();

$form = new Form("index.php?module=forum-management", 'post');

echo $form->generate_hidden_field("fid", $fid);
echo $form->generate_hidden_field("action", "delete");
output_auto_redirect($form, $lang->confirm_proceed_deletion);

$form->end();

$page->output_footer();
exit;
}

// End pagination

// Delete the forum
$db->delete_query("forums", "fid='$fid'");

// Delete subforums

		switch($db->type)
{
case "pgsql":

		switch($db->type)
{
case "pgsql":

Zeile 1983Zeile 2073
				$db->delete_query("forums", "CONCAT(',',parentlist,',') LIKE '%,$fid,%'");
}


				$db->delete_query("forums", "CONCAT(',',parentlist,',') LIKE '%,$fid,%'");
}


		$db->delete_query("threads", "fid='{$fid}' {$delquery}");
$db->delete_query("posts", "fid='{$fid}' {$delquery}");
$db->delete_query("moderators", "fid='{$fid}' {$delquery}");
$db->delete_query("forumsubscriptions", "fid='{$fid}' {$delquery}");




		$db->delete_query('moderators', "fid='{$fid}' {$delquery}");
$db->delete_query('forumsubscriptions', "fid='{$fid}' {$delquery}");
$db->delete_query('forumpermissions', "fid='{$fid}' {$delquery}");
$db->delete_query('announcements', "fid='{$fid}' {$delquery}");
$db->delete_query('forumsread', "fid='{$fid}' {$delquery}");

$plugins->run_hooks("admin_forum_management_delete_commit");


$cache->update_forums();
$cache->update_moderators();
$cache->update_forumpermissions();


$cache->update_forums();
$cache->update_moderators();
$cache->update_forumpermissions();


$update_stats = array(
'numthreads' => "-".$stats['threads'],
'numunapprovedthreads' => "-".$stats['unapprovedthreads'],
'numposts' => "-".$stats['posts'],
'numunapprovedposts' => "-".$stats['unapprovedposts']
);
update_stats($update_stats);

$plugins->run_hooks("admin_forum_management_delete_commit");

		$cache->update_forumsdisplay();











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


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

Zeile 2021Zeile 2105
		$mybb->input['fid'] = 0;
}


		$mybb->input['fid'] = 0;
}


	$fid = $mybb->get_input('fid', 1);

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

	if($fid)
{

	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 2063Zeile 2147
				}
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 2074Zeile 2158
				}
}


				}
}


			$cache->update_forums();

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





			$plugins->run_hooks("admin_forum_management_start_permissions_commit");

			$plugins->run_hooks("admin_forum_management_start_permissions_commit");

 

$cache->update_forums();


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


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

Zeile 2092Zeile 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 2103Zeile 2202
			if(!empty($mybb->input['usergroup']))
{
$isgroup = 1;

			if(!empty($mybb->input['usergroup']))
{
$isgroup = 1;

				$gid = (int)$mybb->input['usergroup'];

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


if(!$groupscache[$gid])
{


if(!$groupscache[$gid])
{

Zeile 2120Zeile 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 2172Zeile 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();

					$cache->update_moderators();

					$plugins->run_hooks("admin_forum_management_start_moderators_commit");

 

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


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

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

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

				}

				}

			}
else
{

			}
else
{

Zeile 2204Zeile 2324
				{
$db->update_query("forums", array('disporder' => (int)$order), "fid='".(int)$update_fid."'");
}

				{
$db->update_query("forums", array('disporder' => (int)$order), "fid='".(int)$update_fid."'");
}


$cache->update_forums();

 

$plugins->run_hooks("admin_forum_management_start_disporder_commit");


$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 2261Zeile 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'));


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


	build_admincp_forums_list($form_container, $fid);

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


$submit_options = array();



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

	{
$form->end();

	{
$form->end();

	}

if($fid)

	}

if($fid)

Zeile 2339Zeile 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']];
$default_checked = true;
}

					{
$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']])

					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;

					}
}

if(!$perms)
{
$perms = $usergroup;

					$default_checked = true;
}
}
else

					$default_checked = true;
}
}
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']];
$default_checked = false;
}

				{
$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 = true;
}
else if(is_array($cached_forum_perms) && $cached_forum_perms[$forum['pid']][$usergroup['gid']])

				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;
}
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']];
$default_checked = true;

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

Zeile 2391Zeile 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] = 0;

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

					}
}
else

					}
}
else

Zeile 2410Zeile 2540
						$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

			{

			{

				$inherited_text = $lang->custom_permission;
}


				$inherited_text = $lang->custom_permission;
}


Zeile 2429Zeile 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";
foreach($perms_checked as $perm => $value)

			}
$field_select .= "</ul></div>\n";
$field_select .= "<div class=\"disabled\"><ul id=\"fields_disabled_{$usergroup['gid']}\">\n";
foreach($perms_checked as $perm => $value)

			{

			{

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

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

				}

				}

			}
$field_select .= "</ul></div></div>\n";
$field_select .= $form->generate_hidden_field("fields_".$usergroup['gid'], @implode(",", @array_keys($perms_checked, '1')), array('id' => 'fields_'.$usergroup['gid']));

			}
$field_select .= "</ul></div></div>\n";
$field_select .= $form->generate_hidden_field("fields_".$usergroup['gid'], @implode(",", @array_keys($perms_checked, '1')), array('id' => 'fields_'.$usergroup['gid']));

Zeile 2466Zeile 2596
			}

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

			}

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

			$form_container->output_cell($field_select, array('colspan' => 2));


if(!$default_checked)
{


if(!$default_checked)
{

Zeile 2515Zeile 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 2545Zeile 2675

// Usergroup Moderator
if(!is_array($usergroups))


// Usergroup Moderator
if(!is_array($usergroups))

		{

		{

			$usergroups = $groupscache;
}

foreach($usergroups as $group)
{

			$usergroups = $groupscache;
}

foreach($usergroups as $group)
{

			$modgroups[$group['gid']] = $lang->usergroup." ".$group['gid'].": ".$group['title'];

			$modgroups[$group['gid']] = $lang->usergroup." ".$group['gid'].": ".htmlspecialchars_uni($group['title']);

		}

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

		}

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

Zeile 2577Zeile 2707
		echo $form->generate_hidden_field("fid", $mybb->input['fid']);
echo $form->generate_hidden_field("add", "moderators");
$form_container = new FormContainer($lang->add_user_as_moderator);

		echo $form->generate_hidden_field("fid", $mybb->input['fid']);
echo $form->generate_hidden_field("add", "moderators");
$form_container = new FormContainer($lang->add_user_as_moderator);

		$form_container->output_row($lang->username." <em>*</em>", $lang->moderator_username_desc, $form->generate_text_box('username', $mybb->input['username'], array('id' => 'username')), 'username');

		$form_container->output_row($lang->username." <em>*</em>", $lang->moderator_username_desc, $form->generate_text_box('username', htmlspecialchars_uni($mybb->get_input('username')), array('id' => 'username')), 'username');

		$form_container->end();

// Autocompletion for usernames
echo '
<link rel="stylesheet" href="../jscripts/select2/select2.css">

		$form_container->end();

// Autocompletion for usernames
echo '
<link rel="stylesheet" href="../jscripts/select2/select2.css">

		<script type="text/javascript" src="../jscripts/select2/select2.min.js"></script>

		<script type="text/javascript" src="../jscripts/select2/select2.min.js?ver=1804"></script>

		<script type="text/javascript">
<!--
$("#username").select2({

		<script type="text/javascript">
<!--
$("#username").select2({

			placeholder: "Search for a user",
minimumInputLength: 3,
maximumSelectionSize: 3,

			placeholder: "'.$lang->search_for_a_user.'",
minimumInputLength: 2,


			multiple: false,
ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
url: "../xmlhttp.php?action=get_users",

			multiple: false,
ajax: { // instead of writing the function to execute the request we use Select2\'s convenient helper
url: "../xmlhttp.php?action=get_users",

Zeile 2615Zeile 2744
					}).done(function(data) { callback(data); });
}
},

					}).done(function(data) { callback(data); });
}
},

 
		});

$(\'[for=username]\').on(\'click\', function(){
$("#username").select2(\'open\');
return false;

		});
// -->
</script>';

		});
// -->
</script>';





		$buttons = array($form->generate_submit_button($lang->add_user_moderator));
$form->output_submit_wrapper($buttons);
$form->end();

		$buttons = array($form->generate_submit_button($lang->add_user_moderator));
$form->output_submit_wrapper($buttons);
$form->end();

Zeile 2626Zeile 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 int $pid
* @param int $depth

 */

 */

function build_admincp_forums_list(&$form_container, $pid=0, $depth=1)

function build_admincp_forums_list(&$form_container, &$form, $pid=0, $depth=1)

{
global $mybb, $lang, $db, $sub_forums;
static $forums_by_parent;

{
global $mybb, $lang, $db, $sub_forums;
static $forums_by_parent;

Zeile 2649Zeile 2786
		}
}


		}
}


	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 2661Zeile 2800
			$forum['name'] = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $forum['name']); // Fix & but allow unicode

if($forum['active'] == 0)

			$forum['name'] = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $forum['name']); // Fix & but allow unicode

if($forum['active'] == 0)

			{

			{

				$forum['name'] = "<em>".$forum['name']."</em>";
}

if($forum['type'] == "c" && ($depth == 1 || $depth == 2))

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

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

				{

				{

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

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

				}
if($sub_forums)

				}
if($sub_forums)

				{

				{

					$sub_forums = "<br /><small>{$lang->sub_forums}: {$sub_forums}</small>";
}

$form_container->output_cell("<div style=\"padding-left: ".(40*($depth-1))."px;\"><a href=\"index.php?module=forum-management&amp;fid={$forum['fid']}\"><strong>{$forum['name']}</strong></a>{$sub_forums}</div>");


					$sub_forums = "<br /><small>{$lang->sub_forums}: {$sub_forums}</small>";
}

$form_container->output_cell("<div style=\"padding-left: ".(40*($depth-1))."px;\"><a href=\"index.php?module=forum-management&amp;fid={$forum['fid']}\"><strong>{$forum['name']}</strong></a>{$sub_forums}</div>");


				$form_container->output_cell("<input type=\"text\" name=\"disporder[".$forum['fid']."]\" value=\"".$forum['disporder']."\" class=\"text_input align_center\" style=\"width: 80%; font-weight: bold;\" />", array("class" => "align_center"));

				$form_container->output_cell($form->generate_numeric_field("disporder[{$forum['fid']}]", "{$forum['disporder']}", array('min' => 0, 'class' => 'align_center', 'style' => 'width:80%; font-weight:bold')), array("class" => "align_center"));


$popup = new PopupMenu("forum_{$forum['fid']}", $lang->options);
$popup->add_item($lang->edit_forum, "index.php?module=forum-management&amp;action=edit&amp;fid={$forum['fid']}");
$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 = new PopupMenu("forum_{$forum['fid']}", $lang->options);
$popup->add_item($lang->edit_forum, "index.php?module=forum-management&amp;action=edit&amp;fid={$forum['fid']}");
$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 2695Zeile 2835
				$form_container->construct_row();

// Does this category have any sub forums?

				$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, $forum['fid'], $depth+1);

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

				}
}
elseif($forum['type'] == "f" && ($depth == 1 || $depth == 2))

				}
}
elseif($forum['type'] == "f" && ($depth == 1 || $depth == 2))

Zeile 2705Zeile 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)
{

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

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

				}
if($sub_forums)
{

				}
if($sub_forums)
{

Zeile 2720Zeile 2860

$form_container->output_cell("<div style=\"padding-left: ".(40*($depth-1))."px;\"><a href=\"index.php?module=forum-management&amp;fid={$forum['fid']}\">{$forum['name']}</a>{$forum['description']}{$sub_forums}</div>");



$form_container->output_cell("<div style=\"padding-left: ".(40*($depth-1))."px;\"><a href=\"index.php?module=forum-management&amp;fid={$forum['fid']}\">{$forum['name']}</a>{$forum['description']}{$sub_forums}</div>");


				$form_container->output_cell("<input type=\"text\" name=\"disporder[".$forum['fid']."]\" value=\"".$forum['disporder']."\" class=\"text_input align_center\" style=\"width: 80%;\" />", array("class" => "align_center"));


				$form_container->output_cell($form->generate_numeric_field("disporder[{$forum['fid']}]", "{$forum['disporder']}", array('min' => 0, 'class' => 'align_center', 'style' => 'width:80%')), array("class" => "align_center"));


				$popup = new PopupMenu("forum_{$forum['fid']}", $lang->options);
$popup->add_item($lang->edit_forum, "index.php?module=forum-management&amp;action=edit&amp;fid={$forum['fid']}");
$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 = new PopupMenu("forum_{$forum['fid']}", $lang->options);
$popup->add_item($lang->edit_forum, "index.php?module=forum-management&amp;action=edit&amp;fid={$forum['fid']}");
$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 2737Zeile 2877

if(isset($forums_by_parent[$forum['fid']]) && $depth == 1)
{


if(isset($forums_by_parent[$forum['fid']]) && $depth == 1)
{

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

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

				}
}
else if($depth == 3)

				}
}
else if($depth == 3)

Zeile 2763Zeile 2903
	}
}


	}
}


 
/**
* @param int $gid
* @param int $fid
*
* @return string
*/

function retrieve_single_permissions_row($gid, $fid)
{
global $mybb, $lang, $cache, $db;

function retrieve_single_permissions_row($gid, $fid)
{
global $mybb, $lang, $cache, $db;





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


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


Zeile 2788Zeile 2934
	);

$field_list2 = array(

	);

$field_list2 = array(

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

		'canview' => $lang->perm_drag_canview,
'canpostthreads' => $lang->perm_drag_canpostthreads,
'canpostreplys' => $lang->perm_drag_canpostreplys,
'canpostpolls' => $lang->perm_drag_canpostpolls,

	);

$form = new Form('', '', "", 0, "", true);

	);

$form = new Form('', '', "", 0, "", true);

Zeile 2847Zeile 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 2856Zeile 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)