<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| 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; }

//include INFUSIONS."sf_gift_system/includes/functions.php";

// Check if locale file is available matching the current site locale setting.
if (file_exists(INFUSIONS."sf_gift_system/locale/".LOCALESET."/sf_gift_panel.php")) {
	// Load the locale file matching the current site locale setting.
	include INFUSIONS."sf_gift_system/locale/".LOCALESET."/sf_gift_panel.php";
} else {
	// Load the infusion's default locale file.
	include INFUSIONS."sf_gift_system/locale/English/sf_gift_panel.php";
}

openside($locale['sfgift600']);
$result = dbquery("SELECT * FROM ".$db_prefix."sf_gift ORDER BY gift_id DESC LIMIT 1");
if(dbrows($result)){
	while($data = dbarray($result)){
		echo "<table width='100%'>
			<tr>
				<td>".$locale['sfgift601']." <span class='small'>(".$data['gift_price']." ".$locale['sfgift602'].")</span></td>
			</tr>
			<tr>
				<td><a href='".INFUSIONS."sf_gift_system/give_gift.php?gift_id=".$data['gift_id']."'><img src='".INFUSIONS."sf_gift_system/images/".$data['gift_image']."'align='left' alt=''></a><span class='small'>".$locale['sfgift603']."<br>".$locale['sfgift604']."<br>".$locale['sfgift605']."<br>".($data['gift_stock']-$data['gift_bought'])."</span></td>
			</tr>";
			if (iMEMBER) {
				echo "<tr>
					<td><a href='".INFUSIONS."sf_gift_system/give_gift.php?gift_id=".$data['gift_id']."'>".$locale['sfgift606']."</a> | <a href='".INFUSIONS."sf_gift_system/brows_gifts.php'>".$locale['sfgift607']."</a></td>
				</tr>";
			}
		echo "</table>";
	}
} else {
	echo $locale['sfgift608'];
}
closeside();
?>