mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-11 10:05:19 +02:00
Username Disallow Admin...
git-svn-id: file:///svn/phpbb/trunk@1210 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
8d3b31d59c
commit
265cabc30e
131
phpBB/admin/admin_disallow.php
Normal file
131
phpBB/admin/admin_disallow.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/***************************************************************************
|
||||
* admin_disallow.php
|
||||
* -------------------
|
||||
* begin : Tuesday, Oct 05, 2001
|
||||
* copyright : (C) 2001 The phpBB Group
|
||||
* email : support@phpbb.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
if($setmodules == 1)
|
||||
{
|
||||
$filename = basename(__FILE__);
|
||||
$module['Users']['Disallow'] = $filename;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Include required files, get $phpEx and check permissions
|
||||
//
|
||||
$phpbb_root_dir = "./../";
|
||||
require('pagestart.inc');
|
||||
|
||||
//
|
||||
// Check to see what mode we shold operate in.
|
||||
//
|
||||
if( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
|
||||
{
|
||||
$mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$mode = "";
|
||||
}
|
||||
$output_info = '';
|
||||
switch( $mode )
|
||||
{
|
||||
case $lang['Delete']:
|
||||
$disallowed_id = ( isset($HTTP_POST_VARS['disallowed_id']) ) ? intval( $HTTP_POST_VARS['disallowed_id'] ) : intval( $HTTP_GET_VARS['disallowed_id'] );
|
||||
|
||||
$sql = 'DELETE FROM '.DISALLOW_TABLE.' WHERE disallow_id = '.$disallowed_id;
|
||||
$result = $db->sql_query($sql);
|
||||
if( !$result )
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Couldn't removed disallowed user.", "",__LINE__, __FILE__, $sql);
|
||||
}
|
||||
$output_info = $lang['disallowed_deleted'];
|
||||
break;
|
||||
case $lang['Add']:
|
||||
$disallowed_user = ( isset($HTTP_POST_VARS['disallowed_user']) ) ? $HTTP_POST_VARS['disallowed_user'] : $HTTP_GET_VARS['disallowed_user'];
|
||||
$disallowed_user = preg_replace( '/\*/', '%', $disallowed_user );
|
||||
if( !validate_username( $disallowed_user ) )
|
||||
{
|
||||
$output_info = $lang['disallowed_already'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = 'INSERT INTO '.DISALLOW_TABLE."(disallow_username) VALUES('".$disallowed_user."')";
|
||||
$result = $db->sql_query( $sql );
|
||||
if ( !$result )
|
||||
{
|
||||
message_die(GENERAL_ERROR, "Could not add disallowed user.", "",__LINE__, __FILE__, $sql);
|
||||
}
|
||||
$output_info = $lang['disallow_successful'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Grab the current list of disallowed usernames...
|
||||
//
|
||||
$sql = 'SELECT * FROM '.DISALLOW_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
if( !$result )
|
||||
{
|
||||
message_die( GENERAL_ERROR, "Couldn't get disallowed users.", "", __LINE__, __FILE__, $sql );
|
||||
}
|
||||
$disallowed = $db->sql_fetchrowset($result);
|
||||
|
||||
//
|
||||
// Ok now generate the info for the template, which will be put out no matter
|
||||
// what mode we are in.
|
||||
//
|
||||
$disallow_select = "<SELECT NAME=\"disallowed_id\">";
|
||||
if ( trim($disallowed) == '' )
|
||||
{
|
||||
$disallow_select .= '<option value="">'.$lang['no_disallowed'].'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$disallow_select .= "<OPTION value=\"\">".$lang['Select'].' '.$lang['Username']."</OPTION>";
|
||||
$user = array();
|
||||
for( $i = 0; $i < count($disallowed); $i++ )
|
||||
{
|
||||
$disallowed[$i]['disallow_username'] = preg_replace( '/%/', '*', $disallowed[$i]['disallow_username']);
|
||||
$disallow_select .= '<option value="'.$disallowed[$i]['disallow_id'].'">'.$disallowed[$i]['disallow_username'].'</option>';
|
||||
}
|
||||
}
|
||||
$disallow_select .= '</SELECT>';
|
||||
$template->set_filenames(array(
|
||||
"body" => "admin/disallow_body.tpl")
|
||||
);
|
||||
$template->assign_vars(array(
|
||||
"S_DISALLOW_SELECT" => $disallow_select,
|
||||
"L_INFO" => $output_info,
|
||||
"L_DISALLOW_TITLE" => $lang['Disallow_control'],
|
||||
"L_DELETE" => $lang['Delete'],
|
||||
"L_ADD" => $lang['Add'],
|
||||
"L_RESET" => $lang['Reset'],
|
||||
"S_FORM_ACTION" => 'admin_disallow.php',
|
||||
"L_EXPLAIN" => $lang['disallow_instructs'],
|
||||
"L_DEL_DISALLOW" => $lang['del_disallow'],
|
||||
"L_DEL_EXPLAIN" => $lang['del_disallow_explain'],
|
||||
"L_ADD_DISALLOW" => $lang['add_disallow'],
|
||||
"L_ADD_EXPLAIN" => $lang['add_disallow_explain'],
|
||||
"L_USERNAME" => $lang['Username'])
|
||||
);
|
||||
$template->pparse("body");
|
||||
?>
|
@ -486,7 +486,7 @@ function validate_username($username)
|
||||
OR LOWER(g.group_name) = '" . strtolower($username) . "' )";
|
||||
$sql_disallow = "SELECT disallow_username
|
||||
FROM " . DISALLOW_TABLE . "
|
||||
WHERE disallow_username = '$username'";
|
||||
WHERE '$username' LIKE disallow_username";
|
||||
if($result = $db->sql_query($sql_users))
|
||||
{
|
||||
if($db->sql_numrows($result) > 0)
|
||||
@ -513,7 +513,7 @@ function validate_username($username)
|
||||
UNION
|
||||
SELECT disallow_username, NULL
|
||||
FROM " . DISALLOW_TABLE . "
|
||||
WHERE disallow_username = '$username'";
|
||||
WHERE '$username' LIKE disallow_username";
|
||||
if($result = $db->sql_query($sql))
|
||||
{
|
||||
if($db->sql_numrows($result) > 0)
|
||||
@ -1207,4 +1207,4 @@ function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "",
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
@ -139,7 +139,7 @@ $lang['None'] = "None";
|
||||
$lang['online'] = "online";
|
||||
|
||||
$lang['You_last_visit'] = "You last visited on";
|
||||
|
||||
$lang['Add'] = "Add";
|
||||
$lang['Welcome_to'] = "Welcome to"; // Followed by site name
|
||||
$lang['Register'] = "Register";
|
||||
$lang['Profile'] = "Profile";
|
||||
@ -1096,8 +1096,22 @@ $lang['Rank_image'] = "Rank Image";
|
||||
$lang['Rank_image_explain'] = "This is the place to set a custom image for everyone in the rank. You can specify either a relative or absolute path to the image";
|
||||
$lang['return_rank_admin'] = "to return to rank admin";
|
||||
|
||||
//
|
||||
// Disallow Username Admin
|
||||
//
|
||||
$lang['disallowed_deleted'] = "The disallowed username has successfully been removed";
|
||||
$lang['disallowed_already'] = "The username you are trying to disallow has already been disallowed, or a user currently exists that this would disallow";
|
||||
$lang['disallow_successful'] = "The disallowed username has successfully been added";
|
||||
$lang['Disallow_control'] = "Username Disallow Control";
|
||||
$lang['disallow_instructs'] = "Here you can control usernames which will not be allowed to be used. Disallowed usernames are allowed to contain a wildcard character of '*'. Please note that you will not be allowed to specify a username to disallow if that username has already been registered. You must first delete that username, and then disallow it.";
|
||||
$lang['del_disallow'] = "Remove a Disallowed Username";
|
||||
$lang['del_disallow_explain'] = "You can remove a disallowed username by selecting the username from this list and clicking submit";
|
||||
$lang['add_disallow'] = "Add a disallowed username";
|
||||
$lang['add_disallow_explain'] = "You can disallow a username using the wildcard character '*' to match any character";
|
||||
$lang['no_disallowed'] = "No Disallowed Usernames";
|
||||
|
||||
//
|
||||
// That's all Folks!
|
||||
// -------------------------------------------------
|
||||
|
||||
?>
|
||||
?>
|
||||
|
30
phpBB/templates/PSO/admin/disallow_body.tpl
Normal file
30
phpBB/templates/PSO/admin/disallow_body.tpl
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
<br clear="all" />
|
||||
|
||||
<h1>{L_DISALLOW_TITLE}</h1>
|
||||
|
||||
<p>{L_EXPLAIN_EXPLAIN}</p>
|
||||
|
||||
<form method="post" action="{S_FORM_ACTION}"><table width="80%" cellspacing="1" cellpadding="4" border="0" align="center">
|
||||
<tr>
|
||||
<td class="cat" colspan="2" align="center">{L_DEL_DISALLOW}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1">{L_USERNAME}: <br /><span class="gensmall">{L_DEL_EXPLAIN}</span></td>
|
||||
<td class="row2">{S_DISALLOW_SELECT} &nbps;<input type="submit" name="mode" value="{L_DELETE}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cat" colspan="2" align="center">{L_ADD_DISALLOW}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1">{L_USERNAME}: <br /><span class="gensmall">{L_ADD_EXPLAIN}</span></td>
|
||||
<td class="row2"><input type="text" name="disallowed_user" size="35" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="cat" colspan="2" align="center"><input type="submit" name="mode" value="{L_ADD}" /> <input type="reset" value="{L_RESET}" /></td>
|
||||
</tr>
|
||||
</table></form>
|
||||
|
||||
<p>{L_INFO}</p>
|
||||
|
||||
<br clear="all" />
|
33
phpBB/templates/subSilver/admin/disallow_body.tpl
Normal file
33
phpBB/templates/subSilver/admin/disallow_body.tpl
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
<h1>{L_DISALLOW_TITLE}</h1>
|
||||
<p>{L_EXPLAIN}</p>
|
||||
|
||||
<form method="post" action="{S_FORM_ACTION}"><table width="80%" cellspacing="1" cellpadding="4" border="0" align="center" class="forumline">
|
||||
<tr>
|
||||
<th class="thHead" colspan="2">{L_DEL_DISALLOW}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1">{L_USERNAME}: <br />
|
||||
<span class="gensmall">{L_DEL_EXPLAIN}</span></td>
|
||||
<td class="row2">{S_DISALLOW_SELECT} <input type="submit" name="mode" value="{L_DELETE}" class="liteoption" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="thHead" colspan="2">{L_ADD_DISALLOW}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1">{L_USERNAME}: <br />
|
||||
<span class="gensmall">{L_ADD_EXPLAIN}></td>
|
||||
<td class="row2">
|
||||
<input type="text" name="disallowed_user" size="35" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="catBottom" colspan="2" align="center">
|
||||
<input type="submit" name="mode" value="{L_ADD}" class="mainoption" />
|
||||
|
||||
<input type="reset" value="{L_RESET}" class="liteoption" />
|
||||
</td>
|
||||
</tr>
|
||||
</table></form>
|
||||
|
||||
<p>{L_INFO}</p>
|
Loading…
x
Reference in New Issue
Block a user