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