Fix profile link in public search for unregistered users.
[platal.git] / modules / profile.php
index fc6bd7d..a8d2c57 100644 (file)
@@ -190,11 +190,15 @@ class ProfileModule extends PLModule
                       WHERE  matricule={?}", $x);
             $login = $res->fetchOneCell();
         } else {
-            $login = get_user_forlife($x);
+            $login = get_user_forlife($x, S::logged() ? '_default_user_callback'
+                                                      : '_silent_user_callback');
         }
 
         if (empty($login)) {
-            if (preg_match('/([-a-z]+)\.([-a-z]+)\.([0-9]{4})/i', $x, $matches)) {
+            if (!S::logged()) {
+                $page->kill("Ce camarade n'a pas de fiche publique.");
+                return;
+            } else if (preg_match('/([-a-z]+)\.([-a-z]+)\.([0-9]{4})/i', $x, $matches)) {
                 $matches = str_replace('-', '_', $matches);
                 $res = XDB::query("SELECT user_id
                                      FROM auth_user_md5
@@ -208,6 +212,9 @@ class ProfileModule extends PLModule
             }
             return PL_NOT_FOUND;
         }
+        if (S::logged()) {
+            $_SESSION['log']->log('view_profile', $login);
+        }
 
         $new   = Env::v('modif') == 'new';
         $user  = get_user_details($login, S::v('uid'), $view);