*
*/
-use Friendica\App;
+use Friendica\AppHelper;
use Friendica\Content\Conversation;
use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Model\Post;
use Friendica\Module\BaseProfile;
-function notes_init(App $a)
+function notes_init(AppHelper $appHelper)
{
if (! DI::userSession()->getLocalUserId()) {
return;
}
-function notes_content(App $a, bool $update = false)
+function notes_content(AppHelper $appHelper, bool $update = false)
{
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
'acl_data' => '',
];
- $o .= DI::conversation()->statusEditor($x, $a->getContactId());
+ $o .= DI::conversation()->statusEditor($x, $appHelper->getContactId());
}
$condition = ['uid' => DI::userSession()->getLocalUserId(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => Item::GRAVITY_PARENT,
- 'contact-id'=> $a->getContactId()];
+ 'contact-id'=> $appHelper->getContactId()];
if (DI::mode()->isMobile()) {
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',
namespace Friendica\Module\Contact;
+use Friendica\App\Arguments;
+use Friendica\App\BaseURL;
+use Friendica\AppHelper;
use Friendica\Core\L10n;
-use Friendica\App;
use Friendica\Core\Protocol;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\Core\Worker;
private $session;
/** @var Database */
private $database;
- /** @var App */
- private $app;
+ /** @var AppHelper */
+ private $appHelper;
- public function __construct(App $app, Database $database, IHandleUserSessions $session, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
+ public function __construct(AppHelper $appHelper, Database $database, IHandleUserSessions $session, L10n $l10n, BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->session = $session;
$this->database = $database;
- $this->app = $app;
+ $this->appHelper = $appHelper;
}
protected function rawContent(array $request = [])
// We don't use magic auth when there is no visitor, we are on the same system, or we visit our own stuff
if (empty($visitor) || Strings::compareLink($basepath, $this->baseUrl) || Strings::compareLink($contact_url, $visitor)) {
$this->logger->info('Redirecting without magic', ['target' => $target_url, 'visitor' => $visitor, 'contact' => $contact_url]);
- $this->app->redirect($target_url);
+ $this->appHelper->redirect($target_url);
}
$separator = strpos($target_url, '?') ? '&' : '?';
$target_url .= $separator . 'zrl=' . urlencode($visitor) . '&addr=' . urlencode($contact_url);
$this->logger->info('Redirecting with magic', ['target' => $target_url, 'visitor' => $visitor, 'contact' => $contact_url]);
- $this->app->redirect($target_url);
+ $this->appHelper->redirect($target_url);
}
/**
$this->checkUrl($contact_url, $url);
$target_url = $url ?: $contact_url;
- if (!empty($this->app->getContactId()) && $this->app->getContactId() == $cid) {
+ if (!empty($this->appHelper->getContactId()) && $this->appHelper->getContactId() == $cid) {
// Local user is already authenticated.
- $this->app->redirect($target_url);
+ $this->appHelper->redirect($target_url);
}
if ($contact['uid'] == 0 && $this->session->getLocalUserId()) {
$cid = $contact['id'];
}
- if (!empty($this->app->getContactId()) && $this->app->getContactId() == $cid) {
+ if (!empty($this->appHelper->getContactId()) && $this->appHelper->getContactId() == $cid) {
// Local user is already authenticated.
$this->logger->info('Contact already authenticated. Redirecting to target url', ['url' => $contact['url'], 'name' => $contact['name'], 'target_url' => $target_url]);
- $this->app->redirect($target_url);
+ $this->appHelper->redirect($target_url);
}
}
if (($host == $remotehost) && ($this->session->getRemoteContactID($this->session->get('visitor_visiting')) == $this->session->get('visitor_id'))) {
// Remote user is already authenticated.
$this->logger->info('Contact already authenticated. Redirecting to target url', ['url' => $contact['url'], 'name' => $contact['name'], 'target_url' => $target_url]);
- $this->app->redirect($target_url);
+ $this->appHelper->redirect($target_url);
}
}
}
$this->logger->info('redirecting to ' . $target_url);
- $this->app->redirect($target_url);
+ $this->appHelper->redirect($target_url);
}
namespace Friendica\Module\Item;
use DateTime;
-use Friendica\App;
+use Friendica\App\Arguments;
+use Friendica\App\BaseURL;
+use Friendica\App\Page;
+use Friendica\AppHelper;
use Friendica\BaseModule;
use Friendica\Content\Feature;
use Friendica\Core\ACL;
/** @var ACLFormatter */
private $ACLFormatter;
- /** @var App\Page */
+ /** @var Page */
private $page;
/** @var IManagePersonalConfigValues */
/** @var UserSession */
private $session;
- /** @var App */
- private $app;
+ /** @var AppHelper */
+ private $appHelper;
- public function __construct(App $app, UserSession $session, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, App\Page $page, ACLFormatter $ACLFormatter, SystemMessages $systemMessages, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
+ public function __construct(AppHelper $appHelper, UserSession $session, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, Page $page, ACLFormatter $ACLFormatter, SystemMessages $systemMessages, L10n $l10n, BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->pConfig = $pConfig;
$this->config = $config;
$this->session = $session;
- $this->app = $app;
+ $this->appHelper = $appHelper;
}
protected function post(array $request = [])
return Login::form('compose');
}
- if ($this->app->getCurrentTheme() !== 'frio') {
+ if ($this->appHelper->getCurrentTheme() !== 'frio') {
throw new NotImplementedException($this->l10n->t('This feature is only available with the frio theme.'));
}
$compose_title = $this->l10n->t('Compose new personal note');
$type = 'note';
$doesFederate = false;
- $contact_allow_list = [$this->app->getContactId()];
+ $contact_allow_list = [$this->appHelper->getContactId()];
$circle_allow_list = [];
$contact_deny_list = [];
$circle_deny_list = [];
$this->page->registerFooterScript(Theme::getPathForFile('js/linkPreview.js'));
$this->page->registerFooterScript(Theme::getPathForFile('js/compose.js'));
- $contact = Contact::getById($this->app->getContactId());
+ $contact = Contact::getById($this->appHelper->getContactId());
if ($this->pConfig->get($this->session->getLocalUserId(), 'system', 'set_creation_date')) {
$created_at = Temporal::getDateTimeField(
- new \DateTime(DBA::NULL_DATETIME),
- new \DateTime('now'),
+ new DateTime(DBA::NULL_DATETIME),
+ new DateTime('now'),
null,
$this->l10n->t('Created at'),
'created_at'
namespace Friendica\Module;
use Exception;
-use Friendica\App;
+use Friendica\App\Arguments;
+use Friendica\App\BaseURL;
+use Friendica\AppHelper;
use Friendica\BaseModule;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
*/
class Magic extends BaseModule
{
- /** @var App */
- protected $app;
+ /** @var AppHelper */
+ protected $appHelper;
/** @var Database */
protected $dba;
/** @var ICanSendHttpRequests */
/** @var IHandleUserSessions */
protected $userSession;
- public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Database $dba, ICanSendHttpRequests $httpClient, IHandleUserSessions $userSession, $server, array $parameters = [])
+ public function __construct(AppHelper $appHelper, L10n $l10n, BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Database $dba, ICanSendHttpRequests $httpClient, IHandleUserSessions $userSession, $server, array $parameters = [])
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
- $this->app = $app;
+ $this->appHelper = $appHelper;
$this->dba = $dba;
$this->httpClient = $httpClient;
$this->userSession = $userSession;
if (empty($contact)) {
if (!$owa) {
$this->logger->info('No contact record found, no oWA, redirecting to destination.', ['request' => $request, 'server' => $_SERVER, 'dest' => $dest]);
- $this->app->redirect($dest);
+ $this->appHelper->redirect($dest);
}
} else {
// Redirect if the contact is already authenticated on this site.
- if ($this->app->getContactId() && strpos($contact['nurl'], Strings::normaliseLink($this->baseUrl)) !== false) {
+ if ($this->appHelper->getContactId() && strpos($contact['nurl'], Strings::normaliseLink($this->baseUrl)) !== false) {
$this->logger->info('Contact is already authenticated, redirecting to destination.', ['dest' => $dest]);
System::externalRedirect($dest);
}
if (!$this->userSession->getLocalUserId() || !$owa) {
$this->logger->notice('Not logged in or not OWA, redirecting to destination.', ['uid' => $this->userSession->getLocalUserId(), 'owa' => $owa, 'dest' => $dest]);
- $this->app->redirect($dest);
+ $this->appHelper->redirect($dest);
}
$dest = Network::removeUrlParameter($dest, 'zid');
$dest = Network::removeUrlParameter($dest, 'f');
-
+
// OpenWebAuth
$owner = User::getOwnerDataById($this->userSession->getLocalUserId());
$j = json_decode($curlResult->getBodyString(), true);
if (empty($j) || !$j['success']) {
$this->logger->notice('Invalid JSON, redirecting to destination.', ['json' => $j, 'dest' => $dest]);
- $this->app->redirect($dest);
+ $this->appHelper->redirect($dest);
}
if ($j['encrypted_token']) {