dolibarr 19.0.3
mymodule.css.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) ---Put here 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']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
58while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
59 $i--;
60 $j--;
61}
62if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
63 $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
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}
68// Try main.inc.php using relative path
69if (!$res && file_exists("../../main.inc.php")) {
70 $res = @include "../../main.inc.php";
71}
72if (!$res && file_exists("../../../main.inc.php")) {
73 $res = @include "../../../main.inc.php";
74}
75if (!$res) {
76 die("Include of main fails");
77}
78
79require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
80
81// 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
82/*if (empty($user->id) && !empty($_SESSION['dol_login'])) {
83 $user->fetch('',$_SESSION['dol_login']);
84 $user->getrights();
85}*/
86
87
88// Define css type
89header('Content-type: text/css');
90// Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access.
91// You can use CTRL+F5 to refresh your browser cache.
92if (empty($dolibarr_nocache)) {
93 header('Cache-Control: max-age=10800, public, must-revalidate');
94} else {
95 header('Cache-Control: no-cache');
96}
97
98?>
99
100div.mainmenu.mymodule::before {
101 content: "\f249";
102}
103div.mainmenu.mymodule {
104 background-image: none;
105}
106
107.myclasscss {
108 /* ... */
109}
110
111