Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-02-17 22:43:57

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Multi-site and draft article preview

Finally got round to getting multi-site installations working. Noticed that this breaks the draft article preview function, because the txp_login_public cookie does not cross subdomains. Just playing around I got it working again locally, and am considering submitting a patch. Questions:

I think all that needs to be done is to add the domain argument to the setcookie() calls in doTxpValidate(). Any reasons this is a bad idea? Or incomplete?

Was thinking a reasonable way to trigger this would be a preference setting, multi_site_domain, perhaps. This would be empty/false by default; if set to true or the value of the domain the domain would be added to the public-side cookie. Better ideas?


Code is topiary

Offline

#2 2010-02-20 17:08:27

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Multi-site and draft article preview

Pursuant to this idea, I noticed something puzzling (to me, anyway) in txp_auth.php, lines 171–173 169–171 (r3250):

setcookie('txp_login', $c_userid, time()+3600*24*365);
setcookie('txp_login_public', '', time()-3600, $pub_path, $domain);
$message = gTxt('bad_cookie');

Cookie exists but is apparently crumbled, and the bad_cookie message (“Your login session has expired. Please login again.”) is displayed. The public-side cookie is set to an expired value, but the admin-side cookie is refreshed. I’m thinking this is not the intent?

Edit: Thanks to Ruud for the explanation.

Last edited by jsoo (2010-02-21 23:10:03)


Code is topiary

Offline

Board footer

Powered by FluxBB