aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-11-19 16:05:47 -0800
committerredmatrix <redmatrix@redmatrix.me>2015-11-19 16:05:47 -0800
commit8f94c721bffab9f2ee4aeb045fb81a9840013211 (patch)
tree6c69448ee7e3ea300a3788da09baa9de268a8469 /mod
parent4f81d6451783f8f51b10b2636d68cde444041dc1 (diff)
downloadvolse-hubzilla-8f94c721bffab9f2ee4aeb045fb81a9840013211.tar.gz
volse-hubzilla-8f94c721bffab9f2ee4aeb045fb81a9840013211.tar.bz2
volse-hubzilla-8f94c721bffab9f2ee4aeb045fb81a9840013211.zip
new feature: 'suppress_duplicates' issue #146 triggered with less than two minutes between posts having identical content.
Diffstat (limited to 'mod')
-rw-r--r--mod/admin.php5
-rw-r--r--mod/item.php20
2 files changed, 23 insertions, 2 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 3f1a69ca6..4b7cb3cd9 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -395,9 +395,10 @@ function admin_page_site(&$a) {
}
/* Banner */
+
$banner = get_config('system', 'banner');
- if($banner == false)
- $banner = 'red';
+ if($banner === false)
+ $banner = get_config('system','sitename');
$banner = htmlspecialchars($banner);
diff --git a/mod/item.php b/mod/item.php
index b66d71797..1e39ca9c9 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -703,6 +703,10 @@ function item_post(&$a) {
$plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid;
}
+
+
+
+
$datarray['aid'] = $channel['channel_account_id'];
$datarray['uid'] = $profile_uid;
@@ -781,6 +785,22 @@ function item_post(&$a) {
if($orig_post)
$datarray['edit'] = true;
+
+
+ if(feature_enabled($profile_uid,'suppress_duplicates')) {
+
+ $z = q("select created from item where uid = %d and body = '%s'",
+ intval($profile_uid),
+ dbesc($body)
+ );
+
+ if($z && $z[0]['created'] > datetime_convert('UTC','UTC', 'now - 2 minutes')) {
+ $datarray['cancel'] = 1;
+ notice( t('Duplicate post suppressed.') . EOL);
+ logger('Duplicate post. Faking plugin cancel.');
+ }
+ }
+
call_hooks('post_local',$datarray);
if(x($datarray,'cancel')) {