/index.php

https://github.com/yllumi/LetsIgnite · PHP · 222 lines · 53 code · 31 blank · 138 comment · 7 complexity · 3cff22a7d39603298622a8f230d638a8 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(E_ALL);
  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/codeigniter';
  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 = 'system/application';
  70. /*
  71. *---------------------------------------------------------------
  72. * WORK FOLDER NAME
  73. *---------------------------------------------------------------
  74. *
  75. * work folder name, default 'work' folder
  76. *
  77. * NO TRAILING SLASH!
  78. *
  79. */
  80. $work_folder = 'work';
  81. /*
  82. * --------------------------------------------------------------------
  83. * DEFAULT CONTROLLER
  84. * --------------------------------------------------------------------
  85. *
  86. * Normally you will set your default controller in the routes.php file.
  87. * You can, however, force a custom routing by hard-coding a
  88. * specific controller class/function here. For most applications, you
  89. * WILL NOT set your routing here, but it's an option for those
  90. * special instances where you might want to override the standard
  91. * routing in a specific front controller that shares a common CI installation.
  92. *
  93. * IMPORTANT: If you set the routing here, NO OTHER controller will be
  94. * callable. In essence, this preference limits your application to ONE
  95. * specific controller. Leave the function name blank if you need
  96. * to call functions dynamically via the URI.
  97. *
  98. * Un-comment the $routing array below to use this feature
  99. *
  100. */
  101. // The directory name, relative to the "controllers" folder. Leave blank
  102. // if your controller is not in a sub-folder within the "controllers" folder
  103. // $routing['directory'] = '';
  104. // The controller class file name. Example: Mycontroller
  105. // $routing['controller'] = '';
  106. // The controller function you wish to be called.
  107. // $routing['function'] = '';
  108. /*
  109. * -------------------------------------------------------------------
  110. * CUSTOM CONFIG VALUES
  111. * -------------------------------------------------------------------
  112. *
  113. * The $assign_to_config array below will be passed dynamically to the
  114. * config class when initialized. This allows you to set custom config
  115. * items or override any default config values found in the config.php file.
  116. * This can be handy as it permits you to share one application between
  117. * multiple front controller files, with each file containing different
  118. * config values.
  119. *
  120. * Un-comment the $assign_to_config array below to use this feature
  121. *
  122. */
  123. // $assign_to_config['name_of_config_item'] = 'value of config item';
  124. // --------------------------------------------------------------------
  125. // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
  126. // --------------------------------------------------------------------
  127. /*
  128. * ---------------------------------------------------------------
  129. * Resolve the system path for increased reliability
  130. * ---------------------------------------------------------------
  131. */
  132. // Set the current directory correctly for CLI requests
  133. if (defined('STDIN'))
  134. {
  135. chdir(dirname(__FILE__));
  136. }
  137. if (realpath($system_path) !== FALSE)
  138. {
  139. $system_path = realpath($system_path).'/';
  140. }
  141. // ensure there's a trailing slash
  142. $system_path = rtrim($system_path, '/').'/';
  143. // Is the system path correct?
  144. if ( ! is_dir($system_path))
  145. {
  146. exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
  147. }
  148. /*
  149. * -------------------------------------------------------------------
  150. * Now that we know the path, set the main path constants
  151. * -------------------------------------------------------------------
  152. */
  153. // The name of THIS file
  154. define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
  155. // The PHP file extension
  156. // this global constant is deprecated.
  157. define('EXT', '.php');
  158. // Path to the system folder
  159. define('BASEPATH', str_replace("\\", "/", $system_path));
  160. // Path to the front controller (this file)
  161. define('FCPATH', str_replace(SELF, '', __FILE__));
  162. // Name of the "system folder"
  163. define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
  164. // Path to the assets folder in root program
  165. define('ASSETSPATH', 'assets/');
  166. // This only allows you to change the name. ADDONPATH should still be used in the app
  167. define('WORKPATH', $work_folder.'/');
  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. /*
  182. * --------------------------------------------------------------------
  183. * LOAD THE BOOTSTRAP FILE
  184. * --------------------------------------------------------------------
  185. *
  186. * And away we go...
  187. *
  188. */
  189. require_once BASEPATH.'core/CodeIgniter.php';
  190. /* End of file index.php */
  191. /* Location: ./index.php */