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

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

277
           $Operator = self::$FieldOperators[''];
277
           $Operator = self::$FieldOperators[''];
278
         }
278
         }
279
         if (!empty($QueryParts['include'])) {
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
           $SearchString .= '( ' . implode($Operator, $QueryParts['include']) . ' ) ';
285
           $SearchString .= '( ' . implode($Operator, $QueryParts['include']) . ' ) ';
281
         }
286
         }
282
         if (!empty($QueryParts['exclude'])) {
287
         if (!empty($QueryParts['exclude'])) {

Loading…
Cancel
Save