예제 #1
0
 /**
  * Register delivery method with main shop module.
  */
 protected function registerDeliveryMethod()
 {
     if (class_exists('shop')) {
         $shop = shop::getInstance();
         $shop->registerDeliveryMethod($this->name, $this);
     }
 }
예제 #2
0
 public function updateShop(UpdateShopRequest $request)
 {
     $name = $request->shop_name;
     $id = Auth::user()->user_id;
     $shops = DB::select(DB::raw("SELECT * from shops WHERE\n                   shops.user_id='{$id}'&& shop_name='{$name}' "));
     if (count($shops) > 0) {
         $data['country'] = shop::getCountryOptions();
         return view('shop/updateshop', compact('shops'))->with($data);
     } else {
         return \Redirect::back()->whith('message', 'You do not have a rigistered shop in our store!! Please create one.');
     }
 }
예제 #3
0
 protected function _gifts_filter($params, &$need_join_g2p = false)
 {
     $where = '';
     if (!empty($params['filter']['min_price']) || !empty($params['filter']['max_price'])) {
         $min_price = max(0, !empty($params['filter']['min_price']) ? (int) $params['filter']['min_price'] : 0);
         $max_price = min(1000000, !empty($params['filter']['max_price']) ? (int) $params['filter']['max_price'] : 1000000);
         $where .= " AND '{$min_price}' <= g.price AND g.price <= '{$max_price}' ";
     }
     // Фильтруем магазины по региону
     if (isset($params['filter']['region_country'])) {
         $shop = new shop();
         $shops_ids = is_array($params['filter']['region_country']) ? $shop->found_shops_ids_by_region($params['filter']['region_country'][0], $params['filter']['region_country'][1], $params['filter']['delivery_type'], $params['filter']['delivery_period']) : $shop->found_shops_ids_by_region();
         if (is_array($shops_ids) && count($shops_ids)) {
             // Если нашли не пустой список магазинов
             $need_join_g2p = true;
             $shops_ids = trim(str_replace(',,', ',', implode($shops_ids, ',')), ',');
             $where .= " AND g2p.shop_id IN ( {$shops_ids} ) ";
         }
     }
     //exclude_ids
     if (isset($params['filter']['exclude_ids']) && is_array($params['filter']['exclude_ids']) && count($params['filter']['exclude_ids'])) {
         $ids = trim(str_replace(',,', ',', implode(',', $params['filter']['exclude_ids'])), ',');
         $where .= " AND g2c.gift_id NOT IN ({$ids}) ";
     }
     if (isset($params['filter']['exclude_group_ids']) && is_array($params['filter']['exclude_group_ids']) && count($params['filter']['exclude_group_ids'])) {
         $ids = trim(str_replace(',,', ',', implode(',', $params['filter']['exclude_group_ids'])), ',');
         $where .= " AND g.group_general_id NOT IN ({$ids}) ";
     }
     if (isset($params['filter']['exclude_links']) && is_array($params['filter']['exclude_links']) && count($params['filter']['exclude_links'])) {
         $ids = trim(str_replace(',,', ',', implode(',', $params['filter']['exclude_links'])), ',');
         $where .= " AND (g2c.gift_id*10000+g2c.category_id) NOT IN ({$ids}) ";
     }
     if (isset($params['filter']['exclude_shop_ids']) && is_array($params['filter']['exclude_shop_ids']) && count($params['filter']['exclude_shop_ids'])) {
         $ids = trim(str_replace(',,', ',', implode(',', $params['filter']['exclude_shop_ids'])), ',');
         $where .= " AND g2p.shop_id NOT IN ({$ids}) ";
         $need_join_g2p = true;
     }
     return $where;
 }
예제 #4
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     global $section;
     parent::__construct(__FILE__);
     // register backend
     if (class_exists('backend')) {
         $backend = backend::getInstance();
         Events::connect('backend', 'user-create', 'handleUserCreate', $this);
         Events::connect('backend', 'user-delete', 'handleUserDelete', $this);
     }
     // connect to shop events
     if (class_exists('shop')) {
         $shop = shop::getInstance();
         Events::connect('shop', 'transaction-completed', 'handleTransactionCompleted', $this);
         Events::connect('shop', 'recurring-payment', 'handleRecurringPayment', $this);
         Events::connect('shop', 'recurring-payment-suspended', 'handleRecurringPaymentSuspended', $this);
     }
 }
예제 #5
0
 /**
  * Make new payment form with specified items and return
  * boolean stating the success of initial payment process.
  * 
  * @param array $data
  * @param array $items
  * @param string $return_url
  * @param string $cancel_url
  * @return string
  */
 public function new_payment($data, $items, $return_url, $cancel_url)
 {
     global $language;
     $description = '';
     $tmp_items = array_slice($items, 0, 5);
     $tmp_names = array();
     foreach ($tmp_items as $item) {
         $tmp_names[] = $item['name'][$language];
     }
     $description = implode(', ', $tmp_names);
     // add dots if there are more than 5 items
     if (count($items) > 5) {
         $description .= ', ...';
     }
     // get proper currency code
     $shop_module = shop::getInstance();
     $currency = $shop_module->getDefaultCurrency();
     if (array_key_exists($currency, $this->currency_aliases)) {
         $currency = $this->currency_aliases[$currency];
     }
     $currency_code = -1;
     if (array_key_exists($currency, $this->currency)) {
         $currency_code = $this->currency[$currency];
     }
     // prepare basic parameters
     $params = array('currency' => $currency_code, 'TranzilaToken' => $data['uid'], 'sum' => $data['total'] + $data['shipping'] + $data['handling'], 'cred_type' => 1, 'pdesc' => $description);
     // prepare items for checkout
     foreach ($items as $item) {
         $item = array_shift($items);
     }
     // create HTML form
     $result = '';
     foreach ($params as $key => $value) {
         $result .= "<input type=\"hidden\" name=\"{$key}\" value=\"{$value}\">";
     }
     return $result;
 }
예제 #6
0
var proftxt = new Object();
prof_ids = new Array();
profnames = new Array();
prjinprof = new Array();


<?php 
    $ilast = $i = 0;
    $lastprof = NULL;
    $j = 0;
    if ($prjs) {
        foreach ($prjs as $ikey => $prj) {
            $d_shop = $DB->row('SELECT * FROM shop WHERE portfolio_id=?i', $prj['id']);
            if ($d_shop) {
                $d_shop = shop::GetItem($d_shop['id'], get_uid(), hasPermissions('shop'));
                $prj['shop_category'] = $d_shop['category'];
                $prj['shop_cost_type'] = $d_shop['currency'];
                $prj['shop_cost'] = $d_shop['prise'];
                $prj['shop_tags'] = $d_shop['tags'];
                //$prj['shop_info'] = $d_shop['addit'];
                if ($prj['in_shop'] == 't') {
                    $prj['in_shop'] = 1;
                } else {
                    $prj['in_shop'] = 0;
                }
            } else {
                $prj['in_shop'] = 0;
                $prj['shop_category'] = '';
                $prj['shop_cost_type'] = '';
                $prj['shop_cost'] = '';
 public function add_region_to_giftsAction()
 {
     $shop = new shop();
     $shop->add_region_to_gifts();
     die('ok');
 }
예제 #8
0
파일: paypal.php 프로젝트: tareqy/Caracal
 /**
  * Handle recurring payment IPN.
  *
  * @param object $transaction
  * @param string $type
  * @param float $amount
  * @return boolean
  */
 private function handleRecurringIPN($transaction, $type, $amount)
 {
     $result = false;
     $shop = shop::getInstance();
     $plan_manager = ShopTransactionPlansManager::getInstance();
     // get plan associated with this transaction
     $plan = $plan_manager->getSingleItem($plan_manager->getFieldNames(), array('transaction' => $transaction->id));
     if (!is_object($plan)) {
         trigger_error('PayPal: Unable to handle IPN, unable to get plan for transaction: ' . $transaction->id, E_USER_WARNING);
         return $result;
     }
     // notification type to status relation
     $status = array('recurring_payment' => RecurringPayment::ACTIVE, 'recurring_payment_expired' => RecurringPayment::EXPIRED, 'recurring_payment_failed' => RecurringPayment::FAILED, 'recurring_payment_profile_created' => RecurringPayment::PENDING, 'recurring_payment_profile_cancel' => RecurringPayment::CANCELED, 'recurring_payment_skipped' => RecurringPayment::SKIPPED, 'recurring_payment_suspended' => RecurringPayment::SUSPENDED, 'recurring_payment_suspended_due_to_max_failed_payment' => RecurringPayment::SUSPENDED);
     // add new recurring payment
     $result = $shop->addRecurringPayment($plan->id, $amount, $status[$type]);
     return $result;
 }
예제 #9
0
        connect::selectDB('webdb');
        $realm = explode("*", $character_realm);
        $result = mysql_query("SELECT price FROM shopitems WHERE entry='" . $entry . "'");
        $row = mysql_fetch_assoc($result);
        $account_id = account::getAccountIDFromCharId($realm[0], $realm[1]);
        $account_name = account::getAccountName($account_id);
        if ($type == 'vote') {
            if (account::hasVP($account_name, $row['price']) == FALSE) {
                die('<b class="red_text">You do not have enough Vote Points</b>');
            }
            account::deductVP($account_id, $row['price']);
        } elseif ($type == 'donate') {
            if (account::hasDP($account_name, $row['price']) == FALSE) {
                die('<b class="red_text">You do not have enough ' . $GLOBALS['donation']['coins_name'] . '</b>');
            }
            account::deductDP($account_id, $row['price']);
        }
        shop::logItem($type, $entry, $realm[0], $account_id, $realm[1], 1);
        $result = mysql_query("SELECT * FROM realms WHERE id='" . $realm[1] . "'");
        $row = mysql_fetch_assoc($result);
        if ($row['sendType'] == 'ra') {
            require '../misc/ra.php';
            require '../classes/character.php';
            sendRa("send items " . character::getCharname($realm[0]) . " \"Your requested item\" \"Thanks for supporting us!\" " . $entry . " ", $row['rank_user'], $row['rank_pass'], $row['host'], $row['ra_port']);
        } elseif ($row['sendType'] == 'soap') {
            require '../misc/soap.php';
            require '../classes/character.php';
            sendSoap("send items " . character::getCharname($realm[0]) . " \"Your requested item\" \"Thanks for supporting us!\" " . $entry . " ", $row['rank_user'], $row['rank_pass'], $row['host'], $row['soap_port']);
        }
    }
}
예제 #10
0
 /**
  * Get available delivery types for selected items. Each type needs
  * to return estimated delivery time, cost and name of service.
  *
  * Example of items array:
  * 		$items = array(
  * 					array(
  * 						'package'		=> 0, // number identifying package
  * 						'properties'	=> array(),
  * 						'package_type'	=> 0,
  * 						'width'			=> 0.2,
  * 						'height'		=> 0.5,
  * 						'length'		=> 1,
  * 						'weight'		=> 0,
  * 						'units'			=> 1,
  * 						'count'			=> 1
  * 					)
  * 				);
  *
  * Example of shipper array:
  * 		$shipper = array(
  * 					'street'	=> array(),
  * 					'city'		=> '',
  * 					'zip_code'	=> '',
  * 					'state'		=> '',
  * 					'country'	=> ''
  * 				);
  *
  * Example of recipient array:
  * 		$recipient = array(
  * 					'street'	=> array(),
  * 					'city'		=> '',
  * 					'zip_code'	=> '',
  * 					'state'		=> '',
  * 					'country'	=> ''
  * 				);
  *
  * Example of result array:
  *		$result = array(
  *					'normal' => array('Normal', 19.95, 'USD', 1364040000, 1365040000),
  *					'express' => array('Express', 33.23, 'USD', 1363040000, 1364040000),
  *					'express_no_estimate' => array('Express', 8.00, 'USD', false, false)
  *				);
  *
  * @param array $items
  * @param array $shipper
  * @param array $recipient
  * @param string $transaction_id
  * @param string $preferred_currency
  * @return array
  */
 public function getDeliveryTypes($items, $shipper, $recipient, $transaction_id, $preferred_currency)
 {
     $shop = shop::getInstance();
     $manager = IntervalManager::getInstance();
     $time_manager = IntervalTimeManager::getInstance();
     $days = array();
     $result = array();
     // load all delivery intervals
     $intervals = $manager->getItems($manager->getFieldNames(), array());
     if (count($intervals) == 0) {
         return $result;
     }
     foreach ($intervals as $interval) {
         // get hours
         $times = $time_manager->getItems($time_manager->getFieldNames(), array('interval' => $interval->id));
         // make sure there are hours defined in this interval
         if (count($times) == 0) {
             continue;
         }
         // collect delivery hours
         for ($i = 0; $i < 7; $i++) {
             if ($interval->days[$i] == '1') {
                 if (!isset($days[$i])) {
                     $days[$i] = array();
                 }
                 foreach ($times as $time) {
                     $days[$i][] = $time;
                 }
             }
         }
     }
     // calculate shipping dates for specified number of days
     $today = mktime(0, 0, 0);
     $date_format = $this->parent->getLanguageConstant('format_date_short');
     $time_format = $this->parent->getLanguageConstant('format_time_short');
     $currency = $shop->getDefaultCurrency();
     for ($i = 0; $i < $this->days_to_show; $i++) {
         $current_date = $today + $i * (24 * 60 * 60);
         $day_of_week = (int) date('N', $current_date) - 1;
         // skip day if there are no deliveries
         if (!isset($days[$day_of_week])) {
             continue;
         }
         // add intervals
         foreach ($days[$day_of_week] as $time) {
             $start = strtotime($time->start, $current_date);
             $end = strtotime($time->end, $current_date);
             // skip past intervals
             if (time() > $start) {
                 continue;
             }
             // add new delivery date
             $key = date($date_format . ' ' . $time_format, $start);
             $result[$key] = array($this->parent->getLanguageConstant('label_' . ($day_of_week + 1)), $time->amount, $currency, $start, $end);
         }
     }
     return $result;
 }
예제 #11
0
 /**
  * Complete checkout and charge money.
  */
 public function completeCheckout()
 {
     global $language;
     $shop = shop::getInstance();
     $return_url = fix_chars($_REQUEST['return_url']);
     $recurring = isset($_REQUEST['type']) && $_REQUEST['type'] == 'recurring';
     $transaction_uid = $_SESSION['transaction']['uid'];
     // get billing information
     $billing = array();
     $fields = array('billing_full_name', 'billing_card_type', 'billing_credit_card', 'billing_expire_month', 'billing_expire_year', 'billing_cvv');
     foreach ($fields as $field) {
         if (isset($_REQUEST[$field])) {
             $billing[$field] = fix_chars($_REQUEST[$field]);
         }
     }
     // create recurring profile
     if ($recurring) {
         $request_id = 0;
         $plan_name = $_SESSION['recurring_plan'];
         $manager = PayPal_PlansManager::getInstance();
         $plan = $manager->getSingleItem($manager->getFieldNames(), array('text_id' => $plan_name));
         $current_plan = $shop->getRecurringPlan();
         // cancel existing recurring payment if exists
         if (!is_null($current_plan)) {
             $plans = $this->get_recurring_plans();
             $current_group = null;
             // get plan data
             if (isset($plans[$current_plan->plan_name])) {
                 $current_group = $plans[$current_plan->plan_name]['group'];
             }
             // cancel current plan
             if (!is_null($current_group) && $current_group == $plan->group_name) {
                 $shop->cancelTransaction($current_plan->transaction);
             }
         }
         // generate params for description
         $plan_params = array('price' => $plan->price, 'period' => $plan->interval_count, 'unit' => $plan->interval, 'setup' => $plan->setup_price, 'trial_period' => $plan->trial_count, 'trial_unit' => $plan->trial);
         // charge one time setup fee
         // TODO: Charge one time setup fee.
         // create recurring payments profile
         $recurring_fields = $fields;
         // set buyer information
         $name = explode(' ', $billing['billing_full_name']);
         $recurring_fields['CREDITCARDTYPE'] = $this->card_type[$billing['billing_card_type']];
         $recurring_fields['ACCT'] = $billing['billing_credit_card'];
         $recurring_fields['EXPDATE'] = $billing['billing_expire_month'] . $billing['billing_expire_year'];
         $recurring_fields['FIRSTNAME'] = $name[0];
         $recurring_fields['LASTNAME'] = $name[1];
         // set starting date of the profile
         $start_timestamp = strtotime($plan->start_time);
         if ($start_timestamp < time()) {
             $start_timestamp = time();
         }
         $recurring_fields['PROFILESTARTDATE'] = strftime('%Y-%m-%dT%T%z', $start_timestamp);
         // set description
         $recurring_fields['DESC'] = $shop->formatRecurring($plan_params);
         // set currency
         $recurring_fields['AMT'] = $plan->price;
         $recurring_fields['CURRENCYCODE'] = $shop->getDefaultCurrency();
         // billing period
         $recurring_fields['BILLINGPERIOD'] = $this->units[$plan->interval];
         $recurring_fields['BILLINGFREQUENCY'] = $plan->interval_count;
         // trial period
         if ($plan->trial_count > 0) {
             $recurring_fields['TRIALBILLINGPERIOD'] = $this->units[$plan->trial];
             $recurring_fields['TRIALBILLINGFREQUENCY'] = $plan->trial_count;
             $recurring_fields['TRIALTOTALBILLINGCYCLES'] = 1;
         }
         // make api call
         $response = PayPal_Helper::callAPI(PayPal_Helper::METHOD_CreateRecurringPaymentsProfile, $recurring_fields);
         if ($response['ACK'] == 'Success' || $response['ACK'] == 'SuccessWithWarning') {
             // update transaction token
             $shop->setTransactionToken($transaction_uid, fix_chars($response['PROFILEID']));
             // update transaction status
             if ($response['PROFILESTATUS'] == 'ActiveProfile') {
                 $shop->setTransactionStatus($transaction_uid, TransactionStatus::COMPLETED);
             }
         } else {
             // report error
             $error_code = urldecode($response['L_ERRORCODE0']);
             $error_long = urldecode($response['L_LONGMESSAGE0']);
             trigger_error("PayPal_Express: ({$error_code}) - {$error_long}", E_USER_ERROR);
         }
         // redirect user
         header('Location: ' . $return_url, true, 302);
     }
 }
예제 #12
0
    public function setDeliveryNumber($order_invoice_id, $id_shop)
    {
        if (!$order_invoice_id) {
            return false;
        }
        $id_shop = shop::getTotalShops() > 1 ? $id_shop : null;
        $number = Configuration::get('PS_DELIVERY_NUMBER', null, null, $id_shop);
        // If delivery slip start number has been set, you clean the value of this configuration
        if ($number) {
            Configuration::updateValue('PS_DELIVERY_NUMBER', false, false, null, $id_shop);
        }
        $sql = 'UPDATE `' . _DB_PREFIX_ . 'order_invoice` SET delivery_number =';
        if ($number) {
            $sql .= (int) $number;
        } else {
            $sql .= '(SELECT new_number FROM (SELECT (MAX(`delivery_number`) + 1) AS new_number
			FROM `' . _DB_PREFIX_ . 'order_invoice`) AS result)';
        }
        $sql .= ' WHERE `id_order_invoice` = ' . (int) $order_invoice_id;
        return Db::getInstance()->execute($sql);
    }
예제 #13
0
파일: shop.php 프로젝트: Kheros/CraftedWeb
function process_cart($cart, $charaID, $character, $accountID, $realm)
{
    if (!isset($_SESSION[$cart . 'Cart'])) {
        return;
    }
    $host = $GLOBALS['realms'][$realm]['host'];
    $rank_user = $GLOBALS['realms'][$realm]['rank_user'];
    $rank_pass = $GLOBALS['realms'][$realm]['rank_pass'];
    $ra_port = $GLOBALS['realms'][$realm]['ra_port'];
    $totalPrice = 0;
    $entrys = array_keys($_SESSION[$cart . 'Cart']);
    if (count($entrys) > 0) {
        // Array of valid items
        $items = array();
        // Generate List
        $query = "SELECT entry, price FROM shopitems WHERE in_shop = '{$cart}' AND entry IN (";
        $query .= implode(', ', $entrys);
        $query .= ")";
        if ($result = mysql_query($query)) {
            while ($row = mysql_fetch_assoc($result)) {
                $item = $_SESSION[$cart . 'Cart'][$row['entry']];
                if ($item) {
                    // Update Price
                    $item['price'] = $row['price'];
                    $item['totalPrice'] = $row['price'] * $item['quantity'];
                    $totalPrice = $totalPrice + $item['totalPrice'];
                    // Valid Item!
                    $items[$row['entry']] = $item;
                    unset($item);
                }
            }
        }
        if ($cart == 'donate' and account::hasDP($_SESSION['cw_user'], $totalPrice) == FALSE) {
            die("You do not have enough {$GLOBALS['donation']['coins_name']}!");
        } else {
            if ($cart == 'vote' and account::hasVP($_SESSION['cw_user'], $totalPrice) == FALSE) {
                die("You do not have enough Vote Points!");
            }
        }
        foreach ($items as $entry => $info) {
            $num = $info['quantity'];
            while ($num > 0) {
                $qty = $num > 12 ? 12 : $num;
                $command = "send items " . $character . " \"Your requested item\" \"Thanks for supporting us!\" " . $entry . ":" . $qty . " ";
                if ($error = sendRA($command, $rank_user, $rank_pass, $host, $ra_port)) {
                    echo 'Connection problems...Aborting | Error: ' . $error;
                    exit;
                } else {
                    shop::logItem($cart, $entry, $charaID, $accountID, $realm, $qty);
                    if ($cart == 'donate') {
                        account::deductDP($accountID, $info['price'] * $qty);
                    } else {
                        account::deductVP($accountID, $info['price'] * $qty);
                    }
                    // Update quantity incase of errors on the next loop
                    $_SESSION[$cart . 'Cart'][$entry]['quantity'] -= $qty;
                }
                $num = $num - $qty;
            }
            // All $entry have been sent
            unset($_SESSION[$cart . 'Cart'][$entry]);
        }
    }
    // Empty Cart
    unset($_SESSION[$cart . 'Cart']);
}
예제 #14
0
파일: fbgallery.php 프로젝트: hipogea/zega
 private function fullGallery()
 {
     //if there aren't images, we don't render anything
     if (!$this->imgsOrder) {
         return false;
     }
     //if is shop, go to its page to render
     if ($this->isShop) {
         shop::itemPageForShop();
     } else {
         $this->render($this->levelAccess ? 'editor/viewSortable' : '_view', array('arrItems' => $this->setItems()));
     }
 }
예제 #15
0
 /**
  * Show price for this delivery method.
  *
  * @param array $tag_params
  * @param array $children
  */
 private function show_price($tag_params, $children)
 {
     $shop = shop::getInstance();
     $template = $this->loadTemplate($tag_params, 'price.xml');
     // prepare parameters
     $params = array('price' => 10, 'currency' => $shop->getDefaultCurrency());
     // parse template
     $template->restoreXML();
     $template->setLocalParams($params);
     $template->parse();
 }
예제 #16
0
 /**
  * Get available delivery types for selected items. Each type needs
  * to return estimated delivery time, cost and name of service.
  *
  * @param array $items
  * @param array $shipper
  * @param array $recipient
  * @param string $transaction_id
  * @return array
  */
 public function getDeliveryTypes($items, $shipper, $recipient, $transaction_id, $preferred_currency)
 {
     $shop = shop::getInstance();
     $debug = $shop->isDebug();
     $result = array();
     $request = array();
     $client = new SoapClient($this->wsdl[FedEx_DeliveryMethod::RATE_SERVICE], array('trace' => $debug));
     if (empty($shipper)) {
         throw new Exception('Missing shipper information!');
     }
     if (empty($recipient)) {
         throw new Exception('Missing recipient information!');
     }
     // populate request header
     $this->_populateCredentials($request);
     $this->_populateClientDetails($request);
     $this->_populateTransactionDetails($request, $transaction_id);
     $this->_populateVersionInformation($request, FedEx_DeliveryMethod::RATE_SERVICE);
     // add remaining request information
     $request['ReturnTransitAndCommit'] = true;
     // request tranzit time and commit data
     $request['RequestedShipment'] = array('RateRequestTypes' => 'PREFERRED');
     $request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP';
     $request['RequestedShipment']['ShipTimestamp'] = date('c');
     $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING';
     $request['RequestedShipment']['PreferredCurrency'] = $preferred_currency;
     $request['RequestedShipment']['Shipper'] = array('Contact' => array(), 'Address' => array('StreetLines' => $shipper['street'], 'City' => $shipper['city'], 'PostalCode' => $shipper['zip_code'], 'StateOrProvinceCode' => $shipper['state'], 'CountryCode' => $shipper['country']));
     $request['RequestedShipment']['Recipient'] = array('Contact' => array(), 'Address' => array('StreetLines' => $recipient['street'], 'City' => $recipient['city'], 'PostalCode' => $recipient['zip_code'], 'StateOrProvinceCode' => strlen($recipient['state']) >= 2 ? '' : $recipient['state'], 'CountryCode' => $recipient['country']));
     $request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => 'SENDER', 'Payor' => array('ResponsibleParty' => array('AccountNumber' => $this->parent->settings['fedex_account'], 'CountryCode' => $shipper['country'])));
     // get package id's and count items for each package
     $packages = array();
     foreach ($items as $item) {
         $package_id = $item['package'];
         if (array_key_exists($package_id, $packages)) {
             $packages[$package_id]++;
         } else {
             $packages[$package_id] = 1;
         }
     }
     // append all the items to list
     $fedex_items = array();
     foreach ($items as $item) {
         $new_item = array('Weight' => array('Value' => $item['weight'], 'Units' => 'KG'), 'Dimensions' => array('Width' => $item['width'], 'Height' => $item['height'], 'Length' => $item['length'], 'Units' => 'CM'));
         $new_item['SequenceNumber'] = $item['package'];
         $new_item['GroupPackageCount'] = $packages[$item['package']];
         $fedex_items[] = $new_item;
     }
     $request['RequestedShipment']['PackageCount'] = count($packages);
     $request['RequestedShipment']['RequestedPackageLineItems'] = $fedex_items;
     // get response from server
     $response = $client->getRates($request);
     if (count($response->RateReplyDetails) > 0) {
         foreach ($response->RateReplyDetails as $type) {
             // extract data from response
             $id = $type->ServiceType;
             $name = $this->parent->getLanguageConstant($id);
             $timestamp = strtotime($type->DeliveryTimestamp);
             $amount = $type->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount;
             $currency = $type->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Currency;
             // add new delivery type to result
             $result[] = array(!empty($name) ? $name : $id, $amount, $currency, null, $timestamp ? $timestamp : null);
         }
     }
     return $result;
 }
예제 #17
0
파일: operations.php 프로젝트: hipogea/zega
 public function addImagesToDB($arrFiles)
 {
     $arrImgs = array();
     $arrInfo = array();
     foreach ($arrFiles as $filename) {
         $arrImgs[] = $filename;
         if (!$this->isShop) {
             $arrInfo[$filename] = array($this->lang->default => self::getPictureInfo($filename));
         } else {
             //to add info for each item loaded we use page item description
             if ($this->conf->isMultilingual) {
                 $arrLangs = array();
                 foreach ($this->lang->all as $lang) {
                     $arrLangs[$lang] = shop::getDescriptionItemShop($lang);
                 }
                 $arrInfo[$filename] = $arrLangs;
             } else {
                 $arrInfo[$filename] = array($this->lang->default => shop::getDescriptionItemShop($this->lang->default));
             }
         }
     }
     if ($this->imgsOrder) {
         $arrImgs = array_merge($this->imgsOrder, $arrImgs);
     }
     if ($this->imgsInfo) {
         $arrInfo = array_merge($this->imgsInfo, $arrInfo);
     }
     self::updateImgsOrder($arrImgs);
     self::updateImgsInfo($arrInfo);
 }
예제 #18
0
    default:
        cpmsg('no_operation', '', '', '', true, true);
        break;
}
if (!empty($opsql) && !empty($wheresql)) {
    // 如果是批量移動所屬店舖,更新店舖中的計數,需要在模型的店舖沒有變之前先更新,
    if ($_REQUEST['operation'] == "moveshop") {
        foreach ($itemarr as $v) {
            if ($mname == "album" && is_album_from_bbs($v)) {
                continue;
            }
            $old_shopid = shop::get_shopid_by_itemid($mname, $v);
            // 多選的情況下有可能轉到一個店舖中
            if ($old_shopid != $_POST['opshopid']) {
                shop::update_item_num($mname, $old_shopid, -1);
                shop::update_item_num($mname, $_POST['opshopid'], 1);
            }
        }
    }
    DB::query($opsql . ' WHERE ' . $wheresql);
    //選擇相冊移動店舖時,同時更改圖片的所屬店舖
    if ($_REQUEST['operation'] == 'moveshop' && $mname == 'album') {
        $opsql_photo = str_replace('albumitems ', 'photoitems ', $opsql);
        $wheresql_photo = str_replace(' itemid IN', ' albumid IN', $wheresql);
        DB::query($opsql_photo . ' WHERE ' . $wheresql_photo);
    }
}
if ($_REQUEST['operation'] == 'check' && !empty($items)) {
    managelog($items, $_POST['opcheck'], $_POST['check_txt']);
}
if ($mname == 'shop' && $_POST['operation'] == 'check') {
예제 #19
0
 /**
  * Charge specified amount with specified token and transaction.
  */
 public function chargeToken()
 {
     $transaction_uid = fix_chars($_REQUEST['transaction_uid']);
     $stripe_token = fix_chars($_REQUEST['stripe_token']);
     $manager = ShopTransactionsManager::getInstance();
     $currency_manager = ShopCurrenciesManager::getInstance();
     $transaction = null;
     // make sure we are working on same transaction for current user
     if (isset($_SESSION['transaction']) && $_SESSION['transaction']['uid'] == $transaction_uid) {
         $transaction = $manager->getSingleItem($manager->getFieldNames(), array('uid' => $transaction_uid));
     }
     if (is_object($transaction)) {
         $currency = $currency_manager->getSingleItem(array('currency'), array('id' => $transaction->currency));
         try {
             // create charge
             Stripe::setApiKey($this->getPrivateKey());
             $charge = Stripe_Charge::create(array('amount' => $transaction->total * 100, 'currency' => $currency->currency, 'card' => $stripe_token, 'description' => null));
         } catch (Stripe_CardError $error) {
         }
         // update transaction status
         if (is_object($charge) && $charge->paid) {
             $shop = shop::getInstance();
             $shop->setTransactionToken($transaction_uid, $charge->id);
             $shop->setTransactionStatus($transaction_uid, TransactionStatus::COMPLETED);
         }
     }
 }
예제 #20
0
 public function callbackAction()
 {
     // Убедимся что кеш выключен
     Zend_Registry::get('target')->enable_cache(0);
     // Проверим: а правильно ли пришли данные?
     $gift = new gift(@$_POST["gift_id"]);
     if (!$gift->get('id') || !isset($_POST["phone"])) {
         die(json_encode(array('msg' => 'Извините, заказ звонка не удался')));
     }
     $_POST["email"] = $_POST["email"] == 'Email' ? '' : $_POST["email"];
     //Преобразовываем номер телефона к единому виду.В номере телефона оставляем только цифры.
     $_POST["phone"] = preg_replace("/\\D/", "", $_POST["phone"]);
     // Расчитаем стоимость заказа обратного звонка
     $_POST['price_call'] = floor($_POST['gift_price'] * Zend_Registry::get('config')->callback->percent / 25) / 4;
     //Проверяем что бы цена звонка была не меньше заданой в конфиге минимальной стоимости звонка
     $_POST['price_call'] = $_POST['price_call'] >= Zend_Registry::get('config')->callback->min_price_call ? $_POST['price_call'] : Zend_Registry::get('config')->callback->min_price_call;
     $_POST['price_call'] = $_POST['price_call'] <= Zend_Registry::get('config')->callback->max_price_call ? $_POST['price_call'] : Zend_Registry::get('config')->callback->max_price_call;
     $_POST['ip'] = $_SERVER["REMOTE_ADDR"];
     $_POST['user_agent'] = $_SERVER["HTTP_USER_AGENT"];
     // Первым делом отправляем письмо юзеру - чтобы не волновался, по идее будем еще ему слать СМС
     $shops = new shop((int) $_POST['shop_id']);
     if (!empty($_POST["email"])) {
         $work_time = $shops->get('work_time');
         $et = new email_template('callback_user');
         $et->assign('USER_NAME', $_POST["name"])->assign('GIFT_NAME', $gift->get('display_name'))->assign('SHOP_NAME', $shops->get('display_name'))->assign('URL_GIFT', "http://{$_SERVER['SERVER_NAME']}/" . $gift->get('local_url') . '/?utm_source=email&utm_medium=user&utm_campaign=callback_user')->assign('WORK_TIME', !empty($work_time) ? 'Время работы магазина: <strong>' . $work_time . '</strong>' : '')->send($_POST["email"], $_POST["name"])->send('*****@*****.**');
     }
     //Записываем заказ звонка в таблицу p_stat_out в любом случае
     $stat = new stat();
     $stat_id = $stat->insert(array('gift_id' => (int) $_POST["gift_id"], 'category_id' => (int) @$_POST["category_id"], 'gift_name' => $gift->get('display_name'), 'cpc' => (double) $_POST['price_call'], 'price' => (int) $_POST['gift_price'], 'partner_id' => (int) $shops->get('partner_id'), 'ip' => $_POST["ip"], 'user_agent' => $_POST["user_agent"], 'from_url' => $gift->get('local_url'), 'to_url' => $_POST["url"], 'click_type' => 2));
     $callback = new p_callback();
     //Проверяем наличие одинаковых записей за временный интервал
     $exist_reserves = $callback->select($count, array('filter' => array('gift_id' => (int) $_POST["gift_id"], 'name' => $_POST["name"], 'phone' => $_POST["phone"], 'email' => $_POST["email"], 'interval' => Zend_Registry::get('config')->callback->interval_order)));
     if (empty($exist_reserves)) {
         //Записываем заказ звонка в таблицу p_callback
         $callback->insert(array('name' => $_POST["name"], 'phone' => $_POST["phone"], 'email' => $_POST["email"], 'stat_id' => (int) $stat_id, 'gift_id' => (int) $_POST["gift_id"], 'gift_name' => $gift->get('display_name'), 'gift_price' => (int) $_POST['gift_price'], 'shop_id' => (int) $_POST['shop_id'], 'partner_id' => (int) $shops->get('partner_id'), 'to_url' => $_POST["url"], 'price_call' => (double) $_POST['price_call'], 'ip' => $_POST["ip"], 'user_agent' => $_POST["user_agent"], 'comment' => !empty($_POST['comment']) ? $_POST['comment'] : ''));
         //Отправляем письмо партнеру
         $et = new email_template('callback');
         $et->assign('GIFT_NAME', $gift->get('display_name'))->assign('BUYER_NAME', $_POST["name"])->assign('PHONE', $_POST["phone"])->assign('EMAIL', $_POST["email"])->assign('SHOP_NAME', $shops->get('display_name'))->assign('URL_GIFT', $_POST["url"])->assign('STAT_URL', "http://{$_SERVER['SERVER_NAME']}/stat/callback/?utm_source=email&utm_medium=partner&utm_campaign=callback")->assign('COMMENT', !empty($_POST['comment']) ? $_POST['comment'] : '')->send(Zend_Registry::get('config')->server->enviroment == 'live' ? $shops->get('callback_email') : Zend_Registry::get('config')->log->error_email)->send('*****@*****.**');
     }
     die(json_encode(array('msg' => 'Заказ звонка принят, спасибо')));
 }
예제 #21
0
파일: shop.php 프로젝트: Kheros/CraftedWeb
    public function listAll($shop)
    {
        connect::selectDB('webdb');
        $shop = mysql_real_escape_string($shop);
        $result = mysql_query("SELECT entry,displayid,name,quality,price,faction,class\n\t\tFROM shopitems WHERE in_shop = '" . $shop . "'");
        if (mysql_num_rows($result) == 0) {
            echo 'No items was found in the shop.';
        } else {
            while ($row = mysql_fetch_assoc($result)) {
                $entry = $row['entry'];
                $getIcon = mysql_query("SELECT icon FROM item_icons WHERE displayid='" . $row['displayid'] . "'");
                if (mysql_num_rows($getIcon) == 0) {
                    //No icon found. Probably cataclysm item. Get the icon from wowhead instead.
                    $sxml = new SimpleXmlElement(file_get_contents('http://www.wowhead.com/item=' . $entry . '&xml'));
                    $icon = strtolower(mysql_real_escape_string($sxml->item->icon));
                    //Now that we have it loaded. Add it into database for future use.
                    //Note that WoWHead XML is extremely slow. This is the main reason why we're adding it into the db.
                    mysql_query("INSERT INTO item_icons VALUES('" . $row['displayid'] . "','" . $icon . "')");
                } else {
                    $iconrow = mysql_fetch_assoc($getIcon);
                    $icon = strtolower($iconrow['icon']);
                }
                ?>
                <div class="shopBox" id="item-<?php 
                echo $entry;
                ?>
"> 
                   <table>
                          <tr> 
                           <td>
                            <div class="iconmedium icon" rel="50818">
                                 <ins style="background-image: url('http://static.wowhead.com/images/wow/icons/medium/<?php 
                echo $icon;
                ?>
.jpg');">
                                 </ins>
                                 <del></del>
                                 </div>
                           </td>
                               <td width="380">
                               		<a href="http://<?php 
                echo $GLOBALS['tooltip_href'];
                ?>
item=<?php 
                echo $entry;
                ?>
" 
									class="<?php 
                echo $class;
                ?>
_tooltip" target="_blank">
                               			<?php 
                echo $row['name'];
                ?>
                                    </a>
                               </td>
                               <td align="right" width="350">
                               <?php 
                if ($row['faction'] == 2) {
                    echo "<span class='blue_text'>Alliance only </span>";
                    if ($row['class'] != "-1") {
                        echo "<br/>";
                    }
                } elseif ($row['faction'] == 1) {
                    echo "<span class='red_text'>Horde only </span>";
                    if ($row['class'] != "-1") {
                        echo "<br/>";
                    }
                }
                if ($row['class'] != "-1") {
                    echo shop::getClassMask($row['class']);
                }
                if (isset($_SESSION['cw_gmlevel']) && $_SESSION['cw_gmlevel'] >= 5) {
                    ?>
                             <font size="-2">
                                 ( <a onclick="editShopItem('<?php 
                    echo $entry;
                    ?>
','<?php 
                    echo $shop;
                    ?>
','<?php 
                    echo $row['price'];
                    ?>
')">Edit</a> | 
                                 <a onclick="removeShopItem('<?php 
                    echo $entry;
                    ?>
','<?php 
                    echo $shop;
                    ?>
')">Remove</a> )
                             </font>
                             &nbsp; &nbsp; &nbsp; &nbsp;   
                             <?php 
                }
                ?>
                               <font class="shopItemPrice"><?php 
                echo $row["price"];
                ?>
 
                               <?php 
                if ($shop == "donate") {
                    echo $GLOBALS['donation']['coins_name'];
                } else {
                    echo 'Vote Points';
                }
                ?>
                               </font>
                         
                       <div style="display:none;" id="status-<?php 
                echo $entry;
                ?>
" class="green_text">
                       		The item was added to your cart
                       </div>
                       </td>
                       <td>
                       		<input type="button" value="Add to cart" 
                       	    onclick="addCartItem(<?php 
                echo $entry;
                ?>
,'<?php 
                echo $shop;
                ?>
Cart',
                       		'<?php 
                echo $shop;
                ?>
',this)"> 
                       </td> 
                   </tr> 
                </table> 
            </div>
            <?php 
            }
        }
    }
예제 #22
0
 /**
  * Complete checkout and charge money.
  */
 public function completeCheckout()
 {
     global $language;
     // prepare data for new recurring profile
     $shop = shop::getInstance();
     $token = escape_chars($_REQUEST['token']);
     $payer_id = escape_chars($_REQUEST['payer_id']);
     $return_url = fix_chars($_REQUEST['return_url']);
     $recurring = isset($_REQUEST['type']) && $_REQUEST['type'] == 'recurring';
     $transaction_uid = $_SESSION['transaction']['uid'];
     // get buyer information
     $fields = array('TOKEN' => $token);
     $response = PayPal_Helper::callAPI(PayPal_Helper::METHOD_GetExpressCheckoutDetails, $fields);
     // update transaction status and buyer
     if ($response['ACK'] == 'Success' || $response['ACK'] == 'SuccessWithWarning') {
         $buyer = array('first_name' => $response['FIRSTNAME'], 'last_name' => $response['LASTNAME'], 'email' => $response['EMAIL'], 'uid' => $response['PAYERID']);
         $shop->updateBuyerInformation($transaction_uid, $buyer);
     } else {
         // report error
         $error_code = urldecode($response['L_ERRORCODE0']);
         $error_long = urldecode($response['L_LONGMESSAGE0']);
         trigger_error("PayPal_Express: ({$error_code}) - {$error_long}", E_USER_ERROR);
     }
     // create recurring profile
     if ($recurring) {
         $request_id = 0;
         $plan_name = $_SESSION['recurring_plan'];
         $manager = PayPal_PlansManager::getInstance();
         $plan = $manager->getSingleItem($manager->getFieldNames(), array('text_id' => $plan_name));
         $current_plan = $shop->getRecurringPlan();
         // cancel existing recurring payment if exists
         if (!is_null($current_plan)) {
             $plans = $this->get_recurring_plans();
             $current_group = null;
             // get plan data
             if (isset($plans[$current_plan->plan_name])) {
                 $current_group = $plans[$current_plan->plan_name]['group'];
             }
             // cancel current plan
             if (!is_null($current_group) && $current_group == $plan->group_name) {
                 $shop->cancelTransaction($current_plan->transaction);
             }
         }
         // generate params for description
         $plan_params = array('price' => $plan->price, 'period' => $plan->interval_count, 'unit' => $plan->interval, 'setup' => $plan->setup_price, 'trial_period' => $plan->trial_count, 'trial_unit' => $plan->trial);
         // charge one time setup fee
         if (is_object($plan) && $plan->setup_price > 0) {
             $setup_fields = $fields;
             $setup_fields["PAYMENTREQUEST_{$request_id}_AMT"] = $plan->setup_price;
             $setup_fields["PAYMENTREQUEST_{$request_id}_CURRENCYCODE"] = $shop->getDefaultCurrency();
             $setup_fields["PAYMENTREQUEST_{$request_id}_DESC"] = $this->parent->getLanguageConstant('api_setup_fee');
             $setup_fields["PAYMENTREQUEST_{$request_id}_INVNUM"] = $_SESSION['transaction']['uid'];
             $setup_fields["PAYMENTREQUEST_{$request_id}_PAYMENTACTION"] = 'Sale';
             $response = PayPal_Helper::callAPI(PayPal_Helper::METHOD_DoExpressCheckoutPayment, $setup_fields);
         }
         // create recurring payments profile
         $recurring_fields = $fields;
         // set starting date of the profile
         $start_timestamp = strtotime($plan->start_time);
         if ($start_timestamp < time()) {
             $start_timestamp = time();
         }
         $recurring_fields['PROFILESTARTDATE'] = strftime('%Y-%m-%dT%T%z', $start_timestamp);
         $recurring_fields['PAYERID'] = $payer_id;
         // set description
         $recurring_fields['DESC'] = $shop->formatRecurring($plan_params);
         // set currency
         $recurring_fields['AMT'] = $plan->price;
         $recurring_fields['CURRENCYCODE'] = $shop->getDefaultCurrency();
         // billing period
         $recurring_fields['BILLINGPERIOD'] = $this->units[$plan->interval];
         $recurring_fields['BILLINGFREQUENCY'] = $plan->interval_count;
         // trial period
         if ($plan->trial_count > 0) {
             $recurring_fields['TRIALBILLINGPERIOD'] = $this->units[$plan->trial];
             $recurring_fields['TRIALBILLINGFREQUENCY'] = $plan->trial_count;
             $recurring_fields['TRIALTOTALBILLINGCYCLES'] = 1;
         }
         // make api call
         $response = PayPal_Helper::callAPI(PayPal_Helper::METHOD_CreateRecurringPaymentsProfile, $recurring_fields);
         if ($response['ACK'] == 'Success' || $response['ACK'] == 'SuccessWithWarning') {
             // update transaction token
             $shop->setTransactionToken($transaction_uid, fix_chars($response['PROFILEID']));
             // update transaction status
             if ($response['PROFILESTATUS'] == 'ActiveProfile') {
                 $shop->setTransactionStatus($transaction_uid, TransactionStatus::COMPLETED);
             }
         } else {
             // report error
             $error_code = urldecode($response['L_ERRORCODE0']);
             $error_long = urldecode($response['L_LONGMESSAGE0']);
             trigger_error("PayPal_Express: ({$error_code}) - {$error_long}", E_USER_ERROR);
         }
         // redirect user
         header('Location: ' . $return_url, true, 302);
     }
 }
예제 #23
0
 function auth()
 {
     global $_G;
     $cookie = $_G['cookie']['auth'];
     if ($cookie) {
         @(list($password, $uid) = explode("\t", authcode($cookie, 'DECODE')));
         $uid = intval($uid);
         $password = addslashes($password);
         $member = DB::fetch_first('SELECT * FROM ' . tname('members') . ' WHERE uid=\'' . $uid . '\' AND password=\'' . $password . '\'');
         if ($member) {
             $_G['uid'] = $uid;
             $_G['username'] = addslashes($member['username']);
             $_G['email'] = addslashes($member['email']);
             $_G['myshopid'] = intval($member['myshopid']);
             $_G['member']['shopcount'] = 0;
             $_G['member'] = $member;
             if ($_G['myshopid'] > 0) {
                 require_once B_ROOT . "./source/class/shop.class.php";
                 $_G['myshopsarr'] = shop::ls_myshops();
                 $_G['member']['shopcount'] = count($_G['myshops']);
             }
         }
     }
     //if(!$_G['uid']) { sclearcookie(); return ;}
     if (IN_STORE === true) {
         if (pkperm('isadmin')) {
             showmessage('admin_no_perm_to_panel', 'index.php');
         } elseif ($_G['myshopid'] < 0) {
             showmessage('no_perm', 'index.php');
         } else {
             $shop_grade = $_G['myshopsarr'][$_G['myshopid']]['grade'];
             if ($shop_grade <= 1) {
                 $_G['myshopstatus'] = 'unverified';
             } elseif ($shop_grade > 1) {
                 $_G['myshopstatus'] = 'verified';
             }
         }
     }
 }
예제 #24
0
				<div class="row">
					<?php 
    echo operations::flag($language) . ' ' . CHtml::label($this->tr("newAlbumName"), 'newAlbumName', array());
    ?>
					<br />
					<?php 
    echo CHtml::textField('newAlbumName_' . $language, '', array('class' => 'inputNewAlbum'));
    ?>
				</div>
				<div class="row">
					<?php 
    echo operations::flag($language) . ' ' . CHtml::label($this->tr("newAlbumDescription"), 'newAlbumDescription', array());
    ?>
					<br />
					<?php 
    echo CHtml::textArea('newAlbumDescription_' . $language, shop::predefinedItemDescriptionShop($language), array('class' => 'inputNewAlbum descriptionNewAlbum cle', 'data-info' => ''));
    ?>
				</div>
			</div>
		<?php 
}
?>
		</div>
		<div class="tagsNewGallery clearfix">
			<div class="row">
				<?php 
echo CHtml::label($this->tr("tags"), 'newAlbumTags', array());
?>
				<?php 
echo '<div class="leftCharsTag">256</div>';
?>
예제 #25
0
                                <td>
                                            <select name="ilto" style="width: 100%">
                                            <option>--Item level to--</option>
                                            <?php 
            for ($i = $GLOBALS['maxItemLevel']; $i >= 1; $i--) {
                if ($_GET['ilto'] == $i) {
                    echo "<option selected='selected'>";
                } else {
                    echo "<option>";
                }
                echo $i . "</option>";
            }
            ?>
                                    </select>	
                                </td>
                            </tr>
        </table>
		<?php 
        }
        ?>
        </form><br/>
</center> 
<?php 
        if (isset($_GET['search'])) {
            shop::search($_GET['search_value'], $shopVar, $_GET['q'], $_GET['t'], $_GET['ilfrom'], $_GET['ilto'], $_GET['r'], $_GET['f'], $_GET['c'], $_GET['st']);
        }
    } elseif ($GLOBALS[$shopVar . 'Shop']['shopType'] == 2) {
        //List all items.
        shop::listAll($shopVar);
    }
}
예제 #26
0
         $type = $donnees3['type'];
         if ($donnees['nb_point_vote'] < $price) {
             echo "<h1 class='title'>Une erreur est survenue !</h1>";
             echo "<p id='avertisement'>Vous n'avez pas assé de points de vote !</p>";
             echo "<p><a href=\"index.php?module=boutique&action=achat&type=\">Retour</a></p>";
         } else {
             if ($type == "pieces") {
                 shop::po($quantity, $character);
             } elseif ($type == "arene") {
                 shop::pa($quantity, $character);
             } elseif ($type == "honneur") {
                 shop::ph($quantity, $character);
             } elseif ($type == "level") {
                 shop::level($quantity, $character);
             } else {
                 shop::item($iditem, $quantity, $character);
             }
             mysql_select_db($coolwow['db']);
             mysql_query("UPDATE membres SET nb_point_vote = nb_point_vote - {$price} WHERE id = '{$id_compte}'");
             mysql_query("INSERT INTO log_achat (id_item,id_membre,id_perso,date_achat,id_boutique) VALUES ('{$iditem}','{$id_compte}','{$character}','{$date}','{$id}')") or die(mysql_error());
             echo "<h1 class='title'>Merci pour votre achat</h1>\n\t\t\t\t\t\t<p>" . $price . " Points de Vote vous ont été enlevé !<br />\n\t\t\t\t\t\tMerci de votre achat et continuez a voter pour plus de bonus !</p>\n\t\t\t\t\t\t<a href=\"index.php?module=boutique\">Retour</a>";
         }
     } else {
         echo "<h1 class='title'>Une erreur est survenue, merci de prévenir l'administrateur !</h1>";
         echo "<p><a href=\"index.php?module=boutique\">Retour</a></p>";
     }
     break;
     // Defaut
 // Defaut
 default:
     echo "<p class=\"title\">Bienvenu dans la boutique</p>\n\t\t\t\t<p id=\"milieu\">\n\t\t\t\tCette page vous permez d'échanger vos points de votes contre des pièces d'or, monture ou encore des objets,<br />\n\t\t\t\tVous avez actuellement <b>" . $donnees['nb_point_vote'] . "</b> point(s)<br /></p>\n\t\t\t\t<table align=\"center\">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><a href='index.php?module=boutique&action=achat&type=pieces'><img src=\"images/boutique/or.png\" alt=\"\" /></a></td>\n\t\t\t\t\t\t<td><b>Pièces d'or</b><br />Vous avez besoin de beaucoup<br />d’or, et rapidement ?!</td>\n\t\t\t\t\t\t<td><a href='index.php?module=boutique&action=achat&type=objet'><img src=\"images/boutique/divers.png\" alt=\"\" /></a></td>\n\t\t\t\t\t\t<td><b>Objets</b><br />Achats un objets, tel que,<br />insignes, sacs et plus.</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><a href='index.php?module=boutique&action=achat&type=level'><img src=\"images/boutique/level.jpg\" alt=\"\" /></a></td>\n\t\t\t\t\t\t<td><b>Levels</b><br />Besoin de gagner des<br />niveaux rapidement ?</td>\n\t\t\t\t\t\t<td><a href='index.php?module=boutique&action=achat&type=metiers'><img src=\"images/boutique/metiers.png\" alt=\"\" /></a></td>\n\t\t\t\t\t\t<td><b>Métiers</b><br />Besoin d'une compos ?<br />c'est par ici !</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><a href='index.php?module=boutique&action=achat&type=montures'><img src=\"images/boutique/animal.png\" alt=\"\" /></a></td>\n\t\t\t\t\t\t<td><b>Montures</b><br />Envis d’avoir la plus belle<br />monture pour frimer ?</td>\n\t\t\t\t\t\t<td><a href='index.php?module=boutique&action=achat&type=arene'><img src=\"images/boutique/arene.png\" alt=\"\" /></a></td>\n\t\t\t\t\t\t<td><b>Point d'arene</b><br />Pour les besoins de<br />point d'arene ?</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><a href='index.php?module=boutique&action=achat&type=honneur'><img src=\"images/boutique/honneur.png\" alt=\"\" /></a></td>\n\t\t\t\t\t\t<td><b>Point d'honneur</b><br />Pour les besoins de<br />point d'honneur ?</td>\n\t\t\t\t\t\t<td><a href='index.php?module=boutique&action=achat&type=rename_perso'><img src=\"images/boutique/renommage.png\" alt=\"\" /></a></td>\n\t\t\t\t\t\t<td><b>Renommage</b><br />Simple pour renommer un<br />de vos personnage !</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><a href='index.php?module=boutique&action=achat_set'><img src=\"images/boutique/arene.png\" alt=\"\" /></a></td>\n\t\t\t\t\t\t<td><b>Set</b><br />Pour ce qui ont<br />de stuff !</td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t<h4 id=\"milieu\">Il n'y aura pas d'échange ou de remboursement.</h4></div>";
예제 #27
0
파일: shop.php 프로젝트: tareqy/Caracal
 /**
  * Public function that creates a single instance
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }