Permalink
Browse files

Updated base url parsing to account for app's folder structure changes.

  • Loading branch information...
1 parent 20b993f commit a1dac801fcff7d23c2f3520d3eb33dec75220a7d @ADmad ADmad committed Jan 11, 2014
Showing with 67 additions and 73 deletions.
  1. +4 −10 src/Network/Request.php
  2. +63 −63 tests/TestCase/Network/RequestTest.php
View
@@ -346,14 +346,11 @@ protected static function _base() {
if (!$baseUrl) {
$base = dirname(env('PHP_SELF'));
- $indexPos = strpos($base, '/webroot/index.php');
+ $indexPos = strpos($base, '/' . $webroot . '/index.php');
if ($indexPos !== false) {
- $base = substr($base, 0, $indexPos) . '/webroot';
+ $base = substr($base, 0, $indexPos) . '/' . $webroot;
}
- if ($webroot === 'webroot' && $webroot === basename($base)) {
- $base = dirname($base);
- }
- if ($dir === 'App' && $dir === basename($base)) {
+ if ($webroot === basename($base)) {
$base = dirname($base);
}
@@ -373,12 +370,9 @@ protected static function _base() {
$webrootDir = $base . '/';
$docRoot = env('DOCUMENT_ROOT');
- $docRootContainsWebroot = strpos($docRoot, $dir . DS . $webroot);
+ $docRootContainsWebroot = strpos($docRoot, $webroot);
if (!empty($base) || !$docRootContainsWebroot) {
- if (strpos($webrootDir, '/' . $dir . '/') === false) {
- $webrootDir .= $dir . '/';
- }
if (strpos($webrootDir, '/' . $webroot . '/') === false) {
$webrootDir .= $webroot . '/';
}
Oops, something went wrong.

0 comments on commit a1dac80

Please sign in to comment.