public function isOnBlackList()
 {
     return IQL::count(IpBlacklistIQL::$_TABLE)->where(NULL, IpBlacklistIQL::$EXPIRES, '>', WebDate::newMysqlDate())->_and(NULL, IpBlacklistIQL::$IP, '=', Request::getIpAddress())->get();
 }
Example #2
0
//TODO add checks
$reqobj = Request::getOrPost("object");
$field = Request::getOrPost("field");
$value = Request::getOrPost("value");
$expanded = Request::getOrPost("expanded");
//	print($reqobj);
//	print($field);
//	print($value);
$reqDao = $reqobj . "Dao";
$dao = new $reqDao();
$reqJsonBuilder = $reqobj . "JsonBuilder";
$builder = new $reqJsonBuilder();
if ($field == 'ALL' && $value == 'ALL') {
    $objs = $dao->getAll();
} else {
    $objs = IQL::select($reqobj)->where(NULL, $field, '=', $value)->get();
}
if ($objs != -1) {
    $objCount = count($objs);
    for ($i = 0; $i < $objCount; $i++) {
        if ($i > 0) {
            echo "\n";
        }
        $obj = $objs[$i];
        if ($expanded == '1') {
            echo $builder->toExpandedJson($obj);
        } else {
            echo $builder->toJson($obj);
        }
    }
}
Example #3
0
        if ($joinobs != -1) {
            foreach ($joinobs as $join) {
                $objs[] = $join->{$accesor}();
            }
        } else {
            $objs = -1;
        }
    } else {
        $q = IQL::select($reqobj);
        if (strpos($field, '.') > 0) {
            $fields = explode('.', $field);
            $field = $fields[1];
        }
        addWhereClause($q, NULL, $field, $value, $searchOption);
        $objs = $q->start($start)->limit($limit)->orderBy(NULL, $sidx, $sord)->get();
        $q = IQL::count($reqobj);
        addWhereClause($q, NULL, $fields[1], $value, $searchOption);
        $totalCount = $q->get();
        if ($totalCount > 0) {
            $totalPages = ceil($totalCount / $limit);
        } else {
            $totalPages = 0;
        }
    }
}
if ($objs == -1) {
    $response = new stdClass();
    $response->page = 0;
    $response->total = 0;
    $response->records = 0;
    echo json_encode($response);
Example #4
0
 /**
  * @param fields is optional. If omitted the default is * for a 'select *' query
  */
 function __construct($table, $fields = array('*'))
 {
     parent::__construct($table);
     $this->fields = $fields;
 }