X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fenotify.php;h=7eb2c80ebc5964d5a89f70b8966c233f55874ba3;hb=138355838f10397d94e83b474642d2369097d74c;hp=e0629a53eb4236a5e9ebba575a7feed823462173;hpb=29f7ebe307c22b275466390937b82ccb3820fb1c;p=friendica.git diff --git a/include/enotify.php b/include/enotify.php index e0629a53eb..7eb2c80ebc 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -11,8 +11,7 @@ use Friendica\Core\System; use Friendica\Database\DBM; use Friendica\Util\DateTimeFormat; use Friendica\Util\Emailer; - -require_once 'include/html2bbcode.php'; +use Friendica\Model\Item; /** * @brief Creates a notification entry and possibly sends a mail @@ -47,10 +46,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'], @@ -134,7 +130,7 @@ function notification($params) $item = null; if ($params['otype'] === 'item' && $parent_id) { - $item = dba::selectFirst('item', [], ['id' => $parent_id]); + $item = Item::selectFirst($params['uid'], [], ['id' => $parent_id]); } $item_post_type = item_post_type($item); @@ -157,7 +153,7 @@ function notification($params) } // "your post" - if (DBM::is_result($item) && $item['owner-name'] == $item['author-name'] && $item['wall']) { + if (DBM::is_result($item) && $item['owner-id'] == $item['author-id'] && $item['wall']) { $dest_str = L10n::t('%1$s commented on [url=%2$s]your %3$s[/url]', '[url='.$params['source_link'].']'.$params['source_name'].'[/url]', $itemlink, @@ -362,7 +358,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.', @@ -744,7 +740,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") { // Only act if it is a "real" post // We need the additional check for the "local_profile" because of mixed situations on connector networks - $item = q("SELECT `id`, `mention`, `tag`,`parent`, `title`, `body`, `author-name`, `author-link`, `author-avatar`, `guid`, + $item = q("SELECT `id`, `mention`, `tag`,`parent`, `title`, `body`, `author-id`, `guid`, `parent-uri`, `uri`, `contact-id` FROM `item` WHERE `id` = %d AND `verb` IN ('%s', '') AND `type` != 'activity' AND NOT (`author-link` IN ($profile_list)) LIMIT 1", @@ -752,6 +748,8 @@ function check_item_notification($itemid, $uid, $defaulttype = "") { if (!$item) return false; + $author = dba::selectFirst('contact', ['name', 'thumb', 'url'], ['id' => $item[0]['author-id']]); + // Generate the notification array $params = []; $params["uid"] = $uid; @@ -763,9 +761,9 @@ function check_item_notification($itemid, $uid, $defaulttype = "") { $params["parent"] = $item[0]["parent"]; $params["link"] = System::baseUrl().'/display/'.urlencode($item[0]["guid"]); $params["otype"] = 'item'; - $params["source_name"] = $item[0]["author-name"]; - $params["source_link"] = $item[0]["author-link"]; - $params["source_photo"] = $item[0]["author-avatar"]; + $params["source_name"] = $author["name"]; + $params["source_link"] = $author["url"]; + $params["source_photo"] = $author["thumb"]; if ($item[0]["parent-uri"] === $item[0]["uri"]) { // Send a notification for every new post?