Vergleich admin/modules/config/thread_prefixes.php - 1.6.2 - 1.6.17

  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$

 */

 */



 

// 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 127Zeile 126
			$plugins->run_hooks('admin_config_thread_prefixes_add_prefix_commit');

// Log admin action

			$plugins->run_hooks('admin_config_thread_prefixes_add_prefix_commit');

// Log admin action

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


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

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

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

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 268Zeile 268
		if($mybb->input['group_type'] == 2)
{
if(count($mybb->input['group_1_groups']) < 1)

		if($mybb->input['group_type'] == 2)
{
if(count($mybb->input['group_1_groups']) < 1)

			{

			{

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


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


Zeile 290Zeile 290
			if($mybb->input['forum_type'] == 2)
{
if(is_array($mybb->input['forum_1_forums']))

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

				{
$checked = array();

				{
$checked = array();

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

$update_prefix['forums'] = implode(',', $checked);

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

$update_prefix['forums'] = implode(',', $checked);

				}
}

				}
}

			else
{
$update_prefix['forums'] = '-1';

			else
{
$update_prefix['forums'] = '-1';

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

// Log admin action

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

$plugins->run_hooks('admin_config_thread_prefixes_edit_prefix_commit');

// Log admin action

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


			log_admin_action($mybb->input['pid'], htmlspecialchars_uni($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 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');

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

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

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

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

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

Zeile 488Zeile 487
		$db->delete_query('threadprefixes', "pid='{$prefix['pid']}'");

$plugins->run_hooks('admin_config_thread_prefixes_delete_thread_prefix_commit');

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

$plugins->run_hooks('admin_config_thread_prefixes_delete_thread_prefix_commit');

		

		

		// Log admin action

		// Log admin action

		log_admin_action($prefix['pid'], $prefix['prefix']);


		log_admin_action($prefix['pid'], htmlspecialchars_uni($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 507Zeile 507
	
$page->output_header($lang->thread_prefixes);
$page->output_nav_tabs($sub_tabs, 'thread_prefixes');

	
$page->output_header($lang->thread_prefixes);
$page->output_nav_tabs($sub_tabs, 'thread_prefixes');

	

	

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


	$table = new Table;
$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)