1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-26 15:24:48 +02:00

MinApp.php : Log problems involving 'allowDirs' option

This commit is contained in:
Steve Clay
2009-09-13 18:30:53 +00:00
parent efe2f7df0a
commit 4cb2ba2cab

View File

@@ -104,16 +104,23 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
}
$allowDirs = array();
foreach ((array)$cOptions['allowDirs'] as $allowDir) {
$allowDirs[] = realpath(str_replace('//', $_SERVER['DOCUMENT_ROOT'] . '/', $allowDir));
$allowDir = str_replace('//', $_SERVER['DOCUMENT_ROOT'] . '/', $allowDir);
$realAllowDir = realpath($allowDir);
if (false === $realAllowDir) {
$this->log("AllowDir path '{$allowDir}' failed realpath()");
} else {
$allowDirs[] = $realAllowDir;
}
}
foreach ($files as $file) {
$path = $_SERVER['DOCUMENT_ROOT'] . $base . $file;
$file = realpath($path);
if (false === $file) {
$this->log("Path \"{$path}\" failed realpath()");
$this->log("Path '{$path}' failed realpath()");
return $options;
} elseif (! parent::_fileIsSafe($file, $allowDirs)) {
$this->log("Path \"{$path}\" failed Minify_Controller_Base::_fileIsSafe()");
$this->log("File '{$file}' was not found, or not located"
. " inside the 'allowDirs': " . var_export($allowDirs, 1));
return $options;
} else {
$sources[] = new Minify_Source(array(