diff --git a/gulliver/system/class.inputfilter.php b/gulliver/system/class.inputfilter.php index 6286769bf..3330637cc 100644 --- a/gulliver/system/class.inputfilter.php +++ b/gulliver/system/class.inputfilter.php @@ -571,7 +571,12 @@ class InputFilter return $value; } - + + /** + * @param $value + * @param $type + * @return bool|int|mixed|string + */ function sanitizeInputValue($value, $type) { switch($type) { @@ -602,9 +607,13 @@ class InputFilter } return $value; - } - - + } + + /** + * @param $value + * @param $type + * @throws Exception + */ function validateInputValue($value, $type) { switch($type) { @@ -641,7 +650,15 @@ class InputFilter throw new Exception('not a string value'); } } - - - } + } + + /** + * @param $pathFile + * @return string + */ + function validatePath($pathFile) { + $sanitizefilteredPath = mb_ereg_replace("([\.]{2,})", '', $pathFile); + $sanitizefilteredPath = mb_ereg_replace("(^~)", '', $sanitizefilteredPath); + return $sanitizefilteredPath; + } } diff --git a/gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer.php b/gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer.php index bd4c21d17..1c956d864 100644 --- a/gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer.php +++ b/gulliver/thirdparty/HTMLPurifier/HTMLPurifier/DefinitionCache/Serializer.php @@ -96,9 +96,8 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac G::LoadSystem('inputfilter'); $filter = new InputFilter(); - $file = $filter->validateInput($file,'path'); - - return unlink($file); + + return unlink($filter->validateInput($file,'path')); } /** @@ -198,19 +197,17 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac private function _write($file, $data, $config) { if (!class_exists('G')) { - $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.g.php'); + $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.g.php'); } - G::LoadSystem('inputfilter'); $filter = new InputFilter(); - $file = $filter->validateInput($file,'path'); - + if(is_file($file)) { $result = file_put_contents($file, $data); } else { @@ -223,7 +220,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac $chmod = 0644; // invalid config or simpletest } $chmod = $chmod & 0666; - chmod($file, $chmod); + chmod($filter->validateInput($file, 'path'), $chmod); } return $result; } diff --git a/gulliver/thirdparty/geshi/contrib/example.php b/gulliver/thirdparty/geshi/contrib/example.php deleted file mode 100755 index 32e6f0c75..000000000 --- a/gulliver/thirdparty/geshi/contrib/example.php +++ /dev/null @@ -1,217 +0,0 @@ - tag inside the list items (
tag around the list () which is invalid in HTML 4 and XHTML 1 - // HEADER_DIV puts a
tag arount the list (valid!) but needs to replace whitespaces with   - // thus producing much larger overhead. You can set the tab width though. - $geshi->set_header_type(GESHI_HEADER_PRE_VALID); - - // Enable CSS classes. You can use get_stylesheet() to output a stylesheet for your code. Using - // CSS classes results in much less output source. - $geshi->enable_classes(); - - // Enable line numbers. We want fancy line numbers, and we want every 5th line number to be fancy - $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 5); - - // Set the style for the PRE around the code. The line numbers are contained within this box (not - // XHTML compliant btw, but if you are liberally minded about these things then you'll appreciate - // the reduced source output). - $geshi->set_overall_style('font: normal normal 90% monospace; color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', false); - - // Set the style for line numbers. In order to get style for line numbers working, the- element - // is being styled. This means that the code on the line will also be styled, and most of the time - // you don't want this. So the set_code_style reverts styles for the line (by using a
on the line). - // So the source output looks like this: - // - //- //
- - -GeSHi examples - - - -GeSHi Example Script
-To use this script, make sure that geshi.php is in the parent directory or in your -include_path, and that the language files are in a subdirectory of GeSHi's directory called geshi/.
-Enter your source and a language to highlight the source in and submit, or just choose a language to -have that language file highlighted in PHP.
-parse_code(); - echo '
'; -} -?> - - - - diff --git a/gulliver/thirdparty/pear/Net/FTP.php b/gulliver/thirdparty/pear/Net/FTP.php index bd6e6b3b7..4f8ad4d5c 100755 --- a/gulliver/thirdparty/pear/Net/FTP.php +++ b/gulliver/thirdparty/pear/Net/FTP.php @@ -1409,6 +1409,17 @@ class Net_FTP extends PEAR function getRecursive($remote_path, $local_path, $overwrite = false, $mode = null) { + if (!class_exists('G')) { + $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.g.php'); + } + G::LoadSystem('inputfilter'); + $filter = new InputFilter(); $remote_path = $this->_constructPath($remote_path); if (!$this->_checkDir($remote_path)) { return $this->raiseError("Given remote-path '".$remote_path. @@ -1421,8 +1432,8 @@ class Net_FTP extends PEAR NET_FTP_ERR_LOCALPATHNODIR); } - if (!@is_dir($local_path)) { - $res = @mkdir($local_path); + if (!@is_dir($filter->validatePath($local_path))) { + $res = @mkdir($filter->validatePath($local_path)); if (!$res) { return $this->raiseError("Could not create dir '$local_path'", NET_FTP_ERR_CREATELOCALDIR_FAILED); diff --git a/gulliver/thirdparty/pear/Net/FTP/Socket.php b/gulliver/thirdparty/pear/Net/FTP/Socket.php index 3dce53e7b..0319cb564 100755 --- a/gulliver/thirdparty/pear/Net/FTP/Socket.php +++ b/gulliver/thirdparty/pear/Net/FTP/Socket.php @@ -635,6 +635,17 @@ function ftp_put(&$control, $remote, $local, $mode, $pos = 0) */ function ftp_get(&$control, $local, $remote, $mode, $resume = 0) { + if (!class_exists('G')) { + $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.g.php'); + } + G::LoadSystem('inputfilter'); + $filter = new InputFilter(); if (!is_resource($control) || !is_writable(dirname($local)) || !is_integer($mode) || !is_integer($resume)) { return false; @@ -660,8 +671,8 @@ function ftp_get(&$control, $local, $remote, $mode, $resume = 0) return false; } - if(is_file($local)) { - $fp = fopen($local, 'w'.$windows[$mode]); + if(is_file($filter->validatePath($local))) { + $fp = fopen($filter->validatePath($local), 'w'.$windows[$mode]); } else { $fp = false; } diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index 5fff3c309..643d59f19 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -190,12 +190,17 @@ try { include (PATH_METHODS . 'processes/processes_webEntryValidate.php'); break; case 'webEntry_delete': + G::LoadSystem('inputfilter'); + $filter = new InputFilter(); $form = $_REQUEST; if(file_exists(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME'])) { - unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME']); + unlink($filter->validateInput(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . + PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME'], 'path')); } if(file_exists(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php")) { - unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php"); + unlink($filter->validateInput(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . + PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php", + 'path')); } $oProcessMap->webEntry($_REQUEST['PRO_UID']); G::auditLog('WebEntry','Delete web entry ('.$form['FILENAME'].') in process "'.$resultProcess['PRO_TITLE'].'"');