X-Git-Url: https://reisub.nsupdate.info/git/?a=blobdiff_plain;f=diaspora%2FDiaspora_Connection.php;h=a33bf608950f1ef8a4f9b6d546dc1d8d8103d595;hb=a5c4a35a4fb06cb184f6b976f5d5faa7a95e0b90;hp=675f15003a1eadbe53ec7a1cf09961b348b4cdd5;hpb=8f7503d573ad90e8150b1f288b5e9c09f9479c2a;p=friendica-addons.git%2F.git diff --git a/diaspora/Diaspora_Connection.php b/diaspora/Diaspora_Connection.php index 675f1500..a33bf608 100644 --- a/diaspora/Diaspora_Connection.php +++ b/diaspora/Diaspora_Connection.php @@ -29,7 +29,7 @@ class Diaspora_Connection { $this->setPassword($password); } - $this->cookiejar = tempnam(sys_get_temp_dir(), 'cookies'); + $this->cookiejar = tempnam(get_temppath(), 'cookies'); return $this; } @@ -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 = '') {