*/ // must be run within Dokuwiki if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'admin.php'); /** * All DokuWiki plugins to extend the admin function * need to inherit from this class */ class admin_plugin_statistics extends DokuWiki_Admin_Plugin { var $dblink = null; var $opt = ''; var $from = ''; var $to = ''; var $tlimit = ''; /** * return some info */ function getInfo(){ return confToHash(dirname(__FILE__).'/info.txt'); } /** * Access for managers allowed */ function forAdminOnly(){ return false; } /** * return sort order for position in admin menu */ function getMenuSort() { return 150; } /** * handle user request */ function handle() { $this->opt = preg_replace('/[^a-z]+/','',$_REQUEST['opt']); // fixme add better sanity checking here: $this->from = preg_replace('/[^\d\-]+/','',$_REQUEST['f']); $this->to = preg_replace('/[^\d\-]+/','',$_REQUEST['t']); if(!$this->from) $this->from = date('Y-m-d'); if(!$this->to) $this->to = date('Y-m-d'); //setup limit clause if($this->from != $this->to){ $this->tlimit = "DATE(A.dt) >= DATE('".$this->from."') AND DATE(A.dt) <= DATE('".$this->to."')"; }else{ $this->tlimit = "DATE(A.dt) = DATE('".$this->from."')"; } } /** * fixme build statistics here */ function html() { // fixme build a navigation menu in a TOC here echo '
| '.hsc($h).' | '; } echo '
|---|
| '; if($k == 'page'){ echo ''; echo hsc($v); echo ''; }elseif($k == 'url'){ $url = hsc($v); if(strlen($url) > 50){ $url = substr($url,0,30).' … '.substr($url,-20); } echo ''; echo $url; echo ''; }elseif($k == 'html'){ echo $v; }else{ echo hsc($v); } echo ' | '; } echo '