Date/Time bug fixes...

Questions about modifications to Zuluru code, to add or change features
Post Reply
sulfur
Posts: 38
Joined: Fri Nov 08, 2013 3:08 pm
Location: Kingston, ON

Date/Time bug fixes...

Post by sulfur »

As I'm setting up Zuluru on our site, we want it to have a fair bit of stuff available to the public. One thing I did come across in the views/helpers/zuluru_time.php module, when the software looks for the personal options for formats of dates and times, it uses an "array_shift" method if there is no personal setting in place.

The problem I've come across is that there can be issues with the way this is handled, because the arrays are being dealt with by reference (for all intents and purposes), and each time the format function is called, it shifts from its last location and reads the next item in the list. Changing the "array_shift()" calls to use "reset()" calls instead solves this problem rather nicely.
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: Date/Time bug fixes...

Post by GregS »

Strange, I haven't experienced that. Just explicitly tested that scenario right now, and it behaved as I expected it to. Seems maybe it's something specific to the way that the CakePHP Configure class works with the very old version of PHP you're using? Anyway, seems that reset is a better option for various reasons, so I'll change it to that, and look elsewhere in the code as I expect other places will also be using this method.

BTW, as pertains to the "public" nature of the site you mentioned, have you looked at the "public site" setting under Configuration -> Settings -> Features?
sulfur
Posts: 38
Joined: Fri Nov 08, 2013 3:08 pm
Location: Kingston, ON

Re: Date/Time bug fixes...

Post by sulfur »

Yes, I did find the "public" setting (and have set that up -- though the site isn't actually public yet, despite the fact that our season is 4 weeks old already! :) ). It does approach more the ideal that we're looking for.

My next step (once everything else works) is to figure out how to present a base front page that doesn't demand an immediate login! Haha.
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: Date/Time bug fixes...

Post by GregS »

I've replaced array_shift with reset everywhere that it looks appropriate. Pretty sure I haven't broken anything in the process! Anything where it wasn't obviously fine, like where it was array_shift(array_keys(...)), I tested, so it should all be fine, but that does sound like famous last words.
GregS
Site Admin
Posts: 240
Joined: Thu Jan 06, 2011 4:58 pm

Re: Date/Time bug fixes...

Post by GregS »

sulfur wrote:My next step (once everything else works) is to figure out how to present a base front page that doesn't demand an immediate login! Haha.
In the beforeFilter function of AppController, look for where it sets $this->Auth->loginAction. In the case of third-party authentication (e.g. integration with Joomla, etc.), it goes to leagues/index, but otherwise it goes to users/login. You can easily adjust this to go to wherever you prefer.
Post Reply