From 05fa61144667c85b0463f7e8baa6af00aa195dc6 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 6 Apr 2011 22:57:43 +0100 Subject: Made Environment Support optional. Comment out or delete the constant to stop environment checks. --- system/helpers/download_helper.php | 2 +- system/helpers/file_helper.php | 2 +- system/helpers/html_helper.php | 2 +- system/helpers/smiley_helper.php | 15 +++++---------- system/helpers/text_helper.php | 2 +- 5 files changed, 9 insertions(+), 14 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index e537cdeca..f8073d238 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -58,7 +58,7 @@ if ( ! function_exists('force_download')) $extension = end($x); // Load the mime types - if (is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT)) { include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT); } diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 7a35c3fa1..44344947e 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -352,7 +352,7 @@ if ( ! function_exists('get_mime_by_extension')) if ( ! is_array($mimes)) { - if (is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT)) { include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT); } diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 53fc899a3..c6103ab6f 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -258,7 +258,7 @@ if ( ! function_exists('doctype')) if ( ! is_array($_doctypes)) { - if (is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT)) { include(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT); } diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index 6c901515d..a2d1031b3 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -229,26 +229,21 @@ if ( ! function_exists('_get_smiley_array')) { function _get_smiley_array() { - if ( ! file_exists(APPPATH.'config/smileys'.EXT) AND ! file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT)) - { - return FALSE; - } - - if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT)) + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT)) { include(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT); } - else + elseif (file_exists(APPPATH.'config/smileys'.EXT)) { include(APPPATH.'config/smileys'.EXT); } - if ( ! isset($smileys) OR ! is_array($smileys)) + if (isset($smileys) AND is_array($smileys)) { - return FALSE; + return $smileys; } - return $smileys; + return FALSE; } } diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 664408912..cca093976 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -366,7 +366,7 @@ if ( ! function_exists('convert_accented_characters')) { function convert_accented_characters($str) { - if (is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT)) { include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT); } -- cgit v1.2.3-24-g4f1b