From: brockhaus Date: Sun, 28 Oct 2007 13:11:16 +0000 (+0000) Subject: event_karma: New option to disable visit tracking for logged in users. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a279d75107dfc22c64c27e473d61872df6d98024;p=s9y.git event_karma: New option to disable visit tracking for logged in users. --- diff --git a/plugins/serendipity_event_karma/ChangeLog b/plugins/serendipity_event_karma/ChangeLog new file mode 100644 index 0000000..5dcf914 --- /dev/null +++ b/plugins/serendipity_event_karma/ChangeLog @@ -0,0 +1,9 @@ +# $Id: ChangeLog,v 1.27 2007/10/25 13:56:39 brockhaus Exp $ + +------------------------------------------------------------------------ +Version 1.4 (brockhaus): + + * New option to disable visit tracking for logged in users. + +------------------------------------------------------------------------ +Version 1.3 (garvinhickins): diff --git a/plugins/serendipity_event_karma/UTF-8/lang_de.inc.php b/plugins/serendipity_event_karma/UTF-8/lang_de.inc.php index f7a9d3c..2467427 100644 --- a/plugins/serendipity_event_karma/UTF-8/lang_de.inc.php +++ b/plugins/serendipity_event_karma/UTF-8/lang_de.inc.php @@ -41,3 +41,6 @@ @define('PLUGIN_KARMA_STATISTICS_VISITS_NO', 'Besuche'); @define('PLUGIN_KARMA_STATISTICS_VOTES_NO', 'Stimmen'); @define('PLUGIN_KARMA_STATISTICS_POINTS_NO', 'Punkte'); + + @define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS', 'Aufrufstatistik auch für eingeloggte Benutzer?'); + @define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS_BLAHBLAH', 'Wenn diese Option eingeschaltet ist, dann werden auch die Besuche von eingeloggten Benutzern protokolliert.'); diff --git a/plugins/serendipity_event_karma/lang_de.inc.php b/plugins/serendipity_event_karma/lang_de.inc.php index 8d94337..ace8864 100644 --- a/plugins/serendipity_event_karma/lang_de.inc.php +++ b/plugins/serendipity_event_karma/lang_de.inc.php @@ -41,3 +41,7 @@ @define('PLUGIN_KARMA_STATISTICS_VISITS_NO', 'Besuche'); @define('PLUGIN_KARMA_STATISTICS_VOTES_NO', 'Stimmen'); @define('PLUGIN_KARMA_STATISTICS_POINTS_NO', 'Punkte'); + + + @define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS', 'Aufrufstatistik auch für eingeloggte Benutzer?'); + @define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS_BLAHBLAH', 'Wenn diese Option eingeschaltet ist, dann werden auch die Besuche von eingeloggten Benutzern protokolliert.'); diff --git a/plugins/serendipity_event_karma/lang_en.inc.php b/plugins/serendipity_event_karma/lang_en.inc.php index b8c8ea0..6a8a8b9 100644 --- a/plugins/serendipity_event_karma/lang_en.inc.php +++ b/plugins/serendipity_event_karma/lang_en.inc.php @@ -48,4 +48,6 @@ @define('PLUGIN_KARMA_STATISTICS_POINTS_NO', 'points'); @define('PLUGIN_KARMA_STARRATING', 'Enable individual rating on this entry?'); -?> + +@define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS', 'Track visits of logged in users?'); +@define('PLUGIN_KARMA_VISITS_LOGGEDIN_USERS_BLAHBLAH', 'If this option is enabled, page visits of users who are logged in are tracked, too.'); diff --git a/plugins/serendipity_event_karma/serendipity_event_karma.php b/plugins/serendipity_event_karma/serendipity_event_karma.php index 9685f51..791294b 100644 --- a/plugins/serendipity_event_karma/serendipity_event_karma.php +++ b/plugins/serendipity_event_karma/serendipity_event_karma.php @@ -13,7 +13,7 @@ if (file_exists($probelang)) { include dirname(__FILE__) . '/lang_en.inc.php'; -@define('PLUGIN_KARMA_VERSION', '1.3'); +@define('PLUGIN_KARMA_VERSION', '1.4'); class serendipity_event_karma extends serendipity_event { @@ -30,7 +30,7 @@ class serendipity_event_karma extends serendipity_event $propbag->add('name', PLUGIN_KARMA_NAME); $propbag->add('description', PLUGIN_KARMA_BLAHBLAH); $propbag->add('stackable', false); - $propbag->add('author', 'Garvin Hicking'); + $propbag->add('author', 'Garvin Hicking','Grischa Brockhaus'); $propbag->add('version', '1.9'); $propbag->add('requirements', array( 'serendipity' => '0.8', @@ -39,7 +39,7 @@ class serendipity_event_karma extends serendipity_event )); $propbag->add('event_hooks', array('frontend_configure' => true, 'entry_display' => true, 'css' => true, 'event_additional_statistics' => true)); $propbag->add('groups', array('STATISTICS')); - $propbag->add('configuration', array('karma_active', 'visits_active', 'exits_active', 'max_entrytime', 'max_votetime', 'extended_only', 'max_karmatime', 'logging')); + $propbag->add('configuration', array('karma_active', 'visits_active', 'track_visits_of_loggedin_users', 'exits_active', 'max_entrytime', 'max_votetime', 'extended_only', 'max_karmatime', 'logging')); } function introspect_config_item($name, &$propbag) @@ -80,6 +80,13 @@ class serendipity_event_karma extends serendipity_event $propbag->add('default', 'true'); break; + case 'track_visits_of_loggedin_users': + $propbag->add('type', 'boolean'); + $propbag->add('name', PLUGIN_KARMA_VISITS_LOGGEDIN_USERS); + $propbag->add('description', PLUGIN_KARMA_VISITS_LOGGEDIN_USERS_BLAHBLAH); + $propbag->add('default', 'true'); + break; + case 'exits_active': $propbag->add('type', 'boolean'); $propbag->add('name', SHOWS_TOP_EXIT); @@ -232,7 +239,7 @@ class serendipity_event_karma extends serendipity_event } if ($entryid && empty($serendipity['GET']['adminAction'])) { - $track_clicks = serendipity_db_bool($this->get_config('visits_active', true)); + $track_clicks = serendipity_db_bool($this->get_config('visits_active', true)) && $this->track_clicks_allowed_by_user(); if ($track_clicks) { $sql = serendipity_db_query('UPDATE ' . $serendipity['dbPrefix'] . 'karma SET visits = visits + 1 WHERE entryid = ' . $entryid, true); if (serendipity_db_affected_rows() < 1) { @@ -615,6 +622,16 @@ class serendipity_event_karma extends serendipity_event return false; } } + + /** + * Check, if visit counting for the actual visitor should be done. + */ + function track_clicks_allowed_by_user(){ + if (!$this->get_config('track_visits_of_loggedin_users',true) && serendipity_userLoggedIn()){ + return false; + } + return true; + } } /* vim: set sts=4 ts=4 expandtab : */