<?php

if (!defined('XOOPS_ROOT_PATH')) exit();

class IndexRedirector extends XCube_ActionFilter
{
	function preBlockFilter()
	{
		$delegate=new XCube_Delegate("IndexRedirector", "redirect");
		$this->mController->mRoot->mEventManager->add("Legacypage.Top.Access", $delegate);
	}

	function redirect(&$controller, &$eventArgs)
	{
		$startPage = $controller->getConfig('startpage');
		if ($startPage != null && $startPage != "--") {
			header('Location: ' . XOOPS_URL . '/modules/' . $startPage . '/');
			exit();
		}
	}
}

?>