extract(->vars);

This commit is contained in:
Ronald Q
2016-05-17 12:07:07 -04:00
parent dc0658e90a
commit dde7353c1a
3 changed files with 8 additions and 40 deletions

View File

@@ -858,17 +858,7 @@ class Phing {
}
$firstPath = explode(":", implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
if (is_dir($firstPath[0])) {
$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);
ini_set('include_path', implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
}
}
}

View File

@@ -118,15 +118,7 @@ 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,
// 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');
@@ -134,15 +126,11 @@ class Capsule {
if(strpos($path,":")>0){
$firstPath = explode(":", $this->templatePath . PATH_SEPARATOR . $__old_inc_path);
if (is_dir($firstPath[0])) {
$incPath = $this->templatePath . PATH_SEPARATOR . $__old_inc_path;
$incPath = $filter->validateInput($incPath, 'path');
ini_set('include_path', $incPath);
}
ini_set('include_path', $this->templatePath . PATH_SEPARATOR . $__old_inc_path);
}
} else {
if(is_dir($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);
ini_set('include_path', $this->templatePath . PATH_SEPARATOR . $__old_inc_path);
}
}

View File

@@ -105,21 +105,11 @@ class IncludePathTask extends TaskPhing {
$curr_parts = explode(PATH_SEPARATOR, get_include_path());
$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);
$dir = implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts));
$dir = $filter->validateInput($dir, 'path');
if(is_dir($dir)) {
set_include_path($dir);
if(is_dir(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)))) {
set_include_path(implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
}
}