}
// }}}
+// {{{ class UFC_Ip
+/** Filters users based on one of their last IPs
+ * @param $ip IP from which connection are checked
+ */
+class UFC_Ip implements UserFilterCondition
+{
+ private $ip;
+
+ public function __construct($ip)
+ {
+ $this->ip = $ip;
+ }
+
+ public function buildCondition(PlFilter &$uf)
+ {
+ $sub = $uf->addLoggerFilter();
+ $ip = ip_to_uint($this->ip);
+ return XDB::format($sub . '.ip = {?} OR ' . $sub . '.forward_ip = {?}', $ip, $ip);
+ }
+}
+// }}}
+
// {{{ class UFC_Comment
class UFC_Comment implements UserFilterCondition
{
}
}
+ /** LOGGER
+ */
+
+ private $with_logger = false;
+ public function addLoggerFilter()
+ {
+ $this->with_logger = true;
+ $this->requireAccounts();
+ return 'ls';
+ }
+ protected function loggerJoins()
+ {
+ $joins = array();
+ if ($this->with_logger) {
+ $joins['ls'] = new PlSqlJoin(PlSqlJoin::MODE_LEFT, 'log_sessions', '$ME.uid = $UID');
+ }
+ return $joins;
+ }
+
/** NAMES
*/
if (S::admin() && strpos($s, '@') !== false) {
return new UFC_Email($s);
} else if (S::admin() && preg_match('/[0-9]+\.([0-9]+|%)\.([0-9]+|%)\.([0-9]+|%)/', $s)) {
- // TODO: create UFC_Ip
-// $this->conds->addChild(new UFC_Ip($s));
+ $this->conds->addChild(new UFC_Ip($s));
return;
}