You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

344 lines
11 KiB

7 years ago
  1. <?php
  2. /**
  3. * CodeIgniter
  4. *
  5. * An open source application development framework for PHP
  6. *
  7. * This content is released under the MIT License (MIT)
  8. *
  9. * Copyright (c) 2014 - 2017, British Columbia Institute of Technology
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12. * of this software and associated documentation files (the "Software"), to deal
  13. * in the Software without restriction, including without limitation the rights
  14. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15. * copies of the Software, and to permit persons to whom the Software is
  16. * furnished to do so, subject to the following conditions:
  17. *
  18. * The above copyright notice and this permission notice shall be included in
  19. * all copies or substantial portions of the Software.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  24. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  26. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  27. * THE SOFTWARE.
  28. *
  29. * @package CodeIgniter
  30. * @author EllisLab Dev Team
  31. * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
  32. * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
  33. * @license http://opensource.org/licenses/MIT MIT License
  34. * @link https://codeigniter.com
  35. * @since Version 1.0.0
  36. * @filesource
  37. */
  38. /*
  39. *---------------------------------------------------------------
  40. * APPLICATION ENVIRONMENT
  41. *---------------------------------------------------------------
  42. *
  43. * You can load different configurations depending on your
  44. * current environment. Setting the environment also influences
  45. * things like logging and error reporting.
  46. *
  47. * This can be set to anything, but default usage is:
  48. *
  49. * development
  50. * testing
  51. * production
  52. *
  53. * NOTE: If you change these, also change the error_reporting() code below
  54. */
  55. define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production');
  56. define('IS_TEST', (ENVIRONMENT != "production"));
  57. /*
  58. *---------------------------------------------------------------
  59. * ERROR REPORTING
  60. *---------------------------------------------------------------
  61. *
  62. * Different environments will require different levels of error reporting.
  63. * By default development will show errors but testing and live will hide them.
  64. */
  65. switch (ENVIRONMENT)
  66. {
  67. case 'development':
  68. error_reporting(-1);
  69. ini_set('display_errors', 1);
  70. break;
  71. case 'testing':
  72. case 'production':
  73. ini_set('display_errors', 0);
  74. if (version_compare(PHP_VERSION, '5.3', '>='))
  75. {
  76. error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
  77. }
  78. else
  79. {
  80. error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
  81. }
  82. break;
  83. default:
  84. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  85. echo 'The application environment is not set correctly.';
  86. exit(1); // EXIT_ERROR
  87. }
  88. /*
  89. *---------------------------------------------------------------
  90. * SYSTEM DIRECTORY NAME
  91. *---------------------------------------------------------------
  92. *
  93. * This variable must contain the name of your "system" directory.
  94. * Set the path if it is not in the same directory as this file.
  95. */
  96. $system_path = '../wheeparam/system';
  97. /*
  98. *---------------------------------------------------------------
  99. * APPLICATION DIRECTORY NAME
  100. *---------------------------------------------------------------
  101. *
  102. * If you want this front controller to use a different "application"
  103. * directory than the default one you can set its name here. The directory
  104. * can also be renamed or relocated anywhere on your server. If you do,
  105. * use an absolute (full) server path.
  106. * For more info please see the user guide:
  107. *
  108. * https://codeigniter.com/user_guide/general/managing_apps.html
  109. *
  110. * NO TRAILING SLASH!
  111. */
  112. $application_folder = '../wheeparam/application';
  113. /*
  114. *---------------------------------------------------------------
  115. * VIEW DIRECTORY NAME
  116. *---------------------------------------------------------------
  117. *
  118. * If you want to move the view directory out of the application
  119. * directory, set the path to it here. The directory can be renamed
  120. * and relocated anywhere on your server. If blank, it will default
  121. * to the standard location inside your application directory.
  122. * If you do move this, use an absolute (full) server path.
  123. *
  124. * NO TRAILING SLASH!
  125. */
  126. $view_folder = '../wheeparam/views';
  127. /*
  128. * --------------------------------------------------------------------
  129. * DEFAULT CONTROLLER
  130. * --------------------------------------------------------------------
  131. *
  132. * Normally you will set your default controller in the routes.php file.
  133. * You can, however, force a custom routing by hard-coding a
  134. * specific controller class/function here. For most applications, you
  135. * WILL NOT set your routing here, but it's an option for those
  136. * special instances where you might want to override the standard
  137. * routing in a specific front controller that shares a common CI installation.
  138. *
  139. * IMPORTANT: If you set the routing here, NO OTHER controller will be
  140. * callable. In essence, this preference limits your application to ONE
  141. * specific controller. Leave the function name blank if you need
  142. * to call functions dynamically via the URI.
  143. *
  144. * Un-comment the $routing array below to use this feature
  145. */
  146. // The directory name, relative to the "controllers" directory. Leave blank
  147. // if your controller is not in a sub-directory within the "controllers" one
  148. // $routing['directory'] = '';
  149. // The controller class file name. Example: mycontroller
  150. // $routing['controller'] = '';
  151. // The controller function you wish to be called.
  152. // $routing['function'] = '';
  153. /*
  154. * -------------------------------------------------------------------
  155. * CUSTOM CONFIG VALUES
  156. * -------------------------------------------------------------------
  157. *
  158. * The $assign_to_config array below will be passed dynamically to the
  159. * config class when initialized. This allows you to set custom config
  160. * items or override any default config values found in the config.php file.
  161. * This can be handy as it permits you to share one application between
  162. * multiple front controller files, with each file containing different
  163. * config values.
  164. *
  165. * Un-comment the $assign_to_config array below to use this feature
  166. */
  167. // $assign_to_config['name_of_config_item'] = 'value of config item';
  168. // --------------------------------------------------------------------
  169. // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
  170. // --------------------------------------------------------------------
  171. /*
  172. * ---------------------------------------------------------------
  173. * Resolve the system path for increased reliability
  174. * ---------------------------------------------------------------
  175. */
  176. // Set the current directory correctly for CLI requests
  177. if (defined('STDIN'))
  178. {
  179. chdir(dirname(__FILE__));
  180. }
  181. if (($_temp = realpath($system_path)) !== FALSE)
  182. {
  183. $system_path = $_temp.DIRECTORY_SEPARATOR;
  184. }
  185. else
  186. {
  187. // Ensure there's a trailing slash
  188. $system_path = strtr(
  189. rtrim($system_path, '/\\'),
  190. '/\\',
  191. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  192. ).DIRECTORY_SEPARATOR;
  193. }
  194. // Is the system path correct?
  195. if ( ! is_dir($system_path))
  196. {
  197. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  198. echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
  199. exit(3); // EXIT_CONFIG
  200. }
  201. /*
  202. * -------------------------------------------------------------------
  203. * Now that we know the path, set the main path constants
  204. * -------------------------------------------------------------------
  205. */
  206. // The name of THIS file
  207. define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
  208. // Path to the system directory
  209. define('BASEPATH', $system_path);
  210. // Path to the front controller (this file) directory
  211. define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
  212. // Name of the "system" directory
  213. define('SYSDIR', basename(BASEPATH));
  214. // The path to the "application" directory
  215. if (is_dir($application_folder))
  216. {
  217. if (($_temp = realpath($application_folder)) !== FALSE)
  218. {
  219. $application_folder = $_temp;
  220. }
  221. else
  222. {
  223. $application_folder = strtr(
  224. rtrim($application_folder, '/\\'),
  225. '/\\',
  226. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  227. );
  228. }
  229. }
  230. elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
  231. {
  232. $application_folder = BASEPATH.strtr(
  233. trim($application_folder, '/\\'),
  234. '/\\',
  235. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  236. );
  237. }
  238. else
  239. {
  240. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  241. echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
  242. exit(3); // EXIT_CONFIG
  243. }
  244. define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
  245. // The path to the "views" directory
  246. if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
  247. {
  248. $view_folder = APPPATH.'views';
  249. }
  250. elseif (is_dir($view_folder))
  251. {
  252. if (($_temp = realpath($view_folder)) !== FALSE)
  253. {
  254. $view_folder = $_temp;
  255. }
  256. else
  257. {
  258. $view_folder = strtr(
  259. rtrim($view_folder, '/\\'),
  260. '/\\',
  261. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  262. );
  263. }
  264. }
  265. elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
  266. {
  267. $view_folder = APPPATH.strtr(
  268. trim($view_folder, '/\\'),
  269. '/\\',
  270. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  271. );
  272. }
  273. else
  274. {
  275. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  276. echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
  277. exit(3); // EXIT_CONFIG
  278. }
  279. define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR);
  280. /*
  281. * --------------------------------------------------------------------
  282. * Define CONSTANT Variable
  283. * --------------------------------------------------------------------
  284. *
  285. */
  286. define("DEVICE_MOBILE", "mobile");
  287. define("DEVICE_DESKTOP", "desktop");
  288. define("COOKIE_VIEWMODE", "viewmode");
  289. define("COOKIE_AUTOLOGIN", "autologin");
  290. define("COOKIE_STATICS", "visit");
  291. define("DIR_UPLOAD", "files");
  292. define("DIR_THEME", "themes");
  293. define("DIR_SKIN", "skins");
  294. define("DIR_WIDGET", "widget");
  295. define("SKIN_TYPE_BOARD", "board");
  296. define("SEPERATE_CHARSET", "|#@#|");
  297. /*
  298. * --------------------------------------------------------------------
  299. * LOAD THE CONFIG FILE
  300. * --------------------------------------------------------------------
  301. *
  302. */
  303. require_once BASEPATH . "../config/wheeparam.php";
  304. /*
  305. * --------------------------------------------------------------------
  306. * LOAD THE BOOTSTRAP FILE
  307. * --------------------------------------------------------------------
  308. *
  309. * And away we go...
  310. */
  311. require_once BASEPATH.'core/CodeIgniter.php';