5
* @version $Id: acp_disallow.php,v 1.15 2007/10/05 14:36:32 acydburn Exp $
6
* @copyright (c) 2005 phpBB Group
7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
14
if (!defined('IN_PHPBB'))
26
function main($id, $mode)
28
global $db, $user, $auth, $template, $cache;
29
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
31
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
33
$user->add_lang('acp/posting');
35
// Set up general vars
36
$this->tpl_name = 'acp_disallow';
37
$this->page_title = 'ACP_DISALLOW_USERNAMES';
39
$form_key = 'acp_disallow';
40
add_form_key($form_key);
42
$disallow = (isset($_POST['disallow'])) ? true : false;
43
$allow = (isset($_POST['allow'])) ? true : false;
45
if (($allow || $disallow) && !check_form_key($form_key))
47
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
52
$disallowed_user = str_replace('*', '%', utf8_normalize_nfc(request_var('disallowed_user', '', true)));
54
if (!$disallowed_user)
56
trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
59
$sql = 'INSERT INTO ' . DISALLOW_TABLE . ' ' . $db->sql_build_array('INSERT', array('disallow_username' => $disallowed_user));
62
$cache->destroy('_disallowed_usernames');
64
$message = $user->lang['DISALLOW_SUCCESSFUL'];
65
add_log('admin', 'LOG_DISALLOW_ADD', str_replace('%', '*', $disallowed_user));
67
trigger_error($message . adm_back_link($this->u_action));
71
$disallowed_id = request_var('disallowed_id', 0);
75
trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING);
78
$sql = 'DELETE FROM ' . DISALLOW_TABLE . '
79
WHERE disallow_id = ' . $disallowed_id;
82
$cache->destroy('_disallowed_usernames');
84
add_log('admin', 'LOG_DISALLOW_DELETE');
86
trigger_error($user->lang['DISALLOWED_DELETED'] . adm_back_link($this->u_action));
89
// Grab the current list of disallowed usernames...
91
FROM ' . DISALLOW_TABLE;
92
$result = $db->sql_query($sql);
94
$disallow_select = '';
95
while ($row = $db->sql_fetchrow($result))
97
$disallow_select .= '<option value="' . $row['disallow_id'] . '">' . str_replace('%', '*', $row['disallow_username']) . '</option>';
99
$db->sql_freeresult($result);
101
$template->assign_vars(array(
102
'U_ACTION' => $this->u_action,
103
'S_DISALLOWED_NAMES' => $disallow_select)
b'\\ No newline at end of file'