aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/conversation.php25
-rw-r--r--include/feedutils.php12
-rw-r--r--include/follow.php2
-rwxr-xr-xinclude/items.php103
-rw-r--r--include/markdown.php4
-rw-r--r--include/text.php4
-rw-r--r--include/zot.php5
7 files changed, 42 insertions, 113 deletions
diff --git a/include/conversation.php b/include/conversation.php
index 97dd402fc..3041d2e21 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1001,18 +1001,21 @@ function thread_author_menu($item, $mode = '') {
$profile_link = chanlink_hash($item['author_xchan']);
$contact = false;
- if(App::$contacts && array_key_exists($item['author_xchan'],App::$contacts))
- $contact = App::$contacts[$item['author_xchan']];
- else
- if($local_channel && $item['author']['xchan_addr'])
- $follow_url = z_root() . '/follow/?f=&url=' . urlencode($item['author']['xchan_addr']) . '&interactive=0';
-
+ if($channel['channel_hash'] !== $item['author_xchan']) {
+ if(App::$contacts && array_key_exists($item['author_xchan'],App::$contacts)) {
+ $contact = App::$contacts[$item['author_xchan']];
+ }
+ else {
+ if($local_channel && $item['author']['xchan_addr'] && (! in_array($item['author']['xchan_network'],[ 'rss', 'anon','unknown' ]))) {
+ $follow_url = z_root() . '/follow/?f=&url=' . urlencode($item['author']['xchan_addr']) . '&interactive=0';
+ }
+ }
- if($item['uid'] > 0 && author_is_pmable($item['author'],$contact)) {
- $pm_url = z_root() . '/mail/new/?f=&hash=' . urlencode($item['author_xchan']);
+ if($item['uid'] > 0 && author_is_pmable($item['author'],$contact)) {
+ $pm_url = z_root() . '/mail/new/?f=&hash=' . urlencode($item['author_xchan']);
+ }
}
-
if($contact) {
$poke_link = z_root() . '/poke/?f=&c=' . $contact['abook_id'];
if (! intval($contact['abook_self']))
@@ -1279,7 +1282,7 @@ function status_editor($a, $x, $popup = false) {
if(x($x, 'hide_weblink'))
$weblink = false;
- $embedPhotos = t('Embed image from photo albums');
+ $embedPhotos = t('Embed (existing) photo from your photo albums');
$writefiles = (($mimetype === 'text/bbcode') ? perm_is_allowed($x['profile_uid'], get_observer_hash(), 'write_storage') : false);
if(x($x, 'hide_attach'))
@@ -1382,7 +1385,7 @@ function status_editor($a, $x, $popup = false) {
'$underline' => t('Underline'),
'$quote' => t('Quote'),
'$code' => t('Code'),
- '$attach' => t('Attach file'),
+ '$attach' => t('Attach/Upload file'),
'$weblink' => $weblink,
'$embedPhotos' => $embedPhotos,
'$embedPhotosModalTitle' => t('Embed an image from your albums'),
diff --git a/include/feedutils.php b/include/feedutils.php
index 023caaad6..afbe4229e 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -1332,6 +1332,12 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
// immediate parent wasn't found. Turn into a top-level post if permissions allow
// but save the thread_parent in case we need to refer to it later.
+ if($importer['channel_system']) {
+ if( ! \Zotlabs\Lib\MessageFilter::evaluate($datarray,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) {
+ continue;
+ }
+ }
+
if(! post_is_importable($datarray, $contact))
continue;
@@ -1482,6 +1488,12 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
$author['owner_avatar'] = $contact['thumb'];
}
+ if($importer['channel_system']) {
+ if( ! \Zotlabs\Lib\MessageFilter::evaluate($datarray,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) {
+ continue;
+ }
+ }
+
if(! post_is_importable($datarray, $contact))
continue;
diff --git a/include/follow.php b/include/follow.php
index d803afa3f..e2f0a8f4d 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -158,7 +158,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
$feeds = get_config('system','feed_contacts');
- if(($feeds) && ($protocol === '' || $protocol === 'feed')) {
+ if(($feeds) && ($protocol === '' || $protocol === 'feed' || $protocol === 'rss')) {
$d = discover_by_url($url);
}
else {
diff --git a/include/items.php b/include/items.php
index 9d6e53c1e..55b5a73db 100755
--- a/include/items.php
+++ b/include/items.php
@@ -178,7 +178,7 @@ function item_normal() {
}
function item_normal_search() {
- return " and item.item_hidden = 0 and item.item_type in (0,3,6) and item.item_deleted = 0
+ return " and item.item_hidden = 0 and item.item_type in (0,3,6,7) and item.item_deleted = 0
and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0
and item.item_blocked = 0 and item.obj_type != '" . ACTIVITY_OBJ_FILE . "' ";
}
@@ -3071,44 +3071,14 @@ function check_item_source($uid, $item) {
return false;
}
-
- // since we now have connection filters with more features, the source filter is redundant and can probably go away
-
- if(! $r[0]['src_patt']) {
+ if (! $r[0]['src_patt']) {
logger('source: success');
return true;
}
-
- require_once('include/html2plain.php');
- $text = prepare_text($item['body'],$item['mimetype']);
- $text = html2plain($text);
-
- $tags = ((count($item['term'])) ? $item['term'] : false);
-
- $words = explode("\n",$r[0]['src_patt']);
- if($words) {
- foreach($words as $word) {
- $w = trim($word);
- if(! $w)
- continue;
- if(substr($w,0,1) === '#' && $tags) {
- foreach($tags as $t) {
- if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($w,1)) || (substr($w,1) === '*'))) {
- logger('source: tag filter success');
- return true;
- }
- }
- }
- elseif((strpos($w,'/') === 0) && preg_match($w,$text)) {
- logger('source: preg filter success');
- return true;
- }
- elseif(stristr($text,$w) !== false) {
- logger('source: text filter success');
- return true;
- }
- }
+ if (\Zotlabs\Lib\MessageFilter::evaluate($item, $r[0]['src_patt'], EMPTY_STR)) {
+ logger('source: text filter success');
+ return true;
}
logger('source: filter fail');
@@ -3129,69 +3099,8 @@ function post_is_importable($item,$abook) {
if(! ($abook['abook_incl'] || $abook['abook_excl']))
return true;
- require_once('include/html2plain.php');
-
- unobscure($item);
-
- $text = prepare_text($item['body'],$item['mimetype']);
- $text = html2plain(($item['title']) ? $item['title'] . ' ' . $text : $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);
+ return \Zotlabs\Lib\MessageFilter::evaluate($item,$abook['abook_incl'],$abook['abook_excl']);
- // exclude always has priority
-
- $exclude = (($abook['abook_excl']) ? explode("\n",$abook['abook_excl']) : null);
-
- if($exclude) {
- foreach($exclude as $word) {
- $word = trim($word);
- if(! $word)
- continue;
- if(substr($word,0,1) === '#' && $tags) {
- foreach($tags as $t)
- if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
- return false;
- }
- elseif((strpos($word,'/') === 0) && preg_match($word,$text))
- return false;
- elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0))
- 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(! $word)
- continue;
- if(substr($word,0,1) === '#' && $tags) {
- foreach($tags as $t)
- if((($t['ttype'] == TERM_HASHTAG) || ($t['ttype'] == TERM_COMMUNITYTAG)) && (($t['term'] === substr($word,1)) || (substr($word,1) === '*')))
- return true;
- }
- elseif((strpos($word,'/') === 0) && preg_match($word,$text))
- return true;
- elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0))
- return true;
- elseif(stristr($text,$word) !== false)
- return true;
- }
- }
- else {
- return true;
- }
-
- return false;
}
diff --git a/include/markdown.php b/include/markdown.php
index 431ba84a4..de9862801 100644
--- a/include/markdown.php
+++ b/include/markdown.php
@@ -75,10 +75,10 @@ function markdown_to_bb($s, $use_zrl = false, $options = []) {
// Convert everything that looks like a link to a link
if($use_zrl) {
$s = str_replace(['[img', '/img]'], ['[zmg', '/zmg]'], $s);
- $s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", '$1[zrl=$2$3]$2$3[/zrl]',$s);
+ $s = preg_replace("/([^\]\=\{]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", '$1[zrl=$2$3]$2$3[/zrl]',$s);
}
else {
- $s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", '$1[url=$2$3]$2$3[/url]',$s);
+ $s = preg_replace("/([^\]\=\{]|^)(https?\:\/\/)([a-zA-Z0-9\pL\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,\@\(\)]+)/ismu", '$1[url=$2$3]$2$3[/url]',$s);
}
// remove duplicate adjacent code tags
diff --git a/include/text.php b/include/text.php
index 5be44c3cb..681103389 100644
--- a/include/text.php
+++ b/include/text.php
@@ -816,7 +816,7 @@ function get_tags($s) {
// match any double quoted tags
- if(preg_match_all('/([@#!]\&quot\;.*?\&quot\;)/',$s,$match)) {
+ if(preg_match_all('/([@#\!]\&quot\;.*?\&quot\;)/',$s,$match)) {
foreach($match[1] as $mtch) {
$ret[] = $mtch;
}
@@ -833,7 +833,7 @@ function get_tags($s) {
// Pull out single word tags. These can be @nickname, @first_last
// and #hash tags.
- if(preg_match_all('/(?<![a-zA-Z0-9=\pL\/\?\;])([@#\!][^ \x0D\x0A,;:?\[]+)/u',$s,$match)) {
+ if(preg_match_all('/(?<![a-zA-Z0-9=\pL\/\?\;])([@#\!][^ \x0D\x0A,;:\?\[\{\&]+)/u',$s,$match)) {
foreach($match[1] as $mtch) {
if(substr($mtch,-1,1) === '.')
$mtch = substr($mtch,0,-1);
diff --git a/include/zot.php b/include/zot.php
index 0343f4464..14c9f6ae5 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1787,6 +1787,10 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
$local_public = false;
continue;
}
+ if(! \Zotlabs\Lib\MessageFilter::evaluate($arr,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) {
+ $local_public = false;
+ continue;
+ }
}
$tag_delivery = tgroup_check($channel['channel_id'],$arr);
@@ -1923,6 +1927,7 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
continue;
}
+
$r = q("select * from item where mid = '%s' and uid = %d limit 1",
dbesc($arr['mid']),
intval($channel['channel_id'])