ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: scripple on March 08, 2014, 03:08:17 pm

Title: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: scripple on March 08, 2014, 03:08:17 pm
In subs.php obExit, should $_SESSION['old_url'] really be updated after and xml request?  Or should strpos($_SERVER['REQUEST_URL'], 'xml') === false be added to the list of checks not to update it?

Is there another variable that says where someone came from to an action/page that doesn't get set to xml requests?
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: emanuele on March 09, 2014, 08:58:59 am
Yep, that should be added indeed.
Also, since there are several places where this old_url is set, wouldn't make more sense to create a function setOldUrl or something similar that does that?
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: scripple on March 09, 2014, 11:43:17 am
Functions are good.  I finally had to do code edits to change the way permissions for posting and editing posts worked.  action_post calls a checkPermissions function.  Post2 does it all inline.  And jsmodify does it all inline but mostly they are redundant as it puts most restrictions on the database jquery to basically enforce the permissions it later checks.

Would have been great if they all called the permissions function in Messages.subs and if that had a hook to override them.  But I know this is legacy from SMF and will be cleaned up over time.
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: emanuele on March 09, 2014, 04:31:37 pm
If you find those kind of things, feel free to report anything you find (or just fix them if you want to give it a try, in that case feel free to ask anything it may be not clear ;)), it would help as future reference for future refactoring of the code! ;D
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: scripple on March 09, 2014, 10:32:47 pm
Along the same lines, jsmodify calls functions like isAllowedTo() which checks permissions and if they fail redirects to an error page.  Of course that error page is a standard html page not any kind of response expected over ajax so instead of the user seeing the error it seems like nothing happens.

Note that's different than allowedTo which returns a bool (or equivalent) to the php.
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: emanuele on March 10, 2014, 08:00:08 am
Yeah, another piece that is not very well structured.
I think isAllowedTo (or better fatal_error) should know "how" to setup the answer (i.e. html, xml, json).
But that's something for 1.1, along with some kind of standardization of the answers I think?

/me feels this should be tracked in the 1200 issue (beta 1.1 goals).
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: scripple on March 10, 2014, 04:45:58 pm
Tried twice to post.  Post button not working.  Trying quick reply.
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: scripple on March 10, 2014, 04:47:52 pm
Odd.  Trying normal post again.  If the functions are  going to live on then yes put on the list to make them output format aware.
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: emanuele on February 04, 2015, 05:15:40 pm
Bump because it has been lost for too long.
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: Spuds on February 07, 2015, 04:41:17 pm
On the OP, do we need to add ;api as well .. not sure if we ever call that without xml though
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: emanuele on February 13, 2015, 02:41:06 pm
You are probably right, at least for consistency.
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: emanuele on March 22, 2015, 01:45:56 pm
And tracked that as well: https://github.com/elkarte/Elkarte/issues/2000
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: Spuds on March 22, 2015, 03:45:16 pm
I think I may have added that ;api as part of 1.0.3  O:-)
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: emanuele on March 22, 2015, 04:10:36 pm
I can't see it in my repo (script.js line 614).
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: Spuds on March 22, 2015, 04:12:15 pm
Not the script but in obexit ... forgot about the script :P
Title: Re: Possible bug in old_url / Maybe I just don't know the code well enough.
Post by: scripple on March 22, 2015, 08:25:54 pm
Yes the ;api change is there.  It's what triggered me to check if the script had been fixed.  (I'd pretty much forgotten the bug as well.)