protected function pagenotfound() { if (AnwCurrentSession::isActionAllowed($this->getoPage()->getName(), 'create', -1)) { AnwPlugins::hook('action_view_pagenotfound_create', $this->getoPage()); AnwUtils::redirect(AnwUtils::link($this->getoPage(), "create")); } else { AnwPlugins::hook('action_view_pagenotfound_404', $this->getoPage()); $this->error404(); } }
public static function loadContentClass($sContentClassName) { if (self::isContentClassLoaded($sContentClassName)) { throw new AnwUnexpectedException("ContentClass " . $sContentClassName . " is already defined"); } $oContentClass = AnwContentClassPage::loadComponent($sContentClassName); self::$osContentClasses[$sContentClassName] = $oContentClass; $oContentClass->init(); //AFTER adding to $osContentClasses !! AnwPlugins::hook("contentclass_init", $oContentClass); AnwPlugins::hook("contentclass_init_byname_" . $oContentClass->getName(), $oContentClass); }
private static function loadCurrentSession() { AnwDebug::startbench("Current session load"); try { self::$oSession = AnwSessions::getCurrentSession(); //keepalive $nElapsedTimeSinceKeepalive = time() - self::getLastKeepAlive(); $nKeepAliveInterval = AnwComponent::globalCfgKeepaliveDelay(); AnwDebug::log('(AnwSessions) Time elapsed since last keepalive: ' . $nElapsedTimeSinceKeepalive . '/' . $nKeepAliveInterval . 's'); if ($nElapsedTimeSinceKeepalive > $nKeepAliveInterval) { AnwDebug::log('(AnwSessions) Running keepalive...'); $nTime = time(); self::resetLastKeepAlive(); //keepalive session AnwSessions::keepAlive(); //run hooks $oSessionUser = self::$oSession->getUser(); AnwPlugins::hook("session_keepalive_any", $oSessionUser); if (self::$oSession->isLoggedIn()) { AnwPlugins::hook("session_keepalive_loggedin", $oSessionUser); } else { AnwPlugins::hook("session_keepalive_loggedout", $oSessionUser); } } } catch (AnwUserNotFoundException $e) { //current user doesn't exist anymore self::$oSession = new AnwSession(); self::logout(); } AnwDebug::stopbench("Current session load"); }
/** * Used for content execution preview (by action edit). */ function toHtml($oPage) { $this->prepareForOutput($oPage); AnwPlugins::hook('contentpage_tohtml_before', $this, $oPage); $oOutputHtml = $this->getContentFieldsContainer()->toHtml($this, $oPage); AnwPlugins::hook('contentpage_tohtml_after', $this, $oPage); return $oOutputHtml; }
private function notifyChanged($bClearCachedOutputForPageGroupsLinking = true) { if ($bClearCachedOutputForPageGroupsLinking) { //clear cachedoutput for linking pagegroups $aoPageGroups = $this->getPageGroup()->getPageGroupsLinking(); foreach ($aoPageGroups as $oPageGroup) { $aoPages = $oPageGroup->getPages(); foreach ($aoPages as $oPage) { AnwCache::clearCachedOutputFromPage($oPage); } } } //notify contentclass $this->getPageGroup()->getContentClass()->onChange($this, $this->oPreviousContent); //notify plugins AnwPlugins::hook('page_onchange', $this, $this->oPreviousContent); $sContentClassName = $this->getPageGroup()->getContentClass()->getName(); AnwPlugins::hook('page_onchange_byclassname_' . $sContentClassName, $this, $this->oPreviousContent); }
static function isNonUniqueDisplayNameAllowed() { if (!AnwComponent::globalCfgUsersUniqueDisplayname() && self::getDriver()->supportsNonUniqueDisplayName()) { try { AnwPlugins::hook("users_nonunique_displayname_allowed"); return true; } catch (AnwPluginInterruptionException $e) { } } return false; }