Esempio n. 1
0
 function shGetNEWSPCategories($catId, $option, $shLangName, &$cat, &$sec)
 {
     if (empty($catId)) {
         return false;
     }
     static $catData = null;
     $sefConfig =& Sh404sefFactory::getConfig();
     if (!is_null($catData[$shLangName][$catId])) {
         // get DB
         $database =& JFactory::getDBO();
         $query = "SELECT c.id, c.section, c.title, s.id as sectionid, s.title as stitle" . "\n FROM #__categories as c, #__sections as s" . "\n WHERE " . "\n s.id = c.section" . "\n AND c.id = '" . $catId . "'";
         $database->setQuery($query);
         if (shTranslateUrl($option, $shLangName)) {
             $categories = $database->loadObjectList();
         } else {
             $categories = $database->loadObjectList(false);
         }
         if (!empty($categories)) {
             $sec = ($sefConfig->shNewsPInsertSecId ? $sectionId . $sefConfig->replacement : '') . $categories[0]->stitle;
             // section
             $cat = ($sefConfig->shNewsPInsertCatId ? $sectionId . $sefConfig->replacement : '') . $categories[0]->title;
             // category
             $catData[$shLangName][$catId]['cat'] = $cat;
             $catData[$shLangName][$catId]['sec'] = $sec;
         }
     } else {
         $cat = $catData[$shLangName][$catId]['cat'];
         $sec = $catData[$shLangName][$catId]['sec'];
     }
     return !empty($cat);
 }
Esempio n. 2
0
 private function _doQuickControl($tpl)
 {
     // get configuration object
     $sefConfig = Sh404sefFactory::getConfig($reset = true);
     // push it into to the view
     $this->sefConfig = $sefConfig;
     $messages = JFactory::getApplication()->getMessageQueue();
     $noMsg = JRequest::getInt('noMsg', 0);
     $this->error = array();
     // push any message
     if (is_array($messages) && !empty($messages)) {
         foreach ($messages as $msg) {
             if (!empty($msg['message'])) {
                 $msg['type'] = isset($msg['type']) ? $msg['type'] : 'info';
                 if ($msg['type'] != 'error') {
                     if (empty($noMsg)) {
                         $this->message = $msg['message'];
                     }
                 } else {
                     $this->errors[] = $msg['message'];
                 }
             }
         }
     }
     parent::display($tpl);
 }
Esempio n. 3
0
 /**
  * Get a Extplugin object for the requested extension
  * If no specific plugin is found, the default, generic
  * public is used instead
  *
  * @param string $option the Joomla! component name. Should begin with "com_"
  * @return object Sh404sefExtpluginBaseextplugin descendant
  */
 public static function &getExtensionPlugin($option)
 {
     static $_plugins = array();
     if (empty($option)) {
         $option = 'default';
     }
     // plugin is cached, check if we already created
     // the plugin for $option
     if (empty($_plugins[$option])) {
         // build the class name for this plugin
         // autolaoder will find the appropriate file and load it
         // if not loaded
         if ($option !== 'default' && strpos($option, 'com_') !== 0) {
             $option = 'com_' . $option;
         }
         $className = 'Sh404sefExtplugin' . ucfirst(strtolower($option));
         // does this class exists?
         $sefConfig =& Sh404sefFactory::getConfig();
         if (class_exists($className, $autoload = true)) {
             // instantiate plugin
             $_plugins[$option] = new $className($option, $sefConfig);
         } else {
             // else use generic plugin
             $_plugins[$option] = new Sh404sefExtpluginDefault($option, $sefConfig);
         }
     }
     // return cached plugin
     return $_plugins[$option];
 }
Esempio n. 4
0
 public function display($tpl = null)
 {
     // get model and update context with current
     $model =& $this->getModel();
     $context = $model->setContext($this->_context . '.' . $this->getLayout());
     // display type: simple for very large sites/slow slq servers
     $sefConfig =& Sh404sefFactory::getConfig();
     // if set for a slowServer, display simplified version of the url manager
     $this->assign('slowServer', $sefConfig->slowServer);
     // read data from model
     $list =& $model->getList((object) array('layout' => $this->getLayout(), 'simpleUrlList' => $this->slowServer, 'slowServer' => $sefConfig->slowServer));
     // and push it into the view for display
     $this->assign('items', $list);
     $this->assign('itemCount', count($this->items));
     $this->assign('pagination', $model->getPagination((object) array('layout' => $this->getLayout(), 'simpleUrlList' => $this->slowServer, 'slowServer' => $sefConfig->slowServer)));
     $options = $model->getDisplayOptions();
     $this->assign('options', $options);
     $this->assign('optionsSelect', $this->_makeOptionsSelect($options));
     // add behaviors and styles as needed
     $modalSelector = 'a.modalediturl';
     $js = '\\function(){window.parent.shAlreadySqueezed = false;if(window.parent.shReloadModal) {parent.window.location=\'' . $this->defaultRedirectUrl . '\';window.parent.shReloadModal=true}}';
     $params = array('overlayOpacity' => 0, 'classWindow' => 'sh404sef-popup', 'classOverlay' => 'sh404sef-popup', 'onClose' => $js);
     Sh404sefHelperHtml::modal($modalSelector, $params);
     // build the toolbar
     $toolbarMethod = '_makeToolbar' . ucfirst($this->getLayout());
     if (is_callable(array($this, $toolbarMethod))) {
         $this->{$toolbarMethod}($params);
     }
     // add our own css
     JHtml::styleSheet('urls.css', Sh404sefHelperGeneral::getComponentUrl() . '/assets/css/');
     // link to  custom javascript
     JHtml::script('list.js', Sh404sefHelperGeneral::getComponentUrl() . '/assets/js/');
     // now display normally
     parent::display($tpl);
 }
Esempio n. 5
0
 protected function _fetchAccountsList()
 {
     $hClient =& Sh404sefHelperAnalytics::getHttpClient();
     $hClient->resetParameters($clearAll = true);
     // build the request
     $sefConfig = Sh404sefFactory::getConfig();
     $accountIdBits = explode('-', trim($sefConfig->analyticsId));
     if (empty($accountIdBits) || count($accountIdBits) < 3) {
         throw new Sh404sefExceptionDefault(JText::sprintf('COM_SH404SEF_ERROR_CHECKING_ANALYTICS', 'Invalid account Id'));
     }
     $accoundId = $accountIdBits[1];
     // set target API url
     $hClient->setUri($this->_endPoint . 'management/accounts/' . $accoundId . '/webproperties/' . trim($sefConfig->analyticsId) . '/profiles?key=' . $this->_getAppKey());
     // make sure we use GET
     $hClient->setMethod(Sh_Zend_Http_Client::GET);
     // set headers required by Google Analytics
     $headers = array('GData-Version' => 2, 'Authorization' => 'GoogleLogin auth=' . $this->_Auth);
     $hClient->setHeaders($headers);
     //perform request
     // establish connection with available methods
     $adapters = array('Sh_Zend_Http_Client_Adapter_Curl', 'Sh_Zend_Http_Client_Adapter_Socket');
     $rawResponse = null;
     // perform connect request
     foreach ($adapters as $adapter) {
         try {
             $hClient->setAdapter($adapter);
             $response = $hClient->request();
             break;
         } catch (Exception $e) {
             // need that to be Exception, so as to catch Sh_Zend_Exceptions.. as well
             // we failed, let's try another method
         }
     }
     // return if error
     if (empty($response)) {
         $msg = 'unknown code';
         throw new Sh404sefExceptionDefault(JText::sprintf('COM_SH404SEF_ERROR_CHECKING_ANALYTICS', $msg));
     }
     if (empty($response) || !is_object($response) || $response->isError()) {
         $msg = method_exists($response, 'getStatus') ? $response->getStatus() : 'unknown code';
         throw new Sh404sefExceptionDefault(JText::sprintf('COM_SH404SEF_ERROR_CHECKING_ANALYTICS', $msg));
     }
     // analyze response
     // check if authentified
     Sh404sefHelperAnalytics::verifyAuthResponse($response);
     $xml = simplexml_load_string($response->getBody());
     if (!empty($xml->entry)) {
         foreach ($xml->entry as $entry) {
             $account = new StdClass();
             $bits = explode('/', (string) $entry->id);
             $account->id = array_pop($bits);
             $account->title = str_replace('Google Analytics Profile ', '', (string) $entry->title);
             $this->_accounts[] = clone $account;
         }
     }
 }
Esempio n. 6
0
 /**
  * Prepare and display the control panel
  * dashboard, which is a simplified view
  * of main analytics results
  *
  * @param string $tpl layout name
  */
 private function _makeViewDashboard($tpl)
 {
     // get configuration object
     $sefConfig =& Sh404sefFactory::getConfig();
     // push it into to the view
     $this->assignRef('sefConfig', $sefConfig);
     // get analytics data using helper, possibly from cache
     $analyticsData = Sh404sefHelperAnalytics::getData($this->options);
     // push analytics stats into view
     $this->assign('analytics', $analyticsData);
 }
Esempio n. 7
0
 protected static function &_getInstance($type = 'file')
 {
     static $_instance = null;
     if (empty($_instance)) {
         // get global config
         $config =& Sh404sefFactory::getConfig();
         // instantiate object
         $className = 'Sh404sefClass' . $type . 'cache';
         $_instance = new $className($config);
     }
     return $_instance;
 }
Esempio n. 8
0
 protected static function &_getInstance($handler = '')
 {
     static $_instance = null;
     if (empty($_instance)) {
         // get global config
         $config =& Sh404sefFactory::getConfig();
         // instantiate object
         $handler = empty($handler) ? $config->UrlCacheHandler : $handler;
         $className = 'Sh404sefClass' . ucfirst($handler) . 'cache';
         $_instance = new $className($config);
     }
     return $_instance;
 }
Esempio n. 9
0
 private static function _shDecodeSecLogLine($line)
 {
     $sefConfig =& Sh404sefFactory::getConfig();
     // skip comments
     if (substr($line, 0, 1) == '#') {
         return;
     }
     if (preg_match('/[0-9]{2}\\-[0-9]{2}\\-[0-9]{2}/', $line)) {
         // this is not header or comment line
         self::$_counters['shSecTotalAttacks']++;
         $bits = explode("\t", $line);
         switch (substr($bits[2], 0, 15)) {
             case 'Flooding':
                 self::$_counters['shSecTotalFlooding']++;
                 break;
             case 'Caught by Honey':
                 self::$_counters['shSecTotalPHP']++;
                 break;
             case 'Honey Pot but u':
                 self::$_counters['shSecTotalPHPUserClicked']++;
                 break;
             case 'Var not numeric':
             case 'Var not alpha-n':
             case 'Var contains ou':
                 self::$_counters['shSecTotalStandardVars']++;
                 break;
             case 'Image file name':
                 self::$_counters['shSecTotalImgTxtCmd']++;
                 break;
             case '<script> tag in':
                 self::$_counters['shSecTotalScripts']++;
                 break;
             case 'Base 64 encoded':
                 self::$_counters['shSecTotalBase64']++;
                 break;
             case 'mosConfig_var i':
                 self::$_counters['shSecTotalConfigVars']++;
                 break;
             case 'Blacklisted IP':
                 self::$_counters['shSecTotalIPDenied']++;
                 break;
             case 'Blacklisted use':
                 self::$_counters['shSecTotalUserAgentDenied']++;
                 break;
             default:
                 // if not one of those, then it's a 404, don't count it as an attack
                 self::$_counters['shSecTotalAttacks']--;
                 break;
         }
     }
 }
Esempio n. 10
0
 private function _doQuickControl($tpl)
 {
     // get configuration object
     $sefConfig =& Sh404sefFactory::getConfig();
     // push it into to the view
     $this->assignRef('sefConfig', $sefConfig);
     // push any message
     $error = $this->getError();
     if (empty($error)) {
         $noMsg = JRequest::getInt('noMsg', 0);
         if (empty($noMsg)) {
             $this->assign('message', JText::_('COM_SH404SEF_ELEMENT_SAVED'));
         }
     }
     parent::display($tpl);
 }
 function shSimpleLogger($siteName, $basePath, $fileName, $isActive)
 {
     $sefConfig = Sh404sefFactory::getConfig();
     if (empty($isActive)) {
         $this->isActive = 0;
         return;
     } else {
         $this->isActive = 1;
     }
     $traceFileName = $basePath . $sefConfig->debugStartedAt . '.' . $fileName . '_' . str_replace('/', '_', str_replace('http://', '', $siteName)) . '.log';
     // Create file
     $fileIsThere = file_exists($traceFileName);
     $sep = "\t";
     if (!$fileIsThere) {
         // create file
         $fileHeader = 'sh404SEF trace file - created : ' . $this->logTime() . ' for ' . $siteName . "\n\n" . str_repeat('-', 25) . ' PHP Configuration ' . str_repeat('-', 25) . "\n\n";
         $config = $this->parsePHPConfig();
         $line = str_repeat('-', 69) . "\n\n";
         // look for ob handlers, as we cannot use print_r from one (thanks Moovur !)
         $handlers = ob_list_handlers();
         $line .= "\nHandlers found : " . count($handlers);
         if (!empty($handlers)) {
             foreach ($handlers as $key => $handler) {
                 $line .= "\nHandler " . ($key + 1) . ' : ' . $handler;
             }
         }
         $line .= "\n" . str_repeat('-', 69) . "\n\n";
     } else {
         $fileHeader = '';
     }
     $file = fopen($traceFileName, 'ab');
     if ($file) {
         if (!empty($fileHeader)) {
             fWrite($file, $fileHeader);
             fWrite($file, print_r($config, true));
             fwrite($file, $line);
         }
         $this->logFile = $file;
     } else {
         $this->isActive = 0;
         return;
     }
 }
Esempio n. 12
0
 public static function updateShurls()
 {
     $pageInfo =& Sh404sefFactory::getPageInfo();
     $sefConfig =& Sh404sefFactory::getConfig();
     $pageInfo->shURL = empty($pageInfo->shURL) ? '' : $pageInfo->shURL;
     if ($sefConfig->enablePageId && !$sefConfig->stopCreatingShurls) {
         try {
             jimport('joomla.utilities.string');
             $nonSefUrl = JString::ltrim($pageInfo->currentNonSefUrl, '/');
             $nonSefUrl = shSortURL($nonSefUrl);
             // make sure we have a language
             $nonSefUrl = shSetURLVar($nonSefUrl, 'lang', $pageInfo->currentLanguageShortTag);
             // remove tracking vars (Google Analytics)
             $nonSefUrl = Sh404sefHelperGeneral::stripTrackingVarsFromNonSef($nonSefUrl);
             // try to get the current shURL, if any
             $shURL = ShlDbHelper::selectResult('#__sh404sef_pageids', array('pageid'), array('newurl' => $nonSefUrl));
             // if none, we may have to create one
             if (empty($shURL)) {
                 $shURL = self::_createShurl($nonSefUrl);
             }
             // insert in head and header, if not empty
             if (!empty($shURL)) {
                 $fullShURL = JString::ltrim($pageInfo->getDefaultFrontLiveSite(), '/') . '/' . $shURL;
                 $document = JFactory::getDocument();
                 if ($sefConfig->insertShortlinkTag) {
                     $document->addHeadLink($fullShURL, 'shortlink');
                     // also add header, especially for HEAD requests
                     JResponse::setHeader('Link', '<' . $fullShURL . '>; rel=shortlink', true);
                 }
                 if ($sefConfig->insertRevCanTag) {
                     $document->addHeadLink($fullShURL, 'canonical', 'rev', array('type' => 'text/html'));
                 }
                 if ($sefConfig->insertAltShorterTag) {
                     $document->addHeadLink($fullShURL, 'alternate shorter');
                 }
                 // store for reuse
                 $pageInfo->shURL = $shURL;
             }
         } catch (Exception $e) {
             ShlSystem_Log::error('sh404sef', '%s::%s::%d: %s', __CLASS__, __METHOD__, __LINE__, $e->getMessage());
         }
     }
 }
Esempio n. 13
0
function plgSh404sefsimilarurls($context, &$rowContent, &$params, $page = 0)
{
    if (!defined('SH404SEF_IS_RUNNING')) {
        // only do something if sh404sef is up and running
        return true;
    }
    // a little hack on the side : optionnally display the requested url
    // first get current sef url
    $shPageInfo =& Sh404sefFactory::getPageInfo();
    // replace marker
    $rowContent->text = str_replace('{%sh404SEF_404_URL%}', htmlspecialchars(JURI::getInstance()->get('_uri'), ENT_COMPAT, 'UTF-8'), $rowContent->text);
    // now the similar urls
    $marker = 'sh404sefSimilarUrls';
    // quick check for our marker:
    if (JString::strpos($rowContent->text, $marker) === false) {
        return true;
    }
    // get plugin params
    $plugin =& JPluginHelper::getPlugin('sh404sefcore', 'sh404sefsimilarurls');
    // init params from plugin
    $pluginParams = new JRegistry();
    $pluginParams->loadString($plugin->params);
    $matches = array();
    // regexp to catch plugin requests
    $regExp = "#{" . $marker . "}#Us";
    // search for our marker}
    if (preg_match_all($regExp, $rowContent->text, $matches, PREG_SET_ORDER) > 0) {
        // we have at least one match, we can search for similar urls
        $html = shGetSimilarUrls(JURI::getInstance()->getPath(), $pluginParams);
        // remove comment, so that nothing shows
        if (empty($html)) {
            $rowContent->text = preg_replace('/{sh404sefSimilarUrlsCommentStart}.*{sh404sefSimilarUrlsCommentEnd}/iUs', '', $rowContent->text);
        } else {
            // remove the comment markers themselves
            $rowContent->text = str_replace('{sh404sefSimilarUrlsCommentStart}', '', $rowContent->text);
            $rowContent->text = str_replace('{sh404sefSimilarUrlsCommentEnd}', '', $rowContent->text);
        }
        // now replace instances of the marker by similar urls list
        $rowContent->text = str_replace($matches[0], $html, $rowContent->text);
    }
    return true;
}
Esempio n. 14
0
 /**
  * Checks whether a request is coming from mobile device
  *
  * @return boolean true if current page request is from a known mobile device
  */
 public static function isMobileRequest()
 {
     static $isMobile = null;
     static $defaultRecords = array(array('start' => 0, 'stop' => 0, 'string' => '/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile|o2|opera m(ob|in)i|palm( os)?|p(ixi|re)\\/|plucker|pocket|psp|smartphone|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce; (iemobile|ppc)|xiino/i'), array('start' => 0, 'stop' => 4, 'string' => '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|e\\-|e\\/|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\\-|2|g)|yas\\-|your|zeto|zte\\-/i'));
     if (is_null($isMobile)) {
         jimport('joomla.environment.browser');
         $browser =& JBrowser::getInstance();
         $isMobile = $browser->get('_mobile');
         $userAgent = $browser->get('_lowerAgent');
         // detection code adapted from http://detectmobilebrowser.com/
         $remoteConfig = Sh404sefHelperUpdates::getRemoteConfig($forced = false);
         $remotesRecords = empty($remoteConfig->config['mobiledetectionstrings']) ? array() : $remoteConfig->config['mobiledetectionstrings'];
         $records = empty($remotes) ? $defaultRecords : $remotesRecords;
         foreach ($records as $record) {
             $isMobile = $isMobile || (empty($record['stop']) ? preg_match($record['string'], substr($userAgent, $record['start'])) : preg_match($record['string'], substr($userAgent, $record['start'], $record['stop'])));
         }
         // tell page information object about this
         Sh404sefFactory::getPageInfo()->isMobileRequest = $isMobile ? Sh404sefClassPageinfo::LIVE_SITE_MOBILE : Sh404sefClassPageinfo::LIVE_SITE_NOT_MOBILE;
     }
     return $isMobile;
 }
Esempio n. 15
0
 function shAppendListing($link_name, $link_id, $add_details = false, $shLangIso, $option, $shLangName)
 {
     global $sh_LANG;
     $sefConfig =& Sh404sefFactory::getConfig();
     $sef = array();
     if ($sefConfig->shMTreeInsertListingId) {
         if (!$sefConfig->shMTreePrependListingId) {
             $sef[] = ($sefConfig->shMTreeInsertListingName ? $link_name . $sefConfig->replacement : '') . $link_id;
         } else {
             $sef[] = $link_id . ($sefConfig->shMTreeInsertListingName ? $sefConfig->replacement . $link_name : '');
         }
     } else {
         if ($sefConfig->shMTreeInsertListingName) {
             $sef[] = $link_name;
         }
     }
     if ($add_details) {
         $sef[] = $sh_LANG[$shLangIso]['_MT_SEF_DETAILS'];
     }
     if ($sefConfig->shMTreeInsertListingName || $sefConfig->shMTreeInsertListingId) {
         shRemoveFromGETVarsList('link_id');
     }
     return $sef;
 }
Esempio n. 16
0
 public function getSefURLFromCacheOrDB($nonSefUrl, &$sefUrl)
 {
     $sefConfig = Sh404sefFactory::getConfig();
     if (empty($nonSefUrl)) {
         return sh404SEF_URLTYPE_NONE;
     }
     $sefUrl = '';
     $urlType = sh404SEF_URLTYPE_NONE;
     if ($sefConfig->shUseURLCache) {
         $urlType = Sh404sefHelperCache::getSefUrlFromCache($nonSefUrl, $sefUrl);
     }
     // Check if the url is already saved in the database.
     if ($urlType == sh404SEF_URLTYPE_NONE) {
         $urlType = $this->getSefUrlFromDatabase($nonSefUrl, $sefUrl);
         if ($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) {
             return $urlType;
         } else {
             if ($sefConfig->shUseURLCache) {
                 Sh404sefHelperCache::addSefUrlToCache($nonSefUrl, $sefUrl, $urlType);
             }
         }
     }
     return $urlType;
 }
Esempio n. 17
0
 /**
  * Create toolbar for default layout view
  *
  * @param midxed $params
  */
 private function _makeToolbarDefaultJ3($params = null)
 {
     // add title
     JToolbarHelper::title('sh404SEF: ' . JText::_('COM_SH404SEF_PAGEIDS_MANAGER'), 'sh404sef-toolbar-title');
     // add "New url" button
     $bar = JToolBar::getInstance('toolbar');
     // prepare configuration button
     $bar->addButtonPath(SHLIB_ROOT_PATH . 'toolbarbutton');
     $params = array();
     $params['size'] = Sh404sefFactory::getPConfig()->windowSizes['import'];
     $params['buttonClass'] = 'btn btn-small';
     $params['iconClass'] = 'icon-upload';
     $params['checkListSelection'] = false;
     $url = 'index.php?option=com_sh404sef&c=wizard&task=start&tmpl=component&optype=import&opsubject=pageids';
     $bar->appendButton('J3popuptoolbarbutton', 'import', JText::_('COM_SH404SEF_IMPORT_BUTTON'), $url, $params['size']['x'], $params['size']['y'], $top = 0, $left = 0, $onClose = '', $title = JText::_('COM_SH404SEF_IMPORTING_TITLE'), $params);
     // add import button
     $params = array();
     $params['size'] = Sh404sefFactory::getPConfig()->windowSizes['export'];
     $params['buttonClass'] = 'btn btn-small';
     $params['iconClass'] = 'icon-download';
     $params['checkListSelection'] = false;
     $url = 'index.php?option=com_sh404sef&c=wizard&task=start&tmpl=component&optype=export&opsubject=pageids';
     $bar->appendButton('J3popuptoolbarbutton', 'export', JText::_('COM_SH404SEF_EXPORT_BUTTON'), $url, $params['size']['x'], $params['size']['y'], $top = 0, $left = 0, $onClose = '', $title = JText::_('COM_SH404SEF_EXPORTING_TITLE'), $params);
     // separator
     JToolBarHelper::spacer(20);
     // add delete button
     $params = array();
     $params['size'] = Sh404sefFactory::getPConfig()->windowSizes['confirm'];
     $params['buttonClass'] = 'btn btn-small';
     $params['iconClass'] = 'icon-trash';
     $params['checkListSelection'] = true;
     $url = 'index.php?option=com_sh404sef&c=pageids&task=confirmdelete&tmpl=component';
     $bar->appendButton('J3popuptoolbarbutton', 'delete', JText::_('JTOOLBAR_DELETE'), $url, $params['size']['x'], $params['size']['y'], $top = 0, $left = 0, $onClose = '', $title = JText::_('COM_SH404SEF_CONFIRM_TITLE'), $params);
 }
Esempio n. 18
0
 function shAddPaginationHeaderLinks(&$buffer)
 {
     $sefConfig =& Sh404sefFactory::getConfig();
     if (!isset($sefConfig) || empty($sefConfig->shMetaManagementActivated) || empty($sefConfig->insertPaginationTags)) {
         return;
     }
     $pageInfo =& Sh404sefFactory::getPageInfo();
     // handle pagination
     if (!empty($pageInfo->paginationNextLink)) {
         $link = "\n  " . '<link rel="next" href="' . $pageInfo->paginationNextLink . '" />';
         $buffer = shInsertCustomTagInBuffer($buffer, '<head>', 'after', $link, 'first');
     }
     if (!empty($pageInfo->paginationPrevLink)) {
         $link = "\n  " . '<link rel="prev" href="' . $pageInfo->paginationPrevLink . '" />';
         $buffer = shInsertCustomTagInBuffer($buffer, '<head>', 'after', $link, 'first');
     }
 }
Esempio n. 19
0
 public function getCategorySlugArray($extension, $id, $whichCat, $useAlias, $insertId, $uncategorizedPath = '', $requestedLanguage = '*', $separator = '')
 {
     // special case for the "uncategorised" category
     $unCat = Sh404sefHelperCategories::getUncategorizedCat($extension);
     if (!empty($unCat) && $id == $unCat->id) {
         $slugArray = empty($uncategorizedPath) ? array() : array($uncategorizedPath);
         return $slugArray;
     }
     // regular category, build the path to the cat
     $separator = empty($separator) ? Sh404sefFactory::getConfig()->replacement : $separator;
     $pathArray = $this->getCategoryPathArray($extension, $id, $whichCat, $useAlias, $insertId, $requestedLanguage, $separator);
     $slugArray = array();
     foreach ($pathArray as $catObject) {
         $slugArray[] = $catObject->slug;
     }
     return $slugArray;
 }
Esempio n. 20
0
    die('Direct Access to this location is not allowed.');
}
// Ensure that user has access to this function.
$user =& JFactory::getUser();
if (!($user->usertype == 'Super Administrator' || $user->usertype == 'Administrator')) {
    $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH'));
}
// Setup paths.
$sef_config_class = JPATH_ADMINISTRATOR . '/components/com_sh404sef/sh404sef.class.php';
$sef_config_file = JPATH_ADMINISTRATOR . '/components/com_sh404sef/config/config.sef.php';
// Make sure class was loaded.
if (!class_exists('shSEFConfig')) {
    if (is_readable($sef_config_class)) {
        require_once $sef_config_class;
    } else {
        JError::RaiseError(500, COM_SH404SEF_NOREAD . "( {$sef_config_class} )<br />" . COM_SH404SEF_CHK_PERMS);
    }
}
// testing JLanguage16
jimport('joomla.language.language');
$j16Language =& shjlang16Helper::getLanguage();
$loaded = $j16Language->load('com_sh404sef', JPATH_BASE);
// include sh404sef default language file
shIncludeLanguageFile();
// find about specific controller requested
$cName = JRequest::getCmd('c');
// get controller from factory
$controller = Sh404sefFactory::getController($cName);
// read and execute task
$controller->execute(JRequest::getCmd('task'));
$controller->redirect();
Esempio n. 21
0
    function shSEFConfig()
    {
        $sef_config_file = sh404SEF_ADMIN_ABS_PATH . 'config/config.sef.php';
        $app = JFactory::getApplication();
        if ($app->isAdmin()) {
            $this->shCheckFilesAccess();
        }
        if (shFileExists($sef_config_file)) {
            include $sef_config_file;
        }
        // shumisha : 2007-04-01 new parameters !
        if (isset($shUseURLCache)) {
            $this->shUseURLCache = $shUseURLCache;
        }
        // shumisha : 2007-04-01 new parameters !
        if (isset($shMaxURLInCache)) {
            $this->shMaxURLInCache = $shMaxURLInCache;
        }
        // shumisha : 2007-04-01 new parameters !
        if (isset($shTranslateURL)) {
            $this->shTranslateURL = $shTranslateURL;
        }
        //V 1.2.4.m
        if (isset($shInsertLanguageCode)) {
            $this->shInsertLanguageCode = $shInsertLanguageCode;
        }
        if (isset($notTranslateURLList)) {
            $this->notTranslateURLList = $notTranslateURLList;
        }
        if (isset($notInsertIsoCodeList)) {
            $this->notInsertIsoCodeList = $notInsertIsoCodeList;
        }
        // shumisha : 2007-04-03 new parameters !
        if (isset($shInsertGlobalItemidIfNone)) {
            $this->shInsertGlobalItemidIfNone = $shInsertGlobalItemidIfNone;
        }
        if (isset($shInsertTitleIfNoItemid)) {
            $this->shInsertTitleIfNoItemid = $shInsertTitleIfNoItemid;
        }
        if (isset($shAlwaysInsertMenuTitle)) {
            $this->shAlwaysInsertMenuTitle = $shAlwaysInsertMenuTitle;
        }
        if (isset($shAlwaysInsertItemid)) {
            $this->shAlwaysInsertItemid = $shAlwaysInsertItemid;
        }
        if (isset($shDefaultMenuItemName)) {
            $this->shDefaultMenuItemName = $shDefaultMenuItemName;
        }
        if (isset($shAppendRemainingGETVars)) {
            $this->shAppendRemainingGETVars = $shAppendRemainingGETVars;
        }
        if (isset($shVmInsertShopName)) {
            $this->shVmInsertShopName = $shVmInsertShopName;
        }
        if (isset($shInsertProductId)) {
            $this->shInsertProductId = $shInsertProductId;
        }
        if (isset($shVmUseProductSKU)) {
            $this->shVmUseProductSKU = $shVmUseProductSKU;
        }
        if (isset($shVmInsertManufacturerName)) {
            $this->shVmInsertManufacturerName = $shVmInsertManufacturerName;
        }
        if (isset($shInsertManufacturerId)) {
            $this->shInsertManufacturerId = $shInsertManufacturerId;
        }
        if (isset($shVMInsertCategories)) {
            $this->shVMInsertCategories = $shVMInsertCategories;
        }
        if (isset($shVmAdditionalText)) {
            $this->shVmAdditionalText = $shVmAdditionalText;
        }
        if (isset($shVmInsertFlypage)) {
            $this->shVmInsertFlypage = $shVmInsertFlypage;
        }
        if (isset($shInsertCategoryId)) {
            $this->shInsertCategoryId = $shInsertCategoryId;
        }
        if (isset($shReplacements)) {
            $this->shReplacements = $shReplacements;
        }
        if (isset($shInsertNumericalId)) {
            $this->shInsertNumericalId = $shInsertNumericalId;
        }
        if (isset($shInsertNumericalIdCatList)) {
            $this->shInsertNumericalIdCatList = $shInsertNumericalIdCatList;
        }
        if (isset($shRedirectNonSefToSef)) {
            $this->shRedirectNonSefToSef = $shRedirectNonSefToSef;
        }
        // disabled, can't be implemented safely
        //if (isset($shRedirectJoomlaSefToSef)) $this->shRedirectJoomlaSefToSef = $shRedirectJoomlaSefToSef;
        if (isset($shConfig_live_secure_site)) {
            $this->shConfig_live_secure_site = JString::rtrim($shConfig_live_secure_site, '/');
        }
        if (isset($shActivateIJoomlaMagInContent)) {
            $this->shActivateIJoomlaMagInContent = $shActivateIJoomlaMagInContent;
        }
        if (isset($shInsertIJoomlaMagIssueId)) {
            $this->shInsertIJoomlaMagIssueId = $shInsertIJoomlaMagIssueId;
        }
        if (isset($shInsertIJoomlaMagName)) {
            $this->shInsertIJoomlaMagName = $shInsertIJoomlaMagName;
        }
        if (isset($shInsertIJoomlaMagMagazineId)) {
            $this->shInsertIJoomlaMagMagazineId = $shInsertIJoomlaMagMagazineId;
        }
        if (isset($shInsertIJoomlaMagArticleId)) {
            $this->shInsertIJoomlaMagArticleId = $shInsertIJoomlaMagArticleId;
        }
        if (isset($shInsertCBName)) {
            $this->shInsertCBName = $shInsertCBName;
        }
        if (isset($shCBInsertUserName)) {
            $this->shCBInsertUserName = $shCBInsertUserName;
        }
        if (isset($shCBInsertUserId)) {
            $this->shCBInsertUserId = $shCBInsertUserId;
        }
        if (isset($shCBUseUserPseudo)) {
            $this->shCBUseUserPseudo = $shCBUseUserPseudo;
        }
        if (isset($shInsertMyBlogName)) {
            $this->shInsertMyBlogName = $shInsertMyBlogName;
        }
        if (isset($shMyBlogInsertPostId)) {
            $this->shMyBlogInsertPostId = $shMyBlogInsertPostId;
        }
        if (isset($shMyBlogInsertTagId)) {
            $this->shMyBlogInsertTagId = $shMyBlogInsertTagId;
        }
        if (isset($shMyBlogInsertBloggerId)) {
            $this->shMyBlogInsertBloggerId = $shMyBlogInsertBloggerId;
        }
        if (isset($shInsertDocmanName)) {
            $this->shInsertDocmanName = $shInsertDocmanName;
        }
        if (isset($shDocmanInsertDocId)) {
            $this->shDocmanInsertDocId = $shDocmanInsertDocId;
        }
        if (isset($shDocmanInsertDocName)) {
            $this->shDocmanInsertDocName = $shDocmanInsertDocName;
        }
        if (isset($shLog404Errors)) {
            $this->shLog404Errors = $shLog404Errors;
        }
        if (isset($shLMDefaultItemid)) {
            $this->shLMDefaultItemid = $shLMDefaultItemid;
        }
        if (isset($shInsertFireboardName)) {
            $this->shInsertFireboardName = $shInsertFireboardName;
        }
        if (isset($shFbInsertCategoryName)) {
            $this->shFbInsertCategoryName = $shFbInsertCategoryName;
        }
        if (isset($shFbInsertCategoryId)) {
            $this->shFbInsertCategoryId = $shFbInsertCategoryId;
        }
        if (isset($shFbInsertMessageSubject)) {
            $this->shFbInsertMessageSubject = $shFbInsertMessageSubject;
        }
        if (isset($shFbInsertMessageId)) {
            $this->shFbInsertMessageId = $shFbInsertMessageId;
        }
        if (isset($shDoNotOverrideOwnSef)) {
            // V 1.2.4.m
            $this->shDoNotOverrideOwnSef = $shDoNotOverrideOwnSef;
        }
        if (isset($shEncodeUrl)) {
            // V 1.2.4.m
            $this->shEncodeUrl = $shEncodeUrl;
        }
        if (isset($guessItemidOnHomepage)) {
            // V 1.2.4.q
            $this->guessItemidOnHomepage = $guessItemidOnHomepage;
        }
        if (isset($shForceNonSefIfHttps)) {
            // V 1.2.4.q
            $this->shForceNonSefIfHttps = $shForceNonSefIfHttps;
        }
        if (isset($shRewriteMode)) {
            // V 1.2.4.s
            $this->shRewriteMode = $shRewriteMode;
        }
        if (isset($shRewriteStrings)) {
            // V 1.2.4.s
            $this->shRewriteStrings = $shRewriteStrings;
        }
        if (isset($shMetaManagementActivated)) {
            // V 1.2.4.s
            $this->shMetaManagementActivated = $shMetaManagementActivated;
        }
        if (isset($shRemoveGeneratorTag)) {
            // V 1.2.4.s
            $this->shRemoveGeneratorTag = $shRemoveGeneratorTag;
        }
        if (isset($shPutH1Tags)) {
            // V 1.2.4.s
            $this->shPutH1Tags = $shPutH1Tags;
        }
        if (isset($shInsertContentTableName)) {
            // V 1.2.4.s
            $this->shInsertContentTableName = $shInsertContentTableName;
        }
        if (isset($shContentTableName)) {
            // V 1.2.4.s
            $this->shContentTableName = $shContentTableName;
        }
        if (isset($shAutoRedirectWww)) {
            // V 1.2.4.s
            $this->shAutoRedirectWww = $shAutoRedirectWww;
        }
        if (isset($shVmInsertProductName)) {
            // V 1.2.4.s
            $this->shVmInsertProductName = $shVmInsertProductName;
        }
        if (isset($shDMInsertCategories)) {
            // V 1.2.4.t
            $this->shDMInsertCategories = $shDMInsertCategories;
        }
        if (isset($shDMInsertCategoryId)) {
            // V 1.2.4.t
            $this->shDMInsertCategoryId = $shDMInsertCategoryId;
        }
        if (isset($shForcedHomePage)) {
            // V 1.2.4.t
            $this->shForcedHomePage = $shForcedHomePage;
        }
        if (isset($shInsertContentBlogName)) {
            // V 1.2.4.t
            $this->shInsertContentBlogName = $shInsertContentBlogName;
        }
        if (isset($shContentBlogName)) {
            // V 1.2.4.t
            $this->shContentBlogName = $shContentBlogName;
        }
        if (isset($shInsertMTreeName)) {
            // V 1.2.4.t
            $this->shInsertMTreeName = $shInsertMTreeName;
        }
        if (isset($shMTreeInsertListingName)) {
            // V 1.2.4.t
            $this->shMTreeInsertListingName = $shMTreeInsertListingName;
        }
        if (isset($shMTreeInsertListingId)) {
            // V 1.2.4.t
            $this->shMTreeInsertListingId = $shMTreeInsertListingId;
        }
        if (isset($shMTreePrependListingId)) {
            // V 1.2.4.t
            $this->shMTreePrependListingId = $shMTreePrependListingId;
        }
        if (isset($shMTreeInsertCategories)) {
            // V 1.2.4.t
            $this->shMTreeInsertCategories = $shMTreeInsertCategories;
        }
        if (isset($shMTreeInsertCategoryId)) {
            // V 1.2.4.t
            $this->shMTreeInsertCategoryId = $shMTreeInsertCategoryId;
        }
        if (isset($shMTreeInsertUserName)) {
            // V 1.2.4.t
            $this->shMTreeInsertUserName = $shMTreeInsertUserName;
        }
        if (isset($shMTreeInsertUserId)) {
            // V 1.2.4.t
            $this->shMTreeInsertUserId = $shMTreeInsertUserId;
        }
        if (isset($shInsertNewsPName)) {
            // V 1.2.4.t
            $this->shInsertNewsPName = $shInsertNewsPName;
        }
        if (isset($shNewsPInsertCatId)) {
            // V 1.2.4.t
            $this->shNewsPInsertCatId = $shNewsPInsertCatId;
        }
        if (isset($shNewsPInsertSecId)) {
            // V 1.2.4.t
            $this->shNewsPInsertSecId = $shNewsPInsertSecId;
        }
        if (isset($shInsertRemoName)) {
            // V 1.2.4.t
            $this->shInsertRemoName = $shInsertRemoName;
        }
        if (isset($shRemoInsertDocId)) {
            // V 1.2.4.t
            $this->shRemoInsertDocId = $shRemoInsertDocId;
        }
        if (isset($shRemoInsertDocName)) {
            // V 1.2.4.t
            $this->shRemoInsertDocName = $shRemoInsertDocName;
        }
        if (isset($shRemoInsertCategories)) {
            // V 1.2.4.t
            $this->shRemoInsertCategories = $shRemoInsertCategories;
        }
        if (isset($shRemoInsertCategoryId)) {
            // V 1.2.4.t
            $this->shRemoInsertCategoryId = $shRemoInsertCategoryId;
        }
        if (isset($shCBShortUserURL)) {
            // V 1.2.4.t
            $this->shCBShortUserURL = $shCBShortUserURL;
        }
        if (isset($shKeepStandardURLOnUpgrade)) {
            // V 1.2.4.t
            $this->shKeepStandardURLOnUpgrade = $shKeepStandardURLOnUpgrade;
        }
        if (isset($shKeepCustomURLOnUpgrade)) {
            // V 1.2.4.t
            $this->shKeepCustomURLOnUpgrade = $shKeepCustomURLOnUpgrade;
        }
        if (isset($shKeepMetaDataOnUpgrade)) {
            // V 1.2.4.t
            $this->shKeepMetaDataOnUpgrade = $shKeepMetaDataOnUpgrade;
        }
        if (isset($shKeepModulesSettingsOnUpgrade)) {
            // V 1.2.4.t
            $this->shKeepModulesSettingsOnUpgrade = $shKeepModulesSettingsOnUpgrade;
        }
        if (isset($shMultipagesTitle)) {
            // V 1.2.4.t
            $this->shMultipagesTitle = $shMultipagesTitle;
        }
        // shumisha end of new parameters
        if (isset($Enabled)) {
            $this->Enabled = $Enabled;
        }
        if (isset($replacement)) {
            $this->replacement = $replacement;
        }
        if (isset($pagerep)) {
            $this->pagerep = $pagerep;
        }
        if (isset($stripthese)) {
            $this->stripthese = $stripthese;
        }
        if (isset($friendlytrim)) {
            $this->friendlytrim = $friendlytrim;
        }
        if (isset($suffix)) {
            $this->suffix = $suffix;
        }
        if (isset($addFile)) {
            $this->addFile = $addFile;
        }
        if (isset($LowerCase)) {
            $this->LowerCase = $LowerCase;
        }
        if (isset($HideCat)) {
            $this->HideCat = $HideCat;
        }
        if (isset($replacement)) {
            $this->UseAlias = $UseAlias;
        }
        if (isset($UseAlias)) {
            $this->page404 = $page404;
        }
        if (isset($predefined)) {
            $this->predefined = $predefined;
        }
        if (isset($skip)) {
            $this->skip = $skip;
        }
        if (isset($nocache)) {
            $this->nocache = $nocache;
        }
        // V x
        if (isset($shKeepConfigOnUpgrade)) {
            // V 1.2.4.x
            $this->shKeepConfigOnUpgrade = $shKeepConfigOnUpgrade;
        }
        if (isset($shSecEnableSecurity)) {
            // V 1.2.4.x
            $this->shSecEnableSecurity = $shSecEnableSecurity;
        }
        if (isset($shSecLogAttacks)) {
            // V 1.2.4.x
            $this->shSecLogAttacks = $shSecLogAttacks;
        }
        if (isset($shSecOnlyNumVars)) {
            // V 1.2.4.x
            $this->shSecOnlyNumVars = $shSecOnlyNumVars;
        }
        if (isset($shSecAlphaNumVars)) {
            // V 1.2.4.x
            $this->shSecAlphaNumVars = $shSecAlphaNumVars;
        }
        if (isset($shSecNoProtocolVars)) {
            // V 1.2.4.x
            $this->shSecNoProtocolVars = $shSecNoProtocolVars;
        }
        $this->ipWhiteList = shReadFile(sh404SEF_ADMIN_ABS_PATH . 'security/sh404SEF_IP_white_list.dat');
        $this->ipBlackList = shReadFile(sh404SEF_ADMIN_ABS_PATH . 'security/sh404SEF_IP_black_list.dat');
        $this->uAgentWhiteList = shReadFile(sh404SEF_ADMIN_ABS_PATH . 'security/sh404SEF_uAgent_white_list.dat');
        $this->uAgentBlackList = shReadFile(sh404SEF_ADMIN_ABS_PATH . 'security/sh404SEF_uAgent_black_list.dat');
        if (isset($shSecCheckHoneyPot)) {
            // V 1.2.4.x
            $this->shSecCheckHoneyPot = $shSecCheckHoneyPot;
        }
        if (isset($shSecDebugHoneyPot)) {
            // V 1.2.4.x
            $this->shSecDebugHoneyPot = $shSecDebugHoneyPot;
        }
        if (isset($shSecHoneyPotKey)) {
            // V 1.2.4.x
            $this->shSecHoneyPotKey = $shSecHoneyPotKey;
        }
        if (isset($shSecEntranceText)) {
            // V 1.2.4.x
            $this->shSecEntranceText = $shSecEntranceText;
        }
        if (isset($shSecSmellyPotText)) {
            // V 1.2.4.x
            $this->shSecSmellyPotText = $shSecSmellyPotText;
        }
        if (isset($monthsToKeepLogs)) {
            // V 1.2.4.x
            $this->monthsToKeepLogs = $monthsToKeepLogs;
        }
        if (isset($shSecActivateAntiFlood)) {
            // V 1.2.4.x
            $this->shSecActivateAntiFlood = $shSecActivateAntiFlood;
        }
        if (isset($shSecAntiFloodOnlyOnPOST)) {
            // V 1.2.4.x
            $this->shSecAntiFloodOnlyOnPOST = $shSecAntiFloodOnlyOnPOST;
        }
        if (isset($shSecAntiFloodPeriod)) {
            // V 1.2.4.x
            $this->shSecAntiFloodPeriod = $shSecAntiFloodPeriod;
        }
        if (isset($shSecAntiFloodCount)) {
            // V 1.2.4.x
            $this->shSecAntiFloodCount = $shSecAntiFloodCount;
        }
        //  if (isset($insertSectionInBlogTableLinks))  // V 1.2.4.x
        //    $this->insertSectionInBlogTableLinks = $insertSectionInBlogTableLinks;
        $this->shLangTranslateList = $this->shInitLanguageList(isset($shLangTranslateList) ? $shLangTranslateList : null, 0, 0);
        $this->shLangInsertCodeList = $this->shInitLanguageList(isset($shLangInsertCodeList) ? $shLangInsertCodeList : null, 0, 0);
        if (isset($defaultComponentStringList)) {
            // V 1.2.4.x
            $this->defaultComponentStringList = $defaultComponentStringList;
        }
        $this->pageTexts = $this->shInitLanguageList(isset($pageTexts) ? $pageTexts : null, isset($pagetext) ? $pagetext : 'Page-%s', isset($pagetext) ? $pagetext : 'Page-%s');
        // use value from prev versions if any
        if (isset($shAdminInterfaceType)) {
            // V 1.2.4.x
            $this->shAdminInterfaceType = $shAdminInterfaceType;
        }
        // compatibility with version earlier than V x
        if (isset($shShopName)) {
            // V 1.2.4.x
            $this->defaultComponentStringList['virtuemart'] = $shShopName;
        }
        if (isset($shIJoomlaMagName)) {
            // V 1.2.4.x
            $this->defaultComponentStringList['magazine'] = $shIJoomlaMagName;
        }
        if (isset($shCBName)) {
            // V 1.2.4.x
            $this->defaultComponentStringList['comprofiler'] = $shCBName;
        }
        if (isset($shFireboardName)) {
            // V 1.2.4.x
            $this->defaultComponentStringList['fireboard'] = $shFireboardName;
        }
        if (isset($shMyBlogName)) {
            // V 1.2.4.x
            $this->defaultComponentStringList['myblog'] = $shMyBlogName;
        }
        if (isset($shDocmanName)) {
            // V 1.2.4.x
            $this->defaultComponentStringList['docman'] = $shDocmanName;
        }
        if (isset($shMTreeName)) {
            // V 1.2.4.x
            $this->defaultComponentStringList['mtree'] = $shMTreeName;
        }
        if (isset($shNewsPName)) {
            // V 1.2.4.x
            $this->defaultComponentStringList['news_portal'] = $shNewsPName;
        }
        if (isset($shRemoName)) {
            // V 1.2.4.x
            $this->defaultComponentStringList['remository'] = $shRemoName;
        }
        // end of compatibility code
        // V 1.3 RC
        if (isset($shInsertNoFollowPDFPrint)) {
            $this->shInsertNoFollowPDFPrint = $shInsertNoFollowPDFPrint;
        }
        if (isset($shInsertReadMorePageTitle)) {
            $this->shInsertReadMorePageTitle = $shInsertReadMorePageTitle;
        }
        if (isset($shMultipleH1ToH2)) {
            $this->shMultipleH1ToH2 = $shMultipleH1ToH2;
        }
        // V 1.3.1 RC
        if (isset($shVmUsingItemsPerPage)) {
            $this->shVmUsingItemsPerPage = $shVmUsingItemsPerPage;
        }
        if (isset($shSecCheckPOSTData)) {
            $this->shSecCheckPOSTData = $shSecCheckPOSTData;
        }
        if (isset($shSecCurMonth)) {
            $this->shSecCurMonth = $shSecCurMonth;
        }
        if (isset($shSecLastUpdated)) {
            $this->shSecLastUpdated = $shSecLastUpdated;
        }
        if (isset($shSecTotalAttacks)) {
            $this->shSecTotalAttacks = $shSecTotalAttacks;
        }
        if (isset($shSecTotalConfigVars)) {
            $this->shSecTotalConfigVars = $shSecTotalConfigVars;
        }
        if (isset($shSecTotalBase64)) {
            $this->shSecTotalBase64 = $shSecTotalBase64;
        }
        if (isset($shSecTotalScripts)) {
            $this->shSecTotalScripts = $shSecTotalScripts;
        }
        if (isset($shSecTotalStandardVars)) {
            $this->shSecTotalStandardVars = $shSecTotalStandardVars;
        }
        if (isset($shSecTotalImgTxtCmd)) {
            $this->shSecTotalImgTxtCmd = $shSecTotalImgTxtCmd;
        }
        if (isset($shSecTotalIPDenied)) {
            $this->shSecTotalIPDenied = $shSecTotalIPDenied;
        }
        if (isset($shSecTotalUserAgentDenied)) {
            $this->shSecTotalUserAgentDenied = $shSecTotalUserAgentDenied;
        }
        if (isset($shSecTotalFlooding)) {
            $this->shSecTotalFlooding = $shSecTotalFlooding;
        }
        if (isset($shSecTotalPHP)) {
            $this->shSecTotalPHP = $shSecTotalPHP;
        }
        if (isset($shSecTotalPHPUserClicked)) {
            $this->shSecTotalPHPUserClicked = $shSecTotalPHPUserClicked;
        }
        if (isset($prependToPageTitle)) {
            $this->prependToPageTitle = $prependToPageTitle;
        }
        if (isset($appendToPageTitle)) {
            $this->appendToPageTitle = $appendToPageTitle;
        }
        if (isset($debugToLogFile)) {
            $this->debugToLogFile = $debugToLogFile;
        }
        if (isset($debugStartedAt)) {
            $this->debugStartedAt = $debugStartedAt;
        }
        if (isset($debugDuration)) {
            $this->debugDuration = $debugDuration;
        }
        // V 1.3.1
        if (isset($shInsertOutboundLinksImage)) {
            $this->shInsertOutboundLinksImage = $shInsertOutboundLinksImage;
        }
        if (isset($shImageForOutboundLinks)) {
            $this->shImageForOutboundLinks = $shImageForOutboundLinks;
        }
        // V 1.0.12
        if (isset($useCatAlias)) {
            $this->useCatAlias = $useCatAlias;
        }
        if (isset($useMenuAlias)) {
            $this->useMenuAlias = $useMenuAlias;
        }
        // V 1.5.3
        if (isset($alwaysAppendItemsPerPage)) {
            $this->alwaysAppendItemsPerPage = $alwaysAppendItemsPerPage;
        }
        if (isset($redirectToCorrectCaseUrl)) {
            $this->redirectToCorrectCaseUrl = $redirectToCorrectCaseUrl;
        }
        // V 1.5.5
        if (isset($jclInsertEventId)) {
            $this->jclInsertEventId = $jclInsertEventId;
        }
        if (isset($jclInsertCategoryId)) {
            $this->jclInsertCategoryId = $jclInsertCategoryId;
        }
        if (isset($jclInsertCalendarId)) {
            $this->jclInsertCalendarId = $jclInsertCalendarId;
        }
        if (isset($jclInsertCalendarName)) {
            $this->jclInsertCalendarName = $jclInsertCalendarName;
        }
        if (isset($jclInsertDate)) {
            $this->jclInsertDate = $jclInsertDate;
        }
        if (isset($jclInsertDateInEventView)) {
            $this->jclInsertDateInEventView = $jclInsertDateInEventView;
        }
        if (isset($ContentTitleShowCat)) {
            $this->ContentTitleShowCat = $ContentTitleShowCat;
        }
        if (isset($ContentTitleUseAlias)) {
            $this->ContentTitleUseAlias = $ContentTitleUseAlias;
        }
        if (isset($ContentTitleUseCatAlias)) {
            $this->ContentTitleUseCatAlias = $ContentTitleUseCatAlias;
        }
        if (isset($pageTitleSeparator)) {
            $this->pageTitleSeparator = $pageTitleSeparator;
        }
        if (isset($ContentTitleInsertArticleId)) {
            $this->ContentTitleInsertArticleId = $ContentTitleInsertArticleId;
        }
        if (isset($shInsertContentArticleIdCatList)) {
            $this->shInsertContentArticleIdCatList = $shInsertContentArticleIdCatList;
        }
        // 1.5.8
        if (isset($shJSInsertJSName)) {
            $this->shJSInsertJSName = $shJSInsertJSName;
        }
        if (isset($shJSShortURLToUserProfile)) {
            $this->shJSShortURLToUserProfile = $shJSShortURLToUserProfile;
        }
        if (isset($shJSInsertUsername)) {
            $this->shJSInsertUsername = $shJSInsertUsername;
        }
        if (isset($shJSInsertUserFullName)) {
            $this->shJSInsertUserFullName = $shJSInsertUserFullName;
        }
        if (isset($shJSInsertUserId)) {
            $this->shJSInsertUserId = $shJSInsertUserId;
        }
        if (isset($shJSInsertUserFullName)) {
            $this->shJSInsertUserFullName = $shJSInsertUserFullName;
        }
        if (isset($shJSInsertGroupCategory)) {
            $this->shJSInsertGroupCategory = $shJSInsertGroupCategory;
        }
        if (isset($shJSInsertGroupCategoryId)) {
            $this->shJSInsertGroupCategoryId = $shJSInsertGroupCategoryId;
        }
        if (isset($shJSInsertGroupId)) {
            $this->shJSInsertGroupId = $shJSInsertGroupId;
        }
        if (isset($shJSInsertGroupBulletinId)) {
            $this->shJSInsertGroupBulletinId = $shJSInsertGroupBulletinId;
        }
        if (isset($shJSInsertDiscussionId)) {
            $this->shJSInsertDiscussionId = $shJSInsertDiscussionId;
        }
        if (isset($shJSInsertMessageId)) {
            $this->shJSInsertMessageId = $shJSInsertMessageId;
        }
        if (isset($shJSInsertPhotoAlbum)) {
            $this->shJSInsertPhotoAlbum = $shJSInsertPhotoAlbum;
        }
        if (isset($shJSInsertPhotoAlbumId)) {
            $this->shJSInsertPhotoAlbumId = $shJSInsertPhotoAlbumId;
        }
        if (isset($shJSInsertPhotoId)) {
            $this->shJSInsertPhotoId = $shJSInsertPhotoId;
        }
        if (isset($shJSInsertVideoCat)) {
            $this->shJSInsertVideoCat = $shJSInsertVideoCat;
        }
        if (isset($shJSInsertVideoCatId)) {
            $this->shJSInsertVideoCatId = $shJSInsertVideoCatId;
        }
        if (isset($shJSInsertVideoId)) {
            $this->shJSInsertVideoId = $shJSInsertVideoId;
        }
        if (isset($shFbInsertUserName)) {
            $this->shFbInsertUserName = $shFbInsertUserName;
        }
        if (isset($shFbInsertUserId)) {
            $this->shFbInsertUserId = $shFbInsertUserId;
        }
        if (isset($shFbShortUrlToProfile)) {
            $this->shFbShortUrlToProfile = $shFbShortUrlToProfile;
        }
        if (isset($shPageNotFoundItemid)) {
            $this->shPageNotFoundItemid = $shPageNotFoundItemid;
        }
        if (isset($autoCheckNewVersion)) {
            $this->autoCheckNewVersion = $autoCheckNewVersion;
        }
        if (isset($error404SubTemplate)) {
            $this->error404SubTemplate = $error404SubTemplate;
        }
        if (isset($enablePageId)) {
            $this->enablePageId = $enablePageId;
        }
        if (isset($compEnablePageId)) {
            $this->compEnablePageId = $compEnablePageId;
        }
        // V 2.1.0
        if (isset($analyticsEnabled)) {
            $this->analyticsEnabled = $analyticsEnabled;
        }
        if (isset($analyticsReportsEnabled)) {
            $this->analyticsReportsEnabled = $analyticsReportsEnabled;
        }
        if (isset($analyticsType)) {
            $this->analyticsType = $analyticsType;
        }
        if (isset($analyticsId)) {
            $this->analyticsId = $analyticsId;
        }
        if (isset($analyticsUser)) {
            $this->analyticsUser = $analyticsUser;
        }
        if (isset($analyticsPassword)) {
            $this->analyticsPassword = $analyticsPassword;
        }
        if (isset($analyticsAccount)) {
            $this->analyticsAccount = $analyticsAccount;
        }
        if (isset($analyticsExcludeIP)) {
            $this->analyticsExcludeIP = $analyticsExcludeIP;
        }
        if (isset($analyticsMaxUserLevel)) {
            $this->analyticsMaxUserLevel = $analyticsMaxUserLevel;
        }
        if (isset($analyticsProfile)) {
            $this->analyticsProfile = $analyticsProfile;
        }
        if (isset($autoCheckNewAnalytics)) {
            $this->autoCheckNewAnalytics = $autoCheckNewAnalytics;
        }
        if (isset($analyticsDashboardDateRange)) {
            $this->analyticsDashboardDateRange = $analyticsDashboardDateRange;
        }
        if (isset($analyticsEnableTimeCollection)) {
            $this->analyticsEnableTimeCollection = $analyticsEnableTimeCollection;
        }
        if (isset($analyticsEnableUserCollection)) {
            $this->analyticsEnableUserCollection = $analyticsEnableUserCollection;
        }
        if (isset($analyticsDashboardDataType)) {
            $this->analyticsDashboardDataType = $analyticsDashboardDataType;
        }
        if (isset($slowServer)) {
            $this->slowServer = $slowServer;
        }
        // V 2.1.10
        if (isset($useJoomsefRouter)) {
            $this->useJoomsefRouter = $useJoomsefRouter;
        }
        if (isset($useAcesefRouter)) {
            $this->useAcesefRouter = $useAcesefRouter;
        }
        // V 2.1.11
        if (isset($insertShortlinkTag)) {
            $this->insertShortlinkTag = $insertShortlinkTag;
        }
        if (isset($insertRevCanTag)) {
            $this->insertRevCanTag = $insertRevCanTag;
        }
        if (isset($insertAltShorterTag)) {
            $this->insertAltShorterTag = $insertAltShorterTag;
        }
        if (isset($canReadRemoteConfig)) {
            $this->canReadRemoteConfig = $canReadRemoteConfig;
        }
        if (isset($stopCreatingShurls)) {
            $this->stopCreatingShurls = $stopCreatingShurls;
        }
        if (isset($shurlBlackList)) {
            $this->shurlBlackList = $shurlBlackList;
        }
        if (isset($shurlNonSefBlackList)) {
            $this->shurlNonSefBlackList = $shurlNonSefBlackList;
        }
        // V 3.0.0
        if (isset($includeContentCat)) {
            $this->includeContentCat = $includeContentCat;
        }
        if (isset($includeContentCatCategories)) {
            $this->includeContentCatCategories = $includeContentCatCategories;
        }
        if (isset($contentCategoriesSuffix)) {
            $this->contentCategoriesSuffix = $contentCategoriesSuffix;
        }
        if (isset($contentTitleIncludeCat)) {
            $this->contentTitleIncludeCat = $contentTitleIncludeCat;
        }
        if (isset($useContactCatAlias)) {
            $this->useContactCatAlias = $useContactCatAlias;
        }
        if (isset($contactCategoriesSuffix)) {
            $this->contactCategoriesSuffix = $contactCategoriesSuffix;
        }
        if (isset($includeContactCat)) {
            $this->includeContactCat = $includeContactCat;
        }
        if (isset($includeContactCatCategories)) {
            $this->includeContactCatCategories = $includeContactCatCategories;
        }
        if (isset($useWeblinksCatAlias)) {
            $this->useWeblinksCatAlias = $useWeblinksCatAlias;
        }
        if (isset($weblinksCategoriesSuffix)) {
            $this->weblinksCategoriesSuffix = $weblinksCategoriesSuffix;
        }
        if (isset($includeWeblinksCat)) {
            $this->includeWeblinksCat = $includeWeblinksCat;
        }
        if (isset($includeWeblinksCatCategories)) {
            $this->includeWeblinksCatCategories = $includeWeblinksCatCategories;
        }
        $this->liveSites = $this->shInitLanguageList(isset($liveSites) ? $liveSites : array(), '', '');
        if (isset($alternateTemplate)) {
            $this->alternateTemplate = $alternateTemplate;
        }
        if (isset($useJoomlaRouter)) {
            $this->useJoomlaRouter = $useJoomlaRouter;
        }
        if (isset($slugForUncategorizedContent)) {
            $this->slugForUncategorizedContent = $slugForUncategorizedContent;
        }
        if (isset($slugForUncategorizedContact)) {
            $this->slugForUncategorizedContact = $slugForUncategorizedContact;
        }
        if (isset($slugForUncategorizedWeblinks)) {
            $this->slugForUncategorizedWeblinks = $slugForUncategorizedWeblinks;
        }
        // 3.4
        if (isset($enableMultiLingualSupport)) {
            $this->enableMultiLingualSupport = $enableMultiLingualSupport;
        }
        if (isset($enableOpenGraphData)) {
            $this->enableOpenGraphData = $enableOpenGraphData;
        }
        if (isset($ogEnableDescription)) {
            $this->ogEnableDescription = $ogEnableDescription;
        }
        if (isset($ogType)) {
            $this->ogType = $ogType;
        }
        if (isset($ogImage)) {
            $this->ogImage = $ogImage;
        }
        if (isset($ogEnableSiteName)) {
            $this->ogEnableSiteName = $ogEnableSiteName;
        }
        if (isset($ogSiteName)) {
            $this->ogSiteName = $ogSiteName;
        }
        if (isset($ogEnableLocation)) {
            $this->ogEnableLocation = $ogEnableLocation;
        }
        if (isset($ogLatitude)) {
            $this->ogLatitude = $ogLatitude;
        }
        if (isset($ogLongitude)) {
            $this->ogLongitude = $ogLongitude;
        }
        if (isset($ogStreetAddress)) {
            $this->ogStreetAddress = $ogStreetAddress;
        }
        if (isset($ogLocality)) {
            $this->ogLocality = $ogLocality;
        }
        if (isset($ogPostalCode)) {
            $this->ogPostalCode = $ogPostalCode;
        }
        if (isset($ogRegion)) {
            $this->ogRegion = $ogRegion;
        }
        if (isset($ogCountryName)) {
            $this->ogCountryName = $ogCountryName;
        }
        if (isset($ogEnableContact)) {
            $this->ogEnableContact = $ogEnableContact;
        }
        if (isset($ogEmail)) {
            $this->ogEmail = $ogEmail;
        }
        if (isset($ogPhoneNumber)) {
            $this->ogPhoneNumber = $ogPhoneNumber;
        }
        if (isset($ogFaxNumber)) {
            $this->ogFaxNumber = $ogFaxNumber;
        }
        if (isset($fbAdminIds)) {
            $this->fbAdminIds = $fbAdminIds;
        }
        if (isset($insertPaginationTags)) {
            $this->insertPaginationTags = $insertPaginationTags;
        }
        // define default values for seldom used params
        if (!defined('sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR')) {
            // SECTION : GLOBAL PARAMETERS for sh404sef ---------------------------------------------------------------------
            $shDefaultParamsHelp['sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR'] = '// if not 0, urls for pdf documents and rss feeds  will be only partially turned into sef urls. 
//The query string &format=pdf or &format=feed will be still be appended.
// This will protect against malfunctions when using some plugins which makes a call
// to JFactory::getDocument() from a onAfterInitiliaze handler
// At this time, SEF urls are not decoded and thus the document type is set to html instead of pdf or feed
// resulting in the home page being displayed instead of the correct document';
            $shDefaultParams['sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR'] = 0;
            /*
                   $shDefaultParamsHelp['sh404SEF_PROTECT_AGAINST_BAD_NON_DEFAULT_LANGUAGE_MENU_HOMELINK'] =
                   '// Joomla mod_mainmenu module forces usage of JURI::base() for the homepage link
                   // On multilingual sites, this causes homepage link in other than default language to
                   // be wrong. If the following parameter is non-zero, such a homepage link
                   // will be replaced by the correct link, similar to www.mysite.com/es/ for instance';
                   $shDefaultParams['sh404SEF_PROTECT_AGAINST_BAD_NON_DEFAULT_LANGUAGE_MENU_HOMELINK'] = 1;
            */
            $shDefaultParamsHelp['sh404SEF_REDIRECT_IF_INDEX_PHP'] = '// if not 0, sh404SEF will do a 301 redirect from http://yoursite.com/index.php
// or http://yoursite.com/index.php?lang=xx to http://yoursite.com/
// this may not work on some web servers, which transform yoursite.com into
// yoursite.com/index.php, thus creating and endless loop. If your server does
// that, set this param to 0';
            $shDefaultParams['sh404SEF_REDIRECT_IF_INDEX_PHP'] = 1;
            $shDefaultParamsHelp['sh404SEF_NON_SEF_IF_SUPERADMIN'] = '// if superadmin logged in, force non-sef, for testing and setting up purpose';
            $shDefaultParams['sh404SEF_NON_SEF_IF_SUPERADMIN'] = 0;
            $shDefaultParamsHelp['sh404SEF_DE_ACTIVATE_LANG_AUTO_REDIRECT'] = '// set to 1 to prevent 303 auto redirect based on user language
// use with care, will prevent language switch to work for users without javascript';
            $shDefaultParams['sh404SEF_DE_ACTIVATE_LANG_AUTO_REDIRECT'] = 1;
            $shDefaultParamsHelp['sh404SEF_CHECK_COMP_IS_INSTALLED'] = '// if 1, SEF URLs will only be built for installed components.';
            $shDefaultParams['sh404SEF_CHECK_COMP_IS_INSTALLED'] = 1;
            $shDefaultParamsHelp['sh404SEF_REDIRECT_OUTBOUND_LINKS'] = '// if 1, all outbound links on page will be reached through a redirect
// to avoid page rank leakage';
            $shDefaultParams['sh404SEF_REDIRECT_OUTBOUND_LINKS'] = 0;
            $shDefaultParamsHelp['sh404SEF_PDF_DIR'] = '// if not empty, urls to pdf produced by Joomla will be prefixed with this
// path. Can be : \'pdf\' or \'pdf/something\' (ie: don\'t put leading or trailing slashes)
// Allows you to store some pre-built PDF in a directory called /pdf, with the same name
// as a page. Such a pdf will be served directly by the web server instead of being built on
// the fly by Joomla. This will save CPU and RAM. (only works this way if using htaccess';
            $shDefaultParams['sh404SEF_PDF_DIR'] = 'pdf';
            $shDefaultParamsHelp['SH404SEF_URL_CACHE_TTL'] = '// time to live for url cache in hours : default = 168h = 1 week
// Set to 0 to keep cache forever';
            $shDefaultParams['SH404SEF_URL_CACHE_TTL'] = 168;
            $shDefaultParamsHelp['SH404SEF_URL_CACHE_WRITES_TO_CHECK_TTL'] = '// number of cache write before checking cache TTL.';
            $shDefaultParams['SH404SEF_URL_CACHE_WRITES_TO_CHECK_TTL'] = 1000;
            $shDefaultParamsHelp['sh404SEF_SEC_MAIL_ATTACKS_TO_ADMIN'] = '// if set to 1, an email will be send to site admin when an attack is logged
// if the site is live, you could be drowning in email rapidly !!!';
            $shDefaultParams['sh404SEF_SEC_MAIL_ATTACKS_TO_ADMIN'] = 0;
            $shDefaultParams['sh404SEF_SEC_EMAIL_TO_ADMIN_SUBJECT'] = 'Your site %sh404SEF_404_SITE_NAME% was subject to an attack';
            $shDefaultParams['sh404SEF_SEC_EMAIL_TO_ADMIN_BODY'] = 'Hello !' . "\n\n" . 'This is sh404SEF security component, running at your site (%sh404SEF_404_SITE_URL%).' . "\n\n" . 'I have just blocked an attack on your site. Please check details below : ' . "\n" . '------------------------------------------------------------------------' . "\n" . '%sh404SEF_404_ATTACK_DETAILS%' . "\n" . '------------------------------------------------------------------------' . "\n\n" . 'Thanks for using sh404SEF!' . "\n\n";
            $shDefaultParamsHelp['SH404SEF_PAGES_TO_CLEAN_LOGS'] = '// number of pages between checks to remove old log files
// if 1, we check at every page request';
            $shDefaultParams['SH404SEF_PAGES_TO_CLEAN_LOGS'] = 10000;
            $shDefaultParamsHelp['SH_VM_ALLOW_PRODUCTS_IN_MULTIPLE_CATS'] = '// SECTION : Virtuemart plugin parameters ----------------------------------------------------------------------------

// set to 1 for products to have requested category name included in url
// useful if some products are in more than one category. If param set to 0,
// only one category will be used for all pages. Not recommended now that sh404SEF
// automatically handle rel=canonical on such pages';
            $shDefaultParams['SH_VM_ALLOW_PRODUCTS_IN_MULTIPLE_CATS'] = 1;
            $shDefaultParamsHelp['sh404SEF_SOBI2_PARAMS_ALWAYS_INCLUDE_CATS'] = '// SECTION : SOBI2 plugin parameters ----------------------------------------------------------------------------

// set to 1 to always include categories in SOBI2 entries
// details pages url';
            $shDefaultParams['sh404SEF_SOBI2_PARAMS_ALWAYS_INCLUDE_CATS'] = 0;
            $shDefaultParamsHelp['sh404SEF_SOBI2_PARAMS_INCLUDE_ENTRY_ID'] = '// set to 1 so that entry id is prepended to url';
            $shDefaultParams['sh404SEF_SOBI2_PARAMS_INCLUDE_ENTRY_ID'] = 0;
            $shDefaultParamsHelp['sh404SEF_SOBI2_PARAMS_INCLUDE_CAT_ID'] = '// set to 1 so that category id is prepended to category name';
            $shDefaultParams['sh404SEF_SOBI2_PARAMS_INCLUDE_CAT_ID'] = 0;
            // end of parameters
            $sef_custom_config_file = sh404SEF_ADMIN_ABS_PATH . 'custom.sef.php';
            // read user defined values, possibly recovered while upgrading
            if (JFile::exists($sef_custom_config_file)) {
                include $sef_custom_config_file;
            }
            // generate string for parameter modification
            if ($app->isAdmin()) {
                // only need to modify custom params in back-end
                $this->defaultParamList = '<?php
// custom.sef.php : custom.configuration file for sh404SEF
// 3.5.1.1299 - anything-digital.com/sh404sef/seo-analytics-and-security-for-joomla.html

// DO NOT REMOVE THIS LINE :
if (!defined(\'_JEXEC\')) die(\'Direct Access to this location is not allowed.\');
// DO NOT REMOVE THIS LINE' . "\n";
                foreach ($shDefaultParams as $key => $value) {
                    $this->defaultParamList .= "\n";
                    if (!empty($shDefaultParamsHelp[$key])) {
                        $this->defaultParamList .= $shDefaultParamsHelp[$key] . "\n";
                    }
                    // echo help text, if any
                    $this->defaultParamList .= '$shDefaultParams[\'' . $key . '\'] = ' . (is_string($value) ? "'{$value}'" : $value) . ";\n";
                }
            }
            // read user set values for these params and create constants
            if (!empty($shDefaultParams)) {
                foreach ($shDefaultParams as $key => $value) {
                    define($key, $value);
                }
            }
            unset($shDefaultParams);
            unset($shDefaultParamsHelp);
        }
        // compatiblity variables, for sef_ext files usage from OpenSef/SEf Advance V 1.2.4.p
        $this->encode_page_suffix = '';
        // if using an opensef sef_ext, we don't let  them manage suffix
        $this->encode_space_char = $this->replacement;
        $this->encode_lowercase = $this->LowerCase;
        $this->encode_strip_chars = $this->stripthese;
        $this->content_page_name = empty($this->pageTexts[Sh404sefFactory::getPageInfo()->shMosConfig_locale]) ? 'Page' : str_replace('%s', '', $this->pageTexts[Sh404sefFactory::getPageInfo()->shMosConfig_locale]);
        // V 1.2.4.r
        $this->content_page_format = '%s' . $this->replacement . '%d';
        // V 1.2.4.r
        $shTemp = $this->shGetReplacements();
        foreach ($shTemp as $dest => $source) {
            $this->spec_chars_d .= $dest . ',';
            $this->spec_chars .= $source . ',';
        }
        JString::rtrim($this->spec_chars_d, ',');
        JString::rtrim($this->spec_chars, ',');
    }
Esempio n. 22
0
function shDoAntiFloodCheck($ip)
{
    $sefConfig = Sh404sefFactory::getConfig();
    if (!$sefConfig->shSecActivateAntiFlood || empty($sefConfig->shSecAntiFloodPeriod) || $sefConfig->shSecAntiFloodOnlyOnPOST && empty($_POST) || empty($sefConfig->shSecAntiFloodCount) || empty($ip)) {
        return;
    }
    // disable for requests coming from same site, including ajax calls
    // coming from jomsocial
    // activate if using JomSocial on your site, removing the /* and */ marks surrounding the next few lines
    /*
    $referrer =  empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
      if (!empty($referrer) && strpos( $referrer, Sh404sefFactory::getPageInfo()->getDefaultLiveSite()) === 0) {
      if (!empty($_POST['option']) && $_POST['option'] == 'community'
      && !empty( $_POST['task']) && $_POST['task'] == 'azrul_ajax') {
      return;
      }
      }
    */
    // end of Jomsocial specific code
    $nextId = 1;
    $cTime = time();
    $count = 0;
    $floodData = shReadFile(sh404SEF_ADMIN_ABS_PATH . 'security/sh404SEF_AntiFlood_Data.dat');
    if (!empty($floodData)) {
        // find next id
        $lastRec = $floodData[count($floodData) - 1];
        $lastRecId = explode(',', $lastRec);
        if (!empty($lastRecId)) {
            $nextId = intval($lastRecId[0]) + 1;
        }
        // trim flood data : remove lines older than set time limit
        foreach ($floodData as $data) {
            $rec = explode(', ', $data);
            if (empty($rec[2]) || $cTime - intVal($rec[2]) > $sefConfig->shSecAntiFloodPeriod) {
                unset($floodData[$count]);
            }
            $count++;
        }
        $floodData = array_filter($floodData);
    }
    // we have only requests made in the last $sefConfig->shSecAntiFloodPeriod seconds left in $floodArray
    $count = 0;
    if (!empty($floodData)) {
        foreach ($floodData as $data) {
            $rec = explode(',', $data);
            if (!empty($rec[1]) && JString::trim($rec[1]) == $ip) {
                $count++;
            }
        }
    }
    // log current request
    $floodData[] = $nextId . ', ' . $ip . ', ' . $cTime;
    // write to file;
    $saveData = implode("\n", $floodData);
    shSaveFile(sh404SEF_ADMIN_ABS_PATH . 'security/sh404SEF_AntiFlood_Data.dat', $saveData);
    if ($count >= $sefConfig->shSecAntiFloodCount) {
        shDoRestrictedAccess('Flooding', $count . ' requests in less than ' . $sefConfig->shSecAntiFloodPeriod . ' seconds (max = ' . $sefConfig->shSecAntiFloodCount . ')');
    }
}
Esempio n. 23
0
 public function renderVersionsForClipboard()
 {
     if (!JEVHelper::isAdminUser()) {
         return;
     }
     jimport("joomla.filesystem.folder");
     $apps = array();
     // Joomla
     $app = new stdClass();
     $app->name = "Joomla";
     $version = new JVersion();
     $app->version = $version->getShortVersion();
     $apps[$app->name] = $app;
     // TODO :  Can we do this from the database???
     // components (including JEvents)
     $xmlfiles3 = array_merge(JFolder::files(JPATH_ADMINISTRATOR . "/components", "manifest\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "sh404sef\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "virtuemart\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "jce\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "jmailalerts\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "hikashop\\.xml", true, true), JFolder::files(JPATH_ADMINISTRATOR . "/components", "jev_latestevents\\.xml", true, true));
     foreach ($xmlfiles3 as $manifest) {
         if (!($manifestdata = $this->getValidManifestFile($manifest))) {
             continue;
         }
         $app = new stdClass();
         $app->name = $manifestdata["name"];
         $app->version = $manifestdata["version"];
         // is sh404sef disabled ?
         if (basename(dirname($manifest)) == "com_sh404sef") {
             if (is_callable("Sh404sefFactory::getConfig")) {
                 $sefConfig = Sh404sefFactory::getConfig();
                 if (!$sefConfig->Enabled) {
                     $app->version = $manifestdata["version"] . " (Disabled in SH404 settings)";
                 }
             } else {
                 $app->version = $manifestdata["version"] . " (sh404sef system plugins not enabled)";
             }
         }
         $name = "component_" . basename(dirname($manifest));
         $apps[$name] = $app;
     }
     // modules
     if (JFolder::exists(JPATH_SITE . "/modules")) {
         $xmlfiles4 = JFolder::files(JPATH_SITE . "/modules", "\\.xml", true, true);
     } else {
         $xmlfiles4 = array();
     }
     foreach ($xmlfiles4 as $manifest) {
         if (strpos($manifest, "mod_") === false) {
             continue;
         }
         if (!($manifestdata = $this->getValidManifestFile($manifest))) {
             continue;
         }
         $app = new stdClass();
         $app->name = $manifestdata["name"];
         $app->version = $manifestdata["version"];
         $app->criticalversion = "";
         $name = "module_" . str_replace(".xml", "", basename($manifest));
         $apps[$name] = $app;
     }
     // club layouts
     $xmlfiles1 = JFolder::files(JEV_PATH . "views", "manifest\\.xml", true, true);
     foreach ($xmlfiles1 as $manifest) {
         if (realpath($manifest) != $manifest) {
             continue;
         }
         if (!($manifestdata = $this->getValidManifestFile($manifest))) {
             continue;
         }
         $app = new stdClass();
         $app->name = $manifestdata["name"];
         $app->version = $manifestdata["version"];
         $apps["layout_" . basename(dirname($manifest))] = $app;
     }
     $xmlfiles1 = JFolder::files(JPATH_ADMINISTRATOR . "/manifests/files", "\\.xml", true, true);
     foreach ($xmlfiles1 as $manifest) {
         if (realpath($manifest) != $manifest) {
             continue;
         }
         if (!($manifestdata = $this->getValidManifestFile($manifest))) {
             continue;
         }
         $app = new stdClass();
         $app->name = $manifestdata["name"];
         $app->version = $manifestdata["version"];
         $apps[str_replace(".xml", "", "layout_" . basename($manifest))] = $app;
     }
     // plugins
     if (JFolder::exists(JPATH_SITE . "/plugins")) {
         $xmlfiles2 = JFolder::files(JPATH_SITE . "/plugins", "\\.xml", true, true);
     } else {
         $xmlfiles2 = array();
     }
     foreach ($xmlfiles2 as $manifest) {
         if (strpos($manifest, "Zend") > 0) {
             continue;
         }
         if (!($manifestdata = $this->getValidManifestFile($manifest))) {
             continue;
         }
         $app = new stdClass();
         $app->name = $manifestdata["name"];
         $app->version = $manifestdata["version"];
         $name = str_replace(".xml", "", basename($manifest));
         $group = basename(dirname(dirname($manifest)));
         $plugin = JPluginHelper::getPlugin($group, $name);
         if (!$plugin) {
             $app->version .= " (not enabled)";
         }
         $name = "plugin_" . $group . "_" . $name;
         $apps[$name] = $app;
     }
     $output = "<textarea rows='40' cols='80' class='versionsinfo'>[code]\n";
     $output .= "PHP Version : " . phpversion() . "\n";
     $output .= "MySQL Version : " . JFactory::getDbo()->getVersion() . "\n";
     $output .= "Server Information : " . php_uname() . "\n";
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     if ($params->get("fixjquery", -1) == -1) {
         $output .= "*** CONFIG NOT SAVED*** \n";
     }
     $output .= "Fix jQuery? : " . ($params->get("fixjquery", 1) ? "Yes" : "No") . "\n";
     $output .= "Load JEvents Bootstrap CSS? : " . ($params->get("bootstrapcss", 1) ? "Yes" : "No") . "\n";
     $output .= "Load JEvents Bootstrap JS? : " . ($params->get("bootstrapjs", 1) ? "Yes" : "No") . "\n";
     if (ini_get("max_input_vars") > 0 && ini_get("max_input_vars") <= 10000) {
         $output .= "Max Input Vars ? : " . ini_get("max_input_vars") . "\n";
     }
     $output .= "Club code set? : " . ($params->get("clubcode", false) ? "Yes" : "No") . "  \n";
     $server = new JInput($_SERVER);
     $useragent = $server->get('HTTP_USER_AGENT', false, "string");
     $output .= $useragent ? "User Agent : " . $useragent . "  \n" : "";
     foreach ($apps as $appname => $app) {
         $output .= "{$appname} : {$app->version}\n";
     }
     $output .= "[/code]</textarea>";
     return $output;
 }
Esempio n. 24
0
 /**
  * Use response object from request to update info server
  * to find if an update is required
  *
  * @param object $response
  */
 private function _updateRequired($response)
 {
     // get configuration
     $sefConfig =& Sh404sefFactory::getConfig();
     // compare versions
     $thisVersion = $sefConfig->version == '@ant_version_number@' ? '3.0.0.987654' : $sefConfig->version;
     $response->shouldUpdate = version_compare($thisVersion, $response->current) == -1;
     $response->shouldUpdate = $response->shouldUpdate && version_compare($thisVersion, $response->minVersionToUpgrade) == 1;
     $response->shouldUpdate = $response->shouldUpdate && (empty($response->maxVersionToUpgrade) || version_compare($thisVersion, $response->maxVersionToUpgrade) == -1);
     if ($response->shouldUpdate) {
         // check specific versions exclusion list
         $response->shouldUpdate = $response->shouldUpdate && !in_array($thisVersion, $response->excludes);
     }
     // build status message based on result of should update calculation
     $response->statusMessage = $response->shouldUpdate ? JText::sprintf('COM_SH404SEF_NEW_VERSION_AVAILABLE') : JText::sprintf('COM_SH404SEF_YOU_ARE_UP_TO_DATE');
     // return whatever we found
     return $response;
 }
Esempio n. 25
0
 function create($string, &$vars, &$shAppendString, $shLanguage, $shSaveString = '', &$originalUri)
 {
     $sefConfig =& shRouter::shGetConfig();
     // get DB
     $database =& JFactory::getDBO();
     _log('Calling sef404 create function with ' . $string);
     if ($sefConfig->shInsertGlobalItemidIfNone && !empty($GLOBALS['Itemid'])) {
         // V 1.2.4.t
         $shCurrentItemid = $GLOBALS['Itemid'];
     } else {
         $shCurrentItemid = null;
     }
     _log('CurrentItemid = ' . $shCurrentItemid);
     $index = str_replace($GLOBALS['shConfigLiveSite'], '', $_SERVER['PHP_SELF']);
     $base = dirname($index);
     $base .= $base == '/' ? '' : '/';
     _log('Extracting $vars:', $vars);
     extract($vars);
     if (isset($title)) {
         // V 1.2.4.r : protect against components using 'title' as GET vars (com_jim for instance)
         $sh404SEF_title = $title;
     }
     // means that $sh404SEF_title has to be used in plugins or extensions
     $title = array();
     // V 1.2.4.r
     // get extension plugin
     $extPlugin =& Sh404sefFactory::getExtensionPlugin($option);
     // which plugin file are we supposed to use?
     $extPluginPath = $extPlugin->getSefPluginPath($vars);
     $pluginType = $extPlugin->getPluginType();
     // use Joomla router.php file in extension dir
     switch ($pluginType) {
         case Sh404sefClassBaseextplugin::TYPE_JOOMLA_ROUTER:
             // Load the plug-in file.
             _log('Loading component own router.php file');
             $functionName = ucfirst(str_replace('com_', '', $option)) . 'BuildRoute';
             if (!function_exists($functionName)) {
                 include JPATH_ROOT . DS . 'components' . DS . $option . DS . 'router.php';
             }
             $originalVars = empty($originalUri) ? $vars : $originalUri->getQuery($asArray = true);
             $title = $functionName($originalVars);
             //$title = shRemoveSlugs( $title, $removeWhat = 'removeId');
             global $mainframe;
             $router =& $mainframe->getRouter();
             $title = $router->_encodeSegments($title);
             // manage GET var lists ourselves, as Joomla router.php does not do it
             if (!empty($vars)) {
                 // there are some unused GET vars, we must transfer them to our mechanism, so
                 // that they are eventually appended to the sef url
                 foreach ($vars as $k => $v) {
                     switch ($k) {
                         case 'option':
                         case 'Itemid':
                             shRemoveFromGETVarsList($k);
                             break;
                         default:
                             // if variable has not been used in sef url, add it to list of variables to be
                             // appended to the url as query string elements
                             if (array_key_exists($k, $originalVars)) {
                                 shAddToGETVarsList($k, $v);
                             } else {
                                 shRemoveFromGETVarsList($k);
                             }
                             break;
                     }
                 }
             }
             // special case for search component, as router.php encode the search word in the url
             // wa can't do that, as we are storing each url in the db
             if (isset($originalVars['option']) && $originalVars['option'] == 'com_search' && !empty($vars['searchword'])) {
                 // router.php has encoded that in the url, we need to undo
                 $title = array();
                 $originalVars['searchword'] = $vars['searchword'];
                 shAddToGETVarsList('searchword', $vars['searchword']);
                 if (!empty($vars['view'])) {
                     $vars['view'] = $vars['view'];
                     shAddToGETVarsList('view', $vars['view']);
                 }
             }
             // handle menu items, having only a single Itemid in the url
             // (router.php will return an empty array in that case, even if we have restored
             // the full non-sef url, as we already did)
             /*
              * Build the application route
              */
             $tmp = '';
             if (empty($title) && isset($vars['Itemid']) && !empty($vars['Itemid'])) {
                 $menu =& shRouter::shGetMenu();
                 $item = $menu->getItem($vars['Itemid']);
                 if (is_object($item) && $vars['option'] == $item->component) {
                     $title[] = $item->route;
                 }
             }
             if (empty($title)) {
                 //$title[] = 'comp';
                 $title[] = substr($vars['option'], 4);
             }
             // add user defined prefix
             $prefix = shGetComponentPrefix($option);
             if (!empty($prefix)) {
                 array_unshift($title, $prefix);
             }
             // now process the resulting title string
             $string = shFinalizePlugin($string, $title, $shAppendString, '', isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null, isset($showall) ? @$showall : null);
             break;
             // use sh404sef plugins, either in ext. dir or in sh404sef dir
         // use sh404sef plugins, either in ext. dir or in sh404sef dir
         case Sh404sefClassBaseextplugin::TYPE_SH404SEF_ROUTER:
             _log('Loading sh404SEF plugin in ' . $extPluginPath);
             include $extPluginPath;
             break;
         case Sh404sefClassBaseextplugin::TYPE_JOOMSEF_ROUTER:
             Sh404sefHelperExtplugins::loadJoomsefCompatLibs();
             include_once $extPluginPath;
             $className = 'SefExt_' . $option;
             $plugin = new $className();
             if (!shIsHomepage($string)) {
                 // make sure the plugin does not try to calculate pagination
                 $params =& SEFTools::GetExtParams('com_content');
                 $params->set('pagination', '1');
                 // ask plugin to build url
                 $plugin->beforeCreate($originalUri);
                 $result = $plugin->create($originalUri);
                 $title = empty($result['title']) ? array() : $result['title'];
                 $plugin->afterCreate($originalUri);
                 // make sure we have a url
                 if (empty($title) && isset($vars['Itemid']) && !empty($vars['Itemid'])) {
                     $menu =& shRouter::shGetMenu();
                     $item = $menu->getItem($vars['Itemid']);
                     if (is_object($item) && $vars['option'] == $item->component) {
                         $title[] = $item->route;
                     }
                 }
                 $prefix = shGetComponentPrefix($option);
                 if (!empty($prefix)) {
                     array_unshift($title, $prefix);
                 }
                 if (empty($title) && !shIsHomepage($string)) {
                     $title[] = substr($vars['option'], 4);
                 }
                 list($usedVars, $ignore) = $plugin->getNonSefVars($result);
                 if (!empty($ignore)) {
                     $usedVars = array_merge($usedVars, $ignore);
                 }
             } else {
                 $string = '';
                 $title[] = '/';
                 $usedVars = array();
             }
             // post process result to adjust to our workflow
             if (!empty($vars)) {
                 foreach ($vars as $key => $value) {
                     if (!array_key_exists($key, $usedVars)) {
                         shRemoveFromGETVarsList($key);
                     }
                 }
             }
             // finalize url
             $string = shFinalizePlugin($string, $title, $shAppendString = '', $shItemidString = '', isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null, isset($showall) ? @$showall : null);
             break;
         case Sh404sefClassBaseextplugin::TYPE_ACESEF_ROUTER:
             Sh404sefHelperExtplugins::loadAcesefCompatLibs();
             include_once $extPluginPath;
             $className = 'AceSEF_' . $option;
             $plugin = new $className();
             $plugin->AcesefConfig = AcesefFactory::getConfig();
             // some plugins appear to not call the constructor parent, and so AcesefConfig is not set
             $tmp =& JPluginHelper::getPlugin('sh404sefextacesef', $option);
             $params = new JParameter($tmp->params);
             $plugin->setParams($params);
             $segments = array();
             $do_sef = true;
             $metadata = array();
             $item_limitstart = 0;
             $plugin->beforeBuild($originalUri);
             $originalVars = empty($originalUri) ? $vars : $originalUri->getQuery($asArray = true);
             $plugin->build($originalVars, $title, $do_sef, $metadata, $item_limitstart);
             $plugin->afterBuild($originalUri);
             $prefix = shGetComponentPrefix($option);
             if (empty($title) && isset($vars['Itemid']) && !empty($vars['Itemid'])) {
                 $menu =& shRouter::shGetMenu();
                 $item = $menu->getItem($vars['Itemid']);
                 if (is_object($item) && $vars['option'] == $item->component) {
                     $title[] = $item->route;
                 }
             }
             if (!empty($prefix)) {
                 array_unshift($title, $prefix);
             }
             if (empty($title) && !shIsHomepage($string)) {
                 $title[] = substr($vars['option'], 4);
             }
             // acesef plugin don't remove used vars from our GET var manager
             // we'll do it now. Vars used are those not present anymore in
             // $originalVars
             // they will be reappended to the SEF url by shFinalizePlugin
             $usedVars = array_diff($vars, $originalVars);
             if (!empty($usedVars)) {
                 foreach ($usedVars as $key => $value) {
                     shRemoveFromGETVarsList($key);
                 }
             }
             // remove Itemid and option, as these are not unset by plugin
             shRemoveFromGETVarsList('Itemid');
             shRemoveFromGETVarsList('option');
             // finalize url
             $string = shFinalizePlugin($string, $title, $shAppendString = '', $shItemidString = '', isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLangName) ? @$shLangName : null, isset($showall) ? @$showall : null);
             break;
         default:
             _log('Falling back to sefGetLocation');
             if (empty($sefConfig->defaultComponentStringList[str_replace('com_', '', $option)])) {
                 $title[] = getMenuTitle($option, isset($task) ? @$task : null, null, null, $shLanguage);
             } else {
                 $title[] = $sefConfig->defaultComponentStringList[str_replace('com_', '', $option)];
             }
             if ($title[0] != '/') {
                 $title[] = '/';
             }
             // V 1.2.4.q getMenuTitle can now return '/'
             if (count($title) > 0) {
                 // V 1.2.4.q use $shLanguage insted of $lang  (lang name rather than lang code)
                 $string = sef_404::sefGetLocation($string, $title, isset($task) ? @$task : null, isset($limit) ? @$limit : null, isset($limitstart) ? @$limitstart : null, isset($shLanguage) ? @$shLanguage : null);
             }
             break;
     }
     return $string;
 }
Esempio n. 26
0
 public static function getDataTypeTitle()
 {
     // need config, to know which data user wants to display : visits, unique visitors, pageviews
     $sefConfig = Sh404sefFactory::getConfig();
     $dataType = $sefConfig->analyticsDashboardDataType;
     $dataTypeString = str_replace('ga:', '', $dataType);
     $label = JText::_('COM_SH404SEF_ANALYTICS_DATA_' . strtoupper($dataTypeString));
     return $label;
 }
Esempio n. 27
0
function shSefRelToAbs($string, $shLanguageParam, &$uri, &$originalUri)
{
    global $_SEF_SPACE, $shMosConfig_lang, $shMosConfig_locale, $mainframe, $shGETVars, $shRebuildNonSef, $shHomeLink;
    _log('Entering shSefRelToAbs with ' . $string . ' | Lang = ' . $shLanguageParam);
    // if superadmin, display non-sef URL, for testing/setting up purposes
    if (sh404SEF_NON_SEF_IF_SUPERADMIN) {
        $user = JFactory::getUser();
        if ($user->usertype == 'Super Administrator') {
            _log('Returning non-sef because superadmin said so.');
            return 'index.php';
        }
    }
    // return unmodified anchors
    if (JString::substr($string, 0, 1) == '#') {
        // V 1.2.4.t
        return $string;
    }
    $sefConfig =& shRouter::shGetConfig();
    $shPageInfo =& shRouter::shPageInfo();
    // Quick fix for shared SSL server : if https, switch to non sef
    $id = shGetURLVar($string, 'Itemid', JRequest::getInt('Itemid'));
    $secure = !empty($shPageInfo->shHttpsSave) || 'yes' == shGetMenuItemSsl($id);
    if ($secure && $sefConfig->shForceNonSefIfHttps) {
        _log('Returning shSefRelToAbs : Forced non sef if https');
        return shFinalizeURL($string);
    }
    $database =& JFactory::getDBO();
    $shOrigString = $string;
    $shMosMsg = shGetMosMsg($string);
    // V x 01/09/2007 22:45:52
    $string = shCleanUpMosMsg($string);
    // V x 01/09/2007 22:45:52
    // V x : removed shJoomfish module. Now we set $mosConfi_lang here
    $shOrigLang = $shMosConfig_locale;
    // save current language
    $shLanguage = shGetURLLang($string);
    // target language in URl is always first choice
    if (empty($shLanguage)) {
        $shLanguage = !empty($shLanguageParam) ? $shLanguageParam : $shMosConfig_locale;
    }
    // V 1.3.1 protect against those drop down lists
    if (strpos($string, 'this.options[selectedIndex].value') !== false) {
        $string .= '&amp;lang=' . shGetIsoCodeFromName($shLanguage);
        return $string;
    }
    $shMosConfig_locale = $shLanguage;
    _log('Language used : ' . $shLanguage);
    // V 1.2.4.t workaround for old links like option=compName instead of option=com_compName
    if (strpos(strtolower($string), 'option=login') === false && strpos(strtolower($string), 'option=logout') === false && strpos(strtolower($string), 'option=&') === false && JString::substr(strtolower($string), -7) != 'option=' && strpos(strtolower($string), 'option=cookiecheck') === false && strpos(strtolower($string), 'option=') !== false && strpos(strtolower($string), 'option=com_') === false) {
        $string = str_replace('option=', 'option=com_', $string);
    }
    // V 1.2.4.k added homepage check : needed in case homepage is not com_frontpage
    if (empty($shHomeLink)) {
        // first, find out about homepage link, from DB. homepage is not always /index.php or similar
        // it can be a link to anything, a page, a component,...
        $menu =& shRouter::shGetMenu();
        $shHomePage =& $menu->getDefault();
        if ($shHomePage) {
            if (JString::substr($shHomePage->link, 0, 9) == 'index.php' && !preg_match('/Itemid=[0-9]*/', $shHomePage->link)) {
                // and it does not have an Itemid
                $shHomePage->link .= ($shHomePage->link == 'index.php' ? '?' : '&') . 'Itemid=' . $shHomePage->id;
                // then add itemid
            }
            $shHomeLink = $shHomePage->link;
            if (!strpos($shHomeLink, 'lang=')) {
                // V 1.2.4.q protect against not existing
                $shDefaultIso = shGetIsoCodeFromName(shGetDefaultLang());
                $shSepString = JString::substr($shHomeLink, -9) == 'index.php' ? '?' : '&';
                $shHomeLink .= $shSepString . 'lang=' . $shDefaultIso;
            }
            $shHomeLink = shSortUrl($shHomeLink);
            // $shHomeLink has lang info, whereas $homepage->link may or may not
        }
        _log('HomeLink = ' . $shHomeLink);
    }
    // V 1.2.4.j string to be appended to URL, but not saved to DB
    $shAppendString = '';
    $shRebuildNonSef = array();
    $shComponentType = '';
    // V w initialize var to avoid notices
    if ($shHomeLink) {
        // now check URL against our homepage, so as to always return / if homepage
        $v1 = JString::ltrim(str_replace($GLOBALS['shConfigLiveSite'], '', $string), '/');
        // V 1.2.4.m : remove anchor if any
        $v2 = explode('#', $v1);
        $v1 = $v2[0];
        $shAnchor = isset($v2[1]) ? '#' . $v2[1] : '';
        $shSepString = JString::substr($v1, -9) == 'index.php' ? '?' : '&';
        $shLangString = $shSepString . 'lang=' . shGetIsoCodeFromName($shLanguage);
        if (!strpos($v1, 'lang=')) {
            $v1 .= $shLangString;
        }
        $v1 = str_replace('&amp;', '&', shSortURL($v1));
        // V 1.2.4.t check also without pagination info
        if (strpos($v1, 'limitstart=0') !== false) {
            // the page has limitstart=0
            $stringNoPag = shCleanUpPag($v1);
            // remove paging info to be sure this is not homepage
        } else {
            $stringNoPag = null;
        }
        if ($v1 == $shHomeLink || $v1 == 'index.php' . $shLangString || $stringNoPag == $shHomeLink) {
            // V 1.2.4.t 24/08/2007 11:07:49
            $shTemp = $v1 == $shHomeLink || shIsDefaultLang($shLanguage) ? '' : shGetIsoCodeFromName($shLanguage) . '/';
            //10/08/2007 17:28:14
            if (!empty($shMosMsg)) {
                // V x 01/09/2007 22:48:01
                $shTemp .= '?' . $shMosMsg;
            }
            if (!empty($sefConfig->shForcedHomePage)) {
                // V 1.2.4.t
                $shTmp = $shTemp . $shAnchor;
                $ret = shFinalizeURL($sefConfig->shForcedHomePage . (empty($shTmp) ? '' : '/' . $shTmp));
                if (empty($uri)) {
                    // if no URI, append remaining vars directly to the string
                    $ret .= $shAppendString;
                } else {
                    shRebuildVars($shAppendString, $uri);
                }
                $shMosConfig_locale = $shOrigLang;
                _log('Returning shSefRelToAbs 1 with ' . $ret);
                return $ret;
            } else {
                $shRewriteBit = shIsDefaultLang($shLanguage) ? '/' : $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode];
                $ret = shFinalizeURL($GLOBALS['shConfigLiveSite'] . $shRewriteBit . $shTemp . $shAnchor);
                if (empty($uri)) {
                    // if no URI, append remaining vars directly to the string
                    $ret .= $shAppendString;
                } else {
                    shRebuildVars($shAppendString, $uri);
                }
                $shMosConfig_locale = $shOrigLang;
                _log('Returning shSefRelToAbs 2 with ' . $ret);
                return $ret;
            }
        }
    }
    $newstring = str_replace($GLOBALS['shConfigLiveSite'] . '/', '', $string);
    // check for url to same site, but with SSL : Joomla 1.5 does not allow it yet
    //$liveSiteSsl = str_replace('http://', 'https://', $GLOBALS['shConfigLiveSite']);
    //$newStringSsl = str_replace($liveSiteSsl.'/', '', $string);
    $letsGo = JString::substr($newstring, 0, 9) == 'index.php' && strpos($newstring, 'this.options[selectedIndex\\].value') === false;
    $letsGoSsl = false;
    if ($letsGo || $letsGoSsl) {
        // Replace & character variations.
        $string = str_replace(array('&amp;', '&#38;'), array('&', '&'), $letsGo ? $newstring : $newStringSsl);
        $newstring = $string;
        // V 1.2.4.q
        $shSaveString = $string;
        // warning : must add &lang=xx (only if it does not exists already), so as to be able to recognize the SefURL in the db if it's there
        if (!strpos($string, 'lang=')) {
            $shSepString = JString::substr($string, -9) == 'index.php' ? '?' : '&';
            $anchorTable = explode('#', $string);
            // V 1.2.4.m remove anchor before adding language
            $string = $anchorTable[0];
            $string .= $shSepString . 'lang=' . shGetIsoCodeFromName($shLanguage) . (!empty($anchorTable[1]) ? '#' . $anchorTable[1] : '');
            // V 1.2.4.m then stitch back anchor
        }
        $URI = new sh_Net_URL($string);
        // V 1.2.4.l need to save unsorted URL
        if (count($URI->querystring) > 0) {
            // Import new vars here.
            $option = null;
            $task = null;
            //$sid = null;  V 1.2.4.s
            // sort GET parameters to avoid some issues when same URL is produced with options not
            // in the same order, ie index.php?option=com_virtuemart&category_id=3&Itemid=2&lang=fr
            // Vs index.php?category_id=3&option=com_virtuemart&Itemid=2&lang=fr
            ksort($URI->querystring);
            // sort URL array
            $string = shSortUrl($string);
            // now we are ready to extract vars
            $shGETVars = $URI->querystring;
            extract($URI->querystring, EXTR_REFS);
        }
        if (empty($option)) {
            // V 1.2.4.r protect against empty $option : we won't know what to do
            $shMosConfig_locale = $shOrigLang;
            _log('Returning shSefRelToAbs 3 with ' . $shOrigString);
            return $shOrigString;
        }
        // get plugin associated with the extension
        $extPlugin =& Sh404sefFactory::getExtensionPlugin($option);
        // get component type
        $shComponentType = $extPlugin->getComponentType();
        $shOption = str_replace('com_', '', $option);
        //list of extension we always skip
        $alwaysSkip = array('jce', 'akeeba');
        if (in_array($shOption, $alwaysSkip)) {
            $shComponentType = Sh404sefClassBaseextplugin::TYPE_SKIP;
        }
        // V 1.2.4.s : fallback to to JoomlaSEF if no extension available
        // V 1.2.4.t : this is too early ; it prevents manual custom redirect to be checked agains the requested non-sef URL
        _log('Component type = ' . $shComponentType);
        // is there a named anchor attached to $string? If so, strip it off, we'll put it back later.
        if ($URI->anchor) {
            $string = str_replace('#' . $URI->anchor, '', $string);
        }
        // V 1.2.4.m
        // shumisha special homepage processing (in other than default language)
        if (shIsHomePage($string) || $string == 'index.php') {
            $sefstring = '';
            $urlType = shGetSefURLFromCacheOrDB($string, $sefstring);
            // still use it so we need it both ways
            if (($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) && empty($showall) && (!empty($limit) || !isset($limit) && !empty($limitstart))) {
                $urlType = shGetSefURLFromCacheOrDB(shCleanUpPag($string), $sefstring);
                // V 1.2.4.t check also without page info
                //to be able to add pagination on custom
                //redirection or multi-page homepage
                if ($urlType != sh404SEF_URLTYPE_NONE && $urlType != sh404SEF_URLTYPE_404) {
                    $sefstring = shAddPaginationInfo(@$limit, @$limitstart, @showall, 1, $string, $sefstring, null);
                    // a special case : com_content  does not calculate pagination right
                    // for frontpage and blog, they include links shown at the bottom in the calculation of number of items
                    // For instance, with joomla sample data, the frontpage has only 5 articles
                    // but the view sets $limit to 9 !!!
                    if ($option == 'com_content' && isset($layout) && $layout == 'blog' || $option == 'com_content' && isset($view) && $view == 'frontpage') {
                        $listLimit = shGetDefaultDisplayNumFromURL($string, $includeBlogLinks = true);
                        $string = shSetURLVar($string, 'limit', $listLimit);
                        $string = shSortUrl($string);
                    }
                    // that's a new URL, so let's add it to DB and cache
                    shAddSefUrlToDBAndCache($string, $sefstring, 0, $urlType);
                    // created url must be of same type as original
                }
                if ($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) {
                    require_once sh404SEF_FRONT_ABS_PATH . 'sef_ext.php';
                    $sef_ext = new sef_404();
                    // Rewrite the URL now.
                    // a special case : com_content  does not calculate pagination right
                    // for frontpage and blog, they include links shown at the bottom in the calculation of number of items
                    // For instance, with joomla sample data, the frontpage has only 5 articles
                    // but the view sets $limit to 9 !!!
                    if ($option == 'com_content' && isset($layout) && $layout == 'blog' || $option == 'com_content' && isset($view) && $view == 'frontpage') {
                        $listLimit = shGetDefaultDisplayNumFromURL($string, $includeBlogLinks = true);
                        $string = shSetURLVar($string, 'limit', $listLimit);
                        $string = shSortUrl($string);
                        //$URI->addQueryString( 'limit', $listLimit);
                    }
                    $urlVars = is_array($URI->querystring) ? array_map('urldecode', $URI->querystring) : $URI->querystring;
                    $sefstring = $sef_ext->create($string, $urlVars, $shAppendString, $shLanguage, $shOrigString, $originalUri);
                    // V 1.2.4.s added original string
                }
            } else {
                if ($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) {
                    // not found but no $limit or $limitstart
                    $sefstring = shGetIsoCodeFromName($shLanguage) . '/';
                    shAddSefUrlToDBAndCache($string, $sefstring, 0, sh404SEF_URLTYPE_AUTO);
                    // create it
                }
            }
            // V 1.2.4.j : added $shAppendString to pass non sef parameters. For use with parameters that won't be stored in DB
            $ret = $GLOBALS['shConfigLiveSite'] . (empty($sefstring) ? '' : $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode] . $sefstring);
            // not valid with 1.5 anymore                       ;
            //if (!empty($shMosMsg)) // V x 01/09/2007 22:48:01
            //  $ret .= (empty($shAppendString) || $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode] == '/index.php?/' ? '?':'&').$shMosMsg;
            $ret = shFinalizeURL($ret);
            if (empty($uri)) {
                // if no URI, append remaining vars directly to the string
                $ret .= $shAppendString;
            } else {
                shRebuildVars($shAppendString, $uri);
            }
            $shMosConfig_locale = $shOrigLang;
            _log('Returning shSefRelToAbs 4 with ' . $ret);
            return $ret;
        }
        if (isset($option) && !($option == 'com_content' && @$task == 'edit') && strtolower($option) != 'com_sh404sef') {
            // V x 29/08/2007 23:19:48
            // check also that option = com_content, otherwise, breaks some comp
            switch ($shComponentType) {
                case Sh404sefClassBaseextplugin::TYPE_SKIP:
                    $sefstring = $shSaveString;
                    // V 1.2.4.q : restore untouched URL, except anchor
                    // which will be added later
                    break;
                case Sh404sefClassBaseextplugin::TYPE_SIMPLE:
                    /* case 'sh404SEFFallback': // v 1.2.4.t*/
                    // check for custom urls
                    $sefstring = '';
                    $urlType = shGetSefURLFromCacheOrDB($string, $sefstring);
                    // if no custom found, then build default url
                    if ($urlType != sh404SEF_URLTYPE_CUSTOM) {
                        // if not found then fall back to Joomla! SEF
                        if (isset($URI)) {
                            unset($URI);
                        }
                        $sefstring = 'component/';
                        $URI = new sh_Net_URL(shSortUrl($shSaveString));
                        if (count($URI->querystring) > 0) {
                            foreach ($URI->querystring as $key => $value) {
                                if (is_array($value)) {
                                    foreach ($value as $k => $v) {
                                        // fix for arrays, thanks doorknob
                                        $sefstring .= $key . '[' . $k . '],' . $v . '/';
                                    }
                                } else {
                                    $sefstring .= $key . ',' . $value . '/';
                                }
                            }
                            $sefstring = str_replace('option/', '', $sefstring);
                        }
                    }
                    break;
                default:
                    $sefstring = '';
                    // base case:
                    $urlType = shGetSefURLFromCacheOrDB($string, $sefstring);
                    // first special case. User may have customized paginated urls
                    // this will be picked up by the line above, except if we're talking about
                    // a category or section blog layout, where Joomla does not uses the correct
                    // value for limit
                    if (($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) && empty($showall) && (!empty($limit) || !isset($limit) && !empty($limitstart))) {
                        if ($option == 'com_content' && isset($layout) && $layout == 'blog' || $option == 'com_content' && isset($view) && $view == 'frontpage') {
                            $listLimit = shGetDefaultDisplayNumFromURL($string, $includeBlogLinks = true);
                            $tmpString = shSetURLVar($string, 'limit', $listLimit);
                            $tmpString = shSortUrl($tmpString);
                            $urlType = shGetSefURLFromCacheOrDB($tmpString, $sefstring);
                            if ($urlType != sh404SEF_URLTYPE_NONE && $urlType != sh404SEF_URLTYPE_404) {
                                // we found a match with pagination info!
                                $string = $tmpString;
                            }
                        }
                    }
                    // now let's try again without any pagination at all
                    if (($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) && empty($showall) && (!empty($limit) || !isset($limit) && !empty($limitstart))) {
                        $urlType = shGetSefURLFromCacheOrDB(shCleanUpPag($string), $sefstring);
                        // search without pagination info
                        if ($urlType != sh404SEF_URLTYPE_NONE && $urlType != sh404SEF_URLTYPE_404) {
                            $sefstring = shAddPaginationInfo(@$limit, @$limitstart, @showall, 1, $string, $sefstring, null);
                            // a special case : com_content  does not calculate pagination right
                            // for frontpage and blog, they include links shown at the bottom in the calculation of number of items
                            // For instance, with joomla sample data, the frontpage has only 5 articles
                            // but the view sets $limit to 9 !!!
                            if ($option == 'com_content' && isset($layout) && $layout == 'blog' || $option == 'com_content' && isset($view) && $view == 'frontpage') {
                                $listLimit = shGetDefaultDisplayNumFromURL($string, $includeBlogLinks = true);
                                $string = shSetURLVar($string, 'limit', $listLimit);
                                $string = shSortUrl($string);
                            }
                            // that's a new URL, so let's add it to DB and cache
                            _log('Created url based on non paginated base url:' . $string);
                            shAddSefUrlToDBAndCache($string, $sefstring, 0, $urlType);
                        }
                    }
                    if ($urlType == sh404SEF_URLTYPE_NONE) {
                        // If component has its own sef_ext plug-in included.
                        $shDoNotOverride = in_array($shOption, $sefConfig->shDoNotOverrideOwnSef);
                        if (shFileExists(sh404SEF_ABS_PATH . 'components/' . $option . '/sef_ext.php') && ($shDoNotOverride || !$shDoNotOverride && (!shFileExists(sh404SEF_ABS_PATH . 'components/com_sh404sef/sef_ext/' . $option . '.php') && !shFileExists(sh404SEF_ABS_PATH . 'components/' . $option . '/sef_ext/' . $option . '.php')))) {
                            // Load the plug-in file. V 1.2.4.s changed require_once to include
                            include_once sh404SEF_ABS_PATH . 'components/' . $option . '/sef_ext.php';
                            $_SEF_SPACE = $sefConfig->replacement;
                            $comp_name = str_replace('com_', '', $option);
                            $className = 'sef_' . $comp_name;
                            $sef_ext = new $className();
                            // V x : added default string in params
                            if (empty($sefConfig->defaultComponentStringList[$comp_name])) {
                                $title[] = getMenuTitle($option, null, isset($Itemid) ? @$Itemid : null, null, $shLanguage);
                            } else {
                                $title[] = $sefConfig->defaultComponentStringList[$comp_name];
                            }
                            // V 1.2.4.r : clean up URL BEFORE sending it to sef_ext files, to have control on what they do
                            // remove lang information, we'll put it back ourselves later
                            //$shString = preg_replace( '/(&|\?)lang=[a-zA-Z]{2,3}/iU' ,'', $string);
                            // V 1.2.4.t use original non-sef string. Some sef_ext files relies on order of params, which may
                            // have been changed by sh404SEF
                            $shString = preg_replace('/(&|\\?)lang=[a-zA-Z]{2,3}/iU', '', $shSaveString);
                            $finalstrip = explode("|", $sefConfig->stripthese);
                            $shString = str_replace('&', '&amp;', $shString);
                            _log('Sending to own sef_ext.php plugin : ' . $shString);
                            $sefstring = $sef_ext->create($shString);
                            _log('Created by sef_ext.php plugin : ' . $sefstring);
                            $sefstring = str_replace("%10", "%2F", $sefstring);
                            $sefstring = str_replace("%11", $sefConfig->replacement, $sefstring);
                            $sefstring = rawurldecode($sefstring);
                            if ($sefstring == $string) {
                                if (!empty($shMosMsg)) {
                                    // V x 01/09/2007 22:48:01
                                    $string .= '?' . $shMosMsg;
                                }
                                $ret = shFinalizeURL($string);
                                $shMosConfig_locale = $shOrigLang;
                                _log('Returning shSefRelToAbs 5 with ' . $ret);
                                return $ret;
                            } else {
                                // V 1.2.4.p : sef_ext extensions for opensef/SefAdvance do not always replace '
                                $sefstring = str_replace('\'', $sefConfig->replacement, $sefstring);
                                // some ext. seem to html_special_chars URL ?
                                $sefstring = str_replace('&#039;', $sefConfig->replacement, $sefstring);
                                // V w 27/08/2007 13:23:56
                                $sefstring = str_replace(' ', $_SEF_SPACE, $sefstring);
                                $sefstring = str_replace(' ', '', (shInsertIsoCodeInUrl($option, $shLanguage) ? shGetIsoCodeFromName($shLanguage) . '/' : '') . titleToLocation($title[0]) . '/' . $sefstring . ($sefstring != '' ? $sefConfig->suffix : ''));
                                if (!empty($sefConfig->suffix)) {
                                    $sefstring = str_replace('/' . $sefConfig->suffix, $sefConfig->suffix, $sefstring);
                                }
                                //$finalstrip = explode("|", $sefConfig->stripthese);
                                $sefstring = str_replace($finalstrip, $sefConfig->replacement, $sefstring);
                                $sefstring = str_replace($sefConfig->replacement . $sefConfig->replacement . $sefConfig->replacement, $sefConfig->replacement, $sefstring);
                                $sefstring = str_replace($sefConfig->replacement . $sefConfig->replacement, $sefConfig->replacement, $sefstring);
                                $suffixthere = 0;
                                if (!empty($sefConfig->suffix) && strpos($sefstring, $sefConfig->suffix) !== false) {
                                    // V 1.2.4.s
                                    $suffixthere = strlen($sefConfig->suffix);
                                }
                                $takethese = str_replace("|", "", $sefConfig->friendlytrim);
                                $sefstring = JString::trim(JString::substr($sefstring, 0, strlen($sefstring) - $suffixthere), $takethese);
                                $sefstring .= $suffixthere == 0 ? '' : $sefConfig->suffix;
                                // version u 26/08/2007 17:27:16
                                // V 1.2.4.m store it in DB so as to be able to use sef_ext plugins really !
                                $string = str_replace('&amp;', '&', $string);
                                // V 1.2.4.r without mod_rewrite
                                $shSefString = shAdjustToRewriteMode($sefstring);
                                // V 1.2.4.p check for various URL for same content
                                $dburl = '';
                                // V 1.2.4.t prevent notice error
                                $urlType = sh404SEF_URLTYPE_NONE;
                                if ($sefConfig->shUseURLCache) {
                                    $urlType = Sh404sefHelperCache::getNonSefUrlFromCache($shSefString, $dburl);
                                }
                                $newMaxRank = 0;
                                // V 1.2.4.s
                                $shDuplicate = false;
                                if ($sefConfig->shRecordDuplicates || $urlType == sh404SEF_URLTYPE_NONE) {
                                    // V 1.2.4.q + V 1.2.4.s+t
                                    $sql = "SELECT newurl, rank, dateadd FROM #__redirection WHERE oldurl = " . $database->Quote($shSefString) . " ORDER BY rank ASC";
                                    $database->setQuery($sql);
                                    $dbUrlList = $database->loadObjectList();
                                    if (count($dbUrlList) > 0) {
                                        $dburl = $dbUrlList[0]->newurl;
                                        $newMaxRank = $dbUrlList[count($dbUrlList) - 1]->rank + 1;
                                        $urlType = $dbUrlList[0]->dateadd == '0000-00-00' ? sh404SEF_URLTYPE_AUTO : sh404SEF_URLTYPE_CUSTOM;
                                    }
                                }
                                if ($urlType != sh404SEF_URLTYPE_NONE && $dburl != $string) {
                                    $shDuplicate = true;
                                }
                                $urlType = $urlType == sh404SEF_URLTYPE_NONE ? sh404SEF_URLTYPE_AUTO : $urlType;
                                _log('Adding from sef_ext to DB : ' . $shSefString . ' | rank = ' . ($shDuplicate ? $newMaxRank : 0));
                                shAddSefUrlToDBAndCache($string, $shSefString, $shDuplicate ? $newMaxRank : 0, $urlType);
                            }
                        } else {
                            $string = JString::trim($string, "&?");
                            // V 1.2.4.q a trial in better handling homepage articles
                            if (shIsCurrentPageHome() && $option == 'com_content' && isset($task) && $task == 'view' && $sefConfig->guessItemidOnHomepage) {
                                $string = preg_replace('/(&|\\?)Itemid=[^&]*/i', '', $string);
                                // we remove Itemid, as com_content plugin
                                $Itemid = null;
                                // will hopefully do a better job at finding the right one
                                unset($URI->querystring['Itemid']);
                                unset($shGETVars['Itemid']);
                            }
                            require_once sh404SEF_FRONT_ABS_PATH . 'sef_ext.php';
                            $sef_ext = new sef_404();
                            // Rewrite the URL now. // V 1.2.4.s added original string
                            // a special case : com_content  does not calculate pagination right
                            // for frontpage and blog, they include links shown at the bottom in the calculation of number of items
                            // For instance, with joomla sample data, the frontpage has only 5 articles
                            // but the view sets $limit to 9 !!!
                            if ($option == 'com_content' && isset($layout) && $layout == 'blog' || $option == 'com_content' && isset($view) && $view == 'frontpage') {
                                $listLimit = shGetDefaultDisplayNumFromURL($string, $includeBlogLinks = true);
                                $string = shSetURLVar($string, 'limit', $listLimit);
                                $string = shSortUrl($string);
                                //$URI->addQueryString( 'limit', $listLimit);
                            }
                            $sefstring = $sef_ext->create($string, $URI->querystring, $shAppendString, $shLanguage, $shOrigString, $originalUri);
                            _log('Created sef url from default plugin: ' . $sefstring);
                        }
                    }
            }
            // end of cache check shumisha
            if (isset($sef_ext)) {
                unset($sef_ext);
            }
            // V 1.2.4.j
            // V 1.2.4.r : checked for double //
            // V 1.2.4.r try sef without mod_rewrite
            $shRewriteBit = $shComponentType == Sh404sefClassBaseextplugin::TYPE_SKIP ? '/' : $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode];
            if (strpos($sefstring, 'index.php') === 0) {
                $shRewriteBit = '/';
            }
            // V 1.2.4.t bug #119
            $string = $GLOBALS['shConfigLiveSite'] . $shRewriteBit . JString::ltrim($sefstring, '/') . ($URI->anchor ? "#" . $URI->anchor : '');
        } else {
            // V x 03/09/2007 13:47:37 editing content
            $shComponentType = Sh404sefClassBaseextplugin::TYPE_SKIP;
            // will prevent turning & into &amp;
            _log('shSefrelfToAbs: option not set, skipping');
        }
        $ret = $string;
        // $ret = str_replace('itemid', 'Itemid', $ret); // V 1.2.4.t bug #125
        _log('(1) Setting shSefRelToAbs return string as: ' . $ret);
    }
    if (!isset($ret)) {
        $ret = $string;
        _log('(2) Setting shSefRelToAbs return string as: ' . $ret);
    }
    //if (!empty($shMosMsg) && strpos($ret, $shMosMsg) === false) // V x 01/09/2007 23:02:00
    //   $ret .= (strpos( $ret, '?') === false  || $sefConfig->shRewriteStrings[$sefConfig->shRewriteMode] == '/index.php?/'? '?':'&').$shMosMsg;
    $ret = $shComponentType == Sh404sefClassBaseextplugin::TYPE_DEFAULT ? shFinalizeURL($ret) : $ret;
    // V w 27/08/2007 13:21:28
    _log('(3) shSefRelToAbs return string after shFinalize: ' . $ret);
    if (empty($uri) || $shComponentType == Sh404sefClassBaseextplugin::TYPE_SKIP) {
        // we don't have a uri : we must be doing a redirect from non-sef to sef or similar
        $ret .= $shAppendString;
        // append directly to url
        _log('(4) shSefRelToAbs return string after appendString: ' . $ret);
    } else {
        if (empty($sefstring) || !empty($sefstring) && strpos($sefstring, 'index.php') !== 0) {
            shRebuildVars($shAppendString, $uri);
            // instead, add to uri. Joomla will put everything together. Only do this if we have a sef url, and not if we have a non-sef
            _log('(5) shSefRelToAbs no sefstring, adding rebuild vars : ' . $shAppendString);
        }
    }
    $shMosConfig_locale = $shOrigLang;
    _log('shSefRelToAbs: finally returning: ' . $ret);
    return $ret;
}
  /**
   * Check if user set parameters and request
   * data allow inserting tracking snippet
   */
  protected function _shouldInsertSnippet() {

    // get config
    $sefConfig = & Sh404sefFactory::getConfig();

    // check if we have a tracking code, no need to insert snippet if no tracking code
    if (empty( $sefConfig->analyticsId)) {
      return false;
    }

    // check if we are set to include tracking code for current user
    $user = JFactory::getUser();
    if ( !empty( $sefConfig->analyticsMaxUserLevel) && $sefConfig->analyticsMaxUserLevel != 'Public Frontend' && Sh404sefHelperGeneral::compareGroups( $user->usertype, $sefConfig->analyticsMaxUserLevel) == 1) {
      return false;
    }

    // check if current IP is on exclusion list
    if( !empty( $sefConfig->analyticsExcludeIP)) {
      $ip = empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'];
      $exclude = Sh404sefHelperGeneral::checkIPList( $ip, $sefConfig->analyticsExcludeIP);
      if ($exclude) {
        return false;
      }
    }

    return true;
  }
Esempio n. 29
0
<?php

/**
 * sh404SEF - SEO extension for Joomla!
 *
 * @author      Yannick Gaultier
 * @copyright   (c) Yannick Gaultier 2012
 * @package     sh404sef
 * @license     http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @version     4.1.0.1559
 * @date		2013-04-25
 */
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
// ------------------  standard plugin initialize function - don't change ---------------------------
global $sh_LANG;
$sefConfig =& Sh404sefFactory::getConfig();
$shLangName = '';
$shLangIso = '';
$title = array();
$shItemidString = '';
$dosef = shInitializePlugin($lang, $shLangName, $shLangIso, $option);
if ($dosef == false) {
    return;
}
// ------------------  standard plugin initialize function - don't change ---------------------------
// ------------------  load language file - adjust as needed ----------------------------------------
//$shLangIso = shLoadPluginLanguage( 'com_XXXXX', $shLangIso, '_SEF_SAMPLE_TEXT_STRING');
// ------------------  load language file - adjust as needed ----------------------------------------
// remove common URL from GET vars list, so that they don't show up as query string in the URL
shRemoveFromGETVarsList('option');
shRemoveFromGETVarsList('lang');
Esempio n. 30
0
 /**
  * Create toolbar for 404 pages template
  *
  * @param midxed $params
  */
 private function _makeToolbarView404J3($params = null)
 {
     // separator
     JToolBarHelper::divider();
     // add title
     JToolbarHelper::title('sh404SEF: ' . JText::_('COM_SH404SEF_404_MANAGER'), 'sh404sef-toolbar-title');
     // add "New url" button
     $bar = JToolBar::getInstance('toolbar');
     // prepare configuration button
     $bar->addButtonPath(SHLIB_ROOT_PATH . 'toolbarbutton');
     // add edit button
     $params = array();
     $params['size'] = Sh404sefFactory::getPConfig()->windowSizes['editurl'];
     $params['buttonClass'] = 'btn btn-small btn-primary';
     $params['iconClass'] = 'icon-edit';
     $params['checkListSelection'] = true;
     $url = 'index.php?option=com_sh404sef&c=editurl&task=edit&tmpl=component';
     $bar->appendButton('J3popuptoolbarbutton', 'edit', JText::_('JTOOLBAR_EDIT'), $url, $params['size']['x'], $params['size']['y'], $top = 0, $left = 0, $onClose = '', $title = '', $params);
     // add delete button
     $params = array();
     $params['size'] = Sh404sefFactory::getPConfig()->windowSizes['confirm'];
     $params['buttonClass'] = 'btn btn-small';
     $params['iconClass'] = 'icon-trash';
     $params['checkListSelection'] = true;
     $url = 'index.php?option=com_sh404sef&c=editurl&task=confirmdelete404&tmpl=component';
     $bar->appendButton('J3popuptoolbarbutton', 'delete', JText::_('JTOOLBAR_DELETE'), $url, $params['size']['x'], $params['size']['y'], $top = 0, $left = 0, $onClose = '', $title = JText::_('COM_SH404SEF_CONFIRM_TITLE'), $params);
     // separator
     JToolBarHelper::spacer(20);
     // add export button
     $params = array();
     $params['size'] = Sh404sefFactory::getPConfig()->windowSizes['export'];
     $params['buttonClass'] = 'btn btn-small';
     $params['iconClass'] = 'icon-download';
     $params['checkListSelection'] = false;
     $url = 'index.php?option=com_sh404sef&c=wizard&task=start&tmpl=component&optype=export&opsubject=view404';
     $bar->appendButton('J3popuptoolbarbutton', 'export', JText::_('COM_SH404SEF_EXPORT_BUTTON'), $url, $params['size']['x'], $params['size']['y'], $top = 0, $left = 0, $onClose = '', $title = JText::_('COM_SH404SEF_EXPORTING_TITLE'), $params);
     // separator
     JToolBarHelper::spacer(20);
     // add purge buttons
     $params = array();
     $params['size'] = Sh404sefFactory::getPConfig()->windowSizes['confirm'];
     $params['buttonClass'] = 'btn btn-small btn-danger';
     $params['iconClass'] = 'shl-icon-remove-sign';
     $params['checkListSelection'] = false;
     $url = 'index.php?option=com_sh404sef&c=urls&task=confirmpurge404&tmpl=component';
     $bar->appendButton('J3popuptoolbarbutton', 'purge', JText::_('COM_SH404SEF_PURGE404'), $url, $params['size']['x'], $params['size']['y'], $top = 0, $left = 0, $onClose = '', $title = JText::_('COM_SH404SEF_CONFIRM_TITLE'), $params);
 }