1<?php 2 3if(!defined('DOKU_INC')) die(); 4 5class action_plugin_publish_hide extends DokuWiki_Action_Plugin { 6 7 /** 8 * @var helper_plugin_publish 9 */ 10 private $hlp; 11 12 function __construct() { 13 $this->hlp = plugin_load('helper','publish'); 14 } 15 16 function register(&$controller) { 17 if ($this->getConf('hide drafts')) { 18 $controller->register_hook('TPL_ACT_RENDER', 'BEFORE', $this, 'hide', array()); 19 } 20 } 21 22 /** 23 * @param Doku_Event $event 24 * @param array $param 25 */ 26 function hide(&$event, $param) { 27 global $ID; 28 global $REV; 29 if ($this->hlp->isRevisionApproved($REV, $ID)) { 30 return; 31 } 32 33 if (auth_quickaclcheck($ID) >= AUTH_EDIT) { 34 return; 35 } 36 37 global $ACT; 38 if (!in_array($ACT, array('show', 'edit', 'source', 'diff'))) { 39 return; 40 } 41 42 $ACT = 'denied'; 43 44 $event->preventDefault(); 45 $event->stopPropagation(); 46 47 print p_locale_xhtml('denied'); 48 49 } 50 51}