isAdmin = $admin;
$root =& XCube_Root::getSingleton();
if (!$this->isAdmin) $this->isAdmin = isXoopensimAdmin($root);
$this->action = $root->mContext->mRequest->getRequest('action');
if ($this->action=='') {
if ($admin) $this->action = 'admin';
else $this->action = 'home';
}
if (!preg_match('/^\w+$/', $this->action)) {
exit('
bad action name!!
');
}
}
function execute($controller)
{
$className = $this->action.'Action';
if ($this->isAdmin) {
$fileName = CMS_MODULE_PATH.'/admin/actions/'.$className.'.class.php';
}
else {
$fileName = CMS_MODULE_PATH.'/actions/'.$className.'.class.php';
}
if (!file_exists($fileName)) {
exit('file not found!! : '.$fileName.'
');
}
require $fileName;
$Action = new $className($controller);
$Action->execute();
if ($Action->isError) {
$controller->executeRedirect(CMS_MODULE_URL, 2, $Action->errMesg);
}
else {
$Action->executeView($controller->mRoot->mContext->mModule->getRenderTarget());
}
}
}
?>