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 21/** 22 * \file htdocs/core/get_info.php 23 * \brief File to return a single page with just logged user info, to be used by other frontend 24 */ 25 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')) define('NOCSRFCHECK', 1); 31if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); 32//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language 33if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); 34 35require_once '../main.inc.php'; 36 37if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php 38 39$langs->load("main"); 40 41$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); 42$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); 43 44 45/* 46 * View 47 */ 48 49$title = $langs->trans("Info"); 50 51// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests 52$head = '<!-- Quick access -->'."\n"; 53$arrayofjs = array(); 54$arrayofcss = array(); 55top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss); 56 57 58 59print '<body>'."\n"; 60print '<div style="padding: 20px;">'; 61//print '<br>'; 62 63// Define link to login card 64$appli = constant('DOL_APPLICATION_TITLE'); 65if (!empty($conf->global->MAIN_APPLICATION_TITLE)) 66{ 67 $appli = $conf->global->MAIN_APPLICATION_TITLE; 68 if (preg_match('/\d\.\d/', $appli)) 69 { 70 if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core 71 } else $appli .= " ".DOL_VERSION; 72} else $appli .= " ".DOL_VERSION; 73 74if (!empty($conf->global->MAIN_FEATURES_LEVEL)) $appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; 75 76$logouttext = ''; 77if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) 78{ 79 //$logouthtmltext=$appli.'<br>'; 80 if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') 81 { 82 $logouthtmltext .= $langs->trans("Logout").'<br>'; 83 84 $logouttext .= '<a href="'.DOL_URL_ROOT.'/user/logout.php">'; 85 //$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); 86 $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>'; 87 $logouttext .= '</a>'; 88 } else { 89 $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]); 90 $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); 91 } 92} 93 94print '<div class="login_block_getinfo">'."\n"; 95 96// Add login user link 97$toprightmenu .= '<div class="login_block_user">'; 98 99// Login name with photo and tooltip 100$mode = -1; 101$toprightmenu .= '<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">'; 102$toprightmenu .= $user->getNomUrl($mode, '', -1, 0, 11, 0, ($user->firstname ? 'firstname' : -1), 'atoplogin'); 103$toprightmenu .= '</div></div>'; 104 105$toprightmenu .= '</div>'."\n"; 106 107$toprightmenu .= '<div class="login_block_other">'; 108 109// Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>') 110$parameters = array(); 111$result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks 112if (is_numeric($result)) 113{ 114 if (empty($result)) $toprightmenu .= $hookmanager->resPrint; // add 115 else $toprightmenu = $hookmanager->resPrint; // replace 116} else $toprightmenu .= $result; // For backward compatibility 117 118if (!isset($form) || !is_object($form)) { 119 include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; 120 $form = new Form($db); 121} 122 123// Link to module builder 124if (!empty($conf->modulebuilder->enabled)) 125{ 126 $text = '<a href="'.DOL_URL_ROOT.'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="modulebuilder">'; 127 //$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"'); 128 $text .= '<span class="fa fa-bug atoplogin"></span>'; 129 $text .= '</a>'; 130 $toprightmenu .= $form->textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2); 131} 132 133// Link to print main content area 134/* 135if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $conf->browser->layout != 'phone') 136{ 137 $qs=dol_escape_htmltag($_SERVER["QUERY_STRING"]); 138 139 if (is_array($_POST)) 140 { 141 foreach($_POST as $key=>$value) { 142 if ($key!=='action' && $key!=='password' && !is_array($value)) $qs.='&'.$key.'='.urlencode($value); 143 } 144 } 145 $qs.=(($qs && $morequerystring)?'&':'').$morequerystring; 146 $text ='<a href="'.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs?'&':'').'optioncss=print" target="_blank">'; 147 //$text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"'); 148 $text.='<span class="fa fa-print atoplogin"></span>'; 149 $text.='</a>'; 150 $toprightmenu .= $form->textwithtooltip('',$langs->trans("PrintContentArea"),2,1,$text,'login_block_elem',2); 151} 152*/ 153 154// Link to Dolibarr wiki pages 155/* 156if (empty($conf->global->MAIN_HELP_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) 157{ 158 $langs->load("help"); 159 160 $helpbaseurl=''; 161 $helppage=''; 162 $mode=''; 163 164 if (empty($helppagename)) $helppagename='EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios'; 165 166 // Get helpbaseurl, helppage and mode from helppagename and langs 167 $arrayres=getHelpParamFor($helppagename,$langs); 168 $helpbaseurl=$arrayres['helpbaseurl']; 169 $helppage=$arrayres['helppage']; 170 $mode=$arrayres['mode']; 171 172 // Link to help pages 173 if ($helpbaseurl && $helppage) 174 { 175 $text=''; 176 $title=$appli.'<br>'; 177 $title.=$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage': 'GoToHelpPage'); 178 if ($mode == 'wiki') $title.=' - '.$langs->trans("PageWiki").' "'.dol_escape_htmltag(strtr($helppage,'_',' ')).'"'; 179 $text.='<a class="help" target="_blank" rel="noopener" href="'; 180 if ($mode == 'wiki') $text.=sprintf($helpbaseurl,urlencode(html_entity_decode($helppage))); 181 else $text.=sprintf($helpbaseurl,$helppage); 182 $text.='">'; 183 //$text.=img_picto('', 'helpdoc_top').' '; 184 $text.='<span class="fa fa-question-circle atoplogin"></span>'; 185 //$toprightmenu.=$langs->trans($mode == 'wiki' ? 'OnlineHelp': 'Help'); 186 //if ($mode == 'wiki') $text.=' ('.dol_trunc(strtr($helppage,'_',' '),8).')'; 187 $text.='</a>'; 188 //$toprightmenu.='</div>'."\n"; 189 $toprightmenu .= $form->textwithtooltip('',$title,2,1,$text,'login_block_elem',2); 190 } 191} 192*/ 193 194// Logout link 195if (GETPOST('withlogout', 'int')) $toprightmenu .= $form->textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem', 2); 196 197$toprightmenu .= '</div>'; 198 199print $toprightmenu; 200 201print "</div>\n"; // end div class="login_block" 202 203print '</div>'; 204print '</body></html>'."\n"; 205 206$db->close(); 207