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

patrick-canterino.de