function _get404vars($route = '') { $mainframe =& JFactory::getApplication(); $db =& JFactory::getDBO(); $sefConfig =& SEFConfig::getConfig(); // you MUST create a static content page with the title 404 for this to work properly if ($sefConfig->showMessageOn404) { $mosmsg = 'FILE NOT FOUND: ' . $route; $mainframe->enqueueMessage($mosmsg); } else { $mosmsg = ''; } if ($sefConfig->page404 == _COM_SEF_404_DEFAULT) { $sql = 'SELECT `id` FROM `#__content` WHERE `title`= "404"'; $db->setQuery($sql); if ($id = $db->loadResult()) { $vars['option'] = 'com_content'; $vars['view'] = 'article'; $vars['id'] = $id; } else { die(JText::_('COM_SEF_ERROR_DEFAULT_404') . $mosmsg . "<br />URI:" . htmlspecialchars($_SERVER['REQUEST_URI'])); } } elseif ($sefConfig->page404 == _COM_SEF_404_FRONTPAGE) { $menu = $mainframe->getMenu('site'); //$item = $menu->getDefault(); // Workaround until Joomla menu bug will be fixed $items = $menu->getItems(array('home', 'language'), array('1', '*')); $item = $items[0]; //Set the information in the frontpage request $vars = $item->query; //Get the itemid $vars['Itemid'] = $item->id; $menu->setActive($vars['Itemid']); } else { $id = $sefConfig->page404; $vars['option'] = 'com_content'; $vars['view'] = 'article'; $vars['id'] = $id; } // If custom Itemid set, use it if ($sefConfig->use404itemid) { $vars['Itemid'] = $sefConfig->itemid404; } JoomSEF::_sendHeader('HTTP/1.0 404 NOT FOUND'); return $vars; }
function _get404vars($route = '') { $mainframe =& JFactory::getApplication(); $db =& JFactory::getDBO(); $sefConfig =& SEFConfig::getConfig(); // Send 404 header JoomSEF::_sendHeader('HTTP/1.0 404 Not Found'); // you MUST create a static content page with the title 404 for this to work properly if ($sefConfig->showMessageOn404) { $mosmsg = 'FILE NOT FOUND: ' . $route; $mainframe->enqueueMessage($mosmsg); } else { $mosmsg = ''; } $sefConfig->page404 = intval($sefConfig->page404); if ($sefConfig->page404 == _COM_SEF_404_DEFAULT) { $sql = 'SELECT `id` FROM `#__content` WHERE `title`= "404"'; $db->setQuery($sql); if ($id = $db->loadResult()) { $vars['option'] = 'com_content'; $vars['view'] = 'article'; $vars['id'] = $id; } else { // Article does not exist, show standard Joomla error JError::raiseError(404, JText::_('Not found')); } } elseif ($sefConfig->page404 == _COM_SEF_404_FRONTPAGE) { $menu =& JSite::getMenu(true); $item = $menu->getDefault(); //Set the information in the frontpage request $vars = $item->query; //Get the itemid $vars['Itemid'] = $item->id; $menu->setActive($vars['Itemid']); } elseif ($sefConfig->page404 == _COM_SEF_404_JOOMLA) { JError::raiseError(404, JText::_('Not found')); } else { $id = $sefConfig->page404; $vars['option'] = 'com_content'; $vars['view'] = 'article'; $vars['id'] = $id; } // If custom Itemid set, use it if ($sefConfig->use404itemid) { $vars['Itemid'] = $sefConfig->itemid404; } // If Joomla template should not be used if (!$sefConfig->template404) { $vars['tmpl'] = 'component'; } return $vars; }