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