Remove unnecessary defined('ENVIRONMENT') checks

As suggested in issue #2134 & PR #2149
diff --git a/application/config/mimes.php b/application/config/mimes.php
index ac7bfaf..dfa9f24 100644
--- a/application/config/mimes.php
+++ b/application/config/mimes.php
@@ -176,4 +176,4 @@
 );
 
 /* End of file mimes.php */
-/* Location: ./application/config/mimes.php */
+/* Location: ./application/config/mimes.php */
\ No newline at end of file
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 8affde6..cb4b735 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -58,7 +58,7 @@
  *  Load the framework constants
  * ------------------------------------------------------
  */
-	if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
+	if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
 	{
 		require(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
 	}
diff --git a/system/core/Common.php b/system/core/Common.php
index d494caf..90cc5b3 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -241,7 +241,7 @@
 		}
 
 		// Is the config file in the environment folder?
-		if (defined('ENVIRONMENT') && file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
+		if (file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
 		{
 			require($file_path);
 		}
@@ -316,7 +316,7 @@
 	{
 		static $_mimes = array();
 
-		if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
+		if (is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'))
 		{
 			$_mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php');
 		}
diff --git a/system/core/Config.php b/system/core/Config.php
index 0160d1a..7e64444 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -106,13 +106,9 @@
 		$file = ($file === '') ? 'config' : str_replace('.php', '', $file);
 		$found = $loaded = FALSE;
 
-		$check_locations = defined('ENVIRONMENT')
-			? array(ENVIRONMENT.'/'.$file, $file)
-			: array($file);
-
 		foreach ($this->_config_paths as $path)
 		{
-			foreach ($check_locations as $location)
+			foreach (array(ENVIRONMENT.'/'.$file, $file) as $location)
 			{
 				$file_path = $path.'config/'.$location.'.php';
 
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index 2cb416c..59759e0 100644
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -81,7 +81,7 @@
 		}
 
 		// Grab the "hooks" definition file.
-		if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
+		if (is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
 		{
 			include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php');
 		}
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 1ad07f1..bbd7a84 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -1089,12 +1089,12 @@
 					// We test for both uppercase and lowercase, for servers that
 					// are case-sensitive with regard to file names. Check for environment
 					// first, global next
-					if (defined('ENVIRONMENT') && file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
+					if (file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
 					{
 						include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
 						break;
 					}
-					elseif (defined('ENVIRONMENT') && file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
+					elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
 					{
 						include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
 						break;
@@ -1180,7 +1180,7 @@
 	 */
 	protected function _ci_autoloader()
 	{
-		if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
+		if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
 		{
 			include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php');
 		}
diff --git a/system/core/Router.php b/system/core/Router.php
index f284e29..4755b37 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -133,7 +133,7 @@
 		}
 
 		// Load the routes.php file.
-		if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
+		if (is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php'))
 		{
 			include(APPPATH.'config/'.ENVIRONMENT.'/routes.php');
 		}
diff --git a/system/database/DB.php b/system/database/DB.php
index f94685c..d910474 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -43,7 +43,7 @@
 	if (is_string($params) && strpos($params, '://') === FALSE)
 	{
 		// Is the config file in the environment folder?
-		if (( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database.php'))
+		if ( ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/database.php')
 			&& ! file_exists($file_path = APPPATH.'config/database.php'))
 		{
 			show_error('The configuration file database.php does not exist.');
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 2d47416..7a71eb8 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -242,7 +242,7 @@
 
 		if ( ! is_array($_doctypes))
 		{
-			if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php'))
+			if (is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php'))
 			{
 				include(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php');
 			}
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index 186b24c..c2f50ec 100644
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
@@ -213,7 +213,7 @@
 	 */
 	function _get_smiley_array()
 	{
-		if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
+		if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
 		{
 			include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php');
 		}
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 1c7eeaf..c255c15 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -367,7 +367,7 @@
 
 		if ( ! isset($foreign_characters) OR ! is_array($foreign_characters))
 		{
-			if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
+			if (is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'))
 			{
 				include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php');
 			}
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index 1f4b2fa..3fe2e05 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -175,7 +175,7 @@
 	 */
 	protected function _load_agent_file()
 	{
-		if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php'))
+		if (is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php'))
 		{
 			include(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php');
 		}