diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index dafc4f208bc..08124d3a22a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -11051,7 +11051,7 @@ class Form */ public static function showphoto($modulepart, $object, $width = 100, $height = 0, $caneditfield = 0, $cssclass = 'photowithmargin', $imagesize = '', $addlinktofullsize = 1, $cache = 0, $forcecapture = '', $noexternsourceoverwrite = 0) { - global $conf, $langs; + global $conf, $db, $langs; $entity = (empty($object->entity) ? $conf->entity : $object->entity); $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid) @@ -11156,6 +11156,10 @@ class Form $ret = ''; if ($dir) { + require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php'; + $ecmfiles = new EcmFiles($db); + $relativefile = str_replace(DOL_DATA_ROOT .'/', '', $dir.'/'.$originalfile); + $ecmfiles->fetch(0, '', $relativefile); if ($file && file_exists($dir . "/" . $file)) { if ($addlinktofullsize) { $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity); @@ -11165,7 +11169,11 @@ class Form $ret .= ''; } } - $ret .= ''; + if (!empty($ecmfiles->share)) { + $ret .= ''; + } else { + $ret .= ''; + } if ($addlinktofullsize) { $ret .= ''; } diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index e236cab6bd6..cf31808ef44 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2005 Rodolphe Quiedeville * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2016 Regis Houssin - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -82,7 +82,8 @@ if (isset($_GET["modulepart"])) { $needlogin = 0; } // Used by TakePOS Auto Order. TODO Image product may became public in this case. A security check to check that product is in takepos tree must be done later. - if ($_GET["modulepart"] == 'product' && isModEnabled('takepos') && isset($_GET["publictakepos"])) { + // isModEnabled is not defined, DOL_DOCUMENT_ROOT is not defined + if ($_GET["modulepart"] == 'product' /* && isModEnabled('takepos') */ && isset($_GET["publictakepos"])) { $needlogin = 0; } }