Exemple #1
0
 function index()
 {
     if (isset($_SESSION['user_id'])) {
         $user_id = $_SESSION['user_id'];
         $autobids = array();
         $autobids_data = $this->exec_all("SELECT * FROM " . _DB_PREFIX_ . "autobids WHERE user_id=" . $user_id . " ORDER BY id DESC");
         $i = 0;
         foreach ($autobids_data as $data) {
             $auction = $this->exec_one("SELECT id, product_id, price FROM " . _DB_PREFIX_ . "auctions WHERE id=" . $data['auction_id'] . "");
             $autobids[$i]['id'] = $data['id'];
             $autobids[$i]['auction_id'] = $auction['id'];
             $autobids[$i]['auction_price'] = $auction['price'];
             $autobids[$i]['auction_leader'] = $auction['id'];
             $autobids[$i]['minimum_price'] = $data['minimum_price'];
             $autobids[$i]['maximum_price'] = $data['maximum_price'];
             $autobids[$i]['total_bids'] = $data['total_bids'];
             $autobids[$i]['bids'] = $data['bids'];
             $autobids[$i]['active'] = $data['active'];
             $autobids[$i]['date'] = tools::niceShort($data['created']);
             $i++;
         }
         $this->smarty->assign(array('autobids' => $autobids));
         $this->smarty->display('user/autobids.tpl');
     } else {
         tools::setFlash(ERROR_LOGIN, 'error');
         tools::redirect('/user/login');
     }
 }
Exemple #2
0
     }
 }
 if ($auction['type'] == 4) {
     $auction['price'] = $auction['fixed_price'];
 }
 if ($auction['type'] == 8 && $auction['status_id'] == 1) {
     $bid_pred_nb = $db->getRow("SELECT count(id) AS total FROM " . DB_PREFIX . "bids WHERE auction_id = :auction_id AND debit > 0", array('auction_id', $auction['id']));
     $auction['bid_pred_nb'] = $bid_pred_nb['total'];
 }
 if (!empty($_GET['histories'])) {
     $res = $db->getRows("SELECT b.id, b.user_id, b.price, b.description, b.debit, b.created, u.username FROM " . DB_PREFIX . "bids b, " . DB_PREFIX . "users u WHERE b.credit = 0 AND b.user_id = u.id AND b.auction_id = " . $auction['id'] . " ORDER BY b.id DESC LIMIT 10");
     if ($res) {
         $bid_histories_result = array();
         foreach ($res as $row) {
             $bid_history['Bid']['id'] = $row['id'];
             $bid_history['Bid']['created'] = tools::niceShort($row['created']);
             $bid_history['Bid']['description'] = $row['description'];
             $bid_history['Bid']['username'] = utf8_encode($row['username']);
             $bid_history['Bid']['amount'] = $row['price'] . '€';
             $bid_histories_result[] = $bid_history;
         }
         $result['Histories'] = $bid_histories_result;
     }
 }
 $result['Auction'] = $auction;
 // writing data to the application cache
 if (!empty($_GET['histories'])) {
     $auction = tools::writeCache('auction_view_' . $value, $result);
 } else {
     $auction = tools::writeCache('auction_' . $value, $result);
 }