register_hook('COMMON_WIKIPAGE_SAVE', 'BEFORE', $this, '_enforceSecurity'); } /** * @param $event Doku_Event https://www.dokuwiki.org/devel:event:common_wikipage_save * @return void */ function _enforceSecurity(Doku_Event &$event) { $data = $event->data; $text = $data["newContent"]; $pattern = XmlTagProcessing::getContainerTagPattern(WebCodeTag::TAG); $result = preg_match("/" . $pattern . "/ms", $text); if ($result === 0) { return; } $isAdmin = Identity::isAdmin(); if ($isAdmin) { return; } $group = "@" . Identity::CONF_DESIGNER_GROUP_NAME; $isMember = Identity::isMember($group); if ($isMember) { return; } LogUtility::warning(self::YOU_DON_T_HAVE_THE_RIGHT . " You should be admin or part of the ($group) group."); $event->preventDefault(); } }