From 3c223f82c36ae37fe80d1b0783c652c85968af3f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 3 Mar 2025 06:49:58 +0100 Subject: [PATCH 1/2] FIX #20716 Upload SVG in editor --- htdocs/admin/company.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 1e2757154a5..bdf19e2cfae 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -1,13 +1,13 @@ - * Copyright (C) 2004-2019 Laurent Destailleur - * Copyright (C) 2005-2017 Regis Houssin - * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2011-2017 Philippe Grand - * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2017 Rui Strecht - * Copyright (C) 2023 Nick Fragoulis - * Copyright (C) 2024-2025 Frédéric France +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2019 Laurent Destailleur + * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2011-2017 Philippe Grand + * Copyright (C) 2015-2025 Alexandre Spangaro + * Copyright (C) 2017 Rui Strecht + * Copyright (C) 2023 Nick Fragoulis + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -137,7 +137,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) $arrayofimages = array('logo', 'logo_squarred'); //var_dump($_FILES); exit; foreach ($arrayofimages as $varforimage) { - if ($_FILES[$varforimage]["name"] && !preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["name"])) { // Logo can be used on a lot of different places. Only jpg and png can be supported. + if ($_FILES[$varforimage]["name"] && !image_format_supported($_FILES[$varforimage]["name"], 1)) { // Logo can be used on a lot of different places. Recommend using jpg and png for better compatibility. $langs->load("errors"); setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); break; From a90f0863de1a619a67ca19c20ed4484f94ece834 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Mar 2025 16:33:03 +0100 Subject: [PATCH 2/2] Update company.php --- htdocs/admin/company.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index bdf19e2cfae..6188bd2802a 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -137,7 +137,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) $arrayofimages = array('logo', 'logo_squarred'); //var_dump($_FILES); exit; foreach ($arrayofimages as $varforimage) { - if ($_FILES[$varforimage]["name"] && !image_format_supported($_FILES[$varforimage]["name"], 1)) { // Logo can be used on a lot of different places. Recommend using jpg and png for better compatibility. + if ($_FILES[$varforimage]["name"] && !image_format_supported($_FILES[$varforimage]["name"], 0)) { // Logo can be used on a lot of different places. Recommend using jpg and png for better compatibility. $langs->load("errors"); setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); break;