1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
\r
5 * An open source application development framework for PHP 4.3.2 or newer
\r
7 * @package CodeIgniter
\r
8 * @author ExpressionEngine Dev Team
\r
9 * @copyright Copyright (c) 2008, EllisLab, Inc.
\r
10 * @license http://codeigniter.com/user_guide/license.html
\r
11 * @link http://codeigniter.com
\r
12 * @since Version 1.0
\r
16 // ------------------------------------------------------------------------
\r
19 * CodeIgniter Security Helpers
\r
21 * @package CodeIgniter
\r
22 * @subpackage Helpers
\r
24 * @author ExpressionEngine Dev Team
\r
25 * @link http://codeigniter.com/user_guide/helpers/security_helper.html
\r
28 // ------------------------------------------------------------------------
\r
35 * @param string the character set of your data
\r
38 if ( ! function_exists('xss_clean'))
\r
40 function xss_clean($str, $charset = 'ISO-8859-1')
\r
42 $CI =& get_instance();
\r
43 return $CI->input->xss_clean($str, $charset);
\r
47 // --------------------------------------------------------------------
\r
50 * Hash encode a string
\r
56 if ( ! function_exists('dohash'))
\r
58 function dohash($str, $type = 'sha1')
\r
60 if ($type == 'sha1')
\r
62 if ( ! function_exists('sha1'))
\r
64 if ( ! function_exists('mhash'))
\r
66 require_once(BASEPATH.'libraries/Sha1'.EXT);
\r
68 return $SH->generate($str);
\r
72 return bin2hex(mhash(MHASH_SHA1, $str));
\r
87 // ------------------------------------------------------------------------
\r
96 if ( ! function_exists('strip_image_tags'))
\r
98 function strip_image_tags($str)
\r
100 $str = preg_replace("#<img\s+.*?src\s*=\s*[\"'](.+?)[\"'].*?\>#", "\\1", $str);
\r
101 $str = preg_replace("#<img\s+.*?src\s*=\s*(.+?).*?\>#", "\\1", $str);
\r
107 // ------------------------------------------------------------------------
\r
110 * Convert PHP tags to entities
\r
116 if ( ! function_exists('encode_php_tags'))
\r
118 function encode_php_tags($str)
\r
120 return str_replace(array('<?php', '<?PHP', '<?', '?>'), array('<?php', '<?PHP', '<?', '?>'), $str);
\r
125 /* End of file security_helper.php */
\r
126 /* Location: ./system/helpers/security_helper.php */