PageRenderTime 50ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/index.php

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