display member photo with hash (#36205)
* display member photo with hash * display member photo with hash * display member photo with hash * display member photo with hash
This commit is contained in:
parent
a00ff66f45
commit
538baecead
2 changed files with 13 additions and 4 deletions
|
|
@ -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 .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
|
||||
}
|
||||
}
|
||||
$ret .= '<img alt="" class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . ' photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">';
|
||||
if (!empty($ecmfiles->share)) {
|
||||
$ret .= '<img alt="" class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . ' photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?hashp=' . urlencode($ecmfiles->share) . '&cache=' . $cache . '">';
|
||||
} else {
|
||||
$ret .= '<img alt="" class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . ' photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">';
|
||||
}
|
||||
if ($addlinktofullsize) {
|
||||
$ret .= '</a>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue