forked from Wavyzz/dolibarr
Test: smarty integration and iphone template
This commit is contained in:
@@ -168,7 +168,7 @@ if ($socid > 0)
|
||||
print "</td>\n";
|
||||
print '<td valign="top" width="50%" class="notopnoleft">';
|
||||
|
||||
// Nbre max d'<EFBFBD>l<EFBFBD>ments des petites listes
|
||||
// Nbre max d'elements des petites listes
|
||||
$MAXLIST=5;
|
||||
$tableaushown=0;
|
||||
|
||||
|
||||
@@ -323,6 +323,308 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
||||
print "\n</body>\n</html>";
|
||||
}
|
||||
|
||||
/**
|
||||
* \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 '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
|
||||
|
||||
// En tete html
|
||||
print "<html>\n";
|
||||
print "<head>\n";
|
||||
print '<meta name="robots" content="noindex,nofollow">'."\n"; // Evite indexation par robots
|
||||
print "<title>".$langs->trans("Login")."</title>\n";
|
||||
|
||||
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/'.$conf->css.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
|
||||
print '<style type="text/css">'."\n";
|
||||
print '<!--'."\n";
|
||||
print '#login {';
|
||||
print ' margin-top: '.(empty($conf->browser->phone)?'70px;':'10px;');
|
||||
print ' margin-bottom: '.(empty($conf->browser->phone)?'30px;':'5px;');
|
||||
print ' text-align: center;';
|
||||
print ' font: 12px arial,helvetica;';
|
||||
print '}'."\n";
|
||||
print '#login table {';
|
||||
if (empty($conf->browser->phone)) print ' width: 498px;';
|
||||
print ' border: 1px solid #C0C0C0;';
|
||||
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
|
||||
{
|
||||
print 'background: #F0F0F0 url('.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png) repeat-x;';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'background: #F0F0F0 url('.DOL_URL_ROOT.'/theme/login_background.png) repeat-x;';
|
||||
}
|
||||
print 'font-size: 12px;';
|
||||
print '}'."\n";
|
||||
print '-->'."\n";
|
||||
print '</style>'."\n";
|
||||
print '<script type="text/javascript">'."\n";
|
||||
print "function donnefocus() {\n";
|
||||
if (! $_REQUEST["username"]) print "document.getElementById('username').focus();\n";
|
||||
else print "document.getElementById('password').focus();\n";
|
||||
print "}\n";
|
||||
print '</script>'."\n";
|
||||
if (! empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER."\n";
|
||||
print '<!-- HTTP_USER_AGENT = '.$_SERVER["HTTP_USER_AGENT"].' -->'."\n";
|
||||
print '</head>'."\n";
|
||||
|
||||
// Body
|
||||
print '<body class="body" onload="donnefocus();">'."\n\n";
|
||||
// Start Form
|
||||
print '<form id="login" name="login" method="post" action="';
|
||||
print $_SERVER['PHP_SELF'];
|
||||
print $_SERVER["QUERY_STRING"]?'?'.$_SERVER["QUERY_STRING"]:'';
|
||||
print '">'."\n";
|
||||
|
||||
// Token field
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
// Table 1
|
||||
$title='Dolibarr '.DOL_VERSION;
|
||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
|
||||
print '<table class="login" summary="'.$title.'" cellpadding="0" cellspacing="0" border="0" align="center">'."\n";;
|
||||
print '<tr class="vmenu"><td align="center">'.$title.'</td></tr>'."\n";
|
||||
print '</table>'."\n";
|
||||
print '<br>'."\n\n";
|
||||
|
||||
// Table 2
|
||||
print '<table class="login" summary="Login area" cellpadding="2" align="center">'."\n";
|
||||
|
||||
print '<tr><td colspan="3"> </td></tr>'."\n";
|
||||
|
||||
print '<tr>';
|
||||
|
||||
$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 '<td valign="bottom"> <b>'.$langs->trans("Login").'</b> </td>'."\n";
|
||||
print '<td valign="bottom" nowrap="nowrap"><input type="text" id="username" name="username" class="flat" size="15" maxlength="25" value="';
|
||||
print (!empty($lastuser)?$lastuser:(isset($_REQUEST["username"])?$_REQUEST["username"]:$demologin));
|
||||
print '" tabindex="1" /></td>'."\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 '<td rowspan="'.$rowspan.'" align="center" valign="top">'."\n";
|
||||
if (empty($conf->browser->phone))
|
||||
{
|
||||
print '<img alt="Logo" title="" src="'.$urllogo.'"';
|
||||
if ($width) print ' width="'.$width.'"';
|
||||
print '>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
if (! empty($conf->browser->phone)) print '<tr><td colspan="3"> </td></tr>'; // More space with phones
|
||||
|
||||
// Password field
|
||||
print '<tr><td valign="top" nowrap="nowrap"> <b>'.$langs->trans("Password").'</b> </td>'."\n";
|
||||
print '<td valign="top" nowrap="nowrap"><input id="password" name="password" class="flat" type="password" size="15" maxlength="30" value="';
|
||||
print $demopassword;
|
||||
print '" tabindex="2">';
|
||||
print '</td></tr>'."\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 '<tr><td colspan="3"> </td></tr>'; // More space with phones
|
||||
|
||||
print '<tr><td valign="top" nowrap="nowrap"> <b>'.$langs->trans("Entity").'</b> </td>'."\n";
|
||||
print '<td valign="top" nowrap="nowrap">';
|
||||
print $mc->select_entities($mc->entities,$lastentity,'tabindex="3"');
|
||||
print '</td></tr>'."\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 '<tr><td valign="middle" nowrap="nowrap"> <b>'.$langs->trans("SecurityCode").'</b></td>'."\n";
|
||||
print '<td valign="top" nowrap="nowrap" align="left" class="none">'."\n";
|
||||
|
||||
print '<table style="width: 100px;"><tr>'."\n"; // Force width to a small value
|
||||
print '<td><input id="securitycode" class="flat" type="text" size="6" maxlength="5" name="code" tabindex="4"></td>'."\n";
|
||||
$width=128;$height=36;
|
||||
if (! empty($conf->browser->phone)) $width=64; $height=24;
|
||||
print '<td><img src="'.DOL_URL_ROOT.'/lib/antispamimage.php" border="0" width="'.$width.'" height="'.$height.'"></td>'."\n";
|
||||
print '<td><a href="'.$_SERVER["PHP_SELF"].'">'.img_refresh().'</a></td>'."\n";
|
||||
print '</tr></table>'."\n";
|
||||
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
print '<tr><td colspan="3"> </td></tr>'."\n";
|
||||
|
||||
print '<tr><td colspan="3" style="text-align:center;"><br>';
|
||||
print '<input type="submit" class="button" value=" '.$langs->trans("Connection").' " tabindex="5" />';
|
||||
print '</td></tr>';
|
||||
|
||||
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
|
||||
{
|
||||
if (! empty($conf->browser->phone)) print '<tr><td colspan="3"> </td></tr>'; // More space with phones
|
||||
|
||||
print '<tr><td colspan="3" align="center">';
|
||||
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
|
||||
{
|
||||
print '<a style="color: #888888; font-size: 10px" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php">(';
|
||||
print $langs->trans("PasswordForgotten");
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
|
||||
{
|
||||
$langs->load("help");
|
||||
print '<a style="color: #888888; font-size: 10px" href="'.DOL_URL_ROOT.'/support/index.php" target="_blank">';
|
||||
if (! empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) print '(';
|
||||
else print ' - ';
|
||||
print $langs->trans("NeedHelpCenter");
|
||||
}
|
||||
print ')</a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
// Hidden fields
|
||||
print '<input type="hidden" name="loginfunction" value="loginfunction" />'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
// Message
|
||||
if (! empty($_SESSION["dol_loginmesg"]))
|
||||
{
|
||||
print '<center><table width="60%"><tr><td align="center"><div class="error">';
|
||||
print $_SESSION["dol_loginmesg"];
|
||||
$_SESSION["dol_loginmesg"]="";
|
||||
print '</div></td></tr></table></center>'."\n";
|
||||
}
|
||||
if (! empty($conf->global->MAIN_HOME))
|
||||
{
|
||||
print '<center><table summary="info" cellpadding="0" cellspacing="0" border="0" align="center"'.(empty($conf->browser->phone)?' width="750"':'').'><tr><td align="center">';
|
||||
$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 '</td></tr></table></center><br>'."\n";
|
||||
}
|
||||
|
||||
// Google Adsense (ex: demo mode)
|
||||
if (! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))
|
||||
{
|
||||
print '<div align="center">'."\n";
|
||||
print '<script type="text/javascript"><!--'."\n";
|
||||
print 'google_ad_client = "'.$conf->global->MAIN_GOOGLE_AD_CLIENT.'";'."\n";
|
||||
print '/* '.$conf->global->MAIN_GOOGLE_AD_WIDTH.'x'.$conf->global->MAIN_GOOGLE_AD_HEIGHT.', '.$conf->global->MAIN_GOOGLE_AD_NAME.' */'."\n";
|
||||
print 'google_ad_slot = "'.$conf->global->MAIN_GOOGLE_AD_SLOT.'";'."\n";
|
||||
print 'google_ad_width = '.$conf->global->MAIN_GOOGLE_AD_WIDTH.';'."\n";
|
||||
print 'google_ad_height = '.$conf->global->MAIN_GOOGLE_AD_HEIGHT.';'."\n";
|
||||
print '//-->'."\n";
|
||||
print '</script>'."\n";
|
||||
print '<script type="text/javascript"'."\n";
|
||||
print 'src="http://pagead2.googlesyndication.com/pagead/show_ads.js">'."\n";
|
||||
print '</script>'."\n";
|
||||
print '</div>'."\n";
|
||||
}
|
||||
|
||||
print "\n";
|
||||
print '<!-- authentication mode = '.$conf->file->main_authentication.' -->'."\n";
|
||||
print '<!-- cookie name used for this session = '.session_name().' -->'."\n";
|
||||
print '<!-- urlfrom in this session = '.(isset($_SESSION["urlfrom"])?$_SESSION["urlfrom"]:'').' -->'."\n";
|
||||
|
||||
if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER."\n";
|
||||
|
||||
// Fin entete html
|
||||
print "\n</body>\n</html>";
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction pour initialiser un salt pour la fonction crypt
|
||||
|
||||
Reference in New Issue
Block a user