<?php

session_start();
include("include/config.php");
include("include/functions/import.php");

$mainmenu = "0";
STemplate::assign('mainmenu',$mainmenu);

//Get family filter settings
if($_SESSION[USERID] == "")
{
	$showfamfilter = "AND mature='0'";
}
elseif($_SESSION[FAMILYFILTER] == "0")
{
	$showfamfilter = "";
}
else
{
	$showfamfilter = "AND mature='0'";
}

//NEWEST VIDEOS BEGIN
$query="SELECT * FROM videos WHERE public='1' AND active='1' $showfamfilter ORDER BY time_added desc limit 5";
$executequery = $conn->Execute($query);
if($executequery->recordcount()>0)
	$newestvideos = $executequery->getrows();
STemplate::assign('newestvideos',$newestvideos);
//NEWEST VIDEOS END

//FEATURED VIDEOS BEGIN
$max_feat = '10';
$query="SELECT value FROM config WHERE setting='max_feat'";
$executequery=$conn->execute($query);
$max_feat = $executequery->fields[value];
$query="SELECT * FROM videos WHERE public='1' AND featured='1' AND active='1' $showfamfilter ORDER BY time_added desc limit $max_feat";
$executequery = $conn->Execute($query);
if($executequery->recordcount()>0)
	$featuredvideos = $executequery->getrows();
STemplate::assign('featuredvideos',$featuredvideos);
STemplate::assign('total',$executequery->recordcount());
//FEATURED VIDEOS END

$pagetitle = "$lang[173]";
STemplate::assign('pagetitle',$pagetitle);

//TEMPLATES BEGIN
STemplate::display('header.tpl');
STemplate::display('home.tpl');
STemplate::display('footer.tpl');
//TEMPLATES END
?>