/index.php

https://github.com/kryu2/ci-ja · PHP · 238 lines · 63 code · 34 blank · 141 comment · 10 complexity · b85838f99754b08848d3c9ddc882fa68 MD5 · raw file

  1. <?php
  2. /*
  3. *---------------------------------------------------------------
  4. * APPLICATION ENVIRONMENT
  5. *---------------------------------------------------------------
  6. *
  7. * You can load different configurations depending on your
  8. * current environment. Setting the environment also influences
  9. * things like logging and error reporting.
  10. *
  11. * This can be set to anything, but default usage is:
  12. *
  13. * development
  14. * testing
  15. * production
  16. *
  17. * NOTE: If you change these, also change the error_reporting() code below
  18. *
  19. */
  20. define('ENVIRONMENT', 'development');
  21. /*
  22. *---------------------------------------------------------------
  23. * ERROR REPORTING
  24. *---------------------------------------------------------------
  25. *
  26. * Different environments will require different levels of error reporting.
  27. * By default development will show errors but testing and live will hide them.
  28. */
  29. if (defined('ENVIRONMENT'))
  30. {
  31. switch (ENVIRONMENT)
  32. {
  33. case 'development':
  34. error_reporting(-1);
  35. break;
  36. case 'testing':
  37. case 'production':
  38. error_reporting(0);
  39. break;
  40. default:
  41. exit('The application environment is not set correctly.');
  42. }
  43. }
  44. /*
  45. *---------------------------------------------------------------
  46. * SYSTEM FOLDER NAME
  47. *---------------------------------------------------------------
  48. *
  49. * This variable must contain the name of your "system" folder.
  50. * Include the path if the folder is not in the same directory
  51. * as this file.
  52. *
  53. */
  54. $system_path = 'system';
  55. /*
  56. *---------------------------------------------------------------
  57. * APPLICATION FOLDER NAME
  58. *---------------------------------------------------------------
  59. *
  60. * If you want this front controller to use a different "application"
  61. * folder then the default one you can set its name here. The folder
  62. * can also be renamed or relocated anywhere on your server. If
  63. * you do, use a full server path. For more info please see the user guide:
  64. * http://codeigniter.com/user_guide/general/managing_apps.html
  65. *
  66. * NO TRAILING SLASH!
  67. *
  68. */
  69. $application_folder = 'application';
  70. /*
  71. *---------------------------------------------------------------
  72. * VIEW FOLDER NAME
  73. *---------------------------------------------------------------
  74. *
  75. * If you want to move the view folder out of the application
  76. * folder set the path to the folder here. The folder can be renamed
  77. * and relocated anywhere on your server. If blank, it will default
  78. * to the standard location inside your application folder. If you
  79. * do move this, use the full server path to this folder
  80. *
  81. * NO TRAILING SLASH!
  82. *
  83. */
  84. $view_folder = '';
  85. /*
  86. * --------------------------------------------------------------------
  87. * DEFAULT CONTROLLER
  88. * --------------------------------------------------------------------
  89. *
  90. * Normally you will set your default controller in the routes.php file.
  91. * You can, however, force a custom routing by hard-coding a
  92. * specific controller class/function here. For most applications, you
  93. * WILL NOT set your routing here, but it's an option for those
  94. * special instances where you might want to override the standard
  95. * routing in a specific front controller that shares a common CI installation.
  96. *
  97. * IMPORTANT: If you set the routing here, NO OTHER controller will be
  98. * callable. In essence, this preference limits your application to ONE
  99. * specific controller. Leave the function name blank if you need
  100. * to call functions dynamically via the URI.
  101. *
  102. * Un-comment the $routing array below to use this feature
  103. *
  104. */
  105. // The directory name, relative to the "controllers" folder. Leave blank
  106. // if your controller is not in a sub-folder within the "controllers" folder
  107. // $routing['directory'] = '';
  108. // The controller class file name. Example: Mycontroller
  109. // $routing['controller'] = '';
  110. // The controller function you wish to be called.
  111. // $routing['function'] = '';
  112. /*
  113. * -------------------------------------------------------------------
  114. * CUSTOM CONFIG VALUES
  115. * -------------------------------------------------------------------
  116. *
  117. * The $assign_to_config array below will be passed dynamically to the
  118. * config class when initialized. This allows you to set custom config
  119. * items or override any default config values found in the config.php file.
  120. * This can be handy as it permits you to share one application between
  121. * multiple front controller files, with each file containing different
  122. * config values.
  123. *
  124. * Un-comment the $assign_to_config array below to use this feature
  125. *
  126. */
  127. // $assign_to_config['name_of_config_item'] = 'value of config item';
  128. // --------------------------------------------------------------------
  129. // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
  130. // --------------------------------------------------------------------
  131. /*
  132. * ---------------------------------------------------------------
  133. * Resolve the system path for increased reliability
  134. * ---------------------------------------------------------------
  135. */
  136. // Set the current directory correctly for CLI requests
  137. if (defined('STDIN'))
  138. {
  139. chdir(dirname(__FILE__));
  140. }
  141. if (realpath($system_path) !== FALSE)
  142. {
  143. $system_path = realpath($system_path).'/';
  144. }
  145. // ensure there's a trailing slash
  146. $system_path = rtrim($system_path, '/').'/';
  147. // Is the system path correct?
  148. if ( ! is_dir($system_path))
  149. {
  150. exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
  151. }
  152. /*
  153. * -------------------------------------------------------------------
  154. * Now that we know the path, set the main path constants
  155. * -------------------------------------------------------------------
  156. */
  157. // The name of THIS file
  158. define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
  159. // The PHP file extension
  160. // this global constant is deprecated.
  161. define('EXT', '.php');
  162. // Path to the system folder
  163. define('BASEPATH', str_replace("\\", "/", $system_path));
  164. // Path to the front controller (this file)
  165. define('FCPATH', str_replace(SELF, '', __FILE__));
  166. // Name of the "system folder"
  167. define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
  168. // The path to the "application" folder
  169. if (is_dir($application_folder))
  170. {
  171. define('APPPATH', $application_folder.'/');
  172. }
  173. else
  174. {
  175. if ( ! is_dir(BASEPATH.$application_folder.'/'))
  176. {
  177. exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
  178. }
  179. define('APPPATH', BASEPATH.$application_folder.'/');
  180. }
  181. // The path to the "views" folder
  182. if (is_dir($view_folder))
  183. {
  184. define ('VIEWPATH', $view_folder .'/');
  185. }
  186. else
  187. {
  188. if ( ! is_dir(APPPATH.'views/'))
  189. {
  190. exit("Your view folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
  191. }
  192. define ('VIEWPATH', APPPATH.'views/' );
  193. }
  194. /*
  195. * --------------------------------------------------------------------
  196. * LOAD THE BOOTSTRAP FILE
  197. * --------------------------------------------------------------------
  198. *
  199. * And away we go...
  200. *
  201. */
  202. require_once BASEPATH.'core/CodeIgniter.php';
  203. /* End of file index.php */
  204. /* Location: ./index.php */