Example #1
1
 function checkLogin()
 {
     global $mainframe;
     DEFINE('GOTOSTARTPAGE_COOKIE', 'ap_gotostartpage');
     DEFINE('LOGINPAGELOCATION_COOKIE', 'ap_loginpagelocation');
     DEFINE('STARTPAGE_COOKIE', 'ap_startpage');
     $gotostartpage = @$_COOKIE[GOTOSTARTPAGE_COOKIE];
     if ($gotostartpage) {
         setcookie(GOTOSTARTPAGE_COOKIE, 0);
         $uri = JFactory::getURI();
         $url = $uri->toString();
         $loginpagelocation = @$_COOKIE[LOGINPAGELOCATION_COOKIE];
         $loginpagelocationuri = new JURI($loginpagelocation);
         $query = $loginpagelocationuri->getQuery();
         if ($query && strpos($query, 'com_login') === FALSE) {
             if ($loginpagelocation && $url != $loginpagelocation) {
                 $mainframe->redirect($loginpagelocation);
             }
         } else {
             $startpage = @$_COOKIE[STARTPAGE_COOKIE];
             if ($startpage && $url != $startpage) {
                 $mainframe->redirect($startpage);
             }
         }
     }
 }
Example #2
1
 /**
  * Function for getting the list of languages
  *
  * @return	array  Language list
  */
 public static function getList()
 {
     $app = JFactory::getApplication();
     $languages = JLanguageHelper::getLanguages();
     $db = JFactory::getDbo();
     $Itemid = $app->input->getInt('Itemid', 0);
     $uri = new JURI(Juri::current());
     $uri->delVar('lang');
     $uri->delVar('Itemid');
     $location = htmlspecialchars($uri->getQuery());
     if (!empty($location)) {
         $location .= '&';
     }
     if (!$Itemid) {
         $active = $app->getMenu()->getActive();
         if ($active) {
             $Itemid = $active->id;
         }
     }
     // For every language we load menu items language specific alias and params
     foreach ($languages as $i => $language) {
         $db->forceLanguageTranslation = $language->lang_code;
         RMenu::resetJoomlaMenuItems();
         $db->forceLanguageTranslation = false;
         $languages[$i]->active = $language->lang_code == JFactory::getLanguage()->getTag();
         $languages[$i]->link = RRoute::_('index.php?' . $location . 'lang=' . $language->sef . ($Itemid > 0 ? '&Itemid=' . $Itemid : ''));
     }
     // After we are done we reset it the way it was
     RMenu::resetJoomlaMenuItems();
     return $languages;
 }
 /**
  * Method to build the router
  *
  * @param   JRouter  $router  JRouter instance
  * @param   JURI     $uri     Current JURI instance
  *
  * @return null
  */
 public function buildRoute($router, $uri)
 {
     if ($uri->getVar('view') == 'article') {
         $query = $uri->getQuery();
         $query = preg_replace('/\\&id=([0-9]+):([a-z0-9\\-\\_]+)/', '&id=\\2', $query);
         $uri->setQuery($query);
     }
 }
Example #4
0
	public function testGetQuery() {
		$this->object->parse('http://*****:*****@www.example.com:80/path/file.html?var=value#fragment');

		$this->assertThat(
			$this->object->getQuery(),
			$this->equalTo('var=value')
		);
	}
Example #5
0
 public static function _($uri = null, $xhtml = true, $ssl = 0)
 {
     jimport('joomla.environment.uri');
     if (!$uri) {
         $link = self::current(true);
         $link->delVar('Itemid');
         $link->delVar('defaultmenu');
         $link->delVar('language');
     } else {
         if (is_numeric($uri)) {
             $item = self::$menu[intval($uri)];
             return JRoute::_($item->link . "&Itemid={$item->id}");
         } else {
             $link = new JURI((string) $uri);
         }
     }
     $query = $link->getQuery(true);
     $Itemid = self::_getItemID($query);
     $link->setVar('Itemid', $Itemid);
     return JRoute::_('index.php?' . $link->getQuery(), $xhtml, $ssl);
 }
Example #6
0
 public function checkAclViolation($data)
 {
     $redirectUrl = XiptRoute::_($this->getRedirectUrl());
     $redirectURI = new JURI($redirectUrl);
     $redirectVar = $redirectURI->getQuery(true);
     foreach ($redirectVar as $key => $value) {
         if (array_key_exists($key, $data)) {
             if ($value != $data[$key]) {
                 return true;
             }
         }
     }
     return false;
 }
Example #7
0
 function _addItemId($url)
 {
     $Jurl = new JURI($url);
     $query = $Jurl->getQuery(true);
     //already itemid is there
     if (isset($query['Itemid'])) {
         return $url;
     }
     XiptBuildRoute($query);
     // no menu there, so we can't add item id
     if (!isset($query['Itemid'])) {
         return $url;
     }
     //we have menu so add it's item id
     return $url . "&Itemid=" . $query['Itemid'];
 }
 /**
  * 
  * Ajax sef URL
  */
 public function getRouterLink()
 {
     error_reporting(0);
     $config = JFactory::getConfig();
     if ($config->get('sef') == 1) {
         $url = base64_decode(JRequest::getVar('link', ''));
         if ($url) {
             $uri = new JURI($url);
             $query = $uri->getQuery();
             if ($query) {
                 $routeLink = JRoute::_('index.php?' . $query);
                 echo base64_encode($routeLink);
             } else {
                 echo base64_encode(JURI::root());
             }
         }
     } else {
         echo 'error';
     }
     jexit();
 }
Example #9
0
 /**
  * Method to get the OAuth message string for signing.
  *
  * Note: As of PHP 5.3 the $this->encode() function is RFC 3986 compliant therefore this requires PHP 5.3+
  *
  * @param   string  $requestUrl     The message's request URL.
  * @param   string  $requestMethod  The message's request method.
  *
  * @return  string  The unsigned OAuth message string.
  *
  * @link    http://www.faqs.org/rfcs/rfc3986
  * @see     $this->encode()
  * @since   1.0
  */
 public function _fetchStringForSigning($requestUrl, $requestMethod)
 {
     // Get a JURI instance for the request URL.
     $uri = new JURI($requestUrl);
     // Initialise base array.
     $base = array();
     // Get the found parameters.
     $params = $this->getParameters();
     // Add the variables from the URI query string.
     foreach ($uri->getQuery(true) as $k => $v) {
         if (strpos($k, 'oauth_') !== 0) {
             $params[$k] = $v;
         }
     }
     // Make sure that any found oauth_signature is not included.
     unset($params['oauth_signature']);
     // Ensure the parameters are in order by key.
     ksort($params);
     // Iterate over the keys to add properties to the base.
     foreach ($params as $key => $value) {
         // If we have multiples for the parameter let's loop over them.
         if (is_array($value)) {
             // Don't want to do this more than once in the inner loop.
             $key = $this->encode($key);
             // Sort the value array and add each one.
             sort($value, SORT_STRING);
             foreach ($value as $v) {
                 $base[] = $key . '=' . $this->encode($v);
             }
         } else {
             $base[] = $this->encode($key) . '=' . $this->encode($value);
         }
     }
     // Start off building the base string by adding the request method and URI.
     $base = array($this->encode(strtoupper($requestMethod)), $this->encode(strtolower($uri->toString(array('scheme', 'user', 'pass', 'host', 'port'))) . $uri->getPath()), $this->encode(implode('&', $base)));
     return implode('&', $base);
 }
Example #10
0
 function _uriToUrl($uri, $removeVariables = null)
 {
     // Create new JURI object
     $url = new JURI($uri->toString(array('path', 'query', 'fragment')));
     // Remove variables if needed
     if (!empty($removeVariables)) {
         if (is_array($removeVariables)) {
             foreach ($removeVariables as $var) {
                 $url->delVar($var);
             }
         } else {
             $url->delVar($removeVariables);
         }
     }
     // sort variables
     $vars = $url->getQuery(true);
     ksort($vars);
     // Move option to beginning
     if (isset($vars['option'])) {
         $opt = $vars['option'];
         unset($vars['option']);
         $vars = array_merge(array('option' => $opt), $vars);
     }
     // Set vars
     $url->setQuery($vars);
     // Create string for db
     return $url->toString(array('path', 'query'));
 }
Example #11
0
 public function __construct($title, $link = null, $class = null, $active = false, $target = null, $titleicon = null)
 {
     $this->title = $titleicon ? $title . $titleicon : $title;
     $this->link = JFilterOutput::ampReplace($link);
     $this->class = $class;
     $this->active = $active;
     $this->id = null;
     if (!empty($link) && $link !== '#') {
         $uri = new JURI($link);
         $params = $uri->getQuery(true);
         $parts = array();
         foreach ($params as $name => $value) {
             $parts[] = str_replace(array('.', '_'), '-', $value);
         }
         $this->id = implode('-', $parts);
     }
     $this->target = $target;
 }
Example #12
0
 function parse(&$uri)
 {
     $mainframe =& JFactory::getApplication();
     // test for the backlink plugin to work correctly
     if (JPluginHelper::isEnabled('system', 'backlink')) {
         // && $uri->getQuery() ) {    // commented out - causing problems
         $joomlaRequest = urldecode($_SERVER['REQUEST_URI']);
         $realRequest = $uri->toString(array('path', 'query'));
         if ($realRequest != $joomlaRequest) {
             $uri = new JURI($joomlaRequest);
         }
     }
     // store the old URI before we change it in case we will need it
     // for default Joomla SEF
     $oldUri = new JURI($uri->toString());
     if (!SEFTools::JoomFishInstalled()) {
         $url_query = $uri->getQuery();
         $host = explode(".", $uri->getHost());
         $subdomain = array_shift($host);
         $db = JFactory::getDBO();
         // Subdomain titlepage
         if ($uri->getPath() == '/' && empty($url_query) && empty($_POST)) {
             $query = "SELECT Itemid_titlepage FROM #__sef_subdomains WHERE subdomain = " . $db->quote($subdomain) . " LIMIT 1";
             $db->setQuery($query);
             $Itemid = $db->loadResult();
             if ($Itemid > 0) {
                 $uri->setVar('Itemid', $Itemid);
                 JoomSEF::set('real_domain', JFactory::getUri()->getHost());
                 JFactory::getUri()->setHost(implode(".", $host));
             }
         } else {
             $query = "SELECT COUNT(*) FROM #__sef_subdomains WHERE subdomain = " . $db->quote($subdomain);
             $db->setQuery($query);
             $cnt = $db->loadResult();
             if ($cnt) {
                 JoomSEF::set('real_domain', JFactory::getUri()->getHost());
                 JFactory::getUri()->setHost(implode(".", $host));
             }
         }
     }
     $sefConfig =& SEFConfig::getConfig();
     // load patches
     JPluginHelper::importPlugin('sefpatch');
     // trigger onSefLoad patches
     $mainframe->triggerEvent('onSefLoad');
     // get path
     $path = $uri->getPath();
     // remove basepath
     $path = substr_replace($path, '', 0, strlen(JURI::base(true)));
     // remove slashes
     $path = ltrim($path, '/');
     // Redirect URL with / on the end to URL without / on the end
     if ($sefConfig->redirectSlash) {
         $request = $_SERVER["REQUEST_URI"];
         $noBase = substr_replace($request, '', 0, strlen(JURI::base(true)));
         if ($request != "/" && $noBase != "/" && substr($request, -1) == '/') {
             $mainframe->redirect(rtrim($request, "/"), '', 'message');
             JFactory::getApplication()->close();
         }
     }
     // Redirect the index.php (need to check this before index.php removal)
     if ($sefConfig->fixIndexPhp && $path == 'index.php' && count($_POST) == 0) {
         $q = $uri->getQuery(true);
         if (count($q) == 0) {
             $newUrl = JURI::root();
             if (substr($newUrl, -1) != '/') {
                 $newUrl .= '/';
             }
             $mainframe->redirect($newUrl, '', 'message', true);
             exit;
         }
     }
     // Try the 301 Alias redirect
     if (count($_POST) == 0) {
         JoomSEF::_parseAlias($path, $uri->getQuery(true));
     }
     // Disable non-SEF redirect for index2.php links
     // EDIT: don't even parse index2.php links!
     if (substr($path, 0, 10) == 'index2.php') {
         //$sefConfig->nonSefRedirect = false;
         return $uri->getQuery(true);
     }
     // Redirect old /index.php/ links if set to
     if ($sefConfig->fixIndexPhp && substr($path, 0, 10) == 'index.php/' && count($_POST) == 0) {
         $newUrl = JURI::root();
         if (substr($newUrl, -1) != '/') {
             $newUrl .= '/';
         }
         $newUrl .= substr($path, 10);
         $mainframe->redirect($newUrl, '', 'message', true);
         exit;
     }
     // remove prefix (both index.php and index2.php)
     $path = preg_replace('/^index2?.php/i', '', $path);
     // remove slashes again to be sure there aren't any left
     $path = ltrim($path, '/');
     // replace spaces with our replacement character
     // (mainly for '+' handling, but may be useful in some other situations too)
     $path = str_replace(' ', $sefConfig->replacement, $path);
     // set the route
     $uri->setPath($path);
     // host name handling
     if (SEFTools::JoomFishInstalled() && $sefConfig->langPlacement == _COM_SEF_LANG_DOMAIN && !JPluginHelper::isEnabled('system', 'jfrouter')) {
         // different domains for languages handling
         $host = $uri->toString(array('host'));
         $host = trim($host, '/');
         $code = null;
         foreach ($sefConfig->jfSubDomains as $langCode => $domain) {
             if ($host == $domain) {
                 // if main language is not selected, use the first corresponding domain
                 if ($sefConfig->mainLanguage == '0') {
                     $code = $langCode;
                     break;
                 } else {
                     if ($langCode == $sefConfig->mainLanguage) {
                         $code = $langCode;
                         break;
                     } else {
                         if (is_null($code)) {
                             $code = $langCode;
                         }
                     }
                 }
             }
         }
         // we found a matching domain
         if (!is_null($code)) {
             JRequest::setVar('lang', $code);
             $config =& JFactory::getConfig();
             $config->set('joomsef.domain_lang', $code);
         }
     }
     // parse the url
     $vars = JoomSEF::_parseSefUrl($uri, $oldUri);
     // handle custom site name for extensions
     if (isset($vars['option'])) {
         $params =& SEFTools::getExtParams($vars['option']);
         $useSitename = $params->get('useSitename', '1');
         $customSitename = trim($params->get('customSitename', ''));
         $config =& JFactory::getConfig();
         if ($useSitename == '0') {
             // don't use site name
             $config->setValue('sitename', '');
         } elseif (!empty($customSitename)) {
             // use custom site name
             $config->setValue('sitename', $customSitename);
         }
     }
     // trigger onSefUnload patches
     $mainframe->triggerEvent('onSefUnload');
     return $vars;
 }
Example #13
0
function shNormalizeNonSefUri(&$uri, $menu = null, $removeSlugs = true)
{
    // put back a J!1.5 non-sef url to J! 1.0.x format
    // Get the route
    $route = $uri->getPath();
    //Get the query vars
    $vars = $uri->getQuery(true);
    // fix some problems in incoming URLs
    if (!empty($vars['Itemid'])) {
        // sometimes we get doubles : ?Itemid=xx?Itemid=xx
        $vars['Itemid'] = intval($vars['Itemid']);
        $uri->setQuery($vars);
    }
    // fix urls obtained through a single Itemid, in menus : url is option=com_xxx&Itemid=yy
    if (count($vars) == 2 && $uri->getVar('Itemid')) {
        if (empty($menu)) {
            $menu =& shRouter::shGetMenu();
        }
        $shItem = $menu->getItem($vars['Itemid']);
        if (!empty($shItem)) {
            // we found the menu item
            $url = $shItem->link . '&Itemid=' . $shItem->id;
            $uri = new JURI($url);
            // rebuild $uri based on this new url
            $uri->setPath($route);
            $vars = $uri->getQuery(true);
        }
    }
    if ($removeSlugs !== false) {
        $vars = shRemoveSlugs($vars, $removeSlugs);
    }
    $uri->setQuery($vars);
}
Example #14
0
 function getSubDomain($Itemid, $uri, &$titlepage)
 {
     $sefConfig = SEFConfig::getConfig();
     $titlepage = false;
     $option = $uri->getVar('option');
     $db = JFactory::getDBO();
     $lang = '*';
     if ($sefConfig->langEnable) {
         $lang = $uri->getVar('lang', '*');
     }
     // Get subdomains
     $subdomains = self::getAllSubdomains();
     if (!array_key_exists($lang, $subdomains)) {
         // No subdomain for given language
         return null;
     }
     for ($i = 0; $i < count($subdomains[$lang]); $i++) {
         $Itemids = explode(",", $subdomains[$lang][$i]->Itemid);
         if ($Itemid == $subdomains[$lang][$i]->Itemid_titlepage) {
             $link = new JURI(self::getMenuItemSubDomains($Itemid));
             $uri_query = $uri->getQuery(true);
             $titlepage = true;
             foreach ($link->getQuery(true) as $opt => $val) {
                 if ($val != @$uri_query[$opt]) {
                     $titlepage = false;
                 }
             }
             return $subdomains[$lang][$i]->subdomain;
         }
         if ($option == $subdomains[$lang][$i]->option) {
             return $subdomains[$lang][$i]->subdomain;
         }
         if (strlen($subdomains[$lang][$i]->Itemid) && in_array($Itemid, $Itemids)) {
             return $subdomains[$lang][$i]->subdomain;
         }
     }
     return null;
 }
 /**
  *
  * Lookup a SEF url in the cache and database, searching
  * for a non-sef associated url
  * Returns a record holding query vars and a status code
  * If no non-sef is found, incoming query vars are returned untouched
  * If a non-sef is found, a query var array is built, merged with incoming vars
  * and returned instead of the incoming one
  *
  * @param JURI object full request details
  * @param array $vars key/value pairs of query vars, usually empty
  * @param string $sefUrl the sef url to search for
  */
 protected function _lookupSef($uri, $vars, $sefUrl)
 {
     // object to hold result
     $result = new stdClass();
     // identify Sh404sefClassBaseextplugin::TYPE_SIMPLE URLs, ie simple encoding, DB bypass
     $isSimpleUrl = JString::substr($sefUrl, 0, 14) == 'component/com_';
     if ($isSimpleUrl) {
         // handle manual decoding
         $vars = $this->_parseSimpleUrls($sefUrl);
         $urlType = sh404SEF_URLTYPE_AUTO;
     }
     if (!$isSimpleUrl) {
         // get a model and check if we've seen this request before
         $nonSefUrl = '';
         $urlType = JModel::getInstance('Sefurls', 'Sh404sefModel')->getNonSefUrlFromDatabase($sefUrl, $nonSefUrl);
         switch ($urlType) {
             // existing matching url
             case sh404SEF_URLTYPE_AUTO:
             case sh404SEF_URLTYPE_CUSTOM:
                 // our db lookup is case insensitive, which allows
                 // doing a 301 to the correct url case, avoiding duplicate content
                 $this->_checkRedirectToCorrectCase($uri, $sefUrl);
                 // collect the query vars, using a JURI instance
                 $newUri = new JURI($nonSefUrl);
                 $vars = array_merge($vars, $newUri->getQuery(true));
                 break;
                 // 404 or some kind or error
             // 404 or some kind or error
             default:
                 break;
         }
     }
     // store result
     $result->vars = $vars;
     $result->urlType = $urlType;
     return $result;
 }
Example #16
0
 function parse(&$siteRouter, &$uri)
 {
     if ($this->parsing) {
         return array();
     }
     $this->parsing = true;
     $uri->setPath(JURI::base(true) . '/' . $uri->getPath());
     $mainframe = JFactory::getApplication();
     $router = $mainframe->get('mijosef.global.jrouter');
     $router->setMode(JROUTER_MODE_DONT_PARSE);
     // Fix the missing question mark
     if (count($_POST) == 0) {
         $url = $uri->toString();
         $new_url = preg_replace('/^([^?&]*)&([^?]+=[^?]*)$/', '$1?$2', $url);
         // Redirect if question mark fixed
         if ($new_url != $url) {
             $mainframe->redirect($new_url, '', 'message', true);
         }
     }
     // Check if URI is string
     if (is_string($uri)) {
         $uri = JURI::getInstance($uri);
     }
     // Backlink plugin compatibility
     if (JPluginHelper::isEnabled('system', 'backlink')) {
         $joomla_request = $_SERVER['REQUEST_URI'];
         $real_request = $uri->toString(array('path', 'query'));
         if ($real_request != $joomla_request) {
             $uri = new JURI($joomla_request);
         }
     }
     // We'll use it for Joomla! SEF to MijoSEF redirection
     $old_uri = clone $uri;
     // get path
     $path = $uri->getPath();
     // remove basepath
     $path = substr_replace($path, '', 0, strlen(JURI::base(true)));
     // remove slashes
     $path = ltrim($path, '/');
     // Check if the URL starts with index2.php
     if (substr($path, 0, 10) == 'index2.php') {
         return $uri->getQuery(true);
     }
     // remove prefix (both index.php and index2.php)
     $path = preg_replace('/^index2?.php/i', '', $path);
     // remove slashes again to be sure there aren't any left
     $path = ltrim($path, '/');
     // replace spaces with our replacement character
     $path = str_replace(' ', $this->MijosefConfig->replacement_character, $path);
     // set the route
     $uri->setPath($path);
     $vars = Mijosef::get('uri')->parseURI($uri, $old_uri);
     // Parsing done
     $this->parsing = false;
     // Fix the start variable
     if ($start = $uri->getVar('start')) {
         $uri->delVar('start');
         $vars['limitstart'] = $start;
     }
     $menu = Mijosef::get('utility')->getMenu();
     // Handle an empty URL (special case)
     if (empty($vars['Itemid']) && empty($vars['option'])) {
         $item = Mijosef::get('uri')->getDefaultMenuItem();
         if (!is_object($item)) {
             return $vars;
         }
         // set the information in the request
         $vars = $item->query;
         // get the itemid
         $vars['Itemid'] = $item->id;
         // set the active menu item
         $menu->setActive($vars['Itemid']);
         // set vars
         $this->setRequestVars($vars);
         return $vars;
     }
     // Get the item id, if it hasn't been set force it to null
     if (empty($vars['Itemid'])) {
         $vars['Itemid'] = JRequest::getInt('Itemid', null);
     }
     // Get the variables from the uri
     $this->setVars($vars);
     // No option? Get the full information from the itemid
     if (empty($vars['option'])) {
         $item = $menu->getItem($this->getVar('Itemid'));
         if (!is_object($item)) {
             return $vars;
         }
         // No default item set
         $vars = $vars + $item->query;
     }
     // Set the active menu item
     $menu->setActive($this->getVar('Itemid'));
     Mijosef::get('language')->parseLang($vars);
     // Set vars
     $this->setRequestVars($vars);
     return $vars;
 }
Example #17
0
 /**
  * Process the build uri query data based on custom defined rules
  *
  * @param   JURI  $uri  The URI
  *
  * @return  void
  */
 protected function _processBuildRules($uri)
 {
     // Make sure any menu vars are used if no others are specified
     if ($this->_mode != JROUTER_MODE_SEF && $uri->getVar('Itemid') && count($uri->getQuery(true)) == 2) {
         $app = JApplication::getInstance('site');
         $menu = $app->getMenu();
         // Get the active menu item
         $itemid = $uri->getVar('Itemid');
         $item = $menu->getItem($itemid);
         if ($item) {
             $uri->setQuery($item->query);
         }
         $uri->setVar('Itemid', $itemid);
     }
     // Process the attached build rules
     parent::_processBuildRules($uri);
     // Get the path data
     $route = $uri->getPath();
     if ($this->_mode == JROUTER_MODE_SEF && $route) {
         $app = JApplication::getInstance('site');
         if ($limitstart = $uri->getVar('limitstart')) {
             $uri->setVar('start', (int) $limitstart);
             $uri->delVar('limitstart');
         }
     }
     $uri->setPath($route);
 }
Example #18
0
 static function append_sid($hook, $url, $params = false, $is_amp = true, $session_id = false)
 {
     global $_SID, $_EXTRA_URL;
     $arrParams = array();
     $arrExtra = array();
     $anchor = '';
     JForumHook::fixPage();
     $config =& JFactory::getConfig();
     if ($url == '.php') {
         $url = '/' . $config->getValue('config.phpbb_path') . '/index.php';
     }
     // Assign sid if session id is not specified
     if ($session_id === false) {
         $session_id = $_SID;
     }
     //Clean the url and the params first
     if ($is_amp) {
         $url = str_replace('&amp;', '&', $url);
         if (!is_array($params)) {
             $params = str_replace('&amp;', '&', $params);
         }
     }
     $amp_delim = $is_amp ? '&amp;' : '&';
     $url_delim = strpos($url, '?') === false ? '?' : $amp_delim;
     // Process the parameters array
     if (is_array($params)) {
         foreach ($params as $key => $item) {
             if ($item === NULL) {
                 continue;
             }
             if ($key == '#') {
                 $anchor = '#' . $item;
                 continue;
             }
             $arrParams[$key] = $item;
         }
     } else {
         if (strpos($params, '#') !== false) {
             list($params, $anchor) = explode('#', $params, 2);
             $anchor = '#' . $anchor;
         }
         parse_str($params, $arrParams);
     }
     //Process the extra array
     if (!empty($_EXTRA_URL)) {
         $extra = implode('&', $_EXTRA_URL);
         parse_str($extra, $arrExtra);
     }
     //Create the URL
     $uri = new JURI($url);
     $query = $uri->getQuery(true);
     $query = $query + $arrParams + $arrExtra;
     $uri->setQuery($query);
     //Set session id variable
     if ($session_id) {
         $uri->setVar('sid', $session_id);
     }
     //Set fragment
     if ($anchor) {
         $uri->setFragment($anchor);
     }
     $view = basename($uri->getPath(), '.php');
     if (!$uri->getVar('rb_v') && $view != "style") {
         if (JRequest::getVar('rb_v') == 'adm') {
             if (strpos($url, $config->getValue('config.phpbb_path')) === false) {
                 $view = 'adm';
             }
         }
         if (stripos($url, $config->getValue('config.phpbb_path') . '/adm') !== false) {
             $view = 'adm';
         }
         if ($view != 'index') {
             $uri->setVar('rb_v', $view);
         }
     }
     if ($view != 'style') {
         $url = 'index.php' . $uri->toString(array('query', 'fragment'));
         // {} getting lost in encoding
         $url = str_replace(array('%7B', '%7D'), array('{', '}'), $url);
         return urldecode(JURI::base() . JRoute::_($url, $is_amp));
     } else {
         $url = 'style.php' . $uri->toString(array('query', 'fragment'));
         $url = str_replace(array('%7B', '%7D'), array('{', '}'), $url);
         return urldecode(JPATH_ROOT . '/' . $config->getValue('config.phpbb_path') . '/' . $url);
     }
 }
Example #19
0
}
// limitstart can be zero
// start by inserting the menu element title (just an idea, this is not required at all)
$task = isset($task) ? @$task : null;
$Itemid = isset($Itemid) ? @$Itemid : null;
$shSampleName = shGetComponentPrefix($option);
$shSampleName = empty($shSampleName) ? getMenuTitle($option, $task, $Itemid, null, $shLangName) : $shSampleName;
$shSampleName = empty($shSampleName) || $shSampleName == '/' ? 'SampleCom' : $shSampleName;
// ZOO ZOO ZOO ZOO ZOO ZOO ZOO ZOO
// load config
require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
// get ZOO app
$zoo = App::getInstance('zoo');
// get query parameters
$uri = new JURI($string);
$query = $uri->getQuery(true);
// if task is empty get task from view parameter
$task = !empty($task) ? $task : (isset($query['view']) ? $query['view'] : null);
$controller = isset($query['controller']) ? $query['controller'] : null;
// ignore ajax requests
if (in_array($task, array('remove', 'callelement', 'element')) || in_array($controller, array('comment', 'item'))) {
    $dosef = false;
}
switch ($task) {
    case 'alphaindex':
        $title[] = $task;
        $title[] = $zoo->alias->application->translateIDToAlias((int) $query['app_id']);
        $title[] = $query['alpha_char'];
        shRemoveFromGETVarsList('app_id');
        shRemoveFromGETVarsList('alpha_char');
        // pagination