private function home_page() { $request = $_REQUEST; define('API_HOME_PAGE', 'yes'); global $cbvid; $videos = $cbvid->get_videos(array('featured' => 'yes', 'limit' => 10, 'order' => 'featured_date DESC', 'has_mobile' => 'yes')); global $userquery; $new_videos = array(); if ($videos) { foreach ($videos as $video) { $video['title'] = utf8_encode($video['title']); $video['description'] = utf8_encode($video['description']); $video['thumbs'] = array('default' => get_thumb($video), 'big' => get_thumb($video, 'big'), '640x480' => get_thumb($video, '640x480')); if (function_exists('get_mob_video')) { $video['videos'] = array('mobile' => get_mob_video(array('video' => $video))); if ($video['has_hd'] == 'yes') { $video['videos']['hq'] = get_hq_video_file($video); } } $video['url'] = $video['video_link'] = $video['videoLink'] = videoLink($video); $video['avatar'] = $video['user_photo'] = $video['displayPic'] = $userquery->avatar($video); $video['avatars']['medium'] = $userquery->avatar($video, 'small'); $video['avatars']['xmedium'] = $userquery->avatar($video, 'xmedium'); $video['avatars']['large'] = $userquery->avatar($video, 'large'); $new_videos[] = $video; } } $featured = $new_videos; $categories = $cbvid->getCbCategories(array('cond' => " ( category_id = '1' OR category_id = '16' OR category_id = '26' OR category_id = '15' ) ", 'limit' => 4, 'type' => 'v')); $cat_videos = array(); foreach ($categories as $category) { $cat_vid = array('name' => $category['category_name'], 'id' => $category['category_id']); $videos = $cbvid->get_videos(array('limit' => 10, 'category' => $category['category_id'], 'order' => ' date_added desc ')); $new_videos = array(); if ($videos) { foreach ($videos as $video) { $video['title'] = utf8_encode($video['title']); $video['description'] = utf8_encode($video['description']); $video['thumbs'] = array('default' => get_thumb($video), 'big' => get_thumb($video, 'big'), '640x480' => get_thumb($video, '640x480')); if (function_exists('get_mob_video')) { $video['videos'] = array('mobile' => get_mob_video(array('video' => $video))); if ($video['has_hd'] == 'yes') { $video['videos']['hq'] = get_hq_video_file($video); } } $video['url'] = $video['video_link'] = $video['videoLink'] = videoLink($video); $video['avatar'] = $video['user_photo'] = $video['displayPic'] = $userquery->avatar($video); $video['avatars']['medium'] = $userquery->avatar($video, 'medium'); $video['avatars']['xmedium'] = $userquery->avatar($video, 'xmedium'); $video['avatars']['large'] = $userquery->avatar($video, 'large'); $new_videos[] = $video; } } $cat_vid['videos'] = $new_videos; $cat_videos[] = $cat_vid; } $home = array('featured' => $featured, 'categories' => $cat_videos); //echo json_encode($home); if (!empty($featured) || !empty($cat_videos)) { $data = array('code' => "200", 'status' => "success", "msg" => "Success", "data" => $home); $this->response($this->json($data)); } else { $data = array('code' => "204", 'status' => "success", "msg" => "No Record Found", "data" => ""); $this->response($this->json($data)); } }
$search = cbsearch::init_search($type); $search->limit = create_query_limit($page, $limit); $search->key = mysql_clean($request['query']); $results = $search->search(); if ($results) { $the_results = array(); switch ($type) { case "video": default: if ($results) { foreach ($results as $video) { $hq_file = get_hq_video_file($video); $video['title'] = title($video['title']); $video['description'] = mob_description($video['description']); $video['thumbs'] = array('default' => get_thumb($video), 'big' => getSmartyThumb(array('vdetails' => $video, 'size' => 'big'))); $video['videos'] = array('mobile' => get_mob_video(array('video' => $video))); $video['url'] = $video['video_link'] = $video['videoLink'] = videoLink($video); if (has_hq($video)) { $video['videos']['hd'] = $hq_file; } foreach ($blacklist_fields as $field) { unset($video[$field]); } $the_results[] = $video; } } break; case "users": if ($results) { foreach ($results as $user) { $user['avatar'] = $user['user_photo'] = $userquery->avatar($user);