<?php
session_start();
if (!(isset($_SESSION['uid']) && $_SESSION['uid'] != '')){
    header ("Location: ../index.php");
    exit();
}
include_once 'includes.php';
if(isset($_SESSION["uid"]))
{
	$setLogged=mysql_query("UPDATE users SET last_login='".time()."'WHERE uid='".$_SESSION["uid"]."'") or die(mysql_error());
}
//include_once 'oauth_redirection.php';
$conversation_uid='';
if(isset($_GET['message_username'])) {
	// Check the username for message
   $conversation_usr=$_GET['message_username'];
   $conversation=$Mat->User_ID($conversation_usr);
   if($conversation) {
	   // If the user id is conversationed before
	  $conversation_uid=$conversation;
      if($conversation_uid!=$uid) {
		  // Show the messages
	     $top_c_id=$Mat->Conversation_Insert($uid,$conversation_uid);
       } else {
		   // else show the chose one to start conversation
		    $url=$base_url.'chat.php';
			header("Location:$url");
	   }	
       } else {
		   // else show the chose one to start conversation
		    $url=$base_url.'404.php';
	        header("Location:$url");
	   }	
}
if(!isset($top_c_id) || $top_c_id == '') {
    $top_c_id = isset($_GET['topcid']) ? $_GET['topcid'] : '';
}
$face=$Mat->User_Profilepic($uid,$base_url);
include_once 'lang.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<title><?php echo $sessionName;?></title>
<link href="<?php echo $base_url; ?>css/lightbox.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<?php echo $base_url; ?>css/green_theme.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $base_url; ?>css/sweet-alert.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $base_url; ?>css/chat.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $base_url; ?>css/icons.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $base_url; ?>css/global.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $base_url; ?>css/animate.min.css">
<script type="text/javascript" src="<?php echo $base_url; ?>js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $base_url; ?>js/jquery.linkify.min.js"></script>
<script type="text/javascript" src="<?php echo $base_url;?>js/md.js"></script>
<script type="text/javascript" src="<?php echo $base_url; ?>js/emosocial.js"></script>
<script type="text/javascript" src="<?php echo $base_url; ?>js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo $base_url; ?>js/jquery.emotions.js"></script>
<script type="text/javascript" src="<?php echo $base_url; ?>js/jquery.emotionsB.js"></script>
<script type="text/javascript" src="<?php echo $base_url; ?>js/animatedModaltwo.min.js"></script>
<script type="text/javascript" src="<?php echo $base_url; ?>js/animatedModal.min.js"></script>
<script type="text/javascript" src="<?php echo $base_url; ?>js/jquery.livequery.js"></script>
<?php echo $strings['timeago'];?>
<script type="text/javascript" src="<?php echo $base_url; ?>js/sweet-alert.min.js"></script>
<script type="text/javascript" src="<?php echo $base_url; ?>js/jquery.slimscroll.js"></script>
<script src="<?php echo $base_url; ?>js/jquery.socialmatform.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo $base_url; ?>js/lightbox.min.js"></script>
<?php echo $strings['alert'];?>
<?php echo $strings['chat'];?>

</head>
<body>
<div class="language_wrap">
    <div class="language_header"><?php echo $strings['language'];?><div class="report_cancel_wrap go"><div class="icon-report_cancel icon-cross-mark"></div></div></div>
    <form method="post" action="">
    <div class="language_items">
      <div class="select-language-type">
        <div class="language_type">
          <input type="radio" id="tr"  name="u_lang" value="2" hidden="hidden" <?php echo $session_lang =="2" ? "checked='checked'":""; ?>>
          <label for="tr" class="ll"></label><?php echo $strings['l_tr'];?>
        </div>
        <div class="language_type">
          <input type="radio" id="de"  name="u_lang" value="1" hidden="hidden" <?php echo $session_lang =="1" ? "checked='checked'":""; ?>>
          <label for="de" class="ll"></label><?php echo $strings['l_eng'];?>
        </div>
        <div class="language_type">
          <input type="radio" id="fr"  name="u_lang" value="3" hidden="hidden" <?php echo $session_lang =="3" ? "checked='checked'":""; ?>>
          <label for="fr" class="ll"></label><?php echo $strings['l_de'];?>
        </div>
        <div class="language_type">
          <input type="radio" id="en"  name="u_lang" value="4" hidden="hidden"<?php echo $session_lang =="4" ? "checked='checked'":""; ?>>
          <label for="en" class="ll"></label><?php echo $strings['l_fr'];?>
        </div>
        
      </div>
    </div>
    <div class="change_language_wrap">
        <div class="language_dpost md-ripple"><input type="submit" class="send_this_language timer"  value="<?php echo $strings['l_change'];?>"></div>
      </div>
      </form>
  </div>
  
<div class="UserPostContent">
  <div class="sidebar_header">
    <div class="icon-status-close icon-chevron-left-thick"></div>
  </div>
  <div class="UserPostArea">
  </div>
</div>
<div class="header-menu">
  <div class="header-menu-wrap">
    <div class="header-left">
      <div class="web-logo js-onebyone">
        <img src="<?php echo $base_url.$LogoPaht.$sessionLogo;?>" />
        <div class="menu-area">
          <div class="icon-header-home-menu icon-navicon-round menu-show-hide-chat tt"></div>
          <div class="menu-area-wrap themecolor">
            <div class="menu-item-info">
              <div class="menu-items md-ripple"><a href="<?php echo $base_url.$session_username; ?>"><img src="<?php echo $session_face;?>" /><div class="menu-items-txt"><?php echo htmlspecialchars($Mat->UserFullName($session_username)).'';?></div></a></div>
              <div class="menu-items md-ripple">
                <a href="<?php echo $base_url.'messages/'.$username;?>">
                  <div class="icon-menu-item icon-email-envelope"></div>
                  <div class="menu-items-txt"><?php echo $strings['messages'];?></div>
                </a>
              </div>
              <div class="menu-items md-ripple">
                <a href="<?php echo $base_url.'photos/'.$username;?>">
                  <div class="icon-menu-item icon-picture"></div>
                  <div class="menu-items-txt"><?php echo $strings['photos'];?></div>
                </a>
              </div>
              <div class="menu-items-2 md-ripple">
                <a href="<?php echo $base_url.'followers/'.$username;?>">
                  <div class="icon-menu-item-2 icon-contacs"></div>
                  <div class="menu-items-txt-2"><?php echo $strings['followers'];?></div>
                </a>
              </div>
              <div class="menu-items-2 md-ripple">
                <a href="<?php echo $base_url.'following/'.$username;?>">
                  <div class="icon-menu-item-2 icon-contact-group"></div>
                  <div class="menu-items-txt-2"><?php echo $strings['following'];?></div>
                </a>
              </div>
              <div class="menu-items-2 md-ripple">
                <a href="<?php echo $base_url;?>notifications.php">
                  <div class="icon-menu-item-2 icon-bell"></div>
                  <div class="menu-items-txt-2"><?php echo $strings['notifications'];?></div>
                </a>
              </div>
              <div class="menu-items-2 md-ripple">
                <a href="<?php echo $base_url.'explore/'.$username;?>">
                  <div class="icon-menu-item-2 icon-compass-1"></div>
                  <div class="menu-items-txt-2"><?php echo $strings['explore'];?></div>
                </a>
              </div>
            </div>
          </div>
        </div>
        <a id="demo03" href="#modal-02">
          <div class="test alp">
            <div class="icon-search-mobile icon-search-find"></div>
          </div>
        </a>
      </div>
    </div>
    <div class="header-right">
      <div class="positioning wow bounceInDown">
        <a id="demo03" href="#modal-02">
          <div class="test alp serc">
            <div class="icon-header-home icon-search-find"></div>
          </div>
        </a>
        <div class="home-page mat-menu js-onebyone">
          <div class="icon-header-home icon-ellipsis"></div>
          <div class="some-info-menu">
            <ul>
              <li class="md-ripple"><a href="<?php echo $base_url.$session_username; ?>"><?php echo $strings['profile_status'];?></a></li>
              <li class="md-ripple"><a href="<?php echo $base_url.'settings/'.$username;?>"><?php echo $strings['settings'];?></a></li>
              <li class="md-ripple"><?php echo $strings['help'];?></li>
              <li class="md-ripple change-language" id="<?php echo $session_uid;?>"><?php echo $strings['p_language'];?></li>
              <li class="md-ripple"><a href="<?php echo $base_url.'logout.php'; ?>"><?php echo $strings['logout'];?></a></li>
            </ul>
          </div>

        </div>
        <a href="<?php echo $index_url; ?>">
          <div class="home-page js-onebyone md-ripple md-ripple-yellow wow bounceInLeft" data-wow-offset="300">
            <div class="icon-header-home icon-home-1"></div>
          </div>
        </a>
        <div class="home-page-message-notification" data-wow-offset="300">
          <?php include( "MessageNotificationsHelper.php");?>
        </div>
        <div class="home-page-notification">
          <?php include( "headernotifications.php");?>
        </div>
      </div>
    </div>

  </div>
</div>
<div class="header"></div>