diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index cafba16f2..9cdffa436 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -306,6 +306,7 @@ class Apps { 'Articles' => t('Articles'), 'Cards' => t('Cards'), 'Admin' => t('Site Admin'), + 'Content Filter' => t('Content Filter'), 'Report Bug' => t('Report Bug'), 'View Bookmarks' => t('View Bookmarks'), 'Chatrooms' => t('Chatrooms'), diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 312d8c3c0..5b0658759 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -675,7 +675,7 @@ class Connedit extends \Zotlabs\Web\Controller { )); } - if(feature_enabled(local_channel(),'connfilter')) { + if(Apps::system_app_installed(local_channel(),'Content Filter')) { $sections['filter'] = [ 'label' => t('Filter'), 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/?f=§ion=filter', @@ -807,7 +807,7 @@ class Connedit extends \Zotlabs\Web\Controller { '$lbl_rating' => t('Rating'), '$lbl_rating_label' => t('Slide to adjust your rating'), '$lbl_rating_txt' => t('Optionally explain your rating'), - '$connfilter' => feature_enabled(local_channel(),'connfilter'), + '$connfilter' => Apps::system_app_installed(local_channel(),'Content Filter'), '$connfilter_label' => t('Custom Filter'), '$incl' => array('abook_incl',t('Only import posts with this text'), $contact['abook_incl'],t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')), '$excl' => array('abook_excl',t('Do not import posts with this text'), $contact['abook_excl'],t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts')), diff --git a/Zotlabs/Module/Content_filter.php b/Zotlabs/Module/Content_filter.php new file mode 100644 index 000000000..03d6f4f34 --- /dev/null +++ b/Zotlabs/Module/Content_filter.php @@ -0,0 +1,74 @@ +' . $desc . ''; + + if(! ( local_channel() && Apps::system_app_installed(local_channel(),'Content Filter'))) { + return $text; + } + + $text .= EOL . t('The settings on this page apply to all incoming content. To edit the settings for individual connetions, see the similar settings on the Connection Edit page for that connection.') . EOL . EOL; + + $setting_fields = $text; + + $setting_fields .= replace_macros(get_markup_template('field_textarea.tpl'), array( + '$field' => [ + 'message_filter_incl', + t('Only import posts with this text'), + get_pconfig(local_channel(),'system','message_filter_incl',''), + t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts') + ] + )); + $setting_fields .= replace_macros(get_markup_template('field_textarea.tpl'), array( + '$field' => [ + 'message_filter_excl', + t('Only import posts with this text'), + get_pconfig(local_channel(),'system','message_filter_excl',''), + t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts') + ] + )); + + $s .= replace_macros(get_markup_template('generic_app_settings.tpl'), array( + '$addon' => array('content_filter', '' . t('Content Filter Settings'), '', t('Submit')), + '$content' => $setting_fields + )); + + return $s; + } + + +} \ No newline at end of file diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index 2e3f402c4..0979ecd99 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -146,6 +146,8 @@ class Channel { $autoperms = ((x($_POST,'autoperms')) ? intval($_POST['autoperms']) : 0); $anymention = ((x($_POST,'anymention')) ? intval($_POST['anymention']) : 0); $hyperdrive = ((x($_POST,'hyperdrive')) ? intval($_POST['hyperdrive']) : 0); + + $public_uploads = ((isset($_POST['public_uploads'])) ? intval($_POST['public_uploads']) : 0); $post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0); $post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0); @@ -578,6 +580,7 @@ class Channel { '$autoperms' => $autoperms, '$anymention' => $anymention, '$hyperdrive' => $hyperdrive, + '$h_not' => t('Notification Settings'), '$activity_options' => t('By default post a status message when:'), '$post_newfriend' => array('post_newfriend', t('accepting a friend request'), $post_newfriend, '', $yes_no), diff --git a/app/content_filter.apd b/app/content_filter.apd new file mode 100644 index 000000000..291aa236f --- /dev/null +++ b/app/content_filter.apd @@ -0,0 +1,6 @@ +version: 1 +url: $baseurl/content_filter +requires: local_channel +name: Content Filter +photo: icon:filter +categories: Networking diff --git a/include/channel.php b/include/channel.php index e35e865aa..1c112d93c 100644 --- a/include/channel.php +++ b/include/channel.php @@ -495,7 +495,7 @@ function create_identity($arr) { $clone['abconfig'] = $abconfig; } - Libsync::build_sync_packet(0, [ 'abook' => [ $clone ] ], true); + Libsync::build_sync_packet($ret['channel']['channel_id'], [ 'abook' => [ $clone ] ], true); $can_view_stream = their_perms_contains($ret['channel']['channel_id'],$clone['abook_xchan'],'view_stream'); diff --git a/include/items.php b/include/items.php index ec860a413..987172793 100755 --- a/include/items.php +++ b/include/items.php @@ -9,6 +9,7 @@ use Zotlabs\Lib\Libzot; use Zotlabs\Lib\Libsync; use Zotlabs\Lib\Group; use Zotlabs\Lib\Activity; +use Zotlabs\Lib\Apps; use Zotlabs\Lib as Zlib; use Zotlabs\Lib\Enotify; @@ -3170,6 +3171,11 @@ function post_is_importable($channel_id,$item,$abook) { if(! $item) return false; + if(! Apps::system_app_installed($channel_id,'Content Filter')) { + return true; + } + + $incl = PConfig::get($channel_id,'system','message_filter_incl',EMPTY_STR); $excl = PConfig::get($channel_id,'system','message_filter_excl',EMPTY_STR); if($incl || $excl) { @@ -3180,8 +3186,6 @@ function post_is_importable($channel_id,$item,$abook) { } } - if(($channel_id) && (! feature_enabled($channel_id,'connfilter'))) - return true; if(! $abook) return true; diff --git a/include/text.php b/include/text.php index 2c4cf4d2a..89e806260 100644 --- a/include/text.php +++ b/include/text.php @@ -830,6 +830,9 @@ function get_tags($s) { // ignore anything in [color= ], because it may contain color codes which are mistaken for tags $s = preg_replace('/\[color=(.*?)\]/sm','',$s); + // skip anchors in URL + $s = preg_replace('/\[url=(.*?)\]/sm','',$s); + // match any double quoted tags if(preg_match_all('/([@#\!]\"\;.*?\"\;)/',$s,$match)) {