Permalink
Browse files

MFB: first part of "Make Ajax calls without enabled cookies work". Se…

…rver-side work is done with this commit. Now only the JS-part in the phorum ajax lib is missing (related to #816)
  • Loading branch information...
1 parent 6ba0bf6 commit 2f8fd76f477b4a803fa50cef1bde0164959e7a33 @mysnip mysnip committed Jul 8, 2011
Showing with 13 additions and 0 deletions.
  1. +13 −0 ajax.php
View
@@ -96,6 +96,19 @@
$ajax_call = basename($PHORUM['ajax_args']['call']);
+// try to get some session-id if there isn't already a user loaded through
+// the regular ways
+if(empty($PHORUM['user']['user_id'])) {
+ // check if we got a session-id in the ajax args and if we got one
+ // try to load a user with that data
+ $ajax_session_id = phorum_ajax_getarg(PHORUM_SESSION_LONG_TERM,'string',0);
+ if(!empty($ajax_session_id)) {
+ $PHORUM['use_cookies']=PHORUM_USE_COOKIES;
+ $PHORUM['args'][PHORUM_SESSION_LONG_TERM]=$ajax_session_id;
+ phorum_api_user_session_restore(PHORUM_FORUM_SESSION);
+ }
+}
+
/**
* [hook]
* ajax_<call>

0 comments on commit 2f8fd76

Please sign in to comment.