Update index.php

This commit is contained in:
andreubisquerra 2020-05-27 06:48:40 +02:00 committed by GitHub
parent abf7fce108
commit 7d323f4379
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,7 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../../main.inc.php'; // Load $user and permissions if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require '../../main.inc.php'; // Load $user and permissions
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$w = GETPOST('w', 'int'); $w = GETPOST('w', 'int');
@ -60,7 +60,7 @@ if ($query == "cat")
{ {
$filename = $obj['photo']; $filename = $obj['photo'];
} }
$file = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename); $file = DOL_URL_ROOT.'/viewimage.php?cache=1&publictakepos=1&modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename);
header('Location: '.$file); header('Location: '.$file);
exit; exit;
} }
@ -72,12 +72,20 @@ elseif ($query == "pro")
$objProd = new Product($db); $objProd = new Product($db);
$objProd->fetch($id); $objProd->fetch($id);
$image = $objProd->show_photos('product', $conf->product->multidir_output[$entity], 'small', 1); $image = $objProd->show_photos('product', $conf->product->multidir_output[$objProd->entity], 'small', 1);
preg_match('@src="([^"]+)"@', $image, $match); preg_match('@src="([^"]+)"@', $image, $match);
$file = array_pop($match); $file = array_pop($match);
if ($file == "") header('Location: ../../public/theme/common/nophoto.png'); if ($file == "") {
else header('Location: '.$file.'&cache=1'); header('Location: ../../public/theme/common/nophoto.png');
} else {
if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
header('Location: '.$file.'&cache=1');
} else {
header('Location: '.$file.'&cache=1&publictakepos=1&modulepart=product');
}
}
} else header('Location: '.$file.'&cache=1');
} }
else else
{ {