<?php

if (!isset($_GET['prd']) || !defined('ACCOUNT_AREA')) {
  include(PATH . 'control/system/headers/403.php');
  exit;
}

$PRD = $SYS->load(array(
  'section' => 'product',
  'id' => (int) $_GET['prd']
));

if (!isset($PRD->id) || $PRD->en == 'no') {
  include(PATH . 'control/system/headers/403.php');
  exit;
}

include(LANG_FLDR . 'footer.php');
include(LANG_FLDR . 'home.php');
include(LANG_FLDR . 'products.php');

$sysTitle = mswCD($PRD->name) . ': ' . mswCD($SETTINGS->website);

include(PATH . 'control/system/modules/_header.php');

$templateParams = [
  'TEXT' => $msw_products,
  'FTEXT' => $msw_footer,
  'HTEXT' => $msw_home,
  'PRODUCT' => $PRD,
  'URL' => mswPromoUrl($PRD->url, $ACC->affcode($loggedInUser)),
  'INTRO' => str_replace('{name}', mswSH($PRD->name), $msw_products[4]),
  'INFO' => $SANTAGS->filter($PRD->info),
  'CODE' => $ACC->affcode($loggedInUser)
];

// Global..
include(PATH . 'control/system/global.php');

$latte->render('acc-product-view.tpl', $templateParams);

include(PATH . 'control/system/modules/_footer.php');

?>
