コード例 #1
0
ファイル: shInit.php プロジェクト: sangkasi/joomla
             _log('Redirecting from non www to wwww');
             shRedirect($shPageInfo->URI->protocol . '://www.' . $_SERVER['HTTP_HOST'] . (!sh404SEF_USE_NON_STANDARD_PORT || empty($shPageInfo->URI->port) ? '' : ':' . $shPageInfo->URI->port) . $shPageInfo->shSaveRequestURI);
         }
         if (substr($shLiveSite, 0, 4) != 'www.' && strtolower(substr($_SERVER['HTTP_HOST'] . (!sh404SEF_USE_NON_STANDARD_PORT || empty($shPageInfo->URI->port) ? '' : ':' . $shPageInfo->URI->port), 4)) == $shLiveSite) {
             _log('Redirecting from www to non wwww');
             shRedirect($shPageInfo->URI->protocol . '://' . str_replace('www.', '', $_SERVER['HTTP_HOST'] . (!sh404SEF_USE_NON_STANDARD_PORT || empty($shPageInfo->URI->port) ? '' : ':' . $shPageInfo->URI->port)) . $shPageInfo->shSaveRequestURI);
         }
     }
 }
 //Make sure host name matches our config, we need this later.
 if (!empty($shPageInfo->URI->host) && strpos($GLOBALS['shConfigLiveSite'], $shPageInfo->URI->host) === false && strpos($sefConfig->shConfig_live_secure_site, $shPageInfo->URI->host) === false) {
     _log('Redirecting to home : host don\'t match our config : ' . $GLOBALS['shConfigLiveSite'] . ' | ' . $shPageInfo->URI->host . ' | ' . $sefConfig->shConfig_live_secure_site);
     shRedirect($GLOBALS['shConfigLiveSite']);
 } else {
     $shPageInfo->shCurrentPagePath = $shPageInfo->URI->protocol . '://' . $shPageInfo->URI->host . (!sh404SEF_USE_NON_STANDARD_PORT || empty($shPageInfo->URI->port) ? '' : ':' . $shPageInfo->URI->port) . $shPageInfo->URI->path;
     $shPageInfo->shCurrentPagePath = shUrlDecode($shPageInfo->shCurrentPagePath);
     $shPageInfo->shCurrentPagePath = str_replace($GLOBALS['shConfigLiveSite'], '', $shPageInfo->shCurrentPagePath);
     _log('Current page path : ' . $shPageInfo->shCurrentPagePath);
     $qString = $shPageInfo->URI->getQueryString();
     $shPageInfo->shCurrentPageURL = empty($qString) ? $shPageInfo->shCurrentPagePath : $shPageInfo->shCurrentPagePath . '?' . JString::ltrim($qString, '&');
     $rewriteBit = empty($sefConfig->shRewriteMode) ? '' : JString::rtrim($sefConfig->shRewriteStrings[$sefConfig->shRewriteMode], '/');
     $shPageInfo->baseUrl = $GLOBALS['shConfigLiveSite'] . $rewriteBit . $shPageInfo->shCurrentPagePath;
     _log('Current base url : ' . $shPageInfo->baseUrl);
     // V 1.2.4.s PR2 : workaround for Virtuemart cookie check issue
     // see second part in shSef404.php
     if (shIsSearchEngine()) {
         // simulate doing successfull cookie check
         _log('Setting VMCHECK cookie for search engine');
         $_COOKIE['VMCHECK'] = 'OK';
         $_REQUEST['vmcchk'] = 1;
         // from VM 1.1.2 onward, result is stored in session, not cookie
コード例 #2
0
ファイル: sh404sef.inc.php プロジェクト: justinlyon/scc
         } else {
             $queryVars = $shPageInfo->URI->getQueryVars();
             $vars = array_merge($vars, $queryVars);
             $shPageInfo->shCurrentPageNonSef = $shPageInfo->shCurrentPagePath;
         }
     }
     break;
 case "":
     JError::RaiseError(500, COM_SH404SEF_STRANGE . " URI->path=" . $shPageInfo->URI->path . ":<br />" . basename(__FILE__) . "-" . __LINE__);
 default:
     // sanity check ok so process URI
     // strip out the base
     // V 1.3.1 always decode !
     //if ($sefConfig->shEncodeUrl) {
     if (!empty($shPageInfo->URI->path)) {
         $shPageInfo->URI->path = shUrlDecode($shPageInfo->URI->path);
         _log('URL decoding of URI->path');
     }
     if (count($shPageInfo->URI->querystring) > 0) {
         foreach ($shPageInfo->URI->querystring as $key => $value) {
             $shPageInfo->URI->querystring[$key] = rawurldecode($value);
         }
     }
     if (!empty($shPageInfo->URI->anchor)) {
         $shPageInfo->URI->anchor = rawurldecode($shPageInfo->URI->anchor);
     }
     //}
     // V 1.2.4.t 301 redirect if Virtuemart cookie check. This has to be from a pre-existing link in Search engine index
     shCheckVMCookieRedirect();
     $path = preg_replace("/^" . preg_quote($shPageInfo->base, "/") . "/", "", $shPageInfo->URI->path);
     $path_array = explode("/", $path);