<?php
//=================================================================
// KOOBI R7 - CMS - PORTALSOFTWARE(c) DREAM4(r) 
// HTTP://WWW.DREAM4.DE
//=================================================================
// ACHTUNG!
// DIESER PROGRAMMCODE IST URHERRECHTLICH GESCHUETZT
// DIE URHEBERRECHTE LIEGEN BEI DEN JEWEILIGEN AUTOREN.
// AENDERUNGEN IN DIESER DATEI ERFOLGEN AUF EIGENE GEFAHR!
// ES IST NICHT GESTATTET, DEN COPYRIGHTHINWEIS ZU AENDERN ODER ZU
// ENTFERNEN. NUR WENN SIE EINE COPYRIGHTHINWEIS-ENTFERNUNG BESTELLT
// HABEN, DUERFEN SIE DIESEN ENTFERNEN.
//================================================================
// BEI FRAGEN WENDEN SIE SICH BITTE AN: KONTAKT@DREAM4.DE
//=================================================================
if(!defined('BASE_DIR')) exit;
function nix(){return;}
//=================================================================
// Shop
//=================================================================
if(VERSION == 'PRO' && get_active('shop_newinshop') && get_active('shop') && @file_exists(BASE_DIR . '/class/Class.Shop.php'))
{
	function NewShopProducts($params='')
	{
		$Shop = new Shop;
		$res = $GLOBALS['db']->RowQuery("SELECT LimitExternNeu, TplExternNeu FROM " . PREFIX . "_shop_einstellungen");
		$params['limit'] = $res->LimitExternNeu;
		$params['tmpl'] = (!file_exists($GLOBALS['config']['source'] . '/shop/' . $res->TplExternNeu)) ? 'page_extern_products_new.tpl' : $res->TplExternNeu;
		$GLOBALS['tmpl']->assign('extern_products_array',$Shop->listProducts(0,0,1,0,$params['limit'],1));
		return $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/shop/' . $params['tmpl']);
	}
	
	function NewShopProductsExtended($params='')
	{
		$Shop = new Shop;
		$params['limit'] = 3;
		$params['limit'] = (!$params['limit']) ? 3 : abs((int)$params['limit']);
		$GLOBALS['tmpl']->assign('extern_products_array',$Shop->listProducts(0,0,1,0,$params['limit'],1));
		return $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/shop/page_extern_products_new_extended.tpl');
	}
	
	function NewShopProductsNavi($params='')
	{
		$Shop = new Shop;
		$params['limit'] = 3;
		$params['limit'] = (!$params['limit']) ? $res->LimitExternNeu : abs((int)$params['limit']);
		$GLOBALS['tmpl']->assign('extern_products_array',$Shop->listProducts(0,0,1,0,$params['limit'],1));
		return $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/shop/page_extern_products_new_navi.tpl');
	}
	
	if(get_active('shop_newinshop_startpage') && @$_REQUEST['p']!='shop' && (@$_REQUEST['p']=='index' || @$_REQUEST['p']=='')) $GLOBALS['tmpl']->assign('NewShopProducts', NewShopProductsExtended());
	if(get_active('shop_newinshop_navi')  && @$_REQUEST['p']!='shop') $GLOBALS['tmpl']->assign('NewShopProductsNavi',NewShopProductsNavi());
} 

//=================================================================
// GetContent
//=================================================================
if(get_active('content') && file_exists(BASE_DIR . '/class/Class.Content.php'))
{
	include_once(BASE_DIR . '/class/Class.Content.php');
	$Content = new Content;
	function getcontent($param='')
	{
		global $Content;
		if(@$param['id']) return $Content->getContent($param['id']);
	}
	$GLOBALS['tmpl']->register_function('getContent','getcontent');
}

//=================================================================
// Umfragen
//=================================================================
if(get_active('poll'))
{
	if(@file_exists(BASE_DIR . '/class/Class.Poll.php'))
	{
		include_once(BASE_DIR . '/class/Class.Poll.php');
		function PollOutSmall($params='')
		{
			$Poll = new Poll;
			$Poll_Results = $Poll->GetPoll();
			$GLOBALS['tmpl']->assign('out', $Poll_Results);
			return $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/poll/pollout_small.tpl');
		}

		$GLOBALS['tmpl']->assign('PollOutSmall',PollOutSmall());
	}
}


if(get_active('newsletter') && file_exists(BASE_DIR . '/class/Class.Newsletter.php'))
{
	include_once(BASE_DIR . '/class/Class.Newsletter.php');
	$Newsletter = new Newsletter;
	$GLOBALS['tmpl']->assign('Newsletter',$Newsletter->displayForm());
}


if(get_active('counter_display'))
{
	$GLOBALS['tmpl']->assign('CounterDisplay', $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/counter/counter_small.tpl'));
}

if(get_active('search'))
{
	$GLOBALS['tmpl']->assign('SearchForm', $GLOBALS['tmpl']->fetch($GLOBALS['config']['source'] . '/search/search_small.tpl'));
}

if(get_active('partners') && file_exists(BASE_DIR . '/class/Class.Partners.php'))
{
	include_once(BASE_DIR . '/class/Class.Partners.php');
	$Partners = new Partner;
	$GLOBALS['tmpl']->assign('PartnerDisplay', $Partners->getPartners());
}

//=================================================================
// KALENDER
//=================================================================
if(get_active('calendar') && file_exists(BASE_DIR . '/class/Class.Calendar.php'))
{
	include_once(BASE_DIR . '/class/Class.Calendar.php');
	$Calendar = new KoobiCalendar;
	$d = getdate(time()); 
	$year = (isset($_REQUEST['koobi_jahr']) && $_REQUEST['koobi_jahr'] != '') ? (int)$_REQUEST['koobi_jahr'] : $d['year'];
	$month = (isset($_REQUEST['koobi_monat']) && $_REQUEST['koobi_monat'] != '') ? (int)$_REQUEST['koobi_monat'] : $d['mon'];
	$GLOBALS['tmpl']->assign('SmallCalendar', $Calendar->getMonthView($month, $year, $GLOBALS['config']['source'] . '/calendar/calendar_small.tpl','1','small',1));
}
?>