Page 1 of 1

Date/Time bug fixes...

Posted: Mon Nov 11, 2013 3:55 pm
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.

Re: Date/Time bug fixes...

Posted: Tue Nov 12, 2013 9:21 pm
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?

Re: Date/Time bug fixes...

Posted: Tue Nov 12, 2013 11:16 pm
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.

Re: Date/Time bug fixes...

Posted: Fri Nov 15, 2013 2:55 pm
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.

Re: Date/Time bug fixes...

Posted: Wed Nov 20, 2013 8:37 pm
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.