[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/includes/modules/payment/ -> paypal_standard.php (source)

   1  <?php
   2  /*
   3    $Id: paypal_standard.php 1803 2008-01-11 18:16:37Z hpdl $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2008 osCommerce
   9  
  10    Released under the GNU General Public License
  11  */
  12  
  13    class paypal_standard {
  14      var $code, $title, $description, $enabled;
  15  
  16  // class constructor
  17      function paypal_standard() {
  18        global $order;
  19  
  20        $this->signature = 'paypal|paypal_standard|1.0|2.2';
  21  
  22        $this->code = 'paypal_standard';
  23        $this->title = MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_TITLE;
  24        $this->public_title = MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_PUBLIC_TITLE;
  25        $this->description = MODULE_PAYMENT_PAYPAL_STANDARD_TEXT_DESCRIPTION;
  26        $this->sort_order = MODULE_PAYMENT_PAYPAL_STANDARD_SORT_ORDER;
  27        $this->enabled = ((MODULE_PAYMENT_PAYPAL_STANDARD_STATUS == 'True') ? true : false);
  28  
  29        if ((int)MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID > 0) {
  30          $this->order_status = MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID;
  31        }
  32  
  33        if (is_object($order)) $this->update_status();
  34  
  35        if (MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER == 'Live') {
  36          $this->form_action_url = 'https://www.paypal.com/cgi-bin/webscr';
  37        } else {
  38          $this->form_action_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
  39        }
  40      }
  41  
  42  // class methods
  43      function update_status() {
  44        global $order;
  45  
  46        if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_STANDARD_ZONE > 0) ) {
  47          $check_flag = false;
  48          $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_STANDARD_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
  49          while ($check = tep_db_fetch_array($check_query)) {
  50            if ($check['zone_id'] < 1) {
  51              $check_flag = true;
  52              break;
  53            } elseif ($check['zone_id'] == $order->billing['zone_id']) {
  54              $check_flag = true;
  55              break;
  56            }
  57          }
  58  
  59          if ($check_flag == false) {
  60            $this->enabled = false;
  61          }
  62        }
  63      }
  64  
  65      function javascript_validation() {
  66        return false;
  67      }
  68  
  69      function selection() {
  70        global $cart_PayPal_Standard_ID;
  71  
  72        if (tep_session_is_registered('cart_PayPal_Standard_ID')) {
  73          $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1);
  74  
  75          $check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 1');
  76  
  77          if (tep_db_num_rows($check_query) < 1) {
  78            tep_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$order_id . '"');
  79            tep_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int)$order_id . '"');
  80            tep_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '"');
  81            tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int)$order_id . '"');
  82            tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int)$order_id . '"');
  83            tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int)$order_id . '"');
  84  
  85            tep_session_unregister('cart_PayPal_Standard_ID');
  86          }
  87        }
  88  
  89        return array('id' => $this->code,
  90                     'module' => $this->public_title);
  91      }
  92  
  93      function pre_confirmation_check() {
  94        global $cartID, $cart;
  95  
  96        if (empty($cart->cartID)) {
  97          $cartID = $cart->cartID = $cart->generate_cart_id();
  98        }
  99  
 100        if (!tep_session_is_registered('cartID')) {
 101          tep_session_register('cartID');
 102        }
 103      }
 104  
 105      function confirmation() {
 106        global $cartID, $cart_PayPal_Standard_ID, $customer_id, $languages_id, $order, $order_total_modules;
 107  
 108        if (tep_session_is_registered('cartID')) {
 109          $insert_order = false;
 110  
 111          if (tep_session_is_registered('cart_PayPal_Standard_ID')) {
 112            $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1);
 113  
 114            $curr_check = tep_db_query("select currency from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
 115            $curr = tep_db_fetch_array($curr_check);
 116  
 117            if ( ($curr['currency'] != $order->info['currency']) || ($cartID != substr($cart_PayPal_Standard_ID, 0, strlen($cartID))) ) {
 118              $check_query = tep_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '" limit 1');
 119  
 120              if (tep_db_num_rows($check_query) < 1) {
 121                tep_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int)$order_id . '"');
 122                tep_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int)$order_id . '"');
 123                tep_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int)$order_id . '"');
 124                tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int)$order_id . '"');
 125                tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int)$order_id . '"');
 126                tep_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int)$order_id . '"');
 127              }
 128  
 129              $insert_order = true;
 130            }
 131          } else {
 132            $insert_order = true;
 133          }
 134  
 135          if ($insert_order == true) {
 136            $order_totals = array();
 137            if (is_array($order_total_modules->modules)) {
 138              reset($order_total_modules->modules);
 139              while (list(, $value) = each($order_total_modules->modules)) {
 140                $class = substr($value, 0, strrpos($value, '.'));
 141                if ($GLOBALS[$class]->enabled) {
 142                  for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++) {
 143                    if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {
 144                      $order_totals[] = array('code' => $GLOBALS[$class]->code,
 145                                              'title' => $GLOBALS[$class]->output[$i]['title'],
 146                                              'text' => $GLOBALS[$class]->output[$i]['text'],
 147                                              'value' => $GLOBALS[$class]->output[$i]['value'],
 148                                              'sort_order' => $GLOBALS[$class]->sort_order);
 149                    }
 150                  }
 151                }
 152              }
 153            }
 154  
 155            $sql_data_array = array('customers_id' => $customer_id,
 156                                    'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
 157                                    'customers_company' => $order->customer['company'],
 158                                    'customers_street_address' => $order->customer['street_address'],
 159                                    'customers_suburb' => $order->customer['suburb'],
 160                                    'customers_city' => $order->customer['city'],
 161                                    'customers_postcode' => $order->customer['postcode'],
 162                                    'customers_state' => $order->customer['state'],
 163                                    'customers_country' => $order->customer['country']['title'],
 164                                    'customers_telephone' => $order->customer['telephone'],
 165                                    'customers_email_address' => $order->customer['email_address'],
 166                                    'customers_address_format_id' => $order->customer['format_id'],
 167                                    'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
 168                                    'delivery_company' => $order->delivery['company'],
 169                                    'delivery_street_address' => $order->delivery['street_address'],
 170                                    'delivery_suburb' => $order->delivery['suburb'],
 171                                    'delivery_city' => $order->delivery['city'],
 172                                    'delivery_postcode' => $order->delivery['postcode'],
 173                                    'delivery_state' => $order->delivery['state'],
 174                                    'delivery_country' => $order->delivery['country']['title'],
 175                                    'delivery_address_format_id' => $order->delivery['format_id'],
 176                                    'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],
 177                                    'billing_company' => $order->billing['company'],
 178                                    'billing_street_address' => $order->billing['street_address'],
 179                                    'billing_suburb' => $order->billing['suburb'],
 180                                    'billing_city' => $order->billing['city'],
 181                                    'billing_postcode' => $order->billing['postcode'],
 182                                    'billing_state' => $order->billing['state'],
 183                                    'billing_country' => $order->billing['country']['title'],
 184                                    'billing_address_format_id' => $order->billing['format_id'],
 185                                    'payment_method' => $order->info['payment_method'],
 186                                    'cc_type' => $order->info['cc_type'],
 187                                    'cc_owner' => $order->info['cc_owner'],
 188                                    'cc_number' => $order->info['cc_number'],
 189                                    'cc_expires' => $order->info['cc_expires'],
 190                                    'date_purchased' => 'now()',
 191                                    'orders_status' => $order->info['order_status'],
 192                                    'currency' => $order->info['currency'],
 193                                    'currency_value' => $order->info['currency_value']);
 194  
 195            tep_db_perform(TABLE_ORDERS, $sql_data_array);
 196  
 197            $insert_id = tep_db_insert_id();
 198  
 199            for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
 200              $sql_data_array = array('orders_id' => $insert_id,
 201                                      'title' => $order_totals[$i]['title'],
 202                                      'text' => $order_totals[$i]['text'],
 203                                      'value' => $order_totals[$i]['value'],
 204                                      'class' => $order_totals[$i]['code'],
 205                                      'sort_order' => $order_totals[$i]['sort_order']);
 206  
 207              tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
 208            }
 209  
 210            for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
 211              $sql_data_array = array('orders_id' => $insert_id,
 212                                      'products_id' => tep_get_prid($order->products[$i]['id']),
 213                                      'products_model' => $order->products[$i]['model'],
 214                                      'products_name' => $order->products[$i]['name'],
 215                                      'products_price' => $order->products[$i]['price'],
 216                                      'final_price' => $order->products[$i]['final_price'],
 217                                      'products_tax' => $order->products[$i]['tax'],
 218                                      'products_quantity' => $order->products[$i]['qty']);
 219  
 220              tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
 221  
 222              $order_products_id = tep_db_insert_id();
 223  // Start - CREDIT CLASS Gift Voucher Contribution
 224  // CCGV 5.19 Fix for GV Queue with Paypal IPN
 225  //          $order_total_modules->update_credit_account($i);
 226              $order_total_modules->update_credit_account($i,$insert_id);
 227  // End - CREDIT CLASS Gift Voucher Contribution
 228              $attributes_exist = '0';
 229              if (isset($order->products[$i]['attributes'])) {
 230                $attributes_exist = '1';
 231                for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
 232                  if (DOWNLOAD_ENABLED == 'true') {
 233                    $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename
 234                                         from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
 235                                         left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
 236                                         on pa.products_attributes_id=pad.products_attributes_id
 237                                         where pa.products_id = '" . $order->products[$i]['id'] . "'
 238                                         and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'
 239                                         and pa.options_id = popt.products_options_id
 240                                         and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'
 241                                         and pa.options_values_id = poval.products_options_values_id
 242                                         and popt.language_id = '" . $languages_id . "'
 243                                         and poval.language_id = '" . $languages_id . "'";
 244                    $attributes = tep_db_query($attributes_query);
 245                  } else {
 246                    $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
 247                  }
 248                  $attributes_values = tep_db_fetch_array($attributes);
 249  
 250                  $sql_data_array = array('orders_id' => $insert_id,
 251                                          'orders_products_id' => $order_products_id,
 252                                          'products_options' => $attributes_values['products_options_name'],
 253                                          'products_options_values' => $attributes_values['products_options_values_name'],
 254                                          'options_values_price' => $attributes_values['options_values_price'],
 255                                          'price_prefix' => $attributes_values['price_prefix']);
 256  
 257                  tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
 258  
 259                  if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {
 260                    $sql_data_array = array('orders_id' => $insert_id,
 261                                            'orders_products_id' => $order_products_id,
 262                                            'orders_products_filename' => $attributes_values['products_attributes_filename'],
 263                                            'download_maxdays' => $attributes_values['products_attributes_maxdays'],
 264                                            'download_count' => $attributes_values['products_attributes_maxcount']);
 265  
 266                    tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
 267                  }
 268                }
 269              }
 270            }
 271  
 272            $cart_PayPal_Standard_ID = $cartID . '-' . $insert_id;
 273            tep_session_register('cart_PayPal_Standard_ID');
 274          }
 275        }
 276  
 277        return false;
 278      }
 279  
 280      function process_button() {
 281        global $customer_id, $order, $sendto, $currency, $cart_PayPal_Standard_ID, $shipping;
 282  
 283        $process_button_string = '';
 284        $parameters = array('cmd' => '_xclick',
 285                            'item_name' => STORE_NAME,
 286                            'shipping' => $this->format_raw($order->info['shipping_cost']),
 287                            'tax' => $this->format_raw($order->info['tax']),
 288                            'business' => MODULE_PAYMENT_PAYPAL_STANDARD_ID,
 289                            'amount' => $this->format_raw($order->info['total'] - $order->info['shipping_cost'] - $order->info['tax']),
 290                            'currency_code' => $currency,
 291                            'invoice' => substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1),
 292                            'custom' => $customer_id,
 293                            'no_note' => '1',
 294                            'notify_url' => tep_href_link('ext/modules/payment/paypal/standard_ipn.php', '', 'SSL', false, false),
 295                            'return' => tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'),
 296                            'cancel_return' => tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'),
 297                            'bn' => 'osCommerce22_Default_ST',
 298                            'paymentaction' => ((MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTION_METHOD == 'Sale') ? 'sale' : 'authorization'));
 299  
 300        if (is_numeric($sendto) && ($sendto > 0)) {
 301          $parameters['address_override'] = '1';
 302          $parameters['first_name'] = $order->delivery['firstname'];
 303          $parameters['last_name'] = $order->delivery['lastname'];
 304          $parameters['address1'] = $order->delivery['street_address'];
 305          $parameters['city'] = $order->delivery['city'];
 306          $parameters['state'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']);
 307          $parameters['zip'] = $order->delivery['postcode'];
 308          $parameters['country'] = $order->delivery['country']['iso_code_2'];
 309        } else {
 310          $parameters['no_shipping'] = '1';
 311          $parameters['first_name'] = $order->billing['firstname'];
 312          $parameters['last_name'] = $order->billing['lastname'];
 313          $parameters['address1'] = $order->billing['street_address'];
 314          $parameters['city'] = $order->billing['city'];
 315          $parameters['state'] = tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']);
 316          $parameters['zip'] = $order->billing['postcode'];
 317          $parameters['country'] = $order->billing['country']['iso_code_2'];
 318        }
 319  
 320        if (tep_not_null(MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE)) {
 321          $parameters['page_style'] = MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE;
 322        }
 323  
 324        if (MODULE_PAYMENT_PAYPAL_STANDARD_EWP_STATUS == 'True') {
 325          $parameters['cert_id'] = MODULE_PAYMENT_PAYPAL_STANDARD_EWP_CERT_ID;
 326  
 327          $random_string = rand(100000, 999999) . '-' . $customer_id . '-';
 328  
 329          $data = '';
 330          reset($parameters);
 331          while (list($key, $value) = each($parameters)) {
 332            $data .= $key . '=' . $value . "\n";
 333          }
 334  
 335          $fp = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', 'w');
 336          fwrite($fp, $data);
 337          fclose($fp);
 338  
 339          unset($data);
 340  
 341          if (function_exists('openssl_pkcs7_sign') && function_exists('openssl_pkcs7_encrypt')) {
 342            openssl_pkcs7_sign(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt', MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $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);
 343  
 344            unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');
 345  
 346  // remove headers from the signature
 347            $signed = file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
 348            $signed = explode("\n\n", $signed);
 349            $signed = base64_decode($signed[1]);
 350  
 351            $fp = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', 'w');
 352            fwrite($fp, $signed);
 353            fclose($fp);
 354  
 355            unset($signed);
 356  
 357            openssl_pkcs7_encrypt(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt', MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY), array('From' => MODULE_PAYMENT_PAYPAL_STANDARD_ID), PKCS7_BINARY);
 358  
 359            unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
 360  
 361  // remove headers from the encrypted result
 362            $data = file_get_contents(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
 363            $data = explode("\n\n", $data);
 364            $data = '-----BEGIN PKCS7-----' . "\n" . $data[1] . "\n" . '-----END PKCS7-----';
 365  
 366            unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
 367          } else {
 368            exec(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL . ' smime -sign -in ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt -signer ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY . ' -inkey ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY . ' -outform der -nodetach -binary > ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
 369            unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'data.txt');
 370  
 371            exec(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL . ' smime -encrypt -des3 -binary -outform pem ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY . ' < ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt > ' . MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
 372            unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'signed.txt');
 373  
 374            $fh = fopen(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt', 'rb');
 375            $data = fread($fh, filesize(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt'));
 376            fclose($fh);
 377  
 378            unlink(MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY . '/' . $random_string . 'encrypted.txt');
 379          }
 380  
 381          $process_button_string = tep_draw_hidden_field('cmd', '_s-xclick') .
 382                                   tep_draw_hidden_field('encrypted', $data);
 383  
 384          unset($data);
 385        } else {
 386          reset($parameters);
 387          while (list($key, $value) = each($parameters)) {
 388            $process_button_string .= tep_draw_hidden_field($key, $value);
 389          }
 390        }
 391  
 392        return $process_button_string;
 393      }
 394  
 395      function before_process() {
 396        global $customer_id, $order, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart, $cart_PayPal_Standard_ID;
 397        global $$payment;
 398  
 399        $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1);
 400  
 401        $check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
 402        if (tep_db_num_rows($check_query)) {
 403          $check = tep_db_fetch_array($check_query);
 404  
 405          if ($check['orders_status'] == MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID) {
 406            $sql_data_array = array('orders_id' => $order_id,
 407                                    'orders_status_id' => MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID,
 408                                    'date_added' => 'now()',
 409                                    'customer_notified' => '0',
 410                                    'comments' => '');
 411  
 412            tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
 413          }
 414        }
 415  
 416        tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? (int)MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : (int)DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . (int)$order_id . "'");
 417  
 418        $sql_data_array = array('orders_id' => $order_id,
 419                                'orders_status_id' => (MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID > 0 ? (int)MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID : (int)DEFAULT_ORDERS_STATUS_ID),
 420                                'date_added' => 'now()',
 421                                'customer_notified' => (SEND_EMAILS == 'true') ? '1' : '0',
 422                                'comments' => $order->info['comments']);
 423  
 424        tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
 425  
 426  // initialized for the email confirmation
 427        $products_ordered = '';
 428        $subtotal = 0;
 429        $total_tax = 0;
 430  
 431        for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
 432  // Stock Update - Joao Correia
 433          if (STOCK_LIMITED == 'true') {
 434            if (DOWNLOAD_ENABLED == 'true') {
 435              $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename
 436                                  FROM " . TABLE_PRODUCTS . " p
 437                                  LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa
 438                                  ON p.products_id=pa.products_id
 439                                  LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
 440                                  ON pa.products_attributes_id=pad.products_attributes_id
 441                                  WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
 442  // Will work with only one option for downloadable products
 443  // otherwise, we have to build the query dynamically with a loop
 444              $products_attributes = $order->products[$i]['attributes'];
 445              if (is_array($products_attributes)) {
 446                $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
 447              }
 448              $stock_query = tep_db_query($stock_query_raw);
 449            } else {
 450              $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
 451            }
 452            if (tep_db_num_rows($stock_query) > 0) {
 453              $stock_values = tep_db_fetch_array($stock_query);
 454  // do not decrement quantities if products_attributes_filename exists
 455              if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
 456                $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
 457              } else {
 458                $stock_left = $stock_values['products_quantity'];
 459              }
 460              tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
 461              if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
 462                tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
 463              }
 464            }
 465          }
 466  
 467  // Update products_ordered (for bestsellers list)
 468          tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
 469  
 470  // Start - CREDIT CLASS Gift Voucher Contribution
 471          $order_total_modules->update_credit_account($i);
 472  // End - CREDIT CLASS Gift Voucher Contribution
 473  
 474  //------insert customer choosen option to order--------
 475          $attributes_exist = '0';
 476          $products_ordered_attributes = '';
 477          if (isset($order->products[$i]['attributes'])) {
 478            $attributes_exist = '1';
 479            for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
 480              if (DOWNLOAD_ENABLED == 'true') {
 481                $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename
 482                                     from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
 483                                     left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad
 484                                     on pa.products_attributes_id=pad.products_attributes_id
 485                                     where pa.products_id = '" . $order->products[$i]['id'] . "'
 486                                     and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'
 487                                     and pa.options_id = popt.products_options_id
 488                                     and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'
 489                                     and pa.options_values_id = poval.products_options_values_id
 490                                     and popt.language_id = '" . $languages_id . "'
 491                                     and poval.language_id = '" . $languages_id . "'";
 492                $attributes = tep_db_query($attributes_query);
 493              } else {
 494                $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
 495              }
 496              $attributes_values = tep_db_fetch_array($attributes);
 497  
 498              $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
 499            }
 500          }
 501  //------insert customer choosen option eof ----
 502          $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
 503          $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
 504          $total_cost += $total_products_price;
 505  
 506          $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
 507        }
 508  
 509  // Start - CREDIT CLASS Gift Voucher Contribution
 510        $order_total_modules->apply_credit();
 511  // End - CREDIT CLASS Gift Voucher Contribution
 512  // lets start with the email confirmation
 513        $email_order = STORE_NAME . "\n" .
 514                       EMAIL_SEPARATOR . "\n" .
 515                       EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" .
 516                       EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" .
 517                       EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
 518        if ($order->info['comments']) {
 519          $email_order .= tep_db_output($order->info['comments']) . "\n\n";
 520        }
 521        $email_order .= EMAIL_TEXT_PRODUCTS . "\n" .
 522                        EMAIL_SEPARATOR . "\n" .
 523                        $products_ordered .
 524                        EMAIL_SEPARATOR . "\n";
 525  
 526        for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
 527          $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
 528        }
 529  
 530        if ($order->content_type != 'virtual') {
 531          $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .
 532                          EMAIL_SEPARATOR . "\n" .
 533                          tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
 534        }
 535  
 536        $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
 537                        EMAIL_SEPARATOR . "\n" .
 538                        tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
 539  
 540        if (is_object($$payment)) {
 541          $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
 542                          EMAIL_SEPARATOR . "\n";
 543          $payment_class = $$payment;
 544          $email_order .= $payment_class->title . "\n\n";
 545          if ($payment_class->email_footer) {
 546            $email_order .= $payment_class->email_footer . "\n\n";
 547          }
 548        }
 549  
 550        tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 551  
 552  // send emails to other people
 553        if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
 554          tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
 555        }
 556  
 557  // load the after_process function from the payment modules
 558        $this->after_process();
 559  
 560        $cart->reset(true);
 561  
 562  // unregister session variables used during checkout
 563        tep_session_unregister('sendto');
 564        tep_session_unregister('billto');
 565        tep_session_unregister('shipping');
 566        tep_session_unregister('payment');
 567        tep_session_unregister('comments');
 568  
 569  // Start - CREDIT CLASS Gift Voucher Contribution
 570        $order_total_modules->clear_posts();
 571  // End - CREDIT CLASS Gift Voucher Contribution
 572        tep_session_unregister('cart_PayPal_Standard_ID');
 573  
 574        tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
 575      }
 576  
 577      function after_process() {
 578        return false;
 579      }
 580  
 581      function output_error() {
 582        return false;
 583      }
 584  
 585      function check() {
 586        if (!isset($this->_check)) {
 587          $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYPAL_STANDARD_STATUS'");
 588          $this->_check = tep_db_num_rows($check_query);
 589        }
 590        return $this->_check;
 591      }
 592  
 593      function install() {
 594        $check_query = tep_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Preparing [PayPal Standard]' limit 1");
 595  
 596        if (tep_db_num_rows($check_query) < 1) {
 597          $status_query = tep_db_query("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS);
 598          $status = tep_db_fetch_array($status_query);
 599  
 600          $status_id = $status['status_id']+1;
 601  
 602          $languages = tep_get_languages();
 603  
 604          foreach ($languages as $lang) {
 605            tep_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'Preparing [PayPal Standard]')");
 606          }
 607  
 608          $flags_query = tep_db_query("describe " . TABLE_ORDERS_STATUS . " public_flag");
 609          if (tep_db_num_rows($flags_query) == 1) {
 610            tep_db_query("update " . TABLE_ORDERS_STATUS . " set public_flag = 0 and downloads_flag = 0 where orders_status_id = '" . $status_id . "'");
 611          }
 612        } else {
 613          $check = tep_db_fetch_array($check_query);
 614  
 615          $status_id = $check['orders_status_id'];
 616        }
 617  
 618        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable PayPal Website Payments Standard', 'MODULE_PAYMENT_PAYPAL_STANDARD_STATUS', 'False', 'Do you want to accept PayPal Website Payments Standard payments?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 619        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('E-Mail Address', 'MODULE_PAYMENT_PAYPAL_STANDARD_ID', '', 'The PayPal seller e-mail address to accept payments for', '6', '4', now())");
 620        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAYPAL_STANDARD_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
 621        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAYPAL_STANDARD_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
 622        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Preparing Order Status', 'MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID', '" . $status_id . "', 'Set the status of prepared orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
 623        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set PayPal Acknowledged Order Status', 'MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
 624        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Gateway Server', 'MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER', 'Live', 'Use the testing (sandbox) or live gateway server for transactions?', '6', '6', 'tep_cfg_select_option(array(\'Live\', \'Sandbox\'), ', now())");
 625        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Method', 'MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTION_METHOD', 'Sale', 'The processing method to use for each transaction.', '6', '0', 'tep_cfg_select_option(array(\'Authorization\', \'Sale\'), ', now())");
 626        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Page Style', 'MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE', '', 'The page style to use for the transaction procedure (defined at your PayPal Profile page)', '6', '4', now())");
 627        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Debug E-Mail Address', 'MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL', '', 'All parameters of an Invalid IPN notification will be sent to this email address if one is entered.', '6', '4', now())");
 628        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Encrypted Web Payments', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_STATUS', 'False', 'Do you want to enable Encrypted Web Payments?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
 629        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your Private Key', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY', '', 'The location of your Private Key to use for signing the data. (*.pem)', '6', '4', now())");
 630        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your Public Certificate', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY', '', 'The location of your Public Certificate to use for signing the data. (*.pem)', '6', '4', now())");
 631        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PayPals Public Certificate', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY', '', 'The location of the PayPal Public Certificate for encrypting the data.', '6', '4', now())");
 632        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Your PayPal Public Certificate ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_CERT_ID', '', 'The Certificate ID to use from your PayPal Encrypted Payment Settings Profile.', '6', '4', now())");
 633        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Working Directory', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY', '', 'The working directory to use for temporary files. (trailing slash needed)', '6', '4', now())");
 634        tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('OpenSSL Location', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL', '/usr/bin/openssl', 'The location of the openssl binary file.', '6', '4', now())");
 635      }
 636  
 637      function remove() {
 638        tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
 639      }
 640  
 641      function keys() {
 642        return array('MODULE_PAYMENT_PAYPAL_STANDARD_STATUS', 'MODULE_PAYMENT_PAYPAL_STANDARD_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_ZONE', 'MODULE_PAYMENT_PAYPAL_STANDARD_PREPARE_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_GATEWAY_SERVER', 'MODULE_PAYMENT_PAYPAL_STANDARD_TRANSACTION_METHOD', 'MODULE_PAYMENT_PAYPAL_STANDARD_PAGE_STYLE', 'MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL', 'MODULE_PAYMENT_PAYPAL_STANDARD_SORT_ORDER', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_STATUS', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PRIVATE_KEY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PUBLIC_KEY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_PAYPAL_KEY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_CERT_ID', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_WORKING_DIRECTORY', 'MODULE_PAYMENT_PAYPAL_STANDARD_EWP_OPENSSL');
 643      }
 644  
 645  // format prices without currency formatting
 646      function format_raw($number, $currency_code = '', $currency_value = '') {
 647        global $currencies, $currency;
 648  
 649        if (empty($currency_code) || !$this->is_set($currency_code)) {
 650          $currency_code = $currency;
 651        }
 652  
 653        if (empty($currency_value) || !is_numeric($currency_value)) {
 654          $currency_value = $currencies->currencies[$currency_code]['value'];
 655        }
 656  
 657        return number_format(tep_round($number * $currency_value, $currencies->currencies[$currency_code]['decimal_places']), $currencies->currencies[$currency_code]['decimal_places'], '.', '');
 658      }
 659    }
 660  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7