mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-29 18:59:21 +02:00
Much quicker item parser (335 items in 12ms instead of 2100ms)
Now checking if character is offline before changing gender. Restructured Admin_shop.php, it will now show pending orders and the whole transaction log.
This commit is contained in:
parent
52721610c4
commit
d3807bfafe
@ -3,17 +3,15 @@ require_once 'engine/init.php';
|
||||
include 'layout/overall/header.php';
|
||||
protect_page();
|
||||
admin_only($user_data);
|
||||
$orders_ammount = isset($_GET['orders_ammount']) && $_GET['orders_ammount'] > 0 && $_GET['orders_ammount'] <= 200 ? (int)$_GET['orders_ammount'] : 50;
|
||||
$orders = mysql_select_multi('SELECT * FROM `znote_shop_orders` ORDER BY `id` DESC LIMIT ' . $orders_ammount);
|
||||
$order_types = array(1 => 'Item', 2 => 'Premium Days', 3 => 'Sex Change', 4 => 'Custom');
|
||||
|
||||
$orders = mysql_select_multi('SELECT * FROM `znote_shop_orders` ORDER BY `id` DESC;');
|
||||
$order_types = array(1 => 'Item', 2 => 'Premium Days', 3 => 'Gender Change', 4 => 'Name Change', 5 => 'Custom');
|
||||
$items = getItemList();
|
||||
?>
|
||||
<h1>Admin Shop</h1>
|
||||
<h2>Shop Orders</h2>
|
||||
<p>Shows latest <?php echo $orders_ammount; ?> shop orders.</p>
|
||||
<form action="" method="get">
|
||||
<label for="orders_length">Enter ammount of orders to show:</label> <input type="number" max="200" min="1" name="orders_ammount" value="<?php echo $orders_ammount; ?>"/>
|
||||
<input type="submit" value="Submit"/>
|
||||
</form>
|
||||
<h1>Shop Logs</h1>
|
||||
|
||||
<h2>Pending Orders</h2>
|
||||
<p>These are pending orders, like items bought, but not received or used yet.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<th>Id</th>
|
||||
@ -29,13 +27,43 @@ $order_types = array(1 => 'Item', 2 => 'Premium Days', 3 => 'Sex Change', 4 => '
|
||||
<td><?php echo $order['id']; ?></td>
|
||||
<td><?php echo user_account_id_from_name($order['account_id']); ?></td>
|
||||
<td><?php echo $order_types[$order['type']] ?></td>
|
||||
<td><?php echo getItemNameById($order['itemid']) . ' (' . $order['itemid'] . ')' ?></td>
|
||||
<td><?php echo '(' . $order['itemid'] . ') ', (isset($items[$order['itemid']])) ? $items[$order['itemid']] : ''; ?></td>
|
||||
<td><?php echo $order['count'] ?></td>
|
||||
<td><?php echo date('Y/m/d H:i', $order['time']) ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
$orders = mysql_select_multi("SELECT `id`, `account_id`, `type`, `itemid`, `count`, `points`, `time` FROM `znote_shop_logs` ORDER BY `id` DESC;");
|
||||
?>
|
||||
<h2>Order History</h2>
|
||||
<p>This list contains all transactions bought in the shop.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<th>Id</th>
|
||||
<th>Account</th>
|
||||
<th>Type</th>
|
||||
<th>Item</th>
|
||||
<th>Count</th>
|
||||
<th>points</th>
|
||||
<th>Date</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach(($orders ? $orders : array()) as $order) { ?>
|
||||
<tr>
|
||||
<td><?php echo $order['id']; ?></td>
|
||||
<td><?php echo $order['account_id']; ?></td>
|
||||
<td><?php echo $order_types[$order['type']] ?></td>
|
||||
<td><?php echo '(' . $order['itemid'] . ') ', (isset($items[$order['itemid']])) ? $items[$order['itemid']] : ''; ?></td>
|
||||
<td><?php echo $order['count'] ?></td>
|
||||
<td><?php echo $order['points'] ?></td>
|
||||
<td><?php echo getClock($order['time'], true, false); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
include 'layout/overall/footer.php';
|
||||
?>
|
116
config.php
116
config.php
@ -55,64 +55,64 @@
|
||||
$config['EnableQuests'] = false;
|
||||
|
||||
// array for filling questlog (Questid, max value, name, end of the quest fill 1 for the last part 0 for all others)
|
||||
$config['Quests'] = array(
|
||||
array(1501,100,'Killing in the Name of',0),
|
||||
array(1502,150,'Killing in the Name of',0),
|
||||
array(65001,100,'Killing in the Name of',0),
|
||||
array(65002,150,'Killing in the Name of',0),
|
||||
array(65003,300,'Killing in the Name of',0),
|
||||
array(65004,3,'Killing in the Name of',0),
|
||||
array(65005,300,'Killing in the Name of',0),
|
||||
array(65006,150,'Killing in the Name of',0),
|
||||
array(65007,200,'Killing in the Name of',0),
|
||||
array(65008,300,'Killing in the Name of',0),
|
||||
array(65009,300,'Killing in the Name of',0),
|
||||
array(65010,300,'Killing in the Name of',0),
|
||||
array(65011,300,'Killing in the Name of',0),
|
||||
array(65012,300,'Killing in the Name of',0),
|
||||
array(65013,300,'Killing in the Name of',0),
|
||||
array(65014,300,'Killing in the Name of',1),
|
||||
array(12110,2,'The Inquisition',0),
|
||||
array(12111,7,'The Inquisition',0),
|
||||
array(12112,3,'The Inquisition',0),
|
||||
array(12113,6,'The Inquisition',0),
|
||||
array(12114,3,'The Inquisition',0),
|
||||
array(12115,3,'The Inquisition',0),
|
||||
array(12116,3,'The Inquisition',0),
|
||||
array(12117,5,'The Inquisition',1),
|
||||
array(330,3,'Sam\'s Old Backpack',1),
|
||||
array(12121,3,'The Ape City',0),
|
||||
array(12122,5,'The Ape City',0),
|
||||
array(12123,3,'The Ape City',0),
|
||||
array(12124,3,'The Ape City',0),
|
||||
array(12125,3,'The Ape City',0),
|
||||
array(12126,3,'The Ape City',0),
|
||||
array(12127,4,'The Ape City',0),
|
||||
array(12128,3,'The Ape City',0),
|
||||
array(12129,3,'The Ape City',1),
|
||||
array(12101,1,'The Ancient Tombs',0),
|
||||
array(12102,1,'The Ancient Tombs',0),
|
||||
array(12103,1,'The Ancient Tombs',0),
|
||||
array(12104,1,'The Ancient Tombs',0),
|
||||
array(12105,1,'The Ancient Tombs',0),
|
||||
array(12106,1,'The Ancient Tombs',0),
|
||||
array(12107,1,'The Ancient Tombs',1),
|
||||
array(12022,3,'Barbarian Test Quest',0),
|
||||
array(12022,3,'Barbarian Test Quest',0),
|
||||
array(12022,3,'Barbarian Test Quest',1),
|
||||
array(12025,3,'The Ice Islands Quest',0),
|
||||
array(12026,5,'The Ice Islands Quest',0),
|
||||
array(12027,3,'The Ice Islands Quest',0),
|
||||
array(12028,2,'The Ice Islands Quest',0),
|
||||
array(12029,6,'The Ice Islands Quest',0),
|
||||
array(12030,8,'The Ice Islands Quest',0),
|
||||
array(12031,3,'The Ice Islands Quest',0),
|
||||
array(12032,4,'The Ice Islands Quest',0),
|
||||
array(12033,2,'The Ice Islands Quest',0),
|
||||
array(12034,2,'The Ice Islands Quest',0),
|
||||
array(12035,2,'The Ice Islands Quest',0),
|
||||
array(12036,6,'The Ice Islands Quest',1),
|
||||
);
|
||||
$config['Quests'] = array(
|
||||
array(1501,100,"Killing in the Name of",0),
|
||||
array(1502,150,"Killing in the Name of",0),
|
||||
array(65001,100,"Killing in the Name of",0),
|
||||
array(65002,150,"Killing in the Name of",0),
|
||||
array(65003,300,"Killing in the Name of",0),
|
||||
array(65004,3,"Killing in the Name of",0),
|
||||
array(65005,300,"Killing in the Name of",0),
|
||||
array(65006,150,"Killing in the Name of",0),
|
||||
array(65007,200,"Killing in the Name of",0),
|
||||
array(65008,300,"Killing in the Name of",0),
|
||||
array(65009,300,"Killing in the Name of",0),
|
||||
array(65010,300,"Killing in the Name of",0),
|
||||
array(65011,300,"Killing in the Name of",0),
|
||||
array(65012,300,"Killing in the Name of",0),
|
||||
array(65013,300,"Killing in the Name of",0),
|
||||
array(65014,300,"Killing in the Name of",1),
|
||||
array(12110,2,"The Inquisition",0),
|
||||
array(12111,7,"The Inquisition",0),
|
||||
array(12112,3,"The Inquisition",0),
|
||||
array(12113,6,"The Inquisition",0),
|
||||
array(12114,3,"The Inquisition",0),
|
||||
array(12115,3,"The Inquisition",0),
|
||||
array(12116,3,"The Inquisition",0),
|
||||
array(12117,5,"The Inquisition",1),
|
||||
array(330,3,"Sam's Old Backpack",1),
|
||||
array(12121,3,"The Ape City",0),
|
||||
array(12122,5,"The Ape City",0),
|
||||
array(12123,3,"The Ape City",0),
|
||||
array(12124,3,"The Ape City",0),
|
||||
array(12125,3,"The Ape City",0),
|
||||
array(12126,3,"The Ape City",0),
|
||||
array(12127,4,"The Ape City",0),
|
||||
array(12128,3,"The Ape City",0),
|
||||
array(12129,3,"The Ape City",1),
|
||||
array(12101,1,"The Ancient Tombs",0),
|
||||
array(12102,1,"The Ancient Tombs",0),
|
||||
array(12103,1,"The Ancient Tombs",0),
|
||||
array(12104,1,"The Ancient Tombs",0),
|
||||
array(12105,1,"The Ancient Tombs",0),
|
||||
array(12106,1,"The Ancient Tombs",0),
|
||||
array(12107,1,"The Ancient Tombs",1),
|
||||
array(12022,3,"Barbarian Test Quest",0),
|
||||
array(12022,3,"Barbarian Test Quest",0),
|
||||
array(12022,3,"Barbarian Test Quest",1),
|
||||
array(12025,3,"The Ice Islands Quest",0),
|
||||
array(12026,5,"The Ice Islands Quest",0),
|
||||
array(12027,3,"The Ice Islands Quest",0),
|
||||
array(12028,2,"The Ice Islands Quest",0),
|
||||
array(12029,6,"The Ice Islands Quest",0),
|
||||
array(12030,8,"The Ice Islands Quest",0),
|
||||
array(12031,3,"The Ice Islands Quest",0),
|
||||
array(12032,4,"The Ice Islands Quest",0),
|
||||
array(12033,2,"The Ice Islands Quest",0),
|
||||
array(12034,2,"The Ice Islands Quest",0),
|
||||
array(12035,2,"The Ice Islands Quest",0),
|
||||
array(12036,6,"The Ice Islands Quest",1),
|
||||
);
|
||||
|
||||
// Vocation ids and names.
|
||||
$config['vocations'] = array(
|
||||
|
@ -16,6 +16,20 @@ function getItemNameById($id) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns a PHP array $id => 'name'
|
||||
$items = getItemList();
|
||||
echo $items[2160]; // Returns 'Crystal Coin'
|
||||
*/
|
||||
function getItemList() {
|
||||
$item_list = explode(PHP_EOL, file_get_contents('item_list.txt'));
|
||||
$ia = array();
|
||||
for ($i = 0; $i < count($item_list) - 1; $i++) {
|
||||
$it = explode('@', $item_list[$i]);
|
||||
$ia[(int)$it[0]] = ucfirst($it[1]);
|
||||
}
|
||||
return $ia;
|
||||
}
|
||||
|
||||
function getItemIdByName($name) {
|
||||
|
||||
$item_list = explode(PHP_EOL, file_get_contents('item_list.txt'));
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
$server = $config['shop']['imageServer'];
|
||||
$imageType = $config['shop']['imageType'];
|
||||
|
||||
$items = getItemList();
|
||||
$compare = &$_GET['compare'];
|
||||
|
||||
// If you are not comparing any items, present the list.
|
||||
@ -37,7 +37,7 @@ if (!$compare) {
|
||||
foreach (($offers['wts'] ? $offers['wts'] : array()) as $o) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php getItemNameById($o['item_id']); ?></td>
|
||||
<td><?php echo (isset($items[$o['item_id']])) ? $items[$o['item_id']] : $o['item_id']; ?></td>
|
||||
<td><img src="<?php echo "http://".$server."/".$o['item_id'].".".$imageType; ?>" alt="Item Image"></td>
|
||||
<td><?php echo $o['amount']; ?></td>
|
||||
<td><?php echo number_format($o['price'], 0, "", " "); ?></td>
|
||||
|
@ -131,7 +131,7 @@ if (!empty($_POST['change_gender'])) {
|
||||
$account_id = user_character_account_id($char_name);
|
||||
|
||||
if ($config['TFSVersion'] == 'TFS_10') {
|
||||
$chr_data = user_is_online_10($user_id);
|
||||
$chr_data = user_is_online_10($char_id);
|
||||
} else $chr_data = user_character_data($char_id, 'online');
|
||||
|
||||
if ($chr_data['online'] != 1) {
|
||||
|
4
shop.php
4
shop.php
@ -44,11 +44,11 @@ if (!empty($_POST['buy'])) {
|
||||
user_account_add_premdays($cid, $buy['count']);
|
||||
echo '<font color="green" size="4">You now have '.$buy['count'].' additional days of premium membership.</font>';
|
||||
} else if ($buy['type'] == 3) {
|
||||
// Character sex
|
||||
// Character Gender
|
||||
mysql_insert("INSERT INTO `znote_shop_orders` (`account_id`, `type`, `itemid`, `count`, `time`) VALUES ('$cid', '". $buy['type'] ."', '". $buy['itemid'] ."', '". $buy['count'] ."', '$time')");
|
||||
echo '<font color="green" size="4">You now have access to change character gender on your characters. Visit <a href="myaccount.php">My Account</a> to select character and change the gender.</font>';
|
||||
} else if ($buy['type'] == 4) {
|
||||
// Character sex
|
||||
// Character Name
|
||||
mysql_insert("INSERT INTO `znote_shop_orders` (`account_id`, `type`, `itemid`, `count`, `time`) VALUES ('$cid', '". $buy['type'] ."', '". $buy['itemid'] ."', '". $buy['count'] ."', '$time')");
|
||||
echo '<font color="green" size="4">You now have access to change character name on your characters. Visit <a href="myaccount.php">My Account</a> to select character and change the name.</font>';
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user