~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/php/phpBB3/includes/acp/acp_disallow.php

  • Committer: dcoles
  • Date: 2008-02-13 04:10:55 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:443
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0

Show diffs side-by-side

added added

removed removed

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