cookienotice addon EN GB translation THX Andy H3
[friendica-addons.git/.git] / diaspora / Diaspora_Connection.php
index 8b8811e..a33bf60 100644 (file)
@@ -46,7 +46,11 @@ class Diaspora_Connection {
        public function setDiasporaID($id) {
                $parts = explode('@', $id);
                $this->user = $parts[0];
-               $this->host = $parts[1];
+               if (count($parts) > 1) {
+                       $this->host = $parts[1];
+               } else {
+                       $this->host = '';
+               }
        }
 
        public function getDiasporaID() {
@@ -136,7 +140,7 @@ class Diaspora_Connection {
                } elseif (!empty($m[1])) {
                        $token = $m[1];
                }
-               return (!empty($token)) ? $token : false;
+               return !empty($token) ? $token : false;
        }
 
        private function readJsonResponse($response) {
@@ -165,14 +169,14 @@ class Diaspora_Connection {
                $this->doHttpRequest('/bookmarklet');
                $m = [];
                preg_match('/"aspects"\:(\[.+?\])/', $this->last_http_result->response, $m);
-               return (!empty($m[1])) ? json_decode($m[1]) : false;
+               return !empty($m[1]) ? json_decode($m[1]) : false;
        }
 
        public function getServices() {
                $this->doHttpRequest('/bookmarklet');
                $m = [];
                preg_match('/"configured_services"\:(\[.+?\])/', $this->last_http_result->response, $m);
-               return (!empty($m[1])) ? json_decode($m[1]) : false;
+               return !empty($m[1]) ? json_decode($m[1]) : false;
        }
 
        public function getNotifications($notification_type = '', $show = '') {