aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorSimon L'nu <simon.lnu@gmail.com>2012-04-25 13:47:20 -0400
committerSimon L'nu <simon.lnu@gmail.com>2012-04-25 13:47:20 -0400
commit78280bdfed363f2316f1fa4e854e9604ebd58470 (patch)
tree349bd483ccf265bef6216c041a4e4c3b587b357b /mod
parent1a1efc7e4614a50a6221e17f0bb4ca48b6d38642 (diff)
parentc9e5609cbfd89db35b536a22eb2ce6cbf7992783 (diff)
downloadvolse-hubzilla-78280bdfed363f2316f1fa4e854e9604ebd58470.tar.gz
volse-hubzilla-78280bdfed363f2316f1fa4e854e9604ebd58470.tar.bz2
volse-hubzilla-78280bdfed363f2316f1fa4e854e9604ebd58470.zip
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
* remotes/upstream/master: bug #307, explaining decentralised private photos is impossible. this turns out to be harder than I thought cleanup - make bb-buttons vanish when comment closed Esperanto at 100% again * master:
Diffstat (limited to 'mod')
-rw-r--r--mod/message.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/mod/message.php b/mod/message.php
index 260f4bb14..dbca45930 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -313,6 +313,29 @@ function message_content(&$a) {
$from_url = $a->get_baseurl(true) . '/redir/' . $message['contact-id'];
$sparkle = ' sparkle';
}
+
+
+ $Text = $message['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/' . $message['contact-id']
+ . '?f=1&url=' . '$1' . '][!#saved_image#!][/url]' ;
+
+ $Text = preg_replace($search,$replace,$Text);
+
+ if(strlen($saved_image))
+ $message['body'] = str_replace('[!#saved_image#!]', '[img]' . $saved_image . '[/img]',$Text);
+ }
+
$mails[] = array(
'id' => $message['id'],
'from_name' => template_escape($message['from-name']),