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