diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-04-02 15:54:37 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-04-02 15:54:37 +0000 |
commit | 805107cd2202ddee66c4743e43804a3069508f29 (patch) | |
tree | 39a0661f2e8a84ee743831ee7abac5c9a626637c /modules/ban.module | |
parent | 1f5bc83d794906c1b88dde20e107363cf2f71c17 (diff) | |
download | brdo-805107cd2202ddee66c4743e43804a3069508f29.tar.gz brdo-805107cd2202ddee66c4743e43804a3069508f29.tar.bz2 |
Commiting my work of last Sunday:
- removed ban.inc and ban.module and integrated it in account.module
under the name "access control" --> the ban code was not really up
to standard so this has now been dealt with. This refactoring and
reintegration cuts down the code size with 100 lines too. :-)
(The ban.module code was really old and it showed.)
- added node.module and made the other modules reuse some of this
code --> cut down the code size of modules by at least 100 lines
and adds stability.
- added a status() function to admin.php to display a conform status
message where appropriate. See admin.php for usage.
- removed $theme->control() and made comments.inc handle this itself
wrapped in a $theme->box(). No need to clutter the themes with
such complexity --> updated all themes already. :-)
- some small visual changes to some administration pages to be more
consistent across different modules.
Diffstat (limited to 'modules/ban.module')
-rw-r--r-- | modules/ban.module | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/modules/ban.module b/modules/ban.module deleted file mode 100644 index 3d1d8a64f..000000000 --- a/modules/ban.module +++ /dev/null @@ -1,143 +0,0 @@ -<?php - -$module = array("help" => "ban_help", - "admin" => "ban_admin"); - -include_once "includes/ban.inc"; - - -function ban_help() { - ?> - <P>The ban module keeps a list of bans in four categories:</P> - <UL> - <LI>Email bans: this type of ban specifies which email addresses will be rejected when registering new users. Can be used to prevent users from using a free email account (e.g. userid@hotmail.com).</LI> - <LI>Profanity bans: <I>under construction</I></LI> - <LI>Hostname bans: this type of ban allows you to block certain hostnames from access to your site or from registering as a new user.</LI> - <LI>Username bans: this ban will block certain usernames from registration. Typical examples include <I>admin</I>, <I>anonymous</I>, <I>root</I>, <I>webmaster</I>, etc.</LI> - </UL> - <P>The ban module allows you to use a flexible wild-card ban system. This means you can block all email addresses from a certain domain name, block every username starting with "guest", etc. To do this, use the following wild-card characters:</P> - <UL> - <LI> % : matches any number of characters, including zero characters.</LI> - <LI> _ : matches exactly one character.</LI> - </UL> - <P><U>Examples:</U></P> - <UL> - <LI>Email address bans <CODE>%@hotmail.com</CODE>, <CODE>%@altavista.%</CODE>, <CODE>%@usa.net</CODE>, etc. Used to prevent users from using free email accounts, which might be used to cause trouble.</LI> - <LI>Username bans <CODE>root</CODE>, <CODE>webmaster</CODE>, <CODE>admin%</CODE>, etc. Used to prevent administrator impersonators.</LI> - </UL> - <?php -} - -function ban_admin_new($mask, $category, $reason) { - ban_add($mask, $category, $reason, $message); - $output .= "$message\n"; - print $output; -} - -function ban_display($category = "") { - global $type2index; - - $category = $category ? $category : 1; - - $result = db_query("SELECT * FROM bans WHERE type = $category ORDER BY mask"); - - $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; - $output .= " <TR>\n"; - $output .= " <TH COLSPAN=\"3\">\n"; - $output .= " <FORM ACTION=\"admin.php?mod=ban\" METHOD=\"post\">\n"; - $output .= " <SELECT NAME=\"category\">\n"; - for (reset($type2index); $cur = current($type2index); next($type2index)) { - $output .= " <OPTION VALUE=\"$cur\"". ($cur == $category ? " SELECTED" : "") .">Bans by ". key($type2index) ."</OPTION>\n"; - } - $output .= " </SELECT>\n"; - $output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update\">\n"; - $output .= " </FORM>\n"; - $output .= " </TH>\n"; - $output .= " </TR>\n"; - $output .= " <TR><TH>mask</TH><TH>reason</TH><TH>operations</TH></TR>\n"; - while ($ban = db_fetch_object($result)) { - $output .= " <TR><TD>$ban->mask</TD><TD>$ban->reason</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=ban&op=delete&category=$category&id=$ban->id\">delete</A></TD></TR>\n"; - } - $output .= " <TR><TD COLSPAN=\"3\"><SMALL>%: matches any number of characters, even zero characters.<BR>_: matches exactly one character.</SMALL></TD></TR>\n"; - $output .= "</TABLE>\n"; - - print $output; -} - -function ban_admin_add() { - global $type2index; - - $output .= "<H3>Add new ban:</H3>\n"; - $output .= "<FORM ACTION=\"admin.php?mod=ban\" METHOD=\"post\">\n"; - - $output .= "<B>Banmask:</B><BR>\n"; - $output .= "<INPUT TYPE=\"text\" NAME=\"mask\" SIZE=\"35\"><P>\n"; - - $output .= "<B>Type:</B><BR>\n"; - for (reset($type2index); $cur = current($type2index); next($type2index)) $options .= "<OPTION VALUE=\"$cur\"". ($cur == $category ? " SELECTED" : "") .">". key($type2index) ."</OPTION>\n"; - $output .= "<SELECT NAME=\"category\"\">$options</SELECT><P>\n"; - - $output .= "<B>Reason:</B><BR>\n"; - $output .= "<TEXTAREA NAME=\"reason\" COLS=\"50\" ROWS=\"5\"></TEXTAREA><P>\n"; - - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Add ban\"><BR>\n"; - $output .= "</FORM>\n"; - - print $output; -} - -function ban_check($mask, $category) { - $ban = ban_match($mask, $category); - $output .= "". ($ban ? "Matched ban '<B>$ban->mask</B>' with reason: <I>$ban->reason</I>.<P>\n" : "No matching bans for '$mask'.<P>\n") .""; - print $output; -} - -function ban_admin_check() { - global $type2index; - - $output .= "<H3>Ban check:</H3>\n"; - $output .= "<FORM ACTION=\"admin.php?mod=ban\" METHOD=\"post\">\n"; - - $output .= "<B>Banmask:</B><BR>\n"; - $output .= "<INPUT TYPE=\"text\" NAME=\"mask\" SIZE=\"35\"><P>\n"; - - $output .= "<B>Type:</B><BR>\n"; - for (reset($type2index); $cur = current($type2index); next($type2index)) $options .= "<OPTION VALUE=\"$cur\"". ($cur == $category ? " SELECTED" : "") .">". key($type2index) ."</OPTION>\n"; - $output .= "<SELECT NAME=\"category\"\">$options</SELECT><P>\n"; - - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Check ban\"><BR>\n"; - $output .= "</FORM>\n"; - - print $output; -} - -function ban_admin() { - global $op, $id, $mask, $category, $reason; - - print "<SMALL><A HREF=\"admin.php?mod=ban&op=add\">add ban</A> | <A HREF=\"admin.php?mod=ban&op=check\">check ban</A> | <A HREF=\"admin.php?mod=ban\">overview</A> | <A HREF=\"admin.php?mod=ban&op=help\">help</A></SMALL><HR>\n"; - - switch ($op) { - case "Add ban": - ban_admin_new(check_input($mask), check_input($category), check_input($reason)); - ban_display(check_input($category)); - break; - case "Check ban": - ban_check(check_input($mask), check_input($category)); - break; - case "add": - ban_admin_add(); - break; - case "help": - ban_help(); - break; - case "check": - ban_admin_check(); - break; - case "delete": - ban_delete(check_input($id)); - default: - ban_display(check_input($category)); - } -} - -?> |