public/index-app.php line 1428

Open in your IDE?
  1. <?php
  2. $time_start microtime(true);
  3. ob_start();
  4. $dataLayer = array();
  5. /**
  6.  * @var AssetsResolverService $assetsResolver
  7.  * @var mysqli $db
  8.  * @var Trans $trans
  9.  * @var UrlGeneratorInterface $urlGenerator
  10.  * @var ContainerInterface $container
  11.  * @var ManifestAssets $manifestAssets
  12.  * @var ContainerBagInterface $parameters
  13.  * @var FileStorageService $fileStorageService
  14.  * @var ActiveCategoryCache $activeCategoryCache
  15.  */
  16. require_once __DIR__ "/require.phtml";
  17. require_once __DIR__ "/includes/monthNames.inc";
  18. require_once __DIR__ "/includes/approvedAgreement.php";
  19. require_once __DIR__ '/includes/Categories.php';
  20. require_once __DIR__ '/includes/JsonHelper.php';
  21. require_once __DIR__ '/includes/renderHeroPagePart.php';
  22. require_once __DIR__ '/includes/registerLoginFunctions.php';
  23. require_once __DIR__ '/includes/bankID/bankID-overlay.php';
  24. use Klaravik\Assets\ManifestAssets;
  25. use Klaravik\Banner\BannerService;
  26. use Klaravik\Category\Cache\ActiveCategoryCache;
  27. use Klaravik\Category\CacheCategoryToJsonGenerator;
  28. use Klaravik\Common\Collections\RegisterCollection;
  29. use Klaravik\Exception\RepositoryException;
  30. use Klaravik\includes\Categories;
  31. use Klaravik\Service\AssetsResolverService;
  32. use Klaravik\Storage\FileStorageService;
  33. use Klaravik\Repository\BannerRepository;
  34. use Klaravik\Translate\Trans;
  35. use Symfony\Component\DependencyInjection\ContainerInterface;
  36. use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
  37. use Symfony\Component\HttpFoundation\Request;
  38. use Symfony\Component\HttpFoundation\RequestStack;
  39. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  40. use function Symfony\Component\String\u;
  41. // Initiate categories object.
  42. $categoriesObject = new Categories($trans$urlGenerator);
  43. $assetsResolver $container->get(AssetsResolverService::class);
  44. $fileStorageService $container->get(FileStorageService::class);
  45. $parameters $container->get('parameter_bag');
  46. $language LANGUAGE_ID;
  47. $url "";
  48. // Set title, keywords and description from translations instead of from siteconfig (deprecated)
  49. $title $trans->get("siteconfig_title");
  50. $shortTitle $trans->get("siteconfig_title");
  51. $keywords $trans->get("siteconfig_metakeywords");
  52. $description $trans->get("siteconfig_description");
  53. if (isset($_REQUEST["vote"]) && is_numeric($_REQUEST["vote"])) {
  54.     $pollQuery "SELECT sida FROM answers WHERE id=" $_REQUEST["vote"];
  55.     $pollResult mysqli_query($db$pollQuery);
  56.     if (mysqli_num_rows($pollResult) > 0) {
  57.         $poll mysqli_fetch_object($pollResult);
  58.         if (!empty($_COOKIE["rostat"])) {
  59.             $value $_COOKIE["rostat"] . "|" $poll->sida;
  60.         } else {
  61.             $value $poll->sida;
  62.         }
  63.         setcookie("rostat"$value0"/");
  64.     }
  65. }
  66. include("includes/loginHandler.php");
  67. require_once(__DIR__ "/requestHandlers.phtml");
  68. $dataLayer['userInfo'] = array(
  69.     'id' => (array_key_exists("register_id"$_SESSION) ? $_SESSION['register_id'] : ''),
  70.     'idEmarsys' => (array_key_exists("register_id"$_SESSION) ? 'B' $_SESSION['register_id'] : 'NOTLOGGEDIN'),
  71.     'userType' => (array_key_exists("register_clientType"$_SESSION) ? $_SESSION['register_clientType'] : ''),
  72.     'country' => (array_key_exists("register_country"$_SESSION) ? $_SESSION['register_country'] : ''),
  73. );
  74. if (array_key_exists('is_admin'$_SESSION)) {
  75.     $dataLayer['isAdmin'] = true;
  76. }
  77. if (array_key_exists('registerInfo'$_SESSION)) {
  78.     $dataLayer['userEvent'] = 'createAccount';
  79.     $dataLayer['userRegisterInfo'] = array(
  80.         'id' => $_SESSION['registerInfo']['id'],
  81.         'userType' => $_SESSION['registerInfo']['clientType'],
  82.         'country' => $_SESSION['registerInfo']['country'],
  83.         'sellerLeadCheckbox' => $_SESSION['registerInfo']['sellerLeadCheckbox'],
  84.     );
  85.     unset($_SESSION['registerInfo']);
  86. }
  87. $pid null;
  88. // klaravik.se/<products_id> -> /auktion/produkt/<urlname>
  89. if (isset($_REQUEST['shorturl'])) {
  90.     $productId = (int) $_REQUEST['shorturl'];
  91.     $queryShortUrl mysqli_query($db"SELECT `urlname` FROM `products_description` WHERE `products_id` = " $productId " LIMIT 1");
  92.     if (mysqli_num_rows($queryShortUrl) > 0) {
  93.         $gotoShortUrl mysqli_fetch_object($queryShortUrl);
  94.         $urlParams = ['produrlname' => $gotoShortUrl->urlname];
  95.         if (isset($_REQUEST['s'])) {
  96.             // From SMS
  97.             $urlParams array_merge(
  98.                 $urlParams,
  99.                 ['utm_source' => 'sms''utm_medium' => 'autosms''utm_campaign' => 'smsalert30']
  100.             );
  101.         }
  102.         $url $urlGenerator->generate('app.legacy.auction.object'$urlParams);
  103.         header('Location: ' $url);
  104.         exit();
  105.     }
  106.     // If products_id not found, show 404.
  107.     $_REQUEST['page'] = '404';
  108. }
  109. if (!empty($_REQUEST["produrlname"])) {
  110.     $query "SELECT products_id FROM products_description WHERE urlname='" $db->escape_string($_REQUEST["produrlname"]) . "' AND language_id=" $language;
  111.     $result mysqli_query($db$query);
  112.     if (mysqli_num_rows($result) > 0) {
  113.         $obj mysqli_fetch_object($result);
  114.         $products_id $obj->products_id;
  115.         if ($parameters->get('app.instance') === 'se' && in_array($products_id, [224486201655525563772605712])) {
  116.             header("Location:/"true301);
  117.             exit();
  118.         }
  119.         $dataLayer['pageType'] = 'product';
  120.     } else {
  121.         $_REQUEST['page'] = '404';
  122.     }
  123. }
  124. if (!empty($_REQUEST['caturlname'])) {
  125.     $categoriesUrl $_REQUEST['caturlname'];
  126.     $categoryModel $categoriesObject->getCategoryByUrl($categoriesUrl);
  127.     if (!is_null($categoryModel->getId())) {
  128.         $_REQUEST['catid'] = $categoryModel->getId();
  129.         if ($categoryModel->getCtLevel() > 0) {
  130.             $urlArray explode('/'$categoryModel->getUrl());
  131.             if (count($urlArray)) {
  132.                 $parent $categoriesObject->getCategoryByUrl($urlArray[0]);
  133.                 $_REQUEST['catid'] = $parent->getId();
  134.                 $_REQUEST['subcatid'] = $categoryModel->getId();
  135.             }
  136.         }
  137.         $dataLayer['pageType'] = 'category';
  138.         $dataLayer['categoryName'] = $categoryModel->getName();
  139.     } else {
  140.         // Redirect with 301 to new URL if old URL found.
  141.         // If a matching url is found in the categoriesUrlHistory.
  142.         $categoriesUrlHistoryResult mysqli_query(
  143.             $db,
  144.             sprintf(
  145.                 "SELECT categories_id FROM categoriesUrlHistory WHERE url='%s'",
  146.                 $db->escape_string($categoriesUrl)
  147.             )
  148.         );
  149.         if ($categoriesUrlHistoryResult && mysqli_num_rows($categoriesUrlHistoryResult)) {
  150.             $categoryModel $categoriesObject->getCategory(
  151.                 mysqli_fetch_object($categoriesUrlHistoryResult)->categories_id
  152.             );
  153.             if (!is_null($categoryModel->getId())) {
  154.                 header('HTTP/1.1 301 Moved Permanently');
  155.                 header(sprintf('Location: %s'$categoryModel->getCompleteUrl()));
  156.                 die;
  157.             }
  158.         }
  159.         $explodedCategoriesUrl explode('/'$categoriesUrl);
  160.         $categoriesUrlEnd end($explodedCategoriesUrl);
  161.         $categoryModel $categoriesObject->getCategoryByOldUrlName($categoriesUrlEnd);
  162.         if (!is_null($categoryModel->getId())) {
  163.             $routeName 'app.legacy.auction.listing.category';
  164.             if (!empty($_REQUEST['specialcat']) && 'closed' === $_REQUEST['specialcat']) {
  165.                 $routeName 'app.legacy.auction.listing.closed.category';
  166.             }
  167.             $redirectUrl $urlGenerator->generate($routeName, ['caturlname' => $categoryModel->getUrl()]);
  168.             header('HTTP/1.1 301 Moved Permanently');
  169.             header('Location: ' $redirectUrl);
  170.             die;
  171.         }
  172.         header('Location: /');
  173.         exit();
  174.     }
  175. }
  176. if (
  177.     (isset($_REQUEST['specialcat']) && $_REQUEST['specialcat'] === 'all')
  178.     || (isset($_REQUEST['cat']) && $_REQUEST['cat'] === 'all')
  179. ) {
  180.     $_REQUEST['catid'] = 0;
  181. }
  182. if (!empty($_REQUEST["urlname"])) {
  183.     $query "SELECT id, pagetype FROM pages WHERE url='" $db->escape_string($_REQUEST["urlname"]) . "' AND language=" $language;
  184.     $result mysqli_query($db$query);
  185.     if (mysqli_num_rows($result) > 0) {
  186.         $obj mysqli_fetch_object($result);
  187.         $pid $obj->id;
  188.         $dataLayer['pageType'] = $obj->pagetype;
  189.     }
  190. } elseif (!empty($_REQUEST["page"])) {
  191.     $cres $db->query("SELECT id, pagetype FROM pages WHERE pagetype='" $db->escape_string($_REQUEST['page']) . "' AND language=" $language);
  192.     if (mysqli_num_rows($cres)) {
  193.         $crow mysqli_fetch_object($cres);
  194.         $pid $crow->id;
  195.         $dataLayer['pageType'] = $crow->pagetype;
  196.     } elseif (!isset($dataLayer['pageType'])) {
  197.         $pageName $_REQUEST['page'];
  198.         switch ($pageName) {
  199.             case "auction":
  200.                 if (isset($_REQUEST['specialcat'])) {
  201.                     $pageName "category_" $_REQUEST['specialcat'];
  202.                 }
  203.                 break;
  204.             case "login":
  205.                 if (isset($_REQUEST['logintab'])) {
  206.                     $pageName .= "_" $_REQUEST['logintab'];
  207.                 }
  208.                 break;
  209.             case "buyer":
  210.                 if (isset($_REQUEST['buyertab'])) {
  211.                     $pageName .= "_" $_REQUEST['buyertab'];
  212.                 }
  213.                 break;
  214.             case "vendor":
  215.                 if (isset($_REQUEST['vendortab'])) {
  216.                     $pageName .= "_" $_REQUEST['vendortab'];
  217.                     if ($_REQUEST['vendortab'] === 'reports' || $_REQUEST['vendortab'] === 'overview' || $_REQUEST['vendortab'] === 'info') {
  218.                         $manifestAssets->add('bundle-ui-Tooltip/kTooltip');
  219.                     }
  220.                 } else {
  221.                     $manifestAssets->add('bundle-ui-Tooltip/kTooltip');
  222.                 }
  223.                 break;
  224.             case "register":
  225.             case "register_thanks":
  226.                 if (isset($_REQUEST['clienttype'])) {
  227.                     $pageName .= "_" $_REQUEST['clienttype'];
  228.                 }
  229.                 break;
  230.             default:
  231.                 break;
  232.         }
  233.         $dataLayer['pageType'] = $pageName;
  234.         if (!empty($_REQUEST['searchtext'])) {
  235.             $dataLayer['pageType'] = 'search';
  236.         }
  237.     }
  238. } else {
  239.     $dataLayer['pageType'] = "frontpage";
  240. }
  241. // The variable $page is used in various places with wildy different
  242. // data. Somtimes it is a string of the pagetype, other times it is
  243. // an object with page data. Unfortunately I don't know why that is,
  244. // so I don't dare change it. I'll just add another variable to the
  245. // fray. It is used to add a unique class to the body element in
  246. // order to be able to style pages with unique layouts, e.g. the
  247. // about page.
  248. $pagetype call_user_func(static function ($pid) use ($db) {
  249.     if (!is_numeric($pid)) {
  250.         return null;
  251.     }
  252.     $res mysqli_query($db"SELECT pagetype FROM pages WHERE id = " . (int) $pid);
  253.     return mysqli_fetch_object($res)->pagetype;
  254. }, $pid);
  255. $continueUrlParams = [];
  256. if ((isset($_REQUEST['page'])) && ($_REQUEST['page'] == 'auction')) {
  257.     $continueUrlParams['continue'] = $_SERVER['REQUEST_URI'];
  258. }
  259. $jsParams = [];
  260. foreach ($parameters->all() as $key => $value) {
  261.     $stringKey u($key);
  262.     if (!$stringKey->startsWith('js.param.')) {
  263.         continue;
  264.     }
  265.     $jsKey strtolower($stringKey->trimStart('js.param.'));
  266.     $jsParams[$jsKey] = $value;
  267. }
  268. if (isset($_SESSION['dataLayer']) && count($_SESSION['dataLayer'])) {
  269.     $dataLayer array_merge($dataLayer$_SESSION['dataLayer']);
  270.     unset($_SESSION['dataLayer']);
  271. }
  272. /**
  273.  * @var \Symfony\Component\HttpFoundation\Request $request
  274.  */
  275. if (isset($_REQUEST['page'], $products_id) && $_REQUEST["page"] === "auction") {
  276.     $ogImage getFirstProductImageUrl($db$products_id);
  277. } else {
  278.     $ogImage $request->getSchemeAndHttpHost() . '/images/klaravik-share-icon-200x200.png';
  279. }
  280. /** @var \Klaravik\Page\PropUserData $propUserData */
  281. $propUserData $container->get(\Klaravik\Page\PropUserData::class);
  282. $propUserName $propUserData->getUserName();
  283. $propLogged $propUserData->isLogged();
  284. $propUser $propUserData->getUserType();
  285. $propAlias $propUserData->getAlias();
  286. $propMultiUser $propUserData->isMultiUser();
  287. $multiRegisterCollection $propUserData->getMultiRegisterCollection();
  288. $multiUserCollection $propUserData->getMultiUserCollection();
  289. if (isset($pid) && is_numeric($pid)) {
  290.     try {
  291.         $pageObject = (new \Klaravik\Repository\PageRepository())->getById($pid);
  292.         if (!empty($pageObject->getTitle())) {
  293.             $title $pageObject->getTitle();
  294.             $shortTitle $pageObject->getTitle();
  295.         }
  296.         if (!empty($pageObject->getMetaKeyword())) {
  297.             $keywords $pageObject->getMetaKeyword();
  298.         }
  299.         if (!empty($pageObject->getMetaDescription())) {
  300.             $description $pageObject->getMetaDescription();
  301.         }
  302.         // Kontrollera om det finns nÃ¥gon enkät pÃ¥ sidan
  303.         $textEnkatQuery "SELECT enkat_id FROM text WHERE sida=" . (int) $pid " AND enkat_id > 0";
  304.         $textEnkatResult mysqli_query($db$textEnkatQuery);
  305.         if (mysqli_num_rows($textEnkatResult)) {
  306.             $textEnkat mysqli_fetch_object($textEnkatResult);
  307.             $enkatQuery "SELECT id, overskrift FROM enkat WHERE id=" . (int) $textEnkat->enkat_id;
  308.             $enkatResult mysqli_query($db$enkatQuery);
  309.             if (mysqli_num_rows($enkatResult)) {
  310.                 $enkat mysqli_fetch_object($enkatResult);
  311.                 if (!array_key_exists('formEditor'$dataLayer)) {
  312.                     $dataLayer['formEditor'] = array(
  313.                         'id' => $enkat->id,
  314.                         'name' => $enkat->overskrift,
  315.                         'submitted' => false
  316.                     );
  317.                 }
  318.             }
  319.         }
  320.         if ($pageObject->getWordpressPageId() > 0) {
  321.             /** @var \Klaravik\Page\MarketWpClient $marketWordPressClient */
  322.             $marketWordPressClient $container->get(\Klaravik\Page\MarketWpClient::class);
  323.             echo $marketWordPressClient->getPageHTML($pageObject$propUserData$jsParams$dataLayercompact(
  324.                 'title',
  325.                 'keywords',
  326.                 'description',
  327.                 'ogImage',
  328.                 'shortTitle',
  329.             ));
  330.             die;
  331.         }
  332.     } catch (RepositoryException $e) {
  333.     }
  334. }
  335. if (!empty($_REQUEST["produrlname"]) && isset($products_id)) {
  336.     $prodtQuery "SELECT p.page_title, pd.name, p.meta_keyword, p.meta_description, p.categories_id, p.vendors_id, p.resprice, p.auctionend FROM products p LEFT JOIN products_description pd on p.id=pd.products_id WHERE p.id='" mysqli_real_escape_string($db$products_id) . "'";
  337.     $prodtResult mysqli_query($db$prodtQuery);
  338.     if (mysqli_num_rows($prodtResult) == 0) {
  339.         $prodtQuery "SELECT p.page_title, pd.name, p.meta_keyword, p.meta_description, p.categories_id, p.vendors_id, p.resprice, p.auctionend FROM products_archive p LEFT JOIN products_description pd on p.id=pd.products_id WHERE p.id='" mysqli_real_escape_string($db$products_id) . "'";
  340.         $prodtResult mysqli_query($db$prodtQuery);
  341.     }
  342.     if (mysqli_num_rows($prodtResult) > 0) {
  343.         $prodt mysqli_fetch_object($prodtResult);
  344.         if ($prodt->page_title !== '') {
  345.             $title $prodt->page_title;
  346.             $shortTitle $prodt->page_title;
  347.         } elseif (!empty($prodt->name)) {
  348.             $title $trans->get("ALIAS_TITLE_PREFIX_OBJECT") . " " $prodt->name;
  349.             $shortTitle $prodt->name;
  350.         }
  351.         if (!empty($prodt->meta_keyword)) {
  352.             $keywords $prodt->meta_keyword;
  353.         }
  354.         if (!empty($prodt->meta_description)) {
  355.             $description $trans->get("ALIAS_DESCRIPTION_PREFIX_OBJECT") . " " $prodt->meta_description;
  356.         } elseif (!empty($prodt->name)) {
  357.             $description $trans->get("ALIAS_DESCRIPTION_PREFIX_OBJECT") . " " $prodt->name;
  358.         }
  359.         $curBid null;
  360.         $bidSql "SELECT bid FROM bids WHERE products_id=" . (int) $products_id " ORDER BY bid DESC LIMIT 1";
  361.         $bidRes mysqli_query($db$bidSql);
  362.         if (mysqli_num_rows($bidRes)) {
  363.             $bid mysqli_fetch_object($bidRes);
  364.             $curBid $bid->bid;
  365.         }
  366.         $resPriceReached false;
  367.         if ((($curBid !== null && ($curBid >= $prodt->resprice && $prodt->resprice 0)) || ($curBid $prodt->resprice && $prodt->resprice == 0)) || $prodt->resprice == 0) {
  368.             $resPriceReached true;
  369.         }
  370.         $categoriesToImplode = array();
  371.         foreach ($categoriesObject->getPublicThreeForCategory($prodt->categories_id) as $categoryItem) {
  372.             $categoriesToImplode[] = $categoryItem->getName();
  373.         }
  374.         try {
  375.             $productHasEnded = (new DateTime()) > (new DateTime($prodt->auctionend));
  376.         } catch (Exception $e) {
  377.             $productHasEnded false;
  378.         }
  379.         $dataLayer['view'] = (int) $products_id;
  380.         $dataLayer['product'] = array(
  381.             'productsId' => (int) $products_id,
  382.             'categoriesId' => (int) $prodt->categories_id,
  383.             'categoryName' => implode('>'$categoriesToImplode),
  384.             'vendorsId' => (int) $prodt->vendors_id,
  385.             'name' => $prodt->name,
  386.             'resPriceReached' => $resPriceReached,
  387.             'zeroReserve' => === (int)$prodt->resprice,
  388.             'ended' => $productHasEnded,
  389.         );
  390.     }
  391. }
  392. $validRequestPage = [
  393.     "login",
  394.     "register",
  395.     "register_thanks",
  396.     "activate",
  397.     "forgot",
  398.     "editcustomer",
  399.     "trustpilot",
  400.     "faq",
  401.     "vendorRegistration",
  402.     "about",
  403.     "howtobuy",
  404.     "howtosell",
  405.     "allrealtors",
  406.     "contactrealtor",
  407.     "buyer",
  408.     "favorites",
  409.     "swish",
  410.     "exportdocuments",
  411.     "requestAdvance",
  412.     "requestAdvanceNo",
  413.     "vendor",
  414.     "ui-lib",
  415.     "404",
  416.     "english",
  417.     "kopinfo",
  418.     "savedSearch",
  419.     "saljinfo",
  420.     "app-download",
  421.     "text",
  422.     "form_thanks",
  423.     "auction",
  424.     "financing",
  425.     "finansiering",
  426.     "contact",
  427.     "dac7",
  428. ];
  429. if (isset($_REQUEST["page"]) && !in_array($_REQUEST["page"], $validRequestPage)) {
  430.     $_REQUEST['page'] = "404";
  431. }
  432. if (isset($_REQUEST['page']) && (string) $_REQUEST["page"] === "404") {
  433.     header("HTTP/1.1 404 Not Found");
  434.     $title $trans->get('error_page_not_found_title');
  435. }
  436. $metaCategoryId null;
  437. if (isset($_REQUEST['subcatid']) && (int) $_REQUEST['subcatid']) {
  438.     $metaCategoryId = (int) $_REQUEST['subcatid'];
  439. } elseif (isset($_REQUEST['catid']) && (int) $_REQUEST['catid']) {
  440.     $metaCategoryId = (int) $_REQUEST['catid'];
  441. }
  442. if (null !== $metaCategoryId) {
  443.     $categoryModel $categoriesObject->getCategory($metaCategoryId);
  444.     if ($categoryModel->getHeadtitle() !== '') {
  445.         $title $shortTitle $categoryModel->getHeadtitle();
  446.     }
  447.     if ($categoryModel->getMetadescription() !== '') {
  448.         $description $categoryModel->getMetadescription();
  449.     }
  450. }
  451. if (DEV_MODE) {
  452.     $title basename(__DIR__) . ' ' $title;
  453. }
  454. global $includedJavaScript;
  455. $includedJavaScript = array();
  456. function includeJS($string$inline false)
  457. {
  458.     global $includedJavaScript;
  459.     $includedJavaScript[] = array(
  460.         'string' => $string,
  461.         'inline' => $inline
  462.     );
  463. }
  464. global $includedCSS;
  465. $includedCSS = array();
  466. function includeCSS($url$media "screen")
  467. {
  468.     global $includedCSS;
  469.     $includedCSS[] = array(
  470.         'url' => $url,
  471.         'media' => $media
  472.     );
  473. }
  474. $manifestAssets->add('bundle-checkBrowser');
  475. /*
  476.  * make sure that $currentpage also considers clienttype so we can
  477.  * differentiate register pages and what assets to include separately by clienttype
  478.  */
  479. $currentPage 'home';
  480. if (isset($_REQUEST['page'])) {
  481.     $currentPage $_REQUEST['page'];
  482.     if (isset($_REQUEST['clienttype'])) {
  483.         $currentPage .= '_' $_REQUEST['clienttype'];
  484.     }
  485. }
  486. $additionalBodyClass = [];
  487. // All css included before this is set as default.
  488. switch ($currentPage) {
  489.     case "contactrealtor":
  490.     case "howtosell":
  491.         includeCSS('/css/vendors/mapbox-gl@v1.10.1.css');
  492.         break;
  493.     case "requestAdvance":
  494.         $manifestAssets->add('bundle-common');
  495.         break;
  496.     case "vendor":
  497.         includeCSS('/css/jquery-ui.min.css');
  498.         includeCSS('/css/jquery.qtip.css');
  499.         includeCSS('/css/select2.min.css');
  500.         break;
  501.     case "annons":
  502.     case "404":
  503.     case "english":
  504.     case "kopinfo":
  505.     case "saljinfo":
  506.     case "text":
  507.     case "form_thanks":
  508.         $manifestAssets->add('bundle-common');
  509.         break;
  510.     case "auction":
  511.         // page_product || page_list
  512.         includeCSS('/css/page-product.css');
  513.         if (isset($products_id)) {
  514.             // page_product.phtml
  515.             includeCSS('/css/jquery-ui.min.css');
  516.             // Single-product
  517.             $manifestAssets
  518.                 ->add('shared')
  519.                 ->add('bundle-single-product');
  520.             $additionalBodyClass array_merge($additionalBodyClass, ['page''product']);
  521.         } else {
  522.             // page_list
  523.             $additionalBodyClass array_merge($additionalBodyClass, ['page''product''list']);
  524.         }
  525.         break;
  526.     case "financing":
  527.         // page_financing
  528.         includeCSS('/css/jquery-ui.min.css');
  529.         break;
  530.     case "home":
  531.         // home - page_list
  532.         $additionalBodyClass array_merge($additionalBodyClass, ['page''all''product''list']);
  533.         break;
  534.     case "vendorRegistration":
  535.         includeCSS('/css/jquery-ui.min.css');
  536.         $manifestAssets
  537.             ->add('bundle-common')
  538.             ->add('shared')
  539.             ->add('bundle-register-new-seller');
  540.         break;
  541.     case "favorites":
  542.         includeCSS('/css/page-product.css');
  543.         $additionalBodyClass array_merge($additionalBodyClass, ['auction''page''list']);
  544.         break;
  545.     case "savedSearch":
  546.         $manifestAssets->add('bundle-common')->add("shared")->add("bundle-saved-search");
  547.         break;
  548.     case "dac7":
  549.         includeCSS('/css/jquery-ui.min.css');
  550.         break;
  551.     default:
  552.         // prints "Unknown page.\n";
  553.         // Should not be handled as default for css.
  554.         break;
  555. }
  556. $products_id $products_id ?? null;
  557. /** @var Twig\Environment $twigEnvironment */
  558. $twigEnvironment $container->get('twig');
  559. try {
  560.     $cachedJsonCategories = (new CacheCategoryToJsonGenerator())->generate($activeCategoryCache->cachedCategories());
  561. } catch (\Psr\Cache\InvalidArgumentException $e) {
  562.     $cachedJsonCategories json_encode([]);
  563. }
  564. ?>
  565. <!DOCTYPE html>
  566. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $parameters->get('app.lang'); ?>"
  567.     lang="<?php echo $parameters->get('app.lang'); ?>" data-market="<?php echo $parameters->get('app.instance'); ?>">
  568. <head>
  569.     <script type="text/javascript">
  570.         window.cachedCategories = <?php echo $cachedJsonCategories?>;
  571.         window.params = <?php echo json_encode($jsParams); ?>;
  572.         dataLayer = [<?php echo json_encode($dataLayer); ?>];
  573.         savedSearchURL = '<?php echo $urlGenerator->generate('app.buyer.saved.savedSearch'); ?>';
  574.     </script>
  575.     <?php
  576.     if (array_key_exists("preview"$_REQUEST)) {
  577.         ?>
  578.         <meta name="robots" content="noindex">
  579.         <?php
  580.     }
  581.     includeJS('/assets/js/modernizr.js');
  582.     echo $twigEnvironment->render('public/head.html.twig'compact(
  583.         'title',
  584.         'keywords',
  585.         'description',
  586.         'ogImage',
  587.         'shortTitle',
  588.         'products_id',
  589.         'includedCSS',
  590.         'currentPage',
  591.         'manifestAssets',
  592.     ));
  593.     ?>
  594. </head>
  595. <?php
  596. $skipChat true;
  597. if (ZENDESKCHAT) {
  598.     $skipChat false;
  599.     if (!empty($_SESSION["users_id"])) {
  600.         $userObj getNodei($db"users"$_SESSION["users_id"]);
  601.         if ($userObj->auth_user != "") {
  602.             $skipChat true;
  603.         }
  604.     }
  605. }
  606. // Check if buyer has all necessary SESSIONS, if not log out the buyer.
  607. if (isset($_SESSION["register_id"]) && !isRegisterSignedIn()) {
  608.     unsetRegisterSessions();
  609.     header('Location: /');
  610. }
  611. if (
  612.     $parameters->get('app.bankid.enable') &&
  613.     isset($_SESSION['register_id']) &&
  614.     $_SESSION['bankIDActive'] === false &&
  615.     isset($_SESSION['register_clientType']) &&
  616.     !in_array($_SESSION['register_clientType'], ['UF''UP']) &&
  617.     !$_SESSION['exceptRequiredAuthentication']
  618. ) {
  619.     $additionalBodyClass[] = 'user-bankid-verification';
  620. }
  621. if ($pagetype) {
  622.     print "<body class=\"" htmlspecialchars($pagetype) . " " implode(' '$additionalBodyClass) . "\">\n";
  623. } elseif (isset($_REQUEST["page"])) {
  624.     /**
  625.      * if register pages, give class name of .register and .register_{type}
  626.      ** (seems to be register pages and register/thank-you pages)
  627.      * else only $_REQUEST['page'] as classname (pages without clienttype set)
  628.      */
  629.     print "<body class=\"
  630.         " . (isset($_REQUEST["clienttype"]) ? htmlspecialchars($_REQUEST["page"]) . "
  631.         " htmlspecialchars($_REQUEST["page"]) . "_" $_REQUEST["clienttype"] : htmlspecialchars($_REQUEST["page"]))
  632.         . (isset($_REQUEST['specialcat']) ? ' ' htmlspecialchars($_REQUEST['specialcat']) : '')
  633.         . (isset($categoriesUrl) ? ' ' $categoriesUrl '')
  634.         . (isset($_REQUEST['vendortab']) ? ' ' htmlspecialchars($_REQUEST['vendortab']) : '')
  635.         . ' ' implode(' '$additionalBodyClass) . "
  636.     \">\n";
  637. } else {
  638.     print "<body class=\"frontpage " implode(' '$additionalBodyClass) . "\">\n";
  639. }
  640. if (!DEV_MODE) {
  641.     if (!empty($parameters->get('gtm.serverside')) && true === $parameters->get('gtm.serverside') && !empty($parameters->get('gtm.serverside.id'))) {
  642.     ?>
  643.     <!-- Google Tag Manager (noscript) -->
  644.     <noscript><iframe src="https://load.ss.klaravik.se/ns.html?id=<?php echo $parameters->get('gtm.serverside.id'); ?>" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  645.     <!-- End Google Tag Manager (noscript) -->
  646.     <?php
  647.     } elseif (!empty($parameters->get('gtm.id'))) {
  648.     ?>
  649.     <!-- Google Tag Manager (noscript) -->
  650.     <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<?php echo $parameters->get('gtm.id'); ?>" height="0"
  651.             width="0" style="display:none;visibility:hidden"></iframe></noscript>
  652.     <!-- End Google Tag Manager (noscript) -->
  653.     <?php
  654.     }
  655. } elseif (DEV_MODE && !empty($parameters->get('gtm.id.dev'))) {
  656.     $gitString '';
  657.     $branchName 'master';
  658.     if (is_file(PROJECT_ROOT '/.git/HEAD')) {
  659.         $gitString file_get_contents(PROJECT_ROOT '/.git/HEAD'FILE_USE_INCLUDE_PATH);
  660.         $branchName rtrim(preg_replace("/(.*?\/){2}/"''$gitString));
  661.     }
  662.     $branch_cookie $_COOKIE['devBranch'] ?? '';
  663.     ?>
  664.     <!-- Google Tag Manager (noscript) -->
  665.     <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<?php echo $parameters->get('gtm.id.dev'); ?>"
  666.             height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  667.     <!-- End Google Tag Manager (noscript) -->
  668.     <?php
  669.     $twig->display('dev/dev_menu.html.twig', [
  670.         "devMenu" => new Dev\DevMenuController(),
  671.         "branchCookie" => $branch_cookie,
  672.         "branchName" => $branchName,
  673.     ]);
  674. }
  675. ?>
  676. <script>
  677.     let isInitialized = false;
  678.     const kLocale = window.params.klocale;
  679.     const kLanguage = window.params.klanguage;
  680. </script>
  681. <?php
  682. $propSearchtext "";
  683. if (!empty($_REQUEST['searchtext'])) {
  684.     $propSearchtext $_REQUEST['searchtext'];
  685. }
  686. $propSearchtext urldecode($propSearchtext);
  687. $requestSetCountyFlag $_REQUEST['setcountyflag'] ?? null;
  688. $setCountyFlagData = [];
  689. if ($requestSetCountyFlag) {
  690.     $setCountyFlagData[] = $requestSetCountyFlag;
  691.     if (is_array($requestSetCountyFlag)) {
  692.         $setCountyFlagData $requestSetCountyFlag;
  693.     }
  694.     $setCountyFlagData array_filter($setCountyFlagData, fn($v) => (is_numeric($v) || "all" === $v));
  695. }
  696. $requestSetMunicipality $_REQUEST['setmunicipality'] ?? null;
  697. $setMunicipalityData = [];
  698. if ($requestSetMunicipality) {
  699.     $setMunicipalityData[] = $requestSetMunicipality;
  700.     if (is_array($requestSetMunicipality)) {
  701.         $setMunicipalityData $requestSetMunicipality;
  702.     }
  703.     $setMunicipalityData array_filter($setMunicipalityData, fn($v) => (is_numeric($v) || "all" === $v || "countyclose" === $v));
  704. }
  705. if ($propMultiUser):
  706.     $multiAccounts = [
  707.         [
  708.             'title' => $trans->get('text_label_app-index_company-accounts'),
  709.             'data' => $multiRegisterCollection->getCompanyTypes(),
  710.         ],
  711.         [
  712.             'title' => $trans->get('text_label_app-index_private-account'),
  713.             'data' => $multiRegisterCollection->getPrivateTypes(),
  714.         ]
  715.     ];
  716.     $lockedCss = !isset($_SESSION['register_id']) && !isset($_SESSION['users_id']) ? 'show lock' '';
  717.     ?>
  718.     <!--Modal account-switcher-->
  719.     <div class="account-switcher <?php echo $lockedCss?>" id="account-switcher">
  720.         <div class="account-switcher__container" id="modal-container">
  721.             <div class="account-switcher__close-modal" id="account-switcher-close">
  722.                 <i class="ri-close-fill"></i>
  723.             </div>
  724.             <div class="account-switcher__flex">
  725.                 <div class="account-switcher__inner">
  726.                     <div class="account-switcher__icon">
  727.                         <i class="ri-arrow-left-right-line"></i>
  728.                     </div>
  729.                     <div class="row">
  730.                         <div class="small-10 small-offset-1 medium-12 medium-offset-0">
  731.                             <div class="account-switcher__header">
  732.                                 <span
  733.                                     class="account-switcher__headline"><?php $trans->eGet('text_headline_app-index_account-switcher'); ?></span>
  734.                             </div>
  735.                         </div>
  736.                     </div>
  737.                     <div class="account-switcher__accounts">
  738.                         <div class="account-switcher__account-group">
  739.                             <div class="account-switcher__account-title">
  740.                                 <?php $trans->eGet('text_label_app-index_buyer-accounts'); ?>:
  741.                             </div>
  742.                             <?php
  743.                             /** @var RegisterCollection $multiAccount */
  744.                             foreach ($multiAccounts as $multiAccount):
  745.                                 if (!$multiAccount['data']->count()) {
  746.                                     continue;
  747.                                 }
  748.                                 ?>
  749.                                 <?php
  750.                                 /** @var \Klaravik\Model\Register $accountData */
  751.                                 foreach ($multiAccount['data'] as $accountData):
  752.                                     $clientTypeString $trans->get(
  753.                                         'text_label_app-index_client-type',
  754.                                         ['clientType' => $accountData->getClienttype()]
  755.                                     );
  756.                                     if ($accountData->getClienttype() === 'SF' && $accountData->isSoleProprietorship()) {
  757.                                         $clientTypeString $trans->get(
  758.                                             'text_label_app-index_client-type',
  759.                                             ['clientType' => 'EF']
  760.                                         );
  761.                                     }
  762.                                     $inactiveAccount '';
  763.                                     if (!$accountData->getActive()) {
  764.                                         $clientTypeString $trans->get('text_label_app-index_inactive-account');
  765.                                         $inactiveAccount 'inactive';
  766.                                     }
  767.                                     switch ($accountData->getClienttype()) {
  768.                                         case "SF":
  769.                                             $icon 'ri-home-smile-fill';
  770.                                             // Check if EF.
  771.                                             if ($accountData->isSoleProprietorship()) {
  772.                                                 $icon 'ri-user-smile-fill';
  773.                                             }
  774.                                             break;
  775.                                         case "SP":
  776.                                             $icon 'ri-user-fill';
  777.                                             break;
  778.                                     }
  779.                                     $activeAccount '';
  780.                                     $switchUserIcon 'ri-arrow-right-line';
  781.                                     $disableSwitch 'submitFunction(this);';
  782.                                     if ($accountData->getId() === (int) ($_SESSION['register_id'] ?? 0)) {
  783.                                         $activeAccount 'active';
  784.                                         $switchUserIcon 'ri-check-fill';
  785.                                         $disableSwitch 'return false';
  786.                                     }
  787.                                     ?>
  788.                                     <div class="">
  789.                                         <?php
  790.                                         echo <<<HTML
  791.                             <form class="account-switcher__form" action="{$urlGenerator->generate(
  792.                                                 'app.legacy.index',
  793.                                                 array_merge(
  794.                                                     ['doSwitchUser' => (int) $accountData->getId(), 'userType' => 'register'],
  795.                                                     $continueUrlParams
  796.                                                 ),
  797.                                                 UrlGeneratorInterface::ABSOLUTE_URL
  798.                                             )}" method="post">
  799.                             HTML;
  800.                                         ?>
  801.                                         <div class="account-switcher__account <?php echo $activeAccount;
  802.                                         echo $inactiveAccount ?>">
  803.                                             <span class="account-switcher__account-icon <?php echo $activeAccount?>">
  804.                                                 <i class="<?php echo $icon?>"></i>
  805.                                             </span>
  806.                                             <span class="account-switcher__user-and-type">
  807.                                                 <div class="account-switcher__user-name <?php echo $inactiveAccount?>">
  808.                                                     <?php echo $accountData->getRegisterName(); ?>
  809.                                                 </div>
  810.                                                 <div class="account-switcher__client-type <?php echo $inactiveAccount?>">
  811.                                                     <?php echo $clientTypeString?>
  812.                                                 </div>
  813.                                             </span>
  814.                                             <?php if ($accountData->getActive()) { ?>
  815.                                                 <span class="account-switcher__icon-switch <?php echo $activeAccount?>">
  816.                                                     <i class="<?php echo $switchUserIcon?>"></i>
  817.                                                 </span>
  818.                                                 <div class="account-switcher__icon-loader"
  819.                                                     data-src="/images/lottie-animations/loader.json"></div>
  820.                                             <?php } else {
  821.                                                 // TODO: Should be an ajax-request to the endpoint /api/buyer/{register_id}/activation/send
  822.                                                 echo '<span class="account-switcher__activation-link" id="send-activation-button" data-registerid="' $accountData->getId() . '">
  823.                                     <span class="mail-icon-text"><i class="ri-mail-send-line"></i>' $trans->get("text_label_app-index_account-switcher_send-verification-mail") . '</span>
  824.                                   </span>';
  825.                                             } ?>
  826.                                         </div>
  827.                                         </form>
  828.                                     </div>
  829.                                 <?php endforeach; ?>
  830.                             <?php endforeach; ?>
  831.                         </div>
  832.                         <?php if (!empty($multiUserCollection->toArray())) { ?>
  833.                             <div class="account-switcher__account-group">
  834.                                 <div class="account-switcher__account-title">
  835.                                     <?php $trans->eGet('text_label_app-index_vendor-accounts'?>:
  836.                                 </div>
  837.                                 <?php
  838.                                 foreach ($multiUserCollection as $userAccount):
  839.                                     // Todo:
  840.                                     // active
  841.                                     // Form action till switcher
  842.                                     $currentAccount '';
  843.                                     if ($userAccount->getId() === (int) ($_SESSION['users_id'] ?? 0)) {
  844.                                         $currentAccount '->';
  845.                                     }
  846.                                     ?>
  847.                                     <?php
  848.                                     $inactiveAccount '';
  849.                                     if (!$userAccount->getActive()) {
  850.                                         $clientTypeString $trans->get('text_label_app-index_inactive-account');
  851.                                         $inactiveAccount 'inactive';
  852.                                     }
  853.                                     $activeAccount '';
  854.                                     $icon 'ri-briefcase-5-fill';
  855.                                     $switchUserIcon 'ri-arrow-right-line';
  856.                                     $disableSwitch 'submitFunction(this);';
  857.                                     if ($userAccount->getId() === (int) ($_SESSION['users_id'] ?? 0)) {
  858.                                         $activeAccount 'active';
  859.                                         $switchUserIcon 'ri-check-fill';
  860.                                         $disableSwitch 'return false';
  861.                                     }
  862.                                     ?>
  863.                                     <div>
  864.                                         <?php
  865.                                         $postUrlForm $urlGenerator->generate(
  866.                                             'app.legacy.index',
  867.                                             array_merge(
  868.                                                 ['doSwitchUser' => (int) $userAccount->getId(), 'userType' => 'user'],
  869.                                                 $continueUrlParams
  870.                                             ),
  871.                                             UrlGeneratorInterface::ABSOLUTE_URL
  872.                                         );
  873.                                         ?>
  874.                                         <form class="account-switcher__form" action="<?php echo $postUrlForm?>" method="post">
  875.                                             <div class="account-switcher__account <?php echo $activeAccount;
  876.                                             echo $inactiveAccount ?>">
  877.                                                 <span class="account-switcher__account-icon <?php echo $activeAccount?>">
  878.                                                     <i class="<?php echo $icon?>"></i>
  879.                                                 </span>
  880.                                                 <span class="account-switcher__user-and-type">
  881.                                                     <div class="account-switcher__user-name <?php echo $inactiveAccount?>">
  882.                                                         <?php echo $userAccount->getName(); ?>
  883.                                                     </div>
  884.                                                     <div class="account-switcher__client-type <?php echo $inactiveAccount?>">
  885.                                                         <?php $trans->eGet('text_label_app-index_clienttype_vendor'); ?>
  886.                                                     </div>
  887.                                                 </span>
  888.                                                 <?php if ($userAccount->getActive()) { ?>
  889.                                                     <span class="account-switcher__icon-switch <?php echo $activeAccount?>">
  890.                                                         <i class="<?php echo $switchUserIcon?>"></i>
  891.                                                     </span>
  892.                                                     <div class="account-switcher__icon-loader"
  893.                                                         data-src="/images/lottie-animations/loader.json"></div>
  894.                                                 <?php ?>
  895.                                             </div>
  896.                                         </form>
  897.                                     </div>
  898.                                 <?php endforeach; ?>
  899.                             </div>
  900.                         <?php ?>
  901.                     </div>
  902.                 </div>
  903.             </div>
  904.             <a class="account-switcher__logout" id="account-switcher-button" href="<?php echo ($propUser === 'seller'
  905.                 $urlGenerator->generate('app.legacy.pages.vendor.logout')
  906.                 : $urlGenerator->generate('app.legacy.pages.buyer.logout')); ?>">
  907.                 <span>
  908.                     <span class="icon">
  909.                         <i class="ri-logout-circle-r-line"></i>
  910.                     </span>
  911.                     <?php $trans->eGet('text_label_app-index_log-out'); ?>
  912.                 </span>
  913.             </a>
  914.         </div>
  915.     </div>
  916. <?php endif; ?>
  917. <!-- End of account-switcher modal -->
  918. <div class="header">
  919.     <div class="topbar">
  920.         <div class="topbar__k-link">
  921.             <a href="<?php echo $urlGenerator->generate('app.legacy.index'); ?>">
  922.                 <svg id="klaravik-icon-rgb" xmlns="http://www.w3.org/2000/svg" width="27.176" height="30"
  923.                      viewBox="0 0 27.176 30">
  924.                     <path id="Path_56433" data-name="Path 56433" d="M118.466,140.76l-5.309,6.338,5.9,8.991h9.485Z"
  925.                           transform="translate(-101.362 -126.089)" fill="#008540" />
  926.                     <path id="Path_56434" data-name="Path 56434"
  927.                           d="M19.193,8.866,25.985,0H17.294L8.029,12.441V0H0V30H8.029V22.191C8.868,21.176,19.193,8.866,19.193,8.866Z"
  928.                           fill="#008540" />
  929.                 </svg>
  930.             </a>
  931.         </div>
  932.         <div class="topbar__wrapper">
  933.             <div class="topbar__left-links">
  934.                 <a class="left-link left-link__black contact-link" href="<?php echo $urlGenerator->generate(
  935.                     'app.legacy.pages.contact'
  936.                 ); ?>">
  937.                     <span></span>
  938.                     <?php $trans->eGet('text_label_app-index_header-contact-us'); ?>
  939.                 </a>
  940.                 <a class="left-link left-link__black faq-link"
  941.                     href="<?php echo $urlGenerator->generate('app.legacy.pages.faq'); ?>">
  942.                     <span></span><?php $trans->eGet('text_label_app-index_header-faq'); ?>
  943.                 </a>
  944.                 <span class="divider-bar"></span>
  945.                 <a class="left-link left-link__green auction-link"
  946.                     href="<?php echo $urlGenerator->generate('app.legacy.auction.listing'); ?>">
  947.                     <span></span><?php $trans->eGet('text_label_app-index_header-all-auctions'); ?>
  948.                 </a>
  949.                 <a class="left-link left-link__green no-reserve-link"
  950.                    href="<?php echo $urlGenerator->generate('app.legacy.auction.listing', ['reserve' => 'none']); ?>">
  951.                     <span></span><?php $trans->eGet('text_label_app-index_header-no-reserve-auctions'); ?>
  952.                 </a>
  953.             </div>
  954.             <div class="topbar__right-links">
  955.                 <!-- Not lopgged in -->
  956.                 <?php if (!$propLogged): ?>
  957.                     <a class="button--small button--rounded button--secondary register-link"
  958.                         href="<?php echo $urlGenerator->generate('app.legacy.pages.register'); ?>">
  959.                         <i class="ri-user-add-line"></i><?php $trans->eGet('text_label_app-index_header-create-account'); ?>
  960.                     </a>
  961.                     <a class="right-link right-link__primary login-link"
  962.                         href="<?php echo $urlGenerator->generate('app.legacy.pages.login'$continueUrlParams); ?>">
  963.                         <i class="ri-user-fill"></i><?php $trans->eGet('text_label_app-index_header-login'); ?>
  964.                     </a>
  965.                 </div>
  966.                 <!--Vendor, single buyer-->
  967.             <?php elseif (in_array($propUser, ['buyer''seller']) && !$propMultiUser): ?>
  968.                 <div class="topbar__userinfo">
  969.                     <ul class="topbar__userinfo-dropdown">
  970.                         <li>
  971.                             <a href="<?php echo ($propUser === 'seller'
  972.                                 $urlGenerator->generate('app.legacy.pages.vendor.logout')
  973.                                 : $urlGenerator->generate('app.legacy.pages.buyer.logout')); ?>">
  974.                                 <?php $trans->eGet('text_label_app-index_log-out'); ?>
  975.                             </a>
  976.                         </li>
  977.                     </ul>
  978.                     <div class="topbar__userinfo-trigger">
  979.                         <a href="<?php echo ($propUser === 'seller'
  980.                             $urlGenerator->generate('app.legacy.pages.vendor')
  981.                             : $urlGenerator->generate('app.legacy.pages.buyer')); ?>">
  982.                             <span class="user-name"> <?php echo $propUserName?></span>
  983.                             <span class="client-type"> <?php echo $propAlias?></span>
  984.                         </a>
  985.                     </div>
  986.                 </div>
  987.                 <!--Multi-->
  988.             <?php else: ?>
  989.                 <div class="topbar__userinfo-trigger multi">
  990.                     <a id="user-info">
  991.                         <span class="user-name"> <?php echo $propUserName?></span>
  992.                         <span class="client-type"><?php echo $propAlias?></span>
  993.                     </a>
  994.                 </div>
  995.                 <div class="topbar__account-switcher" id="account-switcher-opener">
  996.                     <i class="ri-arrow-left-right-line ri-1x"></i>
  997.                 </div>
  998.             <?php endif;
  999.                 // buyer
  1000.                 $savedURL $urlGenerator->generate('app.legacy.pages.buyer.saved.favorites');
  1001.                 if (isset($_COOKIE['savedURL']) && $_COOKIE['savedURL'] === 'undefined') {
  1002.                     setcookie('savedURL'''time() - 3600'/'); // expires 1 hour ago
  1003.                     unset($_COOKIE['savedURL']); // optional: clears it from this request
  1004.                 }
  1005.                 if (isset($_COOKIE['savedURL'])) {
  1006.                     $savedURL $_COOKIE['savedURL'];
  1007.                 }
  1008.                 if ($propLogged && $propUser === 'buyer'): ?>
  1009.                 <span class="divider-bar" id="right-divider"></span>
  1010.                 <a class="button--small button--rounded button--secondary favorites-link" href="<?php echo $savedURL ?>">
  1011.                     <span></span><?php $trans->eGet('text_label_app-index_saved'); ?>
  1012.                 </a>
  1013.             <?php endif; ?>
  1014.             <?php if ($propLogged): ?>
  1015.                 <a class="right-link right-link__primary login-link" href="<?php echo ($propUser === 'seller'
  1016.                     $urlGenerator->generate('app.legacy.pages.vendor')
  1017.                     : $urlGenerator->generate('app.legacy.pages.buyer')); ?>">
  1018.                     <i class="ri-user-fill"></i><?php $trans->eGet('text_label_app-index_my-account'); ?>
  1019.                 </a>
  1020.             </div>
  1021.         <?php endif; ?>
  1022.     </div>
  1023. </div>
  1024. <div class="middlebar">
  1025.     <a class="main-logo" href="<?php echo $urlGenerator->generate('app.legacy.index'); ?>" aria-label="">
  1026.         <svg id="klaravik-logo" xmlns="http://www.w3.org/2000/svg" width="376" height="59.714" viewBox="0 0 376 59.714">
  1027.             <g transform="translate(0 -0.05)">
  1028.                 <g id="Group_2348" data-name="Group 2348" transform="translate(242.111 1.482)">
  1029.                     <path id="Path_872" data-name="Path 872"
  1030.                         d="M490.519,59.885h15.332V2.6H490.519ZM486.138,2.6H470.525L459.181,29.277,447.443,2.6H431.1l26.957,57.9c.281.505.786.505,1.011,0Z"
  1031.                         transform="translate(-431.1 -2.6)" fill="#fff" />
  1032.                 </g>
  1033.                 <g id="Group_2349" data-name="Group 2349" transform="translate(55.487 1.482)">
  1034.                     <path id="Path_873" data-name="Path 873" d="M114.132,46.967V2.6H98.8V59.885h33.528l6.122-12.917Z"
  1035.                         transform="translate(-98.8 -2.6)" fill="#fff" />
  1036.                 </g>
  1037.                 <g id="Group_2350" data-name="Group 2350" transform="translate(0 1.482)">
  1038.                     <path id="Path_874" data-name="Path 874" d="M50.265,52.5,40.1,64.575,51.388,81.76H69.472Z"
  1039.                         transform="translate(-17.579 -24.475)" fill="#fff" />
  1040.                     <path id="Path_875" data-name="Path 875"
  1041.                         d="M36.673,19.5,49.647,2.6H33.023L15.332,26.356V2.6H0V59.885H15.332V44.946C16.961,43.036,36.673,19.5,36.673,19.5Z"
  1042.                         transform="translate(0 -2.6)" fill="#fff" />
  1043.                 </g>
  1044.                 <g id="Group_2351" data-name="Group 2351" transform="translate(324.163 1.482)">
  1045.                     <path id="Path_876" data-name="Path 876" d="M627.365,52.5,617.2,64.575,628.488,81.76h18.084Z"
  1046.                         transform="translate(-594.735 -24.475)" fill="#fff" />
  1047.                     <path id="Path_877" data-name="Path 877"
  1048.                         d="M613.817,19.5,626.791,2.6H610.223L592.532,26.356V2.6H577.2V59.885h15.332V44.946C594.1,43.036,613.817,19.5,613.817,19.5Z"
  1049.                         transform="translate(-577.2 -2.6)" fill="#fff" />
  1050.                 </g>
  1051.                 <path id="Path_878" data-name="Path 878"
  1052.                     d="M319.628,25.065c0-12.692-8.705-22.465-24.093-22.465h-2.359V15.573h1.573c6.908,0,9.435,3.987,9.435,9.547s-2.527,9.435-9.435,9.435h-5.616V15.573h0V2.6H273.8V59.885h15.332V46.743h5.729l7.975,13.142H319.4L309.182,43.6C316.033,39.891,319.628,33.32,319.628,25.065Z"
  1053.                     transform="translate(-120.03 -1.118)" fill="#fff" />
  1054.                 <path id="Path_879" data-name="Path 879"
  1055.                     d="M195.423.471c-.281-.562-.73-.562-1.011,0L166.5,58.767h15l12.749-29.653,5.9,13.31h-7.189l-4.886,11.457H205.2l2.19,4.886h15.838Z"
  1056.                     transform="translate(-72.991 0)" fill="#fff" />
  1057.                 <path id="Path_880" data-name="Path 880"
  1058.                     d="M389.323.471c-.281-.562-.73-.562-1.011,0L360.4,58.767h15l12.749-29.653,5.9,13.31h-7.189l-4.886,11.457H399.1l2.19,4.886h15.838Z"
  1059.                     transform="translate(-157.995 0)" fill="#fff" />
  1060.             </g>
  1061.         </svg>
  1062.         <svg id="klaravik-icon-rgb" xmlns="http://www.w3.org/2000/svg" width="27.176" height="30"
  1063.             viewBox="0 0 27.176 30">
  1064.             <path id="Path_56433" data-name="Path 56433" d="M118.466,140.76l-5.309,6.338,5.9,8.991h9.485Z"
  1065.                 transform="translate(-101.362 -126.089)" fill="#008540" />
  1066.             <path id="Path_56434" data-name="Path 56434"
  1067.                 d="M19.193,8.866,25.985,0H17.294L8.029,12.441V0H0V30H8.029V22.191C8.868,21.176,19.193,8.866,19.193,8.866Z"
  1068.                 fill="#008540" />
  1069.         </svg>
  1070.     </a>
  1071.     <div id="category-links" class="category-links">
  1072.     </div>
  1073. </div>
  1074. <div class="bottombar">
  1075.     <div class="bottombar__wrapper">
  1076.         <form id="searchform" action="<?php echo $urlGenerator->generate('app.legacy.auction.listing'); ?>" method="get"
  1077.             class="searchform validate-form">
  1078.             <div class="form-field-3">
  1079.                 <div class="form-field-3__input-wrapper">
  1080.                     <input class="form-field-3__input-field validate-field" type="text" name="searchtext"
  1081.                         value="<?php echo htmlentities($propSearchtextENT_QUOTES ENT_HTML401'utf-8'?>"
  1082.                         placeholder="<?php $trans->eGet('text_label_app-index_top-search-placeholder'); ?>"
  1083.                         id="topsearch"
  1084.                         autocomplete="off"
  1085.                         maxlength="255"
  1086.                     />
  1087.                     <span class="form-clear-field"></span>
  1088.                 </div>
  1089.                 <div class="form-field-3__clear">
  1090.                     <button type="submit" value="" name="dosearch" class="form-field-3__button"
  1091.                         aria-label="<?php $trans->eGet('info_label_app-index_menu-search-aria-label'); ?>">
  1092.                         <img src="/images/icon-search-white.svg" height="19" width="19" class="subscription-arrow"
  1093.                             alt="<?php $trans->eGet('text_label_app-index_magnifying-glass'); ?>">
  1094.                     </button>
  1095.                 </div>
  1096.                 <div id="searchistory" class="searchhistory">
  1097.                     <div class="searchhistory__header">
  1098.                         <p class="searchhistory__header-title"><span class="searchhistory__header-icon"></span><?php $trans->eGet('text_label_app-index_recent-searches'); ?></p>
  1099.                         <p class="searchhistory__header-title-highlight"><span class="searchhistory__header-icon-highlighted"></span><?php $trans->eGet('text_label_app-index_search-suggestions'); ?></p>
  1100.                         <button type="button" id="clearHistory" class="searchhistory__clear"><span class="searchhistory__header-clear-icon"></span><?php $trans->eGet('text_label_app-index_clear-all'); ?></button>
  1101.                     </div>
  1102.                     <ul id="history">
  1103.                     </ul>
  1104.                 </div>
  1105.                 <div id="livesearch" class="livesearch">
  1106.                     <div id="livesearch__list">
  1107.                         <a id="livesearch__item--template" class="livesearch__item">
  1108.                             <img class="livesearch__thumb" />
  1109.                             <div class="livesearch__info">
  1110.                                 <h2 class="livesearch__name"></h2>
  1111.                                 <div>
  1112.                                     <p>
  1113.                                         <span class="livesearch__bid"></span> -
  1114.                                         <span class="livesearch__end-date"></span>
  1115.                                     </p>
  1116.                                     <p class="livesearch__location"></p>
  1117.                                 </div>
  1118.                             </div>
  1119.                         </a>
  1120.                     </div>
  1121.                     <div class="livesearch__more-results">
  1122.                         <button class="livesearch__more-results-button button--outlined-solid button--medium"></button>
  1123.                     </div>
  1124.                 </div>
  1125.             </div>
  1126.         </form>
  1127.         <div class="bottombar__links">
  1128.             <a class="link link__green closed-link"
  1129.                 href="<?php echo $urlGenerator->generate('app.legacy.auction.listing.closed'); ?>">
  1130.                 <span></span><?php $trans->eGet('text_label_app-index_header-closed-auctions'); ?>
  1131.             </a>
  1132.             <a href="<?php echo $urlGenerator->generate('app.legacy.pages.howtosell'); ?>" id="salesButton"
  1133.                 class="salesButton button--medium button--rounded button--outlined">
  1134.                 <span><?php $trans->eGet('text_label_app-index_klaravik-sales'); ?></span>
  1135.             </a>
  1136.         </div>
  1137.     </div>
  1138. </div>
  1139. </div>
  1140. <div class="row hamburger-position-bar">
  1141.     <div class="columns small-8 mobile-logo">
  1142.         <a href="<?php echo $urlGenerator->generate('app.legacy.index'); ?>" id="logo">
  1143.             <svg xmlns="http://www.w3.org/2000/svg" width="232" height="36.844" viewBox="0 0 232 36.844">
  1144.                 <g id="Logo" transform="translate(0 -0.05)">
  1145.                     <g id="Group_2348" data-name="Group 2348" transform="translate(149.388 0.934)">
  1146.                         <path id="Path_872" data-name="Path 872"
  1147.                             d="M467.763,37.946h9.46V2.6h-9.46ZM465.06,2.6h-9.633l-7,16.46L441.184,2.6H431.1l16.633,35.727c.173.312.485.312.624,0Z"
  1148.                             transform="translate(-431.1 -2.6)" fill="#008540" />
  1149.                     </g>
  1150.                     <g id="Group_2349" data-name="Group 2349" transform="translate(34.237 0.934)">
  1151.                         <path id="Path_873" data-name="Path 873" d="M108.26,29.976V2.6H98.8V37.946h20.688l3.777-7.97Z"
  1152.                             transform="translate(-98.8 -2.6)" fill="#008540" />
  1153.                     </g>
  1154.                     <g id="Group_2350" data-name="Group 2350" transform="translate(0 0.934)">
  1155.                         <path id="Path_874" data-name="Path 874" d="M46.372,52.5,40.1,59.95l6.965,10.6H58.223Z"
  1156.                             transform="translate(-26.204 -35.208)" fill="#008540" />
  1157.                         <path id="Path_875" data-name="Path 875"
  1158.                             d="M22.628,13.03l8-10.43H20.376L9.46,17.258V2.6H0V37.946H9.46V28.728C10.465,27.55,22.628,13.03,22.628,13.03Z"
  1159.                             transform="translate(0 -2.6)" fill="#008540" />
  1160.                     </g>
  1161.                     <g id="Group_2351" data-name="Group 2351" transform="translate(200.015 0.934)">
  1162.                         <path id="Path_876" data-name="Path 876" d="M623.472,52.5,617.2,59.95l6.965,10.6h11.158Z"
  1163.                             transform="translate(-603.339 -35.208)" fill="#008540" />
  1164.                         <path id="Path_877" data-name="Path 877"
  1165.                             d="M599.793,13.03l8-10.43H597.576L586.66,17.258V2.6H577.2V37.946h9.46V28.728C587.63,27.55,599.793,13.03,599.793,13.03Z"
  1166.                             transform="translate(-577.2 -2.6)" fill="#008540" />
  1167.                     </g>
  1168.                     <path id="Path_878" data-name="Path 878"
  1169.                         d="M302.077,16.461c0-7.832-5.371-13.861-14.866-13.861h-1.455v8h.97c4.262,0,5.822,2.46,5.822,5.891s-1.559,5.822-5.822,5.822H283.26V10.6h0v-8H273.8V37.946h9.46V29.837h3.535l4.921,8.109h10.223L295.631,27.9C299.859,25.609,302.077,21.555,302.077,16.461Z"
  1170.                         transform="translate(-178.921 -1.666)" fill="#008540" />
  1171.                     <path id="Path_879" data-name="Path 879"
  1172.                         d="M184.346.31c-.173-.347-.45-.347-.624,0L166.5,36.279h9.252l7.866-18.3,3.639,8.213h-4.436l-3.015,7.069h10.569l1.351,3.015H201.5Z"
  1173.                         transform="translate(-108.803)" fill="#008540" />
  1174.                     <path id="Path_880" data-name="Path 880"
  1175.                         d="M378.246.31c-.173-.347-.451-.347-.624,0L360.4,36.279h9.252l7.866-18.3,3.639,8.213h-4.436l-3.015,7.069h10.569l1.351,3.015H395.4Z"
  1176.                         transform="translate(-235.512)" fill="#008540" />
  1177.                 </g>
  1178.             </svg>
  1179.         </a>
  1180.     </div>
  1181.     <div class="columns small-4 mobile-hamburger">
  1182.         <a href="#" class="hamburger-position-bar__icon" id="hamburger-position-bar__icon" aria-label="<?php echo $trans->get('text_label_app-mobile-menu-alt');?>">
  1183.             <div style="height:22px; width: 22px;" id="lottie-hamburger-menu" class="lottie-hamburger-menu"
  1184.                 data-src="/images/lottie-animations/hamburger-menu.json"></div>
  1185.         </a>
  1186.     </div>
  1187.     <form id="mobile-menu-search-form" class="mobile-search-form validate-form"
  1188.           action="<?php echo $urlGenerator->generate('app.legacy.auction.listing'); ?>" method="get">
  1189.         <div class="form-field-3">
  1190.             <div class="form-field-3__input-wrapper">
  1191.                 <input class="form-field-3__input-field validate-field" type="text" id="menusearch"
  1192.                        class="mobile-menu__search-input"
  1193.                        placeholder="<?php $trans->eGet('info_label_app-index_menu-search-placeholder'); ?>"
  1194.                        name="searchtext" value="<?php if (isset($_REQUEST['searchtext']) && $_REQUEST['searchtext'] !== '')
  1195.                     print htmlentities($_REQUEST['searchtext'], ENT_QUOTES ENT_HTML401'utf-8'); ?>"
  1196.                        title="sokord"
  1197.                        autocomplete="off"/>
  1198.                 <span class="form-clear-field"></span>
  1199.                 <img class="mobile-search__search-icon" src="/images/icon-search.svg" alt="search-icon">
  1200.             </div>
  1201.             <button class="search-abort-button button--text">Avbryt</button>
  1202.             <br>
  1203.             <div id="searchistory-mobile" class="searchhistory">
  1204.                 <div class="searchhistory__header">
  1205.                     <p class="searchhistory__header-title"><span class="searchhistory__header-icon"></span><?php $trans->eGet('text_label_app-index_recent-searches'); ?></p>
  1206.                     <p class="searchhistory__header-title-highlight"><span class="searchhistory__header-icon-highlighted"></span><?php $trans->eGet('text_label_app-index_search-suggestions'); ?></p>
  1207.                     <button type="button" id="clearHistory" class="searchhistory__clear"><span class="searchhistory__header-clear-icon"></span><?php $trans->eGet('text_label_app-index_clear-all'); ?></button>
  1208.                 </div>
  1209.                 <ul id="history-mobile">
  1210.                 </ul>
  1211.             </div>
  1212.             <div id="livesearch" class="livesearch livesearch--mobile">
  1213.                 <div id="livesearch__list">
  1214.                     <a id="livesearch__item--template" class="livesearch__item">
  1215.                         <img class="livesearch__thumb" />
  1216.                         <div class="livesearch__info">
  1217.                             <h2 class="livesearch__name"></h2>
  1218.                             <div>
  1219.                                 <p>
  1220.                                     <span class="livesearch__bid"></span> -
  1221.                                     <span class="livesearch__end-date"></span>
  1222.                                 </p>
  1223.                                 <p class="livesearch__location"></p>
  1224.                             </div>
  1225.                         </div>
  1226.                     </a>
  1227.                 </div>
  1228.                 <div class="livesearch__more-results">
  1229.                     <button class="livesearch__more-results-button button--outlined-solid button--medium"></button>
  1230.                 </div>
  1231.             </div>
  1232.             <button class="mobile-search-confirm button--medium">Sök</button>
  1233.         </div>
  1234.         <?php
  1235.         if ($requestSetCountyFlag && !in_array('all'$setCountyFlagData)) {
  1236.             foreach ($setCountyFlagData as $setCountyFlagDataItem) {
  1237.                 printf(
  1238.                     '<input type="hidden" name="setcountyflag[]" value="%s">',
  1239.                     $setCountyFlagDataItem
  1240.                 );
  1241.             }
  1242.         }
  1243.         if ($requestSetMunicipality && !in_array('all'$setMunicipalityData)) {
  1244.             foreach ($setMunicipalityData as $setMunicipalityDataItem) {
  1245.                 printf(
  1246.                     '<input type="hidden" name="setmunicipality[]" value="%s">',
  1247.                     $setMunicipalityDataItem
  1248.                 );
  1249.             }
  1250.         }
  1251.         ?>
  1252.     </form><!-- end Textfield-3 -->
  1253. </div>
  1254. <?php
  1255. // Display configurable banners from admin interface
  1256. try {
  1257.     $bannerRepository = new BannerRepository($db);
  1258.     // Create RequestStack with current request for cookie handling
  1259.     $requestStack = new RequestStack();
  1260.     if (isset($request)) {
  1261.         $requestStack->push($request);
  1262.     } else {
  1263.         $request Request::createFromGlobals();
  1264.         $requestStack->push($request);
  1265.     }
  1266.     $bannerService = new BannerService($bannerRepository$requestStack$propUserData);
  1267.     $banners $bannerService->getBannersForDisplay();
  1268.     // Use Twig template for proper separation of concerns
  1269.     $manifestAssets->add('bundle-banner-management');
  1270.     if (!$banners->empty()) {
  1271.         $bannerData = [];
  1272.         foreach ($banners as $banner) {
  1273.             $bannerData[] = [
  1274.                 'id' => $banner->getId(),
  1275.                 'content' => $banner->getContent(), // Template expects 'content', not 'safeContent'
  1276.                 'linkUrl' => $banner->getLinkUrl(),
  1277.                 'linkText' => $banner->getLinkText(),
  1278.                 'linkOpensInNewTab' => $banner->getLinkOpensInNewTab()
  1279.             ];
  1280.         }
  1281.         echo $twigEnvironment->render('public/banners/banners.html.twig', [
  1282.             'banners' => $bannerData
  1283.         ]);
  1284.     }
  1285. } catch (RepositoryException $e) {
  1286.     // Repository-specific errors - these might be recoverable
  1287.     error_log('Banner repository error: ' $e->getMessage());
  1288.     // In development, show more detailed error info
  1289.     if ($parameters->get('app.env') === 'dev') {
  1290.         echo '<!-- Banner Repository Error: ' htmlspecialchars($e->getMessage()) . ' -->';
  1291.     }
  1292. } catch (\Exception $e) {
  1293.     // Unexpected errors - log with full context
  1294.     error_log('Unexpected banner service error: ' $e->getMessage());
  1295.     error_log('Banner error trace: ' $e->getTraceAsString());
  1296.     // In development, show generic error to avoid exposing internals
  1297.     if ($parameters->get('app.env') === 'dev') {
  1298.         echo '<!-- Banner Service Error: An unexpected error occurred -->';
  1299.     }
  1300. }
  1301. ?>
  1302. <!-- Mobile multi user, extra header bar  -->
  1303. <?php if ($propMultiUser): ?>
  1304.     <div class="multi-user-bar">
  1305.         <div class="multi-user-bar__flex">
  1306.             <div class="multi-user-bar__user-info" id="user-info-mobile">
  1307.                 <span class="users"><?php echo $propUserName?></span>
  1308.                 <span class="client-types"><?php
  1309.                 echo $trans->get(
  1310.                     'text_label_app-index_client-type',
  1311.                     ['clientType' => $_SESSION['register_clientType'] ?? '']
  1312.                 );
  1313.                 ?></span>
  1314.             </div>
  1315.             <div class="multi-user-bar__icons">
  1316.                 <span class="switch-account-icon" id="switch-account-mobile"><i class="ri-arrow-left-right-line"></i></span>
  1317.                 <span class="divider-mobile"></span>
  1318.                 <a class="my-likes" href="<?php echo $urlGenerator->generate('app.legacy.pages.buyer.saved.favorites'); ?>">
  1319.                     <span class="likes-icon">
  1320.                         <svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">
  1321.                             <path
  1322.                                 d="M3.71741 0C2.75846 0 1.79672 0.394662 1.07777 1.17698C-0.36013 2.7416 -0.358383 5.22383 1.07777 6.78916C1.07777 6.78916 6.85697 13 6.9995 13C7.14203 13 11.0718 8.80698 12.9216 6.79477C14.3595 5.23014 14.3595 2.74686 12.9216 1.18258C11.4837 -0.382043 9.08578 -0.382043 7.64788 1.18258L7.00264 1.88358L6.35216 1.17733C5.63286 0.395012 4.67636 0 3.71741 0Z"
  1323.                                 fill="#222222" />
  1324.                         </svg>
  1325.                     </span>
  1326.                 </a>
  1327.                 <a class="my-account" href="<?php echo $urlGenerator->generate('app.legacy.pages.buyer'); ?>">
  1328.                     <span class="my-account-icon"><i class="ri-user-fill"></i></span>
  1329.                 </a>
  1330.             </div>
  1331.         </div>
  1332.     </div>
  1333. <?php endif;
  1334. $bankidBanner false;
  1335. // show banner on all non bankid verified users
  1336. // do not show this banner on buyer page in the info tab
  1337. if ($parameters->get('app.bankid.enable')) {
  1338.     if (
  1339.         (
  1340.             isset($_SESSION['register_id']) &&
  1341.             $_SESSION['bankIDActive'] === false &&
  1342.             isset($_SESSION['register_clientType']) &&
  1343.             !in_array($_SESSION['register_clientType'], ['UF''UP']) &&
  1344.             !$_SESSION['exceptRequiredAuthentication']
  1345.         ) &&
  1346.         (
  1347.             (isset($_REQUEST['page']) && $_REQUEST['page'] !== 'buyer')
  1348.             || (isset($_REQUEST['buyertab']) && $_REQUEST['buyertab'] !== 'info')
  1349.             || !isset($_REQUEST['page'])
  1350.         )
  1351.     ) {
  1352.         $bankidBanner true;
  1353.         ?>
  1354.         <a class="topbar-bankID" href="#">
  1355.             <span class="topbar-bankID__logo"><img src="/images/bankid_register.svg" alt="BankID"></span>
  1356.             <span class="topbar-bankID__text">Verifiera dig med BankID för att kunna lägga bud</span>
  1357.             <span class="topbar-bankID__icon"><i class="ri-arrow-right-line"></i></span>
  1358.         </a>
  1359.         <?php
  1360.         renderBankIdModal($trans);
  1361.         renderVerifyOverlay();
  1362.     } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] === 'vendor') {
  1363.         renderVerifyOverlay();
  1364.     }
  1365.     //bankid banner/modal endif
  1366. ?>
  1367. <div class="topbar_full <?php if ($propMultiUser)
  1368.     echo 'extra-margin' ?> <?php if ($bankidBanner)
  1369.     echo "extra-margin--bankid-banner"?>">
  1370.     <?php
  1371.     $pageListPath 'page_list.phtml';
  1372.     if ($parameters->get('redis.search.active')) {
  1373.         $pageListPath 'page_list_redis.php';
  1374.     }
  1375.     if (isset($_REQUEST["page"])) {
  1376.         $cfSiteKey $parameters->get('cf_turnstile_site');
  1377.         if ($_REQUEST["page"] == "login") {
  1378.             include("page_login.phtml");
  1379.         } elseif ($_REQUEST["page"] == "register") {
  1380.             if (isset($_REQUEST["clienttype"])) {
  1381.                 $manifestAssets->add('bundle-pages-register');
  1382.                 include("page_register.phtml");
  1383.             } else {
  1384.                 $manifestAssets->add('bundle-common');
  1385.                 include("page_register_choose_clienttype.php");
  1386.             }
  1387.         } elseif ($_REQUEST["page"] == "register_thanks") {
  1388.             $manifestAssets->add('bundle-common');
  1389.             include("page_register_thanks.phtml");
  1390.         } elseif ($_REQUEST["page"] == "activate") {
  1391.             include("page_activate.phtml");
  1392.         } elseif ($_REQUEST["page"] == "forgot") {
  1393.             include("page_forgot.phtml");
  1394.         } elseif ($_REQUEST["page"] == "editcustomer") {
  1395.             include("page_editcustomer.phtml");
  1396.         } elseif ($_REQUEST["page"] == "trustpilot") {
  1397.             include("page_trustpilot.php");
  1398.             $manifestAssets->add('bundle-trustpilot-showcase');
  1399.         } elseif ($_REQUEST["page"] == "faq") {
  1400.             include("page_faq.phtml");
  1401.         } elseif ($_REQUEST['page'] === 'vendorRegistration') {
  1402.             include("page_vendor_registration.phtml");
  1403.         } elseif ($_REQUEST["page"] === "about") {
  1404.             include("page_about_" $parameters->get("app.instance") . ".phtml");
  1405.         } elseif ($_REQUEST["page"] === "howtobuy") {
  1406.             include("page_howtobuy.phtml");
  1407.         } elseif ($_REQUEST["page"] === "howtosell") {
  1408.             include("page_howtosell_" $parameters->get("app.instance") . ".phtml");
  1409.         } elseif ($_REQUEST["page"] === "allrealtors") {
  1410.             include("page_allrealtors.phtml");
  1411.         } elseif ($_REQUEST["page"] === "contactrealtor") {
  1412.             include("page_realtor.phtml");
  1413.         } elseif ($_REQUEST["page"] === "buyer") {
  1414.             include("page_buyer.phtml");
  1415.         } elseif ($_REQUEST['page'] === 'favorites') {
  1416.             $manifestAssets->add('bundle-pages-list');
  1417.             echo $this->forward('\Klaravik\Buyer\Controller\FavoritesController::index')->getContent();
  1418.         } elseif ($_REQUEST["page"] == "swish") {
  1419.             include("page_swish.php");
  1420.         } elseif ($_REQUEST['page'] == 'exportdocuments') {
  1421.             include('page_exportdocumentupload.phtml');
  1422.         } elseif ($_REQUEST["page"] == "requestAdvance") {
  1423.             include("page_requestadvancepay.phtml");
  1424.         } elseif ($_REQUEST["page"] == "requestAdvanceNo") {
  1425.             $manifestAssets->add('bundle-common');
  1426.             include("page_requestadvancepayno.phtml");
  1427.         } elseif ($_REQUEST["page"] == "vendor") {
  1428.             include("page_vendor.phtml");
  1429.         } elseif ($_REQUEST["page"] == "ui-lib") {
  1430.             include("includes/ui-test.php");
  1431.         } elseif ($_REQUEST["page"] == "404") {
  1432.             texter($trans$db$manifestAssets"statictext"404$language$assetsResolver$cfSiteKey);
  1433.         } elseif ($_REQUEST["page"] == "english") {
  1434.             $manifestAssets->add('bundle-common');
  1435.             texter($trans$db$manifestAssets"statictext"1066$language$assetsResolver$cfSiteKey);
  1436.         } elseif ($_REQUEST["page"] == "kopinfo") {
  1437.             texter($trans$db$manifestAssets"statictext"301$language$assetsResolver$cfSiteKey);
  1438.         } elseif ($_REQUEST["page"] == "savedSearch") {
  1439.             echo $this->forward('\Klaravik\Buyer\SavedSearch\Controller\SavedSearchController::build')->getContent();
  1440.         } elseif ($_REQUEST["page"] == "saljinfo") {
  1441.             texter($trans$db$manifestAssets"statictext"302$language$assetsResolver$cfSiteKey);
  1442.         } elseif ($_REQUEST["page"] === "app-download") {
  1443.             include("page_app_download.php");
  1444.         } elseif ($_REQUEST["page"] == "text") {
  1445.             $manifestAssets->add('bundle-common');
  1446.             if (isset($pid) && is_numeric($pid)) {
  1447.                 $pageQuery "SELECT pagetype, url FROM pages WHERE id=" . (int) ($pid);
  1448.                 $pageResult mysqli_query($db$pageQuery);
  1449.                 if (mysqli_num_rows($pageResult) > 0) {
  1450.                     $page mysqli_fetch_object($pageResult);
  1451.                     if ($pid == TERMSPAGE) {
  1452.                         include __DIR__ "/page_terms.php";
  1453.                         texter($trans$db$manifestAssets"text"$pid$language$assetsResolver$cfSiteKey);
  1454.                     } elseif ($page->url == 'cookies') {
  1455.                         texter($trans$db$manifestAssets"text"$pid$language$assetsResolver$cfSiteKey);
  1456.                         echo '<div class="row">
  1457.                             <div class="column xlarge-6 xlarge-offset-3 large-8 large-offset-2">
  1458.                             <a onclick="document.getElementById(\'cookiesDeclaration\').classList.toggle(\'cookies-visible\'), this.classList.toggle(\'cookies-active\')" class="cookie-declaration-btn">
  1459.                             ' $trans->get('text_label_app-index_cookies-consent') . '
  1460.                              <svg id="icn-arrow-down-s" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#00682f">
  1461.                                <path id="Path_56238" data-name="Path 56238" d="M0,0H24V24H0Z" fill="none"/>
  1462.                                <path id="Path_56239" data-name="Path 56239" d="M12,13.172l4.95-4.95,1.414,1.414L12,16,5.636,9.636,7.05,8.222Z"/>
  1463.                              </svg>
  1464.                              <svg id="icn-arrow-up-s" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#00682f">
  1465.                               <path data-name="Path 56236" d="M0,0H24V24H0Z" fill="none"/>
  1466.                               <path data-name="Path 56237" d="M12,10.828l-4.95,4.95L5.636,14.364,12,8l6.364,6.364L16.95,15.778Z"/>
  1467.                             </svg>
  1468.                              </a>
  1469.                             <div id="cookiesDeclaration">
  1470.                             <h2>' $trans->get('text_label_app-index_cookies-declaration') . '</h2>';
  1471.                         if($parameters->get('app.instance') === 'se') {
  1472.                             echo '<script id="CookieDeclaration" data-culture="SE" src="https://consent.cookiebot.com/05ff59ba-3559-4216-af40-9b6b5a930282/cd.js" type="text/javascript" async></script>';
  1473.                         } else {
  1474.                             echo '<script id="CookieDeclaration" data-culture="DK" src="https://consent.cookiebot.com/e578938f-aa79-4c5c-bc98-9b70dc6cbf14/cd.js" type="text/javascript" async></script>';
  1475.                         }
  1476.                         echo '</div></div></div>';
  1477.                     } elseif ($page->url == 'corona-information') {
  1478.                         $manifestAssets->add('bundle-foundation-reInit');
  1479.                         texter($trans$db$manifestAssets"text"$pid$language$assetsResolver$cfSiteKey);
  1480.                         echo '<div class="covid-content" data-equalizer data-equalizer-mq="large-up">
  1481.                             <div class="covid-content__info" data-equalizer-watch>
  1482.                                 <div class="covid-content__list">
  1483.                                     ' $trans->get('text_label_app-index_covid-content-list') . '
  1484.                                 </div>
  1485.                             </div>
  1486.                             <div class="covid-content__img">
  1487.                                <img
  1488.                                   class="covid-content__image"
  1489.                                   data-equalizer-watch src="/images/emil_bil_dator-large.jpg"
  1490.                                   alt="' $trans->get('info_altimg_app-index_img-kam') . '"
  1491.                                >
  1492.                             </div>
  1493.                         </div>';
  1494.                     } else {
  1495.                         renderHeroPagePart($db$pid$fileStorageService);
  1496.                         $manifestAssets->add('bundle-hero-video-image');
  1497.                         texter($trans$db$manifestAssets"text"$pid$language$assetsResolver$cfSiteKey);
  1498.                     }
  1499.                 } else {
  1500.                     header("HTTP/1.1 404 Not Found");
  1501.                     texter($trans$db$manifestAssets"statictext"404$language$assetsResolver$cfSiteKey);
  1502.                 }
  1503.             } else {
  1504.                 header("HTTP/1.1 404 Not Found");
  1505.                 texter($trans$db$manifestAssets"statictext"404$language$assetsResolver$cfSiteKey);
  1506.             }
  1507.         } elseif ($_REQUEST["page"] == "form_thanks") {
  1508.             texter($trans$db$manifestAssets"statictext"4$language$assetsResolver$cfSiteKey);
  1509.         } elseif ($_REQUEST["page"] == "auction") {
  1510.             if (isset($products_id)) {
  1511.                 include("page_product.phtml");
  1512.             } else {
  1513.                 include($pageListPath);
  1514.             }
  1515.         } elseif ($_REQUEST["page"] == "financing") {
  1516.             if (isset($_REQUEST['notavailable'])) {
  1517.                 include("page_financing_notavailable.phtml");
  1518.             } elseif (isset($_REQUEST['financingdone'])) {
  1519.                 include("page_financing_done.phtml");
  1520.             } else {
  1521.                 include("page_financing.phtml");
  1522.             }
  1523.         } elseif ($_REQUEST["page"] == "finansiering") {
  1524.             $manifestAssets->add('bundle-common');
  1525.             include("page_financing_info.phtml");
  1526.         } elseif ($_REQUEST['page'] === 'contact') {
  1527.             $manifestAssets->add('bundle-common');
  1528.             $manifestAssets->add('bundle-pages-contact-us');
  1529.             texter($trans$db$manifestAssets"statictext"250$language$assetsResolver$cfSiteKey);
  1530.         } elseif ($_REQUEST["page"] === "dac7") {
  1531.             $vendor = new Klaravik\Model\Vendor();
  1532.             $vendorRepo = (new \Klaravik\Repository\VendorRepo());
  1533.             if (!empty($_REQUEST['token']) && !empty($_REQUEST['vendorId'])) {
  1534.                 $token mb_substr($_REQUEST['token'], 040);
  1535.                 if (sha1($_REQUEST['vendorId']) === $token) {
  1536.                     $vendor $vendorRepo->getVendor($_REQUEST['vendorId']);
  1537.                 } else {
  1538.                     throw new Exception('Bad token');
  1539.                 }
  1540.             }
  1541.             $vendorsFlagsRepo = (new \Klaravik\Repository\VendorsFlagsRepo());
  1542.             $formSubmitted 0;
  1543.             if (!empty($_REQUEST['vendorId'])) {
  1544.                 try {
  1545.                     $dacUpdated $vendorsFlagsRepo->getVendorsById(
  1546.                         $_REQUEST['vendorId']
  1547.                     )->getDacUpdated();
  1548.                 } catch (RepositoryException $e) {
  1549.                     //Do something
  1550.                 }
  1551.             }
  1552.             if (!empty($dacUpdated)) {
  1553.                 $formSubmitted 1;
  1554.             }
  1555.             $countryRepo = (new \Klaravik\Repository\CountryRepo());
  1556.             $countries $countryRepo->getAll();
  1557.             // If token is available we need
  1558.             if (!empty($_REQUEST['idFromForm']) && $formSubmitted === 0) {
  1559.                 $vendorId = (int) $_REQUEST['idFromForm'];
  1560.                 //TODO handle formdata and save in db
  1561.                 if (!empty($_POST['permanent-establishment'])) {
  1562.                     $pEs count($_POST['permanent-establishment']);
  1563.                     for ($i 0$i $pEs$i++) {
  1564.                         $countryId $countryRepo->getIdByIso2($_POST['permanent-establishment'][$i]);
  1565.                         $db->query("INSERT INTO permanentEstablishment_ref (vendors_id, countries_id) VALUES (" $vendorId "," $countryId ")");
  1566.                     }
  1567.                 }
  1568.                 $fHs count($_POST['fiscal-home']);
  1569.                 for ($i 0$i $fHs$i++) {
  1570.                     $countryId $countryRepo->getIdByIso2($_POST['fiscal-home'][$i]);
  1571.                     $tin $_POST['tin'][$i];
  1572.                     $tin2 $_POST['tin2'][$i] ?? '';
  1573.                     $stmt $db->prepare("
  1574.                           INSERT INTO
  1575.                               fiscalHome_ref
  1576.                                   (vendors_id, countries_id, tin, tin2)
  1577.                           VALUES
  1578.                               (?,?,?,?)");
  1579.                     $stmt->bind_param('iiss'$vendorId$countryId$tin$tin2);
  1580.                     $stmt->execute();
  1581.                 }
  1582.                 if (!empty($_POST['personal_name'])) {
  1583.                     $name u($_POST['personal_name'])->split(' '2);
  1584.                     $firstName $name[0]->toString();
  1585.                     if (!empty($name[1])) {
  1586.                         $lastName $name[1]->toString();
  1587.                     } else {
  1588.                         $lastName '';
  1589.                     }
  1590.                     $countryId $countryRepo->getIdByIso2($_POST['personal_country']);
  1591.                     $address $_POST['personal_address'] ?? '';
  1592.                     $zipcode $_POST['personal_zipcode'] ?? '';
  1593.                     $city $_POST['personal_city'] ?? '';
  1594.                     $cprNumber $_POST['personal_cpr'] ?? '';
  1595.                     $stmt $db->prepare("
  1596.                           INSERT INTO
  1597.                               personal_information
  1598.                                   (vendors_id, firstName, lastName, address, zipcode, city, country, cprNumber)
  1599.                           VALUES
  1600.                               (?,?,?,?,?,?,?,?)
  1601.                           ");
  1602.                     $stmt->bind_param('isssssis'$vendorId$firstName$lastName$address$zipcode$city$countryId$cprNumber);
  1603.                     $stmt->execute();
  1604.                 }
  1605.                 $vendorsFlags $vendor->getVendorsFlags();
  1606.                 $vendorsFlags->setDacUpdated(1);
  1607.                 $vendorsFlagsRepo->save($vendorsFlags);
  1608.                 $formSubmitted 1;
  1609.                 if ($vendor->getStopProductStart() === 1) {
  1610.                     if ($vendor->getStopProductReason() === ' - DAC7') {
  1611.                         $vendor->setStopProductStart(0);
  1612.                         $vendor->setStopProductReason('');
  1613.                     } elseif (str_contains($vendor->getStopProductReason(), ' - DAC7')) {
  1614.                         $reason str_ireplace(' - DAC7'''$vendor->getStopProductReason());
  1615.                         $vendor->setStopProductReason($reason);
  1616.                     }
  1617.                     try {
  1618.                         $vendorRepo->saveForDac7($vendor$parameters->get('app.instance'));
  1619.                     } catch (RepositoryException $e) {
  1620.                         //doStuff();
  1621.                     }
  1622.                 }
  1623.             }
  1624.             $pageRepository = new \Klaravik\Repository\PageRepository();
  1625.             /** @var ?\Klaravik\Model\Page $pageDAC7 */
  1626.             $pageDAC7 null;
  1627.             try {
  1628.                 $pageDAC7 $pageRepository->getByPageKey('DAC7');
  1629.             } catch (RepositoryException $e) {}
  1630.             // Redirect to DAC7 page if new DAC7 page is online and no vendor selected or the form is sent.
  1631.             $pageDAC7Url $pageDAC7 sprintf('/%s.html'$pageDAC7->getUrl()) : '';
  1632.             if ($pageDAC7 && !$vendor->getId()) {
  1633.                 header(sprintf('Location: %s'$pageDAC7Url));
  1634.                 die;
  1635.             }
  1636.             $dac7Params = [
  1637.                 'vendor' => $vendor,
  1638.                 'language' => $parameters->get('app.lang'),
  1639.                 'primaryAddress' => $vendor->getAddresses()->getPrimary()->getFirst(),
  1640.                 'signeeContact' => $vendor->getContacts()->getSignee()->getFirst(),
  1641.                 'countries' => $countries,
  1642.                 'formSubmitted' => $formSubmitted,
  1643.                 'pageDAC7Active' => $pageDAC7,
  1644.                 'pageDAC7Url' => $pageDAC7Url,
  1645.             ];
  1646.             $twigEnvironment->display('public/dac7/dac7.html.twig'$dac7Params);
  1647.             $manifestAssets->add('bundle-pages-dac7');
  1648.         } else {
  1649.             print "Unknown page.\n";
  1650.         }
  1651.     } else {
  1652.         // Default framsidan!
  1653.         include($pageListPath);
  1654.     }
  1655.     ?>
  1656.     <!-- end .topbar_full -->
  1657. </div>
  1658. <div id="k-app-ad-banner">
  1659.     <div class="k-ad-container">
  1660.         <div id="k-ad-heading">
  1661.             <?php $trans->eGet('text_app-index_app-ad_description'); ?>
  1662.         </div>
  1663.         <div class="k-ad-links">
  1664.             <a class="k-ad-links__link k-ad-links__appstore" href=<?php $trans->eGet('text_app-index_app-ad_app-store_url'); ?>>
  1665.                 <img src="/images/logotypes/logo_appstore.png" alt="<?php $trans->eGet('text_app-index_app-ad_app-store_alt'); ?>">
  1666.             </a>
  1667.             <a class="k-ad-links__link k-ad-links__playstore" href=<?php $trans->eGet('text_app-index_app-ad_playstore_url'); ?>>
  1668.                 <img src="/images/logotypes/logo_google_play.svg" alt="<?php $trans->eGet('text_app-index_app-alt'); ?>">
  1669.             </a>
  1670.         </div>
  1671.         <div id="k-ad-picture" class="<?= $parameters->get('app.instance') === 'dk' 'app-dk' '' ?>">
  1672.         </div>
  1673.     </div>
  1674. </div>
  1675. <div id="footer_full">
  1676.     <div class="row">
  1677.         <div class="small-12 columns show-for-small-only">
  1678.             <h5 class="subscribe-title"><?php $trans->eGet('text_headline_app-index_newsletter-caption'); ?></h5>
  1679.             <!-- Begin MOBILE Signup Form -->
  1680.             <form id="subscribe-mobile-form" action="" method="post">
  1681.                 <div class="subscription-input">
  1682.                     <div class="input-animation">
  1683.                         <span class="input-animation-text">
  1684.                             <?php $trans->eGet('text_label_app-index_newsletter-registration'); ?>
  1685.                         </span>
  1686.                     </div>
  1687.                     <div class="button-inside">
  1688.                         <input type="email" value="" name="EMAIL" required class="search-box" id="mobile-email"
  1689.                             placeholder="<?php $trans->eGet('text_label_app-index_newsletter-email-placeholder'); ?>">
  1690.                         <button class="subscribe-erase" style="display: none;" aria-label="<?php $trans->eGet('text_label_app-index_newsletter-email-placeholder'); ?>"><img
  1691.                                 src="/images/footer-subscribe-cross.svg" alt=""></button>
  1692.                     </div>
  1693.                     <div class="button-clear">
  1694.                         <button type="submit" value="" name="subscribe" id="subscribe-mobile" class="subscribe-button">
  1695.                             <img src="/images/arrow-right-white.svg" class="subscription-arrow"
  1696.                                 alt="<?php $trans->eGet('info_altimg_app-index_white-arrow-right'); ?>">
  1697.                             <img src="/images/checkmark-white.svg" class="subscription-checkmark" style="display: none;"
  1698.                                 alt="<?php $trans->eGet('info_altimg_app-index_white-checkbox'); ?>">
  1699.                         </button>
  1700.                     </div>
  1701.                 </div>
  1702.                 <div style="clear: both"></div>
  1703.                 <div id="subscribe-mobile-error"></div>
  1704.             </form>
  1705.             <!--End MOBILE Signup form -->
  1706.         </div>
  1707.         <div class="large-3 medium-4 small-12 columns hide-for-small" style="float: left;">
  1708.             <a href="/"><img src="/images/klaravik-logo-tba.png" alt="Klaravik logo" class="footer-logo"></a>
  1709.         </div>
  1710.     </div>
  1711.     <div class="row">
  1712.         <div class="large-3 medium-6 small-12 columns footer-contact hide-for-small">
  1713.             <h5 class="subscribe-title"><?php $trans->eGet('text_headline_app-index_newsletter-caption'); ?></h5>
  1714.             <!-- Begin DESKTOP Signup Form -->
  1715.             <form id="subscribe-desktop-form" action="" method="post">
  1716.                 <div class="subscription-input">
  1717.                     <div class="input-animation">
  1718.                         <span class="input-animation-text">
  1719.                             <?php $trans->eGet('text_label_app-index_newsletter-registration'); ?>
  1720.                         </span>
  1721.                     </div>
  1722.                     <div class="button-inside">
  1723.                         <input type="email" value="" name="EMAIL" required class="search-box" id="desktop-email"
  1724.                             placeholder="<?php $trans->eGet('text_label_app-index_newsletter-email-placeholder'); ?>">
  1725.                         <button class="subscribe-erase" style="display: none;"  aria-label="<?php $trans->eGet('text_label_app-index_newsletter-email-placeholder'); ?>"><img
  1726.                                 src="/images/footer-subscribe-cross.svg" alt=""></button>
  1727.                     </div>
  1728.                     <div class="button-clear">
  1729.                         <button type="submit" value="" name="subscribe" id="subscribe-desktop" class="subscribe-button">
  1730.                             <img src="/images/arrow-right-white.svg" class="subscription-arrow"
  1731.                                 alt="<?php $trans->eGet('info_altimg_app-index_white-arrow-right'); ?>">
  1732.                             <img src="/images/checkmark-white.svg" class="subscription-checkmark" style="display: none;"
  1733.                                 alt="<?php $trans->eGet('info_altimg_app-index_white-checkbox'); ?>">
  1734.                         </button>
  1735.                     </div>
  1736.                 </div>
  1737.                 <div style="clear: both"></div>
  1738.                 <div id="subscribe-desktop-error"></div>
  1739.             </form>
  1740.             <!--End DESKTOP Signup form -->
  1741.             <div class="footer-info">
  1742.                 <?php
  1743.                 generateFooter($trans);
  1744.                 ?>
  1745.             </div>
  1746.         </div>
  1747.         <div class="large-3 medium-6 small-12 columns small-text-left footer-column-padding">
  1748.             <h6><?php print $trans->get("ALIAS_FOOTER_HEADER_LEFT"); ?></h6>
  1749.             <hr>
  1750.             <?php
  1751.             generateBottomMenu($db$urlGenerator1LANGUAGE_ID$pid);
  1752.             ?>
  1753.         </div>
  1754.         <div class="large-3 medium-6 small-12 columns small-text-left footer-column-padding">
  1755.             <h6><?php print $trans->get("ALIAS_FOOTER_HEADER_CENTER"); ?></h6>
  1756.             <hr>
  1757.             <?php
  1758.             generateBottomMenu($db$urlGenerator2LANGUAGE_ID$pid);
  1759.             ?>
  1760.         </div>
  1761.         <div class="large-3 medium-6 small-12 columns small-text-left footer-column-padding">
  1762.             <h6><?php print $trans->get("ALIAS_FOOTER_HEADER_RIGHT"); ?></h6>
  1763.             <hr>
  1764.             <?php
  1765.             generateBottomMenu($db$urlGenerator3LANGUAGE_ID$pid);
  1766.             ?>
  1767.         </div>
  1768.     </div>
  1769.     <div class="row">
  1770.         <div class="large-12 medium-12 columns hide-for-small">
  1771.             <div class="small-text-right flag-columns">
  1772.                 <a class="footer-flag" href="https://www.klaravik.dk" target="_blank" rel="noreferrer">
  1773.                     <img src="/images/footer-dk-flag.svg"
  1774.                         alt="<?php $trans->eGet('info_altimg_app-index_flag-denmark'); ?>" align="middle"
  1775.                         class="footer-img-flag" />
  1776.                     <span><?php $trans->eGet('text_label_app-index_flag-denmark'); ?></span>
  1777.                 </a>
  1778.                 <a class="footer-flag" href="https://www.klaravik.se/" target="_blank" rel="noreferrer">
  1779.                     <img src="/images/footer-sv-flag.svg"
  1780.                         alt="<?php $trans->eGet('info_altimg_app-index_flag-sweden'); ?>" align="middle"
  1781.                         class="footer-img-flag" />
  1782.                     <span><?php $trans->eGet('text_label_app-index_flag-sweden'); ?></span>
  1783.                 </a>
  1784.             </div>
  1785.         </div>
  1786.         <div class="small-12 show-for-small-only">
  1787.             <div class="large-3 medium-12 small-12 columns">
  1788.                 <a href="/"><img src="/images/klaravik-logo-tba.png" alt="Klaravik logo" class="footer-logo"></a>
  1789.                 <h3><?php print $trans->get("ALIAS_FOOTER_HEADER_CONTACT"); ?></h3>
  1790.                 <div class="footer-info">
  1791.                     <!-- TODO: Ta bort "All rights reserved" text frÃ¥n databasen -->
  1792.                     <?php
  1793.                     generateFooter($trans);
  1794.                     ?>
  1795.                 </div>
  1796.             </div>
  1797.             <div class="small-12 columns show-for-small-only">
  1798.                 <div class="row">
  1799.                     <a class="small-3 small-centered columns flag-columns" href="https://www.klaravik.se/"
  1800.                         target="_blank" rel="noreferrer">
  1801.                         <img src="/images/footer-sv-flag.svg"
  1802.                             alt="<?php $trans->eGet('info_altimg_app-index_flag-sweden'); ?>" align="middle"
  1803.                             class="footer-img-flag" />
  1804.                         <span><?php $trans->eGet('text_label_app-index_flag-sweden'); ?></span>
  1805.                     </a>
  1806.                     <a class="small-3 small-centered columns flag-columns" href="https://www.klaravik.dk/"
  1807.                         target="_blank" rel="noreferrer">
  1808.                         <img src="/images/footer-dk-flag.svg"
  1809.                             alt="<?php $trans->eGet('info_altimg_app-index_flag-denmark'); ?>" align="middle"
  1810.                             class="footer-img-flag" />
  1811.                         <span><?php $trans->eGet('text_label_app-index_flag-denmark'); ?></span>
  1812.                     </a>
  1813.                 </div>
  1814.             </div>
  1815.         </div>
  1816.     </div>
  1817.     <div id="bottom-footer">
  1818.         <div class="row">
  1819.             <div class="small-12 columns bottom-footer-center">
  1820.                 <div class="bottom-footer-center_content">
  1821.                     <span class="copyright-row">
  1822.                         <img class="copyright-sign" src="/images/icons/icn-copyright-line.svg" alt="<?php $trans->eGet('text_label_app-index_copyright-alt'); ?>"/>
  1823.                         <span>
  1824.                             <?php $trans->eGet('text_label_app-index_copyright-caption'); ?>
  1825.                         </span>
  1826.                         <span>|</span>
  1827.                         <span>
  1828.                             <a href="/material.html" target="_blank">
  1829.                                 <?php $trans->eGet('link_button_app-index_copyright-text'); ?>
  1830.                             </a>
  1831.                         </span>
  1832.                     </span>
  1833.                     <div class="follow-links">
  1834.                         <div class="social-media">
  1835.                             <span class="follow-us">
  1836.                                 <?php $trans->eGet('text_label_app-index_social-media-caption'); ?>
  1837.                             </span>
  1838.                             <a href="<?php print $parameters->get('social.media.youtube.link'?>" target="_blank"
  1839.                                 rel="noreferrer"><img class="youtube-logo" src="/images/logotypes/icn-youtube.svg"
  1840.                                     alt="youtube logo"></a>
  1841.                             <a href="<?php print $parameters->get('social.media.facebook.link'?>" target="_blank"
  1842.                                 rel="noreferrer"><img class="fb-logo" src="/images/logotypes/icn-facebook.svg"
  1843.                                     alt="facebook logo"></a>
  1844.                             <?php if ($parameters->get('social.media.tiktok.active')) { ?>
  1845.                                 <a href="<?php print $parameters->get('social.media.tiktok.link'?>" target="_blank"
  1846.                                     rel="noreferrer"><img class="tiktok-logo" src="/images/logotypes/icn-tiktok.svg"
  1847.                                         alt="tiktok logo"></a>
  1848.                             <?php ?>
  1849.                             <?php if ($parameters->get('social.media.instagram.active')) { ?>
  1850.                                 <a href="<?php print $parameters->get('social.media.instagram.link'?>" target="_blank"
  1851.                                     rel="noreferrer"><img class="ig-logo" src="/images/logotypes/icn-instagram.svg"
  1852.                                         alt="instagram logo"></a>
  1853.                             <?php ?>
  1854.                         </div>
  1855.                     </div>
  1856.                 </div>
  1857.             </div>
  1858.         </div><!-- end .row -->
  1859.     </div><!-- end #bottom-footer -->
  1860. </div>
  1861. <!-- end #footer_full --></div>
  1862. </div><!-- end starting div that wraps all content -->
  1863. <!-- The mobile menu -->
  1864. <nav id="mobile-menu" class="mobile-menu">
  1865.     <div class="mobile-menu__toggle-categories-column" id="toggle-categories">
  1866.         <div class="mobile-menu__toggle-categories-link">
  1867.             <?php
  1868.             print $trans->get("ALIAS_MAIN_BUTTON");
  1869.             ?>
  1870.         </div>
  1871.         <div class="mobile-menu__toggle-category-icon">
  1872.             <img src="/images/icon-expand-categories.svg" alt="" class="menu-expand-categories">
  1873.             <img src="/images/icon-retract-categories.svg" alt="" class="menu-retract-categories">
  1874.         </div>
  1875.     </div>
  1876.     <div class="mobile-menu__expanding-section mobile-hide">
  1877.         <?php
  1878.         $pageListPartials = new \Klaravik\includes\PageListPartials($urlGenerator$trans);
  1879.         $urlParams = [];
  1880.         $pageListPartials->geoLocationUrlParams($urlParams);
  1881.         $pageListPartials->filterUrlParams($urlParams);
  1882.         echo '<div class="mobile-menu__category-link-row mobile-menu__top-level-row">';
  1883.         echo '    <a
  1884.                   href="' $urlGenerator->generate('app.legacy.auction.listing'$urlParams) . '"
  1885.                   class="mobile-menu__category-link mobile-menu__all-link"
  1886.                 >
  1887.                     <span>' $trans->get('text_label_app-index_header-all-auctions') . '</span>
  1888.                 </a>';
  1889.         echo '</div>';
  1890.         $catCount count($activeCategoryCache->cachedCategories());
  1891.         $i 0;
  1892.         /** @var \Klaravik\Category\Cache\Model\CacheCategory $headCategory */
  1893.         foreach ($activeCategoryCache->cachedCategories() as $headCategory) {
  1894.             if (++$i === $catCount) {
  1895.                 echo '<div class="mobile-menu__category-link-row mobile-menu__top-level-row mobile-menu__last-row-item" >';
  1896.             } else {
  1897.                 echo '<div class="mobile-menu__category-link-row mobile-menu__top-level-row" >';
  1898.             }
  1899.             echo '<span class="mobile-menu__category-link expand-subcat" data-catId="' $headCategory->getId() . '">
  1900.                       <img class="mobile-menu__category-link-icon" src="/images/icons/icn-category-' $headCategory->getIcon() . '.svg">' $headCategory->getName() . '</span>';
  1901.             if (count($headCategory->getChildren())) {
  1902.                 $urlParams['caturlname'] = $headCategory->getUrl();
  1903.                 echo '<div class="mobile-menu__toggle-category-icon">
  1904.                               <img src="/images/icon-expand-dd.svg" alt="" class="menu-expand-categories">
  1905.                               <img src="/images/icon-retract-dd.svg" alt="" class="menu-retract-categories">
  1906.                           </div>';
  1907.                 echo '</div>';
  1908.                 echo '<div class="mobile-menu__expanding-section subcat-expandable subcat-expandable-' $headCategory->getId() . '">';
  1909.                 echo '<div class="mobile-menu__category-link-row">';
  1910.                 echo '    <a
  1911.                             href="' $urlGenerator->generate('app.legacy.auction.listing.category'$urlParams) . '"
  1912.                             class="mobile-menu__category-link mobile-menu__all-link"
  1913.                           >
  1914.                               <span class="mobile-menu__green-border">
  1915.                                   ' $trans->get(
  1916.                             'link_button_app-index_auction-listing-category',
  1917.                             ['cat_name' => $headCategory->getName()]
  1918.                         ) . ' (' $headCategory->getNumberOfProducts() . ')
  1919.                               </span>
  1920.                           </a>';
  1921.                 echo '</div>';
  1922.                 /** @var \Klaravik\Category\Cache\Model\CacheCategory $child */
  1923.                 foreach ($headCategory->getChildren() as $child) {
  1924.                     if ($child->isShowOnlyInParent()) {
  1925.                         continue;
  1926.                     }
  1927.                     $urlParams['caturlname'] = $child->getUrl();
  1928.                     echo '<div class="mobile-menu__category-link-row">';
  1929.                     echo '    <a href="' $urlGenerator->generate('app.legacy.auction.listing.category'$urlParams) . '" class="mobile-menu__category-link">' $child->getName() . ' (' $child->getNumberOfProducts() . ')</a>';
  1930.                     echo '</div>';
  1931.                 }
  1932.             }
  1933.             echo '</div>';
  1934.         }
  1935.         ?>
  1936.     </div>
  1937.     <div class="mobile-menu__row">
  1938.         <?php
  1939.         echo '<a href="' $urlGenerator->generate('app.legacy.auction.listing', ['reserve' => 'none']) . '" class="mobile-menu__auction-list-link mobile-menu__no-reserve-link"><span></span>' $trans->get('text_label_app-index_header-no-reserve-auctions-full') . '</a>';
  1940.         ?>
  1941.     </div>
  1942.     <div class="mobile-menu__row">
  1943.         <?php
  1944.         echo '<a href="' $urlGenerator->generate('app.legacy.auction.listing.closed') . '" class="mobile-menu__auction-list-link mobile-menu__closed-auctions-link"><span></span>' $trans->get('text_label_app-index_header-closed-auctions') . '</a>';
  1945.         ?>
  1946.     </div>
  1947.     <div class="mobile-menu__row">
  1948.         <?php
  1949.         echo '<a href="' $urlGenerator->generate('app.legacy.pages.howtosell') . '" class="mobile-menu__how-to-sell-link">' $trans->get('ALIAS_TOP_BUTTON_SALE') . '</a>';
  1950.         ?>
  1951.     </div>
  1952.     <div class="mobile-menu__row">
  1953.         <?php
  1954.         echo '<a
  1955.                     href="' $urlGenerator->generate('app.legacy.pages.contact') . '"
  1956.                     class="mobile-menu__link mobile-menu__contact-link"
  1957.                   >
  1958.                        <span></span>' $trans->get('text_label_app-index_header-contact-us') . '
  1959.                   </a>';
  1960.         ?>
  1961.     </div>
  1962.     <div class="mobile-menu__row">
  1963.         <?php
  1964.         echo '<a
  1965.                     href="' $urlGenerator->generate('app.legacy.pages.faq') . '"
  1966.                     class="mobile-menu__link mobile-menu__faq-link"
  1967.                   >
  1968.                       <span></span>' $trans->get('link_button_app-index_pages-faq') . '
  1969.                   </a>';
  1970.         ?>
  1971.     </div>
  1972.     <div class="mobile-menu__row">
  1973.         <?php
  1974.         echo '<a
  1975.                     href="' $urlGenerator->generate('app.legacy.pages.about') . '"
  1976.                     class="mobile-menu__link mobile-menu__about-link"
  1977.                   >
  1978.                       <span></span>' $trans->get('link_button_app-index_pages-about') . '
  1979.                   </a>';
  1980.         ?>
  1981.     </div>
  1982.     <?php
  1983.     if (isset($_SESSION["users_id"])) {
  1984.         print "<div class='mobile-menu__bottom-buttons'>\n";
  1985.         print "  <a href=\"" $urlGenerator->generate('app.legacy.pages.vendor') . "\" class=\"button--large button--primary mobile-menu__bottom-button mobile-menu__login-icon\"><span></span>" $trans->get("ALIAS_VENDOR_MYPAGE") . "</a>";
  1986.         print "  <a
  1987.                href=\"" $urlGenerator->generate('app.legacy.pages.vendor.subpage', ['vendortab' => 'products']) . "\"
  1988.                class=\"button--large button--outlined mobile-menu__bottom-button mobile-menu__my-objects\"
  1989.              >
  1990.                  " $trans->get('link_button_app-index_pages-vendor') . "
  1991.              </a>";
  1992.         print "</div>";
  1993.         print "<div class=\"mobile-menu__footer-row\">";
  1994.         print "<hr class=\"mobile-menu__footer-top-hr\" />";
  1995.         print "    <div class=\"mobile-menu__footer-wrapper\">";
  1996.         print "        <div class=\"mobile-menu__footer-userinfo\">";
  1997.         print "            <span class=\"mobile-menu__footer-text\">" $trans->get("ALIAS_LOGGEDIN_AS_SELLER") . "</span>";
  1998.         print "            <span class=\"mobile-menu__footer-text-username\">" $propUserName "</span>";
  1999.         print "        </div>";
  2000.         print "        <div class=\"mobile-menu__footer-logout\">";
  2001.         print "            <a href=\"" $urlGenerator->generate('app.legacy.pages.vendor.logout') . "\" class=\"mobile-menu__logout-button\"><span></span>" $trans->get("ALIAS_LOGOUT_BUTTON") . "</a>";
  2002.         print "        </div>";
  2003.         print "</div>";
  2004.         print "</div>";
  2005.     } elseif (isset($_SESSION["register_id"])) {
  2006.         print "<div class='mobile-menu__bottom-buttons'>\n";
  2007.         print "  <a href=\"" $urlGenerator->generate('app.legacy.pages.buyer') . "\" class=\"button--large button--primary mobile-menu__bottom-button mobile-menu__login-icon\"><span></span>" $trans->get("ALIAS_BUYER_MYPAGE") . "</a>";
  2008.         print "  <a
  2009.                 href=\"" $savedURL "\"
  2010.                 class=\"button--large button--outlined mobile-menu__bottom-button mobile-menu__link--favorites \"
  2011.              >
  2012.                  <span></span>" $trans->get('text_label_app-index_saved') . "
  2013.              </a>\n";
  2014.         print "</div>";
  2015.         print "<div class=\"mobile-menu__footer-row\">";
  2016.         print "    <hr class=\"mobile-menu__footer-top-hr\" />";
  2017.         print "    <div class=\"mobile-menu__footer-wrapper\">";
  2018.         print "        <div class=\"mobile-menu__footer-userinfo\">";
  2019.         print "            <span class=\"mobile-menu__footer-text\">" $trans->get("ALIAS_LOGGEDIN_AS_BUYER") . "</span>";
  2020.         print "            <span class=\"mobile-menu__footer-text-username\">" $propUserName "</span>";
  2021.         print "        </div>";
  2022.         print "        <div class=\"mobile-menu__footer-logout\">";
  2023.         print "            <a href=\"" $urlGenerator->generate('app.legacy.pages.buyer.logout'$continueUrlParams) . "\" class=\"mobile-menu__logout-button\"><span></span>" $trans->get("ALIAS_LOGOUT_BUTTON") . "</a>";
  2024.         print "        </div>";
  2025.         print "    </div>";
  2026.         print "</div>";
  2027.     } else {
  2028.         print "<div class='mobile-menu__bottom-buttons'>\n";
  2029.         print "  <a href=\"" $urlGenerator->generate('app.legacy.pages.login'$continueUrlParams) . "\" .  class=\"button--large button--primary mobile-menu__bottom-button mobile-menu__login-icon\"><span></span>" $trans->get("ALIAS_TOP_BUTTON_LOGIN") . "</a>";
  2030.         print "  <a href=\"" $urlGenerator->generate('app.legacy.pages.register') . "\" class=\"button--large button--outlined mobile-menu__bottom-button mobile-menu__register-icon\"><span></span>" $trans->get("ALIAS_REGISTER_BUTTON_SAVE") . "</a>\n";
  2031.         print "</div>";
  2032.         print " <hr class=\"mobile-menu__hr-initial\">";
  2033.     }
  2034.     ?>
  2035. </nav>
  2036. <!-- end mobile menu -->
  2037. <?php
  2038. if (isset($_SESSION["register_clientType"])): ?>
  2039.     <div class="hidden" id="globalClient" data-client-type="<?= $_SESSION['register_clientType']; ?>"
  2040.         data-client-id="<?= $_SESSION['register_id']; ?>"></div>
  2041. <?php endif;
  2042. // Prints JS-scripts that is set as to be included.
  2043. foreach ($includedJavaScript as $item) {
  2044.     if ($item['inline']) {
  2045.         echo "<script type=\"text/javascript\">\n";
  2046.         echo $item['inline'] . "\n";
  2047.         echo "</script>\n";
  2048.     } else {
  2049.         echo "<script type=\"text/javascript\" src=\"" getFileVersion($item['string']) . "\"></script>\n";
  2050.     }
  2051. }
  2052. echo '<script type="text/javascript">const storefrontBaseURL = "' $parameters->get('app.storefront.graphql') . '";</script>';
  2053. $manifestAssets->renderJs();
  2054. if ($skipChat === false) {
  2055.     $zendeskKey $parameters->get('zendesk.chat.key');
  2056.     ?>
  2057.     <!-- Start of klaravik Zendesk Widget script -->
  2058.     <script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=<?php echo $zendeskKey?>"> </script>
  2059.     <script type="text/JavaScript">
  2060.                             window.zESettings = {
  2061.                                 webWidget: {
  2062.                                   zIndex: 800,
  2063.                                   color: {
  2064.                                     theme: '#008540',
  2065.                                     launcher: '#FFFFFF', // This will also update the badge
  2066.                                     launcherText: '#ED7600',
  2067.                                     header: '#008540',
  2068.                                   }
  2069.                                 }
  2070.                             };
  2071.                         </script>
  2072.     <!-- End of klaravik Zendesk Widget script -->
  2073.     <?php
  2074. }
  2075. ?>
  2076. </body>
  2077. </html>
  2078. <?php
  2079. $time_end microtime(true);
  2080. $time $time_end $time_start;
  2081. echo "<!-- {$time} -->";