@@ -54,7 +54,7 @@ function phorum_mod_social_authentication_url_build(
54
54
in_array ('_sas=complete ' , $ query_params , TRUE ))
55
55
{
56
56
$ wrapped = '_saw= ' .
57
- urlencode (implode (", " , $ query_params ));
57
+ base64_encode (implode (", " , $ query_params ));
58
58
$ url = phorum_api_url (PHORUM_LOGIN_ACTION_URL , $ wrapped );
59
59
}
60
60
@@ -70,16 +70,35 @@ function phorum_mod_social_authentication_parse_request()
70
70
{
71
71
global $ PHORUM ;
72
72
73
- // Backup the query string for the OpenID modules, which access the
74
- // query string directly.
75
- $ PHORUM ['MOD_SOCIAL_AUTHENTICATION_QUERY_STRING ' ] =
76
- isset ($ _SERVER ['QUERY_STRING ' ]) ? $ _SERVER ['QUERY_STRING ' ] : '' ;
77
-
78
73
// Fix the query string for Phorum use.
74
+ $ query = $ _SERVER ['QUERY_STRING ' ];
79
75
if (isset ($ _GET ['_saw ' ])) {
80
- $ _SERVER ['QUERY_STRING ' ] =
81
- urldecode ($ _GET ['_saw ' ]);
76
+ $ _SERVER ['QUERY_STRING ' ] = base64_decode ($ _GET ['_saw ' ]);
77
+ unset($ _GET ['_saw ' ]);
78
+ }
79
+
80
+ // Prepare the query string for the OpenID modules, which access the
81
+ // query string directly.
82
+ $ params = array ();
83
+ if (trim ($ query ) !== '' )
84
+ {
85
+ $ parts = explode ("& " , $ query );
86
+ foreach ($ parts as $ part ) {
87
+ $ parts = explode ("= " , $ part , 2 );
88
+ if (count ($ parts ) != 2 ) {
89
+ continue ;
90
+ }
91
+ list ($ k , $ v ) = $ parts ;
92
+ if ($ k == '_saw ' ) continue ;
93
+ $ params [urldecode ($ k )] = urldecode ($ v );
94
+ }
95
+ }
96
+
97
+ $ parts = array ();
98
+ foreach ($ params as $ k => $ v ) {
99
+ $ parts [] = urlencode ($ k ) . '= ' . urlencode ($ v );
82
100
}
101
+ $ PHORUM ['MOD_SOCIAL_AUTHENTICATION_QUERY_STRING ' ] = implode ("& " , $ parts );
83
102
}
84
103
85
104
/**
0 commit comments