PageRenderTime 55ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/index.php

https://gitlab.com/filly/e-hrm
PHP | 293 lines | 107 code | 24 blank | 162 comment | 5 complexity | 1dc32ffec6084d4589ade3174d2d959e MD5 | raw file
  1. <?php
  2. /**
  3. * CodeIgniter
  4. *
  5. * An open source application development framework for PHP
  6. *
  7. * This content is released under the MIT License (MIT)
  8. *
  9. * Copyright (c) 2014 - 2015, British Columbia Institute of Technology
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12. * of this software and associated documentation files (the "Software"), to deal
  13. * in the Software without restriction, including without limitation the rights
  14. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15. * copies of the Software, and to permit persons to whom the Software is
  16. * furnished to do so, subject to the following conditions:
  17. *
  18. * The above copyright notice and this permission notice shall be included in
  19. * all copies or substantial portions of the Software.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  24. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  26. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  27. * THE SOFTWARE.
  28. *
  29. * @package CodeIgniter
  30. * @author EllisLab Dev Team
  31. * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
  32. * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
  33. * @license http://opensource.org/licenses/MIT MIT License
  34. * @link http://codeigniter.com
  35. * @since Version 1.0.0
  36. * @filesource
  37. */
  38. /*
  39. *---------------------------------------------------------------
  40. * APPLICATION ENVIRONMENT
  41. *---------------------------------------------------------------
  42. *
  43. * You can load different configurations depending on your
  44. * current environment. Setting the environment also influences
  45. * things like logging and error reporting.
  46. *
  47. * This can be set to anything, but default usage is:
  48. *
  49. * development
  50. * testing
  51. * production
  52. *
  53. * NOTE: If you change these, also change the error_reporting() code below
  54. */
  55. define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
  56. /*
  57. *---------------------------------------------------------------
  58. * ERROR REPORTING
  59. *---------------------------------------------------------------
  60. *
  61. * Different environments will require different levels of error reporting.
  62. * By default development will show errors but testing and live will hide them.
  63. */
  64. switch (ENVIRONMENT)
  65. {
  66. case 'development':
  67. error_reporting(-1);
  68. ini_set('display_errors', 1);
  69. break;
  70. case 'testing':
  71. case 'production':
  72. ini_set('display_errors', 0);
  73. if (version_compare(PHP_VERSION, '5.3', '>='))
  74. {
  75. error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
  76. }
  77. else
  78. {
  79. error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
  80. }
  81. break;
  82. default:
  83. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  84. echo 'The application environment is not set correctly.';
  85. exit(1); // EXIT_ERROR
  86. }
  87. /*
  88. *---------------------------------------------------------------
  89. * SYSTEM FOLDER NAME
  90. *---------------------------------------------------------------
  91. *
  92. * This variable must contain the name of your "system" folder.
  93. * Include the path if the folder is not in the same directory
  94. * as this file.
  95. */
  96. $system_path = 'system';
  97. /*
  98. *---------------------------------------------------------------
  99. * APPLICATION FOLDER NAME
  100. *---------------------------------------------------------------
  101. *
  102. * If you want this front controller to use a different "application"
  103. * folder than the default one you can set its name here. The folder
  104. * can also be renamed or relocated anywhere on your server. If
  105. * you do, use a full server path. For more info please see the user guide:
  106. * http://codeigniter.com/user_guide/general/managing_apps.html
  107. *
  108. * NO TRAILING SLASH!
  109. */
  110. $application_folder = 'application';
  111. /*
  112. *---------------------------------------------------------------
  113. * VIEW FOLDER NAME
  114. *---------------------------------------------------------------
  115. *
  116. * If you want to move the view folder out of the application
  117. * folder set the path to the folder here. The folder can be renamed
  118. * and relocated anywhere on your server. If blank, it will default
  119. * to the standard location inside your application folder. If you
  120. * do move this, use the full server path to this folder.
  121. *
  122. * NO TRAILING SLASH!
  123. */
  124. $view_folder = '';
  125. /*
  126. * --------------------------------------------------------------------
  127. * DEFAULT CONTROLLER
  128. * --------------------------------------------------------------------
  129. *
  130. * Normally you will set your default controller in the routes.php file.
  131. * You can, however, force a custom routing by hard-coding a
  132. * specific controller class/function here. For most applications, you
  133. * WILL NOT set your routing here, but it's an option for those
  134. * special instances where you might want to override the standard
  135. * routing in a specific front controller that shares a common CI installation.
  136. *
  137. * IMPORTANT: If you set the routing here, NO OTHER controller will be
  138. * callable. In essence, this preference limits your application to ONE
  139. * specific controller. Leave the function name blank if you need
  140. * to call functions dynamically via the URI.
  141. *
  142. * Un-comment the $routing array below to use this feature
  143. */
  144. // The directory name, relative to the "controllers" folder. Leave blank
  145. // if your controller is not in a sub-folder within the "controllers" folder
  146. // $routing['directory'] = '';
  147. // The controller class file name. Example: mycontroller
  148. // $routing['controller'] = '';
  149. // The controller function you wish to be called.
  150. // $routing['function'] = '';
  151. /*
  152. * -------------------------------------------------------------------
  153. * CUSTOM CONFIG VALUES
  154. * -------------------------------------------------------------------
  155. *
  156. * The $assign_to_config array below will be passed dynamically to the
  157. * config class when initialized. This allows you to set custom config
  158. * items or override any default config values found in the config.php file.
  159. * This can be handy as it permits you to share one application between
  160. * multiple front controller files, with each file containing different
  161. * config values.
  162. *
  163. * Un-comment the $assign_to_config array below to use this feature
  164. */
  165. // $assign_to_config['name_of_config_item'] = 'value of config item';
  166. // --------------------------------------------------------------------
  167. // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
  168. // --------------------------------------------------------------------
  169. /*
  170. * ---------------------------------------------------------------
  171. * Resolve the system path for increased reliability
  172. * ---------------------------------------------------------------
  173. */
  174. // Set the current directory correctly for CLI requests
  175. if (defined('STDIN'))
  176. {
  177. chdir(dirname(__FILE__));
  178. }
  179. if (($_temp = realpath($system_path)) !== FALSE)
  180. {
  181. $system_path = $_temp.'/';
  182. }
  183. else
  184. {
  185. // Ensure there's a trailing slash
  186. $system_path = rtrim($system_path, '/').'/';
  187. }
  188. // Is the system path correct?
  189. if ( ! is_dir($system_path))
  190. {
  191. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  192. echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
  193. exit(3); // EXIT_CONFIG
  194. }
  195. /*
  196. * -------------------------------------------------------------------
  197. * Now that we know the path, set the main path constants
  198. * -------------------------------------------------------------------
  199. */
  200. // The name of THIS file
  201. define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
  202. // Path to the system folder
  203. define('BASEPATH', str_replace('\\', '/', $system_path));
  204. // Path to the front controller (this file)
  205. define('FCPATH', dirname(__FILE__).'/');
  206. // Name of the "system folder"
  207. define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
  208. // The path to the "application" folder
  209. if (is_dir($application_folder))
  210. {
  211. if (($_temp = realpath($application_folder)) !== FALSE)
  212. {
  213. $application_folder = $_temp;
  214. }
  215. define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
  216. }
  217. else
  218. {
  219. if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
  220. {
  221. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  222. echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
  223. exit(3); // EXIT_CONFIG
  224. }
  225. define('APPPATH', BASEPATH.$application_folder.DIRECTORY_SEPARATOR);
  226. }
  227. // The path to the "views" folder
  228. if ( ! is_dir($view_folder))
  229. {
  230. if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
  231. {
  232. $view_folder = APPPATH.$view_folder;
  233. }
  234. elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
  235. {
  236. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  237. echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
  238. exit(3); // EXIT_CONFIG
  239. }
  240. else
  241. {
  242. $view_folder = APPPATH.'views';
  243. }
  244. }
  245. if (($_temp = realpath($view_folder)) !== FALSE)
  246. {
  247. $view_folder = $_temp.DIRECTORY_SEPARATOR;
  248. }
  249. else
  250. {
  251. $view_folder = rtrim($view_folder, '/\\').DIRECTORY_SEPARATOR;
  252. }
  253. define('VIEWPATH', $view_folder);
  254. /*
  255. * --------------------------------------------------------------------
  256. * LOAD THE BOOTSTRAP FILE
  257. * --------------------------------------------------------------------
  258. *
  259. * And away we go...
  260. */
  261. require_once __DIR__ . '/vendor/autoload.php';
  262. require_once BASEPATH.'core/CodeIgniter.php';