]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
Merge pull request #67 from tomtom84/master
[friendica.git] / mod / item.php
index 217f13c4984b3025226484f9f7b49afa6f682a1e..81d7c753b42484e1fe787b3829803a9159d2449d 100755 (executable)
@@ -17,6 +17,7 @@
 
 require_once('include/crypto.php');
 require_once('include/enotify.php');
+require_once('include/email.php');
 
 function item_post(&$a) {
 
@@ -399,6 +400,8 @@ function item_post(&$a) {
 
        $body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body); 
 
+       $body = scale_external_images($body,false);
+
        /**
         * Look for any tags and linkify them
         */
@@ -649,7 +652,8 @@ function item_post(&$a) {
 
 
        if($orig_post) {
-               $r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
+               $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
+                       dbesc($title),
                        dbesc($body),
                        dbesc(datetime_convert()),
                        intval($post_id),
@@ -744,13 +748,15 @@ function item_post(&$a) {
                                        'language'     => $user['language'],
                                        'to_name'      => $user['username'],
                                        'to_email'     => $user['email'],
+                                       'uid'          => $user['uid'],
                                        'item'         => $datarray,
                                        'link'             => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
                                        'source_name'  => $datarray['author-name'],
                                        'source_link'  => $datarray['author-link'],
                                        'source_photo' => $datarray['author-avatar'],
                                        'verb'         => ACTIVITY_POST,
-                                       'otype'        => 'item'
+                                       'otype'        => 'item',
+                                       'parent'       => $parent,
                                ));
                        
                        }
@@ -786,6 +792,7 @@ function item_post(&$a) {
                                        'language'     => $user['language'],
                                        'to_name'      => $user['username'],
                                        'to_email'     => $user['email'],
+                                       'uid'          => $user['uid'],
                                        'item'         => $datarray,
                                        'link'             => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
                                        'source_name'  => $datarray['author-name'],
@@ -853,8 +860,8 @@ function item_post(&$a) {
                                $disclaimer .= sprintf( t('You may visit them online at %s'), $a->get_baseurl() . '/profile/' . $a->user['nickname']) . EOL;
                                $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL; 
 
-                               $subject  = '[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
-                               $headers  = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
+                               $subject  = email_header_encode('[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']),'UTF-8');
+                               $headers  = 'From: ' . email_header_encode($a->user['username'],'UTF-8') . ' <' . $a->user['email'] . '>' . "\n";
                                $headers .= 'MIME-Version: 1.0' . "\n";
                                $headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
                                $headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";