4 * Copyright (C) 2004 $ThePhpWikiProgrammingTeam
6 * This file is part of PhpWiki.
8 * PhpWiki is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * PhpWiki is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with PhpWiki; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * Analyze our ACCESS_LOG
28 include_once("lib/PageList.php");
30 class WikiPlugin_RecentReferrers extends WikiPlugin
33 return _("RecentReferrers");
36 function getDescription () {
37 return _("Analyse access log.");
40 function getDefaultArguments() {
43 PageList::supportedArgs(),
50 function run($dbi, $argstr, &$request, $basepage) {
52 return HTML::div(array('class' => "error"), "Error: no ACCESS_LOG");
54 $args = $this->getArgs($argstr, $request);
55 $table = HTML::table(array('cellpadding' => 1,
58 'class' => 'pagelist'));
59 if (!$args['noheader'] and !empty($args['caption']))
60 $table->pushContent(HTML::caption(array('align'=>'top'), $args['caption']));
62 $limit = $args['limit'];
63 $accesslog =& $request->_accesslog;
64 if ($logiter = $accesslog->get_referer($limit, "external_only")
65 and $logiter->count()) {
66 $table->pushContent(HTML::tr(HTML::th("Target"),HTML::th("Referrer"),
67 HTML::th("Host"),HTML::th("Date")));
68 while($logentry = $logiter->next()) {
69 $table->pushContent(HTML::tr(HTML::td($logentry['request']),
70 HTML::td($logentry['referer']),
71 HTML::td($logentry['host']),
72 HTML::td($logentry['time'])
80 // (c-file-style: "gnu")
85 // c-hanging-comment-ender-p: nil
86 // indent-tabs-mode: nil