diff options
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/include/items.php b/include/items.php index 1009530a4..c807c1d5d 100755 --- a/include/items.php +++ b/include/items.php @@ -1198,12 +1198,15 @@ function encode_item($item,$mirror = false) { case 2: $x['item_restrict'] |= ITEM_PDL; break; - case 2: + case 3: $x['item_restrict'] |= ITEM_WEBPAGE; break; - case 2: + case 4: $x['item_restrict'] |= ITEM_BUG; break; + case 5: + $x['item_restrict'] |= ITEM_DOC; + break; default: break; } @@ -2654,11 +2657,12 @@ function item_store_update($arr,$allow_exec = false) { return $ret; } + $r = q("delete from term where oid = %d and otype = %d", + intval($orig_post_id), + intval(TERM_OBJ_POST) + ); + if(is_array($terms)) { - $r = q("delete from term where oid = %d and otype = %d", - intval($orig_post_id), - intval(TERM_OBJ_POST) - ); foreach($terms as $t) { q("insert into term (uid,oid,otype,type,term,url) values(%d,%d,%d,%d,'%s','%s') ", @@ -2670,7 +2674,6 @@ function item_store_update($arr,$allow_exec = false) { dbesc($t['url']) ); } - $arr['term'] = $terms; } @@ -3370,14 +3373,18 @@ function post_is_importable($item,$abook) { if(! $item) return false; - if((! $abook['abook_incl']) && (! $abook['abook_excl'])) + if(! ($abook['abook_incl'] || $abook['abook_excl'])) return true; - require_once('include/html2plain.php'); $text = prepare_text($item['body'],$item['mimetype']); $text = html2plain($text); + $lang = null; + + if((strpos($abook['abook_incl'],'lang=') !== false) || (strpos($abook['abook_excl'],'lang=') !== false)) { + $lang = detect_language($text); + } $tags = ((count($item['term'])) ? $item['term'] : false); // exclude always has priority @@ -3394,6 +3401,8 @@ function post_is_importable($item,$abook) { } elseif((strpos($word,'/') === 0) && preg_match($word,$body)) return false; + elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0)) + return false; elseif(stristr($text,$word) !== false) return false; } @@ -3411,6 +3420,8 @@ function post_is_importable($item,$abook) { } elseif((strpos($word,'/') === 0) && preg_match($word,$body)) return true; + elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0)) + return true; elseif(stristr($text,$word) !== false) return true; } @@ -3751,6 +3762,9 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { $author['owner_avatar'] = $contact['thumb']; } + if(! post_is_importable($datarray,$contact)) + continue; + logger('consume_feed: author ' . print_r($author,true),LOGGER_DEBUG); logger('consume_feed: ' . print_r($datarray,true),LOGGER_DATA); |