ElkArte Community

Title: if (typeof(window.XMLHttpRequest) != "undefined")
Post by: emanuele on December 21, 2013, 10:00:34 am
From what I read around this is for IE 5 and 6, am I wrong?
Title: Re: if (typeof(window.XMLHttpRequest) != "undefined")
Post by: Spuds on December 21, 2013, 11:13:32 am
Thats correct ... I think ie7+ has window.XMLHttpRequest availalble ... I've been lazy about yanking that one out, feel free (you know you want to) :D
Title: Re: if (typeof(window.XMLHttpRequest) != "undefined")
Post by: emanuele on December 21, 2013, 12:34:57 pm
Code: [Select]
// Some older versions of Mozilla don't have this, for some reason.
if (!('forms' in document))
document.forms = document.getElementsByTagName('form');

/me wonders what "old" means...

ETA: it was introduced between beta 3 and RC2 (didn't test in between), so it should be a fairly old (i.e. < firefox 3.5)

/me removes it as well

https://github.com/elkarte/Elkarte/pull/1181
Title: Re: if (typeof(window.XMLHttpRequest) != "undefined")
Post by: emanuele on December 22, 2013, 10:59:24 am
Don't want to open another topic, so I'll put it here.

From Auth.controller.php:
Code: [Select]
elseif (!empty($_SESSION['logout_url']) && (strpos('http://', $_SESSION['logout_url']) === false && strpos('https://', $_SESSION['logout_url']) === false))
headscratch

shouldn't be:
Code: [Select]
strpos($_SESSION['logout_url'], 'http://')
and
Code: [Select]
strpos($_SESSION['logout_url'], 'https://')

???
Title: Re: if (typeof(window.XMLHttpRequest) != "undefined")
Post by: emanuele on December 22, 2013, 11:42:26 am
Also in OpenID.subs.php, function canonize:
Code: [Select]
		if (strpos(substr($uri, strpos($uri, '://') + 3), '/') === false)
$uri .= '/';
What is supposed to do that piece of code?
Add a / at the end of the url?
Title: Re: if (typeof(window.XMLHttpRequest) != "undefined")
Post by: Spuds on December 22, 2013, 01:57:03 pm
Sure seems backwards ... thats only going to be true if $_SESSION['logout_url'] equals http(s)://
Quote from: emanuele – Also in OpenID.subs.php, function canonize:
Code: [Select]
		if (strpos(substr($uri, strpos($uri, '://') + 3), '/') === false)
$uri .= '/';
What is supposed to do that piece of code?
Add a / at the end of the url?
Looks that way, starts searching after the http(s):// stuff and if it does not find any / it adds one ... but xyz.abc.com/bla would pass that check I think.  If it just want to make sure there is always a trailing / then a substr -1 may be more understandable check.
Title: Re: if (typeof(window.XMLHttpRequest) != "undefined")
Post by: Spuds on December 22, 2013, 02:08:49 pm
Well I'm thinking about it ... I know there were a few other places that we needed to do a http(s)? check, we added a couple a while back but I think there were a few more on the todo list.  Can't find the github issue ATM but I know its buried in one of the comments when the issue first came up and the immediate problem child was fixed.

Also  :D  since we are removing that XMLHttpRequest  thing, there is some old code in the quotefast function that should be removed as well (at least I think) ... There was some none XMLHttpRequest work around that opened a new browser window with the quote and then grabbed the data from the popup and inserted it in the quick reply, or something along those lines ... pretty sure all that non xml (but still js) stuff can go bye bye.
Title: Re: if (typeof(window.XMLHttpRequest) != "undefined")
Post by: emanuele on December 22, 2013, 02:43:26 pm
Quote from: Spuds –
Quote from: emanuele – From Auth.controller.php:

???
Sure seems backwards ... thats only going to be true if $_SESSION['logout_url'] equals http(s)://
https://github.com/emanuele45/Dialogo/commit/0db15e9ebfb43790f19d9d6be781ac91d4d7608b

Quote from: Spuds –
Quote from: emanuele – Also in OpenID.subs.php, function canonize:
Code: [Select]
		if (strpos(substr($uri, strpos($uri, '://') + 3), '/') === false)
$uri .= '/';
What is supposed to do that piece of code?
Add a / at the end of the url?
Looks that way, starts searching after the http(s):// stuff and if it does not find any / it adds one ... but xyz.abc.com/bla would pass that check I think.  If it just want to make sure there is always a trailing / then a substr -1 may be more understandable check.
Right, I had the impression there was something more, but didn't pay enough attention...
I changed it here:
https://github.com/emanuele45/Dialogo/commit/63cad8dd93258ccc0c934a41c7f07428f0c9dfa7
but I'll revert it and will do in a slightly different way.
Thanks!

Quote from: Spuds – Well I'm thinking about it ... I know there were a few other places that we needed to do a http(s)? check, we added a couple a while back but I think there were a few more on the todo list.  Can't find the github issue ATM but I know its buried in one of the comments when the issue first came up and the immediate problem child was fixed.
I found these:
https://github.com/emanuele45/Dialogo/commit/35cfaa8b1b02e8fcc2b3312e788662686403a1cf
https://github.com/emanuele45/Dialogo/commit/422d2177b5382e05dff6de45ba275c19a541385c
https://github.com/emanuele45/Dialogo/commit/3a513546f3d30cf1a41cd562394d1c03693edc68


Quote from: Spuds – Also  :D  since we are removing that XMLHttpRequest  thing, there is some old code in the quotefast function that should be removed as well (at least I think) ... There was some none XMLHttpRequest work around that opened a new browser window with the quote and then grabbed the data from the popup and inserted it in the quick reply, or something along those lines ... pretty sure all that non xml (but still js) stuff can go bye bye.
mmm... arg...
Well, we can remove them when we found any... O:-)
I have almost no idea where to look... lol