dolibarr 19.0.3
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 = $conf->global->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 = '';
91if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
92 //$logouthtmltext=$appli.'<br>';
93 if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') {
94 $logouthtmltext .= $langs->trans("Logout").'<br>';
95
96 $logouttext .= '<a href="'.DOL_URL_ROOT.'/user/logout.php?token='.newToken().'">';
97 //$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
98 $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>';
99 $logouttext .= '</a>';
100 } else {
101 $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]);
102 $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
103 }
104}
105
106print '<div class="login_block_getinfo">'."\n";
107
108// Add login user link
109$toprightmenu .= '<div class="login_block_user">';
110
111// Login name with photo and tooltip
112$mode = -1;
113$toprightmenu .= '<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
114$toprightmenu .= $user->getNomUrl($mode, '', -1, 0, 11, 0, ($user->firstname ? 'firstname' : -1), 'atoplogin');
115$toprightmenu .= '</div></div>';
116
117$toprightmenu .= '</div>'."\n";
118
119$toprightmenu .= '<div class="login_block_other">';
120
121// Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
122$parameters = array();
123$result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks
124if (is_numeric($result)) {
125 if (empty($result)) {
126 $toprightmenu .= $hookmanager->resPrint; // add
127 } else {
128 $toprightmenu = $hookmanager->resPrint; // replace
129 }
130} else {
131 $toprightmenu .= $result; // For backward compatibility
132}
133
134if (!isset($form) || !is_object($form)) {
135 include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
136 $form = new Form($db);
137}
138
139// Link to module builder
140if (isModEnabled('modulebuilder')) {
141 $text = '<a href="'.DOL_URL_ROOT.'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="modulebuilder">';
142 //$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
143 $text .= '<span class="fa fa-bug atoplogin"></span>';
144 $text .= '</a>';
145 $toprightmenu .= $form->textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2);
146}
147
148// Link to print main content area
149/*
150if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $conf->browser->layout != 'phone')
151{
152 $qs=dol_escape_htmltag($_SERVER["QUERY_STRING"]);
153
154 if (is_array($_POST))
155 {
156 foreach($_POST as $key=>$value) {
157 if ($key!=='action' && $key!=='password' && !is_array($value)) $qs.='&'.$key.'='.urlencode($value);
158 }
159 }
160 $qs.=(($qs && $morequerystring)?'&':'').$morequerystring;
161 $text ='<a href="'.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs?'&':'').'optioncss=print" target="_blank" rel="noopener noreferrer">';
162 //$text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"');
163 $text.='<span class="fa fa-print atoplogin"></span>';
164 $text.='</a>';
165 $toprightmenu .= $form->textwithtooltip('',$langs->trans("PrintContentArea"),2,1,$text,'login_block_elem',2);
166}
167*/
168
169// Link to Dolibarr wiki pages
170/*
171if (empty($conf->global->MAIN_HELP_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
172{
173 $langs->load("help");
174
175 $helpbaseurl='';
176 $helppage='';
177 $mode='';
178
179 if (empty($helppagename)) $helppagename='EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios';
180
181 // Get helpbaseurl, helppage and mode from helppagename and langs
182 $arrayres=getHelpParamFor($helppagename,$langs);
183 $helpbaseurl=$arrayres['helpbaseurl'];
184 $helppage=$arrayres['helppage'];
185 $mode=$arrayres['mode'];
186
187 // Link to help pages
188 if ($helpbaseurl && $helppage)
189 {
190 $text='';
191 $title=$appli.'<br>';
192 $title.=$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage': 'GoToHelpPage');
193 if ($mode == 'wiki') $title.=' - '.$langs->trans("PageWiki").' &quot;'.dol_escape_htmltag(strtr($helppage,'_',' ')).'&quot;';
194 $text.='<a class="help" target="_blank" rel="noopener noreferrer" href="';
195 if ($mode == 'wiki') $text.=sprintf($helpbaseurl,urlencode(html_entity_decode($helppage)));
196 else $text.=sprintf($helpbaseurl,$helppage);
197 $text.='">';
198 //$text.=img_picto('', 'helpdoc_top').' ';
199 $text.='<span class="fa fa-question-circle atoplogin"></span>';
200 //$toprightmenu.=$langs->trans($mode == 'wiki' ? 'OnlineHelp': 'Help');
201 //if ($mode == 'wiki') $text.=' ('.dol_trunc(strtr($helppage,'_',' '),8).')';
202 $text.='</a>';
203 //$toprightmenu.='</div>'."\n";
204 $toprightmenu .= $form->textwithtooltip('',$title,2,1,$text,'login_block_elem',2);
205 }
206}
207*/
208
209// Logout link
210if (GETPOST('withlogout', 'int')) {
211 $toprightmenu .= $form->textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem', 2);
212}
213
214$toprightmenu .= '</div>';
215
216print $toprightmenu;
217
218print "</div>\n"; // end div class="login_block"
219
220print '</div>';
221print '</body></html>'."\n";
222
223$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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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)
Ouput html header of a page.