summaryrefslogtreecommitdiffstats
path: root/system
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
parentd11673b5fc09c28e06333946db0a3841eeea4024 (diff)
Fix some stuff from recent pull requests
Diffstat (limited to 'system')
-rw-r--r--system/core/Common.php6
-rw-r--r--system/core/Log.php24
-rw-r--r--system/libraries/Profiler.php3
3 files changed, 21 insertions, 12 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";
}
}
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index 36e0431b2..470688fdc 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -238,7 +238,6 @@ class CI_Profiler {
foreach ($dbs as $name => $db)
{
$hide_queries = (count($db->queries) > $this->_query_toggle_count) ? ' display:none' : '';
-
$total_time = number_format(array_sum($db->query_times), 4).' '.$this->CI->lang->line('profiler_seconds');
$show_hide_js = '(<span style="cursor: pointer;" onclick="var s=document.getElementById(\'ci_profiler_queries_db_'.$count.'\').style;s.display=s.display==\'none\'?\'\':\'none\';this.innerHTML=this.innerHTML==\''.$this->CI->lang->line('profiler_section_hide').'\'?\''.$this->CI->lang->line('profiler_section_show').'\':\''.$this->CI->lang->line('profiler_section_hide').'\';">'.$this->CI->lang->line('profiler_section_hide').'</span>)';
@@ -252,7 +251,7 @@ class CI_Profiler {
."\n"
.'<legend style="color:#0000FF;">&nbsp;&nbsp;'.$this->CI->lang->line('profiler_database')
.':&nbsp; '.$db->database.' ('.$name.')&nbsp;&nbsp;&nbsp;'.$this->CI->lang->line('profiler_queries')
- .': '.count($db->queries).'('.$total_time.')'.'&nbsp;&nbsp;'.$show_hide_js."</legend>\n\n\n"
+ .': '.count($db->queries).' ('.$total_time.')&nbsp;&nbsp;'.$show_hide_js."</legend>\n\n\n"
.'<table style="width:100%;'.$hide_queries.'" id="ci_profiler_queries_db_'.$count."\">\n";
if (count($db->queries) === 0)