summaryrefslogtreecommitdiffstats
path: root/system/helpers/file_helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers/file_helper.php')
-rw-r--r--system/helpers/file_helper.php104
1 files changed, 52 insertions, 52 deletions
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 86c5c09db..b59443c0e 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -262,60 +262,60 @@ if ( ! function_exists('get_dir_file_info'))
* Options are: name, server_path, size, date, readable, writable, executable, fileperms
* 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
-* @return array
-*/
+* @access public
+* @param string path to file
+* @param mixed array or comma separated string of information returned
+* @return array
+*/
if ( ! function_exists('get_file_info'))
{
- function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date'))
- {
-
- if ( ! file_exists($file))
- {
- return FALSE;
- }
-
- if (is_string($returned_values))
- {
- $returned_values = explode(',', $returned_values);
- }
-
- foreach ($returned_values as $key)
- {
- switch ($key)
- {
- case 'name':
- $fileinfo['name'] = substr(strrchr($file, '/'), 1);
- break;
- case 'server_path':
- $fileinfo['server_path'] = $file;
- break;
- case 'size':
- $fileinfo['size'] = filesize($file);
- break;
- case 'date':
- $fileinfo['date'] = filectime($file);
- break;
- case 'readable':
- $fileinfo['readable'] = is_readable($file);
- break;
- case 'writable':
- // There are known problems using is_weritable on IIS. It may not be reliable - consider fileperms()
- $fileinfo['writable'] = is_writable($file);
- break;
- case 'executable':
- $fileinfo['executable'] = is_executable($file);
- break;
- case 'fileperms':
- $fileinfo['fileperms'] = fileperms($file);
- break;
- }
- }
-
- return $fileinfo;
- }
+ function get_file_info($file, $returned_values = array('name', 'server_path', 'size', 'date'))
+ {
+
+ if ( ! file_exists($file))
+ {
+ return FALSE;
+ }
+
+ if (is_string($returned_values))
+ {
+ $returned_values = explode(',', $returned_values);
+ }
+
+ foreach ($returned_values as $key)
+ {
+ switch ($key)
+ {
+ case 'name':
+ $fileinfo['name'] = substr(strrchr($file, '/'), 1);
+ break;
+ case 'server_path':
+ $fileinfo['server_path'] = $file;
+ break;
+ case 'size':
+ $fileinfo['size'] = filesize($file);
+ break;
+ case 'date':
+ $fileinfo['date'] = filectime($file);
+ break;
+ case 'readable':
+ $fileinfo['readable'] = is_readable($file);
+ break;
+ case 'writable':
+ // There are known problems using is_weritable on IIS. It may not be reliable - consider fileperms()
+ $fileinfo['writable'] = is_writable($file);
+ break;
+ case 'executable':
+ $fileinfo['executable'] = is_executable($file);
+ break;
+ case 'fileperms':
+ $fileinfo['fileperms'] = fileperms($file);
+ break;
+ }
+ }
+
+ return $fileinfo;
+ }
}
// --------------------------------------------------------------------