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