X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=diaspora%2Fdiasphp.php;h=f48933a62115e32b85b636732bcdba06a2279c36;hb=7c8c09836eac3ade1e886ceb402dc73849ddd753;hp=cb7a13cc7fe0323eabfcab63a8ec9275492c303d;hpb=c4578aafa0107ba07513eae0ab1fd46afadf9d25;p=friendica-addons.git diff --git a/diaspora/diasphp.php b/diaspora/diasphp.php index cb7a13cc..f48933a6 100644 --- a/diaspora/diasphp.php +++ b/diaspora/diasphp.php @@ -5,11 +5,18 @@ */ class Diasphp { + private $cookiejar; + function __construct($pod) { $this->token_regex = '/content="(.*?)" name="csrf-token/'; $this->pod = $pod; - $this->cookiejar = tempnam(sys_get_temp_dir(), 'cookies'); + $this->cookiejar = tempnam(get_temppath(), 'cookies'); + } + + function __destruct() { + if (file_exists($this->cookiejar)) + unlink($this->cookiejar); } function _fetch_token() { @@ -61,11 +68,12 @@ class Diasphp { return $this; } - function post($text) { + function post($text, $provider = "diasphp") { // post-daten vorbereiten $datatopost = json_encode(array( 'aspect_ids' => 'public', - 'status_message' => array('text' => $text) + 'status_message' => array('text' => $text, + 'provider_display_name' => $provider) )); // header vorbereiten