Remove requirement for App class in legacy mods

This commit is contained in:
Art4 2024-11-23 08:26:59 +00:00
parent 7dbf1bb8bb
commit 76d25a27b4
6 changed files with 12 additions and 17 deletions

View file

@ -16,7 +16,6 @@
* information. * information.
*/ */
use Friendica\AppHelper;
use Friendica\Content\Conversation; use Friendica\Content\Conversation;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Core\Hook; use Friendica\Core\Hook;
@ -330,7 +329,7 @@ function item_post_return($baseurl, $return_path)
System::jsonExit($json); System::jsonExit($json);
} }
function item_content(AppHelper $appHelper) function item_content()
{ {
if (!DI::userSession()->isAuthenticated()) { if (!DI::userSession()->isAuthenticated()) {
throw new HTTPException\UnauthorizedException(); throw new HTTPException\UnauthorizedException();

View file

@ -7,7 +7,6 @@
* *
*/ */
use Friendica\AppHelper;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -15,7 +14,7 @@ use Friendica\Model\User;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings; use Friendica\Util\Strings;
function lostpass_post(AppHelper $a) function lostpass_post()
{ {
$loginame = trim($_POST['login-name']); $loginame = trim($_POST['login-name']);
if (!$loginame) { if (!$loginame) {
@ -78,7 +77,7 @@ function lostpass_post(AppHelper $a)
DI::baseUrl()->redirect(); DI::baseUrl()->redirect();
} }
function lostpass_content(AppHelper $appHelper) function lostpass_content()
{ {
if (DI::args()->getArgc() > 1) { if (DI::args()->getArgc() > 1) {
$pwdreset_token = DI::args()->getArgv()[1]; $pwdreset_token = DI::args()->getArgv()[1];

View file

@ -7,7 +7,6 @@
* *
*/ */
use Friendica\AppHelper;
use Friendica\Content\Conversation; use Friendica\Content\Conversation;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Content\Pager; use Friendica\Content\Pager;
@ -17,7 +16,7 @@ use Friendica\Model\Item;
use Friendica\Model\Post; use Friendica\Model\Post;
use Friendica\Module\BaseProfile; use Friendica\Module\BaseProfile;
function notes_init(AppHelper $appHelper) function notes_init()
{ {
if (! DI::userSession()->getLocalUserId()) { if (! DI::userSession()->getLocalUserId()) {
return; 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()) { if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return; return;
@ -46,11 +47,11 @@ function notes_content(AppHelper $appHelper, bool $update = false)
'acl_data' => '', '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, $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()) { if (DI::mode()->isMobile()) {
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network', $itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',

View file

@ -28,9 +28,7 @@ use Friendica\Model\Tag;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Module\BaseProfile; use Friendica\Module\BaseProfile;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Network\Probe;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Protocol\ActivityNamespace;
use Friendica\Security\Security; use Friendica\Security\Security;
use Friendica\Util\Crypto; use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;

View file

@ -9,14 +9,13 @@
* *
*/ */
use Friendica\AppHelper;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Post; use Friendica\Model\Post;
use Friendica\Model\Contact; use Friendica\Model\Contact;
function update_contact_content(AppHelper $appHelper) function update_contact_content()
{ {
if (!empty(DI::args()->get(1)) && !empty($_GET['force'])) { if (!empty(DI::args()->get(1)) && !empty($_GET['force'])) {
$contact = DBA::selectFirst('account-user-view', ['pid', 'deleted'], ['id' => DI::args()->get(1)]); $contact = DBA::selectFirst('account-user-view', ['pid', 'deleted'], ['id' => DI::args()->get(1)]);

View file

@ -8,12 +8,11 @@
* AJAX synchronisation of notes page * AJAX synchronisation of notes page
*/ */
use Friendica\AppHelper;
use Friendica\Core\System; use Friendica\Core\System;
require_once 'mod/notes.php'; require_once 'mod/notes.php';
function update_notes_content(AppHelper $appHelper) function update_notes_content()
{ {
$profile_uid = intval($_GET['p']); $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); System::htmlUpdateExit($text);
} }