/**
  * Create sh404SEF URLs
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see 		http://dev.anything-digital.com/sh404SEF/
  * @see			getSiteRoute()
  * @access 		private
  * @param 		string	$url	the original URL to turn into SEF
  * @return 		string SEF URL
  * @since 		3.0
  */
 private function _sh404Sef($url)
 {
     // Load sh404SEF
     require_once JPATH_ADMINISTRATOR . '/components/com_sh404sef/sh404sef.class.php';
     $sefConfig = shRouter::shGetConfig();
     // Turn off any security and flooding setting
     $sefConfig->shSecEnableSecurity = 0;
     $sefConfig->shSecActivateAntiFlood = 0;
     // Require some necessary files
     require_once JPATH_ROOT . '/components/com_sh404sef/shCache.php';
     require_once JPATH_ROOT . '/components/com_sh404sef/shSec.php';
     // Start the sh404sef Router
     if (class_exists('shRouter')) {
         $shRouter = new shRouter();
     } else {
         return $this->_domainname . '/' . $url;
     }
     // Force the domain name
     $GLOBALS['shConfigLiveSite'] = $this->_domainname;
     // Initialize sh404sef
     include_once JPATH_ROOT . '/components/com_sh404sef/shInit.php';
     // Build the SEF URL
     $uri = $shRouter->build($url);
     $sefurl = $uri->toString();
     if (strpos($sefurl, 'http://') === false) {
         $sefurl = str_ireplace('http:/', 'http://', $sefurl);
     }
     return $sefurl;
 }
Exemple #2
0
     $sefConfig->page404 == '0';
 }
 // configuration values carried over when upgrading
 if ($sefConfig->page404 == '0') {
     $sql = 'SELECT id  FROM #__content WHERE `title`="__404__"';
     $database->setQuery($sql);
     if ($id = $database->loadResult()) {
     } else {
         JError::raiseError(404, JText::_('Component Not Found') . $mosmsg);
     }
 } else {
     $id = $sefConfig->page404;
 }
 $vars['id'] = $id;
 $shPageInfo->QUERY_STRING = 'option=com_content&view=article&id=' . $id . (empty($vars['Itemid']) ? '' : '&Itemid=' . $vars['Itemid']);
 $uri = shRouter::build($GLOBALS['shConfigLiveSite'] . '/index.php?' . $shPageInfo->QUERY_STRING);
 $shPageInfo->shCurrentPageNonSef = 'index.php?' . $shPageInfo->QUERY_STRING;
 $tmpl = str_replace('.php', '', $sefConfig->error404SubTemplate);
 if (!empty($tmpl)) {
     $vars['tmpl'] = $tmpl;
 }
 if (!headers_sent()) {
     header('HTTP/1.0 404 NOT FOUND');
     // V x : include error page, faster than loading Joomla 404 page. Not recommended though, why not show
     // your site ?
     if (is_readable(sh404SEF_FRONT_ABS_PATH . '404-Not-Found.tpl.html')) {
         $errorPage = file_get_contents(sh404SEF_FRONT_ABS_PATH . '404-Not-Found.tpl.html');
         if ($errorPage !== false) {
             $errorPage = str_replace('%sh404SEF_404_URL%', $vars['mosmsg'], $errorPage);
             $errorPage = str_replace('%sh404SEF_404_SITE_URL%', $GLOBALS['shConfigLiveSite'], $errorPage);
             $errorPage = str_replace('%sh404SEF_404_SITE_NAME%', $mainframe->getCfg('sitename'), $errorPage);