<?php
include('include/autoloader.php');
if (isset($options['theme_display_featured_slider']) AND $options['theme_display_featured_slider'] == 1) {
if (isset($options['theme_featured_slider_items_number'])) {
$featured_slider_items_number = $options['theme_featured_slider_items_number'];	
} else {
$featured_slider_items_number = 12;		
}	
if (isset($options['theme_featured_content']) AND $options['theme_featured_content'] == 'media') {
$featured = $general->featured_media('hits DESC',$featured_slider_items_number);
} else {
$featured = $general->featured_lists('hits DESC',$featured_slider_items_number);	
}
$smarty->assign('featured',$featured);
}
$smarty->assign('is_home',1);
$ur = explode('?',curPageURL());
if (count($ur) != 0) {
if (isset($ur[1])) {
parse_str($ur[1],$q);	
}
}
if (isset($options['theme_pagination_load']) AND $options['theme_pagination_load'] == 'normal') {
$page = 1;
if (isset($options['theme_home_media_number'])) {
	$size = $options['theme_home_media_number'];
} else {
	$size = 24;
}
if (isset($q['page'])){ $page = (int) $q['page']; }
$sqls = "SELECT * FROM media WHERE published='1' AND deleted='0'";
$query = $mysqli->query($sqls);
$total_records = $query->num_rows;
if ($total_records > 0) {
$pagination = new Pagination();
$pagination->setLink("./upload-time?page=%s");
$pagination->setPage($page);
$pagination->setSize($size);
$pagination->setTotalRecords($total_records);
$get = "SELECT * FROM media WHERE published='1' AND deleted='0' ORDER BY publish_time DESC ".$pagination->getLimitSql();
$qu = $mysqli->query($get);
while ($rows = $qu->fetch_assoc()) {
	$media[] = $rows;
}
$smarty->assign('media',$media);
$smarty->assign('pagi',$pagination->create_links());
}
}
$smarty->assign('seo_title',$language['upload_time'].' - '.$options['general_seo_title']);
$smarty->assign('seo_keywords',$options['general_seo_keywords']);
$smarty->assign('seo_description',$options['general_seo_description']);
$smarty->display('upload-time.html');
?>