<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } require_once '/var/www/shared/encryption.php'; $wsStoreId = (int)($_GET['id'] ?? 0); $wsStore = null; try { if ($wsStoreId > 0) { $wsStore = Database::fetchOne("SELECT id, domain, nickname, store_name, color_master FROM stores WHERE id = :id", [':id' => $wsStoreId]); } } catch (\Throwable $e) { try { if ($wsStoreId > 0) { $wsStore = Database::fetchOne("SELECT id, domain, nickname, store_name FROM stores WHERE id = :id", [':id' => $wsStoreId]); } } catch (\Throwable $e2) {} } if (!$wsStore && $wsStoreId === 0) { $wsStore = ['id' => 0, 'domain' => 'cleanearth.cc', 'nickname' => 'Clean.EARTH', 'store_name' => 'Clean.EARTH', 'color_master' => '#2D6A4F']; } if (!$wsStore) { echo '<div class="toast toast-del">Store not found.</div>'; return; } $wsColor = $wsStore['color_master'] ?? '#2D6A4F'; $wsRawName = $wsStore['store_name'] ?? ''; $wsName = $wsStore['domain']; try { if ($wsRawName) $wsName = Encryption::render($wsRawName) ?: $wsStore['domain']; } catch (\Throwable $e) {} $wsDomain = $wsStore['domain'] ?? 'cleanearth.cc'; $storeIdFilter = $wsStoreId; $wsAction = $_GET['action'] ?? 'products'; $productActions = ['products', 'new_product', 'edit_product', 'new_block', 'layout', 'manage']; $configActions = ['config']; $allValid = array_merge($productActions, $configActions); if (!in_array($wsAction, $allValid)) $wsAction = 'products'; $activeTab = in_array($wsAction, $configActions) ? 'config' : 'products'; 