[various] Remove App dependency from hook functions

pull/1351/head
Hypolite Petovan 2023-01-13 21:16:09 -05:00
parent b53914ee11
commit 39c654da00
87 changed files with 419 additions and 451 deletions

View File

@ -55,7 +55,7 @@ use Symfony\Component\ExpressionLanguage;
require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
function advancedcontentfilter_install(App $a) function advancedcontentfilter_install()
{ {
Hook::register('dbstructure_definition' , __FILE__, 'advancedcontentfilter_dbstructure_definition'); Hook::register('dbstructure_definition' , __FILE__, 'advancedcontentfilter_dbstructure_definition');
Hook::register('prepare_body_content_filter', __FILE__, 'advancedcontentfilter_prepare_body_content_filter'); Hook::register('prepare_body_content_filter', __FILE__, 'advancedcontentfilter_prepare_body_content_filter');
@ -71,7 +71,7 @@ function advancedcontentfilter_install(App $a)
* Hooks * Hooks
*/ */
function advancedcontentfilter_dbstructure_definition(App $a, &$database) function advancedcontentfilter_dbstructure_definition(&$database)
{ {
$database['advancedcontentfilter_rules'] = [ $database['advancedcontentfilter_rules'] = [
'comment' => 'Advancedcontentfilter addon rules', 'comment' => 'Advancedcontentfilter addon rules',
@ -115,7 +115,7 @@ function advancedcontentfilter_get_filter_fields(array $item)
return $vars; return $vars;
} }
function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data) function advancedcontentfilter_prepare_body_content_filter(&$hook_data)
{ {
static $expressionLanguage; static $expressionLanguage;
@ -163,7 +163,7 @@ function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
} }
function advancedcontentfilter_addon_settings(App $a, array &$data) function advancedcontentfilter_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -187,7 +187,7 @@ function advancedcontentfilter_addon_settings(App $a, array &$data)
*/ */
function advancedcontentfilter_module() {} function advancedcontentfilter_module() {}
function advancedcontentfilter_init(App $a) function advancedcontentfilter_init()
{ {
if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'api') { if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'api') {
$slim = new \Slim\App(); $slim = new \Slim\App();
@ -201,7 +201,7 @@ function advancedcontentfilter_init(App $a)
} }
} }
function advancedcontentfilter_content(App $a) function advancedcontentfilter_content()
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return Login::form('/' . implode('/', DI::args()->getArgv())); return Login::form('/' . implode('/', DI::args()->getArgv()));
@ -252,7 +252,7 @@ function advancedcontentfilter_content(App $a)
'rule_expression' => DI::l10n()->t('Rule Expression'), 'rule_expression' => DI::l10n()->t('Rule Expression'),
'cancel' => DI::l10n()->t('Cancel'), 'cancel' => DI::l10n()->t('Cancel'),
], ],
'$current_theme' => $a->getCurrentTheme(), '$current_theme' => DI::app()->getCurrentTheme(),
'$rules' => advancedcontentfilter_get_rules(), '$rules' => advancedcontentfilter_get_rules(),
'$form_security_token' => BaseModule::getFormSecurityToken() '$form_security_token' => BaseModule::getFormSecurityToken()
]); ]);

View File

@ -34,7 +34,7 @@ function birdavatar_install()
/** /**
* Bird avatar user settings page * Bird avatar user settings page
*/ */
function birdavatar_addon_settings(App $a, array &$data) function birdavatar_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -62,7 +62,7 @@ function birdavatar_addon_settings(App $a, array &$data)
/** /**
* Bird avatar user settings POST handle * Bird avatar user settings POST handle
*/ */
function birdavatar_addon_settings_post(App $a, &$s) function birdavatar_addon_settings_post(&$s)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -114,10 +114,9 @@ function birdavatar_addon_settings_post(App $a, &$s)
/** /**
* Returns the URL to the bird avatar * Returns the URL to the bird avatar
* *
* @param $a array
* @param &$b array * @param &$b array
*/ */
function birdavatar_lookup(App $a, array &$b) function birdavatar_lookup(array &$b)
{ {
$user = DBA::selectFirst('user', ['uid'], ['email' => $b['email']]); $user = DBA::selectFirst('user', ['uid'], ['email' => $b['email']]);
if (DBA::isResult($user)) { if (DBA::isResult($user)) {
@ -149,7 +148,7 @@ function birdavatar_module() {}
* @throws NotFoundException * @throws NotFoundException
* *
*/ */
function birdavatar_content(App $a) function birdavatar_content()
{ {
if (DI::args()->getArgc() < 2 || DI::args()->getArgc() > 3) { if (DI::args()->getArgc() < 2 || DI::args()->getArgc() > 3) {
throw new NotFoundException(); // this should be catched on index and show default "not found" page. throw new NotFoundException(); // this should be catched on index and show default "not found" page.

View File

@ -55,7 +55,7 @@ function blackout_install() {
Hook::register('page_header', 'addon/blackout/blackout.php', 'blackout_redirect'); Hook::register('page_header', 'addon/blackout/blackout.php', 'blackout_redirect');
} }
function blackout_redirect (App $a, $b) function blackout_redirect ($b)
{ {
// if we have a logged in user, don't throw her out // if we have a logged in user, don't throw her out
if (DI::userSession()->getLocalUserId()) { if (DI::userSession()->getLocalUserId()) {
@ -83,7 +83,7 @@ function blackout_redirect (App $a, $b)
} }
} }
function blackout_addon_admin(App $a, string &$o) function blackout_addon_admin(string &$o)
{ {
$mystart = DI::config()->get('blackout','begindate'); $mystart = DI::config()->get('blackout','begindate');
if (! is_string($mystart)) { $mystart = 'YYYY-MM-DD hh:mm'; } if (! is_string($mystart)) { $mystart = 'YYYY-MM-DD hh:mm'; }
@ -112,7 +112,7 @@ function blackout_addon_admin(App $a, string &$o)
]); ]);
} }
function blackout_addon_admin_post (App $a) function blackout_addon_admin_post ()
{ {
DI::config()->set('blackout', 'begindate', trim($_POST['startdate'])); DI::config()->set('blackout', 'begindate', trim($_POST['startdate']));
DI::config()->set('blackout', 'enddate', trim($_POST['enddate'])); DI::config()->set('blackout', 'enddate', trim($_POST['enddate']));

View File

@ -24,7 +24,7 @@ function blockbot_install()
Hook::register('init_1', __FILE__, 'blockbot_init_1'); Hook::register('init_1', __FILE__, 'blockbot_init_1');
} }
function blockbot_addon_admin(App $a, string &$o) function blockbot_addon_admin(string &$o)
{ {
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/blockbot/'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/blockbot/');
@ -36,14 +36,14 @@ function blockbot_addon_admin(App $a, string &$o)
]); ]);
} }
function blockbot_addon_admin_post(App $a) function blockbot_addon_admin_post()
{ {
DI::config()->set('blockbot', 'good_crawlers', $_POST['good_crawlers'] ?? false); DI::config()->set('blockbot', 'good_crawlers', $_POST['good_crawlers'] ?? false);
DI::config()->set('blockbot', 'block_gab', $_POST['block_gab'] ?? false); DI::config()->set('blockbot', 'block_gab', $_POST['block_gab'] ?? false);
DI::config()->set('blockbot', 'training', $_POST['training'] ?? false); DI::config()->set('blockbot', 'training', $_POST['training'] ?? false);
} }
function blockbot_init_1(App $a) function blockbot_init_1()
{ {
if (empty($_SERVER['HTTP_USER_AGENT'])) { if (empty($_SERVER['HTTP_USER_AGENT'])) {
return; return;

View File

@ -27,7 +27,7 @@ function blockem_install()
Hook::register('enotify_store' , 'addon/blockem/blockem.php', 'blockem_enotify_store'); Hook::register('enotify_store' , 'addon/blockem/blockem.php', 'blockem_enotify_store');
} }
function blockem_addon_settings(App $a, array &$data) function blockem_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -48,7 +48,7 @@ function blockem_addon_settings(App $a, array &$data)
]; ];
} }
function blockem_addon_settings_post(App $a, array &$b) function blockem_addon_settings_post(array &$b)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -59,7 +59,7 @@ function blockem_addon_settings_post(App $a, array &$b)
} }
} }
function blockem_enotify_store(App $a, array &$b) function blockem_enotify_store(array &$b)
{ {
$words = DI::pConfig()->get($b['uid'], 'blockem', 'words'); $words = DI::pConfig()->get($b['uid'], 'blockem', 'words');
@ -90,7 +90,7 @@ function blockem_enotify_store(App $a, array &$b)
} }
} }
function blockem_prepare_body_content_filter(App $a, array &$hook_data) function blockem_prepare_body_content_filter(array &$hook_data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -122,14 +122,14 @@ function blockem_prepare_body_content_filter(App $a, array &$hook_data)
} }
} }
function blockem_display_item(App $a, array &$b = null) function blockem_display_item(array &$b = null)
{ {
if (!empty($b['output']['body']) && strstr($b['output']['body'], 'id="blockem-wrap-')) { if (!empty($b['output']['body']) && strstr($b['output']['body'], 'id="blockem-wrap-')) {
$b['output']['thumb'] = DI::baseUrl()->get() . "/images/person-80.jpg"; $b['output']['thumb'] = DI::baseUrl()->get() . "/images/person-80.jpg";
} }
} }
function blockem_conversation_start(App $a, array &$b) function blockem_conversation_start(array &$b)
{ {
global $blockem_words; global $blockem_words;
@ -161,7 +161,7 @@ function blockemUnblock(author) {
EOT; EOT;
} }
function blockem_item_photo_menu(App $a, array &$b) function blockem_item_photo_menu(array &$b)
{ {
global $blockem_words; global $blockem_words;
@ -194,7 +194,7 @@ function blockem_item_photo_menu(App $a, array &$b)
*/ */
function blockem_module() {} function blockem_module() {}
function blockem_init(App $a) function blockem_init()
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -15,7 +15,7 @@ function buglink_install()
Hook::register('page_end', 'addon/buglink/buglink.php', 'buglink_active'); Hook::register('page_end', 'addon/buglink/buglink.php', 'buglink_active');
} }
function buglink_active(App $a, string &$b) function buglink_active(string &$b)
{ {
$b .= '<div id="buglink_wrapper" style="position: fixed; bottom: 5px; left: 5px;"><a href="https://github.com/friendica/friendica/issues" target="_blank" rel="noopener noreferrer" title="' . DI::l10n()->t('Report Bug') . '"><img src="addon/buglink/bug-x.gif" alt="' . DI::l10n()->t('Report Bug') . '" /></a></div>'; $b .= '<div id="buglink_wrapper" style="position: fixed; bottom: 5px; left: 5px;"><a href="https://github.com/friendica/friendica/issues" target="_blank" rel="noopener noreferrer" title="' . DI::l10n()->t('Report Bug') . '"><img src="addon/buglink/bug-x.gif" alt="' . DI::l10n()->t('Report Bug') . '" /></a></div>';
} }

View File

@ -14,7 +14,7 @@ function calc_install() {
Hook::register('app_menu', 'addon/calc/calc.php', 'calc_app_menu'); Hook::register('app_menu', 'addon/calc/calc.php', 'calc_app_menu');
} }
function calc_app_menu(App $a, array &$b) function calc_app_menu(array &$b)
{ {
$b['app_menu'][] = '<div class="app-title"><a href="calc">Calculator</a></div>'; $b['app_menu'][] = '<div class="app-title"><a href="calc">Calculator</a></div>';
} }
@ -26,7 +26,7 @@ function calc_app_menu(App $a, array &$b)
*/ */
function calc_module() {} function calc_module() {}
function calc_init(App $a) function calc_init()
{ {
$x = <<< EOT $x = <<< EOT

View File

@ -35,7 +35,7 @@ function catavatar_install()
/** /**
* Cat avatar user settings page * Cat avatar user settings page
*/ */
function catavatar_addon_settings(App $a, array &$data) function catavatar_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -63,7 +63,7 @@ function catavatar_addon_settings(App $a, array &$data)
/** /**
* Cat avatar user settings POST handle * Cat avatar user settings POST handle
*/ */
function catavatar_addon_settings_post(App $a, &$s) function catavatar_addon_settings_post(&$s)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -115,10 +115,9 @@ function catavatar_addon_settings_post(App $a, &$s)
/** /**
* Returns the URL to the cat avatar * Returns the URL to the cat avatar
* *
* @param $a array
* @param &$b array * @param &$b array
*/ */
function catavatar_lookup(App $a, array &$b) function catavatar_lookup(array &$b)
{ {
$user = DBA::selectFirst('user', ['uid'], ['email' => $b['email']]); $user = DBA::selectFirst('user', ['uid'], ['email' => $b['email']]);
if (DBA::isResult($user)) { if (DBA::isResult($user)) {
@ -150,7 +149,7 @@ function catavatar_module() {}
* @throws NotFoundException * @throws NotFoundException
* *
*/ */
function catavatar_content(App $a) function catavatar_content()
{ {
if (DI::args()->getArgc() < 2 || DI::args()->getArgc() > 3) { if (DI::args()->getArgc() < 2 || DI::args()->getArgc() > 3) {
throw new NotFoundException(); // this should be catched on index and show default "not found" page. throw new NotFoundException(); // this should be catched on index and show default "not found" page.

View File

@ -13,7 +13,7 @@ function convert_install() {
Hook::register('app_menu', 'addon/convert/convert.php', 'convert_app_menu'); Hook::register('app_menu', 'addon/convert/convert.php', 'convert_app_menu');
} }
function convert_app_menu(App $a, array &$b) function convert_app_menu(array &$b)
{ {
$b['app_menu'][] = '<div class="app-title"><a href="convert">Units Conversion</a></div>'; $b['app_menu'][] = '<div class="app-title"><a href="convert">Units Conversion</a></div>';
} }
@ -21,7 +21,7 @@ function convert_app_menu(App $a, array &$b)
function convert_module() {} function convert_module() {}
function convert_content(App $a) { function convert_content() {
// @TODO UnitConverter uses a deprecated constructor with the class' name // @TODO UnitConverter uses a deprecated constructor with the class' name
// @TODO Let's one day rewrite this to a modern composer package // @TODO Let's one day rewrite this to a modern composer package
include 'UnitConvertor.php'; include 'UnitConvertor.php';

View File

@ -28,14 +28,13 @@ function cookienotice_install()
* cookienotice_addon_admin * cookienotice_addon_admin
* creates the admins config panel * creates the admins config panel
* *
* @param App $a
* @param string $s The existing config panel html so far * @param string $s The existing config panel html so far
* *
* @return void * @return void
*/ */
function cookienotice_addon_admin(App $a, &$s) function cookienotice_addon_admin(&$s)
{ {
if (!$a->isSiteAdmin()) { if (!DI::userSession()->isSiteAdmin()) {
return; return;
} }
@ -57,12 +56,11 @@ function cookienotice_addon_admin(App $a, &$s)
* cookienotice_addon_admin_post * cookienotice_addon_admin_post
* handles the post request from the admin panel * handles the post request from the admin panel
* *
* @param App $a
* @return void * @return void
*/ */
function cookienotice_addon_admin_post(App $a) function cookienotice_addon_admin_post()
{ {
if (!$a->isSiteAdmin()) { if (!DI::userSession()->isSiteAdmin()) {
return; return;
} }
@ -77,12 +75,11 @@ function cookienotice_addon_admin_post(App $a)
* page_content_top hook * page_content_top hook
* adds css and scripts to the <head> section of the html * adds css and scripts to the <head> section of the html
* *
* @param App $a
* @param string $b unused - the header html incl. nav * @param string $b unused - the header html incl. nav
* *
* @return void * @return void
*/ */
function cookienotice_page_content_top(App $a, string &$b) function cookienotice_page_content_top(string &$b)
{ {
DI::page()->registerStylesheet(__DIR__ . '/cookienotice.css'); DI::page()->registerStylesheet(__DIR__ . '/cookienotice.css');
DI::page()->registerFooterScript(__DIR__ . '/cookienotice.js'); DI::page()->registerFooterScript(__DIR__ . '/cookienotice.js');
@ -93,12 +90,11 @@ function cookienotice_page_content_top(App $a, string &$b)
* page_end hook * page_end hook
* ads our cookienotice box to the end of the html * ads our cookienotice box to the end of the html
* *
* @param App $a
* @param string $b the page html * @param string $b the page html
* *
* @return void * @return void
*/ */
function cookienotice_page_end(App $a, string &$b) function cookienotice_page_end(string &$b)
{ {
$text = (string)DI::config()->get('cookienotice', 'text', DI::l10n()->t('This website uses cookies to recognize revisiting and logged in users. You accept the usage of these cookies by continue browsing this website.')); $text = (string)DI::config()->get('cookienotice', 'text', DI::l10n()->t('This website uses cookies to recognize revisiting and logged in users. You accept the usage of these cookies by continue browsing this website.'));
$oktext = (string)DI::config()->get('cookienotice', 'oktext', DI::l10n()->t('OK')); $oktext = (string)DI::config()->get('cookienotice', 'oktext', DI::l10n()->t('OK'));

View File

@ -86,7 +86,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
return $r; return $r;
} }
function curweather_network_mod_init(App $a, string &$body) function curweather_network_mod_init(string &$body)
{ {
if (!intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'curweather', 'curweather_enable'))) { if (!intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'curweather', 'curweather_enable'))) {
return; return;
@ -152,7 +152,7 @@ function curweather_network_mod_init(App $a, string &$body)
DI::page()['aside'] = $curweather . DI::page()['aside']; DI::page()['aside'] = $curweather . DI::page()['aside'];
} }
function curweather_addon_settings_post(App $a, $post) function curweather_addon_settings_post($post)
{ {
if (!DI::userSession()->getLocalUserId() || empty($_POST['curweather-settings-submit'])) { if (!DI::userSession()->getLocalUserId() || empty($_POST['curweather-settings-submit'])) {
return; return;
@ -163,7 +163,7 @@ function curweather_addon_settings_post(App $a, $post)
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'curweather', 'curweather_units' , trim($_POST['curweather_units'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'curweather', 'curweather_units' , trim($_POST['curweather_units']));
} }
function curweather_addon_settings(App $a, array &$data) function curweather_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -199,9 +199,9 @@ function curweather_addon_settings(App $a, array &$data)
// Config stuff for the admin panel to let the admin of the node set a APPID // Config stuff for the admin panel to let the admin of the node set a APPID
// for accessing the API of openweathermap // for accessing the API of openweathermap
function curweather_addon_admin_post(App $a) function curweather_addon_admin_post()
{ {
if (!$a->isSiteAdmin()) { if (!DI::userSession()->isSiteAdmin()) {
return; return;
} }
@ -211,9 +211,9 @@ function curweather_addon_admin_post(App $a)
} }
} }
function curweather_addon_admin(App $a, string &$o) function curweather_addon_admin(string &$o)
{ {
if (!$a->isSiteAdmin()) { if (!DI::userSession()->isSiteAdmin()) {
return; return;
} }

View File

@ -29,7 +29,7 @@ function diaspora_install()
Hook::register('connector_settings_post', 'addon/diaspora/diaspora.php', 'diaspora_settings_post'); Hook::register('connector_settings_post', 'addon/diaspora/diaspora.php', 'diaspora_settings_post');
} }
function diaspora_jot_nets(App $a, array &$jotnets_fields) function diaspora_jot_nets(array &$jotnets_fields)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -47,7 +47,7 @@ function diaspora_jot_nets(App $a, array &$jotnets_fields)
} }
} }
function diaspora_settings(App $a, array &$data) function diaspora_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -117,7 +117,7 @@ function diaspora_settings(App $a, array &$data)
} }
function diaspora_settings_post(App $a, array &$b) function diaspora_settings_post(array &$b)
{ {
if (!empty($_POST['diaspora-submit'])) { if (!empty($_POST['diaspora-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(),'diaspora', 'post' , intval($_POST['enabled'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(),'diaspora', 'post' , intval($_POST['enabled']));
@ -136,7 +136,7 @@ function diaspora_settings_post(App $a, array &$b)
} }
} }
function diaspora_hook_fork(App $a, array &$b) function diaspora_hook_fork(array &$b)
{ {
if ($b['name'] != 'notifier_normal') { if ($b['name'] != 'notifier_normal') {
return; return;
@ -151,7 +151,7 @@ function diaspora_hook_fork(App $a, array &$b)
} }
} }
function diaspora_post_local(App $a, array &$b) function diaspora_post_local(array &$b)
{ {
if ($b['edit']) { if ($b['edit']) {
return; return;
@ -184,7 +184,7 @@ function diaspora_post_local(App $a, array &$b)
$b['postopts'] .= 'diaspora'; $b['postopts'] .= 'diaspora';
} }
function diaspora_send(App $a, array &$b) function diaspora_send(array &$b)
{ {
$hostname = DI::baseUrl()->getHostname(); $hostname = DI::baseUrl()->getHostname();

View File

@ -36,7 +36,7 @@ function discourse_install()
Hook::register('connector_settings_post', __FILE__, 'discourse_settings_post'); Hook::register('connector_settings_post', __FILE__, 'discourse_settings_post');
} }
function discourse_settings(App $a, array &$data) function discourse_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -58,7 +58,7 @@ function discourse_settings(App $a, array &$data)
]; ];
} }
function discourse_settings_post(App $a) function discourse_settings_post()
{ {
if (!DI::userSession()->getLocalUserId() || empty($_POST['discourse-submit'])) { if (!DI::userSession()->getLocalUserId() || empty($_POST['discourse-submit'])) {
return; return;
@ -67,7 +67,7 @@ function discourse_settings_post(App $a)
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'discourse', 'enabled', intval($_POST['enabled'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'discourse', 'enabled', intval($_POST['enabled']));
} }
function discourse_email_getmessage(App $a, &$message) function discourse_email_getmessage(&$message)
{ {
if (empty($message['item']['uid'])) { if (empty($message['item']['uid'])) {
return; return;

View File

@ -29,7 +29,7 @@ function dwpost_install()
Hook::register('connector_settings_post', 'addon/dwpost/dwpost.php', 'dwpost_settings_post'); Hook::register('connector_settings_post', 'addon/dwpost/dwpost.php', 'dwpost_settings_post');
} }
function dwpost_jot_nets(App $a, array &$jotnets_fields) function dwpost_jot_nets(array &$jotnets_fields)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -48,7 +48,7 @@ function dwpost_jot_nets(App $a, array &$jotnets_fields)
} }
function dwpost_settings(App $a, array &$data) function dwpost_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -76,7 +76,7 @@ function dwpost_settings(App $a, array &$data)
} }
function dwpost_settings_post(App $a, array &$b) function dwpost_settings_post(array &$b)
{ {
if (!empty($_POST['dwpost-submit'])) { if (!empty($_POST['dwpost-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'dwpost', 'post', intval($_POST['dwpost'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'dwpost', 'post', intval($_POST['dwpost']));
@ -86,7 +86,7 @@ function dwpost_settings_post(App $a, array &$b)
} }
} }
function dwpost_post_local(App $a, array &$b) function dwpost_post_local(array &$b)
{ {
// This can probably be changed to allow editing by pointing to a different API endpoint // This can probably be changed to allow editing by pointing to a different API endpoint
if ($b['edit']) { if ($b['edit']) {
@ -120,7 +120,7 @@ function dwpost_post_local(App $a, array &$b)
$b['postopts'] .= 'dwpost'; $b['postopts'] .= 'dwpost';
} }
function dwpost_send(App $a, array &$b) function dwpost_send(array &$b)
{ {
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return; return;

View File

@ -17,18 +17,18 @@ function fancybox_install()
Hook::register('prepare_body_final', __FILE__, 'fancybox_render'); Hook::register('prepare_body_final', __FILE__, 'fancybox_render');
} }
function fancybox_head(App $a, string &$b) function fancybox_head(string &$b)
{ {
DI::page()->registerStylesheet(__DIR__ . '/asset/fancybox/jquery.fancybox.min.css'); DI::page()->registerStylesheet(__DIR__ . '/asset/fancybox/jquery.fancybox.min.css');
} }
function fancybox_footer(App $a, string &$str) function fancybox_footer(string &$str)
{ {
DI::page()->registerFooterScript(__DIR__ . '/asset/fancybox/jquery.fancybox.min.js'); DI::page()->registerFooterScript(__DIR__ . '/asset/fancybox/jquery.fancybox.min.js');
DI::page()->registerFooterScript(__DIR__ . '/asset/fancybox/fancybox.config.js'); DI::page()->registerFooterScript(__DIR__ . '/asset/fancybox/fancybox.config.js');
} }
function fancybox_render(App $a, array &$b){ function fancybox_render(array &$b){
$gallery = 'gallery-' . $b['item']['uri-id'] ?? random_int(1000000, 10000000); $gallery = 'gallery-' . $b['item']['uri-id'] ?? random_int(1000000, 10000000);
// performWithEscapedBlocks escapes block defined with 2nd par pattern that won't be processed. // performWithEscapedBlocks escapes block defined with 2nd par pattern that won't be processed.
@ -39,7 +39,7 @@ function fancybox_render(App $a, array &$b){
function ($text) use ($gallery) { function ($text) use ($gallery) {
// This processes images inlined in posts // This processes images inlined in posts
// Frio / Vier hooks für lightbox are un-hooked in fancybox-config.js. So this works for them, too! // Frio / Vier hooks für lightbox are un-hooked in fancybox-config.js. So this works for them, too!
//if (!in_array($a->getCurrentTheme(),['vier','frio'])) //if (!in_array(DI::app()->getCurrentTheme(),['vier','frio']))
$text = preg_replace( $text = preg_replace(
'#<a[^>]*href="([^"]*)"[^>]*>(<img[^>]*src="[^"]*"[^>]*>)</a>#', '#<a[^>]*href="([^"]*)"[^>]*>(<img[^>]*src="[^"]*"[^>]*>)</a>#',
'<a data-fancybox="' . $gallery . '" href="$1">$2</a>', '<a data-fancybox="' . $gallery . '" href="$1">$2</a>',

View File

@ -36,19 +36,19 @@ function forumdirectory_install()
*/ */
function forumdirectory_module() {} function forumdirectory_module() {}
function forumdirectory_app_menu(App $a, array &$b) function forumdirectory_app_menu(array &$b)
{ {
$b['app_menu'][] = '<div class="app-title"><a href="forumdirectory">' . DI::l10n()->t('Forum Directory') . '</a></div>'; $b['app_menu'][] = '<div class="app-title"><a href="forumdirectory">' . DI::l10n()->t('Forum Directory') . '</a></div>';
} }
function forumdirectory_init(App $a) function forumdirectory_init()
{ {
if (DI::userSession()->getLocalUserId()) { if (DI::userSession()->getLocalUserId()) {
DI::page()['aside'] .= Widget::findPeople(); DI::page()['aside'] .= Widget::findPeople();
} }
} }
function forumdirectory_post(App $a) function forumdirectory_post()
{ {
global $forumdirectory_search; global $forumdirectory_search;
@ -57,7 +57,7 @@ function forumdirectory_post(App $a)
} }
} }
function forumdirectory_content(App $a) function forumdirectory_content()
{ {
global $forumdirectory_search; global $forumdirectory_search;

View File

@ -21,7 +21,7 @@ function fromapp_install()
Logger::notice("installed fromapp"); Logger::notice("installed fromapp");
} }
function fromapp_settings_post(App $a, $post) function fromapp_settings_post($post)
{ {
if (!DI::userSession()->getLocalUserId() || empty($_POST['fromapp-submit'])) { if (!DI::userSession()->getLocalUserId() || empty($_POST['fromapp-submit'])) {
return; return;
@ -31,7 +31,7 @@ function fromapp_settings_post(App $a, $post)
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'fromapp', 'force', intval($_POST['fromapp-force'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'fromapp', 'force', intval($_POST['fromapp-force']));
} }
function fromapp_settings(App &$a, array &$data) function fromapp_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -53,7 +53,7 @@ function fromapp_settings(App &$a, array &$data)
]; ];
} }
function fromapp_post_hook(App $a, &$item) function fromapp_post_hook(&$item)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -77,12 +77,12 @@ function geocoordinates_resolve_item(array &$item)
} }
} }
function geocoordinates_post_hook(App $a, &$item) function geocoordinates_post_hook(&$item)
{ {
geocoordinates_resolve_item($item); geocoordinates_resolve_item($item);
} }
function geocoordinates_addon_admin(App $a, string &$o) function geocoordinates_addon_admin(string &$o)
{ {
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/geocoordinates/'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/geocoordinates/');
@ -93,7 +93,7 @@ function geocoordinates_addon_admin(App $a, string &$o)
]); ]);
} }
function geocoordinates_addon_admin_post(App $a) function geocoordinates_addon_admin_post()
{ {
DI::config()->set('geocoordinates', 'api_key', trim($_POST['api_key'] ?? '')); DI::config()->set('geocoordinates', 'api_key', trim($_POST['api_key'] ?? ''));
DI::config()->set('geocoordinates', 'language', trim($_POST['language'] ?? '')); DI::config()->set('geocoordinates', 'language', trim($_POST['language'] ?? ''));

View File

@ -33,12 +33,12 @@ function geonames_install()
Hook::register('addon_settings_post', __FILE__, 'geonames_addon_settings_post'); Hook::register('addon_settings_post', __FILE__, 'geonames_addon_settings_post');
} }
function geonames_load_config(App $a, ConfigFileManager $loader) function geonames_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('geonames'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('geonames'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
function geonames_post_hook(App $a, array &$item) function geonames_post_hook(array &$item)
{ {
/* An item was posted on the local system. /* An item was posted on the local system.
* We are going to look for specific items: * We are going to look for specific items:
@ -97,10 +97,9 @@ function geonames_post_hook(App $a, array &$item)
* We will make sure we've got a valid user account * We will make sure we've got a valid user account
* and if so set our configuration setting for this person. * and if so set our configuration setting for this person.
* *
* @param App $a
* @param array $post The $_POST array * @param array $post The $_POST array
*/ */
function geonames_addon_settings_post(App $a, array $post) function geonames_addon_settings_post(array $post)
{ {
if (!DI::userSession()->getLocalUserId() || empty($_POST['geonames-submit'])) { if (!DI::userSession()->getLocalUserId() || empty($_POST['geonames-submit'])) {
return; return;
@ -113,11 +112,10 @@ function geonames_addon_settings_post(App $a, array $post)
* Called from the Addon Setting form. * Called from the Addon Setting form.
* Add our own settings info to the page. * Add our own settings info to the page.
* *
* @param App $a
* @param array $data * @param array $data
* @throws Exception * @throws Exception
*/ */
function geonames_addon_settings(App $a, array &$data) function geonames_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -30,7 +30,7 @@ function gnot_install()
* We will make sure we've got a valid user account * We will make sure we've got a valid user account
* and if so set our configuration setting for this person. * and if so set our configuration setting for this person.
*/ */
function gnot_settings_post(App $a, $post) { function gnot_settings_post($post) {
if(! DI::userSession()->getLocalUserId() || empty($_POST['gnot-submit'])) if(! DI::userSession()->getLocalUserId() || empty($_POST['gnot-submit']))
return; return;
@ -41,7 +41,7 @@ function gnot_settings_post(App $a, $post) {
* Called from the Addon Setting form. * Called from the Addon Setting form.
* Add our own settings info to the page. * Add our own settings info to the page.
*/ */
function gnot_settings(App &$a, array &$data) function gnot_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -62,7 +62,7 @@ function gnot_settings(App &$a, array &$data)
]; ];
} }
function gnot_enotify_mail(App $a, array &$b) function gnot_enotify_mail(array &$b)
{ {
if ((!$b['uid']) || (! intval(DI::pConfig()->get($b['uid'], 'gnot','enable')))) { if ((!$b['uid']) || (! intval(DI::pConfig()->get($b['uid'], 'gnot','enable')))) {
return; return;

View File

@ -18,7 +18,7 @@ function googlemaps_install()
Logger::notice('installed googlemaps'); Logger::notice('installed googlemaps');
} }
function googlemaps_location(App $a, &$item) function googlemaps_location(&$item)
{ {
if (!(strlen($item['location']) || strlen($item['coord']))) { if (!(strlen($item['location']) || strlen($item['coord']))) {
return; return;

View File

@ -26,18 +26,17 @@ function gravatar_install() {
Logger::notice("registered gravatar in avatar_lookup hook"); Logger::notice("registered gravatar in avatar_lookup hook");
} }
function gravatar_load_config(App $a, ConfigFileManager $loader) function gravatar_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('gravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('gravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
/** /**
* Looks up the avatar at gravatar.com and returns the URL. * Looks up the avatar at gravatar.com and returns the URL.
* *
* @param $a array
* @param &$b array * @param &$b array
*/ */
function gravatar_lookup(App $a, array &$b) function gravatar_lookup(array &$b)
{ {
$default_avatar = DI::config()->get('gravatar', 'default_avatar'); $default_avatar = DI::config()->get('gravatar', 'default_avatar');
$rating = DI::config()->get('gravatar', 'rating'); $rating = DI::config()->get('gravatar', 'rating');
@ -62,7 +61,7 @@ function gravatar_lookup(App $a, array &$b)
/** /**
* Display admin settings for this addon * Display admin settings for this addon
*/ */
function gravatar_addon_admin (App $a, string &$o) function gravatar_addon_admin (string &$o)
{ {
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/gravatar/" ); $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/gravatar/" );
@ -109,7 +108,7 @@ function gravatar_addon_admin (App $a, string &$o)
/** /**
* Save admin settings * Save admin settings
*/ */
function gravatar_addon_admin_post (App $a) function gravatar_addon_admin_post ()
{ {
BaseModule::checkFormSecurityToken('gravatarsave'); BaseModule::checkFormSecurityToken('gravatarsave');

View File

@ -27,7 +27,7 @@ function group_text_install()
* *
*/ */
function group_text_settings_post(App $a, array $post) function group_text_settings_post(array $post)
{ {
if (!DI::userSession()->getLocalUserId() || empty($post['group_text-submit'])) { if (!DI::userSession()->getLocalUserId() || empty($post['group_text-submit'])) {
return; return;
@ -44,7 +44,7 @@ function group_text_settings_post(App $a, array $post)
* *
*/ */
function group_text_settings(App &$a, array &$data) function group_text_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -16,9 +16,9 @@ function highlightjs_install()
Hook::register('footer', __FILE__, 'highlightjs_footer'); Hook::register('footer', __FILE__, 'highlightjs_footer');
} }
function highlightjs_head(App $a, string &$str) function highlightjs_head(string &$str)
{ {
if ($a->getCurrentTheme() == 'frio') { if (DI::app()->getCurrentTheme() == 'frio') {
$style = 'bootstrap'; $style = 'bootstrap';
} else { } else {
$style = 'default'; $style = 'default';
@ -27,7 +27,7 @@ function highlightjs_head(App $a, string &$str)
DI::page()->registerStylesheet(__DIR__ . '/asset/styles/' . $style . '.css'); DI::page()->registerStylesheet(__DIR__ . '/asset/styles/' . $style . '.css');
} }
function highlightjs_footer(App $a, string &$str) function highlightjs_footer(string &$str)
{ {
DI::page()->registerFooterScript(__DIR__ . '/asset/highlight.pack.js'); DI::page()->registerFooterScript(__DIR__ . '/asset/highlight.pack.js');
DI::page()->registerFooterScript(__DIR__ . '/highlightjs.js'); DI::page()->registerFooterScript(__DIR__ . '/highlightjs.js');

View File

@ -32,7 +32,7 @@ function ifttt_module() {}
function ifttt_content() {} function ifttt_content() {}
function ifttt_settings(App $a, array &$data) function ifttt_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -55,7 +55,7 @@ function ifttt_settings(App $a, array &$data)
'new_photo_upload_body' => DI::l10n()->t('Body for "new photo upload"'), 'new_photo_upload_body' => DI::l10n()->t('Body for "new photo upload"'),
'new_link_post_body' => DI::l10n()->t('Body for "new link post"'), 'new_link_post_body' => DI::l10n()->t('Body for "new link post"'),
], ],
'$url' => DI::baseUrl()->get() . '/ifttt/' . $a->getLoggedInUserNickname(), '$url' => DI::baseUrl()->get() . '/ifttt/' . DI::userSession()->getLocalUserNickname(),
'$new_status_message_body' => 'key=' . $key . '&type=status&msg=<<<{{Message}}>>>&date=<<<{{UpdatedAt}}>>>&url=<<<{{PageUrl}}>>>', '$new_status_message_body' => 'key=' . $key . '&type=status&msg=<<<{{Message}}>>>&date=<<<{{UpdatedAt}}>>>&url=<<<{{PageUrl}}>>>',
'$new_photo_upload_body' => 'key=' . $key . '&type=photo&link=<<<{{Link}}>>>&image=<<<{{ImageSource}}>>>&msg=<<<{{Caption}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>', '$new_photo_upload_body' => 'key=' . $key . '&type=photo&link=<<<{{Link}}>>>&image=<<<{{ImageSource}}>>>&msg=<<<{{Caption}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>',
'$new_link_post_body' => 'key=' . $key . '&type=link&link=<<<{{Link}}>>>&title=<<<{{Title}}>>>&msg=<<<{{Message}}>>>&description=<<<{{Description}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>', '$new_link_post_body' => 'key=' . $key . '&type=link&link=<<<{{Link}}>>>&title=<<<{{Title}}>>>&msg=<<<{{Message}}>>>&description=<<<{{Description}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>',
@ -77,7 +77,7 @@ function ifttt_settings_post()
} }
} }
function ifttt_post(App $a) function ifttt_post()
{ {
if (DI::args()->getArgc() != 2) { if (DI::args()->getArgc() != 2) {
return; return;

View File

@ -28,7 +28,7 @@ function ijpost_install()
Hook::register('connector_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post'); Hook::register('connector_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post');
} }
function ijpost_jot_nets(App &$a, array &$jotnets_fields) function ijpost_jot_nets(array &$jotnets_fields)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -46,7 +46,7 @@ function ijpost_jot_nets(App &$a, array &$jotnets_fields)
} }
} }
function ijpost_settings(App &$a, array &$data) function ijpost_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -73,7 +73,7 @@ function ijpost_settings(App &$a, array &$data)
]; ];
} }
function ijpost_settings_post(App $a, array &$b) function ijpost_settings_post(array &$b)
{ {
if (!empty($_POST['ijpost-submit'])) { if (!empty($_POST['ijpost-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ijpost', 'post', intval($_POST['ijpost'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ijpost', 'post', intval($_POST['ijpost']));
@ -83,7 +83,7 @@ function ijpost_settings_post(App $a, array &$b)
} }
} }
function ijpost_post_local(App $a, array &$b) function ijpost_post_local(array &$b)
{ {
// This can probably be changed to allow editing by pointing to a different API endpoint // This can probably be changed to allow editing by pointing to a different API endpoint
@ -118,7 +118,7 @@ function ijpost_post_local(App $a, array &$b)
$b['postopts'] .= 'ijpost'; $b['postopts'] .= 'ijpost';
} }
function ijpost_send(App $a, array &$b) function ijpost_send(array &$b)
{ {
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return; return;

View File

@ -43,7 +43,7 @@ function obfuscate_email (string $s): string
return $s; return $s;
} }
function impressum_footer(App $a, string &$body) function impressum_footer(string &$body)
{ {
$text = ProxyUtils::proxifyHtml(BBCode::convert(DI::config()->get('impressum', 'footer_text'))); $text = ProxyUtils::proxifyHtml(BBCode::convert(DI::config()->get('impressum', 'footer_text')));
@ -54,12 +54,12 @@ function impressum_footer(App $a, string &$body)
} }
} }
function impressum_load_config(App $a, ConfigFileManager $loader) function impressum_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('impressum'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('impressum'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
function impressum_show(App $a, string &$body) function impressum_show(string &$body)
{ {
$body .= '<h3>' . DI::l10n()->t('Impressum') . '</h3>'; $body .= '<h3>' . DI::l10n()->t('Impressum') . '</h3>';
$owner = DI::config()->get('impressum', 'owner'); $owner = DI::config()->get('impressum', 'owner');
@ -92,7 +92,7 @@ function impressum_show(App $a, string &$body)
} }
} }
function impressum_addon_admin_post (App $a) function impressum_addon_admin_post ()
{ {
DI::config()->set('impressum', 'owner', strip_tags(trim($_POST['owner'] ?? ''))); DI::config()->set('impressum', 'owner', strip_tags(trim($_POST['owner'] ?? '')));
DI::config()->set('impressum', 'ownerprofile', strip_tags(trim($_POST['ownerprofile'] ?? ''))); DI::config()->set('impressum', 'ownerprofile', strip_tags(trim($_POST['ownerprofile'] ?? '')));
@ -102,7 +102,7 @@ function impressum_addon_admin_post (App $a)
DI::config()->set('impressum', 'footer_text', strip_tags(trim($_POST['footer_text'] ?? ''))); DI::config()->set('impressum', 'footer_text', strip_tags(trim($_POST['footer_text'] ?? '')));
} }
function impressum_addon_admin (App $a, string &$o) function impressum_addon_admin (string &$o)
{ {
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/impressum/' ); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/impressum/' );
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [

View File

@ -15,7 +15,7 @@ function infiniteimprobabilitydrive_install()
Hook::register('app_menu', 'addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php', 'infiniteimprobabilitydrive_app_menu'); Hook::register('app_menu', 'addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php', 'infiniteimprobabilitydrive_app_menu');
} }
function infiniteimprobabilitydrive_app_menu(App $a, array &$b) function infiniteimprobabilitydrive_app_menu(array &$b)
{ {
$b['app_menu'][] = '<div class="app-title"><a href="infiniteimprobabilitydrive">' . DI::l10n()->t('Infinite Improbability Drive') . '</a></div>'; $b['app_menu'][] = '<div class="app-title"><a href="infiniteimprobabilitydrive">' . DI::l10n()->t('Infinite Improbability Drive') . '</a></div>';
} }
@ -28,7 +28,7 @@ function infiniteimprobabilitydrive_app_menu(App $a, array &$b)
function infiniteimprobabilitydrive_module() {} function infiniteimprobabilitydrive_module() {}
function infiniteimprobabilitydrive_content(App $a) function infiniteimprobabilitydrive_content()
{ {
$baseurl = DI::baseUrl()->get() . '/addon/infiniteimprobabilitydrive'; $baseurl = DI::baseUrl()->get() . '/addon/infiniteimprobabilitydrive';
$o = ''; $o = '';

View File

@ -19,7 +19,7 @@ function irc_install()
Hook::register('addon_settings_post', 'addon/irc/irc.php', 'irc_addon_settings_post'); Hook::register('addon_settings_post', 'addon/irc/irc.php', 'irc_addon_settings_post');
} }
function irc_addon_settings(App &$a, array &$data) function irc_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -42,7 +42,7 @@ function irc_addon_settings(App &$a, array &$data)
]; ];
} }
function irc_addon_settings_post(App $a, array &$b) function irc_addon_settings_post(array &$b)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -59,7 +59,7 @@ function irc_addon_settings_post(App $a, array &$b)
} }
} }
function irc_app_menu(App $a, array &$b) function irc_app_menu(array &$b)
{ {
$b['app_menu'][] = '<div class="app-title"><a href="irc">' . DI::l10n()->t('IRC Chatroom') . '</a></div>'; $b['app_menu'][] = '<div class="app-title"><a href="irc">' . DI::l10n()->t('IRC Chatroom') . '</a></div>';
} }
@ -71,7 +71,7 @@ function irc_app_menu(App $a, array &$b)
*/ */
function irc_module() {} function irc_module() {}
function irc_content(App $a) function irc_content()
{ {
$baseurl = DI::baseUrl()->get() . '/addon/irc'; $baseurl = DI::baseUrl()->get() . '/addon/irc';
$o = ''; $o = '';
@ -124,9 +124,9 @@ EOT;
return $o; return $o;
} }
function irc_addon_admin_post (App $a) function irc_addon_admin_post ()
{ {
if (!$a->isSiteAdmin()) { if (!DI::userSession()->isSiteAdmin()) {
return; return;
} }
@ -135,7 +135,7 @@ function irc_addon_admin_post (App $a)
DI::config()->set('irc', 'sitechats', trim($_POST['sitechats'])); DI::config()->set('irc', 'sitechats', trim($_POST['sitechats']));
} }
} }
function irc_addon_admin (App $a, string &$o) { function irc_addon_admin (string &$o) {
$sitechats = DI::config()->get('irc', 'sitechats'); /* popular channels */ $sitechats = DI::config()->get('irc', 'sitechats'); /* popular channels */
$autochans = DI::config()->get('irc', 'autochans'); /* auto connect chans */ $autochans = DI::config()->get('irc', 'autochans'); /* auto connect chans */
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/irc/' ); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/irc/' );

View File

@ -25,7 +25,7 @@ function js_upload_install()
Hook::register('photo_post_end', __FILE__, 'js_upload_post_end'); Hook::register('photo_post_end', __FILE__, 'js_upload_post_end');
} }
function js_upload_form(App $a, array &$b) function js_upload_form(array &$b)
{ {
$b['default_upload'] = false; $b['default_upload'] = false;
@ -43,7 +43,7 @@ function js_upload_form(App $a, array &$b)
]); ]);
} }
function js_upload_post_init(App $a, array &$b) function js_upload_post_init(array &$b)
{ {
global $js_upload_result, $js_upload_jsonresponse; global $js_upload_result, $js_upload_jsonresponse;
@ -69,7 +69,7 @@ function js_upload_post_init(App $a, array &$b)
$js_upload_result = $result; $js_upload_result = $result;
} }
function js_upload_post_file(App $a, array &$b) function js_upload_post_file(array &$b)
{ {
global $js_upload_result; global $js_upload_result;
@ -81,7 +81,7 @@ function js_upload_post_file(App $a, array &$b)
} }
function js_upload_post_end(App $a, int &$b) function js_upload_post_end(int &$b)
{ {
global $js_upload_jsonresponse; global $js_upload_jsonresponse;

View File

@ -45,7 +45,7 @@ function keycloakpassword_request($client_id, $secret, $url, $params = [])
return $res; return $res;
} }
function keycloakpassword_authenticate(App $a, array &$b) function keycloakpassword_authenticate(array &$b)
{ {
if (empty($b['password'])) { if (empty($b['password'])) {
return; return;
@ -110,7 +110,7 @@ function keycloakpassword_admin_input($key, $label, $description)
]; ];
} }
function keycloakpassword_addon_admin(App $a, string &$o) function keycloakpassword_addon_admin(string &$o)
{ {
$form = $form =
keycloakpassword_admin_input( keycloakpassword_admin_input(
@ -140,7 +140,7 @@ function keycloakpassword_addon_admin(App $a, string &$o)
$o = Renderer::replaceMacros($t, $form); $o = Renderer::replaceMacros($t, $form);
} }
function keycloakpassword_addon_admin_post(App $a) function keycloakpassword_addon_admin_post()
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -35,7 +35,7 @@ function krynn_install()
Logger::notice("installed krynn"); Logger::notice("installed krynn");
} }
function krynn_post_hook(App $a, &$item) function krynn_post_hook(&$item)
{ {
/** /**
* An item was posted on the local system. * An item was posted on the local system.
@ -88,7 +88,7 @@ function krynn_post_hook(App $a, &$item)
* We will make sure we've got a valid user account * We will make sure we've got a valid user account
* and if so set our configuration setting for this person. * and if so set our configuration setting for this person.
*/ */
function krynn_settings_post(App $a, $post) function krynn_settings_post($post)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -103,7 +103,7 @@ function krynn_settings_post(App $a, $post)
* Called from the addon Setting form. * Called from the addon Setting form.
* Add our own settings info to the page. * Add our own settings info to the page.
*/ */
function krynn_settings(App &$a, array &$data) function krynn_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -31,7 +31,7 @@ function langfilter_install()
* 3rd parse a SMARTY3 template, replacing some translateable strings for the form * 3rd parse a SMARTY3 template, replacing some translateable strings for the form
*/ */
function langfilter_addon_settings(App $a, array &$data) function langfilter_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -67,7 +67,7 @@ function langfilter_addon_settings(App $a, array &$data)
* 3rd save the settings to the DB for later usage * 3rd save the settings to the DB for later usage
*/ */
function langfilter_addon_settings_post(App $a, array &$b) function langfilter_addon_settings_post(array &$b)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -98,7 +98,7 @@ function langfilter_addon_settings_post(App $a, array &$b)
* expand it again. * expand it again.
*/ */
function langfilter_prepare_body_content_filter(App $a, &$hook_data) function langfilter_prepare_body_content_filter(&$hook_data)
{ {
$logged_user = DI::userSession()->getLocalUserId(); $logged_user = DI::userSession()->getLocalUserId();
if (!$logged_user) { if (!$logged_user) {
@ -107,7 +107,7 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data)
// Never filter own messages // Never filter own messages
// TODO: find a better way to extract this // TODO: find a better way to extract this
$logged_user_profile = DI::baseUrl()->get() . '/profile/' . $a->getLoggedInUserNickname(); $logged_user_profile = DI::baseUrl()->get() . '/profile/' . DI::userSession()->getLocalUserNickname();
if ($logged_user_profile == $hook_data['item']['author-link']) { if ($logged_user_profile == $hook_data['item']['author-link']) {
return; return;
} }

View File

@ -43,12 +43,12 @@ function ldapauth_install()
Hook::register('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate'); Hook::register('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate');
} }
function ldapauth_load_config(App $a, ConfigFileManager $loader) function ldapauth_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('ldapauth'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('ldapauth'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
function ldapauth_hook_authenticate(App $a, array &$b) function ldapauth_hook_authenticate(array &$b)
{ {
$user = ldapauth_authenticate($b['username'], $b['password']); $user = ldapauth_authenticate($b['username'], $b['password']);
if (!empty($user['uid'])) { if (!empty($user['uid'])) {

View File

@ -18,7 +18,7 @@ function leistungsschutzrecht_install()
Hook::register('page_info_data', 'addon/leistungsschutzrecht/leistungsschutzrecht.php', 'leistungsschutzrecht_getsiteinfo'); Hook::register('page_info_data', 'addon/leistungsschutzrecht/leistungsschutzrecht.php', 'leistungsschutzrecht_getsiteinfo');
} }
function leistungsschutzrecht_getsiteinfo(App $a, array &$siteinfo) { function leistungsschutzrecht_getsiteinfo(array &$siteinfo) {
if (!isset($siteinfo['url']) || empty($siteinfo['type'])) { if (!isset($siteinfo['url']) || empty($siteinfo['type'])) {
return; return;
} }
@ -162,7 +162,7 @@ function leistungsschutzrecht_is_member_site(string $url): bool
return isset($sites[$site]); return isset($sites[$site]);
} }
function leistungsschutzrecht_cron(App $a, $b) function leistungsschutzrecht_cron($b)
{ {
$last = DI::keyValue()->get('leistungsschutzrecht_last_poll'); $last = DI::keyValue()->get('leistungsschutzrecht_last_poll');

View File

@ -25,7 +25,7 @@ function libertree_install()
Hook::register('connector_settings_post', 'addon/libertree/libertree.php', 'libertree_settings_post'); Hook::register('connector_settings_post', 'addon/libertree/libertree.php', 'libertree_settings_post');
} }
function libertree_jot_nets(App &$a, array &$jotnets_fields) function libertree_jot_nets(array &$jotnets_fields)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -43,7 +43,7 @@ function libertree_jot_nets(App &$a, array &$jotnets_fields)
} }
} }
function libertree_settings(App $a, array &$data) function libertree_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -71,7 +71,7 @@ function libertree_settings(App $a, array &$data)
]; ];
} }
function libertree_settings_post(App $a, array &$b) function libertree_settings_post(array &$b)
{ {
if (!empty($_POST['libertree-submit'])) { if (!empty($_POST['libertree-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(),'libertree','post',intval($_POST['libertree'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(),'libertree','post',intval($_POST['libertree']));
@ -83,7 +83,7 @@ function libertree_settings_post(App $a, array &$b)
} }
function libertree_hook_fork(App &$a, array &$b) function libertree_hook_fork(array &$b)
{ {
if ($b['name'] != 'notifier_normal') { if ($b['name'] != 'notifier_normal') {
return; return;
@ -98,7 +98,7 @@ function libertree_hook_fork(App &$a, array &$b)
} }
} }
function libertree_post_local(App $a, array &$b) function libertree_post_local(array &$b)
{ {
// This can probably be changed to allow editing by pointing to a different API endpoint // This can probably be changed to allow editing by pointing to a different API endpoint
@ -134,7 +134,7 @@ function libertree_post_local(App $a, array &$b)
$b['postopts'] .= 'libertree'; $b['postopts'] .= 'libertree';
} }
function libertree_send(App $a, array &$b) function libertree_send(array &$b)
{ {
Logger::notice('libertree_send: invoked'); Logger::notice('libertree_send: invoked');

View File

@ -24,18 +24,17 @@ function libravatar_install()
Logger::notice("registered libravatar in avatar_lookup hook"); Logger::notice("registered libravatar in avatar_lookup hook");
} }
function libravatar_load_config(App $a, ConfigFileManager $loader) function libravatar_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('libravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('libravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
/** /**
* Looks up the avatar at Libravatar and returns the URL. * Looks up the avatar at Libravatar and returns the URL.
* *
* @param $a array
* @param &$b array * @param &$b array
*/ */
function libravatar_lookup(array $a, array &$b) function libravatar_lookup(array &$b)
{ {
$default_avatar = DI::config()->get('libravatar', 'default_avatar'); $default_avatar = DI::config()->get('libravatar', 'default_avatar');
if (empty($default_avatar)) { if (empty($default_avatar)) {
@ -57,7 +56,7 @@ function libravatar_lookup(array $a, array &$b)
/** /**
* Display admin settings for this addon * Display admin settings for this addon
*/ */
function libravatar_addon_admin(App $a, string &$o) function libravatar_addon_admin(string &$o)
{ {
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/libravatar'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/libravatar');
@ -88,7 +87,7 @@ function libravatar_addon_admin(App $a, string &$o)
/** /**
* Save admin settings * Save admin settings
*/ */
function libravatar_addon_admin_post(App $a) function libravatar_addon_admin_post()
{ {
DI::config()->set('libravatar', 'default_avatar', trim($_POST['avatar'] ?? 'identicon')); DI::config()->set('libravatar', 'default_avatar', trim($_POST['avatar'] ?? 'identicon'));
} }

View File

@ -29,7 +29,7 @@ function ljpost_install()
Hook::register('connector_settings_post', 'addon/ljpost/ljpost.php', 'ljpost_settings_post'); Hook::register('connector_settings_post', 'addon/ljpost/ljpost.php', 'ljpost_settings_post');
} }
function ljpost_jot_nets(App &$a, array &$jotnets_fields) function ljpost_jot_nets(array &$jotnets_fields)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -47,7 +47,7 @@ function ljpost_jot_nets(App &$a, array &$jotnets_fields)
} }
} }
function ljpost_settings(App &$a, array &$data) function ljpost_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -74,7 +74,7 @@ function ljpost_settings(App &$a, array &$data)
]; ];
} }
function ljpost_settings_post(App $a, array &$b) function ljpost_settings_post(array &$b)
{ {
if (!empty($_POST['ljpost-submit'])) { if (!empty($_POST['ljpost-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ljpost', 'post', intval($_POST['ljpost'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ljpost', 'post', intval($_POST['ljpost']));
@ -84,7 +84,7 @@ function ljpost_settings_post(App $a, array &$b)
} }
} }
function ljpost_post_local(App $a, array &$b) function ljpost_post_local(array &$b)
{ {
// This can probably be changed to allow editing by pointing to a different API endpoint // This can probably be changed to allow editing by pointing to a different API endpoint
if ($b['edit']) { if ($b['edit']) {
@ -116,7 +116,7 @@ function ljpost_post_local(App $a, array &$b)
$b['postopts'] .= 'ljpost'; $b['postopts'] .= 'ljpost';
} }
function ljpost_send(App $a, array &$b) function ljpost_send(array &$b)
{ {
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return; return;

View File

@ -67,10 +67,9 @@ function mailstream_module() {}
/** /**
* Adds an item in "addon features" in the admin menu of the site * Adds an item in "addon features" in the admin menu of the site
* *
* @param App $a App object (unused)
* @param string $o HTML form data * @param string $o HTML form data
*/ */
function mailstream_addon_admin(App $a, string &$o) function mailstream_addon_admin(string &$o)
{ {
$frommail = DI::config()->get('mailstream', 'frommail'); $frommail = DI::config()->get('mailstream', 'frommail');
$template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/'); $template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/');
@ -111,7 +110,7 @@ function mailstream_generate_id(string $uri): string
return $message_id; return $message_id;
} }
function mailstream_send_hook(App $a, array $data) function mailstream_send_hook(array $data)
{ {
$criteria = array('uid' => $data['uid'], 'contact-id' => $data['contact-id'], 'uri' => $data['uri']); $criteria = array('uid' => $data['uid'], 'contact-id' => $data['contact-id'], 'uri' => $data['uri']);
$item = Post::selectFirst([], $criteria); $item = Post::selectFirst([], $criteria);
@ -139,11 +138,10 @@ function mailstream_send_hook(App $a, array $data)
* mailstream is enabled and the necessary data is available, forks a * mailstream is enabled and the necessary data is available, forks a
* workerqueue item to send the email. * workerqueue item to send the email.
* *
* @param App $a App object (unused)
* @param array $item content of the item (may or may not already be stored in the item table) * @param array $item content of the item (may or may not already be stored in the item table)
* @return void * @return void
*/ */
function mailstream_post_hook(App $a, array &$item) function mailstream_post_hook(array &$item)
{ {
mailstream_check_version(); mailstream_check_version();
@ -477,11 +475,10 @@ function mailstream_convert_table_entries()
/** /**
* Form for configuring mailstream features for a user * Form for configuring mailstream features for a user
* *
* @param App $a App object
* @param array $data Hook data array * @param array $data Hook data array
* @throws \Friendica\Network\HTTPException\ServiceUnavailableException * @throws \Friendica\Network\HTTPException\ServiceUnavailableException
*/ */
function mailstream_addon_settings(App &$a, array &$data) function mailstream_addon_settings(array &$data)
{ {
$enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'enabled'); $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'enabled');
$address = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'address'); $address = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'address');
@ -525,11 +522,10 @@ function mailstream_addon_settings(App &$a, array &$data)
/** /**
* Process data submitted to user's mailstream features form * Process data submitted to user's mailstream features form
* @param App $a
* @param array $post POST data * @param array $post POST data
* @return void * @return void
*/ */
function mailstream_addon_settings_post(App $a, array $post) function mailstream_addon_settings_post(array $post)
{ {
if (!DI::userSession()->getLocalUserId() || empty($post['mailstream-submit'])) { if (!DI::userSession()->getLocalUserId() || empty($post['mailstream-submit'])) {
return; return;

View File

@ -17,7 +17,7 @@ function markdown_install() {
Hook::register('addon_settings_post', __FILE__, 'markdown_addon_settings_post'); Hook::register('addon_settings_post', __FILE__, 'markdown_addon_settings_post');
} }
function markdown_addon_settings(App $a, array &$data) function markdown_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -37,7 +37,7 @@ function markdown_addon_settings(App $a, array &$data)
]; ];
} }
function markdown_addon_settings_post(App $a, array &$b) function markdown_addon_settings_post(array &$b)
{ {
if (!DI::userSession()->getLocalUserId() || empty($_POST['markdown-submit'])) { if (!DI::userSession()->getLocalUserId() || empty($_POST['markdown-submit'])) {
return; return;
@ -46,7 +46,7 @@ function markdown_addon_settings_post(App $a, array &$b)
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'markdown', 'enabled', intval($_POST['enabled'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'markdown', 'enabled', intval($_POST['enabled']));
} }
function markdown_post_local_start(App $a, &$request) { function markdown_post_local_start(&$request) {
if (empty($request['body']) || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'markdown', 'enabled')) { if (empty($request['body']) || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'markdown', 'enabled')) {
return; return;
} }

View File

@ -27,7 +27,7 @@ function mastodoncustomemojis_install()
Hook::register('contacts_mod_init', __FILE__, 'mastodoncustomemojis_css_hook'); Hook::register('contacts_mod_init', __FILE__, 'mastodoncustomemojis_css_hook');
} }
function mastodoncustomemojis_css_hook(App $a) function mastodoncustomemojis_css_hook()
{ {
DI::page()['htmlhead'] .= <<<HTML DI::page()['htmlhead'] .= <<<HTML
<!-- Style added by mastodoncustomemojis --> <!-- Style added by mastodoncustomemojis -->
@ -42,7 +42,7 @@ function mastodoncustomemojis_css_hook(App $a)
HTML; HTML;
} }
function mastodoncustomemojis_put_item_in_cache(App $a, array &$hook_data) function mastodoncustomemojis_put_item_in_cache(array &$hook_data)
{ {
// Mastodon uses OStatus and ActivityPub, skipping other network protocols // Mastodon uses OStatus and ActivityPub, skipping other network protocols
if (empty($hook_data['item']['author-link']) || !in_array($hook_data['item']['network'], [Protocol::OSTATUS, Protocol::ACTIVITYPUB])) { if (empty($hook_data['item']['author-link']) || !in_array($hook_data['item']['network'], [Protocol::OSTATUS, Protocol::ACTIVITYPUB])) {

View File

@ -20,7 +20,7 @@ function mathjax_install()
Hook::register('addon_settings_post', __FILE__, 'mathjax_settings_post'); Hook::register('addon_settings_post', __FILE__, 'mathjax_settings_post');
} }
function mathjax_settings_post(App $a) function mathjax_settings_post()
{ {
if (!DI::userSession()->getLocalUserId() || empty($_POST['mathjax-submit'])) { if (!DI::userSession()->getLocalUserId() || empty($_POST['mathjax-submit'])) {
return; return;
@ -29,7 +29,7 @@ function mathjax_settings_post(App $a)
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'mathjax', 'use', intval($_POST['mathjax_use'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'mathjax', 'use', intval($_POST['mathjax_use']));
} }
function mathjax_settings(App $a, array &$data) function mathjax_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -50,7 +50,7 @@ function mathjax_settings(App $a, array &$data)
]; ];
} }
function mathjax_footer(App $a, string &$body) function mathjax_footer(string &$body)
{ {
// if the visitor of the page is not a local_user, use MathJax // if the visitor of the page is not a local_user, use MathJax
// otherwise check the users settings. // otherwise check the users settings.

View File

@ -17,9 +17,9 @@ function membersince_install()
Hook::register('profile_advanced', 'addon/membersince/membersince.php', 'membersince_display'); Hook::register('profile_advanced', 'addon/membersince/membersince.php', 'membersince_display');
} }
function membersince_display(App $a, array &$b) function membersince_display(array &$b)
{ {
if ($a->getCurrentTheme() == 'frio') { if (DI::app()->getCurrentTheme() == 'frio') {
// Works in Frio. // Works in Frio.
$doc = new DOMDocument(); $doc = new DOMDocument();
$doc->loadHTML(mb_convert_encoding($b, 'HTML-ENTITIES', 'UTF-8')); $doc->loadHTML(mb_convert_encoding($b, 'HTML-ENTITIES', 'UTF-8'));
@ -39,7 +39,7 @@ function membersince_display(App $a, array &$b)
$label->setAttribute('class', 'col-lg-4 col-md-4 col-sm-4 col-xs-12 profile-label-name text-muted'); $label->setAttribute('class', 'col-lg-4 col-md-4 col-sm-4 col-xs-12 profile-label-name text-muted');
// The div for the register date of the profile owner. // The div for the register date of the profile owner.
$entry = $doc->createElement('div', DateTimeFormat::local($a->profile['register_date'])); $entry = $doc->createElement('div', DateTimeFormat::local(DI::app()->profile['register_date']));
$entry->setAttribute('class', 'col-lg-8 col-md-8 col-sm-8 col-xs-12 profile-entry'); $entry->setAttribute('class', 'col-lg-8 col-md-8 col-sm-8 col-xs-12 profile-entry');
$div->appendChild($hr); $div->appendChild($hr);
@ -50,6 +50,6 @@ function membersince_display(App $a, array &$b)
$b = $doc->saveHTML(); $b = $doc->saveHTML();
} else { } else {
// Works in Vier. // Works in Vier.
$b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . DI::l10n()->t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local($a->profile['register_date']) . "</dd>\n</dl>", $b, 1); $b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . DI::l10n()->t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local(DI::app()->profile['register_date']) . "</dd>\n</dl>", $b, 1);
} }
} }

View File

@ -14,7 +14,7 @@ use Psr\Log\LogLevel;
require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/vendor/autoload.php';
function monolog_install(App $a) function monolog_install()
{ {
Hook::register('logger_instance' , __FILE__, 'monolog_instance'); Hook::register('logger_instance' , __FILE__, 'monolog_instance');
} }
@ -24,7 +24,7 @@ function monolog_uninstall()
Hook::unregister('logger_instance', __FILE__, 'monolog_instance'); Hook::unregister('logger_instance', __FILE__, 'monolog_instance');
} }
function monolog_instance(App $a, array &$data) function monolog_instance(array &$data)
{ {
if ($data['name'] !== 'monolog') { if ($data['name'] !== 'monolog') {
return; return;

View File

@ -19,7 +19,7 @@ function morechoice_install() {
Hook::register('marital_selector', 'addon/morechoice/morechoice.php', 'morechoice_marital_selector'); Hook::register('marital_selector', 'addon/morechoice/morechoice.php', 'morechoice_marital_selector');
} }
function morechoice_gender_selector(App $a, array &$b) { function morechoice_gender_selector(array &$b) {
$b['Androgyne'] = DI::l10n()->t('Androgyne'); $b['Androgyne'] = DI::l10n()->t('Androgyne');
$b['Bear'] = DI::l10n()->t('Bear'); $b['Bear'] = DI::l10n()->t('Bear');
$b['Bigender'] = DI::l10n()->t('Bigender'); $b['Bigender'] = DI::l10n()->t('Bigender');
@ -45,7 +45,7 @@ function morechoice_gender_selector(App $a, array &$b) {
$b['Hard to tell these days'] = DI::l10n()->t('Hard to tell these days'); $b['Hard to tell these days'] = DI::l10n()->t('Hard to tell these days');
} }
function morechoice_sexpref_selector(App $a, array &$b) { function morechoice_sexpref_selector(array &$b) {
$b['Girls with big tits'] = DI::l10n()->t('Girls with big tits'); $b['Girls with big tits'] = DI::l10n()->t('Girls with big tits');
$b['Millionaires'] = DI::l10n()->t('Millionaires'); $b['Millionaires'] = DI::l10n()->t('Millionaires');
$b['Guys with big schlongs'] = DI::l10n()->t('Guys with big schlongs'); $b['Guys with big schlongs'] = DI::l10n()->t('Guys with big schlongs');
@ -98,7 +98,7 @@ function morechoice_sexpref_selector(App $a, array &$b) {
$b['I\'d rather just have some chocolate'] = DI::l10n()->t('I\'d rather just have some chocolate'); $b['I\'d rather just have some chocolate'] = DI::l10n()->t('I\'d rather just have some chocolate');
} }
function morechoice_marital_selector(App $a, array &$b) { function morechoice_marital_selector(array &$b) {
$b['Married to my job'] = DI::l10n()->t('Married to my job'); $b['Married to my job'] = DI::l10n()->t('Married to my job');
$b['Polygamist'] = DI::l10n()->t('Polygamist'); $b['Polygamist'] = DI::l10n()->t('Polygamist');
$b['Half married'] = DI::l10n()->t('Half married'); $b['Half married'] = DI::l10n()->t('Half married');

View File

@ -16,7 +16,7 @@ function morepokes_install()
Hook::register('poke_verbs', 'addon/morepokes/morepokes.php', 'morepokes_poke_verbs'); Hook::register('poke_verbs', 'addon/morepokes/morepokes.php', 'morepokes_poke_verbs');
} }
function morepokes_poke_verbs(App $a, array &$b) function morepokes_poke_verbs(array &$b)
{ {
$b['bitchslap'] = ['bitchslapped', DI::l10n()->t('bitchslap'), DI::l10n()->t('bitchslapped')]; $b['bitchslap'] = ['bitchslapped', DI::l10n()->t('bitchslap'), DI::l10n()->t('bitchslapped')];
$b['shag'] = ['shag', DI::l10n()->t('shag'), DI::l10n()->t('shagged')]; $b['shag'] = ['shag', DI::l10n()->t('shag'), DI::l10n()->t('shagged')];

View File

@ -19,7 +19,7 @@ function newmemberwidget_install()
Logger::notice('newmemberwidget installed'); Logger::notice('newmemberwidget installed');
} }
function newmemberwidget_network_mod_init (App $a, $b) function newmemberwidget_network_mod_init ($b)
{ {
if (empty($_SESSION['new_member'])) { if (empty($_SESSION['new_member'])) {
return; return;
@ -46,7 +46,7 @@ function newmemberwidget_network_mod_init (App $a, $b)
DI::page()['aside'] = $t . DI::page()['aside']; DI::page()['aside'] = $t . DI::page()['aside'];
} }
function newmemberwidget_addon_admin_post(App $a) function newmemberwidget_addon_admin_post()
{ {
DI::config()->set('newmemberwidget', 'freetext', (!empty($_POST['freetext']) ? trim($_POST['freetext']) : "")); DI::config()->set('newmemberwidget', 'freetext', (!empty($_POST['freetext']) ? trim($_POST['freetext']) : ""));
DI::config()->set('newmemberwidget', 'linkglobalsupport', intval($_POST['linkglobalsupport'])); DI::config()->set('newmemberwidget', 'linkglobalsupport', intval($_POST['linkglobalsupport']));
@ -54,7 +54,7 @@ function newmemberwidget_addon_admin_post(App $a)
DI::config()->set('newmemberwidget', 'localsupport', trim($_POST['localsupportname'] ?? '')); DI::config()->set('newmemberwidget', 'localsupport', trim($_POST['localsupportname'] ?? ''));
} }
function newmemberwidget_addon_admin(App $a, string &$o) function newmemberwidget_addon_admin(string &$o)
{ {
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/newmemberwidget'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/newmemberwidget');

View File

@ -35,7 +35,7 @@ function nitter_install()
/* Handle the send data from the admin settings /* Handle the send data from the admin settings
*/ */
function nitter_addon_admin_post(App $a) function nitter_addon_admin_post()
{ {
DI::config()->set('nitter', 'server', rtrim(trim($_POST['nitterserver']), '/')); DI::config()->set('nitter', 'server', rtrim(trim($_POST['nitterserver']), '/'));
} }
@ -43,7 +43,7 @@ function nitter_addon_admin_post(App $a)
/* Hook into the admin settings to let the admin choose a /* Hook into the admin settings to let the admin choose a
* nitter server to use for the replacement. * nitter server to use for the replacement.
*/ */
function nitter_addon_admin(App $a, string &$o) function nitter_addon_admin(string &$o)
{ {
$nitterserver = DI::config()->get('nitter', 'server'); $nitterserver = DI::config()->get('nitter', 'server');
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/nitter/'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/nitter/');
@ -57,7 +57,7 @@ function nitter_addon_admin(App $a, string &$o)
/* /*
* replace "twitter.com" with "nitter.net" * replace "twitter.com" with "nitter.net"
*/ */
function nitter_render(App $a, array &$b) function nitter_render(array &$b)
{ {
// this needs to be a system setting // this needs to be a system setting
$replaced = false; $replaced = false;

View File

@ -65,12 +65,12 @@ function nominatim_resolve_item(array &$item)
} }
} }
function nominatim_post_hook(App $a, array &$item) function nominatim_post_hook(array &$item)
{ {
nominatim_resolve_item($item); nominatim_resolve_item($item);
} }
function nominatim_addon_admin(App $a, string &$o) function nominatim_addon_admin(string &$o)
{ {
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/nominatim/'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/nominatim/');
@ -81,7 +81,7 @@ function nominatim_addon_admin(App $a, string &$o)
]); ]);
} }
function nominatim_addon_admin_post(App $a) function nominatim_addon_admin_post()
{ {
DI::config()->set('nominatim', 'language', (!empty($_POST['language']) ? trim($_POST['language']) : '')); DI::config()->set('nominatim', 'language', (!empty($_POST['language']) ? trim($_POST['language']) : ''));
} }

View File

@ -22,15 +22,15 @@ use Friendica\DI;
*/ */
function notifyall_module() {} function notifyall_module() {}
function notifyall_addon_admin(App $a, string &$o) function notifyall_addon_admin(string &$o)
{ {
$o = '<div></div>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . DI::baseUrl()->get() . '/notifyall">' . DI::l10n()->t('Send email to all members') . '</a></br/>'; $o = '<div></div>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . DI::baseUrl()->get() . '/notifyall">' . DI::l10n()->t('Send email to all members') . '</a></br/>';
} }
function notifyall_post(App $a) function notifyall_post()
{ {
if (!$a->isSiteAdmin()) { if (!DI::userSession()->isSiteAdmin()) {
return; return;
} }
@ -67,9 +67,9 @@ function notifyall_post(App $a)
DI::baseUrl()->redirect('admin'); DI::baseUrl()->redirect('admin');
} }
function notifyall_content(App $a) function notifyall_content()
{ {
if (!$a->isSiteAdmin()) { if (!DI::userSession()->isSiteAdmin()) {
return ''; return '';
} }

View File

@ -51,7 +51,7 @@ function nsfw_extract_photos($body)
return $new_body; return $new_body;
} }
function nsfw_addon_settings(App &$a, array &$data) function nsfw_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -74,7 +74,7 @@ function nsfw_addon_settings(App &$a, array &$data)
]; ];
} }
function nsfw_addon_settings_post(App $a, array &$b) function nsfw_addon_settings_post(array &$b)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -102,7 +102,7 @@ function nsfw_addon_settings_post(App $a, array &$b)
} }
} }
function nsfw_prepare_body_content_filter(App $a, &$hook_data) function nsfw_prepare_body_content_filter(&$hook_data)
{ {
$words = null; $words = null;
if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'nsfw', 'disable')) { if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'nsfw', 'disable')) {

View File

@ -28,7 +28,7 @@ function numfriends_install() {
* and if so set our configuration setting for this person. * and if so set our configuration setting for this person.
* *
*/ */
function numfriends_settings_post(App $a, $post) { function numfriends_settings_post($post) {
if (! DI::userSession()->getLocalUserId() || empty($_POST['numfriends-submit'])) { if (! DI::userSession()->getLocalUserId() || empty($_POST['numfriends-submit'])) {
return; return;
} }
@ -43,7 +43,7 @@ function numfriends_settings_post(App $a, $post) {
* Add our own settings info to the page. * Add our own settings info to the page.
* *
*/ */
function numfriends_settings(App &$a, array &$data) function numfriends_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -35,12 +35,12 @@ function openstreetmap_install()
Logger::notice("installed openstreetmap"); Logger::notice("installed openstreetmap");
} }
function openstreetmap_load_config(App $a, ConfigFileManager $loader) function openstreetmap_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
function openstreetmap_alterheader(App $a, &$navHtml) function openstreetmap_alterheader(&$navHtml)
{ {
$addScriptTag = '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/openstreetmap/openstreetmap.js"></script>' . "\r\n"; $addScriptTag = '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/openstreetmap/openstreetmap.js"></script>' . "\r\n";
DI::page()['htmlhead'] .= $addScriptTag; DI::page()['htmlhead'] .= $addScriptTag;
@ -52,10 +52,9 @@ function openstreetmap_alterheader(App $a, &$navHtml)
* If an item has coordinates add link to a tile map server, e.g. openstreetmap.org. * If an item has coordinates add link to a tile map server, e.g. openstreetmap.org.
* If an item has a location open it with the help of OSM's Nominatim reverse geocode search. * If an item has a location open it with the help of OSM's Nominatim reverse geocode search.
* *
* @param mixed $a
* @param array& $item * @param array& $item
*/ */
function openstreetmap_location(App $a, &$item) function openstreetmap_location(array &$item)
{ {
if (!(strlen($item['location']) || strlen($item['coord']))) { if (!(strlen($item['location']) || strlen($item['coord']))) {
return; return;
@ -105,7 +104,7 @@ function openstreetmap_location(App $a, &$item)
$item['html'] = '<a target="map" title="' . $title . '" href= "' . $target . '">' . $title . '</a>'; $item['html'] = '<a target="map" title="' . $title . '" href= "' . $target . '">' . $title . '</a>';
} }
function openstreetmap_get_coordinates(App $a, array &$b) function openstreetmap_get_coordinates(array &$b)
{ {
$nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM); $nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM);
@ -133,16 +132,16 @@ function openstreetmap_get_coordinates(App $a, array &$b)
} }
} }
function openstreetmap_generate_named_map(App $a, array &$b) function openstreetmap_generate_named_map(array &$b)
{ {
openstreetmap_get_coordinates($a, $b); openstreetmap_get_coordinates($b);
if (!empty($b['lat']) && !empty($b['lon'])) { if (!empty($b['lat']) && !empty($b['lon'])) {
openstreetmap_generate_map($a, $b); openstreetmap_generate_map($b);
} }
} }
function openstreetmap_generate_map(App $a, array &$b) function openstreetmap_generate_map(array &$b)
{ {
$tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS); $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS);
@ -178,7 +177,7 @@ function openstreetmap_generate_map(App $a, array &$b)
Logger::debug('generate_map: ' . $b['html']); Logger::debug('generate_map: ' . $b['html']);
} }
function openstreetmap_addon_admin(App $a, string &$o) function openstreetmap_addon_admin(string &$o)
{ {
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/openstreetmap/'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/openstreetmap/');
$tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS); $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS);
@ -200,7 +199,7 @@ function openstreetmap_addon_admin(App $a, string &$o)
]); ]);
} }
function openstreetmap_addon_admin_post(App $a) function openstreetmap_addon_admin_post()
{ {
DI::config()->set('openstreetmap', 'tmsserver', ($_POST['tmsserver'] ?? '') ?: OSM_TMS); DI::config()->set('openstreetmap', 'tmsserver', ($_POST['tmsserver'] ?? '') ?: OSM_TMS);
DI::config()->set('openstreetmap', 'nomserver', ($_POST['nomserver'] ?? '') ?: OSM_NOM); DI::config()->set('openstreetmap', 'nomserver', ($_POST['nomserver'] ?? '') ?: OSM_NOM);

View File

@ -26,7 +26,7 @@ function opmlexport_install()
} }
function opmlexport(App $a) function opmlexport()
{ {
$condition = [ $condition = [
'uid' => DI::userSession()->getLocalUserId(), 'uid' => DI::userSession()->getLocalUserId(),
@ -68,7 +68,7 @@ function opmlexport(App $a)
} }
function opmlexport_addon_settings(App $a, array &$data) function opmlexport_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -82,11 +82,11 @@ function opmlexport_addon_settings(App $a, array &$data)
} }
function opmlexport_addon_settings_post(App $a, array &$b) function opmlexport_addon_settings_post(array &$b)
{ {
if (!DI::userSession()->getLocalUserId() || empty($_POST['opmlexport-submit'])) { if (!DI::userSession()->getLocalUserId() || empty($_POST['opmlexport-submit'])) {
return; return;
} }
opmlexport($a); opmlexport();
} }

View File

@ -17,9 +17,9 @@ function pageheader_install() {
Hook::register('page_content_top', __FILE__, 'pageheader_fetch'); Hook::register('page_content_top', __FILE__, 'pageheader_fetch');
} }
function pageheader_addon_admin(App &$a, string &$s) function pageheader_addon_admin(string &$s)
{ {
if (!$a->isSiteAdmin()) { if (!DI::userSession()->isSiteAdmin()) {
return; return;
} }
@ -39,9 +39,9 @@ function pageheader_addon_admin(App &$a, string &$s)
return; return;
} }
function pageheader_addon_admin_post(App $a) function pageheader_addon_admin_post()
{ {
if (!$a->isSiteAdmin()) { if (!DI::userSession()->isSiteAdmin()) {
return; return;
} }
@ -52,7 +52,7 @@ function pageheader_addon_admin_post(App $a)
} }
} }
function pageheader_fetch(App $a, string &$b) function pageheader_fetch(string &$b)
{ {
if (file_exists('pageheader.html')) { if (file_exists('pageheader.html')) {
$s = file_get_contents('pageheader.html'); $s = file_get_contents('pageheader.html');

View File

@ -23,16 +23,15 @@ function phpmailer_install()
Hook::register('emailer_send_prepare', __FILE__, 'phpmailer_emailer_send_prepare', 5); Hook::register('emailer_send_prepare', __FILE__, 'phpmailer_emailer_send_prepare', 5);
} }
function phpmailer_load_config(App $a, ConfigFileManager $loader) function phpmailer_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
/** /**
* @param App $a
* @param IEmail $email * @param IEmail $email
*/ */
function phpmailer_emailer_send_prepare(App $a, IEmail &$email) function phpmailer_emailer_send_prepare(IEmail &$email)
{ {
// Passing `true` enables exceptions // Passing `true` enables exceptions
$mailer = new PHPMailer(true); $mailer = new PHPMailer(true);

View File

@ -48,12 +48,12 @@ function piwik_install() {
Logger::notice("installed piwik addon"); Logger::notice("installed piwik addon");
} }
function piwik_load_config(App $a, ConfigFileManager $loader) function piwik_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('piwik'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('piwik'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
function piwik_analytics(App $a, string &$b) function piwik_analytics(string &$b)
{ {
/* /*
* styling of every HTML block added by this addon is done in the * styling of every HTML block added by this addon is done in the
@ -94,7 +94,7 @@ function piwik_analytics(App $a, string &$b)
$b .= "</div>"; $b .= "</div>";
} }
} }
function piwik_addon_admin (App $a, string &$o) function piwik_addon_admin (string &$o)
{ {
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/piwik/" ); $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/piwik/" );
@ -107,7 +107,7 @@ function piwik_addon_admin (App $a, string &$o)
]); ]);
} }
function piwik_addon_admin_post(App $a) function piwik_addon_admin_post()
{ {
DI::config()->set('piwik', 'baseurl', trim($_POST['baseurl'] ?? '')); DI::config()->set('piwik', 'baseurl', trim($_POST['baseurl'] ?? ''));
DI::config()->set('piwik', 'siteid', trim($_POST['siteid'] ?? '')); DI::config()->set('piwik', 'siteid', trim($_POST['siteid'] ?? ''));

View File

@ -38,7 +38,7 @@ function planets_install()
* - A status post by a profile owner * - A status post by a profile owner
* - The profile owner must have allowed our addon * - The profile owner must have allowed our addon
*/ */
function planets_post_hook(App $a, &$item) function planets_post_hook(&$item)
{ {
Logger::notice('planets invoked'); Logger::notice('planets invoked');
@ -93,7 +93,7 @@ function planets_post_hook(App $a, &$item)
* *
*/ */
function planets_settings_post(App $a, $post) function planets_settings_post($post)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -113,7 +113,7 @@ function planets_settings_post(App $a, $post)
function planets_settings(App &$a, array &$data) function planets_settings(array &$data)
{ {
if(!DI::userSession()->getLocalUserId()) { if(!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -27,12 +27,12 @@ function public_server_install()
Hook::register('logged_in', 'addon/public_server/public_server.php', 'public_server_login'); Hook::register('logged_in', 'addon/public_server/public_server.php', 'public_server_login');
} }
function public_server_load_config(App $a, ConfigFileManager $loader) function public_server_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('public_server'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('public_server'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
function public_server_register_account(App $a, $b) function public_server_register_account($b)
{ {
$uid = $b; $uid = $b;
@ -46,7 +46,7 @@ function public_server_register_account(App $a, $b)
DBA::update('user', $fields, ['uid' => $uid]); DBA::update('user', $fields, ['uid' => $uid]);
} }
function public_server_cron(App $a, $b) function public_server_cron($b)
{ {
Logger::notice("public_server: cron start"); Logger::notice("public_server: cron start");
@ -100,7 +100,7 @@ function public_server_cron(App $a, $b)
Logger::notice("public_server: cron end"); Logger::notice("public_server: cron end");
} }
function public_server_enotify(App $a, array &$b) function public_server_enotify(array &$b)
{ {
if (!empty($b['params']) && $b['params']['type'] == Notification\Type::SYSTEM if (!empty($b['params']) && $b['params']['type'] == Notification\Type::SYSTEM
&& !empty($b['params']['system_type']) && $b['params']['system_type'] === 'public_server_expire') { && !empty($b['params']['system_type']) && $b['params']['system_type'] === 'public_server_expire') {
@ -111,7 +111,7 @@ function public_server_enotify(App $a, array &$b)
} }
} }
function public_server_login(App $a, $b) function public_server_login($b)
{ {
$days = DI::config()->get('public_server', 'expiredays'); $days = DI::config()->get('public_server', 'expiredays');
if (!$days) { if (!$days) {
@ -123,7 +123,7 @@ function public_server_login(App $a, $b)
DBA::update('user', $fields, $condition); DBA::update('user', $fields, $condition);
} }
function public_server_addon_admin_post(App $a) function public_server_addon_admin_post()
{ {
BaseModule::checkFormSecurityTokenRedirectOnError('/admin/addons/publicserver', 'publicserver'); BaseModule::checkFormSecurityTokenRedirectOnError('/admin/addons/publicserver', 'publicserver');
@ -135,7 +135,7 @@ function public_server_addon_admin_post(App $a)
DI::config()->set('public_server', 'flagpostsexpire', trim($_POST['flagpostsexpire'] ?? '')); DI::config()->set('public_server', 'flagpostsexpire', trim($_POST['flagpostsexpire'] ?? ''));
} }
function public_server_addon_admin(App $a, string &$o) function public_server_addon_admin(string &$o)
{ {
$token = BaseModule::getFormSecurityToken('publicserver'); $token = BaseModule::getFormSecurityToken('publicserver');
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/public_server'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/public_server');

View File

@ -56,7 +56,7 @@ function pumpio_install()
*/ */
function pumpio_module() {} function pumpio_module() {}
function pumpio_content(App $a) function pumpio_content()
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
@ -66,7 +66,7 @@ function pumpio_content(App $a)
if (isset(DI::args()->getArgv()[1])) { if (isset(DI::args()->getArgv()[1])) {
switch (DI::args()->getArgv()[1]) { switch (DI::args()->getArgv()[1]) {
case 'connect': case 'connect':
$o = pumpio_connect($a); $o = pumpio_connect();
break; break;
default: default:
@ -74,12 +74,12 @@ function pumpio_content(App $a)
break; break;
} }
} else { } else {
$o = pumpio_connect($a); $o = pumpio_connect();
} }
return $o; return $o;
} }
function pumpio_check_item_notification(App $a, array &$notification_data) function pumpio_check_item_notification(array &$notification_data)
{ {
$hostname = DI::pConfig()->get($notification_data['uid'], 'pumpio', 'host'); $hostname = DI::pConfig()->get($notification_data['uid'], 'pumpio', 'host');
$username = DI::pConfig()->get($notification_data['uid'], 'pumpio', 'user'); $username = DI::pConfig()->get($notification_data['uid'], 'pumpio', 'user');
@ -87,7 +87,7 @@ function pumpio_check_item_notification(App $a, array &$notification_data)
$notification_data['profiles'][] = 'https://' . $hostname . '/' . $username; $notification_data['profiles'][] = 'https://' . $hostname . '/' . $username;
} }
function pumpio_registerclient(App $a, $host) function pumpio_registerclient($host)
{ {
$url = 'https://' . $host . '/api/client/register'; $url = 'https://' . $host . '/api/client/register';
@ -131,7 +131,7 @@ function pumpio_registerclient(App $a, $host)
} }
function pumpio_connect(App $a) function pumpio_connect()
{ {
// Define the needed keys // Define the needed keys
$consumer_key = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key'); $consumer_key = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key');
@ -140,7 +140,7 @@ function pumpio_connect(App $a)
if ((($consumer_key == '') || ($consumer_secret == '')) && ($hostname != '')) { if ((($consumer_key == '') || ($consumer_secret == '')) && ($hostname != '')) {
Logger::notice('pumpio_connect: register client'); Logger::notice('pumpio_connect: register client');
$clientdata = pumpio_registerclient($a, $hostname); $clientdata = pumpio_registerclient($hostname);
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key', $clientdata->client_id); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key', $clientdata->client_id);
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_secret', $clientdata->client_secret); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_secret', $clientdata->client_secret);
@ -203,7 +203,7 @@ function pumpio_connect(App $a)
return $o; return $o;
} }
function pumpio_jot_nets(App $a, array &$jotnets_fields) function pumpio_jot_nets(array &$jotnets_fields)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -221,7 +221,7 @@ function pumpio_jot_nets(App $a, array &$jotnets_fields)
} }
} }
function pumpio_settings(App $a, array &$data) function pumpio_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -272,7 +272,7 @@ function pumpio_settings(App $a, array &$data)
]; ];
} }
function pumpio_settings_post(App $a, array &$b) function pumpio_settings_post(array &$b)
{ {
if (!empty($_POST['pumpio_delete'])) { if (!empty($_POST['pumpio_delete'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key' , ''); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key' , '');
@ -318,12 +318,12 @@ function pumpio_settings_post(App $a, array &$b)
} }
} }
function pumpio_load_config(App $a, ConfigFileManager $loader) function pumpio_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('pumpio'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('pumpio'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
function pumpio_hook_fork(App $a, array &$b) function pumpio_hook_fork(array &$b)
{ {
if ($b['name'] != 'notifier_normal') { if ($b['name'] != 'notifier_normal') {
return; return;
@ -359,7 +359,7 @@ function pumpio_hook_fork(App $a, array &$b)
} }
} }
function pumpio_post_local(App $a, array &$b) function pumpio_post_local(array &$b)
{ {
if (!DI::userSession()->getLocalUserId() || (DI::userSession()->getLocalUserId() != $b['uid'])) { if (!DI::userSession()->getLocalUserId() || (DI::userSession()->getLocalUserId() != $b['uid'])) {
return; return;
@ -384,7 +384,7 @@ function pumpio_post_local(App $a, array &$b)
$b['postopts'] .= 'pumpio'; $b['postopts'] .= 'pumpio';
} }
function pumpio_send(App $a, array &$b) function pumpio_send(array &$b)
{ {
if (!DI::pConfig()->get($b['uid'], 'pumpio', 'import') && ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))) { if (!DI::pConfig()->get($b['uid'], 'pumpio', 'import') && ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))) {
return; return;
@ -408,7 +408,7 @@ function pumpio_send(App $a, array &$b)
} else { } else {
$iscomment = false; $iscomment = false;
$receiver = pumpio_getreceiver($a, $b); $receiver = pumpio_getreceiver($b);
Logger::notice('pumpio_send: receiver ', $receiver); Logger::notice('pumpio_send: receiver ', $receiver);
@ -426,9 +426,9 @@ function pumpio_send(App $a, array &$b)
if ($b['verb'] == Activity::LIKE) { if ($b['verb'] == Activity::LIKE) {
if ($b['deleted']) { if ($b['deleted']) {
pumpio_action($a, $b['uid'], $b['thr-parent'], 'unlike'); pumpio_action($b['uid'], $b['thr-parent'], 'unlike');
} else { } else {
pumpio_action($a, $b['uid'], $b['thr-parent'], 'like'); pumpio_action($b['uid'], $b['thr-parent'], 'like');
} }
return; return;
} }
@ -438,11 +438,11 @@ function pumpio_send(App $a, array &$b)
} }
if (($b['verb'] == Activity::POST) && ($b['created'] !== $b['edited']) && !$b['deleted']) { if (($b['verb'] == Activity::POST) && ($b['created'] !== $b['edited']) && !$b['deleted']) {
pumpio_action($a, $b['uid'], $b['uri'], 'update', $b['body']); pumpio_action($b['uid'], $b['uri'], 'update', $b['body']);
} }
if (($b['verb'] == Activity::POST) && $b['deleted']) { if (($b['verb'] == Activity::POST) && $b['deleted']) {
pumpio_action($a, $b['uid'], $b['uri'], 'delete'); pumpio_action($b['uid'], $b['uri'], 'delete');
} }
if ($b['deleted'] || ($b['created'] !== $b['edited'])) { if ($b['deleted'] || ($b['created'] !== $b['edited'])) {
@ -556,7 +556,7 @@ function pumpio_send(App $a, array &$b)
} }
} }
function pumpio_action(App $a, int $uid, string $uri, string $action, string $content = '') function pumpio_action(int $uid, string $uri, string $action, string $content = '')
{ {
// Don't do likes and other stuff if you don't import the timeline // Don't do likes and other stuff if you don't import the timeline
if (!DI::pConfig()->get($uid, 'pumpio', 'import')) { if (!DI::pConfig()->get($uid, 'pumpio', 'import')) {
@ -625,7 +625,7 @@ function pumpio_action(App $a, int $uid, string $uri, string $action, string $co
} }
} }
function pumpio_sync(App $a) function pumpio_sync()
{ {
if (!Addon::isEnabled('pumpio')) { if (!Addon::isEnabled('pumpio')) {
return; return;
@ -647,7 +647,7 @@ function pumpio_sync(App $a)
$pconfigs = DBA::selectToArray('pconfig', ['uid'], ['cat' => 'pumpio', 'k' => 'mirror', 'v' => '1']); $pconfigs = DBA::selectToArray('pconfig', ['uid'], ['cat' => 'pumpio', 'k' => 'mirror', 'v' => '1']);
foreach ($pconfigs as $rr) { foreach ($pconfigs as $rr) {
Logger::notice('pumpio: mirroring user '.$rr['uid']); Logger::notice('pumpio: mirroring user '.$rr['uid']);
pumpio_fetchtimeline($a, $rr['uid']); pumpio_fetchtimeline($rr['uid']);
} }
$abandon_days = intval(DI::config()->get('system', 'account_abandon_days')); $abandon_days = intval(DI::config()->get('system', 'account_abandon_days'));
@ -667,7 +667,7 @@ function pumpio_sync(App $a)
} }
Logger::notice('pumpio: importing timeline from user '.$rr['uid']); Logger::notice('pumpio: importing timeline from user '.$rr['uid']);
pumpio_fetchinbox($a, $rr['uid']); pumpio_fetchinbox($rr['uid']);
// check for new contacts once a day // check for new contacts once a day
$last_contact_check = DI::pConfig()->get($rr['uid'], 'pumpio', 'contact_check'); $last_contact_check = DI::pConfig()->get($rr['uid'], 'pumpio', 'contact_check');
@ -678,7 +678,7 @@ function pumpio_sync(App $a)
} }
if ($next_contact_check <= time()) { if ($next_contact_check <= time()) {
pumpio_getallusers($a, $rr['uid']); pumpio_getallusers($rr['uid']);
DI::pConfig()->set($rr['uid'], 'pumpio', 'contact_check', time()); DI::pConfig()->set($rr['uid'], 'pumpio', 'contact_check', time());
} }
} }
@ -688,12 +688,12 @@ function pumpio_sync(App $a)
DI::keyValue()->set('pumpio_last_poll', time()); DI::keyValue()->set('pumpio_last_poll', time());
} }
function pumpio_cron(App $a, $b) function pumpio_cron($b)
{ {
Worker::add(Worker::PRIORITY_MEDIUM, 'addon/pumpio/pumpio_sync.php'); Worker::add(Worker::PRIORITY_MEDIUM, 'addon/pumpio/pumpio_sync.php');
} }
function pumpio_fetchtimeline(App $a, int $uid) function pumpio_fetchtimeline(int $uid)
{ {
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key'); $ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret'); $csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
@ -814,7 +814,7 @@ function pumpio_fetchtimeline(App $a, int $uid)
} }
} }
function pumpio_dounlike(App $a, int $uid, array $self, $post, string $own_id) function pumpio_dounlike(int $uid, array $self, $post, string $own_id)
{ {
// Searching for the unliked post // Searching for the unliked post
// Two queries for speed issues // Two queries for speed issues
@ -850,7 +850,7 @@ function pumpio_dounlike(App $a, int $uid, array $self, $post, string $own_id)
} }
} }
function pumpio_dolike(App $a, int $uid, array $self, $post, string $own_id, $threadcompletion = true) function pumpio_dolike(int $uid, array $self, $post, string $own_id, $threadcompletion = true)
{ {
if (empty($post->object->id)) { if (empty($post->object->id)) {
Logger::info('Got empty like: '.print_r($post, true)); Logger::info('Got empty like: '.print_r($post, true));
@ -869,7 +869,7 @@ function pumpio_dolike(App $a, int $uid, array $self, $post, string $own_id, $th
// thread completion // thread completion
if ($threadcompletion) { if ($threadcompletion) {
pumpio_fetchallcomments($a, $uid, $post->object->id); pumpio_fetchallcomments($uid, $post->object->id);
} }
$contactid = 0; $contactid = 0;
@ -988,7 +988,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false)
return $contact_id; return $contact_id;
} }
function pumpio_dodelete(App $a, int $uid, array $self, $post, string $own_id) function pumpio_dodelete(int $uid, array $self, $post, string $own_id)
{ {
// Two queries for speed issues // Two queries for speed issues
$condition = ['uri' => $post->object->id, 'uid' => $uid]; $condition = ['uri' => $post->object->id, 'uid' => $uid];
@ -1005,18 +1005,18 @@ function pumpio_dodelete(App $a, int $uid, array $self, $post, string $own_id)
return false; return false;
} }
function pumpio_dopost(App $a, $client, int $uid, array $self, $post, string $own_id, bool $threadcompletion = true) function pumpio_dopost($client, int $uid, array $self, $post, string $own_id, bool $threadcompletion = true)
{ {
if (($post->verb == 'like') || ($post->verb == 'favorite')) { if (($post->verb == 'like') || ($post->verb == 'favorite')) {
return pumpio_dolike($a, $uid, $self, $post, $own_id); return pumpio_dolike($uid, $self, $post, $own_id);
} }
if (($post->verb == 'unlike') || ($post->verb == 'unfavorite')) { if (($post->verb == 'unlike') || ($post->verb == 'unfavorite')) {
return pumpio_dounlike($a, $uid, $self, $post, $own_id); return pumpio_dounlike($uid, $self, $post, $own_id);
} }
if ($post->verb == 'delete') { if ($post->verb == 'delete') {
return pumpio_dodelete($a, $uid, $self, $post, $own_id); return pumpio_dodelete($uid, $self, $post, $own_id);
} }
if ($post->verb != 'update') { if ($post->verb != 'update') {
@ -1110,7 +1110,7 @@ function pumpio_dopost(App $a, $client, int $uid, array $self, $post, string $ow
$reply->generator->displayName = 'pumpio'; $reply->generator->displayName = 'pumpio';
$reply->published = $post->object->inReplyTo->published; $reply->published = $post->object->inReplyTo->published;
$reply->received = $post->object->inReplyTo->updated; $reply->received = $post->object->inReplyTo->updated;
pumpio_dopost($a, $client, $uid, $self, $reply, $own_id, false); pumpio_dopost($client, $uid, $self, $reply, $own_id, false);
$postarray['thr-parent'] = $post->object->inReplyTo->id; $postarray['thr-parent'] = $post->object->inReplyTo->id;
} }
@ -1195,13 +1195,13 @@ function pumpio_dopost(App $a, $client, int $uid, array $self, $post, string $ow
} }
if (($post->object->objectType == 'comment') && $threadcompletion) { if (($post->object->objectType == 'comment') && $threadcompletion) {
pumpio_fetchallcomments($a, $uid, $postarray['thr-parent']); pumpio_fetchallcomments($uid, $postarray['thr-parent']);
} }
return $top_item; return $top_item;
} }
function pumpio_fetchinbox(App $a, int $uid) function pumpio_fetchinbox(int $uid)
{ {
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key'); $ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret'); $csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
@ -1254,20 +1254,20 @@ function pumpio_fetchinbox(App $a, int $uid)
if (count($posts)) { if (count($posts)) {
foreach ($posts as $post) { foreach ($posts as $post) {
$last_id = $post->id; $last_id = $post->id;
pumpio_dopost($a, $client, $uid, $self, $post, $own_id, true); pumpio_dopost($client, $uid, $self, $post, $own_id, true);
} }
} }
} }
while ($item = DBA::fetch($lastitems)) { while ($item = DBA::fetch($lastitems)) {
pumpio_fetchallcomments($a, $uid, $item['uri']); pumpio_fetchallcomments($uid, $item['uri']);
} }
DBA::close($lastitems); DBA::close($lastitems);
DI::pConfig()->set($uid, 'pumpio', 'last_id', $last_id); DI::pConfig()->set($uid, 'pumpio', 'last_id', $last_id);
} }
function pumpio_getallusers(App &$a, int $uid) function pumpio_getallusers(int $uid)
{ {
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key'); $ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret'); $csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
@ -1315,7 +1315,7 @@ function pumpio_getallusers(App &$a, int $uid)
} }
} }
function pumpio_getreceiver(App $a, array $b) function pumpio_getreceiver(array $b)
{ {
$receiver = []; $receiver = [];
@ -1394,7 +1394,7 @@ function pumpio_getreceiver(App $a, array $b)
return $receiver; return $receiver;
} }
function pumpio_fetchallcomments(App $a, $uid, $id) function pumpio_fetchallcomments($uid, $id)
{ {
$ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key'); $ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key');
$csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret'); $csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret');
@ -1454,7 +1454,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
$like->actor->url = $item->url; $like->actor->url = $item->url;
$like->generator = new stdClass; $like->generator = new stdClass;
$like->generator->displayName = 'pumpio'; $like->generator->displayName = 'pumpio';
pumpio_dolike($a, $uid, $self, $post, $own_id, false); pumpio_dolike($uid, $self, $post, $own_id, false);
} }
} }
@ -1492,7 +1492,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
$post->object = $item; $post->object = $item;
Logger::notice('pumpio_fetchallcomments: posting comment ' . $post->object->id . ' ', json_decode(json_encode($post), true)); Logger::notice('pumpio_fetchallcomments: posting comment ' . $post->object->id . ' ', json_decode(json_encode($post), true));
pumpio_dopost($a, $client, $uid, $self, $post, $own_id, false); pumpio_dopost($client, $uid, $self, $post, $own_id, false);
} }
} }

View File

@ -3,8 +3,6 @@ use Friendica\Core\Logger;
use Friendica\DI; use Friendica\DI;
function pumpio_sync_run(array $argv, int $argc) { function pumpio_sync_run(array $argv, int $argc) {
$a = Friendica\DI::app();
require_once 'addon/pumpio/pumpio.php'; require_once 'addon/pumpio/pumpio.php';
if (function_exists('sys_getloadavg')) { if (function_exists('sys_getloadavg')) {
@ -15,5 +13,5 @@ function pumpio_sync_run(array $argv, int $argc) {
} }
} }
pumpio_sync($a); pumpio_sync();
} }

View File

@ -31,12 +31,12 @@ function qcomment_install()
Hook::register('footer' , __FILE__, 'qcomment_footer'); Hook::register('footer' , __FILE__, 'qcomment_footer');
} }
function qcomment_footer(App $a, string &$body) function qcomment_footer(string &$body)
{ {
DI::page()->registerFooterScript('addon/qcomment/qcomment.js'); DI::page()->registerFooterScript('addon/qcomment/qcomment.js');
} }
function qcomment_addon_settings(App &$a, array &$data) function qcomment_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -57,7 +57,7 @@ function qcomment_addon_settings(App &$a, array &$data)
]; ];
} }
function qcomment_addon_settings_post(App $a, array &$b) function qcomment_addon_settings_post(array &$b)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -54,7 +54,7 @@ function randplace_uninstall()
Logger::notice("removed randplace"); Logger::notice("removed randplace");
} }
function randplace_post_hook(App $a, &$item) function randplace_post_hook(&$item)
{ {
/* /*
* An item was posted on the local system. * An item was posted on the local system.
@ -120,7 +120,7 @@ function randplace_post_hook(App $a, &$item)
* We will make sure we've got a valid user account * We will make sure we've got a valid user account
* and if so set our configuration setting for this person. * and if so set our configuration setting for this person.
*/ */
function randplace_settings_post(App $a, $post) function randplace_settings_post($post)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -136,7 +136,7 @@ function randplace_settings_post(App $a, $post)
* Called from the Addon Setting form. * Called from the Addon Setting form.
* Add our own settings info to the page. * Add our own settings info to the page.
*/ */
function randplace_settings(App &$a, array &$data) function randplace_settings(array &$data)
{ {
if(!DI::userSession()->getLocalUserId()) { if(!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -22,11 +22,11 @@ function rendertime_uninstall()
DI::config()->delete('system', 'profiler'); DI::config()->delete('system', 'profiler');
} }
function rendertime_init_1(App $a) function rendertime_init_1()
{ {
} }
function rendertime_addon_admin(App $a, string &$o) function rendertime_addon_admin(string &$o)
{ {
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/rendertime/'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/rendertime/');
@ -37,17 +37,16 @@ function rendertime_addon_admin(App $a, string &$o)
]); ]);
} }
function rendertime_addon_admin_post(App $a) function rendertime_addon_admin_post()
{ {
DI::config()->set('rendertime', 'callstack', $_POST['callstack'] ?? false); DI::config()->set('rendertime', 'callstack', $_POST['callstack'] ?? false);
DI::config()->set('rendertime', 'minimal_time', $_POST['minimal_time'] ?? 0); DI::config()->set('rendertime', 'minimal_time', $_POST['minimal_time'] ?? 0);
} }
/** /**
* @param App $a
* @param string $o * @param string $o
*/ */
function rendertime_page_end(App $a, string &$o) function rendertime_page_end(string &$o)
{ {
$profiler = DI::profiler(); $profiler = DI::profiler();
@ -59,7 +58,7 @@ function rendertime_page_end(App $a, string &$o)
]; ];
$ignored = in_array(DI::router()->getModuleClass(), $ignored_modules); $ignored = in_array(DI::router()->getModuleClass(), $ignored_modules);
if ($a->isSiteAdmin() && (($_GET['mode'] ?? '') != 'minimal') && !DI::mode()->isMobile() && !DI::mode()->isMobile() && !$ignored) { if (DI::userSession()->isSiteAdmin() && (($_GET['mode'] ?? '') != 'minimal') && !DI::mode()->isMobile() && !DI::mode()->isMobile() && !$ignored) {
$o = $o . '<div class="renderinfo">' . DI::l10n()->t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s", $o = $o . '<div class="renderinfo">' . DI::l10n()->t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s",
round($profiler->get('database') - $profiler->get('database_write'), 3), round($profiler->get('database') - $profiler->get('database_write'), 3),

View File

@ -14,7 +14,7 @@ use Friendica\DI;
require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
function s3_storage_install(App $a) function s3_storage_install()
{ {
Hook::register('storage_instance' , __FILE__, 's3_storage_instance'); Hook::register('storage_instance' , __FILE__, 's3_storage_instance');
Hook::register('storage_config' , __FILE__, 's3_storage_config'); Hook::register('storage_config' , __FILE__, 's3_storage_config');
@ -26,7 +26,7 @@ function s3_storage_uninstall()
DI::storageManager()->unregister(S3Client::class); DI::storageManager()->unregister(S3Client::class);
} }
function s3_storage_instance(App $a, array &$data) function s3_storage_instance(array &$data)
{ {
if ($data['name'] == S3Client::getName()) { if ($data['name'] == S3Client::getName()) {
$config = new S3Config(DI::l10n(), DI::config()); $config = new S3Config(DI::l10n(), DI::config());
@ -34,7 +34,7 @@ function s3_storage_instance(App $a, array &$data)
} }
} }
function s3_storage_config(App $a, array &$data) function s3_storage_config(array &$data)
{ {
if ($data['name'] == S3Client::getName()) { if ($data['name'] == S3Client::getName()) {
$data['storage_config'] = new S3Config(DI::l10n(), DI::config()); $data['storage_config'] = new S3Config(DI::l10n(), DI::config());

View File

@ -21,11 +21,9 @@ require_once(__DIR__ . '/vendor/autoload.php');
define('PW_LEN', 32); // number of characters to use for random passwords define('PW_LEN', 32); // number of characters to use for random passwords
function saml_module($a) function saml_module() {}
{
}
function saml_init(App $a) function saml_init()
{ {
if (DI::args()->getArgc() < 2) { if (DI::args()->getArgc() < 2) {
return; return;
@ -41,7 +39,7 @@ function saml_init(App $a)
saml_metadata(); saml_metadata();
break; break;
case 'sso': case 'sso':
saml_sso_reply($a); saml_sso_reply();
break; break;
case 'slo': case 'slo':
saml_slo_reply(); saml_slo_reply();
@ -79,12 +77,12 @@ function saml_install()
Hook::register('footer', __FILE__, 'saml_footer'); Hook::register('footer', __FILE__, 'saml_footer');
} }
function saml_head(App $a, string &$body) function saml_head(string &$body)
{ {
DI::page()->registerStylesheet(__DIR__ . '/saml.css'); DI::page()->registerStylesheet(__DIR__ . '/saml.css');
} }
function saml_footer(App $a, string &$body) function saml_footer(string &$body)
{ {
$fragment = addslashes(BBCode::convert(DI::config()->get('saml', 'settings_statement'))); $fragment = addslashes(BBCode::convert(DI::config()->get('saml', 'settings_statement')));
$body .= <<<EOL $body .= <<<EOL
@ -108,7 +106,7 @@ function saml_is_configured()
DI::config()->get('saml', 'idp_cert'); DI::config()->get('saml', 'idp_cert');
} }
function saml_sso_initiate(App $a, string &$body) function saml_sso_initiate(string &$body)
{ {
if (!saml_is_configured()) { if (!saml_is_configured()) {
Logger::warning('SAML SSO tried to trigger, but the SAML addon is not configured yet!'); Logger::warning('SAML SSO tried to trigger, but the SAML addon is not configured yet!');
@ -124,7 +122,7 @@ function saml_sso_initiate(App $a, string &$body)
exit(); exit();
} }
function saml_sso_reply(App $a) function saml_sso_reply()
{ {
$auth = new \OneLogin\Saml2\Auth(saml_settings()); $auth = new \OneLogin\Saml2\Auth(saml_settings());
$requestID = null; $requestID = null;
@ -165,7 +163,7 @@ function saml_sso_reply(App $a)
} }
if (!empty($user['uid'])) { if (!empty($user['uid'])) {
DI::auth()->setForUser($a, $user); DI::auth()->setForUser($user);
} }
if (isset($_POST['RelayState']) && Utils::getSelfURL() != $_POST['RelayState']) { if (isset($_POST['RelayState']) && Utils::getSelfURL() != $_POST['RelayState']) {
@ -173,7 +171,7 @@ function saml_sso_reply(App $a)
} }
} }
function saml_slo_initiate(App $a) function saml_slo_initiate()
{ {
if (!saml_is_configured()) { if (!saml_is_configured()) {
Logger::warning('SAML SLO tried to trigger, but the SAML addon is not configured yet!'); Logger::warning('SAML SLO tried to trigger, but the SAML addon is not configured yet!');
@ -224,7 +222,7 @@ function saml_input($key, $label, $description)
]; ];
} }
function saml_addon_admin(App $a, string &$o) function saml_addon_admin(string &$o)
{ {
$form = $form =
saml_input( saml_input(
@ -280,7 +278,7 @@ function saml_addon_admin(App $a, string &$o)
$o = Renderer::replaceMacros($t, $form); $o = Renderer::replaceMacros($t, $form);
} }
function saml_addon_admin_post(App $a) function saml_addon_admin_post()
{ {
$set = function ($key) { $set = function ($key) {
$val = (!empty($_POST[$key]) ? trim($_POST[$key]) : ''); $val = (!empty($_POST[$key]) ? trim($_POST[$key]) : '');

View File

@ -34,7 +34,7 @@ use Friendica\Object\Email;
*/ */
class SecureTestEmail extends Email class SecureTestEmail extends Email
{ {
public function __construct(App $a, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, BaseURL $baseUrl) public function __construct(IManageConfigValues $config, IManagePersonalConfigValues $pConfig, BaseURL $baseUrl)
{ {
$sitename = $config->get('config', 'sitename'); $sitename = $config->get('config', 'sitename');

View File

@ -31,12 +31,11 @@ function securemail_install()
* *
* @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#addon_settings 'addon_settings' hook * @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#addon_settings 'addon_settings' hook
* *
* @param App $a App instance * @param array $data
* @param string $s output html
* *
* @see App * @see App
*/ */
function securemail_settings(App &$a, array &$data) function securemail_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -67,12 +66,11 @@ function securemail_settings(App &$a, array &$data)
* *
* @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#addon_settings_post 'addon_settings_post' hook * @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#addon_settings_post 'addon_settings_post' hook
* *
* @param App $a App instance
* @param array $b hook data * @param array $b hook data
* *
* @see App * @see App
*/ */
function securemail_settings_post(App &$a, array &$b) function securemail_settings_post(array &$b)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -103,12 +101,11 @@ function securemail_settings_post(App &$a, array &$b)
* *
* @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#emailer_send_prepare 'emailer_send_prepare' hook * @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#emailer_send_prepare 'emailer_send_prepare' hook
* *
* @param App $a App instance
* @param IEmail $email Email * @param IEmail $email Email
* *
* @see App * @see App
*/ */
function securemail_emailer_send_prepare(App &$a, IEmail &$email) function securemail_emailer_send_prepare(IEmail &$email)
{ {
if (empty($email->getRecipientUid())) { if (empty($email->getRecipientUid())) {
return; return;

View File

@ -21,7 +21,7 @@ function showmore_install()
Hook::register('addon_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post'); Hook::register('addon_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post');
} }
function showmore_addon_settings(App &$a, array &$data) function showmore_addon_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -45,7 +45,7 @@ function showmore_addon_settings(App &$a, array &$data)
]; ];
} }
function showmore_addon_settings_post(App $a, array &$b) function showmore_addon_settings_post(array &$b)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -93,7 +93,7 @@ function get_body_length($body)
return strlen($string); return strlen($string);
} }
function showmore_prepare_body(App $a, &$hook_data) function showmore_prepare_body(&$hook_data)
{ {
// No combination with content filters // No combination with content filters
if (!empty($hook_data['filter_reasons'])) { if (!empty($hook_data['filter_reasons'])) {

View File

@ -24,12 +24,12 @@ function showmore_dyn_install()
Hook::register('addon_settings_post', __FILE__, 'showmore_dyn_settings_post'); Hook::register('addon_settings_post', __FILE__, 'showmore_dyn_settings_post');
} }
function showmore_dyn_head(App $a, string &$body) function showmore_dyn_head(string &$body)
{ {
DI::page()->registerStylesheet(__DIR__ . '/showmore_dyn.css'); DI::page()->registerStylesheet(__DIR__ . '/showmore_dyn.css');
} }
function showmore_dyn_footer(App $a, string &$body) function showmore_dyn_footer(string &$body)
{ {
DI::page()->registerFooterScript(__DIR__ . '/showmore_dyn.js'); DI::page()->registerFooterScript(__DIR__ . '/showmore_dyn.js');
} }
@ -45,7 +45,7 @@ function showmore_dyn_settings_post()
} }
} }
function showmore_dyn_settings(App &$a, array &$data) function showmore_dyn_settings(array &$data)
{ {
if(!DI::userSession()->getLocalUserId()) { if(!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -15,7 +15,7 @@ function smiley_pack_es_install() {
Hook::register('smilie', 'addon/smiley_pack_es/smiley_pack_es.php', 'smiley_pack_smilies_es'); Hook::register('smilie', 'addon/smiley_pack_es/smiley_pack_es.php', 'smiley_pack_smilies_es');
} }
function smiley_pack_smilies_es(App $a, array &$b) { function smiley_pack_smilies_es(array &$b) {
#Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever.

View File

@ -18,7 +18,7 @@ function smiley_pack_fr_install()
Hook::register('smilie', 'addon/smiley_pack_fr/smiley_pack_fr.php', 'smiley_pack_fr_smilies'); Hook::register('smilie', 'addon/smiley_pack_fr/smiley_pack_fr.php', 'smiley_pack_fr_smilies');
} }
function smiley_pack_fr_smilies(App $a, array &$b) function smiley_pack_fr_smilies(array &$b)
{ {
#Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever.

View File

@ -16,7 +16,7 @@ function smiley_pack_install() {
Hook::register('smilie', 'addon/smiley_pack/smiley_pack.php', 'smiley_pack_smilies'); Hook::register('smilie', 'addon/smiley_pack/smiley_pack.php', 'smiley_pack_smilies');
} }
function smiley_pack_smilies(App $a, array &$b) function smiley_pack_smilies(array &$b)
{ {
#Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever.

View File

@ -17,11 +17,10 @@ function smileybutton_install()
Hook::register('jot_tool', 'addon/smileybutton/smileybutton.php', 'smileybutton_jot_tool'); Hook::register('jot_tool', 'addon/smileybutton/smileybutton.php', 'smileybutton_jot_tool');
} }
function smileybutton_jot_tool(App $a, string &$body) function smileybutton_jot_tool(string &$body)
{ {
// Disable if theme is quattro // Disable if theme is quattro
// TODO add style for quattro if (DI::app()->getCurrentTheme() == 'quattro') {
if ($a->getCurrentTheme() == 'quattro') {
return; return;
} }
@ -98,7 +97,7 @@ function smileybutton_jot_tool(App $a, string &$body)
$s .= '</tr></table>'; $s .= '</tr></table>';
//Add css to header //Add css to header
$css_file = __DIR__ . '/view/' . $a->getCurrentTheme() . '.css'; $css_file = __DIR__ . '/view/' . DI::app()->getCurrentTheme() . '.css';
if (!file_exists($css_file)) { if (!file_exists($css_file)) {
$css_file = __DIR__ . '/view/default.css'; $css_file = __DIR__ . '/view/default.css';
} }
@ -106,7 +105,7 @@ function smileybutton_jot_tool(App $a, string &$body)
DI::page()->registerStylesheet($css_file); DI::page()->registerStylesheet($css_file);
//Get the correct image for the theme //Get the correct image for the theme
$image = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.png'; $image = 'addon/smileybutton/view/' . DI::app()->getCurrentTheme() . '.png';
if (!file_exists($image)) { if (!file_exists($image)) {
$image = 'addon/smileybutton/view/default.png'; $image = 'addon/smileybutton/view/default.png';
} }

View File

@ -17,7 +17,7 @@ function smilies_adult_install() {
Hook::register('smilie', 'addon/smilies_adult/smilies_adult.php', 'smilies_adult_smilies'); Hook::register('smilie', 'addon/smilies_adult/smilies_adult.php', 'smilies_adult_smilies');
} }
function smilies_adult_smilies(App $a, array &$b) function smilies_adult_smilies(array &$b)
{ {
$b['texts'][] = '(o)(o)'; $b['texts'][] = '(o)(o)';
$b['icons'][] = '<img class="smiley" src="' . DI::baseUrl()->get() . '/addon/smilies_adult/icons/tits.gif' . '" alt="' . '(o)(o)' . '" />'; $b['icons'][] = '<img class="smiley" src="' . DI::baseUrl()->get() . '/addon/smilies_adult/icons/tits.gif' . '" alt="' . '(o)(o)' . '" />';

View File

@ -18,7 +18,7 @@ function startpage_install() {
Hook::register('addon_settings_post', 'addon/startpage/startpage.php', 'startpage_settings_post'); Hook::register('addon_settings_post', 'addon/startpage/startpage.php', 'startpage_settings_post');
} }
function startpage_home_init(App $a, $b) function startpage_home_init($b)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -39,7 +39,7 @@ function startpage_home_init(App $a, $b)
* *
*/ */
function startpage_settings_post(App $a, $post) function startpage_settings_post($post)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -56,7 +56,7 @@ function startpage_settings_post(App $a, $post)
* Add our own settings info to the page. * Add our own settings info to the page.
* *
*/ */
function startpage_settings(App &$a, array &$data) function startpage_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -62,7 +62,7 @@ function statusnet_install()
Logger::notice('installed GNU Social'); Logger::notice('installed GNU Social');
} }
function statusnet_jot_nets(App $a, array &$jotnets_fields) function statusnet_jot_nets(array &$jotnets_fields)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -80,7 +80,7 @@ function statusnet_jot_nets(App $a, array &$jotnets_fields)
} }
} }
function statusnet_settings_post(App $a, $post) function statusnet_settings_post($post)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -178,7 +178,7 @@ function statusnet_settings_post(App $a, $post)
} }
} }
function statusnet_settings(App $a, array &$data) function statusnet_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -288,7 +288,7 @@ function statusnet_settings(App $a, array &$data)
]; ];
} }
function statusnet_hook_fork(App $a, array &$b) function statusnet_hook_fork(array &$b)
{ {
if ($b['name'] != 'notifier_normal') { if ($b['name'] != 'notifier_normal') {
return; return;
@ -302,7 +302,7 @@ function statusnet_hook_fork(App $a, array &$b)
} }
} }
function statusnet_post_local(App $a, array &$b) function statusnet_post_local(array &$b)
{ {
if ($b['edit']) { if ($b['edit']) {
return; return;
@ -331,7 +331,7 @@ function statusnet_post_local(App $a, array &$b)
$b['postopts'] .= 'statusnet'; $b['postopts'] .= 'statusnet';
} }
function statusnet_post_hook(App $a, array &$b) function statusnet_post_hook(array &$b)
{ {
/** /**
* Post to GNU Social * Post to GNU Social
@ -426,7 +426,7 @@ function statusnet_post_hook(App $a, array &$b)
} }
} }
function statusnet_addon_admin_post(App $a) function statusnet_addon_admin_post()
{ {
$sites = []; $sites = [];
@ -458,7 +458,7 @@ function statusnet_addon_admin_post(App $a)
$sites = DI::config()->set('statusnet', 'sites', $sites); $sites = DI::config()->set('statusnet', 'sites', $sites);
} }
function statusnet_addon_admin(App $a, string &$o) function statusnet_addon_admin(string &$o)
{ {
$sites = DI::config()->get('statusnet', 'sites'); $sites = DI::config()->get('statusnet', 'sites');
$sitesform = []; $sitesform = [];

View File

@ -25,17 +25,17 @@ function testdrive_install()
Hook::register('globaldir_update','addon/testdrive/testdrive.php', 'testdrive_globaldir_update'); Hook::register('globaldir_update','addon/testdrive/testdrive.php', 'testdrive_globaldir_update');
} }
function testdrive_load_config(App $a, ConfigFileManager $loader) function testdrive_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('testdrive'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('testdrive'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
function testdrive_globaldir_update(App $a, array &$b) function testdrive_globaldir_update(array &$b)
{ {
$b['url'] = ''; $b['url'] = '';
} }
function testdrive_register_account(App $a, $b) function testdrive_register_account($b)
{ {
$uid = $b; $uid = $b;
@ -48,7 +48,7 @@ function testdrive_register_account(App $a, $b)
} }
function testdrive_cron(App $a, $b) function testdrive_cron($b)
{ {
$users = DBA::selectToArray('user', [], ["`account_expires_on` < ? AND `expire_notification_sent` <= ?", $users = DBA::selectToArray('user', [], ["`account_expires_on` < ? AND `expire_notification_sent` <= ?",
DateTimeFormat::utc('now + 5 days'), DBA::NULL_DATETIME]); DateTimeFormat::utc('now + 5 days'), DBA::NULL_DATETIME]);
@ -72,7 +72,7 @@ function testdrive_cron(App $a, $b)
} }
} }
function testdrive_enotify(App $a, array &$b) function testdrive_enotify(array &$b)
{ {
if (!empty($b['params']) && $b['params']['type'] == Notification\Type::SYSTEM if (!empty($b['params']) && $b['params']['type'] == Notification\Type::SYSTEM
&& !empty($b['params']['system_type']) && $b['params']['system_type'] === 'testdrive_expire') { && !empty($b['params']['system_type']) && $b['params']['system_type'] === 'testdrive_expire') {

View File

@ -16,7 +16,7 @@ function tictac_install()
Hook::register('app_menu', 'addon/tictac/tictac.php', 'tictac_app_menu'); Hook::register('app_menu', 'addon/tictac/tictac.php', 'tictac_app_menu');
} }
function tictac_app_menu(App $a, array &$b) function tictac_app_menu(array &$b)
{ {
$b['app_menu'][] = '<div class="app-title"><a href="tictac">' . DI::l10n()->t('Three Dimensional Tic-Tac-Toe') . '</a></div>'; $b['app_menu'][] = '<div class="app-title"><a href="tictac">' . DI::l10n()->t('Three Dimensional Tic-Tac-Toe') . '</a></div>';
} }
@ -28,7 +28,7 @@ function tictac_app_menu(App $a, array &$b)
*/ */
function tictac_module() {} function tictac_module() {}
function tictac_content(App $a) { function tictac_content() {
$o = ''; $o = '';

View File

@ -36,7 +36,7 @@ function tumblr_install()
*/ */
function tumblr_module() {} function tumblr_module() {}
function tumblr_content(App $a) function tumblr_content()
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
@ -46,11 +46,11 @@ function tumblr_content(App $a)
if (isset(DI::args()->getArgv()[1])) { if (isset(DI::args()->getArgv()[1])) {
switch (DI::args()->getArgv()[1]) { switch (DI::args()->getArgv()[1]) {
case "connect": case "connect":
$o = tumblr_connect($a); $o = tumblr_connect();
break; break;
case "callback": case "callback":
$o = tumblr_callback($a); $o = tumblr_callback();
break; break;
default: default:
@ -58,13 +58,13 @@ function tumblr_content(App $a)
break; break;
} }
} else { } else {
$o = tumblr_connect($a); $o = tumblr_connect();
} }
return $o; return $o;
} }
function tumblr_addon_admin(App $a, string &$o) function tumblr_addon_admin(string &$o)
{ {
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/tumblr/" ); $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/tumblr/" );
@ -76,13 +76,13 @@ function tumblr_addon_admin(App $a, string &$o)
]); ]);
} }
function tumblr_addon_admin_post(App $a) function tumblr_addon_admin_post()
{ {
DI::config()->set('tumblr', 'consumer_key', trim($_POST['consumer_key'] ?? '')); DI::config()->set('tumblr', 'consumer_key', trim($_POST['consumer_key'] ?? ''));
DI::config()->set('tumblr', 'consumer_secret', trim($_POST['consumer_secret'] ?? '')); DI::config()->set('tumblr', 'consumer_secret', trim($_POST['consumer_secret'] ?? ''));
} }
function tumblr_connect(App $a) function tumblr_connect()
{ {
// Start a session. This is necessary to hold on to a few keys the callback script will also need // Start a session. This is necessary to hold on to a few keys the callback script will also need
session_start(); session_start();
@ -137,7 +137,7 @@ function tumblr_connect(App $a)
return $o; return $o;
} }
function tumblr_callback(App $a) function tumblr_callback()
{ {
// Start a session, load the library // Start a session, load the library
session_start(); session_start();
@ -180,7 +180,7 @@ function tumblr_callback(App $a)
return $o; return $o;
} }
function tumblr_jot_nets(App $a, array &$jotnets_fields) function tumblr_jot_nets(array &$jotnets_fields)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -198,7 +198,7 @@ function tumblr_jot_nets(App $a, array &$jotnets_fields)
} }
} }
function tumblr_settings(App $a, array &$data) function tumblr_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -248,7 +248,7 @@ function tumblr_settings(App $a, array &$data)
]; ];
} }
function tumblr_settings_post(App $a, array &$b) function tumblr_settings_post(array &$b)
{ {
if (!empty($_POST['tumblr-submit'])) { if (!empty($_POST['tumblr-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'tumblr', 'post', intval($_POST['tumblr'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'tumblr', 'post', intval($_POST['tumblr']));
@ -257,7 +257,7 @@ function tumblr_settings_post(App $a, array &$b)
} }
} }
function tumblr_hook_fork(App $a, array &$b) function tumblr_hook_fork(array &$b)
{ {
if ($b['name'] != 'notifier_normal') { if ($b['name'] != 'notifier_normal') {
return; return;
@ -272,7 +272,7 @@ function tumblr_hook_fork(App $a, array &$b)
} }
} }
function tumblr_post_local(App $a, array &$b) function tumblr_post_local(array &$b)
{ {
// This can probably be changed to allow editing by pointing to a different API endpoint // This can probably be changed to allow editing by pointing to a different API endpoint
@ -310,7 +310,7 @@ function tumblr_post_local(App $a, array &$b)
function tumblr_send(App $a, array &$b) { function tumblr_send(array &$b) {
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return; return;

View File

@ -124,12 +124,12 @@ function twitter_install()
// Hook functions // Hook functions
function twitter_load_config(App $a, ConfigFileManager $loader) function twitter_load_config(ConfigFileManager $loader)
{ {
$a->getConfigCache()->load($loader->loadAddonConfig('twitter'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); DI::app()->getConfigCache()->load($loader->loadAddonConfig('twitter'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
} }
function twitter_check_item_notification(App $a, array &$notification_data) function twitter_check_item_notification(array &$notification_data)
{ {
$own_id = DI::pConfig()->get($notification_data['uid'], 'twitter', 'own_id'); $own_id = DI::pConfig()->get($notification_data['uid'], 'twitter', 'own_id');
@ -139,14 +139,14 @@ function twitter_check_item_notification(App $a, array &$notification_data)
} }
} }
function twitter_support_follow(App $a, array &$data) function twitter_support_follow(array &$data)
{ {
if ($data['protocol'] == Protocol::TWITTER) { if ($data['protocol'] == Protocol::TWITTER) {
$data['result'] = true; $data['result'] = true;
} }
} }
function twitter_follow(App $a, array &$contact) function twitter_follow(array &$contact)
{ {
Logger::info('Check if contact is twitter contact', ['url' => $contact['url']]); Logger::info('Check if contact is twitter contact', ['url' => $contact['url']]);
@ -158,7 +158,7 @@ function twitter_follow(App $a, array &$contact)
$nickname = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $contact['url']); $nickname = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $contact['url']);
$nickname = str_replace('@twitter.com', '', $nickname); $nickname = str_replace('@twitter.com', '', $nickname);
$uid = $a->getLoggedInUserId(); $uid = DI::userSession()->getLocalUserId();
if (!twitter_api_contact('friendships/create', ['network' => Protocol::TWITTER, 'nick' => $nickname], $uid)) { if (!twitter_api_contact('friendships/create', ['network' => Protocol::TWITTER, 'nick' => $nickname], $uid)) {
$contact = null; $contact = null;
@ -176,12 +176,12 @@ function twitter_follow(App $a, array &$contact)
} }
} }
function twitter_unfollow(App $a, array &$hook_data) function twitter_unfollow(array &$hook_data)
{ {
$hook_data['result'] = twitter_api_contact('friendships/destroy', $hook_data['contact'], $hook_data['uid']); $hook_data['result'] = twitter_api_contact('friendships/destroy', $hook_data['contact'], $hook_data['uid']);
} }
function twitter_block(App $a, array &$hook_data) function twitter_block(array &$hook_data)
{ {
$hook_data['result'] = twitter_api_contact('blocks/create', $hook_data['contact'], $hook_data['uid']); $hook_data['result'] = twitter_api_contact('blocks/create', $hook_data['contact'], $hook_data['uid']);
@ -191,7 +191,7 @@ function twitter_block(App $a, array &$hook_data)
} }
} }
function twitter_unblock(App $a, array &$hook_data) function twitter_unblock(array &$hook_data)
{ {
$hook_data['result'] = twitter_api_contact('blocks/destroy', $hook_data['contact'], $hook_data['uid']); $hook_data['result'] = twitter_api_contact('blocks/destroy', $hook_data['contact'], $hook_data['uid']);
} }
@ -205,7 +205,7 @@ function twitter_api_contact(string $apiPath, array $contact, int $uid): ?bool
return (bool)twitter_api_call($uid, $apiPath, ['screen_name' => $contact['nick']]); return (bool)twitter_api_call($uid, $apiPath, ['screen_name' => $contact['nick']]);
} }
function twitter_jot_nets(App $a, array &$jotnets_fields) function twitter_jot_nets(array &$jotnets_fields)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -224,7 +224,7 @@ function twitter_jot_nets(App $a, array &$jotnets_fields)
} }
function twitter_settings_post(App $a) function twitter_settings_post()
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -295,7 +295,7 @@ function twitter_settings_post(App $a)
} }
} }
function twitter_settings(App $a, array &$data) function twitter_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -414,7 +414,7 @@ function twitter_settings(App $a, array &$data)
]; ];
} }
function twitter_hook_fork(App $a, array &$b) function twitter_hook_fork(array &$b)
{ {
DI::logger()->debug('twitter_hook_fork', $b); DI::logger()->debug('twitter_hook_fork', $b);
@ -466,7 +466,7 @@ function twitter_hook_fork(App $a, array &$b)
} }
} }
function twitter_post_local(App $a, array &$b) function twitter_post_local(array &$b)
{ {
if ($b['edit']) { if ($b['edit']) {
return; return;
@ -495,7 +495,7 @@ function twitter_post_local(App $a, array &$b)
$b['postopts'] .= 'twitter'; $b['postopts'] .= 'twitter';
} }
function twitter_probe_detect(App $a, array &$hookData) function twitter_probe_detect(array &$hookData)
{ {
// Don't overwrite an existing result // Don't overwrite an existing result
if (isset($hookData['result'])) { if (isset($hookData['result'])) {
@ -529,7 +529,7 @@ function twitter_probe_detect(App $a, array &$hookData)
} }
} }
function twitter_item_by_link(App $a, array &$hookData) function twitter_item_by_link(array &$hookData)
{ {
// Don't overwrite an existing result // Don't overwrite an existing result
if (isset($hookData['item_id'])) { if (isset($hookData['item_id'])) {
@ -569,7 +569,7 @@ function twitter_item_by_link(App $a, array &$hookData)
return; return;
} }
$item = twitter_createpost($a, $hookData['uid'], $status, [], true, false, false); $item = twitter_createpost($hookData['uid'], $status, [], true, false, false);
if (!empty($item)) { if (!empty($item)) {
$hookData['item_id'] = Item::insert($item); $hookData['item_id'] = Item::insert($item);
} }
@ -635,7 +635,7 @@ function twitter_get_id(string $uri)
return (int)$id; return (int)$id;
} }
function twitter_post_hook(App $a, array &$b) function twitter_post_hook(array &$b)
{ {
DI::logger()->debug('Invoke post hook', $b); DI::logger()->debug('Invoke post hook', $b);
@ -736,7 +736,7 @@ function twitter_post_hook(App $a, array &$b)
Logger::info('We have customer key and oauth stuff, going to send.'); Logger::info('We have customer key and oauth stuff, going to send.');
// If it's a repeated message from twitter then do a native retweet and exit // If it's a repeated message from twitter then do a native retweet and exit
if (twitter_is_retweet($a, $b['uid'], $b['body'])) { if (twitter_is_retweet($b['uid'], $b['body'])) {
return; return;
} }
@ -979,13 +979,13 @@ function twitter_delete_item(array $item)
} }
} }
function twitter_addon_admin_post(App $a) function twitter_addon_admin_post()
{ {
DI::config()->set('twitter', 'consumerkey', trim($_POST['consumerkey'] ?? '')); DI::config()->set('twitter', 'consumerkey', trim($_POST['consumerkey'] ?? ''));
DI::config()->set('twitter', 'consumersecret', trim($_POST['consumersecret'] ?? '')); DI::config()->set('twitter', 'consumersecret', trim($_POST['consumersecret'] ?? ''));
} }
function twitter_addon_admin(App $a, string &$o) function twitter_addon_admin(string &$o)
{ {
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/twitter/'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/twitter/');
@ -997,7 +997,7 @@ function twitter_addon_admin(App $a, string &$o)
]); ]);
} }
function twitter_cron(App $a) function twitter_cron()
{ {
$last = DI::keyValue()->get('twitter_last_poll'); $last = DI::keyValue()->get('twitter_last_poll');
@ -1049,7 +1049,7 @@ function twitter_cron(App $a)
$next_contact_check = 0; $next_contact_check = 0;
if($next_contact_check <= time()) { if($next_contact_check <= time()) {
pumpio_getallusers($a, $rr["uid"]); pumpio_getallusers($rr["uid"]);
DI::pConfig()->set($rr['uid'],'pumpio','contact_check',time()); DI::pConfig()->set($rr['uid'],'pumpio','contact_check',time());
} }
*/ */
@ -1060,7 +1060,7 @@ function twitter_cron(App $a)
DI::keyValue()->set('twitter_last_poll', time()); DI::keyValue()->set('twitter_last_poll', time());
} }
function twitter_expire(App $a) function twitter_expire()
{ {
$days = DI::config()->get('twitter', 'expire'); $days = DI::config()->get('twitter', 'expire');
@ -1090,7 +1090,7 @@ function twitter_expire(App $a)
Logger::notice('End expiry'); Logger::notice('End expiry');
} }
function twitter_prepare_body(App $a, array &$b) function twitter_prepare_body(array &$b)
{ {
if ($b['item']['network'] != Protocol::TWITTER) { if ($b['item']['network'] != Protocol::TWITTER) {
return; return;
@ -1149,7 +1149,6 @@ function twitter_statuses_show(string $id, TwitterOAuth $twitterOAuth = null)
/** /**
* Parse Twitter status URLs since Twitter removed OEmbed * Parse Twitter status URLs since Twitter removed OEmbed
* *
* @param App $a
* @param array $b Expected format: * @param array $b Expected format:
* [ * [
* 'url' => [URL to parse], * 'url' => [URL to parse],
@ -1158,7 +1157,7 @@ function twitter_statuses_show(string $id, TwitterOAuth $twitterOAuth = null)
* ] * ]
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
function twitter_parse_link(App $a, array &$b) function twitter_parse_link(array &$b)
{ {
// Only handle Twitter status URLs // Only handle Twitter status URLs
if (!preg_match('#^https?://(?:mobile\.|www\.)?twitter.com/[^/]+/status/(\d+).*#', $b['url'], $matches)) { if (!preg_match('#^https?://(?:mobile\.|www\.)?twitter.com/[^/]+/status/(\d+).*#', $b['url'], $matches)) {
@ -1171,7 +1170,7 @@ function twitter_parse_link(App $a, array &$b)
return; return;
} }
$item = twitter_createpost($a, 0, $status, [], true, false, true); $item = twitter_createpost(0, $status, [], true, false, true);
if (empty($item)) { if (empty($item)) {
return; return;
} }
@ -1222,13 +1221,12 @@ function twitter_parse_link(App $a, array &$b)
/** /**
* @brief Build the item array for the mirrored post * @brief Build the item array for the mirrored post
* *
* @param App $a Application class
* @param integer $uid User id * @param integer $uid User id
* @param object $post Twitter object with the post * @param object $post Twitter object with the post
* *
* @return array item data to be posted * @return array item data to be posted
*/ */
function twitter_do_mirrorpost(App $a, int $uid, $post) function twitter_do_mirrorpost(int $uid, $post)
{ {
$datarray['uid'] = $uid; $datarray['uid'] = $uid;
$datarray['extid'] = 'twitter::' . $post->id; $datarray['extid'] = 'twitter::' . $post->id;
@ -1236,7 +1234,7 @@ function twitter_do_mirrorpost(App $a, int $uid, $post)
if (!empty($post->retweeted_status)) { if (!empty($post->retweeted_status)) {
// We don't support nested shares, so we mustn't show quotes as shares on retweets // We don't support nested shares, so we mustn't show quotes as shares on retweets
$item = twitter_createpost($a, $uid, $post->retweeted_status, ['id' => 0], false, false, true, -1); $item = twitter_createpost($uid, $post->retweeted_status, ['id' => 0], false, false, true, -1);
if (empty($item)) { if (empty($item)) {
return []; return [];
@ -1252,7 +1250,7 @@ function twitter_do_mirrorpost(App $a, int $uid, $post)
$datarray['body'] .= $item['body'] . '[/share]'; $datarray['body'] .= $item['body'] . '[/share]';
} else { } else {
$item = twitter_createpost($a, $uid, $post, ['id' => 0], false, false, false, -1); $item = twitter_createpost($uid, $post, ['id' => 0], false, false, false, -1);
if (empty($item)) { if (empty($item)) {
return []; return [];
@ -1278,12 +1276,11 @@ function twitter_do_mirrorpost(App $a, int $uid, $post)
/** /**
* Fetches the Twitter user's own posts * Fetches the Twitter user's own posts
* *
* @param App $a
* @param int $uid * @param int $uid
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
function twitter_fetchtimeline(App $a, int $uid): void function twitter_fetchtimeline(int $uid): void
{ {
$ckey = DI::config()->get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = DI::config()->get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
@ -1301,7 +1298,7 @@ function twitter_fetchtimeline(App $a, int $uid): void
// Ensure to have the own contact // Ensure to have the own contact
try { try {
twitter_fetch_own_contact($a, $uid); twitter_fetch_own_contact($uid);
} catch (TwitterOAuthException $e) { } catch (TwitterOAuthException $e) {
Logger::notice('Error fetching own contact', ['uid' => $uid, 'message' => $e->getMessage()]); Logger::notice('Error fetching own contact', ['uid' => $uid, 'message' => $e->getMessage()]);
return; return;
@ -1356,7 +1353,7 @@ function twitter_fetchtimeline(App $a, int $uid): void
} }
Logger::info('Preparing mirror post', ['twitter-id' => $post->id_str, 'uid' => $uid]); Logger::info('Preparing mirror post', ['twitter-id' => $post->id_str, 'uid' => $uid]);
$mirrorpost = twitter_do_mirrorpost($a, $uid, $post); $mirrorpost = twitter_do_mirrorpost($uid, $post);
if (empty($mirrorpost['body'])) { if (empty($mirrorpost['body'])) {
Logger::notice('Body is empty', ['post' => $post, 'mirrorpost' => $mirrorpost]); Logger::notice('Body is empty', ['post' => $post, 'mirrorpost' => $mirrorpost]);
@ -1898,7 +1895,6 @@ function twitter_media_entities($post, array &$postarray, int $uriId = -1)
/** /**
* Undocumented function * Undocumented function
* *
* @param App $a
* @param integer $uid User ID * @param integer $uid User ID
* @param object $post Incoming Twitter post * @param object $post Incoming Twitter post
* @param array $self * @param array $self
@ -1908,7 +1904,7 @@ function twitter_media_entities($post, array &$postarray, int $uriId = -1)
* @param integer $uriId URI Id used to store tags. 0 = create a new one; -1 = don't store tags for this post. * @param integer $uriId URI Id used to store tags. 0 = create a new one; -1 = don't store tags for this post.
* @return array item array * @return array item array
*/ */
function twitter_createpost(App $a, int $uid, $post, array $self, $create_user, bool $only_existing_contact, bool $noquote, int $uriId = 0): array function twitter_createpost(int $uid, $post, array $self, $create_user, bool $only_existing_contact, bool $noquote, int $uriId = 0): array
{ {
$postarray = []; $postarray = [];
$postarray['network'] = Protocol::TWITTER; $postarray['network'] = Protocol::TWITTER;
@ -2045,7 +2041,7 @@ function twitter_createpost(App $a, int $uid, $post, array $self, $create_user,
$postarray['coord'] = $post->coordinates->coordinates[1] . ' ' . $post->coordinates->coordinates[0]; $postarray['coord'] = $post->coordinates->coordinates[1] . ' ' . $post->coordinates->coordinates[0];
} }
if (!empty($post->retweeted_status)) { if (!empty($post->retweeted_status)) {
$retweet = twitter_createpost($a, $uid, $post->retweeted_status, $self, false, false, $noquote); $retweet = twitter_createpost($uid, $post->retweeted_status, $self, false, false, $noquote);
if (empty($retweet)) { if (empty($retweet)) {
return []; return [];
@ -2081,7 +2077,7 @@ function twitter_createpost(App $a, int $uid, $post, array $self, $create_user,
// To avoid recursive share blocks we just provide the link to avoid removing quote context. // To avoid recursive share blocks we just provide the link to avoid removing quote context.
$postarray['body'] .= "\n\nhttps://twitter.com/" . $post->quoted_status->user->screen_name . "/status/" . $post->quoted_status->id_str; $postarray['body'] .= "\n\nhttps://twitter.com/" . $post->quoted_status->user->screen_name . "/status/" . $post->quoted_status->id_str;
} else { } else {
$quoted = twitter_createpost($a, 0, $post->quoted_status, $self, false, false, true); $quoted = twitter_createpost(0, $post->quoted_status, $self, false, false, true);
if (!empty($quoted)) { if (!empty($quoted)) {
Item::insert($quoted); Item::insert($quoted);
$post = Post::selectFirst(['guid', 'uri-id'], ['uri' => $quoted['uri'], 'uid' => 0]); $post = Post::selectFirst(['guid', 'uri-id'], ['uri' => $quoted['uri'], 'uid' => 0]);
@ -2121,7 +2117,7 @@ function twitter_store_tags(int $uriId, array $taglist)
} }
} }
function twitter_fetchparentposts(App $a, int $uid, $post, TwitterOAuth $connection, array $self) function twitter_fetchparentposts(int $uid, $post, TwitterOAuth $connection, array $self)
{ {
Logger::info('Fetching parent posts', ['user' => $uid, 'post' => $post->id_str]); Logger::info('Fetching parent posts', ['user' => $uid, 'post' => $post->id_str]);
@ -2158,7 +2154,7 @@ function twitter_fetchparentposts(App $a, int $uid, $post, TwitterOAuth $connect
if (!empty($posts)) { if (!empty($posts)) {
foreach ($posts as $post) { foreach ($posts as $post) {
$postarray = twitter_createpost($a, $uid, $post, $self, false, !DI::pConfig()->get($uid, 'twitter', 'create_user'), false); $postarray = twitter_createpost($uid, $post, $self, false, !DI::pConfig()->get($uid, 'twitter', 'create_user'), false);
if (empty($postarray)) { if (empty($postarray)) {
continue; continue;
@ -2176,12 +2172,11 @@ function twitter_fetchparentposts(App $a, int $uid, $post, TwitterOAuth $connect
/** /**
* Fetches the posts received by the Twitter user * Fetches the posts received by the Twitter user
* *
* @param App $a
* @param int $uid * @param int $uid
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
function twitter_fetchhometimeline(App $a, int $uid): void function twitter_fetchhometimeline(int $uid): void
{ {
$ckey = DI::config()->get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = DI::config()->get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
@ -2201,7 +2196,7 @@ function twitter_fetchhometimeline(App $a, int $uid): void
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
try { try {
$own_contact = twitter_fetch_own_contact($a, $uid); $own_contact = twitter_fetch_own_contact($uid);
} catch (TwitterOAuthException $e) { } catch (TwitterOAuthException $e) {
Logger::notice('Error fetching own contact', ['uid' => $uid, 'message' => $e->getMessage()]); Logger::notice('Error fetching own contact', ['uid' => $uid, 'message' => $e->getMessage()]);
return; return;
@ -2283,12 +2278,12 @@ function twitter_fetchhometimeline(App $a, int $uid): void
} }
if ($post->in_reply_to_status_id_str != '') { if ($post->in_reply_to_status_id_str != '') {
twitter_fetchparentposts($a, $uid, $post, $connection, $self); twitter_fetchparentposts($uid, $post, $connection, $self);
} }
Logger::info('Preparing post ' . $post->id_str . ' for user ' . $uid); Logger::info('Preparing post ' . $post->id_str . ' for user ' . $uid);
$postarray = twitter_createpost($a, $uid, $post, $self, $create_user, true, false); $postarray = twitter_createpost($uid, $post, $self, $create_user, true, false);
if (empty($postarray)) { if (empty($postarray)) {
Logger::info('Empty post ' . $post->id_str . ' and user ' . $uid); Logger::info('Empty post ' . $post->id_str . ' and user ' . $uid);
@ -2352,10 +2347,10 @@ function twitter_fetchhometimeline(App $a, int $uid): void
} }
if ($post->in_reply_to_status_id_str != '') { if ($post->in_reply_to_status_id_str != '') {
twitter_fetchparentposts($a, $uid, $post, $connection, $self); twitter_fetchparentposts($uid, $post, $connection, $self);
} }
$postarray = twitter_createpost($a, $uid, $post, $self, false, !$create_user, false); $postarray = twitter_createpost($uid, $post, $self, false, !$create_user, false);
if (empty($postarray)) { if (empty($postarray)) {
continue; continue;
@ -2372,7 +2367,7 @@ function twitter_fetchhometimeline(App $a, int $uid): void
Logger::info('Last mentions ID for user ' . $uid . ' is now ' . $lastid); Logger::info('Last mentions ID for user ' . $uid . ' is now ' . $lastid);
} }
function twitter_fetch_own_contact(App $a, int $uid) function twitter_fetch_own_contact(int $uid)
{ {
$ckey = DI::config()->get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = DI::config()->get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
@ -2408,7 +2403,7 @@ function twitter_fetch_own_contact(App $a, int $uid)
return $contact_id; return $contact_id;
} }
function twitter_is_retweet(App $a, int $uid, string $body): bool function twitter_is_retweet(int $uid, string $body): bool
{ {
$body = trim($body); $body = trim($body);

View File

@ -5,8 +5,6 @@ use Friendica\DI;
function twitter_sync_run($argv, $argc) function twitter_sync_run($argv, $argc)
{ {
$a = Friendica\DI::app();
require_once 'addon/twitter/twitter.php'; require_once 'addon/twitter/twitter.php';
if (function_exists('sys_getloadavg')) { if (function_exists('sys_getloadavg')) {
@ -26,8 +24,8 @@ function twitter_sync_run($argv, $argc)
$uid = intval($argv[2]); $uid = intval($argv[2]);
if ($mode == 1) { if ($mode == 1) {
twitter_fetchtimeline($a, $uid); twitter_fetchtimeline($uid);
} elseif ($mode == 2) { } elseif ($mode == 2) {
twitter_fetchhometimeline($a, $uid); twitter_fetchhometimeline($uid);
} }
} }

View File

@ -15,7 +15,7 @@ function unicode_smilies_install() {
Hook::register('smilie', 'addon/unicode_smilies/unicode_smilies.php', 'unicode_smilies_smilies'); Hook::register('smilie', 'addon/unicode_smilies/unicode_smilies.php', 'unicode_smilies_smilies');
} }
function unicode_smilies_smilies(App $a, array &$b) function unicode_smilies_smilies(array &$b)
{ {
Smilies::add($b, ':-)', '&#x1F600;'); Smilies::add($b, ':-)', '&#x1F600;');
Smilies::add($b, ':)', '&#x1F600;'); Smilies::add($b, ':)', '&#x1F600;');

View File

@ -17,7 +17,7 @@ function viewsrc_install()
Hook::register('page_end', 'addon/viewsrc/viewsrc.php', 'viewsrc_page_end'); Hook::register('page_end', 'addon/viewsrc/viewsrc.php', 'viewsrc_page_end');
} }
function viewsrc_page_end(App $a, string &$o) function viewsrc_page_end(string &$o)
{ {
DI::page()['htmlhead'] .= <<< EOS DI::page()['htmlhead'] .= <<< EOS
<script> <script>
@ -30,7 +30,7 @@ function viewsrc_page_end(App $a, string &$o)
EOS; EOS;
} }
function viewsrc_item_photo_menu(App $a, array &$b) function viewsrc_item_photo_menu(array &$b)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;

View File

@ -24,7 +24,7 @@ function webdav_storage_uninstall()
DI::storageManager()->unregister(WebDav::class); DI::storageManager()->unregister(WebDav::class);
} }
function webdav_storage_instance(App $a, array &$data) function webdav_storage_instance(array &$data)
{ {
if ($data['name'] == WebDav::getName()) { if ($data['name'] == WebDav::getName()) {
$config = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient()); $config = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient());
@ -32,7 +32,7 @@ function webdav_storage_instance(App $a, array &$data)
} }
} }
function webdav_storage_config(App $a, array &$data) function webdav_storage_config(array &$data)
{ {
if ($data['name'] == WebDav::getName()) { if ($data['name'] == WebDav::getName()) {
$data['storage_config'] = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient()); $data['storage_config'] = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient());

View File

@ -16,12 +16,12 @@ function webrtc_install() {
Hook::register('app_menu', 'addon/webrtc/webrtc.php', 'webrtc_app_menu'); Hook::register('app_menu', 'addon/webrtc/webrtc.php', 'webrtc_app_menu');
} }
function webrtc_app_menu(App $a, array &$b) function webrtc_app_menu(array &$b)
{ {
$b['app_menu'][] = '<div class="app-title"><a href="webrtc">' . DI::l10n()->t('WebRTC Videochat') . '</a></div>'; $b['app_menu'][] = '<div class="app-title"><a href="webrtc">' . DI::l10n()->t('WebRTC Videochat') . '</a></div>';
} }
function webrtc_addon_admin (App $a, string &$o) function webrtc_addon_admin (string &$o)
{ {
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/webrtc/' ); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/webrtc/' );
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [
@ -35,7 +35,7 @@ function webrtc_addon_admin (App $a, string &$o)
]); ]);
} }
function webrtc_addon_admin_post (App $a) function webrtc_addon_admin_post ()
{ {
DI::config()->set('webrtc', 'webrtcurl', trim($_POST['webrtcurl'] ?? '')); DI::config()->set('webrtc', 'webrtcurl', trim($_POST['webrtcurl'] ?? ''));
} }
@ -47,7 +47,7 @@ function webrtc_addon_admin_post (App $a)
*/ */
function webrtc_module() {} function webrtc_module() {}
function webrtc_content(App $a): string function webrtc_content(): string
{ {
$o = ''; $o = '';

View File

@ -27,7 +27,7 @@ function wppost_install()
Hook::register('connector_settings_post', 'addon/wppost/wppost.php', 'wppost_settings_post'); Hook::register('connector_settings_post', 'addon/wppost/wppost.php', 'wppost_settings_post');
} }
function wppost_jot_nets(App &$a, array &$jotnets_fields) function wppost_jot_nets(array &$jotnets_fields)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -46,7 +46,7 @@ function wppost_jot_nets(App &$a, array &$jotnets_fields)
} }
function wppost_settings(App &$a, array &$data) function wppost_settings(array &$data)
{ {
if (!DI::userSession()->getLocalUserId()) { if (!DI::userSession()->getLocalUserId()) {
return; return;
@ -82,7 +82,7 @@ function wppost_settings(App &$a, array &$data)
} }
function wppost_settings_post(App $a, array &$b) function wppost_settings_post(array &$b)
{ {
if(!empty($_POST['wppost-submit'])) { if(!empty($_POST['wppost-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'wppost', 'post' , intval($_POST['wppost'])); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'wppost', 'post' , intval($_POST['wppost']));
@ -98,7 +98,7 @@ function wppost_settings_post(App $a, array &$b)
} }
} }
function wppost_hook_fork(App $a, array &$b) function wppost_hook_fork(array &$b)
{ {
if ($b['name'] != 'notifier_normal') { if ($b['name'] != 'notifier_normal') {
return; return;
@ -113,7 +113,7 @@ function wppost_hook_fork(App $a, array &$b)
} }
} }
function wppost_post_local(App $a, array &$b) { function wppost_post_local(array &$b) {
// This can probably be changed to allow editing by pointing to a different API endpoint // This can probably be changed to allow editing by pointing to a different API endpoint
@ -151,7 +151,7 @@ function wppost_post_local(App $a, array &$b) {
function wppost_send(App $a, array &$b) function wppost_send(array &$b)
{ {
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return; return;