/index.php

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