]> git.mxchange.org Git - friendica.git/commitdiff
Better detection for the mobile client to avoid "{0}" in notifications.
authorMichael Vogel <icarus@dabo.de>
Sat, 13 Jun 2015 18:23:26 +0000 (20:23 +0200)
committerMichael Vogel <icarus@dabo.de>
Sat, 13 Jun 2015 18:23:26 +0000 (20:23 +0200)
boot.php
mod/notify.php
mod/ping.php

index 465bec6775cb5f9e8be98392be2be5acab61b3c8..6c9c8fdc4a7948dd72acf7bc47443a7f3a12f565 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -379,6 +379,7 @@ if(! class_exists('App')) {
                public  $identities;
                public  $is_mobile;
                public  $is_tablet;
+               public  $is_friendica_app;
                public  $performance = array();
 
                public $nav_sel;
@@ -596,6 +597,9 @@ if(! class_exists('App')) {
                        $this->is_mobile = $mobile_detect->isMobile();
                        $this->is_tablet = $mobile_detect->isTablet();
 
+                       // Friendica-Client
+                       $this->is_friendica_app = ($_SERVER['HTTP_USER_AGENT'] == "Apache-HttpClient/UNAVAILABLE (java 1.4)");
+
                        /**
                         * register template engines
                         */
@@ -906,6 +910,10 @@ if(! class_exists('App')) {
                        return(FRIENDICA_PLATFORM." '".FRIENDICA_CODENAME."' ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION."; ".$this->get_baseurl());
                }
 
+               function is_friendica_app() {
+                       return($this->is_friendica_app);
+               }
+
        }
 }
 
index f9c5a09b277deeae503998f895ce3650100dd03d..02260514af91493b287a06438fd799e016c224e5 100644 (file)
@@ -18,11 +18,8 @@ function notify_init(&$a) {
                                intval(local_user())
                        );
 
-                       // Friendica-Client
-                       $friendicamobile = ($_SERVER['HTTP_USER_AGENT'] == "Apache-HttpClient/UNAVAILABLE (java 1.4)");
-
                        // The friendica client has problems with the GUID. this is some workaround
-                       if ($friendicamobile) {
+                       if ($a->is_friendica_app()) {
                                require_once("include/items.php");
                                $urldata = parse_url($r[0]['link']);
                                $guid = basename($urldata["path"]);
index ee5be67f6b6cee847393af5dcba0fba671231364..3ef15a9e7c1123a70f47f86d4d0c68828f3cb0ac 100644 (file)
@@ -316,6 +316,8 @@ function ping_get_notifications($uid, $regularnotifications) {
        $order = "";
        $quit = false;
 
+       $a = get_app();
+
        do {
                $r = q("SELECT `notify`.*, `item`.`visible`, `item`.`spam`, `item`.`deleted`
                        FROM `notify` LEFT JOIN `item` ON `item`.`id` = `notify`.`iid`
@@ -354,8 +356,9 @@ function ping_get_notifications($uid, $regularnotifications) {
                        // Replace the name with {0} but ensure to make that only once
                        // The {0} is used later and prints the name in bold.
                        // But don't do it for the android app.
+
                        $pos = strpos($notification["msg"],$notification['name']);
-                       if (($pos !== false) AND $regularnotifications)
+                       if (($pos !== false) AND $regularnotifications AND !$a->is_friendica_app())
                                $notification["msg"] = substr_replace($notification["msg"],"{0}",$pos,strlen($notification["name"]));
                        else
                                $notification["msg"] = str_replace("{0}", $notification["name"], $notification["msg"]);