index.php 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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. define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
  20. /*
  21. *---------------------------------------------------------------
  22. * ERROR REPORTING
  23. *---------------------------------------------------------------
  24. *
  25. * Different environments will require different levels of error reporting.
  26. * By default development will show errors but testing and live will hide them.
  27. */
  28. switch (ENVIRONMENT)
  29. {
  30. case 'development':
  31. error_reporting(-1);
  32. ini_set('display_errors', 1);
  33. break;
  34. case 'testing':
  35. case 'production':
  36. ini_set('display_errors', 0);
  37. if (version_compare(PHP_VERSION, '5.3', '>='))
  38. {
  39. error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
  40. }
  41. else
  42. {
  43. error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
  44. }
  45. break;
  46. default:
  47. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  48. echo 'The application environment is not set correctly.';
  49. exit(1); // EXIT_ERROR
  50. }
  51. /*
  52. *---------------------------------------------------------------
  53. * SYSTEM DIRECTORY NAME
  54. *---------------------------------------------------------------
  55. *
  56. * This variable must contain the name of your "system" directory.
  57. * Set the path if it is not in the same directory as this file.
  58. */
  59. $system_path = 'vendor/rogeriopradoj/codeigniter/system';
  60. /*
  61. *---------------------------------------------------------------
  62. * APPLICATION DIRECTORY NAME
  63. *---------------------------------------------------------------
  64. *
  65. * If you want this front controller to use a different "application"
  66. * directory than the default one you can set its name here. The directory
  67. * can also be renamed or relocated anywhere on your server. If you do,
  68. * use an absolute (full) server path.
  69. * For more info please see the user guide:
  70. *
  71. * https://codeigniter.com/user_guide/general/managing_apps.html
  72. *
  73. * NO TRAILING SLASH!
  74. */
  75. $application_folder = 'application';
  76. /*
  77. *---------------------------------------------------------------
  78. * VIEW DIRECTORY NAME
  79. *---------------------------------------------------------------
  80. *
  81. * If you want to move the view directory out of the application
  82. * directory, set the path to it here. The directory can be renamed
  83. * and relocated anywhere on your server. If blank, it will default
  84. * to the standard location inside your application directory.
  85. * If you do move this, use an absolute (full) server path.
  86. *
  87. * NO TRAILING SLASH!
  88. */
  89. $view_folder = '';
  90. /*
  91. * --------------------------------------------------------------------
  92. * DEFAULT CONTROLLER
  93. * --------------------------------------------------------------------
  94. *
  95. * Normally you will set your default controller in the routes.php file.
  96. * You can, however, force a custom routing by hard-coding a
  97. * specific controller class/function here. For most applications, you
  98. * WILL NOT set your routing here, but it's an option for those
  99. * special instances where you might want to override the standard
  100. * routing in a specific front controller that shares a common CI installation.
  101. *
  102. * IMPORTANT: If you set the routing here, NO OTHER controller will be
  103. * callable. In essence, this preference limits your application to ONE
  104. * specific controller. Leave the function name blank if you need
  105. * to call functions dynamically via the URI.
  106. *
  107. * Un-comment the $routing array below to use this feature
  108. */
  109. // The directory name, relative to the "controllers" directory. Leave blank
  110. // if your controller is not in a sub-directory within the "controllers" one
  111. // $routing['directory'] = '';
  112. // The controller class file name. Example: mycontroller
  113. // $routing['controller'] = '';
  114. // The controller function you wish to be called.
  115. // $routing['function'] = '';
  116. /*
  117. * -------------------------------------------------------------------
  118. * CUSTOM CONFIG VALUES
  119. * -------------------------------------------------------------------
  120. *
  121. * The $assign_to_config array below will be passed dynamically to the
  122. * config class when initialized. This allows you to set custom config
  123. * items or override any default config values found in the config.php file.
  124. * This can be handy as it permits you to share one application between
  125. * multiple front controller files, with each file containing different
  126. * config values.
  127. *
  128. * Un-comment the $assign_to_config array below to use this feature
  129. */
  130. // $assign_to_config['name_of_config_item'] = 'value of config item';
  131. // --------------------------------------------------------------------
  132. // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
  133. // --------------------------------------------------------------------
  134. /*
  135. * ---------------------------------------------------------------
  136. * Resolve the system path for increased reliability
  137. * ---------------------------------------------------------------
  138. */
  139. // Set the current directory correctly for CLI requests
  140. if (defined('STDIN'))
  141. {
  142. chdir(dirname(__FILE__));
  143. }
  144. if (($_temp = realpath($system_path)) !== FALSE)
  145. {
  146. $system_path = $_temp.DIRECTORY_SEPARATOR;
  147. }
  148. else
  149. {
  150. // Ensure there's a trailing slash
  151. $system_path = strtr(
  152. rtrim($system_path, '/\\'),
  153. '/\\',
  154. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  155. ).DIRECTORY_SEPARATOR;
  156. }
  157. // Is the system path correct?
  158. if ( ! is_dir($system_path))
  159. {
  160. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  161. echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
  162. exit(3); // EXIT_CONFIG
  163. }
  164. /*
  165. * -------------------------------------------------------------------
  166. * Now that we know the path, set the main path constants
  167. * -------------------------------------------------------------------
  168. */
  169. // The name of THIS file
  170. define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
  171. // Path to the system directory
  172. define('BASEPATH', $system_path);
  173. // Path to the front controller (this file) directory
  174. define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
  175. // Name of the "system" directory
  176. define('SYSDIR', basename(BASEPATH));
  177. // The path to the "application" directory
  178. if (is_dir($application_folder))
  179. {
  180. if (($_temp = realpath($application_folder)) !== FALSE)
  181. {
  182. $application_folder = $_temp;
  183. }
  184. else
  185. {
  186. $application_folder = strtr(
  187. rtrim($application_folder, '/\\'),
  188. '/\\',
  189. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  190. );
  191. }
  192. }
  193. elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
  194. {
  195. $application_folder = BASEPATH.strtr(
  196. trim($application_folder, '/\\'),
  197. '/\\',
  198. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  199. );
  200. }
  201. else
  202. {
  203. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  204. echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
  205. exit(3); // EXIT_CONFIG
  206. }
  207. define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
  208. // The path to the "views" directory
  209. if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
  210. {
  211. $view_folder = APPPATH.'views';
  212. }
  213. elseif (is_dir($view_folder))
  214. {
  215. if (($_temp = realpath($view_folder)) !== FALSE)
  216. {
  217. $view_folder = $_temp;
  218. }
  219. else
  220. {
  221. $view_folder = strtr(
  222. rtrim($view_folder, '/\\'),
  223. '/\\',
  224. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  225. );
  226. }
  227. }
  228. elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
  229. {
  230. $view_folder = APPPATH.strtr(
  231. trim($view_folder, '/\\'),
  232. '/\\',
  233. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  234. );
  235. }
  236. else
  237. {
  238. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  239. echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
  240. exit(3); // EXIT_CONFIG
  241. }
  242. define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR);
  243. /*
  244. * --------------------------------------------------------------------
  245. * LOAD THE BOOTSTRAP FILE
  246. * --------------------------------------------------------------------
  247. *
  248. * And away we go...
  249. */
  250. require_once BASEPATH.'core/CodeIgniter.php';