From 31198294c787497d0c5cb4bcf081e5a15db084e5 Mon Sep 17 00:00:00 2001 From: Art4 Date: Fri, 29 Nov 2024 22:36:05 +0000 Subject: [PATCH 01/18] Fix error in bluesky addon --- bluesky/bluesky.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluesky/bluesky.php b/bluesky/bluesky.php index 38934feb..8e2c1ca0 100644 --- a/bluesky/bluesky.php +++ b/bluesky/bluesky.php @@ -1563,7 +1563,7 @@ function bluesky_get_uri_class(string $uri): ?stdClass } $elements = explode(':', $uri); - if (empty($elements) || ($elements[0] != 'at')) { + if ($elements[0] !== 'at') { $post = Post::selectFirstPost(['extid'], ['uri' => $uri]); return bluesky_get_uri_class($post['extid'] ?? ''); } From cf8a7870f3765db549ec961cf28f7fc7b8e466ad Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:27:45 +0000 Subject: [PATCH 02/18] Fix errors in bluesky addon --- bluesky/bluesky.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bluesky/bluesky.php b/bluesky/bluesky.php index 8e2c1ca0..91e524fe 100644 --- a/bluesky/bluesky.php +++ b/bluesky/bluesky.php @@ -683,6 +683,8 @@ function bluesky_create_activity(array $item, stdClass $parent = null) return; } + $post = []; + if ($item['verb'] == Activity::LIKE) { $record = [ 'subject' => $parent, From 1860e732aee24ee9b1f6677e7b8f5c503f226db6 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:28:38 +0000 Subject: [PATCH 03/18] Fix errors in convert addon --- convert/convert.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/convert/convert.php b/convert/convert.php index 2c97e2aa..2545974c 100644 --- a/convert/convert.php +++ b/convert/convert.php @@ -181,7 +181,7 @@ function convert_content() { } } - $o .= '

Unit Conversions

'; + $o = '

Unit Conversions

'; if (isset($_POST['from_unit']) && isset($_POST['value'])) { $o .= ($conv->getTable(intval($_POST['value']), $_POST['from_unit'], $_POST['to_unit'], 5)) . '

'; From 81f232d57e8991ca342751d0db2d2680ec7bc7c8 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:30:39 +0000 Subject: [PATCH 04/18] Fix errors in js_upload addon --- .../file-uploader/tests/action-acceptance.php | 16 ++++++++-------- .../tests/action-handler-queue-test.php | 8 ++++---- .../file-uploader/tests/action-handler-test.php | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/js_upload/file-uploader/tests/action-acceptance.php b/js_upload/file-uploader/tests/action-acceptance.php index fc9583f2..172b8857 100644 --- a/js_upload/file-uploader/tests/action-acceptance.php +++ b/js_upload/file-uploader/tests/action-acceptance.php @@ -2,12 +2,12 @@ usleep(100000); -$fileName; -$fileSize; +$fileName = ''; +$fileSize = 0;; if (isset($_GET['qqfile'])){ $fileName = $_GET['qqfile']; - + // xhr request $headers = apache_request_headers(); $fileSize = (int)$headers['Content-Length']; @@ -34,13 +34,13 @@ if ($fileSize > 9 * 1024){ die ('{error: "server-error file size is bigger than 9kB"}'); } -if (count($_GET)){ +if (count($_GET)){ array_merge($_GET, array('fileName'=>$fileName)); - + $response = array_merge($_GET, array('success'=>true, 'fileName'=>$fileName)); - - // to pass data through iframe you will need to encode all html tags - echo htmlspecialchars(json_encode($response), ENT_NOQUOTES); + + // to pass data through iframe you will need to encode all html tags + echo htmlspecialchars(json_encode($response), ENT_NOQUOTES); } else { die ('{error: "server-error query params not passed"}'); } diff --git a/js_upload/file-uploader/tests/action-handler-queue-test.php b/js_upload/file-uploader/tests/action-handler-queue-test.php index ff13576d..78760d64 100644 --- a/js_upload/file-uploader/tests/action-handler-queue-test.php +++ b/js_upload/file-uploader/tests/action-handler-queue-test.php @@ -2,11 +2,11 @@ sleep(4); -$fileName; +$fileName = ''; if (isset($_GET['qqfile'])){ $fileName = $_GET['qqfile']; - + // xhr request $headers = apache_request_headers(); if ((int)$headers['Content-Length'] == 0){ @@ -14,7 +14,7 @@ if (isset($_GET['qqfile'])){ } } elseif (isset($_FILES['qqfile'])){ $fileName = basename($_FILES['qqfile']['name']); - + // form request if ($_FILES['qqfile']['size'] == 0){ die ('{error: "file size is zero"}'); @@ -25,7 +25,7 @@ if (isset($_GET['qqfile'])){ if (count($_GET)){ $_GET['success'] = true; - echo json_encode(array_merge($_GET)); + echo json_encode(array_merge($_GET)); } else { die ('{error: "query params not passed"}'); } diff --git a/js_upload/file-uploader/tests/action-handler-test.php b/js_upload/file-uploader/tests/action-handler-test.php index 24466b12..9fa72023 100644 --- a/js_upload/file-uploader/tests/action-handler-test.php +++ b/js_upload/file-uploader/tests/action-handler-test.php @@ -2,11 +2,11 @@ usleep(300); -$fileName; +$fileName = ''; if (isset($_GET['qqfile'])){ $fileName = $_GET['qqfile']; - + // xhr request $headers = apache_request_headers(); if ((int)$headers['Content-Length'] == 0){ @@ -14,7 +14,7 @@ if (isset($_GET['qqfile'])){ } } elseif (isset($_FILES['qqfile'])){ $fileName = basename($_FILES['qqfile']['name']); - + // form request if ($_FILES['qqfile']['size'] == 0){ die ('{error: "file size is zero"}'); @@ -25,7 +25,7 @@ if (isset($_GET['qqfile'])){ if (count($_GET)){ //return query params - echo json_encode(array_merge($_GET, array('fileName'=>$fileName))); + echo json_encode(array_merge($_GET, array('fileName'=>$fileName))); } else { die ('{error: "query params not passed"}'); } From 3cf53a334d3d04df83b35423f31a916eea0ab492 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:32:07 +0000 Subject: [PATCH 05/18] Fix errors in keycloakpassword addon --- keycloakpassword/keycloakpassword.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/keycloakpassword/keycloakpassword.php b/keycloakpassword/keycloakpassword.php index bfff4ea4..e9809f86 100644 --- a/keycloakpassword/keycloakpassword.php +++ b/keycloakpassword/keycloakpassword.php @@ -6,7 +6,6 @@ * Author: Ryan */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; @@ -92,7 +91,7 @@ function keycloakpassword_authenticate(array &$b) $client_id, $secret, $endpoint . '/logout', - [ 'refresh_token' => res['refresh_token'] ] + [ 'refresh_token' => $res['refresh_token'] ] ); } } From a53d5ae29b1ec11d4063d636ec6c27074855576b Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:35:19 +0000 Subject: [PATCH 06/18] Fix errors in langfilter addon --- langfilter/langfilter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index e5efa8fb..2bf986f0 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -7,7 +7,6 @@ * License: MIT */ -use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; use Friendica\Core\Renderer; @@ -148,6 +147,8 @@ function langfilter_prepare_body_content_filter(&$hook_data) $iso639 = new Matriphe\ISO639\ISO639; + $confidence = null; + // Extract the language of the post if (!empty($hook_data['item']['language'])) { $languages = json_decode($hook_data['item']['language'], true); From ee1a917612fb1c014eecce9d37b7dbcfa166aaa9 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:37:58 +0000 Subject: [PATCH 07/18] Fix errors in leistungsschutzrecht addon --- leistungsschutzrecht/leistungsschutzrecht.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php index f6c65399..ec8091ac 100644 --- a/leistungsschutzrecht/leistungsschutzrecht.php +++ b/leistungsschutzrecht/leistungsschutzrecht.php @@ -6,7 +6,6 @@ * Author: Michael Vogel */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\DI; @@ -149,7 +148,7 @@ function leistungsschutzrecht_is_member_site(string $url): bool $cleanedurlpart = explode('%', $urldata['host']); $hostname = explode('.', $cleanedurlpart[0]); - if (empty($hostname)) { + if ($hostname === false || $hostname === '') { return false; } From d08a280ba6d51ea1671b62a65ee72f221f83106c Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:41:11 +0000 Subject: [PATCH 08/18] Fix errors in libravatar addon --- libravatar/Services/Libravatar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libravatar/Services/Libravatar.php b/libravatar/Services/Libravatar.php index 70fcfe39..e51ef070 100644 --- a/libravatar/Services/Libravatar.php +++ b/libravatar/Services/Libravatar.php @@ -401,9 +401,8 @@ class Services_Libravatar */ protected function srvGet($domain, $https = false) { - // Are we going secure? Set up a fallback too. - if (isset($https) && $https === true) { + if ($https === true) { $subdomain = '_avatars-sec._tcp.'; $fallback = 'seccdn.'; } else { @@ -426,6 +425,7 @@ class Services_Libravatar $top = $srv[0]; $sum = 0; + $pri = []; // Try to adhere to RFC2782's weighting algorithm, page 3 // "arrange all SRV RRs (that have not been ordered yet) in any order, From 984e7c5e5d133ab4305c766a924d2517a03bbd2c Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:42:40 +0000 Subject: [PATCH 09/18] Fix errors in ljpost addon --- ljpost/ljpost.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 7acc6589..b416c605 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -8,7 +8,6 @@ * Author: Cat Gray */ -use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; use Friendica\Core\Logger; @@ -203,10 +202,12 @@ EOT; Logger::debug('ljpost: data: ' . $xml); + $x = ''; + if ($lj_blog !== 'test') { $x = DI::httpClient()->post($lj_blog, $xml, ['Content-Type' => 'text/xml'])->getBodyString(); } - Logger::info('posted to livejournal: ' . ($x) ? $x : ''); + Logger::info('posted to livejournal: ' . $x); } } From 6b1b043dd8fc48511f9288249cd18322b8a709b4 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:48:49 +0000 Subject: [PATCH 10/18] fix errors in mailstream addon --- mailstream/phpmailer/class.phpmailer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailstream/phpmailer/class.phpmailer.php b/mailstream/phpmailer/class.phpmailer.php index ff3d81e3..dcf02361 100644 --- a/mailstream/phpmailer/class.phpmailer.php +++ b/mailstream/phpmailer/class.phpmailer.php @@ -3287,7 +3287,7 @@ class PHPMailer $result = 'localhost.localdomain'; if (!empty($this->Hostname)) { $result = $this->Hostname; - } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) { + } elseif (array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) { $result = $_SERVER['SERVER_NAME']; } elseif (function_exists('gethostname') && gethostname() !== false) { $result = gethostname(); From c0971779c6091f0d3621c38df30d77f4f1b7e021 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:50:06 +0000 Subject: [PATCH 11/18] Fix errors in nsfw addon --- nsfw/nsfw.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index 4a54d899..674fc201 100644 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -8,7 +8,6 @@ * */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; @@ -119,7 +118,9 @@ function nsfw_prepare_body_content_filter(&$hook_data) $word_list = ['nsfw']; } - $found = false; + $found = false; + $tag_search = false; + if (count($word_list)) { $body = $hook_data['item']['title'] . "\n" . nsfw_extract_photos($hook_data['item']['body']); @@ -129,7 +130,6 @@ function nsfw_prepare_body_content_filter(&$hook_data) continue; } - $tag_search = false; switch ($word[0]) { case '/'; // Regular expression $found = @preg_match($word, $body); From 7fa2dfc608d9ac30253ac257c020dfda3061ec8b Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 19:51:18 +0000 Subject: [PATCH 12/18] Fix errors in pnut addon --- pnut/lib/phpnut.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pnut/lib/phpnut.php b/pnut/lib/phpnut.php index 5794d795..89d5e5f8 100644 --- a/pnut/lib/phpnut.php +++ b/pnut/lib/phpnut.php @@ -1339,6 +1339,8 @@ class phpnut */ protected function updateUserImage(string $image, string $which='avatar') { + $mimeType = ''; + $test = @getimagesize($image); if ($test && array_key_exists('mime', $test)) { $mimeType = $test['mime']; From bda683c56b1800d1c2b3847e44074d554ac34c4b Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 20:12:23 +0000 Subject: [PATCH 13/18] fix errors in pumpio addon --- pumpio/pumpio.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 5e053d7c..d7c2ac32 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -6,7 +6,6 @@ * Author: Michael Vogel */ -use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; use Friendica\Core\Addon; @@ -582,6 +581,8 @@ function pumpio_action(int $uid, string $uri, string $action, string $content = $uri = $orig_post['uri']; } + $objectType = ''; + if (($orig_post['object-type'] != '') && (strstr($orig_post['object-type'], ActivityNamespace::ACTIVITY_SCHEMA))) { $objectType = str_replace(ActivityNamespace::ACTIVITY_SCHEMA, '', $orig_post['object-type']); } elseif (strstr($uri, '/api/comment/')) { @@ -827,6 +828,7 @@ function pumpio_dounlike(int $uid, array $self, $post, string $own_id) } $contactid = 0; + $contact = []; if (Strings::compareLink($post->actor->url, $own_id)) { $contactid = $self['id']; @@ -1430,6 +1432,8 @@ function pumpio_fetchallcomments($uid, $id) Logger::notice('pumpio_fetchallcomments: fetching comment for user ' . $uid . ', URL ' . $url); + $item = new \stdClass(); + if (pumpio_reachable($url)) { $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError' => true], $item); } else { From 5b623c83686b1ac4ac72d15f2072cb380b872ee2 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 20:13:41 +0000 Subject: [PATCH 14/18] fix errors in ratioed addon --- ratioed/RatioedPanel.php | 1 + 1 file changed, 1 insertion(+) diff --git a/ratioed/RatioedPanel.php b/ratioed/RatioedPanel.php index e25c7f34..bd9b44dc 100644 --- a/ratioed/RatioedPanel.php +++ b/ratioed/RatioedPanel.php @@ -26,6 +26,7 @@ class RatioedPanel extends Active $action = $this->parameters['action'] ?? ''; $uid = $this->parameters['uid'] ?? 0; + $user = []; if ($uid) { $user = User::getById($uid, ['username', 'blocked']); From 8e778593ca014916297ad234587f5cbfb426f4f2 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 20:27:57 +0000 Subject: [PATCH 15/18] fix errors in statusnet addon --- statusnet/library/codebirdsn.php | 13 +++++++------ statusnet/statusnet.php | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/statusnet/library/codebirdsn.php b/statusnet/library/codebirdsn.php index 325bcb07..91e256be 100644 --- a/statusnet/library/codebirdsn.php +++ b/statusnet/library/codebirdsn.php @@ -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:'; } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 4bc32050..48f9c254 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -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 From 2f89827deaa09de0cf8bf2a803645441f424cd9a Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 20:36:07 +0000 Subject: [PATCH 16/18] fix errors in tictac addon --- tictac/tictac.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tictac/tictac.php b/tictac/tictac.php index 10103835..082b58c1 100644 --- a/tictac/tictac.php +++ b/tictac/tictac.php @@ -7,7 +7,6 @@ * Status: unsupported */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\DI; @@ -30,7 +29,12 @@ function tictac_module() {} function tictac_content() { - $o = ''; + $o = ''; + $dimen = 3; + $handicap = 0; + $mefirst = 0; + $yours = ''; + $mine = ''; if($_POST['move']) { $handicap = DI::args()->get(1); @@ -45,9 +49,6 @@ function tictac_content() { $handicap = DI::args()->get(1); $dimen = 3; } - else { - $dimen = 3; - } $o .= '

' . DI::l10n()->t('3D Tic-Tac-Toe') . '


'; @@ -163,7 +164,7 @@ class tictac { ]; function __construct($dimen, $handicap, $mefirst, $yours, $mine) { - $this->dimen = 3; + $this->dimen = $dimen; $this->handicap = $handicap ? 1 : 0; $this->mefirst = $mefirst ? 1 : 0; $this->yours = str_replace('XXX','',$yours); @@ -228,6 +229,8 @@ class tictac { } function parse_moves($player) { + $str = ''; + if($player == 'me') $str = $this->mine; if($player == 'you') From a71db771d9473852786cc7435e9b1178b842880f Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 30 Nov 2024 20:36:58 +0000 Subject: [PATCH 17/18] Fix errors in wppost addon --- wppost/wppost.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wppost/wppost.php b/wppost/wppost.php index dba738de..f2ee5d21 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -259,9 +259,11 @@ EOT; Logger::debug('wppost: data: ' . $xml); + $x = ''; + if ($wp_blog !== 'test') { $x = DI::httpClient()->post($wp_blog, $xml)->getBodyString(); } - Logger::info('posted to wordpress: ' . (($x) ? $x : '')); + Logger::info('posted to wordpress: ' . $x); } } From 729b6e52107dd1f3ce870b2fa45b7a8e1f60cc4d Mon Sep 17 00:00:00 2001 From: Artur Weigandt Date: Thu, 5 Dec 2024 18:23:51 +0100 Subject: [PATCH 18/18] Update mailstream/phpmailer/class.phpmailer.php Co-authored-by: Hypolite Petovan --- mailstream/phpmailer/class.phpmailer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailstream/phpmailer/class.phpmailer.php b/mailstream/phpmailer/class.phpmailer.php index dcf02361..1d9df9af 100644 --- a/mailstream/phpmailer/class.phpmailer.php +++ b/mailstream/phpmailer/class.phpmailer.php @@ -3287,7 +3287,7 @@ class PHPMailer $result = 'localhost.localdomain'; if (!empty($this->Hostname)) { $result = $this->Hostname; - } elseif (array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) { + } elseif (!empty($_SERVER['SERVER_NAME'])) { $result = $_SERVER['SERVER_NAME']; } elseif (function_exists('gethostname') && gethostname() !== false) { $result = gethostname();