often there's the need to do a redirect through a HTTP Location header (particularly when using the PRG pattern). But even if it works on nearly every browser with relative URLs, the internet standard (RFC 1945) clearly states, that a fully qualified absolute URL has to be given. So I suggest to add a constant to the core, say CMSIMPLE_URL, perhaps as follows:
- Code: Select all
define('CMSIMPLE_URL', 'http://'.(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 's' : '')
.$_SERVER['SERVER_NAME'].preg_replace('/index.php$/', '', $_SERVER['PHP_SELF']));
There might be problems with the correct recognition of HTTP vs. HTTPS in case of proxies, but that's probably no real problem, as CMSimple sites seldom are accessed through HTTPS.
With this constant, redirection would be really simple, e.g.
- Code: Select all
header('Location: '.CMSIMPLE_URL.'?'.$su);
Plugins could use this constant in a downward compatible way:
- Code: Select all
if (!defined('CMSIMPLE_URL')) {
define('CMSIMPLE_URL', ...);
}
What do you think about it?
Christoph

