File: /home/httpd/html/porn.tw/public_html/includes/ajax.aweblacklabel_loadgalleries.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']) {
header("Location: $basehttp/login");
}
//purchase attempt
if($_GET['purchase'] == 1 && $_GET['id'] && $_GET['albumId']) {
$userData = array( "performerNick" => htmlentities($_GET['id']),
"id" => $_GET['albumId']);
$response = aweBlacklabelCurlRequestPost("purchases/album",$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;
}
}
if($_GET['albumId']) {
$contentData = aweBlacklabelCurlRequest('performers/'.$_GET['id'].'/albums/'.$_GET['albumId'].'/items',"");
} else {
$contentData = aweBlacklabelCurlRequest('performers/'.$_GET['id'].'/albums',"");
}
?>
<div id='videosRoot' class='row'>
<? if($_GET['albumId']) {
//load album
?> <? //print_r($contentData); ?>
<div class='aweTopTabs' style='margin-bottom: 5px;'>
<a class="loadInModalAjax" href='<? echo $basehttp; ?>/live-webcams/loadGalleries/<? 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 (float)$_GET['price']; ?> Credit(s)</a><? } ?>
</div>
<? if($_GET['isLocked']) { ?>
<center>
<h2 style='color: #ffffff; font-weight: bold; padding-top: 50px; font-size: 1.5rem;'>You must purchase this gallery to view it.</h2>
<A class="loadInModalAjax" href='<? echo $basehttp; ?>/live-webcams/loadGalleries/<? echo htmlentities($_GET['id']); ?>?albumId=<? echo htmlentities($_GET['albumId']); ?>&purchase=1'>Click here to purchase this gallery for <? echo (float)htmlentities($_GET['price']); ?> Credit(s)</a>
</center>
<? } ?>
<br>
<center>
<? if(count($contentData['data']['items']) == 1) { ?>
<img id='showFullImage' style='display: block; width: 95%; padding-bottom: 10px;' src='<? echo $contentData['data']['items'][0]['urls']['1920']['url']; ?>'>
<? } else { ?>
<img id='showFullImage' style='display: none; width: 95%; padding-bottom: 10px;'>
<? foreach($contentData['data']['items'] as $c) { ?>
<a class="aweImageThumb" href='<? echo $c['urls']['1920']['url']; ?>'><img src='<? echo $c['coverImageUrls']['400']['url']; ?>' style='max-width: 400px; height: 292px; margin-right: 5px; margin-bottom: 10px;'></a>
<? } ?>
<? } ?>
</center>
<? } else {
//load album listing
if(count($contentData['data']['albums']) < 1) {
?>
<center>
<h2 style='color: #ffffff; font-weight: bold; padding-top: 50px; font-size: 1.5rem;'>Sorry, this performer has no galleries.</h2>
</center>
<?
exit();
}
foreach($contentData['data']['albums'] as $c) {
if($c['isLocked'] == 1) {
$link = "$basehttp/live-webcams/loadGalleries/".htmlentities($_GET['id'])."?albumId=".$c['id']."&isLocked=1&price=".(float)$c['price'];
} else {
$link = "$basehttp/live-webcams/loadGalleries/".htmlentities($_GET['id'])."?albumId=".$c['id'];
}
if($c['type'] == 'image') {
include("$template_path/awe_blacklabel/template.content_item_photo.php");
}
}
}
?>
</div>
<script>
$(document).ready(function() {
$('.aweImageThumb').click(function(event){
event.preventDefault();
var dataHref = $(this).attr('href');
$("#showFullImage").attr("src",dataHref);
$("#showFullImage").show();
$('#resultRoot').animate( { scrollTop: "0" }, 250);
return false;
});
$('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; }
.aweTopTabs { clear: both; width: 100%; }
<style>