diff options
-rwxr-xr-x | include/diaspora.php | 8 | ||||
-rw-r--r-- | include/identity.php | 32 | ||||
-rw-r--r-- | mod/import.php | 5 |
3 files changed, 41 insertions, 4 deletions
diff --git a/include/diaspora.php b/include/diaspora.php index f0687e51e..d288e1435 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -821,7 +821,7 @@ function diaspora_post($importer,$xml,$msg) { foreach($tags as $tag) { if(strpos($tag,'#') === 0) { - if(strpos($tag,'[url=')) + if((strpos($tag,'[url=')) || (strpos($tag,'[zrl'))) continue; // don't link tags that are already embedded in links @@ -1050,7 +1050,7 @@ function diaspora_reshare($importer,$xml,$msg) { foreach($tags as $tag) { if(strpos($tag,'#') === 0) { - if(strpos($tag,'[url=')) + if((strpos($tag,'[url=')) || (strpos($tag,'[zrl'))) continue; // don't link tags that are already embedded in links @@ -1087,7 +1087,7 @@ function diaspora_reshare($importer,$xml,$msg) { } } - // This won't work + // This won't work on redmatrix $plink = 'https://'.substr($diaspora_handle,strpos($diaspora_handle,'@')+1).'/posts/'.$guid; $datarray['uid'] = $importer['channel_id']; @@ -1337,7 +1337,7 @@ function diaspora_comment($importer,$xml,$msg) { foreach($tags as $tag) { if(strpos($tag,'#') === 0) { - if(strpos($tag,'[url=')) + if((strpos($tag,'[url=')) || (strpos($tag,'[zrl'))) continue; // don't link tags that are already embedded in links diff --git a/include/identity.php b/include/identity.php index fafb97bbb..4417f4028 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1525,4 +1525,36 @@ function get_profile_fields_advanced($filter = 0) { return $x; } +/** + * @function notifications_off($channel_id) + * Clear notifyflags for a channel - most likely during bulk import of content or other activity that is likely + * to generate huge amounts of undesired notifications. + * @param int $channel_id + * The channel to disable notifications for + * @returns int + * Current notification flag value. Send this to notifications_on() to restore the channel settings when finished + * with the activity requiring notifications_off(); + */ + + +function notifications_off($channel_id) { + $r = q("select channel_notifyflags from channel where channel_id = %d limit 1", + intval($channel_id) + ); + $x = q("update channel set channel_notifyflags = 0 where channel_id = %d limit 1", + intval($channel_id) + ); + + return intval($r[0]['channel_notifyflags']); + +} + + +function notifications_on($channel_id,$value) { + $x = q("update channel set channel_notifyflags = %d where channel_id = %d limit 1", + intval($value), + intval($channel_id) + ); + return $x; +}
\ No newline at end of file diff --git a/mod/import.php b/mod/import.php index e5a22a26e..3cf114d66 100644 --- a/mod/import.php +++ b/mod/import.php @@ -378,7 +378,10 @@ function import_post(&$a) { } } + $saved_notification_flags = notifications_off($channel['channel_id']); + if($import_posts && array_key_exists('item',$data) && $data['item']) { + foreach($data['item'] as $i) { $item = get_item_elements($i); @@ -404,6 +407,8 @@ function import_post(&$a) { } + notifications_on($channel['channel_id'],$saved_notification_flags); + if(array_key_exists('item_id',$data) && $data['item_id']) { foreach($data['item_id'] as $i) { $r = q("select id from item where mid = '%s' and uid = %d limit 1", |