<?php

if (!defined('PARENT')) {
  include(PATH . 'control/system/headers/403.php');
  exit;
}

$basehref = '';
if (isset($SETTINGS->ifolder)) {
  $basehref = (function_exists('mswSSL') && mswSSL() == 'yes' ? str_replace('http://', 'https://', $SETTINGS->ifolder) : $SETTINGS->ifolder);
}

$metaData = [
  'lang' => (isset($msw_html_lang) ? $msw_html_lang : 'en'),
  'dir' => (isset($msw_html_dir) ? $msw_html_dir : 'ltr'),
  'charset' => (isset($msw_html_charset) ? $msw_html_charset : 'utf-8'),
  'basehref' => $basehref,
  'themefolder' => (defined('THEME_FOLDER') ? THEME_FOLDER . '/' : 'content/_theme_default/'),
  'title' => (isset($sysTitle) ? $sysTitle : '')
];

if (isset($SSN) && method_exists($SSN, 'get')) {
  $sspanel = $SSN->get('panel-state');
}

$templateParams['BASE_THEME_PATH'] = (defined('PATH') && defined('THEME_FOLDER') ? PATH . THEME_FOLDER : '');
$templateParams['SOCIAL'] = (isset($HTML) && method_exists($HTML, 'social') ? $HTML->social(array('lang' => array($msw_common10))) : '');
$templateParams['BOXES'] = (isset($HTML) && method_exists($HTML, 'boxes') ? $HTML->boxes() : '');
$templateParams['CSRF_TOKEN'] = $SSN->get('csrf_token');

// Off canvas menu..
$templateParams['NAV_STATE'] = [
  (isset($sspanel) && $sspanel == '0' ? ' in' : (!isset($sspanel) || $sspanel == '' ? ' in' : '')),
  (isset($sspanel) && $sspanel == '1' ? ' in' : ''),
  (isset($sspanel) && $sspanel == '2' ? ' in' : '')
];

$templateParams['ACCOUNT'] = (isset($systemAcc) ? $systemAcc : []);
$templateParams['NAV_PAGES'] = (isset($HTML) && method_exists($HTML, 'pages') ? $HTML->pages() : '');
$templateParams['IS_LOGGED_IN'] = (isset($loggedInUser['id']) ? 'yes' : 'no');
$templateParams['META'] = $metaData;
$templateParams['PRODUCTS_LIST'] = $HTML->products_list();
$templateParams['FROM_DATE'] = (isset($_GET['from']) ? preg_replace('/[^0-9\/-]/', '', $_GET['from']) : '');
$templateParams['TO_DATE'] = (isset($_GET['to']) ? preg_replace('/[^0-9\/-]/', '', $_GET['to']) : '');
$templateParams['SETTINGS'] = (isset($SETTINGS->id) ? (array) $SETTINGS : []);
$templateParams['PLATFORM'] = ($DETECT->isMobile() ? ($DETECT->isTablet() ? 'tablet' : 'mobile') : 'pc');

?>