<?php
include("lang.php");
if(isset($_SESSION["uid"]))
{
	$setLogged=mysql_query("UPDATE users SET last_login='".time()."'WHERE uid='".$_SESSION["uid"]."'") or die(mysql_error());
}
$home=1;
if(!isset($lastid) || $lastid == '') {
	$lastid=0;
	// Show next sent official image
 }
$r=0;
$k=0;
$z=0;
$ads = 0;
//The following user updates
$updatesarray=$Mat->Friends_Updates($uid,$lastid);
//The total share of following user
$total=$Mat->Total_Friends_Updates($uid);
$reklam_goster=$Mat->Explore();
$adv= $Mat->Advertisments();
$show_explore = false; 
$show_ads = false;
if($updatesarray){
   foreach($updatesarray as $data) {
    //If updates valid database columns
    include("html_posts.php");
	include("suggestion.php");
	include("advertisement.php");
	$r = $r + 1;
	$show_explore = true;
	$show_ads = true;
    }
	if($total>$perpage) {
	  //If total share of following user greater then perpage then show the more button
?>
 <!-- More Button here $msg_id values is a last message id value. -->
<?php 
$link=$index_url;
$class='';
if($login){
   $link='#';
   $class='morep';	
 } 
?>
<div id="more<?php echo $msg_id; ?>" class="morebox">
 <a href="<?php echo $link; ?>" class="<?php echo $class; ?> ee" id="<?php echo $msg_id; ?>" rel=''><?php echo $strings['show_more_post'];?></a>
</div>
<?php
}
}else if($home){
         echo'<div class="wellcomenewsfeed">
		 <div class="wellcometext">Well come to your NewsFeed!</div>
         <div class="wellcomeinfo welltext">When you follow some people, their latest posts will show up here!</div>
		 <div class="wellcomeinfo">Start with a new post <a id="post01" href="#animatedModal"><img src="'.$base_url.'mat_icons/wellcomepost.png" width="35px" height="35px"></a></div>
		 <div class="wellcomeinfo">OR</div>
		 <div class="wellcomeinfo">Search and follow user.<a id="demo02" href="#modal-02"><img src="'.$base_url.'mat_icons/wellcomesearch.png" width="35px" height="35px"/></a></div>
		 </div>';
       }else{
	       echo'<div class="wellcomenewsfeed"><div class="wellcomeinfo">No post will be shown here!</div></div>';
	   }
?>
