diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 3c54d3b371f..edb1bc5acd3 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -1134,20 +1134,17 @@ function img_object($alt, $object, $cssclass='') global $conf,$langs; $cssclass = (!empty($cssclass)?'class="'.$cssclass.'"':''); + $path = 'theme/'.$conf->theme; + $url = DOL_URL_ROOT; if (preg_match('/^([^@]+)@([^@]+)$/i',$object,$regs)) { - if (file_exists(DOL_URL_ROOT.'/'.$regs[2].'/img/object_'.$regs[1])) - { - return ''.dol_escape_htmltag($alt).''; - } - else - { - return ''.dol_escape_htmltag($alt).''; - } + $object = $regs[1]; + $path = $regs[2]; + if (! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/object_'.$object.'.png')) $url = DOL_URL_EXTMODULE; } - return ''.dol_escape_htmltag($alt).''; + return ''.dol_escape_htmltag($alt).''; } /** @@ -1166,16 +1163,18 @@ function img_picto($alt, $picto, $options='', $pictoisfullpath=0) global $conf; $path = 'theme/'.$conf->theme; + $url = DOL_URL_ROOT; if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs)) { $picto = $regs[1]; $path = $regs[2]; + if (! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/'.$picto)) $url = DOL_URL_EXTMODULE; } if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto.='.png'; if ($pictoisfullpath) return ''.dol_escape_htmltag($alt).''; - return ''.dol_escape_htmltag($alt).''; + return ''.dol_escape_htmltag($alt).''; } /**