summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Barnes <eric@ericlbarnes.com>2011-03-22 02:28:58 +0100
committerEric Barnes <eric@ericlbarnes.com>2011-03-22 02:28:58 +0100
commitfdd5b11b62f127901ddff2e5dc7923b063371070 (patch)
tree62b688d3635918089348a8cca9d4ce03d9ca3711
parent74089b2e80614f65112d812470b0959909e37682 (diff)
Fixed logic and removed the error supressing
-rw-r--r--system/core/Hooks.php6
-rw-r--r--system/core/Router.php8
-rw-r--r--system/helpers/download_helper.php6
-rw-r--r--system/helpers/file_helper.php6
-rw-r--r--system/helpers/html_helper.php6
-rw-r--r--system/helpers/text_helper.php13
-rw-r--r--system/libraries/Upload.php17
-rw-r--r--system/libraries/User_agent.php11
8 files changed, 34 insertions, 39 deletions
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index b41c645ae..d1e5586de 100644
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -65,13 +65,13 @@ class CI_Hooks {
// Grab the "hooks" definition file.
// If there are no hooks, we're done.
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT);
}
- else
+ elseif (is_file(APPPATH.'config/hooks'.EXT))
{
- @include(APPPATH.'config/hooks'.EXT);
+ include(APPPATH.'config/hooks'.EXT);
}
diff --git a/system/core/Router.php b/system/core/Router.php
index bd363da71..2c78efe07 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -87,15 +87,15 @@ class CI_Router {
}
// Load the routes.php file.
-
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/routes'.EXT);
}
- else
+ elseif (is_file(APPPATH.'config/routes'.EXT))
{
- @include(APPPATH.'config/routes'.EXT);
+ include(APPPATH.'config/routes'.EXT);
}
+
$this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route;
unset($route);
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 56e4c2a2f..e537cdeca 100644
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
@@ -58,13 +58,13 @@ if ( ! function_exists('force_download'))
$extension = end($x);
// Load the mime types
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT);
}
- else
+ elseif (is_file(APPPATH.'config/mimes'.EXT))
{
- @include(APPPATH.'config/mimes'.EXT);
+ include(APPPATH.'config/mimes'.EXT);
}
// Set a default mime if we can't find it
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index f4b48b484..7a35c3fa1 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -352,13 +352,13 @@ if ( ! function_exists('get_mime_by_extension'))
if ( ! is_array($mimes))
{
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT);
}
- else
+ elseif (is_file(APPPATH.'config/mimes'.EXT))
{
- @include(APPPATH.'config/mimes'.EXT);
+ include(APPPATH.'config/mimes'.EXT);
}
if ( ! is_array($mimes))
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 15c15a919..53fc899a3 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -258,13 +258,13 @@ if ( ! function_exists('doctype'))
if ( ! is_array($_doctypes))
{
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT))
{
include(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT);
}
- else
+ elseif (is_file(APPPATH.'config/doctypes'.EXT))
{
- @include(APPPATH.'config/doctypes'.EXT);
+ include(APPPATH.'config/doctypes'.EXT);
}
if ( ! is_array($_doctypes))
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 99f521fb5..664408912 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -366,18 +366,13 @@ if ( ! function_exists('convert_accented_characters'))
{
function convert_accented_characters($str)
{
- if ( ! file_exists(APPPATH.'config/foreign_chars'.EXT) AND ! file_exists(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT))
{
- return $str;
+ include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT);
}
-
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT))
- {
- include APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT;
- }
- else
+ elseif (is_file(APPPATH.'config/foreign_chars'.EXT))
{
- include APPPATH.'config/foreign_chars'.EXT;
+ include(APPPATH.'config/foreign_chars'.EXT);
}
if ( ! isset($foreign_characters))
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index e8e47a194..5816a5558 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -951,20 +951,21 @@ class CI_Upload {
if (count($this->mimes) == 0)
{
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT))
{
- $_mimes_path = APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT;
+ include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT);
}
- else
+ elseif (is_file(APPPATH.'config/mimes'.EXT))
{
- $_mimes_path = APPPATH.'config/mimes'.EXT;
+ include(APPPATH.'config//mimes'.EXT);
}
-
- if (@require($_mimes_path))
+ else
{
- $this->mimes = $mimes;
- unset($mimes);
+ return FALSE;
}
+
+ $this->mimes = $mimes;
+ unset($mimes);
}
return ( ! isset($this->mimes[$mime])) ? FALSE : $this->mimes[$mime];
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index 38cdb40f1..11af21491 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -84,16 +84,15 @@ class CI_User_agent {
*/
private function _load_agent_file()
{
- if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/user_agents'.EXT))
+ if (is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents'.EXT))
{
- $_ua_path = APPPATH.'config/'.ENVIRONMENT.'/user_agents'.EXT;
+ include(APPPATH.'config/'.ENVIRONMENT.'/user_agents'.EXT);
}
- else
+ elseif (is_file(APPPATH.'config/user_agents'.EXT))
{
- $_ua_path = APPPATH.'config/user_agents'.EXT;
+ include(APPPATH.'config/user_agents'.EXT);
}
-
- if ( ! @include($_ua_path))
+ else
{
return FALSE;
}