]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
multi-user, do not cache open mbox
[friendica.git] / mod / item.php
index 6a611633675950965e91faa54ec43b63ceda659f..e53cfb0331deff8d641372735db394bd9e9bb326 100644 (file)
@@ -96,6 +96,7 @@ function item_post(&$a) {
 
                $body              = escape_tags(trim($_POST['body']));
                $private           = $orig_post['private'];
+               $pubmail_enable    = $orig_post['pubmail'];
        }
        else {
                $str_group_allow   = perms2str($_POST['group_allow']);
@@ -121,6 +122,7 @@ function item_post(&$a) {
                        $private = 1;
                }
        
+               $pubmail_enable    = ((x($_POST,'pubmail_enable') && intval($_POST['pubmail_enable']) && (! $private)) ? 1 : 0);
 
                if(! strlen($body)) {
                        notice( t('Empty post discarded.') . EOL );
@@ -362,6 +364,7 @@ function item_post(&$a) {
        $datarray['deny_cid']      = $str_contact_deny;
        $datarray['deny_gid']      = $str_group_deny;
        $datarray['private']       = $private;
+       $datarray['pubmail']       = $pubmail_enable;
 
        /**
         * These fields are for the convenience of plugins...
@@ -399,8 +402,8 @@ function item_post(&$a) {
 
        $r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`, 
                `author-name`, `author-link`, `author-avatar`, `created`, `edited`, `changed`, `uri`, `title`, `body`, `location`, `coord`, 
-               `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private` )
-               VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d )",
+               `tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail` )
+               VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d )",
                intval($datarray['uid']),
                dbesc($datarray['type']),
                intval($datarray['wall']),
@@ -427,7 +430,8 @@ function item_post(&$a) {
                dbesc($datarray['allow_gid']),
                dbesc($datarray['deny_cid']),
                dbesc($datarray['deny_gid']),
-               intval($datarray['private'])
+               intval($datarray['private']),
+               intval($datarray['pubmail'])
        );
 
        $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
@@ -471,8 +475,11 @@ function item_post(&$a) {
                                        '$body' => strip_tags(bbcode($datarray['body']))
                                ));
 
-                               $res = mail($user['email'], $from . t(" commented on your item at ") . $a->config['sitename'],
-                                       $email_tpl,t("From: Administrator@") . $a->get_hostname() );
+                               $res = mail($user['email'], sprintf( t("%s commented on your item at %s") ,$from,$a->config['sitename']),
+                                       $email_tpl,
+                                       'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+                                       . 'Content-type: text/plain; charset=UTF-8' . "\n"
+                                       . 'Content-transfer-encoding: 8bit' );
                        }
                }
                else {
@@ -494,8 +501,12 @@ function item_post(&$a) {
                                        '$body' => strip_tags(bbcode($datarray['body']))
                                ));
 
-                               $res = mail($user['email'], $from . t(" posted on your profile wall at ") . $a->config['sitename'],
-                                       $email_tpl,t("From: Administrator@") . $a->get_hostname() );
+                               $res = mail($user['email'], sprintf( t("%s posted on your profile wall at %s") ,$from, $a->config['sitename']),
+                                       $email_tpl,
+                                       'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
+                                       . 'Content-type: text/plain; charset=UTF-8' . "\n"
+                                       . 'Content-transfer-encoding: 8bit' );
+
                        }
                }
 
@@ -538,13 +549,12 @@ function item_post(&$a) {
                                $addr = trim($recip);
                                if(! strlen($addr))
                                        continue;
-                               $disclaimer = '<hr />' . t('This message was sent to you by ') . $a->user['username'] 
-                                       . t(', a member of the Friendika social network.') . '<br />';
-                               $disclaimer .= t('You may visit them online at') . ' ' 
-                                       . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '<br />';
-                               $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . '<br />'; 
+                               $disclaimer = '<hr />' . sprintf( t('This message was sent to you by %s, a member of the Friendika social network.'),$a->user['username']) 
+                                       . '<br />';
+                               $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  = '[Friendika]' . ' ' . $a->user['username'] . ' ' . t('posted an update.');
+                               $subject  = '[Friendika]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
                                $headers  = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
                                $headers .= 'MIME-Version: 1.0' . "\n";
                                $headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";