Close #540: Profile of unregistered users redirects to the public marketing page
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 13 Nov 2006 22:57:55 +0000 (22:57 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 13 Nov 2006 22:57:55 +0000 (22:57 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1076 839d8a87-29fc-0310-9880-83ba4fa771e5

ChangeLog
modules/profile.php

index d3206c3..fe549cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,7 @@ Bug/Wish:
         - #451: vCard are RFC compliant                                    -FRU
         - #502: Use 'alias' instead of 'aka' to specify the nickname       -FRU
         - #536: Can use login.promo as a valid user identifier             -FRU
+        - #540: Profile of unregistered user redirects to marketing        -FRU
 
     * Xnet:
         - #511: Migrate ML subscription when changing email of a non-X     -FRU
index e676872..fdaa2a7 100644 (file)
@@ -186,6 +186,18 @@ class ProfileModule extends PLModule
         }
 
         if (empty($login)) {
+            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
+                                    WHERE prenom LIKE {?} AND nom LIKE {?} AND promo = {?}
+                                          AND perms = 'pending'",
+                                  $matches[1], $matches[2], $matches[3]);
+                if ($res->numRows() == 1) {
+                    $uid = $res->fetchOneCell();
+                    pl_redirect('marketing/public/' . $uid);
+                }
+            }
             return PL_NOT_FOUND;
         }