コード例 #1
0
					$CHDB->query("UPDATE characters SET race='$newrace' ,at_login=8 ,playerBytes=1 WHERE guid='$guid'");
					$DB->query("UPDATE `voting_points` SET `points`=(`points` - ".$char_faction_points."), `points_spent`=(`points_spent` + ".$char_faction_points.") 
					WHERE id=?d",$account_id);
					echo "<font color='blue'><center>Success! Race successfully changed</center></font>";	
				} else { echo "<center>Error: Your class cant be the chosen race! Please try again.</center>"; }
			} else { echo "<center>Error: This character is online. Please try again later</center>"; }
		} else { echo "<center>Error: The admin has disabled faction changes. Please select a friendly race</center>"; }
    } else { echo "<center>Error: The new race and the original race are the same</center>"; }
} else { echo "<center>Error: Race code invalid!</center>"; }

// If the admin has faction change enabled, this code is produced instead
}else{
if ($newrace > 0 && $newrace < 12 && $newrace != 9) {
    if ($newrace != $oldrace) {
		if ($online_status == 0) {
			if (isGood($newrace,$class)) {
				if((((isAlliance($newrace) && !isAlliance($oldrace)) || (!isAlliance($newrace) && isAlliance($oldrace))) && $check_guild == 0)||((isAlliance($newrace) && isAlliance($oldrace)) || (!isAlliance($newrace) && !isAlliance($oldrace)))){
					delMounts($guid,$oldrace);
					addMounts($guid,$newrace);
					$aone = $CHDB->selectCell("SELECT `standing` FROM `character_reputation` WHERE guid='$guid' AND faction=72");
					$atwo = $CHDB->selectCell("SELECT `standing` FROM `character_reputation` WHERE guid='$guid' AND faction=47");
					$athree = $CHDB->selectCell("SELECT `standing` FROM `character_reputation` WHERE guid='$guid' AND faction=69");
					$afour = $CHDB->selectCell("SELECT `standing` FROM `character_reputation` WHERE guid='$guid' AND faction=54");
					$afive = $CHDB->selectCell("SELECT `standing` FROM `character_reputation` WHERE guid='$guid' AND faction=930");
					$hone = $CHDB->selectCell("SELECT `standing` FROM `character_reputation` WHERE guid='$guid' AND faction=76");
					$htwo = $CHDB->selectCell("SELECT `standing` FROM `character_reputation` WHERE guid='$guid' AND faction=68");
					$hthree = $CHDB->selectCell("SELECT `standing` FROM `character_reputation` WHERE guid='$guid' AND faction=81");
					$hfour = $CHDB->selectCell("SELECT `standing` FROM `character_reputation` WHERE guid='$guid' AND faction=530");
					$hfive = $CHDB->selectCell("SELECT `standing` FROM `character_reputation` WHERE guid='$guid' AND faction=911");
					// If staying the same race, change main reputaion to match new race
					$oldrepfunction = rep($oldrace);
コード例 #2
0
 function setSubscription()
 {
     global $user_ID;
     if (class_exists('WPSC_Subscription')) {
         $sub = new WPSC_Subscription($user_ID);
     }
     foreach ($this->cart_items as $itemIndex => $item) {
         if (isset($item['is_recurring']) && (int) $item['is_recurring'] > 0) {
             //If you already have a subscription then pass
             $subscription = new AuthorizeNet_Subscription();
             //If there is a predefined interval set it
             if (isGood($item['recurring_data']['rebill_interval']['unit']) && isGood($item['recurring_data']['rebill_interval']['length'])) {
                 $unit = $item['recurring_data']['rebill_interval']['unit'];
                 $length = $item['recurring_data']['rebill_interval']['length'];
                 if ($unit == 'month') {
                     $unit = 'months';
                 } elseif ($unit == 'days') {
                     $unit = 'days';
                 } elseif ($unit == 'week') {
                     $length = $length * 7;
                     $unit = 'days';
                 } elseif ($unit == 'year') {
                     $length = $length * 12;
                     $unit = 'months';
                 }
                 $subscription->intervalUnit = $unit;
                 $subscription->intervalLength = $length;
             }
             //Set rebill design
             if (isset($item['recurring_data']['charge_to_expiry']) && (int) $item['recurring_data']['charge_to_expiry'] > 0) {
                 //we bill forever, set the totalOccurences to 9999
                 $subscription->totalOccurrences = 9999;
             } elseif (isset($item['recurring_data']['times_to_rebill']) && (int) $item['recurring_data']['times_to_rebill'] > 0) {
                 //Only a specified ammount of times
                 $subscription->totalOccurrences = (int) $item['recurring_data']['times_to_rebill'];
             } else {
                 $subscription->totalOccurrences = 1;
             }
             //Always set the start date to today
             $subscription->startDate = date('Y-m-d');
             $subscription->amount = $item['price'] * $item['quantity'] + $item['tax'] + $item['shipping'];
             $amount = $subscription->amount;
             if (isGood($item['name'])) {
                 $subscription->name = $item['name'];
             }
             //Set the billing info
             if (isGood($this->cart_data['billing_address']['first_name'])) {
                 $subscription->billToFirstName = $this->cart_data['billing_address']['first_name'];
             }
             if (isGood($this->cart_data['billing_address']['last_name'])) {
                 $subscription->billToLastName = $this->cart_data['billing_address']['last_name'];
             }
             if (isGood($this->cart_data['billing_address']['address'])) {
                 $subscription->billToAddress = $this->cart_data['billing_address']['address'];
             }
             if (isGood($this->cart_data['billing_address']['city'])) {
                 $subscription->billToCity = $this->cart_data['billing_address']['city'];
             }
             if (isGood($this->cart_data['billing_address']['state'])) {
                 $subscription->billToState = $this->cart_data['billing_address']['state'];
             }
             if (isGood($this->cart_data['billing_address']['post_code'])) {
                 $subscription->billToZip = $this->cart_data['billing_address']['post_code'];
             }
             if (isGood($this->cart_data['billing_address']['country'])) {
                 $subscription->billToCountry = $this->cart_data['billing_address']['country'];
             }
             if (isGood($this->cart_data['email_address'])) {
                 $subscription->customerEmail = $this->cart_data['email_address'];
             }
             $subscription->customerId = $user_ID;
             //Trying to figure out how to set this
             //$subscription->customerPhoneNumber = $item[''];
             if (isGood($_REQUEST['payType']) && ($_REQUEST['payType'] = 'creditCardForms')) {
                 $ccInfo = $_REQUEST['auth_net']['creditCard'];
                 $subscription->creditCardCardNumber = $ccInfo['card_number'];
                 $subscription->creditCardExpirationDate = $ccInfo['expiry']['year'] . '-' . $ccInfo['expiry']['month'];
                 $subscription->creditCardCardCode = $ccInfo['card_code'];
             } elseif (isGood($_REQUEST['payType']) && ($_REQUEST['payType'] = 'checkForms')) {
                 $bInfo = $_REQUEST['auth_net']['bankAccount'];
                 $subscription->bankAccountAccountType = $bInfo['account_type'];
                 $subscription->bankAccountRoutingNumber = $bInfo['routing_number'];
                 $subscription->bankAccountAccountNumber = $bInfo['account_number'];
                 $subscription->bankAccountNameOnAccount = $bInfo['name_on_account'];
                 //$subscription->bankAccountEcheckType = "";
                 $subscription->bankAccountBankName = $bInfo['bank_name'];
             } else {
                 //TODO return if payment data is bad
             }
             $request = new AuthorizeNetARB();
             //Create a unique refid so if there are multiple subscriptions everything works out ok
             $refid = $this->cart_data['session_id'] . '-' . $item['cart_item_id'];
             $request->setRefId($refid);
             $this->response = $request->createSubscription($subscription);
             $this->response->transaction_id = $this->cart_data['session_id'];
             if ($this->response->isOk()) {
                 //This created subscription;
                 $this->response->authorization_code = $this->response->getSubscriptionId();
                 $subscriptionId = $this->response->getSubscriptionId();
                 $end = strtotime($length . ' ' . $unit);
                 $sub->saveSubscriptionMeta(array('purchase_id' => $this->purchase_id, 'producti_d' => $item['product_id'], 'ref_id' => $refid, 'subscription_id' => $this->response->getSubscriptionId(), 'startTime' => time(), 'endTime' => $end));
                 //If we setup the transaction and it worked, remove it from the cart
                 //if their are more subscriptions the foreach will catch the reset of them
                 //If there are other items non-subscription based this loop finishes and returns true
                 //THe submit function will then continue to see if it needs to do anything else.
                 unset($this->cart_items[$itemIndex]);
                 //Remove this ammount from cart_data['total_price'] & tax
                 $this->cart_data['total_price'] = $this->cart_data['total_price'] - $amount;
                 $this->cart_data['cart_tax'] = $this->cart_data['cart_tax'] - $item['tax'];
             } else {
                 //error occured, bailing back to checkout stand
                 $this->set_transaction_details($this->cart_data['session_id'], 6);
                 $this->set_error_message(__('Failed to Authorize the Subscription', 'wpsc_gold_cart'));
                 $this->return_to_checkout();
                 return false;
             }
         }
     }
     return true;
 }
コード例 #3
0
ファイル: user_profile.php プロジェクト: benhuson/Gold-Cart
    function wpec_auth_net_user_profile_display()
    {
        $myGateway = new wpec_auth_net();
        $creditcards = $myGateway->getCreditCardProfiles();
        $bankaccounts = $myGateway->getBankAccountProfiles();
        $shipaddress = $myGateway->getShippingProfiles();
        $auth_net_message = wpsc_get_customer_meta('auth_net_message');
        ?>
		<div id='wpec_auth_net_user_profile_manager'>
		<h2><?php 
        _e('Saved Credit Card, Bank and Shipping Information', 'wpsc_gold_cart');
        ?>
</h2>
		<?php 
        if (isGood($auth_net_message)) {
            ?>
			<div class='notice'><?php 
            echo $auth_net_message;
            ?>
</div>
		<?php 
            wpsc_delete_customer_meta('auth_net_message');
        }
        if ($bankaccounts) {
            ?>
		<form action="<?php 
            echo $wpec_auth_net_user_profile_url;
            ?>
" method="post">
			<div id='bankaccounts'class='sectionBox'>
			<span class="sectionHeader"><?php 
            _e("Bank Accounts You've Saved For Easy Checkout.", 'wpsc_gold_cart');
            ?>
</span>
			<div class="displayList"><?php 
            echo $bankaccounts;
            ?>
 </div>
			<input type='hidden' name='type' value='bankaccounts'>
			<input type='submit' name='submit' class='btn' value='Delete'>
			</div>
		</form>
		<?php 
        }
        ?>
		<?php 
        if ($creditcards) {
            ?>
		<form action="<?php 
            echo $wpec_auth_net_user_profile_url;
            ?>
" method="post">
			<div id='creditcards'class='sectionBox'>
			<span class="sectionHeader"><?php 
            _e("Credit Cards You've Saved For Easy Checkout.", 'wpsc_gold_cart');
            ?>
</span>
			<div class="displayList"><?php 
            echo $creditcards;
            ?>
 </div>
			<input type='hidden' name='type' value='creditcards'>
			<input type='submit' name='submit' class='btn' value='Delete'>
			</div>
		</form>
		<?php 
        }
        ?>
		<?php 
        if ($shipaddress) {
            ?>
		<form action="<?php 
            echo $wpec_auth_net_user_profile_url;
            ?>
" method="post">
			<div id='shipaddress'class='sectionBox'>
			<span class="sectionHeader"><?php 
            _e("Shipping Addresses You've Saved For Easy Checkout.", 'wpsc_gold_cart');
            ?>
</span>
			<div class="displayList"><?php 
            echo $shipaddress;
            ?>
 </div>
			<input type='hidden' name='type' value='shippingaddress'>
			<input type='submit' class='btn' name='submit' value='Delete'>
			</div>
		</form>
		<?php 
        }
        ?>
		</div>
		<?php 
    }