From 409d7af7c9c6c97c8c00cada876a2bf967fa1526 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 2 Jul 2006 14:16:22 +0200 Subject: disableactions support This patch adds a config option to disable certain internal action commands of DokuWiki's main dispatcher. The options resendpasswd and openregister were removed because they can now set through this new option. The config plugin needs to be adjusted. darcs-hash:20060702121622-7ad00-1e80e77bcfb0ae561fe7abd79cfbe1bb158be720.gz --- inc/template.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'inc/template.php') diff --git a/inc/template.php b/inc/template.php index 277c06d8d..f9e69d340 100644 --- a/inc/template.php +++ b/inc/template.php @@ -296,9 +296,29 @@ function tpl_button($type){ global $conf; global $auth; + if(!actionOK($type)) return; + switch($type){ case 'edit': - print html_editbutton(); + #most complicated type - we need to decide on current action + if($ACT == 'show' || $ACT == 'search'){ + if($INFO['writable']){ + if($INFO['draft']){ + echo html_btn('draft',$ID,'e',array('do' => 'draft'),'post'); + }else{ + if($INFO['exists']){ + echo html_btn('edit',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); + }else{ + echo html_btn('create',$ID,'e',array('do' => 'edit','rev' => $REV),'post'); + } + } + }else{ + if(!actionOK('source')) return false; //pseudo action + echo html_btn('source',$ID,'v',array('do' => 'edit','rev' => $REV),'post'); + } + }else{ + echo html_btn('show',$ID,'v',array('do' => 'show')); + } break; case 'history': print html_btn('revs',$ID,'o',array('do' => 'revisions')); @@ -386,6 +406,8 @@ function tpl_actionlink($type,$pre='',$suf=''){ global $lang; global $auth; + if(!actionOK($type)) return; + switch($type){ case 'edit': #most complicated type - we need to decide on current action @@ -401,6 +423,7 @@ function tpl_actionlink($type,$pre='',$suf=''){ 'class="action create" accesskey="e" rel="nofollow"'); } }else{ + if(!actionOK('source')) return false; //pseudo action tpl_link(wl($ID,'do=edit&rev='.$REV), $pre.$lang['btn_source'].$suf, 'class="action source" accesskey="v" rel="nofollow"'); -- cgit v1.2.3