diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index d3ad64871cc..80a0e39f5c4 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -169,8 +169,7 @@ class Conf $arrValue = json_decode($value,true); if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue; else if (in_array($partname,array('login','menus','substitutions','triggers','tpl'))) $value = '/'.$modulename.'/core/'.$partname.'/'; - else if (in_array($partname,array('theme'))) $value = '/'.$modulename.'/'.$partname.'/'; - else if (in_array($partname,array('models'))) $value = '/'.$modulename.'/'; + else if (in_array($partname,array('models','theme'))) $value = '/'.$modulename.'/'; else if (in_array($partname,array('sms'))) $value = $modulename; else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 0888c30c640..758300df73f 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -175,8 +175,21 @@ function dol_loginfunction($langs,$conf,$mysoc) } } - $conf->css = "/theme/".(GETPOST('theme')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php?lang=".$langs->defaultlang; - $conf_css = DOL_URL_ROOT.$conf->css; + // Note: $conf->css looks like '/theme/eldy/style.css.php' + $conf->css = "/theme/".(GETPOST('theme')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php"; + $themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1); + if (! empty($conf->modules_parts['theme'])) // This slow down + { + foreach($conf->modules_parts['theme'] as $reldir) + { + if (file_exists(dol_buildpath($reldir.$conf->css, 0))) + { + $themepath=dol_buildpath($reldir.$conf->css, 1); + break; + } + } + } + $conf_css = $themepath."?lang=".$langs->defaultlang; // Set cookie for timeout management $prefix=dol_getprefix(); diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index f4a61c4c3a3..f532901cab3 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -22,7 +22,7 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client); ?> - + file->character_set_client); ?> - + '."\n"; - // Output style sheets (optioncss='print' or '') + // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php' $themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1); + if (! empty($conf->modules_parts['theme'])) // This slow down + { + foreach($conf->modules_parts['theme'] as $reldir) + { + if (file_exists(dol_buildpath($reldir.$conf->css, 0))) + { + $themepath=dol_buildpath($reldir.$conf->css, 1); + break; + } + } + } $themeparam='?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):'').'&userid='.$user->id.'&entity='.$conf->entity; if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache']; - //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; + //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; print ''."\n"; // CSS forced by modules (relative url starting with /) - if (isset($conf->modules_parts['css'])) + if (! empty($conf->modules_parts['css'])) { $arraycss=(array) $conf->modules_parts['css']; foreach($arraycss as $modcss => $filescss) @@ -1078,7 +1089,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs } // JS forced by modules (relative url starting with /) - if (isset($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) + if (! empty($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) { $arrayjs=(array) $conf->modules_parts['js']; foreach($arrayjs as $modjs => $filesjs) diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 127a38b051b..2930a1cdc61 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -174,8 +174,21 @@ else } } -$conf->css = "/theme/".$conf->theme."/style.css.php?lang=".$langs->defaultlang; -$conf_css = DOL_URL_ROOT.$conf->css; +// Note: $conf->css looks like '/theme/eldy/style.css.php' +$conf->css = "/theme/".(GETPOST('theme')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php"; +$themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1); +if (! empty($conf->modules_parts['theme'])) // This slow down +{ + foreach($conf->modules_parts['theme'] as $reldir) + { + if (file_exists(dol_buildpath($reldir.$conf->css, 0))) + { + $themepath=dol_buildpath($reldir.$conf->css, 1); + break; + } + } +} +$conf_css = $themepath."?lang=".$langs->defaultlang; $jquerytheme = 'smoothness'; if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;