
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fu...
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
if (!defined("IN_FUSION")) { header("Location:../../index.php"); exit; }

if (file_exists(INFUSIONS."last_seen_users_panel/locale/".$settings['locale'].".php")) {
   include INFUSIONS."last_seen_users_panel/locale/".$settings['locale'].".php";
} else {
   include INFUSIONS."last_seen_users_panel/locale/English.php";
}


opentable($locale['lsup000']);
$result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_lastvisit>'0' AND user_status='0' ORDER BY user_lastvisit DESC LIMIT 0,5");

echo "<table cellpadding='0' cellspacing='0' width='100%'>";
if (dbrows($result) != 0) {
   while ($data = dbarray($result)) {
      $lastseen = time() - $data['user_lastvisit'];
      $iW=sprintf("%2d",floor($lastseen/604800));
      $iD=sprintf("%2d",floor($lastseen/(60*60*24)));
      $iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
      $iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
      $iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
      if ($lastseen < 60){
         $lastseen= $locale['lsup001'];
      } elseif ($lastseen < 360){
         $lastseen= $locale['lsup002'];
      } elseif ($iW > 0){
         if ($iW == 1) { $text = $locale['lsup003']; } else { $text = $locale['lsup004']; }
         $lastseen = $iW." ".$text;
      } elseif ($iD > 0){
         if ($iD == 1) { $text = $locale['lsup005']; } else { $text = $locale['lsup006']; }
         $lastseen = $iD." ".$text;
      } else {
         $lastseen = $iH.":".$iM.":".$iS;
      }

echo "<td>";   
echo "<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' class='side'>".$data['user_name']."</a>
<a href='".BASEDIR."messages.php?msg_send=".$data['user_id']."'><br>";

if ($userdata['user_avatar'] != ""){
 echo "<img src='".IMAGES."avatars/".$data['user_avatar']."' alt='".$locale['567']."' width='70' height='70' style='border:0'><br>";
   }else{
echo "<img src='".IMAGES."no-avatar.gif' width='70' height='70' border='0'><br>\n";
}
  
echo "<img src='".BASEDIR."infusions/last_seen_users_panel/pm.jpg' alt='".$locale['571']."' style='border:0px;'></a>\n";
 
$lastseen = time() - $data['user_lastvisit'];

if($lastseen < 60) {
 $lastseen = "<img src='".BASEDIR."infusions/last_seen_users_panel/online.gif'  title='User is Online' alt='User is Online'>";
 } else {
 $lastseen = "<img src='".BASEDIR."infusions/last_seen_users_panel/offline.gif'  title='User is Offline' alt='User is Offline'>";
 }
echo $lastseen."<br>";
   
   }
}
echo "</td>";
echo "</table>";
closetable();
?>
