[ Index ]

PHP Cross Reference of phpBB 3.0 Beta 3

title

Body

[close]

/includes/mcp/ -> mcp_ban.php (source)

   1  <?php
   2  /** 
   3  *
   4  * @package mcp
   5  * @version $Id: mcp_ban.php,v 1.7 2006/06/16 23:20:32 acydburn Exp $
   6  * @copyright (c) 2005 phpBB Group 
   7  * @license http://opensource.org/licenses/gpl-license.php GNU Public License 
   8  *
   9  */
  10  
  11  /**
  12  * @package mcp
  13  */
  14  class mcp_ban
  15  {
  16      var $u_action;
  17  
  18  	function main($id, $mode)
  19      {
  20          global $config, $db, $user, $auth, $template, $cache;
  21          global $phpbb_root_path, $phpEx;
  22  
  23          include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
  24  
  25          // Include the admin banning interface...
  26          include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx);
  27  
  28          $bansubmit        = (isset($_POST['bansubmit'])) ? true : false;
  29          $unbansubmit    = (isset($_POST['unbansubmit'])) ? true : false;
  30          $current_time    = time();
  31  
  32          $user->add_lang('acp/ban');
  33          $this->tpl_name = 'mcp_ban';
  34  
  35          // Ban submitted?
  36          if ($bansubmit)
  37          {
  38              // Grab the list of entries
  39              $ban                = request_var('ban', '');
  40              $ban_len            = request_var('banlength', 0);
  41              $ban_len_other        = request_var('banlengthother', '');
  42              $ban_exclude        = request_var('banexclude', 0);
  43              $ban_reason            = request_var('banreason', '', true);
  44              $ban_give_reason    = request_var('bangivereason', '', true);
  45  
  46              user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason);
  47  
  48              trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>');
  49          }
  50          else if ($unbansubmit)
  51          {
  52              $ban = request_var('unban', array(''));
  53  
  54              user_unban($mode, $ban);
  55  
  56              trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>');
  57          }
  58  
  59          // Ban length options
  60          $ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['UNTIL'] . ' -&gt; ');
  61  
  62          $ban_end_options = '';
  63          foreach ($ban_end_text as $length => $text)
  64          {
  65              $ban_end_options .= '<option value="' . $length . '">' . $text . '</option>';
  66          }
  67  
  68          // Define language vars
  69          $this->page_title = $user->lang[strtoupper($mode) . '_BAN'];
  70  
  71          $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN'];
  72          $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN'];
  73          $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN'];
  74          $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN'];
  75          $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED'];
  76  
  77          switch ($mode)
  78          {
  79              case 'user':
  80                  $l_ban_cell = $user->lang['USERNAME'];
  81              break;
  82  
  83              case 'ip':
  84                  $l_ban_cell = $user->lang['IP_HOSTNAME'];
  85              break;
  86  
  87              case 'email':
  88                  $l_ban_cell = $user->lang['EMAIL_ADDRESS'];
  89              break;
  90          }
  91  
  92          acp_ban::display_ban_options($mode);
  93  
  94          $template->assign_vars(array(
  95              'L_TITLE'                => $this->page_title,
  96              'L_EXPLAIN'                => $l_ban_explain,
  97              'L_UNBAN_TITLE'            => $l_unban_title,
  98              'L_UNBAN_EXPLAIN'        => $l_unban_explain,
  99              'L_BAN_CELL'            => $l_ban_cell,
 100              'L_BAN_EXCLUDE_EXPLAIN'    => $l_ban_exclude_explain,
 101              'L_NO_BAN_CELL'            => $l_no_ban_cell,
 102  
 103              'S_USERNAME_BAN'    => ($mode == 'user') ? true : false,
 104  
 105              'U_ACTION'            => $this->u_action,
 106              'U_FIND_USER'        => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&amp;form=mcp_ban&amp;field=ban'),
 107              )
 108          );
 109      }
 110  }
 111  
 112  ?>


Generated: Wed Nov 22 00:35:05 2006 Cross-referenced by PHPXref 0.6