diff options
author | friendica <info@friendica.com> | 2012-02-14 18:07:13 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-02-14 18:07:13 -0800 |
commit | f86593965389e2592ae41c7e7f5cb6dcfc7a660f (patch) | |
tree | 8ce03a624bc99aab768d2b228a7e5881f82db9ea | |
parent | 134fdda75f5630efd4053469d1a41940c28a1dff (diff) | |
download | volse-hubzilla-f86593965389e2592ae41c7e7f5cb6dcfc7a660f.tar.gz volse-hubzilla-f86593965389e2592ae41c7e7f5cb6dcfc7a660f.tar.bz2 volse-hubzilla-f86593965389e2592ae41c7e7f5cb6dcfc7a660f.zip |
localise links to private photos inside messages
-rwxr-xr-x | include/conversation.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/conversation.php b/include/conversation.php index 4eff0d088..8a0fd00fb 100755 --- a/include/conversation.php +++ b/include/conversation.php @@ -4,6 +4,28 @@ * Render actions localized */ function localize_item(&$item){ + + $Text = $item['body']; + $saved_image = ''; + $img_start = strpos($Text,'[img]data:'); + $img_end = strpos($Text,'[/img]'); + + if($img_start !== false && $img_end !== false && $img_end > $img_start) { + $start_fragment = substr($Text,0,$img_start); + $img_start += strlen('[img]'); + $saved_image = substr($Text,$img_start,$img_end - $img_start); + $end_fragment = substr($Text,$img_end + strlen('[/img]')); + $Text = $start_fragment . '[!#saved_image#!]' . $end_fragment; + $search = '/\[url\=(.*?)\]\[!#saved_image#!\]\[\/url\]' . '/is'; + $replace = '[url=' . z_path() . '/redir/' . $item['contact-id'] + . '?f=1&url=' . '$1' . '][!#saved_image#!][/url]' ; + + $Text = preg_replace($search,$replace,$Text); + + if(strlen($saved_image)) + $item['body'] = str_replace('[!#saved_image#!]', '[img]' . $saved_image . '[/img]',$Text); + } + $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">"; if ($item['verb']=== ACTIVITY_LIKE || $item['verb']=== ACTIVITY_DISLIKE){ |