Browse Source

Move Config::get() to DI::config()->get()

pull/948/head
nupplaPhil 3 years ago
parent
commit
1ce63185ab
No known key found for this signature in database
GPG Key ID: D8365C3D36B77D90
  1. 12
      blackout/blackout.php
  2. 14
      blockbot/blockbot.php
  3. 16
      buffer/buffer.php
  4. 2
      catavatar/catavatar.php
  5. 8
      cookienotice/cookienotice.php
  6. 12
      curweather/curweather.php
  7. 6
      forumdirectory/forumdirectory.php
  8. 8
      geocoordinates/geocoordinates.php
  9. 4
      geonames/geonames.php
  10. 8
      gravatar/gravatar.php
  11. 24
      impressum/impressum.php
  12. 12
      irc/irc.php
  13. 30
      jappixmini/jappixmini.php
  14. 8
      js_upload/js_upload.php
  15. 18
      ldapauth/ldapauth.php
  16. 6
      leistungsschutzrecht/leistungsschutzrecht.php
  17. 6
      libravatar/libravatar.php
  18. 16
      mailstream/mailstream.php
  19. 2
      mastodoncustomemojis/mastodoncustomemojis.php
  20. 16
      newmemberwidget/newmemberwidget.php
  21. 12
      notifyall/notifyall.php
  22. 24
      openstreetmap/openstreetmap.php
  23. 4
      pageheader/pageheader.php
  24. 22
      phpmailer/phpmailer.php
  25. 16
      piwik/piwik.php
  26. 30
      public_server/public_server.php
  27. 12
      pumpio/pumpio.php
  28. 2
      pumpio/pumpio_sync.php
  29. 8
      remote_permissions/remote_permissions.php
  30. 4
      securemail/securemail.php
  31. 208
      statusnet/library/statusnetoauth.php
  32. 14
      statusnet/statusnet.php
  33. 6
      testdrive/testdrive.php
  34. 20
      tumblr/tumblr.php
  35. 56
      twitter/twitter.php
  36. 2
      twitter/twitter_sync.php
  37. 4
      webrtc/webrtc.php
  38. 12
      xmpp/xmpp.php

12
blackout/blackout.php

@ -65,9 +65,9 @@ function blackout_redirect ($a, $b) {
}
// else...
$mystart = Config::get('blackout','begindate');
$myend = Config::get('blackout','enddate');
$myurl = Config::get('blackout','url');
$mystart = DI::config()->get('blackout','begindate');
$myend = DI::config()->get('blackout','enddate');
$myurl = DI::config()->get('blackout','url');
$now = time();
$date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart);
$date2 = DateTime::createFromFormat('Y-m-d G:i', $myend);
@ -85,11 +85,11 @@ function blackout_redirect ($a, $b) {
}
function blackout_addon_admin(&$a, &$o) {
$mystart = Config::get('blackout','begindate');
$mystart = DI::config()->get('blackout','begindate');
if (! is_string($mystart)) { $mystart = "YYYY-MM-DD hh:mm"; }
$myend = Config::get('blackout','enddate');
$myend = DI::config()->get('blackout','enddate');
if (! is_string($myend)) { $myend = "YYYY-MM-DD hh:mm"; }
$myurl = Config::get('blackout','url');
$myurl = DI::config()->get('blackout','url');
if (! is_string($myurl)) { $myurl = "https://www.example.com"; }
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/blackout/" );

14
blockbot/blockbot.php

@ -33,9 +33,9 @@ function blockbot_addon_admin(&$a, &$o) {
$o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'),
'$good_crawlers' => ['good_crawlers', DI::l10n()->t('Allow "good" crawlers'), Config::get('blockbot', 'good_crawlers'), "Don't block fediverse crawlers, relay servers and other bots with good purposes."],
'$block_gab' => ['block_gab', DI::l10n()->t('Block GabSocial'), Config::get('blockbot', 'block_gab'), 'Block the software GabSocial. This will block every access for that software. You can block dedicated gab instances in the blocklist settings in the admin section.'],
'$training' => ['training', DI::l10n()->t('Training mode'), Config::get('blockbot', 'training'), "Activates the training mode. This is only meant for developing purposes. Don't activate this on a production machine. This can cut communication with some systems."],
'$good_crawlers' => ['good_crawlers', DI::l10n()->t('Allow "good" crawlers'), DI::config()->get('blockbot', 'good_crawlers'), "Don't block fediverse crawlers, relay servers and other bots with good purposes."],
'$block_gab' => ['block_gab', DI::l10n()->t('Block GabSocial'), DI::config()->get('blockbot', 'block_gab'), 'Block the software GabSocial. This will block every access for that software. You can block dedicated gab instances in the blocklist settings in the admin section.'],
'$training' => ['training', DI::l10n()->t('Training mode'), DI::config()->get('blockbot', 'training'), "Activates the training mode. This is only meant for developing purposes. Don't activate this on a production machine. This can cut communication with some systems."],
]);
}
@ -77,7 +77,7 @@ function blockbot_init_1(App $a) {
'7Siters/', 'KOCMOHABT', 'Google-SearchByImage', 'FemtosearchBot/',
'HubSpot Crawler', 'DomainStatsBot/', 'Re-re Studio'];
if (!Config::get('blockbot', 'good_crawlers')) {
if (!DI::config()->get('blockbot', 'good_crawlers')) {
$agents = array_merge($agents, $good_agents);
} else {
foreach ($good_agents as $good_agent) {
@ -87,7 +87,7 @@ function blockbot_init_1(App $a) {
}
}
if (Config::get('blockbot', 'block_gab')) {
if (DI::config()->get('blockbot', 'block_gab')) {
$agents[] = 'GabSocial/';
}
@ -98,7 +98,7 @@ function blockbot_init_1(App $a) {
}
// This switch here is only meant for developers who want to add more bots to the list above, it is not safe for production.
if (!Config::get('blockbot', 'training')) {
if (!DI::config()->get('blockbot', 'training')) {
return;
}
@ -117,7 +117,7 @@ function blockbot_init_1(App $a) {
'Dispatch/', 'Ruby', 'Java/', 'libwww-perl/', 'Mastodon/',
'lua-resty-http/'];
if (Config::get('blockbot', 'good_crawlers')) {
if (DI::config()->get('blockbot', 'good_crawlers')) {
$agents = array_merge($agents, $good_agents);
}

16
buffer/buffer.php

@ -78,8 +78,8 @@ function buffer_addon_admin(App $a, &$o)
$o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'),
// name, label, value, help, [extra values]
'$client_id' => ['client_id', DI::l10n()->t('Client ID'), Config::get('buffer', 'client_id'), ''],
'$client_secret' => ['client_secret', DI::l10n()->t('Client Secret'), Config::get('buffer', 'client_secret'), ''],
'$client_id' => ['client_id', DI::l10n()->t('Client ID'), DI::config()->get('buffer', 'client_id'), ''],
'$client_secret' => ['client_secret', DI::l10n()->t('Client Secret'), DI::config()->get('buffer', 'client_secret'), ''],
]);
}
@ -105,8 +105,8 @@ function buffer_connect(App $a)
session_start();
// Define the needed keys
$client_id = Config::get('buffer','client_id');
$client_secret = Config::get('buffer','client_secret');
$client_id = DI::config()->get('buffer','client_id');
$client_secret = DI::config()->get('buffer','client_secret');
// The callback URL is the script that gets called after the user authenticates with buffer
$callback_url = DI::baseUrl()->get()."/buffer/connect";
@ -172,8 +172,8 @@ function buffer_settings(App $a, &$s)
$s .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. DI::l10n()->t('Buffer Export').'</h3>';
$s .= '</span>';
$client_id = Config::get("buffer", "client_id");
$client_secret = Config::get("buffer", "client_secret");
$client_id = DI::config()->get("buffer", "client_id");
$client_secret = DI::config()->get("buffer", "client_secret");
$access_token = DI::pConfig()->get(local_user(), "buffer", "access_token");
$s .= '<div id="buffer-password-wrapper">';
@ -309,8 +309,8 @@ function buffer_send(App $a, array &$b)
//if($b['app'] == "Buffer")
// return;
$client_id = Config::get("buffer", "client_id");
$client_secret = Config::get("buffer", "client_secret");
$client_id = DI::config()->get("buffer", "client_id");
$client_secret = DI::config()->get("buffer", "client_secret");
$access_token = DI::pConfig()->get($b['uid'], "buffer","access_token");
$callback_url = "";

2
catavatar/catavatar.php

@ -111,7 +111,7 @@ function catavatar_addon_settings_post(App $a, &$s)
// Update global directory in background
$url = DI::baseUrl()->get() . '/profile/' . $a->user['nickname'];
if ($url && strlen(Config::get('system', 'directory'))) {
if ($url && strlen(DI::config()->get('system', 'directory'))) {
Worker::add(PRIORITY_LOW, 'Directory', $url);
}

8
cookienotice/cookienotice.php

@ -40,8 +40,8 @@ function cookienotice_addon_admin(App $a, &$s)
return;
}
$text = Config::get('cookienotice', 'text', DI::l10n()->t('This website uses cookies. If you continue browsing this website, you agree to the usage of cookies.'));
$oktext = Config::get('cookienotice', 'oktext', DI::l10n()->t('OK'));
$text = DI::config()->get('cookienotice', 'text', DI::l10n()->t('This website uses cookies. If you continue browsing this website, you agree to the usage of cookies.'));
$oktext = DI::config()->get('cookienotice', 'oktext', DI::l10n()->t('OK'));
$t = Renderer::getMarkupTemplate('admin.tpl', __DIR__);
$s .= Renderer::replaceMacros($t, [
@ -106,8 +106,8 @@ function cookienotice_page_content_top(App $a, &$b)
*/
function cookienotice_page_end(App $a, &$b)
{
$text = (string)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)Config::get('cookienotice', 'oktext', DI::l10n()->t('OK'));
$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'));
$page_end_tpl = Renderer::getMarkupTemplate('cookienotice.tpl', __DIR__);

12
curweather/curweather.php

@ -116,10 +116,10 @@ function curweather_network_mod_init(App $a, &$b)
$rpt = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc');
// Set the language to the browsers language or default and use metric units
$lang = Session::get('language', Config::get('system', 'language'));
$lang = Session::get('language', DI::config()->get('system', 'language'));
$units = DI::pConfig()->get( local_user(), 'curweather', 'curweather_units');
$appid = Config::get('curweather', 'appid');
$cachetime = intval(Config::get('curweather', 'cachetime'));
$appid = DI::config()->get('curweather', 'appid');
$cachetime = intval(DI::config()->get('curweather', 'cachetime'));
if ($units === "") {
$units = 'metric';
@ -184,7 +184,7 @@ function curweather_addon_settings(App $a, &$s)
/* Get the current state of our config variable */
$curweather_loc = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc');
$curweather_units = DI::pConfig()->get(local_user(), 'curweather', 'curweather_units');
$appid = Config::get('curweather', 'appid');
$appid = DI::config()->get('curweather', 'appid');
if ($appid == "") {
$noappidtext = DI::l10n()->t('No APPID found, please contact your admin to obtain one.');
@ -233,8 +233,8 @@ function curweather_addon_admin(App $a, &$o)
return;
}
$appid = Config::get('curweather', 'appid');
$cachetime = Config::get('curweather', 'cachetime');
$appid = DI::config()->get('curweather', 'appid');
$cachetime = DI::config()->get('curweather', 'cachetime');
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/curweather/" );

6
forumdirectory/forumdirectory.php

@ -54,7 +54,7 @@ function forumdirectory_post(App $a)
function forumdirectory_content(App $a)
{
if ((Config::get('system', 'block_public')) && (!local_user()) && (!remote_user())) {
if ((DI::config()->get('system', 'block_public')) && (!local_user()) && (!remote_user())) {
notice(DI::l10n()->t('Public access denied.') . EOL);
return;
}
@ -71,7 +71,7 @@ function forumdirectory_content(App $a)
}
$gdirpath = '';
$dirurl = Config::get('system', 'directory');
$dirurl = DI::config()->get('system', 'directory');
if (strlen($dirurl)) {
$gdirpath = Profile::zrl($dirurl, true);
}
@ -97,7 +97,7 @@ function forumdirectory_content(App $a)
(`profile`.`prv_keywords` LIKE '%$search%'))";
}
$publish = Config::get('system', 'publish_all') ? '' : " AND `publish` = 1 ";
$publish = DI::config()->get('system', 'publish_all') ? '' : " AND `publish` = 1 ";
$total = 0;
$cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total` FROM `profile`

8
geocoordinates/geocoordinates.php

@ -32,11 +32,11 @@ function geocoordinates_resolve_item(&$item)
if((!$item["coord"]) || ($item["location"]))
return;
$key = Config::get("geocoordinates", "api_key");
$key = DI::config()->get("geocoordinates", "api_key");
if ($key == "")
return;
$language = Config::get("geocoordinates", "language");
$language = DI::config()->get("geocoordinates", "language");
if ($language == "")
$language = "de";
@ -93,8 +93,8 @@ function geocoordinates_addon_admin(&$a, &$o)
$o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'),
'$api_key' => ['api_key', DI::l10n()->t('API Key'), Config::get('geocoordinates', 'api_key'), ''],
'$language' => ['language', DI::l10n()->t('Language code (IETF format)'), Config::get('geocoordinates', 'language'), ''],
'$api_key' => ['api_key', DI::l10n()->t('API Key'), DI::config()->get('geocoordinates', 'api_key'), ''],
'$language' => ['language', DI::l10n()->t('Language code (IETF format)'), DI::config()->get('geocoordinates', 'language'), ''],
]);
}

4
geonames/geonames.php

@ -64,7 +64,7 @@ function geonames_post_hook(App $a, array &$item)
/* Retrieve our personal config setting */
$geo_account = Config::get('geonames', 'username');
$geo_account = DI::config()->get('geonames', 'username');
$active = DI::pConfig()->get(local_user(), 'geonames', 'enable');
if (!$geo_account || !$active) {
@ -127,7 +127,7 @@ function geonames_addon_settings(App $a, &$s)
return;
}
$geo_account = Config::get('geonames', 'username');
$geo_account = DI::config()->get('geonames', 'username');
if (!$geo_account) {
return;

8
gravatar/gravatar.php

@ -49,8 +49,8 @@ function gravatar_load_config(App $a, ConfigFileLoader $loader)
* @param &$b array
*/
function gravatar_lookup($a, &$b) {
$default_avatar = Config::get('gravatar', 'default_avatar');
$rating = Config::get('gravatar', 'rating');
$default_avatar = DI::config()->get('gravatar', 'default_avatar');
$rating = DI::config()->get('gravatar', 'rating');
// setting default value if nothing configured
if(! $default_avatar)
@ -75,8 +75,8 @@ function gravatar_lookup($a, &$b) {
function gravatar_addon_admin (&$a, &$o) {
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/gravatar/" );
$default_avatar = Config::get('gravatar', 'default_avatar');
$rating = Config::get('gravatar', 'rating');
$default_avatar = DI::config()->get('gravatar', 'default_avatar');
$rating = DI::config()->get('gravatar', 'rating');
// set default values for first configuration
if(! $default_avatar)

24
impressum/impressum.php

@ -43,7 +43,7 @@ function obfuscate_email ($s) {
return $s;
}
function impressum_footer($a, &$b) {
$text = ProxyUtils::proxifyHtml(BBCode::convert(Config::get('impressum','footer_text')));
$text = ProxyUtils::proxifyHtml(BBCode::convert(DI::config()->get('impressum','footer_text')));
if (! $text == '') {
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.DI::baseUrl()->get().'/addon/impressum/impressum.css" media="all" />';
@ -59,11 +59,11 @@ function impressum_load_config(\Friendica\App $a, ConfigFileLoader $loader)
function impressum_show($a,&$b) {
$b .= '<h3>'.DI::l10n()->t('Impressum').'</h3>';
$owner = Config::get('impressum', 'owner');
$owner_profile = Config::get('impressum','ownerprofile');
$postal = ProxyUtils::proxifyHtml(BBCode::convert(Config::get('impressum', 'postal')));
$notes = ProxyUtils::proxifyHtml(BBCode::convert(Config::get('impressum', 'notes')));
$email = obfuscate_email( Config::get('impressum','email') );
$owner = DI::config()->get('impressum', 'owner');
$owner_profile = DI::config()->get('impressum','ownerprofile');
$postal = ProxyUtils::proxifyHtml(BBCode::convert(DI::config()->get('impressum', 'postal')));
$notes = ProxyUtils::proxifyHtml(BBCode::convert(DI::config()->get('impressum', 'notes')));
$email = obfuscate_email( DI::config()->get('impressum','email') );
if (strlen($owner)) {
if (strlen($owner_profile)) {
$tmp = '<a href="'.$owner_profile.'">'.$owner.'</a>';
@ -105,11 +105,11 @@ function impressum_addon_admin (&$a, &$o) {
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/impressum/" );
$o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'),
'$owner' => ['owner', DI::l10n()->t('Site Owner'), Config::get('impressum','owner'), DI::l10n()->t('The page operators name.')],
'$ownerprofile' => ['ownerprofile', DI::l10n()->t('Site Owners Profile'), Config::get('impressum','ownerprofile'), DI::l10n()->t('Profile address of the operator.')],
'$postal' => ['postal', DI::l10n()->t('Postal Address'), Config::get('impressum','postal'), DI::l10n()->t('How to contact the operator via snail mail. You can use BBCode here.')],
'$notes' => ['notes', DI::l10n()->t('Notes'), Config::get('impressum','notes'), DI::l10n()->t('Additional notes that are displayed beneath the contact information. You can use BBCode here.')],
'$email' => ['email', DI::l10n()->t('Email Address'), Config::get('impressum','email'), DI::l10n()->t('How to contact the operator via email. (will be displayed obfuscated)')],
'$footer_text' => ['footer_text', DI::l10n()->t('Footer note'), Config::get('impressum','footer_text'), DI::l10n()->t('Text for the footer. You can use BBCode here.')],
'$owner' => ['owner', DI::l10n()->t('Site Owner'), DI::config()->get('impressum','owner'), DI::l10n()->t('The page operators name.')],
'$ownerprofile' => ['ownerprofile', DI::l10n()->t('Site Owners Profile'), DI::config()->get('impressum','ownerprofile'), DI::l10n()->t('Profile address of the operator.')],
'$postal' => ['postal', DI::l10n()->t('Postal Address'), DI::config()->get('impressum','postal'), DI::l10n()->t('How to contact the operator via snail mail. You can use BBCode here.')],
'$notes' => ['notes', DI::l10n()->t('Notes'), DI::config()->get('impressum','notes'), DI::l10n()->t('Additional notes that are displayed beneath the contact information. You can use BBCode here.')],
'$email' => ['email', DI::l10n()->t('Email Address'), DI::config()->get('impressum','email'), DI::l10n()->t('How to contact the operator via email. (will be displayed obfuscated)')],
'$footer_text' => ['footer_text', DI::l10n()->t('Footer note'), DI::config()->get('impressum','footer_text'), DI::l10n()->t('Text for the footer. You can use BBCode here.')],
]);
}

12
irc/irc.php

@ -86,9 +86,9 @@ function irc_content(&$a) {
if (local_user()) {
$sitechats = DI::pConfig()->get( local_user(), 'irc', 'sitechats');
if (!$sitechats)
$sitechats = Config::get('irc', 'sitechats');
$sitechats = DI::config()->get('irc', 'sitechats');
} else {
$sitechats = Config::get('irc','sitechats');
$sitechats = DI::config()->get('irc','sitechats');
}
if($sitechats)
$chats = explode(',',$sitechats);
@ -106,9 +106,9 @@ function irc_content(&$a) {
if (local_user()) {
$autochans = DI::pConfig()->get(local_user(), 'irc', 'autochans');
if (!$autochans)
$autochans = Config::get('irc','autochans');
$autochans = DI::config()->get('irc','autochans');
} else {
$autochans = Config::get('irc','autochans');
$autochans = DI::config()->get('irc','autochans');
}
if($autochans)
$channels = $autochans;
@ -138,8 +138,8 @@ function irc_addon_admin_post (&$a) {
}
}
function irc_addon_admin (&$a, &$o) {
$sitechats = Config::get('irc','sitechats'); /* popular channels */
$autochans = Config::get('irc','autochans'); /* auto connect chans */
$sitechats = DI::config()->get('irc','sitechats'); /* popular channels */
$autochans = DI::config()->get('irc','autochans'); /* auto connect chans */
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/irc/" );
$o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'),

30
jappixmini/jappixmini.php

@ -86,7 +86,7 @@ function jappixmini_install()
Hook::register('about_hook', 'addon/jappixmini/jappixmini.php', 'jappixmini_download_source');
// set standard configuration
$info_text = Config::get("jappixmini", "infotext");
$info_text = DI::config()->get("jappixmini", "infotext");
if (!$info_text)
Config::set("jappixmini", "infotext", "To get the chat working, you need to know a BOSH host which works with your Jabber account. " .
"An example of a BOSH server that works for all accounts is https://bind.jappix.com/, but keep " .
@ -94,13 +94,13 @@ function jappixmini_install()
"server also provides an own BOSH server, it is much better to use this one!"
);
$bosh_proxy = Config::get("jappixmini", "bosh_proxy");
$bosh_proxy = DI::config()->get("jappixmini", "bosh_proxy");
if ($bosh_proxy === "") {
Config::set("jappixmini", "bosh_proxy", "1");
}
// set addon version so that safe updates are possible later
$addon_version = Config::get("jappixmini", "version");
$addon_version = DI::config()->get("jappixmini", "version");
if ($addon_version === "") {
Config::set("jappixmini", "version", "1");
}
@ -127,35 +127,35 @@ function jappixmini_addon_admin(App $a, &$o)
}
// warn if cron job has not yet been executed
$cron_run = Config::get("jappixmini", "last_cron_execution");
$cron_run = DI::config()->get("jappixmini", "last_cron_execution");
if (!$cron_run) {
$o .= "<p><strong>Warning: The cron job has not yet been executed. If this message is still there after some time (usually 10 minutes), this means that autosubscribe and autoaccept will not work.</strong></p>";
}
// bosh proxy
$bosh_proxy = intval(Config::get("jappixmini", "bosh_proxy"));
$bosh_proxy = intval(DI::config()->get("jappixmini", "bosh_proxy"));
$bosh_proxy = intval($bosh_proxy) ? ' checked="checked"' : '';
$o .= '<label for="jappixmini-proxy">Activate BOSH proxy</label>';
$o .= ' <input id="jappixmini-proxy" type="checkbox" name="jappixmini-proxy" value="1"' . $bosh_proxy . ' /><br />';
// bosh address
$bosh_address = Config::get("jappixmini", "bosh_address");
$bosh_address = DI::config()->get("jappixmini", "bosh_address");
$o .= '<p><label for="jappixmini-address">Adress of the default BOSH proxy. If enabled it overrides the user settings:</label><br />';
$o .= '<input id="jappixmini-address" type="text" name="jappixmini-address" value="' . $bosh_address . '" /></p>';
// default server address
$default_server = Config::get("jappixmini", "default_server");
$default_server = DI::config()->get("jappixmini", "default_server");
$o .= '<p><label for="jappixmini-server">Adress of the default jabber server:</label><br />';
$o .= '<input id="jappixmini-server" type="text" name="jappixmini-server" value="' . $default_server . '" /></p>';
// default user name to friendica nickname
$default_user = intval(Config::get("jappixmini", "default_user"));
$default_user = intval(DI::config()->get("jappixmini", "default_user"));
$default_user = intval($default_user) ? ' checked="checked"' : '';
$o .= '<label for="jappixmini-user">Set the default username to the nickname:</label>';
$o .= ' <input id="jappixmini-user" type="checkbox" name="jappixmini-defaultuser" value="1"' . $default_user . ' /><br />';
// info text field
$info_text = Config::get("jappixmini", "infotext");
$info_text = DI::config()->get("jappixmini", "infotext");
$o .= '<p><label for="jappixmini-infotext">Info text to help users with configuration (important if you want to provide your own BOSH host!):</label><br />';
$o .= '<textarea id="jappixmini-infotext" name="jappixmini-infotext" rows="5" cols="50">' . htmlentities($info_text) . '</textarea></p>';
@ -272,7 +272,7 @@ function jappixmini_settings(App $a, &$s)
$dontinsertchat = DI::pConfig()->get(local_user(), 'jappixmini', 'dontinsertchat');
$insertchat = !(intval($dontinsertchat) ? ' checked="checked"' : '');
$defaultbosh = Config::get("jappixmini", "bosh_address");
$defaultbosh = DI::config()->get("jappixmini", "bosh_address");
if ($defaultbosh != "") {
DI::pConfig()->set(local_user(), 'jappixmini', 'bosh', $defaultbosh);
@ -294,14 +294,14 @@ function jappixmini_settings(App $a, &$s)
$encrypt_disabled = $encrypt ? '' : ' disabled="disabled"';
if ($server == "") {
$server = Config::get("jappixmini", "default_server");
$server = DI::config()->get("jappixmini", "default_server");
}
if (($username == "") && Config::get("jappixmini", "default_user")) {
if (($username == "") && DI::config()->get("jappixmini", "default_user")) {
$username = $a->user["nickname"];
}
$info_text = Config::get("jappixmini", "infotext");
$info_text = DI::config()->get("jappixmini", "infotext");
$info_text = htmlentities($info_text);
$info_text = str_replace("\n", "<br />", $info_text);
@ -511,7 +511,7 @@ function jappixmini_script(App $a)
$autosubscribe = intval($autosubscribe);
// set proxy if necessary
$use_proxy = Config::get('jappixmini', 'bosh_proxy');
$use_proxy = DI::config()->get('jappixmini', 'bosh_proxy');
if ($use_proxy) {
$proxy = DI::baseUrl()->get() . '/addon/jappixmini/proxy.php';
} else {
@ -548,7 +548,7 @@ function jappixmini_script(App $a)
// get nickname
$r = q("SELECT `username` FROM `user` WHERE `uid`=$uid");
$nickname = json_encode($r[0]["username"]);
$groupchats = Config::get('jappixmini', 'groupchats');
$groupchats = DI::config()->get('jappixmini', 'groupchats');
//if $groupchats has no value jappix_addon_start will produce a syntax error
if (empty($groupchats)) {
$groupchats = "{}";

8
js_upload/js_upload.php

@ -36,7 +36,7 @@ function js_upload_form(App $a, array &$b)
'$cancel' => DI::l10n()->t('Cancel'),
'$failed' => DI::l10n()->t('Failed'),
'$post_url' => $b['post_url'],
'$maximagesize' => intval(Config::get('system', 'maximagesize')),
'$maximagesize' => intval(DI::config()->get('system', 'maximagesize')),
]);
}
@ -46,7 +46,7 @@ function js_upload_post_init(App $a, &$b)
$allowedExtensions = ['jpeg', 'gif', 'png', 'jpg'];
// max file size in bytes
$sizeLimit = Config::get('system', 'maximagesize');
$sizeLimit = DI::config()->get('system', 'maximagesize');
$uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
@ -99,7 +99,7 @@ class qqUploadedFileXhr
{
$input = fopen('php://input', 'r');
$upload_dir = Config::get('system', 'tempdir');
$upload_dir = DI::config()->get('system', 'tempdir');
if (!$upload_dir)
$upload_dir = sys_get_temp_dir();
@ -227,7 +227,7 @@ class qqFileUploader
// }
$maximagesize = Config::get('system', 'maximagesize');
$maximagesize = DI::config()->get('system', 'maximagesize');
if (($maximagesize) && ($size > $maximagesize)) {
return ['error' => DI::l10n()->t('Image exceeds size limit of ') . $maximagesize];

18
ldapauth/ldapauth.php

@ -91,15 +91,15 @@ function ldapauth_hook_authenticate($a, &$b)
function ldapauth_authenticate($username, $password)
{
$ldap_server = Config::get('ldapauth', 'ldap_server');
$ldap_binddn = Config::get('ldapauth', 'ldap_binddn');
$ldap_bindpw = Config::get('ldapauth', 'ldap_bindpw');
$ldap_searchdn = Config::get('ldapauth', 'ldap_searchdn');
$ldap_userattr = Config::get('ldapauth', 'ldap_userattr');
$ldap_group = Config::get('ldapauth', 'ldap_group');
$ldap_autocreateaccount = Config::get('ldapauth', 'ldap_autocreateaccount');
$ldap_autocreateaccount_emailattribute = Config::get('ldapauth', 'ldap_autocreateaccount_emailattribute');
$ldap_autocreateaccount_nameattribute = Config::get('ldapauth', 'ldap_autocreateaccount_nameattribute');
$ldap_server = DI::config()->get('ldapauth', 'ldap_server');
$ldap_binddn = DI::config()->get('ldapauth', 'ldap_binddn');
$ldap_bindpw = DI::config()->get('ldapauth', 'ldap_bindpw');
$ldap_searchdn = DI::config()->get('ldapauth', 'ldap_searchdn');
$ldap_userattr = DI::config()->get('ldapauth', 'ldap_userattr');
$ldap_group = DI::config()->get('ldapauth', 'ldap_group');
$ldap_autocreateaccount = DI::config()->get('ldapauth', 'ldap_autocreateaccount');
$ldap_autocreateaccount_emailattribute = DI::config()->get('ldapauth', 'ldap_autocreateaccount_emailattribute');
$ldap_autocreateaccount_nameattribute = DI::config()->get('ldapauth', 'ldap_autocreateaccount_nameattribute');
if (!(strlen($password) && function_exists('ldap_connect') && strlen($ldap_server))) {
Logger::log("ldapauth: not configured or missing php-ldap module");

6
leistungsschutzrecht/leistungsschutzrecht.php

@ -29,7 +29,7 @@ function leistungsschutzrecht_getsiteinfo($a, &$siteinfo) {
}
// Avoid any third party pictures, to avoid copyright issues
if (!in_array($siteinfo['type'], ['photo', 'video']) && Config::get('leistungsschutzrecht', 'suppress_photos', false)) {
if (!in_array($siteinfo['type'], ['photo', 'video']) && DI::config()->get('leistungsschutzrecht', 'suppress_photos', false)) {
unset($siteinfo["image"]);
unset($siteinfo["images"]);
}
@ -131,7 +131,7 @@ function leistungsschutzrecht_fetchsites()
}
function leistungsschutzrecht_is_member_site($url) {
$sites = Config::get('leistungsschutzrecht','sites');
$sites = DI::config()->get('leistungsschutzrecht','sites');
if ($sites == "")
return(false);
@ -161,7 +161,7 @@ function leistungsschutzrecht_is_member_site($url) {
}
function leistungsschutzrecht_cron($a,$b) {
$last = Config::get('leistungsschutzrecht','last_poll');
$last = DI::config()->get('leistungsschutzrecht','last_poll');
if($last) {
$next = $last + 86400;

6
libravatar/libravatar.php

@ -50,11 +50,11 @@ function libravatar_load_config(App $a, ConfigFileLoader $loader)
*/
function libravatar_lookup($a, &$b)
{
$default_avatar = Config::get('libravatar', 'default_avatar');
$default_avatar = DI::config()->get('libravatar', 'default_avatar');
if (! $default_avatar) {
// if not set, look up if there was one from the gravatar addon
$default_avatar = Config::get('gravatar', 'default_avatar');
$default_avatar = DI::config()->get('gravatar', 'default_avatar');
// setting default avatar if nothing configured
if (!$default_avatar) {
$default_avatar = 'identicon'; // default image will be a random pattern
@ -78,7 +78,7 @@ function libravatar_addon_admin(&$a, &$o)
{
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/libravatar");
$default_avatar = Config::get('libravatar', 'default_avatar');
$default_avatar = DI::config()->get('libravatar', 'default_avatar');
// set default values for first configuration
if (!$default_avatar) {

16
mailstream/mailstream.php

@ -24,31 +24,31 @@ function mailstream_install() {
Hook::register('post_remote_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook');
Hook::register('cron', 'addon/mailstream/mailstream.php', 'mailstream_cron');
if (Config::get('mailstream', 'dbversion') == '0.1') {
if (DI::config()->get('mailstream', 'dbversion') == '0.1') {
q('ALTER TABLE `mailstream_item` DROP INDEX `uid`');
q('ALTER TABLE `mailstream_item` DROP INDEX `contact-id`');
q('ALTER TABLE `mailstream_item` DROP INDEX `plink`');
q('ALTER TABLE `mailstream_item` CHANGE `plink` `uri` char(255) NOT NULL');
Config::set('mailstream', 'dbversion', '0.2');
}
if (Config::get('mailstream', 'dbversion') == '0.2') {
if (DI::config()->get('mailstream', 'dbversion') == '0.2') {
q('DELETE FROM `pconfig` WHERE `cat` = "mailstream" AND `k` = "delay"');
Config::set('mailstream', 'dbversion', '0.3');
}
if (Config::get('mailstream', 'dbversion') == '0.3') {
if (DI::config()->get('mailstream', 'dbversion') == '0.3') {
q('ALTER TABLE `mailstream_item` CHANGE `created` `created` timestamp NOT NULL DEFAULT now()');
q('ALTER TABLE `mailstream_item` CHANGE `completed` `completed` timestamp NULL DEFAULT NULL');
Config::set('mailstream', 'dbversion', '0.4');
}
if (Config::get('mailstream', 'dbversion') == '0.4') {
if (DI::config()->get('mailstream', 'dbversion') == '0.4') {
q('ALTER TABLE `mailstream_item` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin');
Config::set('mailstream', 'dbversion', '0.5');
}
if (Config::get('mailstream', 'dbversion') == '0.5') {
if (DI::config()->get('mailstream', 'dbversion') == '0.5') {
Config::set('mailstream', 'dbversion', '1.0');
}
if (Config::get('retriever', 'dbversion') != '1.0') {
if (DI::config()->get('retriever', 'dbversion') != '1.0') {
$schema = file_get_contents(dirname(__file__).'/database.sql');
$arr = explode(';', $schema);
foreach ($arr as $a) {
@ -74,7 +74,7 @@ function mailstream_uninstall() {
function mailstream_module() {}
function mailstream_addon_admin(&$a,&$o) {
$frommail = Config::get('mailstream', 'frommail');
$frommail = DI::config()->get('mailstream', 'frommail');
$template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/');
$config = ['frommail',
DI::l10n()->t('From Address'),
@ -276,7 +276,7 @@ function mailstream_send(\Friendica\App $a, $message_id, $item, $user) {
$attachments = [];
mailstream_do_images($a, $item, $attachments);
$frommail = Config::get('mailstream', 'frommail');
$frommail = DI::config()->get('mailstream', 'frommail');
if ($frommail == "") {
$frommail = 'friendica@localhost.local';
}

2
mastodoncustomemojis/mastodoncustomemojis.php

@ -76,7 +76,7 @@ function mastodoncustomemojis_get_custom_emojis_for_author($author_link)
$return = DI::cache()->get($cache_key);
if (empty($return) || Config::get('system', 'ignore_cache')) {
if (empty($return) || DI::config()->get('system', 'ignore_cache')) {
$return = mastodoncustomemojis_fetch_custom_emojis_for_url($api_base_url);
DI::cache()->set($cache_key, $return, empty($return['texts']) ? Duration::QUARTER_HOUR : Duration::HOUR);

16
newmemberwidget/newmemberwidget.php

@ -35,15 +35,15 @@ function newmemberwidget_network_mod_init ($a, $b)
$t .= '<h3>'.DI::l10n()->t('New Member').'</h3>'.EOL;
$t .= '<a href="newmember" id="newmemberwidget-tips">' . DI::l10n()->t('Tips for New Members') . '</a><br />'.EOL;
if (Config::get('newmemberwidget','linkglobalsupport', false)) {
if (DI::config()->get('newmemberwidget','linkglobalsupport', false)) {
$t .= '<a href="https://forum.friendi.ca/profile/helpers" target="_new">'.DI::l10n()->t('Global Support Forum').'</a><br />'.EOL;
}
if (Config::get('newmemberwidget','linklocalsupport', false)) {
$t .= '<a href="'.DI::baseUrl()->get().'/profile/'.Config::get('newmemberwidget','localsupport').'" target="_new">'.DI::l10n()->t('Local Support Forum').'</a><br />'.EOL;
if (DI::config()->get('newmemberwidget','linklocalsupport', false)) {
$t .= '<a href="'.DI::baseUrl()->get().'/profile/'.DI::config()->get('newmemberwidget','localsupport').'" target="_new">'.DI::l10n()->t('Local Support Forum').'</a><br />'.EOL;
}
$ft = Config::get('newmemberwidget','freetext', '');
$ft = DI::config()->get('newmemberwidget','freetext', '');
if (!empty($ft)) {
$t .= '<p>'.BBCode::convert(trim($ft)).'</p>';
}
@ -69,9 +69,9 @@ function newmemberwidget_addon_admin(&$a, &$o)
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/newmemberwidget');
$o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'),
'$freetext' => [ "freetext", DI::l10n()->t("Message"), Config::get("newmemberwidget", "freetext"), DI::l10n()->t("Your message for new members. You can use bbcode here.")],
'$linkglobalsupport' => [ "linkglobalsupport", DI::l10n()->t('Add a link to global support forum'), Config::get('newmemberwidget', 'linkglobalsupport'), DI::l10n()->t('Should a link to the global support forum be displayed?')." (<a href='https://forum.friendi.ca/profile/helpers'>@helpers</a>)"],
'$linklocalsupport' => [ "linklocalsupport", DI::l10n()->t('Add a link to the local support forum'), Config::get('newmemberwidget', 'linklocalsupport'), DI::l10n()->t('If you have a local support forum and want to have a link displayed in the widget, check this box.')],
'$localsupportname' => [ "localsupportname", DI::l10n()->t('Name of the local support group'), Config::get('newmemberwidget', 'localsupport'), DI::l10n()->t('If you checked the above, specify the <em>nickname</em> of the local support group here (i.e. helpers)')],
'$freetext' => [ "freetext", DI::l10n()->t("Message"), DI::config()->get("newmemberwidget", "freetext"), DI::l10n()->t("Your message for new members. You can use bbcode here.")],
'$linkglobalsupport' => [ "linkglobalsupport", DI::l10n()->t('Add a link to global support forum'), DI::config()->get('newmemberwidget', 'linkglobalsupport'), DI::l10n()->t('Should a link to the global support forum be displayed?')." (<a href='https://forum.friendi.ca/profile/helpers'>@helpers</a>)"],
'$linklocalsupport' => [ "linklocalsupport", DI::l10n()->t('Add a link to the local support forum'), DI::config()->get('newmemberwidget', 'linklocalsupport'), DI::l10n()->t('If you have a local support forum and want to have a link displayed in the widget, check this box.')],
'$localsupportname' => [ "localsupportname", DI::l10n()->t('Name of the local support group'), DI::config()->get('newmemberwidget', 'localsupport'), DI::l10n()->t('If you checked the above, specify the <em>nickname</em> of the local support group here (i.e. helpers)')],
]);
}

12
notifyall/notifyall.php

@ -46,18 +46,18 @@ function notifyall_post(App $a)
return;
}
$sitename = Config::get('config', 'sitename');
$sitename = DI::config()->get('config', 'sitename');
if (empty(Config::get('config', 'admin_name'))) {
if (empty(DI::config()->get('config', 'admin_name'))) {
$sender_name = '"' . DI::l10n()->t('%s Administrator', $sitename) . '"';
} else {
$sender_name = '"' . DI::l10n()->t('%1$s, %2$s Administrator', Config::get('config', 'admin_name'), $sitename) . '"';
$sender_name = '"' . DI::l10n()->t('%1$s, %2$s Administrator', DI::config()->get('config', 'admin_name'), $sitename) . '"';
}
if (!Config::get('config', 'sender_email')) {
if (!DI::config()->get('config', 'sender_email')) {
$sender_email = 'noreply@' . DI::baseUrl()->getHostname();
} else {
$sender_email = Config::get('config', 'sender_email');
$sender_email = DI::config()->get('config', 'sender_email');
}
$subject = $_REQUEST['subject'];
@ -70,7 +70,7 @@ function notifyall_post(App $a)
// if this is a test, send it only to the admin(s)
// admin_email might be a comma separated list, but we need "a@b','c@d','e@f
if (intval($_REQUEST['test'])) {
$email = Config::get('config', 'admin_email');
$email = DI::config()->get('config', 'admin_email');
$email = "'" . str_replace([" ",","], ["","','"], $email) . "'";
}
$sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : '');

24
openstreetmap/openstreetmap.php

@ -82,10 +82,10 @@ function openstreetmap_location($a, &$item)
* ?mlat=lat&mlon=lon for markers.
*/
$tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS);
$nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM);
$zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM);
$marker = Config::get('openstreetmap', 'marker', OSM_MARKER);
$tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS);
$nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM);
$zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM);
$marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER);
// This is needed since we stored an empty string in the config in previous versions
if (empty($nomserver)) {
@ -120,7 +120,7 @@ function openstreetmap_location($a, &$item)
function openstreetmap_get_coordinates($a, &$b)
{
$nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM);
$nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM);
// This is needed since we stored an empty string in the config in previous versions
if (empty($nomserver)) {
@ -157,14 +157,14 @@ function openstreetmap_generate_named_map(&$a, &$b)
function openstreetmap_generate_map(&$a, &$b)
{
$tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS);
$tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS);
if (strpos(DI::baseUrl()->get(true), 'https:') !== false) {
$tmsserver = str_replace('http:','https:',$tmsserver);
}
$zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM);
$marker = Config::get('openstreetmap', 'marker', OSM_MARKER);
$zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM);
$marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER);
$lat = $b['lat']; // round($b['lat'], 5);
$lon = $b['lon']; // round($b['lon'], 5);
@ -194,10 +194,10 @@ function openstreetmap_generate_map(&$a, &$b)
function openstreetmap_addon_admin(&$a, &$o)
{
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/openstreetmap/");
$tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS);
$nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM);
$zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM);
$marker = Config::get('openstreetmap', 'marker', OSM_MARKER);
$tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS);
$nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM);
$zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM);
$marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER);
// This is needed since we stored an empty string in the config in previous versions
if (empty($nomserver)) {

4
pageheader/pageheader.php

@ -28,7 +28,7 @@ function pageheader_addon_admin(App &$a, &$s)
$stylesheetPath = __DIR__ . '/pageheader.css';
DI::page()->registerStylesheet($stylesheetPath);
$words = Config::get('pageheader','text');
$words = DI::config()->get('pageheader','text');
if(! $words)
$words = '';
@ -61,7 +61,7 @@ function pageheader_fetch(App $a, &$b)
if(file_exists('pageheader.html')){
$s = file_get_contents('pageheader.html');
} else {
$s = Config::get('pageheader', 'text');
$s = DI::config()->get('pageheader', 'text');
}
$stylesheetPath = __DIR__ .'/pageheader.css';

22
phpmailer/phpmailer.php

@ -39,7 +39,7 @@ function phpmailer_emailer_send_prepare(App $a, array &$b)
// Passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
if (Config::get('phpmailer', 'smtp')) {
if (DI::config()->get('phpmailer', 'smtp')) {
// Set mailer to use SMTP
$mail->isSMTP();
@ -48,22 +48,22 @@ function phpmailer_emailer_send_prepare(App $a, array &$b)
$mail->Encoding = 'base64';
// Specify main and backup SMTP servers
$mail->Host = Config::get('phpmailer', 'smtp_server');
$mail->Port = Config::get('phpmailer', 'smtp_port');
$mail->Host = DI::config()->get('phpmailer', 'smtp_server');
$mail->Port = DI::config()->get('phpmailer', 'smtp_port');
if (Config::get('system', 'smtp_secure') && Config::get('phpmailer', 'smtp_port_s')) {
$mail->SMTPSecure = Config::get('phpmailer', 'smtp_secure');
$mail->Port = Config::get('phpmailer', 'smtp_port_s');
if (DI::config()->get('system', 'smtp_secure') && DI::config()->get('phpmailer', 'smtp_port_s')) {
$mail->SMTPSecure = DI::config()->get('phpmailer', 'smtp_secure');
$mail->Port = DI::config()->get('phpmailer', 'smtp_port_s');
}
if (Config::get('phpmailer', 'smtp_username') && Config::get('phpmailer', 'smtp_password')) {
if (DI::config()->get('phpmailer', 'smtp_username') && DI::config()->get('phpmailer', 'smtp_password')) {
$mail->SMTPAuth = true;
$mail->Username = Config::get('phpmailer', 'smtp_username');
$mail->Password = Config::get('phpmailer', 'smtp_password');
$mail->Username = DI::config()->get('phpmailer', 'smtp_username');
$mail->Password = DI::config()->get('phpmailer', 'smtp_password');
}
if (Config::get('phpmailer', 'smtp_from')) {
$mail->setFrom(Config::get('phpmailer', 'smtp_from'), $b['fromName']);
if (DI::config()->get('phpmailer', 'smtp_from')) {
$mail->setFrom(DI::config()->get('phpmailer', 'smtp_from'), $b['fromName']);
}
} else {
$mail->setFrom($b['fromEmail'], $b['fromName']);

16
piwik/piwik.php

@ -70,10 +70,10 @@ function piwik_analytics($a,&$b) {
/*
* Get the configuration variables from the config/addon.config.php file.
*/
$baseurl = Config::get('piwik', 'baseurl');
$siteid = Config::get('piwik', 'siteid');
$optout = Config::get('piwik', 'optout');
$async = Config::get('piwik', 'async');
$baseurl = DI::config()->get('piwik', 'baseurl');
$siteid = DI::config()->get('piwik', 'siteid');
$optout = DI::config()->get('piwik', 'optout');
$async = DI::config()->get('piwik', 'async');
/*
* Add the Piwik tracking code for the site.
@ -103,10 +103,10 @@ function piwik_addon_admin (&$a, &$o) {
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/piwik/" );
$o = Renderer::replaceMacros( $t, [
'$submit' => DI::l10n()->t('Save Settings'),
'$piwikbaseurl' => ['baseurl', DI::l10n()->t('Matomo (Piwik) Base URL'), Config::get('piwik','baseurl' ), DI::l10n()->t('Absolute path to your Matomo (Piwik) installation. (without protocol (http/s), with trailing slash)')],
'$siteid' => ['siteid', DI::l10n()->t('Site ID'), Config::get('piwik','siteid' ), ''],
'$optout' => ['optout', DI::l10n()->t('Show opt-out cookie link?'), Config::get('piwik','optout' ), ''],
'$async' => ['async', DI::l10n()->t('Asynchronous tracking'), Config::get('piwik','async' ), ''],
'$piwikbaseurl' => ['baseurl', DI::l10n()->t('Matomo (Piwik) Base URL'), DI::config()->get('piwik','baseurl' ), DI::l10n()->t('Absolute path to your Matomo (Piwik) installation. (without protocol (http/s), with trailing slash)')],
'$siteid' => ['siteid', DI::l10n()->t('Site ID'), DI::config()->get('piwik','siteid' ), ''],
'$optout' => ['optout', DI::l10n()->t('Show opt-out cookie link?'), DI::config()->get('piwik','optout' ), ''],
'$async' => ['async', DI::l10n()->t('Asynchronous tracking'), DI::config()->get('piwik','async' ), ''],
]);
}
function piwik_addon_admin_post (&$a) {

30
public_server/public_server.php

@ -45,8 +45,8 @@ function public_server_register_account($a, $b)
{
$uid = $b;
$days = Config::get('public_server', 'expiredays');
$days_posts = Config::get('public_server', 'expireposts');
$days = DI::config()->get('public_server', 'expiredays');
$days_posts = DI::config()->get('public_server', 'expireposts');
if (!$days) {
return;
}
@ -83,7 +83,7 @@ function public_server_cron($a, $b)
}
}
$nologin = Config::get('public_server', 'nologin', false);
$nologin = DI::config()->get('public_server', 'nologin', false);
if ($nologin) {
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` <= '%s' AND `register_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s'",
DBA::NULL_DATETIME, intval($nologin), DBA::NULL_DATETIME);
@ -95,7 +95,7 @@ function public_server_cron($a, $b)
}
}
$flagusers = Config::get('public_server', 'flagusers', false);
$flagusers = DI::config()->get('public_server', 'flagusers', false);
if ($flagusers) {
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s' AND `page-flags` = 0",
intval($flagusers), DBA::NULL_DATETIME);
@ -107,8 +107,8 @@ function public_server_cron($a, $b)
}
}
$flagposts = Config::get('public_server', 'flagposts');
$flagpostsexpire = Config::get('public_server', 'flagpostsexpire');
$flagposts = DI::config()->get('public_server', 'flagposts');
$flagpostsexpire = DI::config()->get('public_server', 'flagpostsexpire');
if ($flagposts && $flagpostsexpire) {
$r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s' and `expire` = 0 AND `page-flags` = 0",
intval($flagposts), DBA::NULL_DATETIME);
@ -127,15 +127,15 @@ function public_server_enotify(&$a, &$b)
if (!empty($b['params']) && $b['params']['type'] == NOTIFY_SYSTEM
&& !empty($b['params']['system_type']) && $b['params']['system_type'] === 'public_server_expire') {
$b['itemlink'] = DI::baseUrl()->get();
$b['epreamble'] = $b['preamble'] = DI::l10n()->t('Your account on %s will expire in a few days.', Config::get('system', 'sitename'));
$b['epreamble'] = $b['preamble'] = DI::l10n()->t('Your account on %s will expire in a few days.', DI::config()->get('system', 'sitename'));
$b['subject'] = DI::l10n()->t('Your Friendica account is about to expire.');
$b['body'] = DI::l10n()->t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days", $b['params']['to_name'], "[url=" . Config::get('system', 'url') . "]" . Config::get('config', 'sitename') . "[/url]");
$b['body'] = DI::l10n()->t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days", $b['params']['to_name'], "[url=" . DI::config()->get('system', 'url') . "]" . DI::config()->get('config', 'sitename') . "[/url]");
}
}
function public_server_login($a, $b)
{
$days = Config::get('public_server', 'expiredays');
$days = DI::config()->get('public_server', 'expiredays');
if (!$days) {
return;
}
@ -171,11 +171,11 @@ function public_server_addon_admin(&$a, &$o)
'$submit' => DI::l10n()->t('Save Settings'),
'$form_security_token' => $token,
'$infotext' => DI::l10n()->t('Set any of these options to 0 to deactivate it.'),
'$expiredays' => ["expiredays","Expire Days", intval(Config::get('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "],
'$expireposts' => ["expireposts", "Expire Posts", intval(Config::get('public_server', 'expireposts')), "Set the default days for posts to expire here"],
'$nologin' => ["nologin", "No Login", intval(Config::get('public_server', 'nologin')), "Remove users who have never logged in after nologin days "],
'$flagusers' => ["flagusers", "Flag users", intval(Config::get('public_server', 'flagusers')), "Remove users who last logged in over flagusers days ago"],
'$flagposts' => ["flagposts", "Flag posts", intval(Config::get('public_server', 'flagposts')), "For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire "],
'$flagpostsexpire' => ["flagpostsexpire", "Flag posts expire", intval(Config::get('public_server', 'flagpostsexpire'))],
'$expiredays' => ["expiredays","Expire Days", intval(DI::config()->get('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "],
'$expireposts' => ["expireposts", "Expire Posts", intval(DI::config()->get('public_server', 'expireposts')), "Set the default days for posts to expire here"],
'$nologin' => ["nologin", "No Login", intval(DI::config()->get('public_server', 'nologin')), "Remove users who have never logged in after nologin days "],
'$flagusers' => ["flagusers", "Flag users", intval(DI::config()->get('public_server', 'flagusers')), "Remove users who last logged in over flagusers days ago"],
'$flagposts' => ["flagposts", "Flag posts", intval(DI::config()->get('public_server', 'flagposts')), "For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire "],
'$flagpostsexpire' => ["flagpostsexpire", "Flag posts expire", intval(DI::config()->get('public_server', 'flagpostsexpire'))],
]);
}

12
pumpio/pumpio.php

@ -101,13 +101,13 @@ function pumpio_registerclient(App $a, $host)
$params = [];
$application_name = Config::get('pumpio', 'application_name');
$application_name = DI::config()->get('pumpio', 'application_name');
if ($application_name == "") {
$application_name = DI::baseUrl()->getHostname();
}
$adminlist = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
$adminlist = explode(",", str_replace(" ", "", DI::config()->get('config', 'admin_email')));
$params["type"] = "client_associate";
$params["contacts"] = $adminlist[0];
@ -686,9 +686,9 @@ function pumpio_sync(App $a)
return;
}
$last = Config::get('pumpio', 'last_poll');
$last = DI::config()->get('pumpio', 'last_poll');
$poll_interval = intval(Config::get('pumpio', 'poll_interval', PUMPIO_DEFAULT_POLL_INTERVAL));
$poll_interval = intval(DI::config()->get('pumpio', 'poll_interval', PUMPIO_DEFAULT_POLL_INTERVAL));
if ($last) {
$next = $last + ($poll_interval * 60);
@ -707,7 +707,7 @@ function pumpio_sync(App $a)
}
}
$abandon_days = intval(Config::get('system', 'account_abandon_days'));
$abandon_days = intval(DI::config()->get('system', 'account_abandon_days'));
if ($abandon_days < 1) {
$abandon_days = 0;
}
@ -768,7 +768,7 @@ function pumpio_fetchtimeline(App $a, $uid)
// hostname of the node if neither one is set.
$application_name = DI::pConfig()->get($uid, 'pumpio', 'application_name');
if ($application_name == "") {
$application_name = Config::get('pumpio', 'application_name');
$application_name = DI::config()->get('pumpio', 'application_name');
}
if ($application_name == "") {
$application_name = DI::baseUrl()->getHostname();

2
pumpio/pumpio_sync.php

@ -9,7 +9,7 @@ function pumpio_sync_run(&$argv, &$argc) {
if (function_exists('sys_getloadavg')) {
$load = sys_getloadavg();
if (intval($load[0]) > Config::get('system', 'maxloadavg', 50)) {
if (intval($load[0]) > DI::config()->get('system', 'maxloadavg', 50)) {
Logger::log('system: load ' . $load[0] . ' too high. Pumpio sync deferred to next scheduled run.');
return;
}

8
remote_permissions/remote_permissions.php

@ -31,7 +31,7 @@ function remote_permissions_settings(&$a,&$o) {
if(! local_user())
return;
$global = Config::get("remote_perms", "global");
$global = DI::config()->get("remote_perms", "global");
if($global == 1)
return;
@ -69,7 +69,7 @@ function remote_permissions_content($a, $item_copy) {
if($item_copy['uid'] != local_user())
return;
if(Config::get('remote_perms','global') == 0) {
if(DI::config()->get('remote_perms','global') == 0) {
// Admin has set Individual choice. We need to find
// the original poster. First, get the contact's info
$r = q("SELECT nick, url FROM contact WHERE id = %d LIMIT 1",
@ -202,8 +202,8 @@ function remote_permissions_addon_admin(&$a, &$o){
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/remote_permissions/" );
$o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'),
'$global' => ['remotepermschoice', DI::l10n()->t('Global'), 1, DI::l10n()->t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1],
'$individual' => ['remotepermschoice', DI::l10n()->t('Individual'), 2, DI::l10n()->t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0]
'$global' => ['remotepermschoice', DI::l10n()->t('Global'), 1, DI::l10n()->t('The posts of every user on this server show the post recipients'), DI::config()->get('remote_perms', 'global') == 1],
'$individual' => ['remotepermschoice', DI::l10n()->t('Individual'), 2, DI::l10n()->t('Each user chooses whether his/her posts show the post recipients'), DI::config()->get('remote_perms', 'global') == 0]
]);
}

4
securemail/securemail.php

@ -89,14 +89,14 @@ function securemail_settings_post(App &$a, array &$b)
info(DI::l10n()->t('Secure Mail Settings saved.') . EOL);
if ($_POST['securemail-submit'] == DI::l10n()->t('Save and send test')) {
$sitename = Config::get('config', 'sitename');
$sitename = DI::config()->get('config', 'sitename');
$hostname = DI::baseUrl()->getHostname();
if (strpos($hostname, ':')) {
$hostname = substr($hostname, 0, strpos($hostname, ':'));
}
$sender_email = Config::get('config', 'sender_email');
$sender_email = DI::config()->get('config', 'sender_email');
if (empty($sender_email)) {
$sender_email = 'noreply@' . $hostname;
}

208
statusnet/library/statusnetoauth.php

@ -1,104 +1,104 @@
<?php
use Friendica\Core\Config;
require_once __DIR__ . DIRECTORY_SEPARATOR . 'twitteroauth.php';
/*
* We have to alter the TwitterOAuth class a little bit to work with any GNU Social
* installation abroad. Basically it's only make the API path variable and be happy.
*
* Thank you guys for the Twitter compatible API!
*/
class StatusNetOAuth extends TwitterOAuth
{
function get_maxlength()
{
$config = $this->get($this->host . 'statusnet/config.json');
return $config->site->textlimit;
}
function accessTokenURL()
{
return $this->host . 'oauth/access_token';
}
function authenticateURL()
{
return $this->host . 'oauth/authenticate';
}
function authorizeURL()
{
return $this->host . 'oauth/authorize';
}
function requestTokenURL()
{
return $this->host . 'oauth/request_token';
}
function __construct($apipath, $consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL)
{
parent::__construct($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
$this->host = $apipath;
}
/**
* Make an HTTP request
*
* Copied here from the TwitterOAuth library and complemented by applying the proxy settings of Friendica
*
* @param string $method
* @param string $host
* @param string $path
* @param array $parameters
*
* @return array|object API results
*/
function http($url, $method, $postfields = NULL)
{
$this->http_info = [];
$ci = curl_init();
/* Curl settings */
$prx = Config::get('system', 'proxy');
if (strlen($prx)) {
curl_setopt($ci, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ci, CURLOPT_PROXY, $prx);
$prxusr = Config::get('system', 'proxyuser');
if (strlen($prxusr)) {
curl_setopt($ci, CURLOPT_PROXYUSERPWD, $prxusr);
}
}
curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ci, CURLOPT_HTTPHEADER, ['Expect:']);
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
curl_setopt($ci, CURLOPT_HEADERFUNCTION, [$this, 'getHeader']);
curl_setopt($ci, CURLOPT_HEADER, FALSE);
switch ($method) {
case 'POST':
curl_setopt($ci, CURLOPT_POST, TRUE);
if (!empty($postfields)) {
curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
}
break;
case 'DELETE':
curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE');
if (!empty($postfields)) {
$url = "{$url}?{$postfields}";
}
}
curl_setopt($ci, CURLOPT_URL, $url);
$response = curl_exec($ci);
$this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
$this->http_info = array_merge($this->http_info, curl_getinfo($ci));
$this->url = $url;
curl_close($ci);
return $response;
}
}
<?php
use Friendica\Core\Config;
require_once __DIR__ . DIRECTORY_SEPARATOR . 'twitteroauth.php';
/*
* We have to alter the TwitterOAuth class a little bit to work with any GNU Social
* installation abroad. Basically it's only make the API path variable and be happy.
*
* Thank you guys for the Twitter compatible API!
*/
class StatusNetOAuth extends TwitterOAuth
{
function get_maxlength()
{
$config = $this->get($this->host . 'statusnet/config.json');
return $config->site->textlimit;
}
function accessTokenURL()
{
return $this->host . 'oauth/access_token';
}
function authenticateURL()
{
return $this->host . 'oauth/authenticate';
}
function authorizeURL()
{
return $this->host . 'oauth/authorize';
}
function requestTokenURL()
{
return $this->host . 'oauth/request_token';
}
function __construct($apipath, $consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL)
{
parent::__construct($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
$this->host = $apipath;
}
/**
* Make an HTTP request
*
* Copied here from the TwitterOAuth library and complemented by applying the proxy settings of Friendica
*
* @param string $method
* @param string $host
* @param string $path
* @param array $parameters
*
* @return array|object API results
*/
function http($url, $method, $postfields = NULL)
{
$this->http_info = [];
$ci = curl_init();
/* Curl settings */
$prx = DI::config()->get('system', 'proxy');
if (strlen($prx)) {
curl_setopt($ci, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ci, CURLOPT_PROXY, $prx);
$prxusr = DI::config()->get('system', 'proxyuser');
if (strlen($prxusr)) {
curl_setopt($ci, CURLOPT_PROXYUSERPWD, $prxusr);
}
}
curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent);
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ci, CURLOPT_HTTPHEADER, ['Expect:']);
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
curl_setopt($ci, CURLOPT_HEADERFUNCTION, [$this, 'getHeader']);
curl_setopt($ci, CURLOPT_HEADER, FALSE);
switch ($method) {
case 'POST':
curl_setopt($ci, CURLOPT_POST, TRUE);