user_exists && !$setting['setting_permission_album'] )
{
$page = "error";
$smarty->assign('error_header', 639);
$smarty->assign('error_message', 656);
$smarty->assign('error_submit', 641);
include "footer.php";
}
function chaturbatead()
{
$url="https://chaturbate.com/api/public/affiliates/onlinerooms/?wm=jFpVD&client_ip=request_ip&gender=m&tag=bateworld&num_users=1";
$ch = curl_init();
// Set URL to download
curl_setopt($ch, CURLOPT_URL, $url);
// Include header in result? (0 = yes, 1 = no)
curl_setopt($ch, CURLOPT_HEADER, 0);
// Should cURL return or print out the data? (true = return, false = print)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Timeout in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
// Download the given URL, and return output
$output = curl_exec($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
$j=json_decode($output);
if($j->count==0){
$url="https://chaturbate.com/api/public/affiliates/onlinerooms/?wm=jFpVD&client_ip=request_ip&gender=m&num_users=1";
$ch = curl_init();
// Set URL to download
curl_setopt($ch, CURLOPT_URL, $url);
// Include header in result? (0 = yes, 1 = no)
curl_setopt($ch, CURLOPT_HEADER, 0);
// Should cURL return or print out the data? (true = return, false = print)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Timeout in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
// Download the given URL, and return output
$output = curl_exec($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
$j=json_decode($output);
}
/* ?>


*/?>
count==0){
$url="https://chaturbate.com/api/public/affiliates/onlinerooms/?wm=jFpVD&client_ip=request_ip&gender=m&num_users=1";
$ch = curl_init();
// Set URL to download
curl_setopt($ch, CURLOPT_URL, $url);
// Include header in result? (0 = yes, 1 = no)
curl_setopt($ch, CURLOPT_HEADER, 0);
// Should cURL return or print out the data? (true = return, false = print)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Timeout in seconds
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
// Download the given URL, and return output
$output = curl_exec($ch);
// Close the cURL resource, and free system resources
curl_close($ch);
$j=json_decode($output);
}
/* ?>


*/?>
database_query("SET @SE_PRIVACY_SELF = 1, @SE_PRIVACY_FRIEND = 2, @SE_PRIVACY_FRIEND2 = 4, @SE_PRIVACY_SUBNET = 8, @SE_PRIVACY_REGISTERED = 16, @SE_PRIVACY_ANONYMOUS = 32");
//echo "(SELECT * FROM se_albums LEFT JOIN se_users ON se_albums.album_user_id=se_users.user_id WHERE album_totalfiles>-1 AND se_users.user_enabled='1' AND se_albums.album_user_id='{$user->user_info['user_id']}') UNION (SELECT * FROM se_albums LEFT JOIN se_users ON se_albums.album_user_id=se_users.user_id WHERE album_totalfiles>-1 AND se_users.user_enabled='1' AND ((se_albums.album_privacy & @SE_PRIVACY_FRIEND) AND (SELECT TRUE FROM se_friends WHERE friend_user_id1=se_albums.album_user_id AND friend_user_id2='{$user->user_info['user_id']}' AND friend_status='1' LIMIT 1)))";
// SET WHERE CLAUSE
$where = "album_search=1 AND album_totalspace>0 AND album_totalfiles>0";
// CREATE ALBUM OBJECT
$album = new se_album();
// ONLY MY FRIENDS' ALBUMS
if($v == "1" && $user->user_exists) {
// SET WHERE CLAUSE
$where .= " AND (SELECT TRUE FROM se_friends WHERE friend_user_id1='{$user->user_info['user_id']}' AND friend_user_id2=se_albums.album_user_id AND friend_status=1)";
}
if($v==0){
//$signup_array = $album->randomalbums($where);
}
// GET TOTAL ALBUMS
$total_albums = $album->album_total($where);
// MAKE ENTRY PAGES
$albums_per_page = 14;
$chaturbatead=rand(0, $albums_per_page);
$page_vars = make_page($total_albums, $albums_per_page, $p);
// GET ALBUM ARRAY
$album_array = $album->album_list($page_vars[0], $albums_per_page, $s, $where);
}
elseif($v==7){
//$database->database_query("SET @SE_PRIVACY_SELF = 1, @SE_PRIVACY_FRIEND = 2, @SE_PRIVACY_FRIEND2 = 4, @SE_PRIVACY_SUBNET = 8, @SE_PRIVACY_REGISTERED = 16, @SE_PRIVACY_ANONYMOUS = 32");
//echo "(SELECT * FROM se_albums LEFT JOIN se_users ON se_albums.album_user_id=se_users.user_id WHERE album_totalfiles>-1 AND se_users.user_enabled='1' AND se_albums.album_user_id='{$user->user_info['user_id']}') UNION (SELECT * FROM se_albums LEFT JOIN se_users ON se_albums.album_user_id=se_users.user_id WHERE album_totalfiles>-1 AND se_users.user_enabled='1' AND ((se_albums.album_privacy & @SE_PRIVACY_FRIEND) AND (SELECT TRUE FROM se_friends WHERE friend_user_id1=se_albums.album_user_id AND friend_user_id2='{$user->user_info['user_id']}' AND friend_status='1' LIMIT 1)))";
// SET WHERE CLAUSE
$where = "album_search=1 AND album_totalspace>0 AND album_totalfiles>0";
// CREATE ALBUM OBJECT
$album = new se_album();
// ONLY MY FRIENDS' ALBUMS
if($v == "1" && $user->user_exists) {
// SET WHERE CLAUSE
$where .= " AND (SELECT TRUE FROM se_friends WHERE friend_user_id1='{$user->user_info['user_id']}' AND friend_user_id2=se_albums.album_user_id AND friend_status=1)";
}
if($v==0){
//$signup_array = $album->randomalbums($where);
}
// GET TOTAL ALBUMS
$total_albums = $album->album_total($where);
// MAKE ENTRY PAGES
$albums_per_page = 14;
$chaturbatead=rand(0, $albums_per_page);
$page_vars = make_page($total_albums, $albums_per_page, $p);
// GET ALBUM ARRAY
$album_array = $album->randomalbums($where);
$album_array=array_slice($album_array, 0, $albums_per_page);
}
elseif($v==6)
{
$cutdb=$database->database_query("SELECT media_id FROM se_media ORDER BY media_id DESC Limit 1");
$dblatest=$database->database_fetch_array($cutdb);
$offsethigh=15*$p;
$where = "album_search=1 AND se_users.user_enabled=1 ";
$album = new se_album();
if($v==3){
//$signup_array = $album->randomphotos($where);
}
// GET TOTAL FILES IN ALBUM
$total_albums = $album->list_files_count($where);
//echo $total_albums ;
$media_per_page = 14;
$chaturbatead=rand(0, $media_per_page);
$sortby = "media_id DESC";
// MAKE MEDIA PAGES
$page_vars = make_page($total_albums, $media_per_page, $p);
if(SE_DEBUG){
$where.=$whereadd;
//echo $where;
}
$album_array = $album->randomphotos($page_vars[0], $media_per_page, $sortby, $where, $select);
$album_array=array_slice($album_array, 0, $media_per_page);
$photospart=1;
$smarty->assign_by_ref('photospart', $photospart);
}
elseif($v==3||$v==4)
{
$cutdb=$database->database_query("SELECT media_id FROM se_media ORDER BY media_id DESC Limit 1");
$dblatest=$database->database_fetch_array($cutdb);
$offsethigh=15*$p;
$where = "album_search=1 AND se_users.user_enabled=1 ";
if($v == "4" && $user->user_exists) {
// SET WHERE CLAUSE
$where .= " AND (SELECT TRUE FROM se_friends WHERE friend_user_id1='{$user->user_info['user_id']}' AND friend_user_id2=se_albums.album_user_id AND friend_status=1)";
$where1.= " AND (SELECT TRUE FROM se_friends WHERE friend_user_id1='{$user->user_info['user_id']}' AND friend_user_id2=se_albums.album_user_id AND friend_status=1)";
}
$album = new se_album();
if($v==3){
//$signup_array = $album->randomphotos($where);
}
// GET TOTAL FILES IN ALBUM
$total_albums = $album->list_files_count($where);
//echo $total_albums ;
$media_per_page = 14;
$chaturbatead=rand(0, $media_per_page);
$sortby = "media_id DESC";
// MAKE MEDIA PAGES
$page_vars = make_page($total_albums, $media_per_page, $p);
if(SE_DEBUG){
$where.=$whereadd;
//echo $where;
}
$album_array = $album->list_files($page_vars[0], $media_per_page, $sortby, $where, $select);
$photospart=1;
$smarty->assign_by_ref('photospart', $photospart);
}
elseif($v==4)
{
$album = new se_album();
// GET TOTAL FILES IN ALBUM
$total_albums = $album->list_files_count();
//echo $total_albums ;
$media_per_page = 14;
$chaturbatead=rand(0, $media_per_page);
$sortby = "media_order ASC";
// MAKE MEDIA PAGES
$page_vars = make_page($total_albums, $media_per_page, $p);
$album_array = $album->list_files($page_vars[0], $media_per_page, $sortby, $where, $select);
$photospart=1;
$smarty->assign_by_ref('photospart', $photospart);
}
$y=0;
for($x=$page_vars[1]; $x<=$page_vars[2]; $x++)
{
if(($page_vars[1]+4)==$x)
{break;}
$for[$y]=$x;
$y++;
}
$smarty->assign_by_ref('chaturbatead', $chaturbatead);
//$signup_array = recent_signups();
$smarty->assign_by_ref('signups', $signup_array);
$smarty->assign('for', $for);
// ASSIGN SMARTY VARIABLES AND DISPLAY ALBUMS PAGE
$smarty->assign('albums', $album_array);
$smarty->assign('total_albums', $total_albums);
$smarty->assign('p', $page_vars[1]);
$smarty->assign('maxpage', $page_vars[2]);
$smarty->assign('p_start', $page_vars[0]+1);
$smarty->assign('p_end', $page_vars[0]+count($album_array));
$smarty->assign('s', $s);
$smarty->assign('v', $v);
include "footer.php";
?>