summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2013-02-15 21:30:31 +0100
committerAndrey Andreev <narf@bofh.bg>2013-02-15 21:30:31 +0100
commita107a0fd79d0ee5f6292138a76398ed390041710 (patch)
tree207176937ce460debb5fb6c83e42661468c90bdf /system/core
parentd11673b5fc09c28e06333946db0a3841eeea4024 (diff)
Fix some stuff from recent pull requests
Diffstat (limited to 'system/core')
-rw-r--r--system/core/Common.php6
-rw-r--r--system/core/Log.php24
2 files changed, 20 insertions, 10 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index 136dd521c..f8c1290f5 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -414,7 +414,7 @@ if ( ! function_exists('log_message'))
function log_message($level = 'error', $message, $php_error = FALSE)
{
static $_log, $_log_threshold;
-
+
if ($_log_threshold === NULL)
{
$_log_threshold = config_item('log_threshold');
@@ -429,7 +429,7 @@ if ( ! function_exists('log_message'))
{
$_log =& load_class('Log', 'core');
}
-
+
$_log->write_log($level, $message, $php_error);
}
}
@@ -713,4 +713,4 @@ if ( ! function_exists('function_usable'))
}
/* End of file Common.php */
-/* Location: ./system/core/Common.php */
+/* Location: ./system/core/Common.php */ \ No newline at end of file
diff --git a/system/core/Log.php b/system/core/Log.php
index 0749de8ba..a84d3dc22 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -73,6 +73,13 @@ class CI_Log {
protected $_date_fmt = 'Y-m-d H:i:s';
/**
+ * Filename extension
+ *
+ * @var string
+ */
+ protected $_file_ext;
+
+ /**
* Whether or not the logger can write to the log files
*
* @var bool
@@ -86,8 +93,10 @@ class CI_Log {
*/
protected $_levels = array('ERROR' => 1, 'DEBUG' => 2, 'INFO' => 3, 'ALL' => 4);
+ // --------------------------------------------------------------------
+
/**
- * Initialize Logging class
+ * Class constructor
*
* @return void
*/
@@ -96,8 +105,8 @@ class CI_Log {
$config =& get_config();
$this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/';
-
- $this->_log_ext = ($config['log_file_extension'] !== '') ? ltrim($config['log_file_extension'], '.') : $this->_log_ext;
+ $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);
@@ -149,15 +158,16 @@ class CI_Log {
return FALSE;
}
- $filepath = $this->_log_path.'log-'.date('Y-m-d').'.php';
- $message = '';
+ $filepath = $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext;
+ $message = '';
if ( ! file_exists($filepath))
{
$newfile = TRUE;
- if($this->_log_ext === 'php')
+ // Only add protection to php files
+ if ($this->_file_ext === 'php')
{
- $message .= '<'."?php defined('BASEPATH') OR exit('No direct script access allowed'); ?".">\n\n";
+ $message .= "<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>\n\n";
}
}