diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/codeigniter/Common.php | 38 | ||||
-rw-r--r-- | system/database/DB_cache.php | 3 | ||||
-rw-r--r-- | system/helpers/file_helper.php | 35 | ||||
-rw-r--r-- | system/libraries/Log.php | 2 | ||||
-rw-r--r-- | system/libraries/Output.php | 4 | ||||
-rw-r--r-- | system/libraries/Upload.php | 2 | ||||
-rw-r--r-- | system/plugins/captcha_pi.php | 2 |
7 files changed, 43 insertions, 43 deletions
diff --git a/system/codeigniter/Common.php b/system/codeigniter/Common.php index b6f0a46e8..d9ddf80c7 100644 --- a/system/codeigniter/Common.php +++ b/system/codeigniter/Common.php @@ -30,6 +30,44 @@ // ------------------------------------------------------------------------
/**
+ * Tests for file writability
+ *
+ * is_writable() returns TRUE on Windows servers
+ * when you really can't write to the file
+ * as the OS reports to PHP as FALSE only if the
+ * read-only attribute is marked. Ugh?
+ *
+ * @access private
+ * @return void
+ */
+function is_really_writable($file)
+{
+ if (is_dir($file))
+ {
+ $file = rtrim($file, '/').'/'.md5(rand(1,100));
+
+ if (($fp = @fopen($file, 'ab')) === FALSE)
+ {
+ return FALSE;
+ }
+
+ fclose($fp);
+ @chmod($file, 0777);
+ @unlink($file);
+ return TRUE;
+ }
+ elseif (($fp = @fopen($file, 'ab')) === FALSE)
+ {
+ return FALSE;
+ }
+
+ fclose($fp);
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------
+
+/**
* Class registry
*
* This function acts as a singleton. If the requested class does not
diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 44b8e815f..ad54fc315 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -63,9 +63,6 @@ class CI_DB_Cache { // Add a trailing slash to the path if needed
$path = preg_replace("/(.+?)\/*$/", "\\1/", $path);
-
- // Load the file helper
- $this->CI->load->helper('file');
if ( ! is_dir($path) OR ! is_really_writable($path))
{
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 5fb31cfaa..868561b5a 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -178,39 +178,4 @@ function get_filenames($source_dir, $include_path = FALSE) // --------------------------------------------------------------------
-/**
- * Tests for file writability
- *
- * is_writable() returns TRUE on Windows servers
- * when you really can't write to the file
- * as the OS reports to PHP as FALSE only if the
- * read-only attribute is marked. Ugh?
- *
- * @access private
- * @return void
- */
-function is_really_writable($file)
-{
- if (is_dir($file))
- {
- $file = rtrim($file, '/').'/'.md5(rand(1,100));
-
- if (($fp = @fopen($file, 'ab')) === FALSE)
- {
- return FALSE;
- }
-
- fclose($fp);
- @chmod($file, 0777);
- @unlink($file);
- return TRUE;
- }
- elseif (($fp = @fopen($file, 'ab')) === FALSE)
- {
- return FALSE;
- }
-
- fclose($fp);
- return TRUE;
-}
?>
\ No newline at end of file diff --git a/system/libraries/Log.php b/system/libraries/Log.php index 011bdbfd1..f9ca85a30 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -46,7 +46,7 @@ class CI_Log { $this->log_path = ($config['log_path'] != '') ? $config['log_path'] : BASEPATH.'logs/';
- if ( ! is_dir($this->log_path) OR ! is_writable($this->log_path))
+ if ( ! is_dir($this->log_path) OR ! is_really_writable($this->log_path))
{
$this->_enabled = FALSE;
}
diff --git a/system/libraries/Output.php b/system/libraries/Output.php index f98dab5e0..a4d8d34b8 100644 --- a/system/libraries/Output.php +++ b/system/libraries/Output.php @@ -285,7 +285,7 @@ class CI_Output { $cache_path = ($path == '') ? BASEPATH.'cache/' : $path;
- if ( ! is_dir($cache_path) OR ! is_writable($cache_path))
+ if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path))
{
return;
}
@@ -327,7 +327,7 @@ class CI_Output { $cache_path = ($CFG->item('cache_path') == '') ? BASEPATH.'cache/' : $CFG->item('cache_path');
- if ( ! is_dir($cache_path) OR ! is_writable($cache_path))
+ if ( ! is_dir($cache_path) OR ! is_really_writable($cache_path))
{
return FALSE;
}
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 39f1ed59b..dd7012211 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -641,7 +641,7 @@ class CI_Upload { return FALSE;
}
- if ( ! is_writable($this->upload_path))
+ if ( ! is_really_writable($this->upload_path))
{
$this->set_error('upload_not_writable');
return FALSE;
diff --git a/system/plugins/captcha_pi.php b/system/plugins/captcha_pi.php index 11d4564d3..693fd9117 100644 --- a/system/plugins/captcha_pi.php +++ b/system/plugins/captcha_pi.php @@ -180,7 +180,7 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = return FALSE;
}
- if ( ! is_writable($img_path))
+ if ( ! is_really_writable($img_path))
{
return FALSE;
}
|