<?php
if(!isset($lastrmid) || $lastrmid == '') {
	$lastrmid=0;
	// Show next sent official image
 }
 $Updates_Details_Array=$Mat->UserUploadsPhotos($profile_uid,$lastrmid);
 $total=$Mat->TotalUserUploadsPhotos($profile_uid);
 
 if($Updates_Details_Array) {
	 
	 //If updates valid database columns
	 foreach($Updates_Details_Array as $data) {
		 $msg_id=$data['msg_id'];
		 $muid=$data['uid'];
		 $message_secret=$data['secret_option'];
		 $Check_the_privacy=$Mat->Friends_Check_for_Message($uid,$muid);	
		 if($message_secret == '0') { //if privacy posted with everyone
	         include("html_photos.php");
	       } else {
             if($message_secret == '1') { // if privacy posted with only me
	         if($Check_the_privacy == 'fri' || $Check_the_privacy == 'me') { // Check the user status
 		    include("html_photos.php"); // show the posts following user
	      } else {
		  }
		  } else {
		     if($Check_the_privacy == 'me') { 
			    include("html_photos.php");
		  }
	      }
          }
	      }
	if($total>$perpage) {
	 //If total image post greater then perpage then show the nextphotos button
?>
 <!-- More Button here $msg_id values is a last message id value. -->
<?php 
$link=$index_url;
$class='';
if($login){
    $link='#';
	// nextphotos button
    $class='nextphotos';	
 } 
?> 
<?php echo '<div id="more'.$msg_id.'" class="gorr">
              <div class="post_loader">
              <div class="bubble1"></div>
              <div class="bubble2"></div>
              <div class="bubble3"></div>
              </div>
              <a href="'.$link.'" class="'.$class.' ee" id="'.$msg_id.'" rel='.$profile_uid.'>LOAD MORE</a>
              </div>';
	  
		  
	}
?>
<?php

} else {
    echo '<div class="no-more-picture">No more pictures to be shown</div>';
}

?>
