[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 14 /** 15 * @ignore 16 */ 17 if (!defined('IN_PHPBB')) 18 { 19 exit; 20 } 21 22 class acp_disallow 23 { 24 var $u_action; 25 26 function main($id, $mode) 27 { 28 global $db, $user, $template, $cache, $phpbb_log, $request; 29 30 $user->add_lang('acp/posting'); 31 32 // Set up general vars 33 $this->tpl_name = 'acp_disallow'; 34 $this->page_title = 'ACP_DISALLOW_USERNAMES'; 35 36 $form_key = 'acp_disallow'; 37 add_form_key($form_key); 38 39 $disallow = (isset($_POST['disallow'])) ? true : false; 40 $allow = (isset($_POST['allow'])) ? true : false; 41 42 if (($allow || $disallow) && !check_form_key($form_key)) 43 { 44 trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); 45 } 46 47 if ($disallow) 48 { 49 $disallowed_user = str_replace('*', '%', $request->variable('disallowed_user', '', true)); 50 51 if (!$disallowed_user) 52 { 53 trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); 54 } 55 56 $sql = 'SELECT disallow_id 57 FROM ' . DISALLOW_TABLE . " 58 WHERE disallow_username = '" . $db->sql_escape($disallowed_user) . "'"; 59 $result = $db->sql_query($sql); 60 $row = $db->sql_fetchrow($result); 61 $db->sql_freeresult($result); 62 63 if ($row) 64 { 65 trigger_error($user->lang['DISALLOWED_ALREADY'] . adm_back_link($this->u_action), E_USER_WARNING); 66 } 67 68 $sql = 'INSERT INTO ' . DISALLOW_TABLE . ' ' . $db->sql_build_array('INSERT', array('disallow_username' => $disallowed_user)); 69 $db->sql_query($sql); 70 71 $cache->destroy('_disallowed_usernames'); 72 73 $message = $user->lang['DISALLOW_SUCCESSFUL']; 74 $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DISALLOW_ADD', false, array(str_replace('%', '*', $disallowed_user))); 75 76 trigger_error($message . adm_back_link($this->u_action)); 77 } 78 else if ($allow) 79 { 80 $disallowed_id = $request->variable('disallowed_id', 0); 81 82 if (!$disallowed_id) 83 { 84 trigger_error($user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); 85 } 86 87 $sql = 'DELETE FROM ' . DISALLOW_TABLE . ' 88 WHERE disallow_id = ' . $disallowed_id; 89 $db->sql_query($sql); 90 91 $cache->destroy('_disallowed_usernames'); 92 93 $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DISALLOW_DELETE'); 94 95 trigger_error($user->lang['DISALLOWED_DELETED'] . adm_back_link($this->u_action)); 96 } 97 98 // Grab the current list of disallowed usernames... 99 $sql = 'SELECT * 100 FROM ' . DISALLOW_TABLE; 101 $result = $db->sql_query($sql); 102 103 $disallow_select = ''; 104 while ($row = $db->sql_fetchrow($result)) 105 { 106 $disallow_select .= '<option value="' . $row['disallow_id'] . '">' . str_replace('%', '*', $row['disallow_username']) . '</option>'; 107 } 108 $db->sql_freeresult($result); 109 110 $template->assign_vars(array( 111 'U_ACTION' => $this->u_action, 112 'S_DISALLOWED_NAMES' => $disallow_select) 113 ); 114 } 115 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |