Merge pull request #709 from tubalmartin/2.1-stable

2.1.0 - Fatal error: Call to undefined method CI_DB_Driver::_reset_select()
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 8f530b4..4dfb584 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -1015,8 +1015,14 @@
 		else
 		{
 			$args = (func_num_args() > 1) ? array_splice(func_get_args(), 1) : null;
-
-			return call_user_func_array($function, $args);
+			if (is_null($args))
+			{
+				return call_user_func($function);
+			}
+			else
+			{
+				return call_user_func_array($function, $args);
+			}
 		}
 	}
 
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index d9305c0..8733ae0 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -65,7 +65,7 @@
 		$form .= '>';
 
 		// Add CSRF field if enabled, but leave it out for GET requests and requests to external websites	
-		if ($CI->config->item('csrf_protection') === TRUE AND ! (strpos($action, $CI->config->site_url()) === FALSE OR strpos($form, 'method="get"')))	
+		if ($CI->config->item('csrf_protection') === TRUE AND ! (strpos($action, $CI->config->base_url()) === FALSE OR strpos($form, 'method="get"')))	
 		{
 			$hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
 		}
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 8902f52..7f90512 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -208,7 +208,7 @@
 		}
 		else
 		{
-			if (strpos($this->new_image, '/') === FALSE)
+			if (strpos($this->new_image, '/') === FALSE AND strpos($this->new_image, '\\') === FALSE)
 			{
 				$this->dest_folder = $this->source_folder;
 				$this->dest_image = $this->new_image;
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index fe5907a..506d158 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -1042,14 +1042,17 @@
 		if (function_exists('mime_content_type'))
 		{
 			$this->file_type = @mime_content_type($file['tmp_name']);
-			return;
+			if (strlen($this->file_type) > 0) // Turns out it's possible that mime_content_type() returns FALSE or an empty string
+			{
+				return;
+			}
 		}
 
 		/* This is an ugly hack, but UNIX-type systems provide a native way to detect the file type,
 		 * which is still more secure than depending on the value of $_FILES[$field]['type'].
 		 *
 		 * Notes:
-		 *	- a 'W' in the substr() expression bellow, would mean that we're using Windows
+		 *	- the DIRECTORY_SEPARATOR comparison ensures that we're not on a Windows system
 		 *	- many system admins would disable the exec() function due to security concerns, hence the function_exists() check
 		 */
 		if (DIRECTORY_SEPARATOR !== '\\' && function_exists('exec'))
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index a20f279..b8fdcfc 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -28,7 +28,7 @@
 <div id="masthead">
 <table cellpadding="0" cellspacing="0" border="0" style="width:100%">
 <tr>
-<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.1</h1></td>
 <td id="breadcrumb_right"><a href="./toc.html">Table of Contents Page</a></td>
 </tr>
 </table>
@@ -71,6 +71,9 @@
 <h3>Bug fixes for 2.1.1</h3>
 <ul>
 	<li>Fixed a bug (#697) - A wrong array key was used in the Upload library to check for mime-types.</li>
+	<li>Fixed a bug - form_open() compared $action against site_url() instead of base_url()</li>
+	<li>Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE.</li>
+	<li>Fixed a bug (#538) - Windows paths were ignored when using the <a href="libraries/image_lib.html">Image Manipulation Class</a> to create a new file.</li>
 </ul>