Zeile 1 | Zeile 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 5297 2010-12-28 22:01:14Z Tomm $
| * $Id$
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 40 | Zeile 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") { $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"); } else { $page->output_confirm_action("index.php?module=user-group_promotions&action=disable&pid={$promotion['pid']}", $lang->confirm_promo_disable); }
|
}
if($mybb->input['action'] == "delete")
|
}
if($mybb->input['action'] == "delete")
|
{
| {
|
$plugins->run_hooks("admin_user_group_promotions_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 91 | Zeile 104 |
---|
if(!$promotion['pid']) { flash_message($lang->error_invalid_promo_id, 'error');
|
if(!$promotion['pid']) { flash_message($lang->error_invalid_promo_id, 'error');
|
admin_redirect("index.php?module=user-group_promotions"); }
| admin_redirect("index.php?module=user-group_promotions"); }
|
if($mybb->request_method == "post") {
| if($mybb->request_method == "post") {
|
Zeile 115 | Zeile 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( "enabled" => 1 );
|
$promotion = array( "enabled" => 1 );
|
$db->update_query("promotions", $promotion, "pid = '{$mybb->input['pid']}'");
| $db->update_query("promotions", $promotion, "pid = '{$mybb->input['pid']}'");
|
$plugins->run_hooks("admin_user_group_promotions_enable_commit");
// Log admin action
| $plugins->run_hooks("admin_user_group_promotions_enable_commit");
// Log admin action
|
Zeile 149 | Zeile 168 |
---|
if($mybb->input['action'] == "edit") { $plugins->run_hooks("admin_user_group_promotions_edit");
|
if($mybb->input['action'] == "edit") { $plugins->run_hooks("admin_user_group_promotions_edit");
|
|
|
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');
|
Zeile 163 | Zeile 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($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(!$errors) { if(in_array('*', $mybb->input['originalusergroup']))
|
Zeile 349 | Zeile 368 |
---|
if($mybb->input['action'] == "add") { $plugins->run_hooks("admin_user_group_promotions_add");
|
if($mybb->input['action'] == "add") { $plugins->run_hooks("admin_user_group_promotions_add");
|
|
|
if($mybb->request_method == "post") { if(!trim($mybb->input['title']))
| if($mybb->request_method == "post") { if(!trim($mybb->input['title']))
|
Zeile 368 | Zeile 387 |
---|
}
if(empty($mybb->input['originalusergroup']))
|
}
if(empty($mybb->input['originalusergroup']))
|
{
| {
|
$errors[] = $lang->error_no_orig_usergroup;
|
$errors[] = $lang->error_no_orig_usergroup;
|
}
| }
|
if(!trim($mybb->input['newusergroup'])) { $errors[] = $lang->error_no_new_usergroup; } if(!trim($mybb->input['usergroupchangetype']))
|
if(!trim($mybb->input['newusergroup'])) { $errors[] = $lang->error_no_new_usergroup; } if(!trim($mybb->input['usergroupchangetype']))
|
{
| {
|
$errors[] = $lang->error_no_usergroup_change_type; }
| $errors[] = $lang->error_no_usergroup_change_type; }
|
Zeile 387 | Zeile 406 |
---|
if(in_array('*', $mybb->input['originalusergroup'])) { $mybb->input['originalusergroup'] = '*';
|
if(in_array('*', $mybb->input['originalusergroup'])) { $mybb->input['originalusergroup'] = '*';
|
}
| }
|
else { $mybb->input['originalusergroup'] = implode(',', array_map('intval', $mybb->input['originalusergroup']));
| else { $mybb->input['originalusergroup'] = implode(',', array_map('intval', $mybb->input['originalusergroup']));
|
Zeile 425 | Zeile 444 |
---|
} $page->add_breadcrumb_item($lang->add_new_promotion); $page->output_header($lang->user_group_promotions." - ".$lang->add_new_promotion);
|
} $page->add_breadcrumb_item($lang->add_new_promotion); $page->output_header($lang->user_group_promotions." - ".$lang->add_new_promotion);
|
|
|
$sub_tabs['usergroup_promotions'] = array( 'title' => $lang->user_group_promotions, 'link' => "index.php?module=user-group_promotions"
| $sub_tabs['usergroup_promotions'] = array( 'title' => $lang->user_group_promotions, 'link' => "index.php?module=user-group_promotions"
|
Zeile 435 | Zeile 454 |
---|
'title' => $lang->add_new_promotion, 'link' => "index.php?module=user-group_promotions&action=add", 'description' => $lang->add_new_promotion_desc
|
'title' => $lang->add_new_promotion, 'link' => "index.php?module=user-group_promotions&action=add", 'description' => $lang->add_new_promotion_desc
|
);
| );
|
$sub_tabs['promotion_logs'] = array( 'title' => $lang->view_promotion_logs,
| $sub_tabs['promotion_logs'] = array( 'title' => $lang->view_promotion_logs,
|
Zeile 445 | Zeile 464 |
---|
$page->output_nav_tabs($sub_tabs, 'add_promotion'); $form = new Form("index.php?module=user-group_promotions&action=add", "post", "add"); if($errors)
|
$page->output_nav_tabs($sub_tabs, 'add_promotion'); $form = new Form("index.php?module=user-group_promotions&action=add", "post", "add"); if($errors)
|
{
| {
|
$page->output_inline_error($errors); } else
| $page->output_inline_error($errors); } else
|
Zeile 464 | Zeile 483 |
---|
$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->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');
|
$options = array(
| $options = array(
|
"postcount" => $lang->post_count, "reputation" => $lang->reputation, "referrals" => $lang->referrals,
| "postcount" => $lang->post_count, "reputation" => $lang->reputation, "referrals" => $lang->referrals,
|
Zeile 502 | Zeile 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');
| $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');
|
Zeile 635 | Zeile 654 |
---|
$popup->add_item($lang->edit_promotion, "index.php?module=user-group_promotions&action=edit&pid={$promotion['pid']}"); if($promotion['enabled'] == 1) {
|
$popup->add_item($lang->edit_promotion, "index.php?module=user-group_promotions&action=edit&pid={$promotion['pid']}"); if($promotion['enabled'] == 1) {
|
$popup->add_item($lang->disable_promotion, "index.php?module=user-group_promotions&action=disable&pid={$promotion['pid']}");
| $popup->add_item($lang->disable_promotion, "index.php?module=user-group_promotions&action=disable&pid={$promotion['pid']}&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&action=enable&pid={$promotion['pid']}");
| $popup->add_item($lang->enable_promotion, "index.php?module=user-group_promotions&action=enable&pid={$promotion['pid']}&my_post_key={$mybb->post_code}");
|
} $popup->add_item($lang->delete_promotion, "index.php?module=user-group_promotions&action=delete&pid={$promotion['pid']}&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&action=delete&pid={$promotion['pid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_promo_deletion}')"); $table->construct_cell($popup->fetch(), array("class" => "align_center"));
|
Zeile 656 | Zeile 675 |
---|
$page->output_footer(); }
|
$page->output_footer(); }
|
| |
?>
| ?>
|