コード例 #1
0
if ($update->rowCount() == 0) {
    echo 'The website failed to update the report record.';
    die;
} else {
    //reward the user for approved screenshot
    $accUpdate = $DB->prepare("UPDATE `account_data` SET `silver` = silver + :reward WHERE `id` = :id LIMIT 1;");
    $accUpdate->bindParam(':reward', $ApprovedReportReward, PDO::PARAM_INT);
    $accUpdate->bindParam(':id', $row['account'], PDO::PARAM_INT);
    $accUpdate->execute();
    //check if the reward was delivered
    if ($accUpdate->rowCount() > 0) {
        //log into coin activity
        $ca = new CoinActivity($row['account']);
        $ca->set_SourceType(CA_SOURCE_TYPE_REWARD);
        $ca->set_SourceString('Approved Bug Report');
        $ca->set_CoinsType(CA_COIN_TYPE_SILVER);
        $ca->set_ExchangeType(CA_EXCHANGE_TYPE_PLUS);
        $ca->set_Amount($ApprovedReportReward);
        $ca->execute();
        unset($ca);
        //success
        echo 'OK';
    } else {
        echo 'The website failed to deliver the reward to the user.';
        die;
    }
    unset($accUpdate);
}
unset($update);
####################################################################
exit;
コード例 #2
0
ファイル: armorset_execute.php プロジェクト: superwow/cms
 if ($sendItems === true) {
     //calc the new currency amount
     $accountGold = $accountGold - $row['price'];
     //update the account money
     $update = $DB->prepare("UPDATE `account_data` SET `gold` = :amount WHERE `id` = :account LIMIT 1;");
     $update->bindParam(':amount', $accountGold, PDO::PARAM_INT);
     $update->bindParam(':account', $CURUSER->get('id'), PDO::PARAM_INT);
     $update->execute();
     if ($update->rowCount() > 0) {
         //update the log
         $logs->update(false, 'The send items command has been executed and the user has been successfully charged for his purchase. New value of required currency: ' . $accountGold . ' Gold.', 'ok');
         //log into coin activity
         $ca = new CoinActivity();
         $ca->set_SourceType(CA_SOURCE_TYPE_NONE);
         $ca->set_SourceString('Armorset Purchase');
         $ca->set_CoinsType(CA_COIN_TYPE_GOLD);
         $ca->set_ExchangeType(CA_EXCHANGE_TYPE_MINUS);
         $ca->set_Amount($row['price']);
         $ca->execute();
         unset($ca);
     } else {
         //update the log
         $logs->update(false, 'The user was not charged for his purchase, website failed to update. Values that should have been applied: ' . $accountGold . ' Gold.', 'error');
     }
 } else {
     $ERRORS->Add("The website failed to complete your order. Please contact the administration.");
     //update the log
     $logs->update(false, 'Soap failed to execute the send items command.', 'error');
 }
 //check for fatal errors before proceeding to the complete page
 $ERRORS->Check('/index.php?page=itemsets');
コード例 #3
0
ファイル: accounts.finances.php プロジェクト: superwow/cms
 public function Reward($CA_SourceString, $CA_SourceType = CA_SOURCE_TYPE_NONE)
 {
     global $CURUSER, $DB, $CORE;
     //check if we have amouts to charge
     if (count($this->amounts) == 0) {
         return 'Error, we have no amounts to reward...';
     }
     //check if the coins activity modules is loaded
     if (!$CORE->isLoaded_CoreModule('coin.activity')) {
         $CORE->load_CoreModule('coin.activity');
     }
     //we have to construct the query
     $updateset = array();
     //loop trough the amounts we need to update
     foreach ($this->amounts as $id => $amount) {
         $updateset[] = "`" . $this->CurrencyTranslations[$id] . "` = " . $this->CurrencyTranslations[$id] . " + " . $amount;
     }
     //update the account money
     $update = $DB->prepare("UPDATE `account_data` SET " . implode(',', $updateset) . " WHERE `id` = :account LIMIT 1;");
     $update->bindParam(':account', $this->account, PDO::PARAM_INT);
     $update->execute();
     //assume that the query failed
     $Return = 'The website failed to execute the amount update query.';
     if ($update->rowCount() > 0) {
         //Log for each currency
         foreach ($this->amounts as $id => $amount) {
             //resolve the coins type
             switch ($id) {
                 case CURRENCY_SILVER:
                     $CoinsType = CA_COIN_TYPE_SILVER;
                     break;
                 case CURRENCY_GOLD:
                     $CoinsType = CA_COIN_TYPE_GOLD;
                     break;
                 default:
                     $CoinsType = CA_COIN_TYPE_SILVER;
                     break;
             }
             //log into coin activity
             $ca = new CoinActivity($this->account);
             $ca->set_SourceType($CA_SourceType);
             $ca->set_SourceString($CA_SourceString);
             $ca->set_CoinsType($CoinsType);
             $ca->set_ExchangeType(CA_EXCHANGE_TYPE_PLUS);
             $ca->set_Amount($amount);
             $ca->execute();
             unset($ca);
             $Return = true;
         }
         unset($id, $amount, $CoinsType);
     }
     unset($update, $updateset);
     return $Return;
 }
コード例 #4
0
ファイル: buyItems_execute.php プロジェクト: superwow/cms
 $theTime = $CORE->getTime();
 $currencyType = $currency == 'silver' ? CA_COIN_TYPE_SILVER : CA_COIN_TYPE_GOLD;
 $price = $currency == 'silver' ? $row['silver'] : $row['gold'];
 //insert in the store_activity table
 $insert = $DB->prepare("INSERT INTO `store_activity` (`account`, `source`, `text`, `time`, `itemId`, `money`) VALUES (:acc, 'STORE', 'Purchase', :time, :itemId, :money);");
 $insert->bindParam(':acc', $CURUSER->get('id'), PDO::PARAM_INT);
 $insert->bindParam(':time', $theTime, PDO::PARAM_STR);
 $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'];
 }