function olc_seo_url($url) { //W. Kaiser - Search friendly URLs if (USE_SEO) { $slash_pos = strrpos($url, SLASH); if ($slash_pos !== false) { $slash_pos++; } $pos = strrpos($url, QUESTION); if ($pos !== false) { $url_b = substr($url, 0, $pos); $parameters = substr($url, $pos + 1); } else { $url_b = $url; $parameters = EMPTY_STRING; } $url_b = basename($url_b); global $seo_urls_to_convert, $seo_action_parameter; //URLs are built like: //http://www.server.de/olcommerce/seo-processor-par1-val1-par2-val2-...-parn-valn.htm //e.g.: http://www.server.de/olcommerce/seo-products_info-products_id-144.htm global $seo_array_1, $seo_array_2; if (DO_SEO_EXTENDED) { global $seo_search, $seo_replace; $add_parameters = EMPTY_STRING; $processor_type = EMPTY_STRING; if ($url_b == FILENAME_PRODUCT_INFO) { $rewritten = true; $products_id = get_parameter($parameters, 'products_id', $add_parameters); if ($products_id) { if (strpos($add_parameters, 'add_product') == false) { $processor_type = 'p'; } else { $processor_type = 'a'; $add_parameters = EMPTY_STRING; } $url_par = preg_replace($seo_search, $seo_replace, olc_get_products_name($products_id)) . SEMI_COLON . $products_id; } } elseif ($url_b == FILENAME_DEFAULT) { global $seo_categories; $check_parameter = 'BUYproducts_id'; $products_id = get_parameter($parameters, $check_parameter, $add_parameters); if ($products_id) { $processor_type = 'b'; $url_par = strtolower(olc_get_products_name($products_id, SESSION_LANGUAGE_ID)); $url_par = preg_replace($seo_search, $seo_replace, $url_par) . SEMI_COLON . $products_id; $add_parameters = str_replace('action=buy_now', EMPTY_STRING, $add_parameters); if ($add_parameters[0] == AMP) { $add_parameters = substr($add_parameters, 1); } } else { $category_id = get_parameter($parameters, 'cPath', $add_parameters); if ($category_id) { $processor_type = 'k'; $url_par = EMPTY_STRING; $category_id = explode(UNDERSCORE, $category_id); $categories = sizeof($category_id); for ($i = 0; $i < $categories; $i++) { if ($url_par) { $url_par .= SEO_SEPARATOR; } $url_par .= preg_replace($seo_search, $seo_replace, $seo_categories[$category_id[$i]]); } } else { $manufacturer_id = get_parameter($parameters, 'manufacturers_id', $add_parameters); if ($manufacturer_id) { $processor_type = 'm'; $manufacturers = olc_get_manufacturers(); foreach ($manufacturers as $manufacturer_id) { if ($manufacturer_id['id'] == $manufacturer_id) { $maname = $manufacturer_id['text']; break; } } $url .= shopstat_hrefManulink($maname, $manufacturer_id, $url); } else { $filter_id = get_parameter($parameters, 'filter_id', $add_parameters); if ($filter_id) { } else { //return $url; } } } } } elseif ($url_b == FILENAME_CONTENT) { $content_id = get_parameter($parameters, 'coID', $add_parameters); if ($content_id) { $processor_type = 'c'; $url_par = 'content' . SEMI_COLON . $content_id; } } else { //return $url; } if (!$processor_type) { /* $url_par=explode(PHP,$url); $url_par=$url_par[0]; $pos=strrpos($url_par,SLASH); if ($pos!==false) { $url_par=substr($url_par,$pos+1); $processor_type='g'; if ($parameters) { $add_parameters=$parameters; } } else { return $url; } */ return $url; } if ($processor_type) { $processor_type .= SEO_SEPARATOR; } } else { $url = str_replace($seo_array_1, SEO_SEPARATOR, str_replace($seo_array_2, SEO_SEPARATOR, $url)); $url_par = EMPTY_STRING; } $url = str_replace(PHP, EMPTY_STRING, $url); if ($slash_pos === false) { $url = EMPTY_STRING; } else { $url = substr($url, 0, $slash_pos); } $url .= SEO_PAGENAME_START . $processor_type; $url .= $url_par . SEO_TERMINATOR; if ($add_parameters) { $url .= QUESTION . $add_parameters; } } return $url; }
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; }