当前位置: 首页>>代码示例>>PHP>>正文


PHP Validate::isLoadedObject方法代码示例

本文整理汇总了PHP中Validate::isLoadedObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::isLoadedObject方法的具体用法?PHP Validate::isLoadedObject怎么用?PHP Validate::isLoadedObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validate的用法示例。


在下文中一共展示了Validate::isLoadedObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postProcess

 /**
  * @see FrontController::postProcess()
  */
 public function postProcess()
 {
     parse_str($_POST['optData'], $optData);
     $id_cart = (int) $optData['cartId'];
     $cart = new Cart($id_cart);
     if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) {
         die('Cannot create order for this cart.');
     }
     $customer = new Customer($cart->id_customer);
     if (!Validate::isLoadedObject($customer)) {
         die('No customer for this order.');
     }
     $currency = new Currency((int) $cart->id_currency);
     $paid_amount = $_POST['amount'];
     $order_amount = $cart->getOrderTotal(true, Cart::BOTH);
     $apiHash = $_SERVER['HTTP_API_HASH'];
     $query = http_build_query($_POST);
     $hash = hash_hmac("sha512", $query, $this->module->secret_key);
     if ($apiHash == $hash && $paid_amount == $order_amount) {
         //success
         $this->module->validateOrder($cart->id, Configuration::get('PS_OS_PAYMENT'), $paid_amount, $this->module->displayName, 'Invoice Code: ' . $_POST['invoiceCode'], array(), (int) $currency->id, false, $customer->secure_key);
     } else {
         //failed transaction
     }
 }
开发者ID:inpay,项目名称:InPay-prestashop-plugin,代码行数:28,代码来源:validation.php

示例2: delete

 /**
  * @see ObjectModel::delete()
  */
 public function delete()
 {
     if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL) {
         $result = Db::getInstance()->executeS('SELECT id_product_attribute FROM ' . _DB_PREFIX_ . 'product_attribute_combination WHERE id_attribute = ' . (int) $this->id);
         $products = array();
         foreach ($result as $row) {
             $combination = new Combination($row['id_product_attribute']);
             $newRequest = Db::getInstance()->executeS('SELECT id_product, default_on FROM ' . _DB_PREFIX_ . 'product_attribute WHERE id_product_attribute = ' . (int) $row['id_product_attribute']);
             foreach ($newRequest as $value) {
                 if ($value['default_on'] == 1) {
                     $products[] = $value['id_product'];
                 }
             }
             $combination->delete();
         }
         foreach ($products as $product) {
             $result = Db::getInstance()->executeS('SELECT id_product_attribute FROM ' . _DB_PREFIX_ . 'product_attribute WHERE id_product = ' . (int) $product . ' LIMIT 1');
             foreach ($result as $row) {
                 if (Validate::isLoadedObject($product = new Product((int) $product))) {
                     $product->deleteDefaultAttributes();
                     $product->setDefaultAttribute($row['id_product_attribute']);
                 }
             }
         }
         // Delete associated restrictions on cart rules
         CartRule::cleanProductRuleIntegrity('attributes', $this->id);
         /* Reinitializing position */
         $this->cleanPositions((int) $this->id_attribute_group);
     }
     $return = parent::delete();
     if ($return) {
         Hook::exec('actionAttributeDelete', array('id_attribute' => $this->id));
     }
     return $return;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:38,代码来源:Attribute.php

示例3: initializeContext

 public function initializeContext()
 {
     global $smarty;
     // Clean all cache values
     Cache::clean('*');
     Context::getContext()->shop = new Shop(1);
     Shop::setContext(Shop::CONTEXT_SHOP, 1);
     Configuration::loadConfiguration();
     if (!isset(Context::getContext()->language) || !Validate::isLoadedObject(Context::getContext()->language)) {
         if ($id_lang = (int) Configuration::get('PS_LANG_DEFAULT')) {
             Context::getContext()->language = new Language($id_lang);
         }
     }
     if (!isset(Context::getContext()->country) || !Validate::isLoadedObject(Context::getContext()->country)) {
         if ($id_country = (int) Configuration::get('PS_COUNTRY_DEFAULT')) {
             Context::getContext()->country = new Country((int) $id_country);
         }
     }
     if (!isset(Context::getContext()->currency) || !Validate::isLoadedObject(Context::getContext()->currency)) {
         if ($id_currency = (int) Configuration::get('PS_CURRENCY_DEFAULT')) {
             Context::getContext()->currency = new Currency((int) $id_currency);
         }
     }
     Context::getContext()->cart = new Cart();
     Context::getContext()->employee = new Employee(1);
     if (!defined('_PS_SMARTY_FAST_LOAD_')) {
         define('_PS_SMARTY_FAST_LOAD_', true);
     }
     require_once _PS_ROOT_DIR_ . '/config/smarty.config.inc.php';
     Context::getContext()->smarty = $smarty;
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:31,代码来源:process.php

示例4: postProcess

 /**
  * @see FrontController::postProcess()
  */
 public function postProcess()
 {
     $cart = $this->context->cart;
     if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) {
         Tools::redirect('index.php?controller=order&step=1');
     }
     // Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
     $authorized = false;
     foreach (Module::getPaymentModules() as $module) {
         if ($module['name'] == 'bankpermata') {
             $authorized = true;
             break;
         }
     }
     if (!$authorized) {
         die($this->module->getTranslator()->trans('This payment method is not available.', array(), 'Modules.BankPermata.Shop'));
     }
     $customer = new Customer($cart->id_customer);
     if (!Validate::isLoadedObject($customer)) {
         Tools::redirect('index.php?controller=order&step=1');
     }
     $currency = $this->context->currency;
     $total = (double) $cart->getOrderTotal(true, Cart::BOTH);
     $mailVars = array('{bankpermata_owner}' => Configuration::get('BANK_PERMATA_OWNER'), '{bankpermata_details}' => nl2br(Configuration::get('BANK_PERMATA_DETAILS')), '{bankpermata_address}' => nl2br(Configuration::get('BANK_PERMATA_ADDRESS')));
     $this->module->validateOrder($cart->id, Configuration::get('PS_OS_BANKPERMATA'), $total, $this->module->displayName, NULL, $mailVars, (int) $currency->id, false, $customer->secure_key);
     Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key);
 }
开发者ID:prestanesia,项目名称:bankpermata,代码行数:30,代码来源:validation.php

示例5: changePassword

 protected function changePassword()
 {
     $token = Tools::getValue('token');
     $id_customer = (int) Tools::getValue('id_customer');
     if ($email = Db::getInstance()->getValue('SELECT `email` FROM ' . _DB_PREFIX_ . 'customer c WHERE c.`secure_key` = \'' . pSQL($token) . '\' AND c.id_customer = ' . $id_customer)) {
         $customer = new Customer();
         $customer->getByEmail($email);
         if (!Validate::isLoadedObject($customer)) {
             $this->errors[] = $this->trans('Customer account not found', array(), 'Shop.Notifications.Error');
         } elseif (!$customer->active) {
             $this->errors[] = $this->trans('You cannot regenerate the password for this account.', array(), 'Shop.Notifications.Error');
         }
         // Case if both password params not posted or different, then "change password" form is not POSTED, show it.
         if (!Tools::isSubmit('passwd') || !Tools::isSubmit('confirmation') || ($passwd = Tools::getValue('passwd')) !== ($confirmation = Tools::getValue('confirmation')) || !Validate::isPasswd($passwd) || !Validate::isPasswd($confirmation)) {
             // Check if passwords are here anyway, BUT does not match the password validation format
             if (Tools::isSubmit('passwd') || Tools::isSubmit('confirmation')) {
                 $this->errors[] = $this->trans('The password and its confirmation do not match.', array(), 'Shop.Notifications.Error');
             }
             $this->context->smarty->assign(['customer_email' => $customer->email, 'customer_token' => $token, 'id_customer' => $id_customer, 'reset_token' => Tools::getValue('reset_token')]);
             $this->setTemplate('customer/password-new');
         } else {
             // Both password fields posted. Check if all is right and store new password properly.
             if (!Tools::getValue('reset_token') || strtotime($customer->last_passwd_gen . '+' . (int) Configuration::get('PS_PASSWD_TIME_FRONT') . ' minutes') - time() > 0) {
                 Tools::redirect('index.php?controller=authentication&error_regen_pwd');
             } else {
                 // To update password, we must have the temporary reset token that matches.
                 if ($customer->getValidResetPasswordToken() !== Tools::getValue('reset_token')) {
                     $this->errors[] = $this->trans('The password change request expired. You should ask for a new one.', array(), 'Shop.Notifications.Error');
                 } else {
                     try {
                         $crypto = new Hashing();
                     } catch (\PrestaShop\PrestaShop\Adapter\CoreException $e) {
                         $this->errors[] = $this->trans('An error occurred with your account, which prevents us from updating the new password. Please report this issue using the contact form.', array(), 'Shop.Notifications.Error');
                         return false;
                     }
                     $customer->passwd = $crypto->encrypt($password = Tools::getValue('passwd'), _COOKIE_KEY_);
                     $customer->last_passwd_gen = date('Y-m-d H:i:s', time());
                     if ($customer->update()) {
                         Hook::exec('actionPasswordRenew', array('customer' => $customer, 'password' => $password));
                         $customer->removeResetPasswordToken();
                         $customer->update();
                         $mail_params = ['{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname];
                         if (Mail::Send($this->context->language->id, 'password', Mail::l('Your new password'), $mail_params, $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
                             $this->context->smarty->assign(['customer_email' => $customer->email]);
                             $this->success[] = $this->trans('Your password has been successfully reset and a confirmation has been sent to your email address: %s', array($customer->email), 'Shop.Notifications.Success');
                             $this->context->updateCustomer($customer);
                             $this->redirectWithNotifications('index.php?controller=my-account');
                         } else {
                             $this->errors[] = $this->trans('An error occurred while sending the email.', array(), 'Shop.Notifications.Error');
                         }
                     } else {
                         $this->errors[] = $this->trans('An error occurred with your account, which prevents us from updating the new password. Please report this issue using the contact form.', array(), 'Shop.Notifications.Error');
                     }
                 }
             }
         }
     } else {
         $this->errors[] = $this->trans('We cannot regenerate your password with the data you\'ve submitted', array(), 'Shop.Notifications.Error');
     }
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:60,代码来源:PasswordController.php

示例6: addTags

 /**
  * Add several tags in database and link it to a product
  *
  * @param integer $id_lang Language id
  * @param integer $id_simpleblog_post Post id to link tags with
  * @param string|array $tag_list List of tags, as array or as a string with comas
  * @return boolean Operation success
  */
 public static function addTags($id_lang, $id_simpleblog_post, $tag_list, $separator = ',')
 {
     if (!Validate::isUnsignedId($id_lang)) {
         return false;
     }
     if (!is_array($tag_list)) {
         $tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\' . $separator . '#', $tag_list, null, PREG_SPLIT_NO_EMPTY))));
     }
     $list = array();
     if (is_array($tag_list)) {
         foreach ($tag_list as $tag) {
             if (!Validate::isGenericName($tag)) {
                 return false;
             }
             $tag_obj = new SimpleBlogTag(null, $tag, (int) $id_lang);
             /* Tag does not exist in database */
             if (!Validate::isLoadedObject($tag_obj)) {
                 $tag_obj->name = $tag;
                 $tag_obj->id_lang = (int) $id_lang;
                 $tag_obj->add();
             }
             if (!in_array($tag_obj->id, $list)) {
                 $list[] = $tag_obj->id;
             }
         }
     }
     $data = '';
     foreach ($list as $tag) {
         $data .= '(' . (int) $tag . ',' . (int) $id_simpleblog_post . '),';
     }
     $data = rtrim($data, ',');
     $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'simpleblog_post_tag` (`id_simpleblog_tag`, `id_simpleblog_post`) VALUES ' . $data;
     return Db::getInstance()->execute($sql);
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:42,代码来源:SimpleBlogTag.php

示例7: validateOrder

 public function validateOrder($cart, $id_module, $id_order_status)
 {
     global $cookie;
     if (!Validate::isLoadedObject($cart)) {
         die(Tools::displayError());
     }
     $currency = new Currency((int) $cart->id_currency);
     $order = new Order();
     $order->id_cart = (int) $cart->id;
     $order->id_user = (int) $cart->id_user;
     $order->id_currency = (int) $cart->id_currency;
     $order->id_address = (int) $cart->id_address;
     $order->id_carrier = (int) $cart->id_carrier;
     $order->id_order_status = (int) $id_order_status;
     $order->id_module = (int) $id_module;
     $order->discount = floatval($cart->discount);
     $order->product_total = floatval($cart->getProductTotal());
     $order->shipping_total = floatval($cart->getShippingTotal());
     $order->amount = floatval($cart->getOrderTotal());
     $order->conversion_rate = floatval($currency->conversion_rate);
     $order->track_number = "null";
     if ($order->add()) {
         unset($cookie->id_cart);
         $this->currentOrder = $order->id;
         if ($id_order_status == 2) {
             $products = $cart->getProducts();
             foreach ($products as $row) {
                 Product::updateOrders($row['id_product']);
             }
         }
         return true;
     }
     return false;
 }
开发者ID:yiuked,项目名称:tmcart,代码行数:34,代码来源:PaymentModule.php

示例8: __construct

 public function __construct($type = false)
 {
     parent::__construct();
     // If type is sent, the cookie has to be delete
     if ($type) {
         unset($this->context->cookie->{self::$cookie_name});
         $this->setExpressCheckoutType($type);
     }
     // Store back the PayPal data if present under the cookie
     if (isset($this->context->cookie->{self::$cookie_name})) {
         $paypal = unserialize($this->context->cookie->{self::$cookie_name});
         foreach ($this->cookie_key as $key) {
             $this->{$key} = $paypal[$key];
         }
     }
     $this->currency = new Currency((int) $this->context->cart->id_currency);
     if (!Validate::isLoadedObject($this->currency)) {
         $this->_errors[] = $this->l('Not a valid currency');
     }
     if (count($this->_errors)) {
         return false;
     }
     $currency_decimals = is_array($this->currency) ? (int) $this->currency['decimals'] : (int) $this->currency->decimals;
     $this->decimals = $currency_decimals * _PS_PRICE_DISPLAY_PRECISION_;
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:25,代码来源:process.php

示例9: postProcess

 public function postProcess()
 {
     ${"GLOBALS"}["blpimnned"] = "id_order_seller";
     $dbodbxes = "id_order";
     ${${"GLOBALS"}["qusrvgm"]} = (int) Tools::getValue("id_order");
     if (!$this->context->customer->isLogged() && !Tools::getValue("secure_key")) {
         Tools::redirect("index.php?controller=authentication&back=my-account");
     }
     ${"GLOBALS"}["tvasln"] = "id_order";
     $jpdhpfqcj = "id_order";
     if (!(int) Configuration::get("PS_INVOICE")) {
         die(Tools::displayError("Invoices are disabled in this shop."));
     }
     if (isset(${${"GLOBALS"}["qusrvgm"]}) && Validate::isUnsignedId(${$dbodbxes})) {
         ${${"GLOBALS"}["ymjzko"]} = new Order(${$jpdhpfqcj});
     }
     if (!isset(${${"GLOBALS"}["ymjzko"]}) || !Validate::isLoadedObject(${${"GLOBALS"}["ymjzko"]})) {
         die(Tools::displayError("Invoice not found"));
     }
     ${${"GLOBALS"}["vewtbt"]} = AgileSellerManager::getObjectOwnerID("order", ${${"GLOBALS"}["tvasln"]});
     ${${"GLOBALS"}["sokafjqdei"]} = AgileSellerManager::getLinkedSellerID($this->context->customer->id);
     if (${${"GLOBALS"}["blpimnned"]} != ${${"GLOBALS"}["sokafjqdei"]}) {
         die(Tools::displayError("You do not have permission to see this invoice"));
     }
     if (Tools::isSubmit("secure_key") && $order->secure_key != Tools::getValue("secure_key")) {
         die(Tools::displayError("You do not have permission to see this invoice"));
     }
     if (!OrderState::invoiceAvailable($order->getCurrentState()) && !$order->invoice_number) {
         die(Tools::displayError("No invoice available"));
     }
     $this->order = ${${"GLOBALS"}["ymjzko"]};
 }
开发者ID:sho5kubota,项目名称:guidingyou2,代码行数:32,代码来源:sellerpdfinvoice.php

示例10: getModuleAssign

 public function getModuleAssign($module_name = '', $name_hook = '')
 {
     //$module_id = 7 ; $id_hook = 21 ;
     if (!$module_name || !$name_hook) {
         return;
     }
     $module = Module::getInstanceByName($module_name);
     $module_id = $module->id;
     $id_hook = Hook::getIdByName($name_hook);
     $hook_name = $name_hook;
     if (!$module) {
         return;
     }
     $module_name = $module->name;
     if (Validate::isLoadedObject($module) && $module->id) {
         $array = array();
         $array['id_hook'] = $id_hook;
         $array['module'] = $module_name;
         $array['id_module'] = $module->id;
         if (_PS_VERSION_ < "1.5") {
             return self::lofHookExec($hook_name, array(), $module->id, $array);
         } else {
             $hook_name = substr($hook_name, 7, strlen($hook_name));
             return self::renderModuleByHookV15($hook_name, array(), $module->id, $array);
         }
     }
     return '';
 }
开发者ID:IngenioContenidoDigital,项目名称:serta,代码行数:28,代码来源:Staticblock.php

示例11: install

 public function install()
 {
     /* Before creating a new tab "AdminSelfUpgrade" we need to remove any existing "AdminUpgrade" tab (present in v1.4.4.0 and v1.4.4.1) */
     if ($id_tab = Tab::getIdFromClassName('AdminUpgrade')) {
         $tab = new Tab((int) $id_tab);
         if (!$tab->delete()) {
             $this->_errors[] = sprintf($this->l('Unable to delete outdated AdminUpgrade tab %d'), (int) $id_tab);
         }
     }
     /* If the "AdminSelfUpgrade" tab does not exist yet, create it */
     if (!($id_tab = Tab::getIdFromClassName('AdminSelfUpgrade'))) {
         $tab = new Tab();
         $tab->class_name = 'AdminSelfUpgrade';
         $tab->module = 'autoupgrade';
         $tab->id_parent = (int) Tab::getIdFromClassName('AdminTools');
         foreach (Language::getLanguages(false) as $lang) {
             $tab->name[(int) $lang['id_lang']] = '1-Click Upgrade';
         }
         if (!$tab->save()) {
             return $this->_abortInstall($this->l('Unable to create the "AdminSelfUpgrade" tab'));
         }
         if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'logo.gif', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 't' . DIRECTORY_SEPARATOR . 'AdminSelfUpgrade.gif')) {
             return $this->_abortInstall(sprintf($this->l('Unable to copy logo.gif in %s'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 't' . DIRECTORY_SEPARATOR));
         }
     } else {
         $tab = new Tab((int) $id_tab);
     }
     /* Update the "AdminSelfUpgrade" tab id in database or exit */
     if (Validate::isLoadedObject($tab)) {
         Configuration::updateValue('PS_AUTOUPDATE_MODULE_IDTAB', (int) $tab->id);
     } else {
         return $this->_abortInstall($this->l('Unable to load the "AdminSelfUpgrade" tab'));
     }
     /* Check that the 1-click upgrade working directory is existing or create it */
     $autoupgrade_dir = _PS_ADMIN_DIR_ . DIRECTORY_SEPARATOR . 'autoupgrade';
     if (!file_exists($autoupgrade_dir) && !@mkdir($autoupgrade_dir, 0755)) {
         return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), $autoupgrade_dir));
     }
     /* Make sure that the 1-click upgrade working directory is writeable */
     if (!is_writable($autoupgrade_dir)) {
         return $this->_abortInstall(sprintf($this->l('Unable to write in the directory "%s"'), $autoupgrade_dir));
     }
     /* If a previous version of ajax-upgradetab.php exists, delete it */
     if (file_exists($autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) {
         @unlink($autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php');
     }
     /* Then, try to copy the newest version from the module's directory */
     if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php', $autoupgrade_dir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php')) {
         return $this->_abortInstall(sprintf($this->l('Unable to copy ajax-upgradetab.php in %s'), $autoupgrade_dir));
     }
     /* Make sure that the XML config directory exists */
     if (!file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml') && !@mkdir(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml', 0755)) {
         return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml'));
     }
     /* Create a dummy index.php file in the XML config directory to avoid directory listing */
     if (!file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'index.php') && (file_exists(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'index.php') && !@copy(_PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'index.php', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'index.php'))) {
         return $this->_abortInstall(sprintf($this->l('Unable to create the directory "%s"'), _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'xml'));
     }
     return parent::install();
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:60,代码来源:autoupgrade.php

示例12: getAuthorisation

 public function getAuthorisation()
 {
     global $cookie;
     // Getting cart informations
     $cart = new Cart(intval($cookie->id_cart));
     if (!Validate::isLoadedObject($cart)) {
         $this->_logs[] = $this->l('Not a valid cart');
     }
     $currency = new Currency(intval($cart->id_currency));
     if (!Validate::isLoadedObject($currency)) {
         $this->_logs[] = $this->l('Not a valid currency');
     }
     if (sizeof($this->_logs)) {
         return false;
     }
     // Making request
     $returnURL = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://') . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/paypalapi/express/submit.php';
     $cancelURL = (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://') . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'order.php';
     $paymentAmount = number_format(floatval($cart->getOrderTotalLC()), 2, '.', '');
     $currencyCodeType = strval($currency->iso_code);
     $paymentType = 'Sale';
     $request = '&Amt=' . urlencode($paymentAmount) . '&PAYMENTACTION=' . urlencode($paymentType) . '&ReturnUrl=' . urlencode($returnURL) . '&CANCELURL=' . urlencode($cancelURL) . '&CURRENCYCODE=' . urlencode($currencyCodeType);
     if ($this->_header) {
         $request .= '&HDRIMG=' . urlencode($this->_header);
     }
     // Calling PayPal API
     include _PS_MODULE_DIR_ . 'paypalapi/api/PaypalLib.php';
     $ppAPI = new PaypalLib();
     $result = $ppAPI->makeCall($this->getAPIURL(), $this->getAPIScript(), 'SetExpressCheckout', $request);
     $this->_logs = array_merge($this->_logs, $ppAPI->getLogs());
     return $result;
 }
开发者ID:redb,项目名称:prestashop,代码行数:32,代码来源:PaypalExpress.php

示例13: hookPayment

 public function hookPayment($params)
 {
     $cart = $params['cart'];
     $customer = new Customer((int) $cart->id_customer);
     $deliveryAddress = new Address((int) $cart->id_address_delivery);
     $country = new Country((int) $deliveryAddress->id_country);
     $currency = Currency::getCurrencyInstance($this->context->cookie->id_currency);
     if (!Validate::isLoadedObject($currency)) {
         return false;
     }
     $phone = Tools::safeOutput($deliveryAddress->phone_mobile);
     if (empty($phone)) {
         $phone = Tools::safeOutput($deliveryAddress->phone);
     }
     $public_key = Configuration::get('SIMPLEPAY_LIVE_PUBLIC_KEY');
     if ((int) Configuration::get('SIMPLEPAY_TEST_MODE')) {
         $public_key = Configuration::get('SIMPLEPAY_TEST_PUBLIC_KEY');
     }
     $this->context->smarty->assign('email', $customer->email);
     $this->context->smarty->assign('phone', $phone);
     $this->context->smarty->assign('description', Configuration::get('SIMPLEPAY_PAYMENT_DESCRIPTION') . ' #' . $cart->id);
     $this->context->smarty->assign('address', Tools::safeOutput($deliveryAddress->address1 . ' ' . $deliveryAddress->address2));
     $this->context->smarty->assign('postal_code', Tools::safeOutput($deliveryAddress->postcode));
     $this->context->smarty->assign('city', Tools::safeOutput($deliveryAddress->city));
     $this->context->smarty->assign('country', $country->iso_code);
     $this->context->smarty->assign('amount', $cart->getOrderTotal());
     $this->context->smarty->assign('currency', $currency);
     $this->context->smarty->assign('public_key', $public_key);
     $this->context->smarty->assign('module_dir', $this->_path);
     $this->context->smarty->assign('cart_id', $cart->id);
     $this->context->smarty->assign('cart_id', $cart->id);
     $this->context->smarty->assign('image', Configuration::get('SIMPLEPAY_IMAGE'));
     return $this->display(__FILE__, 'views/templates/hook/payment.tpl');
 }
开发者ID:simplepayng,项目名称:simplepay-prestashop,代码行数:34,代码来源:simplepay.php

示例14: addTags

    /**
     * Add several tags in database and link it to a product
     *
     * @param integer $id_lang Language id
     * @param integer $id_product Product id to link tags with
     * @param string $string Tags separated by commas
     *
     * @return boolean Operation success
     */
    public static function addTags($id_lang, $id_product, $string)
    {
        if (!Validate::isUnsignedId($id_lang) or Validate::isTagsList($string)) {
            Tools::displayError();
        }
        $tmpTab = array_unique(array_map('trim', explode(',', $string)));
        $list = array();
        foreach ($tmpTab as $tag) {
            if (!Validate::isGenericName($tag)) {
                return false;
            }
            $tagObj = new Tag(NULL, trim($tag), intval($id_lang));
            /* Tag does not exist in database */
            if (!Validate::isLoadedObject($tagObj)) {
                $tagObj->name = trim($tag);
                $tagObj->id_lang = intval($id_lang);
                $tagObj->add();
            }
            if (!in_array($tagObj->id, $list)) {
                $list[] = $tagObj->id;
            }
        }
        $data = '';
        foreach ($list as $tag) {
            $data .= '(' . intval($tag) . ',' . intval($id_product) . '),';
        }
        $data = rtrim($data, ',');
        if (!Validate::isValuesList($list)) {
            Tools::displayError();
        }
        return Db::getInstance()->Execute('
		INSERT INTO `' . _DB_PREFIX_ . 'product_tag` (`id_tag`, `id_product`) 
		VALUES ' . $data);
    }
开发者ID:raulgimenez,项目名称:dreamongraphics_shop,代码行数:43,代码来源:Tag.php

示例15: processOrderStep

 function processOrderStep($params)
 {
     global $cart, $smarty, $errors, $isVirtualCart, $orderTotal;
     $cart->recyclable = (isset($_POST['recyclable']) and !empty($_POST['recyclable'])) ? 1 : 0;
     if (isset($_POST['gift']) and !empty($_POST['gift'])) {
         if (!Validate::isMessage($_POST['gift_message'])) {
             $errors[] = Tools::displayError('invalid gift message');
         } else {
             $cart->gift = 1;
             $cart->gift_message = strip_tags($_POST['gift_message']);
         }
     } else {
         $cart->gift = 0;
     }
     $address = new Address(intval($cart->id_address_delivery));
     if (!Validate::isLoadedObject($address)) {
         die(Tools::displayError());
     }
     if (!($id_zone = Address::getZoneById($address->id))) {
         $errors[] = Tools::displayError('no zone match with your address');
     }
     if (isset($_POST['id_carrier']) and Validate::isInt($_POST['id_carrier']) and sizeof(Carrier::checkCarrierZone(intval($_POST['id_carrier']), intval($id_zone)))) {
         $cart->id_carrier = intval($_POST['id_carrier']);
     } elseif (!$isVirtualCart) {
         $errors[] = Tools::displayError('invalid carrier or no carrier selected');
     }
     Module::hookExec('extraCarrierDetailsProcess', array('carrier' => new Carrier($cart->id_carrier)));
     $cart->update();
 }
开发者ID:redb,项目名称:prestashop,代码行数:29,代码来源:ordercarrier.php


注:本文中的Validate::isLoadedObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。