diff options
Diffstat (limited to 'includes/ban.inc')
-rw-r--r-- | includes/ban.inc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/includes/ban.inc b/includes/ban.inc index 8a4045945..f31ef849a 100644 --- a/includes/ban.inc +++ b/includes/ban.inc @@ -4,11 +4,13 @@ $type2index = array("addresses" => 0x01, "profanity" => 0x02, "hostnames" => 0x03, "usernames" => 0x04); + $index2type = array(0x01 => "addresses", 0x02 => "profanity", 0x03 => "hostnames", 0x04 => "usernames"); + function ban_match($mask, $category) { ### Perform query: $result = db_query("SELECT * FROM bans WHERE type = $category AND LOWER('$mask') LIKE LOWER(mask)"); @@ -21,14 +23,14 @@ function ban_add($mask, $category, $reason, $message = "") { global $index2type; if (empty($mask)) { - $message = "Failed: empty banmasks are not allowed.<P>\n"; + $message = "failed: empty banmasks are not allowed.<P>\n"; } else if ($ban = db_fetch_object(db_query("SELECT * FROM bans WHERE type = $category AND '$mask' LIKE mask"))) { - $message = "Failed: ban is already matched by '$ban->mask'.<P>\n"; + $message = "failed: ban is already matched by '$ban->mask'.<P>\n"; } else { $result = db_query("INSERT INTO bans (mask, type, reason, timestamp) VALUES ('$mask', '$category', '$reason', '". time() ."')"); - $message = "Added new ban with mask `$mask'.<P>\n"; + $message = "added new ban with mask `$mask'.<P>\n"; ### Add log entry: watchdog("message", "added new ban `$mask' to category `". $index2type[$category] ."' with reason `$reason'."); |