Vergleich admin/modules/forum/management.php - 1.8.1 - 1.8.26

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









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


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

// Generate parent list

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

// Generate parent list

Zeile 120Zeile 127
			$query = $db->simple_select("forums", '*', "fid='{$to}'");
$to_forum = $db->fetch_array($query);
if(!$db->num_rows($query))

			$query = $db->simple_select("forums", '*', "fid='{$to}'");
$to_forum = $db->fetch_array($query);
if(!$db->num_rows($query))

			{

			{

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


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


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

Zeile 142Zeile 152
		if(!$errors)
{
// Copy permissions

		if(!$errors)
{
// Copy permissions

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

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

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

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

Zeile 183Zeile 193
	$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);


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

		$copy_data = $mybb->input;
}
else

		$copy_data = $mybb->input;
}
else

Zeile 196Zeile 206
		$copy_data['description'] = "";

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

		$copy_data['description'] = "";

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

		{

		{

			$copy_data['pid'] = "-1";
}
else
{

			$copy_data['pid'] = "-1";
}
else
{

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

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

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

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

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

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

	);


	);


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

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

	);


	);


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

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

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

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

	}
else

	}
else

	{
$create_a_options_c['checked'] = true;

	{
$create_a_options_c['checked'] = true;

	}

$usergroups = array();

	}

$usergroups = array();


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

Zeile 252Zeile 262
	$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $copy_data['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->description, "", $form->generate_text_area('description', $copy_data['description'], array('id' => 'description')), 'description');
$form_container->output_row($lang->parent_forum." <em>*</em>", $lang->parent_forum_desc, $form->generate_forum_select('pid', $copy_data['pid'], array('id' => 'pid', 'main_option' => $lang->none)), 'pid');

	$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $copy_data['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->description, "", $form->generate_text_area('description', $copy_data['description'], array('id' => 'description')), 'description');
$form_container->output_row($lang->parent_forum." <em>*</em>", $lang->parent_forum_desc, $form->generate_forum_select('pid', $copy_data['pid'], array('id' => 'pid', 'main_option' => $lang->none)), 'pid');





	$form_container->end();

$buttons[] = $form->generate_submit_button($lang->copy_forum);

	$form_container->end();

$buttons[] = $form->generate_submit_button($lang->copy_forum);

Zeile 264Zeile 274

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

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

if(!$mod_data['id'])

	{

	{

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

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

	}

$plugins->run_hooks("admin_forum_management_editmod");

	}

$plugins->run_hooks("admin_forum_management_editmod");


if($mod_data['isgroup'])
{
$fieldname = "title";


if($mod_data['isgroup'])
{
$fieldname = "title";

	}

	}

	else
{
$fieldname = "username";
}

	else
{
$fieldname = "username";
}





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

	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 295Zeile 305

if(!$errors)
{


if(!$errors)
{

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

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

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

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

			}

			}

			else
{
$mod = get_user($mod_data['id']);
}
$update_array = array(
'fid' => (int)$fid,

			else
{
$mod = get_user($mod_data['id']);
}
$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)

			);

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


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

			$cache->update_moderators();

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





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

			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 374Zeile 384
	echo $form->generate_hidden_field("mid", $mod_data['mid']);

if($errors)

	echo $form->generate_hidden_field("mid", $mod_data['mid']);

if($errors)

	{

	{

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

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

Zeile 414Zeile 424
	$form_container->output_row($lang->moderator_cp_permissions, $lang->moderator_cp_permissions_desc, "<div class=\"forum_settings_bit\">".implode("</div><div class=\"forum_settings_bit\">", $moderator_cp_permissions)."</div>");

$form_container->end();

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

$form_container->end();





	$buttons[] = $form->generate_submit_button($lang->save_mod);
$form->output_submit_wrapper($buttons);
$form->end();

	$buttons[] = $form->generate_submit_button($lang->save_mod);
$form->output_submit_wrapper($buttons);
$form->end();





	$page->output_footer();
}

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

	$page->output_footer();
}

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
if($mybb->input['no'])


// User clicked no
if($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((!$fid || !$gid) && $pid)

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

		{

		{

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

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

		}

		}


if($pid)
{


if($pid)
{

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

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

		}

$cache->update_forumpermissions();




		}

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

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

Zeile 472Zeile 484

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

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

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

		$forum = get_forum($fid);

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

Zeile 521Zeile 533
		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);
}


Zeile 565Zeile 577
		}
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 588Zeile 600
		<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();


Zeile 619Zeile 631
		if($mybb->input['ajax'] != 1)
{
$form = new Form("index.php?module=forum-management&amp;action=permissions", "post");

		if($mybb->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&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");
}

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

if($errors)

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

if($errors)

Zeile 639Zeile 651
		}
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 717Zeile 729
			'candeleteposts' => 'editing',
'candeletethreads' => 'editing',
'caneditattachments' => 'editing',

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

 
			'canviewdeletionnotice' => 'editing',


'modposts' => 'moderate',
'modthreads' => 'moderate',


'modposts' => 'moderate',
'modthreads' => 'moderate',

Zeile 744Zeile 757
		else
{
$page->output_tab_control($tabs);

		else
{
$page->output_tab_control($tabs);

		}


		}


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

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

Zeile 755Zeile 768
				if(array_key_exists($field['Field'], $groups))
{
$field_list[$groups[$field['Field']]][] = $field['Field'];

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

				}

				}

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

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

			}

			}

		}

foreach(array_unique(array_values($groups)) as $group)

		}

foreach(array_unique(array_values($groups)) as $group)

Zeile 783Zeile 796
		{
$buttons[] = $form->generate_submit_button($lang->cancel, array('onclick' => '$.modal.close(); return false;'));
$buttons[] = $form->generate_submit_button($lang->save_permissions, array('id' => 'savePermissions'));

		{
$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();
echo "</div>";

			$form->output_submit_wrapper($buttons);
$form->end();
echo "</div>";

			echo "</div>";
}
else

			echo "</div>";
}
else

		{

		{

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


Zeile 806Zeile 819
if($mybb->input['action'] == "add")
{
$plugins->run_hooks("admin_forum_management_add");

if($mybb->input['action'] == "add")
{
$plugins->run_hooks("admin_forum_management_add");





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

	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);
$type = $mybb->input['type'];


		}

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


		if($pid <= 0 && $type == "f")
{
$errors[] = $lang->error_no_parent;

		if($pid <= 0 && $type == "f")
{
$errors[] = $lang->error_no_parent;

		}


		}


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

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

Zeile 835Zeile 848
				"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);

$parentlist = make_parent_list($fid);

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

$parentlist = make_parent_list($fid);

Zeile 912Zeile 928

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


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





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

Zeile 943Zeile 959
		}
else
{

		}
else
{

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

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

		}
$forum_data['disporder'] = "1";
$forum_data['linkto'] = "";

		}
$forum_data['disporder'] = "1";
$forum_data['linkto'] = "";

Zeile 989Zeile 1005
		$create_a_options_f['checked'] = true;
}
else

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

	{

	{

		$create_a_options_c['checked'] = true;
}


		$create_a_options_c['checked'] = true;
}


Zeile 998Zeile 1014
	$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_numeric_field('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 1013Zeile 1029
	);

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

	);

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





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

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

	);


	);


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

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

Zeile 1027Zeile 1043
	$style_options = array(
$form->generate_check_box('overridestyle', 1, $lang->override_user_style, array('checked' => $forum_data['overridestyle'], 'id' => 'overridestyle')),
$lang->forum_specific_style."<br />\n".$form->generate_select_box('style', $styles, $forum_data['style'], array('id' => 'style'))

	$style_options = array(
$form->generate_check_box('overridestyle', 1, $lang->override_user_style, array('checked' => $forum_data['overridestyle'], 'id' => 'overridestyle')),
$lang->forum_specific_style."<br />\n".$form->generate_select_box('style', $styles, $forum_data['style'], array('id' => 'style'))

	);

	);


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



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


Zeile 1103Zeile 1119
	echo "</div>";

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

	echo "</div>";

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

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

$cached_forum_perms = $cache->read("forumpermissions");
$field_list = array(
'canview' => $lang->permissions_canview,
'canpostthreads' => $lang->permissions_canpostthreads,
'canpostreplys' => $lang->permissions_canpostreplys,
'canpostpolls' => $lang->permissions_canpostpolls,
);

$field_list2 = array(
'canview' => $lang->perm_drag_canview,
'canpostthreads' => $lang->perm_drag_canpostthreads,
'canpostreplys' => $lang->perm_drag_canpostreplys,
'canpostpolls' => $lang->perm_drag_canpostpolls,
);

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

$cached_forum_perms = $cache->read("forumpermissions");
$field_list = array(
'canview' => $lang->permissions_canview,
'canpostthreads' => $lang->permissions_canpostthreads,
'canpostreplys' => $lang->permissions_canpostreplys,
'canpostpolls' => $lang->permissions_canpostpolls,
);

$field_list2 = array(
'canview' => $lang->perm_drag_canview,
'canpostthreads' => $lang->perm_drag_canpostthreads,
'canpostreplys' => $lang->perm_drag_canpostreplys,
'canpostpolls' => $lang->perm_drag_canpostpolls,
);


$ids = array();



$ids = array();


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

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

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

		foreach($usergroups as $usergroup)
{
if(isset($mybb->input['fields_'.$usergroup['gid']]))

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

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

				}

				}

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

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

			}

			}

		}
}


		}
}


Zeile 1161Zeile 1177
				$default_checked = false;
}
elseif(is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['fid']][$usergroup['gid']])

				$default_checked = false;
}
elseif(is_array($cached_forum_perms) && $cached_forum_perms[$forum_data['fid']][$usergroup['gid']])

			{

			{

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

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

			{

			{

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

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

			}
}


			}
}


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

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

Zeile 1185Zeile 1201
				if($mybb->input['default_permissions'][$usergroup['gid']])
{
$default_checked = true;

				if($mybb->input['default_permissions'][$usergroup['gid']])
{
$default_checked = true;

				}
else

				}
else

				{
$default_checked = false;
}

				{
$default_checked = false;
}

Zeile 1201Zeile 1217
				}
}
else

				}
}
else

			{

			{

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

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

Zeile 1280Zeile 1296
	// Write in our JS based field selector
echo "<script type=\"text/javascript\">\n<!--\n";
foreach($ids as $id)

	// Write in our JS based field selector
echo "<script type=\"text/javascript\">\n<!--\n";
foreach($ids as $id)

	{

	{

		echo "$(function() { QuickPermEditor.init(".$id.") });\n";
}
echo "// -->\n</script>\n";

		echo "$(function() { QuickPermEditor.init(".$id.") });\n";
}
echo "// -->\n</script>\n";

Zeile 1291Zeile 1307
if($mybb->input['action'] == "edit")
{
if(!$mybb->input['fid'])

if($mybb->input['action'] == "edit")
{
if(!$mybb->input['fid'])

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


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

Zeile 1304Zeile 1320
		admin_redirect("index.php?module=forum-management");
}


		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'])
{
$errors[] = $lang->error_forum_parent_itself;
}
else


if($pid == $mybb->input['fid'])
{
$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 1371Zeile 1384
				"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']),
);

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

Zeile 1424Zeile 1437
			{
// Make sure we're only skipping inputs that don't start with "fields_" and aren't fields_default_ or fields_inherit_
if(strpos($id, 'fields_') === false || (strpos($id, 'fields_default_') !== false || strpos($id, 'fields_inherit_') !== false))

			{
// Make sure we're only skipping inputs that don't start with "fields_" and aren't fields_default_ or fields_inherit_
if(strpos($id, 'fields_') === false || (strpos($id, 'fields_default_') !== false || strpos($id, 'fields_inherit_') !== false))

				{
continue;
}


				{
continue;
}


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

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

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

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

				}

				}

				$inherit[$gid] = 0;

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

				$inherit[$gid] = 0;

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

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

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

					}
}


					}
}


				foreach(array('canview','canpostthreads','canpostreplys','canpostpolls') as $name)
{
if(in_array($name, $permission) || $permission[$name])

				foreach(array('canview','canpostthreads','canpostreplys','canpostpolls') as $name)
{
if(in_array($name, $permission) || $permission[$name])

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

$cache->update_forums();

$canview = $permissions['canview'];

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

$cache->update_forums();

$canview = $permissions['canview'];

			$canpostthreads = $permissions['canpostthreads'];
$canpostpolls = $permissions['canpostpolls'];
$canpostattachments = $permissions['canpostattachments'];

			$canpostthreads = $permissions['canpostthreads'];
$canpostpolls = $permissions['canpostpolls'];
$canpostattachments = $permissions['canpostattachments'];

Zeile 1540Zeile 1553
	$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_numeric_field('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 1854Zeile 1867

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


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

Zeile 1948Zeile 1961

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


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

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

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

		$forum_info = get_forum($fid);


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


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

 
		}

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





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


		// Delete subforums






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

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

Zeile 1987Zeile 2026
				$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}");

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

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


$plugins->run_hooks("admin_forum_management_delete_commit");

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

 
		$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 2023Zeile 2056
	if(!isset($mybb->input['fid']))
{
$mybb->input['fid'] = 0;

	if(!isset($mybb->input['fid']))
{
$mybb->input['fid'] = 0;

	}

	}





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

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

	if($fid)
{
$forum = get_forum($fid);
}

	if($fid)
{
$forum = get_forum($fid);
}





	$plugins->run_hooks("admin_forum_management_start");

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

	$plugins->run_hooks("admin_forum_management_start");

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

Zeile 2042Zeile 2075
			{
// Make sure we're only skipping inputs that don't start with "fields_" and aren't fields_default_ or fields_inherit_
if(strpos($id, 'fields_') === false || (strpos($id, 'fields_default_') !== false || strpos($id, 'fields_inherit_') !== false))

			{
// Make sure we're only skipping inputs that don't start with "fields_" and aren't fields_default_ or fields_inherit_
if(strpos($id, 'fields_') === false || (strpos($id, 'fields_default_') !== false || strpos($id, 'fields_inherit_') !== false))

				{
continue;

				{
continue;

				}

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

				}

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

Zeile 2100Zeile 2133
		{
$forum = get_forum($fid);
if(!$forum)

		{
$forum = get_forum($fid);
if(!$forum)

			{

			{

				flash_message($lang->error_invalid_forum, 'error');
admin_redirect("index.php?module=forum-management&fid={$fid}#tab_moderators");
}
if(!empty($mybb->input['usergroup']))
{
$isgroup = 1;

				flash_message($lang->error_invalid_forum, 'error');
admin_redirect("index.php?module=forum-management&fid={$fid}#tab_moderators");
}
if(!empty($mybb->input['usergroup']))
{
$isgroup = 1;

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


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


				if(!$groupscache[$gid])
{
// Didn't select a valid moderator

				if(!$groupscache[$gid])
{
// Didn't select a valid moderator

Zeile 2119Zeile 2152
				$newmod = array(
"id" => $gid,
"name" => $groupscache[$gid]['title']

				$newmod = array(
"id" => $gid,
"name" => $groupscache[$gid]['title']

				);

				);

			}
else
{

			}
else
{

Zeile 2266Zeile 2299
		$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();


Zeile 2556Zeile 2589

foreach($usergroups as $group)
{


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 2582Zeile 2615
		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 2620Zeile 2652
					}).done(function(data) { callback(data); });
}
},

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

 
		});

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

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

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

Zeile 2632Zeile 2669

$plugins->run_hooks("admin_forum_management_start_graph");
}


$plugins->run_hooks("admin_forum_management_start_graph");
}





	$page->output_footer();

	$page->output_footer();

}

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




}

/**
* @param DefaultFormContainer $form_container
* @param DefaultForm $form
* @param int $pid
* @param int $depth
*/
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 2671Zeile 2711
			}

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

			}

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

			{
$sub_forums = '';
if(isset($forums_by_parent[$forum['fid']]) && $depth == 2)
{
build_admincp_forums_list($form_container, $forum['fid'], $depth+1);
}
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>");

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

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


			{
$sub_forums = '';
if(isset($forums_by_parent[$forum['fid']]) && $depth == 2)
{
build_admincp_forums_list($form_container, $form, $forum['fid'], $depth+1);
}
if($sub_forums)
{
$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($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->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}')");


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


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





				$form_container->construct_row();

// Does this category have any sub forums?
if($forums_by_parent[$forum['fid']])
{

				$form_container->construct_row();

// Does this category have any sub forums?
if($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 2712Zeile 2753
					$forum['description'] = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $forum['description']);
$forum['description'] = "<br /><small>".$forum['description']."</small>";
}

					$forum['description'] = preg_replace("#&(?!\#[0-9]+;)#si", "&amp;", $forum['description']);
$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 2725Zeile 2766

$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 2742Zeile 2783

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 2768Zeile 2809
	}
}


	}
}


 
/**
* @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;