-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathitem.php
More file actions
25 lines (19 loc) · 707 Bytes
/
item.php
File metadata and controls
25 lines (19 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
require_once 'config.php';
# @todo migrate SQL to Query subclass
$typeID = filter_input(INPUT_GET, 'typeID', FILTER_VALIDATE_INT);
$tpl->typeName = Db::qColumn("SELECT `typeName` FROM `invTypes` WHERE `typeID` = ?", array($typeID));
$offers = Db::q("
SELECT offerID
FROM lpOffers
WHERE typeID LIKE :typeID",
array(':typeID'=>$typeID));
// If there is only one offer, no need to list it, go directly to offer page
if (count($offers) === 1) {
header('Location: '.BASE_PATH.'offer/'.$offers[0]['offerID'].'/');
die();
}
foreach ($offers AS $id => $data) {
$offers[$id] = (new LpOffer($data['offerID']))->calc(); }
$tpl->offers = $offers;
$tpl->display('item.html');