dolibarr 25.0.0-alpha
get_info.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 *
6 * This file is a modified version of datepicker.php from phpBSM to fix some
7 * bugs, to add new features and to dramatically increase speed.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
28//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
29//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
30//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
31//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
32if (!defined('NOCSRFCHECK')) {
33 define('NOCSRFCHECK', 1);
34}
35if (!defined('NOTOKENRENEWAL')) {
36 define('NOTOKENRENEWAL', 1);
37}
38if (!defined('NOREQUIREMENU')) {
39 define('NOREQUIREMENU', 1);
40}
41
42require_once '../main.inc.php';
51if (GETPOST('lang', 'aZ09')) {
52 $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
53}
54
55$langs->load("main");
56
57$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
58$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
59
60
61/*
62 * View
63 */
64
65$title = $langs->trans("Info");
66
67// URL http://mydolibarr/core/get_info.php?dol_use_jmobile=1 can be used for tests
68$head = '<!-- Info user page -->'."\n";
69$arrayofjs = array();
70$arrayofcss = array();
71top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
72
73
74
75print '<body>'."\n";
76print '<div style="padding: 20px;">';
77//print '<br>';
78
79// Define link to login card
80$appli = constant('DOL_APPLICATION_TITLE');
81if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
82 $appli = getDolGlobalString('MAIN_APPLICATION_TITLE');
83 if (preg_match('/\d\.\d/', $appli)) {
84 if (!preg_match('/'.preg_quote(DOL_VERSION, '/').'/', $appli)) {
85 $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
86 }
87 } else {
88 $appli .= " ".DOL_VERSION;
89 }
90} else {
91 $appli .= " ".DOL_VERSION;
92}
93
94if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
95 $appli .= "<br>".$langs->trans("LevelOfFeature").': '.getDolGlobalInt('MAIN_FEATURES_LEVEL');
96}
97
98$logouttext = '';
99$logouthtmltext = '';
100$toprightmenu = '';
101if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
102 //$logouthtmltext=$appli.'<br>';
103 if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') {
104 $logouthtmltext .= $langs->trans("Logout").'<br>';
105
106 $logouttext .= '<a href="'.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'">';
107 //$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
108 $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>';
109 $logouttext .= '</a>';
110 } else {
111 $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]);
112 $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
113 }
114}
115
116print '<div class="login_block_getinfo">'."\n";
117
118// Add login user link
119$toprightmenu .= '<div class="login_block_user">';
120
121// Login name with photo and tooltip
122$picto = -1;
123$toprightmenu .= '<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
124$toprightmenu .= $user->getNomUrl($picto, '', -1, 0, 11, 0, ($user->firstname ? 'firstname' : -1), 'atoplogin');
125$toprightmenu .= '</div></div>';
126
127$toprightmenu .= '</div>'."\n";
128
129$toprightmenu .= '<div class="login_block_other">';
130
131// Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
132$parameters = array();
133$result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks
134if (is_numeric($result)) {
135 if (empty($result)) {
136 $toprightmenu .= $hookmanager->resPrint; // add
137 } else {
138 $toprightmenu = $hookmanager->resPrint; // replace
139 }
140} else {
141 $toprightmenu .= $result; // For backward compatibility
142}
143
144if (!isset($form) || !is_object($form)) {
145 include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
146 $form = new Form($db);
147}
148
149// Link to module builder
150if (isModEnabled('modulebuilder')) {
151 $text = '<a href="'.DOL_URL_ROOT.'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="modulebuilder">';
152 //$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
153 $text .= '<span class="fa fa-bug atoplogin"></span>';
154 $text .= '</a>';
155 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
156 $toprightmenu .= $form->textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2);
157}
158
159// Logout link
160if (GETPOSTINT('withlogout')) {
161 $toprightmenu .= $form->textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem', 2);
162}
163
164$toprightmenu .= '</div>';
165
166print $toprightmenu;
167
168print "</div>\n"; // end div class="login_block"
169
170print '</div>';
171print '</body></html>'."\n";
172
173$db->close();
Class to manage generation of HTML components Only common components must be here.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.