本文整理汇总了PHP中Encryption::encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Encryption::encrypt方法的具体用法?PHP Encryption::encrypt怎么用?PHP Encryption::encrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encryption
的用法示例。
在下文中一共展示了Encryption::encrypt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
protected function index()
{
$this->data['button_confirm'] = $this->language->get('button_confirm');
$this->data['button_back'] = $this->language->get('button_back');
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$this->data['mid'] = $this->config->get('paymate_username');
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
$this->data['return'] = HTTPS_SERVER . 'index.php?route=payment/paymate/callback&oid=' . base64_encode($encryption->encrypt($order_info['order_id'])) . '&conf=' . base64_encode($encryption->encrypt($order_info['payment_firstname'] . $order_info['payment_lastname']));
if ($this->config->get('paymate_include_order')) {
$this->data['ref'] = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8') . " (#" . $order_info['order_id'] . ")";
} else {
$this->data['ref'] = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
}
$currency = array('AUD', 'NZD', 'USD', 'EUR', 'GBP');
if (in_array(strtoupper($order_info['currency']), $currency)) {
$this->data['currency'] = $order_info['currency'];
$this->data['amt'] = $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE);
} else {
for ($findcur = 0; $findcur < sizeof($currency); $findcur++) {
if ($this->currency->getValue($currency[$findcur])) {
$this->data['currency'] = $currency[$findcur];
$this->data['amt'] = $this->currency->format($order_info['total'], $currency[$findcur], '', FALSE);
break;
} elseif ($findcur == sizeof($currency) - 1) {
$this->data['currency'] = 'AUD';
$this->data['amt'] = $order_info['total'];
}
}
}
$this->data['pmt_contact_firstname'] = html_entity_decode($order_info['payment_firstname'], ENT_QUOTES, 'UTF-8');
$this->data['pmt_contact_surname'] = html_entity_decode($order_info['payment_lastname'], ENT_QUOTES, 'UTF-8');
$this->data['pmt_contact_phone'] = $order_info['telephone'];
$this->data['pmt_sender_email'] = $order_info['email'];
$this->data['regindi_address1'] = html_entity_decode($order_info['payment_address_1'], ENT_QUOTES, 'UTF-8');
$this->data['regindi_address2'] = html_entity_decode($order_info['payment_address_2'], ENT_QUOTES, 'UTF-8');
$this->data['regindi_sub'] = html_entity_decode($order_info['payment_city'], ENT_QUOTES, 'UTF-8');
$this->data['regindi_state'] = html_entity_decode($order_info['payment_zone'], ENT_QUOTES, 'UTF-8');
$this->data['regindi_pcode'] = html_entity_decode($order_info['payment_postcode'], ENT_QUOTES, 'UTF-8');
$this->data['pmt_country'] = $order_info['iso_code_2'];
$this->data['action'] = 'https://www.paymate.com/PayMate/ExpressPayment';
$this->data['back'] = HTTPS_SERVER . 'index.php?route=checkout/payment';
$this->id = 'payment';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/paymate.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/paymate.tpl';
} else {
$this->template = 'default/template/payment/paymate.tpl';
}
$this->render();
}
示例2: index
protected function index()
{
//get the buttons at the checkout pages
$this->data['button_confirm'] = $this->language->get('button_confirm');
$this->data['button_back'] = $this->language->get('button_back');
$this->load->model('checkout/order');
//get order id
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
// etranzact requires a terminal id, get it from the settings page
$this->data['terminal_id'] = $this->config->get('etranzact_terminal_id');
//load the encryption library. good practice to encrypts values passed via GET
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
$this->data['response_url'] = HTTP_SERVER . 'index.php?route=payment/etranzact/callback&oid=' . base64_encode($encryption->encrypt($order_info['order_id'])) . '&conf=' . base64_encode($encryption->encrypt($order_info['payment_firstname'] . $order_info['payment_lastname']));
$this->data['transaction_id'] = $order_info['order_id'];
// reference
if ($this->config->get('paymate_include_order')) {
$this->data['ref'] = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8') . " (#" . $order_info['order_id'] . ")";
} else {
$this->data['ref'] = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
}
$this->data['amount'] = $order_info['total'];
//now here lets check if its a demo server
if ($this->config->get('etranzact_test')) {
$this->data['action'] = 'http://demo.etranzact.com/WebConnect/';
} else {
$this->data['action'] = 'https://www.etranzact.net/';
}
$this->data['pmt_contact_firstname'] = html_entity_decode($order_info['payment_firstname'], ENT_QUOTES, 'UTF-8');
$this->data['pmt_contact_surname'] = html_entity_decode($order_info['payment_lastname'], ENT_QUOTES, 'UTF-8');
$this->data['pmt_contact_phone'] = $order_info['telephone'];
$this->data['pmt_sender_email'] = $order_info['email'];
$this->data['regindi_address1'] = html_entity_decode($order_info['payment_address_1'], ENT_QUOTES, 'UTF-8');
$this->data['regindi_address2'] = html_entity_decode($order_info['payment_address_2'], ENT_QUOTES, 'UTF-8');
$this->data['regindi_sub'] = html_entity_decode($order_info['payment_city'], ENT_QUOTES, 'UTF-8');
$this->data['regindi_state'] = html_entity_decode($order_info['payment_zone'], ENT_QUOTES, 'UTF-8');
$this->data['regindi_pcode'] = html_entity_decode($order_info['payment_postcode'], ENT_QUOTES, 'UTF-8');
$this->data['pmt_country'] = $order_info['payment_iso_code_2'];
$this->data['back'] = HTTP_SERVER . 'index.php?route=checkout/payment';
$this->id = 'payment';
// check if etranzact template file exists
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/etranzact.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/etranzact.tpl';
} else {
$this->template = 'default/template/payment/etranzact.tpl';
}
$this->render();
}
示例3: modifyLeadsDataOnStore
/**
* Encrypt data, transmitted viaaa form, before storing into database
*/
public function modifyLeadsDataOnStore($arrPost, $arrForm, $arrFiles, $intLead, $objFields, &$arrSet)
{
if ($this->isEncryptLeadsDataActive($objFields->pid)) {
$arrSet['value'] = \Encryption::encrypt($arrSet['value']);
$arrSet['label'] = \Encryption::encrypt($arrSet['label']);
}
}
示例4: index
protected function index()
{
$this->data['button_confirm'] = $this->language->get('button_confirm');
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$this->data['action'] = 'https://www.secpay.com/java-bin/ValCard';
$this->data['merchant'] = $this->config->get('paypoint_merchant');
$this->data['trans_id'] = $this->session->data['order_id'];
$this->data['amount'] = $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value'], false);
$this->data['bill_name'] = $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname'];
$this->data['bill_addr_1'] = $order_info['payment_address_1'];
$this->data['bill_addr_2'] = $order_info['payment_address_2'];
$this->data['bill_city'] = $order_info['payment_city'];
$this->data['bill_state'] = $order_info['payment_zone'];
$this->data['bill_post_code'] = $order_info['payment_postcode'];
$this->data['bill_country'] = $order_info['payment_country'];
$this->data['bill_tel'] = $order_info['telephone'];
$this->data['bill_email'] = $order_info['email'];
if ($this->cart->hasShipping()) {
$this->data['ship_name'] = $order_info['shipping_firstname'] . ' ' . $order_info['shipping_lastname'];
$this->data['ship_addr_1'] = $order_info['shipping_address_1'];
$this->data['ship_addr_2'] = $order_info['shipping_address_2'];
$this->data['ship_city'] = $order_info['shipping_city'];
$this->data['ship_state'] = $order_info['shipping_zone'];
$this->data['ship_post_code'] = $order_info['shipping_postcode'];
$this->data['ship_country'] = $order_info['shipping_country'];
} else {
$this->data['ship_name'] = '';
$this->data['ship_addr_1'] = '';
$this->data['ship_addr_2'] = '';
$this->data['ship_city'] = '';
$this->data['ship_state'] = '';
$this->data['ship_post_code'] = '';
$this->data['ship_country'] = '';
}
$this->data['currency'] = $this->currency->getCode();
$this->data['callback'] = $this->url->link('payment/paypoint/callback');
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
$this->data['order_id'] = $encryption->encrypt($this->session->data['order_id']);
switch ($this->config->get('paypoint_test')) {
case 'live':
$status = 'live';
break;
case 'successful':
default:
$status = 'true';
break;
case 'fail':
$status = 'false';
break;
}
$this->data['options'] = 'test_status=' . $status . ',dups=false,cb_flds=order_id';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/paypoint.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/paypoint.tpl';
} else {
$this->template = 'default/template/payment/paypoint.tpl';
}
$this->render();
}
示例5: run
public function run()
{
$columnsParameters = array(array('dbField' => 'SupportDiscussionsEntity.idObjet', 'dtField' => 'objet', 'formatter' => function ($d, $row) {
return \SupportObjetsHelper::getLibelle($d);
}), array('dbField' => 'AdminsEntity.name', 'dtField' => 'compte', 'formatter' => function ($d, $row) {
if ($this->isAdmin) {
return $row["user"];
} else {
return $d;
}
}), array('dbField' => 'AccountEntityUser.login', 'dtField' => 'user'), array('dbField' => 'SupportDiscussionsEntity.date', 'dtField' => 'date', 'formatter' => function ($d, $row) {
return \DateTimeHelper::dateTimeToFormatedString($d, "d/m/Y");
}), array('dbField' => 'SupportDiscussionsEntity.dateDernierMessage', 'dtField' => 'lastMessage', 'formatter' => function ($d, $row) {
$firstDate = date("Y-m-d");
$secondDate = $d->format('Y-m-d');
if ($firstDate == $secondDate) {
return \DateTimeHelper::dateTimeToFormatedString($d, "H:i:s");
} else {
return \DateTimeHelper::dateTimeToFormatedString($d);
}
}), array('dbField' => 'SupportMessagesEntity.id', 'dtField' => 'nonLuInDiscussion', 'formatter' => function ($d, $row) {
if ($d === null) {
return "";
} else {
return "lineGreen";
}
}), array('dbField' => 'SupportDiscussionsEntity.id', 'dtField' => 'actions', 'formatter' => function ($d, $row) {
$varButton = '<a class="btn btn-material btn-primary btn-sm" onclick="DiscussionOpen(\'' . \Encryption::encrypt($d) . '\')"><i class="material-icons md-icon-message"></i></a>';
$varButton .= '<a class="btn btn-material btn-warning btn-sm" onclick="DiscussionArchivage(\'' . \Encryption::encrypt($d) . '\', 1)"><i class="material-icons md-icon-archive"></i></a>';
return '<div class="btn-toolbar">' . $varButton . "</div>";
}));
$datatable = new \DataTable();
$datatable->setColumnsParameters($columnsParameters)->setRequest($_GET)->from("\\Site\\Entity\\SupportDiscussions", "SupportDiscussionsEntity")->innerJoin("\\Site\\Entity\\Admins", "AdminsEntity", "WITH", "AdminsEntity.idCompte = SupportDiscussionsEntity.idAdmin")->leftJoin("\\Account\\Entity\\Account", "AccountEntityUser", "WITH", "AccountEntityUser.id = SupportDiscussionsEntity.idCompte")->leftJoin("\\Site\\Entity\\SupportMessages", "SupportMessagesEntity", "WITH", "SupportMessagesEntity.idDiscussion = SupportDiscussionsEntity.id AND SupportMessagesEntity.etat = " . \SupportEtatMessageHelper::NON_LU . " AND SupportMessagesEntity.idCompte != " . $this->objAccount->getId() . "")->andWhere("SupportDiscussionsEntity.idCompte = " . $this->objAccount->getId() . " OR SupportDiscussionsEntity.idAdmin = " . $this->objAccount->getId() . "")->andWhere("SupportDiscussionsEntity.estArchive = 0")->groupBy("SupportDiscussionsEntity.id");
$datatable->getResult()->toJson();
}
示例6: searchFor
/**
* {@inheritDoc}
*/
public function searchFor($strPattern)
{
// Base implementation, do a simple search on given column.
$objQuery = $this->getMetaModel()->getServiceContainer()->getDatabase()->prepare(sprintf('SELECT id FROM %s WHERE %s = ?', $this->getMetaModel()->getTableName(), $this->getColName()))->execute(\Encryption::encrypt($strPattern));
$arrIds = $objQuery->fetchEach('id');
return $arrIds;
}
示例7: add
public static function add($key, $value)
{
$encryptedValue = Encryption::encrypt($value);
if (!isset($_SESSION['encryption_store'])) {
$_SESSION['encryption_store'] = array();
}
$_SESSION['encryption_store'][$key] = $encryptedValue;
}
示例8: generateSession
public static function generateSession()
{
$id = Encryption::encrypt(str_random(32));
$cookie = Config::get('session.cookie');
setcookie(static::$name, $id, time() + $cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']);
$_COOKIE[static::$name] = $id;
static::save();
return $id;
}
示例9: reorder
protected function reorder()
{
$this->data['button_confirm'] = $this->language->get('button_reoder_confirm');
$this->data['button_back'] = $this->language->get('button_back');
$this->data['return'] = HTTPS_SERVER . 'index.php?route=account/paysuccess';
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
//$order_id=$this->request->get['order_id'];
if (isset($this->request->get['order_id'])) {
$order_id = $this->request->get['order_id'];
} else {
$order_id = $this->session->data['zb_cart_orderid'];
}
$this->data['custom'] = $encryption->encrypt($order_id);
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
$this->data['order_info'] = $order_info;
$currency_code = 'CNY';
$item_name = $this->config->get('config_title');
$first_name = $order_info['payment_firstname'];
$last_name = $order_info['payment_lastname'];
$cmdno = $this->config->get('tenpay_cmdno');
// 接口类型
$mch_type = $this->config->get('tenpay_mch_type');
// 虚拟物品还是实际物品
/* 平台商密钥 */
$key = $this->config->get('tenpay_key');
/* 平台商帐号 */
$chnid = $this->config->get('tenpay_bargainor_id');
/* 卖家 */
$seller = $this->config->get('tenpay_seller');
$total = $order_info['total'];
$currency_value = $this->currency->getValue($currency_code);
$amount = $total * $currency_value;
$amount = number_format($amount, 2, '.', '');
$charset = 2;
//编码类型 1:gbk 2:utf-8
$notify_url = HTTPS_SERVER . 'catalog/controller/payment/tenpay_callback.php';
$return_url = HTTPS_SERVER . 'index.php?route=account/paysuccess';
$data = array('bargainor_id' => $chnid, 'chnid' => $chnid, 'seller' => $seller, 'key' => $key, 'order_id' => $order_id, 'total_fee' => $amount * 100, 'store' => $item_name, 'callback' => $notify_url, 'return' => $return_url);
if ($cmdno == '12') {
// 中介担保支付
$action = $this->mediPay($data);
} else {
// 直接支付
$action = $this->pay($data);
}
$this->data['reorder'] = true;
$this->data['action'] = $action;
$this->id = 'payment';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/tenpay.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/tenpay.tpl';
} else {
$this->template = 'default/template/payment/tenpay.tpl';
}
$this->render();
}
示例10: keygen
public static function keygen($min = 10000000, $max = 999999999)
{
$key = rand($min, $max);
$key = Encryption::encrypt($key);
$key = str_replace('/', '_', $key);
$key = str_replace('+', '_', $key);
$key = str_replace('=', '_', $key);
return $key;
}
示例11: Encryption
/**
* Encrypt/Decrypt input.
* @access private
*/
function __crypt($password, $encrypt = true)
{
require_once 'include/utils/encryption.php';
$cryptobj = new Encryption();
if ($encrypt) {
return $cryptobj->encrypt(trim($password));
} else {
return $cryptobj->decrypt(trim($password));
}
}
示例12: index
protected function index()
{
$this->data['button_confirm'] = $this->language->get('button_confirm');
$this->data['button_back'] = $this->language->get('button_back');
if (!$this->config->get('pp_standard_test')) {
$this->data['action'] = 'https://www.paypal.com/cgi-bin/webscr';
} else {
$this->data['action'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
}
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$this->data['business'] = $this->config->get('pp_standard_email');
$this->data['item_name'] = html_entity_decode($this->config->get('config_store'), ENT_QUOTES, 'UTF-8');
$this->data['currency_code'] = $order_info['currency'];
$this->data['amount'] = $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE);
$this->data['first_name'] = html_entity_decode($order_info['payment_firstname'], ENT_QUOTES, 'UTF-8');
$this->data['last_name'] = html_entity_decode($order_info['payment_lastname'], ENT_QUOTES, 'UTF-8');
$this->data['address1'] = html_entity_decode($order_info['payment_address_1'], ENT_QUOTES, 'UTF-8');
$this->data['address2'] = html_entity_decode($order_info['payment_address_2'], ENT_QUOTES, 'UTF-8');
$this->data['city'] = html_entity_decode($order_info['payment_city'], ENT_QUOTES, 'UTF-8');
$this->data['zip'] = html_entity_decode($order_info['payment_postcode'], ENT_QUOTES, 'UTF-8');
$this->data['country'] = $order_info['payment_iso_code_2'];
$this->data['notify_url'] = $this->url->http('payment/pp_standard/callback');
$this->data['email'] = $order_info['email'];
$this->data['invoice'] = $this->session->data['order_id'] . ' - ' . html_entity_decode($order_info['payment_firstname'], ENT_QUOTES, 'UTF-8') . ' ' . html_entity_decode($order_info['payment_lastname'], ENT_QUOTES, 'UTF-8');
$this->data['lc'] = $this->language->getCode();
if (!$this->config->get('pp_standard_transaction')) {
$this->data['paymentaction'] = 'authorization';
} else {
$this->data['paymentaction'] = 'sale';
}
$this->data['return'] = $this->url->https('checkout/success');
if ($this->request->get['route'] != 'checkout/guest/confirm') {
$this->data['cancel_return'] = $this->url->https('checkout/payment');
} else {
$this->data['cancel_return'] = $this->url->https('checkout/guest');
}
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
$this->data['custom'] = $encryption->encrypt($this->session->data['order_id']);
if ($this->request->get['route'] != 'checkout/guest/confirm') {
$this->data['back'] = $this->url->https('checkout/payment');
} else {
$this->data['back'] = $this->url->https('checkout/guest');
}
$this->id = 'payment';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/pp_standard.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/pp_standard.tpl';
} else {
$this->template = 'default/template/payment/pp_standard.tpl';
}
$this->render();
}
示例13: index
protected function index()
{
$this->load->model('checkout/order');
$this->language->load('payment/moneybookers');
$this->data['button_confirm'] = $this->language->get('button_confirm');
$this->data['button_back'] = $this->language->get('button_back');
$this->data['action'] = 'https://www.moneybookers.com/app/payment.pl?rid=10111486';
$this->data['pay_to_email'] = $this->config->get('moneybookers_email');
$this->data['description'] = $this->config->get('config_name');
$this->data['transaction_id'] = $this->session->data['order_id'];
$this->data['return_url'] = HTTPS_SERVER . 'index.php?route=checkout/success';
if ($this->request->get['route'] != 'checkout/guest_step_3') {
$this->data['cancel_url'] = HTTPS_SERVER . 'index.php?route=checkout/payment';
} else {
$this->data['cancel_url'] = HTTPS_SERVER . 'index.php?route=checkout/guest_step_2';
}
$this->data['status_url'] = HTTPS_SERVER . 'index.php?route=payment/moneybookers/callback';
$this->data['language'] = $this->session->data['language'];
$this->data['logo'] = HTTP_IMAGE . $this->config->get('config_logo');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
$this->data['pay_from_email'] = $order_info['email'];
$this->data['firstname'] = $order_info['payment_firstname'];
$this->data['lastname'] = $order_info['payment_lastname'];
$this->data['address'] = $order_info['payment_address_1'];
$this->data['address2'] = $order_info['payment_address_2'];
$this->data['phone_number'] = $order_info['telephone'];
$this->data['postal_code'] = $order_info['payment_postcode'];
$this->data['city'] = $order_info['payment_city'];
$this->data['state'] = $order_info['payment_zone'];
$this->data['country'] = $order_info['payment_iso_code_3'];
$this->data['amount'] = $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE);
$this->data['currency'] = $order_info['currency'];
$products = '';
foreach ($this->cart->getProducts() as $product) {
$products .= $product['quantity'] . ' x ' . $product['name'] . ', ';
}
$this->data['detail1_text'] = $products;
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
$this->data['order_id'] = $encryption->encrypt($this->session->data['order_id']);
if ($this->request->get['route'] != 'checkout/guest_step_3') {
$this->data['back'] = HTTPS_SERVER . 'index.php?route=checkout/payment';
} else {
$this->data['back'] = HTTPS_SERVER . 'index.php?route=checkout/guest_step_2';
}
$this->id = 'payment';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/moneybookers.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/moneybookers.tpl';
} else {
$this->template = 'default/template/payment/moneybookers.tpl';
}
$this->render();
}
示例14: index
public function index()
{
$data['button_confirm'] = $this->language->get('button_confirm');
$data['button_back'] = $this->language->get('button_back');
$data['return'] = HTTPS_SERVER . 'index.php?route=checkout/success';
if ($this->request->get['route'] != 'checkout/guest_step_3') {
$data['cancel_return'] = HTTPS_SERVER . 'index.php?route=checkout/payment';
} else {
$data['cancel_return'] = HTTPS_SERVER . 'index.php?route=checkout/guest_step_2';
}
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
$data['custom'] = $encryption->encrypt($this->session->data['order_id']);
if ($this->request->get['route'] != 'checkout/guest_step_3') {
$data['back'] = HTTPS_SERVER . 'index.php?route=checkout/payment';
} else {
$data['back'] = HTTPS_SERVER . 'index.php?route=checkout/guest_step_2';
}
$this->load->model('checkout/order');
$order_id = $this->session->data['order_id'];
$order_info = $this->model_checkout_order->getOrder($order_id);
$seller_email = $this->config->get('alipay_seller_email');
$security_code = $this->config->get('alipay_security_code');
$trade_type = $this->config->get('alipay_trade_type');
$partner = $this->config->get('alipay_partner');
$currency_code = 'CNY';
$item_name = $this->config->get('config_name');
$full_name = $order_info['payment_fullname'];
$total = $order_info['total'];
$currency_value = $this->currency->getValue($currency_code);
$amount = $total * $currency_value;
$amount = number_format($amount, 2, '.', '');
$_input_charset = "utf-8";
$sign_type = "MD5";
$transport = "http";
$notify_url = HTTP_SERVER . 'catalog/controller/payment/alipay_callback.php';
$return_url = HTTPS_SERVER . 'index.php?route=checkout/success';
$show_url = "";
$parameter = array("service" => $trade_type, "partner" => $partner, "return_url" => $return_url, "notify_url" => $notify_url, "_input_charset" => $_input_charset, "subject" => $item_name . ' Order:' . $order_id, "body" => 'Owner ' . $full_name, "out_trade_no" => $order_id, "price" => $amount, "payment_type" => "1", "quantity" => "1", "logistics_fee" => '0.00', "logistics_payment" => 'BUYER_PAY', "logistics_type" => 'EXPRESS', "show_url" => $show_url, "seller_email" => $seller_email);
$alipay = new alipay_service($parameter, $security_code, $sign_type);
$action = $alipay->build_url();
$data['action'] = $action;
//$this->id = 'payment';
// Save payment url address for pay later.
$this->model_checkout_order->setOrderPaymentUrl($order_id, $action);
// log_result("Alipay test 111111111111");
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/alipay.tpl')) {
return $this->load->view($this->config->get('config_template') . '/template/payment/alipay.tpl', $data);
} else {
return $this->load->view('default/template/payment/alipay.tpl', $data);
}
}
示例15: setRememberMeDbAndCookie
/**
* Set the remember_me option in the database and cookie
* @param $userId
* @throws Exception
*/
public static function setRememberMeDbAndCookie($userId)
{
$database = DbFactory::getFactory()->getConnection();
// generate 64 char random string and write it to database
$randomToken = hash('sha256', mt_rand());
$sql = "UPDATE users SET user_remember_me_token = :user_remember_me_token WHERE user_id = :user_id LIMIT 1";
$query = $database->prepare($sql);
$query->execute(array(':user_remember_me_token' => $randomToken, ':user_id' => $userId));
$cookieStringFirst = Encryption::encrypt($userId) . ':' . $randomToken;
$hashString = hash('sha256', $userId . ':' . $randomToken);
$cookieString = $cookieStringFirst . ':' . $hashString;
setcookie('remember_me', $cookieString, time() + Config::get('COOKIE_RUNTIME'), Config::get('COOKIE_PATH'), Config::get('COOKIE_DOMAIN'), Config::get('COOKIE_SECURE'), Config::get('COOKIE_HTTP'));
}