1<?php 2 3class Kiwiki_Functions { 4 5 public static function _edit_icon($what, $usergroup, $action){ 6 $output = ""; 7 if (isset($usergroup)){ 8 if ((auth_quickaclcheck($USERINFO['id']) > AUTH_READ) && $action == 'show'){ 9 $output = '<a class="edit-this" href="doku.php?id=' . $what . '&do=edit">' . inlineSVG(KIWIKI_IMAGES_PATH . 'edit.svg') .'</a>'; 10 } 11 } 12 return $output; 13 } 14 15 16 /** 17 * Go bottom button 18 */ 19 20 public static function html_bottombtn() { 21 global $lang; 22 23 return '<a class="nolink" href="#dokuwiki__bottom">' 24 .'<button class="button" onclick="window.scrollTo(0, 0)" title="'. $lang['btn_bottom'] .'">' 25 . $lang['btn_bottom'] 26 .'</button></a>'; 27 } 28 29 /** 30 * Custom ACL Informations in footer 31 * Original code from Chris75 32 * https://forum.dokuwiki.org/d/21636-acl-deny-a-user-group-to-a-namespace/13 33 */ 34 35 public static function tpl_aclinfo() { 36 global $ID, $AUTH_ACL, $INFO; 37 38 if ((auth_quickaclcheck($ID) == 0) ||(!$INFO['editable'])) 39 return; // no rights to view, no rights to get this info 40 41 $page_acls = array(); 42 $namespaces = array(); 43 44 $ns = getNS($ID); 45 while ($ns) { 46 array_unshift($namespaces,$ns . ':*'); 47 $ns = getNS($ns); 48 } 49 array_unshift($namespaces,'*'); // root 50 51 $namespaces[] = $ID; 52 53 // check matches 54 foreach ($namespaces as $level) { 55 $matches = preg_grep('/^'.preg_quote($level,'/').'\s+\S+\s+\d+\s*$/',$AUTH_ACL); 56 $this_acls = array(); 57 foreach($matches as $match){ 58 $match = preg_replace('/#.*$/','',$match); //ignore comments 59 $acl = preg_split('/\s+/',$match); 60 $this_acls[urldecode($acl[1])] = $acl[2]; 61 if ($acl[1] == "@ALL") // overwrites stuff from upper level 62 $page_acls = array(); 63 } 64 $page_acls = array_merge($page_acls,$this_acls); 65 } 66 67 // check if visible to everyone: 68 /*if (($page_acls['@ALL'] !== false) && $page_acls['@ALL'] > 0) 69 return; // page is visible to everyone*/ 70 71 $list = array(); 72 foreach ($page_acls as $user => $right) { 73 if ($right > 0 && $user != "@admin" ) // admins can see everything 74 array_push($list,$user); 75 } 76 if (count($list)) { 77 sort($list); 78 print tpl_getLang('Visible to'); 79 print join(', ',$list); 80 } 81 82 // Uncomment this, if you want to display users/groups who cannot access this page, too: 83 $list = array(); 84 foreach ($page_acls as $user => $right) { 85 if ($right == 0) 86 array_push($list,$user); 87 } 88 if (count($list)) { 89 sort($list); 90 print " • "; 91 print tpl_getLang('Hidden to'); 92 print join(', ',$list); 93 } 94 } 95} 96