From 7b45347b0180e1644feef7c75e3e0a5ca2b1f06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 9 Jan 2024 14:30:41 +0100 Subject: [PATCH 1/5] dol_compress_dir creates invalid zip with windoze --- htdocs/core/lib/files.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 9f6abcfdeb1..f271fe5505b 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -4,7 +4,7 @@ * Copyright (C) 2012-2016 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2023 Lenin Rivas * * This program is free software; you can redistribute it and/or modify @@ -2218,7 +2218,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring // Create recursive directory iterator /** @var SplFileInfo[] $files */ $files = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($rootPath), + new RecursiveDirectoryIterator($rootPath, FilesystemIterator::UNIX_PATHS), RecursiveIteratorIterator::LEAVES_ONLY ); @@ -2481,7 +2481,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = // This does not return symbolic links /** @var SplFileInfo[] $files */ $files = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($inputdir), + new RecursiveDirectoryIterator($inputdir, FilesystemIterator::UNIX_PATHS), RecursiveIteratorIterator::LEAVES_ONLY ); From 2841f4723c3a59d408d3fe2c4d17b1a96771caf0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Jan 2024 14:58:38 +0100 Subject: [PATCH 2/5] Fix a header must be followed by exit --- .../class/actions_datapolicy.class.php | 1 + htdocs/main.inc.php | 35 ++++++++++--------- htdocs/opensurvey/results.php | 1 + htdocs/resource/card.php | 2 +- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index 481c3b08d09..0e30db94d84 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -127,6 +127,7 @@ class ActionsDatapolicy extends CommonHookActions setEventMessages($langs->trans('ANONYMISER_SUCCESS'), array()); header('Location:'.$_SERVER["PHP_SELF"]."?socid=".$object->id); + exit; } } } elseif ($parameters['currentcontext'] == 'contactcard' && $action == 'send_datapolicy') { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 953b6b6221b..b1af1d0d73d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -987,8 +987,8 @@ if (!defined('NOLOGIN')) { // Account has been removed after login dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING); } elseif ($user->flagdelsessionsbefore && !empty($_SESSION["dol_logindate"]) && $user->flagdelsessionsbefore > $_SESSION["dol_logindate"]) { - // Session is no more valid - dol_syslog("The user has a date for session invalidation = ".$user->flagdelsessionsbefore." and a session date = ".$_SESSION["dol_logindate"].". We must invalidate its sessions."); + // Session is no more valid + dol_syslog("The user has a date for session invalidation = ".$user->flagdelsessionsbefore." and a session date = ".$_SESSION["dol_logindate"].". We must invalidate its sessions."); } elseif ($user->status != $user::STATUS_ENABLED) { // User is not enabled dol_syslog("The user login is disabled"); @@ -996,10 +996,10 @@ if (!defined('NOLOGIN')) { // User validity dates are no more valid dol_syslog("The user login has a validity between [".$user->datestartvalidity." and ".$user->dateendvalidity."], curren date is ".dol_now()); } - session_destroy(); - session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie - session_name($sessionname); - session_start(); + session_destroy(); + session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie + session_name($sessionname); + session_start(); if ($resultFetchUser == 0) { $langs->loadLangs(array('main', 'errors')); @@ -1019,23 +1019,23 @@ if (!defined('NOLOGIN')) { $user->context['audit'] = 'ErrorUserSessionWasInvalidated - login='.$login; } - // Call trigger - $result = $user->call_trigger('USER_LOGIN_FAILED', $user); + // Call trigger + $result = $user->call_trigger('USER_LOGIN_FAILED', $user); if ($result < 0) { $error++; } - // End call triggers + // End call triggers - // Hooks on failed login - $action = ''; - $hookmanager->initHooks(array('login')); - $parameters = array('dol_authmode' => (isset($dol_authmode) ? $dol_authmode : ''), 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); - $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks + // Hooks on failed login + $action = ''; + $hookmanager->initHooks(array('login')); + $parameters = array('dol_authmode' => (isset($dol_authmode) ? $dol_authmode : ''), 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); + $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $error++; } - $paramsurl = array(); + $paramsurl = array(); if (GETPOST('textbrowser', 'int')) { $paramsurl[] = 'textbrowser='.GETPOST('textbrowser', 'int'); } @@ -1045,8 +1045,9 @@ if (!defined('NOLOGIN')) { if (GETPOST('lang', 'aZ09')) { $paramsurl[] = 'lang='.GETPOST('lang', 'aZ09'); } - header('Location: '.DOL_URL_ROOT.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : '')); - exit; + + header('Location: '.DOL_URL_ROOT.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : '')); + exit; } else { // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('main')); diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index 2656500fbc3..46d41906627 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -165,6 +165,7 @@ if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && $object->format = dol_print_error($db); } else { header('Location: results.php?id='.$object->id_sondage); + exit; } } diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index b8d0766e9fb..cba1ab1d2c0 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -174,7 +174,7 @@ if (empty($reshook)) { if ($result >= 0) { setEventMessages($langs->trans('RessourceSuccessfullyDeleted'), null, 'mesgs'); - Header('Location: '.DOL_URL_ROOT.'/resource/list.php'); + header('Location: '.DOL_URL_ROOT.'/resource/list.php'); exit; } else { setEventMessages($object->error, $object->errors, 'errors'); From c06166267eaa6c5abf6a6d68784e3bb30243a554 Mon Sep 17 00:00:00 2001 From: nat <139254654+nat-itopie@users.noreply.github.com> Date: Mon, 8 Jan 2024 02:36:15 +0100 Subject: [PATCH 3/5] FIX #27312 --- htdocs/core/class/extrafields.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 0a77e11981b..eb5f3e45f7a 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1595,8 +1595,10 @@ class ExtraFields $element = $extrafieldsobjectkey; // $extrafieldsobjectkey comes from $object->table_element but we need $object->element if ($element == 'socpeople') { $element = 'contact'; + } else if ( $element == 'projet' ) { + $element = 'project'; } - + //$out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, '', 0, 0, ''); $out = $form->selectForForms($tmparray[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, '', 0, 0, '', $element.':options_'.$key); } elseif ($type == 'password') { From 82c93e6812e1a95f922e9a72a2e9c83c7d1dbbd1 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 10 Jan 2024 15:40:04 +0100 Subject: [PATCH 4/5] FIX: typo when adding height after custom header (#27384) 'extra_under_header_shift' instead of 'extra_under_address_shift' Co-authored-by: Laurent Destailleur --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 018d41dbb53..fddc2866689 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -473,13 +473,13 @@ class pdf_crabe extends ModelePDFFactures $parameters = array( 'object' => $object, 'i' => $i, - 'pdf' =>& $pdf, + 'pdf' => &$pdf, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); $reshook = $hookmanager->executeHooks('printUnderHeaderPDFline', $parameters, $this); // Note that $object may have been modified by hook if (!empty($hookmanager->resArray['extra_under_address_shift'])) { - $extra_under_address_shift += $hookmanager->resArray['extra_under_header_shift']; + $extra_under_address_shift += $hookmanager->resArray['extra_under_address_shift']; } $tab_top += $extra_under_address_shift; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index de9ec3f2a09..0d67dee5dfd 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -480,13 +480,13 @@ class pdf_sponge extends ModelePDFFactures $parameters = array( 'object' => $object, 'i' => $i, - 'pdf' =>& $pdf, + 'pdf' => &$pdf, 'outputlangs' => $outputlangs, 'hidedetails' => $hidedetails ); $reshook = $hookmanager->executeHooks('printUnderHeaderPDFline', $parameters, $this); // Note that $object may have been modified by hook if (!empty($hookmanager->resArray['extra_under_address_shift'])) { - $extra_under_address_shift += $hookmanager->resArray['extra_under_header_shift']; + $extra_under_address_shift += $hookmanager->resArray['extra_under_address_shift']; } $this->tab_top += $extra_under_address_shift; From 6bc40a5e26f48876685d5fa73d72664771f107fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 10 Jan 2024 16:17:30 +0100 Subject: [PATCH 5/5] fix duplicate (#27389) --- htdocs/core/modules/modSociete.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 46e4b4dcd58..ee1f36810b8 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -375,7 +375,7 @@ class modSociete extends DolibarrModules 's.code_compta'=>"AccountancyCode", 's.code_compta_fournisseur'=>"SupplierAccountancyCode", 's.client'=>'Customer', 's.fournisseur'=>'Supplier', 's.address'=>'Address', 's.zip'=>"Zip", 's.town'=>"Town", 's.phone'=>'Phone', 's.email'=>"Email", - 'c.note_private'=>'NotePrivate', 'c.note_public'=>"NotePublic", + 's.note_private'=>'NotePrivate', 's.note_public'=>"NotePublic", 't.code'=>"ThirdPartyType" ); // Add multicompany field