require_once DIR_FS_INC . 'xtc_get_categories.inc.php';
require_once DIR_FS_INC . 'xtc_get_manufacturers.inc.php';
require_once DIR_FS_INC . 'xtc_checkdate.inc.php';
$breadcrumb->add(NAVBAR_TITLE_ADVANCED_SEARCH, xtc_href_link(FILENAME_ADVANCED_SEARCH));
require DIR_WS_INCLUDES . 'header.php';
$smarty->assign('FORM_ACTION', xtc_draw_form('advanced_search', xtc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', $request_type, false), 'get', 'onsubmit="return check_form(this);"') . xtc_hide_session_id());
//WEB28 change NONSSL to $request_type
$smarty->assign('INPUT_KEYWORDS', xtc_draw_input_field('keywords', '', 'style="width: 100%"'));
//BOF - DokuMan - 2009-05-31 - removed quotationmark
//$smarty->assign('HELP_LINK', xtc_href_link(FILENAME_POPUP_SEARCH_HELP.'?KeepThis=true&TB_iframe=true&height=400&width=600"'));
$smarty->assign('HELP_LINK', xtc_href_link(FILENAME_POPUP_SEARCH_HELP . '?KeepThis=true&TB_iframe=true&height=400&width=600'));
//EOF - DokuMan - 2009-05-31 - removed quotationmark
$smarty->assign('BUTTON_SUBMIT', xtc_image_submit('button_search.gif', IMAGE_BUTTON_SEARCH));
$smarty->assign('SELECT_CATEGORIES', xtc_draw_pull_down_menu('categories_id', xtc_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)))));
$smarty->assign('ENTRY_SUBCAT', xtc_draw_checkbox_field('inc_subcat', '1', true));
$smarty->assign('SELECT_MANUFACTURERS', xtc_draw_pull_down_menu('manufacturers_id', xtc_get_manufacturers(array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)))));
$smarty->assign('SELECT_PFROM', xtc_draw_input_field('pfrom'));
$smarty->assign('SELECT_PTO', xtc_draw_input_field('pto'));
$error = '';
if (isset($_GET['errorno'])) {
    if (($_GET['errorno'] & 1) == 1) {
        $error .= str_replace('\\n', '<br />', JS_AT_LEAST_ONE_INPUT);
    }
    if (($_GET['errorno'] & 10) == 10) {
        $error .= str_replace('\\n', '<br />', JS_INVALID_FROM_DATE);
    }
    if (($_GET['errorno'] & 100) == 100) {
        $error .= str_replace('\\n', '<br />', JS_INVALID_TO_DATE);
    }
    if (($_GET['errorno'] & 1000) == 1000) {
        $error .= str_replace('\\n', '<br />', JS_TO_DATE_LESS_THAN_FROM_DATE);
function shopstat_getSEO($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $mode = 'user')
{
    global $languages_id;
    $link = "";
    $maname = "";
    if ($mode == 'admin') {
        require_once DIR_FS_INC . 'xtc_parse_category_path.inc.php';
        require_once DIR_FS_INC . 'xtc_get_product_path.inc.php';
        require_once DIR_FS_INC . 'xtc_get_parent_categories.inc.php';
        require_once DIR_FS_INC . 'xtc_check_agent.inc.php';
    } else {
        require_once DIR_FS_INC . 'xtc_get_products_name.inc.php';
        require_once DIR_FS_INC . 'xtc_get_manufacturers.inc.php';
    }
    //-- XTC
    !isset($languages_id) ? $languages_id = (int) $_SESSION['languages_id'] : false;
    //BOF - web28 - 2010-08-18 -- Die Parameter aufspalten
    $pararray = array();
    foreach (explode("&", $parameters) as $pair) {
        $values = explode("=", $pair);
        if (!empty($values[0])) {
            $pararray[$values[0]] = $values[1];
        }
    }
    $cPath = isset($pararray['cPath']) ? $pararray['cPath'] : false;
    $prodid = isset($pararray['products_id']) ? $pararray['products_id'] : false;
    $content = isset($pararray['content']) ? $pararray['content'] : false;
    $coid = isset($pararray['coID']) ? $pararray['coID'] : false;
    $maid = isset($pararray['manufacturers_id']) ? $pararray['manufacturers_id'] : false;
    $pager = isset($pararray['page']) ? $pararray['page'] : false;
    $lang = isset($pararray['language']) ? $pararray['language'] : '';
    $sort = isset($pararray['sort']) ? $pararray['sort'] : '';
    $filter_id = isset($pararray['filter_id']) ? $pararray['filter_id'] : '';
    $viewmode = isset($pararray['viewmode']) ? $pararray['viewmode'] : '';
    $view_mode = isset($pararray['viewmode']) ? $pararray['view_mode'] : '';
    $prllset = isset($pararray['prllset']) ? $pararray['prllset'] : '';
    $action = isset($pararray['action']) ? $pararray['action'] : '';
    //EOF - web28 - 2010-08-18 -- Die Parameter aufspalten
    $go = true;
    //-- Nur bei der index.php und product_info.php
    if ($page != "index.php" && $page != "product_info.php" && $page != "shop_content.php") {
        $go = false;
    } elseif (strlen($sort) > 0) {
        //-- Unter diesen Bedingungen werden die URLs nicht umgewandelt
        //-- Sortieren
        $go = false;
    } elseif (strlen($filter_id) > 0) {
        //-- Sortieren der Herstellerprodukte
        $go = false;
    } elseif (strlen($view_mode) > 0) {
        $go = false;
    } elseif (strlen($viewmode) > 0) {
        $go = false;
    } elseif (strlen($prllset) > 0) {
        $go = false;
    } elseif (strlen($action) > 0) {
        //-- Andere Aktion
        $go = false;
    }
    //BOF web28 - 2010-08-18 -- Falls eine Sprache übergeben wurde, wird diese als 'Linksprache' definiert
    if (strlen($lang) > 0) {
        $seolng = new language();
        $lang_id = $seolng->catalog_languages[$lang]['id'];
    } else {
        $lang_id = $languages_id;
    }
    //EOF- web28 - 2010-08-18 -- Falls eine Sprache übergeben wurde, wird diese als 'Linksprache' definiert
    if ($go && (xtc_not_null($maid) || xtc_not_null($cPath) || xtc_not_null($prodid) || xtc_not_null($coid))) {
        if ($connection == 'SSL') {
            if (ENABLE_SSL == true) {
                $link = HTTPS_SERVER . DIR_WS_CATALOG;
            } else {
                $link = HTTP_SERVER . DIR_WS_CATALOG;
            }
        } else {
            $link = HTTP_SERVER . DIR_WS_CATALOG;
        }
        if (xtc_not_null($cPath) || xtc_not_null($prodid)) {
            $cPath_array = xtc_parse_category_path($cPath);
            $cPath = implode('_', $cPath_array);
            $current_category_id = $cPath_array[sizeof($cPath_array) - 1];
            if (!$current_category_id && $prodid) {
                $current_category_id = xtc_get_product_path($prodid);
            }
            // -------------------------------------------------
            if (!$prodid) {
                $category['categories_name'] = shopstat_getRealPath($cPath, '/', $lang_id);
                $link .= shopstat_hrefCatlink($category['categories_name'], $cPath, $pager);
            } else {
                $category['categories_name'] = '';
                if (ADD_CAT_NAMES_TO_PRODUCT_LINK) {
                    $category['categories_name'] = shopstat_getRealPath(xtc_get_product_path($prodid), '/', $lang_id);
                }
                $link .= shopstat_hrefLink($category['categories_name'], xtc_get_products_name($prodid, $lang_id), $prodid);
            }
        } elseif (xtc_not_null($coid)) {
            $content = shopstat_getContentName($coid, $lang_id);
            $link .= shopstat_hrefContlink($content, $coid);
        } elseif (xtc_not_null($maid)) {
            $manufacturers = xtc_get_manufacturers();
            foreach ($manufacturers as $manufacturer) {
                if ($manufacturer['id'] == $maid) {
                    $maname = $manufacturer['text'];
                    break;
                }
            }
            $link .= shopstat_hrefManulink($maname, $maid, $pager);
        }
        $separator = '?';
        //-- Concat the lang-var
        //-- Check parameters and given language, just concat
        //-- if the language is different
        //web28 - 2010-08-18 -- Parameter für die Sprachumschaltung
        if (strlen($lang) > 0 && $lang_id != $languages_id) {
            $link .= $separator . 'language=' . $lang;
        }
    }
    return $link;
}