diff options
author | mrjive <mrjive@mrjive.it> | 2015-12-04 10:32:14 +0100 |
---|---|---|
committer | mrjive <mrjive@mrjive.it> | 2015-12-04 10:32:14 +0100 |
commit | 051346325609f5f2e78ef0deaf182c65d7823bbc (patch) | |
tree | f3660377b3daf6599623d2e4fb95b4d33c30d8cc /mod/item.php | |
parent | 53a796afcc0cff6f9e3f51457df4506a43db1945 (diff) | |
parent | 8a9d743f6f518d3af35014130dcef8f148148113 (diff) | |
download | volse-hubzilla-051346325609f5f2e78ef0deaf182c65d7823bbc.tar.gz volse-hubzilla-051346325609f5f2e78ef0deaf182c65d7823bbc.tar.bz2 volse-hubzilla-051346325609f5f2e78ef0deaf182c65d7823bbc.zip |
Merge pull request #9 from redmatrix/master
updating from original codebase
Diffstat (limited to 'mod/item.php')
-rw-r--r-- | mod/item.php | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/mod/item.php b/mod/item.php index 5f45a248b..f32ff8844 100644 --- a/mod/item.php +++ b/mod/item.php @@ -473,8 +473,9 @@ function item_post(&$a) { require_once('include/text.php'); if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) { require_once('include/bb2diaspora.php'); - $body = escape_tags($body); + $body = escape_tags(trim($body)); $body = str_replace("\n",'<br />', $body); + $body = preg_replace_callback('/\[share(.*?)\]/ism','share_shield',$body); $body = diaspora2bb($body,true); $body = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$body); @@ -650,6 +651,29 @@ function item_post(&$a) { } } + if($orig_post) { + // preserve original tags + $t = q("select * from term where oid = %d and otype = %d and uid = %d and type in ( %d, %d, %d )", + intval($orig_post['id']), + intval(TERM_OBJ_POST), + intval($profile_uid), + intval(TERM_UNKNOWN), + intval(TERM_FILE), + intval(TERM_COMMUNITYTAG) + ); + if($t) { + foreach($t as $t1) { + $post_tags[] = array( + 'uid' => $profile_uid, + 'type' => $t1['type'], + 'otype' => TERM_OBJ_POST, + 'term' => $t1['term'], + 'url' => $t1['url'], + ); + } + } + } + $item_unseen = ((local_channel() != $profile_uid) ? 1 : 0); $item_wall = (($post_type === 'wall' || $post_type === 'wall-comment') ? 1 : 0); @@ -702,6 +726,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; @@ -780,6 +808,22 @@ function item_post(&$a) { if($orig_post) $datarray['edit'] = true; + + + if(feature_enabled($profile_uid,'suppress_duplicates') && (! $orig_post)) { + + $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')) { |