summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/core/Common.php28
-rw-r--r--system/core/Exceptions.php2
-rw-r--r--system/core/Input.php3
-rw-r--r--system/core/Output.php2
-rw-r--r--system/database/DB_driver.php2
-rw-r--r--system/database/DB_forge.php6
-rw-r--r--system/database/DB_query_builder.php41
-rw-r--r--system/database/drivers/cubrid/cubrid_driver.php41
-rw-r--r--system/database/drivers/mysql/mysql_driver.php41
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php41
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php41
-rw-r--r--system/libraries/Cache/drivers/Cache_file.php2
-rw-r--r--system/libraries/Driver.php2
-rw-r--r--system/libraries/Email.php9
-rw-r--r--system/libraries/Image_lib.php2
-rw-r--r--system/libraries/Trackback.php6
16 files changed, 84 insertions, 185 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index ee9bb2e87..10c22375e 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -175,7 +175,8 @@ if ( ! function_exists('load_class'))
// Note: We use exit() rather then show_error() in order to avoid a
// self-referencing loop with the Exceptions class
set_status_header(503);
- exit('Unable to locate the specified class: '.$class.'.php');
+ echo 'Unable to locate the specified class: '.$class.'.php';
+ exit(EXIT_UNKNOWN_CLASS);
}
// Keep track of what we just loaded
@@ -248,14 +249,16 @@ if ( ! function_exists('get_config'))
elseif ( ! $found)
{
set_status_header(503);
- exit('The configuration file does not exist.');
+ echo 'The configuration file does not exist.';
+ exit(EXIT_CONFIG);
}
// Does the $config array exist in the file?
if ( ! isset($config) OR ! is_array($config))
{
set_status_header(503);
- exit('Your config file does not appear to be formatted correctly.');
+ echo 'Your config file does not appear to be formatted correctly.';
+ exit(EXIT_CONFIG);
}
// Are any values being dynamically replaced?
@@ -367,9 +370,24 @@ if ( ! function_exists('show_error'))
*/
function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered')
{
+ $status_code = abs($status_code);
+ if ($status_code < 100)
+ {
+ $exit_status = $status_code + EXIT__AUTO_MIN;
+ if ($exit_status > EXIT__AUTO_MAX)
+ {
+ $exit_status = EXIT_ERROR;
+ }
+ $status_code = 500;
+ }
+ else
+ {
+ $exit_status = EXIT_ERROR;
+ }
+
$_error =& load_class('Exceptions', 'core');
echo $_error->show_error($heading, $message, 'error_general', $status_code);
- exit;
+ exit($exit_status);
}
}
@@ -392,7 +410,7 @@ if ( ! function_exists('show_404'))
{
$_error =& load_class('Exceptions', 'core');
$_error->show_404($page, $log_error);
- exit;
+ exit(EXIT_UNKNOWN_FILE);
}
}
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index e6023e73b..9c68d06a5 100644
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -117,7 +117,7 @@ class CI_Exceptions {
}
echo $this->show_error($heading, $message, 'error_404', 404);
- exit;
+ exit(EXIT_UNKNOWN_FILE);
}
// --------------------------------------------------------------------
diff --git a/system/core/Input.php b/system/core/Input.php
index 68a8fe03f..8d491e055 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -745,7 +745,8 @@ class CI_Input {
if ( ! preg_match('/^[a-z0-9:_\/|-]+$/i', $str))
{
set_status_header(503);
- exit('Disallowed Key Characters.');
+ echo 'Disallowed Key Characters.';
+ exit(EXIT_USER_INPUT);
}
// Clean UTF-8 if supported
diff --git a/system/core/Output.php b/system/core/Output.php
index 25ecd496c..3320ae154 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -793,6 +793,8 @@ class CI_Output {
case 'text/css':
case 'text/javascript':
+ case 'application/javascript':
+ case 'application/x-javascript':
$output = $this->_minify_script_style($output);
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index ed0296d76..18dbbc76e 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -1658,7 +1658,7 @@ abstract class CI_DB_driver {
$error =& load_class('Exceptions', 'core');
echo $error->show_error($heading, $message, 'error_db');
- exit;
+ exit(EXIT_DATABASE);
}
// --------------------------------------------------------------------
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 53cdd53b6..d52029ecd 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -680,8 +680,12 @@ abstract class CI_DB_forge {
return $sql.'DROP COLUMN '.$this->db->escape_identifiers($field);
}
+ $sql .= ($alter_type === 'ADD')
+ ? 'ADD '
+ : $alter_type.' COLUMN ';
+
$sqls = array();
- for ($i = 0, $c = count($field), $sql .= $alter_type.' COLUMN '; $i < $c; $i++)
+ for ($i = 0, $c = count($field); $i < $c; $i++)
{
$sqls[] = $sql
.($field[$i]['_literal'] !== FALSE ? $field[$i]['_literal'] : $this->_process_column($field[$i]));
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 85a233b50..292621b66 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1855,6 +1855,47 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
// --------------------------------------------------------------------
/**
+ * Update_Batch statement
+ *
+ * Generates a platform-specific batch update string from the supplied data
+ *
+ * @param string $table Table name
+ * @param array $values Update data
+ * @param string $index WHERE key
+ * @return string
+ */
+ protected function _update_batch($table, $values, $index)
+ {
+ $ids = array();
+ foreach ($values as $key => $val)
+ {
+ $ids[] = $val[$index];
+
+ foreach (array_keys($val) as $field)
+ {
+ if ($field !== $index)
+ {
+ $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
+ }
+ }
+ }
+
+ $cases = '';
+ foreach ($final as $k => $v)
+ {
+ $cases .= $k." = CASE \n"
+ .implode("\n", $v)."\n"
+ .'ELSE '.$k.' END, ';
+ }
+
+ $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
+
+ return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* The "set_update_batch" function. Allows key/value pairs to be set for batch updating
*
* @param array
diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php
index 6663868bd..51bbbdb47 100644
--- a/system/database/drivers/cubrid/cubrid_driver.php
+++ b/system/database/drivers/cubrid/cubrid_driver.php
@@ -430,47 +430,6 @@ class CI_DB_cubrid_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Update_Batch statement
- *
- * Generates a platform-specific batch update string from the supplied data
- *
- * @param string $table Table name
- * @param array $values Update data
- * @param string $index WHERE key
- * @return string
- */
- protected function _update_batch($table, $values, $index)
- {
- $ids = array();
- foreach ($values as $key => $val)
- {
- $ids[] = $val[$index];
-
- foreach (array_keys($val) as $field)
- {
- if ($field !== $index)
- {
- $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
- }
- }
- }
-
- $cases = '';
- foreach ($final as $k => $v)
- {
- $cases .= $k." = CASE \n"
- .implode("\n", $v)
- .'ELSE '.$k.' END, ';
- }
-
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
-
- return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
- }
-
- // --------------------------------------------------------------------
-
- /**
* FROM tables
*
* Groups tables in FROM clauses if needed, so there is no confusion
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 95003f648..b94642b35 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -456,47 +456,6 @@ class CI_DB_mysql_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Update_Batch statement
- *
- * Generates a platform-specific batch update string from the supplied data
- *
- * @param string $table Table name
- * @param array $values Update data
- * @param string $index WHERE key
- * @return string
- */
- protected function _update_batch($table, $values, $index)
- {
- $ids = array();
- foreach ($values as $key => $val)
- {
- $ids[] = $val[$index];
-
- foreach (array_keys($val) as $field)
- {
- if ($field !== $index)
- {
- $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
- }
- }
- }
-
- $cases = '';
- foreach ($final as $k => $v)
- {
- $cases .= $k." = CASE \n"
- .implode("\n", $v)."\n"
- .'ELSE '.$k.' END, ';
- }
-
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
-
- return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
- }
-
- // --------------------------------------------------------------------
-
- /**
* FROM tables
*
* Groups tables in FROM clauses if needed, so there is no confusion
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index b64a7a2e8..ef2cb8a8d 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -427,47 +427,6 @@ class CI_DB_mysqli_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Update_Batch statement
- *
- * Generates a platform-specific batch update string from the supplied data
- *
- * @param string $table Table name
- * @param array $values Update data
- * @param string $index WHERE key
- * @return string
- */
- protected function _update_batch($table, $values, $index)
- {
- $ids = array();
- foreach ($values as $key => $val)
- {
- $ids[] = $val[$index];
-
- foreach (array_keys($val) as $field)
- {
- if ($field !== $index)
- {
- $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
- }
- }
- }
-
- $cases = '';
- foreach ($final as $k => $v)
- {
- $cases .= $k.' = CASE '."\n"
- .implode("\n", $v)."\n"
- .'ELSE '.$k.' END, ';
- }
-
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
-
- return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
- }
-
- // --------------------------------------------------------------------
-
- /**
* FROM tables
*
* Groups tables in FROM clauses if needed, so there is no confusion
diff --git a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
index 315f6f53b..ff486fc5a 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_mysql_driver.php
@@ -201,47 +201,6 @@ class CI_DB_pdo_mysql_driver extends CI_DB_pdo_driver {
// --------------------------------------------------------------------
/**
- * Update_Batch statement
- *
- * Generates a platform-specific batch update string from the supplied data
- *
- * @param string $table Table name
- * @param array $values Update data
- * @param string $index UPDATE key
- * @return string
- */
- protected function _update_batch($table, $values, $index)
- {
- $ids = array();
- foreach ($values as $key => $val)
- {
- $ids[] = $val[$index];
-
- foreach (array_keys($val) as $field)
- {
- if ($field !== $index)
- {
- $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
- }
- }
- }
-
- $cases = '';
- foreach ($final as $k => $v)
- {
- $cases .= $k." = CASE \n"
- .implode("\n", $v)."\n"
- .'ELSE '.$k.' END), ';
- }
-
- $this->where($index.' IN('.implode(',', $ids).')', NULL, FALSE);
-
- return 'UPDATE '.$table.' SET '.substr($cases, 0, -2).$this->_compile_wh('qb_where');
- }
-
- // --------------------------------------------------------------------
-
- /**
* Truncate statement
*
* Generates a platform-specific truncate string from the supplied data
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php
index f1f1a30be..769bd5a26 100644
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
@@ -133,7 +133,7 @@ class CI_Cache_file extends CI_Driver {
*/
public function clean()
{
- return delete_files($this->_cache_path);
+ return delete_files($this->_cache_path, FALSE, TRUE);
}
// ------------------------------------------------------------------------
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index 382420db0..1bc365cbc 100644
--- a/system/libraries/Driver.php
+++ b/system/libraries/Driver.php
@@ -290,7 +290,7 @@ class CI_Driver {
$trace = debug_backtrace();
_exception_handler(E_ERROR, "No such method '{$method}'", $trace[1]['file'], $trace[1]['line']);
- exit;
+ exit(EXIT_UNKNOWN_METHOD);
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 728b637a3..a745d331d 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -105,9 +105,9 @@ class CI_Email {
/**
* SMTP Encryption
*
- * @var string NULL, 'tls' or 'ssl'
+ * @var string empty, 'tls' or 'ssl'
*/
- public $smtp_crypto = NULL;
+ public $smtp_crypto = '';
/**
* Whether to apply word-wrapping to the message body.
@@ -1875,7 +1875,7 @@ class CI_Email {
return TRUE;
}
- $ssl = ($this->smtp_crypto === 'ssl') ? 'ssl://' : NULL;
+ $ssl = ($this->smtp_crypto === 'ssl') ? 'ssl://' : '';
$this->_smtp_connect = fsockopen($ssl.$this->smtp_host,
$this->smtp_port,
@@ -2021,8 +2021,7 @@ class CI_Email {
{
return TRUE;
}
-
- if (strpos($reply, '334') !== 0)
+ elseif (strpos($reply, '334') !== 0)
{
$this->_set_error_message('lang:email_failed_smtp_login', $reply);
return FALSE;
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 0cec43fc4..b6a11a3a5 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -388,7 +388,7 @@ class CI_Image_lib {
*/
public function clear()
{
- $props = array('library_path', 'source_image', 'new_image', 'width', 'height', 'rotation_angle', 'x_axis', 'y_axis', 'wm_text', 'wm_overlay_path', 'wm_font_path', 'wm_shadow_color', 'source_folder', 'dest_folder', 'mime_type', 'orig_width', 'orig_height', 'image_type', 'size_str', 'full_src_path', 'full_dst_path');
+ $props = array('thumb_marker', 'library_path', 'source_image', 'new_image', 'width', 'height', 'rotation_angle', 'x_axis', 'y_axis', 'wm_text', 'wm_overlay_path', 'wm_font_path', 'wm_shadow_color', 'source_folder', 'dest_folder', 'mime_type', 'orig_width', 'orig_height', 'image_type', 'size_str', 'full_src_path', 'full_dst_path');
foreach ($props as $val)
{
diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php
index ecc7129e3..5a45be8dd 100644
--- a/system/libraries/Trackback.php
+++ b/system/libraries/Trackback.php
@@ -211,8 +211,7 @@ class CI_Trackback {
*/
public function send_error($message = 'Incomplete Information')
{
- echo '<?xml version="1.0" encoding="utf-8"?'.">\n<response>\n<error>1</error>\n<message>".$message."</message>\n</response>";
- exit;
+ exit('<?xml version="1.0" encoding="utf-8"?'.">\n<response>\n<error>1</error>\n<message>".$message."</message>\n</response>");
}
// --------------------------------------------------------------------
@@ -227,8 +226,7 @@ class CI_Trackback {
*/
public function send_success()
{
- echo '<?xml version="1.0" encoding="utf-8"?'.">\n<response>\n<error>0</error>\n</response>";
- exit;
+ exit('<?xml version="1.0" encoding="utf-8"?'.">\n<response>\n<error>0</error>\n</response>");
}
// --------------------------------------------------------------------