11878f16fSAndreas Gohr<?php 21878f16fSAndreas Gohr/** 31878f16fSAndreas Gohr * statistics plugin 41878f16fSAndreas Gohr * 51878f16fSAndreas Gohr * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 66b6f8822SAndreas Gohr * @author Andreas Gohr <gohr@splitbrain.org> 71878f16fSAndreas Gohr */ 81878f16fSAndreas Gohr 91878f16fSAndreas Gohr// must be run within Dokuwiki 101878f16fSAndreas Gohrif(!defined('DOKU_INC')) die(); 111878f16fSAndreas Gohr 122998b1f6SAndreas Gohr 131878f16fSAndreas Gohr/** 141878f16fSAndreas Gohr * All DokuWiki plugins to extend the admin function 151878f16fSAndreas Gohr * need to inherit from this class 161878f16fSAndreas Gohr */ 171878f16fSAndreas Gohrclass admin_plugin_statistics extends DokuWiki_Admin_Plugin { 18a901d721SAndreas Gohr public $dblink = null; 19a901d721SAndreas Gohr protected $opt = ''; 20a901d721SAndreas Gohr protected $from = ''; 21a901d721SAndreas Gohr protected $to = ''; 22a901d721SAndreas Gohr protected $start = ''; 23a901d721SAndreas Gohr protected $tlimit = ''; 24a901d721SAndreas Gohr 25a901d721SAndreas Gohr /** 26a901d721SAndreas Gohr * Available statistic pages 27a901d721SAndreas Gohr */ 28a901d721SAndreas Gohr protected $pages = array('dashboard','page','referer','newreferer', 29*5bccfe87SAndreas Gohr 'outlinks','searchengines','searchphrases', 30*5bccfe87SAndreas Gohr 'searchwords', 'internalsearchphrases', 31*5bccfe87SAndreas Gohr 'internalsearchwords','browsers','os', 32*5bccfe87SAndreas Gohr 'countries','resolution'); 331878f16fSAndreas Gohr 341878f16fSAndreas Gohr /** 356b6f8822SAndreas Gohr * Initialize the helper 366b6f8822SAndreas Gohr */ 376b6f8822SAndreas Gohr public function __construct() { 386b6f8822SAndreas Gohr $this->hlp = plugin_load('helper','statistics'); 396b6f8822SAndreas Gohr } 406b6f8822SAndreas Gohr 416b6f8822SAndreas Gohr /** 421878f16fSAndreas Gohr * Access for managers allowed 431878f16fSAndreas Gohr */ 446b6f8822SAndreas Gohr public function forAdminOnly(){ 451878f16fSAndreas Gohr return false; 461878f16fSAndreas Gohr } 471878f16fSAndreas Gohr 481878f16fSAndreas Gohr /** 491878f16fSAndreas Gohr * return sort order for position in admin menu 501878f16fSAndreas Gohr */ 516b6f8822SAndreas Gohr public function getMenuSort() { 526b6f8822SAndreas Gohr return 350; 531878f16fSAndreas Gohr } 541878f16fSAndreas Gohr 551878f16fSAndreas Gohr /** 561878f16fSAndreas Gohr * handle user request 571878f16fSAndreas Gohr */ 586b6f8822SAndreas Gohr public function handle() { 59264f1744SAndreas Gohr $this->opt = preg_replace('/[^a-z]+/','',$_REQUEST['opt']); 60a901d721SAndreas Gohr if(!in_array($this->opt,$this->pages)) $this->opt = 'dashboard'; 61a901d721SAndreas Gohr 6295eb68e6SAndreas Gohr $this->start = (int) $_REQUEST['s']; 63e8699bceSAndreas Gohr $this->setTimeframe($_REQUEST['f'],$_REQUEST['t']); 64e8699bceSAndreas Gohr } 6595eb68e6SAndreas Gohr 66e8699bceSAndreas Gohr /** 67e8699bceSAndreas Gohr * set limit clause 68e8699bceSAndreas Gohr */ 696b6f8822SAndreas Gohr public function setTimeframe($from,$to){ 70264f1744SAndreas Gohr // fixme add better sanity checking here: 71e8699bceSAndreas Gohr $from = preg_replace('/[^\d\-]+/','',$from); 72e8699bceSAndreas Gohr $to = preg_replace('/[^\d\-]+/','',$to); 73e8699bceSAndreas Gohr if(!$from) $from = date('Y-m-d'); 74e8699bceSAndreas Gohr if(!$to) $to = date('Y-m-d'); 75264f1744SAndreas Gohr 76264f1744SAndreas Gohr //setup limit clause 772ee939eeSAndreas Gohr $tlimit = "A.dt >= '$from 00:00:00' AND A.dt <= '$to 23:59:59'"; 78e8699bceSAndreas Gohr $this->tlimit = $tlimit; 79e8699bceSAndreas Gohr $this->from = $from; 80e8699bceSAndreas Gohr $this->to = $to; 811878f16fSAndreas Gohr } 821878f16fSAndreas Gohr 831878f16fSAndreas Gohr /** 8479b4a855SAndreas Gohr * Output the Statistics 851878f16fSAndreas Gohr */ 861878f16fSAndreas Gohr function html() { 87264f1744SAndreas Gohr echo '<h1>Access Statistics</h1>'; 88264f1744SAndreas Gohr $this->html_timeselect(); 89264f1744SAndreas Gohr 9079b4a855SAndreas Gohr $method = 'html_'.$this->opt; 9179b4a855SAndreas Gohr if(method_exists($this,$method)){ 92a901d721SAndreas Gohr echo '<div class="plg_stats_'.$this->opt.'">'; 93a901d721SAndreas Gohr echo '<h2>'.$this->getLang($this->opt).'</h2>'; 9479b4a855SAndreas Gohr $this->$method(); 95a901d721SAndreas Gohr echo '</div>'; 9614d99ec0SAndreas Gohr } 9714d99ec0SAndreas Gohr } 9814d99ec0SAndreas Gohr 996b6f8822SAndreas Gohr /** 1006b6f8822SAndreas Gohr * Return the TOC 1016b6f8822SAndreas Gohr * 1026b6f8822SAndreas Gohr * @return array 1036b6f8822SAndreas Gohr */ 10447ffcf7dSAndreas Gohr function getTOC(){ 10547ffcf7dSAndreas Gohr $toc = array(); 106a901d721SAndreas Gohr foreach($this->pages as $page){ 10747ffcf7dSAndreas Gohr $toc[] = array( 10847ffcf7dSAndreas Gohr 'link' => '?do=admin&page=statistics&opt='.$page.'&f='.$this->from.'&t='.$this->to, 10947ffcf7dSAndreas Gohr 'title' => $this->getLang($page), 11047ffcf7dSAndreas Gohr 'level' => 1, 11147ffcf7dSAndreas Gohr 'type' => 'ul' 11247ffcf7dSAndreas Gohr ); 11347ffcf7dSAndreas Gohr } 11447ffcf7dSAndreas Gohr return $toc; 1159da6395dSAndreas Gohr } 1169da6395dSAndreas Gohr 1176b6f8822SAndreas Gohr /** 1186b6f8822SAndreas Gohr * Outputs pagination links 1196b6f8822SAndreas Gohr * 1206b6f8822SAndreas Gohr * @fixme does this still work? 1216b6f8822SAndreas Gohr * 1226b6f8822SAndreas Gohr * @param type $limit 1236b6f8822SAndreas Gohr * @param type $next 1246b6f8822SAndreas Gohr */ 1252507f8e0SAndreas Gohr function html_pager($limit,$next){ 1262507f8e0SAndreas Gohr echo '<div class="plg_stats_pager">'; 1272507f8e0SAndreas Gohr 1282507f8e0SAndreas Gohr if($this->start > 0){ 1292507f8e0SAndreas Gohr $go = max($this->start - $limit, 0); 1302507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$this->from.'&t='.$this->to.'&s='.$go.'" class="prev">previous page</a>'; 1312507f8e0SAndreas Gohr } 1322507f8e0SAndreas Gohr 1332507f8e0SAndreas Gohr if($next){ 1342507f8e0SAndreas Gohr $go = $this->start + $limit; 1352507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$this->from.'&t='.$this->to.'&s='.$go.'" class="next">next page</a>'; 1362507f8e0SAndreas Gohr } 1372507f8e0SAndreas Gohr echo '</div>'; 1382507f8e0SAndreas Gohr } 1392507f8e0SAndreas Gohr 140264f1744SAndreas Gohr /** 141264f1744SAndreas Gohr * Print the time selection menu 142264f1744SAndreas Gohr */ 14314d99ec0SAndreas Gohr function html_timeselect(){ 144264f1744SAndreas Gohr $now = date('Y-m-d'); 145264f1744SAndreas Gohr $yday = date('Y-m-d',time()-(60*60*24)); 146264f1744SAndreas Gohr $week = date('Y-m-d',time()-(60*60*24*7)); 147264f1744SAndreas Gohr $month = date('Y-m-d',time()-(60*60*24*30)); 14814d99ec0SAndreas Gohr 149264f1744SAndreas Gohr echo '<div class="plg_stats_timeselect">'; 150264f1744SAndreas Gohr echo '<span>Select the timeframe:</span>'; 151264f1744SAndreas Gohr echo '<ul>'; 152264f1744SAndreas Gohr 153264f1744SAndreas Gohr echo '<li>'; 1542507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$now.'&t='.$now.'">'; 155264f1744SAndreas Gohr echo 'today'; 156264f1744SAndreas Gohr echo '</a>'; 157264f1744SAndreas Gohr echo '</li>'; 158264f1744SAndreas Gohr 159264f1744SAndreas Gohr echo '<li>'; 1602507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$yday.'&t='.$yday.'">'; 161264f1744SAndreas Gohr echo 'yesterday'; 162264f1744SAndreas Gohr echo '</a>'; 163264f1744SAndreas Gohr echo '</li>'; 164264f1744SAndreas Gohr 165264f1744SAndreas Gohr echo '<li>'; 1662507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$week.'&t='.$now.'">'; 167264f1744SAndreas Gohr echo 'last 7 days'; 168264f1744SAndreas Gohr echo '</a>'; 169264f1744SAndreas Gohr echo '</li>'; 170264f1744SAndreas Gohr 171264f1744SAndreas Gohr echo '<li>'; 1722507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt='.$this->opt.'&f='.$month.'&t='.$now.'">'; 173264f1744SAndreas Gohr echo 'last 30 days'; 174264f1744SAndreas Gohr echo '</a>'; 175264f1744SAndreas Gohr echo '</li>'; 176264f1744SAndreas Gohr 177264f1744SAndreas Gohr echo '</ul>'; 178264f1744SAndreas Gohr 179264f1744SAndreas Gohr 180264f1744SAndreas Gohr echo '<form action="" method="get">'; 181264f1744SAndreas Gohr echo '<input type="hidden" name="do" value="admin" />'; 182264f1744SAndreas Gohr echo '<input type="hidden" name="page" value="statistics" />'; 183264f1744SAndreas Gohr echo '<input type="hidden" name="opt" value="'.$this->opt.'" />'; 184264f1744SAndreas Gohr echo '<input type="text" name="f" value="'.$this->from.'" class="edit" />'; 185264f1744SAndreas Gohr echo '<input type="text" name="t" value="'.$this->to.'" class="edit" />'; 186264f1744SAndreas Gohr echo '<input type="submit" value="go" class="button" />'; 18714d99ec0SAndreas Gohr echo '</form>'; 188264f1744SAndreas Gohr 189264f1744SAndreas Gohr echo '</div>'; 19014d99ec0SAndreas Gohr } 19114d99ec0SAndreas Gohr 19214d99ec0SAndreas Gohr 193f5f32cbfSAndreas Gohr /** 194f5f32cbfSAndreas Gohr * Print an introductionary screen 195f5f32cbfSAndreas Gohr */ 19614d99ec0SAndreas Gohr function html_dashboard(){ 1972812a751SAndreas Gohr echo '<p>This page gives you a quick overview on what is happening in your Wiki. For detailed lists 1982812a751SAndreas Gohr choose a topic from the list.</p>'; 1992812a751SAndreas Gohr 2002812a751SAndreas Gohr // general info 2012812a751SAndreas Gohr echo '<div class="plg_stats_top">'; 2026b6f8822SAndreas Gohr $result = $this->hlp->Query()->aggregate($this->tlimit); 2032812a751SAndreas Gohr echo '<ul>'; 2042812a751SAndreas Gohr echo '<li><span>'.$result['pageviews'].'</span> page views </li>'; 2053c0acc14SAndreas Gohr echo '<li><span>'.$result['sessions'].'</span> visits (sessions) </li>'; 2063c0acc14SAndreas Gohr echo '<li><span>'.$result['visitors'].'</span> unique visitors </li>'; 2072812a751SAndreas Gohr echo '<li><span>'.$result['users'].'</span> logged in users</li>'; 2082812a751SAndreas Gohr 2092812a751SAndreas Gohr echo '</ul>'; 2102812a751SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=trend&f='.$this->from.'&t='.$this->to.'" />'; 2112812a751SAndreas Gohr echo '</div>'; 2122812a751SAndreas Gohr 21314d99ec0SAndreas Gohr 21487d5e44bSAndreas Gohr // top pages today 215264f1744SAndreas Gohr echo '<div>'; 216264f1744SAndreas Gohr echo '<h2>Most popular pages</h2>'; 2176b6f8822SAndreas Gohr $result = $this->hlp->Query()->pages($this->tlimit,$this->start,15); 2182812a751SAndreas Gohr $this->html_resulttable($result); 2192507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt=page&f='.$this->from.'&t='.$this->to.'" class="more">more</a>'; 220264f1744SAndreas Gohr echo '</div>'; 22187d5e44bSAndreas Gohr 22287d5e44bSAndreas Gohr // top referer today 223264f1744SAndreas Gohr echo '<div>'; 224e7a2f1e0SAndreas Gohr echo '<h2>Newest incoming links</h2>'; 2256b6f8822SAndreas Gohr $result = $this->hlp->Query()->newreferer($this->tlimit,$this->start,15); 2262812a751SAndreas Gohr $this->html_resulttable($result); 2272507f8e0SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt=newreferer&f='.$this->from.'&t='.$this->to.'" class="more">more</a>'; 228264f1744SAndreas Gohr echo '</div>'; 22954f6c432SAndreas Gohr 23029dea504SAndreas Gohr // top searches today 231264f1744SAndreas Gohr echo '<div>'; 23229dea504SAndreas Gohr echo '<h2>Top search phrases</h2>'; 2336b6f8822SAndreas Gohr $result = $this->hlp->Query()->searchphrases($this->tlimit,$this->start,15); 23429dea504SAndreas Gohr $this->html_resulttable($result); 23529dea504SAndreas Gohr echo '<a href="?do=admin&page=statistics&opt=searchphrases&f='.$this->from.'&t='.$this->to.'" class="more">more</a>'; 236264f1744SAndreas Gohr echo '</div>'; 23714d99ec0SAndreas Gohr } 23814d99ec0SAndreas Gohr 239c67866d1SAndreas Gohr function html_countries(){ 240c67866d1SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=countries&f='.$this->from.'&t='.$this->to.'" />'; 2416b6f8822SAndreas Gohr $result = $this->hlp->Query()->countries($this->tlimit,$this->start,150); 2422507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 2439da6395dSAndreas Gohr } 2449da6395dSAndreas Gohr 2459da6395dSAndreas Gohr function html_page(){ 2466b6f8822SAndreas Gohr $result = $this->hlp->Query()->pages($this->tlimit,$this->start,150); 2472507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 2489da6395dSAndreas Gohr } 2499da6395dSAndreas Gohr 2504f41a2ccSAndreas Gohr function html_browsers(){ 2514f41a2ccSAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=browsers&f='.$this->from.'&t='.$this->to.'" />'; 2526b6f8822SAndreas Gohr $result = $this->hlp->Query()->browsers($this->tlimit,$this->start,150,true); 2532507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 25475fa767dSAndreas Gohr } 25575fa767dSAndreas Gohr 256bd4217d3SAndreas Gohr function html_os(){ 2576b6f8822SAndreas Gohr $result = $this->hlp->Query()->os($this->tlimit,$this->start,150,true); 2582507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 259bd4217d3SAndreas Gohr } 260bd4217d3SAndreas Gohr 2619da6395dSAndreas Gohr function html_referer(){ 2626b6f8822SAndreas Gohr $result = $this->hlp->Query()->aggregate($this->tlimit); 2632812a751SAndreas Gohr 2642812a751SAndreas Gohr $all = $result['search']+$result['external']+$result['direct']; 2652812a751SAndreas Gohr 26694023548SAndreas Gohr if($all){ 2672812a751SAndreas Gohr printf("<p>Of all %d external visits, %d (%.1f%%) were bookmarked (direct) accesses, 2682812a751SAndreas Gohr %d (%.1f%%) came from search engines and %d (%.1f%%) were referred through 2692812a751SAndreas Gohr links from other pages.</p>",$all,$result['direct'],(100*$result['direct']/$all), 2702812a751SAndreas Gohr $result['search'],(100*$result['search']/$all),$result['external'], 2712812a751SAndreas Gohr (100*$result['external']/$all)); 27294023548SAndreas Gohr } 2732812a751SAndreas Gohr 2746b6f8822SAndreas Gohr $result = $this->hlp->Query()->referer($this->tlimit,$this->start,150); 2752507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 2769da6395dSAndreas Gohr } 2779da6395dSAndreas Gohr 278e7a2f1e0SAndreas Gohr function html_newreferer(){ 279e7a2f1e0SAndreas Gohr echo '<p>The following incoming links where first logged in the selected time frame, 280e7a2f1e0SAndreas Gohr and have never been seen before.</p>'; 281e7a2f1e0SAndreas Gohr 2826b6f8822SAndreas Gohr $result = $this->hlp->Query()->newreferer($this->tlimit,$this->start,150); 2832507f8e0SAndreas Gohr $this->html_resulttable($result,'',150); 284e7a2f1e0SAndreas Gohr } 285e7a2f1e0SAndreas Gohr 286e25286daSAndreas Gohr function html_outlinks(){ 2876b6f8822SAndreas Gohr $result = $this->hlp->Query()->outlinks($this->tlimit,$this->start,150); 288e25286daSAndreas Gohr $this->html_resulttable($result,'',150); 289e25286daSAndreas Gohr } 290e25286daSAndreas Gohr 29112dcdeccSAndreas Gohr function html_searchphrases(){ 292*5bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchphrases(true,$this->tlimit,$this->start,150); 29312dcdeccSAndreas Gohr $this->html_resulttable($result,'',150); 29412dcdeccSAndreas Gohr } 29512dcdeccSAndreas Gohr 29612dcdeccSAndreas Gohr function html_searchwords(){ 297*5bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchwords(true,$this->tlimit,$this->start,150); 298*5bccfe87SAndreas Gohr $this->html_resulttable($result,'',150); 299*5bccfe87SAndreas Gohr } 300*5bccfe87SAndreas Gohr 301*5bccfe87SAndreas Gohr function html_internalsearchphrases(){ 302*5bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchphrases(false,$this->tlimit,$this->start,150); 303*5bccfe87SAndreas Gohr $this->html_resulttable($result,'',150); 304*5bccfe87SAndreas Gohr } 305*5bccfe87SAndreas Gohr 306*5bccfe87SAndreas Gohr function html_internalsearchwords(){ 307*5bccfe87SAndreas Gohr $result = $this->hlp->Query()->searchwords(false,$this->tlimit,$this->start,150); 30812dcdeccSAndreas Gohr $this->html_resulttable($result,'',150); 30912dcdeccSAndreas Gohr } 31012dcdeccSAndreas Gohr 31112dcdeccSAndreas Gohr function html_searchengines(){ 3126b6f8822SAndreas Gohr $result = $this->hlp->Query()->searchengines($this->tlimit,$this->start,150); 31312dcdeccSAndreas Gohr $this->html_resulttable($result,'',150); 31412dcdeccSAndreas Gohr } 31512dcdeccSAndreas Gohr 316e25286daSAndreas Gohr 317c73e16f1SAndreas Gohr function html_resolution(){ 3186b6f8822SAndreas Gohr $result = $this->hlp->Query()->resolution($this->tlimit,$this->start,150); 319c73e16f1SAndreas Gohr $this->html_resulttable($result,'',150); 320c73e16f1SAndreas Gohr 321c73e16f1SAndreas Gohr echo '<p>While the data above gives you some info about the resolution your visitors use, it does not tell you 322c73e16f1SAndreas Gohr much about about the real size of their browser windows. The graphic below shows the size distribution of 323c73e16f1SAndreas Gohr the view port (document area) of your visitor\'s browsers. Please note that this data can not be logged 324c73e16f1SAndreas Gohr in all browsers. Because users may resize their browser window while browsing your site the statistics may 325c73e16f1SAndreas Gohr be flawed. Take it with a grain of salt.</p>'; 326c73e16f1SAndreas Gohr 327c73e16f1SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/img.php?img=view&f='.$this->from.'&t='.$this->to.'" />'; 328c73e16f1SAndreas Gohr } 3299da6395dSAndreas Gohr 3309da6395dSAndreas Gohr 33114d99ec0SAndreas Gohr /** 33214d99ec0SAndreas Gohr * Display a result in a HTML table 33314d99ec0SAndreas Gohr */ 3342507f8e0SAndreas Gohr function html_resulttable($result,$header='',$pager=0){ 33514d99ec0SAndreas Gohr echo '<table>'; 3362812a751SAndreas Gohr if(is_array($header)){ 33714d99ec0SAndreas Gohr echo '<tr>'; 33814d99ec0SAndreas Gohr foreach($header as $h){ 33914d99ec0SAndreas Gohr echo '<th>'.hsc($h).'</th>'; 34014d99ec0SAndreas Gohr } 34114d99ec0SAndreas Gohr echo '</tr>'; 3422812a751SAndreas Gohr } 34314d99ec0SAndreas Gohr 3442507f8e0SAndreas Gohr $count = 0; 3452ee939eeSAndreas Gohr if(is_array($result)) foreach($result as $row){ 34614d99ec0SAndreas Gohr echo '<tr>'; 34714d99ec0SAndreas Gohr foreach($row as $k => $v){ 3482812a751SAndreas Gohr echo '<td class="plg_stats_X'.$k.'">'; 34914d99ec0SAndreas Gohr if($k == 'page'){ 35014d99ec0SAndreas Gohr echo '<a href="'.wl($v).'" class="wikilink1">'; 35114d99ec0SAndreas Gohr echo hsc($v); 35214d99ec0SAndreas Gohr echo '</a>'; 35314d99ec0SAndreas Gohr }elseif($k == 'url'){ 35454f6c432SAndreas Gohr $url = hsc($v); 35583b63546SAndreas Gohr $url = preg_replace('/^https?:\/\/(www\.)?/','',$url); 3562812a751SAndreas Gohr if(strlen($url) > 45){ 3572812a751SAndreas Gohr $url = substr($url,0,30).' … '.substr($url,-15); 35854f6c432SAndreas Gohr } 35914d99ec0SAndreas Gohr echo '<a href="'.$v.'" class="urlextern">'; 36054f6c432SAndreas Gohr echo $url; 36114d99ec0SAndreas Gohr echo '</a>'; 362*5bccfe87SAndreas Gohr }elseif($k == 'ilookup'){ 363*5bccfe87SAndreas Gohr echo '<a href="'.wl('',array('id'=>$v,'do'=>'search')).'">Search</a>'; 36429dea504SAndreas Gohr }elseif($k == 'lookup'){ 36529dea504SAndreas Gohr echo '<a href="http://www.google.com/search?q='.rawurlencode($v).'">'; 36629dea504SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/search/google.png" alt="lookup in Google" border="0" />'; 36729dea504SAndreas Gohr echo '</a> '; 36829dea504SAndreas Gohr 36929dea504SAndreas Gohr echo '<a href="http://search.yahoo.com/search?p='.rawurlencode($v).'">'; 37029dea504SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/search/yahoo.png" alt="lookup in Yahoo" border="0" />'; 37129dea504SAndreas Gohr echo '</a> '; 37229dea504SAndreas Gohr 37329dea504SAndreas Gohr echo '<a href="http://search.msn.com/results.aspx?q='.rawurlencode($v).'">'; 37429dea504SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/search/msn.png" alt="lookup in MSN Live" border="0" />'; 37529dea504SAndreas Gohr echo '</a> '; 37629dea504SAndreas Gohr 37712dcdeccSAndreas Gohr }elseif($k == 'engine'){ 37812dcdeccSAndreas Gohr include_once(dirname(__FILE__).'/inc/search_engines.php'); 37912dcdeccSAndreas Gohr echo $SearchEnginesHashLib[$v]; 38075fa767dSAndreas Gohr }elseif($k == 'bflag'){ 3812998b1f6SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/browser/'.strtolower(preg_replace('/[^\w]+/','',$v)).'.png" alt="'.hsc($v).'" />'; 382bd4217d3SAndreas Gohr }elseif($k == 'osflag'){ 3832998b1f6SAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/os/'.strtolower(preg_replace('/[^\w]+/','',$v)).'.png" alt="'.hsc($v).'" />'; 38475fa767dSAndreas Gohr }elseif($k == 'cflag'){ 38575fa767dSAndreas Gohr echo '<img src="'.DOKU_BASE.'lib/plugins/statistics/ico/flags/'.hsc($v).'.png" alt="'.hsc($v).'" width="18" height="12" />'; 38614d99ec0SAndreas Gohr }elseif($k == 'html'){ 38714d99ec0SAndreas Gohr echo $v; 38814d99ec0SAndreas Gohr }else{ 38914d99ec0SAndreas Gohr echo hsc($v); 39014d99ec0SAndreas Gohr } 39114d99ec0SAndreas Gohr echo '</td>'; 39214d99ec0SAndreas Gohr } 39314d99ec0SAndreas Gohr echo '</tr>'; 3942507f8e0SAndreas Gohr 3952507f8e0SAndreas Gohr if($pager && ($count == $pager)) break; 3962507f8e0SAndreas Gohr $count++; 39714d99ec0SAndreas Gohr } 39814d99ec0SAndreas Gohr echo '</table>'; 3992507f8e0SAndreas Gohr 4002507f8e0SAndreas Gohr if($pager) $this->html_pager($pager,count($result) > $pager); 4011878f16fSAndreas Gohr } 4021878f16fSAndreas Gohr 4031878f16fSAndreas Gohr} 404