clipbucket/upload/videos.php

103 lines
2.3 KiB
PHP
Raw Normal View History

2009-08-25 12:16:42 +00:00
<?php
/*
********************************************************************
| Copyright (c) 2007-2009 Clip-Bucket.com. All rights reserved.
| @ Author : ArslanHassan
| @ Software : ClipBucket , © PHPBucket.com
********************************************************************
2009-08-25 12:16:42 +00:00
*/
define("THIS_PAGE",'videos');
define("PARENT_PAGE",'videos');
2009-08-25 12:16:42 +00:00
require 'includes/config.inc.php';
$pages->page_redir();
$userquery->perm_check('view_videos',true);
2009-08-25 12:16:42 +00:00
//Setting Sort
$sort = $_GET['sort'];
2011-02-21 16:14:11 +00:00
$child_ids = "";
2011-02-21 16:14:11 +00:00
if($_GET['cat'] && $_GET['cat']!='all')
{
2011-02-21 16:14:11 +00:00
$childs = $cbvid->get_sub_categories(mysql_clean($_GET['cat']));
$child_ids = array();
2011-02-21 16:25:15 +00:00
if($childs)
foreach($childs as $child)
2011-02-21 16:14:11 +00:00
{
2011-02-21 16:25:15 +00:00
$child_ids[] = $child['category_id'];
$subchilds = $childs = $cbvid->get_sub_categories($child['category_id']);
if($subchilds)
foreach($subchilds as $subchild)
{
$child_ids[] = $subchild['category_id'];
}
2011-02-21 16:14:11 +00:00
}
$child_ids[] = mysql_clean($_GET['cat']);
}
$vid_cond = array('category'=>$child_ids,'date_span'=>$_GET['time'],'sub_cats');
switch($sort)
{
case "most_recent":
default:
{
$vid_cond['order'] = " date_added DESC ";
}
break;
case "most_viewed":
{
$vid_cond['order'] = " views DESC ";
}
break;
case "most_viewed":
{
$vid_cond['order'] = " views DESC ";
}
break;
case "featured":
{
$vid_cond['featured'] = "yes";
}
break;
case "top_rated":
{
$vid_cond['order'] = " rating DESC, rated_by DESC";
}
break;
case "most_commented":
{
$vid_cond['order'] = " comments_count DESC";
}
break;
}
//Getting Video List
$page = mysql_clean($_GET['page']);
$get_limit = create_query_limit($page,VLISTPP);
$vlist = $vid_cond;
2011-08-09 23:08:23 +00:00
$count_query = $vid_cond;
$vlist['limit'] = $get_limit;
$videos = get_videos($vlist);
Assign('videos', $videos);
2009-08-25 12:16:42 +00:00
//Collecting Data for Pagination
$vcount = $vid_cond;
2011-08-09 23:08:23 +00:00
$counter = get_counter('video',$count_query);
if(!$counter)
{
$vcount['count_only'] = true;
$total_rows = get_videos($vcount);
$total_pages = count_pages($total_rows,VLISTPP);
$counter = $total_pages;
update_counter('video',$count_query,$counter);
}
2009-08-25 12:16:42 +00:00
//Pagination
2011-08-09 23:08:23 +00:00
$pages->paginate($counter,$page);
2009-08-25 12:16:42 +00:00
subtitle(lang('videos'));
//Displaying The Template
template_files('videos.html');
display_it();
2011-02-21 16:25:15 +00:00
?>