$s = replace_accent(trim($this->value));
$r = $s = str_replace('*','%',$s);
- if (S::has_perms() && strpos($s, '@') !== false) {
+ if (S::admin() && strpos($s, '@') !== false) {
$this->email = $s;
- } else if (S::has_perms() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) {
+ } else if (S::admin() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) {
$this->ip = $s;
}
if ($this->email || $this->ip) {
}
if (!empty($this->ip)) {
$ip = ip_to_uint($this->ip);
- $where[] = "( ls.ip = $ip OR ls.forward_ip = $ip ) AND ls.suid = 0";
+
+ // If the IP address requested for the search cannot be translated,
+ // the predicate should always be valued to false.
+ if ($ip != null) {
+ $where[] = "( ls.ip = $ip OR ls.forward_ip = $ip ) AND ls.suid = 0";
+ } else {
+ $where[] = "false";
+ }
}
if (!empty($this->phone)){
require_once("profil.func.inc.php");