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

<?php if($_GET['limitdata']!='')
 { $limitdata = $_GET['limitdata']+2;}
if(!isset($limitdata)){$limitdata = 2;}

function ago($time)
{
   $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
   $lengths = array("60","60","24","7","4.35","12","10");

       $now = time();
       $difference    = $now - $time;
       $tense         = "ago";

      for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
         $difference /= $lengths[$j]; }

      $difference = round($difference);
       if($difference != 1) { $periods[$j].= "s"; }
	   
	   
        return "$difference $periods[$j]".' ago'; }
		
if($userfollowids == '') { $userfollowids = 1; }
if($userfrndsids !=''){
$userfrndsids.= ",".$nuserid;}
else {$userfrndsids.= $nuserid;}
//print_r($userfrndsids);
$query = mysql_query("SELECT U.*,S.user_fullname,K.user_fullname AS wallowner_name,S.user_img,(select liked_status from  socialpostvslikes where socialpostid = U.postid  and likeruserid = '".$_SESSION['userid']."'  ) as poststatus FROM `social_userpost` as U left join social_userbasicinfo as S on U.posteruserid= S.user_id LEFT JOIN social_userbasicinfo AS K ON U.wallownerid = K.user_id where (`wallownerid` = '".$nuserid." ' ) || ( `wallownerid` in($userfrndsids) AND (`posteruserid` in($userfrndsids))) || ( `fallowerid` in ($userfollowids) ) order by `postid` desc limit 0, $limitdata  ");

/*print_r("SELECT U.*,S.user_fullname,S.user_img FROM `social_userpost` as U left join social_userbasicinfo as S on U.posteruserid= S.user_id where (`wallownerid` = '".$nuserid." ' ) || ( `wallownerid` in($userfrndsids) AND (`posteruserid` in($userfrndsids))) || ( `fallowerid` in ($userfollowids) ) order by `postid` desc limit 0, $limitdata  ");die;
*/ ?>
 <ul class="post-list">
 <?php
while($cdata=@mysql_fetch_array($query,MYSQL_ASSOC))
 { 
   
   if($cdata['posteruserid']=='0'){  
   $com_id = $cdata['fallowerid']; 
   $rowdata  = mysql_fetch_array(mysql_query("select name,servicetype,sprofileimg from spayogagym where id = '".$com_id."'")); 	
   $link =   trim('../gyms-spa-service-delhi-gurgaon.php'.'?id='.$com_id.'&profile=all&type='.base64_encode($rowdata['servicetype'])); // PROFILE LINKS 
   $name =   $rowdata['name']; //     NAME OF SERVICE PROVIDER
   $dimg =   $rowdata['sprofileimg'];
   if($dimg==''){ $dimg= 'default_profile.jpeg'; } else { $dimg=$dimg; }  
   $imag = '../admin/ProfileImage/Thumb/'.$dimg; // IMAGE OF SERVICE PROVIDER
   }else {
   $com_id=$cdata['posteruserid'];
   $link =   trim($base_url.'dashboard.php'.'?f='.$cdata['user_fullname'].'&m='.base64_encode($com_id.$cdata['user_fullname']));  // PROFILE LINKS
   $name =   $cdata['user_fullname'];   // NAME OF FRIENDS
   $imag =   'ProfileThumb/Thumb/'.$cdata['user_img'];  // FRIENDS IMAGE
  }
  $wallmsg = '';
  if($cdata['posteruserid']!='' && $cdata['wallownerid']!='' && $cdata['comments_type']==''){
  if($cdata['posteruserid']==$cdata['wallownerid']){ $wallmsg = " wrote on his own board"; }
  else { $wallmsg = " wrote on ".$cdata['wallowner_name']."'s board"; } }
  
   if($cdata['posteruserid']!='' && $cdata['wallownerid']!='' && $cdata['comments_type']=='FrndshipUpdate'){
   $name = '';
   $wallmsg  = 'Friendship Accepted';
   $imag = '../admin/ProfileImage/Thumb/my_friends_icon.jpg'; // IMAGE OF SERVICE PROVIDER
  }
  if($cdata['posteruserid']!='' && $cdata['wallownerid']!='' && $cdata['comments_type']=='ChallengeAcceptUpdate'){
   $name = '';
   $wallmsg  = 'Challenge Accepted';
   $imag = '../admin/ProfileImage/Thumb/challenge_icon.jpg'; // IMAGE OF SERVICE PROVIDER
  }
   $comment     = $cdata['comments'];
   $stripcomment = strip_tags($comment); //ASHISH
   $numoflikes  = $cdata['likes'];
   $commenttime = $cdata['date'];
   $postid      = $cdata['postid'];
   $likestatus  = $cdata['poststatus'];
   
   $post_url =  'dashboard.php?post_id='.$postid;// ASHISH
   
   if($likestatus==1){$classofthumb = 'icon-thumbs-down';}
   elseif($likestatus==2){$classofthumb = 'icon-thumbs-up';}
   else { $classofthumb = 'icon-thumbs-up'; }

   $mtime       = ago($commenttime);
?>
   <li class="post">
                  <div class="poster"><a href="<?=$link ?>" style="text-decoration:none;"><img class="frnd" src="<?=$imag?>" /></a></div>
                                <div class="post-info">
                             <div class="poster-name"><a href="<?=$link?>" style="text-decoration:none;"><?=$name?></a><?=$wallmsg?></div>
                                    <div class="post-details">
                                        <div class="post-txt bg-blue"><?=str_replace('\n','<br/>',$comment)?></div>
                                        <div class="thumbs-up">
                                        <a href="javascript:void(0)" title="THUMBS UP"  onclick="postslikefunc(<?=$postid?>,<?=$_SESSION['userid']?>);return false;"><i class="<?=$classofthumb ?>"></i></a> 
                                        <span id="postlikeloadmore_<?=$postid?>" style="display:none;"><img src="images/loader.gif" height="10" width="10"></span>                             
										
                                        <span class="like-numbr"><a href="#pplWhoLiked" onclick="likelistdata(<?=$postid?>,<?=$_SESSION['userid']?>);" role="button" data-toggle="modal" class="like-numbr">{<?=$numoflikes?> likes}
                                        <input type="hidden" name="likescount" value="<?=$numoflikes?>" />
                                        </span></a></div>
                                        <div class="date-time"><?=$mtime?></div>
                                        <div class="share-icons pull-right">
										<!--<a href="#" class="commentopen" id="<?//=$postid?>" title="Comment">Comment </a>-->
	<a href="javascript:void(0)" title="Share on Facebook" onclick="javascript:postToFeed('<?=$name?>','<?=$stripcomment?>','<?=$post_url?>');return false;"><i class="icon icon-facebook-sign"></i></a> 
                                       &nbsp; <a href="#" title="Share on Twitter"><i class="icon icon-twitter-sign"></i></a> &nbsp; <a href="#" title="Share on Google Plus"><i class="icon icon-google-plus-sign"></i></a>
                                        </div>
                                        <div class="clear"></div>
                                      <ul class="comment-wrap">
                                      <span  class="commentcontainer" id="commentload<?=$postid;?>"></span>
                                        <?php include('load_comments.php');?>
				 </div>
                   </div>
                   <div class="clear"></div>
                   <div class="clear" align="center"></div>
                   </li>  
		<?php } ?>
 </ul>

,