X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fenotify.php;h=7d862190590b93e40bf359cb13ce692fe26cfd7a;hb=bb2413ddaf7673e5912538801132d5dd57cf9c51;hp=9ca9d79703cde42b32f73e4bfbb5ade232afc21d;hpb=21b1e09fad40c846080d8c41d9e7621f0814d3b7;p=friendica.git diff --git a/include/enotify.php b/include/enotify.php index 9ca9d79703..7d86219059 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -21,13 +21,21 @@ function notification($params) { $thanks = t('Thank You,'); $sitename = $a->config['sitename']; $site_admin = sprintf( t('%s Administrator'), $sitename); + $nickname = ""; $sender_name = $product; $hostname = $a->get_hostname(); if(strpos($hostname,':')) $hostname = substr($hostname,0,strpos($hostname,':')); + + $sender_email = $a->config['sender_email']; + if (empty($sender_email)) { + $sender_email = t('noreply') . '@' . $hostname; + } - $sender_email = t('noreply') . '@' . $hostname; + $user = q("SELECT `nickname` FROM `user` WHERE `uid` = %d", intval($params['uid'])); + if ($user) + $nickname = $user[0]["nickname"]; // with $params['show_in_notification_page'] == false, the notification isn't inserted into // the database, and an email is sent if applicable. @@ -37,6 +45,7 @@ function notification($params) { $additional_mail_header = ""; $additional_mail_header .= "Precedence: list\n"; $additional_mail_header .= "X-Friendica-Host: ".$hostname."\n"; + $additional_mail_header .= "X-Friendica-Account: <".$nickname."@".$hostname.">\n"; $additional_mail_header .= "X-Friendica-Platform: ".FRIENDICA_PLATFORM."\n"; $additional_mail_header .= "X-Friendica-Version: ".FRIENDICA_VERSION."\n"; $additional_mail_header .= "List-ID: \n"; @@ -320,7 +329,7 @@ function notification($params) { $sitelink = t('Please visit %s to approve or reject the request.'); $tsitelink = sprintf( $sitelink, $params['link'] ); - $hsitelink = sprintf( $sitelink, '' . $sitename . ''); + $hsitelink = sprintf( $sitelink, '' . $sitename . '

'); $itemlink = $params['link']; break; case "SYSTEM_DB_UPDATE_FAIL": @@ -336,11 +345,6 @@ function notification($params) { // add a notification to the user, with could be inexistent) $subject = $params['subject']; $preamble = $params['preamble']; - if (x($params,'epreamble')){ - $epreamble = $params['epreamble']; - } else { - $epreamble = str_replace("\n","
\n",$preamble); - } $body = $params['body']; $sitelink = ""; $tsitelink = ""; @@ -349,7 +353,7 @@ function notification($params) { $show_in_notification_page = false; } - + $subject .= " (".$nickname."@".$hostname.")"; $h = array( 'params' => $params, @@ -547,14 +551,15 @@ function notification($params) { call_hooks('enotify_mail', $datarray); // check whether sending post content in email notifications is allowed - $content_allowed = !get_config('system','enotify_no_content'); + // always true for "SYSTEM_EMAIL" + $content_allowed = ((!get_config('system','enotify_no_content')) || ($params['type'] == "SYSTEM_EMAIL")); // load the template for private message notifications $tpl = get_markup_template('email_notify_html.tpl'); $email_html_body = replace_macros($tpl,array( '$banner' => $datarray['banner'], '$product' => $datarray['product'], - '$preamble' => $datarray['preamble'], + '$preamble' => str_replace("\n","
\n",$datarray['preamble']), '$sitename' => $datarray['sitename'], '$siteurl' => $datarray['siteurl'], '$source_name' => $datarray['source_name'], @@ -595,7 +600,8 @@ function notification($params) { // use the Emailer class to send the message - Emailer::send(array( + return Emailer::send(array( + 'uid' => $params['uid'], 'fromName' => $sender_name, 'fromEmail' => $sender_email, 'replyTo' => $sender_email, @@ -605,7 +611,6 @@ function notification($params) { 'textVersion' => $email_text_body, 'additionalMailHeader' => $datarray['headers'], )); - return True; } return False;