Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated to CodeIgniter 2.1

  • Loading branch information...
commit e233ec11b840e9d825cb90cc2ba90c1e8bb69d61 1 parent 53ba5b5
@rubensarrio authored
Showing with 24,473 additions and 1,135 deletions.
  1. +1 −1  application/config/autoload.php
  2. 0  application/config/config.php
  3. 0  application/config/constants.php
  4. +7 −0 application/config/database.php
  5. 0  application/config/doctypes.php
  6. 0  application/config/foreign_chars.php
  7. 0  application/config/hooks.php
  8. 0  application/config/index.html
  9. +41 −0 application/config/migration.php
  10. +4 −4 application/config/mimes.php
  11. 0  application/config/profiler.php
  12. 0  application/config/routes.php
  13. 0  application/config/smileys.php
  14. 0  application/config/user_agents.php
  15. +0 −2  application/controllers/welcome.php
  16. +43 −15 application/errors/error_404.php
  17. +43 −15 application/errors/error_db.php
  18. +43 −15 application/errors/error_general.php
  19. +71 −53 application/views/welcome_message.php
  20. +51 −12 index.php
  21. +1 −1  license.txt
  22. 0  system/.htaccess
  23. +5 −0 system/core/Benchmark.php
  24. +41 −21 system/core/CodeIgniter.php
  25. +81 −22 system/core/Common.php
  26. +65 −15 system/core/Config.php
  27. +2 −5 system/core/Controller.php
  28. +18 −3 system/core/Exceptions.php
  29. +19 −4 system/core/Hooks.php
  30. +59 −18 system/core/Input.php
  31. +19 −6 system/core/Lang.php
  32. +249 −105 system/core/Loader.php
  33. +1 −0  system/core/Model.php
  34. +62 −5 system/core/Output.php
  35. +64 −9 system/core/Router.php
  36. +136 −90 system/core/Security.php
  37. +37 −6 system/core/URI.php
  38. 0  system/core/Utf8.php
  39. 0  system/core/index.html
  40. +9 −7 system/database/DB.php
  41. +137 −169 system/database/DB_active_rec.php
  42. +1 −1  system/database/DB_cache.php
  43. +6 −6 system/database/DB_driver.php
  44. +2 −2 system/database/DB_forge.php
  45. +71 −66 system/database/DB_result.php
  46. +1 −1  system/database/DB_utility.php
  47. +792 −0 system/database/drivers/cubrid/cubrid_driver.php
  48. +288 −0 system/database/drivers/cubrid/cubrid_forge.php
  49. +202 −0 system/database/drivers/cubrid/cubrid_result.php
  50. +108 −0 system/database/drivers/cubrid/cubrid_utility.php
  51. +10 −0 system/database/drivers/cubrid/index.html
  52. 0  system/database/drivers/index.html
  53. 0  system/database/drivers/mssql/index.html
  54. +1 −0  system/database/drivers/mssql/mssql_driver.php
  55. 0  system/database/drivers/mssql/mssql_forge.php
  56. 0  system/database/drivers/mssql/mssql_result.php
  57. 0  system/database/drivers/mssql/mssql_utility.php
  58. 0  system/database/drivers/mysql/index.html
  59. +19 −2 system/database/drivers/mysql/mysql_driver.php
  60. +6 −2 system/database/drivers/mysql/mysql_forge.php
  61. +11 −6 system/database/drivers/mysql/mysql_result.php
  62. +1 −1  system/database/drivers/mysql/mysql_utility.php
  63. 0  system/database/drivers/mysqli/index.html
  64. +38 −2 system/database/drivers/mysqli/mysqli_driver.php
  65. +6 −2 system/database/drivers/mysqli/mysqli_forge.php
  66. +12 −7 system/database/drivers/mysqli/mysqli_result.php
  67. 0  system/database/drivers/mysqli/mysqli_utility.php
  68. 0  system/database/drivers/oci8/index.html
  69. +96 −65 system/database/drivers/oci8/oci8_driver.php
  70. 0  system/database/drivers/oci8/oci8_forge.php
  71. +34 −64 system/database/drivers/oci8/oci8_result.php
  72. 0  system/database/drivers/oci8/oci8_utility.php
  73. 0  system/database/drivers/odbc/index.html
  74. +3 −2 system/database/drivers/odbc/odbc_driver.php
  75. 0  system/database/drivers/odbc/odbc_forge.php
  76. 0  system/database/drivers/odbc/odbc_result.php
  77. 0  system/database/drivers/odbc/odbc_utility.php
  78. +10 −0 system/database/drivers/pdo/index.html
  79. +803 −0 system/database/drivers/pdo/pdo_driver.php
  80. +266 −0 system/database/drivers/pdo/pdo_forge.php
  81. +171 −0 system/database/drivers/pdo/pdo_result.php
  82. +103 −0 system/database/drivers/pdo/pdo_utility.php
  83. 0  system/database/drivers/postgre/index.html
  84. +19 −0 system/database/drivers/postgre/postgre_driver.php
  85. 0  system/database/drivers/postgre/postgre_forge.php
  86. 0  system/database/drivers/postgre/postgre_result.php
  87. 0  system/database/drivers/postgre/postgre_utility.php
  88. 0  system/database/drivers/sqlite/index.html
  89. +1 −0  system/database/drivers/sqlite/sqlite_driver.php
  90. 0  system/database/drivers/sqlite/sqlite_forge.php
  91. 0  system/database/drivers/sqlite/sqlite_result.php
  92. 0  system/database/drivers/sqlite/sqlite_utility.php
  93. +10 −0 system/database/drivers/sqlsrv/index.html
  94. +599 −0 system/database/drivers/sqlsrv/sqlsrv_driver.php
  95. +248 −0 system/database/drivers/sqlsrv/sqlsrv_forge.php
  96. +169 −0 system/database/drivers/sqlsrv/sqlsrv_result.php
  97. +88 −0 system/database/drivers/sqlsrv/sqlsrv_utility.php
  98. 0  system/database/index.html
  99. 0  system/fonts/index.html
  100. BIN  system/fonts/texb.ttf
  101. 0  system/helpers/array_helper.php
  102. 0  system/helpers/captcha_helper.php
  103. 0  system/helpers/cookie_helper.php
  104. +1 −1  system/helpers/date_helper.php
  105. 0  system/helpers/directory_helper.php
  106. +4 −4 system/helpers/download_helper.php
  107. 0  system/helpers/email_helper.php
  108. +4 −4 system/helpers/file_helper.php
  109. +17 −19 system/helpers/form_helper.php
  110. +11 −6 system/helpers/html_helper.php
  111. 0  system/helpers/index.html
  112. +67 −48 system/helpers/inflector_helper.php
  113. 0  system/helpers/language_helper.php
  114. 0  system/helpers/number_helper.php
  115. 0  system/helpers/path_helper.php
  116. 0  system/helpers/security_helper.php
  117. +4 −4 system/helpers/smiley_helper.php
  118. +17 −0 system/helpers/string_helper.php
  119. +4 −4 system/helpers/text_helper.php
  120. 0  system/helpers/typography_helper.php
  121. +7 −4 system/helpers/url_helper.php
  122. 0  system/helpers/xml_helper.php
  123. 0  system/index.html
  124. 0  system/language/english/calendar_lang.php
  125. 0  system/language/english/date_lang.php
  126. 0  system/language/english/db_lang.php
  127. 0  system/language/english/email_lang.php
  128. +1 −0  system/language/english/form_validation_lang.php
  129. 0  system/language/english/ftp_lang.php
  130. 0  system/language/english/imglib_lang.php
  131. 0  system/language/english/index.html
  132. +13 −0 system/language/english/migration_lang.php
  133. 0  system/language/english/number_lang.php
  134. +3 −0  system/language/english/profiler_lang.php
  135. 0  system/language/english/unit_test_lang.php
  136. 0  system/language/english/upload_lang.php
  137. 0  system/language/index.html
  138. 0  system/libraries/Cache/Cache.php
  139. +2 −2 system/libraries/Cache/drivers/Cache_apc.php
  140. +12 −12 system/libraries/Cache/drivers/Cache_dummy.php
  141. 0  system/libraries/Cache/drivers/Cache_file.php
  142. +10 −1 system/libraries/Cache/drivers/Cache_memcached.php
  143. +1 −1  system/libraries/Calendar.php
  144. +7 −5 system/libraries/Cart.php
  145. +6 −6 system/libraries/Driver.php
  146. +115 −85 system/libraries/Email.php
  147. +1 −1  system/libraries/Encrypt.php
  148. +73 −52 system/libraries/Form_validation.php
  149. 0  system/libraries/Ftp.php
  150. 0  system/libraries/Image_lib.php
  151. 0  system/libraries/Javascript.php
  152. +1 −1  system/libraries/Log.php
  153. +338 −0 system/libraries/Migration.php
  154. +74 −13 system/libraries/Pagination.php
  155. 0  system/libraries/Parser.php
  156. +67 −11 system/libraries/Profiler.php
  157. +6 −5 system/libraries/Session.php
  158. 0  system/libraries/Sha1.php
  159. 0  system/libraries/Table.php
  160. 0  system/libraries/Trackback.php
  161. 0  system/libraries/Typography.php
  162. 0  system/libraries/Unit_test.php
  163. +68 −6 system/libraries/Upload.php
  164. +5 −5 system/libraries/User_agent.php
  165. +3 −3 system/libraries/Xmlrpc.php
  166. 0  system/libraries/Xmlrpcs.php
  167. 0  system/libraries/Zip.php
  168. 0  system/libraries/index.html
  169. 0  system/libraries/javascript/Jquery.php
  170. +1,440 −0 user_guide/changelog.html
  171. +824 −0 user_guide/database/active_record.html
  172. +220 −0 user_guide/database/caching.html
  173. +118 −0 user_guide/database/call_function.html
  174. +164 −0 user_guide/database/configuration.html
  175. +188 −0 user_guide/database/connecting.html
  176. +217 −0 user_guide/database/examples.html
  177. +163 −0 user_guide/database/fields.html
  178. +234 −0 user_guide/database/forge.html
  179. +151 −0 user_guide/database/helpers.html
  180. +99 −0 user_guide/database/index.html
  181. +158 −0 user_guide/database/queries.html
  182. +259 −0 user_guide/database/results.html
  183. +113 −0 user_guide/database/table_data.html
  184. +200 −0 user_guide/database/transactions.html
  185. +314 −0 user_guide/database/utilities.html
  186. +87 −0 user_guide/doc_style/index.html
  187. +128 −0 user_guide/doc_style/template.html
  188. +147 −0 user_guide/general/alternative_php.html
  189. +117 −0 user_guide/general/ancillary_classes.html
  190. +100 −0 user_guide/general/autoloader.html
  191. +115 −0 user_guide/general/caching.html
  192. +150 −0 user_guide/general/cli.html
  193. +127 −0 user_guide/general/common_functions.html
  194. +388 −0 user_guide/general/controllers.html
  195. +186 −0 user_guide/general/core_classes.html
  196. +100 −0 user_guide/general/creating_drivers.html
  197. +293 −0 user_guide/general/creating_libraries.html
  198. +87 −0 user_guide/general/credits.html
  199. +104 −0 user_guide/general/drivers.html
  200. +126 −0 user_guide/general/environments.html
  201. +140 −0 user_guide/general/errors.html
  202. +185 −0 user_guide/general/helpers.html
  203. +165 −0 user_guide/general/hooks.html
  204. +98 −0 user_guide/general/libraries.html
  205. +133 −0 user_guide/general/managing_apps.html
  206. +251 −0 user_guide/general/models.html
  207. +181 −0 user_guide/general/profiling.html
  208. +77 −0 user_guide/general/quick_reference.html
  209. +82 −0 user_guide/general/requirements.html
  210. +128 −0 user_guide/general/reserved_names.html
  211. +171 −0 user_guide/general/routing.html
  212. +164 −0 user_guide/general/security.html
  213. +679 −0 user_guide/general/styleguide.html
  214. +151 −0 user_guide/general/urls.html
  215. +274 −0 user_guide/general/views.html
  216. +170 −0 user_guide/helpers/array_helper.html
  217. +195 −0 user_guide/helpers/captcha_helper.html
  218. +107 −0 user_guide/helpers/cookie_helper.html
  219. +408 −0 user_guide/helpers/date_helper.html
  220. +143 −0 user_guide/helpers/directory_helper.html
  221. +112 −0 user_guide/helpers/download_helper.html
  222. +102 −0 user_guide/helpers/email_helper.html
  223. +179 −0 user_guide/helpers/file_helper.html
  224. +484 −0 user_guide/helpers/form_helper.html
  225. +390 −0 user_guide/helpers/html_helper.html
  226. +151 −0 user_guide/helpers/inflector_helper.html
  227. +98 −0 user_guide/helpers/language_helper.html
  228. +113 −0 user_guide/helpers/number_helper.html
  229. +106 −0 user_guide/helpers/path_helper.html
  230. +132 −0 user_guide/helpers/security_helper.html
  231. +215 −0 user_guide/helpers/smiley_helper.html
  232. +189 −0 user_guide/helpers/string_helper.html
  233. +211 −0 user_guide/helpers/text_helper.html
  234. +112 −0 user_guide/helpers/typography_helper.html
  235. +302 −0 user_guide/helpers/url_helper.html
  236. +105 −0 user_guide/helpers/xml_helper.html
  237. BIN  user_guide/images/appflowchart.gif
  238. BIN  user_guide/images/arrow.gif
  239. BIN  user_guide/images/ci_logo.jpg
  240. BIN  user_guide/images/ci_logo_flame.jpg
  241. BIN  user_guide/images/ci_quick_ref.png
  242. BIN  user_guide/images/codeigniter_1.7.1_helper_reference.pdf
  243. BIN  user_guide/images/codeigniter_1.7.1_helper_reference.png
  244. BIN  user_guide/images/codeigniter_1.7.1_library_reference.pdf
  245. BIN  user_guide/images/codeigniter_1.7.1_library_reference.png
  246. BIN  user_guide/images/file.gif
  247. BIN  user_guide/images/folder.gif
  248. BIN  user_guide/images/nav_bg_darker.jpg
  249. BIN  user_guide/images/nav_separator_darker.jpg
  250. BIN  user_guide/images/nav_toggle_darker.jpg
  251. BIN  user_guide/images/reactor-bullet.png
  252. BIN  user_guide/images/smile.gif
  253. BIN  user_guide/images/transparent.gif
  254. +98 −0 user_guide/index.html
  255. +115 −0 user_guide/installation/downloads.html
  256. +108 −0 user_guide/installation/index.html
  257. +90 −0 user_guide/installation/troubleshooting.html
  258. +92 −0 user_guide/installation/upgrade_120.html
  259. +203 −0 user_guide/installation/upgrade_130.html
  260. +102 −0 user_guide/installation/upgrade_131.html
  261. +100 −0 user_guide/installation/upgrade_132.html
  262. +112 −0 user_guide/installation/upgrade_133.html
  263. +145 −0 user_guide/installation/upgrade_140.html
  264. +148 −0 user_guide/installation/upgrade_141.html
  265. +178 −0 user_guide/installation/upgrade_150.html
  266. +111 −0 user_guide/installation/upgrade_152.html
  267. +100 −0 user_guide/installation/upgrade_153.html
  268. +116 −0 user_guide/installation/upgrade_154.html
  269. +125 −0 user_guide/installation/upgrade_160.html
  270. +98 −0 user_guide/installation/upgrade_161.html
  271. +106 −0 user_guide/installation/upgrade_162.html
  272. +99 −0 user_guide/installation/upgrade_163.html
  273. +121 −0 user_guide/installation/upgrade_170.html
  274. +98 −0 user_guide/installation/upgrade_171.html
  275. +109 −0 user_guide/installation/upgrade_172.html
  276. +131 −0 user_guide/installation/upgrade_200.html
  277. +105 −0 user_guide/installation/upgrade_201.html
  278. +97 −0 user_guide/installation/upgrade_202.html
  279. +121 −0 user_guide/installation/upgrade_203.html
  280. +89 −0 user_guide/installation/upgrade_210.html
  281. +144 −0 user_guide/installation/upgrade_b11.html
  282. +106 −0 user_guide/installation/upgrading.html
  283. +198 −0 user_guide/libraries/benchmark.html
  284. +193 −0 user_guide/libraries/caching.html
  285. +249 −0 user_guide/libraries/calendar.html
Sorry, we could not display the entire diff because too many files (332) changed.
View
2  application/config/autoload.php 100755 → 100644
@@ -37,7 +37,7 @@
|
*/
-$autoload['packages'] = array(APPPATH.'third_party');
+$autoload['packages'] = array();
/*
View
0  application/config/config.php 100755 → 100644
File mode changed
View
0  application/config/constants.php 100755 → 100644
File mode changed
View
7 application/config/database.php 100755 → 100644
@@ -26,6 +26,13 @@
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
+| NOTE: For MySQL and MySQLi databases, this setting is only used
+| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
+| (and in table creation queries made with DB Forge).
+| There is an incompatibility in PHP with mysql_real_escape_string() which
+| can make your site vulnerable to SQL injection if you are using a
+| multi-byte character set and are running versions lower than these.
+| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['autoinit'] Whether or not to automatically initialize the database.
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
View
0  application/config/doctypes.php 100755 → 100644
File mode changed
View
0  application/config/foreign_chars.php 100755 → 100644
File mode changed
View
0  application/config/hooks.php 100755 → 100644
File mode changed
View
0  application/config/index.html 100755 → 100644
File mode changed
View
41 application/config/migration.php
@@ -0,0 +1,41 @@
+<?php defined('BASEPATH') OR exit('No direct script access allowed');
+/*
+|--------------------------------------------------------------------------
+| Enable/Disable Migrations
+|--------------------------------------------------------------------------
+|
+| Migrations are disabled by default but should be enabled
+| whenever you intend to do a schema migration.
+|
+*/
+$config['migration_enabled'] = FALSE;
+
+
+/*
+|--------------------------------------------------------------------------
+| Migrations version
+|--------------------------------------------------------------------------
+|
+| This is used to set migration version that the file system should be on.
+| If you run $this->migration->latest() this is the version that schema will
+| be upgraded / downgraded to.
+|
+*/
+$config['migration_version'] = 0;
+
+
+/*
+|--------------------------------------------------------------------------
+| Migrations Path
+|--------------------------------------------------------------------------
+|
+| Path to your migrations folder.
+| Typically, it will be within your application path.
+| Also, writing permission is required within the migrations path.
+|
+*/
+$config['migration_path'] = APPPATH . 'migrations/';
+
+
+/* End of file migration.php */
+/* Location: ./application/config/migration.php */
View
8 application/config/mimes.php 100755 → 100644
@@ -10,7 +10,7 @@
$mimes = array( 'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
- 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
+ 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'),
'bin' => 'application/macbinary',
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
@@ -65,8 +65,8 @@
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
- 'wav' => 'audio/x-wav',
- 'bmp' => 'image/bmp',
+ 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
+ 'bmp' => array('image/bmp', 'image/x-windows-bmp'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
@@ -103,4 +103,4 @@
/* End of file mimes.php */
-/* Location: ./application/config/mimes.php */
+/* Location: ./application/config/mimes.php */
View
0  application/config/profiler.php 100755 → 100644
File mode changed
View
0  application/config/routes.php 100755 → 100644
File mode changed
View
0  application/config/smileys.php 100755 → 100644
File mode changed
View
0  application/config/user_agents.php 100755 → 100644
File mode changed
View
2  application/controllers/welcome.php 100755 → 100644
@@ -19,8 +19,6 @@ class Welcome extends CI_Controller {
*/
public function index()
{
- $this->load->helper('url');
-
$this->load->view('welcome_message');
}
}
View
58 application/errors/error_404.php
@@ -1,32 +1,60 @@
-<html>
+<!DOCTYPE html>
+<html lang="en">
<head>
<title>404 Page Not Found</title>
<style type="text/css">
+::selection{ background-color: #E13300; color: white; }
+::moz-selection{ background-color: #E13300; color: white; }
+::webkit-selection{ background-color: #E13300; color: white; }
+
body {
-background-color: #fff;
-margin: 40px;
-font-family: Lucida Grande, Verdana, Sans-serif;
-font-size: 12px;
-color: #000;
+ background-color: #fff;
+ margin: 40px;
+ font: 13px/20px normal Helvetica, Arial, sans-serif;
+ color: #4F5155;
}
-#content {
-border: #999 1px solid;
-background-color: #fff;
-padding: 20px 20px 12px 20px;
+a {
+ color: #003399;
+ background-color: transparent;
+ font-weight: normal;
}
h1 {
-font-weight: normal;
-font-size: 14px;
-color: #990000;
-margin: 0 0 4px 0;
+ color: #444;
+ background-color: transparent;
+ border-bottom: 1px solid #D0D0D0;
+ font-size: 19px;
+ font-weight: normal;
+ margin: 0 0 14px 0;
+ padding: 14px 15px 10px 15px;
+}
+
+code {
+ font-family: Consolas, Monaco, Courier New, Courier, monospace;
+ font-size: 12px;
+ background-color: #f9f9f9;
+ border: 1px solid #D0D0D0;
+ color: #002166;
+ display: block;
+ margin: 14px 0 14px 0;
+ padding: 12px 10px 12px 10px;
+}
+
+#container {
+ margin: 10px;
+ border: 1px solid #D0D0D0;
+ -webkit-box-shadow: 0 0 8px #D0D0D0;
+}
+
+p {
+ margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
- <div id="content">
+ <div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
View
58 application/errors/error_db.php
@@ -1,32 +1,60 @@
-<html>
+<!DOCTYPE html>
+<html lang="en">
<head>
<title>Database Error</title>
<style type="text/css">
+::selection{ background-color: #E13300; color: white; }
+::moz-selection{ background-color: #E13300; color: white; }
+::webkit-selection{ background-color: #E13300; color: white; }
+
body {
-background-color: #fff;
-margin: 40px;
-font-family: Lucida Grande, Verdana, Sans-serif;
-font-size: 12px;
-color: #000;
+ background-color: #fff;
+ margin: 40px;
+ font: 13px/20px normal Helvetica, Arial, sans-serif;
+ color: #4F5155;
}
-#content {
-border: #999 1px solid;
-background-color: #fff;
-padding: 20px 20px 12px 20px;
+a {
+ color: #003399;
+ background-color: transparent;
+ font-weight: normal;
}
h1 {
-font-weight: normal;
-font-size: 14px;
-color: #990000;
-margin: 0 0 4px 0;
+ color: #444;
+ background-color: transparent;
+ border-bottom: 1px solid #D0D0D0;
+ font-size: 19px;
+ font-weight: normal;
+ margin: 0 0 14px 0;
+ padding: 14px 15px 10px 15px;
+}
+
+code {
+ font-family: Consolas, Monaco, Courier New, Courier, monospace;
+ font-size: 12px;
+ background-color: #f9f9f9;
+ border: 1px solid #D0D0D0;
+ color: #002166;
+ display: block;
+ margin: 14px 0 14px 0;
+ padding: 12px 10px 12px 10px;
+}
+
+#container {
+ margin: 10px;
+ border: 1px solid #D0D0D0;
+ -webkit-box-shadow: 0 0 8px #D0D0D0;
+}
+
+p {
+ margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
- <div id="content">
+ <div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
View
58 application/errors/error_general.php
@@ -1,32 +1,60 @@
-<html>
+<!DOCTYPE html>
+<html lang="en">
<head>
<title>Error</title>
<style type="text/css">
+::selection{ background-color: #E13300; color: white; }
+::moz-selection{ background-color: #E13300; color: white; }
+::webkit-selection{ background-color: #E13300; color: white; }
+
body {
-background-color: #fff;
-margin: 40px;
-font-family: Lucida Grande, Verdana, Sans-serif;
-font-size: 12px;
-color: #000;
+ background-color: #fff;
+ margin: 40px;
+ font: 13px/20px normal Helvetica, Arial, sans-serif;
+ color: #4F5155;
}
-#content {
-border: #999 1px solid;
-background-color: #fff;
-padding: 20px 20px 12px 20px;
+a {
+ color: #003399;
+ background-color: transparent;
+ font-weight: normal;
}
h1 {
-font-weight: normal;
-font-size: 14px;
-color: #990000;
-margin: 0 0 4px 0;
+ color: #444;
+ background-color: transparent;
+ border-bottom: 1px solid #D0D0D0;
+ font-size: 19px;
+ font-weight: normal;
+ margin: 0 0 14px 0;
+ padding: 14px 15px 10px 15px;
+}
+
+code {
+ font-family: Consolas, Monaco, Courier New, Courier, monospace;
+ font-size: 12px;
+ background-color: #f9f9f9;
+ border: 1px solid #D0D0D0;
+ color: #002166;
+ display: block;
+ margin: 14px 0 14px 0;
+ padding: 12px 10px 12px 10px;
+}
+
+#container {
+ margin: 10px;
+ border: 1px solid #D0D0D0;
+ -webkit-box-shadow: 0 0 8px #D0D0D0;
+}
+
+p {
+ margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
- <div id="content">
+ <div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
View
124 application/views/welcome_message.php
@@ -4,67 +4,85 @@
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
-<style type="text/css">
-
-body {
- background-color: #fff;
- margin: 40px;
- font-family: Lucida Grande, Verdana, Sans-serif;
- font-size: 14px;
- color: #4F5155;
-}
-
-a {
- color: #003399;
- background-color: transparent;
- font-weight: normal;
-}
-
-h1, h2 {
- color: #444;
- background-color: transparent;
- border-bottom: 1px solid #D0D0D0;
- font-size: 16px;
- font-weight: bold;
- margin: 24px 0 2px 0;
- padding: 5px 0 6px 0;
-}
-
-code {
- font-family: Monaco, Verdana, Sans-serif;
- font-size: 12px;
- background-color: #f9f9f9;
- border: 1px solid #D0D0D0;
- color: #002166;
- display: block;
- margin: 14px 0 14px 0;
- padding: 12px 10px 12px 10px;
-}
-
-</style>
+ <style type="text/css">
+
+ ::selection{ background-color: #E13300; color: white; }
+ ::moz-selection{ background-color: #E13300; color: white; }
+ ::webkit-selection{ background-color: #E13300; color: white; }
+
+ body {
+ background-color: #fff;
+ margin: 40px;
+ font: 13px/20px normal Helvetica, Arial, sans-serif;
+ color: #4F5155;
+ }
+
+ a {
+ color: #003399;
+ background-color: transparent;
+ font-weight: normal;
+ }
+
+ h1 {
+ color: #444;
+ background-color: transparent;
+ border-bottom: 1px solid #D0D0D0;
+ font-size: 19px;
+ font-weight: normal;
+ margin: 0 0 14px 0;
+ padding: 14px 15px 10px 15px;
+ }
+
+ code {
+ font-family: Consolas, Monaco, Courier New, Courier, monospace;
+ font-size: 12px;
+ background-color: #f9f9f9;
+ border: 1px solid #D0D0D0;
+ color: #002166;
+ display: block;
+ margin: 14px 0 14px 0;
+ padding: 12px 10px 12px 10px;
+ }
+
+ #body{
+ margin: 0 15px 0 15px;
+ }
+
+ p.footer{
+ text-align: right;
+ font-size: 11px;
+ border-top: 1px solid #D0D0D0;
+ line-height: 32px;
+ padding: 0 10px 0 10px;
+ margin: 20px 0 0 0;
+ }
+
+ #container{
+ margin: 10px;
+ border: 1px solid #D0D0D0;
+ -webkit-box-shadow: 0 0 8px #D0D0D0;
+ }
+ </style>
</head>
<body>
-<h1>Welcome to CodeIgniter!</h1>
-
-<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
-
-<p>If you would like to edit this page you'll find it located at:</p>
-<code>application/views/welcome_message.php</code>
-
-<p>The corresponding controller for this page is found at:</p>
-<code>application/controllers/welcome.php</code>
+<div id="container">
+ <h1>Welcome to CodeIgniter!</h1>
-<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="user_guide/">User Guide</a>.</p>
+ <div id="body">
+ <p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
-<h2>CodeIgniter 2 + HMVC + Doctrine 2</h2>
+ <p>If you would like to edit this page you'll find it located at:</p>
+ <code>application/views/welcome_message.php</code>
-<p>An example code of using CodeIgniter 2 + HMVC + Doctrine 2 can be found here:</p>
-<code>application/modules/blog</code>
+ <p>The corresponding controller for this page is found at:</p>
+ <code>application/controllers/welcome.php</code>
-<p>You can start testing this example <?php echo anchor('blog/posts', 'now') ?>.</p>
+ <p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="user_guide/">User Guide</a>.</p>
+ </div>
-<p><br />Page rendered in {elapsed_time} seconds</p>
+ <p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>
+</div>
</body>
</html>
View
63 index.php
@@ -2,15 +2,49 @@
/*
*---------------------------------------------------------------
- * PHP ERROR REPORTING LEVEL
+ * APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*
- * By default CI runs with error reporting set to ALL. For security
- * reasons you are encouraged to change this to 0 when your site goes live.
- * For more info visit: http://www.php.net/error_reporting
+ * You can load different configurations depending on your
+ * current environment. Setting the environment also influences
+ * things like logging and error reporting.
+ *
+ * This can be set to anything, but default usage is:
+ *
+ * development
+ * testing
+ * production
+ *
+ * NOTE: If you change these, also change the error_reporting() code below
*
*/
- error_reporting(E_ALL);
+ define('ENVIRONMENT', 'development');
+/*
+ *---------------------------------------------------------------
+ * ERROR REPORTING
+ *---------------------------------------------------------------
+ *
+ * Different environments will require different levels of error reporting.
+ * By default development will show errors but testing and live will hide them.
+ */
+
+if (defined('ENVIRONMENT'))
+{
+ switch (ENVIRONMENT)
+ {
+ case 'development':
+ error_reporting(E_ALL);
+ break;
+
+ case 'testing':
+ case 'production':
+ error_reporting(0);
+ break;
+
+ default:
+ exit('The application environment is not set correctly.');
+ }
+}
/*
*---------------------------------------------------------------
@@ -22,7 +56,7 @@
* as this file.
*
*/
- $system_path = "system";
+ $system_path = 'system';
/*
*---------------------------------------------------------------
@@ -38,7 +72,7 @@
* NO TRAILING SLASH!
*
*/
- $application_folder = "application";
+ $application_folder = 'application';
/*
* --------------------------------------------------------------------
@@ -64,7 +98,7 @@
// if your controller is not in a sub-folder within the "controllers" folder
// $routing['directory'] = '';
- // The controller class file name. Example: Mycontroller.php
+ // The controller class file name. Example: Mycontroller
// $routing['controller'] = '';
// The controller function you wish to be called.
@@ -94,14 +128,18 @@
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
// --------------------------------------------------------------------
-
-
-
/*
* ---------------------------------------------------------------
* Resolve the system path for increased reliability
* ---------------------------------------------------------------
*/
+
+ // Set the current directory correctly for CLI requests
+ if (defined('STDIN'))
+ {
+ chdir(dirname(__FILE__));
+ }
+
if (realpath($system_path) !== FALSE)
{
$system_path = realpath($system_path).'/';
@@ -125,6 +163,7 @@
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
// The PHP file extension
+ // this global constant is deprecated.
define('EXT', '.php');
// Path to the system folder
@@ -160,7 +199,7 @@
* And away we go...
*
*/
-require_once BASEPATH.'core/CodeIgniter'.EXT;
+require_once BASEPATH.'core/CodeIgniter.php';
/* End of file index.php */
/* Location: ./index.php */
View
2  license.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2008 - 2010, EllisLab, Inc.
+Copyright (c) 2008 - 2011, EllisLab, Inc.
All rights reserved.
This license is a legal agreement between you and EllisLab Inc. for the use
View
0  system/.htaccess 100755 → 100644
File mode changed
View
5 system/core/Benchmark.php
@@ -29,6 +29,11 @@
*/
class CI_Benchmark {
+ /**
+ * List of all benchmark markers and when they were added
+ *
+ * @var array
+ */
var $marker = array();
// --------------------------------------------------------------------
View
62 system/core/CodeIgniter.php
@@ -27,17 +27,19 @@
* @link http://codeigniter.com/user_guide/
*/
-/*
- * ------------------------------------------------------
- * Define the CodeIgniter Version
- * ------------------------------------------------------
+/**
+ * CodeIgniter Version
+ *
+ * @var string
+ *
*/
- define('CI_VERSION', '2.0.2');
+ define('CI_VERSION', '2.1.0');
-/*
- * ------------------------------------------------------
- * Define the CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
- * ------------------------------------------------------
+/**
+ * CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
+ *
+ * @var boolean
+ *
*/
define('CI_CORE', FALSE);
@@ -46,20 +48,20 @@
* Load the global functions
* ------------------------------------------------------
*/
- require(BASEPATH.'core/Common'.EXT);
+ require(BASEPATH.'core/Common.php');
/*
* ------------------------------------------------------
* Load the framework constants
* ------------------------------------------------------
*/
- if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants'.EXT))
+ if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php'))
{
- require(APPPATH.'config/'.ENVIRONMENT.'/constants'.EXT);
+ require(APPPATH.'config/'.ENVIRONMENT.'/constants.php');
}
else
{
- require(APPPATH.'config/constants'.EXT);
+ require(APPPATH.'config/constants.php');
}
/*
@@ -224,7 +226,7 @@
*
*/
// Load the base controller class
- require BASEPATH.'core/Controller'.EXT;
+ require BASEPATH.'core/Controller.php';
function &get_instance()
{
@@ -232,20 +234,20 @@ function &get_instance()
}
- if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT))
+ if (file_exists(APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php'))
{
- require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller'.EXT;
+ require APPPATH.'core/'.$CFG->config['subclass_prefix'].'Controller.php';
}
// Load the local application controller
// Note: The Router class automatically validates the controller path using the router->_validate_request().
// If this include fails it means that the default controller in the Routes.php file is not resolving to something valid.
- if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT))
+ if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'))
{
show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}
- include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT);
+ include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');
// Set a mark point for benchmarking
$BM->mark('loading_time:_base_classes_end');
@@ -267,7 +269,25 @@ function &get_instance()
OR in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
)
{
- show_404("{$class}/{$method}");
+ if ( ! empty($RTR->routes['404_override']))
+ {
+ $x = explode('/', $RTR->routes['404_override']);
+ $class = $x[0];
+ $method = (isset($x[1]) ? $x[1] : 'index');
+ if ( ! class_exists($class))
+ {
+ if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
+ {
+ show_404("{$class}/{$method}");
+ }
+
+ include_once(APPPATH.'controllers/'.$class.'.php');
+ }
+ }
+ else
+ {
+ show_404("{$class}/{$method}");
+ }
}
/*
@@ -318,12 +338,12 @@ function &get_instance()
$method = (isset($x[1]) ? $x[1] : 'index');
if ( ! class_exists($class))
{
- if ( ! file_exists(APPPATH.'controllers/'.$class.EXT))
+ if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
{
show_404("{$class}/{$method}");
}
- include_once(APPPATH.'controllers/'.$class.EXT);
+ include_once(APPPATH.'controllers/'.$class.'.php');
unset($CI);
$CI = new $class();
}
View
103 system/core/Common.php 100755 → 100644
@@ -39,6 +39,8 @@
* @param string
* @return bool TRUE if the current version is $version or higher
*/
+if ( ! function_exists('is_php'))
+{
function is_php($version = '5.0.0')
{
static $_is_php;
@@ -51,6 +53,7 @@ function is_php($version = '5.0.0')
return $_is_php[$version];
}
+}
// ------------------------------------------------------------------------
@@ -64,6 +67,8 @@ function is_php($version = '5.0.0')
* @access private
* @return void
*/
+if ( ! function_exists('is_really_writable'))
+{
function is_really_writable($file)
{
// If we're on a Unix server with safe_mode off we call is_writable
@@ -96,6 +101,7 @@ function is_really_writable($file)
fclose($fp);
return TRUE;
}
+}
// ------------------------------------------------------------------------
@@ -112,6 +118,8 @@ function is_really_writable($file)
* @param string the class name prefix
* @return object
*/
+if ( ! function_exists('load_class'))
+{
function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
{
static $_classes = array();
@@ -124,17 +132,17 @@ function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
$name = FALSE;
- // Look for the class first in the native system/libraries folder
- // thenin the local application/libraries folder
- foreach (array(BASEPATH, APPPATH) as $path)
+ // Look for the class first in the local application/libraries folder
+ // then in the native system/libraries folder
+ foreach (array(APPPATH, BASEPATH) as $path)
{
- if (file_exists($path.$directory.'/'.$class.EXT))
+ if (file_exists($path.$directory.'/'.$class.'.php'))
{
$name = $prefix.$class;
if (class_exists($name) === FALSE)
{
- require($path.$directory.'/'.$class.EXT);
+ require($path.$directory.'/'.$class.'.php');
}
break;
@@ -142,13 +150,13 @@ function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
}
// Is the request a class extension? If so we load it too
- if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT))
+ if (file_exists(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php'))
{
$name = config_item('subclass_prefix').$class;
if (class_exists($name) === FALSE)
{
- require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.EXT);
+ require(APPPATH.$directory.'/'.config_item('subclass_prefix').$class.'.php');
}
}
@@ -157,7 +165,7 @@ function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
{
// Note: We use exit() rather then show_error() in order to avoid a
// self-referencing loop with the Excptions class
- exit('Unable to locate the specified class: '.$class.EXT);
+ exit('Unable to locate the specified class: '.$class.'.php');
}
// Keep track of what we just loaded
@@ -166,6 +174,7 @@ function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
$_classes[$class] = new $name();
return $_classes[$class];
}
+}
// --------------------------------------------------------------------
@@ -176,6 +185,8 @@ function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
* @access public
* @return array
*/
+if ( ! function_exists('is_loaded'))
+{
function is_loaded($class = '')
{
static $_is_loaded = array();
@@ -187,6 +198,7 @@ function is_loaded($class = '')
return $_is_loaded;
}
+}
// ------------------------------------------------------------------------
@@ -199,6 +211,8 @@ function is_loaded($class = '')
* @access private
* @return array
*/
+if ( ! function_exists('get_config'))
+{
function &get_config($replace = array())
{
static $_config;
@@ -209,9 +223,9 @@ function &get_config($replace = array())
}
// Is the config file in the environment folder?
- if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config'.EXT))
+ if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php'))
{
- $file_path = APPPATH.'config/config'.EXT;
+ $file_path = APPPATH.'config/config.php';
}
// Fetch the config file
@@ -242,6 +256,7 @@ function &get_config($replace = array())
return $_config[0] =& $config;
}
+}
// ------------------------------------------------------------------------
@@ -251,6 +266,8 @@ function &get_config($replace = array())
* @access public
* @return mixed
*/
+if ( ! function_exists('config_item'))
+{
function config_item($item)
{
static $_config_item = array();
@@ -268,6 +285,7 @@ function config_item($item)
return $_config_item[$item];
}
+}
// ------------------------------------------------------------------------
@@ -283,12 +301,15 @@ function config_item($item)
* @access public
* @return void
*/
+if ( ! function_exists('show_error'))
+{
function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered')
{
$_error =& load_class('Exceptions', 'core');
echo $_error->show_error($heading, $message, 'error_general', $status_code);
exit;
}
+}
// ------------------------------------------------------------------------
@@ -302,12 +323,15 @@ function show_error($message, $status_code = 500, $heading = 'An Error Was Encou
* @access public
* @return void
*/
+if ( ! function_exists('show_404'))
+{
function show_404($page = '', $log_error = TRUE)
{
$_error =& load_class('Exceptions', 'core');
$_error->show_404($page, $log_error);
exit;
}
+}
// ------------------------------------------------------------------------
@@ -320,6 +344,8 @@ function show_404($page = '', $log_error = TRUE)
* @access public
* @return void
*/
+if ( ! function_exists('log_message'))
+{
function log_message($level = 'error', $message, $php_error = FALSE)
{
static $_log;
@@ -332,6 +358,7 @@ function log_message($level = 'error', $message, $php_error = FALSE)
$_log =& load_class('Log');
$_log->write_log($level, $message, $php_error);
}
+}
// ------------------------------------------------------------------------
@@ -343,6 +370,8 @@ function log_message($level = 'error', $message, $php_error = FALSE)
* @param string
* @return void
*/
+if ( ! function_exists('set_status_header'))
+{
function set_status_header($code = 200, $text = '')
{
$stati = array(
@@ -417,6 +446,7 @@ function set_status_header($code = 200, $text = '')
header("HTTP/1.1 {$code} {$text}", TRUE, $code);
}
}
+}
// --------------------------------------------------------------------
@@ -434,6 +464,8 @@ function set_status_header($code = 200, $text = '')
* @access private
* @return void
*/
+if ( ! function_exists('_exception_handler'))
+{
function _exception_handler($severity, $message, $filepath, $line)
{
// We don't bother with "strict" notices since they tend to fill up
@@ -463,19 +495,22 @@ function _exception_handler($severity, $message, $filepath, $line)
$_error->log_exception($severity, $message, $filepath, $line);
}
+}
- // --------------------------------------------------------------------
-
- /**
- * Remove Invisible Characters
- *
- * This prevents sandwiching null characters
- * between ascii characters, like Java\0script.
- *
- * @access public
- * @param string
- * @return string
- */
+// --------------------------------------------------------------------
+
+/**
+ * Remove Invisible Characters
+ *
+ * This prevents sandwiching null characters
+ * between ascii characters, like Java\0script.
+ *
+ * @access public
+ * @param string
+ * @return string
+ */
+if ( ! function_exists('remove_invisible_characters'))
+{
function remove_invisible_characters($str, $url_encoded = TRUE)
{
$non_displayables = array();
@@ -499,7 +534,31 @@ function remove_invisible_characters($str, $url_encoded = TRUE)
return $str;
}
+}
+// ------------------------------------------------------------------------
+
+/**
+* Returns HTML escaped variable
+*
+* @access public
+* @param mixed
+* @return mixed
+*/
+if ( ! function_exists('html_escape'))
+{
+ function html_escape($var)
+ {
+ if (is_array($var))
+ {
+ return array_map('html_escape', $var);
+ }
+ else
+ {
+ return htmlspecialchars($var, ENT_QUOTES, config_item('charset'));
+ }
+ }
+}
/* End of file Common.php */
/* Location: ./system/core/Common.php */
View
80 system/core/Config.php
@@ -28,8 +28,23 @@
*/
class CI_Config {
+ /**
+ * List of all loaded config values
+ *
+ * @var array
+ */
var $config = array();
+ /**
+ * List of all loaded config files
+ *
+ * @var array
+ */
var $is_loaded = array();
+ /**
+ * List of paths to search when trying to load a config file
+ *
+ * @var array
+ */
var $_config_paths = array(APPPATH);
/**
@@ -80,7 +95,7 @@ function __construct()
*/
function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
- $file = ($file == '') ? 'config' : str_replace(EXT, '', $file);
+ $file = ($file == '') ? 'config' : str_replace('.php', '', $file);
$found = FALSE;
$loaded = FALSE;
@@ -92,7 +107,7 @@ function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
foreach ($check_locations as $location)
{
- $file_path = $path.'config/'.$location.EXT;
+ $file_path = $path.'config/'.$location.'.php';
if (in_array($file_path, $this->is_loaded, TRUE))
{
@@ -144,6 +159,7 @@ function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
$loaded = TRUE;
log_message('debug', 'Config file loaded: '.$file_path);
+ break;
}
if ($loaded === FALSE)
@@ -152,7 +168,7 @@ function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
return FALSE;
}
- show_error('The configuration file '.$file.EXT.' does not exist.');
+ show_error('The configuration file '.$file.'.php'.' does not exist.');
}
return TRUE;
@@ -202,10 +218,7 @@ function item($item, $index = '')
// --------------------------------------------------------------------
/**
- * Fetch a config file item - adds slash after item
- *
- * The second parameter allows a slash to be added to the end of
- * the item, in the case of a path.
+ * Fetch a config file item - adds slash after item (if item is not empty)
*
* @access public
* @param string the config item name
@@ -218,6 +231,10 @@ function slash_item($item)
{
return FALSE;
}
+ if( trim($this->config[$item]) == '')
+ {
+ return '';
+ }
return rtrim($this->config[$item], '/').'/';
}
@@ -226,6 +243,7 @@ function slash_item($item)
/**
* Site URL
+ * Returns base_url . index_page [. uri_string]
*
* @access public
* @param string the URI string
@@ -240,14 +258,48 @@ function site_url($uri = '')
if ($this->item('enable_query_strings') == FALSE)
{
+ $suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix');
+ return $this->slash_item('base_url').$this->slash_item('index_page').$this->_uri_string($uri).$suffix;
+ }
+ else
+ {
+ return $this->slash_item('base_url').$this->item('index_page').'?'.$this->_uri_string($uri);
+ }
+ }
+
+ // -------------------------------------------------------------
+
+ /**
+ * Base URL
+ * Returns base_url [. uri_string]
+ *
+ * @access public
+ * @param string $uri
+ * @return string
+ */
+ function base_url($uri = '')
+ {
+ return $this->slash_item('base_url').ltrim($this->_uri_string($uri),'/');
+ }
+
+ // -------------------------------------------------------------
+
+ /**
+ * Build URI string for use in Config::site_url() and Config::base_url()
+ *
+ * @access protected
+ * @param $uri
+ * @return string
+ */
+ protected function _uri_string($uri)
+ {
+ if ($this->item('enable_query_strings') == FALSE)
+ {
if (is_array($uri))
{
$uri = implode('/', $uri);
}
-
- $index = $this->item('index_page') == '' ? '' : $this->slash_item('index_page');
- $suffix = ($this->item('url_suffix') == FALSE) ? '' : $this->item('url_suffix');
- return $this->slash_item('base_url').$index.trim($uri, '/').$suffix;
+ $uri = trim($uri, '/');
}
else
{
@@ -261,12 +313,10 @@ function site_url($uri = '')
$str .= $prefix.$key.'='.$val;
$i++;
}
-
$uri = $str;
}
-
- return $this->slash_item('base_url').$this->item('index_page').'?'.$uri;
}
+ return $uri;
}
// --------------------------------------------------------------------
@@ -326,4 +376,4 @@ function _assign_to_config($items = array())
// END CI_Config class
/* End of file Config.php */
-/* Location: ./system/core/Config.php */
+/* Location: ./system/core/Config.php */
View
7 system/core/Controller.php 100755 → 100644
@@ -48,12 +48,9 @@ public function __construct()
$this->load =& load_class('Loader', 'core');
- $this->load->_base_classes =& is_loaded();
-
- $this->load->_ci_autoloader();
-
+ $this->load->initialize();
+
log_message('debug', "Controller Class Initialized");
-
}
public static function &get_instance()
View
21 system/core/Exceptions.php
@@ -30,8 +30,21 @@ class CI_Exceptions {
var $message;
var $filename;
var $line;
+
+ /**
+ * Nesting level of the output buffering mechanism
+ *
+ * @var int
+ * @access public
+ */
var $ob_level;
+ /**
+ * List if available error levels
+ *
+ * @var array
+ * @access public
+ */
var $levels = array(
E_ERROR => 'Error',
E_WARNING => 'Warning',
@@ -84,7 +97,8 @@ function log_exception($severity, $message, $filepath, $line)
* 404 Page Not Found Handler
*
* @access private
- * @param string
+ * @param string the page
+ * @param bool log error yes/no
* @return string
*/
function show_404($page = '', $log_error = TRUE)
@@ -115,6 +129,7 @@ function show_404($page = '', $log_error = TRUE)
* @param string the heading
* @param string the message
* @param string the template name
+ * @param int the status code
* @return string
*/
function show_error($heading, $message, $template = 'error_general', $status_code = 500)
@@ -128,7 +143,7 @@ function show_error($heading, $message, $template = 'error_general', $status_cod
ob_end_flush();
}
ob_start();
- include(APPPATH.'errors/'.$template.EXT);
+ include(APPPATH.'errors/'.$template.'.php');
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
@@ -164,7 +179,7 @@ function show_php_error($severity, $message, $filepath, $line)
ob_end_flush();
}
ob_start();
- include(APPPATH.'errors/error_php'.EXT);
+ include(APPPATH.'errors/error_php.php');
$buffer = ob_get_contents();
ob_end_clean();
echo $buffer;
View
23 system/core/Hooks.php
@@ -28,8 +28,23 @@
*/
class CI_Hooks {
+ /**
+ * Determines wether hooks are enabled
+ *
+ * @var bool
+ */
var $enabled = FALSE;
+ /**
+ * List of all hooks set in config/hooks.php
+ *
+ * @var array
+ */
var $hooks = array();
+ /**
+ * Determines wether hook is in progress, used to prevent infinte loops
+ *
+ * @var bool
+ */
var $in_progress = FALSE;
/**
@@ -65,13 +80,13 @@ function _initialize()
// Grab the "hooks" definition file.
// If there are no hooks, we're done.
- if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT))
+ if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
{
- include(APPPATH.'config/'.ENVIRONMENT.'/hooks'.EXT);
+ include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php');
}
- elseif (is_file(APPPATH.'config/hooks'.EXT))
+ elseif (is_file(APPPATH.'config/hooks.php'))
{
- include(APPPATH.'config/hooks'.EXT);
+ include(APPPATH.'config/hooks.php');
}
View
77 system/core/Input.php
@@ -28,15 +28,51 @@
*/
class CI_Input {
+ /**
+ * IP address of the current user
+ *
+ * @var string
+ */
var $ip_address = FALSE;
+ /**
+ * user agent (web browser) being used by the current user
+ *
+ * @var string
+ */
var $user_agent = FALSE;
+ /**
+ * If FALSE, then $_GET will be set to an empty array
+ *
+ * @var bool
+ */
var $_allow_get_array = TRUE;
+ /**
+ * If TRUE, then newlines are standardized
+ *
+ * @var bool
+ */
var $_standardize_newlines = TRUE;
- var $_enable_xss = FALSE; // Set automatically based on config setting
- var $_enable_csrf = FALSE; // Set automatically based on config setting
-
+ /**
+ * Determines whether the XSS filter is always active when GET, POST or COOKIE data is encountered
+ * Set automatically based on config setting
+ *
+ * @var bool
+ */
+ var $_enable_xss = FALSE;
+ /**
+ * Enables a CSRF cookie token to be set.
+ * Set automatically based on config setting
+ *
+ * @var bool
+ */
+ var $_enable_csrf = FALSE;
+ /**
+ * List of all HTTP request headers
+ *
+ * @var array
+ */
protected $headers = array();
-
+
/**
* Constructor
@@ -147,7 +183,7 @@ function post($index = NULL, $xss_clean = FALSE)
}
return $post;
}
-
+
return $this->_fetch_from_array($_POST, $index, $xss_clean);
}
@@ -402,9 +438,9 @@ function user_agent()
function _sanitize_globals()
{
// It would be "wrong" to unset any of these GLOBALS.
- $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST',
+ $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST',
'_SESSION', '_ENV', 'GLOBALS', 'HTTP_RAW_POST_DATA',
- 'system_folder', 'application_folder', 'BM', 'EXT',
+ 'system_folder', 'application_folder', 'BM', 'EXT',
'CFG', 'URI', 'RTR', 'OUT', 'IN');
// Unset globals for securiy.
@@ -512,8 +548,12 @@ function _clean_input_data($str)
return $new_array;
}
- // We strip slashes if magic quotes is on to keep things consistent
- if (function_exists('get_magic_quotes_gpc') AND get_magic_quotes_gpc())
+ /* We strip slashes if magic quotes is on to keep things consistent
+
+ NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and
+ it will probably not exist in future versions at all.
+ */
+ if ( ! is_php('5.4') && get_magic_quotes_gpc())
{
$str = stripslashes($str);
}
@@ -523,7 +563,7 @@ function _clean_input_data($str)
{
$str = $this->uni->clean_string($str);
}
-
+
// Remove control characters
$str = remove_invisible_characters($str);
@@ -579,9 +619,11 @@ function _clean_input_keys($str)
/**
* Request Headers
*
- * In Apache, you can simply call apache_request_headers(), however for
+ * In Apache, you can simply call apache_request_headers(), however for
* people running other webservers the function is undefined.
*
+ * @param bool XSS cleaning
+ *
* @return array
*/
public function request_headers($xss_clean = FALSE)
@@ -609,10 +651,10 @@ public function request_headers($xss_clean = FALSE)
{
$key = str_replace('_', ' ', strtolower($key));
$key = str_replace(' ', '-', ucwords($key));
-
+
$this->headers[$key] = $val;
}
-
+
return $this->headers;
}
@@ -633,7 +675,7 @@ public function get_request_header($index, $xss_clean = FALSE)
{
$this->request_headers();
}
-
+
if ( ! isset($this->headers[$index]))
{
return FALSE;
@@ -644,7 +686,7 @@ public function get_request_header($index, $xss_clean = FALSE)
return $this->security->xss_clean($this->headers[$index]);
}
- return $this->headers[$index];
+ return $this->headers[$index];
}
// --------------------------------------------------------------------
@@ -672,11 +714,10 @@ public function is_ajax_request()
*/
public function is_cli_request()
{
- return (bool) defined('STDIN');
+ return (php_sapi_name() == 'cli') or defined('STDIN');
}
}
-// END Input class
/* End of file Input.php */
-/* Location: ./system/core/Input.php */
+/* Location: ./system/core/Input.php */
View
25 system/core/Lang.php
@@ -26,7 +26,17 @@
*/
class CI_Lang {
+ /**
+ * List of translations
+ *
+ * @var array
+ */
var $language = array();
+ /**
+ * List of loaded language files
+ *
+ * @var array
+ */
var $is_loaded = array();
/**
@@ -47,18 +57,21 @@ function __construct()
* @access public
* @param mixed the name of the language file to be loaded. Can be an array
* @param string the language (english, etc.)
+ * @param bool return loaded array of translations
+ * @param bool add suffix to $langfile
+ * @param string alternative path to look for language file
* @return mixed
*/
function load($langfile =</