dolibarr  16.0.5
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.
26 if (!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')) {
31  define('NOCSRFCHECK', 1);
32 }
33 if (!defined('NOTOKENRENEWAL')) {
34  define('NOTOKENRENEWAL', 1);
35 }
36 if (!defined('NOLOGIN')) {
37  define('NOLOGIN', 1); // File must be accessed by logon page so without login
38 }
39 //if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
40 if (!defined('NOREQUIREHTML')) {
41  define('NOREQUIREHTML', 1);
42 }
43 if (!defined('NOREQUIREAJAX')) {
44  define('NOREQUIREAJAX', '1');
45 }
46 
47 session_cache_limiter('public');
48 // false or '' = keep cache instruction added by server
49 // 'public' = remove cache instruction added by server
50 // and if no cache-control added later, a default cache delay (10800) will be added by PHP.
51 
52 // Load Dolibarr environment
53 $res = 0;
54 // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
55 if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
56  $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
57 }
58 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
59 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
60 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
61  $i--; $j--;
62 }
63 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
64  $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
65 }
66 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/../main.inc.php")) {
67  $res = @include substr($tmp, 0, ($i + 1))."/../main.inc.php";
68 }
69 // Try main.inc.php using relative path
70 if (!$res && file_exists("../../main.inc.php")) {
71  $res = @include "../../main.inc.php";
72 }
73 if (!$res && file_exists("../../../main.inc.php")) {
74  $res = @include "../../../main.inc.php";
75 }
76 if (!$res) {
77  die("Include of main fails");
78 }
79 
80 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
81 
82 // 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
83 /*if (empty($user->id) && ! empty($_SESSION['dol_login'])) {
84  $user->fetch('',$_SESSION['dol_login']);
85  $user->getrights();
86 }*/
87 
88 
89 // Define css type
90 header('Content-type: text/css');
91 // Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access.
92 // You can use CTRL+F5 to refresh your browser cache.
93 if (empty($dolibarr_nocache)) {
94  header('Cache-Control: max-age=10800, public, must-revalidate');
95 } else {
96  header('Cache-Control: no-cache');
97 }
98 
99 ?>
100 
101 div.mainmenu.mymodule::before {
102  content: "\f249";
103 }
104 div.mainmenu.mymodule {
105  background-image: none;
106 }
107 
108 .myclasscss {
109  /* ... */
110 }
111 
112