2009-08-25 12:16:42 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2010-01-15 16:10:20 +00:00
|
|
|
****************************************************************
|
|
|
|
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
|
|
|
|
| @ Author : ArslanHassan
|
|
|
|
| @ Software : ClipBucket , © PHPBucket.com
|
|
|
|
*****************************************************************
|
2009-08-25 12:16:42 +00:00
|
|
|
*/
|
2009-12-23 13:06:42 +00:00
|
|
|
define('THIS_PAGE','search_result');
|
2009-08-25 12:16:42 +00:00
|
|
|
require 'includes/config.inc.php';
|
|
|
|
$pages->page_redir();
|
2009-10-14 21:09:54 +00:00
|
|
|
|
|
|
|
$page = mysql_clean($_GET['page']);
|
2010-04-29 13:46:06 +00:00
|
|
|
$type = mysql_clean($_GET['type']) ;
|
2009-12-25 17:13:06 +00:00
|
|
|
$type = $type ? $type : 'videos';
|
2011-01-03 11:02:54 +00:00
|
|
|
$chkType = $type;
|
|
|
|
//Checking if search for specific section is allowed or not
|
|
|
|
if($type=='users') $chkType = 'channels';
|
|
|
|
isSectionEnabled($chkType,true);
|
|
|
|
|
2009-12-23 13:06:42 +00:00
|
|
|
$search = cbsearch::init_search($type);
|
2009-08-25 12:16:42 +00:00
|
|
|
|
2010-04-29 13:46:06 +00:00
|
|
|
$search->key = mysql_clean($_GET['query']);
|
2010-06-24 07:05:52 +00:00
|
|
|
|
|
|
|
if(!is_array($_GET['category']))
|
|
|
|
$_GET['category'] = mysql_clean($_GET['category']);
|
2011-02-21 13:28:50 +00:00
|
|
|
|
|
|
|
if($type!='videos')
|
|
|
|
$search->category = $_GET['category'];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$child_ids = array();
|
2010-06-24 07:05:52 +00:00
|
|
|
|
2011-02-21 13:28:50 +00:00
|
|
|
foreach($_GET['category'] as $category)
|
|
|
|
{
|
|
|
|
$childs = $cbvid->get_sub_categories(mysql_clean($category));
|
|
|
|
if($childs)
|
|
|
|
foreach($childs as $child)
|
|
|
|
{
|
|
|
|
$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'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$child_ids[] = mysql_clean($category);
|
|
|
|
}
|
|
|
|
|
|
|
|
$search->category = $child_ids;
|
|
|
|
}
|
2010-04-29 13:46:06 +00:00
|
|
|
$search->date_margin = mysql_clean($_GET['datemargin']);
|
|
|
|
$search->sort_by = mysql_clean($_GET['sort']);
|
2010-03-03 11:40:20 +00:00
|
|
|
$search->limit = create_query_limit($page,$search->results_per_page);
|
2009-12-23 13:06:42 +00:00
|
|
|
$results = $search->search();
|
2009-08-25 12:16:42 +00:00
|
|
|
|
2009-10-14 21:09:54 +00:00
|
|
|
//Collecting Data for Pagination
|
2010-03-03 11:40:20 +00:00
|
|
|
$total_rows = $search->total_results;
|
|
|
|
$total_pages = count_pages($total_rows,$search->results_per_page);
|
2009-08-25 12:16:42 +00:00
|
|
|
|
2009-10-14 21:09:54 +00:00
|
|
|
//Pagination
|
|
|
|
$pages->paginate($total_pages,$page);
|
2009-12-23 13:06:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
Assign('results',$results );
|
|
|
|
Assign('template_var',$search->template_var);
|
|
|
|
Assign('display_template',$search->display_template);
|
2010-03-03 12:16:07 +00:00
|
|
|
if(empty($search->key))
|
|
|
|
Assign('search_type_title',$search->search_type[$type]['title']);
|
|
|
|
else
|
2011-02-07 16:04:49 +00:00
|
|
|
Assign('search_type_title',sprintf(lang('searching_keyword_in_obj'),mysql_clean(get('query')),$search->search_type[$type]['title']));
|
2009-08-25 12:16:42 +00:00
|
|
|
|
2011-02-07 16:04:49 +00:00
|
|
|
if(mysql_clean(get('query')))
|
|
|
|
{
|
|
|
|
subtitle($search->search_type[$type]['title'].' » '.mysql_clean(get('query')));
|
|
|
|
}
|
2009-10-14 21:09:54 +00:00
|
|
|
//Displaying The Template
|
|
|
|
template_files('search.html');
|
|
|
|
display_it();
|
2010-01-16 08:02:43 +00:00
|
|
|
//pr($db);
|
2009-08-25 12:16:42 +00:00
|
|
|
?>
|