Fix xnet subscription wrt + in emails (fight mod_rewrite double urldecode).
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Thu, 24 Mar 2011 21:17:06 +0000 (22:17 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Thu, 24 Mar 2011 21:17:06 +0000 (22:17 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
modules/xnetgrp.php

index c59dc8f..51917e8 100644 (file)
@@ -659,6 +659,11 @@ class XnetGrpModule extends PLModule
         S::assert_xsrf_token();
         $suggest_account_activation = false;
 
+        // FS#703 : $_GET is urldecoded twice, hence
+        // + (the data) => %2B (in the url) => + (first decoding) => ' ' (second decoding)
+        // Since there can be no spaces in emails, we can fix this with :
+        $email = str_replace(' ', '+', $email);
+
         // Finds or creates account: first cases are for users with an account.
         if (!User::isForeignEmailAddress($email)) {
             // Standard account
@@ -768,6 +773,11 @@ class XnetGrpModule extends PLModule
     {
         $page->changeTpl('xnetgrp/membres-suggest.tpl');
 
+        // FS#703 : $_GET is urldecoded twice, hence
+        // + (the data) => %2B (in the url) => + (first decoding) => ' ' (second decoding)
+        // Since there can be no spaces in emails, we can fix this with :
+        $email = str_replace(' ', '+', $email);
+
         if (Post::has('suggest')) {
             if (Post::t('suggest') == 'yes') {
                 $user = S::user();