]> git.mxchange.org Git - friendica-addons.git/commitdiff
fix errors in statusnet addon
authorArt4 <art4@wlabs.de>
Sat, 30 Nov 2024 20:27:57 +0000 (20:27 +0000)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 12 Dec 2024 21:37:42 +0000 (22:37 +0100)
statusnet/library/codebirdsn.php
statusnet/statusnet.php

index 325bcb07267efc2bd5da72484021f9e3df8613c8..91e256be047d20df58e8e8cff85addf13a5f5def 100644 (file)
@@ -31,11 +31,10 @@ use Friendica\Core\System;
 /**
  * Define constants
  */
-$constants = explode(' ', 'OBJECT ARRAY JSON');
-foreach ($constants as $i => $id) {
-    $id = 'CODEBIRD_RETURNFORMAT_' . $id;
-    defined($id) or define($id, $i);
-}
+defined('CODEBIRD_RETURNFORMAT_ARRAY') or define('CODEBIRD_RETURNFORMAT_ARRAY', 0);
+defined('CODEBIRD_RETURNFORMAT_JSON') or define('CODEBIRD_RETURNFORMAT_JSON', 1);
+defined('CODEBIRD_RETURNFORMAT_OBJECT') or define('CODEBIRD_RETURNFORMAT_OBJECT', 2);
+
 $constants = array(
     'CURLE_SSL_CERTPROBLEM' => 58,
     'CURLE_SSL_CACERT' => 60,
@@ -788,6 +787,8 @@ class CodebirdSN
 
         $possible_files = explode(' ', $possible_files[$method]);
 
+        $data = '';
+
         $multipart_border = '--------------------' . $this->_nonce();
         $multipart_request = '';
         foreach ($params as $key => $value) {
@@ -917,7 +918,7 @@ class CodebirdSN
             $authorization = 'Authorization: Bearer ' . self::$_oauth_bearer_token;
         }
         $request_headers = array();
-        if (isset($authorization)) {
+        if ($authorization !== '') {
             $request_headers[] = $authorization;
             $request_headers[] = 'Expect:';
         }
index 4bc32050fb0d8e2547a457af6ccb6e253ece929f..48f9c25428a6ac3a3089339342fa5a57d0142993 100644 (file)
@@ -366,6 +366,8 @@ function statusnet_post_hook(array &$b)
        $otoken  = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthtoken');
        $osecret = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthsecret');
 
+       $iscomment = null;
+
        if ($ckey && $csecret && $otoken && $osecret) {
                $dent = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
                $max_char = $dent->get_maxlength(); // max. length for a dent