Vergleich admin/modules/config/thread_prefixes.php - 1.8.0 - 1.8.38

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

if($mybb->input['forum_type'] == 2)
{


if($mybb->input['forum_type'] == 2)
{

			if(count($mybb->input['forum_1_forums']) < 1)

			if(is_array($mybb->input['forum_1_forums']) && count($mybb->input['forum_1_forums']) < 1)

			{
$errors[] = $lang->error_no_forums_selected;
}

			{
$errors[] = $lang->error_no_forums_selected;
}

Zeile 64Zeile 64

if($mybb->input['group_type'] == 2)
{


if($mybb->input['group_type'] == 2)
{

			if(count($mybb->input['group_1_groups']) < 1)

			if(is_array($mybb->input['group_1_groups']) && count($mybb->input['group_1_groups']) < 1)

			{
$errors[] = $lang->error_no_groups_selected;
}

			{
$errors[] = $lang->error_no_groups_selected;
}

Zeile 251Zeile 251

if($mybb->input['forum_type'] == 2)
{


if($mybb->input['forum_type'] == 2)
{

			if(count($mybb->input['forum_1_forums']) < 1)

			if(is_array($mybb->input['forum_1_forums']) && count($mybb->input['forum_1_forums']) < 1)

			{
$errors[] = $lang->error_no_forums_selected;
}

			{
$errors[] = $lang->error_no_forums_selected;
}

Zeile 266Zeile 266

if($mybb->input['group_type'] == 2)
{


if($mybb->input['group_type'] == 2)
{

			if(count($mybb->input['group_1_groups']) < 1)

			if(is_array($mybb->input['group_1_groups']) && count($mybb->input['group_1_groups']) < 1)

			{
$errors[] = $lang->error_no_groups_selected;
}

			{
$errors[] = $lang->error_no_groups_selected;
}

Zeile 321Zeile 321
			{
$update_prefix['groups'] = '-1';
}

			{
$update_prefix['groups'] = '-1';
}


$db->update_query('threadprefixes', $update_prefix, "pid='{$mybb->input['pid']}'");

 

$plugins->run_hooks('admin_config_thread_prefixes_edit_prefix_commit');


$plugins->run_hooks('admin_config_thread_prefixes_edit_prefix_commit');

 

$db->update_query('threadprefixes', $update_prefix, "pid='{$prefix['pid']}'");


// Log admin action


// Log admin action

			log_admin_action($mybb->input['pid'], $mybb->input['prefix']);

			log_admin_action($prefix['pid'], $mybb->input['prefix']);

			$cache->update_threadprefixes();

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

			$cache->update_threadprefixes();

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

Zeile 348Zeile 348
	$page->output_nav_tabs($sub_tabs, "edit_prefix");

$form = new Form('index.php?module=config-thread_prefixes&amp;action=edit_prefix', 'post');

	$page->output_nav_tabs($sub_tabs, "edit_prefix");

$form = new Form('index.php?module=config-thread_prefixes&amp;action=edit_prefix', 'post');

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

	echo $form->generate_hidden_field('pid', $prefix['pid']);


if($errors)
{


if($errors)
{

Zeile 356Zeile 356
	}
else
{

	}
else
{

		$query = $db->simple_select('threadprefixes', '*', "pid = '{$mybb->input['pid']}'");

		$query = $db->simple_select('threadprefixes', '*', "pid = '{$prefix['pid']}'");

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

$mybb->input['prefix'] = $threadprefix['prefix'];

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

$mybb->input['prefix'] = $threadprefix['prefix'];

Zeile 422Zeile 422
				<tr>
<td valign=\"top\"><small>{$lang->forums_colon}</small></td>
<td>".$form->generate_forum_select('forum_1_forums[]', $mybb->input['forum_1_forums'], array('multiple' => true, 'size' => 5))."</td>

				<tr>
<td valign=\"top\"><small>{$lang->forums_colon}</small></td>
<td>".$form->generate_forum_select('forum_1_forums[]', $mybb->input['forum_1_forums'], array('multiple' => true, 'size' => 5))."</td>

				</tr>
</table>
</dd>
</dl>
<script type=\"text/javascript\">

				</tr>
</table>
</dd>
</dl>
<script type=\"text/javascript\">

	checkAction('forum');
</script>";
$form_container->output_row($lang->available_in_forums.' <em>*</em>', '', $actions);

	checkAction('forum');
</script>";
$form_container->output_row($lang->available_in_forums.' <em>*</em>', '', $actions);





	$group_select = "
<dl style=\"margin-top: 0; margin-bottom: 0; width: 100%\">
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"group_type\" value=\"1\" {$group_checked[1]} class=\"groups_check\" onclick=\"checkAction('group');\" style=\"vertical-align: middle;\" /> <strong>{$lang->all_groups}</strong></label></dt>

	$group_select = "
<dl style=\"margin-top: 0; margin-bottom: 0; width: 100%\">
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"group_type\" value=\"1\" {$group_checked[1]} class=\"groups_check\" onclick=\"checkAction('group');\" style=\"vertical-align: middle;\" /> <strong>{$lang->all_groups}</strong></label></dt>

Zeile 452Zeile 452
	$form_container->end();

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

	$form_container->end();

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





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


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


Zeile 469Zeile 469
	}

// User clicked no

	}

// User clicked no

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

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

	{
admin_redirect('index.php?module=config-thread_prefixes');
}

	{
admin_redirect('index.php?module=config-thread_prefixes');
}

Zeile 480Zeile 480
	{
// Remove prefix from existing threads
$update_threads = array('prefix' => 0);

	{
// Remove prefix from existing threads
$update_threads = array('prefix' => 0);

		$db->update_query('threads', $update_threads, "prefix='{$prefix['pid']}'");





		// Delete prefix
$db->delete_query('threadprefixes', "pid='{$prefix['pid']}'");

		// Delete prefix
$db->delete_query('threadprefixes', "pid='{$prefix['pid']}'");





		$plugins->run_hooks('admin_config_thread_prefixes_delete_thread_prefix_commit');

		$plugins->run_hooks('admin_config_thread_prefixes_delete_thread_prefix_commit');

 

$db->update_query('threads', $update_threads, "prefix='{$prefix['pid']}'");


// Log admin action
log_admin_action($prefix['pid'], $prefix['prefix']);


// Log admin action
log_admin_action($prefix['pid'], $prefix['prefix']);

Zeile 496Zeile 497
	}
else
{

	}
else
{

		$page->output_confirm_action("index.php?module=config-thread_prefixes&amp;action=delete_prefix&amp;pid={$mybb->input['pid']}", $lang->confirm_thread_prefix_deletion);

		$page->output_confirm_action("index.php?module=config-thread_prefixes&amp;action=delete_prefix&amp;pid={$prefix['pid']}", $lang->confirm_thread_prefix_deletion);

	}
}


	}
}


Zeile 509Zeile 510

$table = new Table;
$table->construct_header($lang->prefix);


$table = new Table;
$table->construct_header($lang->prefix);

 
	$table->construct_header($lang->forums);

	$table->construct_header($lang->controls, array('class' => 'align_center', 'colspan' => 2));

$prefixes = build_prefixes();

	$table->construct_header($lang->controls, array('class' => 'align_center', 'colspan' => 2));

$prefixes = build_prefixes();

 


	if(!empty($prefixes))
{

	if(!empty($prefixes))
{

 
		foreach($prefixes as &$prefix)
{
$prefix['forum_fids'] = explode(',', $prefix['forums']);
}
unset($prefix);

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

if($fid)
{
$forum = get_forum($fid, 1);

if(!empty($forum))
{
$title = $lang->sprintf($lang->thread_prefixes_in, $forum['name']);

foreach($prefixes as $key => $prefix)
{
if($prefix['forums'] !== '-1' && !in_array($fid, $prefix['forum_fids']))
{
unset($prefixes[$key]);
}
}
}
}

usort($prefixes, 'thread_prefix_sort');


		foreach($prefixes as $prefix)
{

		foreach($prefixes as $prefix)
{

			$table->construct_cell("<a href=\"index.php?module=config-thread_prefixes&amp;action=edit_prefix&amp;pid={$prefix['pid']}\"><strong>".htmlspecialchars_uni($prefix['prefix'])."</strong></a>");























			if($prefix['forums'] === '-1')
{
$forum_names = $lang->all_forums;
}
else
{
$forum_names = array();

foreach($prefix['forum_fids'] as $fid)
{
$forum = get_forum($fid, 1);

if(!empty($forum))
{
$forum_names[] = '<a href="index.php?module=config-thread_prefixes&amp;fid='.(int)$fid.'">'.$forum['name'].'</a>';
}
}

$forum_names = implode($lang->comma, $forum_names);
}

$table->construct_cell("<a href=\"index.php?module=config-thread_prefixes&amp;action=edit_prefix&amp;pid={$prefix['pid']}\" style=\"color: inherit;\" title=\"".htmlspecialchars_uni($prefix['prefix'])."\">".$prefix['displaystyle']."</a>");
$table->construct_cell($forum_names);

			$table->construct_cell("<a href=\"index.php?module=config-thread_prefixes&amp;action=edit_prefix&amp;pid={$prefix['pid']}\">{$lang->edit}</a>", array('width' => 100, 'class' => "align_center"));
$table->construct_cell("<a href=\"index.php?module=config-thread_prefixes&amp;action=delete_prefix&amp;pid={$prefix['pid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_thread_prefix_deletion}')\">{$lang->delete}</a>", array('width' => 100, 'class' => 'align_center'));
$table->construct_row();

			$table->construct_cell("<a href=\"index.php?module=config-thread_prefixes&amp;action=edit_prefix&amp;pid={$prefix['pid']}\">{$lang->edit}</a>", array('width' => 100, 'class' => "align_center"));
$table->construct_cell("<a href=\"index.php?module=config-thread_prefixes&amp;action=delete_prefix&amp;pid={$prefix['pid']}&amp;my_post_key={$mybb->post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_thread_prefix_deletion}')\">{$lang->delete}</a>", array('width' => 100, 'class' => 'align_center'));
$table->construct_row();

		}
}

		}
}


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


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

	{

	{

		$table->construct_cell($lang->no_thread_prefixes, array('colspan' => 3));
$table->construct_row();
}


		$table->construct_cell($lang->no_thread_prefixes, array('colspan' => 3));
$table->construct_row();
}


	$table->output($lang->thread_prefixes);

$page->output_footer();












































if(!isset($title))
{
$title = $lang->thread_prefixes;
}

$table->output($title);

$page->output_footer();
}

function thread_prefix_sort($a, $b)
{
// all forums
if($a['forums'] === '-1' && $b['forums'] !== '-1')
{
return -1;
}
if($a['forums'] !== '-1' && $b['forums'] === '-1')
{
return 1;
}

// multiple forums
if(count($a['forum_fids']) > 1 xor count($b['forum_fids']) > 1)
{
return count($b['forum_fids']) - count($a['forum_fids']);
}
// natural sort order: forum name
elseif(
count($a['forum_fids']) === 1 && count($b['forum_fids']) === 1 &&
$a['forum_fids'][0] !== $b['forum_fids'][0]
)
{
$forum_a = get_forum($a['forum_fids'][0], 1);
$forum_b = get_forum($b['forum_fids'][0], 1);

if($forum_a !== false && $forum_b !== false)
{
return strnatcmp($forum_a['name'], $forum_b['name']);
}
}

// natural sort order: prefix
return strnatcmp($a['prefix'], $b['prefix']);

}

}