/index.php

https://github.com/Maigre/SupAir · PHP · 222 lines · 64 code · 33 blank · 125 comment · 9 complexity · 9dabdcb36c5e09820fb17a97225be0c5 MD5 · raw file

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