Skip to content

Commit

Permalink
Update dispatcher.php
Browse files Browse the repository at this point in the history
make sure value only defined once

Update Shop.php

suggestions from pululuk

Fix for issue 12412
  • Loading branch information
Prestaworks committed May 19, 2022
1 parent f6736ee commit 696aa6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion classes/shop/Shop.php
Expand Up @@ -396,7 +396,9 @@ public static function initialize()
Configuration::getMultiShopValues('PS_MEDIA_SERVER_3')
);

if ((!$id_shop && defined('_PS_ADMIN_DIR_')) || Tools::isPHPCLI() || in_array($http_host, $all_media)) {
$isAllShop = 'all' === $id_shop;
$isApiInUse = defined('_PS_API_IN_USE_') && _PS_API_IN_USE_;
if ((!$id_shop && defined('_PS_ADMIN_DIR_')) || ($isAllShop && $isApiInUse) || Tools::isPHPCLI() || in_array($http_host, $all_media)) {
// If in admin, we can access to the shop without right URL
if ((!$id_shop && Tools::isPHPCLI()) || defined('_PS_ADMIN_DIR_')) {
$id_shop = (int) Configuration::get('PS_SHOP_DEFAULT');
Expand Down
4 changes: 4 additions & 0 deletions webservice/dispatcher.php
Expand Up @@ -28,6 +28,10 @@

ob_start();

if (!defined('_PS_API_IN_USE_')) {
define('_PS_API_IN_USE_', true);
}

require_once dirname(__FILE__) . '/../config/config.inc.php';

// Cart is needed for some requests
Expand Down

0 comments on commit 696aa6c

Please sign in to comment.