/** * Returns value if it is a valid integer value, FALSE otherwise. * * @param mixed $key * @return mixed * * @tag validator */ function testInt($key) { if (!$this->keyExists($key)) { return false; } if (Inspekt::isInt($this->_getValue($key))) { return $this->_getValue($key); } return FALSE; }
/** * */ public function testIsInt4() { $input = 2147483647; $this->assertTrue(Inspekt::isInt($input)); }
$albcat_terms[] = " LIKE '%{$word}%'"; } foreach ($search_params['params'] as $param => $value) { if (in_array($param, $allowed)) { $fields[] = ($param == 'title' ? 'p.title' : $param) . " LIKE '%{$word}%'"; } } $sections[] = count($fields) ? '(' . implode(' OR ', $fields) . ')' : ''; } } } } $sql .= count($sections) ? '(' . implode($type, $sections) . ')' : '0'; } $sql .= Inspekt::isInt($USER['search']['params']['newer_than']) ? ' AND ( ctime > ' . time() . ' - ' . $USER['search']['params']['newer_than'] * 60 * 60 * 24 . ')' : ''; $sql .= Inspekt::isInt($USER['search']['params']['older_than']) ? ' AND ( ctime < ' . time() . ' - ' . $USER['search']['params']['older_than'] * 60 * 60 * 24 . ')' : ''; $sql .= " AND approved = 'YES' {$FORBIDDEN_SET}"; if ($superCage->get->keyExists('album_title')) { $album_query = "SELECT aid, title, description FROM `{$CONFIG['TABLE_ALBUMS']}` AS p" . " WHERE (`title` " . implode(" {$type} `title` ", $albcat_terms) . ") {$FORBIDDEN_SET}"; $result = cpg_db_query($album_query); if (mysql_num_rows($result) > 0) { starttable('100%', $lang_meta_album_names['album_search'], 2); while ($alb = mysql_fetch_assoc($result)) { $thumb_query = "SELECT filepath, filename, url_prefix, pwidth, pheight " . " FROM `{$CONFIG['TABLE_PICTURES']}` " . " WHERE (`aid` = '{$alb['aid']}') " . " AND approved = 'YES' " . " ORDER BY `pid` DESC"; $thumb_result = cpg_db_query($thumb_query); $thumb = mysql_fetch_assoc($thumb_result); // TODO: query above only pulls in last_pid in each album, not correct album thumb as set by user $thumb_url = get_pic_url($thumb, 'thumb'); $thumb_size = compute_img_size($thumb['pwidth'], $thumb['pheight'], $CONFIG['alb_list_thumb_size'], true, 'cat_thumb'); ?> <tr>
/** * Returns value if it is a valid integer value, FALSE otherwise. * * @param mixed $key * @return mixed * @throws Exception * @tag validator */ public function testInt($key) { $value = $this->getValueOrNull($key); if (!is_null($value) && Inspekt::isInt($value)) { return $value; } return false; }