Example #1
0
function save_upload($temp_file, $filename, $dir_dest)
{
    global $upload_ext_filter;
    $filename = remove_special_chars($filename);
    $file = $dir_dest . $filename;
    $filesize = filesize($temp_file);
    $is_denied = false;
    foreach ($upload_ext_filter as $key => $ext) {
        if (eregi($ext, $filename)) {
            $is_denied = true;
            break;
        }
    }
    if (!$is_denied) {
        if (!check_limit($filesize)) {
            if (file_exists($file)) {
                if (unlink($file)) {
                    if (copy($temp_file, $file)) {
                        @chmod($file, 0755);
                        $out = 6;
                    } else {
                        $out = 2;
                    }
                } else {
                    $out = 5;
                }
            } else {
                if (copy($temp_file, $file)) {
                    @chmod($file, 0755);
                    $out = 1;
                } else {
                    $out = 2;
                }
            }
        } else {
            $out = 3;
        }
    } else {
        $out = 4;
    }
    return $out;
}
Example #2
0
 function FormatFedExShipRequest($pkg, $key)
 {
     global $ZONE001_DEFINES, $debug;
     $crlf = chr(13) . chr(10);
     if ($pkg->ship_method == 'GND' || $pkg->ship_method == 'GDR') {
         $carrier_code = 'FDXG';
         // Ground and Ground Home Delivery
     } else {
         $carrier_code = 'FDXE';
         // Express (all types)
     }
     $sBody = '<?xml version="1.0" encoding="UTF-8" ?>';
     $sBody .= $crlf . '<FDXShipRequest xmlns:api="http://www.fedex.com/fsmapi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FDXShipRequest.xsd">';
     $sBody .= $crlf . '<RequestHeader>';
     $sBody .= $crlf . '<CustomerTransactionIdentifier>FedEx Ship Request</CustomerTransactionIdentifier>';
     $sBody .= $crlf . '<AccountNumber>' . MODULE_SHIPPING_FEDEX_ACCOUNT_NUMBER . '</AccountNumber>';
     $sBody .= $crlf . '<MeterNumber>' . MODULE_SHIPPING_FEDEX_RATE_LICENSE . '</MeterNumber>';
     $sBody .= $crlf . '<CarrierCode>' . $carrier_code . '</CarrierCode>';
     $sBody .= $crlf . '</RequestHeader>';
     $sBody .= $crlf . '<ShipDate>' . $pkg->terminal_date . '</ShipDate>';
     $sBody .= $crlf . '<ShipTime>' . date('H:i:s', time()) . '</ShipTime>';
     $sBody .= $crlf . '<DropoffType>' . $this->FedExPickupMap[$pkg->pickup_service] . '</DropoffType>';
     //Service
     // special case if residential checked and GND service (commercial) is selected, change to GDR home delivery
     $temp = array_flip($this->FedExRateCodes);
     $ship_method = $pkg->residential_address && $pkg->ship_method == 'GND' ? 'GDR' : $pkg->ship_method;
     $sBody .= $crlf . '<Service>' . $temp[$ship_method] . '</Service>';
     $sBody .= $crlf . '<Packaging>' . $this->PackageMap[$pkg->pkg_type] . '</Packaging>';
     // TBD convert weight to pounds if in KGs
     $sBody .= $crlf . '<WeightUnits>' . $pkg->pkg_weight_unit . '</WeightUnits>';
     // TBD total shipment weight or package weight
     $sBody .= $crlf . '<Weight>' . number_format($pkg->package[$key]['weight'], 1) . '</Weight>';
     $sBody .= $crlf . '<CurrencyCode>' . $pkg->insurance_currency . '</CurrencyCode>';
     $sBody .= $crlf . '<ListRate>1</ListRate>';
     if ($pkg->return_service) {
         $sBody .= $crlf . '<ReturnShipmentIndicator>PRINTRETURNLABEL</ReturnShipmentIndicator>';
     }
     // Origin
     $sBody .= $crlf . '<Origin>';
     $sBody .= $crlf . '<Contact>';
     $sBody .= $crlf . '<CompanyName>' . COMPANY_NAME . '</CompanyName>';
     $sBody .= $crlf . '<PhoneNumber>' . strip_alphanumeric(COMPANY_TELEPHONE1) . '</PhoneNumber>';
     if (COMPANY_FAX) {
         $sBody .= $crlf . '<FaxNumber>' . strip_alphanumeric(COMPANY_FAX) . '</FaxNumber>';
     }
     if (COMPANY_EMAIL) {
         $sBody .= $crlf . '<E-MailAddress>' . COMPANY_EMAIL . '</E-MailAddress>';
     }
     $sBody .= $crlf . '</Contact>';
     $sBody .= $crlf . '<Address>';
     $sBody .= $crlf . '<Line1>' . COMPANY_ADDRESS1 . '</Line1>';
     if (COMPANY_ADDRESS2) {
         $sBody .= $crlf . '<Line2>' . COMPANY_ADDRESS2 . '</Line2>';
     }
     $sBody .= $crlf . '<City>' . COMPANY_CITY_TOWN . '</City>';
     $country_code = gen_get_country_iso_2_from_3(COMPANY_COUNTRY);
     if ($country_code == 'US' || $country_code == 'CA') {
         $sBody .= $crlf . '<StateOrProvinceCode>' . COMPANY_ZONE . '</StateOrProvinceCode>';
     }
     if ($country_code == 'US' || $country_code == 'CA' || COMPANY_POSTAL_CODE != '') {
         $sBody .= $crlf . '<PostalCode>' . strip_alphanumeric(COMPANY_POSTAL_CODE) . '</PostalCode>';
     }
     $sBody .= $crlf . '<CountryCode>' . $country_code . '</CountryCode>';
     $sBody .= $crlf . '</Address>';
     $sBody .= $crlf . '</Origin>';
     // Destination
     $sBody .= $crlf . '<Destination>';
     $sBody .= $crlf . '<Contact>';
     if ($pkg->ship_contact) {
         $sBody .= $crlf . '<PersonName>' . remove_special_chars($pkg->ship_contact) . '</PersonName>';
     }
     $sBody .= $crlf . '<CompanyName>' . remove_special_chars($pkg->ship_primary_name) . '</CompanyName>';
     $sBody .= $crlf . '<PhoneNumber>' . strip_alphanumeric($pkg->ship_telephone1) . '</PhoneNumber>';
     if ($pkg->ship_email) {
         $sBody .= $crlf . '<E-MailAddress>' . $pkg->ship_email . '</E-MailAddress>';
     }
     $sBody .= $crlf . '</Contact>';
     $sBody .= $crlf . '<Address>';
     $sBody .= $crlf . '<Line1>' . remove_special_chars($pkg->ship_address1) . '</Line1>';
     if ($pkg->ship_address2) {
         $sBody .= $crlf . '<Line2>' . remove_special_chars($pkg->ship_address2) . '</Line2>';
     }
     $sBody .= $crlf . '<City>' . strtoupper($pkg->ship_city_town) . '</City>';
     if ($pkg->ship_country_code == 'US' || $pkg->ship_country_code == 'CA') {
         $sBody .= $crlf . '<StateOrProvinceCode>' . strtoupper($pkg->ship_state_province) . '</StateOrProvinceCode>';
     }
     if ($pkg->ship_country_code == 'US' || $pkg->ship_country_code == 'CA' || $pkg->ship_postal_code != '') {
         $sBody .= $crlf . '<PostalCode>' . strip_alphanumeric($pkg->ship_postal_code) . '</PostalCode>';
     }
     $sBody .= $crlf . '<CountryCode>' . $pkg->ship_country_code . '</CountryCode>';
     $sBody .= $crlf . '</Address>';
     $sBody .= $crlf . '</Destination>';
     // Payment
     $sBody .= $crlf . '<Payment>';
     $sBody .= $crlf . '<PayorType>' . $this->PaymentMap[$pkg->bill_charges] . '</PayorType>';
     if ($pkg->bill_charges == '1' || $pkg->bill_charges == '2') {
         $sBody .= $crlf . '<Payor>';
         $sBody .= $crlf . '<AccountNumber>' . $pkg->bill_acct . '</AccountNumber>';
         $sBody .= $crlf . '<CountryCode>' . $pkg->ship_country_code . '</CountryCode>';
         $sBody .= $crlf . '</Payor>';
     }
     $sBody .= $crlf . '</Payment>';
     // Reference info
     $sBody .= $crlf . '<ReferenceInfo>';
     //		$sBody .= $crlf . '<CustomerReference>' . $pkg->purchase_invoice_id . '</CustomerReference>';
     if ($pkg->so_po_ref_id) {
         $sBody .= $crlf . '<PONumber>' . $pkg->so_po_ref_id . '</PONumber>';
     }
     $sBody .= $crlf . '<InvoiceNumber>' . $pkg->purchase_invoice_id . '</InvoiceNumber>';
     $sBody .= $crlf . '</ReferenceInfo>';
     // Package
     // TBD what about MPS???
     if ($pkg->pkg_type == '02') {
         // customer supplied packaging
         $sBody .= $crlf . '<Dimensions>';
         $sBody .= $crlf . '<Length>' . $pkg->package[$key]['length'] . '</Length>';
         $sBody .= $crlf . '<Width>' . $pkg->package[$key]['width'] . '</Width>';
         $sBody .= $crlf . '<Height>' . $pkg->package[$key]['height'] . '</Height>';
         $sBody .= $crlf . '<Units>' . $pkg->pkg_dimension_unit . '</Units>';
         $sBody .= $crlf . '</Dimensions>';
     }
     $sBody .= $crlf . '<DeclaredValue>' . number_format($pkg->package[$key]['value'], 2) . '</DeclaredValue>';
     // Special Services
     $sBody .= $crlf . '<SpecialServices>';
     if ($pkg->cod) {
         $sBody .= $crlf . '<COD>';
         $sBody .= $crlf . '<CollectionAmount>' . $pkg->total_amount . '</CollectionAmount>';
         $sBody .= $crlf . '<CollectionType>' . $this->CODMap[$pkg->cod_payment_type] . '</CollectionType>';
         $sBody .= $crlf . '</COD>';
     }
     //		$sBody .= $crlf . '<HoldAtLocation>' . $pkg->hold_at_location . '</HoldAtLocation>'; // NOT USED AT THIS TIME
     //		$sBody .= $crlf . '<DangerousGoods>';
     //		$sBody .= $crlf . '<Accessibility>' . $pkg->accessibility . '</Accessibility>'; // NOT USED AT THIS TIME
     //		$sBody .= $crlf . '</DangerousGoods>';
     //		if ($pkg->dry_ice) $sBody .= $crlf . '<DryIce>1</DryIce>';
     //		$sBody .= $crlf . '<ResidentialPickup>' . $pkg->res_pickup . '</ResidentialPickup>'; // NOT USED AT THIS TIME
     if ($pkg->residential_address) {
         $sBody .= $crlf . '<ResidentialDelivery>1</ResidentialDelivery>';
     }
     //		$sBody .= $crlf . '<InsidePickup>' . $pkg->inside_pickup . '</InsidePickup>';
     //		$sBody .= $crlf . '<InsideDelivery>' . $pkg->inside_delivery . '</InsideDelivery>';
     //		if ($pkg->saturday_pickup) $sBody .= $crlf . '<SaturdayPickup>1</SaturdayPickup>';
     if ($pkg->saturday_delivery) {
         $sBody .= $crlf . '<SaturdayDelivery>1</SaturdayDelivery>';
     }
     if ($pkg->email_sndr_ship || $pkg->email_sndr_excp || $pkg->email_sndr_dlvr || $pkg->email_rcp_ship || $pkg->email_rcp_excp || $pkg->email_rcp_dlvr) {
         $sBody .= $crlf . '<EMailNotification>';
         if ($pkg->email_sndr_ship || $pkg->email_sndr_excp || $pkg->email_sndr_dlvr) {
             $sBody .= $crlf . '<Shipper>';
             if ($pkg->email_sndr_ship) {
                 $sBody .= $crlf . '<ShipAlert>' . $pkg->email_sndr_ship . '</ShipAlert>';
             }
             if ($pkg->email_sndr_dlvr) {
                 $sBody .= $crlf . '<DeliveryNotification>' . $pkg->email_sndr_dlvr . '</DeliveryNotification>';
             }
             if ($pkg->email_sndr_excp) {
                 $sBody .= $crlf . '<ExceptionNotification>' . $pkg->email_sndr_excp . '</ExceptionNotification>';
             }
             $sBody .= $crlf . '<Format>TEXT</Format>';
             $sBody .= $crlf . '<LanguageCode>en</LanguageCode>';
             $sBody .= $crlf . '</Shipper>';
         }
         if ($pkg->email_rcp_ship || $pkg->email_rcp_excp || $pkg->email_rcp_dlvr) {
             $sBody .= $crlf . '<Recipient>';
             if ($pkg->email_rcp_ship) {
                 $sBody .= $crlf . '<ShipAlert>' . $pkg->email_rcp_ship . '</ShipAlert>';
             }
             if ($pkg->email_rcp_dlvr) {
                 $sBody .= $crlf . '<DeliveryNotification>' . $pkg->email_rcp_dlvr . '</DeliveryNotification>';
             }
             if ($pkg->email_rcp_excp) {
                 $sBody .= $crlf . '<ExceptionNotification>' . $pkg->email_rcp_excp . '</ExceptionNotification>';
             }
             $sBody .= $crlf . '<Format>TEXT</Format>';
             $sBody .= $crlf . '<LanguageCode>en</LanguageCode>';
             $sBody .= $crlf . '</Recipient>';
         }
         $sBody .= $crlf . '</EMailNotification>';
     }
     if ($pkg->additional_handling) {
         $sBody .= $crlf . '<NonstandardContainer>1</NonstandardContainer>';
     }
     if ($pkg->delivery_confirmation) {
         $sBody .= $crlf . '<SignatureOption>' . $this->SignatureMap[$pkg->delivery_confirmation_type] . '</SignatureOption>';
     }
     $sBody .= $crlf . '</SpecialServices>';
     if (count($pkg->package) > 1) {
         $sBody .= $crlf . '<MultiPiece>';
         $sBody .= $crlf . '<PackageCount>' . count($pkg->package) . '</PackageCount>';
         $sBody .= $crlf . '<PackageSequenceNumber>' . ($key + 1) . '</PackageSequenceNumber>';
         //			$sBody .= $crlf . '<ShipmentWeight>' . count($pkg->package) . '</ShipmentWeight>';
         if ($key > 0) {
             // link to the master package
             $sBody .= $crlf . '<MasterTrackingNumber>' . $pkg->master_tracking . '</MasterTrackingNumber>';
             if ($carrier_code == 'FDXE') {
                 $sBody .= $crlf . '<MasterFormID>' . $pkg->form_id . '</MasterFormID>';
             }
         }
         $sBody .= $crlf . '</MultiPiece>';
     }
     $sBody .= $crlf . '<Label>';
     $sBody .= $crlf . '<Type>2DCOMMON</Type>';
     // For thermal labels
     if (MODULE_SHIPPING_FEDEX_PRINTER_TYPE == 'Thermal') {
         // valid values are PDF, PNG, ELTRON, ZEBRA, UNIMARK
         $sBody .= $crlf . '<ImageType>' . IMAGETYPE . '</ImageType>';
         $sBody .= $crlf . '<LabelStockOrientation>' . LABELSTOCKORIENTATION . '</LabelStockOrientation>';
         // (LEADING, TRAILING, NONE)
         $sBody .= $crlf . '<DocTabLocation>' . DOCTABLOCATION . '</DocTabLocation>';
         // only valid for thermal labels (TOP, BOTTOM)
         $sBody .= $crlf . '<DocTabContent>';
         $sBody .= $crlf . '<Type>' . DOCTABCONTENT . '</Type>';
         // (STANDARD, ZONE001, BARCODED, NONE)
         if (DOCTABCONTENT == 'ZONE001') {
             $sBody .= $crlf . '<Zone001>';
             foreach ($ZONE001_DEFINES as $zone => $settings) {
                 $sBody .= $crlf . '<HeaderValuePair>';
                 $sBody .= $crlf . '<ZoneNumber>' . $zone . '</ZoneNumber>';
                 $sBody .= $crlf . '<Header>' . $settings['Header'] . '</Header>';
                 if ($pkg->ship_method == 'GND' || $pkg->ship_method == 'GDR') {
                     $settings['Value'] = str_replace('/', '', $settings['Value']);
                 }
                 $sBody .= $crlf . '<Value>' . $settings['Value'] . '</Value>';
                 $sBody .= $crlf . '</HeaderValuePair>';
             }
             $sBody .= $crlf . '</Zone001>';
         }
         $sBody .= $crlf . '</DocTabContent>';
     } else {
         // default to pdf for laser labels
         $sBody .= $crlf . '<ImageType>' . 'PDF' . '</ImageType>';
     }
     $sBody .= $crlf . '</Label>';
     $sBody .= $crlf . '</FDXShipRequest>';
     $sBody .= $crlf;
     return $sBody;
 }
Example #3
0
 function FormatEndiciaShipRequest($pkg)
 {
     $rateCodes = array_flip($this->EndiciaRateCodes);
     $fromPostalCodes = explode('-', COMPANY_POSTAL_CODE);
     $toPostalCodes = explode('-', $pkg->ship_postal_code);
     $data = array('LabelRequest' => array('RequesterID' => MODULE_SHIPPING_ENDICIA_PARTNER_ID, 'AccountID' => MODULE_SHIPPING_ENDICIA_ACCOUNT_NUMBER, 'PassPhrase' => MODULE_SHIPPING_ENDICIA_PASS_PHRASE, 'PartnerCustomerID' => MODULE_SHIPPING_ENDICIA_ACCOUNT_NUMBER, 'PartnerTransactionID' => $pkg->purchase_invoice_id ? $pkg->purchase_invoice_id : time(), 'MailClass' => $rateCodes[$pkg->ship_method], 'MailpieceShape' => $pkg->pkg_type, 'DateAdvance' => '0', 'WeightOz' => ceil($pkg->package['weight'] * 16), 'CostCenter' => '0', 'Value' => $pkg->total_amount, 'Stealth' => 'TRUE', 'Services' => array('DeliveryConfirmation' => $pkg->delivery_confirmation ? 'ON' : 'OFF', 'COD' => $pkg->cod ? 'ON' : 'OFF', 'InsuredMail' => $pkg->ins_1 ? 'ON' : 'OFF', 'AdultSignature' => 'OFF'), 'ResponseOptions' => array('PostagePrice' => 'TRUE'), 'ToCompany' => remove_special_chars($pkg->ship_primary_name), 'ToName' => remove_special_chars($pkg->ship_contact), 'ToAddress1' => remove_special_chars($pkg->ship_address1), 'ToAddress2' => remove_special_chars($pkg->ship_address2), 'ToCity' => strtoupper($pkg->ship_city_town), 'ToState' => $pkg->ship_country_code == 'US' ? strtoupper($pkg->ship_state_province) : '', 'ToPostalCode' => $toPostalCodes[0], 'ToZIP4' => $toPostalCodes[1], 'ToPhone' => strip_alphanumeric($pkg->ship_telephone1), 'ToEMail' => $pkg->ship_email, 'FromCompany' => COMPANY_NAME, 'FromName' => COMPANY_NAME == '' ? AR_CONTACT_NAME : '', 'ReturnAddress1' => COMPANY_ADDRESS1, 'ReturnAddress2' => COMPANY_ADDRESS2, 'FromCity' => COMPANY_CITY_TOWN, 'FromState' => COMPANY_ZONE, 'FromPostalCode' => $fromPostalCodes[0], 'FromZIP4' => $fromPostalCodes[1], 'FromPhone' => strip_alphanumeric(COMPANY_TELEPHONE1), 'FromEMail' => COMPANY_EMAIL, 'LabelSize' => ENDICIA_LABEL_SIZE, 'LabelType' => 'Default', 'ImageFormat' => MODULE_SHIPPING_ENDICIA_PRINTER_TYPE, 'ImageRotation' => 'None', 'CustomsQuantity1' => 0, 'CustomsValue1' => 0, 'CustomsWeight1' => 0, 'CustomsQuantity2' => 0, 'CustomsValue2' => 0, 'CustomsWeight2' => 0, 'CustomsQuantity3' => 0, 'CustomsValue3' => 0, 'CustomsWeight3' => 0, 'CustomsQuantity4' => 0, 'CustomsValue4' => 0, 'CustomsWeight4' => 0, 'CustomsQuantity5' => 0, 'CustomsValue5' => 0, 'CustomsWeight5' => 0));
     if ($pkg->package['length'] && $pkg->package['width'] && $pkg->package['height']) {
         $data['LabelRequest']['MailpieceDimensions'] = array('Length' => $pkg->package['length'], 'Width' => $pkg->package['width'], 'Height' => $pkg->package['height']);
     }
     if (MODULE_SHIPPING_ENDICIA_TEST_MODE == 'Test') {
         $data['LabelRequest']['Test'] = 'YES';
     }
     if ($pkg->cod) {
         $data['LabelRequest']['CODAmount'] = number_format($pkg->total_amount, 2);
     }
     if ($pkg->ins_1) {
         $data['LabelRequest']['InsuredValue'] = number_format($pkg->package['value'], 2);
     }
     if (RUBBERSTAMP1) {
         $data['LabelRequest']['RubberStamp1'] = RUBBERSTAMP1;
     }
     if (RUBBERSTAMP2) {
         $data['LabelRequest']['RubberStamp2'] = RUBBERSTAMP2;
     }
     if (RUBBERSTAMP3) {
         $data['LabelRequest']['RubberStamp3'] = RUBBERSTAMP3;
     }
     return $data;
 }
Example #4
0
 function FormatFedExShipRequest($pkg, $key)
 {
     global $ZONE001_DEFINES, $debug, $currencies;
     // process different for freight than express
     $is_freight = in_array($pkg->ship_method, array('GndFrt', 'EcoFrt')) && MODULE_SHIPPING_FEDEX_V7_LTL_ACCOUNT_NUMBER ? true : false;
     $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => MODULE_SHIPPING_FEDEX_V7_AUTH_KEY, 'Password' => MODULE_SHIPPING_FEDEX_V7_AUTH_PWD));
     $request['ClientDetail'] = array('AccountNumber' => MODULE_SHIPPING_FEDEX_V7_ACCOUNT_NUMBER, 'MeterNumber' => MODULE_SHIPPING_FEDEX_V7_METER_NUMBER);
     $request['TransactionDetail'] = array('CustomerTransactionId' => '*** FedEx Shipping Request ***');
     $request['Version'] = array('ServiceId' => 'ship', 'Major' => MODULE_SHIPPING_FEDEX_SHIP_WSDL_VERSION, 'Intermediate' => '0', 'Minor' => '0');
     $temp = array_flip($this->FedExRateCodes);
     $ship_method = $pkg->residential_address && $pkg->ship_method == 'GND' ? 'GDR' : $pkg->ship_method;
     $request['RequestedShipment'] = array('ShipTimestamp' => date('c', strtotime($pkg->ship_date)), 'DropoffType' => $this->FedExPickupMap[$pkg->pickup_service], 'ServiceType' => $temp[$ship_method], 'PackagingType' => $this->PackageMap[$pkg->pkg_type]);
     $request['RequestedShipment']['Shipper'] = array('Contact' => array('PersonName' => AR_CONTACT_NAME, 'CompanyName' => COMPANY_NAME, 'PhoneNumber' => COMPANY_TELEPHONE1), 'Address' => array('StreetLines' => array('0' => COMPANY_ADDRESS1, '1' => COMPANY_ADDRESS2), 'City' => COMPANY_CITY_TOWN, 'StateOrProvinceCode' => COMPANY_ZONE, 'PostalCode' => COMPANY_POSTAL_CODE, 'CountryCode' => gen_get_country_iso_2_from_3(COMPANY_COUNTRY)));
     $request['RequestedShipment']['Recipient'] = array('Contact' => array('PersonName' => remove_special_chars($pkg->ship_contact), 'CompanyName' => remove_special_chars($pkg->ship_primary_name), 'PhoneNumber' => strip_alphanumeric($pkg->ship_telephone1)), 'Address' => array('StreetLines' => array('0' => remove_special_chars($pkg->ship_address1), '1' => remove_special_chars($pkg->ship_address2)), 'City' => strtoupper($pkg->ship_city_town), 'StateOrProvinceCode' => $pkg->ship_country_code == 'US' ? strtoupper($pkg->ship_state_province) : '', 'PostalCode' => strip_alphanumeric($pkg->ship_postal_code), 'CountryCode' => gen_get_country_iso_2_from_3($pkg->ship_country_code), 'Residential' => $pkg->residential_address ? '1' : '0'));
     // SmartPost
     if ($pkg->ship_method == '3Dam') {
         $request['RequestedShipment']['SmartPostDetail'] = array('Indicia' => $pkg->total_weight < 1 ? 'PRESORTED_STANDARD' : 'PARCEL_SELECT', 'HubId' => FEDEX_SMARTPOST_HUB_ID);
     }
     $request['RequestedShipment']['ShippingChargesPayment'] = array('PaymentType' => $this->PaymentMap[$pkg->bill_charges]);
     $pay_acct = MODULE_SHIPPING_FEDEX_V7_ACCOUNT_NUMBER;
     if ($pkg->bill_charges == '1' || $pkg->bill_charges == '2') {
         $pay_acct = $pkg->bill_acct;
     }
     $request['RequestedShipment']['ShippingChargesPayment']['Payor'] = array('AccountNumber' => $pay_acct, 'CountryCode' => 'US');
     if ($is_freight) {
         //			$request['ClientDetail']['AccountNumber'] = MODULE_SHIPPING_FEDEX_V7_LTL_ACCOUNT_NUMBER; // causes acct and meter not consistent error
         $request['RequestedShipment']['FreightShipmentDetail'] = array('FedExFreightAccountNumber' => MODULE_SHIPPING_FEDEX_V7_LTL_ACCOUNT_NUMBER, 'FedExFreightBillingContactAndAddress' => array('Contact' => array('PersonName' => AR_CONTACT_NAME, 'CompanyName' => COMPANY_NAME, 'PhoneNumber' => COMPANY_TELEPHONE1), 'Address' => array('StreetLines' => COMPANY_ADDRESS1, 'City' => COMPANY_CITY_TOWN, 'StateOrProvinceCode' => COMPANY_ZONE, 'PostalCode' => COMPANY_POSTAL_CODE, 'CountryCode' => gen_get_country_iso_2_from_3(COMPANY_COUNTRY))), 'PrintedReferences' => array('Type' => 'SHIPPER_ID_NUMBER', 'Value' => $pkg->purchase_invoice_id), 'Role' => 'SHIPPER', 'PaymentType' => 'PREPAID', 'CollectTermsType' => 'STANDARD', 'DeclaredValuePerUnit' => array('Amount' => $currencies->clean_value($pkg->package[$key]['value']), 'Currency' => 'USD'), 'TotalHandlingUnits' => $pkg->ltl_num_pieces, 'PalletWeight' => array('Units' => substr($pkg->pkg_weight_unit, 0, 2), 'Value' => number_format($pkg->package[$key]['weight'], 0, '.', '')), 'ShipmentDimensions' => array('Length' => $pkg->package[$key]['length'] < 32 ? 32 : $pkg->package[$key]['length'], 'Width' => $pkg->package[$key]['width'] < 32 ? 32 : $pkg->package[$key]['width'], 'Height' => $pkg->package[$key]['height'] < 16 ? 16 : $pkg->package[$key]['height'], 'Units' => $pkg->pkg_dimension_unit), 'LineItems' => array('FreightClass' => 'CLASS_' . $pkg->ltl_class, 'Packaging' => 'PALLET', 'Description' => $pkg->ltl_description, 'HandlingUnits' => $pkg->ltl_num_pieces, 'Pieces' => 1, 'BillOfLaddingNumber' => $pkg->purchase_invoice_id, 'PurchaseOrderNumber' => $pkg->purch_order_id, 'Weight' => array('Units' => substr($pkg->pkg_weight_unit, 0, 2), 'Value' => number_format($pkg->package[$key]['weight'], 0, '.', '')), 'Dimensions' => array('Length' => $pkg->package[$key]['length'] < 32 ? 32 : $pkg->package[$key]['length'], 'Width' => $pkg->package[$key]['width'] < 32 ? 32 : $pkg->package[$key]['width'], 'Height' => $pkg->package[$key]['height'] < 16 ? 16 : $pkg->package[$key]['height'], 'Units' => $pkg->pkg_dimension_unit)));
     } else {
         // provide small package/express freight details
         $pay_acct = $pkg->bill_charges == '1' || $pkg->bill_charges == '2' ? $pkg->bill_acct : MODULE_SHIPPING_FEDEX_V7_ACCOUNT_NUMBER;
         if ($pkg->cod) {
             $request['RequestedShipment']['SpecialServicesRequested'] = array('SpecialServiceTypes' => array('COD'), 'CodDetail' => array('CollectionType' => $this->CODMap[$pkg->cod_payment_type]));
         }
         if ($pkg->saturday_delivery) {
             $request['RequestedShipment']['SpecialServicesRequested']['SpecialServiceTypes'][] = 'SATURDAY_DELIVERY';
         }
         if ($key > 0) {
             // link to the master package
             $request['RequestedShipment']['MasterTrackingId'] = $pkg->master_tracking;
         }
         $request['RequestedShipment']['RequestedPackageLineItems'] = array('SequenceNumber' => $key + 1, 'InsuredValue' => array('Amount' => $currencies->clean_value($pkg->package[$key]['value']), 'Currency' => 'USD'), 'Weight' => array('Value' => number_format($pkg->package[$key]['weight'], 1, '.', ''), 'Units' => substr($pkg->pkg_weight_unit, 0, 2)), 'Dimensions' => array('Length' => $pkg->package[$key]['length'], 'Width' => $pkg->package[$key]['width'], 'Height' => $pkg->package[$key]['height'], 'Units' => $pkg->pkg_dimension_unit), 'CustomerReferences' => array('0' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 'Value' => $pkg->purchase_invoice_id . '-' . ($key + 1)), '1' => array('CustomerReferenceType' => 'INVOICE_NUMBER', 'Value' => $pkg->purchase_invoice_id), '2' => array('CustomerReferenceType' => 'P_O_NUMBER', 'Value' => $pkg->purch_order_id)));
         if ($pkg->cod) {
             $request['RequestedShipment']['RequestedPackageLineItems']['SpecialServicesRequested'] = array('CodCollectionAmount' => array('Amount' => $pkg->total_amount, 'Currency' => 'USD'), 'EMailNotificationDetail' => array('Shipper' => array('EMailAddress' => COMPANY_EMAIL, 'NotifyOnShipment' => $pkg->email_sndr_ship ? '1' : '0', 'NotifyOnException' => $pkg->email_sndr_dlvr ? '1' : '0', 'NotifyOnException' => $pkg->email_sndr_excp ? '1' : '0', 'Localization"' => substr($_SESSION['language'], 0, 2)), 'Recipient' => array('EMailAddress' => $pkg->ship_email, 'NotifyOnShipment' => $pkg->email_rcp_ship ? '1' : '0', 'NotifyOnException' => $pkg->email_rcp_dlvr ? '1' : '0', 'NotifyOnException' => $pkg->email_rcp_excp ? '1' : '0', 'Localization"' => substr($_SESSION['language'], 0, 2))));
         }
     }
     $request['RequestedShipment']['PackageCount'] = count($pkg->package);
     $request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
     $request['RequestedShipment']['RateRequestTypes'] = 'LIST';
     // valid values ACCOUNT and LIST
     $request['RequestedShipment']['LabelSpecification']['LabelFormatType'] = 'COMMON2D';
     $request['RequestedShipment']['LabelSpecification']['CustomerSpecifiedDetail']['MaskedData'] = 'SHIPPER_ACCOUNT_NUMBER';
     // For thermal labels
     if (!$is_freight && MODULE_SHIPPING_FEDEX_V7_PRINTER_TYPE == 'Thermal') {
         $request['RequestedShipment']['LabelSpecification']['ImageType'] = 'EPL2';
         $request['RequestedShipment']['LabelSpecification']['LabelStockType'] = LABELORIENTATION_THERMAL;
         $request['RequestedShipment']['LabelSpecification']['LabelPrintingOrientation'] = 'TOP_EDGE_OF_TEXT_FIRST';
         if (DOCTABCONTENT == 'Zone001') {
             $request['RequestedShipment']['LabelSpecification']['CustomerSpecifiedDetail']['DocTabContent']['DocTabContentType'] = 'ZONE001';
             // define the zones and values
             $ZONE001_DEFINES = array('1' => array('Header' => TEXT_DATE, 'Literal' => date('Y-m-d', strtotime($pkg->ship_date))), '2' => array('Header' => 'Transit', 'Value' => 'REPLY/SHIPMENT/RoutingDetail/TransitTime'), '3' => array('Header' => 'PO Num', 'Literal' => $pkg->purch_order_id), '4' => array('Header' => 'Inv Num', 'Literal' => $pkg->purchase_invoice_id), '5' => array('Header' => TEXT_WEIGHT, 'Literal' => number_format($pkg->package[$key]['weight'], 1, '.', '')), '7' => array('Header' => 'DV', 'Literal' => number_format($pkg->package[$key]['value'], 2, '.', '')), '8' => array('Header' => 'Insured', 'Value' => 'REQUEST/PACKAGE/InsuredValue/Amount'), '9' => array('Header' => 'List', 'Value' => 'REPLY/SHIPMENT/RATES/PAYOR_LIST_PACKAGE/TotalNetCharge/Amount'), '12' => array('Header' => 'Net', 'Value' => 'REPLY/SHIPMENT/RATES/PAYOR_ACCOUNT_PACKAGE/TotalNetCharge/Amount'));
             foreach ($ZONE001_DEFINES as $zone => $settings) {
                 $request['RequestedShipment']['LabelSpecification']['CustomerSpecifiedDetail']['DocTabContent'][DOCTABCONTENT]['DocTabZoneSpecifications'][] = array('ZoneNumber' => $zone, 'Header' => $settings['Header'], 'DataField' => $settings['Value'], 'LiteralValue' => $settings['Literal']);
             }
         }
     } elseif ($is_freight) {
         $request['RequestedShipment']['LabelSpecification']['LabelFormatType'] = 'FEDEX_FREIGHT_STRAIGHT_BILL_OF_LADING';
         $request['RequestedShipment']['LabelSpecification']['ImageType'] = 'PDF';
         $request['RequestedShipment']['LabelSpecification']['LabelStockType'] = 'PAPER_LETTER';
         $request['RequestedShipment']['LabelSpecification']['LabelPrintingOrientation'] = 'TOP_EDGE_OF_TEXT_FIRST';
         $request['RequestedShipment']['ShippingDocumentSpecification'] = array('ShippingDocumentTypes' => array('FREIGHT_ADDRESS_LABEL'), 'FreightAddressLabelDetail' => array('Format' => array('ImageType' => MODULE_SHIPPING_FEDEX_V7_PRINTER_TYPE == 'Thermal' ? 'EPL2' : 'PDF', 'StockType' => MODULE_SHIPPING_FEDEX_V7_PRINTER_TYPE == 'Thermal' ? LABELORIENTATION_THERMAL : 'PAPER_4X6', 'ProvideInstuctions' => '0'), 'Copies' => '1'));
     } else {
         $request['RequestedShipment']['LabelSpecification']['ImageType'] = 'PDF';
         $request['RequestedShipment']['LabelSpecification']['LabelStockType'] = LABELORIENTATION_PDF;
     }
     return $request;
 }
Example #5
0
<?php

include "includes/header.php";
require_once 'includes/functions.php';
require_once 'includes/class.gbXML.php';
require_once 'config.php';
require_once $language_file;
//include our helper class for listing guestbook entries
require_once 'includes/class.guestbook_entry_lister.php';
require_once 'includes/remove_special_chars.php';
$search = trim(isset($_POST['search_term']) ? remove_special_chars($_POST['search_term']) : '');
$pageNum = isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 0;
$search = isset($_GET['search_term']) ? $_GET['search_term'] : $search;
if ($search == "") {
    echo "<center><font color=blue>Please enter a search term and try again.</font></center>";
    include "includes/footer.php";
    exit;
}
$search_terms = preg_split('/(\\s)+|\\.|,|;/', $search);
$gbXML = new gbXML('messages', 'message', 'data/data.xml');
$records_array = $gbXML->parse_XML_data();
$found_records = array();
foreach ($records_array as $record) {
    foreach ($record as $key => $value) {
        $flag = true;
        foreach ($search_terms as $search_term) {
            if (substr_count(strtolower($value), strtolower($search_term)) > 0) {
                //Next foreach ($search_terms....
            } else {
                $flag = false;
                $break;