100) $page=100;
$num_page = 15;
$from = ($page - 1) * $num_page;
$nxtpage = $page + 1;
$prepage = $page - 1;
$thumb_num = 8;
$cnt = 0;
if($ss_disp_name=='') {
$ss_disp_name = $user_name;
}
if($ss_disp_name=='') {
header( 'Location: /?status=no_ss' );
exit;
}
$query = "select id from myvidster_user where disp_name = '$ss_disp_name' and disable = 0";
$results = mysql_query($query,$mysql_link_slave2);
$row = mysql_fetch_array($results);
$ss_user_id = $row['id'];
//if($ss_user_id == $user_id) {
//update_user_activity($user_id,3);
//}
if(!$ss_user_id) {
header( 'Location: /?status=no_ss' );
exit;
}
// Where meta data for video, channel, gallery will be stored.
$meta_data = array("title" => "", "description" => "", "videothumbnail" => "");
//delete subscription
if ($action == "unfollow") {
if (!$user_id) {
header("Location: /user/index.php?redirect=".urlencode($_SERVER['REQUEST_URI']));
exit;
}
if($ss_disp_name == $user_name) {
$query = "Update myvidster_subscription set status=0 WHERE id = '$action_id'
AND user_id = '$user_id'";
mysql_query($query);
$action_txt = '
'._('You are no longer following this user.').' |
';
}
}
//hide subscription
if ($action == "hide") {
if (!$user_id) {
header("Location: /user/index.php?redirect=".urlencode($_SERVER['REQUEST_URI']));
exit;
}
if($ss_disp_name == $user_name) {
$query = "Update myvidster_subscription set status=2 WHERE id = '$action_id'
AND user_id = '$user_id'";
mysql_query($query);
}
}
//show subscription
if ($action == "show") {
if (!$user_id) {
header("Location: /user/index.php?redirect=".urlencode($_SERVER['REQUEST_URI']));
exit;
}
if($ss_disp_name == $user_name) {
$query = "Update myvidster_subscription set status=1 WHERE id = '$action_id'
AND user_id = '$user_id'";
mysql_query($query);
}
}
//set as favorite
if ($action == "top") {
if (!$user_id) {
header("Location: /user/index.php?redirect=".urlencode($_SERVER['REQUEST_URI']));
exit;
}
$query = "Update myvidster_subscription set favorite=1 WHERE id = '$action_id'
AND user_id = '$user_id'";
mysql_query($query);
}
//set as favorite
if ($action == "unsort") {
if (!$user_id) {
header("Location: /user/index.php?redirect=".urlencode($_SERVER['REQUEST_URI']));
exit;
}
if($ss_disp_name == $user_name) {
$query = "Update myvidster_subscription set favorite=0 WHERE id = '$action_id'
AND user_id = '$user_id'";
mysql_query($query);
}
}
if ($action == "add") {
if (!$user_id) {
$uri = urlencode($_SERVER['REQUEST_URI']);
header("Location: /user/?errorcode=2&redirect=".urlencode("/user/home.php?redirect=$uri"));
exit;
}
if($ss_disp_name == $user_name) {
insert_subscription($action_type,$action_id);
$action_txt = ''._('You are now following this user.').' |
';
}
else {
$to = "indysalsero@gmail.com";
$from = "mail@myvidster.com";
$subject = "insert_subscription_failed_attempt";
$params = implode(",", $_GET);
$self = $_SERVER['PHP_SELF'];
$ref = $_SERVER['HTTP_REFERER'];
$message = "$user_id $user_name $ref self:$self $params";
//send_mail($to,$from,$subject,$message);
}
}
if (!$ss_disp_name) $ss_disp_name = $user_name;
//query scribscriptions
$query = "SELECT count(id) FROM myvidster_subscription WHERE user_name = '$ss_disp_name' and status IN (1,2)";
if($action) {
sleep(1); //so that slave can keep up
$update=true;
}
else {
$update=false;
}
$results = mysql_query($query,$mysql_link_slave2);
$row1 = mysql_fetch_array($results);
$ss_count=$row1['count(id)'];
if($ss_count > 2) {
$z = 7;
}
elseif($ss_count > 75000) {
$sql = "UPDATE `myvidster_user` SET `disable` = '1' WHERE disp_name = '$ss_disp_name'";
mysql_query($sql);
echo "Abuse dedected, account disabled";
exit;
}
else {
$z = 14;
}
$range_limit=time() - ($z * 24 * 60 * 60);
$range_limit=date('Y-m-d H:i:s', $range_limit);
$pid = $ss_disp_name;
$rss = "subscriptions/$ss_disp_name";
if($filter_by){
$ss_string = "".display_selected_subscription($ss_disp_name,$filter_by,$filter_by_id)."
";
}
else
$ss_string = "".display_subscriptions($ss_disp_name,1,$thumb_num,$ss_count,$update)."
";
if($ss_disp_name) {
if ($filter_by) {
if ($filter_by == "gallery") {
$type_name = _("collection");
$type_name2= "collection";
}
elseif ($filter_by == "channel") {
$type_name = _('channel');
$type_name2= "channel";
}
elseif ($filter_by == "user") {
$type_name = _('all collections');
}
if($filter_by == "user") {
$sub_query = "SELECT user.disp_name
FROM myvidster_user user
WHERE id = '$filter_by_id'";
$use_index = "use index(user_id_2)";
}
else {
$sub_query = "SELECT user.disp_name, ".$filter_by.".name
FROM myvidster_user user,
myvidster_".$filter_by." ".$filter_by."
WHERE
user.id = ".$filter_by.".user_id AND
".$filter_by.".id = '$filter_by_id'";
//$use_index = "USE INDEX(fast_idx)";
}
$sub_result = mysql_query($sub_query,$mysql_link_slave);
$sub_row = mysql_fetch_array($sub_result);
$name = $sub_row['name'];
$sub_disp_name = $sub_row['disp_name'];
$sel_name2= ""._("Subscriptions")." » ";
$sel_name3= "$sub_disp_name » ";
if($filter_by == "user"){
$sel_name4= ""._("All Collections")."";
}
else
$sel_name4= "$name";
$sel_name = "$sel_name2 $sel_name3 $sel_name4";
$subscription = "".$filter_by.".id = $filter_by_id";
$pid .= "/$filter_by/$filter_by_id";
$header_txt = $sel_name;
//$header_txt = _("Viewing")." $sel_name ";
$rss = "$filter_by/$filter_by_id";
if($user_id) {
$query = "SELECT video.master_id, user.disp_name, video.id, video.posted, video.thumbnail, video.title,
video.channel_id, video.user_id, channel.gallery_id,
gallery.url_name, gallery.name as gallery_name, channel.name as channel_name,
video.private, watch.status, user.profile_photo, user.email
FROM myvidster_user user
JOIN myvidster_video video $use_index ON user.id = video.user_id
JOIN myvidster_channel channel ON channel.id = video.channel_id
JOIN myvidster_gallery gallery ON gallery.id = channel.gallery_id
LEFT JOIN myvidster_watch2 watch ON watch.master_id=video.master_id and watch.user_id = '$user_id'
WHERE
$subscription AND
video.private IN (0$enable_porn)
ORDER BY video.posted DESC LIMIT $from,$num_page";
}
else {
$query = "SELECT video.master_id, user.disp_name, video.id, video.posted, video.thumbnail, video.title,
video.channel_id, video.user_id, channel.gallery_id,
gallery.url_name, gallery.name as gallery_name, channel.name as channel_name,
video.private, '0' as status, user.profile_photo, user.email
FROM myvidster_user user
JOIN myvidster_video video $use_index ON user.id = video.user_id
JOIN myvidster_channel channel ON channel.id = video.channel_id
JOIN myvidster_gallery gallery ON gallery.id = channel.gallery_id
WHERE
$subscription AND
video.private IN (0$enable_porn)
ORDER BY video.posted DESC LIMIT $from,$num_page";
}
}
else {
if ($glb_locale=="es_ES")
$header_txt = _("Subscriptions")." de $ss_disp_name ("._("most recent").")";
else
$header_txt = "$ss_disp_name "._("subscriptions")." ("._("most recent").")";
if($user_id) {
$query = "SELECT video.master_id, user.disp_name, video.id, video.posted, video.thumbnail, video.title,
video.channel_id, video.user_id, channel.gallery_id,
gallery.url_name, gallery.name as gallery_name, channel.name as channel_name,
video.private, watch.status, user.profile_photo, user.email
FROM myvidster_recent_ss recent_ss
JOIN myvidster_video video ON recent_ss.video_id = video.id
JOIN myvidster_subscription ss ON ss.id = recent_ss.ss_id
JOIN myvidster_channel channel ON channel.id = video.channel_id
JOIN myvidster_gallery gallery ON gallery.id = channel.gallery_id
JOIN myvidster_user user ON user.id = video.user_id
LEFT JOIN myvidster_watch2 watch ON watch.master_id=video.master_id and watch.user_id = '$user_id'
WHERE
recent_ss.user_id = '$ss_user_id' and
ss.status = 1 and
video.private IN (0$enable_porn)
ORDER BY recent_ss.posted DESC LIMIT $from,$num_page";
}
else {
$query = "SELECT video.master_id, user.disp_name, video.id, video.posted, video.thumbnail, video.title,
video.channel_id, video.user_id, channel.gallery_id,
gallery.url_name, gallery.name as gallery_name, channel.name as channel_name,
video.private, '0' as status, user.profile_photo, user.email
FROM myvidster_recent_ss recent_ss
JOIN myvidster_video video ON recent_ss.video_id = video.id
JOIN myvidster_subscription ss ON ss.id = recent_ss.ss_id
JOIN myvidster_channel channel ON channel.id = video.channel_id
JOIN myvidster_gallery gallery ON gallery.id = channel.gallery_id
JOIN myvidster_user user ON user.id = video.user_id
WHERE
recent_ss.user_id = '$ss_user_id' and
ss.status = 1 and
video.private IN (0$enable_porn)
ORDER BY recent_ss.posted DESC LIMIT $from,$num_page";
}
}
//echo $query; exit;
$vid_results = mysql_query($query,$mysql_link_slave2);
$ss_video_cnt=mysql_num_rows($vid_results);
$pagination = '';
if($prepage > 0) $pagination .= ' | ';
else $pagination .= ' | ';
$pagination .= ' | ';
if($ss_video_cnt > 14) $pagination .= ' | ';
else $pagination .= ' | ';
$pagination .= '
';
$video_results = '
![](//cdn2.myvidster.com/images/spacer.gif) |
![](//cdn2.myvidster.com/images/spacer.gif) |
';
while ($row = mysql_fetch_array($vid_results)) {
$user = $row['disp_name']; // Display name of video's owner
$profile_url="$user";
$gallery_id = $row['gallery_id']; // Gallery ID
$gallery_url = $row['url_name']; // Gallery URL name
$gallery_dir = empty($gallery_url) ? "collection/".$gallery_id : $gallery_url; // Gallery directory
$gallery_name = $row['gallery_name']; // Gallery name
$channel = $row['channel_id']; // Channel ID
$channel_name = $row['channel_name']; // Channel name
$channel_name_url = safe_url($channel_name);
$id = $row['id']; // Video ID
$thumb = $row['thumbnail']; // Video thumbnail URL
$thumb = tmb_loader($thumb);
$title = $row['title']; // Video title
$posted = $row['posted']; // Video post date
$posted_formatted = calcDateDifference(time(), $posted); // Formated post date
$private = $row['private']; // Video access
$master_id = $row['master_id'];
if($row['status']==1) $watched="[Watched] ";
elseif($row['status']==2) $watched="[In Queue] ";
else $watched="";
if($private==2 && $adult_filter==1) {
$thumb="/images/adult.jpg";
}
//$video_name_url = sanitize_paranoid_string(html_entity_decode(str_replace(" ","_",$title),ENT_QUOTES));
$video_name_url = safe_url($title);
$profile_photo = $row['profile_photo'];
$email = $row['email'];
if(!$profile_photo) $profile_photo = get_gravatar($email,40,'monsterid','pg',false,1);
$profile_url=""._("Posted")." $posted_formatted "._("by").":
$user ";
$video_results .= '
|
![](//cdn2.myvidster.com/images/spacer.gif) |
';
//promoted beta
if($cnt==0 && $page==1) {
if($glb_sex_pref==2) {
$video_results .= display_promoted('gay');
}
elseif($glb_sex_pref==1){
$video_results .= display_promoted('straight');
}
}
$cnt++;
unset($user, $gallery_id, $gallery_url, $gallery_dir, $gallery_name, $channel,$channel_name, $id, $thumb, $title, $posted, $posted_formatted, $watched);
}
$glb_last_vid_access = $private;
$myVidsterAD=get_myVidsterAD();
$video_results .= ''.$pagination.' |
![](//cdn2.myvidster.com/images/spacer.gif) |
';
}
?>
MyVidster - Subcriptions for