Browse Source

Add support for tag namespaces

Namespaces are of the form tag:namespace and can be infinitely nested
ala tag:namespace:supernamespace etc
spaghetti 9 years ago
parent
commit
0d82148c00
2 changed files with 6 additions and 1 deletions
  1. 1
    1
      classes/misc.class.php
  2. 5
    0
      classes/torrentsearch.class.php

+ 1
- 1
classes/misc.class.php View File

@@ -450,7 +450,7 @@ class Misc {
450 450
    */
451 451
   public static function sanitize_tag($Str) {
452 452
     $Str = strtolower($Str);
453
-    $Str = preg_replace('/[^a-z0-9.]/', '', $Str);
453
+    $Str = preg_replace('/[^a-z0-9:.]/', '', $Str);
454 454
     $Str = preg_replace('/(^[.,]*)|([.,]*$)/', '', $Str);
455 455
     $Str = htmlspecialchars($Str);
456 456
     $Str = db_string(trim($Str));

+ 5
- 0
classes/torrentsearch.class.php View File

@@ -277,6 +277,11 @@ class TorrentSearch {
277 277
           $Operator = self::$FieldOperators[''];
278 278
         }
279 279
         if (!empty($QueryParts['include'])) {
280
+          if ($Field == 'taglist') {
281
+            foreach ($QueryParts['include'] as $key => $Tag) {
282
+              $QueryParts['include'][$key] = '( '.$Tag.' | '.$Tag.':* )';
283
+            }
284
+          }
280 285
           $SearchString .= '( ' . implode($Operator, $QueryParts['include']) . ' ) ';
281 286
         }
282 287
         if (!empty($QueryParts['exclude'])) {

Loading…
Cancel
Save