summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rwxr-xr-x[-rw-r--r--]system/.htaccess0
-rwxr-xr-x[-rw-r--r--]system/core/Common.php0
-rwxr-xr-x[-rw-r--r--]system/core/Controller.php0
-rwxr-xr-x[-rw-r--r--]system/core/Loader.php0
-rwxr-xr-xsystem/core/URI.php4
-rwxr-xr-x[-rw-r--r--]system/core/Utf8.php0
-rwxr-xr-x[-rw-r--r--]system/core/index.html0
-rwxr-xr-x[-rw-r--r--]system/database/DB_active_rec.php0
-rwxr-xr-x[-rw-r--r--]system/database/DB_cache.php0
-rwxr-xr-x[-rw-r--r--]system/database/DB_driver.php0
-rwxr-xr-x[-rw-r--r--]system/database/DB_forge.php0
-rwxr-xr-x[-rw-r--r--]system/database/DB_result.php0
-rwxr-xr-x[-rw-r--r--]system/database/DB_utility.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/index.html0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mssql/index.html0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mssql/mssql_driver.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mssql/mssql_forge.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mssql/mssql_result.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mssql/mssql_utility.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mysql/index.html0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mysql/mysql_driver.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mysql/mysql_forge.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mysql/mysql_result.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mysql/mysql_utility.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mysqli/index.html0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mysqli/mysqli_driver.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mysqli/mysqli_forge.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mysqli/mysqli_result.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/mysqli/mysqli_utility.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/oci8/index.html0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/oci8/oci8_driver.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/oci8/oci8_forge.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/oci8/oci8_result.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/oci8/oci8_utility.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/odbc/index.html0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/odbc/odbc_driver.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/odbc/odbc_forge.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/odbc/odbc_result.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/odbc/odbc_utility.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/postgre/index.html0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/postgre/postgre_driver.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/postgre/postgre_forge.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/postgre/postgre_result.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/postgre/postgre_utility.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/sqlite/index.html0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/sqlite/sqlite_driver.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/sqlite/sqlite_forge.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/sqlite/sqlite_result.php0
-rwxr-xr-x[-rw-r--r--]system/database/drivers/sqlite/sqlite_utility.php0
-rwxr-xr-x[-rw-r--r--]system/database/index.html0
-rwxr-xr-x[-rw-r--r--]system/fonts/index.html0
-rwxr-xr-x[-rw-r--r--]system/fonts/texb.ttfbin143830 -> 143830 bytes
-rwxr-xr-x[-rw-r--r--]system/helpers/array_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/captcha_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/cookie_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/date_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/directory_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/download_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/email_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/file_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/form_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/html_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/index.html0
-rwxr-xr-x[-rw-r--r--]system/helpers/inflector_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/language_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/number_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/path_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/security_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/smiley_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/string_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/text_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/typography_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/url_helper.php0
-rwxr-xr-x[-rw-r--r--]system/helpers/xml_helper.php0
-rwxr-xr-x[-rw-r--r--]system/index.html0
-rwxr-xr-x[-rw-r--r--]system/language/english/calendar_lang.php0
-rwxr-xr-x[-rw-r--r--]system/language/english/date_lang.php0
-rwxr-xr-x[-rw-r--r--]system/language/english/db_lang.php0
-rwxr-xr-x[-rw-r--r--]system/language/english/email_lang.php0
-rwxr-xr-x[-rw-r--r--]system/language/english/form_validation_lang.php0
-rwxr-xr-x[-rw-r--r--]system/language/english/ftp_lang.php0
-rwxr-xr-x[-rw-r--r--]system/language/english/imglib_lang.php0
-rwxr-xr-x[-rw-r--r--]system/language/english/index.html0
-rwxr-xr-x[-rw-r--r--]system/language/english/number_lang.php0
-rwxr-xr-x[-rw-r--r--]system/language/english/profiler_lang.php0
-rwxr-xr-x[-rw-r--r--]system/language/english/unit_test_lang.php0
-rwxr-xr-x[-rw-r--r--]system/language/english/upload_lang.php0
-rwxr-xr-x[-rw-r--r--]system/language/index.html0
-rwxr-xr-x[-rw-r--r--]system/libraries/Cache/Cache.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Cache/drivers/Cache_apc.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Cache/drivers/Cache_dummy.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Cache/drivers/Cache_file.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Cache/drivers/Cache_memcached.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Calendar.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Cart.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Driver.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Email.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Encrypt.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Form_validation.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Ftp.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Image_lib.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Javascript.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Log.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Pagination.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Parser.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Profiler.php0
-rwxr-xr-xsystem/libraries/Security.php737
-rwxr-xr-x[-rw-r--r--]system/libraries/Session.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Sha1.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Table.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Trackback.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Typography.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Unit_test.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Upload.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/User_agent.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Xmlrpc.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Xmlrpcs.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/Zip.php0
-rwxr-xr-x[-rw-r--r--]system/libraries/index.html0
-rwxr-xr-x[-rw-r--r--]system/libraries/javascript/Jquery.php0
120 files changed, 739 insertions, 2 deletions
diff --git a/system/.htaccess b/system/.htaccess
index 14249c50b..14249c50b 100644..100755
--- a/system/.htaccess
+++ b/system/.htaccess
diff --git a/system/core/Common.php b/system/core/Common.php
index d79375475..d79375475 100644..100755
--- a/system/core/Common.php
+++ b/system/core/Common.php
diff --git a/system/core/Controller.php b/system/core/Controller.php
index fddb81e19..fddb81e19 100644..100755
--- a/system/core/Controller.php
+++ b/system/core/Controller.php
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 6b7ee0c28..6b7ee0c28 100644..100755
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
diff --git a/system/core/URI.php b/system/core/URI.php
index a3ae20cc3..d78c8ee49 100755
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -219,7 +219,7 @@ class CI_URI {
$uri = parse_url($uri, PHP_URL_PATH);
// Do some final cleaning of the URI and return it
- return str_replace(array('//', '../'), '/', trim($uri, '/'));
+ return str_replace(array('//', '../'), '/', ltrim($uri, '/'));
}
// --------------------------------------------------------------------
@@ -651,4 +651,4 @@ class CI_URI {
// END URI Class
/* End of file URI.php */
-/* Location: ./system/core/URI.php */ \ No newline at end of file
+/* Location: ./system/core/URI.php */
diff --git a/system/core/Utf8.php b/system/core/Utf8.php
index 2a27d1f35..2a27d1f35 100644..100755
--- a/system/core/Utf8.php
+++ b/system/core/Utf8.php
diff --git a/system/core/index.html b/system/core/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/core/index.html
+++ b/system/core/index.html
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 7bab729f5..7bab729f5 100644..100755
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php
index ad1c28d72..ad1c28d72 100644..100755
--- a/system/database/DB_cache.php
+++ b/system/database/DB_cache.php
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 3680b85c2..3680b85c2 100644..100755
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 6bc40411b..6bc40411b 100644..100755
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index 48d66c8e4..48d66c8e4 100644..100755
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 52196b7ce..52196b7ce 100644..100755
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
diff --git a/system/database/drivers/index.html b/system/database/drivers/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/database/drivers/index.html
+++ b/system/database/drivers/index.html
diff --git a/system/database/drivers/mssql/index.html b/system/database/drivers/mssql/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/database/drivers/mssql/index.html
+++ b/system/database/drivers/mssql/index.html
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index b39bd9360..b39bd9360 100644..100755
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
diff --git a/system/database/drivers/mssql/mssql_forge.php b/system/database/drivers/mssql/mssql_forge.php
index 70b20ecf8..70b20ecf8 100644..100755
--- a/system/database/drivers/mssql/mssql_forge.php
+++ b/system/database/drivers/mssql/mssql_forge.php
diff --git a/system/database/drivers/mssql/mssql_result.php b/system/database/drivers/mssql/mssql_result.php
index 2897ca5a5..2897ca5a5 100644..100755
--- a/system/database/drivers/mssql/mssql_result.php
+++ b/system/database/drivers/mssql/mssql_result.php
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index 48ecbc72a..48ecbc72a 100644..100755
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
diff --git a/system/database/drivers/mysql/index.html b/system/database/drivers/mysql/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/database/drivers/mysql/index.html
+++ b/system/database/drivers/mysql/index.html
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index f87cfea4b..f87cfea4b 100644..100755
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php
index c1cae136c..c1cae136c 100644..100755
--- a/system/database/drivers/mysql/mysql_forge.php
+++ b/system/database/drivers/mysql/mysql_forge.php
diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php
index e1a6e93ca..e1a6e93ca 100644..100755
--- a/system/database/drivers/mysql/mysql_result.php
+++ b/system/database/drivers/mysql/mysql_result.php
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index 48c4d6316..48c4d6316 100644..100755
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
diff --git a/system/database/drivers/mysqli/index.html b/system/database/drivers/mysqli/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/database/drivers/mysqli/index.html
+++ b/system/database/drivers/mysqli/index.html
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index d3200f328..d3200f328 100644..100755
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
diff --git a/system/database/drivers/mysqli/mysqli_forge.php b/system/database/drivers/mysqli/mysqli_forge.php
index 260549457..260549457 100644..100755
--- a/system/database/drivers/mysqli/mysqli_forge.php
+++ b/system/database/drivers/mysqli/mysqli_forge.php
diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php
index 124d4e599..124d4e599 100644..100755
--- a/system/database/drivers/mysqli/mysqli_result.php
+++ b/system/database/drivers/mysqli/mysqli_result.php
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index e17889b8c..e17889b8c 100644..100755
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
diff --git a/system/database/drivers/oci8/index.html b/system/database/drivers/oci8/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/database/drivers/oci8/index.html
+++ b/system/database/drivers/oci8/index.html
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 930177e62..930177e62 100644..100755
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
diff --git a/system/database/drivers/oci8/oci8_forge.php b/system/database/drivers/oci8/oci8_forge.php
index 3cd17585a..3cd17585a 100644..100755
--- a/system/database/drivers/oci8/oci8_forge.php
+++ b/system/database/drivers/oci8/oci8_forge.php
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index ae133d7b5..ae133d7b5 100644..100755
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php
index 854b467e1..854b467e1 100644..100755
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
diff --git a/system/database/drivers/odbc/index.html b/system/database/drivers/odbc/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/database/drivers/odbc/index.html
+++ b/system/database/drivers/odbc/index.html
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index bcd7937d9..bcd7937d9 100644..100755
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
diff --git a/system/database/drivers/odbc/odbc_forge.php b/system/database/drivers/odbc/odbc_forge.php
index 3ec86b4e9..3ec86b4e9 100644..100755
--- a/system/database/drivers/odbc/odbc_forge.php
+++ b/system/database/drivers/odbc/odbc_forge.php
diff --git a/system/database/drivers/odbc/odbc_result.php b/system/database/drivers/odbc/odbc_result.php
index 5d64a464f..5d64a464f 100644..100755
--- a/system/database/drivers/odbc/odbc_result.php
+++ b/system/database/drivers/odbc/odbc_result.php
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index d335bed99..d335bed99 100644..100755
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
diff --git a/system/database/drivers/postgre/index.html b/system/database/drivers/postgre/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/database/drivers/postgre/index.html
+++ b/system/database/drivers/postgre/index.html
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 5367f9759..5367f9759 100644..100755
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
diff --git a/system/database/drivers/postgre/postgre_forge.php b/system/database/drivers/postgre/postgre_forge.php
index 91a1c6861..91a1c6861 100644..100755
--- a/system/database/drivers/postgre/postgre_forge.php
+++ b/system/database/drivers/postgre/postgre_forge.php
diff --git a/system/database/drivers/postgre/postgre_result.php b/system/database/drivers/postgre/postgre_result.php
index e9a1d1607..e9a1d1607 100644..100755
--- a/system/database/drivers/postgre/postgre_result.php
+++ b/system/database/drivers/postgre/postgre_result.php
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index 741c52ea8..741c52ea8 100644..100755
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
diff --git a/system/database/drivers/sqlite/index.html b/system/database/drivers/sqlite/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/database/drivers/sqlite/index.html
+++ b/system/database/drivers/sqlite/index.html
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 0cc898b38..0cc898b38 100644..100755
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
diff --git a/system/database/drivers/sqlite/sqlite_forge.php b/system/database/drivers/sqlite/sqlite_forge.php
index 56904082e..56904082e 100644..100755
--- a/system/database/drivers/sqlite/sqlite_forge.php
+++ b/system/database/drivers/sqlite/sqlite_forge.php
diff --git a/system/database/drivers/sqlite/sqlite_result.php b/system/database/drivers/sqlite/sqlite_result.php
index 7bd30db7c..7bd30db7c 100644..100755
--- a/system/database/drivers/sqlite/sqlite_result.php
+++ b/system/database/drivers/sqlite/sqlite_result.php
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
index 508023e2f..508023e2f 100644..100755
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
diff --git a/system/database/index.html b/system/database/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/database/index.html
+++ b/system/database/index.html
diff --git a/system/fonts/index.html b/system/fonts/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/fonts/index.html
+++ b/system/fonts/index.html
diff --git a/system/fonts/texb.ttf b/system/fonts/texb.ttf
index 383c88b86..383c88b86 100644..100755
--- a/system/fonts/texb.ttf
+++ b/system/fonts/texb.ttf
Binary files differ
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index 075a31fdf..075a31fdf 100644..100755
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index 19ec0c778..19ec0c778 100644..100755
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index 7cee02827..7cee02827 100644..100755
--- a/system/helpers/cookie_helper.php
+++ b/system/helpers/cookie_helper.php
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 0aeb7fafb..0aeb7fafb 100644..100755
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php
index 38347fa62..38347fa62 100644..100755
--- a/system/helpers/directory_helper.php
+++ b/system/helpers/directory_helper.php
diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php
index 1145688ae..1145688ae 100644..100755
--- a/system/helpers/download_helper.php
+++ b/system/helpers/download_helper.php
diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
index 651aef439..651aef439 100644..100755
--- a/system/helpers/email_helper.php
+++ b/system/helpers/email_helper.php
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 3931667fd..3931667fd 100644..100755
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index d9305c00b..d9305c00b 100644..100755
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index b64b60650..b64b60650 100644..100755
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
diff --git a/system/helpers/index.html b/system/helpers/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/helpers/index.html
+++ b/system/helpers/index.html
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 7b99bc5b4..7b99bc5b4 100644..100755
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
diff --git a/system/helpers/language_helper.php b/system/helpers/language_helper.php
index ac0d69da1..ac0d69da1 100644..100755
--- a/system/helpers/language_helper.php
+++ b/system/helpers/language_helper.php
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php
index 611777559..611777559 100644..100755
--- a/system/helpers/number_helper.php
+++ b/system/helpers/number_helper.php
diff --git a/system/helpers/path_helper.php b/system/helpers/path_helper.php
index ffcf46842..ffcf46842 100644..100755
--- a/system/helpers/path_helper.php
+++ b/system/helpers/path_helper.php
diff --git a/system/helpers/security_helper.php b/system/helpers/security_helper.php
index 678dac821..678dac821 100644..100755
--- a/system/helpers/security_helper.php
+++ b/system/helpers/security_helper.php
diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php
index 6d8889354..6d8889354 100644..100755
--- a/system/helpers/smiley_helper.php
+++ b/system/helpers/smiley_helper.php
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index 9fa69f46c..9fa69f46c 100644..100755
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 33d7fa2fd..33d7fa2fd 100644..100755
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
diff --git a/system/helpers/typography_helper.php b/system/helpers/typography_helper.php
index 19b4eec03..19b4eec03 100644..100755
--- a/system/helpers/typography_helper.php
+++ b/system/helpers/typography_helper.php
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 9f4b85248..9f4b85248 100644..100755
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
diff --git a/system/helpers/xml_helper.php b/system/helpers/xml_helper.php
index cdd81ad70..cdd81ad70 100644..100755
--- a/system/helpers/xml_helper.php
+++ b/system/helpers/xml_helper.php
diff --git a/system/index.html b/system/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/index.html
+++ b/system/index.html
diff --git a/system/language/english/calendar_lang.php b/system/language/english/calendar_lang.php
index 3e6312361..3e6312361 100644..100755
--- a/system/language/english/calendar_lang.php
+++ b/system/language/english/calendar_lang.php
diff --git a/system/language/english/date_lang.php b/system/language/english/date_lang.php
index c0ace16ef..c0ace16ef 100644..100755
--- a/system/language/english/date_lang.php
+++ b/system/language/english/date_lang.php
diff --git a/system/language/english/db_lang.php b/system/language/english/db_lang.php
index 79b82c73a..79b82c73a 100644..100755
--- a/system/language/english/db_lang.php
+++ b/system/language/english/db_lang.php
diff --git a/system/language/english/email_lang.php b/system/language/english/email_lang.php
index e3bd113cb..e3bd113cb 100644..100755
--- a/system/language/english/email_lang.php
+++ b/system/language/english/email_lang.php
diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php
index 3418f29ab..3418f29ab 100644..100755
--- a/system/language/english/form_validation_lang.php
+++ b/system/language/english/form_validation_lang.php
diff --git a/system/language/english/ftp_lang.php b/system/language/english/ftp_lang.php
index 1e5168cf8..1e5168cf8 100644..100755
--- a/system/language/english/ftp_lang.php
+++ b/system/language/english/ftp_lang.php
diff --git a/system/language/english/imglib_lang.php b/system/language/english/imglib_lang.php
index 66505da07..66505da07 100644..100755
--- a/system/language/english/imglib_lang.php
+++ b/system/language/english/imglib_lang.php
diff --git a/system/language/english/index.html b/system/language/english/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/language/english/index.html
+++ b/system/language/english/index.html
diff --git a/system/language/english/number_lang.php b/system/language/english/number_lang.php
index 908580914..908580914 100644..100755
--- a/system/language/english/number_lang.php
+++ b/system/language/english/number_lang.php
diff --git a/system/language/english/profiler_lang.php b/system/language/english/profiler_lang.php
index 1111158c8..1111158c8 100644..100755
--- a/system/language/english/profiler_lang.php
+++ b/system/language/english/profiler_lang.php
diff --git a/system/language/english/unit_test_lang.php b/system/language/english/unit_test_lang.php
index 070bcd1f2..070bcd1f2 100644..100755
--- a/system/language/english/unit_test_lang.php
+++ b/system/language/english/unit_test_lang.php
diff --git a/system/language/english/upload_lang.php b/system/language/english/upload_lang.php
index 4de9e9e74..4de9e9e74 100644..100755
--- a/system/language/english/upload_lang.php
+++ b/system/language/english/upload_lang.php
diff --git a/system/language/index.html b/system/language/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/language/index.html
+++ b/system/language/index.html
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php
index 61e7aa761..61e7aa761 100644..100755
--- a/system/libraries/Cache/Cache.php
+++ b/system/libraries/Cache/Cache.php
diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php
index 79d91b320..79d91b320 100644..100755
--- a/system/libraries/Cache/drivers/Cache_apc.php
+++ b/system/libraries/Cache/drivers/Cache_apc.php
diff --git a/system/libraries/Cache/drivers/Cache_dummy.php b/system/libraries/Cache/drivers/Cache_dummy.php
index f96a68e27..f96a68e27 100644..100755
--- a/system/libraries/Cache/drivers/Cache_dummy.php
+++ b/system/libraries/Cache/drivers/Cache_dummy.php
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php
index 13e2d1af6..13e2d1af6 100644..100755
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php
index fc586e025..fc586e025 100644..100755
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index df0fd6eeb..df0fd6eeb 100644..100755
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index ab5a70c98..ab5a70c98 100644..100755
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index 9881c1eec..9881c1eec 100644..100755
--- a/system/libraries/Driver.php
+++ b/system/libraries/Driver.php
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 9ec40af9d..9ec40af9d 100644..100755
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index b30a8cf0b..b30a8cf0b 100644..100755
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index a34809e05..a34809e05 100644..100755
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index d7a8b3b02..d7a8b3b02 100644..100755
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 8902f524d..8902f524d 100644..100755
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php
index 34e0d7001..34e0d7001 100644..100755
--- a/system/libraries/Javascript.php
+++ b/system/libraries/Javascript.php
diff --git a/system/libraries/Log.php b/system/libraries/Log.php
index 9f1db76ba..9f1db76ba 100644..100755
--- a/system/libraries/Log.php
+++ b/system/libraries/Log.php
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index cdaacf2d4..cdaacf2d4 100644..100755
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php
index d223da020..d223da020 100644..100755
--- a/system/libraries/Parser.php
+++ b/system/libraries/Parser.php
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index 082a5ee1d..082a5ee1d 100644..100755
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
diff --git a/system/libraries/Security.php b/system/libraries/Security.php
new file mode 100755
index 000000000..ba64c7326
--- /dev/null
+++ b/system/libraries/Security.php
@@ -0,0 +1,737 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 5.1.6 or newer
+ *
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Security Class
+ *
+ * @package CodeIgniter
+ * @subpackage Libraries
+ * @category Security
+ * @author ExpressionEngine Dev Team
+ * @link http://codeigniter.com/user_guide/libraries/sessions.html
+ */
+class CI_Security {
+
+ public $xss_hash = '';
+ public $csrf_hash = '';
+ public $csrf_expire = 7200; // Two hours (in seconds)
+ public $csrf_token_name = 'ci_csrf_token';
+ public $csrf_cookie_name = 'ci_csrf_token';
+
+ /* never allowed, string replacement */
+ public $never_allowed_str = array(
+ 'document.cookie' => '[removed]',
+ 'document.write' => '[removed]',
+ '.parentNode' => '[removed]',
+ '.innerHTML' => '[removed]',
+ 'window.location' => '[removed]',
+ '-moz-binding' => '[removed]',
+ '<!--' => '&lt;!--',
+ '-->' => '--&gt;',
+ '<![CDATA[' => '&lt;![CDATA['
+ );
+ /* never allowed, regex replacement */
+ public $never_allowed_regex = array(
+ "javascript\s*:" => '[removed]',
+ "expression\s*(\(|&\#40;)" => '[removed]', // CSS and IE
+ "vbscript\s*:" => '[removed]', // IE, surprise!
+ "Redirect\s+302" => '[removed]'
+ );
+
+ public function __construct()
+ {
+ $this->csrf_token_name = (config_item('csrf_token_name')) ? config_item('csrf_token_name') : 'csrf_token_name';
+ $this->csrf_cookie_name = (config_item('csrf_cookie_name')) ? config_item('csrf_cookie_name') : 'csrf_cookie_name';
+ $this->csrf_expire = (config_item('csrf_expire')) ? config_item('csrf_expire') : 7200;
+
+ // Append application specific cookie prefix to token name
+ $this->csrf_cookie_name = (config_item('cookie_prefix')) ? config_item('cookie_prefix').$this->csrf_token_name : $this->csrf_token_name;
+
+ // Set the CSRF hash
+ $this->_csrf_set_hash();
+
+ log_message('debug', "Security Class Initialized");
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Verify Cross Site Request Forgery Protection
+ *
+ * @access public
+ * @return null
+ */
+ public function csrf_verify()
+ {
+ // If no POST data exists we will set the CSRF cookie
+ if (count($_POST) == 0)
+ {
+ return $this->csrf_set_cookie();
+ }
+
+ // Do the tokens exist in both the _POST and _COOKIE arrays?
+ if ( ! isset($_POST[$this->csrf_token_name]) OR ! isset($_COOKIE[$this->csrf_cookie_name]))
+ {
+ $this->csrf_show_error();
+ }
+
+ // Do the tokens match?
+ if ($_POST[$this->csrf_token_name] != $_COOKIE[$this->csrf_cookie_name])
+ {
+ $this->csrf_show_error();
+ }
+
+ // We kill this since we're done and we don't want to polute the _POST array
+ unset($_POST[$this->csrf_token_name]);
+
+ // Nothing should last forever
+ unset($_COOKIE[$this->csrf_cookie_name]);
+ $this->_csrf_set_hash();
+ $this->csrf_set_cookie();
+
+ log_message('debug', "CSRF token verified ");
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Set Cross Site Request Forgery Protection Cookie
+ *
+ * @access public
+ * @return null
+ */
+ public function csrf_set_cookie()
+ {
+ $expire = time() + $this->csrf_expire;
+
+ setcookie($this->csrf_cookie_name, $this->csrf_hash, $expire, config_item('cookie_path'), config_item('cookie_domain'), 0);
+
+ log_message('debug', "CRSF cookie Set");
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Set Cross Site Request Forgery Protection Cookie
+ *
+ * @access private
+ * @return null
+ */
+ private function _csrf_set_hash()
+ {
+ if ($this->csrf_hash == '')
+ {
+ // If the cookie exists we will use it's value. We don't necessarily want to regenerate it with
+ // each page load since a page could contain embedded sub-pages causing this feature to fail
+ if (isset($_COOKIE[$this->csrf_cookie_name]) AND $_COOKIE[$this->csrf_cookie_name] != '')
+ {
+ $this->csrf_hash = $_COOKIE[$this->csrf_cookie_name];
+ }
+ else
+ {
+ $this->csrf_hash = md5(uniqid(rand(), TRUE));
+ }
+ }
+
+ return $this->csrf_hash;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Show CSRF Error
+ *
+ * @access public
+ * @return null
+ */
+ public function csrf_show_error()
+ {
+ show_error('The action you have requested is not allowed.');
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * XSS Clean
+ *
+ * Sanitizes data so that Cross Site Scripting Hacks can be
+ * prevented. This function does a fair amount of work but
+ * it is extremely thorough, designed to prevent even the
+ * most obscure XSS attempts. Nothing is ever 100% foolproof,
+ * of course, but I haven't been able to get anything passed
+ * the filter.
+ *
+ * Note: This function should only be used to deal with data
+ * upon submission. It's not something that should
+ * be used for general runtime processing.
+ *
+ * This function was based in part on some code and ideas I
+ * got from Bitflux: http://channel.bitflux.ch/wiki/XSS_Prevention
+ *
+ * To help develop this script I used this great list of
+ * vulnerabilities along with a few other hacks I've
+ * harvested from examining vulnerabilities in other programs:
+ * http://ha.ckers.org/xss.html
+ *
+ * @access public
+ * @param mixed string or array
+ * @return string
+ */
+ public function xss_clean($str, $is_image = FALSE)
+ {
+ /*
+ * Is the string an array?
+ *
+ */
+ if (is_array($str))
+ {
+ while (list($key) = each($str))
+ {
+ $str[$key] = $this->xss_clean($str[$key]);
+ }
+
+ return $str;
+ }
+
+ /*
+ * Remove Invisible Characters
+ */
+ $str = remove_invisible_characters($str);
+
+ /*
+ * Protect GET variables in URLs
+ */
+
+ // 901119URL5918AMP18930PROTECT8198
+
+ $str = preg_replace('|\&([a-z\_0-9\-]+)\=([a-z\_0-9\-]+)|i', $this->xss_hash()."\\1=\\2", $str);
+
+ /*
+ * Validate standard character entities
+ *
+ * Add a semicolon if missing. We do this to enable
+ * the conversion of entities to ASCII later.
+ *
+ */
+ $str = preg_replace('#(&\#?[0-9a-z]{2,})([\x00-\x20])*;?#i', "\\1;\\2", $str);
+
+ /*
+ * Validate UTF16 two byte encoding (x00)
+ *
+ * Just as above, adds a semicolon if missing.
+ *
+ */
+ $str = preg_replace('#(&\#x?)([0-9A-F]+);?#i',"\\1\\2;",$str);
+
+ /*
+ * Un-Protect GET variables in URLs
+ */
+ $str = str_replace($this->xss_hash(), '&', $str);
+
+ /*
+ * URL Decode
+ *
+ * Just in case stuff like this is submitted:
+ *
+ * <a href="http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D">Google</a>
+ *
+ * Note: Use rawurldecode() so it does not remove plus signs
+ *
+ */
+ $str = rawurldecode($str);
+
+ /*
+ * Convert character entities to ASCII
+ *
+ * This permits our tests below to work reliably.
+ * We only convert entities that are within tags since
+ * these are the ones that will pose security problems.
+ *
+ */
+
+ $str = preg_replace_callback("/[a-z]+=([\'\"]).*?\\1/si", array($this, '_convert_attribute'), $str);
+
+ $str = preg_replace_callback("/<\w+.*?(?=>|<|$)/si", array($this, '_decode_entity'), $str);
+
+ /*
+ * Remove Invisible Characters Again!
+ */
+ $str = remove_invisible_characters($str);
+
+ /*
+ * Convert all tabs to spaces
+ *
+ * This prevents strings like this: ja vascript
+ * NOTE: we deal with spaces between characters later.
+ * NOTE: preg_replace was found to be amazingly slow here on large blocks of data,
+ * so we use str_replace.
+ *
+ */
+
+ if (strpos($str, "\t") !== FALSE)
+ {
+ $str = str_replace("\t", ' ', $str);
+ }
+
+ /*
+ * Capture converted string for later comparison
+ */
+ $converted_string = $str;
+
+ /*
+ * Not Allowed Under Any Conditions
+ */
+
+ foreach ($this->never_allowed_str as $key => $val)
+ {
+ $str = str_replace($key, $val, $str);
+ }
+
+ foreach ($this->never_allowed_regex as $key => $val)
+ {
+ $str = preg_replace("#".$key."#i", $val, $str);
+ }
+
+ /*
+ * Makes PHP tags safe
+ *
+ * Note: XML tags are inadvertently replaced too:
+ *
+ * <?xml
+ *
+ * But it doesn't seem to pose a problem.
+ *
+ */
+ if ($is_image === TRUE)
+ {
+ // Images have a tendency to have the PHP short opening and closing tags every so often
+ // so we skip those and only do the long opening tags.
+ $str = preg_replace('/<\?(php)/i', "&lt;?\\1", $str);
+ }
+ else
+ {
+ $str = str_replace(array('<?', '?'.'>'), array('&lt;?', '?&gt;'), $str);
+ }
+
+ /*
+ * Compact any exploded words
+ *
+ * This corrects words like: j a v a s c r i p t
+ * These words are compacted back to their correct state.
+ *
+ */
+ $words = array('javascript', 'expression', 'vbscript', 'script', 'applet', 'alert', 'document', 'write', 'cookie', 'window');
+ foreach ($words as $word)
+ {
+ $temp = '';
+
+ for ($i = 0, $wordlen = strlen($word); $i < $wordlen; $i++)
+ {
+ $temp .= substr($word, $i, 1)."\s*";
+ }
+
+ // We only want to do this when it is followed by a non-word character
+ // That way valid stuff like "dealer to" does not become "dealerto"
+ $str = preg_replace_callback('#('.substr($temp, 0, -3).')(\W)#is', array($this, '_compact_exploded_words'), $str);
+ }
+
+ /*
+ * Remove disallowed Javascript in links or img tags
+ * We used to do some version comparisons and use of stripos for PHP5, but it is dog slow compared
+ * to these simplified non-capturing preg_match(), especially if the pattern exists in the string
+ */
+ do
+ {
+ $original = $str;
+
+ if (preg_match("/<a/i", $str))
+ {
+ $str = preg_replace_callback("#<a\s+([^>]*?)(>|$)#si", array($this, '_js_link_removal'), $str);
+ }
+
+ if (preg_match("/<img/i", $str))
+ {
+ $str = preg_replace_callback("#<img\s+([^>]*?)(\s?/?>|$)#si", array($this, '_js_img_removal'), $str);
+ }
+
+ if (preg_match("/script/i", $str) OR preg_match("/xss/i", $str))
+ {
+ $str = preg_replace("#<(/*)(script|xss)(.*?)\>#si", '[removed]', $str);
+ }
+ }
+ while($original != $str);
+
+ unset($original);
+
+ /*
+ * Remove JavaScript Event Handlers
+ *
+ * Note: This code is a little blunt. It removes
+ * the event handler and anything up to the closing >,
+ * but it's unlikely to be a problem.
+ *
+ */
+ $event_handlers = array('[^a-z_\-]on\w*','xmlns');
+
+ if ($is_image === TRUE)
+ {
+ /*
+ * Adobe Photoshop puts XML metadata into JFIF images, including namespacing,
+ * so we have to allow this for images. -Paul
+ */
+ unset($event_handlers[array_search('xmlns', $event_handlers)]);
+ }
+
+ $str = preg_replace("#<([^><]+?)(".implode('|', $event_handlers).")(\s*=\s*[^><]*)([><]*)#i", "<\\1\\4", $str);
+
+ /*
+ * Sanitize naughty HTML elements
+ *
+ * If a tag containing any of the words in the list
+ * below is found, the tag gets converted to entities.
+ *
+ * So this: <blink>
+ * Becomes: &lt;blink&gt;
+ *
+ */
+ $naughty = 'alert|applet|audio|basefont|base|behavior|bgsound|blink|body|embed|expression|form|frameset|frame|head|html|ilayer|iframe|input|isindex|layer|link|meta|object|plaintext|style|script|textarea|title|video|xml|xss';
+ $str = preg_replace_callback('#<(/*\s*)('.$naughty.')([^><]*)([><]*)#is', array($this, '_sanitize_naughty_html'), $str);
+
+ /*
+ * Sanitize naughty scripting elements
+ *
+ * Similar to above, only instead of looking for
+ * tags it looks for PHP and JavaScript commands
+ * that are disallowed. Rather than removing the
+ * code, it simply converts the parenthesis to entities
+ * rendering the code un-executable.
+ *
+ * For example: eval('some code')
+ * Becomes: eval&#40;'some code'&#41;
+ *
+ */
+ $str = preg_replace('#(alert|cmd|passthru|eval|exec|expression|system|fopen|fsockopen|file|file_get_contents|readfile|unlink)(\s*)\((.*?)\)#si', "\\1\\2&#40;\\3&#41;", $str);
+
+ /*
+ * Final clean up
+ *
+ * This adds a bit of extra precaution in case
+ * something got through the above filters
+ *
+ */
+ foreach ($this->never_allowed_str as $key => $val)
+ {
+ $str = str_replace($key, $val, $str);
+ }
+
+ foreach ($this->never_allowed_regex as $key => $val)
+ {
+ $str = preg_replace("#".$key."#i", $val, $str);
+ }
+
+ /*
+ * Images are Handled in a Special Way
+ * - Essentially, we want to know that after all of the character conversion is done whether
+ * any unwanted, likely XSS, code was found. If not, we return TRUE, as the image is clean.
+ * However, if the string post-conversion does not matched the string post-removal of XSS,
+ * then it fails, as there was unwanted XSS code found and removed/changed during processing.
+ */
+
+ if ($is_image === TRUE)
+ {
+ if ($str == $converted_string)
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+
+ log_message('debug', "XSS Filtering completed");
+ return $str;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Random Hash for protecting URLs
+ *
+ * @access public
+ * @return string
+ */
+ public function xss_hash()
+ {
+ if ($this->xss_hash == '')
+ {
+ if (phpversion() >= 4.2)
+ mt_srand();
+ else
+ mt_srand(hexdec(substr(md5(microtime()), -8)) & 0x7fffffff);
+
+ $this->xss_hash = md5(time() + mt_rand(0, 1999999999));
+ }
+
+ return $this->xss_hash;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Compact Exploded Words
+ *
+ * Callback function for xss_clean() to remove whitespace from
+ * things like j a v a s c r i p t
+ *
+ * @access private
+ * @param type
+ * @return type
+ */
+ private function _compact_exploded_words($matches)
+ {
+ return preg_replace('/\s+/s', '', $matches[1]).$matches[2];
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Sanitize Naughty HTML
+ *
+ * Callback function for xss_clean() to remove naughty HTML elements
+ *
+ * @access private
+ * @param array
+ * @return string
+ */
+ private function _sanitize_naughty_html($matches)
+ {
+ // encode opening brace
+ $str = '&lt;'.$matches[1].$matches[2].$matches[3];
+
+ // encode captured opening or closing brace to prevent recursive vectors
+ $str .= str_replace(array('>', '<'), array('&gt;', '&lt;'), $matches[4]);
+
+ return $str;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * JS Link Removal
+ *
+ * Callback function for xss_clean() to sanitize links
+ * This limits the PCRE backtracks, making it more performance friendly
+ * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in
+ * PHP 5.2+ on link-heavy strings
+ *
+ * @access private
+ * @param array
+ * @return string
+ */
+ private function _js_link_removal($match)
+ {
+ $attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1]));
+ return str_replace($match[1], preg_replace("#href=.*?(alert\(|alert&\#40;|javascript\:|charset\=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si", "", $attributes), $match[0]);
+ }
+
+ /**
+ * JS Image Removal
+ *
+ * Callback function for xss_clean() to sanitize image tags
+ * This limits the PCRE backtracks, making it more performance friendly
+ * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in
+ * PHP 5.2+ on image tag heavy strings
+ *
+ * @access private
+ * @param array
+ * @return string
+ */
+ private function _js_img_removal($match)
+ {
+ $attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1]));
+ return str_replace($match[1], preg_replace("#src=.*?(alert\(|alert&\#40;|javascript\:|charset\=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si", "", $attributes), $match[0]);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Attribute Conversion
+ *
+ * Used as a callback for XSS Clean
+ *
+ * @access private
+ * @param array
+ * @return string
+ */
+ private function _convert_attribute($match)
+ {
+ return str_replace(array('>', '<', '\\'), array('&gt;', '&lt;', '\\\\'), $match[0]);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Filter Attributes
+ *
+ * Filters tag attributes for consistency and safety
+ *
+ * @access private
+ * @param string
+ * @return string
+ */
+ private function _filter_attributes($str)
+ {
+ $out = '';
+
+ if (preg_match_all('#\s*[a-z\-]+\s*=\s*(\042|\047)([^\\1]*?)\\1#is', $str, $matches))
+ {
+ foreach ($matches[0] as $match)
+ {
+ $out .= preg_replace("#/\*.*?\*/#s", '', $match);
+ }
+ }
+
+ return $out;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * HTML Entity Decode Callback
+ *
+ * Used as a callback for XSS Clean
+ *
+ * @access private
+ * @param array
+ * @return string
+ */
+ private function _decode_entity($match)
+ {
+ return $this->entity_decode($match[0], strtoupper(config_item('charset')));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * HTML Entities Decode
+ *
+ * This function is a replacement for html_entity_decode()
+ *
+ * In some versions of PHP the native function does not work
+ * when UTF-8 is the specified character set, so this gives us
+ * a work-around. More info here:
+ * http://bugs.php.net/bug.php?id=25670
+ *
+ * NOTE: html_entity_decode() has a bug in some PHP versions when UTF-8 is the
+ * character set, and the PHP developers said they were not back porting the
+ * fix to versions other than PHP 5.x.
+ *
+ * @access public
+ * @param string
+ * @param string
+ * @return string
+ */
+ public function entity_decode($str, $charset='UTF-8')
+ {
+ if (stristr($str, '&') === FALSE) return $str;
+
+ // The reason we are not using html_entity_decode() by itself is because
+ // while it is not technically correct to leave out the semicolon
+ // at the end of an entity most browsers will still interpret the entity
+ // correctly. html_entity_decode() does not convert entities without
+ // semicolons, so we are left with our own little solution here. Bummer.
+
+ if (function_exists('html_entity_decode') && (strtolower($charset) != 'utf-8' OR is_php('5.0.0')))
+ {
+ $str = html_entity_decode($str, ENT_COMPAT, $charset);
+ $str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\\1"))', $str);
+ return preg_replace('~&#([0-9]{2,4})~e', 'chr(\\1)', $str);
+ }
+
+ // Numeric Entities
+ $str = preg_replace('~&#x(0*[0-9a-f]{2,5});{0,1}~ei', 'chr(hexdec("\\1"))', $str);
+ $str = preg_replace('~&#([0-9]{2,4});{0,1}~e', 'chr(\\1)', $str);
+
+ // Literal Entities - Slightly slow so we do another check
+ if (stristr($str, '&') === FALSE)
+ {
+ $str = strtr($str, array_flip(get_html_translation_table(HTML_ENTITIES)));
+ }
+
+ return $str;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Filename Security
+ *
+ * @access public
+ * @param string
+ * @return string
+ */
+ public function sanitize_filename($str, $relative_path = FALSE)
+ {
+ $bad = array(
+ "../",
+ "<!--",
+ "-->",
+ "<",
+ ">",
+ "'",
+ '"',
+ '&',
+ '$',
+ '#',
+ '{',
+ '}',
+ '[',
+ ']',
+ '=',
+ ';',
+ '?',
+ "%20",
+ "%22",
+ "%3c", // <
+ "%253c", // <
+ "%3e", // >
+ "%0e", // >
+ "%28", // (
+ "%29", // )
+ "%2528", // (
+ "%26", // &
+ "%24", // $
+ "%3f", // ?
+ "%3b", // ;
+ "%3d" // =
+ );
+
+ if ( ! $relative_path)
+ {
+ $bad[] = './';
+ $bad[] = '/';
+ }
+
+ return stripslashes(str_replace($bad, '', $str));
+ }
+
+}
+// END Security Class
+
+/* End of file Security.php */
+/* Location: ./system/libraries/Security.php */ \ No newline at end of file
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 8ee08c5b2..8ee08c5b2 100644..100755
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
diff --git a/system/libraries/Sha1.php b/system/libraries/Sha1.php
index 1a657572b..1a657572b 100644..100755
--- a/system/libraries/Sha1.php
+++ b/system/libraries/Sha1.php
diff --git a/system/libraries/Table.php b/system/libraries/Table.php
index def696776..def696776 100644..100755
--- a/system/libraries/Table.php
+++ b/system/libraries/Table.php
diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php
index b0a767822..b0a767822 100644..100755
--- a/system/libraries/Trackback.php
+++ b/system/libraries/Trackback.php
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php
index 734cec104..734cec104 100644..100755
--- a/system/libraries/Typography.php
+++ b/system/libraries/Typography.php
diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php
index 5bd7e801a..5bd7e801a 100644..100755
--- a/system/libraries/Unit_test.php
+++ b/system/libraries/Unit_test.php
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 05511b5d3..05511b5d3 100644..100755
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index 0b77a7d42..0b77a7d42 100644..100755
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index d702e902f..d702e902f 100644..100755
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php
index 9cd332147..9cd332147 100644..100755
--- a/system/libraries/Xmlrpcs.php
+++ b/system/libraries/Xmlrpcs.php
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index 666327d5c..666327d5c 100644..100755
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
diff --git a/system/libraries/index.html b/system/libraries/index.html
index c942a79ce..c942a79ce 100644..100755
--- a/system/libraries/index.html
+++ b/system/libraries/index.html
diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/javascript/Jquery.php
index baab83d25..baab83d25 100644..100755
--- a/system/libraries/javascript/Jquery.php
+++ b/system/libraries/javascript/Jquery.php