ElkArte Community

Elk Development => Feature Discussion => Topic started by: Nao on December 09, 2013, 08:52:41 am

Title: Constants
Post by: Nao on December 09, 2013, 08:52:41 am
While I'm here... MessageIndex has a bug in board descriptions, more precisely in the 'Sort by...' popup. It's cut off by an overflow. Ouch.

If you're following my development over at Wedge, I'm currently rewriting the codebase to get rid, once and for all, of themes. Because, well, my skin code is just less f*cked up (if you'll ask me), and I suspect it will make things simpler, here and there.
One of the added benefits is that I'll be able to load theme paths earlier in the code flow, and thus maybe turn them into constants. (Which, I'm afraid aren't as fast as globals, but I'm all for making things faster, and anyway I haven't decided yet, I'll probably eventually go for we::$theme_url or something, don't get me started on this!)

So, I had a look at the Elk codebase because I remembered you guys had turned $boarddir to BOARDDIR and so on.
And then I look at the code flow.
- index.php:58, var is turned to constant.
- later in the file, loadTheme() is called.
- in loadTheme(), Elk tests the current URL, and determines if it needs to update $boarddir with the new, modified URL.
- as such, it then resets $boarddir... But, obviously, NOT the BOARDDIR constant.

I haven't looked where BOARDDIR and other constants are being used, and if it's of any use really, but I've had a feeling that I should point this out to you guys. Dunno if it can't be considered a bug, but you may want to go through the loadTheme code, and see if it's all right!
Title: Re: Constants
Post by: emanuele on December 09, 2013, 10:24:19 am
loadTheme tries to fix $boardurl, not $boarddir. ;)

Though I found one wrong $boarddir around in the code...

/me fixes that!
Title: Re: Constants
Post by: TE on December 09, 2013, 11:36:56 am
Quote from: Nao – While I'm here... MessageIndex has a bug in board descriptions, more precisely in the 'Sort by...' popup. It's cut off by an overflow. Ouch.
thanks for the report, bug has been fixed some days ago .. the site isn't up to date.
Title: Re: Constants
Post by: Nao on December 09, 2013, 03:59:00 pm
Sorry ema, I missed that one lol.

Still. I remember about a conversation on this particular issue, but can't fins it anymore. Bugger. I still need to make a decision. I don't like making multiple commits that show me change my mind over and over again. ;)
Title: Re: Constants
Post by: emanuele on December 09, 2013, 05:46:55 pm
I remember some comment from Arantor (I think) about the fact that we were still using variables in Settings.php and not constants directly from the beginning, but no idea where and when... lol
Title: Re: Constants
Post by: Nao on December 10, 2013, 03:54:01 am
Well it's not possible to store a constant from the start if you want to be able to fix the value later, anyway...

Personally, I'm thinking of not allowing for source folders and other root sub-folders to be modified. I don't see a reason why one would want to put them somewhere else. Security? Seriously...