Vergleich admin/modules/config/thread_prefixes.php - 1.6.0 - 1.6.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1Zeile 1
<?php
/**
* MyBB 1.6

<?php
/**
* MyBB 1.6

 * Copyright � 2010 MyBB Group, All Rights Reserved

 * Copyright 2010 MyBB Group, All Rights Reserved

 *
* Website: http://mybb.com
* License: http://mybb.com/about/license
*

 *
* Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: thread_prefixes.php 4985 2010-06-02 09:09:43Z Tomm $

 * $Id: thread_prefixes.php 5352 2011-02-15 12:57:18Z Tomm $

 */

 */



 

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))


// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))

Zeile 32Zeile 31
);

$plugins->run_hooks('admin_config_thread_prefixes_begin');

);

$plugins->run_hooks('admin_config_thread_prefixes_begin');





if($mybb->input['action'] == 'add_prefix')
{
$plugins->run_hooks('admin_config_thread_prefixes_add_prefix');

if($mybb->input['action'] == 'add_prefix')
{
$plugins->run_hooks('admin_config_thread_prefixes_add_prefix');

	
if($mybb->request_method == 'post')
{
if(trim($mybb->input['prefix']) == '')
{
$errors[] = $lang->error_missing_prefix;
}

if(trim($mybb->input['displaystyle']) == '')
{
$errors[] = $lang->error_missing_display_style;
}

if($mybb->input['forum_type'] == 2)
{
if(count($mybb->input['forum_1_forums']) < 1)
{
$errors[] = $lang->error_no_forums_selected;
}

$forum_checked[2] = "checked=\"checked\"";
}
else
{
$forum_checked[1] = "checked=\"checked\"";
$mybb->input['forum_1_forums'] = '';
}

if($mybb->input['group_type'] == 2)
{
if(count($mybb->input['group_1_groups']) < 1)
{
$errors[] = $lang->error_no_groups_selected;
}

$group_checked[2] = "checked=\"checked\"";

	
if($mybb->request_method == 'post')
{
if(trim($mybb->input['prefix']) == '')
{
$errors[] = $lang->error_missing_prefix;
}

if(trim($mybb->input['displaystyle']) == '')
{
$errors[] = $lang->error_missing_display_style;
}

if($mybb->input['forum_type'] == 2)
{
if(count($mybb->input['forum_1_forums']) < 1)
{
$errors[] = $lang->error_no_forums_selected;
}

$forum_checked[2] = "checked=\"checked\"";
}
else
{
$forum_checked[1] = "checked=\"checked\"";
$mybb->input['forum_1_forums'] = '';
}

if($mybb->input['group_type'] == 2)
{
if(count($mybb->input['group_1_groups']) < 1)
{
$errors[] = $lang->error_no_groups_selected;
}

$group_checked[2] = "checked=\"checked\"";

		}
else
{

		}
else
{

Zeile 87Zeile 86
			);

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

			);

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

			{

			{

				if(is_array($mybb->input['forum_1_forums']))
{
$checked = array();
foreach($mybb->input['forum_1_forums'] as $fid)
{
$checked[] = intval($fid);

				if(is_array($mybb->input['forum_1_forums']))
{
$checked = array();
foreach($mybb->input['forum_1_forums'] as $fid)
{
$checked[] = intval($fid);

					}


					}


					$new_prefix['forums'] = implode(',', $checked);
}
}
else
{
$new_prefix['forums'] = '-1';

					$new_prefix['forums'] = implode(',', $checked);
}
}
else
{
$new_prefix['forums'] = '-1';

			}

			}

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

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

Zeile 128Zeile 127
			
// Log admin action
log_admin_action($pid, $mybb->input['prefix']);

			
// Log admin action
log_admin_action($pid, $mybb->input['prefix']);

 
			$cache->update_threadprefixes();

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

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

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


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


	$page->add_breadcrumb_item($lang->add_new_thread_prefix);
$page->output_header($lang->thread_prefixes." - ".$lang->add_new_thread_prefix);
$page->output_nav_tabs($sub_tabs, 'add_prefix');

	$page->add_breadcrumb_item($lang->add_new_thread_prefix);
$page->output_header($lang->thread_prefixes." - ".$lang->add_new_thread_prefix);
$page->output_nav_tabs($sub_tabs, 'add_prefix');

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

if($errors)

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

if($errors)

	{

	{

		$page->output_inline_error($errors);
}
else

		$page->output_inline_error($errors);
}
else

Zeile 154Zeile 154
		$mybb->input['group_1_groups'] = '';
$group_checked[1] = "checked=\"checked\"";
$group_checked[2] = '';

		$mybb->input['group_1_groups'] = '';
$group_checked[1] = "checked=\"checked\"";
$group_checked[2] = '';

	}

$form_container = new FormContainer($lang->prefix_options);
$form_container->output_row($lang->prefix.' <em>*</em>', $lang->prefix_desc, $form->generate_text_box('prefix', $mybb->input['prefix'], array('id' => 'prefix')), 'prefix');
$form_container->output_row($lang->display_style.' <em>*</em>', $lang->display_style_desc, $form->generate_text_box('displaystyle', $mybb->input['displaystyle'], array('id' => 'displaystyle')), 'displaystyle');

$actions = "<script type=\"text/javascript\">
function checkAction(id)
{
var checked = '';

$$('.'+id+'s_check').each(function(e)
{
if(e.checked == true)
{
checked = e.value;
}
});
$$('.'+id+'s').each(function(e)
{
Element.hide(e);
});
if($(id+'_'+checked))
{
Element.show(id+'_'+checked);
}
}
</script>
<dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\">
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"1\" {$forum_checked[1]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->all_forums}</strong></label></dt>
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"2\" {$forum_checked[2]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->select_forums}</strong></label></dt>
<dd style=\"margin-top: 4px;\" id=\"forum_2\" class=\"forums\">
<table cellpadding=\"4\">
<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\">
checkAction('forum');
</script>";

	}

$form_container = new FormContainer($lang->prefix_options);
$form_container->output_row($lang->prefix.' <em>*</em>', $lang->prefix_desc, $form->generate_text_box('prefix', $mybb->input['prefix'], array('id' => 'prefix')), 'prefix');
$form_container->output_row($lang->display_style.' <em>*</em>', $lang->display_style_desc, $form->generate_text_box('displaystyle', $mybb->input['displaystyle'], array('id' => 'displaystyle')), 'displaystyle');

$actions = "<script type=\"text/javascript\">
function checkAction(id)
{
var checked = '';

$$('.'+id+'s_check').each(function(e)
{
if(e.checked == true)
{
checked = e.value;
}
});
$$('.'+id+'s').each(function(e)
{
Element.hide(e);
});
if($(id+'_'+checked))
{
Element.show(id+'_'+checked);
}
}
</script>
<dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\">
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"1\" {$forum_checked[1]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->all_forums}</strong></label></dt>
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"forum_type\" value=\"2\" {$forum_checked[2]} class=\"forums_check\" onclick=\"checkAction('forum');\" style=\"vertical-align: middle;\" /> <strong>{$lang->select_forums}</strong></label></dt>
<dd style=\"margin-top: 4px;\" id=\"forum_2\" class=\"forums\">
<table cellpadding=\"4\">
<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\">
checkAction('forum');
</script>";

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

$group_select = "

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

$group_select = "

Zeile 220Zeile 220
	$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 231Zeile 231
{
$plugins->run_hooks('admin_config_thread_prefixes_edit_prefix_start');


{
$plugins->run_hooks('admin_config_thread_prefixes_edit_prefix_start');


	$query = $db->simple_select('threadprefixes', 'COUNT(pid) as prefixes', "pid = '{$mybb->input['pid']}'");
if($db->fetch_field($query, 'prefixes') < 1)

	$prefix = build_prefixes($mybb->input['pid']);
if(!$prefix['pid'])

	{
flash_message($lang->error_invalid_prefix, 'error');
admin_redirect('index.php?module=config-thread_prefixes');

	{
flash_message($lang->error_invalid_prefix, 'error');
admin_redirect('index.php?module=config-thread_prefixes');

Zeile 251Zeile 251
		}

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

		}

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

		{
if(count($mybb->input['forum_1_forums']) < 1)
{
$errors[] = $lang->error_no_forums_selected;
}

$forum_checked[2] = "checked=\"checked\"";
}
else
{

		{
if(count($mybb->input['forum_1_forums']) < 1)
{
$errors[] = $lang->error_no_forums_selected;
}

$forum_checked[2] = "checked=\"checked\"";
}
else
{

			$forum_checked[1] = "checked=\"checked\"";
$mybb->input['forum_1_forums'] = '';
}

			$forum_checked[1] = "checked=\"checked\"";
$mybb->input['forum_1_forums'] = '';
}

Zeile 329Zeile 329
			
// Log admin action
log_admin_action($mybb->input['pid'], $mybb->input['prefix']);

			
// Log admin action
log_admin_action($mybb->input['pid'], $mybb->input['prefix']);

 
			$cache->update_threadprefixes();

			
flash_message($lang->success_thread_prefix_updated, 'success');
admin_redirect('index.php?module=config-thread_prefixes');

			
flash_message($lang->success_thread_prefix_updated, 'success');
admin_redirect('index.php?module=config-thread_prefixes');

Zeile 448Zeile 449
		checkAction('group');
</script>";
$form_container->output_row($lang->available_to_groups." <em>*</em>", '', $group_select);

		checkAction('group');
</script>";
$form_container->output_row($lang->available_to_groups." <em>*</em>", '', $group_select);

	

	

	$form_container->end();

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

	$form_container->end();

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

Zeile 463Zeile 464
{
$plugins->run_hooks('admin_config_thread_prefixes_delete_prefix');


{
$plugins->run_hooks('admin_config_thread_prefixes_delete_prefix');


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


	$prefix = build_prefixes($mybb->input['pid']);



	if(!$prefix['pid'])
{
flash_message($lang->error_invalid_thread_prefix, 'error');

	if(!$prefix['pid'])
{
flash_message($lang->error_invalid_thread_prefix, 'error');

Zeile 474Zeile 473
	
// User clicked no
if($mybb->input['no'])

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

	{

	{

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


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


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

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

 
		$cache->update_threadprefixes();

		
flash_message($lang->success_thread_prefix_deleted, 'success');
admin_redirect('index.php?module=config-thread_prefixes');

		
flash_message($lang->success_thread_prefix_deleted, 'success');
admin_redirect('index.php?module=config-thread_prefixes');

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


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


	$query = $db->simple_select('threadprefixes', 'pid, prefix', "", array('order_by' => 'prefix'));
while($prefix = $db->fetch_array($query))

	$prefixes = build_prefixes();
if($prefixes)

	{

	{

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




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