diff options
Diffstat (limited to 'system/helpers')
-rw-r--r-- | system/helpers/download_helper.php | 9 | ||||
-rw-r--r-- | system/helpers/file_helper.php | 11 | ||||
-rw-r--r-- | system/helpers/form_helper.php | 4 | ||||
-rw-r--r-- | system/helpers/html_helper.php | 11 | ||||
-rw-r--r-- | system/helpers/security_helper.php | 34 | ||||
-rw-r--r-- | system/helpers/smiley_helper.php | 18 | ||||
-rw-r--r-- | system/helpers/text_helper.php | 10 | ||||
-rw-r--r-- | system/helpers/typography_helper.php | 5 |
8 files changed, 51 insertions, 51 deletions
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 6cecd0d11..f8073d238 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -58,7 +58,14 @@ if ( ! function_exists('force_download')) $extension = end($x); // Load the mime types - @include(APPPATH.'config/mimes'.EXT); + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT)) + { + include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT); + } + elseif (is_file(APPPATH.'config/mimes'.EXT)) + { + include(APPPATH.'config/mimes'.EXT); + } // Set a default mime if we can't find it if ( ! isset($mimes[$extension])) diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 9518e4843..44344947e 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -352,7 +352,16 @@ if ( ! function_exists('get_mime_by_extension')) if ( ! is_array($mimes)) { - if ( ! require_once(APPPATH.'config/mimes.php')) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT)) + { + include(APPPATH.'config/'.ENVIRONMENT.'/mimes'.EXT); + } + elseif (is_file(APPPATH.'config/mimes'.EXT)) + { + include(APPPATH.'config/mimes'.EXT); + } + + if ( ! is_array($mimes)) { return FALSE; } diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 532309794..8aa788c6c 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -49,11 +49,15 @@ if ( ! function_exists('form_open')) $attributes = 'method="post"'; } + // If an action is not a full URL then turn it into one if ($action && strpos($action, '://') === FALSE) { $action = $CI->config->site_url($action); } + // If no action is provided then set to the current url + $action OR $action = $CI->config->site_url($CI->uri->uri_string()); + $form = '<form action="'.$action.'"'; $form .= _attributes_to_string($attributes, TRUE); diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 68c6f5908..c6103ab6f 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -258,7 +258,16 @@ if ( ! function_exists('doctype')) if ( ! is_array($_doctypes)) { - if ( ! require_once(APPPATH.'config/doctypes.php')) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT)) + { + include(APPPATH.'config/'.ENVIRONMENT.'/doctypes'.EXT); + } + elseif (is_file(APPPATH.'config/doctypes'.EXT)) + { + include(APPPATH.'config/doctypes'.EXT); + } + + if ( ! is_array($_doctypes)) { return FALSE; } diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php index 61ebf46f9..678dac821 100644 --- a/system/helpers/security_helper.php +++ b/system/helpers/security_helper.php @@ -67,22 +67,6 @@ if ( ! function_exists('sanitize_filename')) /** * Hash encode a string * - * This is simply an alias for do_hash() - * dohash() is now deprecated - */ -if ( ! function_exists('dohash')) -{ - function dohash($str, $type = 'sha1') - { - return do_hash($str, $type); - } -} - -// -------------------------------------------------------------------- - -/** - * Hash encode a string - * * @access public * @param string * @return string @@ -93,23 +77,7 @@ if ( ! function_exists('do_hash')) { if ($type == 'sha1') { - if ( ! function_exists('sha1')) - { - if ( ! function_exists('mhash')) - { - require_once(BASEPATH.'libraries/Sha1'.EXT); - $SH = new CI_SHA; - return $SH->generate($str); - } - else - { - return bin2hex(mhash(MHASH_SHA1, $str)); - } - } - else - { - return sha1($str); - } + return sha1($str); } else { diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index 463881f58..a2d1031b3 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -229,19 +229,21 @@ if ( ! function_exists('_get_smiley_array')) { function _get_smiley_array() { - if ( ! file_exists(APPPATH.'config/smileys'.EXT)) + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT)) { - return FALSE; + include(APPPATH.'config/'.ENVIRONMENT.'/smileys'.EXT); } - - include(APPPATH.'config/smileys'.EXT); - - if ( ! isset($smileys) OR ! is_array($smileys)) + elseif (file_exists(APPPATH.'config/smileys'.EXT)) + { + include(APPPATH.'config/smileys'.EXT); + } + + 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 96afd4cee..cca093976 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -366,12 +366,14 @@ if ( ! function_exists('convert_accented_characters')) { function convert_accented_characters($str) { - if ( ! file_exists(APPPATH.'config/foreign_chars'.EXT)) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT)) { - return $str; + include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars'.EXT); + } + 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/helpers/typography_helper.php b/system/helpers/typography_helper.php index 302bf45c5..19b4eec03 100644 --- a/system/helpers/typography_helper.php +++ b/system/helpers/typography_helper.php @@ -84,9 +84,8 @@ if ( ! function_exists('entity_decode')) { function entity_decode($str, $charset='UTF-8') { - $CI =& get_instance(); - $CI->load->library('security'); - return $CI->security->entity_decode($str, $charset); + global $SEC; + return $SEC->entity_decode($str, $charset); } } |