예제 #1
0
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;
}
예제 #2
0
(c) 2003	    nextcommerce (search.php,v 1.9 2003/08/17); www.nextcommerce.org
(c) 2004      XT - Commerce; www.xt-commerce.com

Released under the GNU General Public License
---------------------------------------------------------------------------------------*/
olc_smarty_init($box_smarty, $cacheid);
require_once DIR_FS_INC . 'olc_draw_pull_down_menu.inc.php';
require_once DIR_FS_INC . 'olc_draw_checkbox_field.inc.php';
require_once DIR_FS_INC . 'olc_draw_selection_field.inc.php';
require_once DIR_FS_INC . 'olc_image_submit.inc.php';
require_once DIR_FS_INC . 'olc_get_categories.inc.php';
require_once DIR_FS_INC . 'olc_get_manufacturers.inc.php';
require_once DIR_FS_INC . 'olc_hide_session_id.inc.php';
$selections = '
<table border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td class="infoBoxContents">' . ENTRY_CATEGORIES . HTML_BR . olc_draw_pull_down_menu('categories_id', olc_get_categories(array(array('id' => EMPTY_STRING, 'text' => TEXT_ALL_CATEGORIES)))) . olc_draw_hidden_field('inc_subcat', ONE_STRING) . '
		</td>
  </tr>';
$manufacturers_pulldown = olc_get_manufacturers();
if ($manufacturers_pulldown) {
    $selections .= '<tr><td class="infoBoxContents">' . ENTRY_MANUFACTURERS . HTML_BR . olc_draw_pull_down_menu('manufacturers_id', $manufacturers_pulldown) . '</td></tr>';
}
$selections .= '</table>';
$box_smarty->assign('FORM_ACTION', olc_draw_form('quick_find', olc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, EMPTY_STRING, NONSSL, false), 'get') . olc_hide_session_id());
$box_smarty->assign('INPUT_SEARCH', olc_draw_input_field('keywords', EMPTY_STRING, 'size="16" maxlength="100"'));
$box_smarty->assign('SELECTIONS', $selections);
$box_smarty->assign('BUTTON_SUBMIT', olc_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH, 'align="middle"'));
$box_smarty->assign('LINK_ADVANCED', olc_href_link(FILENAME_ADVANCED_SEARCH));
$box_search = $box_smarty->fetch(CURRENT_TEMPLATE_BOXES . 'box_search' . HTML_EXT, $cacheid);
$smarty->assign('box_SEARCH', $box_search);