Vergleich admin/modules/forum/management.php - 1.8.4 - 1.8.21

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 590Zeile 590
		<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 719Zeile 719
			'candeleteposts' => 'editing',
'candeletethreads' => 'editing',
'caneditattachments' => 'editing',

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

 
			'canviewdeletionnotice' => 'editing',


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


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

Zeile 1325Zeile 1326
		}
else
{

		}
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 1417Zeile 1415
				while($child = $db->fetch_array($query))
{
$db->update_query("forums", array("parentlist" => make_parent_list($child['fid'])), "fid='{$child['fid']}'");

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

				}
}

				}
}


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



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


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

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

	}


	}


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

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

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

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

Zeile 1503Zeile 1501
		$forum_data['title'] = $forum_data['name'];
}


		$forum_data['title'] = $forum_data['name'];
}


	$query = $db->simple_select("usergroups", "*", "", array("order_dir" => "name"));
while($usergroup = $db->fetch_array($query))
{
$usergroups[$usergroup['gid']] = $usergroup;
}


	$query = $db->simple_select("usergroups", "*", "", array("order_dir" => "name"));
while($usergroup = $db->fetch_array($query))
{
$usergroups[$usergroup['gid']] = $usergroup;
}


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

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

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

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

		$delquery = "";
switch($db->type)
{
case "pgsql":
case "sqlite":






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

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

Zeile 1972Zeile 1965
		{
$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");
echo "<div class=\"confirm_action\">\n";
echo "<p>{$lang->confirm_proceed_deletion}</p>\n";
echo "<br />\n";
echo "<script type=\"text/javascript\">$(function() { var button = $(\"#proceed_button\"); if(button.length > 0) { button.val(\"{$lang->automatically_redirecting}\"); button.attr(\"disabled\", true); button.css(\"color\", \"#aaa\"); button.css(\"borderColor\", \"#aaa\"); document.forms[0].trigger('submit'); }})</script>";
echo "<p class=\"buttons\">\n";
echo $form->generate_submit_button($lang->proceed, array('class' => 'button_yes', 'id' => 'proceed_button'));
echo "</p>\n";
echo "</div>\n";

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

$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 2415Zeile 2439
					}
else
{

					}
else
{

						$perms_checked[$forum_permission] = 0;

						$perms_checked[$forum_permission] = 0;

					}
}
}

					}
}
}

Zeile 2585Zeile 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 2595Zeile 2619
		<script type="text/javascript">
<!--
$("#username").select2({

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

			placeholder: "'.$lang->search_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 2625Zeile 2648
			},
});


			},
});


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

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

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

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

Zeile 2645Zeile 2668
}

/**

}

/**

 *



 * @param DefaultFormContainer $form_container
* @param int $pid
* @param int $depth

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

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

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

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





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

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

		}
}


		}
}


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

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

	{

	{

		return;
}


		return;
}


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

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

			}


			}


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

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

				{

				{

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

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

				}

				}

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

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

Zeile 2693Zeile 2718
				$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("<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 = 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->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");

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

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

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

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

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

				$form_container->construct_row();

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

Zeile 2759Zeile 2784
				{
$sub_forums .= "{$comma} <a href=\"index.php?module=forum-management&amp;fid={$forum['fid']}\">{$forum['name']}</a>";
$comma = $lang->comma;

				{
$sub_forums .= "{$comma} <a href=\"index.php?module=forum-management&amp;fid={$forum['fid']}\">{$forum['name']}</a>";
$comma = $lang->comma;

				}

				}


// Have we reached our max visible subforums? put a nice message and break out of the loop
++$donecount;


// Have we reached our max visible subforums? put a nice message and break out of the loop
++$donecount;

Zeile 2776Zeile 2801
	}
}


	}
}


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