]> git.mxchange.org Git - friendica.git/blobdiff - include/enotify.php
MySQL ANY_VALUE with fallback to MIN
[friendica.git] / include / enotify.php
index c6e0506e96ef2e34191e6d3fd250f4192e068a8a..ebc27309dbe61710b76241f84bfd28e6f8ce0b1d 100644 (file)
@@ -23,7 +23,7 @@ function notification($params) {
 
        $banner = t('Friendica Notification');
        $product = FRIENDICA_PLATFORM;
-       $siteurl = $a->get_baseurl(true);
+       $siteurl = App::get_baseurl(true);
        $thanks = t('Thank You,');
        $sitename = $a->config['sitename'];
        if (!x($a->config['admin_name']))
@@ -58,7 +58,7 @@ function notification($params) {
        $additional_mail_header .= "X-Friendica-Platform: ".FRIENDICA_PLATFORM."\n";
        $additional_mail_header .= "X-Friendica-Version: ".FRIENDICA_VERSION."\n";
        $additional_mail_header .= "List-ID: <notification.".$hostname.">\n";
-       $additional_mail_header .= "List-Archive: <".$a->get_baseurl()."/notifications/system>\n";
+       $additional_mail_header .= "List-Archive: <".App::get_baseurl()."/notifications/system>\n";
 
        if (array_key_exists('item', $params)) {
                $title = $params['item']['title'];
@@ -105,7 +105,7 @@ function notification($params) {
                // If so don't create a second notification
 
                $p = null;
-               $p = q("SELECT `id` FROM `notify` WHERE (`type` = %d OR `type` = %d OR `type` = %d) AND `link` = '%s' AND `uid` = %d LIMIT 1",
+               $p = q("SELECT `id` FROM `notify` WHERE `type` IN (%d, %d, %d) AND `link` = '%s' AND `uid` = %d LIMIT 1",
                        intval(NOTIFY_TAGSELF),
                        intval(NOTIFY_COMMENT),
                        intval(NOTIFY_SHARE),
@@ -472,7 +472,7 @@ function notification($params) {
                // After we've stored everything, look again to see if there are any duplicates and if so remove them
 
                $p = null;
-               $p = q("SELECT `id` FROM `notify` WHERE (`type` = %d OR `type` = %d) AND `link` = '%s' AND `uid` = %d ORDER BY `id`",
+               $p = q("SELECT `id` FROM `notify` WHERE `type` IN (%d, %d) AND `link` = '%s' AND `uid` = %d ORDER BY `id`",
                        intval(NOTIFY_TAGSELF),
                        intval(NOTIFY_COMMENT),
                        dbesc($params['link']),
@@ -494,7 +494,7 @@ function notification($params) {
                }
 
 
-               $itemlink = $a->get_baseurl().'/notify/view/'.$notify_id;
+               $itemlink = App::get_baseurl().'/notify/view/'.$notify_id;
                $msg = replace_macros($epreamble, array('$itemlink' => $itemlink));
                $msg_cache = format_notification_message($datarray['name_cache'], strip_tags(bbcode($msg)));
                $r = q("UPDATE `notify` SET `msg` = '%s', `msg_cache` = '%s' WHERE `id` = %d AND `uid` = %d",
@@ -648,8 +648,6 @@ function notification($params) {
  * @param str $defaulttype (Optional) Forces a notification with this type.
  */
 function check_item_notification($itemid, $uid, $defaulttype = "") {
-       $a = get_app();
-
        $notification_data = array("uid" => $uid, "profiles" => array());
        call_hooks('check_item_notification', $notification_data);
 
@@ -667,7 +665,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
        $profiles[] = $owner[0]["url"];
 
        // Notifications from Diaspora are often with an URL in the Diaspora format
-       $profiles[] = $a->get_baseurl()."/u/".$user[0]["nickname"];
+       $profiles[] = App::get_baseurl()."/u/".$user[0]["nickname"];
 
        $profiles2 = array();