]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
Fix for ticket #2804: bad non-cache fallback code for dupe checks of prolific posters
[quix0rs-gnu-social.git] / classes / Notice.php
index 60989f9bac12025688eb0b8922729d69456eefda..792d6e13161699bb5f3ce62a17a453a7eb47b807 100644 (file)
@@ -524,10 +524,8 @@ class Notice extends Memcached_DataObject
         $notice = new Notice();
         $notice->profile_id = $profile_id;
         $notice->content = $content;
-        if (common_config('db','type') == 'pgsql')
-          $notice->whereAdd('extract(epoch from now() - created) < ' . common_config('site', 'dupelimit'));
-        else
-          $notice->whereAdd('now() - created < ' . common_config('site', 'dupelimit'));
+        $threshold = common_sql_date(time() - common_config('site', 'dupelimit'));
+        $notice->whereAdd(sprintf("created > '%s'", $notice->escape($threshold)));
 
         $cnt = $notice->count();
         return ($cnt == 0);