Vergleich admin/modules/user/group_promotions.php - 1.6.1 - 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: group_promotions.php 4941 2010-05-15 18:17:38Z RyanGordon $

 * $Id$

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 40Zeile 40
if($mybb->input['action'] == "disable")
{
$plugins->run_hooks("admin_user_group_promotions_disable");

if($mybb->input['action'] == "disable")
{
$plugins->run_hooks("admin_user_group_promotions_disable");

	
if(!trim($mybb->input['pid']))
{
flash_message($lang->error_no_promo_id, 'error');
admin_redirect("index.php?module=user-group_promotions");
}

$query = $db->simple_select("promotions", "*", "pid='".intval($mybb->input['pid'])."'");
$promotion = $db->fetch_array($query);

if(!$promotion['pid'])
{
flash_message($lang->error_invalid_promo_id, 'error');
admin_redirect("index.php?module=user-group_promotions");
}

$promotion = array(
"enabled" => 0
);
$db->update_query("promotions", $promotion, "pid = '{$mybb->input['pid']}'");

$plugins->run_hooks("admin_user_group_promotions_disable_commit");

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

flash_message($lang->success_promo_disabled, 'success');
admin_redirect("index.php?module=user-group_promotions");















if($mybb->input['no'])
{
admin_redirect("index.php?module=user-group_promotions");
}

if(!trim($mybb->input['pid']))
{
flash_message($lang->error_no_promo_id, 'error');
admin_redirect("index.php?module=user-group_promotions");
}

$query = $db->simple_select("promotions", "*", "pid='".intval($mybb->input['pid'])."'");
$promotion = $db->fetch_array($query);

if(!$promotion['pid'])
{
flash_message($lang->error_invalid_promo_id, 'error');
admin_redirect("index.php?module=user-group_promotions");
}

if($mybb->request_method == "post")
{
$update_promotion = array(
"enabled" => 0
);

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

$plugins->run_hooks("admin_user_group_promotions_disable_commit");

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

flash_message($lang->success_promo_disabled, 'success');
admin_redirect("index.php?module=user-group_promotions");
}
else
{
$page->output_confirm_action("index.php?module=user-group_promotions&amp;action=disable&amp;pid={$promotion['pid']}", $lang->confirm_promo_disable);
}

}

if($mybb->input['action'] == "delete")
{
$plugins->run_hooks("admin_user_group_promotions_delete");

}

if($mybb->input['action'] == "delete")
{
$plugins->run_hooks("admin_user_group_promotions_delete");

	

	

	if($mybb->input['no']) 
{
admin_redirect("index.php?module=user-group_promotions");

	if($mybb->input['no']) 
{
admin_redirect("index.php?module=user-group_promotions");

	} 

	}

	
if(!trim($mybb->input['pid']))
{
flash_message($lang->error_no_promo_id, 'error');

	
if(!trim($mybb->input['pid']))
{
flash_message($lang->error_no_promo_id, 'error');

		admin_redirect("index.php?module=user-group_promotions");
}

		admin_redirect("index.php?module=user-group_promotions");
}

	
$query = $db->simple_select("promotions", "*", "pid='".intval($mybb->input['pid'])."'");
$promotion = $db->fetch_array($query);

	
$query = $db->simple_select("promotions", "*", "pid='".intval($mybb->input['pid'])."'");
$promotion = $db->fetch_array($query);

Zeile 102Zeile 115

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


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





		flash_message($lang->success_promo_deleted, 'success');
admin_redirect("index.php?module=user-group_promotions");
}

		flash_message($lang->success_promo_deleted, 'success');
admin_redirect("index.php?module=user-group_promotions");
}

Zeile 115Zeile 128
if($mybb->input['action'] == "enable")
{
$plugins->run_hooks("admin_user_group_promotions_enable");

if($mybb->input['action'] == "enable")
{
$plugins->run_hooks("admin_user_group_promotions_enable");

	
if(!trim($mybb->input['pid']))
{
flash_message($lang->error_no_promo_id, 'error');
admin_redirect("index.php?module=user-group_promotions");
}









if(!verify_post_check($mybb->input['my_post_key']))
{
flash_message($lang->invalid_post_verify_key2, 'error');
admin_redirect("index.php?module=user-group_promotions");
}

if(!trim($mybb->input['pid']))
{
flash_message($lang->error_no_promo_id, 'error');
admin_redirect("index.php?module=user-group_promotions");
}


	$query = $db->simple_select("promotions", "*", "pid='".intval($mybb->input['pid'])."'");

	$query = $db->simple_select("promotions", "*", "pid='".intval($mybb->input['pid'])."'");

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

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


if(!$promotion['pid'])


if(!$promotion['pid'])

	{
flash_message($lang->error_invalid_promo_id, 'error');
admin_redirect("index.php?module=user-group_promotions");
}

	{
flash_message($lang->error_invalid_promo_id, 'error');
admin_redirect("index.php?module=user-group_promotions");
}





	$promotion = array(

	$update_promotion = array(

		"enabled" => 1
);


		"enabled" => 1
);


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

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

	
$plugins->run_hooks("admin_user_group_promotions_enable_commit");


	
$plugins->run_hooks("admin_user_group_promotions_enable_commit");


Zeile 163Zeile 182
	{
flash_message($lang->error_invalid_promo_id, 'error');
admin_redirect("index.php?module=user-group_promotions");

	{
flash_message($lang->error_invalid_promo_id, 'error');
admin_redirect("index.php?module=user-group_promotions");

	}

if($mybb->request_method == "post")
{
if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_no_title;
}

if(!trim($mybb->input['description']))
{
$errors[] = $lang->error_no_desc;
}

if(empty($mybb->input['requirements']))
{
$errors[] = $lang->error_no_requirements;
}

if(empty($mybb->input['originalusergroup']))
{
$errors[] = $lang->error_no_orig_usergroup;
}

if(!trim($mybb->input['newusergroup']))
{
$errors[] = $lang->error_no_new_usergroup;
}

if(!trim($mybb->input['usergroupchangetype']))
{
$errors[] = $lang->error_no_usergroup_change_type;
}

if(!$errors)
{
if(in_array('*', $mybb->input['originalusergroup']))

	}

if($mybb->request_method == "post")
{
if(!trim($mybb->input['title']))
{
$errors[] = $lang->error_no_title;
}

if(!trim($mybb->input['description']))
{
$errors[] = $lang->error_no_desc;
}

if(empty($mybb->input['requirements']))
{
$errors[] = $lang->error_no_requirements;
}

if(empty($mybb->input['originalusergroup']))
{
$errors[] = $lang->error_no_orig_usergroup;
}

if(!trim($mybb->input['newusergroup']))
{
$errors[] = $lang->error_no_new_usergroup;
}

if(!trim($mybb->input['usergroupchangetype']))
{
$errors[] = $lang->error_no_usergroup_change_type;
}

if(!$errors)
{
if(in_array('*', $mybb->input['originalusergroup']))

			{
$mybb->input['originalusergroup'] = '*';
}

			{
$mybb->input['originalusergroup'] = '*';
}

Zeile 237Zeile 256
			flash_message($lang->success_promo_updated, 'success');
admin_redirect("index.php?module=user-group_promotions");
}

			flash_message($lang->success_promo_updated, 'success');
admin_redirect("index.php?module=user-group_promotions");
}

	}

	}

	
$page->add_breadcrumb_item($lang->edit_promotion);
$page->output_header($lang->user_group_promotions." - ".$lang->edit_promotion);

	
$page->add_breadcrumb_item($lang->edit_promotion);
$page->output_header($lang->user_group_promotions." - ".$lang->edit_promotion);

Zeile 274Zeile 293
		$mybb->input['newusergroup'] = $promotion['newusergroup'];
$mybb->input['enabled'] = $promotion['enabled'];
$mybb->input['logging'] = $promotion['logging'];

		$mybb->input['newusergroup'] = $promotion['newusergroup'];
$mybb->input['enabled'] = $promotion['enabled'];
$mybb->input['logging'] = $promotion['logging'];

	}


	}


	$form_container = new FormContainer($lang->edit_promotion);
$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->short_desc." <em>*</em>", "", $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');

	$form_container = new FormContainer($lang->edit_promotion);
$form_container->output_row($lang->title." <em>*</em>", "", $form->generate_text_box('title', $mybb->input['title'], array('id' => 'title')), 'title');
$form_container->output_row($lang->short_desc." <em>*</em>", "", $form->generate_text_box('description', $mybb->input['description'], array('id' => 'description')), 'description');

Zeile 285Zeile 304
		"reputation" => $lang->reputation,
"referrals" => $lang->referrals,
"timeregistered" => $lang->time_registered

		"reputation" => $lang->reputation,
"referrals" => $lang->referrals,
"timeregistered" => $lang->time_registered

	);

	);

	
$form_container->output_row($lang->promo_requirements." <em>*</em>", $lang->promo_requirements_desc, $form->generate_select_box('requirements[]', $options, $mybb->input['requirements'], array('id' => 'requirements', 'multiple' => true, 'size' => 3)), 'requirements');


	
$form_container->output_row($lang->promo_requirements." <em>*</em>", $lang->promo_requirements_desc, $form->generate_select_box('requirements[]', $options, $mybb->input['requirements'], array('id' => 'requirements', 'multiple' => true, 'size' => 3)), 'requirements');


Zeile 332Zeile 351
	);

$form_container->output_row($lang->user_group_change_type." <em>*</em>", $lang->user_group_change_type_desc, $form->generate_select_box('usergroupchangetype', $options, $mybb->input['usergroupchangetype'], array('id' => 'usergroupchangetype')), 'usergroupchangetype');

	);

$form_container->output_row($lang->user_group_change_type." <em>*</em>", $lang->user_group_change_type_desc, $form->generate_select_box('usergroupchangetype', $options, $mybb->input['usergroupchangetype'], array('id' => 'usergroupchangetype')), 'usergroupchangetype');





	$form_container->output_row($lang->enabled." <em>*</em>", "", $form->generate_yes_no_radio("enabled", $mybb->input['enabled'], true));

$form_container->output_row($lang->enable_logging." <em>*</em>", "", $form->generate_yes_no_radio("logging", $mybb->input['logging'], true));
$form_container->end();

	$form_container->output_row($lang->enabled." <em>*</em>", "", $form->generate_yes_no_radio("enabled", $mybb->input['enabled'], true));

$form_container->output_row($lang->enable_logging." <em>*</em>", "", $form->generate_yes_no_radio("logging", $mybb->input['logging'], true));
$form_container->end();





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

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

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

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





	$page->output_footer();
}


	$page->output_footer();
}


Zeile 351Zeile 370
	$plugins->run_hooks("admin_user_group_promotions_add");

if($mybb->request_method == "post")

	$plugins->run_hooks("admin_user_group_promotions_add");

if($mybb->request_method == "post")

	{

	{

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

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

Zeile 502Zeile 521
	while($usergroup = $db->fetch_array($query))
{
$options[(int)$usergroup['gid']] = $usergroup['title'];

	while($usergroup = $db->fetch_array($query))
{
$options[(int)$usergroup['gid']] = $usergroup['title'];

	}


	}


	$form_container->output_row($lang->orig_user_group." <em>*</em>", $lang->orig_user_group_desc, $form->generate_select_box('originalusergroup[]', $options, $mybb->input['originalusergroup'], array('id' => 'originalusergroup', 'multiple' => true, 'size' => 5)), 'originalusergroup');

unset($options['*']);

	$form_container->output_row($lang->orig_user_group." <em>*</em>", $lang->orig_user_group_desc, $form->generate_select_box('originalusergroup[]', $options, $mybb->input['originalusergroup'], array('id' => 'originalusergroup', 'multiple' => true, 'size' => 5)), 'originalusergroup');

unset($options['*']);

Zeile 514Zeile 533
		'secondary' => $lang->secondary_user_group
);


		'secondary' => $lang->secondary_user_group
);


	$form_container->output_row($lang->user_group_change_type." <em>*</em>", $lang->user_group_change_type_desc, $form->generate_select_box('usergroupchangetype', $options, $mybb->input['usergroupchangetype'], array('id' => 'usergroupchangetype')), 'usergroupchangetype');


	$form_container->output_row($lang->user_group_change_type." <em>*</em>", $lang->user_group_change_type_desc, $form->generate_select_box('usergroupchangetype', $options, $mybb->input['usergroupchangetype'], array('id' => 'usergroupchangetype')), 'usergroupchangetype');


	$form_container->output_row($lang->enabled." <em>*</em>", "", $form->generate_yes_no_radio("enabled", $mybb->input['enabled'], true));

$form_container->output_row($lang->enable_logging." <em>*</em>", "", $form->generate_yes_no_radio("logging", $mybb->input['logging'], true));
$form_container->end();

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

	$form_container->output_row($lang->enabled." <em>*</em>", "", $form->generate_yes_no_radio("enabled", $mybb->input['enabled'], true));

$form_container->output_row($lang->enable_logging." <em>*</em>", "", $form->generate_yes_no_radio("logging", $mybb->input['logging'], true));
$form_container->end();

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





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

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





	$page->output_footer();
}

if($mybb->input['action'] == "logs")
{
$plugins->run_hooks("admin_user_group_promotions_logs");

	$page->output_footer();
}

if($mybb->input['action'] == "logs")
{
$plugins->run_hooks("admin_user_group_promotions_logs");

	

	

	if($mybb->input['page'] && $mybb->input['page'] > 1)
{
$mybb->input['page'] = intval($mybb->input['page']);

	if($mybb->input['page'] && $mybb->input['page'] > 1)
{
$mybb->input['page'] = intval($mybb->input['page']);

Zeile 570Zeile 589
		if($log['type'] == "secondary" || (!empty($log['oldusergroup']) && strstr(",", $log['oldusergroup'])))
{
$log['oldusergroup'] = "<i>".$lang->multiple_usergroups."</i>";

		if($log['type'] == "secondary" || (!empty($log['oldusergroup']) && strstr(",", $log['oldusergroup'])))
{
$log['oldusergroup'] = "<i>".$lang->multiple_usergroups."</i>";

			$log['newusergroup'] = htmlspecialchars_uni($groupscache[$log['newusergroup']]['title']);

			$log['newusergroup'] = htmlspecialchars_uni($groupscache[$log['newusergroup']]['title']);

		}
else
{

		}
else
{

Zeile 579Zeile 598
		}

if($log['type'] == "secondary")

		}

if($log['type'] == "secondary")

		{

		{

			$log['type'] = $lang->secondary;
}
else

			$log['type'] = $lang->secondary;
}
else

Zeile 606Zeile 625
	
$query = $db->simple_select("promotionlogs", "COUNT(plid) as promotionlogs");
$total_rows = $db->fetch_field($query, "promotionlogs");

	
$query = $db->simple_select("promotionlogs", "COUNT(plid) as promotionlogs");
$total_rows = $db->fetch_field($query, "promotionlogs");

	
echo "<br />".draw_admin_pagination($mybb->input['page'], "20", $total_rows, "index.php?module=user-group_promotions&amp;action=logs&amp;page={page}");


	
echo "<br />".draw_admin_pagination($mybb->input['page'], "20", $total_rows, "index.php?module=user-group_promotions&amp;action=logs&amp;page={page}");


	$page->output_footer();
}


	$page->output_footer();
}


Zeile 617Zeile 636
	$plugins->run_hooks("admin_user_group_promotions_start");

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

	$plugins->run_hooks("admin_user_group_promotions_start");

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

	

	

	$page->output_nav_tabs($sub_tabs, 'usergroup_promotions');

	$page->output_nav_tabs($sub_tabs, 'usergroup_promotions');





	$table = new Table;
$table->construct_header($lang->promotion);
$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));

$query = $db->simple_select("promotions", "*", "", array("order_by" => "title", "order_dir" => "asc"));
while($promotion = $db->fetch_array($query))

	$table = new Table;
$table->construct_header($lang->promotion);
$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150));

$query = $db->simple_select("promotions", "*", "", array("order_by" => "title", "order_dir" => "asc"));
while($promotion = $db->fetch_array($query))

	{

	{

		$promotion['title'] = htmlspecialchars_uni($promotion['title']);
$promotion['description'] = htmlspecialchars_uni($promotion['description']);
$table->construct_cell("<div><strong><a href=\"index.php?module=user-group_promotions&amp;action=edit&amp;pid={$promotion['pid']}\">{$promotion['title']}</a></strong><br /><small>{$promotion['description']}</small></div>");

		$promotion['title'] = htmlspecialchars_uni($promotion['title']);
$promotion['description'] = htmlspecialchars_uni($promotion['description']);
$table->construct_cell("<div><strong><a href=\"index.php?module=user-group_promotions&amp;action=edit&amp;pid={$promotion['pid']}\">{$promotion['title']}</a></strong><br /><small>{$promotion['description']}</small></div>");

Zeile 635Zeile 654
		$popup->add_item($lang->edit_promotion, "index.php?module=user-group_promotions&amp;action=edit&amp;pid={$promotion['pid']}");
if($promotion['enabled'] == 1)
{

		$popup->add_item($lang->edit_promotion, "index.php?module=user-group_promotions&amp;action=edit&amp;pid={$promotion['pid']}");
if($promotion['enabled'] == 1)
{

			$popup->add_item($lang->disable_promotion, "index.php?module=user-group_promotions&amp;action=disable&amp;pid={$promotion['pid']}");

			$popup->add_item($lang->disable_promotion, "index.php?module=user-group_promotions&amp;action=disable&amp;pid={$promotion['pid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_promo_disable}')");

		}
else
{

		}
else
{

			$popup->add_item($lang->enable_promotion, "index.php?module=user-group_promotions&amp;action=enable&amp;pid={$promotion['pid']}");

			$popup->add_item($lang->enable_promotion, "index.php?module=user-group_promotions&amp;action=enable&amp;pid={$promotion['pid']}&amp;my_post_key={$mybb->post_code}");

		}
$popup->add_item($lang->delete_promotion, "index.php?module=user-group_promotions&amp;action=delete&amp;pid={$promotion['pid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_promo_deletion}')");
$table->construct_cell($popup->fetch(), array("class" => "align_center"));

		}
$popup->add_item($lang->delete_promotion, "index.php?module=user-group_promotions&amp;action=delete&amp;pid={$promotion['pid']}&amp;my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_promo_deletion}')");
$table->construct_cell($popup->fetch(), array("class" => "align_center"));

Zeile 656Zeile 675
	
$page->output_footer();
}

	
$page->output_footer();
}



 
?>

?>