예제 #1
0
         $insert->bindParam(':itemId', $id, PDO::PARAM_INT);
         $insert->bindParam(':money', $moneyString, PDO::PARAM_STR);
         $insert->execute();
         unset($insert);
         //log into coin activity
         $ca = new CoinActivity();
         $ca->set_SourceType(CA_SOURCE_TYPE_NONE);
         $ca->set_SourceString('Item Purchase');
         $ca->set_CoinsType($currencyType);
         $ca->set_ExchangeType(CA_EXCHANGE_TYPE_MINUS);
         $ca->set_Amount($price);
         $ca->execute();
         unset($ca);
         $currencyType = $currency == 'silver' ? CURRENCY_SILVER : CURRENCY_GOLD;
         //Add the item as refundable
         $refundable = ItemRefundSystem::AddRefundable($row['entry'], $price, $currencyType, $characterGUID);
         //update the log
         $logs->update(false, 'The user has enough money, proceeding to item (id: ' . $id . ') sending.' . ($refundable ? ' Successfully added the item as refundable.' : ''));
         //sending... append the item entry to the items string for the SOAP command
         if (!$itemsString) {
             $itemsString = $row['entry'];
         } else {
             $itemsString .= ' ' . $row['entry'];
         }
         unset($currencyType, $price, $theTime);
     }
 } else {
     //save the item error
     $itemErrors[$index]['error'] = 'The selected currency for this item is invalid.';
     //log
     $logs->update(false, 'The user is using invalid currency for this purchase of item (id: ' . $id . ').', 'error');