Vergleich admin/modules/forum/management.php - 1.8.6 - 1.8.25

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

if(!$errors)
{


if(!$errors)
{

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

				$new_forum = $from_forum;
unset($new_forum['fid'], $new_forum['threads'], $new_forum['posts'], $new_forum['lastpost'], $new_forum['lastposter'], $new_forum['lastposteruid'], $new_forum['lastposttid'], $new_forum['lastpostsubject'], $new_forum['unapprovedthreads'], $new_forum['unapprovedposts']);
$new_forum['name'] = $db->escape_string($mybb->input['title']);

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

Zeile 142Zeile 146
		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 252Zeile 256
	$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();



$form_container->end();


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

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

Zeile 335Zeile 339
			$plugins->run_hooks("admin_forum_management_editmod_commit");

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

			$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

			$cache->update_moderators();

// Log admin action

Zeile 416Zeile 420
	$form_container->end();

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

	$form_container->end();

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

	$form->output_submit_wrapper($buttons);
$form->end();

$page->output_footer();
}

	$form->output_submit_wrapper($buttons);
$form->end();

$page->output_footer();
}


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


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

Zeile 456Zeile 460
		}

$plugins->run_hooks('admin_forum_management_clear_permission_commit');

		}

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

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

Zeile 543Zeile 547
		{
echo json_encode("<script type=\"text/javascript\">$('#row_{$gid}').html('".str_replace(array("'", "\t", "\n"), array("\\'", "", ""), retrieve_single_permissions_row($gid, $fid))."'); QuickPermEditor.init({$gid});</script>");
die;

		{
echo json_encode("<script type=\"text/javascript\">$('#row_{$gid}').html('".str_replace(array("'", "\t", "\n"), array("\\'", "", ""), retrieve_single_permissions_row($gid, $fid))."'); QuickPermEditor.init({$gid});</script>");
die;

		}

		}

		else
{
flash_message($lang->success_forum_permissions_saved, 'success');

		else
{
flash_message($lang->success_forum_permissions_saved, 'success');

Zeile 590Zeile 594
		<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 625Zeile 629
		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");

		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 719Zeile 723
			'candeleteposts' => 'editing',
'candeletethreads' => 'editing',
'caneditattachments' => 'editing',

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

 
			'canviewdeletionnotice' => 'editing',


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


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

Zeile 746Zeile 751
		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)

		{

		{

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

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

				{

				{

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

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

			}

			}

		}

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

		}

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

Zeile 778Zeile 783
			}
$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();

			echo "</div>";
}


			echo "</div>";
}


		if($mybb->input['ajax'] == 1)
{
$buttons[] = $form->generate_submit_button($lang->cancel, array('onclick' => '$.modal.close(); return false;'));
$buttons[] = $form->generate_submit_button($lang->save_permissions, array('id' => 'savePermissions'));

		if($mybb->input['ajax'] == 1)
{
$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->output_submit_wrapper($buttons);

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

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

			echo "</div>";
}

			echo "</div>";
}

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

		else
{
$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 814Zeile 819
		if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_missing_title;

		if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_missing_title;

		}


		}


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


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


Zeile 861Zeile 866
				"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 871Zeile 879
			foreach($mybb->input as $id => $permission)
{
if(strpos($id, 'fields_') === false)

			foreach($mybb->input as $id => $permission)
{
if(strpos($id, 'fields_') === false)

				{

				{

					continue;
}

					continue;
}





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

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

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

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

Zeile 883Zeile 891
					$permission = explode(',', $permission);
$permission = array_flip($permission);
foreach($permission as $name => $value)

					$permission = explode(',', $permission);
$permission = array_flip($permission);
foreach($permission as $name => $value)

					{

					{

						$permission[$name] = 1;

						$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] = 1;
}
else

Zeile 917Zeile 925

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


Zeile 1024Zeile 1032
	while($style = $db->fetch_array($query))
{
$styles[$style['tid']] = htmlspecialchars_uni($style['name']);

	while($style = $db->fetch_array($query))
{
$styles[$style['tid']] = htmlspecialchars_uni($style['name']);

	}

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

$display_methods = array(
'0' => $lang->dont_display_rules,
'1' => $lang->display_rules_inline,
'3' => $lang->display_rules_inline_new,
'2' => $lang->display_rules_link
);

$forum_rules = array(
$lang->display_method."<br />\n".$form->generate_select_box('rulestype', $display_methods, $forum_data['rulestype'], array('checked' => $forum_data['rulestype'], 'id' => 'rulestype')),
$lang->title."<br />\n".$form->generate_text_box('rulestitle', $forum_data['rulestitle'], array('checked' => $forum_data['rulestitle'], 'id' => 'rulestitle')),
$lang->rules."<br />\n".$form->generate_text_area('rules', $forum_data['rules'], array('checked' => $forum_data['rules'], 'id' => 'rules'))
);

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

$default_date_cut = array(
0 => $lang->board_default,
1 => $lang->datelimit_1day,
5 => $lang->datelimit_5days,
10 => $lang->datelimit_10days,
20 => $lang->datelimit_20days,
50 => $lang->datelimit_50days,
75 => $lang->datelimit_75days,
100 => $lang->datelimit_100days,
365 => $lang->datelimit_lastyear,
9999 => $lang->datelimit_beginning,
);

$default_sort_by = array(
"" => $lang->board_default,
"subject" => $lang->sort_by_subject,
"lastpost" => $lang->sort_by_lastpost,
"starter" => $lang->sort_by_starter,
"started" => $lang->sort_by_started,
"rating" => $lang->sort_by_rating,
"replies" => $lang->sort_by_replies,
"views" => $lang->sort_by_views,
);

$default_sort_order = array(
"" => $lang->board_default,

	}

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

$display_methods = array(
'0' => $lang->dont_display_rules,
'1' => $lang->display_rules_inline,
'3' => $lang->display_rules_inline_new,
'2' => $lang->display_rules_link
);

$forum_rules = array(
$lang->display_method."<br />\n".$form->generate_select_box('rulestype', $display_methods, $forum_data['rulestype'], array('checked' => $forum_data['rulestype'], 'id' => 'rulestype')),
$lang->title."<br />\n".$form->generate_text_box('rulestitle', $forum_data['rulestitle'], array('checked' => $forum_data['rulestitle'], 'id' => 'rulestitle')),
$lang->rules."<br />\n".$form->generate_text_area('rules', $forum_data['rules'], array('checked' => $forum_data['rules'], 'id' => 'rules'))
);

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

$default_date_cut = array(
0 => $lang->board_default,
1 => $lang->datelimit_1day,
5 => $lang->datelimit_5days,
10 => $lang->datelimit_10days,
20 => $lang->datelimit_20days,
50 => $lang->datelimit_50days,
75 => $lang->datelimit_75days,
100 => $lang->datelimit_100days,
365 => $lang->datelimit_lastyear,
9999 => $lang->datelimit_beginning,
);

$default_sort_by = array(
"" => $lang->board_default,
"subject" => $lang->sort_by_subject,
"lastpost" => $lang->sort_by_lastpost,
"starter" => $lang->sort_by_starter,
"started" => $lang->sort_by_started,
"rating" => $lang->sort_by_rating,
"replies" => $lang->sort_by_replies,
"views" => $lang->sort_by_views,
);

$default_sort_order = array(
"" => $lang->board_default,

		"asc" => $lang->sort_order_asc,
"desc" => $lang->sort_order_desc,
);

		"asc" => $lang->sort_order_asc,
"desc" => $lang->sort_order_desc,
);

Zeile 1194Zeile 1202
				}

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

				}

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

				{
$perms_checked[$forum_permission] = 1;
}

				{
$perms_checked[$forum_permission] = 1;
}

				else
{
$perms_checked[$forum_permission] = 0;

				else
{
$perms_checked[$forum_permission] = 0;

Zeile 1315Zeile 1323
		if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_missing_title;

		if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_missing_title;

		}

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


		}

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


		if($pid == $mybb->input['fid'])
{
$errors[] = $lang->error_forum_parent_itself;

		if($pid == $mybb->input['fid'])
{
$errors[] = $lang->error_forum_parent_itself;

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

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





				// Rebuild the parentlist of all of the subforums of this forum
switch($db->type)
{

				// Rebuild the parentlist of all of the subforums of this forum
switch($db->type)
{

Zeile 1950Zeile 1958
		$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
$forum_info = get_forum($fid);


		$fid = $mybb->get_input('fid', MyBB::INPUT_INT);
$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)
{
case "pgsql":

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

Zeile 1964Zeile 1967
				break;
default:
$query = $db->simple_select("forums", "*", "CONCAT(',', parentlist, ',') LIKE '%,$fid,%'");

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

		}

		}

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

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

		{

		{

			$fids[$forum['fid']] = $fid;
$delquery .= " OR fid='{$forum['fid']}'";

			$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 1986Zeile 2020
				$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("forumpermissions", "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");


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




		$cache->update_forumsdisplay();


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

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

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

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

	}

	}

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

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





if(!$mybb->input['action'])
{
if(!isset($mybb->input['fid']))

if(!$mybb->input['action'])
{
if(!isset($mybb->input['fid']))

	{

	{

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


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


Zeile 2030Zeile 2057
	{
$forum = get_forum($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 2069
			{
// 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 2068Zeile 2095
				foreach(array('canview','canpostthreads','canpostreplys','canpostpolls') as $name)
{
if($permission[$name])

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

					{

					{

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

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

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

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

	}

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


	}

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


	if($fid)
{
$page->output_nav_tabs($sub_tabs, 'view_forum');

	if($fid)
{
$page->output_nav_tabs($sub_tabs, 'view_forum');

	}
else
{

	}
else
{

		$page->output_nav_tabs($sub_tabs, 'forum_management');
}

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

		$page->output_nav_tabs($sub_tabs, 'forum_management');
}

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

	echo $form->generate_hidden_field("fid", $mybb->input['fid']);

	echo $form->generate_hidden_field("fid", $mybb->input['fid']);


if($fid)
{


if($fid)
{

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

if($form_container->num_rows() == 0)

	$submit_options = array();

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

		$form_container->output_cell($lang->no_forums, array('colspan' => 3));
$form_container->construct_row();
$submit_options = array('disabled' => 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);


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

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

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

		);

		);


$field_list2 = array(
'canview' => $lang->perm_drag_canview,


$field_list2 = array(
'canview' => $lang->perm_drag_canview,

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

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

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

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

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

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

				{

				{

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

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

Zeile 2414Zeile 2441
					{
$perms_checked[$forum_permission] = 0;
}

					{
$perms_checked[$forum_permission] = 0;
}

				}

				}

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

if($default_checked == 1)

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

if($default_checked == 1)

			{

			{

				$inherited_text = $lang->inherited_permission;
}
else

				$inherited_text = $lang->inherited_permission;
}
else

Zeile 2434Zeile 2461
			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)
{
if($value == 0)

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

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

Zeile 2453Zeile 2480
			$field_select .= $form->generate_hidden_field("fields_default_".$usergroup['gid'], @implode(",", @array_keys($perms_checked, '1')), array('id' => 'fields_default_'.$usergroup['gid']));
$field_select = str_replace("'", "\\'", $field_select);
$field_select = str_replace("\n", "", $field_select);

			$field_select .= $form->generate_hidden_field("fields_default_".$usergroup['gid'], @implode(",", @array_keys($perms_checked, '1')), array('id' => 'fields_default_'.$usergroup['gid']));
$field_select = str_replace("'", "\\'", $field_select);
$field_select = str_replace("\n", "", $field_select);





			$field_select = "<script type=\"text/javascript\">
//<![CDATA[
document.write('".str_replace("/", "\/", $field_select)."');

			$field_select = "<script type=\"text/javascript\">
//<![CDATA[
document.write('".str_replace("/", "\/", $field_select)."');

Zeile 2477Zeile 2504
			{
$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

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

Zeile 2519Zeile 2546
		while($moderator = $db->fetch_array($query))
{
if($moderator['isgroup'])

		while($moderator = $db->fetch_array($query))
{
if($moderator['isgroup'])

			{

			{

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

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

Zeile 2582Zeile 2609
		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

		$form_container->end();

// Autocompletion for usernames

Zeile 2593Zeile 2620
		<!--
$("#username").select2({
placeholder: "'.$lang->search_for_a_user.'",

		<!--
$("#username").select2({
placeholder: "'.$lang->search_for_a_user.'",

			minimumInputLength: 3,
maximumSelectionSize: 3,

			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 2622Zeile 2648
			},
});


			},
});


		$(\'[for=username]\').click(function(){

		$(\'[for=username]\').on(\'click\', function(){

			$("#username").select2(\'open\');
return false;
});

			$("#username").select2(\'open\');
return false;
});

Zeile 2643Zeile 2669

/**
* @param DefaultFormContainer $form_container


/**
* @param DefaultFormContainer $form_container

 
 * @param DefaultForm $form

 * @param int $pid
* @param int $depth
*/

 * @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 2678Zeile 2705
			}

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


			{
$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("<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 2708Zeile 2736

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


// 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))
{
if($forum['description'])

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

				{

				{

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

Zeile 2723Zeile 2751
				$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 2732Zeile 2760

$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 2749Zeile 2777

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)