Current Path : /var/www/html/social/
Upload File :
Current File : /var/www/html/social/segmentdata_ajax.php

<?php session_start(); error_reporting(0);
require "__dashboardconfig/class.function.php";
dashboard::establishConnection();
define('baseurl','http://www.365hops.com/');
     require "__dashboardconfig/class_social.php";
 	 $obj1=new Social();
// Delete Event
if(isset($_REQUEST['delete_event']) and $_REQUEST['id']!='')
 {
	  $id=$_REQUEST['id'];
	  $userid=$_SESSION['userid'];
	  $qq=mysql_query("DELETE FROM `hk_event` WHERE `id`='".$id."' AND `userid`='".$userid."'");
	   if($qq){
	   mysql_query("DELETE FROM `hk_event_enquiry` WHERE `eventid`='".$id."'");
	   mysql_query("DELETE FROM `hk_event_gallery` WHERE `event_id`='".$id."'");
	   }
	 echo 1;
	}	
// Report Event 
if(isset($_REQUEST['report_event']) and $_REQUEST['id']!='')
 {
	  $id=$_REQUEST['id'];
	  $userid=$_SESSION['userid'];
	  $type='Event'; //Event, Plan, PlacetoStay,placetoVisit  
	  $status=Social::reportAbuse2($userid,$id,$type);
	echo $status;
	}
	// Wrong Location Event
if(isset($_REQUEST['wrong_event']) and $_REQUEST['id']!='')
 {
	  $id=$_REQUEST['id'];
	  $userid=$_SESSION['userid'];
	  $type='Event';//Event, Plan, PlacetoStay,placetoVisit  etc
      $status=Social::wrongLocationTag2($userid,$id,$type);
     echo $status;
 }	//
 // Delete Place visit
if(isset($_REQUEST['delete_place']) and $_REQUEST['id']!='')
 {
	  $id=$_REQUEST['id'];
	  $userid=$_SESSION['userid'];
	  $qq=mysql_query("DELETE FROM `hk_placetovisit` WHERE `id`='".$id."' AND `userid`='".$userid."'");
	   if($qq){
	   mysql_query("DELETE FROM `hk_placevisit_beenthere` WHERE `placeid`='".$id."'");
	   mysql_query("DELETE FROM `hk_placetovisit_vs_image` WHERE `placeid`='".$id."'");
	   }
	 echo 1;
	}	
// Report Place visit 
if(isset($_REQUEST['report_place']) and $_REQUEST['id']!='')
 {
	  $id=$_REQUEST['id'];
	  $userid=$_SESSION['userid'];
	  $type='placetoVisit'; //Event, Plan, PlacetoStay,placetoVisit  
	  $status=Social::reportAbuse2($userid,$id,$type);
	echo $status;
	}
	// Wrong Location Place visit
if(isset($_REQUEST['wrong_place']) and $_REQUEST['id']!='')
 {
	  $id=$_REQUEST['id'];
	  $userid=$_SESSION['userid'];
	  $type='placetoVisit';//Event, Plan, PlacetoStay,placetoVisit  etc
      $status=Social::wrongLocationTag2($userid,$id,$type);
     echo $status;
 }	 
// Delete Plan Stickers//
if(isset($_REQUEST['delete_plan']) and $_REQUEST['id']!='')
 {
	  $id=$_REQUEST['id'];
	  $userid=$_SESSION['userid'];
	  $qq=mysql_query("DELETE FROM `hk_broadcast` WHERE `id`='".$id."' AND `userid`='".$userid."'");
	   if($qq){
	  mysql_query("DELETE FROM `hk_broadcost_vs_interest` WHERE `id`='".$id."'");
	   }
	 echo 1;
	}	
// Report Plan 
if(isset($_REQUEST['report_plan']) and $_REQUEST['id']!='')
 {
	  $id=$_REQUEST['id'];
	  $userid=$_SESSION['userid'];
	  $type='Plan'; //Event, Plan, PlacetoStay,placetoVisit  
	  $status=Social::reportAbuse2($userid,$id,$type);
	echo $status;
	}
if(isset($_REQUEST['wrong_plan']) and $_REQUEST['id']!='')
 {
	  $id=$_REQUEST['id'];
	  $userid=$_SESSION['userid'];
	  $type='Plan';//Event, Plan, PlacetoStay,placetoVisit  etc
      $status=Social::wrongLocationTag2($userid,$id,$type);
     echo $status;
 }
if(isset($_REQUEST['getsegment_posts']))
   {
	if(isset($_REQUEST['rpid'])){
	$rpid=base64_decode($_REQUEST['rpid']);
    }else{$rpid='';} 
	 if($nuserid!=$_SESSION['userid']){
	               $userfrndsids=0;
	              }
				 else{  $userfrndsids = dashboard::getfollowingsid($nuserid);  
	                  $userfrndsids.=  !empty($userfrndsids)?",".$nuserid:$nuserid;
					  }
				//		  
$postTable      = 'hk_destination_post';
$postLikeTable  = 'hk_destination_post_vs_like';
$replyTable     ='hk_destination_reply';
$replyLikeTable = 'hk_destination_reply_vs_like';//'socialreplyvslikes';
$catid          = '';//$_REQUEST['segmentid'];
$nuserid        = $_REQUEST['segmentid'];
$userfrndsids   =0;
$userfollowids  =10;
//$limitdata      = $_REQUEST['limitdata'];
$limitdata1      = '';
$limitdata2      = '';
$limitdata3      = ''; 
$limitdata=20;
$pids='';					  
/*if($nuserid==0){$nuserid=11;}*/
$lon='';
$lat='';
if($_REQUEST['location']!=''){
if($_REQUEST['latitude']!=''){
$lat=$_REQUEST['latitude'];
}
if($_REQUEST['longitude']!=''){
$lon=$_REQUEST['longitude'];
} }

$wallsocialdata = dashboard:: getwallhtml($nuserid,$userfrndsids,$userfollowids,$limitdata,$postTable,$postLikeTable,$replyTable,$replyLikeTable,$_SESSION['userid'],$_SESSION['userimg'],$catid,'','dashborduserpost',$rpid,$lat,$lon);
echo $wallsocialdata; 
	}
if(isset($_REQUEST['Add_boardcost']))
{
	$location=$_REQUEST['location'];
	$latitude=$_REQUEST['latitude'];
	$longitude=$_REQUEST['longitude'];
	$boraod_place1=$_REQUEST['boraod_place1'];
	$boraod_place2=$_REQUEST['boraod_place2'];
	$boraod_place3=$_REQUEST['boraod_place3'];
	$boraod_placefull=$_REQUEST['boraod_placefull'];
    $broadcast_from=date('Y-m-d',strtotime($_REQUEST['broadcast_from']));
	$broadcast_to=date('Y-m-d',strtotime($_REQUEST['broadcast_to']));
	$userid=$_SESSION['userid'];
	$broadcast_segment=$_REQUEST['broadcast_segment'];
	$broad_imgval=$_REQUEST['broad_imgval'];
	if($_REQUEST['broadcast_message']!=''){
	  $broadcast_message=mysql_real_escape_string($_REQUEST['broadcast_message']);
	 }else{$broadcast_message='';}
	//
	 // Posted From location lat & Lon for later use
	  require_once("php-detect-country/ip.codehelper.io.php");
      require_once("php-detect-country/php_fast_cache.php");
     $_ip = new ip_codehelper();

// Detect Real IP Address & Location
$real_client_ip_address =$_ip->getRealIP(); //'201.90.234.57'; // 
$visitor_location= $_ip->getLocation($real_client_ip_address);

$latitude_creat=$visitor_location['CityLatitude'];
$longitude_creat=$visitor_location['CityLongitude'];
$CityName_creat=$visitor_location['CityName'];	  
if($latitude_creat=='Unknown'){
	$latitude_creat='';
}
if($longitude_creat=='Unknown'){
	$longitude_creat='';
}
if($CityName_creat=='Unknown'){
	$CityName_creat='';
}

if($_REQUEST['braodcstid']==0){
	//
	
	$sql_insert="INSERT INTO `hk_broadcast` SET `userid`='".$userid."',`segmentid`='".$broadcast_segment."', `message`='".$broadcast_message."',image='".$broad_imgval."', 
	`date_from`='".$broadcast_from."',`date_to`='".$broadcast_to."',`creation_date`=NOW(), `where`='".$location."', `fulladress_name`='".$boraod_placefull."',
	 `plc_name`='".$boraod_place1."', `plc_name2`='".$boraod_place2."', `plc_name3`='".$boraod_place3."', `latitude`='".$latitude."', `longitude`='".$longitude."',latitude_creat='".$latitude_creat."',longitude_creat='".$longitude_creat."',city_creat='".$CityName_creat."', `status`='1'";
	//echo $sql_insert;
	$qq=mysql_query($sql_insert);
	$lastid=mysql_insert_id();
	//
	$message='shared a plan';
	$obj1->add_recent_activity($userid,$lastid,$lastid,$message,'Share','Plan','hk_broadcast','social/plan.php?id='.$lastid);
	// Add GPS notifications//
	$location_users=$obj1->getuserBYlatlon($latitude,$longitude,100);
	// User By Interest //
	 $interestusers=$obj1->GetUsersbyInterestids($broadcast_segment);	
	//
			 $postedby=$userid;
			 $message='shared a plan near you';
			 $wallwoner=$lastid;
			 $postid=$lastid;
			 $posttype='New Plan';
			 $ppostid=$id;
			 $ppostname='Plan';
			 $tablename='hk_broadcast';
			 $url='';
			 $parrentpostid=0;
$commonuser=array_intersect($location_users,$interestusers); // 
if(count($commonuser)>0)
   {
	$locationonly=array_diff($location_users,$commonuser);	
	$interstonly=array_diff($interestusers,$commonuser);	
	}
	else{
		$locationonly=$location_users;
		$interstonly=$interestusers;
		}
	if(count($locationonly)>0){   
	foreach($locationonly as $users)
	  {
		if($users>0)
		   {
			  $message='shared a plan near you';   
			  if($users!=$postedby){  
			  Social::adduserNotificationNew($users,$postedby,$message,$wallwoner,$postid,$posttype,$ppostid,$ppostname,$tablename,$url,$parrentpostid);
			  }
			 }
		  }
	   }
	   if(count($interstonly)>0){   
	foreach($interstonly as $users)
	  {
		if($users>0)
		   {
			  $message='shared a plan within your interest';   
			 if($users!=$postedby){  
			  Social::adduserNotificationNew($users,$postedby,$message,$wallwoner,$postid,$posttype,$ppostid,$ppostname,$tablename,$url,$parrentpostid);
			 }
			 }
		  }
	   }
	//
	  if(count($commonuser)>0){   
	foreach($commonuser as $users)
	  {
		if($users>0)
		   {
			  $message='shared a plan within your location & interest';   
			 if($users!=$postedby){  
			  Social::adduserNotificationNew($users,$postedby,$message,$wallwoner,$postid,$posttype,$ppostid,$ppostname,$tablename,$url,$parrentpostid);
			 }
			 }
		  }
	   }
	
   }
   else
    {
	 $sql_updat="UPDATE `hk_broadcast` SET `userid`='".$userid."',`segmentid`='".$broadcast_segment."', `message`='".$broadcast_message."',image='".$broad_imgval."', 
	`date_from`='".$broadcast_from."',`date_to`='".$broadcast_to."',`creation_date`=NOW(), `where`='".$location."', `fulladress_name`='".$boraod_placefull."',
	 `plc_name`='".$boraod_place1."', `plc_name2`='".$boraod_place2."', `plc_name3`='".$boraod_place3."', `latitude`='".$latitude."', `longitude`='".$longitude."',latitude_creat='".$latitude_creat."',longitude_creat='".$longitude_creat."',city_creat='".$CityName_creat."', `status`='1' WHERE id='".$_REQUEST['braodcstid']."'";
	//echo $sql_insert;
	$qq2=mysql_query($sql_updat);
	$lastid=$_REQUEST['braodcstid'];  
	   }
	$str='';
	if($lastid>0){
	 $broadcast_message=mysql_fetch_array(mysql_query("SELECT hk_broadcast.*,social_userbasicinfo.user_fullname,social_userbasicinfo.user_img from hk_broadcast left join social_userbasicinfo  on social_userbasicinfo.user_id=hk_broadcast.userid WHERE id='".$lastid."'"),MYSQL_ASSOC);
	   if($broadcast_message['image']=='')
			  {
			  $inteterest_details32=$obj1->get_interest_by_id($broadcast_message['segmentid']);
                
				
				 $img_broadss='../admin/segment_pics/'.$inteterest_details32['path'];
				  }else{  $img_broadss='broadcast_images/'.$broadcast_message['image'];}	
	  $when=''; if(strtotime($broadcast_message['date_from'])>0){ $when.=date('d-m-Y',strtotime($broadcast_message['date_from'])); }
				if(strtotime($broadcast_message['date_to'])>0){   $when.=' to '.date('d-m-Y',strtotime($broadcast_message['date_to'])); }
				
	 $str='<li id="broadmsgli_'.$broadcast_message['id'].'">
            <img src="'.$img_broadss.'" alt="" style="height:140px !important">
        	<p>“'.$broadcast_message['message'].'”</p>
            <div class="player-detailss">
            	<p><b>When :</b>'.$when.'</p>
                <p class="oneline"><b>Where :</b>'.$broadcast_message['where'].'</p>
                <div class="name-details">
                	<h3 style="text-align:left">'.ucwords($broadcast_message['user_fullname']).'</h3>
                    <img src="ProfileThumb/Thumb/'.$broadcast_message['user_img'].'" style="width:50px !important; height:50px !important; border-radius:28px; margin-top:-25px !important" alt="">
                    <i style="text-align:left">'.date('jS M, Y',strtotime($broadcast_message['creation_date'])).', '.$broadcast_message['city_creat'].'</i>
                </div>
             </div>
            </li>';
	}
echo $str.'#RAJ#'.$lastid;	
}
if(isset($_REQUEST['delet_broadcast']) and $_REQUEST['broadcastid']!='')
  {
   mysql_query("DELETE FROM `hk_broadcast` WHERE `id`='".$_REQUEST['broadcastid']."' AND `userid`='".$_SESSION['userid']."'");
 }
 if(isset($_REQUEST['get_edit']) and $_REQUEST['edit_id'])
   {
	$res=mysql_fetch_array(mysql_query("SELECT `id`, `userid`, `segmentid`, `message`, `image`,DATE_FORMAT(date_from,'%m/%d/%Y') AS date_from1,DATE_FORMAT(date_to,'%m/%d/%Y') AS date_to2, `creation_date`, `where`, `fulladress_name`, `plc_name`, `plc_name2`, `plc_name3`, `latitude`, `longitude`, `latitude_creat`, `longitude_creat`, `city_creat`, `status` from hk_broadcast where id='".$_REQUEST['edit_id']."'"),MYSQL_ASSOC); 
	 $str=implode('#RAJ#',$res);
	 echo $str;
	 }
	 // Add Placess/
	 if(isset($_REQUEST['AddPlaces']))
	 {// print_r($_REQUEST);
	$fulladress_name=$_REQUEST['fulladress_name'];
    $plc_name=$_REQUEST['plc_name'];
    $plc_name2=$_REQUEST['plc_name2'];
    $plc_name3=$_REQUEST['plc_name3'];
    $lectitude=$_REQUEST['lectitude'];
    $longitude=$_REQUEST['longitude'];
     $name=$_REQUEST['name'];
    $broadcast_where=$_REQUEST['broadcast_where'];
    $thingstodo=$_REQUEST['thingstodo'];
    $howtoreach=$_REQUEST['howtoreach'];
	if($thingstodo!=''){
	  $thingstodo=mysql_real_escape_string($thingstodo);
	 }
	if($howtoreach!=''){
	  $howtoreach=mysql_real_escape_string($howtoreach);
	 }
    $userid=$_SESSION['userid'];
	$numimages=count($_REQUEST['broad_image']); 
	
	 // Posted From location lat & Lon for later use
	  require_once("php-detect-country/ip.codehelper.io.php");
      require_once("php-detect-country/php_fast_cache.php");
    // $_ip = new ip_codehelper();
//
// Detect Real IP Address & Location
//$real_client_ip_address =$_ip->getRealIP(); //'201.90.234.57'; // 
//$visitor_location= $_ip->getLocation($real_client_ip_address);

$latitude_creat=$visitor_location['CityLatitude'];
$longitude_creat=$visitor_location['CityLongitude'];
$CityName_creat=$visitor_location['CityName'];	  
if($latitude_creat=='Unknown'){
	$latitude_creat='';
}
if($longitude_creat=='Unknown'){
	$longitude_creat='';
}
if($CityName_creat=='Unknown'){
	$CityName_creat='';
}

    $broadcast_segment=$_REQUEST['broadcast_segment'];
	if($_REQUEST['edit_broadcastid_hid']==0){ 
	$sql_insert="INSERT INTO `hk_placetovisit` SET `userid`='".$userid."',name='".$name."',
	interest_id='".$broadcast_segment."',
	`location`='".$broadcast_where."', `placefull`='".$fulladress_name."',
	 `place1`='".$plc_name."', `place2`='".$plc_name2."', `place3`='".$plc_name3."', `latitude`='".$lectitude."', `longitude`='".$longitude."', todo='".$thingstodo."',
	 howtoreach='".$howtoreach."',creat_date=NOW(),
	 creat_lat='".$latitude_creat."',creat_lon='".$longitude_creat."',creat_city='".$CityName_creat."'";
	//echo $sql_insert; die('1');
	$qq=mysql_query($sql_insert);
	$lastid=mysql_insert_id();
		//
	$message='shared a place';
	$obj1->add_recent_activity($userid,$lastid,$lastid,$message,'Share','Place','hk_placetovisit','social/placetovisit_detail.php?id='.$lastid);
	// Add GPS notifications//
	 //
	 //Add notificationss//
	 // Add GPS notifications//
	$location_users=$obj1->getuserBYlatlon($lectitude,$longitude,100);
	// User By Interest //
	 $interestusers=$obj1->GetUsersbyInterestids($broadcast_segment);	
	//
			 $postedby=$userid;
			 $message='shared a place near you';
			 $wallwoner=$lastid;
			 $postid=$lastid;
			 $posttype='New Place';
			 $ppostid=$lastid;
			 $ppostname='Place';
			 $tablename='hk_placetovisit';
			 $url='';
			 $parrentpostid=0;
$commonuser=array_intersect($location_users,$interestusers); // 
if(count($commonuser)>0)
   {
	$locationonly=array_diff($location_users,$commonuser);	
	$interstonly=array_diff($interestusers,$commonuser);	
	}
	else{
		$locationonly=$location_users;
		$interstonly=$interestusers;
		}
	if(count($locationonly)>0){   
	foreach($locationonly as $users)
	  {
		if($users>0)
		   {
			  $message='shared a place near you'; 
			  if($users!=$postedby){  
			  Social::adduserNotificationNew($users,$postedby,$message,$wallwoner,$postid,$posttype,$ppostid,$ppostname,$tablename,$url,$parrentpostid);
			  }
			 }
		  }
	   }
	   if(count($interstonly)>0){   
	foreach($interstonly as $users)
	  {
		if($users>0)
		   {
			  $message='shared a place within your interest';   
			  if($users!=$postedby){  
			  Social::adduserNotificationNew($users,$postedby,$message,$wallwoner,$postid,$posttype,$ppostid,$ppostname,$tablename,$url,$parrentpostid);
			  }
			 }
		  }
	   }
	//
	  if(count($commonuser)>0){   
	foreach($commonuser as $users)
	  {
		if($users>0)
		   {
			  $message='shared a place within your location & interest';   
			  if($users!=$postedby){  
			  Social::adduserNotificationNew($users,$postedby,$message,$wallwoner,$postid,$posttype,$ppostid,$ppostname,$tablename,$url,$parrentpostid);
			  }
			 }
		  }
	   }

	 //
	 
	 }
	else{ 
		$sql_insert="UPDATE `hk_placetovisit` SET name='".$name."',
	interest_id='".$broadcast_segment."',
	`location`='".$broadcast_where."', `placefull`='".$fulladress_name."',
	 `place1`='".$plc_name."', `place2`='".$plc_name2."', `place3`='".$plc_name3."', `latitude`='".$lectitude."', `longitude`='".$longitude."', todo='".$thingstodo."',
	 howtoreach='".$howtoreach."',
	 creat_lat='".$latitude_creat."',creat_lon='".$longitude_creat."',creat_city='".$CityName_creat."' WHERE id='".$_REQUEST['edit_broadcastid_hid']."'";
	//echo $sql_update; die('2');
	$qq=mysql_query($sql_insert);
	$lastid=$_REQUEST['edit_broadcastid_hid'];
	mysql_query("delete  from hk_placetovisit_vs_image where placeid='".$lastid."'");	
		}
	if($numimages>0){
		for($i=0;$i<$numimages;$i++){
			 $imgpath=$_REQUEST['broad_image'][$i];
			 if($imgpath!=''){
				 mysql_query("INSERT INTO  hk_placetovisit_vs_image SET placeid='".$lastid."',path='".$imgpath."'");
				 }
			}
		}
	
	//	
  echo $lastid;
   }
   // Get Boad cost or Plan Details//
  if(isset($_REQUEST['getplandetail']) and $_REQUEST['id']!=''){
    $results=array(); 
	$id=$_REQUEST['id'];
	$userid=$_SESSION['userid'];
	$braodcost_sql=mysql_query("SELECT hk_broadcast.`id`,hk_broadcast.`message` as title, hk_broadcast.`image`, hk_broadcast.`date_from`, hk_broadcast.`date_to`, hk_broadcast.`creation_date` as date, hk_broadcast.`where` as where_area, hk_broadcast.`latitude_creat`, hk_broadcast.`longitude_creat`, hk_broadcast.`city_creat`, social_userbasicinfo.user_id, social_userbasicinfo.user_fullname,social_userbasicinfo.user_img from hk_broadcast left join social_userbasicinfo  on social_userbasicinfo.user_id=hk_broadcast.userid WHERE hk_broadcast.`id`='".$id."'");
	 $res=mysql_fetch_array($braodcost_sql,MYSQL_ASSOC);
            $distances=0;
		   $res['distance']=$distances; 
		   $res['comments']=Social::broadcost_numberofcomments2($res['id']);
		   $res['intrests']=Social::broadcost_interested_peoples_number($res['id']);
		   		   
		    if($userid!=''){
		      $res['comments_status']=Social::broadcast_comment_status2($res['id'],$userid);
		      }else{ $res['comments_status']=0; }
		   if($userid!=0){ 
		    $res['intrest_status']=Social::user_broadcost_interested_status2($res['id'],$userid);
		  }else{  $res['intrest_status']=0;}
		    $res['ago']=Social::ago2(strtotime($res['date']));
		   $res['sfd']='Plan';
		 // Comments
 $comments=Social::getevent_comments2('Plan',$res['id'],'');
   // print_r($res);
    $when='';
	$when.=date('jS M, y',strtotime($res['date_from'])).' to '.date('jS M, y',strtotime($res['date_to'])); 
	if($res['city_creat']==''){$res['city_creat']='-';}
	if($res['image']=='')
			  {
			 $inteterest_details32=$obj1->get_interest_by_id($res['segmentid']);
		  	 if($inteterest_details32['path']!=''){
			       $img_broadss='admin/segment_pics/'.$inteterest_details32['path'];
			    }
				else{$img_broadss='images/tile-imag.jpg';}  
				  }else{  $img_broadss='social/broadcast_images/'.$res['image'];
				}
	if($res['intrest_status']==0){
		$str_intersted='<a href="javascript:void(0);" id="interestp" onClick="return showinterestplan('.$res['id'].');" >Show Interest</a>
		                <a href="javascript:void(0);" id="uninterestp" style="display:none;" onClick="return showuninterestplan('.$res['id'].');" >Interested</a>';
		}else{
		$str_intersted='<a href="javascript:void(0);" id="interestp" style="display:none;" onClick="return showinterestplan('.$res['id'].');" >Show Interest</a>
		                <a href="javascript:void(0);" id="uninterestp"  onClick="return showuninterestplan('.$res['id'].');" >Interested</a>';
		
		}		
		$str_buttons='';
	if($res['user_id']==$_SESSION['userid']){	
	$edit_url=baseurl."social/new_plan.php?id=".base64_encode($res['id']);
	$str_buttons='<a class="head_butt" href="'.$edit_url.'">Edit</a>
				 <a href="javascript:void(0);" class="head_butt" onClick="delete_plan('.$res['id'].');">Delete</a>';
	}else{
		$str_buttons='<a href="javascript:void(0);" class="head_butt" onClick="reportabuse_plan('.$res['id'].');">Report Abuse</a>
				 <a href="javascript:void(0);" class="head_butt" onClick="wronglocationtag_plan('.$res['id'].');">Wrong Location Tag</a>';
		}
	$str_result='<div class="left-lay">
       	   		 <img src="'.baseurl.'searching_files/timthumb.php?src='.baseurl.$img_broadss.'&h=205&w=290&zc=1" alt=""/>
                 <span>'.$res['title'].'</span>
				 '.$str_buttons.'
                 <div class="date-place">
                 	<div class="location-current">
                         <p style="margin-left:-23px"><strong>'.$res['where_area'].'</strong></p>
                    </div>
                    <div class="calen">
                      	<p style="margin-left:-19px"><strong>'.$when.'</strong></p>
                    </div>
                 </div>
            </div>
            <div class="right-lay">
            	<ul>
                	<li>
                    	<div class="name-sec">
                            	<img src="'.baseurl.'searching_files/timthumb.php?src='.baseurl.'social/ProfileThumb/Thumb/'.$res['user_img'].'&h=29&w=32&zc=1" alt="">
                            <p><strong>'.$res['user_fullname'].'</strong></p>
                           <p>'.$res['ago'].'</p>
                          </div>
                            <div class="name-sec">
                            	<img alt="" src="'.baseurl.'images/broad-cast.jpg">
                                <p>Broadcasted</p>
                                <p><strong>'.$res['city_creat'].'</strong></p>
                            </div>
                    </li>
                    <li>
                    	<div class="interest">
                            	<p><strong id="numinterstsp">'.$res['intrests'].'</strong></p>
                                <p>'.$str_intersted.'</p>
                            </div>
                            <div class="comment">
                            	<p><strong>'.$res['comments'].'</strong></p>
                                <p>Comments</p>
                            </div>
                    </li>
                    <li>
                    	<textarea name="broad_cmnt" style="border:1px solid; color:#333; font-size:14px; width:99%" id="broad_cmnt"></textarea>
						<a href="javascript:void(0);" onClick="sendplan_cmnt('.$res['id'].');" style="font-size:12px; margin-left:219px" >Comment</a>
						</li>';
                    $str_result.='<li>
                    	              <ul id="commentlistPlan" style="max-height:150px; overflow:auto;">';
					if($res['comments']>0){
						  foreach($comments as $cmnt){
							$str_result.='<li>
                                <img src="'.baseurl.'searching_files/timthumb.php?src='.baseurl.'social/ProfileThumb/Thumb/'.$cmnt['user_img'].'&h=29&w=32&zc=1" alt="'.$cmnt['user_fullname'].'" >
                                <p>'.$cmnt['comment'].'</p>
                                <span>'.$cmnt['date'].'</span>
                            <br/></li>';
						    }
                      
					}
					  $str_result.='</ul>
                    </li>';
               $str_result.='</ul>
                 </div>';
			  print_r($str_result);
  }
  // Get plan details social//
  if(isset($_REQUEST['getplandetail2']) and $_REQUEST['id']!=''){
    $results=array(); 
	$id=$_REQUEST['id'];
	$userid=$_SESSION['userid'];
	$braodcost_sql=mysql_query("SELECT hk_broadcast.`id`,hk_broadcast.`message` as title, hk_broadcast.`image`, hk_broadcast.`date_from`, hk_broadcast.`date_to`, hk_broadcast.`creation_date` as date, hk_broadcast.`where` as where_area, hk_broadcast.`latitude_creat`, hk_broadcast.`longitude_creat`, hk_broadcast.`city_creat`, social_userbasicinfo.user_id, social_userbasicinfo.user_fullname,social_userbasicinfo.user_img from hk_broadcast left join social_userbasicinfo  on social_userbasicinfo.user_id=hk_broadcast.userid WHERE hk_broadcast.`id`='".$id."'");
	 $res=mysql_fetch_array($braodcost_sql,MYSQL_ASSOC);
            $distances=0;
		   $res['distance']=$distances; 
		   $res['comments']=Social::broadcost_numberofcomments2($res['id']);
		   $res['intrests']=Social::broadcost_interested_peoples_number($res['id']);
		   		   
		    if($userid!=''){
		      $res['comments_status']=Social::broadcast_comment_status2($res['id'],$userid);
		      }else{ $res['comments_status']=0; }
		   if($userid!=0){ 
		    $res['intrest_status']=Social::user_broadcost_interested_status2($res['id'],$userid);
		  }else{  $res['intrest_status']=0;}
		    $res['ago']=Social::ago2(strtotime($res['date']));
		   $res['sfd']='Plan';
		 // Comments
 $comments=Social::getevent_comments2('Plan',$res['id'],'');
   // print_r($res);
    $when='';
	$when.=date('jS M, y',strtotime($res['date_from'])).' to '.date('jS M, y',strtotime($res['date_to'])); 
	if($res['city_creat']==''){$res['city_creat']='-';}
	if($res['image']=='')
			  {
			 $inteterest_details32=$obj1->get_interest_by_id($res['segmentid']);
		  	 if($inteterest_details32['path']!=''){
			       $img_broadss='admin/segment_pics/'.$inteterest_details32['path'];
			    }
				else{$img_broadss='images/tile-imag.jpg';}  
				  }else{  $img_broadss='social/broadcast_images/'.$res['image'];
				}
	if($res['intrest_status']==0){
		$str_intersted='<a href="javascript:void(0);" id="interestp" onClick="return showinterestplan('.$res['id'].');" >Show Interest</a>
		                <a href="javascript:void(0);" id="uninterestp" style="display:none;" onClick="return showuninterestplan('.$res['id'].');" >Interested</a>';
		}else{
		$str_intersted='<a href="javascript:void(0);" id="interestp" style="display:none;" onClick="return showinterestplan('.$res['id'].');" >Show Interest</a>
		                <a href="javascript:void(0);" id="uninterestp"  onClick="return showuninterestplan('.$res['id'].');" >Interested</a>';
		
		}
	$str_buttons='';
	if($res['user_id']==$_SESSION['userid']){	
	$edit_url=baseurl."social/new_plan.php?id=".base64_encode($res['id']);
	$str_buttons='<a class="head_butt" href="'.$edit_url.'">Edit</a>
				 <a href="javascript:void(0);" class="head_butt" onClick="delete_plan('.$res['id'].');">Delete</a>';
	}else{
		$str_buttons='<a href="javascript:void(0);" class="head_butt" onClick="reportabuse_plan('.$res['id'].');">Report Abuse</a>
				 <a href="javascript:void(0);" class="head_butt" onClick="wronglocationtag_plan('.$res['id'].');">Wrong Location Tag</a>';
		}
	$str_result='<div class="left-lay">
       	   		 <img src="'.baseurl.'searching_files/timthumb.php?src='.baseurl.$img_broadss.'&h=205&w=300&zc=1" alt=""/>
                 <span>'.$res['title'].'</span>'.$str_buttons.'
			     <div class="date-place">
                 	<div class="location-current">
                         <p style="margin-left:-17px;"><strong>'.$res['where_area'].'</strong></p>
                    </div>
                    <div class="calen">
                      	<p>'.$when.'</p>
                    </div>
                 </div>
            </div>
            <div class="right-lay">
            	<ul>
                	<li>
                    	<div class="name-sec">
                            	<img src="'.baseurl.'searching_files/timthumb.php?src='.baseurl.'social/ProfileThumb/Thumb/'.$res['user_img'].'&h=29&w=32&zc=1" alt="">
                            <p><strong>'.$res['user_fullname'].'</strong></p>
                           <p>'.$res['ago'].'</p>
                          </div>
                            <div class="name-sec">
                            	<img alt="" src="'.baseurl.'images/broad-cast.jpg">
                                <p>Broadcasted</p>
                                <p><strong>'.$res['city_creat'].'</strong></p>
                            </div>
                    </li>
                    <li>
                    	<div class="interest">
                            	<p><strong id="numinterstsp">'.$res['intrests'].'</strong></p>
                                <p>'.$str_intersted.'</p>
                            </div>
                            <div class="comment">
                            	<p><strong>'.$res['comments'].'</strong></p>
                                <p>Comments</p>
                            </div>
                    </li>
                    <li>
                    	<textarea name="broad_cmnt" style="border:1px solid; color:#333; font-size:14px; width:93%" id="broad_cmnt"></textarea>
						<a href="javascript:void(0);" onClick="sendplan_cmnt('.$res['id'].');" style="float:right" >Comment</a>
						</li>';
                    $str_result.='<li>
                    	              <ul id="commentlistPlan" style="max-height:150px; overflow:auto;">';
					if($res['comments']>0){
						  foreach($comments as $cmnt){
							$str_result.='<li style="width:97%">
                                <img src="'.baseurl.'searching_files/timthumb.php?src='.baseurl.'social/ProfileThumb/Thumb/'.$cmnt['user_img'].'&h=29&w=32&zc=1" alt="'.$cmnt['user_fullname'].'" >
                                <p>'.$cmnt['comment'].'</p>
                                <span>'.$cmnt['date'].'</span>
                            <br/></li>';
						    }
                      
					}
					  $str_result.='</ul>
                    </li>';
               $str_result.='</ul>
                 </div>';
			  print_r($str_result);
  }
  
 if(isset($_REQUEST['postcomment_plan']) and $_REQUEST['id']!='' and $_REQUEST['msg']!=''){  
       $status=$obj1->postevent_comments2('Plan',$_REQUEST['id'],$_SESSION['userid'],$_REQUEST['msg']);
       $str_result='';
	   if($status!=0){
	     $comments=Social::getevent_comments2('Plan',$_REQUEST['id'],'');
		
		 foreach($comments as $cmnt){
							$str_result.='<li>
                                <img src="'.baseurl.'searching_files/timthumb.php?src='.baseurl.'social/ProfileThumb/Thumb/'.$cmnt['user_img'].'&h=29&w=32&zc=1" alt="'.$cmnt['user_fullname'].'" >
                                <p>'.$cmnt['comment'].'</p>
                                <span>'.$cmnt['date'].'</span>
                            <br/></li>';
						    }
	   }
	   echo $str_result;
   }
 // Plan/Broadcost Interests//  
if(isset($_REQUEST['planshowinterest']) and $_REQUEST['id']!='')
     {
	 $id=$_REQUEST['id'];
	 $userid=$_SESSION['userid'];	 
	 $tm=time();
	  $stat=$obj1->eventShow_intrest2("Plan",$id,$userid); 
	   print_r($stat['status']);
	   }
	   
if(isset($_REQUEST['planshowuninterest']) and $_REQUEST['id']!='')
     {
	 $id=$_REQUEST['id'];
	 $userid=$_SESSION['userid'];
	 $status=Social::user_broadcost_interested_status2($id,$userid);	 
	 if($status>0){
	  mysql_query("DELETE FROM `hk_broadcost_vs_interest` WHERE `id`='".$id."' AND `user_id`='".$userid."'");
	  echo 1;
	   }else{echo 0;}
	   }
// Trip//Event show Interest//	   	   
   if(isset($_REQUEST['tripshowinterest']) and $_REQUEST['id']!='')
     {
	 $id=$_REQUEST['id'];
	 $userid=$_SESSION['userid'];	 
	 $tm=time();
	  $stat=$obj1->eventShow_intrest2("Event",$id,$userid); 
	   print_r($stat['status']);
	   }
if(isset($_REQUEST['tripshowuninterest']) and $_REQUEST['id']!='')
     {
	 $id=$_REQUEST['id'];
	 $userid=$_SESSION['userid'];
	 $status=Social::user_event_interested_status2($id,$userid);	 
	 if($status>0){
	  mysql_query("DELETE FROM `hk_event_vs_interest` WHERE `event_id`='".$id."' AND user_id='".$userid."'");
	  echo 1;
	   }else{echo 0;}
	   }
// been there//
 if(isset($_REQUEST['visitbeenthere']) and $_REQUEST['id']!='')
    { //placetoStay
      $id=$_REQUEST['id'];
	  $userid=$_SESSION['userid'];
	  $stat=$obj1->placetovisitBeenThere2('placetoVisite',$id,$userid);
	   if($stat['message']=='Verified successfully'){ echo 1;}else{ echo 0;}
	  }
	// been there//
 if(isset($_REQUEST['visitnotbeenthere']) and $_REQUEST['id']!='')
    { //placetoStay
      $id=$_REQUEST['id'];
	  $userid=$_SESSION['userid'];
	  $stat=$obj1->placetovistBeenthere_status2($id,$userid);
	   if($stat==1)
	    {
		 mysql_query("DELETE FROM  `hk_placevisit_beenthere` where `placeid`='".$id."' AND `userid`='".$userid."'");	
		   echo 1;
		   }else{ echo 0;}
	  }   	   

 if(isset($_REQUEST['postcomment_visit']) and $_REQUEST['id']!='' and $_REQUEST['msg']!=''){  
      
       $status=$obj1->postplacetoVisite_comments2('placetoVisite',$_REQUEST['id'],$_SESSION['userid'],$_REQUEST['msg']);
       $str_result='';
	   if($status!=0){
	     $comments=Social::placetoVisite_comments2('placetoVisite',$_REQUEST['id'],'');
		
		 foreach($comments as $cmnt){
							$str_result.='<li>
                                <img src="'.baseurl.'searching_files/timthumb.php?src='.baseurl.'social/ProfileThumb/Thumb/'.$cmnt['user_img'].'&h=29&w=32&zc=1" alt="'.$cmnt['user_fullname'].'" >
                                <p>'.$cmnt['comment'].'</p>
                                <span>'.$cmnt['date'].'</span>
                            <br/></li>';
						    }
	   }
	   echo $str_result;
   }
    if(isset($_REQUEST['add_travellog']) and $_REQUEST['log_name']!='')
     {
      $userid=$_SESSION['userid'];
	  $locationfull=$_REQUEST[adress_name];
      $location1=$_REQUEST[plc_name];
      $location2=$_REQUEST[plc_name2];
      $location3=$_REQUEST[plc_name3];
      $lat=$_REQUEST[lectitude];
      $lon=$_REQUEST[longitude];
      $name=$_REQUEST[log_name];
      $place=$_REQUEST[pacinput_loc];
      $month=$_REQUEST[log_month];
      $year=$_REQUEST[log_year];
      $description=$_REQUEST[log_desc];
      $images=$_REQUEST[log_img];
	  //print_r($place); die;
      $msg=$obj1->addTravelLog2($userid,$name,$place,$location1,$location2,$location3,$locationfull,$lat,$lon,$month,$year,$description,$images);
	 print($msg['success']);
	 }
?>

,