Skip to content

Commit

Permalink
be more strict about allowed comparisons
Browse files Browse the repository at this point in the history
git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.0@20 7f39781d-f577-437e-ae19-be835c7a54ca
  • Loading branch information
shish committed Apr 27, 2007
1 parent 8d44a83 commit ab42847
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/database.class.php
Expand Up @@ -93,17 +93,17 @@ private function build_search_querylet($terms) {
$term = $this->resolve_alias($term);

$matches = array();
if(preg_match("/size([><=]+)(\d+)x(\d+)/", $term, $matches)) {
if(preg_match("/size(<|>|<=|>=|=)(\d+)x(\d+)/", $term, $matches)) {
$cmp = $matches[1];
$args = array(int_escape($matches[2]), int_escape($matches[3]));
$img_search->append(new Querylet("AND (width $cmp ? AND height $cmp ?)", $args));
}
else if(preg_match("/ratio([><=]+)(\d+):(\d+)/", $term, $matches)) {
else if(preg_match("/ratio(<|>|<=|>=|=)(\d+):(\d+)/", $term, $matches)) {
$cmp = $matches[1];
$args = array(int_escape($matches[2]), int_escape($matches[3]));
$img_search->append(new Querylet("AND (width / height $cmp ? / ?)", $args));
}
else if(preg_match("/(filesize|id)([><=]+)([\dKMGB]+)/i", $term, $matches)) {
else if(preg_match("/(filesize|id)(<|>|<=|>=|=)([\dKMGB]+)/i", $term, $matches)) {
$col = $matches[1];
$cmp = $matches[2];
$val = parse_shorthand_int($matches[3]);
Expand Down

0 comments on commit ab42847

Please sign in to comment.