Пример #1
0
function zen_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $static = false, $use_dir_ws_catalog = true)
{
    global $seo_urls;
    $href_link = null;
    if (isset($seo_urls)) {
        $href_link = $seo_urls->href_link($page, $parameters, $connection, $add_session_id, $static, $use_dir_ws_catalog);
    }
    if ($href_link === null) {
        $href_link = original_zen_href_link($page, $parameters, $connection, $add_session_id, $search_engine_safe, $static, $use_dir_ws_catalog);
    }
    return $href_link;
}
Пример #2
0
function zen_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = false, $search_engine_safe = true, $static = false, $use_dir_ws_catalog = true)
{
    /* QUICK AND DIRTY WAY TO DISABLE REDIRECTS ON PAGES WHEN SEO_URLS_ONLY_IN is enabled IMAGINADW.COM */
    $sefu = explode(",", ereg_replace(' +', '', SEO_URLS_ONLY_IN));
    if (SEO_URLS_ONLY_IN != "" && !in_array($page, $sefu)) {
        return original_zen_href_link($page, $parameters, $connection, $add_session_id, $search_engine_safe, $static, $use_dir_ws_catalog);
    }
    if (!isset($GLOBALS['seo_urls']) && !is_object($GLOBALS['seo_urls'])) {
        include_once DIR_WS_CLASSES . 'seo.url.php';
        $GLOBALS['seo_urls'] =& new SEO_URL($_SESSION['languages_id']);
    }
    return $GLOBALS['seo_urls']->href_link($page, $parameters, $connection, $add_session_id, $static, $use_dir_ws_catalog);
}
Пример #3
0
 function need_redirect()
 {
     $this->need_redirect = false;
     // If we are in the admin we should never redirect
     // We should also avoid redirects with post content
     if (IS_ADMIN_FLAG != 'true' && count($_POST) <= 0) {
         // First see if we need to redirect because the URL contains main_page=
         $this->need_redirect = preg_match('/[?&]main_page=([^&]*)/', $this->uri) === 1 ? true : false;
         // Retrieve the generated URL for this request
         $params = array();
         foreach ($_GET as $key => $value) {
             if ($key == 'main_page') {
                 continue;
             }
             // Fix the case sensitivity, shopping cart sometimes breaks this
             if ($key == 'cpath') {
                 $key = 'cPath';
             }
             $params[] = $key . '=' . $value;
         }
         $params = sizeof($params) > 0 ? implode('&', $params) : '';
         $my_url = $this->href_link($_GET['main_page'], $params, 'NONSSL', false, true, false, true);
         if ($my_url === null) {
             $my_url = original_zen_href_link($_GET['main_page'], $params, 'NONSSL', false);
         }
         $this->redirect_url = parse_url($my_url);
         unset($my_url);
         // See if the path's match
         if ($this->uri_parsed['path'] != $this->redirect_url['path'] && rawurldecode($this->uri_parsed['path']) != $this->redirect_url['path']) {
             if ($this->canonical !== null) {
                 $canonical = parse_url($this->canonical);
                 if ($this->uri_parsed['path'] != $canonical['path']) {
                     $this->need_redirect = true;
                 }
             } else {
                 $this->need_redirect = true;
             }
         } else {
             $params = asort(explode('&', $this->uri_parsed['query']));
             $old_params = asort(explode('&', $this->uri_parsed['query']));
             if (count($params) != count($old_params)) {
                 $this->need_redirect = true;
             } else {
                 for ($i = 0, $n = count($params); $i < $n; $i++) {
                     if ($params[$i] != $old_params[$i]) {
                         $this->need_redirect = true;
                         break;
                     }
                 }
             }
             unset($params, $old_params);
         }
         $this->redirect_url = $this->redirect_url['path'] . (array_key_exists('query', $this->redirect_url) ? '?' . $this->redirect_url['query'] : '');
     }
 }