function zen_get_country_list($name, $selected = '', $parameters = '')
 {
     $countriesAtTopOfList = array();
     $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
     $countries = zen_get_countries();
     // Set some default entries at top of list:
     if (STORE_COUNTRY != SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY) {
         $countriesAtTopOfList[] = SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;
     }
     $countriesAtTopOfList[] = STORE_COUNTRY;
     // IF YOU WANT TO ADD MORE DEFAULTS TO THE TOP OF THIS LIST, SIMPLY ENTER THEIR NUMBERS HERE.
     // Duplicate more lines as needed
     // Example: Canada is 108, so use 108 as shown:
     //$countriesAtTopOfList[] = 108;
     //process array of top-of-list entries:
     foreach ($countriesAtTopOfList as $key => $val) {
         $countries_array[] = array('id' => $val, 'text' => zen_get_country_name($val));
     }
     // now add anything not in the defaults list:
     foreach ($countries as $country) {
         $alreadyInList = FALSE;
         foreach ($countriesAtTopOfList as $key => $val) {
             if ($country['id'] == $val) {
                 // If you don't want to exclude entries already at the top of the list, comment out this next line:
                 $alreadyInList = TRUE;
                 continue;
             }
         }
         if (!$alreadyInList) {
             $countries_array[] = $country;
         }
     }
     return zen_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
 }
Esempio n. 2
0
function zen_address_format($address_format_id, $address, $html, $boln, $eoln)
{
    global $db;
    $address_format_query = "select address_format as format\n                             from " . TABLE_ADDRESS_FORMAT . "\n                             where address_format_id = '" . (int) $address_format_id . "'";
    $address_format = $db->Execute($address_format_query);
    //$company = zen_output_string_protected($address['company']);
    if (isset($address['firstname']) && zen_not_null($address['firstname'])) {
        $firstname = zen_output_string_protected($address['firstname']);
        $lastname = zen_output_string_protected($address['lastname']);
    } elseif (isset($address['name']) && zen_not_null($address['name'])) {
        $firstname = zen_output_string_protected($address['name']);
        $lastname = '';
    } else {
        $firstname = '';
        $lastname = '';
    }
    $street = zen_output_string_protected($address['street_address']);
    $suburb = zen_output_string_protected($address['suburb']);
    $city = zen_output_string_protected($address['city']);
    $state = zen_output_string_protected($address['state']);
    $phone = ENTRY_PHONE_NUMBER . zen_output_string_protected($address['phone']);
    if (isset($address['country_id']) && zen_not_null($address['country_id'])) {
        $country = zen_get_country_name($address['country_id']);
        if (isset($address['zone_id']) && zen_not_null($address['zone_id'])) {
            $state = zen_get_zone_code($address['country_id'], $address['zone_id'], $state);
        }
    } elseif (isset($address['country']) && zen_not_null($address['country'])) {
        if (is_array($address['country'])) {
            $country = zen_output_string_protected($address['country']['countries_name']);
        } else {
            $country = zen_output_string_protected($address['country']);
        }
    } else {
        $country = '';
    }
    $postcode = zen_output_string_protected($address['postcode']);
    $zip = $postcode;
    if ($html) {
        // HTML Mode
        $HR = '<hr />';
        $hr = '<hr />';
        if ($boln == '' && $eoln == "\n") {
            // Values not specified, use rational defaults
            $CR = '<br />';
            $cr = '<br />';
            $eoln = $cr;
        } else {
            // Use values supplied
            $CR = $eoln . $boln;
            $cr = $CR;
        }
    } else {
        // Text Mode
        $CR = $eoln;
        $cr = $CR;
        $HR = '----------------------------------------';
        $hr = '----------------------------------------';
    }
    $statecomma = '';
    $streets = $street;
    if ($suburb != '') {
        $streets = $street . ',' . $suburb;
    }
    if ($country == '') {
        if (is_array($address['country'])) {
            $country = zen_output_string_protected($address['country']['countries_name']);
        } else {
            $country = zen_output_string_protected($address['country']);
        }
    }
    if ($state != '') {
        $statecomma = $state . ', ';
    }
    $fmt = $address_format->fields['format'];
    eval("\$address_out = \"{$fmt}\";");
    return $address_out;
}
    } elseif ($free_shipping == 1) {
        echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER));
    } else {
        ?>
<table width="100%" border="1" cellpadding="2" cellspacing="2">
<?php 
        if ($_SESSION['customer_id'] < 1) {
            ?>
    <tr>
			<td colspan="2" class="seDisplayedAddressLabel">
        <?php 
            echo CART_SHIPPING_QUOTE_CRITERIA;
            ?>
<br />
        <?php 
            echo '<span class="seDisplayedAddressInfo">' . zen_get_zone_name($selected_country, $state_zone_id, '') . ($selectedState != '' ? ' ' . $selectedState : '') . ' ' . $order->delivery['postcode'] . ' ' . zen_get_country_name($order->delivery['country_id']) . '</span>';
            ?>
      </td>
		</tr>
<?php 
        }
        ?>
     <tr>
			<th scope="col" id="seProductsHeading"><?php 
        echo CART_SHIPPING_METHOD_TEXT;
        ?>
</th>
			<th scope="col" id="seTotalHeading"><?php 
        echo CART_SHIPPING_METHOD_RATES;
        ?>
</th>
Esempio n. 4
0
function handleMobileOutputBuffering($buffer)
{
    $mobile = createMobileObject();
    mb_http_output("Shift_JIS");
    $buffer = replaceTableToDiv($buffer);
    $buffer = scriptCancel($buffer);
    //  $buffer = convertCharsetSJIS($buffer);
    $buffer = replaceType("password", "text", $buffer);
    //   $buffer = imgAddBorder($buffer);
    $buffer = selectToInput('country', zen_get_country_name(SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY), $buffer);
    $buffer = selectToInput('state', $_POST['state'], $buffer);
    $buffer = replaceInputTypeImage($buffer);
    $buffer = replaceHtagToBtag($buffer);
    $buffer = preg_replace('/<noscript>.*?(<img src=.*?>).*?<\\/noscript>/si', '$1', $buffer);
    header("Content-type:text/html; charset=Shift_JIS");
    $buffer = replaceSpecialPriceSale($buffer);
    $buffer = mb_convert_encoding($buffer, 'SJIS', 'EUC-JP');
    $buffer = mb_convert_kana($buffer, 'k', 'SJIS');
    $buffer = mb_convert_kana($buffer, 'a', 'SJIS');
    // convert <form> tag
    $buffer = preg_replace_callback('#(<form.*?>)#', 'queryStringToHiddenField', $buffer);
    $buffer = preg_replace_callback('#(<form.*?>[\\s\\S]*?</form>)#', 'addHideSessionIDInsideForm', $buffer);
    // convert <input> tag (type=text
    $buffer = preg_replace_callback('#(<input.*?type="text".*?/>)#', 'addIStyleOrMode', $buffer);
    // convert <input> tag (type=password
    $buffer = preg_replace_callback('#(<input.*?type="password".*?/>)#', 'addIStyleOrMode', $buffer);
    // convert <a> tag
    $buffer = preg_replace_callback('#(<a.*?>)#', 'addSessionID', $buffer);
    // convert <img> tag
    $buffer = preg_replace_callback('#(<img.*?>)#', 'replaceImageForMobile', $buffer);
    $buffer = mobileEmojiConverter($buffer);
    if (!MOBILE_CSS_CONF) {
        $buffer = voidableCss($buffer);
    }
    if (MOBILE_SLIM_SIZE) {
        $buffer = slimSize($buffer);
    }
    $buffer = deleteInvalidTag($buffer);
    return $buffer;
}
Esempio n. 5
0
function zen_address_format($address_format_id, $address, $html, $boln, $eoln)
{
    global $db;
    $address_format = $db->Execute("select address_format as format\n                             from " . TABLE_ADDRESS_FORMAT . "\n                             where address_format_id = '" . (int) $address_format_id . "'");
    $company = zen_output_string_protected($address['company']);
    if (isset($address['firstname']) && zen_not_null($address['firstname'])) {
        $firstname = zen_output_string_protected($address['firstname']);
        $lastname = zen_output_string_protected($address['lastname']);
    } elseif (isset($address['name']) && zen_not_null($address['name'])) {
        $firstname = zen_output_string_protected($address['name']);
        $lastname = '';
    } else {
        $firstname = '';
        $lastname = '';
    }
    $street = zen_output_string_protected($address['street_address']);
    $suburb = zen_output_string_protected($address['suburb']);
    $city = zen_output_string_protected($address['city']);
    $state = zen_output_string_protected($address['state']);
    $telephone = zen_output_string_protected($address['telephone']);
    $fax = zen_output_string_protected($address['fax']);
    if (isset($address['country_id']) && zen_not_null($address['country_id'])) {
        $country = zen_get_country_name($address['country_id']);
        if (isset($address['zone_id']) && zen_not_null($address['zone_id'])) {
            $state = zen_get_zone_code($address['country_id'], $address['zone_id'], $state);
        }
    } elseif (isset($address['country']) && zen_not_null($address['country'])) {
        $country = zen_output_string_protected($address['country']);
    } else {
        $country = '';
    }
    $postcode = zen_output_string_protected($address['postcode']);
    $zip = $postcode;
    if ($html) {
        // HTML Mode
        $HR = '<hr>';
        $hr = '<hr>';
        if ($boln == '' && $eoln == "\n") {
            // Values not specified, use rational defaults
            $CR = '<br>';
            $cr = '<br>';
            $eoln = $cr;
        } else {
            // Use values supplied
            $CR = $eoln . $boln;
            $cr = $CR;
        }
    } else {
        // Text Mode
        $CR = $eoln;
        $cr = $CR;
        $HR = '----------------------------------------';
        $hr = '----------------------------------------';
    }
    $statecomma = '';
    $streets = $street;
    $state = zen_convert_to_zone_name_m17n($state) . ' ';
    if ($suburb != '') {
        $streets = $street . $cr . $suburb;
    }
    if ($country == '') {
        $country = zen_output_string_protected($address['country']);
    }
    if ($state != '') {
        $statecomma = $state . ', ';
    }
    if ($telephone != '') {
        $telephone = ENTRY_TELEPHONE_NUMBER . $telephone;
    }
    if ($fax != '') {
        $fax = ENTRY_FAX_NUMBER . $fax;
    }
    $fmt = $address_format->fields['format'];
    eval("\$address = \"{$fmt}\";");
    if (ACCOUNT_COMPANY == 'true' && zen_not_null($company)) {
        $address = $company . $cr . $address;
    }
    return $address;
}
Esempio n. 6
0
         </tr>
<?php 
    }
    ?>
          <tr>
            <td class="main"><?php 
    echo ENTRY_COUNTRY;
    ?>
</td>
            <td class="main">
<?php 
    if ($error == true) {
        if ($entry_country_error == true) {
            echo zen_draw_pull_down_menu('entry_country_id', zen_get_countries(), $cInfo->entry_country_id) . '&nbsp;' . ENTRY_COUNTRY_ERROR;
        } else {
            echo zen_get_country_name($cInfo->entry_country_id) . zen_draw_hidden_field('entry_country_id');
        }
    } else {
        echo zen_draw_pull_down_menu('entry_country_id', zen_get_countries(), $cInfo->entry_country_id);
    }
    ?>
</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php 
    echo zen_draw_separator('pixel_trans.gif', '1', '10');
    ?>
</td>
      </tr>
Esempio n. 7
0
 /**
  * Get actual quote from USPS
  *
  * @return array of results or boolean false if no results
  */
 function _getQuote()
 {
     global $order;
     global $shipping_weight, $currencies;
     global $logfilename;
     $package_id = 'USPS DOMESTIC RETURNED: ' . "\n";
     $usps_groundonly = 'false';
     if ($usps_groundonly == 'false') {
         // no GroundOnly products
         $usps_groundonly = '';
     } else {
         // 1+ GroundOnly products force Standard Post only
         $usps_groundonly = '<Content>' . '<ContentType>HAZMAT</ContentType>' . '</Content>' . '<GroundOnly>' . $usps_groundonly . '</GroundOnly>';
     }
     if ((int) SHIPPING_ORIGIN_ZIP == 0) {
         // no quotes obtained no 5 digit zip code origin set
         return array('module' => $this->title, 'error' => MODULE_SHIPPING_USPS_TEXT_ERROR . (MODULE_SHIPPING_USPS_SERVER == 'test' ? MODULE_SHIPPING_USPS_TEXT_TEST_MODE_NOTICE : ''));
     }
     if (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Logs') {
         $usps_instance_id = date('mdYGis');
         $usps_dir_logs = defined('DIR_FS_LOGS') ? DIR_FS_LOGS : DIR_FS_SQL_CACHE;
         $logfilename = $usps_dir_logs . '/SHIP_usps_Debug_' . $usps_instance_id . '_' . str_replace(' ', '', $order->delivery['country']['countries_iso_code_2']) . '_' . str_replace(' ', '', $order->delivery['postcode']) . '_' . $this->pounds . 'lb_' . $this->ounces . 'oz' . '.log';
     }
     $transreq = array();
     if (MODULE_SHIPPING_USPS_DEBUG_MODE != 'Off') {
         // display checked boxes
         $usps_shipping_methods_domestic = '';
         $usps_shipping_methods_international = '';
         $usps_shipping_country = "\n" . '==================================' . "\n\n" . 'USPS Country - $this->countries[$order->delivery[country][iso_code_2]]: ' . $this->countries[$order->delivery['country']['countries_iso_code_2']] . ' $this->usps_countries: ' . $this->usps_countries . "\n";
         if ($this->usps_countries == 'US') {
             $package_id_sent = 0;
             $usps_shipping_methods_domestic .= '<br />USPS DOMESTIC CHECKED: ' . MODULE_SHIPPING_USPS_RATE_TYPE . '<br />';
             foreach ($this->typeCheckboxesSelected as $key => $val) {
                 $requested_type = $this->typeCheckboxesSelected[$key];
                 $checked_request = ' min: ' . $this->typeCheckboxesSelected[$key + 1] . ' max: ' . $this->typeCheckboxesSelected[$key + 2] . ' handling: ' . $this->typeCheckboxesSelected[$key + 3];
                 if (is_numeric($requested_type) || empty($requested_type) || preg_match('#(GXG|International)#i', $requested_type)) {
                     continue;
                 }
                 $usps_shipping_methods_domestic .= 'Package ID sent: ' . $package_id_sent . ' ' . $requested_type . ' - ' . $checked_request . "\n";
                 $package_id_sent++;
             }
         } else {
             $usps_shipping_methods_international .= '<br />USPS INTERNATIONAL CHECKED: ' . MODULE_SHIPPING_USPS_RATE_TYPE . '<br />';
             foreach ($this->typeCheckboxesSelected as $key => $val) {
                 $requested_type = $this->typeCheckboxesSelected[$key];
                 $checked_request = ' min: ' . $this->typeCheckboxesSelected[$key + 1] . ' max: ' . $this->typeCheckboxesSelected[$key + 2] . ' handling: ' . $this->typeCheckboxesSelected[$key + 3];
                 if (is_numeric($requested_type) || empty($requested_type) || !preg_match('#(GXG|International)#i', $requested_type)) {
                     continue;
                 }
                 $usps_shipping_methods_international .= $requested_type . ' - ' . $checked_request . "\n";
             }
         }
         if (false && $_GET['main_page'] == 'popup_shipping_estimator' && MODULE_SHIPPING_USPS_DEBUG_MODE != 'Off') {
             echo '================================' . '<br />';
             echo $usps_shipping_methods_domestic;
             echo $usps_shipping_methods_international;
             echo '================================' . '<br />';
         }
     }
     $shipment_value = (double) $order->subtotal > 0 ? $order->subtotal + $order->getField('tax') : (!empty($_SESSION['cart']->total) ? $_SESSION['cart']->total : 0);
     $insurable_value = $shipment_value;
     // spiderr - where is this defined? - $uninsurable_value;
     // US Domestic destinations
     if ($order->delivery['country']['countries_iso_code_3'] == 'USA' || $this->usps_countries == 'US') {
         // build special services for domestic
         // Some Special Services cannot work with others
         $special_services_domestic = $this->special_services();
         $ZipDestination = substr(str_replace(' ', '', $order->delivery['postcode']), 0, 5);
         if ($ZipDestination == '') {
             return -1;
         }
         $request = '<RateV4Request USERID="' . MODULE_SHIPPING_USPS_USERID . '">' . '<Revision>2</Revision>';
         $package_count = 0;
         $ship_date = $this->zen_usps_shipdate();
         foreach ($this->typeCheckboxesSelected as $requested_type) {
             if (is_numeric($requested_type) || preg_match('#(GXG|International)#i', $requested_type)) {
                 continue;
             }
             $FirstClassMailType = '';
             $Container = 'VARIABLE';
             if (preg_match('#First\\-Class#i', $requested_type)) {
                 if ($shipping_weight > 13 / 16 || $shipping_weight > 0.21875 && $requested_type == 'First-Class Mail Letter') {
                     continue;
                 } else {
                     // First-Class MailRM Letter\', \'First-Class MailRM Large Envelope\', \'First-Class MailRM Parcel
                     $service = 'First-Class Mail';
                     if ($requested_type == 'First-Class Mail Letter') {
                         $FirstClassMailType = 'LETTER';
                     } elseif ($requested_type == 'First-Class Mail Large Envelope') {
                         $FirstClassMailType = 'FLAT';
                     } else {
                         $FirstClassMailType = 'PARCEL';
                         //$FirstClassMailType = 'PACKAGE SERVICE';
                     }
                 }
             } elseif ($requested_type == 'Media Mail Parcel') {
                 $service = 'MEDIA';
             } elseif ($requested_type == 'Standard PostRM') {
                 $service = 'PARCEL';
             } elseif (preg_match('#Priority Mail(?! Express)#i', $requested_type)) {
                 $service = 'PRIORITY COMMERCIAL';
                 if ($requested_type == 'Priority MailTM Flat Rate Envelope') {
                     $Container = 'FLAT RATE ENVELOPE';
                 } elseif ($requested_type == 'Priority MailTM Legal Flat Rate Envelope') {
                     $Container = 'LEGAL FLAT RATE ENVELOPE';
                 } elseif ($requested_type == 'Priority MailTM Padded Flat Rate Envelope') {
                     $Container = 'PADDED FLAT RATE ENVELOPE';
                 } elseif ($requested_type == 'Priority MailTM Small Flat Rate Box') {
                     $Container = 'SM FLAT RATE BOX';
                 } elseif ($requested_type == 'Priority MailTM Medium Flat Rate Box') {
                     $Container = 'MD FLAT RATE BOX';
                 } elseif ($requested_type == 'Priority MailTM Large Flat Rate Box') {
                     $Container = 'LG FLAT RATE BOX';
                 } elseif ($requested_type == 'Priority MailTM Regional Rate Box A') {
                     $Container = 'REGIONALRATEBOXA';
                 } elseif ($requested_type == 'Priority MailTM Regional Rate Box B') {
                     $Container = 'REGIONALRATEBOXB';
                 } elseif ($requested_type == 'Priority MailTM Regional Rate Box C') {
                     $Container = 'REGIONALRATEBOXC';
                 }
             } elseif (preg_match('#Priority Mail Express#i', $requested_type)) {
                 $service = 'EXPRESS COMMERCIAL';
                 if ($requested_type == 'Priority Mail ExpressTM Flat Rate Envelope') {
                     $Container = 'FLAT RATE ENVELOPE';
                 } elseif ($requested_type == 'Priority Mail ExpressTM Legal Flat Rate Envelope') {
                     $Container = 'LEGAL FLAT RATE ENVELOPE';
                 } elseif ($requested_type == 'Priority Mail ExpressTM Flat Rate Boxes') {
                     $Container = 'FLAT RATE BOX';
                 }
             } else {
                 continue;
             }
             $specialservices = $special_services_domestic;
             $width = MODULE_SHIPPING_USPS_WIDTH;
             $length = MODULE_SHIPPING_USPS_LENGTH;
             $height = MODULE_SHIPPING_USPS_HEIGHT;
             $girth = 108;
             $dimensions = '<Width>' . $width . '</Width>' . '<Length>' . $length . '</Length>' . '<Height>' . $height . '</Height>' . '<Girth>' . $girth . '</Girth>';
             $dimensions = '';
             $request .= '<Package ID="' . $package_count . '">' . '<Service>' . $service . '</Service>' . ($FirstClassMailType != '' ? '<FirstClassMailType>' . $FirstClassMailType . '</FirstClassMailType>' : '') . '<ZipOrigination>' . SHIPPING_ORIGIN_ZIP . '</ZipOrigination>' . '<ZipDestination>' . $ZipDestination . '</ZipDestination>' . '<Pounds>' . $this->pounds . '</Pounds>' . '<Ounces>' . $this->ounces . '</Ounces>' . '<Container>' . $Container . '</Container>' . '<Size>REGULAR</Size>' . $dimensions . '<Value>' . number_format($insurable_value, 2, '.', '') . '</Value>' . $specialservices . ($usps_groundonly != '' ? $usps_groundonly : '') . '<Machinable>' . ($this->machinable == 'True' ? 'TRUE' : 'FALSE') . '</Machinable>' . ($this->getTransitTime && $this->transitTimeCalculationMode == 'NEW' ? '<ShipDate>' . $ship_date . '</ShipDate>' : '') . '</Package>';
             $package_id .= 'Package ID returned: ' . $package_count . ' $requested_type: ' . $requested_type . ' $service: ' . $service . ' $Container: ' . $Container . "\n";
             $package_count++;
             if ($this->getTransitTime && $this->transitTimeCalculationMode == 'OLD') {
                 $transitreq = 'USERID="' . MODULE_SHIPPING_USPS_USERID . '">' . '<OriginZip>' . SHIPPING_ORIGIN_ZIP . '</OriginZip>' . '<DestinationZip>' . $ZipDestination . '</DestinationZip>';
                 //echo 'USPS $service: ' . $service . '<br>';
                 switch ($service) {
                     case 'PRIORITY COMMERCIAL':
                     case 'PRIORITY':
                         $transreq[$requested_type] = 'API=PriorityMail&XML=' . urlencode('<PriorityMailRequest ' . $transitreq . '</PriorityMailRequest>');
                         break;
                     case 'PARCEL':
                         $transreq[$requested_type] = 'API=StandardB&XML=' . urlencode('<StandardBRequest ' . $transitreq . '</StandardBRequest>');
                         break;
                     case 'First-Class Mail':
                         $transreq[$requested_type] = 'API=FirstClassMail&XML=' . urlencode('<FirstClassMailRequest ' . $transitreq . '</FirstClassMailRequest>');
                         break;
                     case 'MEDIA':
                     default:
                         $transreq[$requested_type] = '';
                         break;
                 }
             }
         }
         $request .= '</RateV4Request>';
         if (MODULE_SHIPPING_USPS_DEBUG_MODE != 'Off') {
             // prepare request for display
             $this->request_display = preg_replace(array('/<\\//', '/></', '/>  </', '/</', '/>/', '/&gt;  &lt;/', '/&gt;&lt;/'), array('&lt;/', '&gt;&lt;', '&gt;  &lt;', '&lt;', '&gt;', '&gt;<br>  &lt;', '&gt;<br>&lt;'), htmlspecialchars_decode($request));
             if (false && $_GET['main_page'] == 'popup_shipping_estimator' && MODULE_SHIPPING_USPS_DEBUG_MODE != 'Off') {
                 echo '<br />USPS DOMESTIC $request: <br />' . 'API=RateV4&XML=' . $this->request_display . '<br />';
             }
             // prepare request for debug log
             $this->request_display = $request;
         }
         $request = 'API=RateV4&XML=' . urlencode($request);
     } else {
         // INTERNATIONAL destinations
         // build extra services for international
         // Some Extra Services cannot work with others
         $extra_service_international = $this->extra_service();
         $intl_gxg_requested = 0;
         foreach ($this->typeCheckboxesSelected as $requested_type) {
             if (!is_numeric($requested_type) && preg_match('#(GXG)#i', $requested_type)) {
                 $intl_gxg_requested++;
             }
         }
         // rudimentary dimensions, since they cannot be passed as blanks
         if ($intl_gxg_requested) {
             $width = MODULE_SHIPPING_USPS_WIDTH_INTL;
             $length = MODULE_SHIPPING_USPS_LENGTH_INTL;
             $height = MODULE_SHIPPING_USPS_HEIGHT_INTL;
             $girth = 0;
         } else {
             $width = MODULE_SHIPPING_USPS_WIDTH;
             $length = MODULE_SHIPPING_USPS_LENGTH;
             $height = MODULE_SHIPPING_USPS_HEIGHT;
             $girth = 0;
         }
         // adjust <ValueOfContents> to not exceed $2499 per box
         global $shipping_num_boxes;
         $max_usps_allowed_price = $order->subtotal > 0 ? $order->subtotal + $order->getField('tax', 0) : (!empty($_SESSION['cart']) ? $_SESSION['cart']->total : 0);
         $max_usps_allowed_price = $max_usps_allowed_price / $shipping_num_boxes;
         $extraservices = $extra_service_international;
         $submission_value = $insurable_value > $max_usps_allowed_price ? $max_usps_allowed_price : $insurable_value;
         $request = '<IntlRateV2Request USERID="' . MODULE_SHIPPING_USPS_USERID . '">' . '<Revision>2</Revision>' . '<Package ID="0">' . '<Pounds>' . $this->pounds . '</Pounds>' . '<Ounces>' . $this->ounces . '</Ounces>' . '<MailType>All</MailType>' . '<GXG>' . '  <POBoxFlag>N</POBoxFlag>' . '  <GiftFlag>N</GiftFlag>' . '</GXG>' . '<ValueOfContents>' . number_format($submission_value, 2, '.', '') . '</ValueOfContents>' . '<Country>' . (empty($this->countries[$order->delivery['country']['countries_iso_code_2']]) ? zen_get_country_name($order->delivery['country']['countries_id']) : $this->countries[$order->delivery['country']['countries_iso_code_2']]) . '</Country>' . '<Container>RECTANGULAR</Container>' . '<Size>REGULAR</Size>' . '<Width>' . $width . '</Width>' . '<Length>' . $length . '</Length>' . '<Height>' . $height . '</Height>' . '<Girth>' . $girth . '</Girth>' . '<OriginZip>' . SHIPPING_ORIGIN_ZIP . '</OriginZip>' . '<CommercialFlag>Y</CommercialFlag>' . $extraservices . '</Package>' . '</IntlRateV2Request>';
         if ($this->getTransitTime) {
             $transreq[$requested_type] = '';
         }
         if (MODULE_SHIPPING_USPS_DEBUG_MODE != 'Off') {
             // prepare request for display
             $this->request_display = preg_replace(array('/<\\//', '/></', '/>  </', '/</', '/>/', '/&gt;  &lt;/', '/&gt;&lt;/'), array('&lt;/', '&gt;&lt;', '&gt;  &lt;', '&lt;', '&gt;', '&gt;<br>  &lt;', '&gt;<br>&lt;'), htmlspecialchars_decode($request));
             if (false && $_GET['main_page'] == 'popup_shipping_estimator' && MODULE_SHIPPING_USPS_DEBUG_MODE != 'Off') {
                 echo '<br />USPS INTERNATIONAL $request: <br />' . 'API=IntlRateV2&XML=' . $this->request_display . '<br />';
             }
             // prepare request for debug log
             $this->request_display = $request;
         }
         $request = 'API=IntlRateV2&XML=' . urlencode($request);
     }
     switch (MODULE_SHIPPING_USPS_SERVER) {
         case 'production':
             $usps_server = 'http://production.shippingapis.com';
             $api_dll = 'shippingapi.dll';
             break;
         case 'test':
         default:
             $usps_server = 'http://stg-production.shippingapis.com';
             $api_dll = 'ShippingApi.dll';
             break;
     }
     $body = '';
     // Send quote request via CURL
     global $request_type;
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $usps_server . '/' . $api_dll);
     curl_setopt($ch, CURLOPT_REFERER, $request_type == 'SSL' ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG);
     curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_VERBOSE, 0);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, 15);
     curl_setopt($ch, CURLOPT_SSLVERSION, 3);
     curl_setopt($ch, CURLOPT_USERAGENT, 'Zen Cart');
     if (CommerceSystem::isConfigActive('CURL_PROXY_REQUIRED')) {
         $this->proxy_tunnel_flag = defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE' ? false : true;
         curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, $this->proxy_tunnel_flag);
         curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
         curl_setopt($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS);
     }
     // submit request
     // set to TRUE to show times when debug is enabled
     $show_times = FALSE;
     if ($show_times && MODULE_SHIPPING_USPS_DEBUG_MODE != 'Off') {
         echo 'Time sent to USPS before curl_exec: ' . date('M d Y G:i:s') . ' ' . time() . '<br>';
     }
     $body = curl_exec($ch);
     $this->commError = curl_error($ch);
     $this->commErrNo = curl_errno($ch);
     $this->commInfo = @curl_getinfo($ch);
     // SUBMIT ADDITIONAL REQUESTS FOR DELIVERY TIME ESTIMATES
     if ($this->transitTimeCalculationMode == 'OLD' && $this->getTransitTime && sizeof($transreq)) {
         while (list($key, $value) = each($transreq)) {
             $transitResp[$key] = '';
             if ($value != '') {
                 curl_setopt($ch, CURLOPT_POSTFIELDS, $value);
                 $transitResp[$key] = curl_exec($ch);
             }
         }
         $this->parseDomesticLegacyAPITransitTimeResults($transitResp);
     }
     // done with CURL, so close connection
     curl_close($ch);
     if ($show_times && MODULE_SHIPPING_USPS_DEBUG_MODE != 'Off') {
         echo 'Time sent to USPS after curl_exec: ' . date('M d Y G:i:s') . ' ' . time() . '<br><br>';
     }
     // DEV ONLY - dump out the returned data for debugging
     if (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Email') {
         mail(STORE_OWNER_EMAIL_ADDRESS, 'Debug: USPS rate quote response', '(You can turn off this debug email by editing your USPS module settings in the admin area of your store.) ' . "\n\n" . $body, 'From: <' . EMAIL_FROM . '>');
     }
     //      echo 'USPS METHODS: <pre>'; echo print_r($body); echo '</pre>';
     if (MODULE_SHIPPING_USPS_DEBUG_MODE != 'Off') {
         global $shipping_weight, $currencies;
         $body_display_header = '';
         $body_display_header .= "\n" . 'USPS build: ' . MODULE_SHIPPING_USPS_VERSION . "\n\n";
         $body_display_header .= 'Server: ' . MODULE_SHIPPING_USPS_SERVER . "\n";
         $body_display_header .= 'Quote Request Rate Type: ' . MODULE_SHIPPING_USPS_RATE_TYPE . "\n";
         $body_display_header .= 'Quote from main_page: ' . $_GET['main_page'] . "\n";
         $body_display_header .= 'USPS Options (weight, time): ' . MODULE_SHIPPING_USPS_OPTIONS . "\n";
         $body_display_header .= 'USPS Domestic Transit Time Calculation Mode: ' . MODULE_SHIPPING_USPS_TRANSIT_TIME_CALCULATION_MODE . "\n";
         $body_display_header .= "\n" . 'Cart Weight: ' . $_SESSION['cart']->weight . "\n";
         $body_display_header .= 'Total Quote Weight: ' . $shipping_weight . ' Pounds: ' . $this->pounds . ' Ounces: ' . $this->ounces . "\n";
         $body_display_header .= 'Maximum: ' . SHIPPING_MAX_WEIGHT . ' Tare Rates: Small/Medium: ' . SHIPPING_BOX_WEIGHT . ' Large: ' . SHIPPING_BOX_PADDING . "\n";
         $body_display_header .= 'Handling method: ' . MODULE_SHIPPING_USPS_HANDLING_METHOD . ' Handling fee Domestic: ' . $currencies->format(MODULE_SHIPPING_USPS_HANDLING) . ' Handling fee International: ' . $currencies->format(MODULE_SHIPPING_USPS_HANDLING_INT) . "\n";
         $body_display_header .= 'Decimals: ' . MODULE_SHIPPING_USPS_DECIMALS . "\n";
         $body_display_header .= 'Domestic Length: ' . MODULE_SHIPPING_USPS_LENGTH . ' Width: ' . MODULE_SHIPPING_USPS_WIDTH . ' Height: ' . MODULE_SHIPPING_USPS_HEIGHT . "\n";
         $body_display_header .= 'International Length: ' . MODULE_SHIPPING_USPS_LENGTH_INTL . ' Width: ' . MODULE_SHIPPING_USPS_WIDTH_INTL . ' Height: ' . MODULE_SHIPPING_USPS_HEIGHT_INTL . "\n";
         $body_display_header .= "\n" . 'ZipOrigination: ' . ((int) SHIPPING_ORIGIN_ZIP == 0 ? '***WARNING: NO STORE 5 DIGIT ZIP CODE SET' : SHIPPING_ORIGIN_ZIP) . "\n" . 'ZipDestination: ' . $order->delivery['postcode'] . (!empty($this->countries[$order->delivery['country']['countries_iso_code_2']]) ? ' Country: ' . $this->countries[$order->delivery['country']['countries_iso_code_2']] : '') . ($order->delivery['city'] != '' ? ' City: ' . $order->delivery['city'] : '') . ($order->delivery['state'] != '' ? ' State: ' . $order->delivery['state'] : '') . "\n";
         $body_display_header .= 'Order SubTotal: ' . $currencies->format($order->info['subtotal']) . "\n";
         $body_display_header .= 'Order Total: ' . $currencies->format($shipment_value) . "\n";
         $body_display_header .= 'Uninsurable Portion: ' . $currencies->format($uninsurable_value) . "\n";
         $body_display_header .= 'Insurable Value: ' . $currencies->format($insurable_value) . "\n";
         $body_display_header .= "\n" . 'RESPONSE FROM USPS: ' . "\n";
         $body_display_header .= "\n" . '==================================' . "\n";
         // build list of requested shipping services
         $services_domestic = 'Domestic Services Selected: ' . "\n";
         $services_international = 'International Services Selected: ' . "\n";
         // Domestic/US destination:
         if ($this->usps_countries == 'US') {
             $dOptions = explode(', ', MODULE_SHIPPING_USPS_DMST_SERVICES);
             // domestic
             foreach ($dOptions as $key => $val) {
                 if (strlen($dOptions[$key]) > 1) {
                     if ($dOptions[$key + 1] == 'C' || $dOptions[$key + 1] == 'S' || $dOptions[$key + 1] == 'Y') {
                         $services_domestic .= $dOptions[$key] . "\n";
                     }
                     //echo '$dOptions[$key]: > 1 ' . $dOptions[$key] . ' $dOptions[$key+1]: ' . $dOptions[$key+1] . '<br>';
                 }
             }
         } else {
             // International destination:
             $iOptions = explode(', ', MODULE_SHIPPING_USPS_INTL_SERVICES);
             foreach ($iOptions as $key => $val) {
                 if (strlen($iOptions[$key]) > 1) {
                     if ($iOptions[$key + 1] == 'C' || $iOptions[$key + 1] == 'S' || $iOptions[$key + 1] == 'Y') {
                         $services_international .= $iOptions[$key] . "\n";
                     }
                     //echo '$iOptions[$key]: > 1 ' . $iOptions[$key] . ' $iOptions[$key+1]: ' . $iOptions[$key+1] . '<br>';
                 }
             }
         }
         if ($this->usps_countries == 'US') {
             $usps_shipping_services_selected = $services_domestic;
         } else {
             $usps_shipping_services_selected = $services_international;
         }
         $usps_shipping_country = str_replace("<br />", "\n", $usps_shipping_country);
         $usps_shipping_methods_domestic = str_replace("<br />", "\n", $usps_shipping_methods_domestic);
         $usps_shipping_methods_international = str_replace("<br />", "\n", $usps_shipping_methods_international);
         if ($this->usps_countries == 'US') {
             $usps_shipping_methods_selected = $usps_shipping_methods_domestic . "\n\n" . $package_id . "\n\n";
         } else {
             $usps_shipping_methods_selected = $usps_shipping_methods_international . "\n\n";
         }
     }
     if (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Screen') {
         echo ($this->commErrNo != 0 ? '<br />' . $this->commErrNo . ' ' . $this->commError : '') . '<br /><pre>' . $body . '</pre><br />';
     }
     if (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Logs') {
         // skip debug log if no destination zipcode is set:   0==(int)SHIPPING_ORIGIN_ZIP
         $fp = @fopen($logfilename, 'a');
         if ($fp && $this->commErrNo != 0) {
             fwrite($fp, date('M d Y G:i:s') . ' -- ' . 'CommErr (should be 0): ' . $this->commErrNo . ' - ' . $this->commError . "\n\n\n\n" . $body_display_header . "\n\n" . $usps_shipping_country . $usps_shipping_methods_selected . '==================================' . "\n\n" . $usps_shipping_services_selected . "\n" . '==================================' . "\n\n" . 'SENT TO USPS:' . "\n\n");
             fclose($fp);
         }
     }
     //if communication error, return -1 because no quotes were found, and user doesn't need to see the actual error message (set DEBUG mode to get the messages logged instead)
     if ($this->commErrNo != 0) {
         return -1;
     }
     if (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Logs' || MODULE_SHIPPING_USPS_DEBUG_MODE == 'Screen') {
         $body_display = str_replace('&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;', 'TM', $body);
         $body_display = str_replace('&amp;lt;sup&amp;gt;&amp;#174;&amp;lt;/sup&amp;gt;', 'RM', $body_display);
         $body_display = str_replace('<Service ID', (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Logs' ? "\n\n" : '<br /><br />') . '<Service ID', $body_display);
         $body_display = str_replace('</Service>', '</Service>' . "\n", $body_display);
         $body_display = str_replace('<SvcDescription', (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Logs' ? "\n" : '<br />') . '<SvcDescription', $body_display);
         $body_display = str_replace('<MaxDimensions>', "\n" . '<MaxDimensions>', $body_display);
         $body_display = str_replace('<MaxWeight>', "\n" . '<MaxWeight>', $body_display);
         $body_display = str_replace('<Package ID', (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Logs' ? "\n\n\n" : '<br /><br /><br />') . '<Package ID', $body_display);
         $body_display = str_replace('<Postage CLASSID', "\n" . '<Postage CLASSID', $body_display);
         $body_display = str_replace('<Rate>', (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Logs' ? "\n" : '<br />') . '<Rate>', $body_display);
         $body_display = str_replace('<SpecialServices', (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Logs' ? "\n" : '<br />') . '<SpecialServices', $body_display);
         $body_display = str_replace('<ServiceID>', "\n" . '<ServiceID>', $body_display);
         $body_display = str_replace('<Description>', "\n" . '<Description>', $body_display);
         if ($this->usps_countries == 'US') {
             $body_display = str_replace('</Postage>', "\n" . '</Postage>', $body_display);
             $body_display = str_replace('<Location>', "\n\t\t\t" . '<Location>', $body_display);
             $body_display = str_replace('</RateV4Response>', "\n" . '</RateV4Response>', $body_display);
         }
         if ($this->usps_countries != 'US') {
             $body_display = str_replace('<Postage>', (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Logs' ? "\n" : '<br />') . '<Postage>', $body_display);
             $body_display = str_replace('<ValueOfContents>', "\n" . '<ValueOfContents>', $body_display);
         }
         if (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Screen') {
             echo '<br />View Source:<br />' . "\n" . $body_display_header . "\n\n" . $body_display . '<br />';
         }
         if (MODULE_SHIPPING_USPS_DEBUG_MODE == 'Logs') {
             // skip debug log if no destination zipcode is set
             $fp = @fopen($logfilename, 'a');
             if ($fp) {
                 $this->request_display = preg_replace(array('/></', '/>  </'), array('>' . "\n" . '<', '>' . "\n" . ' <'), htmlspecialchars_decode($this->request_display));
                 fwrite($fp, date('M d Y G:i:s') . ' -- ' . $body_display_header . "\n\n" . $body_display . "\n\n" . $usps_shipping_country . $usps_shipping_methods_selected . '==================================' . "\n\n" . $usps_shipping_services_selected . "\n" . '==================================' . "\n\n" . 'SENT TO USPS:' . "\n\n" . $this->request_display . "\n\n" . "============\n\nRAW XML FROM USPS:\n\n" . print_r(simplexml_load_string($body), true) . "\n\n");
                 fclose($fp);
             }
         }
     }
     // This occasionally threw an error with simplexml; may only be needed for the test server but could change in the future for the production server
     /* $body = str_replace('<?xml version="1.0" encoding="UTF-8"?>', '<?xml version="1.0"?>', $body);
      */
     $body_array = simplexml_load_string($body);
     $body_encoded = json_decode(json_encode($body_array), TRUE);
     return $body_encoded;
 }
Esempio n. 8
0
function zen_address_format($address_format_id, $address, $html, $boln, $eoln)
{
    global $gBitDb;
    $address_format_query = "select `address_format` as `format`\n                             from " . TABLE_ADDRESS_FORMAT . "\n                             where `address_format_id` = '" . (int) $address_format_id . "'";
    $address_format = $gBitDb->query($address_format_query);
    $company = zen_output_string_protected($address['company']);
    if (!empty($address['firstname'])) {
        $firstname = zen_output_string_protected($address['firstname']);
        $lastname = zen_output_string_protected($address['lastname']);
    } elseif (!empty($address['name'])) {
        $firstname = zen_output_string_protected($address['name']);
        $lastname = '';
    } else {
        $firstname = '';
        $lastname = '';
    }
    $street = zen_output_string_protected($address['street_address']);
    $suburb = zen_output_string_protected($address['suburb']);
    $city = zen_output_string_protected($address['city']);
    $state = zen_output_string_protected($address['state']);
    $telephone = isset($address['telephone']) ? zen_output_string_protected($address['telephone']) : NULL;
    if (!empty($address['country_id'])) {
        $country = zen_get_country_name($address['country_id']);
        if (!empty($address['zone_id'])) {
            $state = zen_get_zone_code($address['country_id'], $address['zone_id'], $state);
        }
    } elseif (!empty($address['country'])) {
        if (is_array($address['country'])) {
            $country = zen_output_string_protected($address['country']['countries_name']);
        } else {
            $country = zen_output_string_protected($address['country']);
        }
    } else {
        $country = '';
    }
    $postcode = zen_output_string_protected($address['postcode']);
    $zip = $postcode;
    if ($html) {
        // HTML Mode
        $HR = '<hr />';
        $hr = '<hr />';
        if (empty($boln) && $eoln == "\n") {
            // Values not specified, use rational defaults
            $CR = '<br />';
            $cr = '<br />';
            $eoln = $cr;
        } else {
            // Use values supplied
            $CR = $eoln . $boln;
            $cr = $CR;
        }
    } else {
        // Text Mode
        $CR = $eoln;
        $cr = $CR;
        $HR = '----------------------------------------';
        $hr = '----------------------------------------';
    }
    $statecomma = '';
    $streets = $street;
    if ($suburb != '') {
        $streets = $street . $cr . $suburb;
    }
    if (empty($country)) {
        if (is_array($address['country'])) {
            $country = zen_output_string_protected($address['country']['countries_name']);
        } else {
            $country = zen_output_string_protected($address['country']);
        }
    }
    if ($state != '') {
        $statecomma = $state . ', ';
    }
    $fmt = $address_format->fields['format'];
    eval("\$address_out = \"{$fmt}\";");
    if (!empty($telephone)) {
        $address_out .= $cr . $telephone;
    }
    if (ACCOUNT_COMPANY == 'true' && zen_not_null($company)) {
        $address_out = $company . $cr . $address_out;
    }
    return $address_out;
}
Esempio n. 9
0
    $messageStack->add('header', TEXT_EZPAGES_STATUS_HEADER_ADMIN, 'caution');
}
if (EZPAGES_STATUS_FOOTER == '2' && strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])) {
    $messageStack->add('header', TEXT_EZPAGES_STATUS_FOOTER_ADMIN, 'caution');
}
if (EZPAGES_STATUS_SIDEBOX == '2' && strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])) {
    $messageStack->add('header', TEXT_EZPAGES_STATUS_SIDEBOX_ADMIN, 'caution');
}
if (defined('STRICT_ERROR_REPORTING') && STRICT_ERROR_REPORTING == true) {
    $messageStack->add('header', 'STRICT ERROR REPORTING IS ON', 'warning');
}
// if down for maintenance, prevent indexing
if (DOWN_FOR_MAINTENANCE == 'true' && !strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])) {
    header("HTTP/1.1 503 Service Unavailable");
}
/* Check for invalid countries in customer's address book.
 * If a customer is logged in, check to see that the customers' address(es) still contain valid countries.
* If not, redirect to the address-book page for changes.
*/
if ($_SESSION['customer_id'] && $_GET['main_page'] != FILENAME_ADDRESS_BOOK_PROCESS && $_GET['main_page'] != FILENAME_LOGOFF) {
    $addresses_query = "SELECT address_book_id, entry_country_id as country_id, entry_firstname as firstname, entry_lastname as lastname\n                      FROM   " . TABLE_ADDRESS_BOOK . "\n                      WHERE  customers_id = :customersID\n                      ORDER BY firstname, lastname";
    $addresses_query = $db->bindVars($addresses_query, ':customersID', $_SESSION['customer_id'], 'integer');
    $addresses = $db->Execute($addresses_query);
    while (!$addresses->EOF) {
        if (zen_get_country_name($addresses->fields['country_id'], TRUE) == '') {
            $messageStack->add_session('addressbook', sprintf(ERROR_TEXT_COUNTRY_DISABLED_PLEASE_CHANGE, zen_get_country_name($addresses->fields['country_id'], FALSE)), 'error');
            zen_redirect(zen_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'edit=' . $addresses->fields['address_book_id'], 'SSL'));
        }
        $addresses->MoveNext();
    }
}
Esempio n. 10
0
     $newOption['orders_id'] = $_REQUEST['oID'];
     $newOption['orders_products_id'] = $_REQUEST['orders_products_id'];
     $gBitDb->associateInsert(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $newOption);
     $order->updateStatus(array('comments' => 'Added Product Option: ' . $newOption['products_options'] . ' => ' . $newOption['products_options_values'] . ' (' . $_REQUEST['newOrderOptionValue'] . ')'));
     bit_redirect(BITCOMMERCE_PKG_URL . 'admin/orders.php?oID=' . $_REQUEST['oID'] . '&action=edit');
     break;
 case 'save_address':
     $addressType = $_REQUEST['address_type'];
     $saveAddress[$addressType . '_name'] = $_REQUEST['name'];
     $saveAddress[$addressType . '_company'] = $_REQUEST['company'];
     $saveAddress[$addressType . '_street_address'] = $_REQUEST['street_address'];
     $saveAddress[$addressType . '_suburb'] = $_REQUEST['suburb'];
     $saveAddress[$addressType . '_city'] = $_REQUEST['city'];
     $saveAddress[$addressType . '_state'] = $_REQUEST['state'];
     $saveAddress[$addressType . '_postcode'] = $_REQUEST['postcode'];
     $saveAddress[$addressType . '_country'] = zen_get_country_name($_REQUEST['country_id']);
     $saveAddress[$addressType . '_telephone'] = $_REQUEST['telephone'];
     $gBitDb->StartTrans();
     $gBitDb->associateUpdate(TABLE_ORDERS, $saveAddress, array('orders_id' => $_REQUEST['oID']));
     $gBitDb->CompleteTrans();
     bit_redirect($_SERVER['SCRIPT_NAME'] . '?oID=' . $_REQUEST['oID']);
     exit;
     break;
 case 'update_order':
     if (!empty($_REQUEST['charge_amount']) && !empty($_REQUEST['charge_amount'])) {
         $formatCharge = $currencies->format($_REQUEST['charge_amount'], FALSE, BitBase::getParameter($_REQUEST, 'charge_currency'));
         $_REQUEST['cc_ref_id'] = $order->info['cc_ref_id'];
         if ($paymentModule = $order->getPaymentModule()) {
             if ($paymentModule->processPayment($_REQUEST, $order)) {
                 $statusMsg = tra('A payment adjustment has been made to this order for the following amount:') . "\n" . $formatCharge . ' ' . tra('Transaction ID:') . "\n" . $paymentModule->getTransactionReference();
                 $_REQUEST['comments'] = (!empty($_REQUEST['comments']) ? $_REQUEST['comments'] . "\n\n" : '') . $statusMsg;
 if ($status < 1) {
     break;
 }
 $order_updated = false;
 $sql_data_array = array('customers_name' => zen_db_prepare_input($_POST['update_customer_name']), 'customers_company' => zen_db_prepare_input($_POST['update_customer_company']), 'customers_street_address' => zen_db_prepare_input($_POST['update_customer_street_address']), 'customers_suburb' => zen_db_prepare_input($_POST['update_customer_suburb']), 'customers_city' => zen_db_prepare_input($_POST['update_customer_city']), 'customers_state' => zen_db_prepare_input($_POST['update_customer_state']), 'customers_postcode' => zen_db_prepare_input($_POST['update_customer_postcode']), 'customers_country' => zen_db_prepare_input($_POST['update_customer_country']), 'customers_telephone' => zen_db_prepare_input($_POST['update_customer_telephone']), 'customers_email_address' => zen_db_prepare_input($_POST['update_customer_email_address']), 'last_modified' => 'now()', 'billing_name' => zen_db_prepare_input($_POST['update_billing_name']), 'billing_company' => zen_db_prepare_input($_POST['update_billing_company']), 'billing_street_address' => zen_db_prepare_input($_POST['update_billing_street_address']), 'billing_suburb' => zen_db_prepare_input($_POST['update_billing_suburb']), 'billing_city' => zen_db_prepare_input($_POST['update_billing_city']), 'billing_state' => zen_db_prepare_input($_POST['update_billing_state']), 'billing_postcode' => zen_db_prepare_input($_POST['update_billing_postcode']), 'billing_country' => zen_db_prepare_input($_POST['update_billing_country']), 'delivery_name' => zen_db_prepare_input($_POST['update_delivery_name']), 'delivery_company' => zen_db_prepare_input($_POST['update_delivery_company']), 'delivery_street_address' => zen_db_prepare_input($_POST['update_delivery_street_address']), 'delivery_suburb' => zen_db_prepare_input($_POST['update_delivery_suburb']), 'delivery_city' => zen_db_prepare_input($_POST['update_delivery_city']), 'delivery_state' => zen_db_prepare_input($_POST['update_delivery_state']), 'delivery_postcode' => zen_db_prepare_input($_POST['update_delivery_postcode']), 'delivery_country' => zen_db_prepare_input($_POST['update_delivery_country']), 'payment_method' => zen_db_prepare_input($_POST['update_info_payment_method']), 'cc_type' => zen_db_prepare_input($_POST['update_info_cc_type']), 'cc_owner' => zen_db_prepare_input($_POST['update_info_cc_owner']), 'cc_expires' => zen_db_prepare_input($_POST['update_info_cc_expires']));
 // If the country was passed as an id, change it to the country name for
 // storing in the database. This is done in case a country is removed in
 // the future, so the country name is still associated with the order.
 if (is_numeric($sql_data_array['customers_country'])) {
     $sql_data_array['customers_country'] = zen_get_country_name((int) $sql_data_array['customers_country']);
 }
 if (is_numeric($sql_data_array['billing_country'])) {
     $sql_data_array['billing_country'] = zen_get_country_name((int) $sql_data_array['billing_country']);
 }
 if (is_numeric($sql_data_array['delivery_country'])) {
     $sql_data_array['delivery_country'] = zen_get_country_name((int) $sql_data_array['delivery_country']);
 }
 // For PA-DSS Compliance, we no longer store the Credit Card number in
 // the database. While inconvenient, this saves us in the event of an audit.
 if (array_key_exists('update_info_cc_number', $_POST)) {
     $update_info_cc_number = zen_db_prepare_input($_POST['update_info_cc_number']);
     // If the number is not already obscufated, we use the same method
     // as the authorize.net module to obscufate the entered CC number
     if (is_numeric($update_info_cc_number)) {
         $update_info_cc_number = str_pad(substr($_POST['update_info_cc_number'], -4), strlen($_POST['update_info_cc_number']), "X", STR_PAD_LEFT);
     }
     $sql_data_array['cc_number'] = $update_info_cc_number;
     unset($_POST['update_info_cc_number']);
 }
 zen_db_perform(TABLE_ORDERS, $sql_data_array, 'update', 'orders_id = \'' . (int) $oID . '\'');
 // BEGIN TY TRACKER 1 - READ FROM POST