diff --git a/htdocs/core/templates/footer.tpl b/htdocs/core/templates/footer.tpl new file mode 100644 index 00000000000..3bce69570b9 --- /dev/null +++ b/htdocs/core/templates/footer.tpl @@ -0,0 +1,24 @@ +{* Copyright (C) 2009 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + *} + + + + + + \ No newline at end of file diff --git a/htdocs/core/templates/google_ad.tpl b/htdocs/core/templates/google_ad.tpl new file mode 100644 index 00000000000..a2c58cb7212 --- /dev/null +++ b/htdocs/core/templates/google_ad.tpl @@ -0,0 +1,34 @@ +{* Copyright (C) 2009 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + *} + + + + + + + \ No newline at end of file diff --git a/htdocs/core/templates/header.tpl b/htdocs/core/templates/header.tpl new file mode 100644 index 00000000000..3bce69570b9 --- /dev/null +++ b/htdocs/core/templates/header.tpl @@ -0,0 +1,24 @@ +{* Copyright (C) 2009 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + *} + + + + + + \ No newline at end of file diff --git a/htdocs/core/templates/login.tpl b/htdocs/core/templates/login.tpl new file mode 100644 index 00000000000..5ddf137f875 --- /dev/null +++ b/htdocs/core/templates/login.tpl @@ -0,0 +1,179 @@ +{* Copyright (C) 2009 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + *} +{php} + header('Cache-Control: Public, must-revalidate'); + header("Content-type: text/html; charset=".$conf->file->character_set_client); +{/php} + + + + + + + + +{$langs->trans('Login')} + + + + + + + + {if $main_html_header} + {$main_html_header} + {/if} + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + {if $entity} + + + {/if} + + {if $captcha} + + + {/if} + + + + + + {if $forgetpasslink || $helpcenterlink} + + {/if} + + + + + +
+ + {if $dol_loginmesg} +
+ {$dol_loginmesg} +
+ {/if} + + {if $main_home} +
+
+ {$main_home} +

+ {/if} + + {if $main_google_ad_client} +
+ {include file=$google_ad_tpl} +
+ {/if} + + + + + + {if $main_html_footer} + {$main_html_footer} + {/if} + + + + + \ No newline at end of file diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index a5d24f82b10..91aef4cba5c 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -339,14 +339,18 @@ function dol_loginfunction2($langs,$conf,$mysoc) $langs->load("main"); $langs->load("other"); + $langs->load("help"); $smarty->assign('langs', $langs); + if (! empty($conf->global->MAIN_HTML_HEADER)) $smarty->assign('main_html_header', $conf->global->MAIN_HTML_HEADER); + $php_self = $_SERVER['PHP_SELF']; $php_self.= $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:''; $smarty->assign('php_self', $php_self); - + + // Select templates if ($conf->browser->phone) { if (file_exists(DOL_DOCUMENT_ROOT."/theme/phones/".$conf->browser->phone)) @@ -357,20 +361,31 @@ function dol_loginfunction2($langs,$conf,$mysoc) { $smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/phones/other/default/templates/"; } + // Differencier les pages dans le cache + $cache_id = $conf->browser->phone; } else { + if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/login.tpl")) + { + $smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/"; + } + else + { + $smarty->template_dir = DOL_DOCUMENT_ROOT."/core/templates/"; + } + $conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; - $smarty->template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/templates/"; // Si feuille de style en php existe if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php?lang=".$langs->defaultlang; $smarty->assign('conf_css', DOL_URL_ROOT.'/'.$conf->css); + + // Differencier les pages dans le cache + $cache_id = $conf->theme; } - $smarty->assign('dol_url_root', DOL_URL_ROOT); - $smarty->assign('character_set_client', $conf->file->character_set_client); // Set cookie for timeout management $sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]); @@ -378,6 +393,18 @@ function dol_loginfunction2($langs,$conf,$mysoc) if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"]; else unset($_SESSION["urlfrom"]); + + if (! $_REQUEST["username"]) $smarty->assign('focus_element', 'username'); + else $smarty->assign('focus_element', 'password'); + + if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png')) + { + $smarty->assign('login_background', DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'); + } + else + { + $smarty->assign('login_background', DOL_URL_ROOT.'/theme/login_background.png'); + } // Title $title='Dolibarr '.DOL_VERSION; @@ -424,7 +451,9 @@ function dol_loginfunction2($langs,$conf,$mysoc) // Show logo (search in order: small company logo, large company logo, theme logo, common logo) $width=0; + $rowspan=2; $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); @@ -439,8 +468,11 @@ function dol_loginfunction2($langs,$conf,$mysoc) $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; } - $smarty->assign('logo_url', $urllogo); - $smarty->assign('login_width', $width); + if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $rowspan++; + + $smarty->assign('logo', $urllogo); + $smarty->assign('logo_width', $width); + $smarty->assign('logo_rowspan', $rowspan); // Entity field if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) @@ -459,53 +491,68 @@ function dol_loginfunction2($langs,$conf,$mysoc) if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { $smarty->assign('captcha', 1); + $smarty->assign('captcha_refresh', img_refresh()); } - -/* + + // Extra link if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK)) { - if (! empty($conf->browser->phone)) print ' '; // More space with phones - - print ''; if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { - print '('; - print $langs->trans("PasswordForgotten"); + $smarty->assign('forgetpasslink', 1); } 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"); + $smarty->assign('helpcenterlink', 1); } - print ')'; } -*/ - // Message + + // Error message if (! empty($_SESSION["dol_loginmesg"])) { $smarty->assign('dol_loginmesg', $_SESSION["dol_loginmesg"]); $_SESSION["dol_loginmesg"]=""; } -/* + + // Home message 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"; + $smarty->assign('main_home', nl2br($conf->global->MAIN_HOME)); } -*/ - $smarty->display('login.tpl'); + // Google Adsense (ex: demo mode) + if (! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT)) + { + $smarty->assign('main_google_ad_client', $conf->global->MAIN_GOOGLE_AD_CLIENT); + $smarty->assign('main_google_ad_name', $conf->global->MAIN_GOOGLE_AD_NAME); + $smarty->assign('main_google_ad_slot', $conf->global->MAIN_GOOGLE_AD_SLOT); + $smarty->assign('main_google_ad_width', $conf->global->MAIN_GOOGLE_AD_WIDTH); + $smarty->assign('main_google_ad_height', $conf->global->MAIN_GOOGLE_AD_HEIGHT); + + $google_ad_template = DOL_DOCUMENT_ROOT."/core/templates/google_ad.tpl"; + $smarty->assign('google_ad_tpl', $google_ad_template); + } + + if (! empty($conf->global->MAIN_HTML_FOOTER)) $smarty->assign('main_html_footer', $conf->global->MAIN_HTML_FOOTER); + + $smarty->assign('main_authentication', $conf->file->main_authentication); + $smarty->assign('session_name', session_name()); + + // Activation du cache + $smarty->caching = 1; + + // Creation et mise en cache du template avec un id + $smarty->display('login.tpl', $cache_id); + + // Suppression de la version compilee + $smarty->clear_compiled_tpl('login.tpl'); } diff --git a/htdocs/theme/phones/iphone/default/templates/login.tpl b/htdocs/theme/phones/iphone/default/templates/login.tpl index f25daba2df4..7023350c4d3 100644 --- a/htdocs/theme/phones/iphone/default/templates/login.tpl +++ b/htdocs/theme/phones/iphone/default/templates/login.tpl @@ -16,6 +16,10 @@ * * $Id$ *} +{php} + header('Cache-Control: Public, must-revalidate'); + header("Content-type: text/html; charset=".$conf->file->character_set_client); +{/php} @@ -43,7 +47,7 @@
- +