diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index d9d734b8705..b868a847e9e 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -300,8 +300,9 @@ if ($action == 'update') { } if ($mode == 'css') { - $data = GETPOST('CUSTOM_CSS', 'none'); - file_put_contents(DOL_DATA_ROOT.'/admin/customcss.css', $data); + //file_put_contents(DOL_DATA_ROOT.'/admin/customcss.css', $data); + //dol_chmod(DOL_DATA_ROOT.'/admin/customcss.css'); + dolibarr_set_const($db, "MAIN_IHM_CUSTOM_CSS", GETPOST('MAIN_IHM_CUSTOM_CSS', 'restricthtml'), 'chaine', 0, '', $conf->entity); } $_SESSION["mainmenu"] = ""; // The menu manager may have changed @@ -310,7 +311,7 @@ if ($action == 'update') { dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity); } - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".'&mode='.$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOST('page_y', 'int') : '')); + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup&mode=".$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOST('page_y', 'int') : '')); exit; } @@ -698,9 +699,10 @@ if ($mode == 'css') { print ''; print ''; - $customcssValue = file_get_contents(DOL_DATA_ROOT.'/admin/customcss.css'); + //$customcssValue = file_get_contents(DOL_DATA_ROOT.'/admin/customcss.css'); + $customcssValue = getDolGlobalString('MAIN_IHM_CUSTOM_CSS'); - $doleditor = new DolEditor('CUSTOM_CSS', $customcssValue, '', 400, 'Basic', 'In', false, true, 'ace', 80, 80, 0); + $doleditor = new DolEditor('MAIN_IHM_CUSTOM_CSS', $customcssValue, '80%', 400, 'Basic', 'In', true, false, 'ace', 10, '90%'); $doleditor->Create(0, '', true, 'css', 'css'); print ''."\n"; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3a28077277e..323af1af532 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1786,9 +1786,11 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr } } - //customcss - print ''."\n"; - + // Custom CSS + if (getDolGlobalString('MAIN_IHM_CUSTOM_CSS')) { + // If a custom CSS was set, we add link to the custom css php file + print ''."\n"; + } // Output standard javascript links if (!defined('DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) { diff --git a/htdocs/theme/custom.css.php b/htdocs/theme/custom.css.php index 011d1624a3e..8caf1696f2f 100644 --- a/htdocs/theme/custom.css.php +++ b/htdocs/theme/custom.css.php @@ -30,6 +30,6 @@ if (empty($dolibarr_nocache)) { header('Cache-Control: no-cache'); } -if (file_exists(DOL_DATA_ROOT.'/admin/customcss.css')) { - readfile(DOL_DATA_ROOT.'/admin/customcss.css'); -} + +print '// Here, the content of the common custom CSS defined into Home - Setup - Display - CSS'."\n"; +print getDolGlobalString('MAIN_IHM_CUSTOM_CSS');