opentable("Naujausios dovanotos dovanos");
echo "<table width='100%' cellpadding='0' cellspacing='0' align='center' class='tbl-border'>
<tr>
<td width='33% ' align='center' class='tbl2'>Kas</td>
<td width='33% ' align='center' class='tbl2'>Dovana</td>
<td width='33%' align='center' class='tbl2'>Kam</td>
</tr>
</table><br>
";
$result = dbquery("SELECT * FROM ".$db_prefix."sf_gift_given ORDER BY gift_given_id DESC LIMIT 4");
if (dbrows($result) != 0) {
echo "<table width='100%' cellpadding='0' cellspacing='0'>";
while ($data = dbarray($result)) {
$data2 = dbarray(dbquery("SELECT * FROM `".DB_PREFIX."users` WHERE `user_id`='".$data['gift_given_from']."'"));
$data3 = dbarray(dbquery("SELECT * FROM `".DB_PREFIX."users` WHERE `user_id`='".$data['gift_given_to']."'"));
if ($data2['user_avatar']) {
$imgas = IMAGES."avatars/".$data2['user_avatar'];
} else{
$imgas = "http://c31.one.lt/res/images/util/no-photo-small-0.jpg";
}
if ($data3['user_avatar']) {
$img = IMAGES."avatars/".$data3['user_avatar'];
} else{
$img = "http://c31.one.lt/res/images/util/no-photo-small-0.jpg";
}
echo "<tr>
<td width='33%'>";
echo"<center><a href='".BASEDIR."profile.php?lookup=".$data['gift_given_from']."'><img src='$imgas' width='80' height='120'></a></center><center><a href='".BASEDIR."profile.php?lookup=".$data['gift_given_from']."'>
".$data2['user_name']."</a></center>
</td>
<td width='33%'>";
$result2 = dbquery("SELECT * FROM ".$db_prefix."sf_gift ORDER BY gift_image DESC LIMIT 1");
while ($datas = dbarray($result2)) {
$datazz = dbarray(dbquery("SELECT * FROM `".DB_PREFIX."sf_gift` WHERE `gift_id`='".$data['gift_given_gift_id']."'"));
echo"
<center>
<img src='".BASEDIR."/infusions/sf_gift_system/images/".$datazz['gift_image']."'>
</center>
";
}
echo"
<center>".showdate("%d/%m/%Y %H:%M:%S", $data['gift_given_data'])."</center>
</td>
<td width='33%'>";
echo"<center><a href='".BASEDIR."profile.php?lookup=".$data['gift_given_to']."'><img src='$img' width='80' height='120'></a></center><center>
<a href='".BASEDIR."profile.php?lookup=".$data['gift_given_to']."'>
".$data3['user_name']."</a></center></td>
</tr>";
}
echo "</table>";
} else {
echo "<div style='text-align:center'>".$locale['004']."</div>\n";
}
echo "";
closetable();