24if (!defined(
'NOREQUIRESOC')) {
25 define(
'NOREQUIRESOC',
'1');
28if (!defined(
'NOTOKENRENEWAL')) {
29 define(
'NOTOKENRENEWAL',
'1');
31if (!defined(
'NOREQUIREMENU')) {
32 define(
'NOREQUIREMENU',
'1');
34if (!defined(
'NOREQUIREHTML')) {
35 define(
'NOREQUIREHTML',
'1');
37if (!defined(
'NOREQUIREAJAX')) {
38 define(
'NOREQUIREAJAX',
'1');
41if (!defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
42 require
'../../main.inc.php';
50$query =
GETPOST(
'query',
'alpha');
62 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
63 require_once DOL_DOCUMENT_ROOT.
'/core/lib/categories.lib.php';
68 $upload_dir = $conf->categorie->multidir_output[
$object->entity ?? $conf->entity];
69 $pdir =
get_exdir(
$object->id, 2, 0, 0, $object,
'category').$object->id.
"/photos/";
70 $dir = $upload_dir.
'/'.$pdir;
72 foreach (
$object->liste_photos($dir) as $key => $obj) {
73 if ($obj[
'photo_vignette']) {
74 $filename = $obj[
'photo_vignette'];
76 $filename = $obj[
'photo'];
78 $file = DOL_URL_ROOT.
'/viewimage.php?cache=1&publictakepos=1&modulepart=category&entity='.
$object->entity.
'&file='.urlencode($pdir.$filename);
79 header(
'Location: '.$file);
82 header(
'Location: ../../public/theme/common/nophoto.png');
84} elseif ($query ==
"pro") {
85 require_once DOL_DOCUMENT_ROOT.
"/product/class/product.class.php";
89 $image = $objProd->show_photos(
'product', $conf->product->multidir_output[$objProd->entity ?? $conf->entity],
'small', 1);
92 preg_match(
'@src="([^"]+)"@', $image, $match);
93 $file = array_pop($match);
95 header(
'Location: ../../public/theme/common/nophoto.png');
98 if (!defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
99 header(
'Location: '.$file.
'&cache=1');
102 header(
'Location: '.$file.
'&cache=1&publictakepos=1&modulepart=product');
107 print
'Invalid param query. Must be "cat" or "pro"';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
Class to manage categories.
Class to manage products or services.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.