aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-06-28 22:33:13 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-06-28 22:33:13 -0700
commit63f2e9b41259975f1af6415cda01dc0f81b1af30 (patch)
tree01518a9183b0daf02350da8f8e7d853f1a039ffc /include/items.php
parent8d84472b4cb85b50c314491e0706d80eb5b7de6d (diff)
parent090dae46e500634cec8f3718fbb83d5dbb8f9690 (diff)
downloadvolse-hubzilla-63f2e9b41259975f1af6415cda01dc0f81b1af30.tar.gz
volse-hubzilla-63f2e9b41259975f1af6415cda01dc0f81b1af30.tar.bz2
volse-hubzilla-63f2e9b41259975f1af6415cda01dc0f81b1af30.zip
Merge branch 'master' of https://github.com/redmatrix/redmatrix
Conflicts: include/zot.php mod/connedit.php util/messages.po
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php65
1 files changed, 62 insertions, 3 deletions
diff --git a/include/items.php b/include/items.php
index cf7e28daa..5f479660e 100755
--- a/include/items.php
+++ b/include/items.php
@@ -3295,8 +3295,7 @@ function check_item_source($uid, $item) {
$text = prepare_text($item['body'],$item['mimetype']);
$text = html2plain($text);
- /** @BUG $items is undefined, should this be $item? */
- $tags = ((count($items['term'])) ? $items['term'] : false);
+ $tags = ((count($item['term'])) ? $item['term'] : false);
$words = explode("\n",$r[0]['src_patt']);
if($words) {
@@ -3306,11 +3305,71 @@ function check_item_source($uid, $item) {
if(($t['type'] == TERM_HASHTAG) && ((substr($t,1) === substr($word,1)) || (substr($word,1) === '*')))
return true;
}
- if(stristr($text,$word) !== false)
+ elseif((strpos($word,'/') === 0) && preg_match($word,$body))
return true;
+ elseif(stristr($text,$word) !== false)
+ return true;
+ }
+ }
+
+ return false;
+}
+
+function post_is_importable($item,$abook) {
+
+ if(! $abook)
+ return true;
+ if(! $item)
+ return false;
+
+ if((! $abook['abook_incl']) && (! $abook['abook_excl']))
+ return true;
+
+ require_once('include/html2plain.php');
+ $text = prepare_text($item['body'],$item['mimetype']);
+ $text = html2plain($text);
+
+ $tags = ((count($item['term'])) ? $item['term'] : false);
+
+ // exclude always has priority
+
+ $exclude = (($abook['abook_excl']) ? explode("\n",$abook['abook_excl']) : null);
+
+ if($exclude) {
+ foreach($exclude as $word) {
+ $word = trim($word);
+ if(substr($word,0,1) === '#' && $tags) {
+ foreach($tags as $t)
+ if(($t['type'] == TERM_HASHTAG) && ((substr($t,1) === substr($word,1)) || (substr($word,1) === '*')))
+ return false;
+ }
+ elseif((strpos($word,'/') === 0) && preg_match($word,$body))
+ return false;
+ elseif(stristr($text,$word) !== false)
+ return false;
}
}
+ $include = (($abook['abook_incl']) ? explode("\n",$abook['abook_incl']) : null);
+
+ if($include) {
+ foreach($include as $word) {
+ $word = trim($word);
+ if(substr($word,0,1) === '#' && $tags) {
+ foreach($tags as $t)
+ if(($t['type'] == TERM_HASHTAG) && ((substr($t,1) === substr($word,1)) || (substr($word,1) === '*')))
+ return true;
+ }
+ elseif((strpos($word,'/') === 0) && preg_match($word,$body))
+ return true;
+ elseif(stristr($text,$word) !== false)
+ return true;
+ }
+ }
+ else {
+ return true;
+ }
+
return false;
}