clr_str($_GET[$type[0]]);
$pl_key = $class_filter->clr_str($_GET["p"]);
$cfg[] = $class_database->getConfigurations('video_player,audio_player,affiliate_tracking_id');
$_cfg = unserialize($class_database->singleFieldValue('db_fileplayers', 'db_config', 'db_name', $cfg["video_player"] . '_embed'));
if ($pl_key) {
$pl = unserialize($class_database->singleFieldValue('db_' . $type . 'playlists', 'pl_files', 'pl_key', $pl_key));
$file_key = $pl[0];
}
$u = $db->execute(sprintf("SELECT
A.`usr_key`, A.`usr_live`,
B.`usr_id`, B.`embed_src`,
B.`file_title`, B.`file_category`, B.`thumb_cache`
FROM
`db_accountuser` A, `db_%sfiles` B
WHERE
A.`usr_id`=B.`usr_id` AND
B.`file_key`='%s'
LIMIT 1;", $type, $file_key));
$usr_key = $u->fields["usr_key"];
$channel_id = (int) $u->fields["usr_id"];
$title = $u->fields["file_title"];
$embed_src = $u->fields["embed_src"];
$live = $u->fields["usr_live"];
$thumb_cache = $u->fields["thumb_cache"];
$thumb_cache = $thumb_cache > 1 ? $thumb_cache : null;
$mob = VHref::isMobile();
$tmb = $cfg["media_files_url"] . '/' . $usr_key . '/t/' . $file_key . '/0' . $thumb_cache . '.jpg';
// Membership gating (scaffold): if a tier is required and viewer lacks access, show upsell instead of player
if (VMembership::enabled()) {
$reqTier = VMembership::getRequiredTierForFile($type, $file_key);
if ($reqTier && !VMembership::hasAccess((int) $_SESSION['USER_ID'], $channel_id, $reqTier)) {
$join_url = $cfg['main_url'] . '/' . VHref::getKey('channel') . '/' . $usr_key . '#join';
echo '
'
. '' . htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . ''
. ''
. '';
exit;
}
}
switch ($cfg["video_player"]) {
case "vjs":
$tmb_url = VGenerate::thumbSigned($type, $file_key, array($usr_key, $thumb_cache));
if ($type == 'short') {
$_cfg["vjs_advertising"] = 0;
}
if ($_cfg["vjs_advertising"] == 1 and $embed_src == 'local') {
$t = $db->execute(sprintf("SELECT `vjs_ads` FROM `db_%sfiles` WHERE `file_key`='%s' LIMIT 1;", $type, $file_key));
$ads = $t->fields["vjs_ads"];
if ($ads != '') {
//found ads assigned to video
$ar = unserialize($ads);
$sql = sprintf("SELECT `ad_id`, `ad_key`, `ad_client`, `ad_tag`, `ad_skip`, `ad_comp_div`, `ad_comp_id`, `ad_comp_w`, `ad_comp_h` FROM `db_vjsadentries` WHERE `ad_type`='dedicated' AND `ad_active`='1'%s AND `ad_id` IN (%s) ORDER BY RAND() LIMIT 1;", ($mob ? " AND `ad_mobile`='1'" : null), ($ar[0] > 0 ? implode(',', $ar) : 0));
$t = $db->execute($sql);
} else {
//check for category ads
$t = $db->execute(sprintf("SELECT `ct_ads` FROM `db_categories` WHERE `ct_id`='%s' LIMIT 1;", $res->fields["file_category"]));
$ads = $t->fields["ct_ads"];
if ($ads != '') {
//found ads assigned to category
$ar = unserialize($ads);
$sql = sprintf("SELECT `ad_id`, `ad_key`, `ad_client`, `ad_tag`, `ad_skip`, `ad_comp_div`, `ad_comp_id`, `ad_comp_w`, `ad_comp_h` FROM `db_vjsadentries` WHERE `ad_type`='dedicated' AND `ad_active`='1'%s AND `ad_id` IN (%s) ORDER BY RAND() LIMIT 1;", ($mob ? " AND `ad_mobile`='1'" : null), ($ar[0] > 0 ? implode(',', $ar) : 0));
$t = $db->execute($sql);
} else {
//no video ads assigned/generate a random ad
$sql = sprintf("SELECT `ad_id`, `ad_key`, `ad_client`, `ad_tag`, `ad_skip`, `ad_comp_div`, `ad_comp_id`, `ad_comp_w`, `ad_comp_h` FROM `db_vjsadentries` WHERE `ad_type`='shared' AND `ad_active`='1'%s ORDER BY RAND() LIMIT 1;", ($mob ? " AND `ad_mobile`='1'" : null));
$t = $db->execute($sql);
}
}
if ($t->fields["ad_id"]) {
$ad_client = ($t->fields["ad_client"] == 'custom' ? 'vast' : $t->fields["ad_client"]);
$ad_tag_url = ($t->fields["ad_client"] == 'custom' ? $cfg['main_url'] . '/' . VHref::getKey('vast') . '?t=vjs&v=' . $t->fields["ad_key"] : $t->fields["ad_tag"]);
$ad_skip = ($t->fields["ad_client"] == 'custom' ? $t->fields["ad_skip"] : false);
$ad_tag_comp = $t->fields["ad_comp_div"];
$ad_tag_comp_id = $t->fields["ad_comp_id"];
$ad_tag_comp_w = $t->fields["ad_comp_w"];
$ad_tag_comp_h = $t->fields["ad_comp_h"];
$smarty->assign('ad_client', ($ad_client == 'custom' ? 'vast' : $t->fields["ad_client"]));
}
}
$css = '';
$css_extra = '';
$css_extra .= '';
if ($_cfg["vjs_advertising"] == 1 and $embed_src == 'local') {
if ($ad_client == 'vast' or $ad_client == 'custom') {
$css_extra .= '';
$css_extra .= '';
} elseif ($ad_client == 'ima') {
$css_extra .= '';
$css_extra .= '';
} elseif ($ad_client == 'vamp') {
$css_extra .= '';
$css_extra .= '';
}
if ($ad_tag_comp == 1) {
$css_extra .= '';
$css_extra .= '';
}
}
$player_key = null;
$player_style = 'width: 100%; height: 100%;';
$player_br = null;
$player_cp = null;
$player_js = 'https://vjs.zencdn.net/5.19/video.min.js';
$player_js_extra = '';
if ($_cfg["vjs_advertising"] == 1) {
$player_js_extra .= '';
if ($ad_client == 'ima' and $embed_src == 'local') {
$player_js_extra .= '';
$player_js_extra .= '';
$player_js_extra .= '';
} elseif ($ad_client == 'vamp' and $embed_src == 'local') {
$player_js_extra .= '';
$player_js_extra .= '';
$player_js_extra .= '';
$player_js_extra .= '';
$player_js_extra .= '';
} elseif (($ad_client == 'vast' or $ad_client == 'custom') and $embed_src == 'local') {
$player_js_extra .= '';
$player_js_extra .= '';
}
}
$player_js_extra .= '';
$player_js_extra .= $live == 1 ? '' : null;
$player_js_extra .= $live == 1 ? '' : null;
$css_extra .= '
';
break;
}
?>
>
' : null;
$phtml .= ($type[0] == 'a' and $cfg["audio_player"] == 'vjs') ? '<' . $type . ' id="view-player-' . $file_key . '" style="width: 100%; height: 100%;" oncontextmenu="return false;" preload="none" class="video-js vjs-default-skin vjs-big-play-centered" />' : null;
} else {
$phtml = '
';
}
if (($cfg["video_player"] == 'vjs' and ($type[0] == 'v' or $type[0] == 'l' or $type[0] == 's')) or ($cfg["audio_player"] == 'vjs' and $type[0] == 'a')) {
$first_sub = null;
$other_sub = null;
$thumb_file = $cfg["media_files_dir"] . '/' . $usr_key . '/t/' . $file_key . '/p/thumbnails.vtt';
if (file_exists($thumb_file)) {
$first_sub .= '
';
}
$sub_file = $class_database->singleFieldValue('db_' . $type . 'subs', 'vjs_subs', 'file_key', $file_key);
if ($sub_file != '') {
$sub_arr = unserialize($sub_file);
foreach ($sub_arr as $sub_file => $sub_arr) {
if ($sub_arr['default'] == '1') {
$first_sub .= '
';
} else {
$other_sub .= '
';
}
}
}
}
$phtml .= $first_sub . $other_sub;
if ($embed_src == 'local' and $_cfg["vjs_advertising"] == 1) {
if (($cfg["video_player"] == 'vjs' and ($type[0] == 'v' or $type[0] == 'l')) or ($cfg["audio_player"] == 'vjs' and $type[0] == 'a')) {
if ($_cfg["vjs_advertising"] == 1 and $ad_client == 'ima') {
$phtml .= '
';
$phtml .= '';
}
}
}
echo $phtml;
$b = $cfg["main_url"] . '/' . VHref::getKey("viewers") . '?e=1&' . $type[0] . '=' . $file_key;
?>