Esempio n. 1
0
 function _process()
 {
     global $osC_MessageStack, $osC_Database, $osC_Language;
     $Qcheck = $osC_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1');
     $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcheck->bindValue(':customers_email_address', $_POST['email_address']);
     $Qcheck->execute();
     if ($Qcheck->numberOfRows() === 1) {
         $password = osc_create_random_string(ACCOUNT_PASSWORD);
         if (osC_Account::savePassword($password, $Qcheck->valueInt('customers_id'))) {
             if (ACCOUNT_GENDER > -1) {
                 if ($data['gender'] == 'm') {
                     $email_text = sprintf($osC_Language->get('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
                 } else {
                     $email_text = sprintf($osC_Language->get('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
                 }
             } else {
                 $email_text = sprintf($osC_Language->get('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n";
             }
             $email_text .= sprintf($osC_Language->get('email_password_reminder_body'), getenv('REMOTE_ADDR'), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS);
             osc_email($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), sprintf($osC_Language->get('email_password_reminder_subject'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
             $osC_MessageStack->add('login', $osC_Language->get('success_password_forgotten_sent'), 'success');
         }
         osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
     } else {
         $osC_MessageStack->add('password_forgotten', $osC_Language->get('error_password_forgotten_no_email_address_found'));
     }
 }
Esempio n. 2
0
 public static function execute(ApplicationAbstract $application)
 {
     $OSCOM_Database = Registry::get('Database');
     $OSCOM_MessageStack = Registry::get('MessageStack');
     $Qcheck = $OSCOM_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1');
     $Qcheck->bindValue(':customers_email_address', $_POST['email_address']);
     $Qcheck->execute();
     if ($Qcheck->numberOfRows() === 1) {
         $password = osc_create_random_string(ACCOUNT_PASSWORD);
         if (Account::savePassword($password, $Qcheck->valueInt('customers_id'))) {
             if (ACCOUNT_GENDER > -1) {
                 if ($Qcheck->value('customers_gender') == 'm') {
                     $email_text = sprintf(OSCOM::getDef('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
                 } else {
                     $email_text = sprintf(OSCOM::getDef('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n";
                 }
             } else {
                 $email_text = sprintf(OSCOM::getDef('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n";
             }
             $email_text .= sprintf(OSCOM::getDef('email_password_reminder_body'), osc_get_ip_address(), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS);
             osc_email($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), sprintf(OSCOM::getDef('email_password_reminder_subject'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
             $OSCOM_MessageStack->add('LogIn', OSCOM::getDef('success_password_forgotten_sent'), 'success');
         }
         osc_redirect(OSCOM::getLink(null, null, 'LogIn', 'SSL'));
     } else {
         $OSCOM_MessageStack->add('PasswordForgotten', OSCOM::getDef('error_password_forgotten_no_email_address_found'));
     }
 }
 function _process()
 {
     global $messageStack, $osC_Database, $osC_Language;
     $Qcheck = $osC_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1');
     $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS);
     $Qcheck->bindValue(':customers_email_address', $_POST['email_address']);
     $Qcheck->execute();
     if ($Qcheck->numberOfRows() === 1) {
         $password = osc_create_random_string(ACCOUNT_PASSWORD);
         if (osC_Account::savePassword($password, $Qcheck->valueInt('customers_id'))) {
             include 'includes/classes/email_template.php';
             $email_template = toC_Email_Template::getEmailTemplate('password_forgotten');
             $email_template->setData($Qcheck->valueProtected('customers_firstname'), $Qcheck->valueProtected('customers_lastname'), getenv('REMOTE_ADDR'), $password, $Qcheck->valueProtected('customers_gender'), $Qcheck->valueProtected('customers_email_address'));
             $email_template->buildMessage();
             $email_template->sendEmail();
             $messageStack->add_session('login', $osC_Language->get('success_password_forgotten_sent'), 'success');
         }
         osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL'));
     } else {
         $messageStack->add('password_forgotten', $osC_Language->get('error_password_forgotten_no_email_address_found'));
     }
 }
Esempio n. 4
0
 function generateCartID($length = 5)
 {
     return osc_create_random_string($length, 'digits');
 }
Esempio n. 5
0
 function toC_Captcha()
 {
     $this->_code = osc_create_random_string(6);
 }
Esempio n. 6
0
 function process_button()
 {
     global $osC_Customer, $osC_Currencies, $osC_ShoppingCart;
     if (MODULE_PAYMENT_PAYPAL_IPN_CURRENCY == 'Selected Currency') {
         $currency = $osC_Currencies->getCode();
     } else {
         $currency = MODULE_PAYMENT_PAYPAL_IPN_CURRENCY;
     }
     if (in_array($currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD')) === false) {
         $currency = DEFAULT_CURRENCY;
     }
     $params = array('cmd' => '_ext-enter', 'redirect_cmd' => '_xclick', 'business' => MODULE_PAYMENT_PAYPAL_IPN_ID, 'item_name' => STORE_NAME, 'amount' => $osC_Currencies->formatRaw($osC_ShoppingCart->getTotal() - $osC_ShoppingCart->getShippingMethod('cost'), $currency), 'first_name' => $osC_ShoppingCart->getBillingAddress('firstname'), 'last_name' => $osC_ShoppingCart->getBillingAddress('lastname'), 'address1' => $osC_ShoppingCart->getBillingAddress('street_address'), 'address2' => $osC_ShoppingCart->getBillingAddress('suburb'), 'city' => $osC_ShoppingCart->getBillingAddress('city'), 'zip' => $osC_ShoppingCart->getBillingAddress('postcode'), 'country' => $osC_ShoppingCart->getBillingAddress('country_iso_code_2'), 'address_override' => '1', 'notify_url' => osc_href_link(FILENAME_CHECKOUT, 'callback&module=' . $this->_code . (!osc_empty(MODULE_PAYMENT_PAYPAL_IPN_SECRET_KEY) ? '&secret=' . MODULE_PAYMENT_PAYPAL_IPN_SECRET_KEY : ''), 'SSL', false, false, true), 'email' => $osC_Customer->getEmailAddress(), 'invoice' => $this->_order_id, 'shipping' => $osC_Currencies->formatRaw($osC_ShoppingCart->getShippingMethod('cost'), $currency), 'currency_code' => $currency, 'lc' => 'EN', 'return' => osc_href_link(FILENAME_CHECKOUT, 'process', 'SSL', null, null, true), 'rm' => '2', 'no_note' => '1', 'cancel_return' => osc_href_link(FILENAME_CHECKOUT, 'payment', 'SSL', null, null, true), 'paymentaction' => 'authorization');
     if ($osC_ShoppingCart->getBillingAddress('country_iso_code_2') == 'US') {
         $params['state'] = $osC_ShoppingCart->getBillingAddress('zone_code');
     }
     if (MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS == '1') {
         $params['cert_id'] = MODULE_PAYMENT_PAYPAL_IPN_EWP_CERT_ID;
         $random_string = $osC_Customer->getID() . '-' . time() . '-' . osc_create_random_string(5) . '-';
         $data = '';
         foreach ($params as $key => $value) {
             $data .= $key . '=' . $value . "\n";
         }
         $fp = fopen(DIR_FS_WORK . $random_string . 'data.txt', 'w');
         fwrite($fp, $data);
         fclose($fp);
         unset($data);
         unset($fp);
         if (function_exists('openssl_pkcs7_sign') && function_exists('openssl_pkcs7_encrypt')) {
             openssl_pkcs7_sign(DIR_FS_WORK . $random_string . 'data.txt', DIR_FS_WORK . $random_string . 'signed.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY), file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY), array('From' => MODULE_PAYMENT_PAYPAL_IPN_ID), PKCS7_BINARY);
             unlink(DIR_FS_WORK . $random_string . 'data.txt');
             // remove headers from the signature
             $signed = file_get_contents(DIR_FS_WORK . $random_string . 'signed.txt');
             $signed = explode("\n\n", $signed);
             $signed = base64_decode($signed[1]);
             $fp = fopen(DIR_FS_WORK . $random_string . 'signed.txt', 'w');
             fwrite($fp, $signed);
             fclose($fp);
             unset($signed);
             unset($fp);
             openssl_pkcs7_encrypt(DIR_FS_WORK . $random_string . 'signed.txt', DIR_FS_WORK . $random_string . 'encrypted.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY), array('From' => MODULE_PAYMENT_PAYPAL_IPN_ID), PKCS7_BINARY);
             unlink(DIR_FS_WORK . $random_string . 'signed.txt');
             // remove headers from the encrypted result
             $data = file_get_contents(DIR_FS_WORK . $random_string . 'encrypted.txt');
             $data = explode("\n\n", $data);
             $data = '-----BEGIN PKCS7-----' . "\n" . $data[1] . "\n" . '-----END PKCS7-----';
             unlink(DIR_FS_WORK . $random_string . 'encrypted.txt');
         } else {
             exec(MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL . ' smime -sign -in ' . DIR_FS_WORK . $random_string . 'data.txt -signer ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY . ' -inkey ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY . ' -outform der -nodetach -binary > ' . DIR_FS_WORK . $random_string . 'signed.txt');
             unlink(DIR_FS_WORK . $random_string . 'data.txt');
             exec(MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL . ' smime -encrypt -des3 -binary -outform pem ' . MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY . ' < ' . DIR_FS_WORK . $random_string . 'signed.txt > ' . DIR_FS_WORK . $random_string . 'encrypted.txt');
             unlink(DIR_FS_WORK . $random_string . 'signed.txt');
             $fp = fopen(DIR_FS_WORK . $random_string . 'encrypted.txt', 'rb');
             $data = fread($fp, filesize(DIR_FS_WORK . $random_string . 'encrypted.txt'));
             fclose($fp);
             unset($fp);
             unlink(DIR_FS_WORK . $random_string . 'encrypted.txt');
         }
         $process_button_string = osc_draw_hidden_field('cmd', '_s-xclick') . osc_draw_hidden_field('encrypted', $data);
         unset($data);
     } else {
         $process_button_string = '';
         foreach ($params as $key => $value) {
             $process_button_string .= osc_draw_hidden_field($key, $value);
         }
     }
     return $process_button_string;
 }
Esempio n. 7
0
 function process_button()
 {
     global $osC_ShoppingCart, $osC_Currencies, $osC_Customer;
     //convert currency to payfast currency number
     $currency = $osC_Currencies->getCode();
     switch ($currency) {
         case 'GBP':
             $this->TransactionCurrency = '826';
             break;
         case 'USD':
             $this->TransactionCurrency = "840";
             break;
         case "EUR":
             $this->TransactionCurrency = "978";
             break;
         case "AUD":
             $this->TransactionCurrency = "036";
             break;
     }
     $this->payfast_web_notes = osc_create_random_string(10, 'digits');
     $process_button_string = '';
     $params = array();
     $params['merchant_id'] = MODULE_PAYMENT_PAYFAST_MERCHANT_ID;
     $params['merchant_key'] = MODULE_PAYMENT_PAYFAST_MERCHANT_KEY;
     $params['amount'] = number_format($osC_ShoppingCart->getTotal() * $osC_Currencies->value($currency), $osC_Currencies->getDecimalPlaces($osC_Currencies->getID($currency)));
     $products = $osC_ShoppingCart->getProducts();
     $product_name = '';
     foreach ($products as $product) {
         $product_name .= $product['name'] . (count($products) > 1 ? "<br />" : '');
     }
     $params['item_name'] = $product_name;
     $params['TransactionCurrency'] = $this->TransactionCurrency;
     $params['TransactionAmount'] = number_format($osC_ShoppingCart->getTotal() * $osC_Currencies->value($currency), $osC_Currencies->getDecimalPlaces($osC_Currencies->getID($currency)));
     $params['amount'] = number_format($osC_ShoppingCart->getTotal() * $osC_Currencies->value($currency), $osC_Currencies->getDecimalPlaces($osC_Currencies->getID($currency)));
     $params['CustomerEmail'] = $osC_Customer->getEmailAddress();
     $params['redirectorsuccess'] = HTTP_SERVER . DIR_WS_HTTP_CATALOG . FILENAME_CHECKOUT . '?process&Note=' . $this->payfast_notes . '&';
     $params['redirectorfailed'] = osc_href_link(FILENAME_CHECKOUT, 'process&fail=true', 'SSL', null, null, true);
     $params['PayPageType'] = 4;
     $params['Notes'] = $this->payfast_notes;
     foreach ($params as $key => $value) {
         $process_button_string .= osc_draw_hidden_field($key, $value);
     }
     return $process_button_string;
 }
 function generatePassword($email)
 {
     global $osC_Database;
     $password = osc_create_random_string(8);
     $Qpassword = $osC_Database->query('update :table_administrators set user_password = :user_password where email_address = :email_address');
     $Qpassword->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
     $Qpassword->bindValue(':user_password', osc_encrypt_string($password));
     $Qpassword->bindValue(':email_address', $email);
     $Qpassword->execute();
     if (!$osC_Database->isError()) {
         $Qadmin = $osC_Database->query('select id, user_name, email_address from :table_administrators where email_address = :email_address');
         $Qadmin->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
         $Qadmin->bindValue(':email_address', $email);
         $Qadmin->execute();
         include '../includes/classes/email_template.php';
         $email_template = toC_Email_Template::getEmailTemplate('admin_password_forgotten');
         $email_template->setData($Qadmin->value('user_name'), osc_get_ip_address(), $password, $email);
         $email_template->buildMessage();
         $email_template->sendEmail();
         return true;
     }
     return false;
 }
Esempio n. 9
0
 function process_button()
 {
     global $osC_Customer, $osC_Currencies, $osC_ShoppingCart, $osC_Tax, $osC_Language;
     $process_button_string = '';
     $params = array('business' => MODULE_PAYMENT_PAYPAL_STANDARD_ID, 'currency_code' => $osC_Currencies->getCode(), 'invoice' => $this->_order_id, 'custom' => $osC_Customer->getID(), 'no_note' => '1', 'lc' => 'EN', 'notify_url' => HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . FILENAME_CHECKOUT . '?callback&module=' . $this->_code, 'return' => osc_href_link(FILENAME_CHECKOUT, 'process', 'SSL', null, null, true), 'rm' => '2', 'cancel_return' => osc_href_link(FILENAME_CHECKOUT, 'checkout', 'SSL', null, null, true), 'bn' => 'Tomatocart_Default_ST', 'paymentaction' => MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTION_METHOD == 'Sale' ? 'sale' : 'authorization');
     if ($osC_ShoppingCart->hasShippingAddress()) {
         $params['address_override'] = '1';
         $params['first_name'] = $osC_ShoppingCart->getShippingAddress('firstname');
         $params['last_name'] = $osC_ShoppingCart->getShippingAddress('lastname');
         $params['address1'] = $osC_ShoppingCart->getShippingAddress('street_address');
         $params['city'] = $osC_ShoppingCart->getShippingAddress('city');
         $params['state'] = $osC_ShoppingCart->getShippingAddress('zone_code');
         $params['zip'] = $osC_ShoppingCart->getShippingAddress('postcode');
         $params['country'] = $osC_ShoppingCart->getShippingAddress('country_iso_code_2');
     } else {
         $params['no_shipping'] = '1';
         $params['first_name'] = $osC_ShoppingCart->getBillingAddress('firstname');
         $params['last_name'] = $osC_ShoppingCart->getBillingAddress('lastname');
         $params['address1'] = $osC_ShoppingCart->getBillingAddress('street_address');
         $params['city'] = $osC_ShoppingCart->getBillingAddress('city');
         $params['state'] = $osC_ShoppingCart->getBillingAddress('zone_code');
         $params['zip'] = $osC_ShoppingCart->getBillingAddress('postcode');
         $params['country'] = $osC_ShoppingCart->getBillingAddress('country_iso_code_2');
     }
     if (MODULE_PAYMENT_PAYPAL_STANDARD_TRANSFER_CART == '-1') {
         $params['cmd'] = '_xclick';
         $params['item_name'] = STORE_NAME;
         $shipping_tax = $osC_ShoppingCart->getShippingMethod('cost') * ($osC_Tax->getTaxRate($osC_ShoppingCart->getShippingMethod('tax_class_id'), $osC_ShoppingCart->getTaxingAddress('country_id'), $osC_ShoppingCart->getTaxingAddress('zone_id')) / 100);
         if (DISPLAY_PRICE_WITH_TAX == '1') {
             $shipping = $osC_ShoppingCart->getShippingMethod('cost');
         } else {
             $shipping = $osC_ShoppingCart->getShippingMethod('cost') + $shipping_tax;
         }
         $params['shipping'] = $osC_Currencies->formatRaw($shipping);
         $total_tax = $osC_ShoppingCart->getTax() - $shipping_tax;
         $params['tax'] = $osC_Currencies->formatRaw($total_tax);
         $params['amount'] = $osC_Currencies->formatRaw($osC_ShoppingCart->getTotal() - $shipping - $total_tax);
     } else {
         $params['cmd'] = '_cart';
         $params['upload'] = '1';
         if (DISPLAY_PRICE_WITH_TAX == '-1') {
             $params['tax_cart'] = $osC_Currencies->formatRaw($osC_ShoppingCart->getTax());
         }
         //products
         $products = array();
         if ($osC_ShoppingCart->hasContents()) {
             $i = 1;
             $products = $osC_ShoppingCart->getProducts();
             foreach ($products as $product) {
                 $product_name = $product['name'];
                 //gift certificate
                 if ($product['type'] == PRODUCT_TYPE_GIFT_CERTIFICATE) {
                     $product_name .= "\n" . ' - ' . $osC_Language->get('senders_name') . ': ' . $product['gc_data']['senders_name'];
                     if ($product['gc_data']['type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                         $product_name .= "\n" . ' - ' . $osC_Language->get('senders_email') . ': ' . $product['gc_data']['senders_email'];
                     }
                     $product_name .= "\n" . ' - ' . $osC_Language->get('recipients_name') . ': ' . $product['gc_data']['recipients_name'];
                     if ($product['gc_data']['type'] == GIFT_CERTIFICATE_TYPE_EMAIL) {
                         $product_name .= "\n" . ' - ' . $osC_Language->get('recipients_email') . ': ' . $product['gc_data']['recipients_email'];
                     }
                     $product_name .= "\n" . ' - ' . $osC_Language->get('message') . ': ' . $product['gc_data']['message'];
                 }
                 if ($osC_ShoppingCart->hasVariants($product['id'])) {
                     foreach ($osC_ShoppingCart->getVariants($product['id']) as $variant) {
                         $product_name .= ' - ' . $variant['groups_name'] . ': ' . $variant['values_name'];
                     }
                 }
                 $product_data = array('item_name_' . $i => $product_name, 'item_number_' . $i => $product['sku'], 'quantity_' . $i => $product['quantity']);
                 $tax = $osC_Tax->getTaxRate($product['tax_class_id'], $osC_ShoppingCart->getTaxingAddress('country_id'), $osC_ShoppingCart->getTaxingAddress('zone_id'));
                 $price = $osC_Currencies->addTaxRateToPrice($product['final_price'], $tax);
                 $product_data['amount_' . $i] = $osC_Currencies->formatRaw($price);
                 $params = array_merge($params, $product_data);
                 $i++;
             }
         }
         //order totals
         foreach ($osC_ShoppingCart->getOrderTotals() as $total) {
             if (!in_array($total['code'], $this->_ignore_order_totals)) {
                 if ($total['code'] == 'coupon' || $total['code'] == 'gift_certificate') {
                     $params['discount_amount_cart'] += $osC_Currencies->formatRaw(abs($total['value']));
                 } else {
                     $order_total = array('item_name_' . $i => $total['title'], 'quantity_' . $i => 1, 'amount_' . $i => $total['value']);
                     $params = array_merge($params, $order_total);
                     $i++;
                 }
             }
         }
     }
     if (defined('MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE')) {
         $params['page_style'] = MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE;
     }
     if (MODULE_PAYMENT_PAYPAL_STANDARD_EWP_STATUS == '1') {
         $params['cert_id'] = MODULE_PAYMENT_PAYPAL_STANDARD_EWP_CERT_ID;
         $random_string = osc_create_random_string(5, 'digits') . '-' . $osC_Customer->getID() . '-';
         $data = '';
         reset($params);
         foreach ($params as $key => $value) {
             $data .= $key . '=' . $value . "\n";
         }
         $fp = fopen(DIR_FS_WORK . $random_string . 'data.txt', 'w');
         fwrite($fp, $data);
         fclose($fp);
         unset($data);
         if (function_exists('openssl_pkcs7_sign') && function_exists('openssl_pkcs7_encrypt')) {
             openssl_pkcs7_sign(DIR_FS_WORK . $random_string . 'data.txt', DIR_FS_WORK . $random_string . 'signed.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY), file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY), array('From' => MODULE_PAYMENT_PAYPAL_STANDARD_ID), PKCS7_BINARY);
             unlink(DIR_FS_WORK . $random_string . 'data.txt');
             // remove headers from the signature
             $signed = file_get_contents(DIR_FS_WORK . $random_string . 'signed.txt');
             $signed = explode("\n\n", $signed);
             $signed = base64_decode($signed[1]);
             $fp = fopen(DIR_FS_WORK . $random_string . 'signed.txt', 'w');
             fwrite($fp, $signed);
             fclose($fp);
             unset($signed);
             openssl_pkcs7_encrypt(DIR_FS_WORK . $random_string . 'signed.txt', DIR_FS_WORK . $random_string . 'encrypted.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY), array('From' => MODULE_PAYMENT_PAYPAL_STANDARD_ID), PKCS7_BINARY);
             unlink(DIR_FS_WORK . $random_string . 'signed.txt');
             // remove headers from the encrypted result
             $data = file_get_contents(DIR_FS_WORK . $random_string . 'encrypted.txt');
             $data = explode("\n\n", $data);
             $data = '-----BEGIN PKCS7-----' . "\n" . $data[1] . "\n" . '-----END PKCS7-----';
             unlink(DIR_FS_WORK . $random_string . 'encrypted.txt');
         } else {
             exec(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL . ' smime -sign -in ' . DIR_FS_WORK . $random_string . 'data.txt -signer ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY . ' -inkey ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY . ' -outform der -nodetach -binary > ' . DIR_FS_WORK . $random_string . 'signed.txt');
             unlink(DIR_FS_WORK . $random_string . 'data.txt');
             exec(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL . ' smime -encrypt -des3 -binary -outform pem ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY . ' < ' . DIR_FS_WORK . $random_string . 'signed.txt > ' . DIR_FS_WORK . $random_string . 'encrypted.txt');
             unlink(DIR_FS_WORK . $random_string . 'signed.txt');
             $fp = fopen(DIR_FS_WORK . $random_string . 'encrypted.txt', 'rb');
             $data = fread($fp, filesize(DIR_FS_WORK . $random_string . 'encrypted.txt'));
             fclose($fp);
             unset($fp);
             unlink(DIR_FS_WORK . $random_string . 'encrypted.txt');
         }
         $process_button_string = osc_draw_hidden_field('cmd', '_s-xclick') . osc_draw_hidden_field('encrypted', $data);
         unset($data);
     } else {
         $process_button_string = '';
         foreach ($params as $key => $value) {
             $process_button_string .= osc_draw_hidden_field($key, $value);
         }
     }
     return $process_button_string;
 }