This commit is contained in:
Paula V. Quispe
2016-04-22 15:01:21 -04:00
parent 43f9dcc7cd
commit 6b3ee8f471
3 changed files with 38 additions and 6 deletions

View File

@@ -858,7 +858,17 @@ class Phing {
}
$firstPath = explode(":", implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
if (is_dir($firstPath[0])) {
ini_set('include_path', implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.inputfilter.php');
$filter = new InputFilter();
$incPath = implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts));
$incPath = $filter->validateInput($incPath, 'path');
ini_set('include_path', $incPath);
}
}
}

View File

@@ -117,7 +117,15 @@ class Capsule {
// extract variables into local namespace
extract($this->vars);
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.inputfilter.php');
$filter = new InputFilter();
// prepend template path to include path,
// so that include "path/relative/to/templates"; can be used within templates
$__old_inc_path = ini_get('include_path');
@@ -126,11 +134,15 @@ class Capsule {
if(strpos($path,":")>0){
$firstPath = explode(":", $this->templatePath . PATH_SEPARATOR . $__old_inc_path);
if (is_dir($firstPath[0])) {
ini_set('include_path', $this->templatePath . PATH_SEPARATOR . $__old_inc_path);
$incPath = $this->templatePath . PATH_SEPARATOR . $__old_inc_path;
$incPath = $filter->validateInput($incPath, 'path');
ini_set('include_path', $incPath);
}
} else {
if(is_dir($this->templatePath . PATH_SEPARATOR . $__old_inc_path)) {
ini_set('include_path', $this->templatePath . PATH_SEPARATOR . $__old_inc_path);
$incPath = $this->templatePath . PATH_SEPARATOR . $__old_inc_path;
$incPath = $filter->validateInput($incPath, 'path');
ini_set('include_path', $incPath);
}
}

View File

@@ -106,10 +106,20 @@ class IncludePathTask extends TaskPhing {
$add_parts = explode(PATH_SEPARATOR, $this->classpath);
$new_parts = array_diff($add_parts, $curr_parts);
$realdocuroot = str_replace( '\\', '/', $_SERVER['DOCUMENT_ROOT'] );
$docuroot = explode( '/', $realdocuroot );
array_pop( $docuroot );
$pathhome = implode( '/', $docuroot ) . '/';
array_pop( $docuroot );
$pathTrunk = implode( '/', $docuroot ) . '/';
require_once($pathTrunk.'gulliver/system/class.inputfilter.php');
$filter = new InputFilter();
if ($new_parts) {
$this->log("Prepending new include_path components: " . implode(PATH_SEPARATOR, $new_parts), PROJECT_MSG_VERBOSE);
if(is_dir(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)))) {
set_include_path(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
$dir = implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts));
$dir = $filter->validateInput($dir, 'path');
if(is_dir($dir)) {
set_include_path($dir);
}
}