From 5aa2f823d82a52ec94530a134ca554ddd30f3ecd Mon Sep 17 00:00:00 2001 From: Thasan Date: Tue, 5 Nov 2013 22:43:46 +0200 Subject: [PATCH 1/3] Fixing rating= search --- ext/rating/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/rating/main.php b/ext/rating/main.php index e53141c8..77ecac2a 100644 --- a/ext/rating/main.php +++ b/ext/rating/main.php @@ -104,7 +104,7 @@ class Ratings extends Extension { $set = Ratings::privs_to_sql(Ratings::get_user_privs($user)); $event->add_querylet(new Querylet("rating IN ($set)")); } - if(preg_match("/^rating=(?:([sqeu]+)|(safe|questionable|explicit|unknown))$", strtolower($event->term), $matches)) { + if(preg_match("/^rating=(?:([sqeu]+)|(safe|questionable|explicit|unknown))$/D", strtolower($event->term), $matches)) { $ratings = $matches[1] ? $matches[1] : array($matches[2][0]); $ratings = array_intersect($ratings, str_split(Ratings::get_user_privs($user))); $set = "'" . join("', '", $ratings) . "'"; From fe84c8d9ddcee459eb82e4a4856ada83e6258052 Mon Sep 17 00:00:00 2001 From: Thasan Date: Wed, 6 Nov 2013 00:11:17 +0200 Subject: [PATCH 2/3] Also checking rating permissions --- ext/rating/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/rating/main.php b/ext/rating/main.php index 77ecac2a..714c96a5 100644 --- a/ext/rating/main.php +++ b/ext/rating/main.php @@ -106,7 +106,7 @@ class Ratings extends Extension { } if(preg_match("/^rating=(?:([sqeu]+)|(safe|questionable|explicit|unknown))$/D", strtolower($event->term), $matches)) { $ratings = $matches[1] ? $matches[1] : array($matches[2][0]); - $ratings = array_intersect($ratings, str_split(Ratings::get_user_privs($user))); + $ratings = array_intersect(str_split($ratings), str_split(Ratings::get_user_privs($user))); $set = "'" . join("', '", $ratings) . "'"; $event->add_querylet(new Querylet("rating IN ($set)")); } From b16be279a841af22a3fa193bb2da8f42f3b7e7bb Mon Sep 17 00:00:00 2001 From: Thasan Date: Wed, 6 Nov 2013 00:32:27 +0200 Subject: [PATCH 3/3] ext\rating documentation --- ext/rating/main.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ext/rating/main.php b/ext/rating/main.php index 714c96a5..be54cdb4 100644 --- a/ext/rating/main.php +++ b/ext/rating/main.php @@ -5,6 +5,18 @@ * Link: http://code.shishnet.org/shimmie2/ * License: GPLv2 * Description: Allow users to rate images "safe", "questionable" or "explicit" + * Documentation: + * This shimmie extension provides filter: + *
    + *
  • rating = (safe|questionable|explicit|unknown) + *
      + *
    • rating=s -- safe images + *
    • rating=q -- questionable images + *
    • rating=e -- explicit images + *
    • rating=u -- Unknown rating + *
    • rating=sq -- safe and questionable images + *
    + *
*/ class RatingSetEvent extends Event {