--- /tmp/dsg/dolibarr/htdocs/github_19.0.3_document.php +++ /tmp/dsg/dolibarr/htdocs/client_document.php @@ -8 +7,0 @@ - * Copyright (C) 2022 Ferran Marcet @@ -34,2 +32,0 @@ -define('MAIN_SECURITY_FORCECSP', "default-src: 'none'"); - @@ -38,12 +35,4 @@ -if (!defined('NOTOKENRENEWAL')) { - define('NOTOKENRENEWAL', '1'); -} -if (!defined('NOREQUIREMENU')) { - define('NOREQUIREMENU', '1'); -} -if (!defined('NOREQUIREHTML')) { - define('NOREQUIREHTML', '1'); -} -if (!defined('NOREQUIREAJAX')) { - define('NOREQUIREAJAX', '1'); -} +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); @@ -52,10 +41,5 @@ -if (isset($_GET["hashp"]) && !defined("NOLOGIN")) { - if (!defined("NOLOGIN")) { - define("NOLOGIN", 1); - } - if (!defined("NOCSRFCHECK")) { - define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. - } - if (!defined("NOIPCHECK")) { - define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip - } +if (isset($_GET["hashp"]) && !defined("NOLOGIN")) +{ + if (!defined("NOLOGIN")) define("NOLOGIN", 1); + if (!defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. + if (!defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip @@ -64,10 +48,5 @@ -if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias')) { - if (!defined("NOLOGIN")) { - define("NOLOGIN", 1); - } - if (!defined("NOCSRFCHECK")) { - define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. - } - if (!defined("NOIPCHECK")) { - define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip - } +if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias')) +{ + if (!defined("NOLOGIN")) define("NOLOGIN", 1); + if (!defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. + if (!defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip @@ -100 +79 @@ -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); @@ -108,9 +87,3 @@ -if (empty($modulepart) && empty($hashp)) { - httponly_accessforbidden('Bad link. Bad value for parameter modulepart', 400); -} -if (empty($original_file) && empty($hashp)) { - httponly_accessforbidden('Bad link. Missing identification to find file (original_file or hashp)', 400); -} -if ($modulepart == 'fckeditor') { - $modulepart = 'medias'; // For backward compatibility -} +if (empty($modulepart) && empty($hashp)) accessforbidden('Bad link. Bad value for parameter modulepart', 0, 0, 1); +if (empty($original_file) && empty($hashp)) accessforbidden('Bad link. Missing identification to find file (original_file or hashp)', 0, 0, 1); +if ($modulepart == 'fckeditor') $modulepart = 'medias'; // For backward compatibility @@ -119,3 +92 @@ -if ($user->socid > 0) { - $socid = $user->socid; -} +if ($user->socid > 0) $socid = $user->socid; @@ -124,4 +95,3 @@ -if (in_array($modulepart, array('facture_paiement', 'unpaid'))) { - if (!$user->hasRight('societe', 'client', 'voir') || $socid) { - $original_file = 'private/'.$user->id.'/'.$original_file; // If user has no permission to see all, output dir is specific to user - } +if (in_array($modulepart, array('facture_paiement', 'unpaid'))) +{ + if (!$user->rights->societe->client->voir || $socid) $original_file = 'private/'.$user->id.'/'.$original_file; // If user has no permission to see all, output dir is specific to user @@ -144,2 +114,2 @@ -$ecmfile=''; -if (!empty($hashp)) { +if (!empty($hashp)) +{ @@ -149 +119,2 @@ - if ($result > 0) { + if ($result > 0) + { @@ -152 +123,2 @@ - if (is_numeric($tmp[0])) { // If first tmp is numeric, it is subdir of company for multicompany, we take next part. + if (is_numeric($tmp[0])) // If first tmp is numeric, it is subdir of company for multicompany, we take next part. + { @@ -157,2 +129,4 @@ - if ($modulepart) { // Not required, so often not defined, for link using public hashp parameter. - if ($moduleparttocheck == $modulepart) { + if ($modulepart) // Not required, so often not defined, for link using public hashp parameter. + { + if ($moduleparttocheck == $modulepart) + { @@ -162,2 +135,0 @@ - } else { - httponly_accessforbidden('Bad link. File is from another module part.', 403); @@ -165 +137,7 @@ - } else { + else + { + accessforbidden('Bad link. File is from another module part.', 0, 0, 1); + } + } + else + { @@ -169,6 +147,3 @@ - $entity = $ecmfile->entity; - if ($entity != $conf->entity) { - $conf->entity = $entity; - $conf->setValues($db); - } - } else { + } + else + { @@ -176 +151 @@ - httponly_accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 403, 1); + accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1); @@ -182,9 +157,3 @@ -if (preg_match('/\.(html|htm)$/i', $original_file)) { - $attachment = false; -} -if (isset($_GET["attachment"])) { - $attachment = GETPOST("attachment", 'alpha') ?true:false; -} -if (getDolGlobalString('MAIN_DISABLE_FORCE_SAVEAS')) { - $attachment = false; -} +if (preg_match('/\.(html|htm)$/i', $original_file)) $attachment = false; +if (isset($_GET["attachment"])) $attachment = GETPOST("attachment", 'alpha') ?true:false; +if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false; @@ -193,18 +162,11 @@ -$type = 'application/octet-stream'; // By default -if (GETPOST('type', 'alpha')) { - $type = GETPOST('type', 'alpha'); -} else { - $type = dol_mimetype($original_file); -} -// Security: Force to octet-stream if file is a dangerous file. For example when it is a .noexe file -// We do not force if file is a javascript to be able to get js from website module with '."\n"; + else print ''."\n"; + /*if (! empty($conf->global->MAIN_FEATURES_LEVEL) && ! defined('JS_JQUERY_MIGRATE_DISABLED')) + { + if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) print ''."\n"; + else print ''."\n"; + }*/ + if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) print ''."\n"; + else print ''."\n"; + if (!defined('DISABLE_JQUERY_TABLEDND')) print ''."\n"; + // jQuery jnotify + if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) + { + print ''."\n"; + } + // Flot + if (empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH == 'jflot') + { + if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && !defined('DISABLE_JQUERY_FLOT')) + { + if (constant('JS_JQUERY_FLOT')) + { + print ''."\n"; + print ''."\n"; + print ''."\n"; @@ -1903,11 +1371,16 @@ - // cssfile is a relative path - $urlforcss = dol_buildpath($cssfile, 1); - if ($urlforcss && $urlforcss != '/') { - print ''."\n".''."\n"; - } else { - dol_syslog("Warning: module ".$modcss." declared a css path file for a file we can't find.", LOG_WARNING); + else + { + print ''."\n"; + print ''."\n"; + print ''."\n"; + /* Test for jflot 4.2 -> not better than current + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + */ @@ -1917,46 +1389,0 @@ - } - // CSS forced by page in top_htmlhead call (relative url starting with /) - if (is_array($arrayofcss)) { - foreach ($arrayofcss as $cssfile) { - if (preg_match('/^(http|\/\/)/i', $cssfile)) { - $urltofile = $cssfile; - } else { - $urltofile = dol_buildpath($cssfile, 1); - } - print ''."\n".''."\n"; - } - } - - // Custom CSS - if (getDolGlobalString('MAIN_IHM_CUSTOM_CSS')) { - // If a custom CSS was set, we add link to the custom css php file - print ''."\n"; - } - - // Output standard javascript links - if (!defined('DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) { - // JQuery. Must be before other includes - print ''."\n"; - if (defined('JS_JQUERY') && constant('JS_JQUERY')) { - print ''."\n"; - } else { - print ''."\n"; - } - if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) { - print ''."\n"; - } else { - print ''."\n"; - } - // jQuery jnotify - if (!getDolGlobalString('MAIN_DISABLE_JQUERY_JNOTIFY') && !defined('DISABLE_JQUERY_JNOTIFY')) { - print ''."\n"; - } - // Table drag and drop lines - if (empty($disableforlogin) && !defined('DISABLE_JQUERY_TABLEDND')) { - print ''."\n"; - } @@ -1964,2 +1391,3 @@ - if (empty($disableforlogin) && (!getDolGlobalString('MAIN_JS_GRAPH') || getDolGlobalString('MAIN_JS_GRAPH') == 'chart') && !defined('DISABLE_JS_GRAPH')) { - print ''."\n"; + if ($conf->global->MAIN_JS_GRAPH == 'chart') + { + print ''."\n"; @@ -1969 +1397,2 @@ - if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !defined('DISABLE_JQUERY_JEDITABLE')) { + if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined('DISABLE_JQUERY_JEDITABLE')) + { @@ -1971,3 +1400,3 @@ - print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; @@ -1979 +1408 @@ - print 'var cancelInPlace = \''.$langs->trans("Cancel").'\';'."\n"; + print 'var cancelInPlace = \''.$langs->trans('Cancel').'\';'."\n"; @@ -1984,117 +1413,107 @@ - print ''."\n"; - print ''."\n"; - } - // jQuery Timepicker - if (getDolGlobalString('MAIN_USE_JQUERY_TIMEPICKER') || defined('REQUIRE_JQUERY_TIMEPICKER')) { - print ''."\n"; - print ''."\n"; - } - if (!defined('DISABLE_SELECT2') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { - // jQuery plugin "mutiselect", "multiple-select", "select2", ... - $tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ?constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; - print ''."\n"; // We include full because we need the support of containerCssClass - } - if (!defined('DISABLE_MULTISELECT')) { // jQuery plugin "mutiselect" to select with checkboxes. Can be removed once we have an enhanced search tool - print ''."\n"; - } - } - - if (!$disablejs && !empty($conf->use_javascript_ajax)) { - // CKEditor - if (empty($disableforlogin) && (isModEnabled('fckeditor') && (!getDolGlobalString('FCKEDITOR_EDITORNAME') || getDolGlobalString('FCKEDITOR_EDITORNAME') == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) { - print ''."\n"; - $pathckeditor = DOL_URL_ROOT.'/includes/ckeditor/ckeditor/'; - $jsckeditor = 'ckeditor.js'; - if (constant('JS_CKEDITOR')) { - // To use external ckeditor 4 js lib - $pathckeditor = constant('JS_CKEDITOR'); - } - print ''."\n"; - print ''."\n"; - print ''."\n"; - } - - // Browser notifications (if NOREQUIREMENU is on, it is mostly a page for popup, so we do not enable notif too. We hide also for public pages). - if (!defined('NOBROWSERNOTIF') && !defined('NOREQUIREMENU') && !defined('NOLOGIN')) { - $enablebrowsernotif = false; - if (isModEnabled('agenda') && getDolGlobalString('AGENDA_REMINDER_BROWSER')) { - $enablebrowsernotif = true; - } - if ($conf->browser->layout == 'phone') { - $enablebrowsernotif = false; - } - if ($enablebrowsernotif) { - print ''."\n"; - print ''."\n"; - } - } - - // Global js function - print ''."\n"; - print ''."\n"; - - // JS forced by modules (relative url starting with /) - if (!empty($conf->modules_parts['js'])) { // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) - $arrayjs = (array) $conf->modules_parts['js']; - foreach ($arrayjs as $modjs => $filesjs) { - $filesjs = (array) $filesjs; // To be sure filejs is an array - foreach ($filesjs as $jsfile) { - // jsfile is a relative path - $urlforjs = dol_buildpath($jsfile, 1); - if ($urlforjs && $urlforjs != '/') { - print ''."\n"; - print ''."\n"; - } else { - dol_syslog("Warning: module ".$modjs." declared a js path file for a file we can't find.", LOG_WARNING); - } - } - } - } - // JS forced by page in top_htmlhead (relative url starting with /) - if (is_array($arrayofjs)) { - print ''."\n"; - foreach ($arrayofjs as $jsfile) { - if (preg_match('/^(http|\/\/)/i', $jsfile)) { - print ''."\n"; - } else { - print ''."\n"; - } - } - } - } - - //If you want to load custom javascript file from your selected theme directory - if (getDolGlobalString('ALLOW_THEME_JS')) { - $theme_js = dol_buildpath('/theme/'.$conf->theme.'/'.$conf->theme.'.js', 0); - if (file_exists($theme_js)) { - print ''."\n"; - } - } - - if (!empty($head)) { - print $head."\n"; - } - if (getDolGlobalString('MAIN_HTML_HEADER')) { - print getDolGlobalString('MAIN_HTML_HEADER') . "\n"; - } - - $parameters = array(); - $result = $hookmanager->executeHooks('addHtmlHeader', $parameters); // Note that $action and $object may have been modified by some hooks - print $hookmanager->resPrint; // Replace Title to show - - print "\n\n"; - } - - $conf->headerdone = 1; // To tell header was output + print ''."\n"; + print ''."\n"; + } + // jQuery Timepicker + if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) + { + print ''."\n"; + print ''."\n"; + } + if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) // jQuery plugin "mutiselect", "multiple-select", "select2", ... + { + $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ?constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; + print ''."\n"; // We include full because we need the support of containerCssClass + } + } + + if (!$disablejs && !empty($conf->use_javascript_ajax)) + { + // CKEditor + if ((!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) + { + print ''."\n"; + $pathckeditor = DOL_URL_ROOT.'/includes/ckeditor/ckeditor/'; + $jsckeditor = 'ckeditor.js'; + if (constant('JS_CKEDITOR')) // To use external ckeditor 4 js lib + { + $pathckeditor = constant('JS_CKEDITOR'); + } + print ''."\n"; + print ''."\n"; + print ''."\n"; + } + + // Browser notifications + if (!defined('DISABLE_BROWSER_NOTIF')) + { + $enablebrowsernotif = false; + if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER)) $enablebrowsernotif = true; + if ($conf->browser->layout == 'phone') $enablebrowsernotif = false; + if ($enablebrowsernotif) + { + print ''."\n"; + print ''."\n"; + } + } + + // Global js function + print ''."\n"; + print ''."\n"; + + // JS forced by modules (relative url starting with /) + if (!empty($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) + { + $arrayjs = (array) $conf->modules_parts['js']; + foreach ($arrayjs as $modjs => $filesjs) + { + $filesjs = (array) $filesjs; // To be sure filejs is an array + foreach ($filesjs as $jsfile) + { + // jsfile is a relative path + print ''."\n".''."\n"; + } + } + } + // JS forced by page in top_htmlhead (relative url starting with /) + if (is_array($arrayofjs)) + { + print ''."\n"; + foreach ($arrayofjs as $jsfile) + { + if (preg_match('/^(http|\/\/)/i', $jsfile)) + { + print ''."\n"; + } + else + { + print ''."\n"; + } + } + } + } + + if (!empty($head)) print $head."\n"; + if (!empty($conf->global->MAIN_HTML_HEADER)) print $conf->global->MAIN_HTML_HEADER."\n"; + + $parameters = array(); + $result = $hookmanager->executeHooks('addHtmlHeader', $parameters); // Note that $action and $object may have been modified by some hooks + print $hookmanager->resPrint; // Replace Title to show + + print "\n\n"; + } + + $conf->headerdone = 1; // To tell header was output @@ -2107,11 +1526,11 @@ - * @param string $head Lines in the HEAD - * @param string $title Title of web page - * @param string $target Target to use in menu links (Example: '' or '_top') - * @param int $disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax) - * @param int $disablehead Do not output head section - * @param array $arrayofjs Array of js files to add in header - * @param array $arrayofcss Array of css files to add in header - * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) - * @param string $helppagename Name of wiki page for help ('' by default). - * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage - * For other external page: http://server/url + * @param string $head Lines in the HEAD + * @param string $title Title of web page + * @param string $target Target to use in menu links (Example: '' or '_top') + * @param int $disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax) + * @param int $disablehead Do not output head section + * @param array $arrayofjs Array of js files to add in header + * @param array $arrayofcss Array of css files to add in header + * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) + * @param string $helppagename Name of wiki page for help ('' by default). + * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage + * For other external page: http://server/url @@ -2120,3 +1539,3 @@ -function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = array(), $arrayofcss = array(), $morequerystring = '', $helppagename = '') -{ - global $user, $conf, $langs, $db, $form; +function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $helppagename = '') +{ + global $user, $conf, $langs, $db; @@ -2127,2 +1546,3 @@ - - // Instantiate hooks for external modules + $bookmarks = ''; + + // Instantiate hooks of thirdparty module @@ -2134,3 +1554,3 @@ - if (empty($conf->headerdone)) { - $disablenofollow = 0; - top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, $disablenofollow); + if (empty($conf->headerdone)) + { + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); @@ -2141,8 +1561,4 @@ - * Top menu - */ - if ((empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) { - if (!isset($form) || !is_object($form)) { - include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; - $form = new Form($db); - } - + * Top menu + */ + if ((empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) + { @@ -2151 +1567 @@ - print '
'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible. + print '
'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible. @@ -2154 +1570 @@ - print '
'."\n"; + print '
'."\n"; @@ -2156 +1572 @@ - $menumanager->showmenu('top', array('searchform'=>$searchform)); // This contains a \n + $menumanager->showmenu('top', array('searchform'=>$searchform, 'bookmarks'=>$bookmarks)); // This contains a \n @@ -2161 +1577,2 @@ - if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) + { @@ -2163,14 +1580,9 @@ - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { - $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - } else { - $appli .= " ".DOL_VERSION; - } - } else { - $appli .= " ".DOL_VERSION; - } - - if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { - $appli .= "
".$langs->trans("LevelOfFeature").': '.getDolGlobalInt('MAIN_FEATURES_LEVEL'); - } + if (preg_match('/\d\.\d/', $appli)) + { + if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core + } + else $appli .= " ".DOL_VERSION; + } + else $appli .= " ".DOL_VERSION; + + if (!empty($conf->global->MAIN_FEATURES_LEVEL)) $appli .= "
".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; @@ -2179,2 +1591,2 @@ - $logouthtmltext = ''; - if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { @@ -2182,9 +1594,2 @@ - $stringforfirstkey = $langs->trans("KeyboardShortcut"); - if ($conf->browser->name == 'chrome') { - $stringforfirstkey .= ' ALT +'; - } elseif ($conf->browser->name == 'firefox') { - $stringforfirstkey .= ' ALT + SHIFT +'; - } else { - $stringforfirstkey .= ' CTL +'; - } - if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { + if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') + { @@ -2192,2 +1597,3 @@ - $logouttext .= ''; - $logouttext .= img_picto($langs->trans('Logout').' ('.$stringforfirstkey.' l)', 'sign-out', '', false, 0, 0, '', 'atoplogin valignmiddle'); + + $logouttext .= ''; + $logouttext .= img_picto($langs->trans('Logout'), 'sign-out', '', false, 0, 0, '', 'atoplogin'); @@ -2195 +1601,3 @@ - } else { + } + else + { @@ -2197 +1605 @@ - $logouttext .= img_picto($langs->trans('Logout').' ('.$stringforfirstkey.' l)', 'sign-out', '', false, 0, 0, '', 'atoplogin valignmiddle opacitymedium'); + $logouttext .= img_picto($langs->trans('Logout'), 'sign-out', '', false, 0, 0, '', 'atoplogin opacitymedium'); @@ -2208,2 +1616,3 @@ - if (is_numeric($result)) { - if ($result == 0) { + if (is_numeric($result)) + { + if ($result == 0) @@ -2211 +1620 @@ - } else { + else @@ -2213,2 +1622,3 @@ - } - } else { + } + else + { @@ -2219 +1629,2 @@ - if (isModEnabled('modulebuilder')) { + if (!empty($conf->modulebuilder->enabled)) + { @@ -2224,5 +1635,6 @@ - $toprightmenu .= $form->textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2); - } - - // Link to print main content area (optioncss=print) - if (!getDolGlobalString('MAIN_PRINT_DISABLELINK') && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { + $toprightmenu .= @Form::textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2); + } + + // Link to print main content area + if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $conf->browser->layout != 'phone') + { @@ -2231,17 +1643,4 @@ - if (isset($_POST) && is_array($_POST)) { - foreach ($_POST as $key => $value) { - $key = preg_replace('/[^a-z0-9_\.\-\[\]]/i', '', $key); - if (in_array($key, array('action', 'massaction', 'password'))) { - continue; - } - if (!is_array($value)) { - if ($value !== '') { - $qs .= '&'.urlencode($key).'='.urlencode($value); - } - } else { - foreach ($value as $value2) { - if (($value2 !== '') && (!is_array($value2))) { - $qs .= '&'.urlencode($key).'[]='.urlencode($value2); - } - } - } + if (is_array($_POST)) + { + foreach ($_POST as $key=>$value) { + if ($key !== 'action' && $key !== 'password' && !is_array($value)) $qs .= '&'.$key.'='.urlencode($value); @@ -2251 +1650 @@ - $text = ''; + $text = ''; @@ -2255 +1654 @@ - $toprightmenu .= $form->textwithtooltip('', $langs->trans("PrintContentArea"), 2, 1, $text, 'login_block_elem', 2); + $toprightmenu .= @Form::textwithtooltip('', $langs->trans("PrintContentArea"), 2, 1, $text, 'login_block_elem', 2); @@ -2259 +1658,2 @@ - if (!getDolGlobalString('MAIN_HELP_DISABLELINK') && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { + if (empty($conf->global->MAIN_HELP_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { @@ -2265,7 +1665,2 @@ - $helppresent = ''; - - if (empty($helppagename)) { - $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios|DE:Benutzerdokumentation'; - } else { - $helppresent = 'helppresent'; - } + + if (empty($helppagename)) $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios'; @@ -2280 +1675,2 @@ - if ($helpbaseurl && $helppage) { + if ($helpbaseurl && $helppage) + { @@ -2282,15 +1678,5 @@ - $title = $langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage').', '; - if ($mode == 'wiki') { - $title .= '
'.img_picto('', 'globe', 'class="pictofixedwidth"').$langs->trans("PageWiki").' '.dol_escape_htmltag('"'.strtr($helppage, '_', ' ').'"'); - if ($helppresent) { - $title .= ' ('.$langs->trans("DedicatedPageAvailable").')'; - } else { - $title .= ' ('.$langs->trans("HomePage").')'; - } - } - $text .= '
'; - $text .= ''; + $text .= ''; @@ -2301 +1686 @@ - $toprightmenu .= $form->textwithtooltip('', $title, 2, 1, $text, 'login_block_elem', 2); + $toprightmenu .= @Form::textwithtooltip('', $title, 2, 1, $text, 'login_block_elem', 2); @@ -2305 +1690 @@ - if (getDolGlobalString('MAIN_SHOWDATABASENAMEINHELPPAGESLINK')) { + if (!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) { @@ -2311,4 +1696,3 @@ - if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { - $text = ''.DOL_VERSION.''; - $toprightmenu .= $form->textwithtooltip('', $appli, 2, 1, $text, 'login_block_elem', 2); - } + $text = ''.DOL_VERSION.''; + $toprightmenu .= @Form::textwithtooltip('', $appli, 2, 1, $text, 'login_block_elem', 2); + @@ -2317 +1701 @@ - $toprightmenu .= $form->textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem logout-btn', 2); + $toprightmenu .= @Form::textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem logout-btn', 2); @@ -2327,3 +1711,3 @@ - $toprightmenu .= ''; @@ -2354,2 +1733 @@ - print '
'; - //print '
 
'; + print ''; @@ -2361,3 +1739 @@ - if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) { - print '
'; - } + if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) print '
'; @@ -2371 +1747 @@ - * @param string $urllogout URL for logout (Will use DOL_URL_ROOT.'/user/logout.php?token=...' if empty) + * @param string $urllogout URL for logout @@ -2376,157 +1752,97 @@ - global $langs, $conf, $db, $hookmanager, $user, $mysoc; - global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; - - $langs->load('companies'); - - $userImage = $userDropDownImage = ''; - if (!empty($user->photo)) { - $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); - $userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1); - } else { - $nophoto = '/public/theme/common/user_anonymous.png'; - if ($user->gender == 'man') { - $nophoto = '/public/theme/common/user_man.png'; - } - if ($user->gender == 'woman') { - $nophoto = '/public/theme/common/user_woman.png'; - } - - $userImage = 'No photo'; - $userDropDownImage = 'No photo'; - } - - $dropdownBody = ''; - $dropdownBody .= ' '.$langs->trans("ShowCompanyInfos").''; - $dropdownBody .= '
'; - - $dropdownBody .= '
'.$langs->trans("Company").': '.dol_escape_htmltag($mysoc->name).''; - if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId1", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_SIREN"), 1).''; - } - if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId2", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_SIRET"), 2).''; - } - if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId3", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_APE"), 3).''; - } - if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId4", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_RCS"), 4).''; - } - if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId5", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID5"), 5).''; - } - if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') { - $dropdownBody .= '
'.$langs->transcountry("ProfId6", $mysoc->country_code).': '.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID6"), 6).''; - } - $dropdownBody .= '
'.$langs->trans("VATIntraShort").': '.dol_print_profids(getDolGlobalString("MAIN_INFO_TVAINTRA"), 'VAT').''; - $dropdownBody .= '
'.$langs->trans("Country").': '.($mysoc->country_code ? $langs->trans("Country".$mysoc->country_code) : '').''; - if (isModEnabled('multicurrency')) { - $dropdownBody .= '
'.$langs->trans("Currency").': '.$conf->currency.''; - } - $dropdownBody .= '
'; - - $dropdownBody .= '
'; - $dropdownBody .= ' '.$langs->trans("ShowMoreInfos").''; - $dropdownBody .= '
'; - - // login infos - if (!empty($user->admin)) { - $dropdownBody .= '
'.$langs->trans("Administrator").': '.yn($user->admin); - } - if (!empty($user->socid)) { // Add thirdparty for external users - $thirdpartystatic = new Societe($db); - $thirdpartystatic->fetch($user->socid); - $companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company - $company = ' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; - } - $type = ($user->socid ? $langs->trans("External").$company : $langs->trans("Internal")); - $dropdownBody .= '
'.$langs->trans("Type").': '.$type; - $dropdownBody .= '
'.$langs->trans("Status").': '.$user->getLibStatut(0); - $dropdownBody .= '
'; - - $dropdownBody .= '
'.$langs->trans("Session").''; - $dropdownBody .= '
'.$langs->trans("IPAddress").': '.dol_escape_htmltag($_SERVER["REMOTE_ADDR"]); - if (getDolGlobalString('MAIN_MODULE_MULTICOMPANY')) { - $dropdownBody .= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$user->entity.')'; - } - $dropdownBody .= '
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)'); - $dropdownBody .= '
'.$langs->trans("ConnectedSince").': '.dol_print_date($user->datelastlogin, "dayhour", 'tzuser'); - $dropdownBody .= '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); - $dropdownBody .= '
'.$langs->trans("CurrentTheme").': '.$conf->theme; - $dropdownBody .= '
'.$langs->trans("CurrentMenuManager").': '.(isset($menumanager) ? $menumanager->name : 'unknown'); - $langFlag = picto_from_langcode($langs->getDefaultLang()); - $dropdownBody .= '
'.$langs->trans("CurrentUserLanguage").': '.($langFlag ? $langFlag.' ' : '').$langs->getDefaultLang(); - - $tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']; - $dropdownBody .= '
'.$langs->trans("ClientTZ").': '.($tz ? ($tz >= 0 ? '+' : '').$tz : ''); - $dropdownBody .= ' ('.$_SESSION['dol_tz_string'].')'; - //$dropdownBody .= '       '.$langs->trans("DaylingSavingTime").': '; - //if ($_SESSION['dol_dst'] > 0) $dropdownBody .= yn(1); - //else $dropdownBody .= yn(0); - - $dropdownBody .= '
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.dol_escape_htmltag($_SERVER['HTTP_USER_AGENT']).')'; - $dropdownBody .= '
'.$langs->trans("Layout").': '.$conf->browser->layout; - $dropdownBody .= '
'.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; - if ($conf->browser->layout == 'phone') { - $dropdownBody .= '
'.$langs->trans("Phone").': '.$langs->trans("Yes"); - } - if (!empty($_SESSION["disablemodules"])) { - $dropdownBody .= '
'.$langs->trans("DisabledModules").':
'.join(', ', explode(',', $_SESSION["disablemodules"])); - } - $dropdownBody .= '
'; - - // Execute hook - $parameters = array('user'=>$user, 'langs' => $langs); - $result = $hookmanager->executeHooks('printTopRightMenuLoginDropdownBody', $parameters); // Note that $action and $object may have been modified by some hooks - if (is_numeric($result)) { - if ($result == 0) { - $dropdownBody .= $hookmanager->resPrint; // add - } else { - $dropdownBody = $hookmanager->resPrint; // replace - } - } - - if (empty($urllogout)) { - $urllogout = DOL_URL_ROOT.'/user/logout.php?token='.newToken(); - } - - // accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox - // accesskey is for Mac: CTRL + key for all browsers - $stringforfirstkey = $langs->trans("KeyboardShortcut"); - if ($conf->browser->name == 'chrome') { - $stringforfirstkey .= ' ALT +'; - } elseif ($conf->browser->name == 'firefox') { - $stringforfirstkey .= ' ALT + SHIFT +'; - } else { - $stringforfirstkey .= ' CTL +'; - } - - // Defined the links for bottom of card - $profilLink = '
'.$langs->trans("Card").''; - $urltovirtualcard = '/user/virtualcard.php?id='.((int) $user->id); - $virtuelcardLink = dolButtonToOpenUrlInDialogPopup('publicvirtualcardmenu', $langs->transnoentitiesnoconv("PublicVirtualCardUrl").(is_object($user) ? ' - '.$user->getFullName($langs) : '').' ('.$stringforfirstkey.' v)', img_picto($langs->trans("PublicVirtualCardUrl").' ('.$stringforfirstkey.' v)', 'card', ''), $urltovirtualcard, '', 'button-top-menu-dropdown marginleftonly nohover', "closeTopMenuLoginDropdown()", '', 'v'); - $logoutLink = ''.$langs->trans("Logout").''; - - $profilName = $user->getFullName($langs).' ('.$user->login.')'; - if (!empty($user->admin)) { - $profilName = ' '.$profilName; - } - - // Define version to show - $appli = constant('DOL_APPLICATION_TITLE'); - if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { - $appli = $conf->global->MAIN_APPLICATION_TITLE; - if (preg_match('/\d\.\d/', $appli)) { - if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { - $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - } else { - $appli .= " ".DOL_VERSION; - } - } else { - $appli .= " ".DOL_VERSION; - } - - if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { - $btnUser = ' + global $langs, $conf, $db, $hookmanager, $user; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + $userImage = $userDropDownImage = ''; + if (!empty($user->photo)) + { + $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); + $userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1); + } + else { + $nophoto = '/public/theme/common/user_anonymous.png'; + if ($user->gender == 'man') $nophoto = '/public/theme/common/user_man.png'; + if ($user->gender == 'woman') $nophoto = '/public/theme/common/user_woman.png'; + + $userImage = 'No photo'; + $userDropDownImage = 'No photo'; + } + + $dropdownBody = ''; + $dropdownBody .= ' '.$langs->trans("ShowMoreInfos").''; + $dropdownBody .= '
'; + + // login infos + if (!empty($user->admin)) { + $dropdownBody .= '
'.$langs->trans("Administrator").': '.yn($user->admin); + } + if (!empty($user->socid)) // Add thirdparty for external users + { + $thirdpartystatic = new Societe($db); + $thirdpartystatic->fetch($user->socid); + $companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company + $company = ' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; + } + $type = ($user->socid ? $langs->trans("External").$company : $langs->trans("Internal")); + $dropdownBody .= '
'.$langs->trans("Type").': '.$type; + $dropdownBody .= '
'.$langs->trans("Status").': '.$user->getLibStatut(0); + $dropdownBody .= '
'; + + $dropdownBody .= '
'.$langs->trans("Session").''; + $dropdownBody .= '
'.$langs->trans("IPAddress").': '.dol_escape_htmltag($_SERVER["REMOTE_ADDR"]); + if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $dropdownBody .= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$user->entity.')'; + $dropdownBody .= '
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)'); + $dropdownBody .= '
'.$langs->trans("ConnectedSince").': '.dol_print_date($user->datelastlogin, "dayhour", 'tzuser'); + $dropdownBody .= '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); + $dropdownBody .= '
'.$langs->trans("CurrentTheme").': '.$conf->theme; + $dropdownBody .= '
'.$langs->trans("CurrentMenuManager").': '.$menumanager->name; + $langFlag = picto_from_langcode($langs->getDefaultLang()); + $dropdownBody .= '
'.$langs->trans("CurrentUserLanguage").': '.($langFlag ? $langFlag.' ' : '').$langs->getDefaultLang(); + $dropdownBody .= '
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.dol_escape_htmltag($_SERVER['HTTP_USER_AGENT']).')'; + $dropdownBody .= '
'.$langs->trans("Layout").': '.$conf->browser->layout; + $dropdownBody .= '
'.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; + if ($conf->browser->layout == 'phone') $dropdownBody .= '
'.$langs->trans("Phone").': '.$langs->trans("Yes"); + if (!empty($_SESSION["disablemodules"])) $dropdownBody .= '
'.$langs->trans("DisabledModules").':
'.join(', ', explode(',', $_SESSION["disablemodules"])); + $dropdownBody .= '
'; + + // Execute hook + $parameters = array('user'=>$user, 'langs' => $langs); + $result = $hookmanager->executeHooks('printTopRightMenuLoginDropdownBody', $parameters); // Note that $action and $object may have been modified by some hooks + if (is_numeric($result)) + { + if ($result == 0) { + $dropdownBody .= $hookmanager->resPrint; // add + } + else { + $dropdownBody = $hookmanager->resPrint; // replace + } + } + + if (empty($urllogout)) { + $urllogout = DOL_URL_ROOT.'/user/logout.php'; + } + $logoutLink = ' '.$langs->trans("Logout").''; + $profilLink = ' '.$langs->trans("Card").''; + + + $profilName = $user->getFullName($langs).' ('.$user->login.')'; + + if (!empty($user->admin)) { + $profilName = ' '.$profilName; + } + + // Define version to show + $appli = constant('DOL_APPLICATION_TITLE'); + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) + { + $appli = $conf->global->MAIN_APPLICATION_TITLE; + if (preg_match('/\d\.\d/', $appli)) + { + if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core + } + else $appli .= " ".DOL_VERSION; + } + else $appli .= " ".DOL_VERSION; + + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + $btnUser = ' @@ -2534,2 +1850,3 @@ -