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,875 @@
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
+ * Validation Class
20
+ *
21
+ * @package CodeIgniter
22
+ * @subpackage Libraries
23
+ * @category Validation
24
+ * @author ExpressionEngine Dev Team
25
+ * @link http://codeigniter.com/user_guide/libraries/validation.html
26
+ */
27
+ class CI_Validation {
28
+
29
+ var $CI;
30
+ var $error_string = '';
31
+ var $_error_array = array();
32
+ var $_rules = array();
33
+ var $_fields = array();
34
+ var $_error_messages = array();
35
+ var $_current_field = '';
36
+ var $_safe_form_data = FALSE;
37
+ var $_error_prefix = '<p>';
38
+ var $_error_suffix = '</p>';
39
+
40
+
41
+
42
+ /**
43
+ * Constructor
44
+ *
45
+ */
46
+ function CI_Validation()
47
+ {
48
+ $this->CI =& get_instance();
49
+
50
+ if (function_exists('mb_internal_encoding'))
51
+ {
52
+ mb_internal_encoding($this->CI->config->item('charset'));
53
+ }
54
+
55
+ log_message('debug', "Validation Class Initialized");
56
+ }
57
+
58
+ // --------------------------------------------------------------------
59
+
60
+ /**
61
+ * Set Fields
62
+ *
63
+ * This function takes an array of field names as input
64
+ * and generates class variables with the same name, which will
65
+ * either be blank or contain the $_POST value corresponding to it
66
+ *
67
+ * @access public
68
+ * @param string
69
+ * @param string
70
+ * @return void
71
+ */
72
+ function set_fields($data = '', $field = '')
73
+ {
74
+ if ($data == '')
75
+ {
76
+ if (count($this->_fields) == 0)
77
+ {
78
+ return FALSE;
79
+ }
80
+ }
81
+ else
82
+ {
83
+ if ( ! is_array($data))
84
+ {
85
+ $data = array($data => $field);
86
+ }
87
+
88
+ if (count($data) > 0)
89
+ {
90
+ $this->_fields = $data;
91
+ }
92
+ }
93
+
94
+ foreach($this->_fields as $key => $val)
95
+ {
96
+ $this->$key = ( ! isset($_POST[$key])) ? '' : $this->prep_for_form($_POST[$key]);
97
+
98
+ $error = $key.'_error';
99
+ if ( ! isset($this->$error))
100
+ {
101
+ $this->$error = '';
102
+ }
103
+ }
104
+ }
105
+
106
+ // --------------------------------------------------------------------
107
+
108
+ /**
109
+ * Set Rules
110
+ *
111
+ * This function takes an array of field names and validation
112
+ * rules as input ad simply stores is for use later.
113
+ *
114
+ * @access public
115
+ * @param mixed
116
+ * @param string
117
+ * @return void
118
+ */
119
+ function set_rules($data, $rules = '')
120
+ {
121
+ if ( ! is_array($data))
122
+ {
123
+ if ($rules == '')
124
+ return;
125
+
126
+ $data = array($data => $rules);
127
+ }
128
+
129
+ foreach ($data as $key => $val)
130
+ {
131
+ $this->_rules[$key] = $val;
132
+ }
133
+ }
134
+
135
+ // --------------------------------------------------------------------
136
+
137
+ /**
138
+ * Set Error Message
139
+ *
140
+ * Lets users set their own error messages on the fly. Note: The key
141
+ * name has to match the function name that it corresponds to.
142
+ *
143
+ * @access public
144
+ * @param string
145
+ * @param string
146
+ * @return string
147
+ */
148
+ function set_message($lang, $val = '')
149
+ {
150
+ if ( ! is_array($lang))
151
+ {
152
+ $lang = array($lang => $val);
153
+ }
154
+
155
+ $this->_error_messages = array_merge($this->_error_messages, $lang);
156
+ }
157
+
158
+ // --------------------------------------------------------------------
159
+
160
+ /**
161
+ * Set The Error Delimiter
162
+ *
163
+ * Permits a prefix/suffix to be added to each error message
164
+ *
165
+ * @access public
166
+ * @param string
167
+ * @param string
168
+ * @return void
169
+ */
170
+ function set_error_delimiters($prefix = '<p>', $suffix = '</p>')
171
+ {
172
+ $this->_error_prefix = $prefix;
173
+ $this->_error_suffix = $suffix;
174
+ }
175
+
176
+ // --------------------------------------------------------------------
177
+
178
+ /**
179
+ * Run the Validator
180
+ *
181
+ * This function does all the work.
182
+ *
183
+ * @access public
184
+ * @return bool
185
+ */
186
+ function run()
187
+ {
188
+ // Do we even have any data to process? Mm?
189
+ if (count($_POST) == 0 OR count($this->_rules) == 0)
190
+ {
191
+ return FALSE;
192
+ }
193
+
194
+ // Load the language file containing error messages
195
+ $this->CI->lang->load('validation');
196
+
197
+ // Cycle through the rules and test for errors
198
+ foreach ($this->_rules as $field => $rules)
199
+ {
200
+ //Explode out the rules!
201
+ $ex = explode('|', $rules);
202
+
203
+ // Is the field required? If not, if the field is blank we'll move on to the next test
204
+ if ( ! in_array('required', $ex, TRUE))
205
+ {
206
+ if ( ! isset($_POST[$field]) OR $_POST[$field] == '')
207
+ {
208
+ continue;
209
+ }
210
+ }
211
+
212
+ /*
213
+ * Are we dealing with an "isset" rule?
214
+ *
215
+ * Before going further, we'll see if one of the rules
216
+ * is to check whether the item is set (typically this
217
+ * applies only to checkboxes). If so, we'll
218
+ * test for it here since there's not reason to go
219
+ * further
220
+ */
221
+ if ( ! isset($_POST[$field]))
222
+ {
223
+ if (in_array('isset', $ex, TRUE) OR in_array('required', $ex))
224
+ {
225
+ if ( ! isset($this->_error_messages['isset']))
226
+ {
227
+ if (FALSE === ($line = $this->CI->lang->line('isset')))
228
+ {
229
+ $line = 'The field was not set';
230
+ }
231
+ }
232
+ else
233
+ {
234
+ $line = $this->_error_messages['isset'];
235
+ }
236
+
237
+ // Build the error message
238
+ $mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field];
239
+ $message = sprintf($line, $mfield);
240
+
241
+ // Set the error variable. Example: $this->username_error
242
+ $error = $field.'_error';
243
+ $this->$error = $this->_error_prefix.$message.$this->_error_suffix;
244
+ $this->_error_array[] = $message;
245
+ }
246
+
247
+ continue;
248
+ }
249
+
250
+ /*
251
+ * Set the current field
252
+ *
253
+ * The various prepping functions need to know the
254
+ * current field name so they can do this:
255
+ *
256
+ * $_POST[$this->_current_field] == 'bla bla';
257
+ */
258
+ $this->_current_field = $field;
259
+
260
+ // Cycle through the rules!
261
+ foreach ($ex As $rule)
262
+ {
263
+ // Is the rule a callback?
264
+ $callback = FALSE;
265
+ if (substr($rule, 0, 9) == 'callback_')
266
+ {
267
+ $rule = substr($rule, 9);
268
+ $callback = TRUE;
269
+ }
270
+
271
+ // Strip the parameter (if exists) from the rule
272
+ // Rules can contain a parameter: max_length[5]
273
+ $param = FALSE;
274
+ if (preg_match("/(.*?)\[(.*?)\]/", $rule, $match))
275
+ {
276
+ $rule = $match[1];
277
+ $param = $match[2];
278
+ }
279
+
280
+ // Call the function that corresponds to the rule
281
+ if ($callback === TRUE)
282
+ {
283
+ if ( ! method_exists($this->CI, $rule))
284
+ {
285
+ continue;
286
+ }
287
+
288
+ $result = $this->CI->$rule($_POST[$field], $param);
289
+
290
+ // If the field isn't required and we just processed a callback we'll move on...
291
+ if ( ! in_array('required', $ex, TRUE) AND $result !== FALSE)
292
+ {
293
+ continue 2;
294
+ }
295
+
296
+ }
297
+ else
298
+ {
299
+ if ( ! method_exists($this, $rule))
300
+ {
301
+ /*
302
+ * Run the native PHP function if called for
303
+ *
304
+ * If our own wrapper function doesn't exist we see
305
+ * if a native PHP function does. Users can use
306
+ * any native PHP function call that has one param.
307
+ */
308
+ if (function_exists($rule))
309
+ {
310
+ $_POST[$field] = $rule($_POST[$field]);
311
+ $this->$field = $_POST[$field];
312
+ }
313
+
314
+ continue;
315
+ }
316
+
317
+ $result = $this->$rule($_POST[$field], $param);
318
+ }
319
+
320
+ // Did the rule test negatively? If so, grab the error.
321
+ if ($result === FALSE)
322
+ {
323
+ if ( ! isset($this->_error_messages[$rule]))
324
+ {
325
+ if (FALSE === ($line = $this->CI->lang->line($rule)))
326
+ {
327
+ $line = 'Unable to access an error message corresponding to your field name.';
328
+ }
329
+ }
330
+ else
331
+ {
332
+ $line = $this->_error_messages[$rule];
333
+ }
334
+
335
+ // Build the error message
336
+ $mfield = ( ! isset($this->_fields[$field])) ? $field : $this->_fields[$field];
337
+ $mparam = ( ! isset($this->_fields[$param])) ? $param : $this->_fields[$param];
338
+ $message = sprintf($line, $mfield, $mparam);
339
+
340
+ // Set the error variable. Example: $this->username_error
341
+ $error = $field.'_error';
342
+ $this->$error = $this->_error_prefix.$message.$this->_error_suffix;
343
+
344
+ // Add the error to the error array
345
+ $this->_error_array[] = $message;
346
+ continue 2;
347
+ }
348
+ }
349
+
350
+ }
351
+
352
+ $total_errors = count($this->_error_array);
353
+
354
+ /*
355
+ * Recompile the class variables
356
+ *
357
+ * If any prepping functions were called the $_POST data
358
+ * might now be different then the corresponding class
359
+ * variables so we'll set them anew.
360
+ */
361
+ if ($total_errors > 0)
362
+ {
363
+ $this->_safe_form_data = TRUE;
364
+ }
365
+
366
+ $this->set_fields();
367
+
368
+ // Did we end up with any errors?
369
+ if ($total_errors == 0)
370
+ {
371
+ return TRUE;
372
+ }
373
+
374
+ // Generate the error string
375
+ foreach ($this->_error_array as $val)
376
+ {
377
+ $this->error_string .= $this->_error_prefix.$val.$this->_error_suffix."\n";
378
+ }
379
+
380
+ return FALSE;
381
+ }
382
+
383
+ // --------------------------------------------------------------------
384
+
385
+ /**
386
+ * Required
387
+ *
388
+ * @access public
389
+ * @param string
390
+ * @return bool
391
+ */
392
+ function required($str)
393
+ {
394
+ if ( ! is_array($str))
395
+ {
396
+ return (trim($str) == '') ? FALSE : TRUE;
397
+ }
398
+ else
399
+ {
400
+ return ( ! empty($str));
401
+ }
402
+ }
403
+
404
+ // --------------------------------------------------------------------
405
+
406
+ /**
407
+ * Match one field to another
408
+ *
409
+ * @access public
410
+ * @param string
411
+ * @param field
412
+ * @return bool
413
+ */
414
+ function matches($str, $field)
415
+ {
416
+ if ( ! isset($_POST[$field]))
417
+ {
418
+ return FALSE;
419
+ }
420
+
421
+ return ($str !== $_POST[$field]) ? FALSE : TRUE;
422
+ }
423
+
424
+ // --------------------------------------------------------------------
425
+
426
+ /**
427
+ * Minimum Length
428
+ *
429
+ * @access public
430
+ * @param string
431
+ * @param value
432
+ * @return bool
433
+ */
434
+ function min_length($str, $val)
435
+ {
436
+ if (preg_match("/[^0-9]/", $val))
437
+ {
438
+ return FALSE;
439
+ }
440
+
441
+ if (function_exists('mb_strlen'))
442
+ {
443
+ return (mb_strlen($str) < $val) ? FALSE : TRUE;
444
+ }
445
+
446
+ return (strlen($str) < $val) ? FALSE : TRUE;
447
+ }
448
+
449
+ // --------------------------------------------------------------------
450
+
451
+ /**
452
+ * Max Length
453
+ *
454
+ * @access public
455
+ * @param string
456
+ * @param value
457
+ * @return bool
458
+ */
459
+ function max_length($str, $val)
460
+ {
461
+ if (preg_match("/[^0-9]/", $val))
462
+ {
463
+ return FALSE;
464
+ }
465
+
466
+ if (function_exists('mb_strlen'))
467
+ {
468
+ return (mb_strlen($str) > $val) ? FALSE : TRUE;
469
+ }
470
+
471
+ return (strlen($str) > $val) ? FALSE : TRUE;
472
+ }
473
+
474
+ // --------------------------------------------------------------------
475
+
476
+ /**
477
+ * Exact Length
478
+ *
479
+ * @access public
480
+ * @param string
481
+ * @param value
482
+ * @return bool
483
+ */
484
+ function exact_length($str, $val)
485
+ {
486
+ if (preg_match("/[^0-9]/", $val))
487
+ {
488
+ return FALSE;
489
+ }
490
+
491
+ if (function_exists('mb_strlen'))
492
+ {
493
+ return (mb_strlen($str) != $val) ? FALSE : TRUE;
494
+ }
495
+
496
+ return (strlen($str) != $val) ? FALSE : TRUE;
497
+ }
498
+
499
+ // --------------------------------------------------------------------
500
+
501
+ /**
502
+ * Valid Email
503
+ *
504
+ * @access public
505
+ * @param string
506
+ * @return bool
507
+ */
508
+ function valid_email($str)
509
+ {
510
+ return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
511
+ }
512
+
513
+ // --------------------------------------------------------------------
514
+
515
+ /**
516
+ * Valid Emails
517
+ *
518
+ * @access public
519
+ * @param string
520
+ * @return bool
521
+ */
522
+ function valid_emails($str)
523
+ {
524
+ if (strpos($str, ',') === FALSE)
525
+ {
526
+ return $this->valid_email(trim($str));
527
+ }
528
+
529
+ foreach(explode(',', $str) as $email)
530
+ {
531
+ if (trim($email) != '' && $this->valid_email(trim($email)) === FALSE)
532
+ {
533
+ return FALSE;
534
+ }
535
+ }
536
+
537
+ return TRUE;
538
+ }
539
+
540
+ // --------------------------------------------------------------------
541
+
542
+ /**
543
+ * Validate IP Address
544
+ *
545
+ * @access public
546
+ * @param string
547
+ * @return string
548
+ */
549
+ function valid_ip($ip)
550
+ {
551
+ return $this->CI->input->valid_ip($ip);
552
+ }
553
+
554
+ // --------------------------------------------------------------------
555
+
556
+ /**
557
+ * Alpha
558
+ *
559
+ * @access public
560
+ * @param string
561
+ * @return bool
562
+ */
563
+ function alpha($str)
564
+ {
565
+ return ( ! preg_match("/^([a-z])+$/i", $str)) ? FALSE : TRUE;
566
+ }
567
+
568
+ // --------------------------------------------------------------------
569
+
570
+ /**
571
+ * Alpha-numeric
572
+ *
573
+ * @access public
574
+ * @param string
575
+ * @return bool
576
+ */
577
+ function alpha_numeric($str)
578
+ {
579
+ return ( ! preg_match("/^([a-z0-9])+$/i", $str)) ? FALSE : TRUE;
580
+ }
581
+
582
+ // --------------------------------------------------------------------
583
+
584
+ /**
585
+ * Alpha-numeric with underscores and dashes
586
+ *
587
+ * @access public
588
+ * @param string
589
+ * @return bool
590
+ */
591
+ function alpha_dash($str)
592
+ {
593
+ return ( ! preg_match("/^([-a-z0-9_-])+$/i", $str)) ? FALSE : TRUE;
594
+ }
595
+
596
+ // --------------------------------------------------------------------
597
+
598
+ /**
599
+ * Numeric
600
+ *
601
+ * @access public
602
+ * @param string
603
+ * @return bool
604
+ */
605
+ function numeric($str)
606
+ {
607
+ return (bool)preg_match( '/^[\-+]?[0-9]*\.?[0-9]+$/', $str);
608
+
609
+ }
610
+
611
+ // --------------------------------------------------------------------
612
+
613
+ /**
614
+ * Is Numeric
615
+ *
616
+ * @access public
617
+ * @param string
618
+ * @return bool
619
+ */
620
+ function is_numeric($str)
621
+ {
622
+ return ( ! is_numeric($str)) ? FALSE : TRUE;
623
+ }
624
+
625
+ // --------------------------------------------------------------------
626
+
627
+ /**
628
+ * Integer
629
+ *
630
+ * @access public
631
+ * @param string
632
+ * @return bool
633
+ */
634
+ function integer($str)
635
+ {
636
+ return (bool)preg_match( '/^[\-+]?[0-9]+$/', $str);
637
+ }
638
+
639
+ // --------------------------------------------------------------------
640
+
641
+ /**
642
+ * Is a Natural number (0,1,2,3, etc.)
643
+ *
644
+ * @access public
645
+ * @param string
646
+ * @return bool
647
+ */
648
+ function is_natural($str)
649
+ {
650
+ return (bool)preg_match( '/^[0-9]+$/', $str);
651
+ }
652
+
653
+ // --------------------------------------------------------------------
654
+
655
+ /**
656
+ * Is a Natural number, but not a zero (1,2,3, etc.)
657
+ *
658
+ * @access public
659
+ * @param string
660
+ * @return bool
661
+ */
662
+ function is_natural_no_zero($str)
663
+ {
664
+ if ( ! preg_match( '/^[0-9]+$/', $str))
665
+ {
666
+ return FALSE;
667
+ }
668
+
669
+ if ($str == 0)
670
+ {
671
+ return FALSE;
672
+ }
673
+
674
+ return TRUE;
675
+ }
676
+
677
+ // --------------------------------------------------------------------
678
+
679
+ /**
680
+ * Valid Base64
681
+ *
682
+ * Tests a string for characters outside of the Base64 alphabet
683
+ * as defined by RFC 2045 http://www.faqs.org/rfcs/rfc2045
684
+ *
685
+ * @access public
686
+ * @param string
687
+ * @return bool
688
+ */
689
+ function valid_base64($str)
690
+ {
691
+ return (bool) ! preg_match('/[^a-zA-Z0-9\/\+=]/', $str);
692
+ }
693
+
694
+ // --------------------------------------------------------------------
695
+
696
+ /**
697
+ * Set Select
698
+ *
699
+ * Enables pull-down lists to be set to the value the user
700
+ * selected in the event of an error
701
+ *
702
+ * @access public
703
+ * @param string
704
+ * @param string
705
+ * @return string
706
+ */
707
+ function set_select($field = '', $value = '')
708
+ {
709
+ if ($field == '' OR $value == '' OR ! isset($_POST[$field]))
710
+ {
711
+ return '';
712
+ }
713
+
714
+ if ($_POST[$field] == $value)
715
+ {
716
+ return ' selected="selected"';
717
+ }
718
+ }
719
+
720
+ // --------------------------------------------------------------------
721
+
722
+ /**
723
+ * Set Radio
724
+ *
725
+ * Enables radio buttons to be set to the value the user
726
+ * selected in the event of an error
727
+ *
728
+ * @access public
729
+ * @param string
730
+ * @param string
731
+ * @return string
732
+ */
733
+ function set_radio($field = '', $value = '')
734
+ {
735
+ if ($field == '' OR $value == '' OR ! isset($_POST[$field]))
736
+ {
737
+ return '';
738
+ }
739
+
740
+ if ($_POST[$field] == $value)
741
+ {
742
+ return ' checked="checked"';
743
+ }
744
+ }
745
+
746
+ // --------------------------------------------------------------------
747
+
748
+ /**
749
+ * Set Checkbox
750
+ *
751
+ * Enables checkboxes to be set to the value the user
752
+ * selected in the event of an error
753
+ *
754
+ * @access public
755
+ * @param string
756
+ * @param string
757
+ * @return string
758
+ */
759
+ function set_checkbox($field = '', $value = '')
760
+ {
761
+ if ($field == '' OR $value == '' OR ! isset($_POST[$field]))
762
+ {
763
+ return '';
764
+ }
765
+
766
+ if ($_POST[$field] == $value)
767
+ {
768
+ return ' checked="checked"';
769
+ }
770
+ }
771
+
772
+ // --------------------------------------------------------------------
773
+
774
+ /**
775
+ * Prep data for form
776
+ *
777
+ * This function allows HTML to be safely shown in a form.
778
+ * Special characters are converted.
779
+ *
780
+ * @access public
781
+ * @param string
782
+ * @return string
783
+ */
784
+ function prep_for_form($data = '')
785
+ {
786
+ if (is_array($data))
787
+ {
788
+ foreach ($data as $key => $val)
789
+ {
790
+ $data[$key] = $this->prep_for_form($val);
791
+ }
792
+
793
+ return $data;
794
+ }
795
+
796
+ if ($this->_safe_form_data == FALSE OR $data == '')
797
+ {
798
+ return $data;
799
+ }
800
+
801
+ return str_replace(array("'", '"', '<', '>'), array("&#39;", "&quot;", '&lt;', '&gt;'), stripslashes($data));
802
+ }
803
+
804
+ // --------------------------------------------------------------------
805
+
806
+ /**
807
+ * Prep URL
808
+ *
809
+ * @access public
810
+ * @param string
811
+ * @return string
812
+ */
813
+ function prep_url($str = '')
814
+ {
815
+ if ($str == 'http://' OR $str == '')
816
+ {
817
+ $_POST[$this->_current_field] = '';
818
+ return;
819
+ }
820
+
821
+ if (substr($str, 0, 7) != 'http://' && substr($str, 0, 8) != 'https://')
822
+ {
823
+ $str = 'http://'.$str;
824
+ }
825
+
826
+ $_POST[$this->_current_field] = $str;
827
+ }
828
+
829
+ // --------------------------------------------------------------------
830
+
831
+ /**
832
+ * Strip Image Tags
833
+ *
834
+ * @access public
835
+ * @param string
836
+ * @return string
837
+ */
838
+ function strip_image_tags($str)
839
+ {
840
+ $_POST[$this->_current_field] = $this->CI->input->strip_image_tags($str);
841
+ }
842
+
843
+ // --------------------------------------------------------------------
844
+
845
+ /**
846
+ * XSS Clean
847
+ *
848
+ * @access public
849
+ * @param string
850
+ * @return string
851
+ */
852
+ function xss_clean($str)
853
+ {
854
+ $_POST[$this->_current_field] = $this->CI->input->xss_clean($str);
855
+ }
856
+
857
+ // --------------------------------------------------------------------
858
+
859
+ /**
860
+ * Convert PHP tags to entities
861
+ *
862
+ * @access public
863
+ * @param string
864
+ * @return string
865
+ */
866
+ function encode_php_tags($str)
867
+ {
868
+ $_POST[$this->_current_field] = str_replace(array('<?php', '<?PHP', '<?', '?>'), array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);
869
+ }
870
+
871
+ }
872
+ // END Validation Class
873
+
874
+ /* End of file Validation.php */
875
+ /* Location: ./system/libraries/Validation.php */