codeigniter_vender 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (350) hide show
  1. data/.gitignore +2 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README +40 -0
  4. data/Rakefile +18 -0
  5. data/VERSION +1 -0
  6. data/codeigniter_vender.gemspec +389 -0
  7. data/generators/ci_app/USAGE +8 -0
  8. data/generators/ci_app/ci_app_generator.rb +12 -0
  9. data/generators/ci_app/templates/CodeIgniter_1.7.2/index.php +118 -0
  10. data/generators/ci_app/templates/CodeIgniter_1.7.2/license.txt +52 -0
  11. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/autoload.php +116 -0
  12. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/config.php +329 -0
  13. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/constants.php +41 -0
  14. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/database.php +55 -0
  15. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/doctypes.php +15 -0
  16. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/hooks.php +16 -0
  17. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/index.html +10 -0
  18. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/mimes.php +105 -0
  19. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/routes.php +48 -0
  20. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/smileys.php +66 -0
  21. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/config/user_agents.php +175 -0
  22. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/controllers/index.html +10 -0
  23. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/controllers/welcome.php +17 -0
  24. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_404.php +34 -0
  25. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_db.php +34 -0
  26. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_general.php +34 -0
  27. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/error_php.php +10 -0
  28. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/errors/index.html +10 -0
  29. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/helpers/index.html +10 -0
  30. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/hooks/index.html +10 -0
  31. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/index.html +10 -0
  32. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/language/english/index.html +10 -0
  33. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/libraries/index.html +10 -0
  34. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/models/index.html +10 -0
  35. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/views/index.html +10 -0
  36. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/application/views/welcome_message.php +62 -0
  37. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/cache/index.html +10 -0
  38. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Base4.php +69 -0
  39. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Base5.php +56 -0
  40. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/CodeIgniter.php +280 -0
  41. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Common.php +421 -0
  42. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/Compat.php +93 -0
  43. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/codeigniter/index.html +10 -0
  44. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB.php +146 -0
  45. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_active_rec.php +1820 -0
  46. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_cache.php +195 -0
  47. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_driver.php +1366 -0
  48. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_forge.php +375 -0
  49. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_result.php +342 -0
  50. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/DB_utility.php +389 -0
  51. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/index.html +10 -0
  52. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/index.html +10 -0
  53. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_driver.php +667 -0
  54. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_forge.php +248 -0
  55. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_result.php +169 -0
  56. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mssql/mssql_utility.php +123 -0
  57. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/index.html +10 -0
  58. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_driver.php +670 -0
  59. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_forge.php +254 -0
  60. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_result.php +169 -0
  61. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysql/mysql_utility.php +245 -0
  62. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/index.html +10 -0
  63. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_driver.php +671 -0
  64. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_forge.php +254 -0
  65. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_result.php +169 -0
  66. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/mysqli/mysqli_utility.php +123 -0
  67. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/index.html +10 -0
  68. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_driver.php +780 -0
  69. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_forge.php +248 -0
  70. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_result.php +249 -0
  71. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/oci8/oci8_utility.php +122 -0
  72. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/index.html +10 -0
  73. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_driver.php +639 -0
  74. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_forge.php +266 -0
  75. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_result.php +228 -0
  76. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/odbc/odbc_utility.php +148 -0
  77. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/index.html +10 -0
  78. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_driver.php +684 -0
  79. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_forge.php +248 -0
  80. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_result.php +169 -0
  81. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/postgre/postgre_utility.php +124 -0
  82. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/index.html +10 -0
  83. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_driver.php +657 -0
  84. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_forge.php +265 -0
  85. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_result.php +179 -0
  86. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/drivers/sqlite/sqlite_utility.php +141 -0
  87. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/database/index.html +10 -0
  88. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/fonts/index.html +10 -0
  89. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/fonts/texb.ttf +0 -0
  90. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/array_helper.php +78 -0
  91. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/compatibility_helper.php +498 -0
  92. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/cookie_helper.php +144 -0
  93. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/date_helper.php +611 -0
  94. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/directory_helper.php +84 -0
  95. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/download_helper.php +100 -0
  96. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/email_helper.php +62 -0
  97. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/file_helper.php +464 -0
  98. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/form_helper.php +1025 -0
  99. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/html_helper.php +416 -0
  100. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/index.html +10 -0
  101. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/inflector_helper.php +171 -0
  102. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/language_helper.php +58 -0
  103. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/number_helper.php +75 -0
  104. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/path_helper.php +72 -0
  105. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/security_helper.php +126 -0
  106. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/smiley_helper.php +273 -0
  107. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/string_helper.php +273 -0
  108. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/text_helper.php +462 -0
  109. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/typography_helper.php +71 -0
  110. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/url_helper.php +593 -0
  111. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/helpers/xml_helper.php +62 -0
  112. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/index.html +10 -0
  113. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/calendar_lang.php +51 -0
  114. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/date_lang.php +60 -0
  115. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/db_lang.php +28 -0
  116. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/email_lang.php +24 -0
  117. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/form_validation_lang.php +24 -0
  118. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/ftp_lang.php +17 -0
  119. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/imglib_lang.php +24 -0
  120. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/index.html +10 -0
  121. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/number_lang.php +10 -0
  122. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/profiler_lang.php +19 -0
  123. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/scaffolding_lang.php +17 -0
  124. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/unit_test_lang.php +24 -0
  125. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/upload_lang.php +22 -0
  126. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/english/validation_lang.php +24 -0
  127. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/language/index.html +10 -0
  128. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Benchmark.php +113 -0
  129. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Calendar.php +477 -0
  130. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Cart.php +550 -0
  131. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Config.php +244 -0
  132. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Controller.php +127 -0
  133. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Email.php +2041 -0
  134. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Encrypt.php +484 -0
  135. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Exceptions.php +174 -0
  136. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Form_validation.php +1278 -0
  137. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Ftp.php +618 -0
  138. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Hooks.php +226 -0
  139. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Image_lib.php +1544 -0
  140. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Input.php +1067 -0
  141. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Language.php +123 -0
  142. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Loader.php +1085 -0
  143. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Log.php +117 -0
  144. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Model.php +83 -0
  145. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Output.php +409 -0
  146. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Pagination.php +244 -0
  147. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Parser.php +173 -0
  148. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Profiler.php +392 -0
  149. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Router.php +389 -0
  150. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Session.php +758 -0
  151. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Sha1.php +251 -0
  152. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Table.php +440 -0
  153. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Trackback.php +547 -0
  154. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Typography.php +406 -0
  155. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/URI.php +586 -0
  156. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Unit_test.php +347 -0
  157. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Upload.php +970 -0
  158. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/User_agent.php +502 -0
  159. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Validation.php +875 -0
  160. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Xmlrpc.php +1421 -0
  161. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Xmlrpcs.php +536 -0
  162. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/Zip.php +359 -0
  163. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/libraries/index.html +10 -0
  164. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/logs/index.html +10 -0
  165. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/captcha_pi.php +356 -0
  166. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/index.html +10 -0
  167. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/plugins/js_calendar_pi.php +629 -0
  168. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/Scaffolding.php +291 -0
  169. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/background.jpg +0 -0
  170. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/index.html +10 -0
  171. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/images/logo.jpg +0 -0
  172. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/index.html +10 -0
  173. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/add.php +32 -0
  174. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/delete.php +9 -0
  175. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/edit.php +33 -0
  176. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/footer.php +10 -0
  177. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/header.php +29 -0
  178. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/index.html +10 -0
  179. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/no_data.php +8 -0
  180. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/stylesheet.css +143 -0
  181. data/generators/ci_app/templates/CodeIgniter_1.7.2/system/scaffolding/views/view.php +27 -0
  182. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/changelog.html +1080 -0
  183. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/active_record.html +757 -0
  184. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/caching.html +220 -0
  185. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/call_function.html +118 -0
  186. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/configuration.html +157 -0
  187. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/connecting.html +186 -0
  188. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/examples.html +217 -0
  189. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/fields.html +163 -0
  190. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/forge.html +234 -0
  191. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/helpers.html +151 -0
  192. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/index.html +99 -0
  193. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/queries.html +153 -0
  194. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/results.html +238 -0
  195. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/table_data.html +113 -0
  196. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/transactions.html +200 -0
  197. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/database/utilities.html +295 -0
  198. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/doc_style/index.html +86 -0
  199. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/doc_style/template.html +128 -0
  200. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/alternative_php.html +147 -0
  201. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/ancillary_classes.html +117 -0
  202. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/autoloader.html +101 -0
  203. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/caching.html +115 -0
  204. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/common_functions.html +119 -0
  205. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/controllers.html +385 -0
  206. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/core_classes.html +185 -0
  207. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/creating_libraries.html +298 -0
  208. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/credits.html +86 -0
  209. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/errors.html +138 -0
  210. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/helpers.html +185 -0
  211. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/hooks.html +167 -0
  212. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/libraries.html +94 -0
  213. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/managing_apps.html +133 -0
  214. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/models.html +251 -0
  215. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/plugins.html +127 -0
  216. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/profiling.html +104 -0
  217. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/quick_reference.html +77 -0
  218. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/requirements.html +82 -0
  219. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/reserved_names.html +156 -0
  220. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/routing.html +176 -0
  221. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/scaffolding.html +147 -0
  222. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/security.html +153 -0
  223. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/styleguide.html +687 -0
  224. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/urls.html +151 -0
  225. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/general/views.html +274 -0
  226. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/array_helper.html +119 -0
  227. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/compatibility_helper.html +118 -0
  228. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/cookie_helper.html +147 -0
  229. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/date_helper.html +408 -0
  230. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/directory_helper.html +143 -0
  231. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/download_helper.html +112 -0
  232. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/email_helper.html +102 -0
  233. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/file_helper.html +178 -0
  234. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/form_helper.html +484 -0
  235. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/html_helper.html +385 -0
  236. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/inflector_helper.html +151 -0
  237. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/language_helper.html +98 -0
  238. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/number_helper.html +107 -0
  239. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/path_helper.html +106 -0
  240. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/security_helper.html +125 -0
  241. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/smiley_helper.html +215 -0
  242. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/string_helper.html +176 -0
  243. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/text_helper.html +192 -0
  244. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/typography_helper.html +112 -0
  245. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/url_helper.html +289 -0
  246. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/helpers/xml_helper.html +105 -0
  247. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/appflowchart.gif +0 -0
  248. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/arrow.gif +0 -0
  249. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_logo.jpg +0 -0
  250. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_logo_flame.jpg +0 -0
  251. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/ci_quick_ref.png +0 -0
  252. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_helper_reference.pdf +0 -0
  253. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_helper_reference.png +0 -0
  254. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_library_reference.pdf +0 -0
  255. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/codeigniter_1.7.1_library_reference.png +0 -0
  256. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/file.gif +0 -0
  257. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/folder.gif +0 -0
  258. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_bg_darker.jpg +0 -0
  259. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_separator_darker.jpg +0 -0
  260. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/nav_toggle_darker.jpg +0 -0
  261. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/smile.gif +0 -0
  262. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/images/transparent.gif +0 -0
  263. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/index.html +99 -0
  264. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/downloads.html +105 -0
  265. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/index.html +97 -0
  266. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/troubleshooting.html +90 -0
  267. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_120.html +92 -0
  268. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_130.html +203 -0
  269. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_131.html +102 -0
  270. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_132.html +100 -0
  271. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_133.html +112 -0
  272. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_140.html +145 -0
  273. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_141.html +148 -0
  274. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_150.html +178 -0
  275. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_152.html +111 -0
  276. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_153.html +100 -0
  277. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_154.html +116 -0
  278. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_160.html +125 -0
  279. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_161.html +98 -0
  280. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_162.html +106 -0
  281. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_163.html +99 -0
  282. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_170.html +121 -0
  283. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_171.html +98 -0
  284. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_172.html +105 -0
  285. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrade_b11.html +144 -0
  286. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/installation/upgrading.html +101 -0
  287. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/benchmark.html +198 -0
  288. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/calendar.html +249 -0
  289. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/cart.html +346 -0
  290. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/config.html +181 -0
  291. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/email.html +307 -0
  292. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/encryption.html +182 -0
  293. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/file_uploading.html +451 -0
  294. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/form_validation.html +1221 -0
  295. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/ftp.html +303 -0
  296. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/image_lib.html +666 -0
  297. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/input.html +231 -0
  298. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/language.html +137 -0
  299. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/loader.html +214 -0
  300. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/output.html +145 -0
  301. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/pagination.html +218 -0
  302. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/parser.html +208 -0
  303. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/sessions.html +311 -0
  304. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/table.html +292 -0
  305. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/trackback.html +246 -0
  306. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/typography.html +160 -0
  307. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/unit_testing.html +205 -0
  308. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/uri.html +252 -0
  309. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/user_agent.html +201 -0
  310. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/validation.html +740 -0
  311. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/xmlrpc.html +517 -0
  312. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/libraries/zip.html +278 -0
  313. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/license.html +107 -0
  314. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/hacks.txt +9 -0
  315. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/moo.fx.js +119 -0
  316. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/moo.fx.pack.js +241 -0
  317. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/nav.js +139 -0
  318. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/prototype.lite.js +127 -0
  319. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/nav/user_guide_menu.js +4 -0
  320. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/appflow.html +95 -0
  321. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/at_a_glance.html +172 -0
  322. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/cheatsheets.html +83 -0
  323. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/features.html +120 -0
  324. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/getting_started.html +92 -0
  325. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/goals.html +98 -0
  326. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/index.html +84 -0
  327. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/overview/mvc.html +100 -0
  328. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/toc.html +209 -0
  329. data/generators/ci_app/templates/CodeIgniter_1.7.2/user_guide/userguide.css +406 -0
  330. data/generators/ci_app/templates/README +1 -0
  331. data/generators/ci_controller/USAGE +2 -0
  332. data/generators/ci_controller/ci_controller_generator.rb +11 -0
  333. data/generators/ci_controller/templates/ci_controller.php.erb +15 -0
  334. data/generators/ci_controller/templates/ci_view.php.erb +8 -0
  335. data/generators/ci_layout/USAGE +2 -0
  336. data/generators/ci_layout/ci_layout_generator.rb +24 -0
  337. data/generators/ci_layout/templates/application_layout.php.erb +19 -0
  338. data/generators/ci_model/USAGE +2 -0
  339. data/generators/ci_model/ci_model_generator.rb +42 -0
  340. data/generators/ci_model/templates/ci_model.php.erb +15 -0
  341. data/generators/ci_model/templates/model.rb +5 -0
  342. data/generators/ci_model/templates/model_migration.rb.erb +16 -0
  343. data/init.rb +1 -0
  344. data/install.rb +1 -0
  345. data/lib/codeigniter_vender.rb +1 -0
  346. data/lib/tasks/app.rake +8 -0
  347. data/test/codeigniter_vender_test.rb +8 -0
  348. data/test/test_helper.rb +3 -0
  349. data/uninstall.rb +1 -0
  350. metadata +411 -0
@@ -0,0 +1,1067 @@
1
+ <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
+ /**
3
+ * CodeIgniter
4
+ *
5
+ * An open source application development framework for PHP 4.3.2 or newer
6
+ *
7
+ * @package CodeIgniter
8
+ * @author ExpressionEngine Dev Team
9
+ * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
10
+ * @license http://codeigniter.com/user_guide/license.html
11
+ * @link http://codeigniter.com
12
+ * @since Version 1.0
13
+ * @filesource
14
+ */
15
+
16
+ // ------------------------------------------------------------------------
17
+
18
+ /**
19
+ * Input Class
20
+ *
21
+ * Pre-processes global input data for security
22
+ *
23
+ * @package CodeIgniter
24
+ * @subpackage Libraries
25
+ * @category Input
26
+ * @author ExpressionEngine Dev Team
27
+ * @link http://codeigniter.com/user_guide/libraries/input.html
28
+ */
29
+ class CI_Input {
30
+ var $use_xss_clean = FALSE;
31
+ var $xss_hash = '';
32
+ var $ip_address = FALSE;
33
+ var $user_agent = FALSE;
34
+ var $allow_get_array = FALSE;
35
+
36
+ /* never allowed, string replacement */
37
+ var $never_allowed_str = array(
38
+ 'document.cookie' => '[removed]',
39
+ 'document.write' => '[removed]',
40
+ '.parentNode' => '[removed]',
41
+ '.innerHTML' => '[removed]',
42
+ 'window.location' => '[removed]',
43
+ '-moz-binding' => '[removed]',
44
+ '<!--' => '&lt;!--',
45
+ '-->' => '--&gt;',
46
+ '<![CDATA[' => '&lt;![CDATA['
47
+ );
48
+ /* never allowed, regex replacement */
49
+ var $never_allowed_regex = array(
50
+ "javascript\s*:" => '[removed]',
51
+ "expression\s*(\(|&\#40;)" => '[removed]', // CSS and IE
52
+ "vbscript\s*:" => '[removed]', // IE, surprise!
53
+ "Redirect\s+302" => '[removed]'
54
+ );
55
+
56
+ /**
57
+ * Constructor
58
+ *
59
+ * Sets whether to globally enable the XSS processing
60
+ * and whether to allow the $_GET array
61
+ *
62
+ * @access public
63
+ */
64
+ function CI_Input()
65
+ {
66
+ log_message('debug', "Input Class Initialized");
67
+
68
+ $CFG =& load_class('Config');
69
+ $this->use_xss_clean = ($CFG->item('global_xss_filtering') === TRUE) ? TRUE : FALSE;
70
+ $this->allow_get_array = ($CFG->item('enable_query_strings') === TRUE) ? TRUE : FALSE;
71
+ $this->_sanitize_globals();
72
+ }
73
+
74
+ // --------------------------------------------------------------------
75
+
76
+ /**
77
+ * Sanitize Globals
78
+ *
79
+ * This function does the following:
80
+ *
81
+ * Unsets $_GET data (if query strings are not enabled)
82
+ *
83
+ * Unsets all globals if register_globals is enabled
84
+ *
85
+ * Standardizes newline characters to \n
86
+ *
87
+ * @access private
88
+ * @return void
89
+ */
90
+ function _sanitize_globals()
91
+ {
92
+ // Would kind of be "wrong" to unset any of these GLOBALS
93
+ $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST', '_SESSION', '_ENV', 'GLOBALS', 'HTTP_RAW_POST_DATA',
94
+ 'system_folder', 'application_folder', 'BM', 'EXT', 'CFG', 'URI', 'RTR', 'OUT', 'IN');
95
+
96
+ // Unset globals for security.
97
+ // This is effectively the same as register_globals = off
98
+ foreach (array($_GET, $_POST, $_COOKIE, $_SERVER, $_FILES, $_ENV, (isset($_SESSION) && is_array($_SESSION)) ? $_SESSION : array()) as $global)
99
+ {
100
+ if ( ! is_array($global))
101
+ {
102
+ if ( ! in_array($global, $protected))
103
+ {
104
+ unset($GLOBALS[$global]);
105
+ }
106
+ }
107
+ else
108
+ {
109
+ foreach ($global as $key => $val)
110
+ {
111
+ if ( ! in_array($key, $protected))
112
+ {
113
+ unset($GLOBALS[$key]);
114
+ }
115
+
116
+ if (is_array($val))
117
+ {
118
+ foreach($val as $k => $v)
119
+ {
120
+ if ( ! in_array($k, $protected))
121
+ {
122
+ unset($GLOBALS[$k]);
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+ }
129
+
130
+ // Is $_GET data allowed? If not we'll set the $_GET to an empty array
131
+ if ($this->allow_get_array == FALSE)
132
+ {
133
+ $_GET = array();
134
+ }
135
+ else
136
+ {
137
+ $_GET = $this->_clean_input_data($_GET);
138
+ }
139
+
140
+ // Clean $_POST Data
141
+ $_POST = $this->_clean_input_data($_POST);
142
+
143
+ // Clean $_COOKIE Data
144
+ // Also get rid of specially treated cookies that might be set by a server
145
+ // or silly application, that are of no use to a CI application anyway
146
+ // but that when present will trip our 'Disallowed Key Characters' alarm
147
+ // http://www.ietf.org/rfc/rfc2109.txt
148
+ // note that the key names below are single quoted strings, and are not PHP variables
149
+ unset($_COOKIE['$Version']);
150
+ unset($_COOKIE['$Path']);
151
+ unset($_COOKIE['$Domain']);
152
+ $_COOKIE = $this->_clean_input_data($_COOKIE);
153
+
154
+ log_message('debug', "Global POST and COOKIE data sanitized");
155
+ }
156
+
157
+ // --------------------------------------------------------------------
158
+
159
+ /**
160
+ * Clean Input Data
161
+ *
162
+ * This is a helper function. It escapes data and
163
+ * standardizes newline characters to \n
164
+ *
165
+ * @access private
166
+ * @param string
167
+ * @return string
168
+ */
169
+ function _clean_input_data($str)
170
+ {
171
+ if (is_array($str))
172
+ {
173
+ $new_array = array();
174
+ foreach ($str as $key => $val)
175
+ {
176
+ $new_array[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
177
+ }
178
+ return $new_array;
179
+ }
180
+
181
+ // We strip slashes if magic quotes is on to keep things consistent
182
+ if (get_magic_quotes_gpc())
183
+ {
184
+ $str = stripslashes($str);
185
+ }
186
+
187
+ // Should we filter the input data?
188
+ if ($this->use_xss_clean === TRUE)
189
+ {
190
+ $str = $this->xss_clean($str);
191
+ }
192
+
193
+ // Standardize newlines
194
+ if (strpos($str, "\r") !== FALSE)
195
+ {
196
+ $str = str_replace(array("\r\n", "\r"), "\n", $str);
197
+ }
198
+
199
+ return $str;
200
+ }
201
+
202
+ // --------------------------------------------------------------------
203
+
204
+ /**
205
+ * Clean Keys
206
+ *
207
+ * This is a helper function. To prevent malicious users
208
+ * from trying to exploit keys we make sure that keys are
209
+ * only named with alpha-numeric text and a few other items.
210
+ *
211
+ * @access private
212
+ * @param string
213
+ * @return string
214
+ */
215
+ function _clean_input_keys($str)
216
+ {
217
+ if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
218
+ {
219
+ exit('Disallowed Key Characters.');
220
+ }
221
+
222
+ return $str;
223
+ }
224
+
225
+ // --------------------------------------------------------------------
226
+
227
+ /**
228
+ * Fetch from array
229
+ *
230
+ * This is a helper function to retrieve values from global arrays
231
+ *
232
+ * @access private
233
+ * @param array
234
+ * @param string
235
+ * @param bool
236
+ * @return string
237
+ */
238
+ function _fetch_from_array(&$array, $index = '', $xss_clean = FALSE)
239
+ {
240
+ if ( ! isset($array[$index]))
241
+ {
242
+ return FALSE;
243
+ }
244
+
245
+ if ($xss_clean === TRUE)
246
+ {
247
+ return $this->xss_clean($array[$index]);
248
+ }
249
+
250
+ return $array[$index];
251
+ }
252
+
253
+ // --------------------------------------------------------------------
254
+
255
+ /**
256
+ * Fetch an item from the GET array
257
+ *
258
+ * @access public
259
+ * @param string
260
+ * @param bool
261
+ * @return string
262
+ */
263
+ function get($index = '', $xss_clean = FALSE)
264
+ {
265
+ return $this->_fetch_from_array($_GET, $index, $xss_clean);
266
+ }
267
+
268
+ // --------------------------------------------------------------------
269
+
270
+ /**
271
+ * Fetch an item from the POST array
272
+ *
273
+ * @access public
274
+ * @param string
275
+ * @param bool
276
+ * @return string
277
+ */
278
+ function post($index = '', $xss_clean = FALSE)
279
+ {
280
+ return $this->_fetch_from_array($_POST, $index, $xss_clean);
281
+ }
282
+
283
+ // --------------------------------------------------------------------
284
+
285
+ /**
286
+ * Fetch an item from either the GET array or the POST
287
+ *
288
+ * @access public
289
+ * @param string The index key
290
+ * @param bool XSS cleaning
291
+ * @return string
292
+ */
293
+ function get_post($index = '', $xss_clean = FALSE)
294
+ {
295
+ if ( ! isset($_POST[$index]) )
296
+ {
297
+ return $this->get($index, $xss_clean);
298
+ }
299
+ else
300
+ {
301
+ return $this->post($index, $xss_clean);
302
+ }
303
+ }
304
+
305
+ // --------------------------------------------------------------------
306
+
307
+ /**
308
+ * Fetch an item from the COOKIE array
309
+ *
310
+ * @access public
311
+ * @param string
312
+ * @param bool
313
+ * @return string
314
+ */
315
+ function cookie($index = '', $xss_clean = FALSE)
316
+ {
317
+ return $this->_fetch_from_array($_COOKIE, $index, $xss_clean);
318
+ }
319
+
320
+ // --------------------------------------------------------------------
321
+
322
+ /**
323
+ * Fetch an item from the SERVER array
324
+ *
325
+ * @access public
326
+ * @param string
327
+ * @param bool
328
+ * @return string
329
+ */
330
+ function server($index = '', $xss_clean = FALSE)
331
+ {
332
+ return $this->_fetch_from_array($_SERVER, $index, $xss_clean);
333
+ }
334
+
335
+ // --------------------------------------------------------------------
336
+
337
+ /**
338
+ * Fetch the IP Address
339
+ *
340
+ * @access public
341
+ * @return string
342
+ */
343
+ function ip_address()
344
+ {
345
+ if ($this->ip_address !== FALSE)
346
+ {
347
+ return $this->ip_address;
348
+ }
349
+
350
+ if (config_item('proxy_ips') != '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR'))
351
+ {
352
+ $proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY);
353
+ $proxies = is_array($proxies) ? $proxies : array($proxies);
354
+
355
+ $this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
356
+ }
357
+ elseif ($this->server('REMOTE_ADDR') AND $this->server('HTTP_CLIENT_IP'))
358
+ {
359
+ $this->ip_address = $_SERVER['HTTP_CLIENT_IP'];
360
+ }
361
+ elseif ($this->server('REMOTE_ADDR'))
362
+ {
363
+ $this->ip_address = $_SERVER['REMOTE_ADDR'];
364
+ }
365
+ elseif ($this->server('HTTP_CLIENT_IP'))
366
+ {
367
+ $this->ip_address = $_SERVER['HTTP_CLIENT_IP'];
368
+ }
369
+ elseif ($this->server('HTTP_X_FORWARDED_FOR'))
370
+ {
371
+ $this->ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
372
+ }
373
+
374
+ if ($this->ip_address === FALSE)
375
+ {
376
+ $this->ip_address = '0.0.0.0';
377
+ return $this->ip_address;
378
+ }
379
+
380
+ if (strstr($this->ip_address, ','))
381
+ {
382
+ $x = explode(',', $this->ip_address);
383
+ $this->ip_address = trim(end($x));
384
+ }
385
+
386
+ if ( ! $this->valid_ip($this->ip_address))
387
+ {
388
+ $this->ip_address = '0.0.0.0';
389
+ }
390
+
391
+ return $this->ip_address;
392
+ }
393
+
394
+ // --------------------------------------------------------------------
395
+
396
+ /**
397
+ * Validate IP Address
398
+ *
399
+ * Updated version suggested by Geert De Deckere
400
+ *
401
+ * @access public
402
+ * @param string
403
+ * @return string
404
+ */
405
+ function valid_ip($ip)
406
+ {
407
+ $ip_segments = explode('.', $ip);
408
+
409
+ // Always 4 segments needed
410
+ if (count($ip_segments) != 4)
411
+ {
412
+ return FALSE;
413
+ }
414
+ // IP can not start with 0
415
+ if ($ip_segments[0][0] == '0')
416
+ {
417
+ return FALSE;
418
+ }
419
+ // Check each segment
420
+ foreach ($ip_segments as $segment)
421
+ {
422
+ // IP segments must be digits and can not be
423
+ // longer than 3 digits or greater then 255
424
+ if ($segment == '' OR preg_match("/[^0-9]/", $segment) OR $segment > 255 OR strlen($segment) > 3)
425
+ {
426
+ return FALSE;
427
+ }
428
+ }
429
+
430
+ return TRUE;
431
+ }
432
+
433
+ // --------------------------------------------------------------------
434
+
435
+ /**
436
+ * User Agent
437
+ *
438
+ * @access public
439
+ * @return string
440
+ */
441
+ function user_agent()
442
+ {
443
+ if ($this->user_agent !== FALSE)
444
+ {
445
+ return $this->user_agent;
446
+ }
447
+
448
+ $this->user_agent = ( ! isset($_SERVER['HTTP_USER_AGENT'])) ? FALSE : $_SERVER['HTTP_USER_AGENT'];
449
+
450
+ return $this->user_agent;
451
+ }
452
+
453
+ // --------------------------------------------------------------------
454
+
455
+ /**
456
+ * Filename Security
457
+ *
458
+ * @access public
459
+ * @param string
460
+ * @return string
461
+ */
462
+ function filename_security($str)
463
+ {
464
+ $bad = array(
465
+ "../",
466
+ "./",
467
+ "<!--",
468
+ "-->",
469
+ "<",
470
+ ">",
471
+ "'",
472
+ '"',
473
+ '&',
474
+ '$',
475
+ '#',
476
+ '{',
477
+ '}',
478
+ '[',
479
+ ']',
480
+ '=',
481
+ ';',
482
+ '?',
483
+ "%20",
484
+ "%22",
485
+ "%3c", // <
486
+ "%253c", // <
487
+ "%3e", // >
488
+ "%0e", // >
489
+ "%28", // (
490
+ "%29", // )
491
+ "%2528", // (
492
+ "%26", // &
493
+ "%24", // $
494
+ "%3f", // ?
495
+ "%3b", // ;
496
+ "%3d" // =
497
+ );
498
+
499
+ return stripslashes(str_replace($bad, '', $str));
500
+ }
501
+
502
+ // --------------------------------------------------------------------
503
+
504
+ /**
505
+ * XSS Clean
506
+ *
507
+ * Sanitizes data so that Cross Site Scripting Hacks can be
508
+ * prevented. This function does a fair amount of work but
509
+ * it is extremely thorough, designed to prevent even the
510
+ * most obscure XSS attempts. Nothing is ever 100% foolproof,
511
+ * of course, but I haven't been able to get anything passed
512
+ * the filter.
513
+ *
514
+ * Note: This function should only be used to deal with data
515
+ * upon submission. It's not something that should
516
+ * be used for general runtime processing.
517
+ *
518
+ * This function was based in part on some code and ideas I
519
+ * got from Bitflux: http://blog.bitflux.ch/wiki/XSS_Prevention
520
+ *
521
+ * To help develop this script I used this great list of
522
+ * vulnerabilities along with a few other hacks I've
523
+ * harvested from examining vulnerabilities in other programs:
524
+ * http://ha.ckers.org/xss.html
525
+ *
526
+ * @access public
527
+ * @param string
528
+ * @return string
529
+ */
530
+ function xss_clean($str, $is_image = FALSE)
531
+ {
532
+ /*
533
+ * Is the string an array?
534
+ *
535
+ */
536
+ if (is_array($str))
537
+ {
538
+ while (list($key) = each($str))
539
+ {
540
+ $str[$key] = $this->xss_clean($str[$key]);
541
+ }
542
+
543
+ return $str;
544
+ }
545
+
546
+ /*
547
+ * Remove Invisible Characters
548
+ */
549
+ $str = $this->_remove_invisible_characters($str);
550
+
551
+ /*
552
+ * Protect GET variables in URLs
553
+ */
554
+
555
+ // 901119URL5918AMP18930PROTECT8198
556
+
557
+ $str = preg_replace('|\&([a-z\_0-9]+)\=([a-z\_0-9]+)|i', $this->xss_hash()."\\1=\\2", $str);
558
+
559
+ /*
560
+ * Validate standard character entities
561
+ *
562
+ * Add a semicolon if missing. We do this to enable
563
+ * the conversion of entities to ASCII later.
564
+ *
565
+ */
566
+ $str = preg_replace('#(&\#?[0-9a-z]{2,})([\x00-\x20])*;?#i', "\\1;\\2", $str);
567
+
568
+ /*
569
+ * Validate UTF16 two byte encoding (x00)
570
+ *
571
+ * Just as above, adds a semicolon if missing.
572
+ *
573
+ */
574
+ $str = preg_replace('#(&\#x?)([0-9A-F]+);?#i',"\\1\\2;",$str);
575
+
576
+ /*
577
+ * Un-Protect GET variables in URLs
578
+ */
579
+ $str = str_replace($this->xss_hash(), '&', $str);
580
+
581
+ /*
582
+ * URL Decode
583
+ *
584
+ * Just in case stuff like this is submitted:
585
+ *
586
+ * <a href="http://%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D">Google</a>
587
+ *
588
+ * Note: Use rawurldecode() so it does not remove plus signs
589
+ *
590
+ */
591
+ $str = rawurldecode($str);
592
+
593
+ /*
594
+ * Convert character entities to ASCII
595
+ *
596
+ * This permits our tests below to work reliably.
597
+ * We only convert entities that are within tags since
598
+ * these are the ones that will pose security problems.
599
+ *
600
+ */
601
+
602
+ $str = preg_replace_callback("/[a-z]+=([\'\"]).*?\\1/si", array($this, '_convert_attribute'), $str);
603
+
604
+ $str = preg_replace_callback("/<\w+.*?(?=>|<|$)/si", array($this, '_html_entity_decode_callback'), $str);
605
+
606
+ /*
607
+ * Remove Invisible Characters Again!
608
+ */
609
+ $str = $this->_remove_invisible_characters($str);
610
+
611
+ /*
612
+ * Convert all tabs to spaces
613
+ *
614
+ * This prevents strings like this: ja vascript
615
+ * NOTE: we deal with spaces between characters later.
616
+ * NOTE: preg_replace was found to be amazingly slow here on large blocks of data,
617
+ * so we use str_replace.
618
+ *
619
+ */
620
+
621
+ if (strpos($str, "\t") !== FALSE)
622
+ {
623
+ $str = str_replace("\t", ' ', $str);
624
+ }
625
+
626
+ /*
627
+ * Capture converted string for later comparison
628
+ */
629
+ $converted_string = $str;
630
+
631
+ /*
632
+ * Not Allowed Under Any Conditions
633
+ */
634
+
635
+ foreach ($this->never_allowed_str as $key => $val)
636
+ {
637
+ $str = str_replace($key, $val, $str);
638
+ }
639
+
640
+ foreach ($this->never_allowed_regex as $key => $val)
641
+ {
642
+ $str = preg_replace("#".$key."#i", $val, $str);
643
+ }
644
+
645
+ /*
646
+ * Makes PHP tags safe
647
+ *
648
+ * Note: XML tags are inadvertently replaced too:
649
+ *
650
+ * <?xml
651
+ *
652
+ * But it doesn't seem to pose a problem.
653
+ *
654
+ */
655
+ if ($is_image === TRUE)
656
+ {
657
+ // Images have a tendency to have the PHP short opening and closing tags every so often
658
+ // so we skip those and only do the long opening tags.
659
+ $str = preg_replace('/<\?(php)/i', "&lt;?\\1", $str);
660
+ }
661
+ else
662
+ {
663
+ $str = str_replace(array('<?', '?'.'>'), array('&lt;?', '?&gt;'), $str);
664
+ }
665
+
666
+ /*
667
+ * Compact any exploded words
668
+ *
669
+ * This corrects words like: j a v a s c r i p t
670
+ * These words are compacted back to their correct state.
671
+ *
672
+ */
673
+ $words = array('javascript', 'expression', 'vbscript', 'script', 'applet', 'alert', 'document', 'write', 'cookie', 'window');
674
+ foreach ($words as $word)
675
+ {
676
+ $temp = '';
677
+
678
+ for ($i = 0, $wordlen = strlen($word); $i < $wordlen; $i++)
679
+ {
680
+ $temp .= substr($word, $i, 1)."\s*";
681
+ }
682
+
683
+ // We only want to do this when it is followed by a non-word character
684
+ // That way valid stuff like "dealer to" does not become "dealerto"
685
+ $str = preg_replace_callback('#('.substr($temp, 0, -3).')(\W)#is', array($this, '_compact_exploded_words'), $str);
686
+ }
687
+
688
+ /*
689
+ * Remove disallowed Javascript in links or img tags
690
+ * We used to do some version comparisons and use of stripos for PHP5, but it is dog slow compared
691
+ * to these simplified non-capturing preg_match(), especially if the pattern exists in the string
692
+ */
693
+ do
694
+ {
695
+ $original = $str;
696
+
697
+ if (preg_match("/<a/i", $str))
698
+ {
699
+ $str = preg_replace_callback("#<a\s+([^>]*?)(>|$)#si", array($this, '_js_link_removal'), $str);
700
+ }
701
+
702
+ if (preg_match("/<img/i", $str))
703
+ {
704
+ $str = preg_replace_callback("#<img\s+([^>]*?)(\s?/?>|$)#si", array($this, '_js_img_removal'), $str);
705
+ }
706
+
707
+ if (preg_match("/script/i", $str) OR preg_match("/xss/i", $str))
708
+ {
709
+ $str = preg_replace("#<(/*)(script|xss)(.*?)\>#si", '[removed]', $str);
710
+ }
711
+ }
712
+ while($original != $str);
713
+
714
+ unset($original);
715
+
716
+ /*
717
+ * Remove JavaScript Event Handlers
718
+ *
719
+ * Note: This code is a little blunt. It removes
720
+ * the event handler and anything up to the closing >,
721
+ * but it's unlikely to be a problem.
722
+ *
723
+ */
724
+ $event_handlers = array('[^a-z_\-]on\w*','xmlns');
725
+
726
+ if ($is_image === TRUE)
727
+ {
728
+ /*
729
+ * Adobe Photoshop puts XML metadata into JFIF images, including namespacing,
730
+ * so we have to allow this for images. -Paul
731
+ */
732
+ unset($event_handlers[array_search('xmlns', $event_handlers)]);
733
+ }
734
+
735
+ $str = preg_replace("#<([^><]+?)(".implode('|', $event_handlers).")(\s*=\s*[^><]*)([><]*)#i", "<\\1\\4", $str);
736
+
737
+ /*
738
+ * Sanitize naughty HTML elements
739
+ *
740
+ * If a tag containing any of the words in the list
741
+ * below is found, the tag gets converted to entities.
742
+ *
743
+ * So this: <blink>
744
+ * Becomes: &lt;blink&gt;
745
+ *
746
+ */
747
+ $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';
748
+ $str = preg_replace_callback('#<(/*\s*)('.$naughty.')([^><]*)([><]*)#is', array($this, '_sanitize_naughty_html'), $str);
749
+
750
+ /*
751
+ * Sanitize naughty scripting elements
752
+ *
753
+ * Similar to above, only instead of looking for
754
+ * tags it looks for PHP and JavaScript commands
755
+ * that are disallowed. Rather than removing the
756
+ * code, it simply converts the parenthesis to entities
757
+ * rendering the code un-executable.
758
+ *
759
+ * For example: eval('some code')
760
+ * Becomes: eval&#40;'some code'&#41;
761
+ *
762
+ */
763
+ $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);
764
+
765
+ /*
766
+ * Final clean up
767
+ *
768
+ * This adds a bit of extra precaution in case
769
+ * something got through the above filters
770
+ *
771
+ */
772
+ foreach ($this->never_allowed_str as $key => $val)
773
+ {
774
+ $str = str_replace($key, $val, $str);
775
+ }
776
+
777
+ foreach ($this->never_allowed_regex as $key => $val)
778
+ {
779
+ $str = preg_replace("#".$key."#i", $val, $str);
780
+ }
781
+
782
+ /*
783
+ * Images are Handled in a Special Way
784
+ * - Essentially, we want to know that after all of the character conversion is done whether
785
+ * any unwanted, likely XSS, code was found. If not, we return TRUE, as the image is clean.
786
+ * However, if the string post-conversion does not matched the string post-removal of XSS,
787
+ * then it fails, as there was unwanted XSS code found and removed/changed during processing.
788
+ */
789
+
790
+ if ($is_image === TRUE)
791
+ {
792
+ if ($str == $converted_string)
793
+ {
794
+ return TRUE;
795
+ }
796
+ else
797
+ {
798
+ return FALSE;
799
+ }
800
+ }
801
+
802
+ log_message('debug', "XSS Filtering completed");
803
+ return $str;
804
+ }
805
+
806
+ // --------------------------------------------------------------------
807
+
808
+ /**
809
+ * Random Hash for protecting URLs
810
+ *
811
+ * @access public
812
+ * @return string
813
+ */
814
+ function xss_hash()
815
+ {
816
+ if ($this->xss_hash == '')
817
+ {
818
+ if (phpversion() >= 4.2)
819
+ mt_srand();
820
+ else
821
+ mt_srand(hexdec(substr(md5(microtime()), -8)) & 0x7fffffff);
822
+
823
+ $this->xss_hash = md5(time() + mt_rand(0, 1999999999));
824
+ }
825
+
826
+ return $this->xss_hash;
827
+ }
828
+
829
+ // --------------------------------------------------------------------
830
+
831
+ /**
832
+ * Remove Invisible Characters
833
+ *
834
+ * This prevents sandwiching null characters
835
+ * between ascii characters, like Java\0script.
836
+ *
837
+ * @access public
838
+ * @param string
839
+ * @return string
840
+ */
841
+ function _remove_invisible_characters($str)
842
+ {
843
+ static $non_displayables;
844
+
845
+ if ( ! isset($non_displayables))
846
+ {
847
+ // every control character except newline (dec 10), carriage return (dec 13), and horizontal tab (dec 09),
848
+ $non_displayables = array(
849
+ '/%0[0-8bcef]/', // url encoded 00-08, 11, 12, 14, 15
850
+ '/%1[0-9a-f]/', // url encoded 16-31
851
+ '/[\x00-\x08]/', // 00-08
852
+ '/\x0b/', '/\x0c/', // 11, 12
853
+ '/[\x0e-\x1f]/' // 14-31
854
+ );
855
+ }
856
+
857
+ do
858
+ {
859
+ $cleaned = $str;
860
+ $str = preg_replace($non_displayables, '', $str);
861
+ }
862
+ while ($cleaned != $str);
863
+
864
+ return $str;
865
+ }
866
+
867
+ // --------------------------------------------------------------------
868
+
869
+ /**
870
+ * Compact Exploded Words
871
+ *
872
+ * Callback function for xss_clean() to remove whitespace from
873
+ * things like j a v a s c r i p t
874
+ *
875
+ * @access public
876
+ * @param type
877
+ * @return type
878
+ */
879
+ function _compact_exploded_words($matches)
880
+ {
881
+ return preg_replace('/\s+/s', '', $matches[1]).$matches[2];
882
+ }
883
+
884
+ // --------------------------------------------------------------------
885
+
886
+ /**
887
+ * Sanitize Naughty HTML
888
+ *
889
+ * Callback function for xss_clean() to remove naughty HTML elements
890
+ *
891
+ * @access private
892
+ * @param array
893
+ * @return string
894
+ */
895
+ function _sanitize_naughty_html($matches)
896
+ {
897
+ // encode opening brace
898
+ $str = '&lt;'.$matches[1].$matches[2].$matches[3];
899
+
900
+ // encode captured opening or closing brace to prevent recursive vectors
901
+ $str .= str_replace(array('>', '<'), array('&gt;', '&lt;'), $matches[4]);
902
+
903
+ return $str;
904
+ }
905
+
906
+ // --------------------------------------------------------------------
907
+
908
+ /**
909
+ * JS Link Removal
910
+ *
911
+ * Callback function for xss_clean() to sanitize links
912
+ * This limits the PCRE backtracks, making it more performance friendly
913
+ * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in
914
+ * PHP 5.2+ on link-heavy strings
915
+ *
916
+ * @access private
917
+ * @param array
918
+ * @return string
919
+ */
920
+ function _js_link_removal($match)
921
+ {
922
+ $attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1]));
923
+ return str_replace($match[1], preg_replace("#href=.*?(alert\(|alert&\#40;|javascript\:|charset\=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si", "", $attributes), $match[0]);
924
+ }
925
+
926
+ /**
927
+ * JS Image Removal
928
+ *
929
+ * Callback function for xss_clean() to sanitize image tags
930
+ * This limits the PCRE backtracks, making it more performance friendly
931
+ * and prevents PREG_BACKTRACK_LIMIT_ERROR from being triggered in
932
+ * PHP 5.2+ on image tag heavy strings
933
+ *
934
+ * @access private
935
+ * @param array
936
+ * @return string
937
+ */
938
+ function _js_img_removal($match)
939
+ {
940
+ $attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1]));
941
+ return str_replace($match[1], preg_replace("#src=.*?(alert\(|alert&\#40;|javascript\:|charset\=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si", "", $attributes), $match[0]);
942
+ }
943
+
944
+ // --------------------------------------------------------------------
945
+
946
+ /**
947
+ * Attribute Conversion
948
+ *
949
+ * Used as a callback for XSS Clean
950
+ *
951
+ * @access public
952
+ * @param array
953
+ * @return string
954
+ */
955
+ function _convert_attribute($match)
956
+ {
957
+ return str_replace(array('>', '<', '\\'), array('&gt;', '&lt;', '\\\\'), $match[0]);
958
+ }
959
+
960
+ // --------------------------------------------------------------------
961
+
962
+ /**
963
+ * HTML Entity Decode Callback
964
+ *
965
+ * Used as a callback for XSS Clean
966
+ *
967
+ * @access public
968
+ * @param array
969
+ * @return string
970
+ */
971
+ function _html_entity_decode_callback($match)
972
+ {
973
+ $CFG =& load_class('Config');
974
+ $charset = $CFG->item('charset');
975
+
976
+ return $this->_html_entity_decode($match[0], strtoupper($charset));
977
+ }
978
+
979
+ // --------------------------------------------------------------------
980
+
981
+ /**
982
+ * HTML Entities Decode
983
+ *
984
+ * This function is a replacement for html_entity_decode()
985
+ *
986
+ * In some versions of PHP the native function does not work
987
+ * when UTF-8 is the specified character set, so this gives us
988
+ * a work-around. More info here:
989
+ * http://bugs.php.net/bug.php?id=25670
990
+ *
991
+ * @access private
992
+ * @param string
993
+ * @param string
994
+ * @return string
995
+ */
996
+ /* -------------------------------------------------
997
+ /* Replacement for html_entity_decode()
998
+ /* -------------------------------------------------*/
999
+
1000
+ /*
1001
+ NOTE: html_entity_decode() has a bug in some PHP versions when UTF-8 is the
1002
+ character set, and the PHP developers said they were not back porting the
1003
+ fix to versions other than PHP 5.x.
1004
+ */
1005
+ function _html_entity_decode($str, $charset='UTF-8')
1006
+ {
1007
+ if (stristr($str, '&') === FALSE) return $str;
1008
+
1009
+ // The reason we are not using html_entity_decode() by itself is because
1010
+ // while it is not technically correct to leave out the semicolon
1011
+ // at the end of an entity most browsers will still interpret the entity
1012
+ // correctly. html_entity_decode() does not convert entities without
1013
+ // semicolons, so we are left with our own little solution here. Bummer.
1014
+
1015
+ if (function_exists('html_entity_decode') && (strtolower($charset) != 'utf-8' OR version_compare(phpversion(), '5.0.0', '>=')))
1016
+ {
1017
+ $str = html_entity_decode($str, ENT_COMPAT, $charset);
1018
+ $str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\\1"))', $str);
1019
+ return preg_replace('~&#([0-9]{2,4})~e', 'chr(\\1)', $str);
1020
+ }
1021
+
1022
+ // Numeric Entities
1023
+ $str = preg_replace('~&#x(0*[0-9a-f]{2,5});{0,1}~ei', 'chr(hexdec("\\1"))', $str);
1024
+ $str = preg_replace('~&#([0-9]{2,4});{0,1}~e', 'chr(\\1)', $str);
1025
+
1026
+ // Literal Entities - Slightly slow so we do another check
1027
+ if (stristr($str, '&') === FALSE)
1028
+ {
1029
+ $str = strtr($str, array_flip(get_html_translation_table(HTML_ENTITIES)));
1030
+ }
1031
+
1032
+ return $str;
1033
+ }
1034
+
1035
+ // --------------------------------------------------------------------
1036
+
1037
+ /**
1038
+ * Filter Attributes
1039
+ *
1040
+ * Filters tag attributes for consistency and safety
1041
+ *
1042
+ * @access public
1043
+ * @param string
1044
+ * @return string
1045
+ */
1046
+ function _filter_attributes($str)
1047
+ {
1048
+ $out = '';
1049
+
1050
+ if (preg_match_all('#\s*[a-z\-]+\s*=\s*(\042|\047)([^\\1]*?)\\1#is', $str, $matches))
1051
+ {
1052
+ foreach ($matches[0] as $match)
1053
+ {
1054
+ $out .= preg_replace("#/\*.*?\*/#s", '', $match);
1055
+ }
1056
+ }
1057
+
1058
+ return $out;
1059
+ }
1060
+
1061
+ // --------------------------------------------------------------------
1062
+
1063
+ }
1064
+ // END Input class
1065
+
1066
+ /* End of file Input.php */
1067
+ /* Location: ./system/libraries/Input.php */