<?php
include("lang.php");
 $loggedTime=time()-120;	//2 minutes
 $loginTime=$data['last_login'];
if($loginTime>$loggedTime) {
	$online='#1de9b6';
   } else {
	  $online='#9e9e9e';
   }
 $msg_id=$data['msg_id'];
 $orimessage=$data['message'];
 $message=htmlcode($orimessage);
 $time=$data['created'];
 $mtime=date("c", $time);
 $username=$data['username'];
 $option_pr=$data['secret_option'];
 $pr_background0='';
 $pr_background1='';
 $pr_background2='';
 $pr_text_bold0='';
 $pr_text_bold1='';
 $pr_text_bold2='';
 $pr_icon='';
   $share_uid=isset($data['share_uid']) ? $data['share_uid'] : NULL;
 $share_ouid = isset($data['share_ouid']) ? $data['share_ouid'] : NULL;
 if($option_pr == '0'){
	 $pr_background0= '#b2dfdb';
	 $pr_text_bold0='bold';
	 $pr_icon= 'icon-globe';
  }else if($option_pr == '1'){
	 $pr_background1= '#b2dfdb';
	 $pr_text_bold1='bold';
	 $pr_icon= 'icon-contacs'; 
  }else if($option_pr == '2'){
	 $pr_background2= '#b2dfdb';
	 $pr_text_bold2='bold';
	 $pr_icon= 'icon-lock-1';  
	  }
	  
 $share_count=0;
 $shareKey=0;
 if($share_uid!=$share_ouid) {
    $share_count=$data['share_count'];
    $omsg_id='s'.$msg_id;
    $shareKey=1;
  }
   $style='';
   $border='';
   if($share_ouid>0) {
      $style='margin-top:8px;';
      $border='border:solid 1px #006699';
      $datanew=$Mat->User_Details($share_ouid);
      $username=$datanew['username'];
   }
 // instead check if it is set or use null:
 $video = isset($data['video']) ? $data['video'] : NULL;
 $uploads = isset($data['uploads']) ? $data['uploads'] : NULL;
 $privacy  = isset($data['secret_option']) ? $data['secret_option'] : NULL;
 $msg_uid = isset($data['uid_fk']) ? $data['uid_fk'] : NULL;
 $like_count = isset($data['like_count']) ? $data['like_count'] : NULL;
 $omsg_id=$msg_id;	
 $like=$Mat->Like_Check($msg_id,$uid);
 if($like) {
	// If user not liked the update
	$like_status='Like'; // show the status Like
	$like_statusicon='icon-heart-empty-1'; // and show the css icon 1
  } else {
	  // else if user liked the update
	  $like_status='Unlike'; // show the status Unlike
	  $like_statusicon='icon-heart-2'; // and show the css icon 2
  }	
  /* User Avatar*/
  $face = $Mat->User_Profilepic($msg_uid,$base_url); 
  $share=$Mat->Share_Check($msg_id,$uid);
 if($share) {
	$share_status='Share';
  } else {
	$share_status='Unshare';
  }
  /* User Avatar*/
  $face = $Mat->User_Profilepic($msg_uid,$base_url); 
  if($share_count>0) {
     $shareuid=$Mat->Share_Msg($msg_id);
     if($shareuid) {	
        $datanew=$Mat->User_Details($shareuid);
        $susername=$datanew['username'];
     }
   }
  /* End Avatar */ 
  $Check_the_privacy=$Mat->Friends_Check_for_Message($uid,$msg_uid);			
?>
<?php 
//Check the message privacy
if($privacy == '0') { //if privacy posted with everyone
	include("post.php");
	} else {
    if($privacy == '1') { // if privacy posted with only me
	   if($Check_the_privacy == 'fri' || $Check_the_privacy == 'me') { // Check the user status
 		  include("post.php"); // show the posts following user
	    } else {
		}
		} else {
		    if($Check_the_privacy == 'me'){ 
			     include("post.php");
		}
	    }
 }
?>




