コード例 #1
0
$update->bindParam(':approval', $approval, PDO::PARAM_INT);
$update->bindParam(':id', $row['id'], PDO::PARAM_INT);
$update->execute();
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);
}
コード例 #2
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;
 }
コード例 #3
0
ファイル: buyItems_execute.php プロジェクト: superwow/cms
 }
 //if the character has the money send the item
 if ($hasMoney) {
     $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'];
コード例 #4
0
ファイル: armorset_execute.php プロジェクト: superwow/cms
 //level the character
 $sendItems = $command->sendItems($character, $itemsString, 'Armor Set Delivery', $RealmId);
 //check if the command was successfull
 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');
コード例 #5
0
ファイル: vote_execute.php プロジェクト: superwow/cms
    }
}
if ($ipCheck == true and time() < $IPcooldown) {
    //set the cooldown
    $CURUSER->setCooldown('votingsite' . $siteid, strtotime('+' . $cooldownTime));
    $ERRORS->Add("The website failed to update your Silver coins. Reason: Someone has already voted from this IP.");
} else {
    //update the user points
    $update = $DB->prepare("UPDATE `account_data` SET `silver` = silver + :points WHERE `id` = :acc LIMIT 1;");
    $update->bindParam(':acc', $CURUSER->get('id'), PDO::PARAM_INT);
    $update->bindParam(':points', $pointsPerVote, PDO::PARAM_INT);
    $update->execute();
    //check if the points ware updated
    if ($update->rowCount() > 0) {
        //log into coin activity
        $ca = new CoinActivity();
        $ca->set_SourceType(CA_SOURCE_TYPE_REWARD);
        $ca->set_SourceString($voteSitesData['name'] . ' Vote');
        $ca->set_CoinsType(CA_COIN_TYPE_SILVER);
        $ca->set_ExchangeType(CA_EXCHANGE_TYPE_PLUS);
        $ca->set_Amount($pointsPerVote);
        $ca->execute();
        unset($ca);
        //set the cooldown
        $CURUSER->setCooldown('votingsite' . $siteid, strtotime('+' . $cooldownTime));
        $ERRORS->triggerSuccess();
    } else {
        $ERRORS->Add("The website failed to update your Silver coins.");
    }
    unset($update);
}