summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2009-04-21 15:33:40 +0200
committerDerek Jones <derek.jones@ellislab.com>2009-04-21 15:33:40 +0200
commitc37f0e1ea7fd048a7b7bf7cfcb9b41d5e703f956 (patch)
tree161c0b08024bdaae5acf8f0aaae46e3693f050b8
parentbb2e0250d459f7a60d6d24e38cae944c72110207 (diff)
switched some hard /'s to DIRECTORY_SEPARATOR
-rw-r--r--system/helpers/file_helper.php27
-rw-r--r--user_guide/changelog.html1
2 files changed, 14 insertions, 14 deletions
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index b0c554658..9602ec8c2 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -22,7 +22,7 @@
* @subpackage Helpers
* @category Helpers
* @author ExpressionEngine Dev Team
- * @link http://codeigniter.com/user_guide/helpers/file_helper.html
+ * @link http://codeigniter.com/user_guide/helpers/file_helpers.html
*/
// ------------------------------------------------------------------------
@@ -121,8 +121,8 @@ if ( ! function_exists('delete_files'))
function delete_files($path, $del_dir = FALSE, $level = 0)
{
// Trim the trailing slash
- $path = preg_replace("|^(.+?)/*$|", "\\1", $path);
-
+ $path = rtrim($path, DIRECTORY_SEPARATOR);
+
if ( ! $current_dir = @opendir($path))
return;
@@ -130,17 +130,17 @@ if ( ! function_exists('delete_files'))
{
if ($filename != "." and $filename != "..")
{
- if (is_dir($path.'/'.$filename))
+ if (is_dir($path.DIRECTORY_SEPARATOR.$filename))
{
// Ignore empty folders
if (substr($filename, 0, 1) != '.')
{
- delete_files($path.'/'.$filename, $del_dir, $level + 1);
- }
+ delete_files($path.DIRECTORY_SEPARATOR.$filename, $del_dir, $level + 1);
+ }
}
else
{
- unlink($path.'/'.$filename);
+ unlink($path.DIRECTORY_SEPARATOR.$filename);
}
}
}
@@ -190,7 +190,6 @@ if ( ! function_exists('get_filenames'))
}
elseif (strncmp($file, '.', 1) !== 0)
{
-
$_filedata[] = ($include_path == TRUE) ? $source_dir.$file : $file;
}
}
@@ -225,7 +224,7 @@ if ( ! function_exists('get_dir_file_info'))
{
static $_filedata = array();
$relative_path = $source_dir;
-
+
if ($fp = @opendir($source_dir))
{
// reset the array and make sure $source_dir has a trailing slash on the initial call
@@ -267,8 +266,8 @@ if ( ! function_exists('get_dir_file_info'))
* Returns FALSE if the file cannot be found.
*
* @access public
-* @param string path to file
-* @param mixed array or comma separated string of information returned
+* @param string path to file
+* @param mixed array or comma separated string of information returned
* @return array
*/
if ( ! function_exists('get_file_info'))
@@ -291,7 +290,7 @@ if ( ! function_exists('get_file_info'))
switch ($key)
{
case 'name':
- $fileinfo['name'] = substr(strrchr($file, '/'), 1);
+ $fileinfo['name'] = substr(strrchr($file, DIRECTORY_SEPARATOR), 1);
break;
case 'server_path':
$fileinfo['server_path'] = $file;
@@ -342,9 +341,9 @@ if ( ! function_exists('get_mime_by_extension'))
function get_mime_by_extension($file)
{
$extension = substr(strrchr($file, '.'), 1);
-
+
global $mimes;
-
+
if ( ! is_array($mimes))
{
if ( ! require_once(APPPATH.'config/mimes.php'))
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 9bc64d2ad..8b4bf293e 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -93,6 +93,7 @@ SVN Revision: </p>
<li>Fixed a bug with ORIG_PATH_INFO that was allowing URIs of just a slash through.</li>
<li>Fixed a fatal error in the Oracle and ODBC drivers (#6752)</li>
<li>Fixed a bug where Database Forge's add_column and modify_column were not looping through when sent multiple fields.</li>
+ <li>Fixed a bug where the File Helper was using '/' instead of the DIRECTORY_SEPARATOR constant.</li>
</ul>
<h2>Version 1.7.1</h2>