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,758 @@
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
+ * Session Class
20
+ *
21
+ * @package CodeIgniter
22
+ * @subpackage Libraries
23
+ * @category Sessions
24
+ * @author ExpressionEngine Dev Team
25
+ * @link http://codeigniter.com/user_guide/libraries/sessions.html
26
+ */
27
+ class CI_Session {
28
+
29
+ var $sess_encrypt_cookie = FALSE;
30
+ var $sess_use_database = FALSE;
31
+ var $sess_table_name = '';
32
+ var $sess_expiration = 7200;
33
+ var $sess_match_ip = FALSE;
34
+ var $sess_match_useragent = TRUE;
35
+ var $sess_cookie_name = 'ci_session';
36
+ var $cookie_prefix = '';
37
+ var $cookie_path = '';
38
+ var $cookie_domain = '';
39
+ var $sess_time_to_update = 300;
40
+ var $encryption_key = '';
41
+ var $flashdata_key = 'flash';
42
+ var $time_reference = 'time';
43
+ var $gc_probability = 5;
44
+ var $userdata = array();
45
+ var $CI;
46
+ var $now;
47
+
48
+ /**
49
+ * Session Constructor
50
+ *
51
+ * The constructor runs the session routines automatically
52
+ * whenever the class is instantiated.
53
+ */
54
+ function CI_Session($params = array())
55
+ {
56
+ log_message('debug', "Session Class Initialized");
57
+
58
+ // Set the super object to a local variable for use throughout the class
59
+ $this->CI =& get_instance();
60
+
61
+ // Set all the session preferences, which can either be set
62
+ // manually via the $params array above or via the config file
63
+ foreach (array('sess_encrypt_cookie', 'sess_use_database', 'sess_table_name', 'sess_expiration', 'sess_match_ip', 'sess_match_useragent', 'sess_cookie_name', 'cookie_path', 'cookie_domain', 'sess_time_to_update', 'time_reference', 'cookie_prefix', 'encryption_key') as $key)
64
+ {
65
+ $this->$key = (isset($params[$key])) ? $params[$key] : $this->CI->config->item($key);
66
+ }
67
+
68
+ // Load the string helper so we can use the strip_slashes() function
69
+ $this->CI->load->helper('string');
70
+
71
+ // Do we need encryption? If so, load the encryption class
72
+ if ($this->sess_encrypt_cookie == TRUE)
73
+ {
74
+ $this->CI->load->library('encrypt');
75
+ }
76
+
77
+ // Are we using a database? If so, load it
78
+ if ($this->sess_use_database === TRUE AND $this->sess_table_name != '')
79
+ {
80
+ $this->CI->load->database();
81
+ }
82
+
83
+ // Set the "now" time. Can either be GMT or server time, based on the
84
+ // config prefs. We use this to set the "last activity" time
85
+ $this->now = $this->_get_time();
86
+
87
+ // Set the session length. If the session expiration is
88
+ // set to zero we'll set the expiration two years from now.
89
+ if ($this->sess_expiration == 0)
90
+ {
91
+ $this->sess_expiration = (60*60*24*365*2);
92
+ }
93
+
94
+ // Set the cookie name
95
+ $this->sess_cookie_name = $this->cookie_prefix.$this->sess_cookie_name;
96
+
97
+ // Run the Session routine. If a session doesn't exist we'll
98
+ // create a new one. If it does, we'll update it.
99
+ if ( ! $this->sess_read())
100
+ {
101
+ $this->sess_create();
102
+ }
103
+ else
104
+ {
105
+ $this->sess_update();
106
+ }
107
+
108
+ // Delete 'old' flashdata (from last request)
109
+ $this->_flashdata_sweep();
110
+
111
+ // Mark all new flashdata as old (data will be deleted before next request)
112
+ $this->_flashdata_mark();
113
+
114
+ // Delete expired sessions if necessary
115
+ $this->_sess_gc();
116
+
117
+ log_message('debug', "Session routines successfully run");
118
+ }
119
+
120
+ // --------------------------------------------------------------------
121
+
122
+ /**
123
+ * Fetch the current session data if it exists
124
+ *
125
+ * @access public
126
+ * @return bool
127
+ */
128
+ function sess_read()
129
+ {
130
+ // Fetch the cookie
131
+ $session = $this->CI->input->cookie($this->sess_cookie_name);
132
+
133
+ // No cookie? Goodbye cruel world!...
134
+ if ($session === FALSE)
135
+ {
136
+ log_message('debug', 'A session cookie was not found.');
137
+ return FALSE;
138
+ }
139
+
140
+ // Decrypt the cookie data
141
+ if ($this->sess_encrypt_cookie == TRUE)
142
+ {
143
+ $session = $this->CI->encrypt->decode($session);
144
+ }
145
+ else
146
+ {
147
+ // encryption was not used, so we need to check the md5 hash
148
+ $hash = substr($session, strlen($session)-32); // get last 32 chars
149
+ $session = substr($session, 0, strlen($session)-32);
150
+
151
+ // Does the md5 hash match? This is to prevent manipulation of session data in userspace
152
+ if ($hash !== md5($session.$this->encryption_key))
153
+ {
154
+ log_message('error', 'The session cookie data did not match what was expected. This could be a possible hacking attempt.');
155
+ $this->sess_destroy();
156
+ return FALSE;
157
+ }
158
+ }
159
+
160
+ // Unserialize the session array
161
+ $session = $this->_unserialize($session);
162
+
163
+ // Is the session data we unserialized an array with the correct format?
164
+ if ( ! is_array($session) OR ! isset($session['session_id']) OR ! isset($session['ip_address']) OR ! isset($session['user_agent']) OR ! isset($session['last_activity']))
165
+ {
166
+ $this->sess_destroy();
167
+ return FALSE;
168
+ }
169
+
170
+ // Is the session current?
171
+ if (($session['last_activity'] + $this->sess_expiration) < $this->now)
172
+ {
173
+ $this->sess_destroy();
174
+ return FALSE;
175
+ }
176
+
177
+ // Does the IP Match?
178
+ if ($this->sess_match_ip == TRUE AND $session['ip_address'] != $this->CI->input->ip_address())
179
+ {
180
+ $this->sess_destroy();
181
+ return FALSE;
182
+ }
183
+
184
+ // Does the User Agent Match?
185
+ if ($this->sess_match_useragent == TRUE AND trim($session['user_agent']) != trim(substr($this->CI->input->user_agent(), 0, 50)))
186
+ {
187
+ $this->sess_destroy();
188
+ return FALSE;
189
+ }
190
+
191
+ // Is there a corresponding session in the DB?
192
+ if ($this->sess_use_database === TRUE)
193
+ {
194
+ $this->CI->db->where('session_id', $session['session_id']);
195
+
196
+ if ($this->sess_match_ip == TRUE)
197
+ {
198
+ $this->CI->db->where('ip_address', $session['ip_address']);
199
+ }
200
+
201
+ if ($this->sess_match_useragent == TRUE)
202
+ {
203
+ $this->CI->db->where('user_agent', $session['user_agent']);
204
+ }
205
+
206
+ $query = $this->CI->db->get($this->sess_table_name);
207
+
208
+ // No result? Kill it!
209
+ if ($query->num_rows() == 0)
210
+ {
211
+ $this->sess_destroy();
212
+ return FALSE;
213
+ }
214
+
215
+ // Is there custom data? If so, add it to the main session array
216
+ $row = $query->row();
217
+ if (isset($row->user_data) AND $row->user_data != '')
218
+ {
219
+ $custom_data = $this->_unserialize($row->user_data);
220
+
221
+ if (is_array($custom_data))
222
+ {
223
+ foreach ($custom_data as $key => $val)
224
+ {
225
+ $session[$key] = $val;
226
+ }
227
+ }
228
+ }
229
+ }
230
+
231
+ // Session is valid!
232
+ $this->userdata = $session;
233
+ unset($session);
234
+
235
+ return TRUE;
236
+ }
237
+
238
+ // --------------------------------------------------------------------
239
+
240
+ /**
241
+ * Write the session data
242
+ *
243
+ * @access public
244
+ * @return void
245
+ */
246
+ function sess_write()
247
+ {
248
+ // Are we saving custom data to the DB? If not, all we do is update the cookie
249
+ if ($this->sess_use_database === FALSE)
250
+ {
251
+ $this->_set_cookie();
252
+ return;
253
+ }
254
+
255
+ // set the custom userdata, the session data we will set in a second
256
+ $custom_userdata = $this->userdata;
257
+ $cookie_userdata = array();
258
+
259
+ // Before continuing, we need to determine if there is any custom data to deal with.
260
+ // Let's determine this by removing the default indexes to see if there's anything left in the array
261
+ // and set the session data while we're at it
262
+ foreach (array('session_id','ip_address','user_agent','last_activity') as $val)
263
+ {
264
+ unset($custom_userdata[$val]);
265
+ $cookie_userdata[$val] = $this->userdata[$val];
266
+ }
267
+
268
+ // Did we find any custom data? If not, we turn the empty array into a string
269
+ // since there's no reason to serialize and store an empty array in the DB
270
+ if (count($custom_userdata) === 0)
271
+ {
272
+ $custom_userdata = '';
273
+ }
274
+ else
275
+ {
276
+ // Serialize the custom data array so we can store it
277
+ $custom_userdata = $this->_serialize($custom_userdata);
278
+ }
279
+
280
+ // Run the update query
281
+ $this->CI->db->where('session_id', $this->userdata['session_id']);
282
+ $this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_data' => $custom_userdata));
283
+
284
+ // Write the cookie. Notice that we manually pass the cookie data array to the
285
+ // _set_cookie() function. Normally that function will store $this->userdata, but
286
+ // in this case that array contains custom data, which we do not want in the cookie.
287
+ $this->_set_cookie($cookie_userdata);
288
+ }
289
+
290
+ // --------------------------------------------------------------------
291
+
292
+ /**
293
+ * Create a new session
294
+ *
295
+ * @access public
296
+ * @return void
297
+ */
298
+ function sess_create()
299
+ {
300
+ $sessid = '';
301
+ while (strlen($sessid) < 32)
302
+ {
303
+ $sessid .= mt_rand(0, mt_getrandmax());
304
+ }
305
+
306
+ // To make the session ID even more secure we'll combine it with the user's IP
307
+ $sessid .= $this->CI->input->ip_address();
308
+
309
+ $this->userdata = array(
310
+ 'session_id' => md5(uniqid($sessid, TRUE)),
311
+ 'ip_address' => $this->CI->input->ip_address(),
312
+ 'user_agent' => substr($this->CI->input->user_agent(), 0, 50),
313
+ 'last_activity' => $this->now
314
+ );
315
+
316
+
317
+ // Save the data to the DB if needed
318
+ if ($this->sess_use_database === TRUE)
319
+ {
320
+ $this->CI->db->query($this->CI->db->insert_string($this->sess_table_name, $this->userdata));
321
+ }
322
+
323
+ // Write the cookie
324
+ $this->_set_cookie();
325
+ }
326
+
327
+ // --------------------------------------------------------------------
328
+
329
+ /**
330
+ * Update an existing session
331
+ *
332
+ * @access public
333
+ * @return void
334
+ */
335
+ function sess_update()
336
+ {
337
+ // We only update the session every five minutes by default
338
+ if (($this->userdata['last_activity'] + $this->sess_time_to_update) >= $this->now)
339
+ {
340
+ return;
341
+ }
342
+
343
+ // Save the old session id so we know which record to
344
+ // update in the database if we need it
345
+ $old_sessid = $this->userdata['session_id'];
346
+ $new_sessid = '';
347
+ while (strlen($new_sessid) < 32)
348
+ {
349
+ $new_sessid .= mt_rand(0, mt_getrandmax());
350
+ }
351
+
352
+ // To make the session ID even more secure we'll combine it with the user's IP
353
+ $new_sessid .= $this->CI->input->ip_address();
354
+
355
+ // Turn it into a hash
356
+ $new_sessid = md5(uniqid($new_sessid, TRUE));
357
+
358
+ // Update the session data in the session data array
359
+ $this->userdata['session_id'] = $new_sessid;
360
+ $this->userdata['last_activity'] = $this->now;
361
+
362
+ // _set_cookie() will handle this for us if we aren't using database sessions
363
+ // by pushing all userdata to the cookie.
364
+ $cookie_data = NULL;
365
+
366
+ // Update the session ID and last_activity field in the DB if needed
367
+ if ($this->sess_use_database === TRUE)
368
+ {
369
+ // set cookie explicitly to only have our session data
370
+ $cookie_data = array();
371
+ foreach (array('session_id','ip_address','user_agent','last_activity') as $val)
372
+ {
373
+ $cookie_data[$val] = $this->userdata[$val];
374
+ }
375
+
376
+ $this->CI->db->query($this->CI->db->update_string($this->sess_table_name, array('last_activity' => $this->now, 'session_id' => $new_sessid), array('session_id' => $old_sessid)));
377
+ }
378
+
379
+ // Write the cookie
380
+ $this->_set_cookie($cookie_data);
381
+ }
382
+
383
+ // --------------------------------------------------------------------
384
+
385
+ /**
386
+ * Destroy the current session
387
+ *
388
+ * @access public
389
+ * @return void
390
+ */
391
+ function sess_destroy()
392
+ {
393
+ // Kill the session DB row
394
+ if ($this->sess_use_database === TRUE AND isset($this->userdata['session_id']))
395
+ {
396
+ $this->CI->db->where('session_id', $this->userdata['session_id']);
397
+ $this->CI->db->delete($this->sess_table_name);
398
+ }
399
+
400
+ // Kill the cookie
401
+ setcookie(
402
+ $this->sess_cookie_name,
403
+ addslashes(serialize(array())),
404
+ ($this->now - 31500000),
405
+ $this->cookie_path,
406
+ $this->cookie_domain,
407
+ 0
408
+ );
409
+ }
410
+
411
+ // --------------------------------------------------------------------
412
+
413
+ /**
414
+ * Fetch a specific item from the session array
415
+ *
416
+ * @access public
417
+ * @param string
418
+ * @return string
419
+ */
420
+ function userdata($item)
421
+ {
422
+ return ( ! isset($this->userdata[$item])) ? FALSE : $this->userdata[$item];
423
+ }
424
+
425
+ // --------------------------------------------------------------------
426
+
427
+ /**
428
+ * Fetch all session data
429
+ *
430
+ * @access public
431
+ * @return mixed
432
+ */
433
+ function all_userdata()
434
+ {
435
+ return ( ! isset($this->userdata)) ? FALSE : $this->userdata;
436
+ }
437
+
438
+ // --------------------------------------------------------------------
439
+
440
+ /**
441
+ * Add or change data in the "userdata" array
442
+ *
443
+ * @access public
444
+ * @param mixed
445
+ * @param string
446
+ * @return void
447
+ */
448
+ function set_userdata($newdata = array(), $newval = '')
449
+ {
450
+ if (is_string($newdata))
451
+ {
452
+ $newdata = array($newdata => $newval);
453
+ }
454
+
455
+ if (count($newdata) > 0)
456
+ {
457
+ foreach ($newdata as $key => $val)
458
+ {
459
+ $this->userdata[$key] = $val;
460
+ }
461
+ }
462
+
463
+ $this->sess_write();
464
+ }
465
+
466
+ // --------------------------------------------------------------------
467
+
468
+ /**
469
+ * Delete a session variable from the "userdata" array
470
+ *
471
+ * @access array
472
+ * @return void
473
+ */
474
+ function unset_userdata($newdata = array())
475
+ {
476
+ if (is_string($newdata))
477
+ {
478
+ $newdata = array($newdata => '');
479
+ }
480
+
481
+ if (count($newdata) > 0)
482
+ {
483
+ foreach ($newdata as $key => $val)
484
+ {
485
+ unset($this->userdata[$key]);
486
+ }
487
+ }
488
+
489
+ $this->sess_write();
490
+ }
491
+
492
+ // ------------------------------------------------------------------------
493
+
494
+ /**
495
+ * Add or change flashdata, only available
496
+ * until the next request
497
+ *
498
+ * @access public
499
+ * @param mixed
500
+ * @param string
501
+ * @return void
502
+ */
503
+ function set_flashdata($newdata = array(), $newval = '')
504
+ {
505
+ if (is_string($newdata))
506
+ {
507
+ $newdata = array($newdata => $newval);
508
+ }
509
+
510
+ if (count($newdata) > 0)
511
+ {
512
+ foreach ($newdata as $key => $val)
513
+ {
514
+ $flashdata_key = $this->flashdata_key.':new:'.$key;
515
+ $this->set_userdata($flashdata_key, $val);
516
+ }
517
+ }
518
+ }
519
+
520
+ // ------------------------------------------------------------------------
521
+
522
+ /**
523
+ * Keeps existing flashdata available to next request.
524
+ *
525
+ * @access public
526
+ * @param string
527
+ * @return void
528
+ */
529
+ function keep_flashdata($key)
530
+ {
531
+ // 'old' flashdata gets removed. Here we mark all
532
+ // flashdata as 'new' to preserve it from _flashdata_sweep()
533
+ // Note the function will return FALSE if the $key
534
+ // provided cannot be found
535
+ $old_flashdata_key = $this->flashdata_key.':old:'.$key;
536
+ $value = $this->userdata($old_flashdata_key);
537
+
538
+ $new_flashdata_key = $this->flashdata_key.':new:'.$key;
539
+ $this->set_userdata($new_flashdata_key, $value);
540
+ }
541
+
542
+ // ------------------------------------------------------------------------
543
+
544
+ /**
545
+ * Fetch a specific flashdata item from the session array
546
+ *
547
+ * @access public
548
+ * @param string
549
+ * @return string
550
+ */
551
+ function flashdata($key)
552
+ {
553
+ $flashdata_key = $this->flashdata_key.':old:'.$key;
554
+ return $this->userdata($flashdata_key);
555
+ }
556
+
557
+ // ------------------------------------------------------------------------
558
+
559
+ /**
560
+ * Identifies flashdata as 'old' for removal
561
+ * when _flashdata_sweep() runs.
562
+ *
563
+ * @access private
564
+ * @return void
565
+ */
566
+ function _flashdata_mark()
567
+ {
568
+ $userdata = $this->all_userdata();
569
+ foreach ($userdata as $name => $value)
570
+ {
571
+ $parts = explode(':new:', $name);
572
+ if (is_array($parts) && count($parts) === 2)
573
+ {
574
+ $new_name = $this->flashdata_key.':old:'.$parts[1];
575
+ $this->set_userdata($new_name, $value);
576
+ $this->unset_userdata($name);
577
+ }
578
+ }
579
+ }
580
+
581
+ // ------------------------------------------------------------------------
582
+
583
+ /**
584
+ * Removes all flashdata marked as 'old'
585
+ *
586
+ * @access private
587
+ * @return void
588
+ */
589
+
590
+ function _flashdata_sweep()
591
+ {
592
+ $userdata = $this->all_userdata();
593
+ foreach ($userdata as $key => $value)
594
+ {
595
+ if (strpos($key, ':old:'))
596
+ {
597
+ $this->unset_userdata($key);
598
+ }
599
+ }
600
+
601
+ }
602
+
603
+ // --------------------------------------------------------------------
604
+
605
+ /**
606
+ * Get the "now" time
607
+ *
608
+ * @access private
609
+ * @return string
610
+ */
611
+ function _get_time()
612
+ {
613
+ if (strtolower($this->time_reference) == 'gmt')
614
+ {
615
+ $now = time();
616
+ $time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now));
617
+ }
618
+ else
619
+ {
620
+ $time = time();
621
+ }
622
+
623
+ return $time;
624
+ }
625
+
626
+ // --------------------------------------------------------------------
627
+
628
+ /**
629
+ * Write the session cookie
630
+ *
631
+ * @access public
632
+ * @return void
633
+ */
634
+ function _set_cookie($cookie_data = NULL)
635
+ {
636
+ if (is_null($cookie_data))
637
+ {
638
+ $cookie_data = $this->userdata;
639
+ }
640
+
641
+ // Serialize the userdata for the cookie
642
+ $cookie_data = $this->_serialize($cookie_data);
643
+
644
+ if ($this->sess_encrypt_cookie == TRUE)
645
+ {
646
+ $cookie_data = $this->CI->encrypt->encode($cookie_data);
647
+ }
648
+ else
649
+ {
650
+ // if encryption is not used, we provide an md5 hash to prevent userside tampering
651
+ $cookie_data = $cookie_data.md5($cookie_data.$this->encryption_key);
652
+ }
653
+
654
+ // Set the cookie
655
+ setcookie(
656
+ $this->sess_cookie_name,
657
+ $cookie_data,
658
+ $this->sess_expiration + time(),
659
+ $this->cookie_path,
660
+ $this->cookie_domain,
661
+ 0
662
+ );
663
+ }
664
+
665
+ // --------------------------------------------------------------------
666
+
667
+ /**
668
+ * Serialize an array
669
+ *
670
+ * This function first converts any slashes found in the array to a temporary
671
+ * marker, so when it gets unserialized the slashes will be preserved
672
+ *
673
+ * @access private
674
+ * @param array
675
+ * @return string
676
+ */
677
+ function _serialize($data)
678
+ {
679
+ if (is_array($data))
680
+ {
681
+ foreach ($data as $key => $val)
682
+ {
683
+ $data[$key] = str_replace('\\', '{{slash}}', $val);
684
+ }
685
+ }
686
+ else
687
+ {
688
+ $data = str_replace('\\', '{{slash}}', $data);
689
+ }
690
+
691
+ return serialize($data);
692
+ }
693
+
694
+ // --------------------------------------------------------------------
695
+
696
+ /**
697
+ * Unserialize
698
+ *
699
+ * This function unserializes a data string, then converts any
700
+ * temporary slash markers back to actual slashes
701
+ *
702
+ * @access private
703
+ * @param array
704
+ * @return string
705
+ */
706
+ function _unserialize($data)
707
+ {
708
+ $data = @unserialize(strip_slashes($data));
709
+
710
+ if (is_array($data))
711
+ {
712
+ foreach ($data as $key => $val)
713
+ {
714
+ $data[$key] = str_replace('{{slash}}', '\\', $val);
715
+ }
716
+
717
+ return $data;
718
+ }
719
+
720
+ return str_replace('{{slash}}', '\\', $data);
721
+ }
722
+
723
+ // --------------------------------------------------------------------
724
+
725
+ /**
726
+ * Garbage collection
727
+ *
728
+ * This deletes expired session rows from database
729
+ * if the probability percentage is met
730
+ *
731
+ * @access public
732
+ * @return void
733
+ */
734
+ function _sess_gc()
735
+ {
736
+ if ($this->sess_use_database != TRUE)
737
+ {
738
+ return;
739
+ }
740
+
741
+ srand(time());
742
+ if ((rand() % 100) < $this->gc_probability)
743
+ {
744
+ $expire = $this->now - $this->sess_expiration;
745
+
746
+ $this->CI->db->where("last_activity < {$expire}");
747
+ $this->CI->db->delete($this->sess_table_name);
748
+
749
+ log_message('debug', 'Session garbage collection performed.');
750
+ }
751
+ }
752
+
753
+
754
+ }
755
+ // END Session Class
756
+
757
+ /* End of file Session.php */
758
+ /* Location: ./system/libraries/Session.php */