Merge branch 'master' into 2.4

Conflicts:
	lib/Cake/VERSION.txt
This commit is contained in:
mark_story 2013-05-10 21:58:48 -04:00
commit df872dde28
23 changed files with 68 additions and 42 deletions

View file

@ -49,7 +49,7 @@ class CommandListShell extends AppShell {
$this->out(" -core: " . rtrim(CORE_PATH, DS)); $this->out(" -core: " . rtrim(CORE_PATH, DS));
$this->out(""); $this->out("");
$this->out(__d('cake_console', "<info>Changing Paths:</info>"), 2); $this->out(__d('cake_console', "<info>Changing Paths:</info>"), 2);
$this->out(__d('cake_console', "Your working path should be the same as your application path to change your path use the '-app' param.")); $this->out(__d('cake_console', "Your working path should be the same as your application path. To change your path use the '-app' param."));
$this->out(__d('cake_console', "Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp"), 2); $this->out(__d('cake_console', "Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp"), 2);
$this->out(__d('cake_console', "<info>Available Shells:</info>"), 2); $this->out(__d('cake_console', "<info>Available Shells:</info>"), 2);

View file

@ -63,7 +63,7 @@ class CakeBaseException extends RuntimeException {
* *
* @package Cake.Error * @package Cake.Error
*/ */
if (!class_exists('HttpException')) { if (!class_exists('HttpException', false)) {
class HttpException extends CakeBaseException { class HttpException extends CakeBaseException {
} }
} }

View file

@ -292,7 +292,7 @@ class CakeRequest implements ArrayAccess {
if ($base === DS || $base === '.') { if ($base === DS || $base === '.') {
$base = ''; $base = '';
} }
$base = implode('/', array_map('rawurlencode', explode('/', $base)));
$this->webroot = $base . '/'; $this->webroot = $base . '/';
return $this->base = $base; return $this->base = $base;
} }

View file

@ -1134,6 +1134,15 @@ class CakeRequestTest extends CakeTestCase {
public function testBaseUrlAndWebrootWithModRewrite() { public function testBaseUrlAndWebrootWithModRewrite() {
Configure::write('App.baseUrl', false); Configure::write('App.baseUrl', false);
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches';
$_SERVER['PHP_SELF'] = '/urlencode me/app/webroot/index.php';
$_SERVER['PATH_INFO'] = '/posts/view/1';
$request = new CakeRequest();
$this->assertEquals('/urlencode%20me', $request->base);
$this->assertEquals('/urlencode%20me/', $request->webroot);
$this->assertEquals('posts/view/1', $request->url);
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches'; $_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches';
$_SERVER['PHP_SELF'] = '/1.2.x.x/app/webroot/index.php'; $_SERVER['PHP_SELF'] = '/1.2.x.x/app/webroot/index.php';
$_SERVER['PATH_INFO'] = '/posts/view/1'; $_SERVER['PATH_INFO'] = '/posts/view/1';

View file

@ -725,6 +725,16 @@ XML;
) )
); );
$this->assertEquals($expected, Xml::toArray($obj)); $this->assertEquals($expected, Xml::toArray($obj));
$xml = '<tag type="myType">0</tag>';
$obj = Xml::build($xml);
$expected = array(
'tag' => array(
'@type' => 'myType',
'@' => 0
)
);
$this->assertEquals($expected, Xml::toArray($obj));
} }
/** /**

View file

@ -605,6 +605,10 @@ class HelperTest extends CakeTestCase {
Configure::write('Asset.timestamp', true); Configure::write('Asset.timestamp', true);
Configure::write('debug', 0); Configure::write('debug', 0);
$result = $this->Helper->assetTimestamp('/%3Cb%3E/cake.generic.css');
$this->assertEquals('/%3Cb%3E/cake.generic.css', $result);
$result = $this->Helper->assetTimestamp(CSS_URL . 'cake.generic.css'); $result = $this->Helper->assetTimestamp(CSS_URL . 'cake.generic.css');
$this->assertEquals(CSS_URL . 'cake.generic.css', $result); $this->assertEquals(CSS_URL . 'cake.generic.css', $result);

View file

@ -170,7 +170,7 @@ class Hash {
*/ */
protected static function _matches(array $data, $selector) { protected static function _matches(array $data, $selector) {
preg_match_all( preg_match_all(
'/(\[ (?<attr>[^=><!]+?) (\s* (?<op>[><!]?[=]|[><]) \s* (?<val>(?:\/.*?\/ | [^\]]+)) )? \])/x', '/(\[ (?P<attr>[^=><!]+?) (\s* (?P<op>[><!]?[=]|[><]) \s* (?P<val>(?:\/.*?\/ | [^\]]+)) )? \])/x',
$selector, $selector,
$conditions, $conditions,
PREG_SET_ORDER PREG_SET_ORDER

View file

@ -365,7 +365,7 @@ class Xml {
$asString = trim((string)$xml); $asString = trim((string)$xml);
if (empty($data)) { if (empty($data)) {
$data = $asString; $data = $asString;
} elseif (!empty($asString)) { } elseif (strlen($asString) > 0) {
$data['@'] = $asString; $data['@'] = $asString;
} }

View file

@ -55,10 +55,10 @@ App::uses('Debugger', 'Utility');
'<a href="#" onclick="traceToggle(event, \'trace-args-%s\')">%s(%s)</a> ', '<a href="#" onclick="traceToggle(event, \'trace-args-%s\')">%s(%s)</a> ',
$i, $i,
$called, $called,
implode(', ', $args) h(implode(', ', $args))
); );
$arguments = sprintf('<div id="trace-args-%s" class="cake-code-dump" style="display: none;"><pre>', $i); $arguments = sprintf('<div id="trace-args-%s" class="cake-code-dump" style="display: none;"><pre>', $i);
$arguments .= implode("\n", $params); $arguments .= h(implode("\n", $params));
$arguments .= '</pre></div>'; $arguments .= '</pre></div>';
endif; endif;
echo $excerpt; echo $excerpt;

View file

@ -17,20 +17,20 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
?> ?>
<h2><?php echo __d('cake_dev', 'Missing Method in %s', $controller); ?></h2> <p class="error"> <h2><?php echo __d('cake_dev', 'Missing Method in %s', h($controller)); ?></h2> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'The action %1$s is not defined in controller %2$s', '<em>' . $action . '</em>', '<em>' . $controller . '</em>'); ?> <?php echo __d('cake_dev', 'The action %1$s is not defined in controller %2$s', '<em>' . h($action) . '</em>', '<em>' . h($controller) . '</em>'); ?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Create %1$s%2$s in file: %3$s.', '<em>' . $controller . '::</em>', '<em>' . $action . '()</em>', APP_DIR . DS . 'Controller' . DS . $controller . '.php'); ?> <?php echo __d('cake_dev', 'Create %1$s%2$s in file: %3$s.', '<em>' . h($controller) . '::</em>', '<em>' . h($action) . '()</em>', APP_DIR . DS . 'Controller' . DS . h($controller) . '.php'); ?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
class <?php echo $controller; ?> extends AppController { class <?php echo h($controller); ?> extends AppController {
<strong> <strong>
public function <?php echo $action; ?>() { public function <?php echo h($action); ?>() {
} }
</strong> </strong>

View file

@ -21,15 +21,15 @@ $pluginDot = empty($plugin) ? null : $plugin . '.';
<h2><?php echo __d('cake_dev', 'Missing Behavior'); ?></h2> <h2><?php echo __d('cake_dev', 'Missing Behavior'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $pluginDot . $class . '</em>'); ?> <?php echo __d('cake_dev', '%s could not be found.', '<em>' . h($pluginDot . $class) . '</em>'); ?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'Model' . DS . 'Behavior' . DS . $class . '.php'); ?> <?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . h($class) . '</em>', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'Model' . DS . 'Behavior' . DS . h($class) . '.php'); ?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
class <?php echo $class; ?> extends ModelBehavior { class <?php echo h($class); ?> extends ModelBehavior {
} }
</pre> </pre>

View file

@ -21,15 +21,15 @@ $pluginDot = empty($plugin) ? null : $plugin . '.';
<h2><?php echo __d('cake_dev', 'Missing Component'); ?></h2> <h2><?php echo __d('cake_dev', 'Missing Component'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $pluginDot . $class . '</em>'); ?> <?php echo __d('cake_dev', '%s could not be found.', '<em>' . h($pluginDot . $class) . '</em>'); ?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', (empty($plugin) ? APP_DIR : CakePlugin::path($plugin)) . DS . 'Controller' . DS . 'Component' . DS . $class . '.php'); ?> <?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . h($class) . '</em>', (empty($plugin) ? APP_DIR : CakePlugin::path($plugin)) . DS . 'Controller' . DS . 'Component' . DS . h($class) . '.php'); ?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
class <?php echo $class; ?> extends Component { class <?php echo h($class); ?> extends Component {
} }
</pre> </pre>

View file

@ -20,18 +20,18 @@
<h2><?php echo __d('cake_dev', 'Missing Database Connection'); ?></h2> <h2><?php echo __d('cake_dev', 'Missing Database Connection'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'A Database connection using "%s" was missing or unable to connect. ', $class); ?> <?php echo __d('cake_dev', 'A Database connection using "%s" was missing or unable to connect. ', h($class)); ?>
<br /> <br />
<?php <?php
if (isset($message)): if (isset($message)):
echo __d('cake_dev', 'The database server returned this error: %s', $message); echo __d('cake_dev', 'The database server returned this error: %s', h($message));
endif; endif;
?> ?>
</p> </p>
<?php if (!$enabled) : ?> <?php if (!$enabled) : ?>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', '%s driver is NOT enabled', $class); ?> <?php echo __d('cake_dev', '%s driver is NOT enabled', h($class)); ?>
</p> </p>
<?php endif; ?> <?php endif; ?>
<p class="notice"> <p class="notice">

View file

@ -21,15 +21,15 @@ $pluginDot = empty($plugin) ? null : $plugin . '.';
<h2><?php echo __d('cake_dev', 'Missing Controller'); ?></h2> <h2><?php echo __d('cake_dev', 'Missing Controller'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $pluginDot . $class . '</em>'); ?> <?php echo __d('cake_dev', '%s could not be found.', '<em>' . h($pluginDot . $class) . '</em>'); ?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'Controller' . DS . $class . '.php'); ?> <?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . h($class) . '</em>', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'Controller' . DS . h($class) . '.php'); ?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
class <?php echo $class . ' extends ' . $plugin; ?>AppController { class <?php echo h($class . ' extends ' . $plugin); ?>AppController {
} }
</pre> </pre>

View file

@ -21,7 +21,7 @@ $pluginDot = empty($plugin) ? null : $plugin . '.';
<h2><?php echo __d('cake_dev', 'Missing Datasource'); ?></h2> <h2><?php echo __d('cake_dev', 'Missing Datasource'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Datasource class %s could not be found.', '<em>' . $pluginDot . $class . '</em>'); ?> <?php echo __d('cake_dev', 'Datasource class %s could not be found.', '<em>' . h($pluginDot . $class) . '</em>'); ?>
<?php if (isset($message)): ?> <?php if (isset($message)): ?>
<?php echo h($message); ?> <?php echo h($message); ?>
<?php endif; ?> <?php endif; ?>

View file

@ -20,7 +20,7 @@
<h2><?php echo __d('cake_dev', 'Missing Datasource Configuration'); ?></h2> <h2><?php echo __d('cake_dev', 'Missing Datasource Configuration'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'The datasource configuration %1$s was not found in database.php.', '<em>' . $config . '</em>'); ?> <?php echo __d('cake_dev', 'The datasource configuration %1$s was not found in database.php.', '<em>' . h($config) . '</em>'); ?>
</p> </p>
<p class="notice"> <p class="notice">
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>

View file

@ -21,15 +21,15 @@ $pluginDot = empty($plugin) ? null : $plugin . '.';
<h2><?php echo __d('cake_dev', 'Missing Helper'); ?></h2> <h2><?php echo __d('cake_dev', 'Missing Helper'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', '%s could not be found.', '<em>' . $pluginDot . $class . '</em>'); ?> <?php echo __d('cake_dev', '%s could not be found.', '<em>' . h($pluginDot . $class) . '</em>'); ?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . $class . '</em>', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'View' . DS . 'Helper' . DS . $class . '.php'); ?> <?php echo __d('cake_dev', 'Create the class %s below in file: %s', '<em>' . h($class) . '</em>', (empty($plugin) ? APP_DIR . DS : CakePlugin::path($plugin)) . 'View' . DS . 'Helper' . DS . h($class) . '.php'); ?>
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
class <?php echo $class; ?> extends AppHelper { class <?php echo h($class); ?> extends AppHelper {
} }
</pre> </pre>

View file

@ -20,11 +20,11 @@
<h2><?php echo __d('cake_dev', 'Missing Layout'); ?></h2> <h2><?php echo __d('cake_dev', 'Missing Layout'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'The layout file %s can not be found or does not exist.', '<em>' . $file . '</em>'); ?> <?php echo __d('cake_dev', 'The layout file %s can not be found or does not exist.', '<em>' . h($file) . '</em>'); ?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Confirm you have created the file: %s', '<em>' . $file . '</em>'); ?> <?php echo __d('cake_dev', 'Confirm you have created the file: %s', '<em>' . h($file) . '</em>'); ?>
</p> </p>
<p class="notice"> <p class="notice">
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>

View file

@ -20,7 +20,7 @@
<h2><?php echo __d('cake_dev', 'Missing Plugin'); ?></h2> <h2><?php echo __d('cake_dev', 'Missing Plugin'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'The application is trying to load a file from the %s plugin', '<em>' . $plugin . '</em>'); ?> <?php echo __d('cake_dev', 'The application is trying to load a file from the %s plugin', '<em>' . h($plugin) . '</em>'); ?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
@ -28,7 +28,7 @@
</p> </p>
<pre> <pre>
&lt;?php &lt;?php
CakePlugin::load('<?php echo $plugin?>'); CakePlugin::load('<?php echo h($plugin); ?>');
</pre> </pre>
<p class="notice"> <p class="notice">

View file

@ -20,7 +20,7 @@
<h2><?php echo __d('cake_dev', 'Missing Database Table'); ?></h2> <h2><?php echo __d('cake_dev', 'Missing Database Table'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Table %1$s for model %2$s was not found in datasource %3$s.', '<em>' . $table . '</em>', '<em>' . $class . '</em>', '<em>' . $ds . '</em>'); ?> <?php echo __d('cake_dev', 'Table %1$s for model %2$s was not found in datasource %3$s.', '<em>' . h($table) . '</em>', '<em>' . h($class) . '</em>', '<em>' . h($ds) . '</em>'); ?>
</p> </p>
<p class="notice"> <p class="notice">
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>

View file

@ -20,11 +20,11 @@
<h2><?php echo __d('cake_dev', 'Missing View'); ?></h2> <h2><?php echo __d('cake_dev', 'Missing View'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'The view for %1$s%2$s was not found.', '<em>' . Inflector::camelize($this->request->controller) . 'Controller::</em>', '<em>' . $this->request->action . '()</em>'); ?> <?php echo __d('cake_dev', 'The view for %1$s%2$s was not found.', '<em>' . h(Inflector::camelize($this->request->controller)) . 'Controller::</em>', '<em>' . h($this->request->action) . '()</em>'); ?>
</p> </p>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Confirm you have created the file: %s', $file); ?> <?php echo __d('cake_dev', 'Confirm you have created the file: %s', h($file)); ?>
</p> </p>
<p class="notice"> <p class="notice">
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>

View file

@ -20,7 +20,7 @@
<h2><?php echo __d('cake_dev', 'Private Method in %s', $controller); ?></h2> <h2><?php echo __d('cake_dev', 'Private Method in %s', $controller); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', '%s%s cannot be accessed directly.', '<em>' . $controller . '::</em>', '<em>' . $action . '()</em>'); ?> <?php echo __d('cake_dev', '%s%s cannot be accessed directly.', '<em>' . h($controller) . '::</em>', '<em>' . h($action) . '()</em>'); ?>
</p> </p>
<p class="notice"> <p class="notice">
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>

View file

@ -341,10 +341,9 @@ class Helper extends Object {
*/ */
protected function _encodeUrl($url) { protected function _encodeUrl($url) {
$path = parse_url($url, PHP_URL_PATH); $path = parse_url($url, PHP_URL_PATH);
$encoded = implode('/', array_map( $parts = array_map('urldecode', explode('/', $path));
'rawurlencode', $parts = array_map('rawurlencode', $parts);
explode('/', $path) $encoded = implode('/', $parts);
));
return h(str_replace($path, $encoded, $url)); return h(str_replace($path, $encoded, $url));
} }
@ -360,7 +359,11 @@ class Helper extends Object {
$stamp = Configure::read('Asset.timestamp'); $stamp = Configure::read('Asset.timestamp');
$timestampEnabled = $stamp === 'force' || ($stamp === true && Configure::read('debug') > 0); $timestampEnabled = $stamp === 'force' || ($stamp === true && Configure::read('debug') > 0);
if ($timestampEnabled && strpos($path, '?') === false) { if ($timestampEnabled && strpos($path, '?') === false) {
$filepath = preg_replace('/^' . preg_quote($this->request->webroot, '/') . '/', '', $path); $filepath = preg_replace(
'/^' . preg_quote($this->request->webroot, '/') . '/',
'',
urldecode($path)
);
$webrootPath = WWW_ROOT . str_replace('/', DS, $filepath); $webrootPath = WWW_ROOT . str_replace('/', DS, $filepath);
if (file_exists($webrootPath)) { if (file_exists($webrootPath)) {
//@codingStandardsIgnoreStart //@codingStandardsIgnoreStart