function cb_player($in) { global $cb_player; $cb_player = true; $vdetails = $in['vdetails']; $vid_file = get_video_file($vdetails, true, true); //Checking for YT Referal if (function_exists('get_refer_url_from_embed_code')) { $ref_details = get_refer_url_from_embed_code(unhtmlentities(stripslashes($vdetails['embed_code']))); $ytcode = $ref_details['ytcode']; } if ($vid_file || $ytcode) { $hd = $data['hq']; if ($hd == 'yes') { $file = get_hq_video_file($vdetails); } else { $file = get_video_file($vdetails, true, true); } $hd_file = get_hq_video_file($vdetails); if ($ytcode) { assign('youtube', true); assign('ytcode', $ytcode); } if (!strstr($in['width'], "%")) { $in['width'] = $in['width'] . 'px'; } if (!strstr($in['height'], "%")) { $in['height'] = $in['height'] . 'px'; } if ($in['autoplay'] == 'yes' || $in['autoplay'] === true || $_COOKIE['auto_play_playlist'] && ($_GET['play_list'] || $_GET['playlist'])) { $in['autoplay'] = true; } else { $in['autoplay'] = false; } //Logo Placement assign('logo_placement', cb_player_logo_position()); assign('logo_margin', config('logo_padding')); //Setting Skin assign('cb_skin', 'glow/glow.xml'); assign('player_data', $in); assign('player_logo', website_logo()); assign('normal_vid_file', $vid_file); assign("hq_vid_file", $hd_file); assign('vdata', $vdetails); Template(CB_PLAYER_DIR . '/cbplayer.html', false); return true; } }
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)); } }
$limit = 20; if (!$type) { $type = 'video'; } $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;
} if ($is_mobile) { $request['has_mobile'] = 'yes'; } $videos = $cbvid->get_videos($request); header('Content-Type: text/html; charset=utf-8'); $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')); if (function_exists('get_mob_video')) { $video['videos'] = array('mobile' => get_mob_video(array('video' => $video))); if (has_hq($video)) { $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); /* if (!$video['fullname']) { $video['userDetail'] = $userquery->get_user_details($video['userid']); } */ foreach ($blacklist_fields as $field) { unset($video[$field]); } $new_videos[] = $video; }
/** * this function will play pak player * @param : $in ARRAY * array('vdetails' [all video details]) */ function pak_player($in) { global $pak_player; $pak_player = true; $vdetails = $in['vdetails']; $vid_file = get_video_file($vdetails, true, true); //Checking for YT Referal if (function_exists('get_refer_url_from_embed_code')) { $ref_details = get_refer_url_from_embed_code(unhtmlentities(stripslashes($vdetails['embed_code']))); $ytcode = $ref_details['ytcode']; } if ($vid_file || $ytcode) { $hd = $data['hq']; if ($hd == 'yes') { $file = get_hq_video_file($vdetails); } else { $file = get_video_file($vdetails, true, true); } $hd_file = get_hq_video_file($vdetails); if ($ytcode) { assign('youtube', true); assign('ytcode', $ytcode); } if (!strstr($in['width'], "\\%")) { $in['width'] = $in['width'] . 'px'; } if (!strstr($in['height'], "\\%")) { $in['height'] = $in['height'] . 'px'; } if ($in['autoplay'] == 'yes' || $in['autoplay'] === true || $_COOKIE['auto_play_playlist'] && $_GET['playlist']) { $in['autoplay'] = true; } else { $in['autoplay'] = false; } //Logo Placement $placement = config('logo_placement'); switch ($placement) { case "tl": assign('logo_top', '5'); assign('logo_left', '5'); assign('logo_position', 'top:5,left:5'); break; case "tr": assign('logo_top', '5'); assign('logo_right', '5'); assign('logo_position', 'top:5,right:5'); break; case "br": assign('logo_bottom', '5'); assign('logo_right', '5'); assign('logo_position', 'bottom:5,right:5'); break; case "bl": assign('logo_bottom', '5'); assign('logo_left', '5'); assign('logo_position', 'bottom:5,left:5'); break; } assign('player_data', $in); assign('player_logo', website_logo()); assign('normal_vid_file', $vid_file); assign("hq_vid_file", $hd_file); assign('vdata', $vdetails); assign('pakplayer', 'yes'); assign('updateEmbedCode', 'updateEmbedCode'); Template(PAK_PLAYER_DIR . '/player.html', false); return true; } }
<?php define("CLEAN_BASEURL", "/\\/player\\/cbplayer/"); include "../../includes/config.inc.php"; $vid = $_GET['vid']; //gettin video details $vdetails = get_video_details($vid); if (!$vdetails) { exit(json_encode(array("err" => "no video details found"))); } header('Content-Type: text/xml'); $video = $vdetails; //Loading video files $vid_file = get_video_file($vdetails, true, true); $hd_file = get_hq_video_file($vdetails, false); /* Checking for youtube */ $ref = $video['refer_url']; //Trying other method if (function_exists('get_refer_url_from_embed_code')) { $ref_details = get_refer_url_from_embed_code(unhtmlentities(stripslashes($video['embed_code']))); $ytcode = $ref_details['ytcode']; } ?> <config> <?php if (!$ytcode) { ?> <file><?php echo $vid_file; ?>
/** * Function used to check weather video has Mp4 file or not */ function has_hq($vdetails, $is_file = false) { if (!$is_file) { $file = get_hq_video_file($vdetails); } else { $file = $vdetails; } if (getext($file) == 'mp4') { return $file; } else { return false; } }
function html5_player($in) { global $html5_player; $html5_player = true; $vdetails = $in['vdetails']; $video_play = get_video_files($vdetails, true, true); if (function_exists('get_refer_url_from_embed_code')) { $ref_details = get_refer_url_from_embed_code(unhtmlentities(stripslashes($vdetails['embed_code']))); $ytcode = $ref_details['ytcode']; } if ($video_play || $ytcode) { $hd = $data['hq']; if ($hd == 'yes') { $file = get_hq_video_file($vdetails); } else { $file = get_video_files($vdetails, true, true); } $hd_file = get_hq_video_file($vdetails); if ($ytcode) { assign('youtube', true); assign('ytcode', $ytcode); } if (!strstr($in['width'], "%")) { $in['width'] = $in['width'] . 'px'; } if (!strstr($in['height'], "%")) { $in['height'] = $in['height'] . 'px'; } // Allowing CB defalut player settings to Html5player if ($in['autoplay'] == 'yes') { assign('autoplay', 'true'); } if ($in['player_logo_url']) { $player_logo_url = $in['player_logo_url']; assign('product_link', $player_logo_url); } assign('vdata', $vdetails); assign('height', $in['height']); assign('width', $in['width']); $l_details = BASEURL . '/images/icons/country/hp-cb.png'; $l_convert = base64_encode(file_get_contents($l_details)); assign('display', $l_convert); //Enable disable enlarge/smaal button $enlarge_button = $in['enlarge_button']; if (THIS_PAGE == 'watch_video' && $enlarge_button == 'yes') { assign('enlarge_small', 'true'); } else { assign('enlarge_small', 'false'); } assign('about', BASEURL); $jquery = BASEDIR . '/js/jquery.js'; assign('jquery', $jquery); // logo placement $pos = config('logo_placement'); switch ($pos) { case "tl": $position = array("top" => '5px', "left" => '5px', "bottom" => '', "right" => ''); break; case "tr": $position = array("top" => '5px', "left" => '', "bottom" => '', "right" => '5px'); break; case "br": $position = array("top" => '', "left" => '', "bottom" => '5px', "right" => '5px'); break; case "bl": $position = array("top" => '', "left" => '5px', "bottom" => '5px', "right" => ''); break; } assign('top', $position["top"]); assign('left', $position["left"]); assign('bottom', $position["bottom"]); assign('right', $position["right"]); assign('username', $username); assign('title', $title); assign('thumb', $default_thumb); assign('key', $videokey); assign('has_hq', $has_hq); assign('player_data', $in); // setting flash player fallback for Flashplayer Videos $ext = getExt($video_play[0]); if ($ext == 'flv') { assign('player_data', $in); assign('cb_skin', 'glow/glow.xml'); assign('player_url', PLAYER_URL); assign('flashplayer', true); } if (!is_array($video_play)) { assign('normal_vid_file', $video_play); assign('application_videos', true); } else { if ($video_play[0]) { $quality = get_quality($video_play[0]); if ($quality == 'hd' || $quality == 'sd') { assign('application_videos', true); if ($video_play[1] == '') { assign('normal_vid_file', $video_play[0]); assign('hq_vid_file', ''); } else { assign('normal_vid_file', $video_play[1]); assign('hq_vid_file', $video_play[0]); assign('HQ', true); } } else { $video_play = process_app_videos($video_play); $json_array = json_encode($video_play); assign('json_videos', $json_array); $video_play = array_reverse($video_play, true); assign('ms_videos', $video_play); } } else { $json_array = json_encode($video_play); assign('json_videos', $json_array); $video_play = array_reverse($video_play, true); assign('ms_videos', $video_play); } } if (CB_HTML5_PLAYER_SETTINGS == 'installed') { $html5_configs = get_html5_configs(); $iv_logo_enable = $html5_configs['iv_logo_enable']; if ($iv_logo_enable == 'yes') { $ov_details = BASEURL . '/images/icons/country/ov.png'; $ov_convert = base64_encode(file_get_contents($ov_details)); assign('ov', $ov_convert); } assign('iv_logo_enbale', $iv_logo_enable); } Template(HTML5_PLAYER_DIR . '/html5_player.html', false); return true; } }
/** * Function used to check weather video has Mp4 file or not */ function has_hq($vdetails, $is_file = false) { $custom_funcs = cb_get_functions('has_hq'); if ($custom_funcs && !$is_file) { foreach ($custom_funcs as $func) { if (function_exists($func)) { return $func($vdetails); } } } if (!$is_file) { $file = get_hq_video_file($vdetails); } else { $file = $vdetails; } if (getext($file) == 'mp4' && !strstr($file, '-m')) { return $file; } else { return false; } }