diff options
author | dkm <dkm@gre.kataplop.net> | 2009-06-09 13:40:40 +0200 |
---|---|---|
committer | dkm <dkm@gre.kataplop.net> | 2009-06-09 13:40:40 +0200 |
commit | 93acc00959acaa365b0750f4ed8cf1cb2e2caefc (patch) | |
tree | a84e4fb45e51841d202b654bc99cf8eab41cd40e /application/config/config.php | |
parent | e77ba1d7512b3d7f4c3cd12bb499e0e296c485ae (diff) | |
parent | a42c101c0b76edb403f2f9c646c27539b983394b (diff) |
Merge branch 'master' of git@github.com:dkm/gallery3
Diffstat (limited to 'application/config/config.php')
-rw-r--r-- | application/config/config.php | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/application/config/config.php b/application/config/config.php index d274a31b..2d66d1c0 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -22,9 +22,25 @@ * Base path of the web site. If this includes a domain, eg: localhost/kohana/ * then a full URL will be used, eg: http://localhost/kohana/. If it only includes * the path, and a site_protocol is specified, the domain will be auto-detected. + * + * Here we do our best to autodetect the base path to Gallery. If your url is something like: + * http://example.com/gallery3/index.php/album73/photo5.jpg?param=value + * + * We want the site_domain to be: + * /gallery3 + * + * In the above example, $_SERVER["SCRIPT_NAME"] contains "/gallery3/index.php" so + * dirname($_SERVER["SCRIPT_NAME"]) is what we need. Except some low end hosts (namely 1and1.com) + * break SCRIPT_NAME and it contains the extra path info, so in the above example it'd be: + * /gallery3/index.php/album73/photo5.jpg + * + * So dirname doesn't work. So we do a tricky workaround where we look up the SCRIPT_FILENAME (in + * this case it'd be "index.php" and we delete from that part onwards. If you work at 1and1 and + * you're reading this, please fix this bug! */ -$config["site_domain"] = dirname( - empty($_SERVER["ORIG_SCRIPT_NAME"]) ? $_SERVER["SCRIPT_NAME"] : $_SERVER["ORIG_SCRIPT_NAME"]); +$config["site_domain"] = + substr($_SERVER["SCRIPT_NAME"], 0, + strpos($_SERVER["SCRIPT_NAME"], basename($_SERVER["SCRIPT_FILENAME"]))); /** * Force a default protocol to be used by the site. If no site_protocol is |