/* | Match by redirection rule | | Match the first segment of the URI by component name. If a match is | found, the component's router will be loaded to continue parsing any | further segments. */ $router->rules('parse')->append('redirect', function ($uri) { // Use an alturi in case any previous rule altered // the $uri by adding/removing vars $alturi = new \Hubzero\Utility\Uri($uri->uri()); $db = \App::get('db'); $db->setQuery("SELECT *\n\t\tFROM `#__redirect_links`\n\t\tWHERE `published`=1\n\t\tAND (`old_url`=" . $db->quote($alturi->toString(array('scheme', 'host', 'port', 'path', 'query', 'fragment'))) . "\n\t\tOR `old_url`=" . $db->quote($alturi->toString(array('path', 'query', 'fragment'))) . ")\n\t\tLIMIT 1"); if ($row = $db->loadObject()) { $myuri = new \Hubzero\Utility\Uri($row->new_url); $vars = $myuri->getQuery(true); foreach ($vars as $key => $var) { $uri->setVar($key, $var); } if (isset($vars['Itemid'])) { $menu->setActive($vars['Itemid']); } return true; } }); /* | Match by posted data | | Look for the option var in POST data */ $router->rules('parse')->append('post', function ($uri) {