]> git.mjollnir.org Git - s9y.git/commitdiff
Patch by kalkin: Improve statistics plugin for better bot detection and graph creation
authorgarvinhicking <garvinhicking>
Tue, 24 Jul 2007 12:57:48 +0000 (12:57 +0000)
committergarvinhicking <garvinhicking>
Tue, 24 Jul 2007 12:57:48 +0000 (12:57 +0000)
plugins/serendipity_event_statistics/ChangeLog [new file with mode: 0644]
plugins/serendipity_event_statistics/UTF-8/lang_bg.inc.php
plugins/serendipity_event_statistics/UTF-8/lang_de.inc.php
plugins/serendipity_event_statistics/UTF-8/lang_pl.inc.php
plugins/serendipity_event_statistics/lang_bg.inc.php
plugins/serendipity_event_statistics/lang_de.inc.php
plugins/serendipity_event_statistics/lang_en.inc.php
plugins/serendipity_event_statistics/serendipity_event_statistics.php

diff --git a/plugins/serendipity_event_statistics/ChangeLog b/plugins/serendipity_event_statistics/ChangeLog
new file mode 100644 (file)
index 0000000..4eff103
--- /dev/null
@@ -0,0 +1,27 @@
+20070723 Version 1.60:
+----------------------
+(By kalkin)
+
+- rewrote the botfilter. Now it's smarter.
+- the graphs can be maximal 200px large
+- the bar colors are now relative.
+
+20070121 Version 1.50:
+----------------------
+(By kalkin)
+
+- added lots of bots
+- now the plugin just count each ip as an visitor at this day, not evry refresh
+
+Version 1.40:
+-------------
+
+(By Shrikee / Arnan)
+
+- added a database table which holds daily stats.
+- 2 graphs which use the data in the above table
+- rewrote the bots filter
+- added a config option to show only visitor stats or show everything (post counts and such)
+- option to enable or disable the bot filter
+- fixed the referer register. They werent added in the database, now they are
+- if either $useragent, $referer or $remote_addr is empty or unknown its set to unknown.
index 170701e01f3bd7862ca94b11619b7498c05952e2..b207c789e247a18fc0b68f80bb705029789714e5 100644 (file)
@@ -61,8 +61,8 @@
     @define('PLUGIN_EVENT_STATISTICS_EXT_OPT1', ' Не');
     @define('PLUGIN_EVENT_STATISTICS_EXT_OPT2', 'Да, долу на страницата');
     @define('PLUGIN_EVENT_STATISTICS_EXT_OPT3', 'Да, горе на страницата');
-    @define('PLUGIN_EVENT_STATISTICS_EXT_ALL', 'Ð\9fоказване Ð½Ð° Ð¿Ñ\8aлна Ñ\81Ñ\82аÑ\82иÑ\81Ñ\82ика?');
-    @define('PLUGIN_EVENT_STATISTICS_EXT_ALL_DESC', 'УÑ\81Ñ\82ановеÑ\82е \'не\' Ð·Ð° Ð´Ð° Ð¿Ð¾ÐºÐ°Ð·Ð²Ð°Ñ\82е Ñ\81амо Ñ\81Ñ\82аÑ\82иÑ\81Ñ\82икаÑ\82а Ð·Ð° Ð¿Ð¾Ñ\81еÑ\82иÑ\82елиÑ\82е');
+    @define('PLUGIN_EVENT_STATISTICS_EXT_ALL', 'УÑ\81Ñ\82ановеÑ\82е \'не\' Ð·Ð° Ð´Ð° Ð¿Ð¾ÐºÐ°Ð·Ð²Ð°Ñ\82е Ñ\81амо Ñ\81Ñ\82аÑ\82иÑ\81Ñ\82икаÑ\82а Ð·Ð° Ð¿Ð¾Ñ\81еÑ\82иÑ\82елиÑ\82е');
+    @define('PLUGIN_EVENT_STATISTICS_EXT_ALL_DESC', 'Ð\9fоказване Ð½Ð° Ð²Ñ\81иÑ\87ко? (по Ð¿Ð¾Ð´Ñ\80азбиÑ\80ане: Ð½Ðµ)');
     @define('PLUGIN_EVENT_STATISTICS_EXT_ALL1', 'Не, скриване на всичко освен броячите');
     @define('PLUGIN_EVENT_STATISTICS_EXT_ALL2', 'Пълна статистика');
     @define('PLUGIN_EVENT_STATISTICS_EXT_VISITORS', 'Брой на посетителите');
index a3cb206f3c9f412f5323b85be4e16a47559186df..95637de58f93f755c11277ea136a91cba3385f98 100644 (file)
         @define('PLUGIN_EVENT_STATISTICS_EXT_ALL1', 'Nein, alles außer dem Zähler verbergen.');
         @define('PLUGIN_EVENT_STATISTICS_EXT_ALL2', 'Ja, alle Statistiken anzeigen!');
         @define('PLUGIN_EVENT_STATISTICS_EXT_VISITORS', 'Anzahl der Besucher');
-        @define('PLUGIN_EVENT_STATISTICS_EXT_VISTODAY', 'Anzahl der Besucher heute');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_HITSTODAY', 'Aufrufe heute');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_HITSTOTAL', 'Aufrufe gesamt');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_VISTODAY', 'Besucher heute');
         @define('PLUGIN_EVENT_STATISTICS_EXT_VISTOTAL', 'Besucher gesamt');
         @define('PLUGIN_EVENT_STATISTICS_EXT_VISSINCE', 'Die erweiterte Besucherstatistik hat seit folgendem Zeitpunkt Daten gesammelt:');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_COUNTDESC','Die Zahl der Aufrufe kann sehr groß werden, liefert jedoch einen Wert bezüglich der einzelnen Seitenanfragen. Diese Zahl erhöht sich deshalb mit JEDEM Seitenaufruf sowie jeder Aktualisierung der Seite und kann damit NICHT als Besucherzähler verstanden werden.');
         @define('PLUGIN_EVENT_STATISTICS_EXT_VISLATEST', 'Letzte Besucher');
         @define('PLUGIN_EVENT_STATISTICS_EXT_TOPREFS', 'Top-Referrer');
         @define('PLUGIN_EVENT_STATISTICS_EXT_TOPREFS_NONE', 'Bisher wurden keine Referrer registriert.');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_DAYGRAPH', 'Aufrufe, auf den Tag bezogen');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_MONTHGRAPH', 'Aufrufe, auf den Monat bezogen');
         @define('PLUGIN_EVENT_STATISTICS_OUT_EXT_STATISTICS', 'Erweiterte Besucherstatistik');
         @define('PLUGIN_EVENT_STATISTICS_BANNED_HOSTS1', 'Aktivieren, keine Robots zählen');
         @define('PLUGIN_EVENT_STATISTICS_BANNED_HOSTS2', 'Nein, Robots bitte mitzählen');
index f31e18314280a4665b35a2e82b04b832ba4a4c85..335b1443a0b52fc0a5e17f7701a1031c4ce9e4b1 100644 (file)
@@ -1,4 +1,4 @@
-<?php # $Id$
+<?php # $Id$
 
 /**
  *  @version $Revision$
index d1059a4d355a94eaa4038721abe6a2047a902cda..929aef428b2b2114a2ba8329859e502d5e7efdb6 100644 (file)
@@ -61,8 +61,8 @@
     @define('PLUGIN_EVENT_STATISTICS_EXT_OPT1', ' Íå');
     @define('PLUGIN_EVENT_STATISTICS_EXT_OPT2', 'Äà, äîëó íà ñòðàíèöàòà');
     @define('PLUGIN_EVENT_STATISTICS_EXT_OPT3', 'Äà, ãîðå íà ñòðàíèöàòà');
-    @define('PLUGIN_EVENT_STATISTICS_EXT_ALL', 'Ïîêàçâàíå íà ïúëíà ñòàòèñòèêà?');
-    @define('PLUGIN_EVENT_STATISTICS_EXT_ALL_DESC', 'Óñòàíîâåòå \'íå\' çà äà ïîêàçâàòå ñàìî ñòàòèñòèêàòà çà ïîñåòèòåëèòå');
+    @define('PLUGIN_EVENT_STATISTICS_EXT_ALL', 'Óñòàíîâåòå \'íå\' çà äà ïîêàçâàòå ñàìî ñòàòèñòèêàòà çà ïîñåòèòåëèòå');
+    @define('PLUGIN_EVENT_STATISTICS_EXT_ALL_DESC', 'Ïîêàçâàíå íà âñè÷êî? (ïî ïîäðàçáèðàíå: íå)');
     @define('PLUGIN_EVENT_STATISTICS_EXT_ALL1', 'Íå, ñêðèâàíå íà âñè÷êî îñâåí áðîÿ÷èòå');
     @define('PLUGIN_EVENT_STATISTICS_EXT_ALL2', 'Ïúëíà ñòàòèñòèêà');
     @define('PLUGIN_EVENT_STATISTICS_EXT_VISITORS', 'Áðîé íà ïîñåòèòåëèòå');
index 2ad08d914c239944662ad8b7d443b65f47adde5b..2f587f7901603f5230f8792c4047d57ccf1e99fd 100644 (file)
         @define('PLUGIN_EVENT_STATISTICS_EXT_ALL1', 'Nein, alles außer dem Zähler verbergen.');
         @define('PLUGIN_EVENT_STATISTICS_EXT_ALL2', 'Ja, alle Statistiken anzeigen!');
         @define('PLUGIN_EVENT_STATISTICS_EXT_VISITORS', 'Anzahl der Besucher');
-        @define('PLUGIN_EVENT_STATISTICS_EXT_VISTODAY', 'Anzahl der Besucher heute');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_HITSTODAY', 'Aufrufe heute');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_HITSTOTAL', 'Aufrufe gesamt');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_VISTODAY', 'Besucher heute');
         @define('PLUGIN_EVENT_STATISTICS_EXT_VISTOTAL', 'Besucher gesamt');
         @define('PLUGIN_EVENT_STATISTICS_EXT_VISSINCE', 'Die erweiterte Besucherstatistik hat seit folgendem Zeitpunkt Daten gesammelt:');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_COUNTDESC','Die Zahl der Aufrufe kann sehr groß werden, liefert jedoch einen Wert bezüglich der einzelnen Seitenanfragen. Diese Zahl erhöht sich deshalb mit JEDEM Seitenaufruf sowie jeder Aktualisierung der Seite und kann damit NICHT als Besucherzähler verstanden werden.');
         @define('PLUGIN_EVENT_STATISTICS_EXT_VISLATEST', 'Letzte Besucher');
         @define('PLUGIN_EVENT_STATISTICS_EXT_TOPREFS', 'Top-Referrer');
         @define('PLUGIN_EVENT_STATISTICS_EXT_TOPREFS_NONE', 'Bisher wurden keine Referrer registriert.');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_DAYGRAPH', 'Aufrufe, auf den Tag bezogen');
+        @define('PLUGIN_EVENT_STATISTICS_EXT_MONTHGRAPH', 'Aufrufe, auf den Monat bezogen');
         @define('PLUGIN_EVENT_STATISTICS_OUT_EXT_STATISTICS', 'Erweiterte Besucherstatistik');
         @define('PLUGIN_EVENT_STATISTICS_BANNED_HOSTS1', 'Aktivieren, keine Robots zählen');
         @define('PLUGIN_EVENT_STATISTICS_BANNED_HOSTS2', 'Nein, Robots bitte mitzählen');
index cbbdc16cca717ef2d82caa95851fb1237f62e484..3eaec3ebec4d87104db9a8d408378cce51631d6f 100644 (file)
@@ -62,8 +62,8 @@
 @define('PLUGIN_EVENT_STATISTICS_EXT_OPT1', 'No!');
 @define('PLUGIN_EVENT_STATISTICS_EXT_OPT2', 'Yes, at the bottom of the page');
 @define('PLUGIN_EVENT_STATISTICS_EXT_OPT3', 'Yes, at the top of the page');
-@define('PLUGIN_EVENT_STATISTICS_EXT_ALL', 'Show all statistics?');
-@define('PLUGIN_EVENT_STATISTICS_EXT_ALL_DESC', 'Set to \'no\' to only show visitor stats');
+@define('PLUGIN_EVENT_STATISTICS_EXT_ALL', 'Set to \'no\' to show only visitor stats');
+@define('PLUGIN_EVENT_STATISTICS_EXT_ALL_DESC', 'Show everything? (default: no)');
 @define('PLUGIN_EVENT_STATISTICS_EXT_ALL1', 'No, hide everything but the counter.');
 @define('PLUGIN_EVENT_STATISTICS_EXT_ALL2', 'Yes, show me all statistics!');
 @define('PLUGIN_EVENT_STATISTICS_EXT_VISITORS', 'Individual counters');
@@ -82,7 +82,7 @@
 @define('PLUGIN_EVENT_STATISTICS_BANNED_HOSTS1', 'Enable, do not count bots');
 @define('PLUGIN_EVENT_STATISTICS_BANNED_HOSTS2', 'Disable, please count bots');
 @define('PLUGIN_EVENT_STATISTICS_BANNED_HOSTS', 'Robot count protection');
-@define('PLUGIN_EVENT_STATISTICS_BANNED_HOSTS_DESC', 'Set to \'yes\' to not count robots. Set to \'no\' to count robots. Currently over 25 bots are banned.');
+@define('PLUGIN_EVENT_STATISTICS_BANNED_HOSTS_DESC', 'Set to \'yes\' to not count robots. set to \'no\' to count robots. Currently over 25 bots are banned.');
 
 @define('PLUGIN_EVENT_STATISTICS_SHOW_LASTENTRY', 'Show date of last entry');
 @define('PLUGIN_EVENT_STATISTICS_SHOW_ENTRYCOUNT', 'Show number of entries');
index 4e0769288c4acbebde3f3ac8a18c3a7f8ffc3e7b..0ec5990428212faac15d0591ac18c484981c94e2 100644 (file)
@@ -4,7 +4,6 @@ if (IN_serendipity !== true) {
     die ("Don't hack!");
 }
 
-
 // Probe for a language include with constants. Still include defines later on, if some constants were missing
 $probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
 if (file_exists($probelang)) {
@@ -24,8 +23,8 @@ class serendipity_event_statistics extends serendipity_event
         $propbag->add('name',          PLUGIN_EVENT_STATISTICS_NAME);
         $propbag->add('description',   PLUGIN_EVENT_STATISTICS_DESC);
         $propbag->add('stackable',     false);
-        $propbag->add('author',        'Arnan de Gans, Garvin Hicking, Fredrik Sandberg');
-        $propbag->add('version',       '1.47');
+        $propbag->add('author',        'Arnan de Gans, Garvin Hicking, Fredrik Sandberg, kalkin');
+        $propbag->add('version',       '1.48');
         $propbag->add('requirements',  array(
             'serendipity' => '0.8',
             'smarty'      => '2.6.7',
@@ -144,7 +143,7 @@ class serendipity_event_statistics extends serendipity_event
                             // excludelist botagents
                             $banned_array = array(
                                     '1'     =>     "unknown",
-                                    '2'     =>     "Yahoo! Slurp",
+                                    '2'     =>     "bot",
                                     '3'     =>     "slurpy",
                                     '4'     =>     "agent 007",
                                     '5'     =>     "ichiro",
@@ -170,39 +169,31 @@ class serendipity_event_statistics extends serendipity_event
                                     '25'    =>     "Dumbot",
                                     '26'    =>     "GeoBot",
                                     '27'    =>     "DigExt",
-                                    '28'    =>     "Feedfetcher-Google",
+                                    '28'    =>     "Jeeves/Teoma",
                                     '29'    =>     "FeedBurner",
-                                    '30'    =>     "Jeeves/Teoma",
-                                    '31'    =>     "FeedBurner/1.0(http://www.FeedBurner.com)",
-                                    '32'    =>     "Technorati Feed Engine/0.01 (Java 1.4.2_07 Sun Microsystems Inc./Linux 2.6.9-22.0.1.ELsmp)",
-                                    '33'    =>     "Java/1.5.0_10",
-                                    '34'    =>     "Java/1.5.0_06",
-                                    '35'    =>     "MarsEdit",
-                                    '36'    =>     "Blogslive (info@blogslive.com)",
-                                    '37'    =>     "XMLRPCCocoa",
-                                    '38'    =>     "Feedfetcher-Google; (+www.google.com/feedfetcher.html)",
-                                    '39'    =>     "YahooFeedSeeker/2.0 (compatible; Mozilla 4.0; MSIE 5.5; http://publisher.yahoo.com/rssguide)",
-                                    '40'    =>     "Mediapartners-Google/2.1",
-                                    '41'    =>     "MagpieRSS/0.61 (+http://magpierss.sf.net)",
-                                    '42'    =>     "www.google.com/feedfetcher.html)",
-                                    '43'    =>     "Sphere Scout&v4.0 (beta)- scout at sphere dot com",
-                                    '44'    =>     "Mozilla 5.0(BlogCorpusReader 1.4142)",
-                                    '45'    =>     "libwww-perl/5.76",
-                                    '46'    =>     "Mozilla 5.0(BlogCorpusReader 1.4142)",
-                                    '48'    =>     "WordPress/2.0.5",
-                                    '49'    =>     "Incutio XML-RPC -- WordPress/2.0.5",
-                                    '50'    =>     "-- WordPress/2.1-alpha3",
-                                    '51'    =>     "WordPress/2.1.1",
-                                    '52'    =>     "WordPress/2.1",
-                                    '53'    =>     "ping.wordblog.de/ping/1.0",
-                                    '54'    =>     "PEAR HTTP_Request class (http://pear.php.net/ )",
-                                    '55'    =>     "Java/1.5.0_07",
-                                    '56'    =>     "Mozilla 5.0(BlogCorpusReader 1.4142)",
-                                    '57'    =>     "BlogPulseLive(support@blogpulse.com)"
+                                    '30'    =>     "Technorati",
+                                    '31'    =>     "Java/1.5.0_10",
+                                    '32'    =>     "Java/1.5.0_06",
+                                    '33'    =>     "MarsEdit",
+                                    '34'    =>     "Blogslive",
+                                    '35'    =>     "XMLRPCCocoa",
+                                    '36'    =>     "Google",
+                                    '37'    =>     "MagpieRSS",
+                                    '38'    =>     "Sphere Scout",
+                                    '39'    =>     "BlogCorpusReader",
+                                    '41'    =>     "libwww-perl",
+                                    '42'    =>     "WordPress",
+                                    '43'    =>     "ping.wordblog.de",
+                                    '44'    =>     "PEAR HTTP_Request",
+                                    '45'    =>     "Java/1.5.0_07",
+                                    '46'    =>     "BlogPulseLive(support@blogpulse.com)",
+                                    '47'    =>     "TrackBack",
+                                    '48'    =>     "Blogdimension",
+                                    '49'    =>     "Yahoo"
                                     );
                                     
                             foreach($banned_array AS $ban) {
-                                if (stristr($useragent, $ban)) {
+                                if (stripos($useragent, $ban) !== false) {
                                     $found = 1;
                                     break;
                                 }
@@ -797,17 +788,19 @@ class serendipity_event_statistics extends serendipity_event
                     }
 
                     $num = $this->statistics_getmonthlystats($i, $visitors_count[0]);
+                    $rep = $num;
+                    rsort($rep);
+                    $maxVisHeigh = 100/$rep[0]*2;
                     echo '<td class="'.$color.'" width="8%" align="center" valign="bottom"><small>' . $num[$i];
-                    $num[$i] = ($num[$i] / 100) * 20 + 1;
                     echo '<br /><img src="plugins/serendipity_event_statistics/'; 
-                    if ($num[$i] < 10) {
+                    if ($num[$i]*$maxVisHeigh/2 <= 33) {
                         echo 'red.png';
-                    } else if ($num[$i] >= 11 && $num[$i] < 30) {
+                    } else if ($num[$i]*$maxVisHeigh/2 > 33 && $num[$i]*$maxVisHeigh/2 < 66) {
                         echo 'yellow.png';
                     } else {
                         echo 'green.png';
                     }
-                    echo '" width="8" alt="" align="bottom" height="'.$num[$i].'" />';
+                    echo '" width="8" alt="" align="bottom" height="'.round($num[$i]*$maxVisHeigh).'" />';
                     echo '<br /></small></td>';
                 } ?>
         </tr><tr>
@@ -840,17 +833,19 @@ class serendipity_event_statistics extends serendipity_event
                     }
 
                     $num = $this->statistics_getdailystats($i, $visitors_count[0]);
+                    $rep = $num;
+                    rsort($rep);
+                    $maxVisHeigh = 100/$rep[0]*2;
                     echo '<td class="'.$color.'" width="3%" align="center" valign="bottom"><small>' . $num[$i];        
-                    $num[$i] = ($num[$i] / 100) * 40 + 1;
                     echo '<br /><img src="plugins/serendipity_event_statistics/';
-                    if ($num[$i] < 20) {
+                    if ($num[$i]*$maxVisHeigh/2 <= 33) {
                         echo 'red.png';
-                    } else if ($num[$i] >= 21 && $num[$i] < 40) {
+                    } else if ($num[$i]*$maxVisHeigh/2 > 33 && $num[$i]*$maxVisHeigh/2 < 66) {
                         echo 'yellow.png';
                     } else {
                         echo 'green.png';
                     }
-                    echo '" width="8" alt="" align="bottom" height="'.$num[$i].'" />';
+                    echo '" width="8" alt="" align="bottom" height="'.round($num[$i]*$maxVisHeigh).'" />';
                     echo '<br /></small></td>';
                 }
             ?>