From 7a45d84a9f9458387bf4f57ac5a520f31c1604ab Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 14 Dec 2000 14:13:37 +0000 Subject: - added a whole bunch of NEW modules --- modules/ban.module | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 modules/ban.module (limited to 'modules/ban.module') diff --git a/modules/ban.module b/modules/ban.module new file mode 100644 index 000000000..df7bb5aef --- /dev/null +++ b/modules/ban.module @@ -0,0 +1,107 @@ + "ban_admin"); + +include "includes/ban.inc"; + +function ban_check($mask, $category) { + $ban = ban_match($mask, $category); + $output .= "". ($ban ? "Matched ban '$ban->mask' with reason: $ban->reason.

\n" : "No matching bans for '$mask'.

\n") .""; + print $output; +} + +function ban_new($mask, $category, $reason) { + ban_add($mask, $category, $reason, &$message); + $output .= "$message\n"; + print $output; +} + +function ban_display($category = "") { + global $type2index; + + // initialize variable: + $category = $category ? $category : 1; + + // Perform query: + $result = db_query("SELECT * FROM bans WHERE type = $category ORDER BY mask"); + + // Generate output: + $output .= "\n"; + $output .= " \n"; + $output .= " \n"; + $output .= " \n"; + $output .= " \n"; + $output .= " \n"; + $output .= " \n"; + $output .= " \n"; + $output .= " \n"; + + while ($ban = db_fetch_object($result)) { + $output .= " \n"; + } + + $output .= " \n"; + $output .= "
\n"; + $output .= "
\n"; + $output .= " \n"; + $output .= " \n"; + $output .= "
\n"; + $output .= "
maskreasonoperations
$ban->mask$ban->reasonid\">delete
%: matches any number of characters, even zero characters.
_: matches exactly one character.
\n"; + $output .= "


\n"; + + $output .= "

Add new ban:

\n"; + $output .= "
\n"; + $output .= "Banmask:
\n"; + $output .= "

\n"; + $output .= "Type:
\n"; + $output .= "

\n"; + $output .= "Reason:
\n"; + $output .= "

\n"; + $output .= "
\n"; + $output .= "

\n"; + $output .= "

\n"; + + $output .= "

Ban check:

\n"; + $output .= "
\n"; + $output .= "Banmask:
\n"; + $output .= "

\n"; + $output .= "Type:
\n"; + $output .= "

\n"; + $output .= "
\n"; + $output .= "

\n"; + + print $output; +} + +function ban_admin() { + global $op, $id, $mask, $category, $reason; + + switch ($op) { + case "Add ban": + ban_new($mask, $category, $reason); + ban_display($category); + break; + case "Check ban": + ban_check($mask, $category); + ban_display($category); + break; + case "delete": + ban_delete($id); + default: + ban_display($category); + } +} + +?> -- cgit v1.2.3