From 76d25a27b4bbb336b676229777d2ef9531441e8c Mon Sep 17 00:00:00 2001 From: Art4 Date: Sat, 23 Nov 2024 08:26:59 +0000 Subject: [PATCH] Remove requirement for App class in legacy mods --- mod/item.php | 3 +-- mod/lostpass.php | 5 ++--- mod/notes.php | 11 ++++++----- mod/photos.php | 2 -- mod/update_contact.php | 3 +-- mod/update_notes.php | 5 ++--- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/mod/item.php b/mod/item.php index decb957bcc..c47dbac44d 100644 --- a/mod/item.php +++ b/mod/item.php @@ -16,7 +16,6 @@ * information. */ -use Friendica\AppHelper; use Friendica\Content\Conversation; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; @@ -330,7 +329,7 @@ function item_post_return($baseurl, $return_path) System::jsonExit($json); } -function item_content(AppHelper $appHelper) +function item_content() { if (!DI::userSession()->isAuthenticated()) { throw new HTTPException\UnauthorizedException(); diff --git a/mod/lostpass.php b/mod/lostpass.php index 940546d951..d62fd5f5aa 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -7,7 +7,6 @@ * */ -use Friendica\AppHelper; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; @@ -15,7 +14,7 @@ use Friendica\Model\User; use Friendica\Util\DateTimeFormat; use Friendica\Util\Strings; -function lostpass_post(AppHelper $a) +function lostpass_post() { $loginame = trim($_POST['login-name']); if (!$loginame) { @@ -78,7 +77,7 @@ function lostpass_post(AppHelper $a) DI::baseUrl()->redirect(); } -function lostpass_content(AppHelper $appHelper) +function lostpass_content() { if (DI::args()->getArgc() > 1) { $pwdreset_token = DI::args()->getArgv()[1]; diff --git a/mod/notes.php b/mod/notes.php index b61cb97850..478e4c4aca 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -7,7 +7,6 @@ * */ -use Friendica\AppHelper; use Friendica\Content\Conversation; use Friendica\Content\Nav; use Friendica\Content\Pager; @@ -17,7 +16,7 @@ use Friendica\Model\Item; use Friendica\Model\Post; use Friendica\Module\BaseProfile; -function notes_init(AppHelper $appHelper) +function notes_init() { if (! DI::userSession()->getLocalUserId()) { return; @@ -27,8 +26,10 @@ function notes_init(AppHelper $appHelper) } -function notes_content(AppHelper $appHelper, bool $update = false) +function notes_content(bool $update = false) { + $contactId = DI::appHelper()->getContactId(); + if (!DI::userSession()->getLocalUserId()) { DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); return; @@ -46,11 +47,11 @@ function notes_content(AppHelper $appHelper, bool $update = false) 'acl_data' => '', ]; - $o .= DI::conversation()->statusEditor($x, $appHelper->getContactId()); + $o .= DI::conversation()->statusEditor($x, $contactId); } $condition = ['uid' => DI::userSession()->getLocalUserId(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => Item::GRAVITY_PARENT, - 'contact-id'=> $appHelper->getContactId()]; + 'contact-id'=> $contactId]; if (DI::mode()->isMobile()) { $itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network', diff --git a/mod/photos.php b/mod/photos.php index 3afca2db2a..c9fa60bca0 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -28,9 +28,7 @@ use Friendica\Model\Tag; use Friendica\Model\User; use Friendica\Module\BaseProfile; use Friendica\Network\HTTPException; -use Friendica\Network\Probe; use Friendica\Protocol\Activity; -use Friendica\Protocol\ActivityNamespace; use Friendica\Security\Security; use Friendica\Util\Crypto; use Friendica\Util\DateTimeFormat; diff --git a/mod/update_contact.php b/mod/update_contact.php index 30212e5589..adfbc513d7 100644 --- a/mod/update_contact.php +++ b/mod/update_contact.php @@ -9,14 +9,13 @@ * */ -use Friendica\AppHelper; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Post; use Friendica\Model\Contact; -function update_contact_content(AppHelper $appHelper) +function update_contact_content() { if (!empty(DI::args()->get(1)) && !empty($_GET['force'])) { $contact = DBA::selectFirst('account-user-view', ['pid', 'deleted'], ['id' => DI::args()->get(1)]); diff --git a/mod/update_notes.php b/mod/update_notes.php index 93b5e95207..06bbac6930 100644 --- a/mod/update_notes.php +++ b/mod/update_notes.php @@ -8,12 +8,11 @@ * AJAX synchronisation of notes page */ -use Friendica\AppHelper; use Friendica\Core\System; require_once 'mod/notes.php'; -function update_notes_content(AppHelper $appHelper) +function update_notes_content() { $profile_uid = intval($_GET['p']); @@ -27,7 +26,7 @@ function update_notes_content(AppHelper $appHelper) * */ - $text = notes_content($appHelper, $profile_uid); + $text = notes_content($profile_uid); System::htmlUpdateExit($text); }