Beispiel #1
0
 /**
  * Update the stored value of an item and the total value of this kill.
  *
  * Input values are taken from the query string.
  */
 private function updatePrices()
 {
     if (config::get('item_values')) {
         if (isset($_POST['submit']) && $_POST['submit'] == 'UpdateValue') {
             // Send new value for item to the database
             $qry = DBFactory::getDBQuery();
             $qry->autocommit(false);
             if (isset($_POST['SID'])) {
                 $SID = intval($_POST['SID']);
                 $Val = preg_replace('/[^0-9]/', '', $_POST[$SID]);
                 $qry->execute("INSERT INTO kb3_item_price (typeID, price) VALUES ('" . $SID . "', '" . $Val . "') ON DUPLICATE KEY UPDATE price = '" . $Val . "'");
                 Ship::delCache($this->kill->getVictimShip());
             } else {
                 $IID = intval($_POST['IID']);
                 $Val = preg_replace('/[^0-9]/', '', $_POST[$IID]);
                 $qry->execute("INSERT INTO kb3_item_price (typeID, price) VALUES ('" . $IID . "', '" . $Val . "') ON DUPLICATE KEY UPDATE price = '" . $Val . "'");
                 Item::delCache(Item::getByID($IID));
             }
             Kill::delCache($this->kill);
             $this->kill = Kill::getByID($this->kill->getID());
             $this->kill->calculateISKLoss(true);
             $qry->autocommit(true);
         }
     }
 }