<?php
if($pnconfig[Version_Sub] == "Rogue")
{
if (!eregi('admin.php', $PHP_SELF)) die ('Access Denied: You can\'t access this file directly.');
if (!authorised(0, "$ModName::", '::', ACCESS_ADMIN)) die ('Access Denied: No permissions');
}
else
{
if (!eregi("admin.php", $PHP_SELF)) die ("Access Denied");
}
include ("header.php");
include ("modules/$ModName/classes/products.php");
GraphicAdmin($hlpfile);
cp_menu();
OpenTable();
echo "\n <table border=0 cellpadding=3 cellspacing=1 bgcolor=\"$bgcolor2\" width=\"100%\">\n"
." <tr style=\"background-color: $bgcolor3; color: $textcolor1; font-weight: bold;\">\n"
." <td width=\"3%\" bgcolor=\"$bgcolor1\"> </td>\n"
." <td width=\"\">ID#</td>\n"
." <td width=\"\">Name</td>\n"
." <td width=\"\">Type</td>\n"
." <td width=\"\">Charge</td>\n"
." <td width=\"5%\" align=center>View</td>\n"
." <td width=\"5%\" align=center>Edit</td>\n"
." </tr>\n";
$stores = mysql_query("SELECT id, name FROM $pntable[CP_Stores] ORDER BY id");
while($store = mysql_fetch_array($stores)) {
$type = $item[ptype];
echo " <tr bgcolor=\"$bgcolor4\">\n"
." <td colspan=7><a href=\"admin.php?op=add_store_$ModName&cpop=edit_store&editStore=$store[id]\">$store[name]</a></td>\n"
." </tr>\n";
$items = mysql_query("SELECT * FROM $pntable[cp_products] WHERE store='$store[id]' ORDER BY ptype");
while ($item = mysql_fetch_array($items)) {
$type = $item[ptype];
echo " <tr style=\"background-color: $bgcolor1; color: $textcolor1;\">\n"
." <td> </td>\n"
." <td>$item[prod]</td>\n"
." <td>$item[name]</td>\n"
." <td>$products[$type]</td>\n"
." <td>\$$item[charge]</td>\n"
." <td align=center><a href=\"admin.php?op=view_product_$ModName&item=$item[prod]\"><img src=\"modules/$ModName/images/admin_show.gif\" alt=\"Show preview and details.\" border=0></a></td>\n"
." <td align=center><a href=\"admin.php?op=add_product_$ModName&cpop=edit_product&editProd=$item[prod]\"><img src=\"modules/$ModName/images/admin_edit.gif\" alt=\"Edit item details.\" border=0></a></td>\n"
." </tr>\n";
}
$seasonals = mysql_query("SELECT * FROM $pntable[cp_seasonal] WHERE store='$store[id]' ORDER BY expire");
if (mysql_num_rows($seasonals))
echo " <tr style=\"background-color: $bgcolor3; color: $textcolor1;\">\n"
." <td bgcolor=$bgcolor1> </td>\n"
." <td colspan=6>Seasonal Items:</td>\n"
." </tr>\n";
while ($item = mysql_fetch_array($seasonals)) {
echo " <tr style=\"background-color: $bgcolor1; color: $textcolor1;\">\n"
." <td> </td>\n"
." <td>$item[prod]</td>\n"
." <td>$item[name]</td>\n"
." <td>Seasonal</td>\n"
." <td>\$$item[charge]</td>\n"
." <td align=center><a href=\"admin.php?op=view_product_$ModName&item=$item[prod]&seasonal=1\"><img src=\"modules/$ModName/images/admin_show.gif\" alt=\"Show preview and details.\" border=0></a></td>\n"
." <td align=center><a href=\"admin.php?op=add_seasonal_$ModName&cpop=edit_product&editProd=$item[prod]\"><img src=\"modules/$ModName/images/admin_edit.gif\" alt=\"Edit item details.\" border=0></a></td>\n"
." </tr>\n";
}
}
if (!mysql_num_rows($stores)) echo "<tr bgcolor=\"$bgcolor1\"><td colspan=7 align=center>No stores defined!<br>If you are using my module please consider starting a new store with the link below to help me earn money to keep developing! Thanks!<br><br><a href=\"http://www.cafepress.com/cp/info/storeref.aspx?refby=rastafari\" target=\"_blank\"><img src=\"modules/$ModName/images/admin.gif\" alt=\"Don't have a store? Click to signup!\" border=0><br>Click to Get a Store!</a></td></tr>";
echo " </table>\n";
CloseTable();
include ("footer.php");
?>