]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/Notifier.php
Add support for legacy $lang config in App->loadConfig
[friendica.git] / src / Worker / Notifier.php
index 96549233e58a56fe1d1f25ecd7c332c04cf18047..385892f9916047ae61931d48cbe1301f8afaa5c1 100644 (file)
@@ -48,9 +48,11 @@ require_once 'include/items.php';
  * and ITEM_ID is the id of the item in the database that needs to be sent to others.
  */
 
-class Notifier {
-       public static function execute($cmd, $item_id) {
-               global $a;
+class Notifier
+{
+       public static function execute($cmd, $item_id)
+       {
+               $a = \Friendica\BaseObject::getApp();
 
                logger('notifier: invoked: '.$cmd.': '.$item_id, LOGGER_DEBUG);
 
@@ -378,7 +380,7 @@ class Notifier {
                }
 
                // If this is a public message and pubmail is set on the parent, include all your email contacts
-               if (function_exists('imap_open') && !Config::get('system','imap_disabled')) {
+               if (!empty($target_item) && function_exists('imap_open') && !Config::get('system','imap_disabled')) {
                        if (!strlen($target_item['allow_cid']) && !strlen($target_item['allow_gid'])
                                && !strlen($target_item['deny_cid']) && !strlen($target_item['deny_gid'])
                                && intval($target_item['pubmail'])) {
@@ -412,7 +414,7 @@ class Notifier {
                // delivery loop
                if (DBM::is_result($r)) {
                        foreach ($r as $contact) {
-                               logger("Deliver ".$target_item["guid"]." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
+                               logger("Deliver ".$item_id." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
 
                                Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
                                                'Delivery', $cmd, $item_id, (int)$contact['id']);