fix errors in statusnet addon

This commit is contained in:
Art4 2024-11-30 20:27:57 +00:00
parent fccf361ef1
commit a41f8c13fe
2 changed files with 9 additions and 6 deletions

View file

@ -31,11 +31,10 @@ use Friendica\Core\System;
/** /**
* Define constants * Define constants
*/ */
$constants = explode(' ', 'OBJECT ARRAY JSON'); defined('CODEBIRD_RETURNFORMAT_ARRAY') or define('CODEBIRD_RETURNFORMAT_ARRAY', 0);
foreach ($constants as $i => $id) { defined('CODEBIRD_RETURNFORMAT_JSON') or define('CODEBIRD_RETURNFORMAT_JSON', 1);
$id = 'CODEBIRD_RETURNFORMAT_' . $id; defined('CODEBIRD_RETURNFORMAT_OBJECT') or define('CODEBIRD_RETURNFORMAT_OBJECT', 2);
defined($id) or define($id, $i);
}
$constants = array( $constants = array(
'CURLE_SSL_CERTPROBLEM' => 58, 'CURLE_SSL_CERTPROBLEM' => 58,
'CURLE_SSL_CACERT' => 60, 'CURLE_SSL_CACERT' => 60,
@ -788,6 +787,8 @@ class CodebirdSN
$possible_files = explode(' ', $possible_files[$method]); $possible_files = explode(' ', $possible_files[$method]);
$data = '';
$multipart_border = '--------------------' . $this->_nonce(); $multipart_border = '--------------------' . $this->_nonce();
$multipart_request = ''; $multipart_request = '';
foreach ($params as $key => $value) { foreach ($params as $key => $value) {
@ -917,7 +918,7 @@ class CodebirdSN
$authorization = 'Authorization: Bearer ' . self::$_oauth_bearer_token; $authorization = 'Authorization: Bearer ' . self::$_oauth_bearer_token;
} }
$request_headers = array(); $request_headers = array();
if (isset($authorization)) { if ($authorization !== '') {
$request_headers[] = $authorization; $request_headers[] = $authorization;
$request_headers[] = 'Expect:'; $request_headers[] = 'Expect:';
} }

View file

@ -366,6 +366,8 @@ function statusnet_post_hook(array &$b)
$otoken = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthtoken'); $otoken = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthtoken');
$osecret = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthsecret'); $osecret = DI::pConfig()->get($b['uid'], 'statusnet', 'oauthsecret');
$iscomment = null;
if ($ckey && $csecret && $otoken && $osecret) { if ($ckey && $csecret && $otoken && $osecret) {
$dent = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret); $dent = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
$max_char = $dent->get_maxlength(); // max. length for a dent $max_char = $dent->get_maxlength(); // max. length for a dent