diff options
| author | Chad Kieffer <ckieffer@gmail.com> | 2009-06-09 00:26:01 -0600 |
|---|---|---|
| committer | Chad Kieffer <ckieffer@gmail.com> | 2009-06-09 00:26:01 -0600 |
| commit | a42c101c0b76edb403f2f9c646c27539b983394b (patch) | |
| tree | 833c42c308aa5eca8a0469a67b723936e33a81f9 /application | |
| parent | d2b8ca241d6b2a1c1a512c731721b738e719d613 (diff) | |
| parent | e6768a4e9771f5f751d74001ce3a0d33f6775216 (diff) | |
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'application')
| -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 |
