diff --git a/ext/artists/main.php b/ext/artists/main.php index 984b12af..0b1d40b7 100644 --- a/ext/artists/main.php +++ b/ext/artists/main.php @@ -45,7 +45,7 @@ class Artists extends Extension { public function onSearchTermParse(SearchTermParseEvent $event) { $matches = array(); - if(preg_match("/^author[=|:](.*)$/", $event->term, $matches)) { + if(preg_match("/^author[=|:](.*)$/i", $event->term, $matches)) { $char = $matches[1]; $event->add_querylet(new Querylet("Author = :author_char", array("author_char"=>$char))); } diff --git a/ext/comment/main.php b/ext/comment/main.php index 1c472626..107b2247 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -262,7 +262,7 @@ class CommentList extends Extension { public function onSearchTermParse(SearchTermParseEvent $event) { $matches = array(); - if(preg_match("/^comments([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/", $event->term, $matches)) { + if(preg_match("/^comments([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i", $event->term, $matches)) { $cmp = ltrim($matches[1], ":") ?: "="; $comments = $matches[2]; $event->add_querylet(new Querylet("images.id IN (SELECT DISTINCT image_id FROM comments GROUP BY image_id HAVING count(image_id) $cmp $comments)")); diff --git a/ext/favorites/main.php b/ext/favorites/main.php index 6517377e..21ce0829 100644 --- a/ext/favorites/main.php +++ b/ext/favorites/main.php @@ -117,7 +117,7 @@ class Favorites extends Extension { public function onSearchTermParse(SearchTermParseEvent $event) { $matches = array(); - if(preg_match("/^favorites([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/", $event->term, $matches)) { + if(preg_match("/^favorites([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i", $event->term, $matches)) { $cmp = ltrim($matches[1], ":") ?: "="; $favorites = $matches[2]; $event->add_querylet(new Querylet("images.id IN (SELECT id FROM images WHERE favorites $cmp $favorites)")); diff --git a/ext/index/main.php b/ext/index/main.php index 9cf5abfc..f7018512 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -295,12 +295,12 @@ class Index extends Extension { public function onSearchTermParse(SearchTermParseEvent $event) { $matches = array(); // check for tags first as tag based searches are more common. - if(preg_match("/^tags([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/", $event->term, $matches)) { + if(preg_match("/^tags([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i", $event->term, $matches)) { $cmp = ltrim($matches[1], ":") ?: "="; $tags = $matches[2]; $event->add_querylet(new Querylet('images.id IN (SELECT DISTINCT image_id FROM image_tags GROUP BY image_id HAVING count(image_id) '.$cmp.' '.$tags.')')); } - else if(preg_match("/^ratio([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+):(\d+)$/", $event->term, $matches)) { + else if(preg_match("/^ratio([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+):(\d+)$/i", $event->term, $matches)) { $cmp = preg_replace('/^:/', '=', $matches[1]); $args = array("width{$this->stpen}"=>int_escape($matches[2]), "height{$this->stpen}"=>int_escape($matches[3])); $event->add_querylet(new Querylet("width / height $cmp :width{$this->stpen} / :height{$this->stpen}", $args)); @@ -326,28 +326,28 @@ class Index extends Extension { else if(preg_match("/^(source)[=|:](.*)$/i", $event->term, $matches)) { $source = strtolower($matches[2]); - if(preg_match("/^(any|none)$/", $source)){ + if(preg_match("/^(any|none)$/i", $source)){ $not = ($source == "any" ? "NOT" : ""); $event->add_querylet(new Querylet("images.source IS $not NULL")); }else{ $event->add_querylet(new Querylet('images.source LIKE :src', array("src"=>"%$source%"))); } } - else if(preg_match("/^posted([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])([0-9-]*)$/", $event->term, $matches)) { + else if(preg_match("/^posted([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])([0-9-]*)$/i", $event->term, $matches)) { $cmp = ltrim($matches[1], ":") ?: "="; $val = $matches[2]; $event->add_querylet(new Querylet("images.posted $cmp :posted{$this->stpen}", array("posted{$this->stpen}"=>$val))); } - else if(preg_match("/^size([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)x(\d+)$/", $event->term, $matches)) { + else if(preg_match("/^size([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)x(\d+)$/i", $event->term, $matches)) { $cmp = ltrim($matches[1], ":") ?: "="; $args = array("width{$this->stpen}"=>int_escape($matches[2]), "height{$this->stpen}"=>int_escape($matches[3])); $event->add_querylet(new Querylet("width $cmp :width{$this->stpen} AND height $cmp :height{$this->stpen}", $args)); } - else if(preg_match("/^width([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/", $event->term, $matches)) { + else if(preg_match("/^width([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i", $event->term, $matches)) { $cmp = ltrim($matches[1], ":") ?: "="; $event->add_querylet(new Querylet("width $cmp :width{$this->stpen}", array("width{$this->stpen}"=>int_escape($matches[2])))); } - else if(preg_match("/^height([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/", $event->term, $matches)) { + else if(preg_match("/^height([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)$/i", $event->term, $matches)) { $cmp = ltrim($matches[1], ":") ?: "="; $event->add_querylet(new Querylet("height $cmp :height{$this->stpen}",array("height{$this->stpen}"=>int_escape($matches[2])))); } diff --git a/ext/notes/main.php b/ext/notes/main.php index f29a22e9..ac058c45 100644 --- a/ext/notes/main.php +++ b/ext/notes/main.php @@ -214,7 +214,7 @@ class Notes extends Extension { $notes = int_escape($matches[1]); $event->add_querylet(new Querylet("images.id IN (SELECT image_id FROM notes WHERE note = $notes)")); } - else if(preg_match("/^notes([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)%/", $event->term, $matches)) { + else if(preg_match("/^notes([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(\d+)%/i", $event->term, $matches)) { $cmp = ltrim($matches[1], ":") ?: "="; $notes = $matches[2]; $event->add_querylet(new Querylet("images.id IN (SELECT id FROM images WHERE notes $cmp $notes)")); diff --git a/ext/numeric_score/main.php b/ext/numeric_score/main.php index 2da74577..70c18061 100644 --- a/ext/numeric_score/main.php +++ b/ext/numeric_score/main.php @@ -217,12 +217,12 @@ class NumericScore extends Extension { public function onSearchTermParse(SearchTermParseEvent $event) { $matches = array(); - if(preg_match("/^score([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(-?\d+)$/", $event->term, $matches)) { + if(preg_match("/^score([:]?<|[:]?>|[:]?<=|[:]?>=|[:|=])(-?\d+)$/i", $event->term, $matches)) { $cmp = ltrim($matches[1], ":") ?: "="; $score = $matches[2]; $event->add_querylet(new Querylet("numeric_score $cmp $score")); } - if(preg_match("/^upvoted_by[=|:](.*)$/", $event->term, $matches)) { + else if(preg_match("/^upvoted_by[=|:](.*)$/i", $event->term, $matches)) { $duser = User::by_name($matches[1]); if(is_null($duser)) { throw new SearchTermParseException( @@ -232,7 +232,7 @@ class NumericScore extends Extension { "images.id in (SELECT image_id FROM numeric_score_votes WHERE user_id=:ns_user_id AND score=1)", array("ns_user_id"=>$duser->id))); } - if(preg_match("/^downvoted_by[=|:](.*)$/", $event->term, $matches)) { + else if(preg_match("/^downvoted_by[=|:](.*)$/i", $event->term, $matches)) { $duser = User::by_name($matches[1]); if(is_null($duser)) { throw new SearchTermParseException( @@ -242,13 +242,13 @@ class NumericScore extends Extension { "images.id in (SELECT image_id FROM numeric_score_votes WHERE user_id=:ns_user_id AND score=-1)", array("ns_user_id"=>$duser->id))); } - if(preg_match("/^upvoted_by_id[=|:](\d+)$/", $event->term, $matches)) { + else if(preg_match("/^upvoted_by_id[=|:](\d+)$/i", $event->term, $matches)) { $iid = int_escape($matches[1]); $event->add_querylet(new Querylet( "images.id in (SELECT image_id FROM numeric_score_votes WHERE user_id=:ns_user_id AND score=1)", array("ns_user_id"=>$iid))); } - if(preg_match("/^downvoted_by_id[=|:](\d+)$/", $event->term, $matches)) { + else if(preg_match("/^downvoted_by_id[=|:](\d+)$/i", $event->term, $matches)) { $iid = int_escape($matches[1]); $event->add_querylet(new Querylet( "images.id in (SELECT image_id FROM numeric_score_votes WHERE user_id=:ns_user_id AND score=-1)", diff --git a/ext/pools/main.php b/ext/pools/main.php index 6bcd8760..3af892b7 100644 --- a/ext/pools/main.php +++ b/ext/pools/main.php @@ -295,7 +295,7 @@ class Pools extends Extension { public function onSearchTermParse(SearchTermParseEvent $event) { $matches = array(); - if(preg_match("/^pool[=|:]([0-9]+|any|none)$/", $event->term, $matches)) { + if(preg_match("/^pool[=|:]([0-9]+|any|none)$/i", $event->term, $matches)) { $poolID = $matches[1]; if(preg_match("/^(any|none)$/", $poolID)){ @@ -305,7 +305,7 @@ class Pools extends Extension { $event->add_querylet(new Querylet("images.id IN (SELECT DISTINCT image_id FROM pool_images WHERE pool_id = $poolID)")); } } - else if(preg_match("/^pool_by_name[=|:](.*)$/", $event->term, $matches)) { + else if(preg_match("/^pool_by_name[=|:](.*)$/i", $event->term, $matches)) { $poolTitle = str_replace("_", " ", $matches[1]); $pool = $this->get_single_pool_from_title($poolTitle);