File: //home/httpd/mech_ftp/baretube.com/includes/ajax.aweblacklabel_loadvideos.php
<?
include_once("../admin/db.php");
$_SESSION['aweBlacklabelLastViewedModel'] = $_GET['id']; //save last viewed model
//user is logged in, get payment URL.
if($_SESSION['userid']) {
$userData = array( "partnerUserId" => $_SESSION['userid'],
"displayName" => $_SESSION['username'],
"email" => $_SESSION['email']);
$response = aweBlacklabelCurlRequestPost("users",$userData);
$purchaseLink = $response['data']['purchaseUrl'];
if(detectMobile()) {
$purchaseLink = $purchaseLink."&device=mobile";
}
}
if($_GET['purchase'] == 1 && !$_SESSION['userid']) {
?>
<script>
window.top.location.href = "<? echo $basehttp; ?>/login";
</script>
<?
exit();
}
//purchase attempt
if($_GET['purchase'] == 1 && $_GET['id'] && $_GET['albumId']) {
$userData = array( "performerNick" => htmlentities($_GET['id']),
"id" => $_GET['albumId']);
$response = aweBlacklabelCurlRequestPost("purchases/video",$userData);
//$response = aweBlacklabelCurlRequest('purchases/album',"?performerNick=".htmlentities($_GET['id'])."&ID=".$_GET['albumId']);
if((int)$response['errors'][0]['code'] == 403 || (int)$response['errors'][0]['code'] == 402 ) {
?>
<center>
<h2 style='color: #ffffff; font-weight: bold; padding-top: 50px; font-size: 1.5rem;'>You don't have enough credits to purchase this video!</h2>
<A href='<? echo $purchaseLink; ?>'>Click here to purchase more credits</a>
</center>
<?
exit();
} else {
$purchaseSuccess = true;
}
}
$contentData = aweBlacklabelCurlRequest('performers/'.$_GET['id'].'/videos',"");
?>
<div id='videosRoot' class='row'>
<? if($_GET['albumId']) {
//load album
?>
<div class='aweTopTabs'>
<a class="loadInModalAjax" href='<? echo $basehttp; ?>/live-webcams/loadVideos/<? echo htmlentities($_GET['id']); ?>'>Back</a> <? if($_GET['isLocked']) { ?><a class="loadInModalAjax" href='<? echo $basehttp; ?>/live-webcams/loadVideos/<? echo htmlentities($_GET['id']); ?>?albumId=<? echo htmlentities($_GET['albumId']); ?>&purchase=1'>Purchase for <? echo (int)$_GET['price']; ?> Credit(s)</a><? } ?>
</div>
<br>
<? foreach($contentData['data']['items'] as $c) { ?>
<? if($c['id'] == $_GET['albumId']) {
if(!$c['urls']) {
?>
<center>
<h2 style='color: #ffffff; font-weight: bold; padding-top: 50px; font-size: 1.5rem;'>You must purchase this video to view it.</h2>
<A class="loadInModalAjax" href='<? echo $basehttp; ?>/live-webcams/loadVideos/<? echo htmlentities($_GET['id']); ?>?albumId=<? echo htmlentities($_GET['albumId']); ?>&purchase=1'>Click here to purchase this video for <? echo (int)htmlentities($_GET['price']); ?> Credit(s)</a>
<? if($c['id'] == $_GET['albumId']) { ?>
<div><br>
<img src='<? echo $c['coverImageUrls'][400]['url']; ?>'><br>
<? echo $c['title']; ?>
</div>
<? } ?>
</center>
<?
} else {
?>
<script src="<?php echo $basehttp; ?>/includes/fluidplayer/fluidplayer.min.js"></script>
<link href="<?php echo $basehttp; ?>/includes/fluidplayer/fluidplayer.min.css" rel="stylesheet">
<video id="thisPlayer">
<? foreach($c['urls'] as $cc) { ?>
<source src='<? echo $cc['url']; ?>' title='<? echo $cc['width']; ?>x<? echo $cc['height']; ?>' type='video/mp4' />
<? } ?>
</video>
<script type="text/javascript">
var myFluidPlayer = fluidPlayer(
'thisPlayer',
{
layoutControls: {
autoPlay: <? if($player_autoplay) echo 'true'; else { echo 'false'; } ?>,
playbackRateEnabled: true,
allowTheatre: true,
},
vastOptions: {
//vast tags go here as per https://docs.fluidplayer.com/ad_configuration/
}
}
);
</script>
<style>
#thisPlayer {
display: block;
width: <?php echo $width; ?>;
height: <?php echo $height; ?>;
position: relative;
}
#fluid_video_wrapper_thisPlayer {
position: absolute;
top: 35px;
bottom: 0;
left: 0;
right: 0;
width: 100% !important;
height: 90% !important;
}
.fluid_timeline_preview_container {
border: none !important;
}
</style>
<? } ?>
<? } ?>
<? } ?>
<? } else {
if(count($contentData['data']['items']) < 1) {
?>
<center>
<h2 style='color: #ffffff; font-weight: bold; padding-top: 50px; font-size: 1.5rem;'>Sorry, this performer has no videos.</h2>
</center>
<?
exit();
}
foreach($contentData['data']['items'] as $c) {
if($c['isLocked'] == 1) {
$link = "$basehttp/live-webcams/loadVideos/".htmlentities($_GET['id'])."?albumId=".$c['id']."&isLocked=1&price=".(int)$c['price'];
} else {
$link = "$basehttp/live-webcams/loadVideos/".htmlentities($_GET['id'])."?albumId=".$c['id'];
}
include("$template_path/awe_blacklabel/template.content_item_video.php");
}
}
?>
</div>
<script>
$(document).ready(function() {
$('a.loadInModalAjax').click(function(event){
event.preventDefault();
$("#resultRoot").html("<div class='loader'></div>");
$('#resultRoot').load($(this).attr('href'));
return false;
});
});
</script>
<style>
.freeContent:before { background-color: #3cba54 !important; }
<style>