dolibarr 21.0.0-beta
mymodule.css.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) ---Replace with your own copyright and developer email---
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24//if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language
25//if (!defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled. Language code is found on url.
26if (!defined('NOREQUIRESOC')) {
27 define('NOREQUIRESOC', '1');
28}
29//if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
30//if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); // Should be disable only for special situation
31if (!defined('NOTOKENRENEWAL')) {
32 define('NOTOKENRENEWAL', 1);
33}
34if (!defined('NOLOGIN')) {
35 define('NOLOGIN', 1); // File must be accessed by logon page so without login
36}
37//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
38if (!defined('NOREQUIREHTML')) {
39 define('NOREQUIREHTML', 1);
40}
41if (!defined('NOREQUIREAJAX')) {
42 define('NOREQUIREAJAX', '1');
43}
44
45session_cache_limiter('public');
46// false or '' = keep cache instruction added by server
47// 'public' = remove cache instruction added by server
48// and if no cache-control added later, a default cache delay (10800) will be added by PHP.
49
50// Load Dolibarr environment
51$res = 0;
52// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
53if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
54 $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
55}
56// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
57$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
58$tmp2 = realpath(__FILE__);
59$i = strlen($tmp) - 1;
60$j = strlen($tmp2) - 1;
61while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
62 $i--;
63 $j--;
64}
65if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
66 $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
67}
68if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/../main.inc.php")) {
69 $res = @include substr($tmp, 0, ($i + 1))."/../main.inc.php";
70}
71// Try main.inc.php using relative path
72if (!$res && file_exists("../../main.inc.php")) {
73 $res = @include "../../main.inc.php";
74}
75if (!$res && file_exists("../../../main.inc.php")) {
76 $res = @include "../../../main.inc.php";
77}
78if (!$res) {
79 die("Include of main fails");
80}
81
82require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
83
84// Load user to have $user->conf loaded (not done by default here because of NOLOGIN constant defined) and load permission if we need to use them in CSS
85/*if (empty($user->id) && !empty($_SESSION['dol_login'])) {
86 $user->fetch('',$_SESSION['dol_login']);
87 $user->loadRights();
88}*/
89
90
91// Define css type
92header('Content-type: text/css');
93// Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access.
94// You can use CTRL+F5 to refresh your browser cache.
95if (empty($dolibarr_nocache)) {
96 header('Cache-Control: max-age=10800, public, must-revalidate');
97} else {
98 header('Cache-Control: no-cache');
99}
100
101?>
102
103div.mainmenu.mymodule::before {
104 content: "\f249";
105}
106div.mainmenu.mymodule {
107 background-image: none;
108}
109
110.myclasscss {
111 /* ... */
112}