postgres barfs if you try to compare a string to an inet_addr
This commit is contained in:
parent
5e4f387983
commit
8b93b0644c
@ -55,9 +55,22 @@ class LogDatabase extends SimpleExtension {
|
||||
$args[] = $_GET["module"];
|
||||
}
|
||||
if(!empty($_GET["user"])) {
|
||||
$wheres[] = "(username = ? OR address = ?)";
|
||||
$args[] = $_GET["user"];
|
||||
$args[] = $_GET["user"];
|
||||
if($database->engine->name == "pgsql") {
|
||||
if(preg_match("#\d+\.\d+\.\d+\.\d+(/\d+)?#", $_GET["user"])) {
|
||||
$wheres[] = "(username = ? OR address << ?)";
|
||||
$args[] = $_GET["user"];
|
||||
$args[] = $_GET["user"];
|
||||
}
|
||||
else {
|
||||
$wheres[] = "lower(username) = lower(?)";
|
||||
$args[] = $_GET["user"];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$wheres[] = "(username = ? OR address = ?)";
|
||||
$args[] = $_GET["user"];
|
||||
$args[] = $_GET["user"];
|
||||
}
|
||||
}
|
||||
if(!empty($_GET["priority"])) {
|
||||
$wheres[] = "priority >= ?";
|
||||
|
Loading…
x
Reference in New Issue
Block a user