From c8175be96157bb97374b1d9bb1be91c7b97bd640 Mon Sep 17 00:00:00 2001 From: tschechniker Date: Wed, 4 Apr 2012 14:47:30 +0300 Subject: Added Windows path compatibility to function read_dir --- system/libraries/Zip.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index e91e2a2ff..2ec7befd3 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -279,7 +279,7 @@ class CI_Zip { */ public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL) { - $path = rtrim($path, '/\\').'/'; + $path = rtrim($path, '/\\').DIRECTORY_SEPARATOR; if ( ! $fp = @opendir($path)) { return FALSE; @@ -288,7 +288,7 @@ class CI_Zip { // Set the original directory root for child dir's to use as relative if ($root_path === NULL) { - $root_path = dirname($path).'/'; + $root_path = dirname($path).DIRECTORY_SEPARATOR; } while (FALSE !== ($file = readdir($fp))) @@ -300,11 +300,12 @@ class CI_Zip { if (@is_dir($path.$file)) { - $this->read_dir($path.$file.'/', $preserve_filepath, $root_path); + $this->read_dir($path.$file.DIRECTORY_SEPARATOR, $preserve_filepath, $root_path); } elseif (FALSE !== ($data = file_get_contents($path.$file))) { - $name = str_replace('\\', '/', $path); + $name = str_replace("\\", DIRECTORY_SEPARATOR, $path); + $name = str_replace("/", DIRECTORY_SEPARATOR, $path); if ($preserve_filepath === FALSE) { $name = str_replace($root_path, '', $name); -- cgit v1.2.3-24-g4f1b From 7bf632f4ba3a3db1ae38915efe2026d25acc9539 Mon Sep 17 00:00:00 2001 From: Tobias Tschech Date: Wed, 4 Apr 2012 15:18:26 +0300 Subject: Update user_guide_src/source/changelog.rst --- user_guide_src/source/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 9929cc368..1c8647bb7 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -194,6 +194,7 @@ Bug fixes for 3.0 - Fixed a bug (#1238) - delete_all() in the `Database Caching Library ` used to delete .htaccess and index.html files, which is a potential security risk. - Fixed a bug in :doc:`Trackback Library ` method validate_url() where it didn't actually do anything, due to input not being passed by reference. - Fixed a bug (#11, #183, #863) - CI_Form_validation::_execute() silently continued to the next rule, if a rule method/function is not found. +- Fixed a bug (#1242) Added Windows path compatibility to function read_dir of ZIP library Version 2.1.1 ============= -- cgit v1.2.3-24-g4f1b From 9664cc9fbb9b7f10776e9ad76ba7b27de5c2cda4 Mon Sep 17 00:00:00 2001 From: Tobias Tschech Date: Wed, 4 Apr 2012 15:22:33 +0300 Subject: Update system/libraries/Zip.php --- system/libraries/Zip.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php index 2ec7befd3..80438546b 100644 --- a/system/libraries/Zip.php +++ b/system/libraries/Zip.php @@ -304,8 +304,7 @@ class CI_Zip { } elseif (FALSE !== ($data = file_get_contents($path.$file))) { - $name = str_replace("\\", DIRECTORY_SEPARATOR, $path); - $name = str_replace("/", DIRECTORY_SEPARATOR, $path); + $name = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path); if ($preserve_filepath === FALSE) { $name = str_replace($root_path, '', $name); -- cgit v1.2.3-24-g4f1b