diff --git a/plugins/serendipity_event_karma/serendipity_event_karma.php b/plugins/serendipity_event_karma/serendipity_event_karma.php index 7979ffa2..801b19a3 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_DB_VERSION', '2.01'); +@define('PLUGIN_KARMA_DB_VERSION', '2.0'); class serendipity_event_karma extends serendipity_event { @@ -54,7 +54,7 @@ class serendipity_event_karma extends serendipity_event $propbag->add('description', PLUGIN_KARMA_BLAHBLAH); $propbag->add('stackable', false); $propbag->add('author', 'Garvin Hicking, Grischa Brockhaus, Gregor Völtz, Judebert'); - $propbag->add('version', '2.1'); + $propbag->add('version', '2.2'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -65,6 +65,8 @@ class serendipity_event_karma extends serendipity_event 'entry_display' => true, 'css' => true, 'backend_header' => true, + 'backend_sidebar_entries' => true, + 'backend_sidebar_entries_event_display_karmalog' => true, 'event_additional_statistics' => true )); $propbag->add('groups', array('STATISTICS')); @@ -91,7 +93,7 @@ class serendipity_event_karma extends serendipity_event 'textual_visits', 'preview_bg', 'base_image', - // Text/Language optins + // Text/Language options 'text_tab', 'rate_msg', 'curr_msg', @@ -491,7 +493,6 @@ class serendipity_event_karma extends serendipity_event function event_hook($event, &$bag, &$eventData, $addData = null) { global $serendipity; - $hooks = &$bag->get('event_hooks'); @@ -558,8 +559,12 @@ class serendipity_event_karma extends serendipity_event return ; } - // We don't want googlebots hitting the karma-voting - if (stristr($_SERVER['HTTP_USER_AGENT'], 'google')) { + // We don't want bots hitting the karma-voting + $agent = $_SERVER['HTTP_USER_AGENT']; + if (stristr($agent, 'google') + || stristr($agent, 'LinkWalker') + || stristr($agent, 'zermelo') + || stristr($agent, 'NimbleCrawler')) { $this->karmaVote = 'invalid1'; return ; } @@ -1059,7 +1064,6 @@ END_IMG_CSS; //--TODO: Ensure that this works with the Custom Permalinks plugin // (We've seen trouble; it votes correctly, but redirects to the front page) $url = serendipity_currentURL(true); - // Voting is only allowed on entries. Therefore voting URLs must be // either single-entry URLs or summary URLs. serendipity_currentURL // converts them to an "ErrorDocument-URI", so we can focus on the @@ -1085,7 +1089,7 @@ END_IMG_CSS; // to this page after we cast our vote. // Remove any clutter from our previous voting activity - $url_parts = parse_url(serendipity_currentURL()); + $url_parts = parse_url(serendipity_currentURL(true)); if (!empty($url_parts['query'])) { $exclude = array('serendipity[karmaVote]', 'serendipity[karmaId]'); // I tried using parse_str, but it gave me very weird results @@ -1275,6 +1279,343 @@ END_IMG_CSS; return true; break; + // Display the Karma Log link on the sidebar + case 'backend_sidebar_entries': +?> +
';
+ } else {
+ $linkPrevious = ' ';
+ }
+ if ($linkNext) {
+ $linkNext = '
';
+ } else {
+ $linkNext = ' ';
+ }
+ $paging = sprintf(PAGE_BROWSE_COMMENTS, $page, $pages, $totalVotes);
+
+ // Retrieve the next batch of karma votes
+ // [entryid, points, ip, user_agent, votetime]
+ $sql = serendipity_db_query("SELECT l.entryid AS entryid, l.points AS points, l.ip AS ip, l.user_agent AS user_agent, l.votetime AS votetime, e.title AS title FROM {$serendipity['dbPrefix']}karmalog l
+ LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = l.entryid)
+ WHERE 1 = 1 " . $and . "
+ ORDER BY $orderby $limit");
+
+ // Start the form for display and deleting
+ if (is_array($sql)) {
+ print("
+");
+ }
+
+ // Print the footer paging table
+ print("
+| $linkPrevious | +$paging | +$linkNext | +