dolibarr 22.0.5
callback.php
1<?php
2/* Copyright (C) 2023 Maximilien Rozniecki <mrozniecki@easya.solutions>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
26define('NOLOGIN', '1');
27if (!defined('NOTOKENRENEWAL')) {
28 define('NOTOKENRENEWAL', '1');
29}
30
31require '../../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
33
39// Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
40$arrayofjs = array(
41 '/includes/jstz/jstz.min.js'.(empty($conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION)),
42 '/core/js/dst.js'.(empty($conf->dol_use_jmobile) ? '' : '?version='.urlencode(DOL_VERSION))
43);
44
45top_htmlhead('', '', 0, 0, $arrayofjs);
46
47$prefix = dol_getprefix('');
48
49$callbackUrl = $_COOKIE["DOL_rollback_url_".$prefix]; // Was set by login page to $_SERVER['REQUEST_URI'] to allow come back to initial requested page
50
51if (empty($callbackUrl) || !preg_match('/^\/[a-z0-9]/i', $callbackUrl)) {
52 // We accept only value that is an internal relative URL. URL starting with http are not allowed.
53 $callbackUrl = '/';
54}
55if ($callbackUrl === '/') {
56 $callbackUrl = $dolibarr_main_url_root . '/index.php?mainmenu=home&leftmenu=';
57} else {
58 dolSetCookie('DOL_rollback_url_'.dol_getprefix(''), "", time() + 1);
59}
60?>
61
62<form id="login" name="login" method="post" action="<?php echo dolPrintHTMLForAttributeUrl($callbackUrl); ?>">
63 <!-- Add fields to send OpenID information -->
64 <input type="hidden" name="openid_mode" value="true" />
65 <input type="hidden" name="state" value="<?php echo GETPOST('state'); ?>" />
66 <input type="hidden" name="session_state" value="<?php echo GETPOST('session_state'); ?>" />
67 <input type="hidden" name="code" value="<?php echo GETPOST('code'); ?>" />
68 <input type="hidden" name="token" value="<?php echo newToken(); ?>" />
69 <!-- Add fields to send local user information -->
70 <input type="hidden" name="tz" id="tz" value="" />
71 <input type="hidden" name="tz_string" id="tz_string" value="" />
72 <input type="hidden" name="dst_observed" id="dst_observed" value="" />
73 <input type="hidden" name="dst_first" id="dst_first" value="" />
74 <input type="hidden" name="dst_second" id="dst_second" value="" />
75 <input type="hidden" name="screenwidth" id="screenwidth" value="" />
76 <input type="hidden" name="screenheight" id="screenheight" value="" />
77</form>
78<script type="text/javascript">
79 $(document).ready(function () {
80 document.forms['login'].submit();
81 });
82</script>
global $dolibarr_main_url_root
dolSetCookie(string $cookiename, string $cookievalue, int $expire=-1)
Set a cookie.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
$conf db user
Active Directory does not allow anonymous connections.
Definition repair.php:162
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:158
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:161