private static function generateActionsMapping() { $aaActionsMapping = array(self::MAPPING_GLOBALNAV => array(), self::MAPPING_PAGENAV => array(), self::MAPPING_MANAGEMENTNAV => array(), self::HTTPS_ACTIONS => array(), self::PUBLIC_ACTIONS => array(), self::ADMIN_ACTIONS => array(), self::ALWAYS_ENABLED_ACTIONS => array(), self::GRANT_ALL_USERS_BY_DEFAULT_ACTIONS => array(), self::ACTIONS_PAGE => array()); $asEnabledActions = AnwComponent::getAvailableComponents(AnwComponent::TYPE_ACTION); foreach ($asEnabledActions as $sEnabledAction) { try { //load action $sEnabledAction = strtolower($sEnabledAction); $oAction = AnwAction::loadComponent($sEnabledAction); //is it an AnwHttpsAction? if ($oAction instanceof AnwHttpsAction) { $aaActionsMapping[self::HTTPS_ACTIONS][] = $oAction->getName(); } //is it an AnwPublicAction? if ($oAction instanceof AnwPublicAction) { $aaActionsMapping[self::PUBLIC_ACTIONS][] = $oAction->getName(); } //is it an AnwAdminAction? if ($oAction instanceof AnwAdminAction) { $aaActionsMapping[self::ADMIN_ACTIONS][] = $oAction->getName(); } //is it an AnwAlwaysEnabledAction? if ($oAction instanceof AnwAlwaysEnabledAction) { $aaActionsMapping[self::ALWAYS_ENABLED_ACTIONS][] = $oAction->getName(); } //is it an AnwGrantAllUsersByDefaultAction? if ($oAction instanceof AnwGrantAllUsersByDefaultAction) { $aaActionsMapping[self::GRANT_ALL_USERS_BY_DEFAULT_ACTIONS][] = $oAction->getName(); } //is it an AnwActionPage? if ($oAction instanceof AnwActionPage) { $aaActionsMapping[self::ACTIONS_PAGE][] = $oAction->getName(); } $mGlobalNavEntries = $oAction->getNavEntry(); $aaActionsMapping = self::updateNavMapping($mGlobalNavEntries, $aaActionsMapping); } catch (AnwException $e) { AnwDebug::reportError($e); } } return $aaActionsMapping; }
define('ANWIKI_MODE_MINIMAL', true); } require_once "engine.inc.php"; //install redirect if (!file_exists(ANWIKI_INSTALL_LOCK) && AnwEnv::_GET('a') != 'install') { $sUrlInstall = AnwEnv::_SERVER('SCRIPT_URI') . '?a=install'; header("Location: " . $sUrlInstall); print '<a href="' . AnwUtils::xQuote($sUrlInstall) . '">' . AnwUtils::xQuote($sUrlInstall) . '</a>'; exit; } AnwDebug::startbench("preparing action", true); //load action code try { $sAction = strtolower(AnwEnv::_GET(AnwAction::GET_ACTIONNAME, "view")); $oAction = AnwAction::loadComponent($sAction); } catch (AnwException $e) { $sAction = "view"; $oAction = AnwAction::loadComponent($sAction); } //security check if (ANWIKI_MODE_MINIMAL && !$oAction instanceof AnwActionMinimal) { AnwDieCriticalError("Unauthorized mode / bad URL"); } $oAction->setAsCurrentAction(); AnwDebug::log("Action : " . $sAction); AnwDebug::stopbench("preparing action"); //run $oAction->runAndOutput(); } catch (AnwException $e) { errorApp($e); }