X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fsearch.php;h=f7006722f93de8519eafeed5affeaf4d7521ca5d;hb=40b6aa0f63724eadfa0ef6ea88b1fbbada96b041;hp=c9ca317de53eda9567c2629fa9cb54ac680f763a;hpb=55546c0db778c2d8f9d7debd30117931dc39ff16;p=platal.git diff --git a/modules/search.php b/modules/search.php index c9ca317..f700672 100644 --- a/modules/search.php +++ b/modules/search.php @@ -1,6 +1,6 @@ $this->make_hook('quick', AUTH_PUBLIC), - 'search/adv' => $this->make_hook('advanced', AUTH_COOKIE), + 'search' => $this->make_hook('quick', AUTH_PUBLIC), + 'search/adv' => $this->make_hook('advanced', AUTH_COOKIE), 'advanced_search.php' => $this->make_hook('redir_advanced', AUTH_PUBLIC), - 'search/autocomplete' => $this->make_hook('autocomplete', AUTH_COOKIE, 'user', NO_AUTH), - 'search/list' => $this->make_hook('list', AUTH_COOKIE, 'user', NO_AUTH), + 'search/autocomplete' => $this->make_hook('autocomplete', AUTH_COOKIE, 'user', NO_AUTH), + 'search/list' => $this->make_hook('list', AUTH_COOKIE, 'user', NO_AUTH), ); } @@ -87,7 +87,7 @@ class SearchModule extends PLModule $list .= '|admin|adm|ax'; } if (preg_match('/^(' . $list . '):([-a-z]+(\.[-a-z]+(\.\d{2,4})?)?)$/', replace_accent($quick), $matches)) { - $forlife = $matches[2]; + $login = $matches[2]; switch($matches[1]) { case 'admin': case 'adm': $base = 'admin/user/'; @@ -103,13 +103,12 @@ class SearchModule extends PLModule break; } - require_once 'user.func.inc.php'; - $login = get_user_forlife($forlife, '_silent_user_callback'); - if ($login) { - pl_redirect($base . $login); + $user = User::getSilent($login); + if ($user) { + pl_redirect($base . $user->login()); } - $_REQUEST['quick'] = $forlife; - $_GET['quick'] = $forlife; + $_REQUEST['quick'] = $login; + $_GET['quick'] = $login; } elseif (strpos($quick, 'doc:') === 0) { $url = 'Docs/Recherche?'; $url .= 'action=search&q=' . urlencode(substr($quick, 4)); @@ -168,7 +167,7 @@ class SearchModule extends PLModule 'nationalite' => array('field' => 'a2', 'table' => 'geoloc_pays', 'text' => 'nat', 'exact' => 'false'), 'binet' => array('field' => 'id', 'table' => 'binets_def', 'text' => 'text', 'exact' => false), 'groupex' => array('field' => 'id', 'table' => 'groupex.asso', - 'text' => "(a.cat = 'GroupesX' OR a.cat = 'Institutions') AND pub = 'public' AND nom", + 'text' => "(cat = 'GroupesX' OR cat = 'Institutions') AND pub = 'public' AND nom", 'exact' => false), 'section' => array('field' => 'id', 'table' => 'sections', 'text' => 'text', 'exact' => false), 'school' => array('field' => 'id', 'table' => 'applis_def', 'text' => 'text', 'exact' => false),