]> git.p6c8.net - jirafeau_project.git/blob - lib/settings.php
[FEATURE] Autogenerate prefix for absolute links
[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 {
26 // read local copy and merge with original values
27 $cfgOriginal = $cfg;
28 require (JIRAFEAU_ROOT . 'lib/config.local.php');
29 $cfg = array_merge($cfgOriginal, $cfg);
30 unset($cfgOriginal);
31 }
32
33 // Set constants
34
35 /* Jirafeau package */
36 define ('JIRAFEAU_PACKAGE', 'Jirafeau');
37 define ('JIRAFEAU_VERSION', '2.0.0');
38
39 /* Directories. */
40 define ('VAR_FILES', $cfg['var_root'] . 'files/');
41 define ('VAR_LINKS', $cfg['var_root'] . 'links/');
42 define ('VAR_ASYNC', $cfg['var_root'] . 'async/');
43 define ('VAR_ALIAS', $cfg['var_root'] . 'alias/');
44
45 // helping variable to build absolute link to
46 // root of the domain without handling the URL scheme
47 $absPrefix = parse_url($cfg['web_root'], PHP_URL_PATH);
48 if(true === empty($absPrefix)) {
49 // fallback if installation isnt done yet: relative links to same level on the current page
50 $absPrefix = './';
51 }
52 define ('JIRAFEAU_ABSPREFIX', $absPrefix);
53
54 /* Useful constants. */
55 if (!defined ('NL')) {
56 define ('NL', "\n");
57 }
58 if (!defined ('QUOTE')) {
59 define ('QUOTE', "'");
60 }
61
62 define ('JIRAFEAU_INFINITY', -1);
63 define ('JIRAFEAU_MINUTE', 60); // 60
64 define ('JIRAFEAU_HOUR', 3600); // JIRAFEAU_MINUTE * 60
65 define ('JIRAFEAU_DAY', 86400); // JIRAFEAU_HOUR * 24
66 define ('JIRAFEAU_WEEK', 604800); // JIRAFEAU_DAY * 7
67 define ('JIRAFEAU_MONTH', 2419200); // JIRAFEAU_WEEK * 4
68 define ('JIRAFEAU_QUARTER', 7257600); // JIRAFEAU_MONTH * 3
69 define ('JIRAFEAU_YEAR', 29030400); // JIRAFEAU_MONTH * 12

patrick-canterino.de