dolibarr 21.0.0-beta
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}
38//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language and need security layer
39if (!defined('NOREQUIREMENU')) {
40 define('NOREQUIREMENU', 1);
41}
42
43require_once '../main.inc.php';
52if (GETPOST('lang', 'aZ09')) {
53 $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
54}
55
56$langs->load("main");
57
58$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
59$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
60
61
62/*
63 * View
64 */
65
66$title = $langs->trans("Info");
67
68// URL http://mydolibarr/core/get_info.php?dol_use_jmobile=1 can be used for tests
69$head = '<!-- Info user page -->'."\n";
70$arrayofjs = array();
71$arrayofcss = array();
72top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
73
74
75
76print '<body>'."\n";
77print '<div style="padding: 20px;">';
78//print '<br>';
79
80// Define link to login card
81$appli = constant('DOL_APPLICATION_TITLE');
82if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
83 $appli = getDolGlobalString('MAIN_APPLICATION_TITLE');
84 if (preg_match('/\d\.\d/', $appli)) {
85 if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
86 $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
87 }
88 } else {
89 $appli .= " ".DOL_VERSION;
90 }
91} else {
92 $appli .= " ".DOL_VERSION;
93}
94
95if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
96 $appli .= "<br>".$langs->trans("LevelOfFeature").': '.getDolGlobalInt('MAIN_FEATURES_LEVEL');
97}
98
99$logouttext = '';
100$logouthtmltext = '';
101$toprightmenu = '';
102if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
103 //$logouthtmltext=$appli.'<br>';
104 if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') {
105 $logouthtmltext .= $langs->trans("Logout").'<br>';
106
107 $logouttext .= '<a href="'.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'">';
108 //$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
109 $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>';
110 $logouttext .= '</a>';
111 } else {
112 $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]);
113 $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
114 }
115}
116
117print '<div class="login_block_getinfo">'."\n";
118
119// Add login user link
120$toprightmenu .= '<div class="login_block_user">';
121
122// Login name with photo and tooltip
123$picto = -1;
124$toprightmenu .= '<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
125$toprightmenu .= $user->getNomUrl($picto, '', -1, 0, 11, 0, ($user->firstname ? 'firstname' : -1), 'atoplogin');
126$toprightmenu .= '</div></div>';
127
128$toprightmenu .= '</div>'."\n";
129
130$toprightmenu .= '<div class="login_block_other">';
131
132// Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
133$parameters = array();
134$result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks
135if (is_numeric($result)) {
136 if (empty($result)) {
137 $toprightmenu .= $hookmanager->resPrint; // add
138 } else {
139 $toprightmenu = $hookmanager->resPrint; // replace
140 }
141} else {
142 $toprightmenu .= $result; // For backward compatibility
143}
144
145if (!isset($form) || !is_object($form)) {
146 include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
147 $form = new Form($db);
148}
149
150// Link to module builder
151if (isModEnabled('modulebuilder')) {
152 $text = '<a href="'.DOL_URL_ROOT.'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="modulebuilder">';
153 //$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
154 $text .= '<span class="fa fa-bug atoplogin"></span>';
155 $text .= '</a>';
156 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
157 $toprightmenu .= $form->textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2);
158}
159
160// Logout link
161if (GETPOSTINT('withlogout')) {
162 $toprightmenu .= $form->textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem', 2);
163}
164
165$toprightmenu .= '</div>';
166
167print $toprightmenu;
168
169print "</div>\n"; // end div class="login_block"
170
171print '</div>';
172print '</body></html>'."\n";
173
174$db->close();
Class to manage generation of HTML components Only common components must be here.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.