index.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <?php
  2. /**
  3. * DO NOT EDIT THIS FILE!
  4. * Make a copy of the ipconfig.php.example file, rename the copy to 'ipconfig.php' and set your settings in this file
  5. */
  6. /*
  7. *---------------------------------------------------------------
  8. * LOAD DOTENV
  9. *---------------------------------------------------------------
  10. */
  11. if (!file_exists('ipconfig.php')) {
  12. exit("The <b>ipconfig.php</b> file is missing! Please make a copy of the <b>ipconfig.php.example</b> file and rename it to <b>ipconfig.php</b>");
  13. }
  14. require ('vendor/autoload.php');
  15. $dotenv = new \Dotenv\Dotenv(__DIR__, 'ipconfig.php');
  16. $dotenv->load();
  17. /**
  18. * Small helper function to allow defaults for the getenv function
  19. *
  20. * @param string $env_key
  21. * @param mixed $default
  22. * @return mixed
  23. */
  24. function env($env_key, $default = null) {
  25. return getenv($env_key) ? getenv($env_key) : $default;
  26. }
  27. /**
  28. * Small helper function to get bool values for the env setting
  29. *
  30. * @param string $env_key
  31. * @param boolean $default
  32. * @return bool
  33. */
  34. function env_bool($env_key, $default = false) {
  35. return env($env_key, $default) === 'true' ? true : false;
  36. }
  37. // Enable debug mode if enabled
  38. define('IP_DEBUG', env_bool('ENABLE_DEBUG'));
  39. define('SUMEX_URL', env('SUMEX_URL'));
  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. } 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. Automatic cleanup
  90. */
  91. array_map('unlink', glob("uploads/temp/*.pdf"));
  92. /*
  93. *---------------------------------------------------------------
  94. * SYSTEM DIRECTORY NAME
  95. *---------------------------------------------------------------
  96. *
  97. * This variable must contain the name of your "system" directory.
  98. * Set the path if it is not in the same directory as this file.
  99. */
  100. $system_path = 'vendor/codeigniter/framework/system';
  101. /*
  102. *---------------------------------------------------------------
  103. * APPLICATION DIRECTORY NAME
  104. *---------------------------------------------------------------
  105. *
  106. * If you want this front controller to use a different "application"
  107. * directory than the default one you can set its name here. The directory
  108. * can also be renamed or relocated anywhere on your server. If you do,
  109. * use an absolute (full) server path.
  110. * For more info please see the user guide:
  111. *
  112. * https://codeigniter.com/user_guide/general/managing_apps.html
  113. *
  114. * NO TRAILING SLASH!
  115. */
  116. $application_folder = 'application';
  117. /*
  118. *---------------------------------------------------------------
  119. * VIEW DIRECTORY NAME
  120. *---------------------------------------------------------------
  121. *
  122. * If you want to move the view directory out of the application
  123. * directory, set the path to it here. The directory can be renamed
  124. * and relocated anywhere on your server. If blank, it will default
  125. * to the standard location inside your application directory.
  126. * If you do move this, use an absolute (full) server path.
  127. *
  128. * NO TRAILING SLASH!
  129. */
  130. $view_folder = '';
  131. /*
  132. * --------------------------------------------------------------------
  133. * DEFAULT CONTROLLER
  134. * --------------------------------------------------------------------
  135. *
  136. * Normally you will set your default controller in the routes.php file.
  137. * You can, however, force a custom routing by hard-coding a
  138. * specific controller class/function here. For most applications, you
  139. * WILL NOT set your routing here, but it's an option for those
  140. * special instances where you might want to override the standard
  141. * routing in a specific front controller that shares a common CI installation.
  142. *
  143. * IMPORTANT: If you set the routing here, NO OTHER controller will be
  144. * callable. In essence, this preference limits your application to ONE
  145. * specific controller. Leave the function name blank if you need
  146. * to call functions dynamically via the URI.
  147. *
  148. * Un-comment the $routing array below to use this feature
  149. */
  150. // The directory name, relative to the "controllers" directory. Leave blank
  151. // if your controller is not in a sub-directory within the "controllers" one
  152. // $routing['directory'] = '';
  153. // The controller class file name. Example: mycontroller
  154. // $routing['controller'] = '';
  155. // The controller function you wish to be called.
  156. // $routing['function'] = '';
  157. /*
  158. * -------------------------------------------------------------------
  159. * CUSTOM CONFIG VALUES
  160. * -------------------------------------------------------------------
  161. *
  162. * The $assign_to_config array below will be passed dynamically to the
  163. * config class when initialized. This allows you to set custom config
  164. * items or override any default config values found in the config.php file.
  165. * This can be handy as it permits you to share one application between
  166. * multiple front controller files, with each file containing different
  167. * config values.
  168. *
  169. * Un-comment the $assign_to_config array below to use this feature
  170. */
  171. // $assign_to_config['name_of_config_item'] = 'value of config item';
  172. // --------------------------------------------------------------------
  173. // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
  174. // --------------------------------------------------------------------
  175. /*
  176. * ---------------------------------------------------------------
  177. * Resolve the system path for increased reliability
  178. * ---------------------------------------------------------------
  179. */
  180. // Set the current directory correctly for CLI requests
  181. if (defined('STDIN'))
  182. {
  183. chdir(dirname(__FILE__));
  184. }
  185. if (($_temp = realpath($system_path)) !== FALSE)
  186. {
  187. $system_path = $_temp.DIRECTORY_SEPARATOR;
  188. } else
  189. {
  190. // Ensure there's a trailing slash
  191. $system_path = strtr(
  192. rtrim($system_path, '/\\'),
  193. '/\\',
  194. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  195. ).DIRECTORY_SEPARATOR;
  196. }
  197. // Is the system path correct?
  198. if ( ! is_dir($system_path))
  199. {
  200. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  201. echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
  202. exit(3); // EXIT_CONFIG
  203. }
  204. /*
  205. * -------------------------------------------------------------------
  206. * Now that we know the path, set the main path constants
  207. * -------------------------------------------------------------------
  208. */
  209. // The name of THIS file
  210. define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
  211. // Path to the system directory
  212. define('BASEPATH', $system_path);
  213. // Path to the front controller (this file) directory
  214. define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
  215. // Name of the "system" directory
  216. define('SYSDIR', basename(BASEPATH));
  217. // The path to the "application" directory
  218. if (is_dir($application_folder))
  219. {
  220. if (($_temp = realpath($application_folder)) !== FALSE)
  221. {
  222. $application_folder = $_temp;
  223. } else
  224. {
  225. $application_folder = strtr(
  226. rtrim($application_folder, '/\\'),
  227. '/\\',
  228. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  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. } 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. } elseif (is_dir($view_folder))
  250. {
  251. if (($_temp = realpath($view_folder)) !== FALSE)
  252. {
  253. $view_folder = $_temp;
  254. } else
  255. {
  256. $view_folder = strtr(
  257. rtrim($view_folder, '/\\'),
  258. '/\\',
  259. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  260. );
  261. }
  262. } elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
  263. {
  264. $view_folder = APPPATH.strtr(
  265. trim($view_folder, '/\\'),
  266. '/\\',
  267. DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
  268. );
  269. } else
  270. {
  271. header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
  272. echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
  273. exit(3); // EXIT_CONFIG
  274. }
  275. define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR);
  276. define('UPLOADS_FOLDER', FCPATH . 'uploads/');
  277. define('THEME_FOLDER', FCPATH . 'assets/');
  278. define('IPCONFIG_FILE', FCPATH . 'ipconfig.php');
  279. /*
  280. * --------------------------------------------------------------------
  281. * LOAD THE BOOTSTRAP FILE
  282. * --------------------------------------------------------------------
  283. *
  284. * And away we go...
  285. */
  286. require_once BASEPATH.'core/CodeIgniter.php';