Don't use error suppression on realpath() + style adjustments
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index b8b7053..8cfe0f1 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -137,14 +137,12 @@
}
}
}
- @closedir($current_dir);
- if ($del_dir === TRUE && $_level > 0)
- {
- return @rmdir($path);
- }
+ closedir($current_dir);
- return TRUE;
+ return ($del_dir === TRUE && $_level > 0)
+ ? @rmdir($path)
+ : TRUE;
}
}
@@ -178,7 +176,7 @@
while (FALSE !== ($file = readdir($fp)))
{
- if (@is_dir($source_dir.$file) && $file[0] !== '.')
+ if (is_dir($source_dir.$file) && $file[0] !== '.')
{
get_filenames($source_dir.$file.DIRECTORY_SEPARATOR, $include_path, TRUE);
}
@@ -187,8 +185,8 @@
$_filedata[] = ($include_path === TRUE) ? $source_dir.$file : $file;
}
}
- closedir($fp);
+ closedir($fp);
return $_filedata;
}
@@ -230,7 +228,7 @@
// 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) && $file[0] !== '.' && $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);
}
@@ -240,8 +238,8 @@
$_filedata[$file]['relative_path'] = $relative_path;
}
}
- closedir($fp);
+ closedir($fp);
return $_filedata;
}
@@ -330,8 +328,6 @@
*/
function get_mime_by_extension($filename)
{
- $extension = strtolower(substr(strrchr($filename, '.'), 1));
-
static $mimes;
if ( ! is_array($mimes))
@@ -344,6 +340,8 @@
}
}
+ $extension = strtolower(substr(strrchr($filename, '.'), 1));
+
if (isset($mimes[$extension]))
{
return is_array($mimes[$extension])
@@ -405,18 +403,18 @@
// Owner
$symbolic .= (($perms & 0x0100) ? 'r' : '-')
- . (($perms & 0x0080) ? 'w' : '-')
- . (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));
+ .(($perms & 0x0080) ? 'w' : '-')
+ .(($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));
// Group
$symbolic .= (($perms & 0x0020) ? 'r' : '-')
- . (($perms & 0x0010) ? 'w' : '-')
- . (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
+ .(($perms & 0x0010) ? 'w' : '-')
+ .(($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
// World
$symbolic .= (($perms & 0x0004) ? 'r' : '-')
- . (($perms & 0x0002) ? 'w' : '-')
- . (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));
+ .(($perms & 0x0002) ? 'w' : '-')
+ .(($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));
return $symbolic;
}