Fix quick search shortcuts (admin:, profile:...) to support new login
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 6 Oct 2010 16:28:58 +0000 (18:28 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 6 Oct 2010 16:28:58 +0000 (18:28 +0200)
patterns (.ax, .m2010, .d2009, .fx, ...).

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
modules/search.php

index 5d474f5..505e5ee 100644 (file)
@@ -74,7 +74,9 @@ class SearchModule extends PLModule
             if (S::admin()) {
                 $list .= '|admin|adm|ax';
             }
-            if (preg_match('/^(' . $list . '):([-a-z]+(\.[-a-z]+(\.\d{2,4})?)?)$/', replace_accent($quick), $matches)) {
+            $suffixes = array_keys(DirEnum::getOptions(DirEnum::ACCOUNTTYPES));
+            $suffixes = implode('|', $suffixes);
+            if (preg_match('/^(' . $list . '):([-a-z]+(\.[-a-z]+(\.(?:[md]?\d{2,4}|' . $suffixes . '))?)?)$/', replace_accent($quick), $matches)) {
                 $login = $matches[2];
                 switch($matches[1]) {
                   case 'admin': case 'adm':