dolibarr  9.0.0
login.tpl.php
1 <?php
2 /* Copyright (C) 2009-2015 Regis Houssin <regis.houssin@inodbox.com>
3  * Copyright (C) 2011-2013 Laurent Destailleur <eldy@users.sourceforge.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 // Need global variable $title to be defined by caller (like dol_loginfunction)
20 // Caller can also set $morelogincontent = array(['options']=>array('js'=>..., 'table'=>...);
21 
22 
23 // Protection to avoid direct call of template
24 if (empty($conf) || ! is_object($conf))
25 {
26  print "Error, template page can't be called as URL";
27  exit;
28 }
29 
30 
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
32 
33 header('Cache-Control: Public, must-revalidate');
34 header("Content-type: text/html; charset=".$conf->file->character_set_client);
35 
36 if (GETPOST('dol_hide_topmenu')) $conf->dol_hide_topmenu=1;
37 if (GETPOST('dol_hide_leftmenu')) $conf->dol_hide_leftmenu=1;
38 if (GETPOST('dol_optimize_smallscreen')) $conf->dol_optimize_smallscreen=1;
39 if (GETPOST('dol_no_mouse_hover')) $conf->dol_no_mouse_hover=1;
40 if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1;
41 
42 // If we force to use jmobile, then we reenable javascript
43 if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1;
44 
45 $php_self = dol_escape_htmltag($_SERVER['PHP_SELF']);
46 $php_self.= dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'';
47 if (! preg_match('/mainmenu=/',$php_self)) $php_self.=(preg_match('/\?/',$php_self)?'&':'?').'mainmenu=home';
48 
49 // Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
50 $arrayofjs=array(
51  '/includes/jstz/jstz.min.js'.(empty($conf->dol_use_jmobile)?'':'?version='.urlencode(DOL_VERSION)),
52  '/core/js/dst.js'.(empty($conf->dol_use_jmobile)?'':'?version='.urlencode(DOL_VERSION))
53 );
54 $titleofloginpage=$langs->trans('Login').' @ '.$titletruedolibarrversion; // $titletruedolibarrversion is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page and find true dolibarr version.
55 
56 $disablenofollow=1;
57 if (! preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) $disablenofollow=0;
58 
59 print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow);
60 
61 
62 $colorbackhmenu1='60,70,100'; // topmenu
63 if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1=$colorbackhmenu1;
64 $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);
65 $colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
66 
67 ?>
68 <!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->
69 
70 <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='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>>
71 
72 <?php if (empty($conf->dol_use_jmobile)) { ?>
73 <script type="text/javascript">
74 $(document).ready(function () {
75  /* Set focus on correct field */
76  <?php if ($focus_element) { ?>$('#<?php echo $focus_element; ?>').focus(); <?php } ?> // Warning to use this only on visible element
77 });
78 </script>
79 <?php } ?>
80 
81 <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));"':'' ?>>
82 <div class="login_vertical_align">
83 
84 <form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
85 <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
86 <input type="hidden" name="loginfunction" value="loginfunction" />
87 <!-- Add fields to send local user information -->
88 <input type="hidden" name="tz" id="tz" value="" />
89 <input type="hidden" name="tz_string" id="tz_string" value="" />
90 <input type="hidden" name="dst_observed" id="dst_observed" value="" />
91 <input type="hidden" name="dst_first" id="dst_first" value="" />
92 <input type="hidden" name="dst_second" id="dst_second" value="" />
93 <input type="hidden" name="screenwidth" id="screenwidth" value="" />
94 <input type="hidden" name="screenheight" id="screenheight" value="" />
95 <input type="hidden" name="dol_hide_topmenu" id="dol_hide_topmenu" value="<?php echo $dol_hide_topmenu; ?>" />
96 <input type="hidden" name="dol_hide_leftmenu" id="dol_hide_leftmenu" value="<?php echo $dol_hide_leftmenu; ?>" />
97 <input type="hidden" name="dol_optimize_smallscreen" id="dol_optimize_smallscreen" value="<?php echo $dol_optimize_smallscreen; ?>" />
98 <input type="hidden" name="dol_no_mouse_hover" id="dol_no_mouse_hover" value="<?php echo $dol_no_mouse_hover; ?>" />
99 <input type="hidden" name="dol_use_jmobile" id="dol_use_jmobile" value="<?php echo $dol_use_jmobile; ?>" />
100 
101 
102 
103 <!-- Title with version -->
104 <div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
105 <?php
106 if ($disablenofollow) echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank">';
107 echo dol_escape_htmltag($title);
108 if ($disablenofollow) echo '</a>';
109 ?>
110 </div>
111 
112 
113 
114 <div class="login_table">
115 
116 <div id="login_line1">
117 
118 <div id="login_left">
119 <img alt="" src="<?php echo $urllogo; ?>" id="img_logo" />
120 </div>
121 
122 <br>
123 
124 <div id="login_right">
125 
126 <div class="tagtable left centpercent" title="<?php echo $langs->trans("EnterLoginDetail"); ?>">
127 
128 <!-- Login -->
129 <div class="trinputlogin">
130 <div class="tagtd nowraponall center valignmiddle tdinputlogin">
131 <?php if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?><label for="username" class="hidden"><?php echo $langs->trans("Login"); ?></label><?php } ?>
132 <!-- <span class="span-icon-user">-->
133 <span class="fa fa-user">
134 </span>
135 <input type="text" id="username" 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" />
136 </div>
137 </div>
138 
139 <!-- Password -->
140 <div class="trinputlogin">
141 <div class="tagtd nowraponall center valignmiddle tdinputlogin">
142 <?php if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?><label for="password" class="hidden"><?php echo $langs->trans("Password"); ?></label><?php } ?>
143 <!--<span class="span-icon-password">-->
144 <span class="fa fa-key">
145 </span>
146 <input id="password" placeholder="<?php echo $langs->trans("Password"); ?>" name="password" class="flat input-icon-password minwidth150" type="password" value="<?php echo dol_escape_htmltag($password); ?>" tabindex="2" autocomplete="<?php echo empty($conf->global->MAIN_LOGIN_ENABLE_PASSWORD_AUTOCOMPLETE)?'off':'on'; ?>" />
147 </div></div>
148 
149 <?php
150 if (! empty($morelogincontent)) {
151  if (is_array($morelogincontent)) {
152  foreach ($morelogincontent as $format => $option)
153  {
154  if ($format == 'table') {
155  echo '<!-- Option by hook -->';
156  echo $option;
157  }
158  }
159  }
160  else {
161  echo '<!-- Option by hook -->';
162  echo $morelogincontent;
163  }
164 }
165 
166 if ($captcha) {
167  // Add a variable param to force not using cache (jmobile)
168  $php_self = preg_replace('/[&\?]time=(\d+)/','',$php_self); // Remove param time
169  if (preg_match('/\?/',$php_self)) $php_self.='&time='.dol_print_date(dol_now(),'dayhourlog');
170  else $php_self.='?time='.dol_print_date(dol_now(),'dayhourlog');
171  // TODO: provide accessible captcha variants
172 ?>
173  <!-- Captcha -->
174  <div class="trinputlogin">
175  <div class="tagtd nowraponall none center valignmiddle tdinputlogin">
176 
177  <table class="login_table_securitycode centpercent">
178  <tr class="valignmiddle">
179  <td>
180  <span class="span-icon-security">
181  <input id="securitycode" placeholder="<?php echo $langs->trans("SecurityCode"); ?>" class="flat input-icon-security width100" type="text" maxlength="5" name="code" tabindex="3" />
182  </span>
183  </td>
184  <td><img src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" /></td>
185  <td><a href="<?php echo $php_self; ?>" tabindex="4" data-role="button"><?php echo $captcha_refresh; ?></a></td>
186  </tr>
187  </table>
188 
189  </div></div>
190 <?php } ?>
191 
192 </div>
193 
194 </div> <!-- end div login_right -->
195 
196 </div> <!-- end div login_line1 -->
197 
198 
199 <div id="login_line2" style="clear: both">
200 
201 <!-- Button Connection -->
202 <br><input type="submit" class="button" value="&nbsp; <?php echo $langs->trans('Connection'); ?> &nbsp;" tabindex="5" />
203 
204 <?php
205 if ($forgetpasslink || $helpcenterlink)
206 {
207  $moreparam='';
208  if ($dol_hide_topmenu) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$dol_hide_topmenu;
209  if ($dol_hide_leftmenu) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_leftmenu='.$dol_hide_leftmenu;
210  if ($dol_no_mouse_hover) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$dol_no_mouse_hover;
211  if ($dol_use_jmobile) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$dol_use_jmobile;
212 
213  echo '<br>';
214  echo '<div class="center" style="margin-top: 15px;">';
215  if ($forgetpasslink) {
216  $url=DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam;
217  if (! empty($conf->global->MAIN_PASSWORD_FORGOTLINK)) $url=$conf->global->MAIN_PASSWORD_FORGOTLINK;
218  echo '<a class="alogin" href="'.dol_escape_htmltag($url).'">';
219  echo $langs->trans('PasswordForgotten');
220  echo '</a>';
221  }
222 
223  if ($forgetpasslink && $helpcenterlink) echo '&nbsp;-&nbsp;';
224 
225  if ($helpcenterlink) {
226  $url=DOL_URL_ROOT.'/support/index.php'.$moreparam;
227  if (! empty($conf->global->MAIN_HELPCENTER_LINKTOUSE)) $url=$conf->global->MAIN_HELPCENTER_LINKTOUSE;
228  echo '<a class="alogin" href="'.dol_escape_htmltag($url).'" target="_blank">';
229  echo $langs->trans('NeedHelpCenter');
230  echo '</a>';
231  }
232  echo '</div>';
233 }
234 
235 if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file->main_authentication))
236 {
237  $langs->load("users");
238 
239  //if (! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $url=
240  echo '<br>';
241  echo '<div class="center" style="margin-top: 4px;">';
242 
243  $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
244  if (! empty($url)) print '<a class="alogin" href="'.$url.'">'.$langs->trans("LoginUsingOpenID").'</a>';
245  else
246  {
247  $langs->load("errors");
248  print '<font class="warning">'.$langs->trans("ErrorOpenIDSetupNotComplete",'MAIN_AUTHENTICATION_OPENID_URL').'</font>';
249  }
250 
251  echo '</div>';
252 }
253 
254 
255 ?>
256 
257 </div> <!-- end login line 2 -->
258 
259 </div> <!-- end login table -->
260 
261 
262 </form>
263 
264 
265 <?php
266 // Show error message if defined
267 if (! empty($_SESSION['dol_loginmesg']))
268 {
269 ?>
270  <div class="center login_main_message"><div class="error">
271  <?php echo $_SESSION['dol_loginmesg']; ?>
272  </div></div>
273 <?php
274 }
275 
276 // Add commit strip
277 if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
278  include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
279  if (substr($langs->defaultlang,0,2)=='fr') {
280  $resgetcommitstrip = getURLContent("http://www.commitstrip.com/fr/feed/");
281  } else {
282  $resgetcommitstrip = getURLContent("http://www.commitstrip.com/en/feed/");
283  }
284  if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200')
285  {
286  $xml = simplexml_load_string($resgetcommitstrip['content']);
287  $little = $xml->channel->item[0]->children('content',true);
288  print preg_replace('/width="650" height="658"/', '', $little->encoded);
289  }
290 }
291 
292 ?>
293 
294 <?php if ($main_home)
295 {
296 ?>
297  <div class="center login_main_home paddingtopbottom <?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND)?'':' backgroundsemitransparent'; ?>" style="max-width: 70%">
298  <?php echo $main_home; ?>
299  </div><br>
300 <?php
301 }
302 ?>
303 
304 <!-- authentication mode = <?php echo $main_authentication ?> -->
305 <!-- cookie name used for this session = <?php echo $session_name ?> -->
306 <!-- urlfrom in this session = <?php echo isset($_SESSION["urlfrom"])?$_SESSION["urlfrom"]:''; ?> -->
307 
308 <!-- Common footer is not used for login page, this is same than footer but inside login tpl -->
309 
310 <?php
311 if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER;
312 
313 if (! empty($morelogincontent) && is_array($morelogincontent)) {
314  foreach ($morelogincontent as $format => $option)
315  {
316  if ($format == 'js') {
317  echo "\n".'<!-- Javascript by hook -->';
318  echo $option."\n";
319  }
320  }
321 }
322 else if (! empty($moreloginextracontent)) {
323  echo '<!-- Javascript by hook -->';
324  echo $moreloginextracontent;
325 }
326 
327 // Google Analytics (need Google module)
328 if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
329 {
330  if (empty($conf->dol_use_jmobile))
331  {
332  print "\n";
333  print '<script type="text/javascript">'."\n";
334  print ' var _gaq = _gaq || [];'."\n";
335  print ' _gaq.push([\'_setAccount\', \''.$conf->global->MAIN_GOOGLE_AN_ID.'\']);'."\n";
336  print ' _gaq.push([\'_trackPageview\']);'."\n";
337  print ''."\n";
338  print ' (function() {'."\n";
339  print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;'."\n";
340  print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';'."\n";
341  print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);'."\n";
342  print ' })();'."\n";
343  print '</script>'."\n";
344  }
345 }
346 
347 // Google Adsense
348 if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))
349 {
350  if (empty($conf->dol_use_jmobile))
351  {
352 ?>
353  <div class="center"><br>
354  <script type="text/javascript"><!--
355  google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
356  google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
357  google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
358  google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
359  //-->
360  </script>
361  <script type="text/javascript"
362  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
363  </script>
364  </div>
365 <?php
366  }
367 }
368 ?>
369 
370 
371 </div>
372 </div> <!-- end of center -->
373 
374 
375 </body>
376 </html>
377 <!-- END PHP TEMPLATE -->
print $object label
hash of file content (md5_file(dol_osencode($destfull))
Definition: edit.php:153
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
API that allows to log in with an user account.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:103
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value (&#39;FFFFFF&#39;, &#39;255,255,255&#39;) into an array RGB array(255,255,255).
type
Definition: viewcat.php:284
getURLContent($url, $postorget='GET', $param='', $followlocation=1, $addheaders=array())
Function get content from an URL (use proxy if proxy defined)
Definition: geturl.lib.php:34
dol_now($mode='gmt')
Return date for now.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0, $disablenofollow=0)
Ouput html header of a page.
Definition: main.inc.php:1172