PageRenderTime 25ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/index.php

https://gitlab.com/zanderwong/admin
PHP | 195 lines | 41 code | 28 blank | 126 comment | 8 complexity | e1d979ac8179f4a4abf40c8716486360 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. switch (ENVIRONMENT) {
  31. case 'development':
  32. error_reporting(E_ALL);
  33. break;
  34. case 'testing':
  35. case 'production':
  36. error_reporting(0);
  37. break;
  38. default:
  39. exit('The application environment is not set correctly.');
  40. }
  41. }
  42. /*
  43. *---------------------------------------------------------------
  44. * SYSTEM FOLDER NAME
  45. *---------------------------------------------------------------
  46. *
  47. * This variable must contain the name of your "system" folder.
  48. * Include the path if the folder is not in the same directory
  49. * as this file.
  50. *
  51. */
  52. $system_path = 'system';
  53. /*
  54. *---------------------------------------------------------------
  55. * APPLICATION FOLDER NAME
  56. *---------------------------------------------------------------
  57. *
  58. * If you want this front controller to use a different "application"
  59. * folder then the default one you can set its name here. The folder
  60. * can also be renamed or relocated anywhere on your server. If
  61. * you do, use a full server path. For more info please see the user guide:
  62. * http://codeigniter.com/user_guide/general/managing_apps.html
  63. *
  64. * NO TRAILING SLASH!
  65. *
  66. */
  67. $application_folder = 'application';
  68. /*
  69. * --------------------------------------------------------------------
  70. * DEFAULT CONTROLLER
  71. * --------------------------------------------------------------------
  72. *
  73. * Normally you will set your default controller in the routes.php file.
  74. * You can, however, force a custom routing by hard-coding a
  75. * specific controller class/function here. For most applications, you
  76. * WILL NOT set your routing here, but it's an option for those
  77. * special instances where you might want to override the standard
  78. * routing in a specific front controller that shares a common CI installation.
  79. *
  80. * IMPORTANT: If you set the routing here, NO OTHER controller will be
  81. * callable. In essence, this preference limits your application to ONE
  82. * specific controller. Leave the function name blank if you need
  83. * to call functions dynamically via the URI.
  84. *
  85. * Un-comment the $routing array below to use this feature
  86. *
  87. */
  88. // The directory name, relative to the "controllers" folder. Leave blank
  89. // if your controller is not in a sub-folder within the "controllers" folder
  90. // $routing['directory'] = '';
  91. // The controller class file name. Example: Mycontroller
  92. // $routing['controller'] = '';
  93. // The controller function you wish to be called.
  94. // $routing['function'] = '';
  95. /*
  96. * -------------------------------------------------------------------
  97. * CUSTOM CONFIG VALUES
  98. * -------------------------------------------------------------------
  99. *
  100. * The $assign_to_config array below will be passed dynamically to the
  101. * config class when initialized. This allows you to set custom config
  102. * items or override any default config values found in the config.php file.
  103. * This can be handy as it permits you to share one application between
  104. * multiple front controller files, with each file containing different
  105. * config values.
  106. *
  107. * Un-comment the $assign_to_config array below to use this feature
  108. *
  109. */
  110. // $assign_to_config['name_of_config_item'] = 'value of config item';
  111. // --------------------------------------------------------------------
  112. // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
  113. // --------------------------------------------------------------------
  114. /*
  115. * ---------------------------------------------------------------
  116. * Resolve the system path for increased reliability
  117. * ---------------------------------------------------------------
  118. */
  119. // Set the current directory correctly for CLI requests
  120. if (defined('STDIN')) {
  121. chdir(dirname(__FILE__));
  122. }
  123. if (realpath($system_path) !== FALSE) {
  124. $system_path = realpath($system_path) . '/';
  125. }
  126. // ensure there's a trailing slash
  127. $system_path = rtrim($system_path, '/') . '/';
  128. // Is the system path correct?
  129. if (!is_dir($system_path)) {
  130. exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: " . pathinfo(__FILE__, PATHINFO_BASENAME));
  131. }
  132. /*
  133. * -------------------------------------------------------------------
  134. * Now that we know the path, set the main path constants
  135. * -------------------------------------------------------------------
  136. */
  137. // The name of THIS file
  138. define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
  139. // The PHP file extension
  140. // this global constant is deprecated.
  141. define('EXT', '.php');
  142. // Path to the system folder
  143. define('BASEPATH', str_replace("\\", "/", $system_path));
  144. // Path to the front controller (this file)
  145. define('FCPATH', str_replace(SELF, '', __FILE__));
  146. // Name of the "system folder"
  147. define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
  148. // The path to the "application" folder
  149. if (is_dir($application_folder)) {
  150. define('APPPATH', $application_folder . '/');
  151. } else {
  152. if (!is_dir(BASEPATH . $application_folder . '/')) {
  153. exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: " . SELF);
  154. }
  155. define('APPPATH', BASEPATH . $application_folder . '/');
  156. }
  157. /*
  158. * --------------------------------------------------------------------
  159. * LOAD THE BOOTSTRAP FILE
  160. * --------------------------------------------------------------------
  161. *
  162. * And away we go...
  163. *
  164. */
  165. require_once BASEPATH . 'core/CodeIgniter.php';
  166. /* End of file index.php */
  167. /* Location: ./index.php */