[ Index ]

PHP Cross Reference of phpBB 3.0 Beta 3

title

Body

[close]

/includes/acp/ -> acp_disallow.php (source)

   1  <?php
   2  /** 
   3  *
   4  * @package acp
   5  * @version $Id: acp_disallow.php,v 1.9 2006/11/12 15:17:46 davidmj 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 acp
  13  */
  14  class acp_disallow
  15  {
  16      var $u_action;
  17  
  18  	function main($id, $mode)
  19      {
  20          global $db, $user, $auth, $template, $cache;
  21          global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
  22  
  23          include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
  24  
  25          $user->add_lang('acp/posting');
  26  
  27          // Set up general vars
  28          $this->tpl_name = 'acp_disallow';
  29          $this->page_header = 'ACP_DISALLOW_USERNAMES';
  30  
  31          $disallow = (isset($_POST['disallow'])) ? true : false;
  32          $allow = (isset($_POST['allow'])) ? true : false;
  33  
  34          if ($disallow)
  35          {
  36              $disallowed_user = str_replace('*', '%', request_var('disallowed_user', '', true));
  37  
  38              if (!$disallowed_user)
  39              {
  40                  trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
  41              }
  42  
  43              $sql = 'INSERT INTO ' . DISALLOW_TABLE . ' ' . $db->sql_build_array('INSERT', array('disallow_username' => $disallowed_user));
  44              $db->sql_query($sql);
  45  
  46              $cache->destroy('disallowed_usernames');
  47  
  48              $message = $user->lang['DISALLOW_SUCCESSFUL'];
  49              add_log('admin', 'LOG_DISALLOW_ADD', str_replace('%', '*', $disallowed_user));
  50  
  51              trigger_error($message . adm_back_link($this->u_action));
  52          }
  53          else if ($allow)
  54          {
  55              $disallowed_id = request_var('disallowed_id', 0);
  56  
  57              if (!$disallowed_id)
  58              {
  59                  trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
  60              }
  61  
  62              $sql = 'DELETE FROM ' . DISALLOW_TABLE . '
  63                  WHERE disallow_id = ' . $disallowed_id;
  64              $db->sql_query($sql);
  65  
  66              $cache->destroy('disallowed_usernames');
  67  
  68              add_log('admin', 'LOG_DISALLOW_DELETE');
  69  
  70              trigger_error($user->lang['DISALLOWED_DELETED'] . adm_back_link($this->u_action), E_USER_WARNING);
  71          }
  72  
  73          // Grab the current list of disallowed usernames...
  74          $sql = 'SELECT *
  75              FROM ' . DISALLOW_TABLE;
  76          $result = $db->sql_query($sql);
  77  
  78          $disallow_select = '';
  79          while ($row = $db->sql_fetchrow($result))
  80          {
  81              $disallow_select .= '<option value="' . $row['disallow_id'] . '">' . str_replace('%', '*', $row['disallow_username']) . '</option>';
  82          }
  83          $db->sql_freeresult($result);
  84  
  85          $template->assign_vars(array(
  86              'U_ACTION'                => $this->u_action,
  87              'S_DISALLOWED_NAMES'    => $disallow_select)
  88          );
  89      }
  90  }
  91  
  92  ?>


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