25if (!defined(
'NOREQUIRESOC')) {
26 define(
'NOREQUIRESOC',
'1');
29if (!defined(
'NOTOKENRENEWAL')) {
30 define(
'NOTOKENRENEWAL',
'1');
32if (!defined(
'NOREQUIREMENU')) {
33 define(
'NOREQUIREMENU',
'1');
35if (!defined(
'NOREQUIREHTML')) {
36 define(
'NOREQUIREHTML',
'1');
38if (!defined(
'NOREQUIREAJAX')) {
39 define(
'NOREQUIREAJAX',
'1');
42if (!defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
43 require
'../../main.inc.php';
52$query =
GETPOST(
'query',
'alpha');
64 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
65 require_once DOL_DOCUMENT_ROOT.
'/core/lib/categories.lib.php';
70 $upload_dir =
$conf->categorie->multidir_output[
$object->entity ??
$conf->entity];
71 $pdir =
get_exdir(
$object->id, 2, 0, 0, $object,
'category').$object->id.
"/photos/";
72 $dir = $upload_dir.
'/'.$pdir;
74 foreach (
$object->liste_photos($dir) as $key => $obj) {
75 if ($obj[
'photo_vignette']) {
76 $filename = $obj[
'photo_vignette'];
78 $filename = $obj[
'photo'];
80 $file = DOL_URL_ROOT.
'/viewimage.php?cache=1&publictakepos=1&modulepart=category&entity='.
$object->entity.
'&file='.urlencode($pdir.$filename);
81 header(
'Location: '.$file);
84 header(
'Location: ../../public/theme/common/nophoto.png');
86} elseif ($query ==
"pro") {
87 require_once DOL_DOCUMENT_ROOT.
"/product/class/product.class.php";
91 $image = $objProd->show_photos(
'product',
$conf->product->multidir_output[$objProd->entity ??
$conf->entity],
'small', 1);
94 preg_match(
'@src="([^"]+)"@', $image, $match);
95 $file = array_pop($match);
97 header(
'Location: ../../public/theme/common/nophoto.png');
100 if (!defined(
'INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
101 header(
'Location: '.$file.
'&cache=1');
104 header(
'Location: '.$file.
'&cache=1&publictakepos=1&modulepart=product');
109 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.