Merge changes from develop
diff --git a/system/core/Input.php b/system/core/Input.php
index 4a0caa5..b65509f 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -329,11 +329,7 @@
 		}
 
 		$proxy_ips = config_item('proxy_ips');
-		if (empty($proxy_ips))
-		{
-			$proxy_ips = FALSE;
-		}
-		elseif ( ! is_array($proxy_ips))
+		if ( ! empty($proxy_ips) && ! is_array($proxy_ips))
 		{
 			$proxy_ips = explode(',', str_replace(' ', '', $proxy_ips));
 		}
@@ -366,7 +362,7 @@
 				}
 			}
 
-			if ($spoof !== NULL)
+			if ($spoof)
 			{
 				for ($i = 0, $c = count($proxy_ips), $separator = (strlen($ip) === 32 ? '.' : ':'); $i < $c; $i++)
 				{
@@ -441,12 +437,6 @@
 			}
 		}
 
-		if (strpos($this->ip_address, ',') !== FALSE)
-		{
-			$x = explode(',', $this->ip_address);
-			$this->ip_address = trim($x[0]);
-		}
-
 		if ( ! $this->valid_ip($this->ip_address))
 		{
 			return $this->ip_address = '0.0.0.0';
@@ -602,7 +592,7 @@
 		$_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']);
 
 		// CSRF Protection check
-		if ($this->_enable_csrf === TRUE)
+		if ($this->_enable_csrf === TRUE && ! $this->is_cli_request())
 		{
 			$this->security->csrf_verify();
 		}