From 617757d8776ef8e1f6b1c427b0430ef03ec1839f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tadej=20Ba=C5=A1a?= <tadej.basa@gmail.com>
Date: Mon, 7 Mar 2011 18:14:21 +0100
Subject: [PATCH] Patch for issue #997092

---
 .../all/modules/contrib/votingapi/votingapi.module |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/sites/all/modules/contrib/votingapi/votingapi.module b/sites/all/modules/contrib/votingapi/votingapi.module
index 6834c15..381b4d3 100755
--- a/sites/all/modules/contrib/votingapi/votingapi.module
+++ b/sites/all/modules/contrib/votingapi/votingapi.module
@@ -314,14 +314,19 @@ function votingapi_delete_results($vote_results = array()) {
  *   An array of votes matching the criteria.
  */
 function votingapi_select_votes($criteria = array(), $limit = 0) {
-  $anon_window = variable_get('votingapi_anonymous_window', 3600);
+  $anon_window = variable_get('votingapi_anonymous_window', 86400);
   if (!empty($criteria['vote_source']) && $anon_window >= 0) {
     $criteria['timestamp'] = REQUEST_TIME - $anon_window;
   }
   $query = db_select('votingapi_vote')->fields('votingapi_vote');
   foreach ($criteria as $key => $value) {
-    $query->condition($key, $value, is_array($value) ? 'IN' : '=');
-  }
+    if ($key == 'timestamp') {
+      $query->condition($key, $value, '>');
+    }
+    else {
+      $query->condition($key, $value, is_array($value) ? 'IN' : '=');
+    }
+  }  
   if (!empty($limit)) {
     $query->range(0, $limit);
   }
-- 
1.7.1

