diff options
Diffstat (limited to 'system/core')
-rw-r--r-- | system/core/Common.php | 25 | ||||
-rw-r--r-- | system/core/Exceptions.php | 2 | ||||
-rw-r--r-- | system/core/Input.php | 2 | ||||
-rw-r--r-- | system/core/Log.php | 6 | ||||
-rw-r--r-- | system/core/Output.php | 6 |
5 files changed, 21 insertions, 20 deletions
diff --git a/system/core/Common.php b/system/core/Common.php index 55f07a871..237bd4246 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -94,17 +94,17 @@ if ( ! function_exists('is_really_writable')) if (is_dir($file)) { $file = rtrim($file, '/').'/'.md5(mt_rand()); - if (($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE) + if (($fp = @fopen($file, 'ab')) === FALSE) { return FALSE; } fclose($fp); - @chmod($file, DIR_WRITE_MODE); + @chmod($file, 0777); @unlink($file); return TRUE; } - elseif ( ! is_file($file) OR ($fp = @fopen($file, FOPEN_WRITE_CREATE)) === FALSE) + elseif ( ! is_file($file) OR ($fp = @fopen($file, 'ab')) === FALSE) { return FALSE; } @@ -177,7 +177,7 @@ if ( ! function_exists('load_class')) // self-referencing loop with the Exceptions class set_status_header(503); echo 'Unable to locate the specified class: '.$class.'.php'; - exit(EXIT_UNKNOWN_CLASS); + exit(5); // EXIT_UNK_CLASS } // Keep track of what we just loaded @@ -250,7 +250,7 @@ if ( ! function_exists('get_config')) { set_status_header(503); echo 'The configuration file does not exist.'; - exit(EXIT_CONFIG); + exit(3); // EXIT_CONFIG } // Does the $config array exist in the file? @@ -258,7 +258,7 @@ if ( ! function_exists('get_config')) { set_status_header(503); echo 'Your config file does not appear to be formatted correctly.'; - exit(EXIT_CONFIG); + exit(3); // EXIT_CONFIG } // references cannot be directly assigned to static variables, so we use an array @@ -397,16 +397,17 @@ if ( ! function_exists('show_error')) $status_code = abs($status_code); if ($status_code < 100) { - $exit_status = $status_code + EXIT__AUTO_MIN; - if ($exit_status > EXIT__AUTO_MAX) + $exit_status = $status_code + 9; // 9 is EXIT__AUTO_MIN + if ($exit_status > 125) // 125 is EXIT__AUTO_MAX { - $exit_status = EXIT_ERROR; + $exit_status = 1; // EXIT_ERROR } + $status_code = 500; } else { - $exit_status = EXIT_ERROR; + $exit_status = 1; // EXIT_ERROR } $_error =& load_class('Exceptions', 'core'); @@ -434,7 +435,7 @@ if ( ! function_exists('show_404')) { $_error =& load_class('Exceptions', 'core'); $_error->show_404($page, $log_error); - exit(EXIT_UNKNOWN_FILE); + exit(4); // EXIT_UNKNOWN_FILE } } @@ -612,7 +613,7 @@ if ( ! function_exists('_exception_handler')) // default error handling. See http://www.php.net/manual/en/errorfunc.constants.php if ($is_error) { - exit(EXIT_ERROR); + exit(1); // EXIT_ERROR } } } diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 54a5bc48b..041869641 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -125,7 +125,7 @@ class CI_Exceptions { } echo $this->show_error($heading, $message, 'error_404', 404); - exit(EXIT_UNKNOWN_FILE); + exit(4); // EXIT_UNKNOWN_FILE } // -------------------------------------------------------------------- diff --git a/system/core/Input.php b/system/core/Input.php index 1408da2cb..5ffe43d0e 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -754,7 +754,7 @@ class CI_Input { { set_status_header(503); echo 'Disallowed Key Characters.'; - exit(EXIT_USER_INPUT); + exit(7); // EXIT_USER_INPUT } } diff --git a/system/core/Log.php b/system/core/Log.php index 707964ccc..a949c3f39 100644 --- a/system/core/Log.php +++ b/system/core/Log.php @@ -108,7 +108,7 @@ class CI_Log { $this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '') ? ltrim($config['log_file_extension'], '.') : 'php'; - file_exists($this->_log_path) OR mkdir($this->_log_path, DIR_WRITE_MODE, TRUE); + file_exists($this->_log_path) OR mkdir($this->_log_path, 0777, TRUE); if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path)) { @@ -170,7 +170,7 @@ class CI_Log { } } - if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE)) + if ( ! $fp = @fopen($filepath, 'ab')) { return FALSE; } @@ -192,7 +192,7 @@ class CI_Log { if (isset($newfile) && $newfile === TRUE) { - @chmod($filepath, FILE_WRITE_MODE); + @chmod($filepath, 0666); } return is_int($result); diff --git a/system/core/Output.php b/system/core/Output.php index 7a35b02da..df9ef0778 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -555,7 +555,7 @@ class CI_Output { $cache_path .= md5($uri); - if ( ! $fp = @fopen($cache_path, FOPEN_WRITE_CREATE_DESTRUCTIVE)) + if ( ! $fp = @fopen($cache_path, 'w+b')) { log_message('error', 'Unable to write cache file: '.$cache_path); return; @@ -606,7 +606,7 @@ class CI_Output { if (is_int($result)) { - @chmod($cache_path, FILE_WRITE_MODE); + @chmod($cache_path, 0666); log_message('debug', 'Cache file written: '.$cache_path); // Send HTTP cache-control headers to browser to match file cache settings. @@ -639,7 +639,7 @@ class CI_Output { $uri = $CFG->item('base_url').$CFG->item('index_page').$URI->uri_string; $filepath = $cache_path.md5($uri); - if ( ! file_exists($filepath) OR ! $fp = @fopen($filepath, FOPEN_READ)) + if ( ! file_exists($filepath) OR ! $fp = @fopen($filepath, 'rb')) { return FALSE; } |