Beispiel #1
0
 /**
  * Redirect to home page.
  *
  * @return KunenaLayout
  *
  * @throws KunenaExceptionAuthorise
  */
 public function execute()
 {
     $menu = $this->app->getMenu();
     $home = $menu->getActive();
     if (!$home) {
         $this->input->set('view', 'category');
         $this->input->set('layout', 'list');
         // throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 500);
     } else {
         // Find default menu item.
         $default = $this->getDefaultMenuItem($menu, $home);
         if (!$default || $default->id == $home->id) {
             // There is no default menu item, use category view instead.
             $default = $menu->getItem(KunenaRoute::getItemID('index.php?option=com_kunena&view=category&layout=list'));
             if ($default) {
                 $default = clone $default;
                 $defhome = KunenaRoute::getHome($default);
                 if (!$defhome || $defhome->id != $home->id) {
                     $default = clone $home;
                 }
                 $default->query['view'] = 'category';
                 $default->query['layout'] = 'list';
             }
         }
         if (!$default) {
             throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 500);
         }
         // Add query variables from shown menu item.
         foreach ($default->query as $var => $value) {
             $this->input->set($var, $value);
         }
         // Remove query variables coming from the home menu item.
         $this->input->set('defaultmenu', null);
         // Set active menu item to point the real page.
         $this->input->set('Itemid', $default->id);
         $menu->setActive($default->id);
     }
     // Reset our router.
     KunenaRoute::initialize();
     // Get HMVC controller for the current page.
     $controller = KunenaControllerApplication::getInstance($this->input->getCmd('view'), $this->input->getCmd('layout', 'default'), $this->input->getCmd('task', 'display'), $this->input, $this->app);
     if (!$controller) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404);
     }
     return $controller->execute();
 }
Beispiel #2
0
	}
}

// Support legacy urls (they need to be redirected).
$app   = JFactory::getApplication();
$input = $app->input;
$input->set('limitstart', $input->getInt('limitstart', $input->getInt('start')));
$view    = $input->getWord('func', $input->getWord('view', 'home'));
$subview = $input->getWord('layout', 'default');
$task    = $input->getCmd('task', 'display');

// Import plugins and event listeners.
JPluginHelper::importPlugin('kunena');

// Get HMVC controller and if exists, execute it.
$controller = KunenaControllerApplication::getInstance($view, $subview, $task, $input, $app);
if ($controller)
{
	KunenaRoute::cacheLoad();
	$contents = $controller->execute();
	KunenaRoute::cacheStore();

}
elseif (is_file(KPATH_SITE . "/controllers/{$view}.php"))
{
	// Execute old MVC.
	// Legacy support: If the content layout doesn't exist on HMVC, load and execute the old controller.
	$controller = KunenaController::getInstance();
	KunenaRoute::cacheLoad();
	ob_start();
	$controller->execute($task);