Introduce new DI container
- Adding Friendica\DI class for getting dynamic classes - Replacing BaseObject::getApp() with this class
This commit is contained in:
parent
a9220aa83b
commit
1de3f186d7
132 changed files with 377 additions and 270 deletions
|
@ -37,7 +37,7 @@ $dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config
|
|||
$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['daemon']]);
|
||||
|
||||
\Friendica\BaseObject::setDependencyInjection($dice);
|
||||
$a = \Friendica\BaseObject::getApp();
|
||||
$a = \Friendica\DI::app();
|
||||
|
||||
if ($a->getMode()->isInstall()) {
|
||||
die("Friendica isn't properly installed yet.\n");
|
||||
|
|
|
@ -36,7 +36,7 @@ $dice = (new Dice())->addRules(include __DIR__ . '/../static/dependencies.config
|
|||
$dice = $dice->addRule(LoggerInterface::class,['constructParams' => ['worker']]);
|
||||
|
||||
BaseObject::setDependencyInjection($dice);
|
||||
$a = BaseObject::getApp();
|
||||
$a = Friendica\DI::app();
|
||||
|
||||
// Check the database structure and possibly fixes it
|
||||
Update::check($a->getBasePath(), true, $a->getMode());
|
||||
|
|
6
boot.php
6
boot.php
|
@ -23,8 +23,8 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Util\BasePath;
|
||||
|
@ -241,12 +241,12 @@ if (!defined('CURLE_OPERATION_TIMEDOUT')) {
|
|||
* Useful in functions which require it but don't get it passed to them
|
||||
*
|
||||
* @deprecated since version 2018.09
|
||||
* @see BaseObject::getApp()
|
||||
* @see DI::app()
|
||||
* @return App
|
||||
*/
|
||||
function get_app()
|
||||
{
|
||||
return BaseObject::getApp();
|
||||
return DI::app();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1370,7 +1370,7 @@ function api_get_item(array $condition)
|
|||
*/
|
||||
function api_users_show($type)
|
||||
{
|
||||
$a = BaseObject::getApp();
|
||||
$a = Friendica\DI::app();
|
||||
|
||||
$user_info = api_get_user($a);
|
||||
|
||||
|
@ -2968,7 +2968,7 @@ function api_format_items_profiles($profile_row)
|
|||
*/
|
||||
function api_format_items($items, $user_info, $filter_user = false, $type = "json")
|
||||
{
|
||||
$a = BaseObject::getApp();
|
||||
$a = Friendica\DI::app();
|
||||
|
||||
$ret = [];
|
||||
|
||||
|
@ -3002,7 +3002,7 @@ function api_format_items($items, $user_info, $filter_user = false, $type = "jso
|
|||
*/
|
||||
function api_format_item($item, $type = "json", $status_user = null, $author_user = null, $owner_user = null)
|
||||
{
|
||||
$a = BaseObject::getApp();
|
||||
$a = Friendica\DI::app();
|
||||
|
||||
if (empty($status_user) || empty($author_user) || empty($owner_user)) {
|
||||
list($status_user, $author_user, $owner_user) = api_item_get_user($a, $item);
|
||||
|
|
|
@ -344,7 +344,7 @@ function drop_items(array $items)
|
|||
|
||||
function drop_item($id, $return = '')
|
||||
{
|
||||
$a = BaseObject::getApp();
|
||||
$a = Friendica\DI::app();
|
||||
|
||||
// locate item to be deleted
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ $dice = $dice->addRule(Friendica\App\Mode::class, ['call' => [['determineRunMode
|
|||
|
||||
\Friendica\BaseObject::setDependencyInjection($dice);
|
||||
|
||||
$a = \Friendica\BaseObject::getApp();
|
||||
$a = \Friendica\DI::app();
|
||||
|
||||
$a->runFrontend(
|
||||
$dice->create(\Friendica\App\Module::class),
|
||||
|
|
|
@ -31,18 +31,7 @@ class BaseObject
|
|||
public static function setDependencyInjection(Dice $dice)
|
||||
{
|
||||
self::$dice = $dice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the app
|
||||
*
|
||||
* Same as get_app from boot.php
|
||||
*
|
||||
* @return App
|
||||
*/
|
||||
public static function getApp()
|
||||
{
|
||||
return self::getClass(App::class);
|
||||
DI::init($dice);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,7 +57,7 @@ HELP;
|
|||
|
||||
protected function doExecute()
|
||||
{
|
||||
$a = \Friendica\BaseObject::getApp();
|
||||
$a = \Friendica\DI::app();
|
||||
|
||||
if ($this->getOption($this->helpOptions)) {
|
||||
$this->out($this->getHelp());
|
||||
|
|
|
@ -19,6 +19,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Event;
|
||||
use Friendica\Model\Photo;
|
||||
|
@ -1093,7 +1094,7 @@ class BBCode extends BaseObject
|
|||
$text = Cache::get($cache_key);
|
||||
|
||||
if (is_null($text)) {
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$stamp1 = microtime(true);
|
||||
|
||||
|
@ -1149,7 +1150,7 @@ class BBCode extends BaseObject
|
|||
|
||||
private static function cleanPictureLinksCallback($match)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// When the picture link is the own photo path then we can avoid fetching the link
|
||||
$own_photo_url = preg_quote(Strings::normaliseLink($a->getBaseURL()) . '/photos/');
|
||||
|
@ -1253,7 +1254,7 @@ class BBCode extends BaseObject
|
|||
*/
|
||||
public static function convert($text, $try_oembed = true, $simple_html = 0, $for_plaintext = false)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
/*
|
||||
* preg_match_callback function to replace potential Oembed tags with Oembed content
|
||||
|
@ -2010,7 +2011,7 @@ class BBCode extends BaseObject
|
|||
*/
|
||||
public static function toMarkdown($text, $for_diaspora = true)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$original_text = $text;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace Friendica\Content\Text;
|
|||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +44,7 @@ class Markdown extends BaseObject
|
|||
|
||||
$html = $MarkdownParser->transform($text);
|
||||
|
||||
self::getApp()->getProfiler()->saveTimestamp($stamp1, "parser", System::callstack());
|
||||
DI::app()->getProfiler()->saveTimestamp($stamp1, "parser", System::callstack());
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Friendica\Core;
|
|||
use Friendica\App\Page;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
|
||||
|
@ -35,7 +36,7 @@ class ACL extends BaseObject
|
|||
*/
|
||||
public static function getSuggestContactSelectHTML($selname, $selclass, array $options = [], array $preselected = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$networks = null;
|
||||
|
||||
|
@ -145,7 +146,7 @@ class ACL extends BaseObject
|
|||
*/
|
||||
public static function getMessageContactSelectHTML($selname, $selclass, array $preselected = [], $size = 4, $tabindex = null)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$o = '';
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace Friendica\Core;
|
|||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
/**
|
||||
|
@ -177,7 +178,7 @@ class Addon extends BaseObject
|
|||
@include_once('addon/' . $addon . '/' . $addon . '.php');
|
||||
if (function_exists($addon . '_install')) {
|
||||
$func = $addon . '_install';
|
||||
$func(self::getApp());
|
||||
$func(DI::app());
|
||||
|
||||
$addon_admin = (function_exists($addon . "_addon_admin") ? 1 : 0);
|
||||
|
||||
|
@ -234,11 +235,11 @@ class Addon extends BaseObject
|
|||
|
||||
if (function_exists($addon . '_uninstall')) {
|
||||
$func = $addon . '_uninstall';
|
||||
$func(self::getApp());
|
||||
$func(DI::app());
|
||||
}
|
||||
if (function_exists($addon . '_install')) {
|
||||
$func = $addon . '_install';
|
||||
$func(self::getApp());
|
||||
$func(DI::app());
|
||||
}
|
||||
DBA::update('addon', ['timestamp' => $t], ['id' => $i['id']]);
|
||||
}
|
||||
|
@ -267,7 +268,7 @@ class Addon extends BaseObject
|
|||
*/
|
||||
public static function getInfo($addon)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$addon = Strings::sanitizeFilePathItem($addon);
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace Friendica\Core;
|
|||
use Friendica\App;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
/**
|
||||
|
@ -75,7 +76,7 @@ class Hook extends BaseObject
|
|||
*/
|
||||
public static function register($hook, $file, $function, $priority = 0)
|
||||
{
|
||||
$file = str_replace(self::getApp()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
$file = str_replace(DI::app()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
|
||||
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
|
||||
if (DBA::exists('hook', $condition)) {
|
||||
|
@ -98,7 +99,7 @@ class Hook extends BaseObject
|
|||
*/
|
||||
public static function unregister($hook, $file, $function)
|
||||
{
|
||||
$relative_file = str_replace(self::getApp()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
$relative_file = str_replace(DI::app()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
|
||||
|
||||
// This here is only needed for fixing a problem that existed on the develop branch
|
||||
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
|
||||
|
@ -148,7 +149,7 @@ class Hook extends BaseObject
|
|||
if ($hook[0] != $fork_hook[0]) {
|
||||
continue;
|
||||
}
|
||||
self::callSingle(self::getApp(), 'hook_fork', $fork_hook, $hookdata);
|
||||
self::callSingle(DI::app(), 'hook_fork', $fork_hook, $hookdata);
|
||||
}
|
||||
|
||||
if (!$hookdata['execute']) {
|
||||
|
@ -175,7 +176,7 @@ class Hook extends BaseObject
|
|||
{
|
||||
if (array_key_exists($name, self::$hooks)) {
|
||||
foreach (self::$hooks[$name] as $hook) {
|
||||
self::callSingle(self::getApp(), $name, $hook, $data);
|
||||
self::callSingle(DI::app(), $name, $hook, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace Friendica\Core;
|
|||
|
||||
use Exception;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\DI;
|
||||
use Friendica\Render\FriendicaSmarty;
|
||||
use Friendica\Render\ITemplateEngine;
|
||||
|
||||
|
@ -61,7 +62,7 @@ class Renderer extends BaseObject
|
|||
public static function replaceMacros($s, array $vars = [])
|
||||
{
|
||||
$stamp1 = microtime(true);
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// pass $baseurl to all templates if it isn't set
|
||||
$vars = array_merge(['$baseurl' => $a->getBaseURL()], $vars);
|
||||
|
@ -92,7 +93,7 @@ class Renderer extends BaseObject
|
|||
public static function getMarkupTemplate($s, $root = '')
|
||||
{
|
||||
$stamp1 = microtime(true);
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
$t = self::getTemplateEngine();
|
||||
|
||||
try {
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Core;
|
|||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -92,7 +93,7 @@ class Search extends BaseObject
|
|||
*/
|
||||
public static function getContactsFromGlobalDirectory($search, $type = self::TYPE_ALL, $page = 1)
|
||||
{
|
||||
$config = self::getApp()->getConfig();
|
||||
$config = DI::app()->getConfig();
|
||||
$server = $config->get('system', 'directory', self::DEFAULT_DIRECTORY);
|
||||
|
||||
$searchUrl = $server . '/search';
|
||||
|
@ -158,7 +159,7 @@ class Search extends BaseObject
|
|||
*/
|
||||
public static function getContactsFromLocalDirectory($search, $type = self::TYPE_ALL, $start = 0, $itemPage = 80)
|
||||
{
|
||||
$config = self::getApp()->getConfig();
|
||||
$config = DI::app()->getConfig();
|
||||
|
||||
$diaspora = $config->get('system', 'diaspora_enabled') ? Protocol::DIASPORA : Protocol::DFRN;
|
||||
$ostatus = !$config->get('system', 'ostatus_disabled') ? Protocol::OSTATUS : Protocol::DFRN;
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Friendica\Core;
|
|||
|
||||
use Friendica\App\BaseURL;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
|
@ -43,7 +44,7 @@ class System extends BaseObject
|
|||
*/
|
||||
public static function removedBaseUrl(string $orig_url)
|
||||
{
|
||||
return self::getApp()->removeBaseURL($orig_url);
|
||||
return DI::app()->removeBaseURL($orig_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -184,7 +185,7 @@ class System extends BaseObject
|
|||
if (is_bool($prefix) && !$prefix) {
|
||||
$prefix = '';
|
||||
} elseif (empty($prefix)) {
|
||||
$prefix = hash('crc32', self::getApp()->getHostName());
|
||||
$prefix = hash('crc32', DI::app()->getHostName());
|
||||
}
|
||||
|
||||
while (strlen($prefix) < ($size - 13)) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -194,7 +195,7 @@ class Theme
|
|||
*/
|
||||
public static function getPathForFile($file)
|
||||
{
|
||||
$a = BaseObject::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$theme = $a->getCurrentTheme();
|
||||
|
||||
|
@ -232,7 +233,7 @@ class Theme
|
|||
return 'view/theme/' . $theme . '/style.css';
|
||||
}
|
||||
|
||||
$a = BaseObject::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$query_params = [];
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace Friendica\Core;
|
|||
use Friendica\BaseObject;
|
||||
use Friendica\Core;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Process;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -1232,11 +1233,11 @@ class Worker
|
|||
*/
|
||||
public static function defer()
|
||||
{
|
||||
if (empty(BaseObject::getApp()->queue)) {
|
||||
if (empty(DI::app()->queue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$queue = BaseObject::getApp()->queue;
|
||||
$queue = DI::app()->queue;
|
||||
|
||||
$retrial = $queue['retrial'];
|
||||
$id = $queue['id'];
|
||||
|
|
33
src/DI.php
Normal file
33
src/DI.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica;
|
||||
|
||||
use Dice\Dice;
|
||||
|
||||
/**
|
||||
* This class is capable of getting all dynamic created classes
|
||||
*
|
||||
* There has to be a "method" phpDoc for each new class, containing result class for a proper matching
|
||||
*
|
||||
* @method static App app()
|
||||
*/
|
||||
class DI
|
||||
{
|
||||
/** @var Dice */
|
||||
private static $dice;
|
||||
|
||||
public static function init(Dice $dice)
|
||||
{
|
||||
self::$dice = $dice;
|
||||
}
|
||||
|
||||
public static function __callStatic($name, $arguments)
|
||||
{
|
||||
switch ($name) {
|
||||
case 'app':
|
||||
return self::$dice->create(App::class, $arguments);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -67,7 +67,7 @@ class LegacyModule extends BaseModule
|
|||
$function_name = static::$moduleName . '_' . $function_suffix;
|
||||
|
||||
if (\function_exists($function_name)) {
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
return $function_name($a);
|
||||
} else {
|
||||
return parent::{$function_suffix}($parameters);
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Core\StorageManager;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Storage\IStorage;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -31,7 +32,7 @@ class Attach extends BaseObject
|
|||
*/
|
||||
private static function getFields()
|
||||
{
|
||||
$allfields = DBStructure::definition(self::getApp()->getBasePath(), false);
|
||||
$allfields = DBStructure::definition(DI::app()->getBasePath(), false);
|
||||
$fields = array_keys($allfields['attach']['fields']);
|
||||
array_splice($fields, array_search('data', $fields), 1);
|
||||
return $fields;
|
||||
|
|
|
@ -16,6 +16,7 @@ use Friendica\Core\Session;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\Activity;
|
||||
|
@ -1733,7 +1734,7 @@ class Contact extends BaseObject
|
|||
*/
|
||||
public static function getPostsFromUrl($contact_url, $thread_mode = false, $update = 0)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$cid = self::getIdForURL($contact_url);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ use Friendica\Core\Session;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
|
@ -2513,7 +2514,7 @@ class Item extends BaseObject
|
|||
$guid = System::createUUID();
|
||||
}
|
||||
|
||||
return self::getApp()->getBaseURL() . '/objects/' . $guid;
|
||||
return DI::app()->getBaseURL() . '/objects/' . $guid;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3474,7 +3475,7 @@ class Item extends BaseObject
|
|||
*/
|
||||
private static function addRedirToImageTags(array &$item)
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
$matches = [];
|
||||
$cnt = preg_match_all('|\[img\](http[^\[]*?/photo/[a-fA-F0-9]+?(-[0-9]\.[\w]+?)?)\[\/img\]|', $item['body'], $matches, PREG_SET_ORDER);
|
||||
|
@ -3509,7 +3510,7 @@ class Item extends BaseObject
|
|||
*/
|
||||
public static function prepareBody(array &$item, $attach = false, $is_preview = false)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
Hook::callAll('prepare_body_init', $item);
|
||||
|
||||
// In order to provide theme developers more possibilities, event items
|
||||
|
@ -3647,7 +3648,7 @@ class Item extends BaseObject
|
|||
*/
|
||||
public static function getPlink($item)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->user['nickname'] != "") {
|
||||
$ret = [
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Model;
|
|||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Model interaction for the nodeinfo
|
||||
|
@ -18,7 +19,7 @@ class Nodeinfo extends BaseObject
|
|||
*/
|
||||
public static function update()
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$config = $app->getConfig();
|
||||
$logger = $app->getLogger();
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\L10n\L10n;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
|
@ -515,7 +516,7 @@ final class Notify extends BaseObject
|
|||
$ident = self::PERSONAL;
|
||||
$notifies = [];
|
||||
|
||||
$myurl = str_replace('http://', '', self::getApp()->contact['nurl']);
|
||||
$myurl = str_replace('http://', '', DI::app()->contact['nurl']);
|
||||
$diasp_url = str_replace('/profile/', '/u/', $myurl);
|
||||
|
||||
$condition = ["NOT `wall` AND `uid` = ? AND (`item`.`author-id` = ? OR `item`.`tag` REGEXP ? OR `item`.`tag` REGEXP ?)",
|
||||
|
@ -669,7 +670,7 @@ final class Notify extends BaseObject
|
|||
// We have to distinguish between these two because they use different data.
|
||||
// Contact suggestions
|
||||
if ($intro['fid']) {
|
||||
$return_addr = bin2hex(self::getApp()->user['nickname'] . '@' .
|
||||
$return_addr = bin2hex(DI::app()->user['nickname'] . '@' .
|
||||
$this->baseUrl->getHostName() .
|
||||
(($this->baseUrl->getURLPath()) ? '/' . $this->baseUrl->getURLPath() : ''));
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use Friendica\Core\StorageManager;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Storage\IStorage;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -202,7 +203,7 @@ class Photo extends BaseObject
|
|||
*/
|
||||
private static function getFields()
|
||||
{
|
||||
$allfields = DBStructure::definition(self::getApp()->getBasePath(), false);
|
||||
$allfields = DBStructure::definition(DI::app()->getBasePath(), false);
|
||||
$fields = array_keys($allfields["photo"]["fields"]);
|
||||
array_splice($fields, array_search("data", $fields), 1);
|
||||
return $fields;
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\Content\Text\Markdown;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -15,7 +16,7 @@ class Details extends BaseAdminModule
|
|||
{
|
||||
parent::post($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
|
@ -39,7 +40,7 @@ class Details extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$addons_admin = Addon::getAdminList();
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module\Admin\Addons;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
|
||||
class Index extends BaseAdminModule
|
||||
|
@ -13,7 +14,7 @@ class Index extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// reload active themes
|
||||
if (!empty($_GET['action'])) {
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\Content\Pager;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
use Friendica\Model;
|
||||
|
||||
|
@ -38,14 +39,14 @@ class Contact extends BaseAdminModule
|
|||
notice(L10n::tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
|
||||
}
|
||||
|
||||
self::getApp()->internalRedirect('admin/blocklist/contact');
|
||||
DI::app()->internalRedirect('admin/blocklist/contact');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$condition = ['uid' => 0, 'blocked' => true];
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module\Admin\Blocklist;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -47,14 +48,14 @@ class Server extends BaseAdminModule
|
|||
info(L10n::t('Site blocklist updated.') . EOL);
|
||||
}
|
||||
|
||||
self::getApp()->internalRedirect('admin/blocklist/server');
|
||||
DI::app()->internalRedirect('admin/blocklist/server');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$blocklist = Config::get('system', 'blocklist');
|
||||
$blocklistform = [];
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\Renderer;
|
|||
use Friendica\Core\Update;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
|
||||
class DBSync extends BaseAdminModule
|
||||
|
@ -16,7 +17,7 @@ class DBSync extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$o = '';
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\Content\Feature;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
|
||||
class Features extends BaseAdminModule
|
||||
|
@ -39,7 +40,7 @@ class Features extends BaseAdminModule
|
|||
}
|
||||
}
|
||||
|
||||
self::getApp()->internalRedirect('admin/features');
|
||||
DI::app()->internalRedirect('admin/features');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Module\Admin\Item;
|
|||
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -33,7 +34,7 @@ class Delete extends BaseAdminModule
|
|||
}
|
||||
|
||||
info(L10n::t('Item marked for deletion.') . EOL);
|
||||
self::getApp()->internalRedirect('admin/item/delete');
|
||||
DI::app()->internalRedirect('admin/item/delete');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Module\Admin\Item;
|
|||
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
|
||||
|
@ -17,7 +18,7 @@ class Source extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$guid = null;
|
||||
// @TODO: Replace with parameter from router
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module\Admin\Logs;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
use Friendica\Util\Strings;
|
||||
use Psr\Log\LogLevel;
|
||||
|
@ -34,14 +35,14 @@ class Settings extends BaseAdminModule
|
|||
}
|
||||
|
||||
info(L10n::t("Log settings updated."));
|
||||
self::getApp()->internalRedirect('admin/logs');
|
||||
DI::app()->internalRedirect('admin/logs');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$log_choices = [
|
||||
LogLevel::ERROR => 'Error',
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module\Admin;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
use Friendica\Util\Arrays;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -23,7 +24,7 @@ class Queue extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
$deferred = $a->argc > 2 && $a->argv[2] == 'deferred';
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\StorageManager;
|
|||
use Friendica\Core\Theme;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
use Friendica\Module\Register;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
|
@ -27,7 +28,7 @@ class Site extends BaseAdminModule
|
|||
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/site', 'admin_site');
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (!empty($_POST['republish_directory'])) {
|
||||
Worker::add(PRIORITY_LOW, 'Directory');
|
||||
|
@ -416,7 +417,7 @@ class Site extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
/* Installed langs */
|
||||
$lang_choices = L10n::getAvailableLanguages();
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\Renderer;
|
|||
use Friendica\Core\Update;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Register;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
|
@ -24,7 +25,7 @@ class Summary extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// are there MyISAM tables in the DB? If so, trigger a warning message
|
||||
$warningtext = [];
|
||||
|
@ -208,7 +209,7 @@ class Summary extends BaseAdminModule
|
|||
private static function checkSelfHostMeta()
|
||||
{
|
||||
// Fetch the host-meta to check if this really is a vital server
|
||||
return Network::curl(self::getApp()->getBaseURL() . '/.well-known/host-meta')->isSuccess();
|
||||
return Network::curl(DI::app()->getBaseURL() . '/.well-known/host-meta')->isSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\Content\Text\Markdown;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -15,7 +16,7 @@ class Details extends BaseAdminModule
|
|||
{
|
||||
parent::post($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
|
@ -43,7 +44,7 @@ class Details extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Module\Admin\Themes;
|
|||
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -11,7 +12,7 @@ class Embed extends BaseAdminModule
|
|||
{
|
||||
public static function init(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
|
@ -27,7 +28,7 @@ class Embed extends BaseAdminModule
|
|||
{
|
||||
parent::post($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
|
@ -57,7 +58,7 @@ class Embed extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 2) {
|
||||
// @TODO: Replace with parameter from router
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -15,7 +16,7 @@ class Index extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$allowed_themes = Theme::getAllowedList();
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module\Admin;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
|
||||
class Tos extends BaseAdminModule
|
||||
|
@ -29,7 +30,7 @@ class Tos extends BaseAdminModule
|
|||
|
||||
info(L10n::t('The Terms of Service settings have been updated.'));
|
||||
|
||||
self::getApp()->internalRedirect('admin/tos');
|
||||
DI::app()->internalRedirect('admin/tos');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Register;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseAdminModule;
|
||||
|
@ -19,7 +20,7 @@ class Users extends BaseAdminModule
|
|||
{
|
||||
parent::post($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$pending = $_POST['pending'] ?? [];
|
||||
$users = $_POST['user'] ?? [];
|
||||
|
@ -135,7 +136,7 @@ class Users extends BaseAdminModule
|
|||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc > 3) {
|
||||
// @TODO: Replace with parameter from router
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\Content\ContactSelector;
|
|||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
|
@ -18,7 +19,7 @@ class AllFriends extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
if (!local_user()) {
|
||||
throw new HTTPException\ForbiddenException();
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\Content\Nav;
|
|||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Shows the App menu
|
||||
|
@ -17,7 +18,7 @@ class Apps extends BaseModule
|
|||
{
|
||||
$privateaddons = Config::get('config', 'private_addons');
|
||||
if ($privateaddons === "1" && !local_user()) {
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Attach as MAttach;
|
||||
|
||||
/**
|
||||
|
@ -22,7 +23,7 @@ class Attach extends BaseModule
|
|||
*/
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
if ($a->argc != 2) {
|
||||
throw new \Friendica\Network\HTTPException\BadRequestException();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module\Base;
|
|||
use Friendica\App\Arguments;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
require_once __DIR__ . '/../../../include/api.php';
|
||||
|
@ -41,7 +42,7 @@ class Api extends BaseModule
|
|||
throw new HTTPException\UnauthorizedException(L10n::t('Permission denied.'));
|
||||
}
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (!empty($a->user['uid']) && $a->user['uid'] != api_user()) {
|
||||
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));
|
||||
|
@ -67,7 +68,7 @@ class Api extends BaseModule
|
|||
*/
|
||||
protected static function login()
|
||||
{
|
||||
api_login(self::getApp());
|
||||
api_login(DI::app());
|
||||
|
||||
self::$current_user_id = api_user();
|
||||
|
||||
|
@ -86,7 +87,7 @@ class Api extends BaseModule
|
|||
*/
|
||||
protected static function getUser($contact_id = null)
|
||||
{
|
||||
return api_get_user(self::getApp(), $contact_id);
|
||||
return api_get_user(DI::app(), $contact_id);
|
||||
}
|
||||
|
||||
protected static function format($root_element, $data)
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException\ForbiddenException;
|
||||
|
||||
require_once 'boot.php';
|
||||
|
@ -50,7 +51,7 @@ abstract class BaseAdminModule extends BaseModule
|
|||
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (!is_site_admin()) {
|
||||
notice(L10n::t('Please login to continue.'));
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\Content\Pager;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Search;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Object\Search\ContactResult;
|
||||
|
@ -33,7 +34,7 @@ class BaseSearchModule extends BaseModule
|
|||
*/
|
||||
public static function performContactSearch($search, $prefix = '')
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
$config = $a->getConfig();
|
||||
|
||||
$type = Search::TYPE_ALL;
|
||||
|
@ -97,7 +98,7 @@ class BaseSearchModule extends BaseModule
|
|||
return '';
|
||||
}
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$id = 0;
|
||||
$entries = [];
|
||||
|
|
|
@ -6,12 +6,13 @@ use Friendica\BaseModule;
|
|||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
class BaseSettingsModule extends BaseModule
|
||||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('settings/head.tpl');
|
||||
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\ACL;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -19,7 +20,7 @@ class Bookmarklet extends BaseModule
|
|||
{
|
||||
$_GET['mode'] = 'minimal';
|
||||
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$config = $app->getConfig();
|
||||
|
||||
if (!local_user()) {
|
||||
|
|
|
@ -17,6 +17,7 @@ use Friendica\Core\Renderer;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Network\HTTPException\BadRequestException;
|
||||
|
@ -78,7 +79,7 @@ class Contact extends BaseModule
|
|||
|
||||
public static function post(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (!local_user()) {
|
||||
return;
|
||||
|
@ -247,7 +248,7 @@ class Contact extends BaseModule
|
|||
return Login::form($_SERVER['REQUEST_URI']);
|
||||
}
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$nets = $_GET['nets'] ?? '';
|
||||
$rel = $_GET['rel'] ?? '';
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module\Debug;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Protocol;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -18,7 +19,7 @@ class Feed extends BaseModule
|
|||
{
|
||||
if (!local_user()) {
|
||||
info(L10n::t('You must be logged in to use this module'));
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Module\Debug;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
|
@ -18,7 +19,7 @@ class ItemBody extends BaseModule
|
|||
throw new HTTPException\UnauthorizedException(L10n::t('Access denied.'));
|
||||
}
|
||||
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
$itemId = (($app->argc > 1) ? intval($app->argv[1]) : 0);
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module\Debug;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Installer;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
|
@ -17,13 +18,13 @@ class Localtime extends BaseModule
|
|||
$bd_format = L10n::t('l F d, Y \@ g:i A');
|
||||
|
||||
if (!empty($_POST['timezone'])) {
|
||||
self::getApp()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
|
||||
DI::app()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
|
||||
}
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
$time = ($_REQUEST['time'] ?? '') ?: 'now';
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPException\ForbiddenException;
|
||||
|
@ -25,7 +26,7 @@ class Delegation extends BaseModule
|
|||
}
|
||||
|
||||
$uid = local_user();
|
||||
$orig_record = self::getApp()->user;
|
||||
$orig_record = DI::app()->user;
|
||||
|
||||
if (Session::get('submanage')) {
|
||||
$user = User::getById(Session::get('submanage'));
|
||||
|
@ -82,7 +83,7 @@ class Delegation extends BaseModule
|
|||
|
||||
/** @var Authentication $authentication */
|
||||
$authentication = self::getClass(Authentication::class);
|
||||
$authentication->setForUser(self::getApp(), $user, true, true);
|
||||
$authentication->setForUser(DI::app(), $user, true, true);
|
||||
|
||||
if ($limited_id) {
|
||||
Session::set('submanage', $original_id);
|
||||
|
@ -91,7 +92,7 @@ class Delegation extends BaseModule
|
|||
$ret = [];
|
||||
Hook::callAll('home_init', $ret);
|
||||
|
||||
self::getApp()->internalRedirect('profile/' . self::getApp()->user['nickname']);
|
||||
DI::app()->internalRedirect('profile/' . DI::app()->user['nickname']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -101,7 +102,7 @@ class Delegation extends BaseModule
|
|||
throw new ForbiddenException(L10n::t('Permission denied.'));
|
||||
}
|
||||
|
||||
$identities = self::getApp()->identities;
|
||||
$identities = DI::app()->identities;
|
||||
|
||||
//getting additinal information for each identity
|
||||
foreach ($identities as $key => $identity) {
|
||||
|
@ -112,7 +113,7 @@ class Delegation extends BaseModule
|
|||
|
||||
$identities[$key]['thumb'] = $thumb['thumb'];
|
||||
|
||||
$identities[$key]['selected'] = ($identity['nickname'] === self::getApp()->user['nickname']);
|
||||
$identities[$key]['selected'] = ($identity['nickname'] === DI::app()->user['nickname']);
|
||||
|
||||
$condition = ["`uid` = ? AND `msg` != '' AND NOT (`type` IN (?, ?)) AND NOT `seen`", $identity['uid'], NOTIFY_INTRO, NOTIFY_MAIL];
|
||||
$params = ['distinct' => true, 'expression' => 'parent'];
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module\Diaspora;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -19,7 +20,7 @@ class Fetch extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if (($app->argc != 3) || (!in_array($app->argv[1], ["post", "status_message", "reshare"]))) {
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -23,7 +24,7 @@ class Directory extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$config = $app->getConfig();
|
||||
|
||||
if (($config->get('system', 'block_public') && !Session::isAuthenticated()) ||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Protocol\OStatus;
|
||||
|
||||
/**
|
||||
|
@ -25,7 +26,7 @@ class Feed extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$last_update = $_GET['last_update'] ?? '';
|
||||
$nocache = !empty($_GET['nocache']) && local_user();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Module\Filer;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\FileTag;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\XML;
|
||||
|
@ -18,7 +19,7 @@ class RemoveTag extends BaseModule
|
|||
throw new HTTPException\ForbiddenException();
|
||||
}
|
||||
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$logger = $app->getLogger();
|
||||
|
||||
$item_id = (($app->argc > 1) ? intval($app->argv[1]) : 0);
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
|
@ -18,13 +19,13 @@ class SaveTag extends BaseModule
|
|||
{
|
||||
if (!local_user()) {
|
||||
info(L10n::t('You must be logged in to use this module'));
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
}
|
||||
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
$logger = $a->getLogger();
|
||||
|
||||
$term = XML::unescape(trim($_GET['term'] ?? ''));
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Module;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Model\Introduction;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Process follow request confirmations
|
||||
|
@ -12,7 +13,7 @@ class FollowConfirm extends BaseModule
|
|||
{
|
||||
public static function post(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$uid = local_user();
|
||||
if (!$uid) {
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Friendica\Module;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
||||
|
@ -16,7 +17,7 @@ class Followers extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if (empty($a->argv[1])) {
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Friendica\Module;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
||||
|
@ -16,7 +17,7 @@ class Following extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if (empty($a->argv[1])) {
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
|
||||
/**
|
||||
|
@ -17,7 +18,7 @@ class Friendica extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$config = $app->getConfig();
|
||||
|
||||
$visibleAddonList = Addon::getVisibleList();
|
||||
|
@ -90,7 +91,7 @@ class Friendica extends BaseModule
|
|||
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if ($app->argc <= 1 || ($app->argv[1] !== 'json')) {
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -21,7 +22,7 @@ class Group extends BaseModule
|
|||
{
|
||||
public static function post(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->isAjax()) {
|
||||
self::ajaxPost();
|
||||
|
@ -71,7 +72,7 @@ class Group extends BaseModule
|
|||
public static function ajaxPost()
|
||||
{
|
||||
try {
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (!local_user()) {
|
||||
throw new \Exception(L10n::t('Permission denied.'), 403);
|
||||
|
@ -134,7 +135,7 @@ class Group extends BaseModule
|
|||
throw new \Friendica\Network\HTTPException\ForbiddenException();
|
||||
}
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$a->page['aside'] = Model\Group::sidebarWidget('contact', 'group', 'extended', (($a->argc > 1) ? $a->argv[1] : 'everyone'));
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -21,7 +22,7 @@ class Help extends BaseModule
|
|||
$text = '';
|
||||
$filename = '';
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
$config = $a->getConfig();
|
||||
$lang = $config->get('system', 'language');
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Security\Login;
|
||||
|
||||
/**
|
||||
|
@ -15,7 +16,7 @@ class Home extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$config = $app->getConfig();
|
||||
|
||||
// currently no returned data is used
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -21,7 +22,7 @@ class Inbox extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$postdata = Network::postdata();
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core;
|
|||
use Friendica\Core\Config\Cache\ConfigCache;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\BasePath;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -48,7 +49,7 @@ class Install extends BaseModule
|
|||
|
||||
public static function init(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (!$a->getMode()->isInstall()) {
|
||||
throw new HTTPException\ForbiddenException();
|
||||
|
@ -78,7 +79,7 @@ class Install extends BaseModule
|
|||
|
||||
public static function post(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
$configCache = $a->getConfigCache();
|
||||
|
||||
switch (self::$currentWizardStep) {
|
||||
|
@ -151,7 +152,7 @@ class Install extends BaseModule
|
|||
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
$configCache = $a->getConfigCache();
|
||||
|
||||
$output = '';
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Protocol\Email;
|
||||
|
@ -24,7 +25,7 @@ class Invite extends BaseModule
|
|||
|
||||
self::checkFormSecurityTokenRedirectOnError('/', 'send_invite');
|
||||
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$config = $app->getConfig();
|
||||
|
||||
$max_invites = intval($config->get('system', 'max_invites'));
|
||||
|
@ -110,7 +111,7 @@ class Invite extends BaseModule
|
|||
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));
|
||||
}
|
||||
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$config = $app->getConfig();
|
||||
|
||||
$inviteOnly = false;
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\Renderer;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Theme;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\FileTag;
|
||||
use Friendica\Model\Group;
|
||||
|
@ -29,7 +30,7 @@ class Compose extends BaseModule
|
|||
if (!empty($_REQUEST['body'])) {
|
||||
$_REQUEST['return'] = 'network';
|
||||
require_once 'mod/item.php';
|
||||
item_post(self::getApp());
|
||||
item_post(DI::app());
|
||||
} else {
|
||||
notice(L10n::t('Please enter a post body.'));
|
||||
}
|
||||
|
@ -41,7 +42,7 @@ class Compose extends BaseModule
|
|||
return Login::form('compose', false);
|
||||
}
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->getCurrentTheme() !== 'frio') {
|
||||
throw new NotImplementedException(L10n::t('This feature is only available with the frio theme.'));
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\L10n\L10n;
|
|||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
|
@ -69,7 +70,7 @@ class Ignore extends BaseModule
|
|||
$rand = "?$rand";
|
||||
}
|
||||
|
||||
self::getApp()->internalRedirect($return_path . $rand);
|
||||
DI::app()->internalRedirect($return_path . $rand);
|
||||
}
|
||||
|
||||
// the json doesn't really matter, it will either be 0 or 1
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -25,7 +26,7 @@ class Like extends BaseModule
|
|||
$verb = 'like';
|
||||
}
|
||||
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
$itemId = (($app->argc > 1) ? Strings::escapeTags(trim($app->argv[1])) : 0);
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -22,7 +23,7 @@ class Magic extends BaseModule
|
|||
{
|
||||
public static function init(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
$ret = ['success' => false, 'url' => '', 'message' => ''];
|
||||
Logger::log('magic mdule: invoked', Logger::DEBUG);
|
||||
|
||||
|
@ -48,7 +49,7 @@ class Magic extends BaseModule
|
|||
$contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
|
||||
|
||||
// Redirect if the contact is already authenticated on this site.
|
||||
if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], Strings::normaliseLink(self::getApp()->getBaseURL())) !== false) {
|
||||
if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], Strings::normaliseLink(DI::app()->getBaseURL())) !== false) {
|
||||
if ($test) {
|
||||
$ret['success'] = true;
|
||||
$ret['message'] .= 'Local site - you are already authenticated.' . EOL;
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -16,7 +17,7 @@ class Maintenance extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$config = self::getApp()->getConfig();
|
||||
$config = DI::app()->getConfig();
|
||||
|
||||
$reason = $config->get('system', 'maintenance_reason');
|
||||
|
||||
|
|
|
@ -4,12 +4,13 @@ namespace Friendica\Module;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
class Manifest extends BaseModule
|
||||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$config = $app->getConfig();
|
||||
|
||||
$tpl = Renderer::getMarkupTemplate('manifest.tpl');
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\App;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Standardized way of exposing metadata about a server running one of the distributed social networks.
|
||||
|
@ -15,7 +16,7 @@ class NodeInfo extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
if ($parameters['version'] == '1.0') {
|
||||
self::printNodeInfo1($app);
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\BaseObject;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Notify as ModelNotify;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
|
@ -23,7 +24,7 @@ class Notify extends BaseModule
|
|||
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if ($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all') {
|
||||
|
@ -47,7 +48,7 @@ class Notify extends BaseModule
|
|||
*/
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if ($a->argc > 2 && $a->argv[1] === 'view' && intval($a->argv[2])) {
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace Friendica\Module;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
||||
|
@ -17,7 +18,7 @@ class Objects extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (empty($a->argv[1])) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Module;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
/**
|
||||
|
@ -19,7 +20,7 @@ class Oembed extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// Unused form: /oembed/b2h?url=...
|
||||
if ($a->argv[1] == 'b2h') {
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module;
|
|||
use DOMDocument;
|
||||
use DOMElement;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
/**
|
||||
|
@ -20,8 +21,8 @@ class OpenSearch extends BaseModule
|
|||
{
|
||||
header('Content-type: application/opensearchdescription+xml');
|
||||
|
||||
$hostname = self::getApp()->getHostName();
|
||||
$baseUrl = self::getApp()->getBaseURL();
|
||||
$hostname = DI::app()->getHostName();
|
||||
$baseUrl = DI::app()->getBaseURL();
|
||||
|
||||
/** @var DOMDocument $xml */
|
||||
$xml = null;
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Friendica\Module;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
||||
|
@ -16,7 +17,7 @@ class Outbox extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if (empty($a->argv[1])) {
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Photo as MPhoto;
|
||||
use Friendica\Object\Image;
|
||||
|
||||
|
@ -25,7 +26,7 @@ class Photo extends BaseModule
|
|||
*/
|
||||
public static function init(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
// @TODO: Replace with parameter from router
|
||||
if ($a->argc <= 1 || $a->argc > 4) {
|
||||
throw new \Friendica\Network\HTTPException\BadRequestException();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
|
||||
/**
|
||||
|
@ -30,7 +31,7 @@ class Pinned extends BaseModule
|
|||
$returnPath = $_REQUEST['return'] ?? '';
|
||||
if (!empty($returnPath)) {
|
||||
$rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand';
|
||||
self::getApp()->internalRedirect($returnPath . $rand);
|
||||
DI::app()->internalRedirect($returnPath . $rand);
|
||||
}
|
||||
|
||||
// the json doesn't really matter, it will either be 0 or 1
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact as ContactModel;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Item;
|
||||
|
@ -36,7 +37,7 @@ class Profile extends BaseModule
|
|||
|
||||
public static function init(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if ($a->argc < 2) {
|
||||
|
@ -78,7 +79,7 @@ class Profile extends BaseModule
|
|||
|
||||
public static function content(array $parameters = [], $update = 0)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (!$update) {
|
||||
ProfileModel::load($a, self::$which, self::$profile);
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
|
@ -24,7 +25,7 @@ class Contacts extends BaseModule
|
|||
throw new \Friendica\Network\HTTPException\NotFoundException(L10n::t('User not found.'));
|
||||
}
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
//@TODO: Get value from router parameters
|
||||
$nickname = $a->argv[1];
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
|
@ -33,7 +34,7 @@ class Proxy extends BaseModule
|
|||
public static function init(array $parameters = [])
|
||||
{
|
||||
// Set application instance here
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
/*
|
||||
* Pictures are stored in one of the following ways:
|
||||
|
@ -156,7 +157,7 @@ class Proxy extends BaseModule
|
|||
*/
|
||||
private static function getRequestInfo()
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
$size = 1024;
|
||||
$sizetype = '';
|
||||
|
||||
|
@ -230,7 +231,7 @@ class Proxy extends BaseModule
|
|||
*/
|
||||
private static function setupDirectCache()
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
$basepath = $a->getBasePath();
|
||||
|
||||
// If the cache path isn't there, try to create it
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Module;
|
|||
|
||||
use ASN_BASE;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPException\BadRequestException;
|
||||
|
||||
|
@ -14,7 +15,7 @@ class PublicRSAKey extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if ($app->argc !== 2) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
|
||||
|
@ -13,7 +14,7 @@ class RandomProfile extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$contactUrl = GContact::getRandomUrl();
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
/**
|
||||
|
@ -15,7 +16,7 @@ class ReallySimpleDiscovery extends BaseModule
|
|||
{
|
||||
header('Content-Type: text/xml');
|
||||
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$xml = null;
|
||||
echo XML::fromArray([
|
||||
'rsd' => [
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -123,7 +124,7 @@ class Register extends BaseModule
|
|||
'$ask_password' => $ask_password,
|
||||
'$password1' => ['password1', L10n::t('New Password:'), '', L10n::t('Leave empty for an auto generated password.')],
|
||||
'$password2' => ['confirm', L10n::t('Confirm:'), '', ''],
|
||||
'$nickdesc' => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "<strong>nickname@%s</strong>".', self::getApp()->getHostName()),
|
||||
'$nickdesc' => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "<strong>nickname@%s</strong>".', DI::app()->getHostName()),
|
||||
'$nicklabel' => L10n::t('Choose a nickname: '),
|
||||
'$photo' => $photo,
|
||||
'$publish' => $profile_publish,
|
||||
|
@ -131,7 +132,7 @@ class Register extends BaseModule
|
|||
'$username' => $username,
|
||||
'$email' => $email,
|
||||
'$nickname' => $nickname,
|
||||
'$sitename' => self::getApp()->getHostName(),
|
||||
'$sitename' => DI::app()->getHostName(),
|
||||
'$importh' => L10n::t('Import'),
|
||||
'$importt' => L10n::t('Import your profile to this friendica instance'),
|
||||
'$showtoslink' => Config::get('system', 'tosdisplay'),
|
||||
|
@ -156,7 +157,7 @@ class Register extends BaseModule
|
|||
{
|
||||
BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register');
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$arr = ['post' => $_POST];
|
||||
Hook::callAll('register_post', $arr);
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Module\Search;
|
|||
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseSearchModule;
|
||||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -22,7 +23,7 @@ class Directory extends BaseSearchModule
|
|||
|
||||
$search = Strings::escapeTags(trim(rawurldecode($_REQUEST['search'] ?? '')));
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (empty($a->page['aside'])) {
|
||||
$a->page['aside'] = '';
|
||||
|
|
|
@ -16,6 +16,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Term;
|
||||
|
@ -68,7 +69,7 @@ class Index extends BaseSearchModule
|
|||
}
|
||||
|
||||
if (local_user()) {
|
||||
self::getApp()->page['aside'] .= Widget\SavedSearches::getHTML('search?q=' . urlencode($search), $search);
|
||||
DI::app()->page['aside'] .= Widget\SavedSearches::getHTML('search?q=' . urlencode($search), $search);
|
||||
}
|
||||
|
||||
Nav::setSelected('search');
|
||||
|
@ -190,7 +191,7 @@ class Index extends BaseSearchModule
|
|||
|
||||
Logger::info('Start Conversation.', ['q' => $search]);
|
||||
|
||||
$o .= conversation(self::getApp(), $r, $pager, 'search', false, false, 'commented', local_user());
|
||||
$o .= conversation(DI::app(), $r, $pager, 'search', false, false, 'commented', local_user());
|
||||
|
||||
$o .= $pager->renderMinimal(count($r));
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\App\Arguments;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
class Saved extends BaseModule
|
||||
|
@ -39,6 +40,6 @@ class Saved extends BaseModule
|
|||
}
|
||||
}
|
||||
|
||||
self::getApp()->internalRedirect($return_url);
|
||||
DI::app()->internalRedirect($return_url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Register;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
|
@ -25,7 +26,7 @@ class Login extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (local_user()) {
|
||||
$a->internalRedirect();
|
||||
|
@ -57,7 +58,7 @@ class Login extends BaseModule
|
|||
/** @var Authentication $authentication */
|
||||
$authentication = self::getClass(Authentication::class);
|
||||
$authentication->withPassword(
|
||||
self::getApp(),
|
||||
DI::app(),
|
||||
trim($_POST['username']),
|
||||
trim($_POST['password']),
|
||||
!empty($_POST['remember'])
|
||||
|
@ -81,7 +82,7 @@ class Login extends BaseModule
|
|||
*/
|
||||
public static function form($return_path = null, $register = false, $hiddens = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
$o = '';
|
||||
|
||||
$noid = Config::get('system', 'no_openid');
|
||||
|
@ -133,7 +134,7 @@ class Login extends BaseModule
|
|||
$o .= Renderer::replaceMacros(
|
||||
$tpl,
|
||||
[
|
||||
'$dest_url' => self::getApp()->getBaseURL(true) . '/login',
|
||||
'$dest_url' => DI::app()->getBaseURL(true) . '/login',
|
||||
'$logout' => L10n::t('Logout'),
|
||||
'$login' => L10n::t('Login'),
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Profile;
|
||||
|
||||
/**
|
||||
|
@ -39,7 +40,7 @@ class Logout extends BaseModule
|
|||
System::externalRedirect($visitor_home);
|
||||
} else {
|
||||
info(L10n::t('Logged out.'));
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\App\Authentication;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\TwoFactor\RecoveryCode;
|
||||
|
||||
/**
|
||||
|
@ -32,7 +33,7 @@ class Recovery extends BaseModule
|
|||
if (($_POST['action'] ?? '') == 'recover') {
|
||||
self::checkFormSecurityTokenRedirectOnError('2fa', 'twofactor_recovery');
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$recovery_code = $_POST['recovery_code'] ?? '';
|
||||
|
||||
|
@ -54,12 +55,12 @@ class Recovery extends BaseModule
|
|||
public static function content(array $parameters = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
|
||||
// Already authenticated with 2FA token
|
||||
if (Session::get('2fa')) {
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/recovery.tpl'), [
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use PragmaRX\Google2FA\Google2FA;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +29,7 @@ class Verify extends BaseModule
|
|||
if (($_POST['action'] ?? '') == 'verify') {
|
||||
self::checkFormSecurityTokenRedirectOnError('2fa', 'twofactor_verify');
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$code = $_POST['verify_code'] ?? '';
|
||||
|
||||
|
@ -51,12 +52,12 @@ class Verify extends BaseModule
|
|||
public static function content(array $parameters = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
|
||||
// Already authenticated with 2FA token
|
||||
if (Session::get('2fa')) {
|
||||
self::getApp()->internalRedirect();
|
||||
DI::app()->internalRedirect();
|
||||
}
|
||||
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/verify.tpl'), [
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\Renderer;
|
|||
use Friendica\Core\Session;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseSettingsModule;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -22,7 +23,7 @@ class Delegation extends BaseSettingsModule
|
|||
{
|
||||
public static function post(array $parameters = [])
|
||||
{
|
||||
if (!local_user() || !empty(self::getApp()->user['uid']) && self::getApp()->user['uid'] != local_user()) {
|
||||
if (!local_user() || !empty(DI::app()->user['uid']) && DI::app()->user['uid'] != local_user()) {
|
||||
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));
|
||||
}
|
||||
|
||||
|
@ -64,7 +65,7 @@ class Delegation extends BaseSettingsModule
|
|||
if ($action === 'add' && $user_id) {
|
||||
if (Session::get('submanage')) {
|
||||
notice(L10n::t('Delegated administrators can view but not change delegation permissions.'));
|
||||
self::getApp()->internalRedirect('settings/delegation');
|
||||
DI::app()->internalRedirect('settings/delegation');
|
||||
}
|
||||
|
||||
$user = User::getById($user_id, ['nickname']);
|
||||
|
@ -80,17 +81,17 @@ class Delegation extends BaseSettingsModule
|
|||
notice(L10n::t('Delegate user not found.'));
|
||||
}
|
||||
|
||||
self::getApp()->internalRedirect('settings/delegation');
|
||||
DI::app()->internalRedirect('settings/delegation');
|
||||
}
|
||||
|
||||
if ($action === 'remove' && $user_id) {
|
||||
if (Session::get('submanage')) {
|
||||
notice(L10n::t('Delegated administrators can view but not change delegation permissions.'));
|
||||
self::getApp()->internalRedirect('settings/delegation');
|
||||
DI::app()->internalRedirect('settings/delegation');
|
||||
}
|
||||
|
||||
DBA::delete('manage', ['uid' => $user_id, 'mid' => local_user()]);
|
||||
self::getApp()->internalRedirect('settings/delegation');
|
||||
DI::app()->internalRedirect('settings/delegation');
|
||||
}
|
||||
|
||||
// find everybody that currently has delegated management to this account/page
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace Friendica\Module\Settings\TwoFactor;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\TwoFactor\AppSpecificPassword;
|
||||
use Friendica\Module\BaseSettingsModule;
|
||||
use Friendica\Module\Security\Login;
|
||||
|
@ -29,12 +30,12 @@ class AppSpecific extends BaseSettingsModule
|
|||
$verified = PConfig::get(local_user(), '2fa', 'verified');
|
||||
|
||||
if (!$verified) {
|
||||
self::getApp()->internalRedirect('settings/2fa');
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice(L10n::t('Please enter your password to access this page.'));
|
||||
self::getApp()->internalRedirect('settings/2fa');
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,10 +53,10 @@ class AppSpecific extends BaseSettingsModule
|
|||
$description = $_POST['description'] ?? '';
|
||||
if (empty($description)) {
|
||||
notice(L10n::t('App-specific password generation failed: The description is empty.'));
|
||||
self::getApp()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
} elseif (AppSpecificPassword::checkDuplicateForUser(local_user(), $description)) {
|
||||
notice(L10n::t('App-specific password generation failed: This description already exists.'));
|
||||
self::getApp()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
} else {
|
||||
self::$appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
|
||||
notice(L10n::t('New app-specific password generated.'));
|
||||
|
@ -65,7 +66,7 @@ class AppSpecific extends BaseSettingsModule
|
|||
case 'revoke_all' :
|
||||
AppSpecificPassword::deleteAllForUser(local_user());
|
||||
notice(L10n::t('App-specific passwords successfully revoked.'));
|
||||
self::getApp()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +78,7 @@ class AppSpecific extends BaseSettingsModule
|
|||
notice(L10n::t('App-specific password successfully revoked.'));
|
||||
}
|
||||
|
||||
self::getApp()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\TwoFactor\AppSpecificPassword;
|
||||
use Friendica\Model\TwoFactor\RecoveryCode;
|
||||
use Friendica\Model\User;
|
||||
|
@ -38,7 +39,7 @@ class Index extends BaseSettingsModule
|
|||
|
||||
PConfig::set(local_user(), '2fa', 'secret', $Google2FA->generateSecretKey(32));
|
||||
|
||||
self::getApp()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
break;
|
||||
case 'disable':
|
||||
|
@ -49,22 +50,22 @@ class Index extends BaseSettingsModule
|
|||
Session::remove('2fa');
|
||||
|
||||
notice(L10n::t('Two-factor authentication successfully disabled.'));
|
||||
self::getApp()->internalRedirect('settings/2fa');
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
}
|
||||
break;
|
||||
case 'recovery':
|
||||
if ($has_secret) {
|
||||
self::getApp()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
break;
|
||||
case 'app_specific':
|
||||
if ($has_secret) {
|
||||
self::getApp()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
break;
|
||||
case 'configure':
|
||||
if (!$verified) {
|
||||
self::getApp()->internalRedirect('settings/2fa/verify?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::app()->internalRedirect('settings/2fa/verify?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace Friendica\Module\Settings\TwoFactor;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\TwoFactor\RecoveryCode;
|
||||
use Friendica\Module\BaseSettingsModule;
|
||||
use Friendica\Module\Security\Login;
|
||||
|
@ -27,12 +28,12 @@ class Recovery extends BaseSettingsModule
|
|||
$secret = PConfig::get(local_user(), '2fa', 'secret');
|
||||
|
||||
if (!$secret) {
|
||||
self::getApp()->internalRedirect('settings/2fa');
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice(L10n::t('Please enter your password to access this page.'));
|
||||
self::getApp()->internalRedirect('settings/2fa');
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +49,7 @@ class Recovery extends BaseSettingsModule
|
|||
if ($_POST['action'] == 'regenerate') {
|
||||
RecoveryCode::regenerateForUser(local_user());
|
||||
notice(L10n::t('New recovery codes successfully generated.'));
|
||||
self::getApp()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseSettingsModule;
|
||||
use Friendica\Module\Security\Login;
|
||||
use PragmaRX\Google2FA\Google2FA;
|
||||
|
@ -34,12 +35,12 @@ class Verify extends BaseSettingsModule
|
|||
$verified = PConfig::get(local_user(), '2fa', 'verified');
|
||||
|
||||
if ($secret && $verified) {
|
||||
self::getApp()->internalRedirect('settings/2fa');
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice(L10n::t('Please enter your password to access this page.'));
|
||||
self::getApp()->internalRedirect('settings/2fa');
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +63,7 @@ class Verify extends BaseSettingsModule
|
|||
|
||||
notice(L10n::t('Two-factor authentication successfully activated.'));
|
||||
|
||||
self::getApp()->internalRedirect('settings/2fa');
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
} else {
|
||||
notice(L10n::t('Invalid code, please retry.'));
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Core\Renderer;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\DBStructure;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\BaseSettingsModule;
|
||||
|
||||
/**
|
||||
|
@ -65,18 +66,18 @@ class UserExport extends BaseSettingsModule
|
|||
if ($args->getArgc() == 3) {
|
||||
// @TODO Replace with router-provided arguments
|
||||
$action = $args->get(2);
|
||||
$user = self::getApp()->user;
|
||||
$user = DI::app()->user;
|
||||
switch ($action) {
|
||||
case "backup":
|
||||
header("Content-type: application/json");
|
||||
header('Content-Disposition: attachment; filename="' . $user['nickname'] . '.' . $action . '"');
|
||||
self::exportAll(self::getApp());
|
||||
self::exportAll(DI::app());
|
||||
exit();
|
||||
break;
|
||||
case "account":
|
||||
header("Content-type: application/json");
|
||||
header('Content-Disposition: attachment; filename="' . $user['nickname'] . '.' . $action . '"');
|
||||
self::exportAccount(self::getApp());
|
||||
self::exportAccount(DI::app());
|
||||
exit();
|
||||
break;
|
||||
case "contact":
|
||||
|
@ -92,7 +93,7 @@ class UserExport extends BaseSettingsModule
|
|||
}
|
||||
private static function exportMultiRow(string $query)
|
||||
{
|
||||
$dbStructure = DBStructure::definition(self::getApp()->getBasePath(), false);
|
||||
$dbStructure = DBStructure::definition(DI::app()->getBasePath(), false);
|
||||
|
||||
preg_match("/\s+from\s+`?([a-z\d_]+)`?/i", $query, $match);
|
||||
$table = $match[1];
|
||||
|
@ -119,7 +120,7 @@ class UserExport extends BaseSettingsModule
|
|||
|
||||
private static function exportRow(string $query)
|
||||
{
|
||||
$dbStructure = DBStructure::definition(self::getApp()->getBasePath(), false);
|
||||
$dbStructure = DBStructure::definition(DI::app()->getBasePath(), false);
|
||||
|
||||
preg_match("/\s+from\s+`?([a-z\d_]+)`?/i", $query, $match);
|
||||
$table = $match[1];
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Content;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Prints the possible Smilies of this node
|
||||
|
@ -14,7 +15,7 @@ class Smilies extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
if (!empty($app->argv[1]) && ($app->argv[1] === "json")) {
|
||||
$smilies = Content\Smilies::getList();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
|
||||
/**
|
||||
|
@ -35,7 +36,7 @@ class Starred extends BaseModule
|
|||
$returnPath = $_REQUEST['return'] ?? '';
|
||||
if (!empty($returnPath)) {
|
||||
$rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand';
|
||||
self::getApp()->internalRedirect($returnPath . $rand);
|
||||
DI::app()->internalRedirect($returnPath . $rand);
|
||||
}
|
||||
|
||||
// the json doesn't really matter, it will either be 0 or 1
|
||||
|
|
|
@ -5,12 +5,13 @@ namespace Friendica\Module;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
||||
class Statistics extends BaseModule
|
||||
{
|
||||
public static function init(array $parameters = [])
|
||||
{
|
||||
$config = self::getApp()->getConfig();
|
||||
$config = DI::app()->getConfig();
|
||||
|
||||
if (!$config->get("system", "nodeinfo")) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
|
@ -19,8 +20,8 @@ class Statistics extends BaseModule
|
|||
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$config = self::getApp()->getConfig();
|
||||
$logger = self::getApp()->getLogger();
|
||||
$config = DI::app()->getConfig();
|
||||
$logger = DI::app()->getLogger();
|
||||
|
||||
$registration_open =
|
||||
intval($config->get('config', 'register_policy')) !== Register::CLOSED
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
|
||||
/**
|
||||
|
@ -14,7 +15,7 @@ class Theme extends BaseModule
|
|||
{
|
||||
header("Content-Type: text/css");
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ($a->argc == 4) {
|
||||
$theme = $a->argv[2];
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Toggles the mobile view (on/off)
|
||||
|
@ -11,7 +12,7 @@ class ToggleMobile extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (isset($_GET['off'])) {
|
||||
$_SESSION['show-mobile'] = false;
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\DI;
|
||||
|
||||
class Tos extends BaseModule
|
||||
{
|
||||
|
@ -50,7 +51,7 @@ class Tos extends BaseModule
|
|||
public static function init(array $parameters = [])
|
||||
{
|
||||
if (strlen(Config::get('system','singleuser'))) {
|
||||
self::getApp()->internalRedirect('profile/' . Config::get('system','singleuser'));
|
||||
DI::app()->internalRedirect('profile/' . Config::get('system','singleuser'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Module;
|
|||
use Friendica\BaseModule;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Prints the welcome page for new users
|
||||
|
@ -13,7 +14,7 @@ class Welcome extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$config = self::getApp()->getConfig();
|
||||
$config = DI::app()->getConfig();
|
||||
|
||||
$mail_disabled = ((function_exists('imap_open') &&
|
||||
(!$config->get('system', 'imap_disabled'))));
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Module\WellKnown;
|
|||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\DI;
|
||||
use Friendica\Protocol\Salmon;
|
||||
use Friendica\Util\Crypto;
|
||||
|
||||
|
@ -15,7 +16,7 @@ class HostMeta extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$config = $app->getConfig();
|
||||
|
||||
header('Content-type: text/xml');
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace Friendica\Module\WellKnown;
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* Standardized way of exposing metadata about a server running one of the distributed social networks.
|
||||
|
@ -13,7 +14,7 @@ class NodeInfo extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
self::printWellKnown($app);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Friendica\Module\WellKnown;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Search;
|
||||
|
||||
/**
|
||||
|
@ -13,7 +14,7 @@ class XSocialRelay extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
$config = $app->getConfig();
|
||||
|
||||
$subscribe = $config->get('system', 'relay_subscribe', false);
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\ActivityNamespace;
|
||||
|
@ -19,7 +20,7 @@ class Xrd extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$app = self::getApp();
|
||||
$app = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if ($app->argv[0] == 'xrd') {
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\App\Authentication;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use OAuthServer;
|
||||
use OAuthSignatureMethod_HMAC_SHA1;
|
||||
use OAuthSignatureMethod_PLAINTEXT;
|
||||
|
@ -37,7 +38,7 @@ class FKOAuth1 extends OAuthServer
|
|||
public function loginUser($uid)
|
||||
{
|
||||
Logger::log("FKOAuth1::loginUser $uid");
|
||||
$a = BaseObject::getApp();
|
||||
$a = DI::app();
|
||||
$record = DBA::selectFirst('user', [], ['uid' => $uid, 'blocked' => 0, 'account_expired' => 0, 'account_removed' => 0, 'verified' => 1]);
|
||||
|
||||
if (!DBA::isResult($record)) {
|
||||
|
|
|
@ -18,6 +18,7 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Term;
|
||||
|
@ -121,7 +122,7 @@ class Post extends BaseObject
|
|||
*/
|
||||
public function getTemplateData(array $conv_responses, $thread_level = 1)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$item = $this->getData();
|
||||
$edited = false;
|
||||
|
@ -815,7 +816,7 @@ class Post extends BaseObject
|
|||
*/
|
||||
private function getDefaultText()
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if (!local_user()) {
|
||||
return '';
|
||||
|
@ -862,7 +863,7 @@ class Post extends BaseObject
|
|||
*/
|
||||
private function getCommentBox($indent)
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$comment_box = '';
|
||||
$conv = $this->getThread();
|
||||
|
@ -945,7 +946,7 @@ class Post extends BaseObject
|
|||
*/
|
||||
protected function checkWallToWall()
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
$conv = $this->getThread();
|
||||
$this->wall_to_wall = false;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace Friendica\Object;
|
|||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\DI;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\Security;
|
||||
|
||||
|
@ -52,7 +53,7 @@ class Thread extends BaseObject
|
|||
return;
|
||||
}
|
||||
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
switch ($mode) {
|
||||
case 'network':
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\APContact;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
|
@ -204,7 +205,7 @@ class Transmitter
|
|||
{
|
||||
return ['type' => 'Service',
|
||||
'name' => FRIENDICA_PLATFORM . " '" . FRIENDICA_CODENAME . "' " . FRIENDICA_VERSION . '-' . DB_UPDATE_VERSION,
|
||||
'url' => BaseObject::getApp()->getBaseURL()];
|
||||
'url' => DI::app()->getBaseURL()];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\BaseObject;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
use Imagick;
|
||||
|
||||
/**
|
||||
|
@ -165,7 +166,7 @@ class Images
|
|||
|
||||
$stamp1 = microtime(true);
|
||||
file_put_contents($tempfile, $img_str);
|
||||
BaseObject::getApp()->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
|
||||
DI::app()->getProfiler()->saveTimestamp($stamp1, "file", System::callstack());
|
||||
|
||||
$data = getimagesize($tempfile);
|
||||
unlink($tempfile);
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Friendica\Util;
|
|||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\DI;
|
||||
|
||||
/**
|
||||
* @brief Proxy utilities class
|
||||
|
@ -63,7 +64,7 @@ class Proxy
|
|||
public static function proxifyUrl($url, $writemode = false, $size = '')
|
||||
{
|
||||
// Get application instance
|
||||
$a = BaseObject::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// Trim URL first
|
||||
$url = trim($url);
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
@ -19,7 +20,7 @@ class Cron
|
|||
{
|
||||
public static function execute()
|
||||
{
|
||||
$a = BaseObject::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$last = Config::get('system', 'last_cron');
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ use Friendica\Core\StorageManager;
|
|||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Database\PostUpdate;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\GServer;
|
||||
|
@ -29,7 +30,7 @@ class CronJobs
|
|||
{
|
||||
public static function execute($command = '')
|
||||
{
|
||||
$a = BaseObject::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
// No parameter set? So return
|
||||
if ($command == '') {
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace Friendica\Worker;
|
|||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Update;
|
||||
use Friendica\DI;
|
||||
|
||||
class DBUpdate extends BaseObject
|
||||
{
|
||||
|
@ -15,7 +16,7 @@ class DBUpdate extends BaseObject
|
|||
{
|
||||
// Just in case the last update wasn't failed
|
||||
if (Config::get('system', 'update', Update::SUCCESS, true) != Update::FAILED) {
|
||||
Update::run(self::getApp()->getBasePath());
|
||||
Update::run(DI::app()->getBasePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
|
@ -140,7 +141,7 @@ class Delivery extends BaseObject
|
|||
// if $parent['wall'] == 1 we will already have the parent message in our array
|
||||
// and we will relay the whole lot.
|
||||
|
||||
$localhost = self::getApp()->getHostName();
|
||||
$localhost = DI::app()->getHostName();
|
||||
if (strpos($localhost, ':')) {
|
||||
$localhost = substr($localhost, 0, strpos($localhost, ':'));
|
||||
}
|
||||
|
@ -548,7 +549,7 @@ class Delivery extends BaseObject
|
|||
$headers = 'From: ' . Email::encodeHeader($local_user['username'],'UTF-8') . ' <' . $local_user['email'] . '>' . "\n";
|
||||
}
|
||||
} else {
|
||||
$headers = 'From: '. Email::encodeHeader($local_user['username'], 'UTF-8') . ' <noreply@' . self::getApp()->getHostName() . '>' . "\n";
|
||||
$headers = 'From: '. Email::encodeHeader($local_user['username'], 'UTF-8') . ' <noreply@' . DI::app()->getHostName() . '>' . "\n";
|
||||
}
|
||||
|
||||
$headers .= 'Message-Id: <' . Email::iri2msgid($target_item['uri']) . '>' . "\n";
|
||||
|
|
|
@ -12,13 +12,14 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Item;
|
||||
|
||||
class Expire
|
||||
{
|
||||
public static function execute($param = '', $hook_function = '')
|
||||
{
|
||||
$a = BaseObject::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
Hook::loadHooks();
|
||||
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
namespace Friendica\Worker;
|
||||
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
|
||||
Class ForkHook
|
||||
{
|
||||
public static function execute($name, $hook, $data)
|
||||
{
|
||||
$a = \Friendica\BaseObject::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
Hook::callSingle($a, $name, $hook, $data);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\APContact;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Conversation;
|
||||
|
@ -41,7 +42,7 @@ class Notifier
|
|||
{
|
||||
public static function execute($cmd, $target_id)
|
||||
{
|
||||
$a = BaseObject::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
Logger::info('Invoked', ['cmd' => $cmd, 'target' => $target_id]);
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ namespace Friendica\Worker;
|
|||
use Friendica\BaseObject;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\DI;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
||||
|
@ -18,7 +19,7 @@ class ProfileUpdate {
|
|||
return;
|
||||
}
|
||||
|
||||
$a = BaseObject::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
$inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser($uid);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use Friendica\Core\Session;
|
|||
use Friendica\Core\Session\ISession;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Test\Util\Database\StaticDatabase;
|
||||
|
@ -87,7 +88,7 @@ class ApiTest extends DatabaseTest
|
|||
$this->loadFixture(__DIR__ . '/../datasets/api.fixture.php', $dba);
|
||||
|
||||
/** @var App app */
|
||||
$this->app = BaseObject::getApp();
|
||||
$this->app = DI::app();
|
||||
|
||||
$this->app->argc = 1;
|
||||
$this->app->argv = ['home'];
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* BaseObjectTest class.
|
||||
*/
|
||||
|
||||
namespace Friendica\Test\src;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Test\Util\AppMockTrait;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Tests for the BaseObject class.
|
||||
*/
|
||||
class BaseObjectTest extends TestCase
|
||||
{
|
||||
use VFSTrait;
|
||||
use AppMockTrait;
|
||||
|
||||
/**
|
||||
* @var BaseObject
|
||||
*/
|
||||
private $baseObject;
|
||||
|
||||
/**
|
||||
* Test the getApp() function without App
|
||||
* @expectedException Friendica\Network\HTTPException\InternalServerErrorException
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testGetAppFailed()
|
||||
{
|
||||
BaseObject::getApp();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue