23 if (!defined(
'NOBROWSERNOTIF')) {
24 define(
'NOBROWSERNOTIF', 1);
28 if (empty($conf) || !is_object($conf)) {
29 print
"Error, template page can't be called as URL";
34 $size = (empty($_SERVER[
'CONTENT_LENGTH']) ? 0 : (int) $_SERVER[
'CONTENT_LENGTH']);
36 $langs->loadLangs(array(
"errors",
"install"));
37 httponly_accessforbidden(
'<center>'.$langs->trans(
"ErrorRequestTooLarge").
'.<br><a href="'.DOL_URL_ROOT.
'">'.$langs->trans(
"ClickHereToGoToApp").
'</a></center>', 413, 1);
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
43 header(
'Cache-Control: Public, must-revalidate');
44 header(
"Content-type: text/html; charset=".$conf->file->character_set_client);
46 if (
GETPOST(
'dol_hide_topmenu')) {
47 $conf->dol_hide_topmenu = 1;
49 if (
GETPOST(
'dol_hide_leftmenu')) {
50 $conf->dol_hide_leftmenu = 1;
52 if (
GETPOST(
'dol_optimize_smallscreen')) {
53 $conf->dol_optimize_smallscreen = 1;
55 if (
GETPOST(
'dol_no_mouse_hover')) {
56 $conf->dol_no_mouse_hover = 1;
58 if (
GETPOST(
'dol_use_jmobile')) {
59 $conf->dol_use_jmobile = 1;
63 if (!empty($conf->dol_use_jmobile)) {
64 $conf->use_javascript_ajax = 1;
68 $php_self .=
dol_escape_htmltag($_SERVER[
"QUERY_STRING"]) ?
'?'.dol_escape_htmltag($_SERVER[
"QUERY_STRING"]) :
'';
69 if (!preg_match(
'/mainmenu=/', $php_self)) {
70 $php_self .= (preg_match(
'/\?/', $php_self) ?
'&' :
'?').
'mainmenu=home';
72 if (preg_match(
'/'.preg_quote(
'core/modules/oauth',
'/').
'/', $php_self)) {
73 $php_self = DOL_URL_ROOT.
'/index.php?mainmenu=home';
75 $php_self = preg_replace(
'/(\?|&|&)action=[^&]+/',
'\1', $php_self);
76 $php_self = preg_replace(
'/(\?|&|&)massaction=[^&]+/',
'\1', $php_self);
77 $php_self = preg_replace(
'/(\?|&|&)token=[^&]+/',
'\1', $php_self);
81 '/includes/jstz/jstz.min.js'.(empty($conf->dol_use_jmobile) ?
'' :
'?version='.urlencode(DOL_VERSION)),
82 '/core/js/dst.js'.(empty($conf->dol_use_jmobile) ?
'' :
'?version='.urlencode(DOL_VERSION))
86 if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
87 $titleofloginpage = $conf->global->MAIN_APPLICATION_TITLE;
89 $titleofloginpage = $langs->trans(
'Login');
91 $titleofloginpage .=
' @ '.$titletruedolibarrversion;
94 if (!preg_match(
'/'.constant(
'DOL_APPLICATION_TITLE').
'/', $title)) {
97 if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
101 top_htmlhead(
'', $titleofloginpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow);
104 $colorbackhmenu1 =
'60,70,100';
105 if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) {
106 $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
108 $colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1);
111 print
"<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->\n";
113 if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
116 <body
class=
"body bodylogin" style=
"background-image: url('<?php echo dol_escape_htmltag($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND); ?>'); background-repeat: no-repeat; background-position: center center; background-attachment: fixed; background-size: cover; background-color: #ffffff;">
120 <body
class=
"body bodylogin"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND) ?
'' :
' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.
'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file=logos/'.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).
'\')
"'; ?>>
125 <?php if (empty($conf->dol_use_jmobile)) { ?>
127 $(document).ready(function () {
128 /* Set focus on correct field */
129 <?php if ($focus_element) {
130 ?>$('#<?php echo $focus_element; ?>').focus(); <?php
131 } ?> // Warning to use this only on visible element
136 <div class="login_center center
"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb(
'.$colorbackhmenu1.',0.3), rgb(240,240,240));
"' : '' ?>>
137 <div class="login_vertical_align
">
139 <form id="login
" name="login
" method="post
" action="<?php echo $php_self; ?>
">
141 <input type="hidden
" name="token
" value="<?php echo
newToken(); ?>
" />
142 <input type="hidden
" name="actionlogin
" value="login
">
143 <input type="hidden
" name="loginfunction
" value="loginfunction
" />
144 <input type="hidden
" name="backtopage
" value="<?php echo
GETPOST(
'backtopage'); ?>
" />
145 <!-- Add fields to store and send local user information. This fields are filled by the core/js/dst.js -->
146 <input type="hidden
" name="tz
" id="tz
" value="" />
147 <input type="hidden
" name="tz_string
" id="tz_string
" value="" />
148 <input type="hidden
" name="dst_observed
" id="dst_observed
" value="" />
149 <input type="hidden
" name="dst_first
" id="dst_first
" value="" />
150 <input type="hidden
" name="dst_second
" id="dst_second
" value="" />
151 <input type="hidden
" name="screenwidth
" id="screenwidth
" value="" />
152 <input type="hidden
" name="screenheight
" id="screenheight
" value="" />
153 <input type="hidden
" name="dol_hide_topmenu
" id="dol_hide_topmenu
" value="<?php echo $dol_hide_topmenu; ?>
" />
154 <input type="hidden
" name="dol_hide_leftmenu
" id="dol_hide_leftmenu
" value="<?php echo $dol_hide_leftmenu; ?>
" />
155 <input type="hidden
" name="dol_optimize_smallscreen
" id="dol_optimize_smallscreen
" value="<?php echo $dol_optimize_smallscreen; ?>
" />
156 <input type="hidden
" name="dol_no_mouse_hover
" id="dol_no_mouse_hover
" value="<?php echo $dol_no_mouse_hover; ?>
" />
157 <input type="hidden
" name="dol_use_jmobile
" id="dol_use_jmobile
" value="<?php echo $dol_use_jmobile; ?>
" />
161 <!-- Title with version -->
162 <div class="login_table_title center
" title="<?php echo
dol_escape_htmltag($title); ?>
">
164 if ($disablenofollow) {
165 echo '<a class="login_table_title
" href="https:
168 if ($disablenofollow) {
176 <div
class=
"login_table">
178 <div
id=
"login_line1">
180 <div
id=
"login_left">
181 <img alt=
"" src=
"<?php echo $urllogo; ?>" id=
"img_logo" />
186 <div
id=
"login_right">
188 <div
class=
"tagtable left centpercent" title=
"<?php echo $langs->trans("EnterLoginDetail
"); ?>">
191 <div
class=
"trinputlogin">
192 <div
class=
"tagtd nowraponall center valignmiddle tdinputlogin">
193 <?php
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
194 ?><label
for=
"username" class=
"hidden"><?php echo $langs->trans(
"Login"); ?></label><?php
196 <!-- <span
class=
"span-icon-user">-->
197 <span
class=
"fa fa-user"></span>
198 <input
type=
"text" id=
"username" maxlength=
"255" placeholder=
"<?php echo $langs->trans("Login"); ?>" name=
"username" class=
"flat input-icon-user minwidth150" value=
"<?php echo dol_escape_htmltag($login); ?>" tabindex=
"1" autofocus=
"autofocus" />
203 <div
class=
"trinputlogin">
204 <div
class=
"tagtd nowraponall center valignmiddle tdinputlogin">
205 <?php
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
206 ?><label
for=
"password" class=
"hidden"><?php echo $langs->trans(
"Password"); ?></label><?php
208 <!--<span
class=
"span-icon-password">-->
209 <span
class=
"fa fa-key"></span>
210 <input
type=
"password" id=
"password" maxlength=
"128" placeholder=
"<?php echo $langs->trans("Password
"); ?>" name=
"password" class=
"flat input-icon-password minwidth150" value=
"<?php echo dol_escape_htmltag($password); ?>" tabindex=
"2" autocomplete=
"<?php echo empty($conf->global->MAIN_LOGIN_ENABLE_PASSWORD_AUTOCOMPLETE) ? 'off' : 'on'; ?>" />
214 if (!empty($captcha)) {
216 $php_self = preg_replace(
'/[&\?]time=(\d+)/',
'', $php_self);
217 if (preg_match(
'/\?/', $php_self)) {
218 $php_self .=
'&time='.dol_print_date(
dol_now(),
'dayhourlog');
220 $php_self .=
'?time='.dol_print_date(
dol_now(),
'dayhourlog');
225 <div
class=
"trinputlogin">
226 <div
class=
"tagtd none valignmiddle tdinputlogin nowrap">
228 <span
class=
"fa fa-unlock"></span>
229 <span
class=
"span-icon-security inline-block">
230 <input
id=
"securitycode" placeholder=
"<?php echo $langs->trans("SecurityCode
"); ?>" class=
"flat input-icon-security width125" type=
"text" maxlength=
"5" name=
"code" tabindex=
"3" autocomplete=
"off" />
232 <span
class=
"nowrap inline-block">
233 <img
class=
"inline-block valignmiddle" src=
"<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border=
"0" width=
"80" height=
"32" id=
"img_securitycode" />
234 <a
class=
"inline-block valignmiddle" href=
"<?php echo $php_self; ?>" tabindex=
"4" data-role=
"button"><?php echo $captcha_refresh; ?></a>
241 if (!empty($morelogincontent)) {
242 if (is_array($morelogincontent)) {
243 foreach ($morelogincontent as $format => $option) {
244 if ($format ==
'table') {
245 echo
'<!-- Option by hook -->';
250 echo
'<!-- Option by hook -->';
251 echo $morelogincontent;
259 </div> <!-- end div login_right -->
261 </div> <!-- end div login_line1 -->
264 <div
id=
"login_line2" style=
"clear: both">
266 <!-- Button Connection -->
268 <div
id=
"login-submit-wrapper">
269 <input
type=
"submit" class=
"button" value=
" <?php echo $langs->trans('Connection'); ?> " tabindex=
"5" />
273 if ($forgetpasslink || $helpcenterlink) {
275 if ($dol_hide_topmenu) {
276 $moreparam .= (strpos($moreparam,
'?') ===
false ?
'?' :
'&').
'dol_hide_topmenu='.$dol_hide_topmenu;
278 if ($dol_hide_leftmenu) {
279 $moreparam .= (strpos($moreparam,
'?') ===
false ?
'?' :
'&').
'dol_hide_leftmenu='.$dol_hide_leftmenu;
281 if ($dol_no_mouse_hover) {
282 $moreparam .= (strpos($moreparam,
'?') ===
false ?
'?' :
'&').
'dol_no_mouse_hover='.$dol_no_mouse_hover;
284 if ($dol_use_jmobile) {
285 $moreparam .= (strpos($moreparam,
'?') ===
false ?
'?' :
'&').
'dol_use_jmobile='.$dol_use_jmobile;
289 echo
'<div class="center" style="margin-top: 5px;">';
290 if ($forgetpasslink) {
291 $url = DOL_URL_ROOT.
'/user/passwordforgotten.php'.$moreparam;
292 if (!empty($conf->global->MAIN_PASSWORD_FORGOTLINK)) {
293 $url = $conf->global->MAIN_PASSWORD_FORGOTLINK;
295 echo
'<a class="alogin" href="'.dol_escape_htmltag($url).
'">';
296 echo $langs->trans(
'PasswordForgotten');
300 if ($forgetpasslink && $helpcenterlink) {
301 echo
' - ';
304 if ($helpcenterlink) {
305 $url = DOL_URL_ROOT.
'/support/index.php'.$moreparam;
306 if (!empty($conf->global->MAIN_HELPCENTER_LINKTOUSE)) {
307 $url = $conf->global->MAIN_HELPCENTER_LINKTOUSE;
309 echo
'<a class="alogin" href="'.dol_escape_htmltag($url).
'" target="_blank" rel="noopener noreferrer">';
310 echo $langs->trans(
'NeedHelpCenter');
316 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication)) {
317 $langs->load(
"users");
321 echo
'<div class="center" style="margin-top: 4px;">';
323 $url = $conf->global->MAIN_AUTHENTICATION_OPENID_URL;
325 print
'<a class="alogin" href="'.$url.
'">'.$langs->trans(
"LoginUsingOpenID").
'</a>';
327 $langs->load(
"errors");
328 print
'<span class="warning">'.$langs->trans(
"ErrorOpenIDSetupNotComplete",
'MAIN_AUTHENTICATION_OPENID_URL').
'</span>';
334 if (isset($conf->file->main_authentication) && preg_match(
'/google/', $conf->file->main_authentication)) {
335 $langs->load(
"users");
337 global $dolibarr_main_url_root;
340 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
341 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
345 echo
'<div class="center" style="margin-top: 4px;">';
348 $shortscope =
'openid,email,profile';
350 $oauthstateanticsrf = bin2hex(random_bytes(128/8));
351 $_SESSION[
'oauthstateanticsrf'] = $shortscope.
'-'.$oauthstateanticsrf;
352 $urltorenew = $urlwithroot.
'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.
'&state=forlogin-'.$shortscope.
'-'.$oauthstateanticsrf;
356 print
img_picto(
'',
'google',
'class="pictofixedwidth"').
'<a class="alogin" href="'.$url.
'">'.$langs->trans(
"LoginWith",
"Google").
'</a>';
363 </div> <!-- end login line 2 -->
365 </div> <!-- end login table -->
373 if (!empty($_SESSION[
'dol_loginmesg'])) {
375 <div
class=
"center login_main_message">
377 $message = $_SESSION[
'dol_loginmesg'];
378 if (preg_match(
'/<!-- warning -->/', $message)) {
379 $message = str_replace(
'<!-- warning -->',
'', $message);
380 print
'<div class="warning">';
382 print
'<div class="error">';
392 if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
393 include_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
394 if (substr($langs->defaultlang, 0, 2) ==
'fr') {
395 $resgetcommitstrip =
getURLContent(
"https://www.commitstrip.com/fr/feed/");
397 $resgetcommitstrip =
getURLContent(
"https://www.commitstrip.com/en/feed/");
399 if ($resgetcommitstrip && $resgetcommitstrip[
'http_code'] ==
'200') {
400 $xml = simplexml_load_string($resgetcommitstrip[
'content'],
'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
401 $little = $xml->channel->item[0]->children(
'content',
true);
402 print preg_replace(
'/width="650" height="658"/',
'', $little->encoded);
408 <?php
if ($main_home) {
410 <div
class=
"center login_main_home paddingtopbottom <?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent boxshadow'; ?>" style=
"max-width: 70%">
411 <?php echo $main_home; ?>
417 <!-- authentication mode = <?php echo $main_authentication ?> -->
418 <!-- cookie
name used
for this session = <?php echo $session_name ?> -->
419 <!-- urlfrom in
this session = <?php echo isset($_SESSION[
"urlfrom"]) ? $_SESSION[
"urlfrom"] :
''; ?> -->
421 <!-- Common footer is not used
for login page,
this is same than footer but inside login tpl -->
424 if (!empty($conf->global->MAIN_HTML_FOOTER)) {
425 print $conf->global->MAIN_HTML_FOOTER;
428 if (!empty($morelogincontent) && is_array($morelogincontent)) {
429 foreach ($morelogincontent as $format => $option) {
430 if ($format ==
'js') {
431 echo
"\n".
'<!-- Javascript by hook -->';
435 } elseif (!empty($moreloginextracontent)) {
436 echo
'<!-- Javascript by hook -->';
437 echo $moreloginextracontent;
442 if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) {
443 $tmptagarray = explode(
',', $conf->global->MAIN_GOOGLE_AN_ID);
444 foreach ($tmptagarray as $tmptag) {
446 print
"<!-- JS CODE TO ENABLE for google analtics tag -->\n";
448 <!-- Global site tag (gtag.js) - Google Analytics -->
449 <script async src=\"https://www.googletagmanager.com/gtag/js?id=".trim($tmptag).
"\"></script>
451 window.dataLayer = window.dataLayer || [];
452 function gtag(){dataLayer.push(arguments);}
453 gtag('js', new Date());
455 gtag('config', '".trim($tmptag).
"');
463 if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {
464 if (empty($conf->dol_use_jmobile)) {
466 <div
class=
"center"><br>
468 google_ad_client =
"<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
469 google_ad_slot =
"<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
470 google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
471 google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
474 <script src=
"//pagead2.googlesyndication.com/pagead/show_ads.js"></script>
483 </div><!-- end of center -->
488 <!-- END PHP TEMPLATE -->
API that allows to log in with an user account.
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getURLContent($url, $postorget='GET', $param='', $followlocation=1, $addheaders=array(), $allowedschemes=array('http', 'https'), $localurl=0, $ssl_verifypeer=-1)
Function to get a content from an URL (use proxy if proxy defined).
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.