PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/index.php

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