diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 9e533aa8d85..799d40a1904 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -37,6 +37,15 @@ $langs->load("companies"); if (!$user->admin) accessforbidden(); +// Define size of logo small and mini +$maxwidthsmall=270;$maxheightsmall=150; +$maxwidthmini=128;$maxheightmini=72; +$quality = 80; + + +/* + * Actions + */ if ( (isset($_POST["action"]) && $_POST["action"] == 'update') || (isset($_POST["action"]) && $_POST["action"] == 'updateedit') ) @@ -71,12 +80,12 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update') { dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",$original_file,'chaine',0,'',$conf->entity); - // Create thumbs of logo + // Create thumbs of logo (Note that PDF use original file and not thumbs) if ($isimage > 0) { - $quality = 80; - - $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, 200, 100, '_small', $quality); + // Create small thumbs for company (Ratio is near 16/9) + // Used on logon for example + $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); if (preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg)) { $imgThumbSmall = $reg[1]; @@ -84,8 +93,9 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update') } else dol_syslog($imgThumbSmall); - // Creation de la vignette de la page "Societe/Institution" - $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, 100, 30, '_mini', $quality); + // Create mini thumbs for company (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); if (preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg)) { $imgThumbMini = $reg[1]; @@ -135,8 +145,9 @@ if ($_GET["action"] == 'addthumb') // Create thumbs of logo if ($isimage > 0) { - // Creation de la vignette de la page login - $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], 200, 100, '_small',80); + // Create small thumbs for company (Ratio is near 16/9) + // Used on logon for example + $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg)) { $imgThumbSmall = $reg[1]; @@ -144,8 +155,9 @@ if ($_GET["action"] == 'addthumb') } else dol_syslog($imgThumbSmall); - // Creation de la vignette de la page "Societe/Institution" - $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], 100, 30, '_mini',80); + // Create mini thumbs for company (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini',$quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg)) { $imgThumbMini = $reg[1]; diff --git a/htdocs/core/conf.class.php b/htdocs/core/conf.class.php index 49a8ed4bc4a..749c49a1134 100644 --- a/htdocs/core/conf.class.php +++ b/htdocs/core/conf.class.php @@ -334,7 +334,7 @@ class Conf // $this->theme et $this->css if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME="eldy"; $this->theme=$this->global->MAIN_THEME; - $this->css = "theme/".$this->theme."/".$this->theme.".css"; + $this->css = "/theme/".$this->theme."/".$this->theme.".css"; // $this->email_from = email pour envoi par dolibarr des mails automatiques $this->email_from = "dolibarr-robot@domain.com"; diff --git a/htdocs/core/templates/login.tpl.php b/htdocs/core/templates/login.tpl.php index b9c41bc4d55..0a55eb5f25a 100644 --- a/htdocs/core/templates/login.tpl.php +++ b/htdocs/core/templates/login.tpl.php @@ -33,7 +33,7 @@ header("Content-type: text/html; charset=".$conf->file->character_set_client); <?php echo $langs->trans('Login'); ?> - + '."\n"; - print ''."\n"; - if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER."\n"; - print ''."\n"; - print ''."\n"; - - // Body - print ''."\n\n"; - // Start Form - print '
'."\n"; - - // Token field - print ''; - - // Table 1 - print ''."\n";; - print ''."\n"; - print '
'.$title.'
'."\n"; - print '
'."\n\n"; - - // Table 2 - print ''."\n"; - - print ''."\n"; - - print ''; - - // Login field - print ''."\n"; - print ''."\n"; - // Show logo (search in order: small company logo, large company logo, theme logo, common logo) - $width=0; - $urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; - if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small); - } - elseif (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode($mysoc->logo); - $width=96; - } - elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')) - { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; - } - $rowspan = 2; - if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++; - print ''; - print ''."\n"; - - if (! empty($conf->browser->phone)) print ''; // More space with phones - - // Password field - print ''."\n"; - print ''."\n"; - - // Entity field - if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) - { - require_once(DOL_DOCUMENT_ROOT.'/multicompany/multicompany.class.php'); - - $mc = new Multicompany($db); - $mc->getEntities(); - - if (! empty($conf->browser->phone)) print ''; // More space with phones - - print ''."\n"; - print ''."\n"; - } - - // Security graphical code - if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) - { - //print "Info session: ".session_name().session_id();print_r($_SESSION); - print ''."\n"; - print ''; - print ''."\n"; - } - - print ''."\n"; - - print ''; - - if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) - { - if (! empty($conf->browser->phone)) print ''; // More space with phones - - print ''; - } - - print '
 
  '.$langs->trans("Login").'   '."\n"; - if (empty($conf->browser->phone)) - { - print 'Logo'; - } - print '
 
  '.$langs->trans("Password").'   '; - print '
 
  '.$langs->trans("Entity").'   '; - print $mc->select_entities($mc->entities,$lastentity,'tabindex="3"'); - print '
  '.$langs->trans("SecurityCode").''."\n"; - - print ''."\n"; // Force width to a small value - print ''."\n"; - $width=128;$height=36; - if (! empty($conf->browser->phone)) $width=64; $height=24; - print ''."\n"; - print ''."\n"; - print '
'.img_refresh().'
'."\n"; - - print '
 

'; - print ''; - print '
 
'; - - if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) - { - print '('; - print $langs->trans("PasswordForgotten"); - if (! empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) print ')'; - print ''; - } - - if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) - { - $langs->load("help"); - print ''; - if (! empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) print '('; - else print ' - '; - print $langs->trans("NeedHelpCenter"); - print ')'; - } - - print '
'."\n"; - - // Hidden fields - print ''."\n"; - - print '
'."\n"; - - // Message - if (! empty($_SESSION["dol_loginmesg"])) - { - print '
'; - print $_SESSION["dol_loginmesg"]; - $_SESSION["dol_loginmesg"]=""; - print '
'."\n"; - } - if (! empty($conf->global->MAIN_HOME)) - { - print '
browser->phone)?' width="750"':'').'>
'; - $i=0; - while (preg_match('/__\(([a-zA-Z]+)\)__/i',$conf->global->MAIN_HOME,$reg) && $i < 100) - { - $conf->global->MAIN_HOME=preg_replace('/__\('.$reg[1].'\)__/i',$langs->trans($reg[1]),$conf->global->MAIN_HOME); - $i++; - } - print nl2br($conf->global->MAIN_HOME); - print '

'."\n"; - } - - // Google Adsense (ex: demo mode) - if (! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT)) - { - print '
'."\n"; - print ''."\n"; - print ''."\n"; - print '
'."\n"; - } - - print "\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - - if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER."\n"; - - // Fin entete html - print "\n\n"; -} -*/ - /** * \brief Show Dolibarr default login page * \param langs Lang object @@ -369,8 +72,7 @@ function dol_loginfunction($langs,$conf,$mysoc) $template_dir=DOL_DOCUMENT_ROOT.'/core/templates/'; } - $conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; - $conf->css.=".php?lang=".$langs->defaultlang; + $conf->css = "/theme/".$conf->theme."/".$conf->theme.".css.php?lang=".$langs->defaultlang; } // Set cookie for timeout management @@ -440,7 +142,7 @@ function dol_loginfunction($langs,$conf,$mysoc) elseif (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.urlencode($mysoc->logo); - $width=96; + $width=128; } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png')) { @@ -497,13 +199,15 @@ function dol_loginfunction($langs,$conf,$mysoc) } } + $conf_css=DOL_URL_ROOT.$conf->css; + // START SMARTY if ($conf->global->MAIN_SMARTY) { global $smarty; - $smarty->assign('conf_css', DOL_URL_ROOT.'/'.$conf->css); + $smarty->assign('conf_css', $conf_css); $smarty->assign('langs', $langs); if (! empty($conf->global->MAIN_HTML_HEADER)) $smarty->assign('main_html_header', $conf->global->MAIN_HTML_HEADER); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 99f0ae54914..069a6d9814a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -567,7 +567,7 @@ if (! defined('NOLOGIN')) if (isset($user->conf->MAIN_THEME) && $user->conf->MAIN_THEME) { $conf->theme=$user->conf->MAIN_THEME; - $conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; + $conf->css = "/theme/".$conf->theme."/".$conf->theme.".css.php"; } // Set javascript option if (! empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) @@ -601,10 +601,10 @@ else // If language was forced on URL if (! empty($_GET["theme"])) { $conf->theme=$_GET["theme"]; - $conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; + $conf->css = "/theme/".$conf->theme."/".$conf->theme.".css.php"; } // Style sheet must be a php file -$conf->css.=".php"; +//$conf->css.=".php"; // Define menu manager to use if (empty($user->societe_id)) // Si utilisateur interne ou non defini @@ -701,7 +701,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs { global $user, $conf, $langs, $db; - if (empty($conf->css)) $conf->css = 'theme/eldy/eldy.css.php'; + if (empty($conf->css)) $conf->css = '/theme/eldy/eldy.css.php'; //header("Content-type: text/html; charset=UTF-8"); header("Content-type: text/html; charset=".$conf->file->character_set_client); @@ -729,8 +729,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print "\n"; // Output style sheets - print ''."\n"; - // CSS forced by modules + print ''."\n"; + // CSS forced by modules (relative url starting with /) if (is_array($conf->css_modules)) { foreach($conf->css_modules as $cssfile) @@ -738,12 +738,12 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; } } - // CSS forced by page (in top_htmlhead call) + // CSS forced by page in top_htmlhead call (relative url starting with /) if (is_array($arrayofcss)) { foreach($arrayofcss as $cssfile) { - print ''."\n"; + print ''."\n"; } } diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index f10860009e5..1bb0f0332da 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -93,7 +93,7 @@ define('DOL_MAIN_URL_ROOT', $dolibarr_main_url_root); // URL relative root $uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root); // $uri contains url without http* $suburi = strstr ($uri, '/'); // $suburi contains url without domain if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now '' -define('DOL_URL_ROOT', $suburi); // URL relative root ('/', '/dolibarr', ...) +define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) if (! empty($dolibarr_main_url_root_static)) define('DOL_URL_ROOT_FULL_STATIC', $dolibarr_main_url_root_static); // Used to put static images on another domain diff --git a/htdocs/paybox/paybox.lib.php b/htdocs/paybox/paybox.lib.php index 64f8e84e4d0..76bd636656f 100644 --- a/htdocs/paybox/paybox.lib.php +++ b/htdocs/paybox/paybox.lib.php @@ -29,9 +29,6 @@ function llxHeaderPaybox($title, $head = "") { global $user, $conf, $langs; - // Si feuille de style en php existe - if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php"; - header("Content-type: text/html; charset=".$conf->file->character_set_client); print ''; @@ -47,7 +44,7 @@ function llxHeaderPaybox($title, $head = "") if ($conf->global->PAYBOX_CSS_URL) print ''."\n"; else { - print ''."\n"; + print ''."\n"; print '