Merge pull request #948 from nupplaphil/task/di_config

CleanUp Config namespace
This commit is contained in:
Hypolite Petovan 2020-01-19 22:23:10 -05:00 committed by GitHub
commit 1357817fc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 421 additions and 455 deletions

View File

@ -44,7 +44,6 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -65,9 +64,9 @@ function blackout_redirect ($a, $b) {
} }
// else... // else...
$mystart = Config::get('blackout','begindate'); $mystart = DI::config()->get('blackout','begindate');
$myend = Config::get('blackout','enddate'); $myend = DI::config()->get('blackout','enddate');
$myurl = Config::get('blackout','url'); $myurl = DI::config()->get('blackout','url');
$now = time(); $now = time();
$date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart); $date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart);
$date2 = DateTime::createFromFormat('Y-m-d G:i', $myend); $date2 = DateTime::createFromFormat('Y-m-d G:i', $myend);
@ -85,11 +84,11 @@ function blackout_redirect ($a, $b) {
} }
function blackout_addon_admin(&$a, &$o) { 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"; } 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"; } 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"; } if (! is_string($myurl)) { $myurl = "https://www.example.com"; }
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/blackout/" ); $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/blackout/" );
@ -115,7 +114,7 @@ function blackout_addon_admin_post (&$a) {
$begindate = trim($_POST['startdate']); $begindate = trim($_POST['startdate']);
$enddate = trim($_POST['enddate']); $enddate = trim($_POST['enddate']);
$url = trim($_POST['rurl']); $url = trim($_POST['rurl']);
Config::set('blackout','begindate',$begindate); DI::config()->set('blackout','begindate',$begindate);
Config::set('blackout','enddate',$enddate); DI::config()->set('blackout','enddate',$enddate);
Config::set('blackout','url',$url); DI::config()->set('blackout','url',$url);
} }

View File

@ -9,7 +9,6 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
@ -33,16 +32,16 @@ function blockbot_addon_admin(&$a, &$o) {
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'), '$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."], '$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'), 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.'], '$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'), 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."], '$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."],
]); ]);
} }
function blockbot_addon_admin_post(&$a) { function blockbot_addon_admin_post(&$a) {
Config::set('blockbot', 'good_crawlers', $_POST['good_crawlers'] ?? false); DI::config()->set('blockbot', 'good_crawlers', $_POST['good_crawlers'] ?? false);
Config::set('blockbot', 'block_gab', $_POST['block_gab'] ?? false); DI::config()->set('blockbot', 'block_gab', $_POST['block_gab'] ?? false);
Config::set('blockbot', 'training', $_POST['training'] ?? false); DI::config()->set('blockbot', 'training', $_POST['training'] ?? false);
info(DI::l10n()->t('Settings updated.'). EOL); info(DI::l10n()->t('Settings updated.'). EOL);
} }
@ -77,7 +76,7 @@ function blockbot_init_1(App $a) {
'7Siters/', 'KOCMOHABT', 'Google-SearchByImage', 'FemtosearchBot/', '7Siters/', 'KOCMOHABT', 'Google-SearchByImage', 'FemtosearchBot/',
'HubSpot Crawler', 'DomainStatsBot/', 'Re-re Studio']; '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); $agents = array_merge($agents, $good_agents);
} else { } else {
foreach ($good_agents as $good_agent) { foreach ($good_agents as $good_agent) {
@ -87,7 +86,7 @@ function blockbot_init_1(App $a) {
} }
} }
if (Config::get('blockbot', 'block_gab')) { if (DI::config()->get('blockbot', 'block_gab')) {
$agents[] = 'GabSocial/'; $agents[] = 'GabSocial/';
} }
@ -98,7 +97,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. // 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; return;
} }
@ -117,7 +116,7 @@ function blockbot_init_1(App $a) {
'Dispatch/', 'Ruby', 'Java/', 'libwww-perl/', 'Mastodon/', 'Dispatch/', 'Ruby', 'Java/', 'libwww-perl/', 'Mastodon/',
'lua-resty-http/']; 'lua-resty-http/'];
if (Config::get('blockbot', 'good_crawlers')) { if (DI::config()->get('blockbot', 'good_crawlers')) {
$agents = array_merge($agents, $good_agents); $agents = array_merge($agents, $good_agents);
} }

View File

@ -9,7 +9,6 @@
require 'addon/buffer/bufferapp.php'; require 'addon/buffer/bufferapp.php';
use Friendica\App; use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
@ -78,8 +77,8 @@ function buffer_addon_admin(App $a, &$o)
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'), '$submit' => DI::l10n()->t('Save Settings'),
// name, label, value, help, [extra values] // name, label, value, help, [extra values]
'$client_id' => ['client_id', DI::l10n()->t('Client ID'), Config::get('buffer', 'client_id'), ''], '$client_id' => ['client_id', DI::l10n()->t('Client ID'), DI::config()->get('buffer', 'client_id'), ''],
'$client_secret' => ['client_secret', DI::l10n()->t('Client Secret'), Config::get('buffer', 'client_secret'), ''], '$client_secret' => ['client_secret', DI::l10n()->t('Client Secret'), DI::config()->get('buffer', 'client_secret'), ''],
]); ]);
} }
@ -88,8 +87,8 @@ function buffer_addon_admin_post(App $a)
$client_id = (!empty($_POST['client_id']) ? Strings::escapeTags(trim($_POST['client_id'])) : ''); $client_id = (!empty($_POST['client_id']) ? Strings::escapeTags(trim($_POST['client_id'])) : '');
$client_secret = (!empty($_POST['client_secret']) ? Strings::escapeTags(trim($_POST['client_secret'])) : ''); $client_secret = (!empty($_POST['client_secret']) ? Strings::escapeTags(trim($_POST['client_secret'])) : '');
Config::set('buffer', 'client_id' , $client_id); DI::config()->set('buffer', 'client_id' , $client_id);
Config::set('buffer', 'client_secret', $client_secret); DI::config()->set('buffer', 'client_secret', $client_secret);
info(DI::l10n()->t('Settings updated.'). EOL); info(DI::l10n()->t('Settings updated.'). EOL);
} }
@ -105,8 +104,8 @@ function buffer_connect(App $a)
session_start(); session_start();
// Define the needed keys // Define the needed keys
$client_id = Config::get('buffer','client_id'); $client_id = DI::config()->get('buffer','client_id');
$client_secret = Config::get('buffer','client_secret'); $client_secret = DI::config()->get('buffer','client_secret');
// The callback URL is the script that gets called after the user authenticates with buffer // The callback URL is the script that gets called after the user authenticates with buffer
$callback_url = DI::baseUrl()->get()."/buffer/connect"; $callback_url = DI::baseUrl()->get()."/buffer/connect";
@ -172,8 +171,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 .= '<img class="connector'.$css.'" src="images/buffer.png" /><h3 class="connector">'. DI::l10n()->t('Buffer Export').'</h3>';
$s .= '</span>'; $s .= '</span>';
$client_id = Config::get("buffer", "client_id"); $client_id = DI::config()->get("buffer", "client_id");
$client_secret = Config::get("buffer", "client_secret"); $client_secret = DI::config()->get("buffer", "client_secret");
$access_token = DI::pConfig()->get(local_user(), "buffer", "access_token"); $access_token = DI::pConfig()->get(local_user(), "buffer", "access_token");
$s .= '<div id="buffer-password-wrapper">'; $s .= '<div id="buffer-password-wrapper">';
@ -309,8 +308,8 @@ function buffer_send(App $a, array &$b)
//if($b['app'] == "Buffer") //if($b['app'] == "Buffer")
// return; // return;
$client_id = Config::get("buffer", "client_id"); $client_id = DI::config()->get("buffer", "client_id");
$client_secret = Config::get("buffer", "client_secret"); $client_secret = DI::config()->get("buffer", "client_secret");
$access_token = DI::pConfig()->get($b['uid'], "buffer","access_token"); $access_token = DI::pConfig()->get($b['uid'], "buffer","access_token");
$callback_url = ""; $callback_url = "";

View File

@ -7,7 +7,6 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -111,7 +110,7 @@ function catavatar_addon_settings_post(App $a, &$s)
// Update global directory in background // Update global directory in background
$url = DI::baseUrl()->get() . '/profile/' . $a->user['nickname']; $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); Worker::add(PRIORITY_LOW, 'Directory', $url);
} }

View File

@ -8,7 +8,6 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
@ -40,8 +39,8 @@ function cookienotice_addon_admin(App $a, &$s)
return; 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.')); $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 = Config::get('cookienotice', 'oktext', DI::l10n()->t('OK')); $oktext = DI::config()->get('cookienotice', 'oktext', DI::l10n()->t('OK'));
$t = Renderer::getMarkupTemplate('admin.tpl', __DIR__); $t = Renderer::getMarkupTemplate('admin.tpl', __DIR__);
$s .= Renderer::replaceMacros($t, [ $s .= Renderer::replaceMacros($t, [
@ -69,8 +68,8 @@ function cookienotice_addon_admin_post(App $a)
} }
if ($_POST['cookienotice-submit']) { if ($_POST['cookienotice-submit']) {
Config::set('cookienotice', 'text', trim(strip_tags($_POST['cookienotice-text']))); DI::config()->set('cookienotice', 'text', trim(strip_tags($_POST['cookienotice-text'])));
Config::set('cookienotice', 'oktext', trim(strip_tags($_POST['cookienotice-oktext']))); DI::config()->set('cookienotice', 'oktext', trim(strip_tags($_POST['cookienotice-oktext'])));
info(DI::l10n()->t('cookienotice Settings saved.')); info(DI::l10n()->t('cookienotice Settings saved.'));
} }
} }
@ -106,8 +105,8 @@ function cookienotice_page_content_top(App $a, &$b)
*/ */
function cookienotice_page_end(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.')); $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)Config::get('cookienotice', 'oktext', DI::l10n()->t('OK')); $oktext = (string)DI::config()->get('cookienotice', 'oktext', DI::l10n()->t('OK'));
$page_end_tpl = Renderer::getMarkupTemplate('cookienotice.tpl', __DIR__); $page_end_tpl = Renderer::getMarkupTemplate('cookienotice.tpl', __DIR__);

View File

@ -11,7 +11,6 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Cache\Duration; use Friendica\Core\Cache\Duration;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session; use Friendica\Core\Session;
@ -116,10 +115,10 @@ function curweather_network_mod_init(App $a, &$b)
$rpt = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc'); $rpt = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc');
// Set the language to the browsers language or default and use metric units // 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'); $units = DI::pConfig()->get( local_user(), 'curweather', 'curweather_units');
$appid = Config::get('curweather', 'appid'); $appid = DI::config()->get('curweather', 'appid');
$cachetime = intval(Config::get('curweather', 'cachetime')); $cachetime = intval(DI::config()->get('curweather', 'cachetime'));
if ($units === "") { if ($units === "") {
$units = 'metric'; $units = 'metric';
@ -184,7 +183,7 @@ function curweather_addon_settings(App $a, &$s)
/* Get the current state of our config variable */ /* Get the current state of our config variable */
$curweather_loc = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc'); $curweather_loc = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc');
$curweather_units = DI::pConfig()->get(local_user(), 'curweather', 'curweather_units'); $curweather_units = DI::pConfig()->get(local_user(), 'curweather', 'curweather_units');
$appid = Config::get('curweather', 'appid'); $appid = DI::config()->get('curweather', 'appid');
if ($appid == "") { if ($appid == "") {
$noappidtext = DI::l10n()->t('No APPID found, please contact your admin to obtain one.'); $noappidtext = DI::l10n()->t('No APPID found, please contact your admin to obtain one.');
@ -220,8 +219,8 @@ function curweather_addon_admin_post(App $a)
} }
if (!empty($_POST['curweather-submit'])) { if (!empty($_POST['curweather-submit'])) {
Config::set('curweather', 'appid', trim($_POST['appid'])); DI::config()->set('curweather', 'appid', trim($_POST['appid']));
Config::set('curweather', 'cachetime', trim($_POST['cachetime'])); DI::config()->set('curweather', 'cachetime', trim($_POST['cachetime']));
info(DI::l10n()->t('Curweather settings saved.' . PHP_EOL)); info(DI::l10n()->t('Curweather settings saved.' . PHP_EOL));
} }
@ -233,8 +232,8 @@ function curweather_addon_admin(App $a, &$o)
return; return;
} }
$appid = Config::get('curweather', 'appid'); $appid = DI::config()->get('curweather', 'appid');
$cachetime = Config::get('curweather', 'cachetime'); $cachetime = DI::config()->get('curweather', 'cachetime');
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/curweather/" ); $t = Renderer::getMarkupTemplate("admin.tpl", "addon/curweather/" );

View File

@ -10,7 +10,6 @@ use Friendica\App;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Content\Pager; use Friendica\Content\Pager;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
@ -54,7 +53,7 @@ function forumdirectory_post(App $a)
function forumdirectory_content(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); notice(DI::l10n()->t('Public access denied.') . EOL);
return; return;
} }
@ -71,7 +70,7 @@ function forumdirectory_content(App $a)
} }
$gdirpath = ''; $gdirpath = '';
$dirurl = Config::get('system', 'directory'); $dirurl = DI::config()->get('system', 'directory');
if (strlen($dirurl)) { if (strlen($dirurl)) {
$gdirpath = Profile::zrl($dirurl, true); $gdirpath = Profile::zrl($dirurl, true);
} }
@ -97,7 +96,7 @@ function forumdirectory_content(App $a)
(`profile`.`prv_keywords` LIKE '%$search%'))"; (`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; $total = 0;
$cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total` FROM `profile` $cnt = DBA::fetchFirst("SELECT COUNT(*) AS `total` FROM `profile`

View File

@ -5,8 +5,6 @@
* Version: 0.1 * Version: 0.1
* Author: Michael Vogel <https://pirati.ca/profile/heluecht> * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
*/ */
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -32,11 +30,11 @@ function geocoordinates_resolve_item(&$item)
if((!$item["coord"]) || ($item["location"])) if((!$item["coord"]) || ($item["location"]))
return; return;
$key = Config::get("geocoordinates", "api_key"); $key = DI::config()->get("geocoordinates", "api_key");
if ($key == "") if ($key == "")
return; return;
$language = Config::get("geocoordinates", "language"); $language = DI::config()->get("geocoordinates", "language");
if ($language == "") if ($language == "")
$language = "de"; $language = "de";
@ -93,17 +91,17 @@ function geocoordinates_addon_admin(&$a, &$o)
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'), '$submit' => DI::l10n()->t('Save Settings'),
'$api_key' => ['api_key', DI::l10n()->t('API Key'), Config::get('geocoordinates', 'api_key'), ''], '$api_key' => ['api_key', DI::l10n()->t('API Key'), DI::config()->get('geocoordinates', 'api_key'), ''],
'$language' => ['language', DI::l10n()->t('Language code (IETF format)'), Config::get('geocoordinates', 'language'), ''], '$language' => ['language', DI::l10n()->t('Language code (IETF format)'), DI::config()->get('geocoordinates', 'language'), ''],
]); ]);
} }
function geocoordinates_addon_admin_post(&$a) function geocoordinates_addon_admin_post(&$a)
{ {
$api_key = (!empty($_POST['api_key']) ? Strings::escapeTags(trim($_POST['api_key'])) : ''); $api_key = (!empty($_POST['api_key']) ? Strings::escapeTags(trim($_POST['api_key'])) : '');
Config::set('geocoordinates', 'api_key', $api_key); DI::config()->set('geocoordinates', 'api_key', $api_key);
$language = (!empty($_POST['language']) ? Strings::escapeTags(trim($_POST['language'])) : ''); $language = (!empty($_POST['language']) ? Strings::escapeTags(trim($_POST['language'])) : '');
Config::set('geocoordinates', 'language', $language); DI::config()->set('geocoordinates', 'language', $language);
info(DI::l10n()->t('Settings updated.') . EOL); info(DI::l10n()->t('Settings updated.') . EOL);
} }

View File

@ -7,7 +7,6 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -64,7 +63,7 @@ function geonames_post_hook(App $a, array &$item)
/* Retrieve our personal config setting */ /* 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'); $active = DI::pConfig()->get(local_user(), 'geonames', 'enable');
if (!$geo_account || !$active) { if (!$geo_account || !$active) {
@ -127,7 +126,7 @@ function geonames_addon_settings(App $a, &$s)
return; return;
} }
$geo_account = Config::get('geonames', 'username'); $geo_account = DI::config()->get('geonames', 'username');
if (!$geo_account) { if (!$geo_account) {
return; return;

View File

@ -8,7 +8,6 @@
use Friendica\App; use Friendica\App;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -49,8 +48,8 @@ function gravatar_load_config(App $a, ConfigFileLoader $loader)
* @param &$b array * @param &$b array
*/ */
function gravatar_lookup($a, &$b) { function gravatar_lookup($a, &$b) {
$default_avatar = Config::get('gravatar', 'default_avatar'); $default_avatar = DI::config()->get('gravatar', 'default_avatar');
$rating = Config::get('gravatar', 'rating'); $rating = DI::config()->get('gravatar', 'rating');
// setting default value if nothing configured // setting default value if nothing configured
if(! $default_avatar) if(! $default_avatar)
@ -75,8 +74,8 @@ function gravatar_lookup($a, &$b) {
function gravatar_addon_admin (&$a, &$o) { function gravatar_addon_admin (&$a, &$o) {
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/gravatar/" ); $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/gravatar/" );
$default_avatar = Config::get('gravatar', 'default_avatar'); $default_avatar = DI::config()->get('gravatar', 'default_avatar');
$rating = Config::get('gravatar', 'rating'); $rating = DI::config()->get('gravatar', 'rating');
// set default values for first configuration // set default values for first configuration
if(! $default_avatar) if(! $default_avatar)
@ -124,7 +123,7 @@ function gravatar_addon_admin_post (&$a) {
$default_avatar = (!empty($_POST['avatar']) ? Strings::escapeTags(trim($_POST['avatar'])) : 'identicon'); $default_avatar = (!empty($_POST['avatar']) ? Strings::escapeTags(trim($_POST['avatar'])) : 'identicon');
$rating = (!empty($_POST['rating']) ? Strings::escapeTags(trim($_POST['rating'])) : 'g'); $rating = (!empty($_POST['rating']) ? Strings::escapeTags(trim($_POST['rating'])) : 'g');
Config::set('gravatar', 'default_avatar', $default_avatar); DI::config()->set('gravatar', 'default_avatar', $default_avatar);
Config::set('gravatar', 'rating', $rating); DI::config()->set('gravatar', 'rating', $rating);
info(DI::l10n()->t('Gravatar settings updated.') .EOL); info(DI::l10n()->t('Gravatar settings updated.') .EOL);
} }

View File

@ -8,7 +8,6 @@
*/ */
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -43,7 +42,7 @@ function obfuscate_email ($s) {
return $s; return $s;
} }
function impressum_footer($a, &$b) { 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 == '') { if (! $text == '') {
DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.DI::baseUrl()->get().'/addon/impressum/impressum.css" media="all" />'; DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.DI::baseUrl()->get().'/addon/impressum/impressum.css" media="all" />';
@ -59,11 +58,11 @@ function impressum_load_config(\Friendica\App $a, ConfigFileLoader $loader)
function impressum_show($a,&$b) { function impressum_show($a,&$b) {
$b .= '<h3>'.DI::l10n()->t('Impressum').'</h3>'; $b .= '<h3>'.DI::l10n()->t('Impressum').'</h3>';
$owner = Config::get('impressum', 'owner'); $owner = DI::config()->get('impressum', 'owner');
$owner_profile = Config::get('impressum','ownerprofile'); $owner_profile = DI::config()->get('impressum','ownerprofile');
$postal = ProxyUtils::proxifyHtml(BBCode::convert(Config::get('impressum', 'postal'))); $postal = ProxyUtils::proxifyHtml(BBCode::convert(DI::config()->get('impressum', 'postal')));
$notes = ProxyUtils::proxifyHtml(BBCode::convert(Config::get('impressum', 'notes'))); $notes = ProxyUtils::proxifyHtml(BBCode::convert(DI::config()->get('impressum', 'notes')));
$email = obfuscate_email( Config::get('impressum','email') ); $email = obfuscate_email( DI::config()->get('impressum','email') );
if (strlen($owner)) { if (strlen($owner)) {
if (strlen($owner_profile)) { if (strlen($owner_profile)) {
$tmp = '<a href="'.$owner_profile.'">'.$owner.'</a>'; $tmp = '<a href="'.$owner_profile.'">'.$owner.'</a>';
@ -93,23 +92,23 @@ function impressum_addon_admin_post (&$a) {
$notes = (!empty($_POST['notes']) ? (trim($_POST['notes'])) : ''); $notes = (!empty($_POST['notes']) ? (trim($_POST['notes'])) : '');
$email = (!empty($_POST['email']) ? Strings::escapeTags(trim($_POST['email'])) : ''); $email = (!empty($_POST['email']) ? Strings::escapeTags(trim($_POST['email'])) : '');
$footer_text = (!empty($_POST['footer_text']) ? (trim($_POST['footer_text'])) : ''); $footer_text = (!empty($_POST['footer_text']) ? (trim($_POST['footer_text'])) : '');
Config::set('impressum','owner',strip_tags($owner)); DI::config()->set('impressum','owner',strip_tags($owner));
Config::set('impressum','ownerprofile',strip_tags($ownerprofile)); DI::config()->set('impressum','ownerprofile',strip_tags($ownerprofile));
Config::set('impressum','postal',strip_tags($postal)); DI::config()->set('impressum','postal',strip_tags($postal));
Config::set('impressum','email',strip_tags($email)); DI::config()->set('impressum','email',strip_tags($email));
Config::set('impressum','notes',strip_tags($notes)); DI::config()->set('impressum','notes',strip_tags($notes));
Config::set('impressum','footer_text',strip_tags($footer_text)); DI::config()->set('impressum','footer_text',strip_tags($footer_text));
info(DI::l10n()->t('Settings updated.'). EOL ); info(DI::l10n()->t('Settings updated.'). EOL );
} }
function impressum_addon_admin (&$a, &$o) { function impressum_addon_admin (&$a, &$o) {
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/impressum/" ); $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/impressum/" );
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'), '$submit' => DI::l10n()->t('Save Settings'),
'$owner' => ['owner', DI::l10n()->t('Site Owner'), Config::get('impressum','owner'), DI::l10n()->t('The page operators name.')], '$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'), Config::get('impressum','ownerprofile'), DI::l10n()->t('Profile address of the operator.')], '$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'), Config::get('impressum','postal'), DI::l10n()->t('How to contact the operator via snail mail. You can use BBCode here.')], '$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'), Config::get('impressum','notes'), DI::l10n()->t('Additional notes that are displayed beneath the contact information. 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'), Config::get('impressum','email'), DI::l10n()->t('How to contact the operator via email. (will be displayed obfuscated)')], '$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'), Config::get('impressum','footer_text'), DI::l10n()->t('Text for the footer. You can use BBCode here.')], '$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.')],
]); ]);
} }

View File

@ -7,7 +7,6 @@
* Author: Tobias Diekershoff <https://f.diekershoff.de/u/tobias> * Author: Tobias Diekershoff <https://f.diekershoff.de/u/tobias>
*/ */
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
@ -86,9 +85,9 @@ function irc_content(&$a) {
if (local_user()) { if (local_user()) {
$sitechats = DI::pConfig()->get( local_user(), 'irc', 'sitechats'); $sitechats = DI::pConfig()->get( local_user(), 'irc', 'sitechats');
if (!$sitechats) if (!$sitechats)
$sitechats = Config::get('irc', 'sitechats'); $sitechats = DI::config()->get('irc', 'sitechats');
} else { } else {
$sitechats = Config::get('irc','sitechats'); $sitechats = DI::config()->get('irc','sitechats');
} }
if($sitechats) if($sitechats)
$chats = explode(',',$sitechats); $chats = explode(',',$sitechats);
@ -106,9 +105,9 @@ function irc_content(&$a) {
if (local_user()) { if (local_user()) {
$autochans = DI::pConfig()->get(local_user(), 'irc', 'autochans'); $autochans = DI::pConfig()->get(local_user(), 'irc', 'autochans');
if (!$autochans) if (!$autochans)
$autochans = Config::get('irc','autochans'); $autochans = DI::config()->get('irc','autochans');
} else { } else {
$autochans = Config::get('irc','autochans'); $autochans = DI::config()->get('irc','autochans');
} }
if($autochans) if($autochans)
$channels = $autochans; $channels = $autochans;
@ -131,15 +130,15 @@ function irc_addon_admin_post (&$a) {
return; return;
if($_POST['irc-submit']) { if($_POST['irc-submit']) {
Config::set('irc','autochans',trim($_POST['autochans'])); DI::config()->set('irc','autochans',trim($_POST['autochans']));
Config::set('irc','sitechats',trim($_POST['sitechats'])); DI::config()->set('irc','sitechats',trim($_POST['sitechats']));
/* stupid pop-up thing */ /* stupid pop-up thing */
info(DI::l10n()->t('IRC settings saved.') . EOL); info(DI::l10n()->t('IRC settings saved.') . EOL);
} }
} }
function irc_addon_admin (&$a, &$o) { function irc_addon_admin (&$a, &$o) {
$sitechats = Config::get('irc','sitechats'); /* popular channels */ $sitechats = DI::config()->get('irc','sitechats'); /* popular channels */
$autochans = 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/" );
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'), '$submit' => DI::l10n()->t('Save Settings'),

View File

@ -63,7 +63,6 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
@ -86,23 +85,23 @@ function jappixmini_install()
Hook::register('about_hook', 'addon/jappixmini/jappixmini.php', 'jappixmini_download_source'); Hook::register('about_hook', 'addon/jappixmini/jappixmini.php', 'jappixmini_download_source');
// set standard configuration // set standard configuration
$info_text = Config::get("jappixmini", "infotext"); $info_text = DI::config()->get("jappixmini", "infotext");
if (!$info_text) 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. " . DI::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 " . "An example of a BOSH server that works for all accounts is https://bind.jappix.com/, but keep " .
"in mind that the BOSH server can read along all chat messages. If you know that your Jabber " . "in mind that the BOSH server can read along all chat messages. If you know that your Jabber " .
"server also provides an own BOSH server, it is much better to use this one!" "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 === "") { if ($bosh_proxy === "") {
Config::set("jappixmini", "bosh_proxy", "1"); DI::config()->set("jappixmini", "bosh_proxy", "1");
} }
// set addon version so that safe updates are possible later // 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 === "") { if ($addon_version === "") {
Config::set("jappixmini", "version", "1"); DI::config()->set("jappixmini", "version", "1");
} }
} }
@ -127,35 +126,35 @@ function jappixmini_addon_admin(App $a, &$o)
} }
// warn if cron job has not yet been executed // 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) { 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>"; $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
$bosh_proxy = intval(Config::get("jappixmini", "bosh_proxy")); $bosh_proxy = intval(DI::config()->get("jappixmini", "bosh_proxy"));
$bosh_proxy = intval($bosh_proxy) ? ' checked="checked"' : ''; $bosh_proxy = intval($bosh_proxy) ? ' checked="checked"' : '';
$o .= '<label for="jappixmini-proxy">Activate BOSH proxy</label>'; $o .= '<label for="jappixmini-proxy">Activate BOSH proxy</label>';
$o .= ' <input id="jappixmini-proxy" type="checkbox" name="jappixmini-proxy" value="1"' . $bosh_proxy . ' /><br />'; $o .= ' <input id="jappixmini-proxy" type="checkbox" name="jappixmini-proxy" value="1"' . $bosh_proxy . ' /><br />';
// bosh address // 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 .= '<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>'; $o .= '<input id="jappixmini-address" type="text" name="jappixmini-address" value="' . $bosh_address . '" /></p>';
// default server address // 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 .= '<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>'; $o .= '<input id="jappixmini-server" type="text" name="jappixmini-server" value="' . $default_server . '" /></p>';
// default user name to friendica nickname // 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"' : ''; $default_user = intval($default_user) ? ' checked="checked"' : '';
$o .= '<label for="jappixmini-user">Set the default username to the nickname:</label>'; $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 />'; $o .= ' <input id="jappixmini-user" type="checkbox" name="jappixmini-defaultuser" value="1"' . $default_user . ' /><br />';
// info text field // 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 .= '<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>'; $o .= '<textarea id="jappixmini-infotext" name="jappixmini-infotext" rows="5" cols="50">' . htmlentities($info_text) . '</textarea></p>';
@ -173,11 +172,11 @@ function jappixmini_addon_admin_post(App $a)
$default_user = intval($_REQUEST['jappixmini-defaultuser']); $default_user = intval($_REQUEST['jappixmini-defaultuser']);
$bosh_address = $_REQUEST['jappixmini-address']; $bosh_address = $_REQUEST['jappixmini-address'];
$default_server = $_REQUEST['jappixmini-server']; $default_server = $_REQUEST['jappixmini-server'];
Config::set("jappixmini", "infotext", $info_text); DI::config()->set("jappixmini", "infotext", $info_text);
Config::set("jappixmini", "bosh_proxy", $bosh_proxy); DI::config()->set("jappixmini", "bosh_proxy", $bosh_proxy);
Config::set("jappixmini", "bosh_address", $bosh_address); DI::config()->set("jappixmini", "bosh_address", $bosh_address);
Config::set("jappixmini", "default_server", $default_server); DI::config()->set("jappixmini", "default_server", $default_server);
Config::set("jappixmini", "default_user", $default_user); DI::config()->set("jappixmini", "default_user", $default_user);
} }
} }
@ -272,7 +271,7 @@ function jappixmini_settings(App $a, &$s)
$dontinsertchat = DI::pConfig()->get(local_user(), 'jappixmini', 'dontinsertchat'); $dontinsertchat = DI::pConfig()->get(local_user(), 'jappixmini', 'dontinsertchat');
$insertchat = !(intval($dontinsertchat) ? ' checked="checked"' : ''); $insertchat = !(intval($dontinsertchat) ? ' checked="checked"' : '');
$defaultbosh = Config::get("jappixmini", "bosh_address"); $defaultbosh = DI::config()->get("jappixmini", "bosh_address");
if ($defaultbosh != "") { if ($defaultbosh != "") {
DI::pConfig()->set(local_user(), 'jappixmini', 'bosh', $defaultbosh); DI::pConfig()->set(local_user(), 'jappixmini', 'bosh', $defaultbosh);
@ -294,14 +293,14 @@ function jappixmini_settings(App $a, &$s)
$encrypt_disabled = $encrypt ? '' : ' disabled="disabled"'; $encrypt_disabled = $encrypt ? '' : ' disabled="disabled"';
if ($server == "") { 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"]; $username = $a->user["nickname"];
} }
$info_text = Config::get("jappixmini", "infotext"); $info_text = DI::config()->get("jappixmini", "infotext");
$info_text = htmlentities($info_text); $info_text = htmlentities($info_text);
$info_text = str_replace("\n", "<br />", $info_text); $info_text = str_replace("\n", "<br />", $info_text);
@ -511,7 +510,7 @@ function jappixmini_script(App $a)
$autosubscribe = intval($autosubscribe); $autosubscribe = intval($autosubscribe);
// set proxy if necessary // set proxy if necessary
$use_proxy = Config::get('jappixmini', 'bosh_proxy'); $use_proxy = DI::config()->get('jappixmini', 'bosh_proxy');
if ($use_proxy) { if ($use_proxy) {
$proxy = DI::baseUrl()->get() . '/addon/jappixmini/proxy.php'; $proxy = DI::baseUrl()->get() . '/addon/jappixmini/proxy.php';
} else { } else {
@ -548,7 +547,7 @@ function jappixmini_script(App $a)
// get nickname // get nickname
$r = q("SELECT `username` FROM `user` WHERE `uid`=$uid"); $r = q("SELECT `username` FROM `user` WHERE `uid`=$uid");
$nickname = json_encode($r[0]["username"]); $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 $groupchats has no value jappix_addon_start will produce a syntax error
if (empty($groupchats)) { if (empty($groupchats)) {
$groupchats = "{}"; $groupchats = "{}";
@ -580,7 +579,7 @@ function jappixmini_login(App $a, &$o)
function jappixmini_cron(App $a, $d) function jappixmini_cron(App $a, $d)
{ {
// For autosubscribe/autoapprove, we need to maintain a list of jabber addresses of our contacts. // For autosubscribe/autoapprove, we need to maintain a list of jabber addresses of our contacts.
Config::set("jappixmini", "last_cron_execution", $d); DI::config()->set("jappixmini", "last_cron_execution", $d);
// go through list of users with jabber enabled // go through list of users with jabber enabled
$users = q("SELECT `uid` FROM `pconfig` WHERE `cat`='jappixmini' AND (`k`='autosubscribe' OR `k`='autoapprove') AND `v`='1'"); $users = q("SELECT `uid` FROM `pconfig` WHERE `cat`='jappixmini' AND (`k`='autosubscribe' OR `k`='autoapprove') AND `v`='1'");

View File

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

View File

@ -54,9 +54,9 @@
* ...etc. * ...etc.
*/ */
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\DI;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Util\ConfigFileLoader; use Friendica\Util\ConfigFileLoader;
@ -91,15 +91,15 @@ function ldapauth_hook_authenticate($a, &$b)
function ldapauth_authenticate($username, $password) function ldapauth_authenticate($username, $password)
{ {
$ldap_server = Config::get('ldapauth', 'ldap_server'); $ldap_server = DI::config()->get('ldapauth', 'ldap_server');
$ldap_binddn = Config::get('ldapauth', 'ldap_binddn'); $ldap_binddn = DI::config()->get('ldapauth', 'ldap_binddn');
$ldap_bindpw = Config::get('ldapauth', 'ldap_bindpw'); $ldap_bindpw = DI::config()->get('ldapauth', 'ldap_bindpw');
$ldap_searchdn = Config::get('ldapauth', 'ldap_searchdn'); $ldap_searchdn = DI::config()->get('ldapauth', 'ldap_searchdn');
$ldap_userattr = Config::get('ldapauth', 'ldap_userattr'); $ldap_userattr = DI::config()->get('ldapauth', 'ldap_userattr');
$ldap_group = Config::get('ldapauth', 'ldap_group'); $ldap_group = DI::config()->get('ldapauth', 'ldap_group');
$ldap_autocreateaccount = Config::get('ldapauth', 'ldap_autocreateaccount'); $ldap_autocreateaccount = DI::config()->get('ldapauth', 'ldap_autocreateaccount');
$ldap_autocreateaccount_emailattribute = Config::get('ldapauth', 'ldap_autocreateaccount_emailattribute'); $ldap_autocreateaccount_emailattribute = DI::config()->get('ldapauth', 'ldap_autocreateaccount_emailattribute');
$ldap_autocreateaccount_nameattribute = Config::get('ldapauth', 'ldap_autocreateaccount_nameattribute'); $ldap_autocreateaccount_nameattribute = DI::config()->get('ldapauth', 'ldap_autocreateaccount_nameattribute');
if (!(strlen($password) && function_exists('ldap_connect') && strlen($ldap_server))) { if (!(strlen($password) && function_exists('ldap_connect') && strlen($ldap_server))) {
Logger::log("ldapauth: not configured or missing php-ldap module"); Logger::log("ldapauth: not configured or missing php-ldap module");

View File

@ -5,9 +5,9 @@
* Version: 0.1 * Version: 0.1
* Author: Michael Vogel <https://pirati.ca/profile/heluecht> * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
*/ */
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\DI;
use Friendica\Util\Network; use Friendica\Util\Network;
function leistungsschutzrecht_install() { function leistungsschutzrecht_install() {
@ -29,7 +29,7 @@ function leistungsschutzrecht_getsiteinfo($a, &$siteinfo) {
} }
// Avoid any third party pictures, to avoid copyright issues // 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["image"]);
unset($siteinfo["images"]); unset($siteinfo["images"]);
} }
@ -126,12 +126,12 @@ function leistungsschutzrecht_fetchsites()
*/ */
if (sizeof($sites)) { if (sizeof($sites)) {
Config::set('leistungsschutzrecht','sites',$sites); DI::config()->set('leistungsschutzrecht','sites',$sites);
} }
} }
function leistungsschutzrecht_is_member_site($url) { function leistungsschutzrecht_is_member_site($url) {
$sites = Config::get('leistungsschutzrecht','sites'); $sites = DI::config()->get('leistungsschutzrecht','sites');
if ($sites == "") if ($sites == "")
return(false); return(false);
@ -161,7 +161,7 @@ function leistungsschutzrecht_is_member_site($url) {
} }
function leistungsschutzrecht_cron($a,$b) { function leistungsschutzrecht_cron($a,$b) {
$last = Config::get('leistungsschutzrecht','last_poll'); $last = DI::config()->get('leistungsschutzrecht','last_poll');
if($last) { if($last) {
$next = $last + 86400; $next = $last + 86400;
@ -171,6 +171,6 @@ function leistungsschutzrecht_cron($a,$b) {
} }
} }
leistungsschutzrecht_fetchsites(); leistungsschutzrecht_fetchsites();
Config::set('leistungsschutzrecht','last_poll', time()); DI::config()->set('leistungsschutzrecht','last_poll', time());
} }
?> ?>

View File

@ -8,7 +8,6 @@
use Friendica\App; use Friendica\App;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -50,11 +49,11 @@ function libravatar_load_config(App $a, ConfigFileLoader $loader)
*/ */
function libravatar_lookup($a, &$b) function libravatar_lookup($a, &$b)
{ {
$default_avatar = Config::get('libravatar', 'default_avatar'); $default_avatar = DI::config()->get('libravatar', 'default_avatar');
if (! $default_avatar) { if (! $default_avatar) {
// if not set, look up if there was one from the gravatar addon // 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 // setting default avatar if nothing configured
if (!$default_avatar) { if (!$default_avatar) {
$default_avatar = 'identicon'; // default image will be a random pattern $default_avatar = 'identicon'; // default image will be a random pattern
@ -78,7 +77,7 @@ function libravatar_addon_admin(&$a, &$o)
{ {
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/libravatar"); $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 // set default values for first configuration
if (!$default_avatar) { if (!$default_avatar) {
@ -126,6 +125,6 @@ function libravatar_addon_admin_post(&$a)
BaseModule::checkFormSecurityToken('libravatarrsave'); BaseModule::checkFormSecurityToken('libravatarrsave');
$default_avatar = (!empty($_POST['avatar']) ? Strings::escapeTags(trim($_POST['avatar'])) : 'identicon'); $default_avatar = (!empty($_POST['avatar']) ? Strings::escapeTags(trim($_POST['avatar'])) : 'identicon');
Config::set('libravatar', 'default_avatar', $default_avatar); DI::config()->set('libravatar', 'default_avatar', $default_avatar);
info(DI::l10n()->t('Libravatar settings updated.') .EOL); info(DI::l10n()->t('Libravatar settings updated.') .EOL);
} }

View File

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

View File

@ -12,7 +12,6 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Smilies; use Friendica\Content\Smilies;
use Friendica\Core\Cache\Duration; use Friendica\Core\Cache\Duration;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\DI; use Friendica\DI;
@ -76,7 +75,7 @@ function mastodoncustomemojis_get_custom_emojis_for_author($author_link)
$return = DI::cache()->get($cache_key); $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); $return = mastodoncustomemojis_fetch_custom_emojis_for_url($api_base_url);
DI::cache()->set($cache_key, $return, empty($return['texts']) ? Duration::QUARTER_HOUR : Duration::HOUR); DI::cache()->set($cache_key, $return, empty($return['texts']) ? Duration::QUARTER_HOUR : Duration::HOUR);

View File

@ -7,7 +7,6 @@
***/ ***/
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -35,15 +34,15 @@ function newmemberwidget_network_mod_init ($a, $b)
$t .= '<h3>'.DI::l10n()->t('New Member').'</h3>'.EOL; $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; $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; $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)) { if (DI::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; $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)) { if (!empty($ft)) {
$t .= '<p>'.BBCode::convert(trim($ft)).'</p>'; $t .= '<p>'.BBCode::convert(trim($ft)).'</p>';
} }
@ -58,10 +57,10 @@ function newmemberwidget_addon_admin_post(&$a)
$lsn = (!empty($_POST['localsupportname']) ? Strings::escapeTags(trim($_POST['localsupportname'])) : ""); $lsn = (!empty($_POST['localsupportname']) ? Strings::escapeTags(trim($_POST['localsupportname'])) : "");
$gs = intval($_POST['linkglobalsupport']); $gs = intval($_POST['linkglobalsupport']);
$ls = intval($_POST['linklocalsupport']); $ls = intval($_POST['linklocalsupport']);
Config::set('newmemberwidget', 'freetext', trim($ft)); DI::config()->set('newmemberwidget', 'freetext', trim($ft));
Config::set('newmemberwidget', 'linkglobalsupport', $gs); DI::config()->set('newmemberwidget', 'linkglobalsupport', $gs);
Config::set('newmemberwidget', 'linklocalsupport', $ls); DI::config()->set('newmemberwidget', 'linklocalsupport', $ls);
Config::set('newmemberwidget', 'localsupport', trim($lsn)); DI::config()->set('newmemberwidget', 'localsupport', trim($lsn));
} }
function newmemberwidget_addon_admin(&$a, &$o) function newmemberwidget_addon_admin(&$a, &$o)
@ -69,9 +68,9 @@ function newmemberwidget_addon_admin(&$a, &$o)
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/newmemberwidget'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/newmemberwidget');
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'), '$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.")], '$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'), 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>)"], '$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'), 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.')], '$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'), 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)')], '$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)')],
]); ]);
} }

View File

@ -10,7 +10,6 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
@ -46,18 +45,18 @@ function notifyall_post(App $a)
return; 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) . '"'; $sender_name = '"' . DI::l10n()->t('%s Administrator', $sitename) . '"';
} else { } 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(); $sender_email = 'noreply@' . DI::baseUrl()->getHostname();
} else { } else {
$sender_email = Config::get('config', 'sender_email'); $sender_email = DI::config()->get('config', 'sender_email');
} }
$subject = $_REQUEST['subject']; $subject = $_REQUEST['subject'];
@ -70,7 +69,7 @@ function notifyall_post(App $a)
// if this is a test, send it only to the admin(s) // 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 // admin_email might be a comma separated list, but we need "a@b','c@d','e@f
if (intval($_REQUEST['test'])) { if (intval($_REQUEST['test'])) {
$email = Config::get('config', 'admin_email'); $email = DI::config()->get('config', 'admin_email');
$email = "'" . str_replace([" ",","], ["","','"], $email) . "'"; $email = "'" . str_replace([" ",","], ["","','"], $email) . "'";
} }
$sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : ''); $sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : '');

View File

@ -11,7 +11,6 @@
use Friendica\DI; use Friendica\DI;
use Friendica\Core\Cache\Duration; use Friendica\Core\Cache\Duration;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -82,10 +81,10 @@ function openstreetmap_location($a, &$item)
* ?mlat=lat&mlon=lon for markers. * ?mlat=lat&mlon=lon for markers.
*/ */
$tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS); $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS);
$nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM); $nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM);
$zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM); $zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM);
$marker = Config::get('openstreetmap', 'marker', OSM_MARKER); $marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER);
// This is needed since we stored an empty string in the config in previous versions // This is needed since we stored an empty string in the config in previous versions
if (empty($nomserver)) { if (empty($nomserver)) {
@ -120,7 +119,7 @@ function openstreetmap_location($a, &$item)
function openstreetmap_get_coordinates($a, &$b) 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 // This is needed since we stored an empty string in the config in previous versions
if (empty($nomserver)) { if (empty($nomserver)) {
@ -157,14 +156,14 @@ function openstreetmap_generate_named_map(&$a, &$b)
function openstreetmap_generate_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) { if (strpos(DI::baseUrl()->get(true), 'https:') !== false) {
$tmsserver = str_replace('http:','https:',$tmsserver); $tmsserver = str_replace('http:','https:',$tmsserver);
} }
$zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM); $zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM);
$marker = Config::get('openstreetmap', 'marker', OSM_MARKER); $marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER);
$lat = $b['lat']; // round($b['lat'], 5); $lat = $b['lat']; // round($b['lat'], 5);
$lon = $b['lon']; // round($b['lon'], 5); $lon = $b['lon']; // round($b['lon'], 5);
@ -194,10 +193,10 @@ function openstreetmap_generate_map(&$a, &$b)
function openstreetmap_addon_admin(&$a, &$o) function openstreetmap_addon_admin(&$a, &$o)
{ {
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/openstreetmap/"); $t = Renderer::getMarkupTemplate("admin.tpl", "addon/openstreetmap/");
$tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS); $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS);
$nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM); $nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM);
$zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM); $zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM);
$marker = Config::get('openstreetmap', 'marker', OSM_MARKER); $marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER);
// This is needed since we stored an empty string in the config in previous versions // This is needed since we stored an empty string in the config in previous versions
if (empty($nomserver)) { if (empty($nomserver)) {
@ -220,10 +219,10 @@ function openstreetmap_addon_admin_post(&$a)
$zoom = ($_POST['zoom'] ?? '') ?: OSM_ZOOM; $zoom = ($_POST['zoom'] ?? '') ?: OSM_ZOOM;
$marker = ($_POST['marker'] ?? '') ?: OSM_MARKER; $marker = ($_POST['marker'] ?? '') ?: OSM_MARKER;
Config::set('openstreetmap', 'tmsserver', $urltms); DI::config()->set('openstreetmap', 'tmsserver', $urltms);
Config::set('openstreetmap', 'nomserver', $urlnom); DI::config()->set('openstreetmap', 'nomserver', $urlnom);
Config::set('openstreetmap', 'zoom', $zoom); DI::config()->set('openstreetmap', 'zoom', $zoom);
Config::set('openstreetmap', 'marker', $marker); DI::config()->set('openstreetmap', 'marker', $marker);
info(DI::l10n()->t('Settings updated.') . EOL); info(DI::l10n()->t('Settings updated.') . EOL);
} }

View File

@ -9,7 +9,6 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
@ -28,7 +27,7 @@ function pageheader_addon_admin(App &$a, &$s)
$stylesheetPath = __DIR__ . '/pageheader.css'; $stylesheetPath = __DIR__ . '/pageheader.css';
DI::page()->registerStylesheet($stylesheetPath); DI::page()->registerStylesheet($stylesheetPath);
$words = Config::get('pageheader','text'); $words = DI::config()->get('pageheader','text');
if(! $words) if(! $words)
$words = ''; $words = '';
@ -50,7 +49,7 @@ function pageheader_addon_admin_post(App $a)
if(!empty($_POST['pageheader-submit'])) { if(!empty($_POST['pageheader-submit'])) {
if (isset($_POST['pageheader-words'])) { if (isset($_POST['pageheader-words'])) {
Config::set('pageheader', 'text', trim(strip_tags($_POST['pageheader-words']))); DI::config()->set('pageheader', 'text', trim(strip_tags($_POST['pageheader-words'])));
} }
info(DI::l10n()->t('pageheader Settings saved.')); info(DI::l10n()->t('pageheader Settings saved.'));
} }
@ -61,7 +60,7 @@ function pageheader_fetch(App $a, &$b)
if(file_exists('pageheader.html')){ if(file_exists('pageheader.html')){
$s = file_get_contents('pageheader.html'); $s = file_get_contents('pageheader.html');
} else { } else {
$s = Config::get('pageheader', 'text'); $s = DI::config()->get('pageheader', 'text');
} }
$stylesheetPath = __DIR__ .'/pageheader.css'; $stylesheetPath = __DIR__ .'/pageheader.css';

View File

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

View File

@ -31,7 +31,6 @@
* setting. * setting.
*/ */
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -70,10 +69,10 @@ function piwik_analytics($a,&$b) {
/* /*
* Get the configuration variables from the config/addon.config.php file. * Get the configuration variables from the config/addon.config.php file.
*/ */
$baseurl = Config::get('piwik', 'baseurl'); $baseurl = DI::config()->get('piwik', 'baseurl');
$siteid = Config::get('piwik', 'siteid'); $siteid = DI::config()->get('piwik', 'siteid');
$optout = Config::get('piwik', 'optout'); $optout = DI::config()->get('piwik', 'optout');
$async = Config::get('piwik', 'async'); $async = DI::config()->get('piwik', 'async');
/* /*
* Add the Piwik tracking code for the site. * Add the Piwik tracking code for the site.
@ -103,10 +102,10 @@ function piwik_addon_admin (&$a, &$o) {
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/piwik/" ); $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/piwik/" );
$o = Renderer::replaceMacros( $t, [ $o = Renderer::replaceMacros( $t, [
'$submit' => DI::l10n()->t('Save Settings'), '$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)')], '$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'), Config::get('piwik','siteid' ), ''], '$siteid' => ['siteid', DI::l10n()->t('Site ID'), DI::config()->get('piwik','siteid' ), ''],
'$optout' => ['optout', DI::l10n()->t('Show opt-out cookie link?'), Config::get('piwik','optout' ), ''], '$optout' => ['optout', DI::l10n()->t('Show opt-out cookie link?'), DI::config()->get('piwik','optout' ), ''],
'$async' => ['async', DI::l10n()->t('Asynchronous tracking'), Config::get('piwik','async' ), ''], '$async' => ['async', DI::l10n()->t('Asynchronous tracking'), DI::config()->get('piwik','async' ), ''],
]); ]);
} }
function piwik_addon_admin_post (&$a) { function piwik_addon_admin_post (&$a) {
@ -114,9 +113,9 @@ function piwik_addon_admin_post (&$a) {
$id = (!empty($_POST['siteid']) ? trim($_POST['siteid']) : ''); $id = (!empty($_POST['siteid']) ? trim($_POST['siteid']) : '');
$optout = (!empty($_POST['optout']) ? trim($_POST['optout']) : ''); $optout = (!empty($_POST['optout']) ? trim($_POST['optout']) : '');
$async = (!empty($_POST['async']) ? trim($_POST['async']) : ''); $async = (!empty($_POST['async']) ? trim($_POST['async']) : '');
Config::set('piwik', 'baseurl', $url); DI::config()->set('piwik', 'baseurl', $url);
Config::set('piwik', 'siteid', $id); DI::config()->set('piwik', 'siteid', $id);
Config::set('piwik', 'optout', $optout); DI::config()->set('piwik', 'optout', $optout);
Config::set('piwik', 'async', $async); DI::config()->set('piwik', 'async', $async);
info(DI::l10n()->t('Settings updated.'). EOL); info(DI::l10n()->t('Settings updated.'). EOL);
} }

View File

@ -8,7 +8,6 @@
use Friendica\App; use Friendica\App;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -45,8 +44,8 @@ function public_server_register_account($a, $b)
{ {
$uid = $b; $uid = $b;
$days = Config::get('public_server', 'expiredays'); $days = DI::config()->get('public_server', 'expiredays');
$days_posts = Config::get('public_server', 'expireposts'); $days_posts = DI::config()->get('public_server', 'expireposts');
if (!$days) { if (!$days) {
return; return;
} }
@ -83,7 +82,7 @@ function public_server_cron($a, $b)
} }
} }
$nologin = Config::get('public_server', 'nologin', false); $nologin = DI::config()->get('public_server', 'nologin', false);
if ($nologin) { 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'", $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); DBA::NULL_DATETIME, intval($nologin), DBA::NULL_DATETIME);
@ -95,7 +94,7 @@ function public_server_cron($a, $b)
} }
} }
$flagusers = Config::get('public_server', 'flagusers', false); $flagusers = DI::config()->get('public_server', 'flagusers', false);
if ($flagusers) { 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", $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); intval($flagusers), DBA::NULL_DATETIME);
@ -107,8 +106,8 @@ function public_server_cron($a, $b)
} }
} }
$flagposts = Config::get('public_server', 'flagposts'); $flagposts = DI::config()->get('public_server', 'flagposts');
$flagpostsexpire = Config::get('public_server', 'flagpostsexpire'); $flagpostsexpire = DI::config()->get('public_server', 'flagpostsexpire');
if ($flagposts && $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", $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); intval($flagposts), DBA::NULL_DATETIME);
@ -127,15 +126,15 @@ function public_server_enotify(&$a, &$b)
if (!empty($b['params']) && $b['params']['type'] == NOTIFY_SYSTEM if (!empty($b['params']) && $b['params']['type'] == NOTIFY_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') {
$b['itemlink'] = DI::baseUrl()->get(); $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['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) function public_server_login($a, $b)
{ {
$days = Config::get('public_server', 'expiredays'); $days = DI::config()->get('public_server', 'expiredays');
if (!$days) { if (!$days) {
return; return;
} }
@ -154,12 +153,12 @@ function public_server_addon_admin_post(&$a)
$flagusers = (!empty($_POST['flagusers']) ? Strings::escapeTags(trim($_POST['flagusers'])) : ''); $flagusers = (!empty($_POST['flagusers']) ? Strings::escapeTags(trim($_POST['flagusers'])) : '');
$flagposts = (!empty($_POST['flagposts']) ? Strings::escapeTags(trim($_POST['flagposts'])) : ''); $flagposts = (!empty($_POST['flagposts']) ? Strings::escapeTags(trim($_POST['flagposts'])) : '');
$flagpostsexpire = (!empty($_POST['flagpostsexpire']) ? Strings::escapeTags(trim($_POST['flagpostsexpire'])) : ''); $flagpostsexpire = (!empty($_POST['flagpostsexpire']) ? Strings::escapeTags(trim($_POST['flagpostsexpire'])) : '');
Config::set('public_server', 'expiredays', $expiredays); DI::config()->set('public_server', 'expiredays', $expiredays);
Config::set('public_server', 'expireposts', $expireposts); DI::config()->set('public_server', 'expireposts', $expireposts);
Config::set('public_server', 'nologin', $nologin); DI::config()->set('public_server', 'nologin', $nologin);
Config::set('public_server', 'flagusers', $flagusers); DI::config()->set('public_server', 'flagusers', $flagusers);
Config::set('public_server', 'flagposts', $flagposts); DI::config()->set('public_server', 'flagposts', $flagposts);
Config::set('public_server', 'flagpostsexpire', $flagpostsexpire); DI::config()->set('public_server', 'flagpostsexpire', $flagpostsexpire);
info(DI::l10n()->t('Settings saved').EOL); info(DI::l10n()->t('Settings saved').EOL);
} }
@ -171,11 +170,11 @@ function public_server_addon_admin(&$a, &$o)
'$submit' => DI::l10n()->t('Save Settings'), '$submit' => DI::l10n()->t('Save Settings'),
'$form_security_token' => $token, '$form_security_token' => $token,
'$infotext' => DI::l10n()->t('Set any of these options to 0 to deactivate it.'), '$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 "], '$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(Config::get('public_server', 'expireposts')), "Set the default days for posts to expire here"], '$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(Config::get('public_server', 'nologin')), "Remove users who have never logged in after nologin days "], '$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(Config::get('public_server', 'flagusers')), "Remove users who last logged in over flagusers days ago"], '$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(Config::get('public_server', 'flagposts')), "For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire "], '$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(Config::get('public_server', 'flagpostsexpire'))], '$flagpostsexpire' => ["flagpostsexpire", "Flag posts expire", intval(DI::config()->get('public_server', 'flagpostsexpire'))],
]); ]);
} }

View File

@ -9,7 +9,6 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML; use Friendica\Content\Text\HTML;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
@ -101,13 +100,13 @@ function pumpio_registerclient(App $a, $host)
$params = []; $params = [];
$application_name = Config::get('pumpio', 'application_name'); $application_name = DI::config()->get('pumpio', 'application_name');
if ($application_name == "") { if ($application_name == "") {
$application_name = DI::baseUrl()->getHostname(); $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["type"] = "client_associate";
$params["contacts"] = $adminlist[0]; $params["contacts"] = $adminlist[0];
@ -686,9 +685,9 @@ function pumpio_sync(App $a)
return; 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) { if ($last) {
$next = $last + ($poll_interval * 60); $next = $last + ($poll_interval * 60);
@ -707,7 +706,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) { if ($abandon_days < 1) {
$abandon_days = 0; $abandon_days = 0;
} }
@ -745,7 +744,7 @@ function pumpio_sync(App $a)
Logger::log('pumpio: cron_end'); Logger::log('pumpio: cron_end');
Config::set('pumpio', 'last_poll', time()); DI::config()->set('pumpio', 'last_poll', time());
} }
function pumpio_cron(App $a, $b) function pumpio_cron(App $a, $b)
@ -768,7 +767,7 @@ function pumpio_fetchtimeline(App $a, $uid)
// hostname of the node if neither one is set. // hostname of the node if neither one is set.
$application_name = DI::pConfig()->get($uid, 'pumpio', 'application_name'); $application_name = DI::pConfig()->get($uid, 'pumpio', 'application_name');
if ($application_name == "") { if ($application_name == "") {
$application_name = Config::get('pumpio', 'application_name'); $application_name = DI::config()->get('pumpio', 'application_name');
} }
if ($application_name == "") { if ($application_name == "") {
$application_name = DI::baseUrl()->getHostname(); $application_name = DI::baseUrl()->getHostname();

View File

@ -1,6 +1,6 @@
<?php <?php
use Friendica\Core\Config;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\DI;
function pumpio_sync_run(&$argv, &$argc) { function pumpio_sync_run(&$argv, &$argc) {
$a = Friendica\DI::app(); $a = Friendica\DI::app();
@ -9,7 +9,7 @@ function pumpio_sync_run(&$argv, &$argc) {
if (function_exists('sys_getloadavg')) { if (function_exists('sys_getloadavg')) {
$load = 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.'); Logger::log('system: load ' . $load[0] . ' too high. Pumpio sync deferred to next scheduled run.');
return; return;
} }

View File

@ -7,7 +7,6 @@
* Status: Unsupported * Status: Unsupported
*/ */
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
@ -31,7 +30,7 @@ function remote_permissions_settings(&$a,&$o) {
if(! local_user()) if(! local_user())
return; return;
$global = Config::get("remote_perms", "global"); $global = DI::config()->get("remote_perms", "global");
if($global == 1) if($global == 1)
return; return;
@ -69,7 +68,7 @@ function remote_permissions_content($a, $item_copy) {
if($item_copy['uid'] != local_user()) if($item_copy['uid'] != local_user())
return; 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 // Admin has set Individual choice. We need to find
// the original poster. First, get the contact's info // the original poster. First, get the contact's info
$r = q("SELECT nick, url FROM contact WHERE id = %d LIMIT 1", $r = q("SELECT nick, url FROM contact WHERE id = %d LIMIT 1",
@ -202,13 +201,13 @@ function remote_permissions_addon_admin(&$a, &$o){
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/remote_permissions/" ); $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/remote_permissions/" );
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'), '$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], '$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'), Config::get('remote_perms', 'global') == 0] '$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]
]); ]);
} }
function remote_permissions_addon_admin_post(&$a){ function remote_permissions_addon_admin_post(&$a){
$choice = (!empty($_POST['remotepermschoice']) ? Strings::escapeTags(trim($_POST['remotepermschoice'])) : ''); $choice = (!empty($_POST['remotepermschoice']) ? Strings::escapeTags(trim($_POST['remotepermschoice'])) : '');
Config::set('remote_perms','global',($choice == 1 ? 1 : 0)); DI::config()->set('remote_perms','global',($choice == 1 ? 1 : 0));
info(DI::l10n()->t('Settings updated.'). EOL); info(DI::l10n()->t('Settings updated.'). EOL);
} }

View File

@ -7,7 +7,6 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -89,14 +88,14 @@ function securemail_settings_post(App &$a, array &$b)
info(DI::l10n()->t('Secure Mail Settings saved.') . EOL); info(DI::l10n()->t('Secure Mail Settings saved.') . EOL);
if ($_POST['securemail-submit'] == DI::l10n()->t('Save and send test')) { 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(); $hostname = DI::baseUrl()->getHostname();
if (strpos($hostname, ':')) { if (strpos($hostname, ':')) {
$hostname = substr($hostname, 0, 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)) { if (empty($sender_email)) {
$sender_email = 'noreply@' . $hostname; $sender_email = 'noreply@' . $hostname;
} }

View File

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

View File

@ -42,7 +42,6 @@ use Friendica\App;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Content\Text\HTML; use Friendica\Content\Text\HTML;
use Friendica\Content\Text\Plaintext; use Friendica\Content\Text\Plaintext;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
@ -151,7 +150,7 @@ function statusnet_settings_post(App $a, $post)
* use them. All the data are available in the global config. * use them. All the data are available in the global config.
* Check the API Url never the less and blame the admin if it's not working ^^ * Check the API Url never the less and blame the admin if it's not working ^^
*/ */
$globalsn = Config::get('statusnet', 'sites'); $globalsn = DI::config()->get('statusnet', 'sites');
foreach ($globalsn as $asn) { foreach ($globalsn as $asn) {
if ($asn['apiurl'] == $_POST['statusnet-preconf-apiurl']) { if ($asn['apiurl'] == $_POST['statusnet-preconf-apiurl']) {
$apibase = $asn['apiurl']; $apibase = $asn['apiurl'];
@ -277,7 +276,7 @@ function statusnet_settings(App $a, &$s)
/* * * /* * *
* no consumer keys * no consumer keys
*/ */
$globalsn = Config::get('statusnet', 'sites'); $globalsn = DI::config()->get('statusnet', 'sites');
/* * * /* * *
* lets check if we have one or more globally configured GNU Social * lets check if we have one or more globally configured GNU Social
* server OAuth credentials in the configuration. If so offer them * server OAuth credentials in the configuration. If so offer them
@ -685,12 +684,12 @@ function statusnet_addon_admin_post(App $a)
} }
} }
$sites = Config::set('statusnet', 'sites', $sites); $sites = DI::config()->set('statusnet', 'sites', $sites);
} }
function statusnet_addon_admin(App $a, &$o) function statusnet_addon_admin(App $a, &$o)
{ {
$sites = Config::get('statusnet', 'sites'); $sites = DI::config()->get('statusnet', 'sites');
$sitesform = []; $sitesform = [];
if (is_array($sites)) { if (is_array($sites)) {
foreach ($sites as $id => $s) { foreach ($sites as $id => $s) {
@ -766,9 +765,9 @@ function statusnet_prepare_body(App $a, &$b)
function statusnet_cron(App $a, $b) function statusnet_cron(App $a, $b)
{ {
$last = Config::get('statusnet', 'last_poll'); $last = DI::config()->get('statusnet', 'last_poll');
$poll_interval = intval(Config::get('statusnet', 'poll_interval')); $poll_interval = intval(DI::config()->get('statusnet', 'poll_interval'));
if (!$poll_interval) { if (!$poll_interval) {
$poll_interval = STATUSNET_DEFAULT_POLL_INTERVAL; $poll_interval = STATUSNET_DEFAULT_POLL_INTERVAL;
} }
@ -790,7 +789,7 @@ function statusnet_cron(App $a, $b)
} }
} }
$abandon_days = intval(Config::get('system', 'account_abandon_days')); $abandon_days = intval(DI::config()->get('system', 'account_abandon_days'));
if ($abandon_days < 1) { if ($abandon_days < 1) {
$abandon_days = 0; $abandon_days = 0;
} }
@ -815,7 +814,7 @@ function statusnet_cron(App $a, $b)
Logger::log('statusnet: cron_end'); Logger::log('statusnet: cron_end');
Config::set('statusnet', 'last_poll', time()); DI::config()->set('statusnet', 'last_poll', time());
} }
function statusnet_fetchtimeline(App $a, $uid) function statusnet_fetchtimeline(App $a, $uid)
@ -833,7 +832,7 @@ function statusnet_fetchtimeline(App $a, $uid)
// hostname of the node if neither one is set. // hostname of the node if neither one is set.
$application_name = DI::pConfig()->get($uid, 'statusnet', 'application_name'); $application_name = DI::pConfig()->get($uid, 'statusnet', 'application_name');
if ($application_name == "") { if ($application_name == "") {
$application_name = Config::get('statusnet', 'application_name'); $application_name = DI::config()->get('statusnet', 'application_name');
} }
if ($application_name == "") { if ($application_name == "") {
$application_name = DI::baseUrl()->getHostname(); $application_name = DI::baseUrl()->getHostname();

View File

@ -7,7 +7,6 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Search; use Friendica\Core\Search;
use Friendica\Database\DBA; use Friendica\Database\DBA;
@ -50,7 +49,7 @@ function testdrive_register_account($a,$b) {
$uid = $b; $uid = $b;
$days = Config::get('testdrive','expiredays'); $days = DI::config()->get('testdrive','expiredays');
if(! $days) if(! $days)
return; return;
@ -100,8 +99,8 @@ function testdrive_enotify(&$a, &$b) {
if (!empty($b['params']) && $b['params']['type'] == NOTIFY_SYSTEM if (!empty($b['params']) && $b['params']['type'] == NOTIFY_SYSTEM
&& !empty($b['params']['system_type']) && $b['params']['system_type'] === 'testdrive_expire') { && !empty($b['params']['system_type']) && $b['params']['system_type'] === 'testdrive_expire') {
$b['itemlink'] = DI::baseUrl()->get(); $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 test account is about to expire.'); $b['subject'] = DI::l10n()->t('Your Friendica test account is about to expire.');
$b['body'] = DI::l10n()->t("Hi %1\$s,\n\nYour test account on %2\$s will expire in less than five days. We hope you enjoyed this test drive and use this opportunity to find a permanent Friendica website for your integrated social communications. A list of public sites is available at %s/siteinfo - and for more information on setting up your own Friendica server please see the Friendica project website at https://friendi.ca.", $b['params']['to_name'], "[url=".Config::get('system', 'url')."]".Config::get('config', 'sitename')."[/url]", Search::getGlobalDirectory()); $b['body'] = DI::l10n()->t("Hi %1\$s,\n\nYour test account on %2\$s will expire in less than five days. We hope you enjoyed this test drive and use this opportunity to find a permanent Friendica website for your integrated social communications. A list of public sites is available at %s/siteinfo - and for more information on setting up your own Friendica server please see the Friendica project website at https://friendi.ca.", $b['params']['to_name'], "[url=".DI::config()->get('system', 'url')."]".DI::config()->get('config', 'sitename')."[/url]", Search::getGlobalDirectory());
} }
} }

View File

@ -11,7 +11,6 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . '
use Friendica\App; use Friendica\App;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
@ -78,8 +77,8 @@ function tumblr_addon_admin(App $a, &$o)
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'), '$submit' => DI::l10n()->t('Save Settings'),
// name, label, value, help, [extra values] // name, label, value, help, [extra values]
'$consumer_key' => ['consumer_key', DI::l10n()->t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''], '$consumer_key' => ['consumer_key', DI::l10n()->t('Consumer Key'), DI::config()->get('tumblr', 'consumer_key' ), ''],
'$consumer_secret' => ['consumer_secret', DI::l10n()->t('Consumer Secret'), Config::get('tumblr', 'consumer_secret' ), ''], '$consumer_secret' => ['consumer_secret', DI::l10n()->t('Consumer Secret'), DI::config()->get('tumblr', 'consumer_secret' ), ''],
]); ]);
} }
@ -88,8 +87,8 @@ function tumblr_addon_admin_post(App $a)
$consumer_key = (!empty($_POST['consumer_key']) ? Strings::escapeTags(trim($_POST['consumer_key'])) : ''); $consumer_key = (!empty($_POST['consumer_key']) ? Strings::escapeTags(trim($_POST['consumer_key'])) : '');
$consumer_secret = (!empty($_POST['consumer_secret']) ? Strings::escapeTags(trim($_POST['consumer_secret'])): ''); $consumer_secret = (!empty($_POST['consumer_secret']) ? Strings::escapeTags(trim($_POST['consumer_secret'])): '');
Config::set('tumblr', 'consumer_key',$consumer_key); DI::config()->set('tumblr', 'consumer_key',$consumer_key);
Config::set('tumblr', 'consumer_secret',$consumer_secret); DI::config()->set('tumblr', 'consumer_secret',$consumer_secret);
info(DI::l10n()->t('Settings updated.'). EOL); info(DI::l10n()->t('Settings updated.'). EOL);
} }
@ -103,8 +102,8 @@ function tumblr_connect(App $a)
//require_once('addon/tumblr/tumblroauth/tumblroauth.php'); //require_once('addon/tumblr/tumblroauth/tumblroauth.php');
// Define the needed keys // Define the needed keys
$consumer_key = Config::get('tumblr', 'consumer_key'); $consumer_key = DI::config()->get('tumblr', 'consumer_key');
$consumer_secret = Config::get('tumblr', 'consumer_secret'); $consumer_secret = DI::config()->get('tumblr', 'consumer_secret');
// The callback URL is the script that gets called after the user authenticates with tumblr // The callback URL is the script that gets called after the user authenticates with tumblr
// In this example, it would be the included callback.php // In this example, it would be the included callback.php
@ -156,8 +155,8 @@ function tumblr_callback(App $a)
//require_once('addon/tumblr/tumblroauth/tumblroauth.php'); //require_once('addon/tumblr/tumblroauth/tumblroauth.php');
// Define the needed keys // Define the needed keys
$consumer_key = Config::get('tumblr', 'consumer_key'); $consumer_key = DI::config()->get('tumblr', 'consumer_key');
$consumer_secret = Config::get('tumblr', 'consumer_secret'); $consumer_secret = DI::config()->get('tumblr', 'consumer_secret');
// Once the user approves your app at Tumblr, they are sent back to this script. // Once the user approves your app at Tumblr, they are sent back to this script.
// This script is passed two parameters in the URL, oauth_token (our Request Token) // This script is passed two parameters in the URL, oauth_token (our Request Token)
@ -263,8 +262,8 @@ function tumblr_settings(App $a, &$s)
if (($oauth_token != "") && ($oauth_token_secret != "")) { if (($oauth_token != "") && ($oauth_token_secret != "")) {
$page = DI::pConfig()->get(local_user(), 'tumblr', 'page'); $page = DI::pConfig()->get(local_user(), 'tumblr', 'page');
$consumer_key = Config::get('tumblr', 'consumer_key'); $consumer_key = DI::config()->get('tumblr', 'consumer_key');
$consumer_secret = Config::get('tumblr', 'consumer_secret'); $consumer_secret = DI::config()->get('tumblr', 'consumer_secret');
$tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret); $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
@ -470,8 +469,8 @@ function tumblr_send(App $a, array &$b) {
$params['caption'] = BBCode::convert("[quote]" . $siteinfo["description"] . "[/quote]", false, 4); $params['caption'] = BBCode::convert("[quote]" . $siteinfo["description"] . "[/quote]", false, 4);
} }
$consumer_key = Config::get('tumblr','consumer_key'); $consumer_key = DI::config()->get('tumblr','consumer_key');
$consumer_secret = Config::get('tumblr','consumer_secret'); $consumer_secret = DI::config()->get('tumblr','consumer_secret');
$tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret); $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);

View File

@ -69,7 +69,6 @@ use Friendica\App;
use Friendica\Content\OEmbed; use Friendica\Content\OEmbed;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Plaintext; use Friendica\Content\Text\Plaintext;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
@ -166,8 +165,8 @@ function twitter_follow(App $a, array &$contact)
$uid = $a->user["uid"]; $uid = $a->user["uid"];
$ckey = Config::get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
@ -240,8 +239,8 @@ function twitter_settings_post(App $a)
if (isset($_POST['twitter-pin'])) { if (isset($_POST['twitter-pin'])) {
// if the user supplied us with a PIN from Twitter, let the magic of OAuth happen // if the user supplied us with a PIN from Twitter, let the magic of OAuth happen
Logger::notice('got a Twitter PIN'); Logger::notice('got a Twitter PIN');
$ckey = Config::get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
// the token and secret for which the PIN was generated were hidden in the settings // the token and secret for which the PIN was generated were hidden in the settings
// form as token and token2, we need a new connection to Twitter using these token // form as token and token2, we need a new connection to Twitter using these token
// and secret to request a Access Token with the PIN // and secret to request a Access Token with the PIN
@ -292,8 +291,8 @@ function twitter_settings(App $a, &$s)
* 2) If no OAuthtoken & stuff is present, generate button to get some * 2) If no OAuthtoken & stuff is present, generate button to get some
* 3) Checkbox for "Send public notices (280 chars only) * 3) Checkbox for "Send public notices (280 chars only)
*/ */
$ckey = Config::get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
$otoken = DI::pConfig()->get(local_user(), 'twitter', 'oauthtoken'); $otoken = DI::pConfig()->get(local_user(), 'twitter', 'oauthtoken');
$osecret = DI::pConfig()->get(local_user(), 'twitter', 'oauthsecret'); $osecret = DI::pConfig()->get(local_user(), 'twitter', 'oauthsecret');
@ -472,8 +471,8 @@ function twitter_post_local(App $a, array &$b)
function twitter_action(App $a, $uid, $pid, $action) function twitter_action(App $a, $uid, $pid, $action)
{ {
$ckey = Config::get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
@ -588,8 +587,8 @@ function twitter_post_hook(App $a, array &$b)
DI::pConfig()->load($b['uid'], 'twitter'); DI::pConfig()->load($b['uid'], 'twitter');
$ckey = Config::get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
$otoken = DI::pConfig()->get($b['uid'], 'twitter', 'oauthtoken'); $otoken = DI::pConfig()->get($b['uid'], 'twitter', 'oauthtoken');
$osecret = DI::pConfig()->get($b['uid'], 'twitter', 'oauthsecret'); $osecret = DI::pConfig()->get($b['uid'], 'twitter', 'oauthsecret');
@ -699,7 +698,7 @@ function twitter_post_hook(App $a, array &$b)
Logger::info('twitter_post send', ['id' => $b['id'], 'result' => $result]); Logger::info('twitter_post send', ['id' => $b['id'], 'result' => $result]);
if (!empty($result->source)) { if (!empty($result->source)) {
Config::set("twitter", "application_name", strip_tags($result->source)); DI::config()->set("twitter", "application_name", strip_tags($result->source));
} }
if (!empty($result->errors)) { if (!empty($result->errors)) {
@ -716,8 +715,8 @@ function twitter_addon_admin_post(App $a)
{ {
$consumerkey = !empty($_POST['consumerkey']) ? Strings::escapeTags(trim($_POST['consumerkey'])) : ''; $consumerkey = !empty($_POST['consumerkey']) ? Strings::escapeTags(trim($_POST['consumerkey'])) : '';
$consumersecret = !empty($_POST['consumersecret']) ? Strings::escapeTags(trim($_POST['consumersecret'])) : ''; $consumersecret = !empty($_POST['consumersecret']) ? Strings::escapeTags(trim($_POST['consumersecret'])) : '';
Config::set('twitter', 'consumerkey', $consumerkey); DI::config()->set('twitter', 'consumerkey', $consumerkey);
Config::set('twitter', 'consumersecret', $consumersecret); DI::config()->set('twitter', 'consumersecret', $consumersecret);
info(DI::l10n()->t('Settings updated.') . EOL); info(DI::l10n()->t('Settings updated.') . EOL);
} }
@ -728,16 +727,16 @@ function twitter_addon_admin(App $a, &$o)
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'), '$submit' => DI::l10n()->t('Save Settings'),
// name, label, value, help, [extra values] // name, label, value, help, [extra values]
'$consumerkey' => ['consumerkey', DI::l10n()->t('Consumer key'), Config::get('twitter', 'consumerkey'), ''], '$consumerkey' => ['consumerkey', DI::l10n()->t('Consumer key'), DI::config()->get('twitter', 'consumerkey'), ''],
'$consumersecret' => ['consumersecret', DI::l10n()->t('Consumer secret'), Config::get('twitter', 'consumersecret'), ''], '$consumersecret' => ['consumersecret', DI::l10n()->t('Consumer secret'), DI::config()->get('twitter', 'consumersecret'), ''],
]); ]);
} }
function twitter_cron(App $a) function twitter_cron(App $a)
{ {
$last = Config::get('twitter', 'last_poll'); $last = DI::config()->get('twitter', 'last_poll');
$poll_interval = intval(Config::get('twitter', 'poll_interval')); $poll_interval = intval(DI::config()->get('twitter', 'poll_interval'));
if (!$poll_interval) { if (!$poll_interval) {
$poll_interval = TWITTER_DEFAULT_POLL_INTERVAL; $poll_interval = TWITTER_DEFAULT_POLL_INTERVAL;
} }
@ -759,7 +758,7 @@ function twitter_cron(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) { if ($abandon_days < 1) {
$abandon_days = 0; $abandon_days = 0;
} }
@ -798,12 +797,12 @@ function twitter_cron(App $a)
Logger::notice('twitter: cron_end'); Logger::notice('twitter: cron_end');
Config::set('twitter', 'last_poll', time()); DI::config()->set('twitter', 'last_poll', time());
} }
function twitter_expire(App $a) function twitter_expire(App $a)
{ {
$days = Config::get('twitter', 'expire'); $days = DI::config()->get('twitter', 'expire');
if ($days == 0) { if ($days == 0) {
return; return;
@ -929,13 +928,13 @@ function twitter_do_mirrorpost(App $a, $uid, $post)
function twitter_fetchtimeline(App $a, $uid) function twitter_fetchtimeline(App $a, $uid)
{ {
$ckey = Config::get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
$lastid = DI::pConfig()->get($uid, 'twitter', 'lastid'); $lastid = DI::pConfig()->get($uid, 'twitter', 'lastid');
$application_name = Config::get('twitter', 'application_name'); $application_name = DI::config()->get('twitter', 'application_name');
if ($application_name == "") { if ($application_name == "") {
$application_name = DI::baseUrl()->getHostname(); $application_name = DI::baseUrl()->getHostname();
@ -1095,8 +1094,8 @@ function twitter_fetch_contact($uid, $data, $create_user)
function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "") function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
{ {
$ckey = Config::get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
@ -1619,8 +1618,8 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection,
function twitter_fetchhometimeline(App $a, $uid) function twitter_fetchhometimeline(App $a, $uid)
{ {
$ckey = Config::get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
$create_user = DI::pConfig()->get($uid, 'twitter', 'create_user'); $create_user = DI::pConfig()->get($uid, 'twitter', 'create_user');
@ -1628,7 +1627,7 @@ function twitter_fetchhometimeline(App $a, $uid)
Logger::log("Fetching timeline for user " . $uid, Logger::DEBUG); Logger::log("Fetching timeline for user " . $uid, Logger::DEBUG);
$application_name = Config::get('twitter', 'application_name'); $application_name = DI::config()->get('twitter', 'application_name');
if ($application_name == "") { if ($application_name == "") {
$application_name = DI::baseUrl()->getHostname(); $application_name = DI::baseUrl()->getHostname();
@ -1803,8 +1802,8 @@ function twitter_fetchhometimeline(App $a, $uid)
function twitter_fetch_own_contact(App $a, $uid) function twitter_fetch_own_contact(App $a, $uid)
{ {
$ckey = Config::get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');
@ -1878,8 +1877,8 @@ function twitter_is_retweet(App $a, $uid, $body)
Logger::log('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, Logger::DEBUG); Logger::log('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, Logger::DEBUG);
$ckey = Config::get('twitter', 'consumerkey'); $ckey = DI::config()->get('twitter', 'consumerkey');
$csecret = Config::get('twitter', 'consumersecret'); $csecret = DI::config()->get('twitter', 'consumersecret');
$otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken');
$osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret');

View File

@ -1,7 +1,7 @@
<?php <?php
use Friendica\Core\Config;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\DI;
function twitter_sync_run($argv, $argc) function twitter_sync_run($argv, $argc)
{ {
@ -11,7 +11,7 @@ function twitter_sync_run($argv, $argc)
if (function_exists('sys_getloadavg')) { if (function_exists('sys_getloadavg')) {
$load = 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. Twitter sync deferred to next scheduled run.'); Logger::log('system: load ' . $load[0] . ' too high. Twitter sync deferred to next scheduled run.');
return; return;
} }

View File

@ -6,7 +6,6 @@
* Author: Stephen Mahood <https://friends.mayfirst.org/profile/marxistvegan> * Author: Stephen Mahood <https://friends.mayfirst.org/profile/marxistvegan>
* Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias> * Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
*/ */
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
@ -29,12 +28,12 @@ function webrtc_addon_admin (&$a, &$o) {
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/webrtc/" ); $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/webrtc/" );
$o = Renderer::replaceMacros( $t, [ $o = Renderer::replaceMacros( $t, [
'$submit' => DI::l10n()->t('Save Settings'), '$submit' => DI::l10n()->t('Save Settings'),
'$webrtcurl' => ['webrtcurl', DI::l10n()->t('WebRTC Base URL'), Config::get('webrtc','webrtcurl' ), DI::l10n()->t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')], '$webrtcurl' => ['webrtcurl', DI::l10n()->t('WebRTC Base URL'), DI::config()->get('webrtc','webrtcurl' ), DI::l10n()->t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')],
]); ]);
} }
function webrtc_addon_admin_post (&$a) { function webrtc_addon_admin_post (&$a) {
$url = (!empty($_POST['webrtcurl']) ? Strings::escapeTags(trim($_POST['webrtcurl'])) : ''); $url = (!empty($_POST['webrtcurl']) ? Strings::escapeTags(trim($_POST['webrtcurl'])) : '');
Config::set('webrtc', 'webrtcurl', $url); DI::config()->set('webrtc', 'webrtcurl', $url);
info(DI::l10n()->t('Settings updated.'). EOL); info(DI::l10n()->t('Settings updated.'). EOL);
} }
@ -46,7 +45,7 @@ function webrtc_content(&$a) {
$o = ''; $o = '';
/* landingpage to create chatrooms */ /* landingpage to create chatrooms */
$webrtcurl = Config::get('webrtc','webrtcurl'); $webrtcurl = DI::config()->get('webrtc','webrtcurl');
/* embedd the landing page in an iframe */ /* embedd the landing page in an iframe */
$o .= '<h2>'.DI::l10n()->t('Video Chat').'</h2>'; $o .= '<h2>'.DI::l10n()->t('Video Chat').'</h2>';

View File

@ -8,7 +8,6 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
@ -77,13 +76,13 @@ function xmpp_addon_settings(App $a, &$s)
$s .= '<input id="xmpp-enabled" type="checkbox" name="xmpp_enabled" value="1" ' . $enabled_checked . '/>'; $s .= '<input id="xmpp-enabled" type="checkbox" name="xmpp_enabled" value="1" ' . $enabled_checked . '/>';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
if (Config::get("xmpp", "central_userbase")) { if (DI::config()->get("xmpp", "central_userbase")) {
$s .= '<label id="xmpp-individual-label" for="xmpp-individual">' . DI::l10n()->t('Individual Credentials') . '</label>'; $s .= '<label id="xmpp-individual-label" for="xmpp-individual">' . DI::l10n()->t('Individual Credentials') . '</label>';
$s .= '<input id="xmpp-individual" type="checkbox" name="xmpp_individual" value="1" ' . $individual_checked . '/>'; $s .= '<input id="xmpp-individual" type="checkbox" name="xmpp_individual" value="1" ' . $individual_checked . '/>';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
} }
if (!Config::get("xmpp", "central_userbase") || DI::pConfig()->get(local_user(), "xmpp", "individual")) { if (!DI::config()->get("xmpp", "central_userbase") || DI::pConfig()->get(local_user(), "xmpp", "individual")) {
$s .= '<label id="xmpp-bosh-proxy-label" for="xmpp-bosh-proxy">' . DI::l10n()->t('Jabber BOSH host') . '</label>'; $s .= '<label id="xmpp-bosh-proxy-label" for="xmpp-bosh-proxy">' . DI::l10n()->t('Jabber BOSH host') . '</label>';
$s .= ' <input id="xmpp-bosh-proxy" type="text" name="xmpp_bosh_proxy" value="' . $bosh_proxy . '" />'; $s .= ' <input id="xmpp-bosh-proxy" type="text" name="xmpp_bosh_proxy" value="' . $bosh_proxy . '" />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
@ -110,8 +109,8 @@ function xmpp_addon_admin(App $a, &$o)
$o = Renderer::replaceMacros($t, [ $o = Renderer::replaceMacros($t, [
'$submit' => DI::l10n()->t('Save Settings'), '$submit' => DI::l10n()->t('Save Settings'),
'$bosh_proxy' => ['bosh_proxy', DI::l10n()->t('Jabber BOSH host'), Config::get('xmpp', 'bosh_proxy'), ''], '$bosh_proxy' => ['bosh_proxy', DI::l10n()->t('Jabber BOSH host'), DI::config()->get('xmpp', 'bosh_proxy'), ''],
'$central_userbase' => ['central_userbase', DI::l10n()->t('Use central userbase'), Config::get('xmpp', 'central_userbase'), DI::l10n()->t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')], '$central_userbase' => ['central_userbase', DI::l10n()->t('Use central userbase'), DI::config()->get('xmpp', 'central_userbase'), DI::l10n()->t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')],
]); ]);
} }
@ -120,8 +119,8 @@ function xmpp_addon_admin_post()
$bosh_proxy = (!empty($_POST['bosh_proxy']) ? trim($_POST['bosh_proxy']) : ''); $bosh_proxy = (!empty($_POST['bosh_proxy']) ? trim($_POST['bosh_proxy']) : '');
$central_userbase = (!empty($_POST['central_userbase']) ? intval($_POST['central_userbase']) : false); $central_userbase = (!empty($_POST['central_userbase']) ? intval($_POST['central_userbase']) : false);
Config::set('xmpp', 'bosh_proxy', $bosh_proxy); DI::config()->set('xmpp', 'bosh_proxy', $bosh_proxy);
Config::set('xmpp', 'central_userbase', $central_userbase); DI::config()->set('xmpp', 'central_userbase', $central_userbase);
info(DI::l10n()->t('Settings updated.') . EOL); info(DI::l10n()->t('Settings updated.') . EOL);
} }
@ -156,8 +155,8 @@ function xmpp_converse(App $a)
DI::page()['htmlhead'] .= '<link type="text/css" rel="stylesheet" media="screen" href="addon/xmpp/converse/css/converse.css" />' . "\n"; DI::page()['htmlhead'] .= '<link type="text/css" rel="stylesheet" media="screen" href="addon/xmpp/converse/css/converse.css" />' . "\n";
DI::page()['htmlhead'] .= '<script src="addon/xmpp/converse/builds/converse.min.js"></script>' . "\n"; DI::page()['htmlhead'] .= '<script src="addon/xmpp/converse/builds/converse.min.js"></script>' . "\n";
if (Config::get("xmpp", "central_userbase") && !DI::pConfig()->get(local_user(), "xmpp", "individual")) { if (DI::config()->get("xmpp", "central_userbase") && !DI::pConfig()->get(local_user(), "xmpp", "individual")) {
$bosh_proxy = Config::get("xmpp", "bosh_proxy"); $bosh_proxy = DI::config()->get("xmpp", "bosh_proxy");
$password = DI::pConfig()->get(local_user(), "xmpp", "password", '', true); $password = DI::pConfig()->get(local_user(), "xmpp", "password", '', true);