login.tpl.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. <?php
  2. /* Copyright (C) 2009-2015 Regis Houssin <regis.houssin@inodbox.com>
  3. * Copyright (C) 2011-2022 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 <https://www.gnu.org/licenses/>.
  17. */
  18. // Need global variable $urllogo, $title and $titletruedolibarrversion to be defined by caller (like dol_loginfunction in security2.lib.php)
  19. // Caller can also set $morelogincontent = array(['options']=>array('js'=>..., 'table'=>...);
  20. // $titletruedolibarrversion must be defined
  21. if (!defined('NOBROWSERNOTIF')) {
  22. define('NOBROWSERNOTIF', 1);
  23. }
  24. // Protection to avoid direct call of template
  25. if (empty($conf) || !is_object($conf)) {
  26. print "Error, template page can't be called as URL";
  27. exit;
  28. }
  29. // DDOS protection
  30. $size = (empty($_SERVER['CONTENT_LENGTH']) ? 0 : (int) $_SERVER['CONTENT_LENGTH']);
  31. if ($size > 10000) {
  32. $langs->loadLangs(array("errors", "install"));
  33. httponly_accessforbidden('<center>'.$langs->trans("ErrorRequestTooLarge").'.<br><a href="'.DOL_URL_ROOT.'">'.$langs->trans("ClickHereToGoToApp").'</a></center>', 413, 1);
  34. }
  35. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  36. header('Cache-Control: Public, must-revalidate');
  37. header("Content-type: text/html; charset=".$conf->file->character_set_client);
  38. if (GETPOST('dol_hide_topmenu')) {
  39. $conf->dol_hide_topmenu = 1;
  40. }
  41. if (GETPOST('dol_hide_leftmenu')) {
  42. $conf->dol_hide_leftmenu = 1;
  43. }
  44. if (GETPOST('dol_optimize_smallscreen')) {
  45. $conf->dol_optimize_smallscreen = 1;
  46. }
  47. if (GETPOST('dol_no_mouse_hover')) {
  48. $conf->dol_no_mouse_hover = 1;
  49. }
  50. if (GETPOST('dol_use_jmobile')) {
  51. $conf->dol_use_jmobile = 1;
  52. }
  53. // If we force to use jmobile, then we reenable javascript
  54. if (!empty($conf->dol_use_jmobile)) {
  55. $conf->use_javascript_ajax = 1;
  56. }
  57. $php_self = empty($php_self) ? dol_escape_htmltag($_SERVER['PHP_SELF']) : $php_self;
  58. $php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '';
  59. if (!preg_match('/mainmenu=/', $php_self)) {
  60. $php_self .= (preg_match('/\?/', $php_self) ? '&' : '?').'mainmenu=home';
  61. }
  62. if (preg_match('/'.preg_quote('core/modules/oauth', '/').'/', $php_self)) {
  63. $php_self = DOL_URL_ROOT.'/index.php?mainmenu=home';
  64. }
  65. $php_self = preg_replace('/(\?|&amp;|&)action=[^&]+/', '\1', $php_self);
  66. $php_self = preg_replace('/(\?|&amp;|&)massaction=[^&]+/', '\1', $php_self);
  67. $php_self = preg_replace('/(\?|&amp;|&)token=[^&]+/', '\1', $php_self);
  68. // Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
  69. $arrayofjs = array(
  70. '/includes/jstz/jstz.min.js'.(empty($conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION)),
  71. '/core/js/dst.js'.(empty($conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION))
  72. );
  73. // We display application title instead Login term
  74. if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
  75. $titleofloginpage = $conf->global->MAIN_APPLICATION_TITLE;
  76. } else {
  77. $titleofloginpage = $langs->trans('Login');
  78. }
  79. $titleofloginpage .= ' @ '.$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.
  80. $disablenofollow = 1;
  81. if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) {
  82. $disablenofollow = 0;
  83. }
  84. if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
  85. $disablenofollow = 0;
  86. }
  87. top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow);
  88. $colorbackhmenu1 = '60,70,100'; // topmenu
  89. if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) {
  90. $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
  91. }
  92. $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);
  93. $colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z'
  94. print "<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->\n";
  95. if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
  96. // For example $conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND = 'https://source.unsplash.com/random'
  97. ?>
  98. <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;">
  99. <?php
  100. } else {
  101. ?>
  102. <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).'\')"'; ?>>
  103. <?php
  104. }
  105. ?>
  106. <?php if (empty($conf->dol_use_jmobile)) { ?>
  107. <script>
  108. $(document).ready(function () {
  109. /* Set focus on correct field */
  110. <?php if ($focus_element) {
  111. ?>$('#<?php echo $focus_element; ?>').focus(); <?php
  112. } ?> // Warning to use this only on visible element
  113. });
  114. </script>
  115. <?php } ?>
  116. <div class="login_center center"<?php
  117. if (empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
  118. $backstyle = 'background: linear-gradient('.($conf->browser->layout == 'phone' ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
  119. // old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
  120. $backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
  121. print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : '';
  122. }
  123. ?>>
  124. <div class="login_vertical_align">
  125. <form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
  126. <input type="hidden" name="token" value="<?php echo newToken(); ?>" />
  127. <input type="hidden" name="actionlogin" value="login">
  128. <input type="hidden" name="loginfunction" value="loginfunction" />
  129. <input type="hidden" name="backtopage" value="<?php echo GETPOST('backtopage'); ?>" />
  130. <!-- Add fields to store and send local user information. This fields are filled by the core/js/dst.js -->
  131. <input type="hidden" name="tz" id="tz" value="" />
  132. <input type="hidden" name="tz_string" id="tz_string" value="" />
  133. <input type="hidden" name="dst_observed" id="dst_observed" value="" />
  134. <input type="hidden" name="dst_first" id="dst_first" value="" />
  135. <input type="hidden" name="dst_second" id="dst_second" value="" />
  136. <input type="hidden" name="screenwidth" id="screenwidth" value="" />
  137. <input type="hidden" name="screenheight" id="screenheight" value="" />
  138. <input type="hidden" name="dol_hide_topmenu" id="dol_hide_topmenu" value="<?php echo $dol_hide_topmenu; ?>" />
  139. <input type="hidden" name="dol_hide_leftmenu" id="dol_hide_leftmenu" value="<?php echo $dol_hide_leftmenu; ?>" />
  140. <input type="hidden" name="dol_optimize_smallscreen" id="dol_optimize_smallscreen" value="<?php echo $dol_optimize_smallscreen; ?>" />
  141. <input type="hidden" name="dol_no_mouse_hover" id="dol_no_mouse_hover" value="<?php echo $dol_no_mouse_hover; ?>" />
  142. <input type="hidden" name="dol_use_jmobile" id="dol_use_jmobile" value="<?php echo $dol_use_jmobile; ?>" />
  143. <!-- Title with version -->
  144. <div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
  145. <?php
  146. if ($disablenofollow) {
  147. echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank" rel="noopener noreferrer external">';
  148. }
  149. echo dol_escape_htmltag($title);
  150. if ($disablenofollow) {
  151. echo '</a>';
  152. }
  153. ?>
  154. </div>
  155. <div class="login_table">
  156. <div id="login_line1">
  157. <div id="login_left">
  158. <img alt="" src="<?php echo $urllogo; ?>" id="img_logo" />
  159. </div>
  160. <br>
  161. <div id="login_right">
  162. <div class="tagtable left centpercent" title="<?php echo $langs->trans("EnterLoginDetail"); ?>">
  163. <!-- Login -->
  164. <div class="trinputlogin">
  165. <div class="tagtd nowraponall center valignmiddle tdinputlogin">
  166. <?php if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
  167. ?><label for="username" class="hidden"><?php echo $langs->trans("Login"); ?></label><?php
  168. } ?>
  169. <!-- <span class="span-icon-user">-->
  170. <span class="fa fa-user"></span>
  171. <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" />
  172. </div>
  173. </div>
  174. <!-- Password -->
  175. <div class="trinputlogin">
  176. <div class="tagtd nowraponall center valignmiddle tdinputlogin">
  177. <?php if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
  178. ?><label for="password" class="hidden"><?php echo $langs->trans("Password"); ?></label><?php
  179. } ?>
  180. <!--<span class="span-icon-password">-->
  181. <span class="fa fa-key"></span>
  182. <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'; ?>" />
  183. </div></div>
  184. <?php
  185. if (!empty($captcha)) {
  186. // Add a variable param to force not using cache (jmobile)
  187. $php_self = preg_replace('/[&\?]time=(\d+)/', '', $php_self); // Remove param time
  188. if (preg_match('/\?/', $php_self)) {
  189. $php_self .= '&time='.dol_print_date(dol_now(), 'dayhourlog');
  190. } else {
  191. $php_self .= '?time='.dol_print_date(dol_now(), 'dayhourlog');
  192. }
  193. // TODO: provide accessible captcha variants
  194. ?>
  195. <!-- Captcha -->
  196. <div class="trinputlogin">
  197. <div class="tagtd none valignmiddle tdinputlogin nowrap">
  198. <span class="fa fa-unlock"></span>
  199. <span class="span-icon-security inline-block">
  200. <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" />
  201. </span>
  202. <span class="nowrap inline-block">
  203. <img class="inline-block valignmiddle" src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />
  204. <a class="inline-block valignmiddle" href="<?php echo $php_self; ?>" tabindex="4" data-role="button"><?php echo $captcha_refresh; ?></a>
  205. </span>
  206. </div></div>
  207. <?php
  208. }
  209. if (!empty($morelogincontent)) {
  210. if (is_array($morelogincontent)) {
  211. foreach ($morelogincontent as $format => $option) {
  212. if ($format == 'table') {
  213. echo '<!-- Option by hook -->';
  214. echo $option;
  215. }
  216. }
  217. } else {
  218. echo '<!-- Option by hook -->';
  219. echo $morelogincontent;
  220. }
  221. }
  222. ?>
  223. </div>
  224. </div> <!-- end div login_right -->
  225. </div> <!-- end div login_line1 -->
  226. <div id="login_line2" style="clear: both">
  227. <!-- Button Connection -->
  228. <br>
  229. <div id="login-submit-wrapper">
  230. <input type="submit" class="button" value="&nbsp; <?php echo $langs->trans('Connection'); ?> &nbsp;" tabindex="5" />
  231. </div>
  232. <?php
  233. if ($forgetpasslink || $helpcenterlink) {
  234. $moreparam = '';
  235. if ($dol_hide_topmenu) {
  236. $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_hide_topmenu='.$dol_hide_topmenu;
  237. }
  238. if ($dol_hide_leftmenu) {
  239. $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_hide_leftmenu='.$dol_hide_leftmenu;
  240. }
  241. if ($dol_no_mouse_hover) {
  242. $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_no_mouse_hover='.$dol_no_mouse_hover;
  243. }
  244. if ($dol_use_jmobile) {
  245. $moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_use_jmobile='.$dol_use_jmobile;
  246. }
  247. echo '<br>';
  248. echo '<div class="center" style="margin-top: 5px;">';
  249. if ($forgetpasslink) {
  250. $url = DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam;
  251. if (!empty($conf->global->MAIN_PASSWORD_FORGOTLINK)) {
  252. $url = $conf->global->MAIN_PASSWORD_FORGOTLINK;
  253. }
  254. echo '<a class="alogin" href="'.dol_escape_htmltag($url).'">';
  255. echo $langs->trans('PasswordForgotten');
  256. echo '</a>';
  257. }
  258. if ($forgetpasslink && $helpcenterlink) {
  259. echo '&nbsp;-&nbsp;';
  260. }
  261. if ($helpcenterlink) {
  262. $url = DOL_URL_ROOT.'/support/index.php'.$moreparam;
  263. if (!empty($conf->global->MAIN_HELPCENTER_LINKTOUSE)) {
  264. $url = $conf->global->MAIN_HELPCENTER_LINKTOUSE;
  265. }
  266. echo '<a class="alogin" href="'.dol_escape_htmltag($url).'" target="_blank" rel="noopener noreferrer">';
  267. echo $langs->trans('NeedHelpCenter');
  268. echo '</a>';
  269. }
  270. echo '</div>';
  271. }
  272. if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->file->main_authentication)) {
  273. $langs->load("users");
  274. //if (!empty($conf->global->MAIN_OPENIDURL_PERUSER)) $url=
  275. echo '<br>';
  276. echo '<div class="center" style="margin-top: 4px;">';
  277. $url = $conf->global->MAIN_AUTHENTICATION_OPENID_URL;
  278. if (!empty($url)) {
  279. print '<a class="alogin" href="'.$url.'">'.$langs->trans("LoginUsingOpenID").'</a>';
  280. } else {
  281. $langs->load("errors");
  282. print '<span class="warning">'.$langs->trans("ErrorOpenIDSetupNotComplete", 'MAIN_AUTHENTICATION_OPENID_URL').'</span>';
  283. }
  284. echo '</div>';
  285. }
  286. if (isset($conf->file->main_authentication) && preg_match('/google/', $conf->file->main_authentication)) {
  287. $langs->load("users");
  288. global $dolibarr_main_url_root;
  289. // Define $urlwithroot
  290. $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
  291. $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
  292. //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
  293. echo '<br>';
  294. echo '<div class="center" style="margin-top: 4px;">';
  295. //$shortscope = 'userinfo_email,userinfo_profile';
  296. $shortscope = 'openid,email,profile'; // For openid connect
  297. $oauthstateanticsrf = bin2hex(random_bytes(128/8));
  298. $_SESSION['oauthstateanticsrf'] = $shortscope.'-'.$oauthstateanticsrf;
  299. $urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state=forlogin-'.$shortscope.'-'.$oauthstateanticsrf;
  300. $url = $urltorenew;
  301. print img_picto('', 'google', 'class="pictofixedwidth"').'<a class="alogin" href="'.$url.'">'.$langs->trans("LoginWith", "Google").'</a>';
  302. echo '</div>';
  303. }
  304. ?>
  305. </div> <!-- end login line 2 -->
  306. </div> <!-- end login table -->
  307. </form>
  308. <?php
  309. // Show error message if defined
  310. if (!empty($_SESSION['dol_loginmesg'])) {
  311. ?>
  312. <div class="center login_main_message">
  313. <?php
  314. $message = $_SESSION['dol_loginmesg']; // By default this is an error message
  315. if (preg_match('/<!-- warning -->/', $message)) { // if it contains this comment, this is a warning message
  316. $message = str_replace('<!-- warning -->', '', $message);
  317. print '<div class="warning">';
  318. } else {
  319. print '<div class="error">';
  320. }
  321. print dol_escape_htmltag($message);
  322. print '</div>';
  323. ?>
  324. </div>
  325. <?php
  326. }
  327. // Add commit strip
  328. if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
  329. include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
  330. if (substr($langs->defaultlang, 0, 2) == 'fr') {
  331. $resgetcommitstrip = getURLContent("https://www.commitstrip.com/fr/feed/");
  332. } else {
  333. $resgetcommitstrip = getURLContent("https://www.commitstrip.com/en/feed/");
  334. }
  335. if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200') {
  336. $xml = simplexml_load_string($resgetcommitstrip['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
  337. $little = $xml->channel->item[0]->children('content', true);
  338. print preg_replace('/width="650" height="658"/', '', $little->encoded);
  339. }
  340. }
  341. ?>
  342. <?php if ($main_home) {
  343. ?>
  344. <div class="center login_main_home paddingtopbottom <?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent boxshadow'; ?>" style="max-width: 70%">
  345. <?php echo $main_home; ?>
  346. </div><br>
  347. <?php
  348. }
  349. ?>
  350. <!-- authentication mode = <?php echo $main_authentication ?> -->
  351. <!-- cookie name used for this session = <?php echo $session_name ?> -->
  352. <!-- urlfrom in this session = <?php echo isset($_SESSION["urlfrom"]) ? $_SESSION["urlfrom"] : ''; ?> -->
  353. <!-- Common footer is not used for login page, this is same than footer but inside login tpl -->
  354. <?php
  355. if (!empty($conf->global->MAIN_HTML_FOOTER)) {
  356. print $conf->global->MAIN_HTML_FOOTER;
  357. }
  358. if (!empty($morelogincontent) && is_array($morelogincontent)) {
  359. foreach ($morelogincontent as $format => $option) {
  360. if ($format == 'js') {
  361. echo "\n".'<!-- Javascript by hook -->';
  362. echo $option."\n";
  363. }
  364. }
  365. } elseif (!empty($moreloginextracontent)) {
  366. echo '<!-- Javascript by hook -->';
  367. echo $moreloginextracontent;
  368. }
  369. // Google Analytics
  370. // TODO Add a hook here
  371. if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) {
  372. $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID);
  373. foreach ($tmptagarray as $tmptag) {
  374. print "\n";
  375. print "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
  376. print "
  377. <!-- Global site tag (gtag.js) - Google Analytics -->
  378. <script async src=\"https://www.googletagmanager.com/gtag/js?id=".trim($tmptag)."\"></script>
  379. <script>
  380. window.dataLayer = window.dataLayer || [];
  381. function gtag(){dataLayer.push(arguments);}
  382. gtag('js', new Date());
  383. gtag('config', '".trim($tmptag)."');
  384. </script>";
  385. print "\n";
  386. }
  387. }
  388. // TODO Replace this with a hook
  389. // Google Adsense (need Google module)
  390. if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {
  391. if (empty($conf->dol_use_jmobile)) {
  392. ?>
  393. <div class="center"><br>
  394. <script><!--
  395. google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
  396. google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
  397. google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
  398. google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
  399. //-->
  400. </script>
  401. <script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>
  402. </div>
  403. <?php
  404. }
  405. }
  406. ?>
  407. </div>
  408. </div><!-- end of center -->
  409. </body>
  410. </html>
  411. <!-- END PHP TEMPLATE -->