function shCheckAlias($incomingUrl) { $sefConfig =& shRouter::shGetConfig(); $db =& JFactory::getDBO(); $query = 'SELECT newurl FROM #__sh404sef_aliases WHERE alias = ' . $db->Quote($incomingUrl); $db->setQuery($query); $dest = $db->loadResult(); shCheckRedirect($dest, $incomingUrl); }
protected function _checkShurls($uri) { if (self::$requestParsed) { return; } // sanitize $path = $uri->getPath(); if (empty($path)) { // no path in request, no possible short url return; } // our configuration object $sefConfig = Sh404sefFactory::getConfig(); // check short url based on request path if ($sefConfig->enablePageId) { try { $dest = Sh404sefHelperDb::selectResult('#__sh404sef_pageids', array('newurl'), array('pageid' => $path)); // check on $dest: if empty, prevent loop, plus stitch back query string, if any if (!empty($dest)) { $queryString = $uri->getQuery(); if (!empty($queryString)) { $dest .= JString::strpos($dest, '?') !== false ? '&' . $queryString : '?' . $queryString; } shCheckRedirect($dest, $uri->get('_uri')); } } catch (Sh404sefException $e) { // if error, just log _log(__METHOD__ . '/' . __LINE__ . '/' . __CLASS__ . 'Database error reading aliases: ' . $e->getMessage()); } } }