converted to unix-style eol
[www-register-wizard.git] / helpers / security_helper.php
index f2c5bac..0e2ba78 100644 (file)
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');\r
-/**\r
- * CodeIgniter\r
- *\r
- * An open source application development framework for PHP 4.3.2 or newer\r
- *\r
- * @package            CodeIgniter\r
- * @author             ExpressionEngine Dev Team\r
- * @copyright  Copyright (c) 2008, EllisLab, Inc.\r
- * @license            http://codeigniter.com/user_guide/license.html\r
- * @link               http://codeigniter.com\r
- * @since              Version 1.0\r
- * @filesource\r
- */\r
-\r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * CodeIgniter Security Helpers\r
- *\r
- * @package            CodeIgniter\r
- * @subpackage Helpers\r
- * @category   Helpers\r
- * @author             ExpressionEngine Dev Team\r
- * @link               http://codeigniter.com/user_guide/helpers/security_helper.html\r
- */\r
-\r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * XSS Filtering\r
- *\r
- * @access     public\r
- * @param      string\r
- * @param      string  the character set of your data\r
- * @return     string\r
- */    \r
-if ( ! function_exists('xss_clean'))\r
-{\r
-       function xss_clean($str, $charset = 'ISO-8859-1')\r
-       {\r
-               $CI =& get_instance();\r
-               return $CI->input->xss_clean($str, $charset);\r
-       }\r
-}\r
-\r
-// --------------------------------------------------------------------\r
-\r
-/**\r
- * Hash encode a string\r
- *\r
- * @access     public\r
- * @param      string\r
- * @return     string\r
- */    \r
-if ( ! function_exists('dohash'))\r
-{      \r
-       function dohash($str, $type = 'sha1')\r
-       {\r
-               if ($type == 'sha1')\r
-               {\r
-                       if ( ! function_exists('sha1'))\r
-                       {\r
-                               if ( ! function_exists('mhash'))\r
-                               {       \r
-                                       require_once(BASEPATH.'libraries/Sha1'.EXT);\r
-                                       $SH = new CI_SHA;\r
-                                       return $SH->generate($str);\r
-                               }\r
-                               else\r
-                               {\r
-                                       return bin2hex(mhash(MHASH_SHA1, $str));\r
-                               }\r
-                       }\r
-                       else\r
-                       {\r
-                               return sha1($str);\r
-                       }       \r
-               }\r
-               else\r
-               {\r
-                       return md5($str);\r
-               }\r
-       }\r
-}\r
-       \r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * Strip Image Tags\r
- *\r
- * @access     public\r
- * @param      string\r
- * @return     string\r
- */    \r
-if ( ! function_exists('strip_image_tags'))\r
-{\r
-       function strip_image_tags($str)\r
-       {\r
-               $str = preg_replace("#<img\s+.*?src\s*=\s*[\"'](.+?)[\"'].*?\>#", "\\1", $str);\r
-               $str = preg_replace("#<img\s+.*?src\s*=\s*(.+?).*?\>#", "\\1", $str);\r
-                       \r
-               return $str;\r
-       }\r
-}\r
-       \r
-// ------------------------------------------------------------------------\r
-\r
-/**\r
- * Convert PHP tags to entities\r
- *\r
- * @access     public\r
- * @param      string\r
- * @return     string\r
- */    \r
-if ( ! function_exists('encode_php_tags'))\r
-{\r
-       function encode_php_tags($str)\r
-       {\r
-               return str_replace(array('<?php', '<?PHP', '<?', '?>'),  array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);\r
-       }\r
-}\r
-\r
-\r
-/* End of file security_helper.php */\r
+<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 4.3.2 or newer
+ *
+ * @package            CodeIgniter
+ * @author             ExpressionEngine Dev Team
+ * @copyright  Copyright (c) 2008, EllisLab, Inc.
+ * @license            http://codeigniter.com/user_guide/license.html
+ * @link               http://codeigniter.com
+ * @since              Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CodeIgniter Security Helpers
+ *
+ * @package            CodeIgniter
+ * @subpackage Helpers
+ * @category   Helpers
+ * @author             ExpressionEngine Dev Team
+ * @link               http://codeigniter.com/user_guide/helpers/security_helper.html
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * XSS Filtering
+ *
+ * @access     public
+ * @param      string
+ * @param      string  the character set of your data
+ * @return     string
+ */    
+if ( ! function_exists('xss_clean'))
+{
+       function xss_clean($str, $charset = 'ISO-8859-1')
+       {
+               $CI =& get_instance();
+               return $CI->input->xss_clean($str, $charset);
+       }
+}
+
+// --------------------------------------------------------------------
+
+/**
+ * Hash encode a string
+ *
+ * @access     public
+ * @param      string
+ * @return     string
+ */    
+if ( ! function_exists('dohash'))
+{      
+       function dohash($str, $type = 'sha1')
+       {
+               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);
+                       }       
+               }
+               else
+               {
+                       return md5($str);
+               }
+       }
+}
+       
+// ------------------------------------------------------------------------
+
+/**
+ * Strip Image Tags
+ *
+ * @access     public
+ * @param      string
+ * @return     string
+ */    
+if ( ! function_exists('strip_image_tags'))
+{
+       function strip_image_tags($str)
+       {
+               $str = preg_replace("#<img\s+.*?src\s*=\s*[\"'](.+?)[\"'].*?\>#", "\\1", $str);
+               $str = preg_replace("#<img\s+.*?src\s*=\s*(.+?).*?\>#", "\\1", $str);
+                       
+               return $str;
+       }
+}
+       
+// ------------------------------------------------------------------------
+
+/**
+ * Convert PHP tags to entities
+ *
+ * @access     public
+ * @param      string
+ * @return     string
+ */    
+if ( ! function_exists('encode_php_tags'))
+{
+       function encode_php_tags($str)
+       {
+               return str_replace(array('<?php', '<?PHP', '<?', '?>'),  array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);
+       }
+}
+
+
+/* End of file security_helper.php */
 /* Location: ./system/helpers/security_helper.php */
\ No newline at end of file