App.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <?php
  2. namespace Config;
  3. use CodeIgniter\Config\BaseConfig;
  4. class App extends BaseConfig
  5. {
  6. /**
  7. * --------------------------------------------------------------------------
  8. * Base Site URL
  9. * --------------------------------------------------------------------------
  10. *
  11. * URL to your CodeIgniter root. Typically, this will be your base URL,
  12. * WITH a trailing slash:
  13. *
  14. * E.g., http://example.com/
  15. */
  16. public string $baseURL = 'http://localhost:8080/';
  17. /**
  18. * Allowed Hostnames in the Site URL other than the hostname in the baseURL.
  19. * If you want to accept multiple Hostnames, set this.
  20. *
  21. * E.g.,
  22. * When your site URL ($baseURL) is 'http://example.com/', and your site
  23. * also accepts 'http://media.example.com/' and 'http://accounts.example.com/':
  24. * ['media.example.com', 'accounts.example.com']
  25. *
  26. * @var list<string>
  27. */
  28. public array $allowedHostnames = [];
  29. /**
  30. * --------------------------------------------------------------------------
  31. * Index File
  32. * --------------------------------------------------------------------------
  33. *
  34. * Typically, this will be your `index.php` file, unless you've renamed it to
  35. * something else. If you have configured your web server to remove this file
  36. * from your site URIs, set this variable to an empty string.
  37. */
  38. public string $indexPage = 'index.php';
  39. /**
  40. * --------------------------------------------------------------------------
  41. * URI PROTOCOL
  42. * --------------------------------------------------------------------------
  43. *
  44. * This item determines which server global should be used to retrieve the
  45. * URI string. The default setting of 'REQUEST_URI' works for most servers.
  46. * If your links do not seem to work, try one of the other delicious flavors:
  47. *
  48. * 'REQUEST_URI': Uses $_SERVER['REQUEST_URI']
  49. * 'QUERY_STRING': Uses $_SERVER['QUERY_STRING']
  50. * 'PATH_INFO': Uses $_SERVER['PATH_INFO']
  51. *
  52. * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
  53. */
  54. public string $uriProtocol = 'REQUEST_URI';
  55. /*
  56. |--------------------------------------------------------------------------
  57. | Allowed URL Characters
  58. |--------------------------------------------------------------------------
  59. |
  60. | This lets you specify which characters are permitted within your URLs.
  61. | When someone tries to submit a URL with disallowed characters they will
  62. | get a warning message.
  63. |
  64. | As a security measure you are STRONGLY encouraged to restrict URLs to
  65. | as few characters as possible.
  66. |
  67. | By default, only these are allowed: `a-z 0-9~%.:_-`
  68. |
  69. | Set an empty string to allow all characters -- but only if you are insane.
  70. |
  71. | The configured value is actually a regular expression character group
  72. | and it will be used as: '/\A[<permittedURIChars>]+\z/iu'
  73. |
  74. | DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
  75. |
  76. */
  77. public string $permittedURIChars = 'a-z 0-9~%.:_\-';
  78. /**
  79. * --------------------------------------------------------------------------
  80. * Default Locale
  81. * --------------------------------------------------------------------------
  82. *
  83. * The Locale roughly represents the language and location that your visitor
  84. * is viewing the site from. It affects the language strings and other
  85. * strings (like currency markers, numbers, etc), that your program
  86. * should run under for this request.
  87. */
  88. public string $defaultLocale = 'en';
  89. /**
  90. * --------------------------------------------------------------------------
  91. * Negotiate Locale
  92. * --------------------------------------------------------------------------
  93. *
  94. * If true, the current Request object will automatically determine the
  95. * language to use based on the value of the Accept-Language header.
  96. *
  97. * If false, no automatic detection will be performed.
  98. */
  99. public bool $negotiateLocale = false;
  100. /**
  101. * --------------------------------------------------------------------------
  102. * Supported Locales
  103. * --------------------------------------------------------------------------
  104. *
  105. * If $negotiateLocale is true, this array lists the locales supported
  106. * by the application in descending order of priority. If no match is
  107. * found, the first locale will be used.
  108. *
  109. * IncomingRequest::setLocale() also uses this list.
  110. *
  111. * @var list<string>
  112. */
  113. public array $supportedLocales = ['en'];
  114. /**
  115. * --------------------------------------------------------------------------
  116. * Application Timezone
  117. * --------------------------------------------------------------------------
  118. *
  119. * The default timezone that will be used in your application to display
  120. * dates with the date helper, and can be retrieved through app_timezone()
  121. *
  122. * @see https://www.php.net/manual/en/timezones.php for list of timezones
  123. * supported by PHP.
  124. */
  125. public string $appTimezone = 'UTC';
  126. /**
  127. * --------------------------------------------------------------------------
  128. * Default Character Set
  129. * --------------------------------------------------------------------------
  130. *
  131. * This determines which character set is used by default in various methods
  132. * that require a character set to be provided.
  133. *
  134. * @see http://php.net/htmlspecialchars for a list of supported charsets.
  135. */
  136. public string $charset = 'UTF-8';
  137. /**
  138. * --------------------------------------------------------------------------
  139. * Force Global Secure Requests
  140. * --------------------------------------------------------------------------
  141. *
  142. * If true, this will force every request made to this application to be
  143. * made via a secure connection (HTTPS). If the incoming request is not
  144. * secure, the user will be redirected to a secure version of the page
  145. * and the HTTP Strict Transport Security (HSTS) header will be set.
  146. */
  147. public bool $forceGlobalSecureRequests = false;
  148. /**
  149. * --------------------------------------------------------------------------
  150. * Reverse Proxy IPs
  151. * --------------------------------------------------------------------------
  152. *
  153. * If your server is behind a reverse proxy, you must whitelist the proxy
  154. * IP addresses from which CodeIgniter should trust headers such as
  155. * X-Forwarded-For or Client-IP in order to properly identify
  156. * the visitor's IP address.
  157. *
  158. * You need to set a proxy IP address or IP address with subnets and
  159. * the HTTP header for the client IP address.
  160. *
  161. * Here are some examples:
  162. * [
  163. * '10.0.1.200' => 'X-Forwarded-For',
  164. * '192.168.5.0/24' => 'X-Real-IP',
  165. * ]
  166. *
  167. * @var array<string, string>
  168. */
  169. public array $proxyIPs = [];
  170. /**
  171. * --------------------------------------------------------------------------
  172. * Content Security Policy
  173. * --------------------------------------------------------------------------
  174. *
  175. * Enables the Response's Content Secure Policy to restrict the sources that
  176. * can be used for images, scripts, CSS files, audio, video, etc. If enabled,
  177. * the Response object will populate default values for the policy from the
  178. * `ContentSecurityPolicy.php` file. Controllers can always add to those
  179. * restrictions at run time.
  180. *
  181. * For a better understanding of CSP, see these documents:
  182. *
  183. * @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
  184. * @see http://www.w3.org/TR/CSP/
  185. */
  186. public bool $CSPEnabled = false;
  187. }