dolibarr 21.0.0-alpha
custom.css.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023-2024 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2023-2024 Lionel Vessiller <lvessiller@easya.solutions>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (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 General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26if (!defined('NOREQUIRESOC')) {
27 define('NOREQUIRESOC', '1');
28}
29
30if (!defined('NOCSRFCHECK')) {
31 define('NOCSRFCHECK', 1);
32}
33if (!defined('NOTOKENRENEWAL')) {
34 define('NOTOKENRENEWAL', 1);
35}
36if (!defined('NOLOGIN')) {
37 define('NOLOGIN', 1); // File must be accessed by logon page so without login.
38}
39if (!defined('NOREQUIREHTML')) {
40 define('NOREQUIREHTML', 1);
41}
42if (!defined('NOREQUIREAJAX')) {
43 define('NOREQUIREAJAX', '1');
44}
45
46session_cache_limiter('public');
47
48if (!defined('MAIN_INC_REL_DIR')) {
49 define('MAIN_INC_REL_DIR', '../../');
50}
51require_once __DIR__.'/../../webportal.main.inc.php';
52dol_include_once('/webportal/class/webPortalTheme.class.php');
53
54// Define css type
55top_httphead('text/css');
56/*
57header("Content-Type: text/css");
58header("X-Content-Type-Options: nosniff");
59header("X-Frame-Options: SAMEORIGIN");
60*/
61// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
62if (empty($dolibarr_nocache)) {
63 header('Cache-Control: max-age=10800, public, must-revalidate');
64} else {
65 header('Cache-Control: no-cache');
66}
67
68$webPortalTheme = new WebPortalTheme();
69
70?>
71[data-theme="custom"], :root{
72 --primary-color-hue: <?php print $webPortalTheme->primaryColorHsl['h']; ?>;
73 --primary-color-saturation: <?php print $webPortalTheme->primaryColorHsl['s']; ?>%;
74 --primary-color-lightness: <?php print $webPortalTheme->primaryColorHsl['l']; ?>%;
75 --banner-background: url(<?php print !empty($webPortalTheme->bannerBackground) ? $webPortalTheme->bannerBackground : '../img/banner.svg' ?>);
76}
77
78.login-page {
79 <?php
80 if (!empty($webPortalTheme->loginBackground)) {
81 print '--login-background: rgba(0, 0, 0, 0.4) url("'.$webPortalTheme->loginBackground.'");'."\n";
82 }
83
84 if (!empty($webPortalTheme->loginLogoUrl)) {
85 print '--login-logo: url("'.$webPortalTheme->loginLogoUrl.'"); /* for relative path, must be relative to the css file or use full url starting by http:// */'."\n";
86 }
87 ?>
88}
89<?php
90
91print '/* Here, the content of the common custom CSS defined into Home - Setup - Display - CSS */'."\n";
92print getDolGlobalString('WEBPORTAL_CUSTOM_CSS');
Class WebPortalTheme.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.