summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/config/mimes.php12
-rw-r--r--application/config/user_agents.php3
-rw-r--r--system/core/Log.php2
-rw-r--r--system/core/Output.php26
-rw-r--r--user_guide_src/source/changelog.rst1
5 files changed, 31 insertions, 13 deletions
diff --git a/application/config/mimes.php b/application/config/mimes.php
index cced3ee02..124e4a436 100644
--- a/application/config/mimes.php
+++ b/application/config/mimes.php
@@ -73,7 +73,7 @@ return array(
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
- 'js' => 'application/x-javascript',
+ 'js' => array('application/x-javascript', 'text/plain'),
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
@@ -104,16 +104,16 @@ return array(
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
- 'css' => 'text/css',
- 'html' => 'text/html',
- 'htm' => 'text/html',
- 'shtml' => 'text/html',
+ 'css' => array('text/css', 'text/plain'),
+ 'html' => array('text/html', 'text/plain'),
+ 'htm' => array('text/html', 'text/plain'),
+ 'shtml' => array('text/html', 'text/plain'),
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
- 'xml' => array('application/xml', 'text/xml'),
+ 'xml' => array('application/xml', 'text/xml', 'text/plain'),
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
diff --git a/application/config/user_agents.php b/application/config/user_agents.php
index 7f86d2dfc..35c36cb42 100644
--- a/application/config/user_agents.php
+++ b/application/config/user_agents.php
@@ -101,7 +101,8 @@ $browsers = array(
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
- 'IBrowse' => 'IBrowse'
+ 'IBrowse' => 'IBrowse',
+ 'Maxthon' => 'Maxthon'
);
$mobiles = array(
diff --git a/system/core/Log.php b/system/core/Log.php
index 9dabfe6f2..cd3c17e1e 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -97,6 +97,8 @@ class CI_Log {
$this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/';
+ file_exists($this->_log_path) OR mkdir($this->_log_path, DIR_WRITE_MODE, TRUE);
+
if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path))
{
$this->_enabled = FALSE;
diff --git a/system/core/Output.php b/system/core/Output.php
index 27e711783..a20841463 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -544,9 +544,15 @@ class CI_Output {
$expire = time() + ($this->cache_expiration * 60);
+ // Put together our serialized info.
+ $cache_info = serialize(array(
+ 'expire' => $expire,
+ 'headers' => $this->headers
+ ));
+
if (flock($fp, LOCK_EX))
{
- fwrite($fp, $expire.'TS--->'.$output);
+ fwrite($fp, $cache_info.'ENDCI--->'.$output);
flock($fp, LOCK_UN);
}
else
@@ -595,14 +601,16 @@ class CI_Output {
flock($fp, LOCK_UN);
fclose($fp);
- // Strip out the embedded timestamp
- if ( ! preg_match('/^(\d+)TS--->/', $cache, $match))
+ // Look for embedded serialized file info.
+ if ( ! preg_match('/^(.*)ENDCI--->/', $cache, $match))
{
return FALSE;
}
+ $cache_info = unserialize($match[1]);
+ $expire = $cache_info['expire'];
+
$last_modified = filemtime($cache_path);
- $expire = $match[1];
// Has the file expired?
if ($_SERVER['REQUEST_TIME'] >= $expire && is_really_writable($cache_path))
@@ -618,6 +626,12 @@ class CI_Output {
$this->set_cache_header($last_modified, $expire);
}
+ // Add headers from cache file.
+ foreach ($cache_info['headers'] as $header)
+ {
+ $this->set_header($header[0], $header[1]);
+ }
+
// Display the cache
$this->_display(substr($cache, strlen($match[0])));
log_message('debug', 'Cache file is current. Sending it to browser.');
@@ -742,7 +756,7 @@ class CI_Output {
$output = preg_replace('{\s*<!--[^\[<>].*(?<!!)-->\s*}msU', '', $output);
// Remove spaces around block-level elements.
- $output = preg_replace('/\s*(<\/?(html|head|title|meta|script|link|style|body|h[1-6]|div|p|br)[^>]*>)\s*/is', '$1', $output);
+ $output = preg_replace('/\s*(<\/?(html|head|title|meta|script|link|style|body|table|thead|tbody|tfoot|tr|th|td|h[1-6]|div|p|br)[^>]*>)\s*/is', '$1', $output);
// Replace mangled <pre> etc. tags with unprocessed ones.
@@ -758,7 +772,7 @@ class CI_Output {
$output = str_replace($codes_messed[0], $codes_clean[0], $output);
}
- if ( ! empty($codes_clean))
+ if ( ! empty($textareas_clean))
{
preg_match_all('{<textarea.+</textarea>}msU', $output, $textareas_messed);
$output = str_replace($textareas_messed[0], $textareas_clean[0], $output);
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 989999929..f6dad07b3 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -321,6 +321,7 @@ Release Date: Not Released
- Changed method ``load()`` to filter the language name with ``ctype_digit()``.
- Added an optional second parameter to method ``line()`` to disable error login for line keys that were not found.
- Language files are now loaded in a cascading style with the one in **system/** always loaded and overriden afterwards, if another one is found.
+ - Log Library will now try to create the **log_path** directory if it doesn't exist.
Bug fixes for 3.0
------------------