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(); }
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(); }
/** * 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']); } }
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(); }
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(); }
/** * {@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; }
public static function add($key, $value) { $encryptedValue = Encryption::encrypt($value); if (!isset($_SESSION['encryption_store'])) { $_SESSION['encryption_store'] = array(); } $_SESSION['encryption_store'][$key] = $encryptedValue; }
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; }
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(); }
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; }
/** * 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)); } }
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(); }
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(); }
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); } }
/** * 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')); }
public function confirm() { $this->load->library('encryption'); $encryption = new Encryption($this->config->get('config_encryption')); $order_id = $encryption->encrypt($this->session->data['order_id']); $this->load->language('payment/boleto_bb'); $this->load->model('checkout/order'); $codigo_boleto = $order_id; $comment = $this->language->get('text_instruction') . "\n\n"; $comment .= sprintf($this->language->get('text_linkboleto'), $codigo_boleto) . "\n\n"; $comment .= $this->language->get('text_payment'); $this->model_checkout_order->confirm($this->session->data['order_id'], $this->config->get('boleto_bb_order_status_id'), $comment); }
public function run() { global $request; $em = \Shared\DoctrineHelper::getEntityManager(); $idDiscussion = $request->request->get("Numero_Discussion"); $objSupportDiscussion = \Site\SiteHelper::getSupportDiscussionsRepository()->find($idDiscussion); if ($objSupportDiscussion !== null) { $objSupportDiscussion->setIdAdmin($this->objAccount->getId()); $em->persist($objSupportDiscussion); $em->flush(); echo \Encryption::encrypt($objSupportDiscussion->getId()); } else { echo "NULL"; } }
public function reorder() { $this->data['button_confirm'] = $this->language->get('button_reoder_confirm'); $this->data['button_back'] = $this->language->get('button_back'); $this->data['return'] = $this->url->link('checkout/success', '', 'SSL'); $this->load->library('encryption'); $encryption = new Encryption($this->config->get('config_encryption')); 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; $order_totals = $this->model_checkout_order->Gettotals($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'); $first_name = $order_info['payment_firstname']; $last_name = $order_info['payment_lastname']; $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_notify.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 . $this->language->get('text_order_no') . $order_id, "body" => $item_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(); $this->data['reorder'] = true; $this->data['action'] = $action; $this->id = 'payment'; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/alipay.tpl')) { $this->template = $this->config->get('config_template') . '/template/payment/alipay.tpl'; } else { $this->template = 'default/template/payment/alipay.tpl'; } $this->render(); }
public function saveConfig($password, Config $cfg) { if ($cfg->isValid()) { $asArray = $cfg->asArray(); $asArray['loaded'] = 'yes'; $json = JSON::encode($asArray); $ciphertext = Encryption::encrypt($password, $json); file_put_contents(self::$CONFIG_DECRYPTED, $json); file_put_contents(self::$CONFIG, $ciphertext); if (file_exists('/tmp_disk/price.json')) { unlink('/tmp_disk/price.json'); } } else { throw new SetupMachineException("Configuration was invalid or incomplete"); } }
/** * Set the entity defaults from dca config (for new model entry) * * @param \Model $objModel * * @return \Model The modified model, containing the default values from all dca fields */ public static function setDefaultsFromDca(\Model $objModel) { $strTable = $objModel->getTable(); \Controller::loadDataContainer($strTable); // Get all default values for the new entry foreach ($GLOBALS['TL_DCA'][$strTable]['fields'] as $k => $v) { // Use array_key_exists here (see #5252) if (array_key_exists('default', $v)) { $objModel->{$k} = is_array($v['default']) ? serialize($v['default']) : $v['default']; // Encrypt the default value (see #3740) if ($GLOBALS['TL_DCA'][$strTable]['fields'][$k]['eval']['encrypt']) { $objModel->{$k} = \Encryption::encrypt($objModel->{$k}); } } } return $objModel; }
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.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-search"></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")->andWhere("SupportDiscussionsEntity.idCompte = " . $this->objAccount->getId() . " OR SupportDiscussionsEntity.idAdmin = " . $this->objAccount->getId() . "")->andWhere("SupportDiscussionsEntity.estArchive = 1"); $datatable->getResult()->toJson(); }
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('paypal_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->load->library('encryption'); $encryption = new Encryption($this->config->get('config_encryption')); $this->data['business'] = $this->config->get('paypal_email'); $this->data['item_name'] = $this->config->get('config_store'); $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'] = $order_info['payment_firstname']; $this->data['last_name'] = $order_info['payment_lastname']; $this->data['address1'] = $order_info['payment_address_1']; $this->data['address2'] = $order_info['payment_address_2']; $this->data['city'] = $order_info['payment_city']; $this->data['zip'] = $order_info['payment_postcode']; $this->data['country'] = $order_info['payment_country']; $this->data['notify_url'] = $this->url->https('payment/paypal/callback&order_id=' . $encryption->encrypt($this->session->data['order_id'])); $this->data['email'] = $order_info['email']; $this->data['invoice'] = $this->session->data['order_id'] . ' - ' . $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname']; $this->data['lc'] = $this->language->getCode(); if (!$this->config->get('paypal_transaction')) { $this->data['paymentaction'] = 'authorization'; } else { $this->data['paymentaction'] = 'sale'; } $this->data['return'] = $this->url->https('checkout/success'); $this->data['cancel_return'] = $this->url->https('checkout/payment'); $this->data['back'] = $this->url->https('checkout/payment'); $this->id = 'payment'; $this->template = $this->config->get('config_template') . 'payment/paypal.tpl'; $this->render(); }
exit; } if (!isset($_SESSION['tickets'][$_POST['id']]['id'])) { header('Content-Type: application/json; charset=utf-8'); echo json_encode(array(0 => 'Access Denied')); exit; } $_POST['contype'] = is_numeric($_POST['contype']) ? $_POST['contype'] : exit; $_POST['website'] = trim(preg_replace('/\\s+/', '', $_POST['website'])) != '' ? trim(preg_replace('/\\s+/', '', $_POST['website'])) : ''; $_POST['user'] = trim(preg_replace('/\\s+/', '', $_POST['user']) != '') ? trim($_POST['user']) : ''; $_POST['pass'] = trim(preg_replace('/\\s+/', '', $_POST['pass']) != '') ? $_POST['pass'] : ''; if (!empty($_POST['pass'])) { include_once 'endecrypt.php'; $key = uniqid('', true); $e = new Encryption(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $_POST['pass'] = $e->encrypt($_POST['pass'], $key); } try { $DBH = new PDO("mysql:host={$Hostname};dbname={$DatabaseName}", $Username, $Password); $DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $query = "UPDATE " . $SupportTicketsTable . " SET website=?,contype=?,ftp_user=?,ftp_password=?,enc_key=? WHERE id=? LIMIT 1"; $STH = $DBH->prepare($query); $STH->bindParam(1, $_POST['website'], PDO::PARAM_STR); $STH->bindParam(2, $_POST['contype'], PDO::PARAM_STR); $STH->bindParam(3, $_POST['user'], PDO::PARAM_STR); $STH->bindParam(4, $_POST['pass'], PDO::PARAM_STR); $STH->bindParam(5, $key, PDO::PARAM_STR); $STH->bindParam(6, $_POST['id'], PDO::PARAM_INT); $STH->execute(); header('Content-Type: application/json; charset=utf-8'); echo json_encode(array(0 => 'Updated'));
/** * Duplicate all child records of a duplicated record * @param string * @param int * @param int * @param int */ protected function copyChilds($table, $insertID, $id, $parentId) { $time = time(); $copy = array(); $cctable = array(); $ctable = $GLOBALS['TL_DCA'][$table]['config']['ctable']; if (!$GLOBALS['TL_DCA'][$table]['config']['ptable'] && \Input::get('childs') != '' && $this->Database->fieldExists('pid', $table)) { $ctable[] = $table; } if (!is_array($ctable)) { return; } // Walk through each child table foreach ($ctable as $v) { $this->loadDataContainer($v); $cctable[$v] = $GLOBALS['TL_DCA'][$v]['config']['ctable']; if (!$GLOBALS['TL_DCA'][$v]['config']['doNotCopyRecords'] && strlen($v)) { $objCTable = $this->Database->prepare("SELECT * FROM " . $v . " WHERE pid=?" . ($this->Database->fieldExists('sorting', $v) ? " ORDER BY sorting" : ""))->execute($id); foreach ($objCTable->fetchAllAssoc() as $row) { // Exclude the duplicated record itself if ($v == $table && $row['id'] == $parentId) { continue; } foreach ($row as $kk => $vv) { if ($kk == 'id') { continue; } // Reset all unique, doNotCopy and fallback fields to their default value if ($GLOBALS['TL_DCA'][$v]['fields'][$kk]['eval']['unique'] || $GLOBALS['TL_DCA'][$v]['fields'][$kk]['eval']['doNotCopy'] || $GLOBALS['TL_DCA'][$v]['fields'][$kk]['eval']['fallback']) { $vv = ''; // Use array_key_exists to allow NULL (see #5252) if (array_key_exists('default', $GLOBALS['TL_DCA'][$v]['fields'][$kk])) { $vv = is_array($GLOBALS['TL_DCA'][$v]['fields'][$kk]['default']) ? serialize($GLOBALS['TL_DCA'][$v]['fields'][$kk]['default']) : $GLOBALS['TL_DCA'][$v]['fields'][$kk]['default']; } // Encrypt the default value (see #3740) if ($GLOBALS['TL_DCA'][$v]['fields'][$kk]['eval']['encrypt']) { $vv = \Encryption::encrypt($vv); } } $copy[$v][$row['id']][$kk] = $vv; } $copy[$v][$row['id']]['pid'] = $insertID; $copy[$v][$row['id']]['tstamp'] = $time; } } } // Duplicate the child records foreach ($copy as $k => $v) { if (!empty($v)) { foreach ($v as $kk => $vv) { $objInsertStmt = $this->Database->prepare("INSERT INTO " . $k . " %s")->set($vv)->execute(); if ($objInsertStmt->affectedRows && (!empty($cctable[$k]) || $GLOBALS['TL_DCA'][$k]['list']['sorting']['mode'] == 5) && $kk != $parentId) { $this->copyChilds($k, $objInsertStmt->insertId, $kk, $parentId); } } } } }
public function upload() { $this->language->load('product/product'); $json = array(); if (isset($this->request->files['file']['name']) && $this->request->files['file']['name']) { if (strlen(utf8_decode($this->request->files['file']['name'])) < 3 || strlen(utf8_decode($this->request->files['file']['name'])) > 128) { $json['error'] = $this->language->get('error_filename'); } $allowed = array(); $filetypes = explode(',', $this->config->get('config_upload_allowed')); foreach ($filetypes as $filetype) { $allowed[] = trim($filetype); } if (!in_array(substr(strrchr($this->request->files['file']['name'], '.'), 1), $allowed)) { $json['error'] = $this->language->get('error_filetype'); } if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) { $json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']); } } else { $json['error'] = $this->language->get('error_upload'); } if ($this->request->server['REQUEST_METHOD'] == 'POST' && !isset($json['error'])) { if (is_uploaded_file($this->request->files['file']['tmp_name']) && file_exists($this->request->files['file']['tmp_name'])) { $file = basename($this->request->files['file']['name']) . '.' . md5(rand()); // Hide the uploaded file name sop people can not link to it directly. $this->load->library('encryption'); $encryption = new Encryption($this->config->get('config_encryption')); $json['file'] = $encryption->encrypt($file); move_uploaded_file($this->request->files['file']['tmp_name'], DIR_DOWNLOAD . $file); } $json['success'] = $this->language->get('text_upload'); } $this->load->library('json'); $this->response->setOutput(Json::encode($json)); }
/** * Using default mcrypt Encryption with salt key * @return string */ public function testEncryptionDefaultWithSalt() { return Encryption::encrypt($this->string_encrypt, $this->salt); }
/** * Generate the module */ protected function compile() { /** @var \PageModel $objPage */ global $objPage; $this->import('FrontendUser', 'User'); $GLOBALS['TL_LANGUAGE'] = $objPage->language; \System::loadLanguageFile('tl_member'); $this->loadDataContainer('tl_member'); // Call onload_callback (e.g. to check permissions) if (is_array($GLOBALS['TL_DCA']['tl_member']['config']['onload_callback'])) { foreach ($GLOBALS['TL_DCA']['tl_member']['config']['onload_callback'] as $callback) { if (is_array($callback)) { $this->import($callback[0]); $this->{$callback[0]}->{$callback[1]}(); } elseif (is_callable($callback)) { $callback(); } } } // Set the template if ($this->memberTpl != '') { /** @var \FrontendTemplate|object $objTemplate */ $objTemplate = new \FrontendTemplate($this->memberTpl); $this->Template = $objTemplate; $this->Template->setData($this->arrData); } $this->Template->fields = ''; $this->Template->tableless = $this->tableless; $arrFields = array(); $doNotSubmit = false; $hasUpload = false; $row = 0; // Predefine the group order (other groups will be appended automatically) $arrGroups = array('personal' => array(), 'address' => array(), 'contact' => array(), 'login' => array(), 'profile' => array()); $blnModified = false; $objMember = \MemberModel::findByPk($this->User->id); $strTable = $objMember->getTable(); // Initialize the versioning (see #7415) $objVersions = new \Versions($strTable, $objMember->id); $objVersions->setUsername($objMember->username); $objVersions->setUserId(0); $objVersions->setEditUrl('contao/main.php?do=member&act=edit&id=%s&rt=1'); $objVersions->initialize(); // Build the form foreach ($this->editable as $field) { $arrData =& $GLOBALS['TL_DCA']['tl_member']['fields'][$field]; // Map checkboxWizards to regular checkbox widgets if ($arrData['inputType'] == 'checkboxWizard') { $arrData['inputType'] = 'checkbox'; } // Map fileTrees to upload widgets (see #8091) if ($arrData['inputType'] == 'fileTree') { $arrData['inputType'] = 'upload'; } /** @var \Widget $strClass */ $strClass = $GLOBALS['TL_FFL'][$arrData['inputType']]; // Continue if the class does not exist if (!$arrData['eval']['feEditable'] || !class_exists($strClass)) { continue; } $strGroup = $arrData['eval']['feGroup']; $arrData['eval']['required'] = false; $arrData['eval']['tableless'] = $this->tableless; // Use strlen() here (see #3277) if ($arrData['eval']['mandatory']) { if (is_array($this->User->{$field})) { if (empty($this->User->{$field})) { $arrData['eval']['required'] = true; } } else { if (!strlen($this->User->{$field})) { $arrData['eval']['required'] = true; } } } $varValue = $this->User->{$field}; // Call the load_callback if (isset($arrData['load_callback']) && is_array($arrData['load_callback'])) { foreach ($arrData['load_callback'] as $callback) { if (is_array($callback)) { $this->import($callback[0]); $varValue = $this->{$callback[0]}->{$callback[1]}($varValue, $this->User, $this); } elseif (is_callable($callback)) { $varValue = $callback($varValue, $this->User, $this); } } } /** @var \Widget $objWidget */ $objWidget = new $strClass($strClass::getAttributesFromDca($arrData, $field, $varValue, $field, $strTable, $this)); $objWidget->storeValues = true; $objWidget->rowClass = 'row_' . $row . ($row == 0 ? ' row_first' : '') . ($row % 2 == 0 ? ' even' : ' odd'); // Increase the row count if it is a password field if ($objWidget instanceof \FormPassword) { if ($objMember->password != '') { $objWidget->mandatory = false; } $objWidget->rowClassConfirm = 'row_' . ++$row . ($row % 2 == 0 ? ' even' : ' odd'); } // Validate the form data if (\Input::post('FORM_SUBMIT') == 'tl_member_' . $this->id) { $objWidget->validate(); $varValue = $objWidget->value; $rgxp = $arrData['eval']['rgxp']; // Convert date formats into timestamps (check the eval setting first -> #3063) if ($varValue != '' && in_array($rgxp, array('date', 'time', 'datim'))) { try { $objDate = new \Date($varValue, \Date::getFormatFromRgxp($rgxp)); $varValue = $objDate->tstamp; } catch (\OutOfBoundsException $e) { $objWidget->addError(sprintf($GLOBALS['TL_LANG']['ERR']['invalidDate'], $varValue)); } } // Make sure that unique fields are unique (check the eval setting first -> #3063) if ($arrData['eval']['unique'] && $varValue != '' && !$this->Database->isUniqueValue('tl_member', $field, $varValue, $this->User->id)) { $objWidget->addError(sprintf($GLOBALS['TL_LANG']['ERR']['unique'], $arrData['label'][0] ?: $field)); } // Trigger the save_callback (see #5247) if ($objWidget->submitInput() && !$objWidget->hasErrors() && is_array($arrData['save_callback'])) { foreach ($arrData['save_callback'] as $callback) { try { if (is_array($callback)) { $this->import($callback[0]); $varValue = $this->{$callback[0]}->{$callback[1]}($varValue, $this->User, $this); } elseif (is_callable($callback)) { $varValue = $callback($varValue, $this->User, $this); } } catch (\Exception $e) { $objWidget->class = 'error'; $objWidget->addError($e->getMessage()); } } } // Do not submit the field if there are errors if ($objWidget->hasErrors()) { $doNotSubmit = true; } elseif ($objWidget->submitInput()) { // Store the form data $_SESSION['FORM_DATA'][$field] = $varValue; // Set the correct empty value (see #6284, #6373) if ($varValue === '') { $varValue = $objWidget->getEmptyValue(); } // Encrypt the value (see #7815) if ($arrData['eval']['encrypt']) { $varValue = \Encryption::encrypt($varValue); } // Set the new value if ($varValue !== $this->User->{$field}) { $this->User->{$field} = $varValue; // Set the new field in the member model $blnModified = true; $objMember->{$field} = $varValue; } } } if ($objWidget instanceof \uploadable) { $hasUpload = true; } $temp = $objWidget->parse(); $this->Template->fields .= $temp; $arrFields[$strGroup][$field] .= $temp; ++$row; } // Save the model if ($blnModified) { $objMember->tstamp = time(); $objMember->save(); // Create a new version if ($GLOBALS['TL_DCA'][$strTable]['config']['enableVersioning']) { $objVersions->create(); $this->log('A new version of record "' . $strTable . '.id=' . $objMember->id . '" has been created' . $this->getParentEntries($strTable, $objMember->id), __METHOD__, TL_GENERAL); } } $this->Template->hasError = $doNotSubmit; // Redirect or reload if there was no error if (\Input::post('FORM_SUBMIT') == 'tl_member_' . $this->id && !$doNotSubmit) { // HOOK: updated personal data if (isset($GLOBALS['TL_HOOKS']['updatePersonalData']) && is_array($GLOBALS['TL_HOOKS']['updatePersonalData'])) { foreach ($GLOBALS['TL_HOOKS']['updatePersonalData'] as $callback) { $this->import($callback[0]); $this->{$callback[0]}->{$callback[1]}($this->User, $_SESSION['FORM_DATA'], $this); } } // Call the onsubmit_callback if (is_array($GLOBALS['TL_DCA']['tl_member']['config']['onsubmit_callback'])) { foreach ($GLOBALS['TL_DCA']['tl_member']['config']['onsubmit_callback'] as $callback) { if (is_array($callback)) { $this->import($callback[0]); $this->{$callback[0]}->{$callback[1]}($this->User, $this); } elseif (is_callable($callback)) { $callback($this->User, $this); } } } // Check whether there is a jumpTo page if (($objJumpTo = $this->objModel->getRelated('jumpTo')) !== null) { $this->jumpToOrReload($objJumpTo->row()); } \Message::addConfirmation($GLOBALS['TL_LANG']['MSC']['savedData']); $this->reload(); } $this->Template->loginDetails = $GLOBALS['TL_LANG']['tl_member']['loginDetails']; $this->Template->addressDetails = $GLOBALS['TL_LANG']['tl_member']['addressDetails']; $this->Template->contactDetails = $GLOBALS['TL_LANG']['tl_member']['contactDetails']; $this->Template->personalData = $GLOBALS['TL_LANG']['tl_member']['personalData']; // Add the groups foreach ($arrFields as $k => $v) { $this->Template->{$k} = $v; // backwards compatibility $key = $k . ($k == 'personal' ? 'Data' : 'Details'); $arrGroups[$GLOBALS['TL_LANG']['tl_member'][$key]] = $v; } $this->Template->categories = $arrGroups; $this->Template->formId = 'tl_member_' . $this->id; $this->Template->slabel = specialchars($GLOBALS['TL_LANG']['MSC']['saveData']); $this->Template->action = \Environment::get('indexFreeRequest'); $this->Template->enctype = $hasUpload ? 'multipart/form-data' : 'application/x-www-form-urlencoded'; $this->Template->rowLast = 'row_' . $row . ($row % 2 == 0 ? ' even' : ' odd'); $this->Template->message = \Message::generate(false, true); }
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'); $this->order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']); // Check for supported currency, otherwise convert to USD. $currencies = array('AUD', 'CAD', 'EUR', 'GBP', 'JPY', 'USD', 'NZD', 'CHF', 'HKD', 'SGD', 'SEK', 'DKK', 'PLN', 'NOK', 'HUF', 'CZK', 'ILS', 'MXN', 'MYR', 'BRL', 'PHP', 'PLN', 'TWD', 'THB'); if (in_array($this->order_info['currency'], $currencies)) { $currency = $this->order_info['currency']; } else { $currency = 'USD'; } // Get all totals $total = 0; $taxes = $this->cart->getTaxes(); $this->load->model('checkout/extension'); $sort_order = array(); $results = $this->model_checkout_extension->getExtensions('total'); foreach ($results as $key => $value) { $sort_order[$key] = $this->config->get($value['key'] . '_sort_order'); } array_multisort($sort_order, SORT_ASC, $results); $discount_total = 0; foreach ($results as $result) { $this->load->model('total/' . $result['key']); $old_total = $total; $this->{'model_total_' . $result['key']}->getTotal($total_data, $total, $taxes); if ($total < $old_total) { $discount_total += $old_total - $total; } } $total = $this->currency->format($total, $currency, FALSE, FALSE); $shipping_total = 0; // Create form fields $this->fields = array(); $this->data['fields']['cmd'] = '_cart'; $this->data['fields']['upload'] = '1'; if ($this->cart->hasShipping()) { $shipping_total = $this->currency->format($this->session->data['shipping_method']['cost'], $currency, FALSE, FALSE); $this->data['fields']['shipping_1'] = $shipping_total; } $tax_total = 0; foreach ($taxes as $key => $value) { $tax_total += $this->currency->format($value, $currency, FALSE, FALSE); } //$this->data['fields']['tax'] = $tax_total; $this->data['fields']['tax_cart'] = $tax_total; $product_total = 0; $i = 1; foreach ($this->cart->getProducts() as $product) { $price = $this->currency->format($product['price'], $currency, FALSE, FALSE); $this->data['fields']['item_number_' . $i . ''] = $product['model']; $this->data['fields']['item_name_' . $i . ''] = $product['name']; $this->data['fields']['amount_' . $i . ''] = $price; $this->data['fields']['quantity_' . $i . ''] = $product['quantity']; $this->data['fields']['weight_' . $i . ''] = $product['weight']; $product_total += $price * $product['quantity']; if (!empty($product['option'])) { $x = 0; foreach ($product['option'] as $res) { $this->data['fields']['on' . $x . '_' . $i . ''] = $res['name']; $this->data['fields']['os' . $x . '_' . $i . ''] = $res['value']; $x++; } } $i++; } $this->data['fields']['discount_amount_cart'] = number_format($discount_total, 2, '.', ''); $remaining_total = $total - $product_total - $tax_total - $shipping_total + $discount_total; if ($remaining_total > 0) { $this->data['fields']['handling_cart'] = number_format(abs($remaining_total), 2, '.', ''); } $this->data['fields']['business'] = $this->config->get('pp_standard_email'); $this->data['fields']['currency_code'] = $currency; $this->data['fields']['first_name'] = html_entity_decode($this->order_info['payment_firstname'], ENT_QUOTES, 'UTF-8'); $this->data['fields']['last_name'] = html_entity_decode($this->order_info['payment_lastname'], ENT_QUOTES, 'UTF-8'); $this->data['fields']['address1'] = html_entity_decode($this->order_info['payment_address_1'], ENT_QUOTES, 'UTF-8'); $this->data['fields']['address2'] = html_entity_decode($this->order_info['payment_address_2'], ENT_QUOTES, 'UTF-8'); $this->data['fields']['city'] = html_entity_decode($this->order_info['payment_city'], ENT_QUOTES, 'UTF-8'); $this->data['fields']['zip'] = html_entity_decode($this->order_info['payment_postcode'], ENT_QUOTES, 'UTF-8'); $this->data['fields']['country'] = $this->order_info['payment_iso_code_2']; $this->data['fields']['email'] = $this->order_info['email']; $this->data['fields']['invoice'] = $this->session->data['order_id'] . ' - ' . html_entity_decode($this->order_info['payment_firstname'], ENT_QUOTES, 'UTF-8') . ' ' . html_entity_decode($this->order_info['payment_lastname'], ENT_QUOTES, 'UTF-8'); $this->data['fields']['lc'] = $this->session->data['language']; $this->data['fields']['rm'] = '2'; if (!$this->config->get('pp_standard_transaction')) { $this->data['fields']['paymentaction'] = 'authorization'; } else { $this->data['fields']['paymentaction'] = 'sale'; } //$this->data['fields']['return'] = HTTPS_SERVER . 'index.php?route=checkout/success'; $this->data['fields']['return'] = HTTPS_SERVER . 'index.php?route=payment/pp_standard/pdt'; $this->data['fields']['notify_url'] = HTTP_SERVER . 'index.php?route=payment/pp_standard/callback'; if ($this->request->get['route'] != 'checkout/guest_step_3') { $this->data['fields']['cancel_return'] = HTTPS_SERVER . 'index.php?route=checkout/payment'; } else { $this->data['fields']['cancel_return'] = HTTPS_SERVER . 'index.php?route=checkout/guest_step_2'; } $this->load->library('encryption'); $encryption = new Encryption($this->config->get('config_encryption')); $this->data['fields']['custom'] = $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->data['testmode'] = $this->config->get('pp_standard_test'); $this->data['text_testmode'] = $this->language->get('text_testmode'); $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(); }
function changepassword($newpassword) { require_once 'include/utils/encryption.php'; $en_crypt = new Encryption(); if (isset($newpassword)) { $encrypted_password = $en_crypt->encrypt($newpassword); } return $encrypted_password; }
/** * Duplicate all child records of a duplicated record * * @param string $table * @param integer $insertID * @param integer $id * @param integer $parentId */ protected function copyChilds($table, $insertID, $id, $parentId) { $time = time(); $copy = array(); $cctable = array(); $ctable = $GLOBALS['TL_DCA'][$table]['config']['ctable']; if (!$GLOBALS['TL_DCA'][$table]['config']['ptable'] && strlen(\Input::get('childs')) && $this->Database->fieldExists('pid', $table) && $this->Database->fieldExists('sorting', $table)) { $ctable[] = $table; } if (!is_array($ctable)) { return; } // Walk through each child table foreach ($ctable as $v) { $this->loadDataContainer($v); $cctable[$v] = $GLOBALS['TL_DCA'][$v]['config']['ctable']; if (!$GLOBALS['TL_DCA'][$v]['config']['doNotCopyRecords'] && strlen($v)) { // Consider the dynamic parent table (see #4867) if ($GLOBALS['TL_DCA'][$v]['config']['dynamicPtable']) { $ptable = $GLOBALS['TL_DCA'][$v]['config']['ptable']; $cond = $ptable == 'tl_article' ? "(ptable=? OR ptable='')" : "ptable=?"; // backwards compatibility $objCTable = $this->Database->prepare("SELECT * FROM {$v} WHERE pid=? AND {$cond}" . ($this->Database->fieldExists('sorting', $v) ? " ORDER BY sorting" : ""))->execute($id, $ptable); } else { $objCTable = $this->Database->prepare("SELECT * FROM {$v} WHERE pid=?" . ($this->Database->fieldExists('sorting', $v) ? " ORDER BY sorting" : ""))->execute($id); } while ($objCTable->next()) { // Exclude the duplicated record itself if ($v == $table && $objCTable->id == $parentId) { continue; } foreach ($objCTable->row() as $kk => $vv) { if ($kk == 'id') { continue; } // Never copy passwords if ($GLOBALS['TL_DCA'][$v]['fields'][$kk]['inputType'] == 'password') { $vv = \Widget::getEmptyValueByFieldType($GLOBALS['TL_DCA'][$v]['fields'][$kk]['sql']); } elseif ($GLOBALS['TL_DCA'][$v]['fields'][$kk]['eval']['unique']) { $vv = \Input::get('act') == 'copyAll' ? $vv . '-' . substr(md5(uniqid(mt_rand(), true)), 0, 8) : \Widget::getEmptyValueByFieldType($GLOBALS['TL_DCA'][$v]['fields'][$kk]['sql']); } elseif ($GLOBALS['TL_DCA'][$v]['fields'][$kk]['eval']['doNotCopy'] || $GLOBALS['TL_DCA'][$v]['fields'][$kk]['eval']['fallback']) { $vv = ''; // Use array_key_exists to allow NULL (see #5252) if (array_key_exists('default', $GLOBALS['TL_DCA'][$v]['fields'][$kk])) { $vv = is_array($GLOBALS['TL_DCA'][$v]['fields'][$kk]['default']) ? serialize($GLOBALS['TL_DCA'][$v]['fields'][$kk]['default']) : $GLOBALS['TL_DCA'][$v]['fields'][$kk]['default']; } // Encrypt the default value (see #3740) if ($GLOBALS['TL_DCA'][$v]['fields'][$kk]['eval']['encrypt']) { $vv = \Encryption::encrypt($vv); } } $copy[$v][$objCTable->id][$kk] = $vv; } $copy[$v][$objCTable->id]['pid'] = $insertID; $copy[$v][$objCTable->id]['tstamp'] = $time; } } } // Duplicate the child records foreach ($copy as $k => $v) { if (!empty($v)) { foreach ($v as $kk => $vv) { $objInsertStmt = $this->Database->prepare("INSERT INTO " . $k . " %s")->set($vv)->execute(); if ($objInsertStmt->affectedRows) { $insertID = $objInsertStmt->insertId; if ((!empty($cctable[$k]) || $GLOBALS['TL_DCA'][$k]['list']['sorting']['mode'] == 5) && $kk != $parentId) { $this->copyChilds($k, $insertID, $kk, $parentId); } } } } } }