<?php include_once './engine/initialize.php'; //Load the most important module $CORE->load_CoreModule('accounts.finances'); //Setup the finances class $finance = new AccountFinances(); define('SECRET', ''); // YOUR SECRET KEY define('CREDIT_TYPE_CHARGEBACK', 2); //Whitelisted IP addresses $ipsWhitelist = array(); //Get them variables $userId = isset($_GET['uid']) ? (int) $_GET['uid'] : NULL; $credits = isset($_GET['currency']) ? (int) $_GET['currency'] : NULL; $type = isset($_GET['type']) ? (int) $_GET['type'] : NULL; $refId = isset($_GET['ref']) ? $_GET['ref'] : NULL; $signature = isset($_GET['sig']) ? $_GET['sig'] : NULL; //Assume failured $result = false; //A little fuction function calculatePingbackSignature($params, $secret) { $str = ''; foreach ($params as $k => $v) { $str .= "{$k}={$v}"; } $str .= $secret; return md5($str); } //Check if them variables are set
<?php include_once 'engine/initialize.php'; //Load the most important module $CORE->load_CoreModule('accounts.finances'); //Log this transaction $CORE->load_CoreModule('transaction.logging'); //Setup the log class $Logs = new TransactionLogging_Paypal(); //Setup the finances class $finance = new AccountFinances(); // STEP 1: Read POST data // reading posted data from directly from $_POST causes serialization // issues with array data in POST // reading raw POST data from input stream instead. $raw_post_data = file_get_contents('php://input'); $raw_post_array = explode('&', $raw_post_data); $myPost = array(); foreach ($raw_post_array as $keyval) { $keyval = explode('=', $keyval); if (count($keyval) == 2) { $myPost[$keyval[0]] = urldecode($keyval[1]); } } // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; if (function_exists('get_magic_quotes_gpc')) { $get_magic_quotes_exists = true; } foreach ($myPost as $key => $value) { if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
$CORE->load_CoreModule('coin.activity'); //load the characters handling class $CORE->load_ServerModule('character'); //load the log class $CORE->load_CoreModule('purchaseLog'); //load the sendmail class $CORE->load_ServerModule('commands'); $CORE->load_CoreModule('accounts.finances'); //prepare the sendmail class $command = new server_Commands(); //prepare the log $logs = new purchaseLog(); //levels data $LevelsData = new LevelsData(); //Setup the finances class $finance = new AccountFinances(); //prepare multi errors $ERRORS->NewInstance('pStore_gold'); //bind the onsuccess message $ERRORS->onSuccess('Your purchase has been successfully delivered.', '/index.php?page=purchase_gold'); $character = isset($_POST['character']) ? $_POST['character'] : false; $GoldAmount = isset($_POST['amount']) ? (int) $_POST['amount'] : false; //assume the realm is 1 (for now) $RealmId = $CURUSER->GetRealm(); if (!$character) { $ERRORS->Add("Please select a character first."); } if (!$GoldAmount) { $ERRORS->Add("Please enter the amount of gold you would like to purchase."); } else { //Verify the gold amount
private function ProcessCurrencyReward($currency, $amount) { global $CORE; //Verify the currency $Currencies = array(CURRENCY_SILVER, CURRENCY_GOLD); if (!in_array($currency, $Currencies)) { $this->errors[] = 'The code seems to have invalid reward type.'; return false; } //Load the Finances module if not loaded if (!$CORE->isLoaded_CoreModule('accounts.finances')) { $CORE->load_CoreModule('accounts.finances'); } //Setup the finances class $finance = new AccountFinances(); //Add the currency to the user //Set the account id $finance->SetAccount($this->account); //Set the currency to gold $finance->SetCurrency($currency); //Set the amount we are Giving $finance->SetAmount($amount); //Give coins to the user $Reward = $finance->Reward('Promotion Code', CA_SOURCE_TYPE_REWARD); //check if it was updated if ($Reward !== true) { $this->errors[] = 'The website was unable to deliver your reward due to reason: ' . $Reward; return false; } unset($finance); return true; }
//load the register module $CORE->load_CoreModule('accounts.register'); $CORE->load_CoreModule('accounts.finances'); $CORE->load_CoreModule('purchaseLog'); //setup new instance of multiple errors $ERRORS->NewInstance('changedname'); //bind the onsuccess message $ERRORS->onSuccess('Your Display Name was successfuly changed.', '/index.php?page=changedname'); //Define the variables $displayName = isset($_POST['displayName']) ? $_POST['displayName'] : false; $currency = isset($_POST['currency']) ? (int) $_POST['currency'] : false; //Define the cost of display name change $PurchaseCost_Silver = 100; $PurchaseCost_Gold = 10; //Setup the finances class $finance = new AccountFinances(); //prepare the log $logs = new purchaseLog(); ###################################### ############### CHECKs ############### if (!$displayName) { //no new password $ERRORS->Add('Please enter your new Display Name.'); } else { if ($displaynameError = AccountsRegister::checkDisplayname($displayName)) { $ERRORS->Add($displaynameError); } } if (!$currency) { //no currency is selected $ERRORS->Add('Please select a currency for the purchase.');
exit; } $CORE->loggedInOrReturn(); //load the coin activity handler $CORE->load_CoreModule('coin.activity'); //load the characters handling class $CORE->load_ServerModule('character'); //load the log class $CORE->load_CoreModule('purchaseLog'); //load the sendmail class $CORE->load_ServerModule('commands'); $CORE->load_CoreModule('accounts.finances'); //prepare the sendmail class $command = new server_Commands(); //Setup the finances class $finance = new AccountFinances(); //prepare the log $logs = new purchaseLog(); //prepare multi errors $ERRORS->NewInstance('pStore_faction'); //bind the onsuccess message $ERRORS->onSuccess('Successfull character faction change.', '/index.php?page=factionchange'); $character = isset($_POST['character']) ? $_POST['character'] : false; $RealmId = $CURUSER->GetRealm(); //define how much a faction change is going to cost $factionChangePrice = 5; if (!$character) { $ERRORS->Add("Please select a character first."); } //Set the currency and price $finance->SetCurrency(CURRENCY_GOLD);
exit; } $CORE->load_CoreModule('purchaseLog'); //prepare the log $logs = new purchaseLog(); //start logging $logs->add('SOCIAL_BUTTONS', 'Starting log session. Application: ' . $app . ', status variable: ' . $status . '.', 'pending'); //Update the user social button status if ($CURUSER->setSocial($app, $status)) { //If the status was update reward the user //log successful status update $logs->update(false, 'The user status was update.', 'pending'); //Load the most important module $CORE->load_CoreModule('accounts.finances'); //Setup the finances class $finance = new AccountFinances(); //Set the account id $finance->SetAccount($CURUSER->get('id')); //Set the currency to gold $finance->SetCurrency(CURRENCY_SILVER); //Set the amount we are Giving $finance->SetAmount($RewardAmount); //Resolve the source [facebook, twitter etc...] switch ($app) { case APP_FACEBOOK: $CA_Source = 'You liked us on Facebook'; break; case APP_TWITTER: $CA_Source = 'You followed us on Twitter'; break; default:
header('HTTP/1.0 404 not found'); exit; } if (!$CURUSER->isOnline()) { echo 'Error: You must be logged in.'; die; } //load the character module $CORE->load_ServerModule('character'); $CORE->load_CoreModule('item.refund.system'); $CORE->load_ServerModule('commands'); $CORE->load_CoreModule('accounts.finances'); //prepare the sendmail class $command = new server_Commands(); //Setup the finances class $finance = new AccountFinances(); //Prepare the characters class $chars = new server_Character(); //prepare multi errors $ERRORS->NewInstance('refund_item'); $RealmId = $CURUSER->GetRealm(); $refundId = isset($_POST['id']) ? (int) $_POST['id'] : false; if (!$RealmId) { echo 'There is no realm assigned to your account.'; die; } if (!$chars->setRealm($RealmId)) { echo 'The realm assigned to your account is invalid.'; die; } //check if the realm is online
$CORE->load_CoreModule('coin.activity'); //load the characters handling class $CORE->load_ServerModule('character'); //load the log class $CORE->load_CoreModule('purchaseLog'); //load the sendmail class $CORE->load_ServerModule('commands'); $CORE->load_CoreModule('accounts.finances'); //prepare the sendmail class $command = new server_Commands(); //prepare the log $logs = new purchaseLog(); //levels data $LevelsData = new LevelsData(); //Setup the finances class $finance = new AccountFinances(); //prepare multi errors $ERRORS->NewInstance('pStore_levels'); //bind the onsuccess message $ERRORS->onSuccess('Your purchase has been successfully delivered.', '/index.php?page=levels'); $level = isset($_POST['levels']) ? (int) $_POST['levels'] : false; $character = isset($_POST['character']) ? $_POST['character'] : false; //assume the realm is 1 (for now) $RealmId = $CURUSER->GetRealm(); if (!$character) { $ERRORS->Add("Please select a character first."); } if (!$level) { $ERRORS->Add("Please select your desired level."); } else { if (!$LevelsData->get($level)) {
exit; } $CORE->loggedInOrReturn(); //load the coin activity handler $CORE->load_CoreModule('coin.activity'); //load the characters handling class $CORE->load_ServerModule('character'); //load the log class $CORE->load_CoreModule('purchaseLog'); //load the sendmail class $CORE->load_ServerModule('commands'); $CORE->load_CoreModule('accounts.finances'); //prepare the sendmail class $command = new server_Commands(); //Setup the finances class $finance = new AccountFinances(); //prepare the log $logs = new purchaseLog(); //prepare multi errors $ERRORS->NewInstance('pStore_recustomization'); //bind the onsuccess message $ERRORS->onSuccess('Successfull character re-customization.', '/index.php?page=recustomization'); $character = isset($_POST['character']) ? $_POST['character'] : false; //assume the realm is 1 (for now) $RealmId = $CURUSER->GetRealm(); //define how much a faction change is going to cost $recustomizationPrice = 5; if (!$character) { $ERRORS->Add("Please select a character first."); } //Set the currency and price
exit; } //load the register module $CORE->load_CoreModule('accounts.finances'); $CORE->load_CoreModule('purchaseLog'); //setup new instance of multiple errors $ERRORS->NewInstance('purchase_boost'); //bind the onsuccess message $ERRORS->onSuccess('Your Boosts have been successfuly applied, please re-log.', '/index.php?page=boosts'); //Define the variables $RealmId = $CURUSER->GetRealm(); $BoostId = isset($_POST['boost']) ? (int) $_POST['boost'] : false; $currency = isset($_POST['currency']) ? (int) $_POST['currency'] : false; $DurationId = isset($_POST['duration']) ? (int) $_POST['duration'] : false; //Setup the finances class $finance = new AccountFinances(); //prepare the log $logs = new purchaseLog(); //The boosts storage $BoostsStorage = new BoostsData(); ###################################### ############### CHECKs ############### if (!$BoostId) { //no boost selected $ERRORS->Add('Please select boost first.'); } else { if (!($BoostDetails = $BoostsStorage->get($BoostId))) { //Verify the boost id $ERRORS->Add('The selected boost is invalid.'); } }