<?php

/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */

if (!defined('BASEDIR')) {
  include_once '..' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'constants.php';
}

SecurityOperations::setCookieDomainFromSettings();

if (!session_id()) {
  session_start();
}


CodingOperations::encodeEingaben();
CodingOperations::setObStartIfInternalAndExternalEncodingAreDiffrent();

SecurityOperations::PurgeInput();
$urlParam = new URLParameterNavigation();
$type = RequestOperations::getVarValue('info', '--');
switch ($type) {
  case 'warenkorb':
    $dm = new DataMenuWarenkorbFeed($urlParam);
    break;
  case 'fd':
    $lfdNr = CleanOperations::cleanInt(RequestOperations::getVarValue('nr', 0));
    $className = 'DataMenuFreeSight' . $lfdNr;
    if (class_exists($className)) {
      $dm = new $className($urlParam);
    } else {
      $dm = null;
      Logger::logg('feeds.php mit info=fd aufgerufen, aber ungueltige nr: ' . $lfdNr, 5002);
    }
    break;
  case 'ma':
    $id = FilterBasis::getOnlyAlphaNumeric(RequestOperations::getVarValue('nr', ''));
    $up = new URLParameterNavigation(false);
    $up->dsnr = $id;
    $dm = new DataMenuBasysUserFeed($up);
    break;
  case 'kurshighlights':
    $dm = new DataMenuKursHighlightsSeparat(new URLParameterHighlights());
    break;
  default:
    $dm = null;
    Logger::logg('feeds.php aufgerufen, weiß aber nicht, was anzuzeigen waere - info: ' . $type, 5001);
}

if (!is_null($dm)) {
  echo $dm->getContent();
}


CodingOperations::encodeAnzeige();