diff options
author | Andy Staudacher <andy.st@gmail.com> | 2010-02-27 21:26:38 -0800 |
---|---|---|
committer | Andy Staudacher <andy.st@gmail.com> | 2010-02-27 21:26:38 -0800 |
commit | 70837b5212966e173c886c376fae20a29cee8737 (patch) | |
tree | 16ee547bc4967cc957e909ea5647e2f6f8bfa788 /modules/gallery/helpers/access.php | |
parent | 74113f869a37bd5eda1175c9eb520b938c4793c4 (diff) |
Fix for ticket #1035: Make .htaccess access rules work for the case when index.php isn't part of generated URLs.
Diffstat (limited to 'modules/gallery/helpers/access.php')
-rw-r--r-- | modules/gallery/helpers/access.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/modules/gallery/helpers/access.php b/modules/gallery/helpers/access.php index 7e8b079a..af336798 100644 --- a/modules/gallery/helpers/access.php +++ b/modules/gallery/helpers/access.php @@ -637,8 +637,22 @@ class access_Core { $dirs[] = dirname($album->thumb_path()); } - $base_url = url::site("?kohana_uri=/file_proxy"); - $base_url = str_replace("/?", "?", $base_url); + $base_url = url::base(true); + $sep = "?"; + if (strpos($base_url, "?") !== false) { + $sep = "&"; + } + $base_url .= $sep . "kohana_uri=/file_proxy"; + // Replace "/index.php/?kohana..." with "/index.php?koahan..." + // Doesn't apply to "/?kohana..." or "/foo/?kohana..." + // Can't check for "index.php" since the file might be renamed, and + // there might be more Apache aliases / rewrites at work. + $url_path = parse_url($base_url, PHP_URL_PATH); + // Does the URL path have a file component? + if (preg_match("#[^/]+\.php#i", $url_path)) { + $base_url = str_replace("/?", "?", $base_url); + } + foreach ($dirs as $dir) { if ($value === self::DENY) { $fp = fopen("$dir/.htaccess", "w+"); |