]> git.p6c8.net - jirafeau_project.git/blob - lib/settings.php
Added some comments explaining the build job for the Docker image
[jirafeau_project.git] / lib / settings.php
1 <?php
2 /*
3 * Jirafeau, your web file repository
4 * Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
5 * Copyright (C) 2015 Jerome Jutteau <jerome@jutteau.fr>
6 * Copyright (C) 2024 Jirafeau project <https://gitlab.com/jirafeau> (see AUTHORS.md)
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as
10 * published by the Free Software Foundation, either version 3 of the
11 * License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 global $cfg;
23
24 // Read config files
25 require(JIRAFEAU_ROOT . 'lib/config.original.php');
26 if (file_exists(JIRAFEAU_ROOT . 'lib/config.local.php')) {
27 // read local copy and merge with original values
28 $cfgOriginal = $cfg;
29 require(JIRAFEAU_ROOT . 'lib/config.local.php');
30 $cfg = array_merge($cfgOriginal, $cfg);
31 unset($cfgOriginal);
32 }
33
34 // Setup debug mode
35 if ($cfg['debug'] === true) {
36 @error_reporting(E_ALL);
37 } else {
38 @error_reporting(0);
39 }
40
41
42 // Set constants
43
44 /* Jirafeau package */
45 define('JIRAFEAU_PACKAGE', 'Jirafeau');
46 define('JIRAFEAU_VERSION', '4.6.x-dev');
47
48 define('JIRAFEAU_WEBSITE', 'https://gitlab.com/jirafeau/Jirafeau');
49
50 /* Directories. */
51 define('VAR_FILES', $cfg['var_root'] . 'files/');
52 define('VAR_LINKS', $cfg['var_root'] . 'links/');
53 define('VAR_ASYNC', $cfg['var_root'] . 'async/');
54
55 // helping variable to build absolute link to
56 // root of the domain without handling the URL scheme
57 $absPrefix = parse_url($cfg['web_root'], PHP_URL_PATH);
58 if (true === empty($absPrefix)) {
59 // fallback if installation isn't done yet: relative links to same level on the current page
60 $absPrefix = './';
61 }
62 define('JIRAFEAU_ABSPREFIX', $absPrefix);
63
64 /* Useful constants. */
65 if (!defined('NL')) {
66 define('NL', "\n");
67 }
68 if (!defined('QUOTE')) {
69 define('QUOTE', "'");
70 }
71
72 define('JIRAFEAU_INFINITY', -1);
73 define('JIRAFEAU_MINUTE', 60); // 60
74 define('JIRAFEAU_HOUR', 3600); // JIRAFEAU_MINUTE * 60
75 define('JIRAFEAU_DAY', 86400); // JIRAFEAU_HOUR * 24
76 define('JIRAFEAU_WEEK', 604800); // JIRAFEAU_DAY * 7
77 define('JIRAFEAU_FORTNIGHT', 1209600); // JIRAFEAU_WEEK * 2
78 define('JIRAFEAU_MONTH', 2592000); // JIRAFEAU_DAY * 30
79 define('JIRAFEAU_QUARTER', 7776000); // JIRAFEAU_DAY * 90
80 define('JIRAFEAU_YEAR', 31536000); // JIRAFEAU_DAY * 365
81
82 define('JIRAFEAU_USER_AUTH_BY_IP_NO_PASSWORD', 1);
83 define('JIRAFEAU_USER_AUTH_BY_PASSWORD', 2);
84
85 define('JIRAFEAU_SODIUM_CHUNKSIZE', 1024);
86
87 // Define some Sodium constants from newer PHP versions if they are not available
88
89 if (extension_loaded('sodium')) {
90 if (!defined('SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES')) {
91 define('SODIUM_CRYPTO_STREAM_XCHACHA20_KEYBYTES', 32);
92 }
93
94 if (!defined('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES')) {
95 define('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_HEADERBYTES', 24);
96 }
97
98 if (!defined('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES')) {
99 define('SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_ABYTES', 17);
100 }
101 }
102
103 // set UTC as default timezone for all date/time functions
104 date_default_timezone_set('UTC');

patrick-canterino.de