postgres barfs if you try to compare a string to an inet_addr
This commit is contained in:
parent
5e4f387983
commit
8b93b0644c
@ -55,10 +55,23 @@ class LogDatabase extends SimpleExtension {
|
|||||||
$args[] = $_GET["module"];
|
$args[] = $_GET["module"];
|
||||||
}
|
}
|
||||||
if(!empty($_GET["user"])) {
|
if(!empty($_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 = ?)";
|
$wheres[] = "(username = ? OR address = ?)";
|
||||||
$args[] = $_GET["user"];
|
$args[] = $_GET["user"];
|
||||||
$args[] = $_GET["user"];
|
$args[] = $_GET["user"];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(!empty($_GET["priority"])) {
|
if(!empty($_GET["priority"])) {
|
||||||
$wheres[] = "priority >= ?";
|
$wheres[] = "priority >= ?";
|
||||||
$args[] = int_escape($_GET["priority"]);
|
$args[] = int_escape($_GET["priority"]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user