<?php
include('include/autoloader.php');
$smarty->assign('is_media',1);
$id = intval(make_safe(xss_clean($_GET['id'])));
$slug = make_safe(xss_clean($_GET['slug']));
$media = $general->media($id);
foreach ($media AS $key=>$value) {
	$smarty->assign('media_'.$key,$value);
}

if (!empty($media['tags'])) {
	$tags = explode(',',$media['tags']);
	$smarty->assign('tags',$tags);
}
$related = $general->related_media($media['id'],$media['category_id'],10);
$smarty->assign('related',$related);
$smarty->assign('seo_title',htmlspecialchars_decode($media['title'],ENT_QUOTES));
$smarty->assign('seo_keywords',$media['tags']);
$smarty->assign('seo_description',mb_substr(make_safe(htmlspecialchars_decode($media['details'],ENT_QUOTES)),0,255,'UTF-8'));
$url = $options['general_siteurl']."/upload/media/".$media['thumbnail'];
$slugged = str_replace(':/','://',str_replace('//','/',($url)));
$smarty->assign('seo_facebook_image',$slugged);
$smarty->display('media.html');	
?>