diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 250f5fabd65..405cb6feb75 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -168,7 +168,7 @@ if ($socid > 0) print "\n"; print ''; - // Nbre max d'�l�ments des petites listes + // Nbre max d'elements des petites listes $MAXLIST=5; $tableaushown=0; diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php index 7f76e7bbc9c..b76f659bd02 100644 --- a/htdocs/lib/security.lib.php +++ b/htdocs/lib/security.lib.php @@ -323,6 +323,308 @@ function dol_loginfunction($langs,$conf,$mysoc) print "\n\n"; } +/** + * \brief Show Dolibarr default login page + * \param langs Lang object + * \param conf Conf object + * \param mysoc Company object + * \remarks Test for smarty integration. + */ +function dol_loginfunction2($langs,$conf,$mysoc) +{ + $langcode=(empty($_GET["lang"])?'auto':$_GET["lang"]); + $langs->setDefaultLang($langcode); + + $langs->load("main"); + $langs->load("other"); + + if ($conf->browser->phone) + { + $conf->css = "theme/phones/".$conf->browser->phone."/iui.css"; + } + else + { + $conf->css = "theme/".$conf->theme."/".$conf->theme.".css"; + // Si feuille de style en php existe + if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php"; + } + + header('Cache-Control: Public, must-revalidate'); + header("Content-type: text/html; charset=".$conf->file->character_set_client); + + // Set cookie for timeout management + $sessiontimeout='DOLSESSTIMEOUT_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]); + if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", '', 0); + + if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"]; + else unset($_SESSION["urlfrom"]); + + // Ce DTD est OK + print ''."\n"; + + // En tete html + print "\n"; + print "\n"; + print ''."\n"; // Evite indexation par robots + print "".$langs->trans("Login")."\n"; + + print ''."\n"; + + print ''."\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 + $title='Dolibarr '.DOL_VERSION; + if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE; + print ''."\n";; + print ''."\n"; + print '
'.$title.'
'."\n"; + print '
'."\n\n"; + + // Table 2 + print ''."\n"; + + print ''."\n"; + + print ''; + + $demologin=''; + $demopassword=''; + global $dolibarr_main_demo; + if (! empty($dolibarr_main_demo)) + { + $tab=explode(',',$dolibarr_main_demo); + $demologin=$tab[0]; + $demopassword=$tab[1]; + } + + // Entity cookie + if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) + { + $lastuser = ''; + $lastentity = $_POST['entity']; + + if (! empty($conf->global->MAIN_MULTICOMPANY_COOKIE)) + { + $entityCookieName = 'DOLENTITYID_'.md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]); + if (isset($_COOKIE[$entityCookieName])) + { + include_once(DOL_DOCUMENT_ROOT . "/core/cookie.class.php"); + + $cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' ); + + $entityCookie = new DolCookie($cryptkey); + $cookieValue = $entityCookie->_getCookie($entityCookieName); + list($lastuser, $lastentity) = explode('|', $cookieValue); + } + } + } + + // 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'); + + global $db; + + $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)) + { + $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 Fonction pour initialiser un salt pour la fonction crypt