fix errors in statusnet addon

This commit is contained in:
Art4 2024-11-30 20:27:57 +00:00 committed by Hypolite Petovan
parent 5b623c8368
commit 8e778593ca
2 changed files with 9 additions and 6 deletions

View 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:';
}

View 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