summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/core/Output.php74
-rw-r--r--system/database/DB_query_builder.php5
2 files changed, 76 insertions, 3 deletions
diff --git a/system/core/Output.php b/system/core/Output.php
index 6312ccd86..98deff55c 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -256,7 +256,7 @@ class CI_Output {
{
for ($i = 0, $c = count($this->headers); $i < $c; $i++)
{
- if (sscanf($this->headers[$i][0], 'Content-Type: %s', $content_type) === 1)
+ if (sscanf($this->headers[$i][0], 'Content-Type: %[^;]', $content_type) === 1)
{
return $content_type;
}
@@ -268,6 +268,39 @@ class CI_Output {
// --------------------------------------------------------------------
/**
+ * Get Header
+ *
+ * @param string $header_name
+ * @return string
+ */
+ public function get_header($header)
+ {
+ // Combine headers already sent with our batched headers
+ $headers = array_merge(
+ // We only need [x][0] from our multi-dimensional array
+ array_map('array_shift', $this->headers),
+ headers_list()
+ );
+
+ if (empty($headers) OR empty($header))
+ {
+ return NULL;
+ }
+
+ for ($i = 0, $c = count($headers); $i < $c; $i++)
+ {
+ if (strncasecmp($header, $headers[$i], $l = strlen($header)) === 0)
+ {
+ return trim(substr($headers[$i], $l+1));
+ }
+ }
+
+ return NULL;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Set HTTP Status Header
*
* As of version 1.7.2, this is an alias for common function
@@ -594,6 +627,45 @@ class CI_Output {
// --------------------------------------------------------------------
/**
+ * Delete cache
+ *
+ * @param string $uri URI string
+ * @return bool
+ */
+ public function delete_cache($uri = '')
+ {
+ $CI =& get_instance();
+ $cache_path = $CI->config->item('cache_path');
+ if ($cache_path === '')
+ {
+ $cache_path = APPPATH.'cache/';
+ }
+
+ if ( ! is_dir($cache_path))
+ {
+ log_message('error', 'Unable to find cache path: '.$cache_path);
+ return FALSE;
+ }
+
+ if (empty($uri))
+ {
+ $uri = $CI->uri->uri_string();
+ }
+
+ $cache_path .= md5($CI->config->item('base_url').$CI->config->item('index_page').$uri);
+
+ if ( ! @unlink($cache_path))
+ {
+ log_message('error', 'Unable to delete cache file for '.$uri);
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Set Cache Header
*
* Set the HTTP headers to match the server-side file cache settings
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 9bd535b0e..e77fba63d 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -903,11 +903,12 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
}
is_bool($escape) OR $escape = $this->_protect_identifiers;
- $prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0)
- ? $this->_group_get_type('') : $this->_group_get_type($type);
foreach ($field as $k => $v)
{
+ $prefix = (count($this->qb_where) === 0 && count($this->qb_cache_where) === 0)
+ ? $this->_group_get_type('') : $this->_group_get_type($type);
+
$v = $this->escape_like_str($v);
if ($side === 'none')