Esempio n. 1
0
  http://projekt.wifo.uni-mannheim.de/elmar/nav/osCommerce
  Copyright (c) 2004-2005 Dr. Stefan Kuhlins, http://kuhlins.de/
  Released under the GNU General Public License
  $Id: reg.php 64 2005-12-19 18:07:20Z Michael $
*/
if (@(include_once 'checkstart.inc.php')) {
    checkstart(basename($_SERVER['PHP_SELF']));
}
// Pruefen, ob der Shop schon bei Elm@r registriert ist.
$is_reg = REGISTERED ? 'yes' : 'no';
$errormsg = '';
if ($is_reg == 'no') {
    if (!ini_get('allow_url_fopen')) {
        $is_reg = 'allow_url_fopen';
    } else {
        $shopName = shopNameOrHost();
        $register_url = ELMAR_SERVICE_URL . '?action=isShopRegistered&name=' . urlencode($shopName);
        @ini_set('default_socket_timeout', 10);
        $lines = @file($register_url);
        if (!$lines) {
            $is_reg = 'Error';
            $errormsg .= "\n\n" . 'Es konnte keine Verbindung mit der Elm@r-Website hergestellt werden, um zu prüfen, ob der Shop schon registriert ist. Bitte versuchen Sie es später nochmals.' . "\n\nURL: " . htmlspecialchars($register_url);
        } else {
            $s = chop($lines[0]);
            if (is_numeric($s)) {
                // Elm@r liefert die Shop-ID fuer registrierte Shops
                $is_reg = 'yes';
                $shopid = $s;
                reminder_const_check(true);
            } elseif ($s == 'locked') {
                $is_reg = 'locked';
Esempio n. 2
0
function generate_shopinfo()
{
    global $languages_id, $language_code, $currency, $currency_rate;
    // Alle Includes hier, wegen der Pfadangabe. Reihenfolge ist relevant!
    require ELMAR_PATH . 'tools/pear.php';
    require ELMAR_PATH . 'tools/node.php';
    require ELMAR_PATH . 'tools/parser.php';
    require ELMAR_PATH . 'tools/tree.php';
    $attributes = '1.0" encoding="ISO-8859-1';
    $tree = new XML_Tree(NULL, $attributes);
    if (ELMAR_NEW_SHOPINFO_XML) {
        $XMLarray = array('xmlns' => 'http://elektronischer-markt.de/schema/shopinfo-2.0', 'xmlns:c' => 'http://elektronischer-markt.de/schema/categories-2.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://elektronischer-markt.de/schema/shopinfo-2.0 ' . ELMAR_SCHEMA_BASE_URL . 'shopinfo-2.0.xsd', 'version' => '2.0');
        $root =& $tree->addRoot('Shop', NULL, $XMLarray);
    } else {
        $XMLarray = array('xmlns:osp' => 'http://elektronischer-markt.de/schema', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://elektronischer-markt.de/schema ' . ELMAR_SCHEMA_BASE_URL . 'shop.xsd');
        $root =& $tree->addRoot('osp:Shop', NULL, $XMLarray);
    }
    $common =& $root->addChild("Common");
    $xml_version =& $common->addChild("Version", ELMAR_NEW_SHOPINFO_XML ? '2.0' : '1.1');
    $xml_language =& $common->addChild("Language", $language_code);
    $xml_currency =& $common->addChild("Currency", $currency);
    if (ELMAR_NEW_SHOPINFO_XML) {
        $xml_generator =& $common->addChild('Generator', 'Elm@r-Modul osCommerce/' . MODUL_VERSION . '.' . MODUL_SUBVERSION . ' (http://projekt.wifo.uni-mannheim.de/elmar/nav/osCommerce)');
    }
    $name =& $root->addChild("Name", shopNameOrHost());
    $shopUrl = ELMAR_SHOP_ROOT_DIR;
    //tep_href_link('index.php', '', 'NONSSL', false);
    $url =& $root->addChild("Url", $shopUrl);
    $requests =& $root->addChild("Requests");
    // Die Parameter fuer die Echtzeitanfrage, siehe elmar_request.php
    $requestUrl = ELMAR_SHOP_ROOT_DIR . 'elmar_request.php';
    // Url zur Echtzeitabfrage
    $onlineRequest =& $requests->addChild("OnlineRequest", Null, array("method" => "GET POST TRACE"));
    $processor =& $onlineRequest->addChild("Processor", $requestUrl);
    $paramBrand =& $onlineRequest->addChild("ParamBrand", 'p_brand');
    $paramProduct =& $onlineRequest->addChild("ParamProduct", 'p_product');
    $paramDescription =& $onlineRequest->addChild("ParamDescription", 'p_desc');
    if (defined('ELMAR_PRODUCTS_EAN_FIELD')) {
        $paramEan =& $onlineRequest->addChild("ParamID", 'p_ean', array("type" => "EAN"));
    }
    if (defined('ELMAR_PRODUCTS_ISBN_FIELD')) {
        $paramIsbn =& $onlineRequest->addChild("ParamID", 'p_isbn', array("type" => "ISBN"));
    }
    if (ELMAR_NEW_SHOPINFO_XML) {
        $paramId =& $onlineRequest->addChild("ParamID", 'p_id', array("type" => "ID"));
    }
    $paramQuickSearch =& $onlineRequest->addChild("ParamQuickSearch", 'p_qs');
    $paramPriceBounds =& $onlineRequest->addChild("ParamPriceBounds");
    $lowerPrice =& $paramPriceBounds->addChild("LowerPrice", 'p_low');
    $upperPrice =& $paramPriceBounds->addChild("UpperPrice", 'p_high');
    $paramSize =& $onlineRequest->addChild("ParamSize", 'p_size');
    $paramIP =& $onlineRequest->addChild("ParamIP", 'p_ip');
    $offlineRequest =& offlineRequest($requests);
    if (ELMAR_NEW_SHOPINFO_XML) {
        $affiliateRequest =& $requests->addChild('AffiliateRequest', NULL, array('method' => 'GET POST TRACE'));
        $processor =& $affiliateRequest->addChild('Processor', ELMAR_SHOP_ROOT_DIR . 'elmar_affiliate.php');
        $paramName =& $affiliateRequest->addChild('ParamName', 'name');
    }
    /*
    $interface = & $root->addChild("Interface");
        $positionLimit = & $interface->addChild("PositionLimit");
    */
    if (defined('STORE_LOGO') && file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . STORE_LOGO)) {
        $logo =& $root->addChild("Logo", IMAGE_PATH . STORE_LOGO);
    }
    /*
    $address = & $root->addChild("Adress");
        $company= & $address->addChild("Company");
        $street = & $address->addChild("Street");
        $city = & $address->addChild("City");
    */
    if (emailOk()) {
        $contact =& $root->addChild("Contact");
        $publicMailAddress =& $contact->addChild("PublicMailAddress", STORE_OWNER_EMAIL_ADDRESS);
        $privateMailAddress =& $contact->addChild("PrivateMailAddress", STORE_OWNER_EMAIL_ADDRESS);
    }
    /*
    $orderPhone = & $contact->addChild("OrderPhone");
        $number= & $orderPhone->addChild("Number");
        $costPerMinute= & $orderPhone->addChild("CostPerMinute");
    $orderFax= & $contact->addChild("OrderFax");
        $number = & $orderFax->addChild("Number");
        $costPerMinute= & $orderFax->addChild("CostPerMinute");
    $hotline = & $contact->addChild("Hotline");
    */
    $prodSum = productAnz();
    $categories =& $root->addChild("Categories");
    if ($prodSum > 0) {
        $totalProductCount =& $categories->addChild("TotalProductCount", $prodSum);
    }
    $ns = ELMAR_NEW_SHOPINFO_XML ? 'c:' : '';
    $attrib = ELMAR_NEW_SHOPINFO_XML ? array('lang' => $language_code) : NULL;
    $mapOther = $language_code == 'de' ? 'Sonstiges' : 'Other';
    // Die Produktkategorien der ersten Ebene schreiben. Durch "group by" Doppelte herauswerfen.
    $categories_query = tep_db_query('select c.categories_id, cd.categories_name from ' . TABLE_CATEGORIES . ' c left join ' . TABLE_CATEGORIES_DESCRIPTION . ' cd using(categories_id) where c.parent_id=0 and cd.language_id=' . (int) $languages_id . ' group by cd.categories_name');
    if (tep_db_num_rows($categories_query)) {
        while ($category = tep_db_fetch_array($categories_query)) {
            $categories_name = trim($category['categories_name']);
            if ($categories_name != '') {
                $item =& $categories->addChild("Item", NULL, $attrib);
                $name =& $item->addChild($ns . "Name", $categories_name);
                if (function_exists('tep_count_products_in_category') && ($cpic = tep_count_products_in_category($category['categories_id']))) {
                    $productCount =& $item->addChild($ns . "ProductCount", $cpic);
                }
                $mapping =& $item->addChild($ns . "Mapping", KategorieAnpassen($category['categories_name'], $mapOther));
            }
        }
    } else {
        $item =& $categories->addChild("Item", NULL, $attrib);
        $name =& $item->addChild($ns . "Name", $mapOther);
        if ($prodSum > 0) {
            $productCount =& $item->addChild($ns . "ProductCount", $prodSum);
        }
        $mapping =& $item->addChild($ns . "Mapping", $mapOther);
    }
    $lastschriftverfahren = defined('MODULE_PAYMENT_BANKTRANSFER_STATUS') && MODULE_PAYMENT_BANKTRANSFER_STATUS == 'True' ? true : false;
    $nachnahme = defined('MODULE_PAYMENT_COD_STATUS') && MODULE_PAYMENT_COD_STATUS == 'True' ? true : false;
    $paypal = defined('MODULE_PAYMENT_PAYPAL_STATUS') && MODULE_PAYMENT_PAYPAL_STATUS == 'True' ? true : false;
    $rechnung = defined('MODULE_PAYMENT_INVOICE_STATUS') && MODULE_PAYMENT_INVOICE_STATUS == 'True' ? true : false;
    $vorkasse = defined('MODULE_PAYMENT_MONEYORDER_STATUS') && MODULE_PAYMENT_MONEYORDER_STATUS == 'True' ? true : false;
    #$barzahlung = (defined('MODULE_PAYMENT_CASH_STATUS') && (MODULE_PAYMENT_CASH_STATUS == 'True')) ? true : false;
    #e-cash (elektronisches Zahlungsmittel); money transfer (Ueberweisung); cheque (Scheck)
    if ($nachnahme || $paypal || $lastschriftverfahren || $rechnung || $vorkasse) {
        $payment =& $root->addChild("Payment");
        if ($nachnahme) {
            $item =& $payment->addChild("Item");
            $name =& $item->addChild("Name", 'on delivery');
            // Nachnahme
            //$surcharge = & $item->addChild("Surcharge");
            //$maxSurcharge = & $item->addChild("MaxSurcharge");
            //$relativeSurcharge = & $item->addChild("RelativeSurcharge");
        }
        if ($paypal) {
            $item =& $payment->addChild("Item");
            $name =& $item->addChild("Name", 'paypal');
            // PayPal
        }
        if ($lastschriftverfahren) {
            $item =& $payment->addChild("Item");
            $name =& $item->addChild("Name", 'debit');
            // Bankeinzug/Lastschrift
        }
        if ($rechnung) {
            $item =& $payment->addChild("Item");
            $name =& $item->addChild("Name", 'invoice');
            // Rechnung
        }
        if ($vorkasse) {
            $item =& $payment->addChild("Item");
            $name =& $item->addChild("Name", 'pre-payment');
            // Vorauszahlung
        }
    }
    $free_shipping = defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true' ? true : false;
    $shipping_flat_status = defined('MODULE_SHIPPING_FLAT_STATUS') && MODULE_SHIPPING_FLAT_STATUS == 'True' ? true : false;
    if ($free_shipping || $shipping_flat_status) {
        $forwardExpenses =& $root->addChild("ForwardExpenses");
        if ($shipping_flat_status) {
            if (DISPLAY_PRICE_WITH_TAX == 'true') {
                $shipping_flat_cost = tep_add_tax(MODULE_SHIPPING_FLAT_COST, tep_get_tax_rate(MODULE_SHIPPING_FLAT_TAX_CLASS, STORE_COUNTRY, MODULE_SHIPPING_FLAT_ZONE));
            } else {
                $shipping_flat_cost = MODULE_SHIPPING_FLAT_COST;
            }
            $flatRate =& $forwardExpenses->addChild("FlatRate", number_format($shipping_flat_cost * $currency_rate, 2));
        }
        if ($free_shipping) {
            $upperBound =& $forwardExpenses->addChild("UpperBound", number_format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER * $currency_rate, 2));
        }
    }
    /*
    $features = & $root->addChild("Features");
        $installment = & $features->addChild("Installment");
        $orderTracking = & $features->addChild("OrderTracking");
        $deliverTracking = & $features->addChild("DeliverTRacking");
        $installationAssistance = & $features->addChild("InstallationAssistance");
        $repairService = & $features->addChild("RepairService");
        $careAfterPurchase = & $features->addChild("CareAfterPurchase");
        $giftService = & $features->addChild("GiftService");
    */
    $technology =& $root->addChild("Technology");
    if (ENABLE_SSL) {
        $ssl =& $technology->addChild("SSL");
    }
    $search =& $technology->addChild("Search");
    // $set = & $technology->addChild("SET");
    if (defined('FILENAME_CONDITIONS')) {
        $termAndConditions =& $root->addChild("TermsAndConditions");
        $url =& $termAndConditions->addChild("Url", tep_href_link(FILENAME_CONDITIONS, '', 'NONSSL', false));
        // $return = & $termAndConditions->addChild("Return");
    }
    /*
    $specialDiscount = & $root->addChild("SpecialDiscount");
        $description = & $specialDiscount->addChild("Description");
        $url = & $specialDiscount->addChild("Url");
    $certifications= & $root->addChild("Certifications");
        $item = & $certifications->addChild("Item");
    $self_Discription = & $root->addChild("Self-Discription");
    */
    $content = $tree->get();
    $content = str_replace(''', '\'', $content);
    // ersetzen von '
    $content = str_replace('|', '|', $content);
    // ersetzen von |
    return $content;
}