1<?php 2if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 3if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 4require_once(DOKU_PLUGIN.'admin.php'); 5 6/** 7 * All DokuWiki plugins to extend the admin function 8 * need to inherit from this class 9 */ 10class admin_plugin_discussion extends DokuWiki_Admin_Plugin { 11 12 /** 13 * return some info 14 */ 15 function getInfo(){ 16 return array( 17 'author' => 'iDo', 18 'email' => 'iDo@woow-fr.com', 19 'date' => '2006-12-30', 20 'name' => 'See all discussion', 21 'desc' => '', 22 'url' => '', 23 ); 24 } 25 26 /** 27 * return sort order for position in admin menu 28 */ 29 function getMenuSort() { 30 return 200; 31 } 32 33 /** 34 * handle user request 35 */ 36 function handle() { 37 } 38 39 /** 40 * output appropriate html 41 */ 42 function html() { 43 require_once(DOKU_PLUGIN.'action.php'); 44 $actionDiscussion= new action_plugin_discussion(); 45 46 global $conf; 47 global $INFO; 48 global $ID; 49 global $ADMDISCUSSION; 50 51 $chem=DOKU_INC.$conf['savedir']."/meta/"; 52 $arr=$this->globr($chem,"*.comments"); 53 $com =array(); 54 foreach ($arr as $v) { 55 $ap=unserialize(io_readFile($v, false)); 56 if (isset($ap['comments'])){ 57 $ID=substr(str_replace(array($chem,".comments",'/'),array("","",':'),$v),1); 58 $ADMDISCUSSION['page']=' : <a href="'.wl($ID,'').'">'.str_replace("/doku.php/","",wl($ID,'')).'</a>'; 59 $actionDiscussion->_show(); 60 } 61 } 62 63 } 64 65 /** 66 * Recursive version of glob 67 * 68 * @return array containing all pattern-matched files. 69 * 70 * @param string $sDir Directory to start with. 71 * @param string $sPattern Pattern to glob for. 72 * @param int $nFlags Flags sent to glob. 73 */ 74 function globr($sDir, $sPattern, $nFlags = NULL) { 75 $sDir = escapeshellcmd($sDir); 76 // Get the list of all matching files currently in the 77 // directory. 78 $aFiles = glob("$sDir/$sPattern", $nFlags); 79 // Then get a list of all directories in this directory, and 80 // run ourselves on the resulting array. This is the 81 // recursion step, which will not execute if there are no 82 // directories. 83 foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir) { 84 $aSubFiles = $this->globr($sSubDir, $sPattern, $nFlags); 85 $aFiles = array_merge($aFiles, $aSubFiles); 86 } 87 // The array we return contains the files we found, and the 88 // files all of our children found. 89 return $aFiles; 90 } 91 92 93 94} 95?> 96