Some of these things date back to early SMF days, and may not be 'useful' any more. I'm in the process of rewriting some stuff in Wedge's index.php file, and compared it with ElkArte's, and noticed some things that just seem odd to me. (Not all of these are in Wedge at this point, and it still seems to work fine... )
if (function_exists('set_magic_quotes_runtime'))
@set_magic_quotes_runtime(0);
IIRC, some PHP might give an error message, even with the @ set. My code for this adds a version_compare.
// We don't need no globals.
foreach (array('db_character_set', 'cachedir') as $variable)
if (isset($GLOBALS[$variable]))
unset($GLOBALS[$variable], $GLOBALS[$variable]);
I remember seeing a discussion long ago that tried to explain why a variable needed to be unset twice (!), but that still seems completely crazy to me...
Also, the whole point of this..? Unsetting $GLOBALS['db_character_set'] (and the other), to me, is exactly the same as unsetting $db_character_set at this point. Not only that, but because Settings.php overrides any existing variables, I really don't see a need to unset them first...
And finally: why these variables, and not other globals..? You might as well go through $GLOBALS, and unset anything that doesn't start with an underscore, or that isn't "GLOBALS".
if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt'))
$boarddir = dirname(__FILE__);
Why agreement.txt..? To me, it seems likelier for an admin to remove that file, than for instance, SSI.php... (Which is why I changed that.)
// Pre-dispatch
elk_main();
Well, it's no longer a 'pre'-dispatch, since the function is called from within that... In fact, it looks like you guys simply forgot to remove that function. Just move its contents in place of the call, and you can throw away the 4 globals as a bonus.
Just my 2 cents!