PageRenderTime 63ms CodeModel.GetById 36ms RepoModel.GetById 1ms app.codeStats 0ms

/intern/index.php

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