X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fenotify.php;h=39c74fdc64a0ae8c1c27156114ced1ea085db07e;hb=12a71f0155784890d8d0d2da4899fdb43953f036;hp=2b8c36e257d9c58929337feb927f3dd7c1093ae1;hpb=876acd68a0c6f7384c5aa0c78553dd70cd32bd99;p=friendica.git diff --git a/include/enotify.php b/include/enotify.php index 2b8c36e257..39c74fdc64 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -3,6 +3,7 @@ * @file include/enotify.php */ +use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -11,17 +12,14 @@ use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; use Friendica\Util\Emailer; -require_once 'include/bbcode.php'; -require_once 'include/html2bbcode.php'; - /** * @brief Creates a notification entry and possibly sends a mail * * @param array $params Array with the elements: - uid, item, parent, type, otype, verb, event, - link, subject, body, to_name, to_email, source_name, - source_link, activity, preamble, notify_flags, - language, show_in_notification_page + * uid, item, parent, type, otype, verb, event, + * link, subject, body, to_name, to_email, source_name, + * source_link, activity, preamble, notify_flags, + * language, show_in_notification_page */ function notification($params) { @@ -47,10 +45,7 @@ function notification($params) $hostname = substr($hostname, 0, strpos($hostname, ':')); } - $sender_email = $a->config['sender_email']; - if (empty($sender_email)) { - $sender_email = L10n::t('noreply').'@'.$hostname; - } + $sender_email = $a->getSenderEmailAddress(); if ($params['type'] != SYSTEM_EMAIL) { $user = dba::selectFirst('user', ['nickname', 'page-flags'], @@ -362,7 +357,7 @@ function notification($params) if ($params['type'] == NOTIFY_SYSTEM) { switch($params['event']) { case "SYSTEM_REGISTER_REQUEST": - $subject = L10n::t('[Friendica System:Notify] registration request'); + $subject = L10n::t('[Friendica System Notify]') . ' ' . L10n::t('registration request'); $preamble = L10n::t('You\'ve received a registration request from \'%1$s\' at %2$s', $params['source_name'], $sitename); $epreamble = L10n::t('You\'ve received a [url=%1$s]registration request[/url] from %2$s.', @@ -370,7 +365,7 @@ function notification($params) '[url='.$params['source_link'].']'.$params['source_name'].'[/url]' ); - $body = L10n::t('Full Name: %1$s\nSite Location: %2$s\nLogin Name: %3$s ' . "\x28" . '%4$s' . "\x28", + $body = L10n::t('Full Name: %1$s\nSite Location: %2$s\nLogin Name: %3$s ' . "\x28" . '%4$s' . "\x29", $params['source_name'], $siteurl, $params['source_mail'], $params['source_nick'] @@ -448,7 +443,7 @@ function notification($params) $datarray = []; $datarray['hash'] = $hash; $datarray['name'] = $params['source_name']; - $datarray['name_cache'] = strip_tags(bbcode($params['source_name'])); + $datarray['name_cache'] = strip_tags(BBCode::convert($params['source_name'])); $datarray['url'] = $params['source_link']; $datarray['photo'] = $params['source_photo']; $datarray['date'] = DateTimeFormat::utcNow(); @@ -519,7 +514,7 @@ function notification($params) $itemlink = System::baseUrl().'/notify/view/'.$notify_id; $msg = replace_macros($epreamble, ['$itemlink' => $itemlink]); - $msg_cache = format_notification_message($datarray['name_cache'], strip_tags(bbcode($msg))); + $msg_cache = format_notification_message($datarray['name_cache'], strip_tags(BBCode::convert($msg))); q("UPDATE `notify` SET `msg` = '%s', `msg_cache` = '%s' WHERE `id` = %d AND `uid` = %d", dbesc($msg), dbesc($msg_cache), @@ -567,9 +562,9 @@ function notification($params) } // textversion keeps linebreaks - $textversion = strip_tags(str_replace("
", "\n", html_entity_decode(bbcode(stripslashes(str_replace(["\\r\\n", "\\r", "\\n"], "\n", + $textversion = strip_tags(str_replace("
", "\n", html_entity_decode(BBCode::convert(stripslashes(str_replace(["\\r\\n", "\\r", "\\n"], "\n", $body))),ENT_QUOTES, 'UTF-8'))); - $htmlversion = html_entity_decode(bbcode(stripslashes(str_replace(["\\r\\n", "\\r", "\\n\\n", "\\n"], + $htmlversion = html_entity_decode(BBCode::convert(stripslashes(str_replace(["\\r\\n", "\\r", "\\n\\n", "\\n"], "
\n", $body))), ENT_QUOTES, 'UTF-8'); $datarray = [];