aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthe_systech <the_systech@users.sourceforge.net>2001-10-15 20:15:46 +0000
committerthe_systech <the_systech@users.sourceforge.net>2001-10-15 20:15:46 +0000
commit265cabc30e6b1f708c60bc283d4fb087b17f164b (patch)
treee8d7e61fb21fbad00f99f0971b97d66681696691
parent8d3b31d59c147cfd2628f9e35cc02357dedb5c87 (diff)
downloadforums-265cabc30e6b1f708c60bc283d4fb087b17f164b.tar
forums-265cabc30e6b1f708c60bc283d4fb087b17f164b.tar.gz
forums-265cabc30e6b1f708c60bc283d4fb087b17f164b.tar.bz2
forums-265cabc30e6b1f708c60bc283d4fb087b17f164b.tar.xz
forums-265cabc30e6b1f708c60bc283d4fb087b17f164b.zip
Username Disallow Admin...
git-svn-id: file:///svn/phpbb/trunk@1210 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/admin/admin_disallow.php131
-rw-r--r--phpBB/includes/functions.php6
-rw-r--r--phpBB/language/lang_english/lang_main.php18
-rw-r--r--phpBB/templates/PSO/admin/disallow_body.tpl30
-rw-r--r--phpBB/templates/subSilver/admin/disallow_body.tpl33
5 files changed, 213 insertions, 5 deletions
diff --git a/phpBB/admin/admin_disallow.php b/phpBB/admin/admin_disallow.php
new file mode 100644
index 0000000000..b52ee9e769
--- /dev/null
+++ b/phpBB/admin/admin_disallow.php
@@ -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");
+?>
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 0723bbae58..a6c34a4345 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -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 = "",
}
-?> \ No newline at end of file
+?>
diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php
index a3533116dc..d9c85c778b 100644
--- a/phpBB/language/lang_english/lang_main.php
+++ b/phpBB/language/lang_english/lang_main.php
@@ -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";
@@ -1097,7 +1097,21 @@ $lang['Rank_image_explain'] = "This is the place to set a custom image for every
$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!
// -------------------------------------------------
-?> \ No newline at end of file
+?>
diff --git a/phpBB/templates/PSO/admin/disallow_body.tpl b/phpBB/templates/PSO/admin/disallow_body.tpl
new file mode 100644
index 0000000000..e16871e143
--- /dev/null
+++ b/phpBB/templates/PSO/admin/disallow_body.tpl
@@ -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}:&nbsp;<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}:&nbsp;<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}" />&nbsp;&nbsp;<input type="reset" value="{L_RESET}" /></td>
+ </tr>
+</table></form>
+
+<p>{L_INFO}</p>
+
+<br clear="all" />
diff --git a/phpBB/templates/subSilver/admin/disallow_body.tpl b/phpBB/templates/subSilver/admin/disallow_body.tpl
new file mode 100644
index 0000000000..8b1e832e67
--- /dev/null
+++ b/phpBB/templates/subSilver/admin/disallow_body.tpl
@@ -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}&nbsp;<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" />
+ &nbsp;&nbsp;
+ <input type="reset" value="{L_RESET}" class="liteoption" />
+ </td>
+ </tr>
+</table></form>
+
+<p>{L_INFO}</p>