summaryrefslogtreecommitdiffstats
path: root/system/helpers/file_helper.php
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-01-10 19:50:43 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-01-10 19:50:43 +0100
commit61e42c0e97cf49033f474a8b82506a9d31c81bac (patch)
tree634850dec66305648f86d7eb9714a47728066755 /system/helpers/file_helper.php
parent9d587505fbb7f6f886802cd2a72f1ffcc97826d3 (diff)
parent176b363e534da12a38a75c9e2ba273846dfa35a7 (diff)
Merge pull request #912 from narfbg/develop-fix-fh
Fixes for two previous commits
Diffstat (limited to 'system/helpers/file_helper.php')
-rw-r--r--system/helpers/file_helper.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 9b39b8c20..2d4b10e37 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -196,16 +196,16 @@ if ( ! function_exists('get_filenames'))
while (FALSE !== ($file = readdir($fp)))
{
- if (@is_dir($source_dir.$file) && strncmp($file, '.', 1) !== 0)
+ if (@is_dir($source_dir.$file) && $file[0] !== '.')
{
get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
}
- elseif (strncmp($file, '.', 1) !== 0)
+ elseif ($file[0] !== '.')
{
$_filedata[] = ($include_path == TRUE) ? $source_dir.$file : $file;
}
}
- closedir($source_dir);
+ closedir($fp);
return $_filedata;
}
@@ -249,17 +249,17 @@ if ( ! function_exists('get_dir_file_info'))
// foreach (scandir($source_dir, 1) as $file) // In addition to being PHP5+, scandir() is simply not as fast
while (FALSE !== ($file = readdir($fp)))
{
- if (@is_dir($source_dir.$file) AND strncmp($file, '.', 1) !== 0 AND $top_level_only === FALSE)
+ if (@is_dir($source_dir.$file) && $file[0] !== '.' && $top_level_only === FALSE)
{
get_dir_file_info($source_dir.$file.DIRECTORY_SEPARATOR, $top_level_only, TRUE);
}
- elseif (strncmp($file, '.', 1) !== 0)
+ elseif ($file[0] !== '.')
{
$_filedata[$file] = get_file_info($source_dir.$file);
$_filedata[$file]['relative_path'] = $relative_path;
}
}
- closedir($source_dir);
+ closedir($fp);
return $_filedata;
}
@@ -359,7 +359,7 @@ if ( ! function_exists('get_mime_by_extension'))
if ( ! is_array($mimes))
{
- if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
+ if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
}