add support for using : as a metatag seperator + updated docs

This commit is contained in:
Daku
2014-01-02 14:00:24 +00:00
parent 85880804d2
commit 25c286b71f
7 changed files with 61 additions and 49 deletions

View File

@@ -116,7 +116,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))$/D", 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(str_split($ratings), str_split(Ratings::get_user_privs($user)));
$set = "'" . join("', '", $ratings) . "'";
@@ -199,7 +199,7 @@ class Ratings extends Extension {
private function no_rating_query($context) {
foreach($context as $term) {
if(preg_match("/^rating=/", $term)) {
if(preg_match("/^rating[=|:]/", $term)) {
return false;
}
}