diff --git a/blackout/blackout.php b/blackout/blackout.php index 09fa06934..aee5acc76 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -65,9 +65,9 @@ function blackout_redirect ($a, $b) { } // else... - $mystart = Config::get('blackout','begindate'); - $myend = Config::get('blackout','enddate'); - $myurl = Config::get('blackout','url'); + $mystart = DI::config()->get('blackout','begindate'); + $myend = DI::config()->get('blackout','enddate'); + $myurl = DI::config()->get('blackout','url'); $now = time(); $date1 = DateTime::createFromFormat('Y-m-d G:i', $mystart); $date2 = DateTime::createFromFormat('Y-m-d G:i', $myend); @@ -85,11 +85,11 @@ function blackout_redirect ($a, $b) { } function blackout_addon_admin(&$a, &$o) { - $mystart = Config::get('blackout','begindate'); + $mystart = DI::config()->get('blackout','begindate'); if (! is_string($mystart)) { $mystart = "YYYY-MM-DD hh:mm"; } - $myend = Config::get('blackout','enddate'); + $myend = DI::config()->get('blackout','enddate'); if (! is_string($myend)) { $myend = "YYYY-MM-DD hh:mm"; } - $myurl = Config::get('blackout','url'); + $myurl = DI::config()->get('blackout','url'); if (! is_string($myurl)) { $myurl = "https://www.example.com"; } $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/blackout/" ); diff --git a/blockbot/blockbot.php b/blockbot/blockbot.php index caa4ef846..0e6cea96c 100644 --- a/blockbot/blockbot.php +++ b/blockbot/blockbot.php @@ -33,9 +33,9 @@ function blockbot_addon_admin(&$a, &$o) { $o = Renderer::replaceMacros($t, [ '$submit' => DI::l10n()->t('Save Settings'), - '$good_crawlers' => ['good_crawlers', DI::l10n()->t('Allow "good" crawlers'), Config::get('blockbot', 'good_crawlers'), "Don't block fediverse crawlers, relay servers and other bots with good purposes."], - '$block_gab' => ['block_gab', DI::l10n()->t('Block GabSocial'), Config::get('blockbot', 'block_gab'), 'Block the software GabSocial. This will block every access for that software. You can block dedicated gab instances in the blocklist settings in the admin section.'], - '$training' => ['training', DI::l10n()->t('Training mode'), Config::get('blockbot', 'training'), "Activates the training mode. This is only meant for developing purposes. Don't activate this on a production machine. This can cut communication with some systems."], + '$good_crawlers' => ['good_crawlers', DI::l10n()->t('Allow "good" crawlers'), DI::config()->get('blockbot', 'good_crawlers'), "Don't block fediverse crawlers, relay servers and other bots with good purposes."], + '$block_gab' => ['block_gab', DI::l10n()->t('Block GabSocial'), DI::config()->get('blockbot', 'block_gab'), 'Block the software GabSocial. This will block every access for that software. You can block dedicated gab instances in the blocklist settings in the admin section.'], + '$training' => ['training', DI::l10n()->t('Training mode'), DI::config()->get('blockbot', 'training'), "Activates the training mode. This is only meant for developing purposes. Don't activate this on a production machine. This can cut communication with some systems."], ]); } @@ -77,7 +77,7 @@ function blockbot_init_1(App $a) { '7Siters/', 'KOCMOHABT', 'Google-SearchByImage', 'FemtosearchBot/', 'HubSpot Crawler', 'DomainStatsBot/', 'Re-re Studio']; - if (!Config::get('blockbot', 'good_crawlers')) { + if (!DI::config()->get('blockbot', 'good_crawlers')) { $agents = array_merge($agents, $good_agents); } else { foreach ($good_agents as $good_agent) { @@ -87,7 +87,7 @@ function blockbot_init_1(App $a) { } } - if (Config::get('blockbot', 'block_gab')) { + if (DI::config()->get('blockbot', 'block_gab')) { $agents[] = 'GabSocial/'; } @@ -98,7 +98,7 @@ function blockbot_init_1(App $a) { } // This switch here is only meant for developers who want to add more bots to the list above, it is not safe for production. - if (!Config::get('blockbot', 'training')) { + if (!DI::config()->get('blockbot', 'training')) { return; } @@ -117,7 +117,7 @@ function blockbot_init_1(App $a) { 'Dispatch/', 'Ruby', 'Java/', 'libwww-perl/', 'Mastodon/', 'lua-resty-http/']; - if (Config::get('blockbot', 'good_crawlers')) { + if (DI::config()->get('blockbot', 'good_crawlers')) { $agents = array_merge($agents, $good_agents); } diff --git a/buffer/buffer.php b/buffer/buffer.php index a583496d8..81625ea6c 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -78,8 +78,8 @@ function buffer_addon_admin(App $a, &$o) $o = Renderer::replaceMacros($t, [ '$submit' => DI::l10n()->t('Save Settings'), // name, label, value, help, [extra values] - '$client_id' => ['client_id', DI::l10n()->t('Client ID'), Config::get('buffer', 'client_id'), ''], - '$client_secret' => ['client_secret', DI::l10n()->t('Client Secret'), Config::get('buffer', 'client_secret'), ''], + '$client_id' => ['client_id', DI::l10n()->t('Client ID'), DI::config()->get('buffer', 'client_id'), ''], + '$client_secret' => ['client_secret', DI::l10n()->t('Client Secret'), DI::config()->get('buffer', 'client_secret'), ''], ]); } @@ -105,8 +105,8 @@ function buffer_connect(App $a) session_start(); // Define the needed keys - $client_id = Config::get('buffer','client_id'); - $client_secret = Config::get('buffer','client_secret'); + $client_id = DI::config()->get('buffer','client_id'); + $client_secret = DI::config()->get('buffer','client_secret'); // The callback URL is the script that gets called after the user authenticates with buffer $callback_url = DI::baseUrl()->get()."/buffer/connect"; @@ -172,8 +172,8 @@ function buffer_settings(App $a, &$s) $s .= '
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.
"; } // bosh proxy - $bosh_proxy = intval(Config::get("jappixmini", "bosh_proxy")); + $bosh_proxy = intval(DI::config()->get("jappixmini", "bosh_proxy")); $bosh_proxy = intval($bosh_proxy) ? ' checked="checked"' : ''; $o .= ''; $o .= '
';
$o .= '
';
$o .= '
';
$o .= '
'.BBCode::convert(trim($ft)).'
'; } @@ -69,9 +69,9 @@ function newmemberwidget_addon_admin(&$a, &$o) $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/newmemberwidget'); $o = Renderer::replaceMacros($t, [ '$submit' => DI::l10n()->t('Save Settings'), - '$freetext' => [ "freetext", DI::l10n()->t("Message"), Config::get("newmemberwidget", "freetext"), DI::l10n()->t("Your message for new members. You can use bbcode here.")], - '$linkglobalsupport' => [ "linkglobalsupport", DI::l10n()->t('Add a link to global support forum'), Config::get('newmemberwidget', 'linkglobalsupport'), DI::l10n()->t('Should a link to the global support forum be displayed?')." (@helpers)"], - '$linklocalsupport' => [ "linklocalsupport", DI::l10n()->t('Add a link to the local support forum'), Config::get('newmemberwidget', 'linklocalsupport'), DI::l10n()->t('If you have a local support forum and want to have a link displayed in the widget, check this box.')], - '$localsupportname' => [ "localsupportname", DI::l10n()->t('Name of the local support group'), Config::get('newmemberwidget', 'localsupport'), DI::l10n()->t('If you checked the above, specify the nickname of the local support group here (i.e. helpers)')], + '$freetext' => [ "freetext", DI::l10n()->t("Message"), DI::config()->get("newmemberwidget", "freetext"), DI::l10n()->t("Your message for new members. You can use bbcode here.")], + '$linkglobalsupport' => [ "linkglobalsupport", DI::l10n()->t('Add a link to global support forum'), DI::config()->get('newmemberwidget', 'linkglobalsupport'), DI::l10n()->t('Should a link to the global support forum be displayed?')." (@helpers)"], + '$linklocalsupport' => [ "linklocalsupport", DI::l10n()->t('Add a link to the local support forum'), DI::config()->get('newmemberwidget', 'linklocalsupport'), DI::l10n()->t('If you have a local support forum and want to have a link displayed in the widget, check this box.')], + '$localsupportname' => [ "localsupportname", DI::l10n()->t('Name of the local support group'), DI::config()->get('newmemberwidget', 'localsupport'), DI::l10n()->t('If you checked the above, specify the nickname of the local support group here (i.e. helpers)')], ]); } diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 5135ac4d7..dc7688738 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -46,18 +46,18 @@ function notifyall_post(App $a) return; } - $sitename = Config::get('config', 'sitename'); + $sitename = DI::config()->get('config', 'sitename'); - if (empty(Config::get('config', 'admin_name'))) { + if (empty(DI::config()->get('config', 'admin_name'))) { $sender_name = '"' . DI::l10n()->t('%s Administrator', $sitename) . '"'; } else { - $sender_name = '"' . DI::l10n()->t('%1$s, %2$s Administrator', Config::get('config', 'admin_name'), $sitename) . '"'; + $sender_name = '"' . DI::l10n()->t('%1$s, %2$s Administrator', DI::config()->get('config', 'admin_name'), $sitename) . '"'; } - if (!Config::get('config', 'sender_email')) { + if (!DI::config()->get('config', 'sender_email')) { $sender_email = 'noreply@' . DI::baseUrl()->getHostname(); } else { - $sender_email = Config::get('config', 'sender_email'); + $sender_email = DI::config()->get('config', 'sender_email'); } $subject = $_REQUEST['subject']; @@ -70,7 +70,7 @@ function notifyall_post(App $a) // if this is a test, send it only to the admin(s) // admin_email might be a comma separated list, but we need "a@b','c@d','e@f if (intval($_REQUEST['test'])) { - $email = Config::get('config', 'admin_email'); + $email = DI::config()->get('config', 'admin_email'); $email = "'" . str_replace([" ",","], ["","','"], $email) . "'"; } $sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : ''); diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index a4aafcd38..4391d1b00 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -82,10 +82,10 @@ function openstreetmap_location($a, &$item) * ?mlat=lat&mlon=lon for markers. */ - $tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS); - $nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM); - $zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM); - $marker = Config::get('openstreetmap', 'marker', OSM_MARKER); + $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS); + $nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM); + $zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM); + $marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER); // This is needed since we stored an empty string in the config in previous versions if (empty($nomserver)) { @@ -120,7 +120,7 @@ function openstreetmap_location($a, &$item) function openstreetmap_get_coordinates($a, &$b) { - $nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM); + $nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM); // This is needed since we stored an empty string in the config in previous versions if (empty($nomserver)) { @@ -157,14 +157,14 @@ function openstreetmap_generate_named_map(&$a, &$b) function openstreetmap_generate_map(&$a, &$b) { - $tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS); + $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS); if (strpos(DI::baseUrl()->get(true), 'https:') !== false) { $tmsserver = str_replace('http:','https:',$tmsserver); } - $zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM); - $marker = Config::get('openstreetmap', 'marker', OSM_MARKER); + $zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM); + $marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER); $lat = $b['lat']; // round($b['lat'], 5); $lon = $b['lon']; // round($b['lon'], 5); @@ -194,10 +194,10 @@ function openstreetmap_generate_map(&$a, &$b) function openstreetmap_addon_admin(&$a, &$o) { $t = Renderer::getMarkupTemplate("admin.tpl", "addon/openstreetmap/"); - $tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS); - $nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM); - $zoom = Config::get('openstreetmap', 'zoom', OSM_ZOOM); - $marker = Config::get('openstreetmap', 'marker', OSM_MARKER); + $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS); + $nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM); + $zoom = DI::config()->get('openstreetmap', 'zoom', OSM_ZOOM); + $marker = DI::config()->get('openstreetmap', 'marker', OSM_MARKER); // This is needed since we stored an empty string in the config in previous versions if (empty($nomserver)) { diff --git a/pageheader/pageheader.php b/pageheader/pageheader.php index 83cebbb9f..59a52c4f7 100644 --- a/pageheader/pageheader.php +++ b/pageheader/pageheader.php @@ -28,7 +28,7 @@ function pageheader_addon_admin(App &$a, &$s) $stylesheetPath = __DIR__ . '/pageheader.css'; DI::page()->registerStylesheet($stylesheetPath); - $words = Config::get('pageheader','text'); + $words = DI::config()->get('pageheader','text'); if(! $words) $words = ''; @@ -61,7 +61,7 @@ function pageheader_fetch(App $a, &$b) if(file_exists('pageheader.html')){ $s = file_get_contents('pageheader.html'); } else { - $s = Config::get('pageheader', 'text'); + $s = DI::config()->get('pageheader', 'text'); } $stylesheetPath = __DIR__ .'/pageheader.css'; diff --git a/phpmailer/phpmailer.php b/phpmailer/phpmailer.php index 7f91c2775..b55fcccd9 100644 --- a/phpmailer/phpmailer.php +++ b/phpmailer/phpmailer.php @@ -39,7 +39,7 @@ function phpmailer_emailer_send_prepare(App $a, array &$b) // Passing `true` enables exceptions $mail = new PHPMailer(true); try { - if (Config::get('phpmailer', 'smtp')) { + if (DI::config()->get('phpmailer', 'smtp')) { // Set mailer to use SMTP $mail->isSMTP(); @@ -48,22 +48,22 @@ function phpmailer_emailer_send_prepare(App $a, array &$b) $mail->Encoding = 'base64'; // Specify main and backup SMTP servers - $mail->Host = Config::get('phpmailer', 'smtp_server'); - $mail->Port = Config::get('phpmailer', 'smtp_port'); + $mail->Host = DI::config()->get('phpmailer', 'smtp_server'); + $mail->Port = DI::config()->get('phpmailer', 'smtp_port'); - if (Config::get('system', 'smtp_secure') && Config::get('phpmailer', 'smtp_port_s')) { - $mail->SMTPSecure = Config::get('phpmailer', 'smtp_secure'); - $mail->Port = Config::get('phpmailer', 'smtp_port_s'); + if (DI::config()->get('system', 'smtp_secure') && DI::config()->get('phpmailer', 'smtp_port_s')) { + $mail->SMTPSecure = DI::config()->get('phpmailer', 'smtp_secure'); + $mail->Port = DI::config()->get('phpmailer', 'smtp_port_s'); } - if (Config::get('phpmailer', 'smtp_username') && Config::get('phpmailer', 'smtp_password')) { + if (DI::config()->get('phpmailer', 'smtp_username') && DI::config()->get('phpmailer', 'smtp_password')) { $mail->SMTPAuth = true; - $mail->Username = Config::get('phpmailer', 'smtp_username'); - $mail->Password = Config::get('phpmailer', 'smtp_password'); + $mail->Username = DI::config()->get('phpmailer', 'smtp_username'); + $mail->Password = DI::config()->get('phpmailer', 'smtp_password'); } - if (Config::get('phpmailer', 'smtp_from')) { - $mail->setFrom(Config::get('phpmailer', 'smtp_from'), $b['fromName']); + if (DI::config()->get('phpmailer', 'smtp_from')) { + $mail->setFrom(DI::config()->get('phpmailer', 'smtp_from'), $b['fromName']); } } else { $mail->setFrom($b['fromEmail'], $b['fromName']); diff --git a/piwik/piwik.php b/piwik/piwik.php index e3afb937f..3ec08bfaa 100644 --- a/piwik/piwik.php +++ b/piwik/piwik.php @@ -70,10 +70,10 @@ function piwik_analytics($a,&$b) { /* * Get the configuration variables from the config/addon.config.php file. */ - $baseurl = Config::get('piwik', 'baseurl'); - $siteid = Config::get('piwik', 'siteid'); - $optout = Config::get('piwik', 'optout'); - $async = Config::get('piwik', 'async'); + $baseurl = DI::config()->get('piwik', 'baseurl'); + $siteid = DI::config()->get('piwik', 'siteid'); + $optout = DI::config()->get('piwik', 'optout'); + $async = DI::config()->get('piwik', 'async'); /* * Add the Piwik tracking code for the site. @@ -103,10 +103,10 @@ function piwik_addon_admin (&$a, &$o) { $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/piwik/" ); $o = Renderer::replaceMacros( $t, [ '$submit' => DI::l10n()->t('Save Settings'), - '$piwikbaseurl' => ['baseurl', DI::l10n()->t('Matomo (Piwik) Base URL'), Config::get('piwik','baseurl' ), DI::l10n()->t('Absolute path to your Matomo (Piwik) installation. (without protocol (http/s), with trailing slash)')], - '$siteid' => ['siteid', DI::l10n()->t('Site ID'), Config::get('piwik','siteid' ), ''], - '$optout' => ['optout', DI::l10n()->t('Show opt-out cookie link?'), Config::get('piwik','optout' ), ''], - '$async' => ['async', DI::l10n()->t('Asynchronous tracking'), Config::get('piwik','async' ), ''], + '$piwikbaseurl' => ['baseurl', DI::l10n()->t('Matomo (Piwik) Base URL'), DI::config()->get('piwik','baseurl' ), DI::l10n()->t('Absolute path to your Matomo (Piwik) installation. (without protocol (http/s), with trailing slash)')], + '$siteid' => ['siteid', DI::l10n()->t('Site ID'), DI::config()->get('piwik','siteid' ), ''], + '$optout' => ['optout', DI::l10n()->t('Show opt-out cookie link?'), DI::config()->get('piwik','optout' ), ''], + '$async' => ['async', DI::l10n()->t('Asynchronous tracking'), DI::config()->get('piwik','async' ), ''], ]); } function piwik_addon_admin_post (&$a) { diff --git a/public_server/public_server.php b/public_server/public_server.php index bcefef985..5a4dde802 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -45,8 +45,8 @@ function public_server_register_account($a, $b) { $uid = $b; - $days = Config::get('public_server', 'expiredays'); - $days_posts = Config::get('public_server', 'expireposts'); + $days = DI::config()->get('public_server', 'expiredays'); + $days_posts = DI::config()->get('public_server', 'expireposts'); if (!$days) { return; } @@ -83,7 +83,7 @@ function public_server_cron($a, $b) } } - $nologin = Config::get('public_server', 'nologin', false); + $nologin = DI::config()->get('public_server', 'nologin', false); if ($nologin) { $r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` <= '%s' AND `register_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s'", DBA::NULL_DATETIME, intval($nologin), DBA::NULL_DATETIME); @@ -95,7 +95,7 @@ function public_server_cron($a, $b) } } - $flagusers = Config::get('public_server', 'flagusers', false); + $flagusers = DI::config()->get('public_server', 'flagusers', false); if ($flagusers) { $r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s' AND `page-flags` = 0", intval($flagusers), DBA::NULL_DATETIME); @@ -107,8 +107,8 @@ function public_server_cron($a, $b) } } - $flagposts = Config::get('public_server', 'flagposts'); - $flagpostsexpire = Config::get('public_server', 'flagpostsexpire'); + $flagposts = DI::config()->get('public_server', 'flagposts'); + $flagpostsexpire = DI::config()->get('public_server', 'flagpostsexpire'); if ($flagposts && $flagpostsexpire) { $r = q("SELECT `uid` FROM `user` WHERE NOT `account_expired` AND `login_date` < UTC_TIMESTAMP() - INTERVAL %d DAY AND `account_expires_on` <= '%s' and `expire` = 0 AND `page-flags` = 0", intval($flagposts), DBA::NULL_DATETIME); @@ -127,15 +127,15 @@ function public_server_enotify(&$a, &$b) if (!empty($b['params']) && $b['params']['type'] == NOTIFY_SYSTEM && !empty($b['params']['system_type']) && $b['params']['system_type'] === 'public_server_expire') { $b['itemlink'] = DI::baseUrl()->get(); - $b['epreamble'] = $b['preamble'] = DI::l10n()->t('Your account on %s will expire in a few days.', Config::get('system', 'sitename')); + $b['epreamble'] = $b['preamble'] = DI::l10n()->t('Your account on %s will expire in a few days.', DI::config()->get('system', 'sitename')); $b['subject'] = DI::l10n()->t('Your Friendica account is about to expire.'); - $b['body'] = DI::l10n()->t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days", $b['params']['to_name'], "[url=" . Config::get('system', 'url') . "]" . Config::get('config', 'sitename') . "[/url]"); + $b['body'] = DI::l10n()->t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days", $b['params']['to_name'], "[url=" . DI::config()->get('system', 'url') . "]" . DI::config()->get('config', 'sitename') . "[/url]"); } } function public_server_login($a, $b) { - $days = Config::get('public_server', 'expiredays'); + $days = DI::config()->get('public_server', 'expiredays'); if (!$days) { return; } @@ -171,11 +171,11 @@ function public_server_addon_admin(&$a, &$o) '$submit' => DI::l10n()->t('Save Settings'), '$form_security_token' => $token, '$infotext' => DI::l10n()->t('Set any of these options to 0 to deactivate it.'), - '$expiredays' => ["expiredays","Expire Days", intval(Config::get('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "], - '$expireposts' => ["expireposts", "Expire Posts", intval(Config::get('public_server', 'expireposts')), "Set the default days for posts to expire here"], - '$nologin' => ["nologin", "No Login", intval(Config::get('public_server', 'nologin')), "Remove users who have never logged in after nologin days "], - '$flagusers' => ["flagusers", "Flag users", intval(Config::get('public_server', 'flagusers')), "Remove users who last logged in over flagusers days ago"], - '$flagposts' => ["flagposts", "Flag posts", intval(Config::get('public_server', 'flagposts')), "For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire "], - '$flagpostsexpire' => ["flagpostsexpire", "Flag posts expire", intval(Config::get('public_server', 'flagpostsexpire'))], + '$expiredays' => ["expiredays","Expire Days", intval(DI::config()->get('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "], + '$expireposts' => ["expireposts", "Expire Posts", intval(DI::config()->get('public_server', 'expireposts')), "Set the default days for posts to expire here"], + '$nologin' => ["nologin", "No Login", intval(DI::config()->get('public_server', 'nologin')), "Remove users who have never logged in after nologin days "], + '$flagusers' => ["flagusers", "Flag users", intval(DI::config()->get('public_server', 'flagusers')), "Remove users who last logged in over flagusers days ago"], + '$flagposts' => ["flagposts", "Flag posts", intval(DI::config()->get('public_server', 'flagposts')), "For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire "], + '$flagpostsexpire' => ["flagpostsexpire", "Flag posts expire", intval(DI::config()->get('public_server', 'flagpostsexpire'))], ]); } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 90d396e00..5fed2fbeb 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -101,13 +101,13 @@ function pumpio_registerclient(App $a, $host) $params = []; - $application_name = Config::get('pumpio', 'application_name'); + $application_name = DI::config()->get('pumpio', 'application_name'); if ($application_name == "") { $application_name = DI::baseUrl()->getHostname(); } - $adminlist = explode(",", str_replace(" ", "", Config::get('config', 'admin_email'))); + $adminlist = explode(",", str_replace(" ", "", DI::config()->get('config', 'admin_email'))); $params["type"] = "client_associate"; $params["contacts"] = $adminlist[0]; @@ -686,9 +686,9 @@ function pumpio_sync(App $a) return; } - $last = Config::get('pumpio', 'last_poll'); + $last = DI::config()->get('pumpio', 'last_poll'); - $poll_interval = intval(Config::get('pumpio', 'poll_interval', PUMPIO_DEFAULT_POLL_INTERVAL)); + $poll_interval = intval(DI::config()->get('pumpio', 'poll_interval', PUMPIO_DEFAULT_POLL_INTERVAL)); if ($last) { $next = $last + ($poll_interval * 60); @@ -707,7 +707,7 @@ function pumpio_sync(App $a) } } - $abandon_days = intval(Config::get('system', 'account_abandon_days')); + $abandon_days = intval(DI::config()->get('system', 'account_abandon_days')); if ($abandon_days < 1) { $abandon_days = 0; } @@ -768,7 +768,7 @@ function pumpio_fetchtimeline(App $a, $uid) // hostname of the node if neither one is set. $application_name = DI::pConfig()->get($uid, 'pumpio', 'application_name'); if ($application_name == "") { - $application_name = Config::get('pumpio', 'application_name'); + $application_name = DI::config()->get('pumpio', 'application_name'); } if ($application_name == "") { $application_name = DI::baseUrl()->getHostname(); diff --git a/pumpio/pumpio_sync.php b/pumpio/pumpio_sync.php index f59d621f4..d562f185e 100644 --- a/pumpio/pumpio_sync.php +++ b/pumpio/pumpio_sync.php @@ -9,7 +9,7 @@ function pumpio_sync_run(&$argv, &$argc) { if (function_exists('sys_getloadavg')) { $load = sys_getloadavg(); - if (intval($load[0]) > Config::get('system', 'maxloadavg', 50)) { + if (intval($load[0]) > DI::config()->get('system', 'maxloadavg', 50)) { Logger::log('system: load ' . $load[0] . ' too high. Pumpio sync deferred to next scheduled run.'); return; } diff --git a/remote_permissions/remote_permissions.php b/remote_permissions/remote_permissions.php index 506eb7220..134a09c02 100644 --- a/remote_permissions/remote_permissions.php +++ b/remote_permissions/remote_permissions.php @@ -31,7 +31,7 @@ function remote_permissions_settings(&$a,&$o) { if(! local_user()) return; - $global = Config::get("remote_perms", "global"); + $global = DI::config()->get("remote_perms", "global"); if($global == 1) return; @@ -69,7 +69,7 @@ function remote_permissions_content($a, $item_copy) { if($item_copy['uid'] != local_user()) return; - if(Config::get('remote_perms','global') == 0) { + if(DI::config()->get('remote_perms','global') == 0) { // Admin has set Individual choice. We need to find // the original poster. First, get the contact's info $r = q("SELECT nick, url FROM contact WHERE id = %d LIMIT 1", @@ -202,8 +202,8 @@ function remote_permissions_addon_admin(&$a, &$o){ $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/remote_permissions/" ); $o = Renderer::replaceMacros($t, [ '$submit' => DI::l10n()->t('Save Settings'), - '$global' => ['remotepermschoice', DI::l10n()->t('Global'), 1, DI::l10n()->t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1], - '$individual' => ['remotepermschoice', DI::l10n()->t('Individual'), 2, DI::l10n()->t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0] + '$global' => ['remotepermschoice', DI::l10n()->t('Global'), 1, DI::l10n()->t('The posts of every user on this server show the post recipients'), DI::config()->get('remote_perms', 'global') == 1], + '$individual' => ['remotepermschoice', DI::l10n()->t('Individual'), 2, DI::l10n()->t('Each user chooses whether his/her posts show the post recipients'), DI::config()->get('remote_perms', 'global') == 0] ]); } diff --git a/securemail/securemail.php b/securemail/securemail.php index ef8edb3c4..36f2ab5dc 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -89,14 +89,14 @@ function securemail_settings_post(App &$a, array &$b) info(DI::l10n()->t('Secure Mail Settings saved.') . EOL); if ($_POST['securemail-submit'] == DI::l10n()->t('Save and send test')) { - $sitename = Config::get('config', 'sitename'); + $sitename = DI::config()->get('config', 'sitename'); $hostname = DI::baseUrl()->getHostname(); if (strpos($hostname, ':')) { $hostname = substr($hostname, 0, strpos($hostname, ':')); } - $sender_email = Config::get('config', 'sender_email'); + $sender_email = DI::config()->get('config', 'sender_email'); if (empty($sender_email)) { $sender_email = 'noreply@' . $hostname; } diff --git a/statusnet/library/statusnetoauth.php b/statusnet/library/statusnetoauth.php index 27d91638b..8228f40d0 100644 --- a/statusnet/library/statusnetoauth.php +++ b/statusnet/library/statusnetoauth.php @@ -1,104 +1,104 @@ -get($this->host . 'statusnet/config.json'); - return $config->site->textlimit; - } - - function accessTokenURL() - { - return $this->host . 'oauth/access_token'; - } - - function authenticateURL() - { - return $this->host . 'oauth/authenticate'; - } - - function authorizeURL() - { - return $this->host . 'oauth/authorize'; - } - - function requestTokenURL() - { - return $this->host . 'oauth/request_token'; - } - - function __construct($apipath, $consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL) - { - parent::__construct($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret); - $this->host = $apipath; - } - - /** - * Make an HTTP request - * - * Copied here from the TwitterOAuth library and complemented by applying the proxy settings of Friendica - * - * @param string $method - * @param string $host - * @param string $path - * @param array $parameters - * - * @return array|object API results - */ - function http($url, $method, $postfields = NULL) - { - $this->http_info = []; - $ci = curl_init(); - /* Curl settings */ - $prx = Config::get('system', 'proxy'); - if (strlen($prx)) { - curl_setopt($ci, CURLOPT_HTTPPROXYTUNNEL, 1); - curl_setopt($ci, CURLOPT_PROXY, $prx); - $prxusr = Config::get('system', 'proxyuser'); - if (strlen($prxusr)) { - curl_setopt($ci, CURLOPT_PROXYUSERPWD, $prxusr); - } - } - curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent); - curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout); - curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout); - curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE); - curl_setopt($ci, CURLOPT_HTTPHEADER, ['Expect:']); - curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer); - curl_setopt($ci, CURLOPT_HEADERFUNCTION, [$this, 'getHeader']); - curl_setopt($ci, CURLOPT_HEADER, FALSE); - - switch ($method) { - case 'POST': - curl_setopt($ci, CURLOPT_POST, TRUE); - if (!empty($postfields)) { - curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields); - } - break; - case 'DELETE': - curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE'); - if (!empty($postfields)) { - $url = "{$url}?{$postfields}"; - } - } - - curl_setopt($ci, CURLOPT_URL, $url); - $response = curl_exec($ci); - $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE); - $this->http_info = array_merge($this->http_info, curl_getinfo($ci)); - $this->url = $url; - curl_close($ci); - return $response; - } -} +get($this->host . 'statusnet/config.json'); + return $config->site->textlimit; + } + + function accessTokenURL() + { + return $this->host . 'oauth/access_token'; + } + + function authenticateURL() + { + return $this->host . 'oauth/authenticate'; + } + + function authorizeURL() + { + return $this->host . 'oauth/authorize'; + } + + function requestTokenURL() + { + return $this->host . 'oauth/request_token'; + } + + function __construct($apipath, $consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL) + { + parent::__construct($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret); + $this->host = $apipath; + } + + /** + * Make an HTTP request + * + * Copied here from the TwitterOAuth library and complemented by applying the proxy settings of Friendica + * + * @param string $method + * @param string $host + * @param string $path + * @param array $parameters + * + * @return array|object API results + */ + function http($url, $method, $postfields = NULL) + { + $this->http_info = []; + $ci = curl_init(); + /* Curl settings */ + $prx = DI::config()->get('system', 'proxy'); + if (strlen($prx)) { + curl_setopt($ci, CURLOPT_HTTPPROXYTUNNEL, 1); + curl_setopt($ci, CURLOPT_PROXY, $prx); + $prxusr = DI::config()->get('system', 'proxyuser'); + if (strlen($prxusr)) { + curl_setopt($ci, CURLOPT_PROXYUSERPWD, $prxusr); + } + } + curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent); + curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout); + curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout); + curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE); + curl_setopt($ci, CURLOPT_HTTPHEADER, ['Expect:']); + curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer); + curl_setopt($ci, CURLOPT_HEADERFUNCTION, [$this, 'getHeader']); + curl_setopt($ci, CURLOPT_HEADER, FALSE); + + switch ($method) { + case 'POST': + curl_setopt($ci, CURLOPT_POST, TRUE); + if (!empty($postfields)) { + curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields); + } + break; + case 'DELETE': + curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE'); + if (!empty($postfields)) { + $url = "{$url}?{$postfields}"; + } + } + + curl_setopt($ci, CURLOPT_URL, $url); + $response = curl_exec($ci); + $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE); + $this->http_info = array_merge($this->http_info, curl_getinfo($ci)); + $this->url = $url; + curl_close($ci); + return $response; + } +} diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index a89f9cef7..c9fb437a8 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -151,7 +151,7 @@ function statusnet_settings_post(App $a, $post) * 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 ^^ */ - $globalsn = Config::get('statusnet', 'sites'); + $globalsn = DI::config()->get('statusnet', 'sites'); foreach ($globalsn as $asn) { if ($asn['apiurl'] == $_POST['statusnet-preconf-apiurl']) { $apibase = $asn['apiurl']; @@ -277,7 +277,7 @@ function statusnet_settings(App $a, &$s) /* * * * 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 * server OAuth credentials in the configuration. If so offer them @@ -690,7 +690,7 @@ function statusnet_addon_admin_post(App $a) function statusnet_addon_admin(App $a, &$o) { - $sites = Config::get('statusnet', 'sites'); + $sites = DI::config()->get('statusnet', 'sites'); $sitesform = []; if (is_array($sites)) { foreach ($sites as $id => $s) { @@ -766,9 +766,9 @@ function statusnet_prepare_body(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) { $poll_interval = STATUSNET_DEFAULT_POLL_INTERVAL; } @@ -790,7 +790,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) { $abandon_days = 0; } @@ -833,7 +833,7 @@ function statusnet_fetchtimeline(App $a, $uid) // hostname of the node if neither one is set. $application_name = DI::pConfig()->get($uid, 'statusnet', 'application_name'); if ($application_name == "") { - $application_name = Config::get('statusnet', 'application_name'); + $application_name = DI::config()->get('statusnet', 'application_name'); } if ($application_name == "") { $application_name = DI::baseUrl()->getHostname(); diff --git a/testdrive/testdrive.php b/testdrive/testdrive.php index 05be239ab..9f94b7c66 100644 --- a/testdrive/testdrive.php +++ b/testdrive/testdrive.php @@ -50,7 +50,7 @@ function testdrive_register_account($a,$b) { $uid = $b; - $days = Config::get('testdrive','expiredays'); + $days = DI::config()->get('testdrive','expiredays'); if(! $days) return; @@ -100,8 +100,8 @@ function testdrive_enotify(&$a, &$b) { if (!empty($b['params']) && $b['params']['type'] == NOTIFY_SYSTEM && !empty($b['params']['system_type']) && $b['params']['system_type'] === 'testdrive_expire') { $b['itemlink'] = DI::baseUrl()->get(); - $b['epreamble'] = $b['preamble'] = DI::l10n()->t('Your account on %s will expire in a few days.', Config::get('system', 'sitename')); + $b['epreamble'] = $b['preamble'] = DI::l10n()->t('Your account on %s will expire in a few days.', DI::config()->get('system', 'sitename')); $b['subject'] = DI::l10n()->t('Your Friendica 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()); } } diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index aff58f264..5d413412f 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -78,8 +78,8 @@ function tumblr_addon_admin(App $a, &$o) $o = Renderer::replaceMacros($t, [ '$submit' => DI::l10n()->t('Save Settings'), // name, label, value, help, [extra values] - '$consumer_key' => ['consumer_key', DI::l10n()->t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''], - '$consumer_secret' => ['consumer_secret', DI::l10n()->t('Consumer Secret'), Config::get('tumblr', 'consumer_secret' ), ''], + '$consumer_key' => ['consumer_key', DI::l10n()->t('Consumer Key'), DI::config()->get('tumblr', 'consumer_key' ), ''], + '$consumer_secret' => ['consumer_secret', DI::l10n()->t('Consumer Secret'), DI::config()->get('tumblr', 'consumer_secret' ), ''], ]); } @@ -103,8 +103,8 @@ function tumblr_connect(App $a) //require_once('addon/tumblr/tumblroauth/tumblroauth.php'); // Define the needed keys - $consumer_key = Config::get('tumblr', 'consumer_key'); - $consumer_secret = Config::get('tumblr', 'consumer_secret'); + $consumer_key = DI::config()->get('tumblr', 'consumer_key'); + $consumer_secret = DI::config()->get('tumblr', 'consumer_secret'); // 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 @@ -156,8 +156,8 @@ function tumblr_callback(App $a) //require_once('addon/tumblr/tumblroauth/tumblroauth.php'); // Define the needed keys - $consumer_key = Config::get('tumblr', 'consumer_key'); - $consumer_secret = Config::get('tumblr', 'consumer_secret'); + $consumer_key = DI::config()->get('tumblr', 'consumer_key'); + $consumer_secret = DI::config()->get('tumblr', 'consumer_secret'); // 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) @@ -263,8 +263,8 @@ function tumblr_settings(App $a, &$s) if (($oauth_token != "") && ($oauth_token_secret != "")) { $page = DI::pConfig()->get(local_user(), 'tumblr', 'page'); - $consumer_key = Config::get('tumblr', 'consumer_key'); - $consumer_secret = Config::get('tumblr', 'consumer_secret'); + $consumer_key = DI::config()->get('tumblr', 'consumer_key'); + $consumer_secret = DI::config()->get('tumblr', 'consumer_secret'); $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret); @@ -470,8 +470,8 @@ function tumblr_send(App $a, array &$b) { $params['caption'] = BBCode::convert("[quote]" . $siteinfo["description"] . "[/quote]", false, 4); } - $consumer_key = Config::get('tumblr','consumer_key'); - $consumer_secret = Config::get('tumblr','consumer_secret'); + $consumer_key = DI::config()->get('tumblr','consumer_key'); + $consumer_secret = DI::config()->get('tumblr','consumer_secret'); $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret); diff --git a/twitter/twitter.php b/twitter/twitter.php index b6da5e1a9..d9f086d53 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -166,8 +166,8 @@ function twitter_follow(App $a, array &$contact) $uid = $a->user["uid"]; - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); + $ckey = DI::config()->get('twitter', 'consumerkey'); + $csecret = DI::config()->get('twitter', 'consumersecret'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); @@ -240,8 +240,8 @@ function twitter_settings_post(App $a) if (isset($_POST['twitter-pin'])) { // if the user supplied us with a PIN from Twitter, let the magic of OAuth happen Logger::notice('got a Twitter PIN'); - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); + $ckey = DI::config()->get('twitter', 'consumerkey'); + $csecret = DI::config()->get('twitter', 'consumersecret'); // 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 // and secret to request a Access Token with the PIN @@ -292,8 +292,8 @@ function twitter_settings(App $a, &$s) * 2) If no OAuthtoken & stuff is present, generate button to get some * 3) Checkbox for "Send public notices (280 chars only) */ - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); + $ckey = DI::config()->get('twitter', 'consumerkey'); + $csecret = DI::config()->get('twitter', 'consumersecret'); $otoken = DI::pConfig()->get(local_user(), 'twitter', 'oauthtoken'); $osecret = DI::pConfig()->get(local_user(), 'twitter', 'oauthsecret'); @@ -472,8 +472,8 @@ function twitter_post_local(App $a, array &$b) function twitter_action(App $a, $uid, $pid, $action) { - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); + $ckey = DI::config()->get('twitter', 'consumerkey'); + $csecret = DI::config()->get('twitter', 'consumersecret'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); @@ -588,8 +588,8 @@ function twitter_post_hook(App $a, array &$b) DI::pConfig()->load($b['uid'], 'twitter'); - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); + $ckey = DI::config()->get('twitter', 'consumerkey'); + $csecret = DI::config()->get('twitter', 'consumersecret'); $otoken = DI::pConfig()->get($b['uid'], 'twitter', 'oauthtoken'); $osecret = DI::pConfig()->get($b['uid'], 'twitter', 'oauthsecret'); @@ -728,16 +728,16 @@ function twitter_addon_admin(App $a, &$o) $o = Renderer::replaceMacros($t, [ '$submit' => DI::l10n()->t('Save Settings'), // name, label, value, help, [extra values] - '$consumerkey' => ['consumerkey', DI::l10n()->t('Consumer key'), Config::get('twitter', 'consumerkey'), ''], - '$consumersecret' => ['consumersecret', DI::l10n()->t('Consumer secret'), Config::get('twitter', 'consumersecret'), ''], + '$consumerkey' => ['consumerkey', DI::l10n()->t('Consumer key'), DI::config()->get('twitter', 'consumerkey'), ''], + '$consumersecret' => ['consumersecret', DI::l10n()->t('Consumer secret'), DI::config()->get('twitter', 'consumersecret'), ''], ]); } 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) { $poll_interval = TWITTER_DEFAULT_POLL_INTERVAL; } @@ -759,7 +759,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) { $abandon_days = 0; } @@ -803,7 +803,7 @@ function twitter_cron(App $a) function twitter_expire(App $a) { - $days = Config::get('twitter', 'expire'); + $days = DI::config()->get('twitter', 'expire'); if ($days == 0) { return; @@ -929,13 +929,13 @@ function twitter_do_mirrorpost(App $a, $uid, $post) function twitter_fetchtimeline(App $a, $uid) { - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); + $ckey = DI::config()->get('twitter', 'consumerkey'); + $csecret = DI::config()->get('twitter', 'consumersecret'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); $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 == "") { $application_name = DI::baseUrl()->getHostname(); @@ -1095,8 +1095,8 @@ function twitter_fetch_contact($uid, $data, $create_user) function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "") { - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); + $ckey = DI::config()->get('twitter', 'consumerkey'); + $csecret = DI::config()->get('twitter', 'consumersecret'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); @@ -1619,8 +1619,8 @@ function twitter_fetchparentposts(App $a, $uid, $post, TwitterOAuth $connection, function twitter_fetchhometimeline(App $a, $uid) { - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); + $ckey = DI::config()->get('twitter', 'consumerkey'); + $csecret = DI::config()->get('twitter', 'consumersecret'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); $create_user = DI::pConfig()->get($uid, 'twitter', 'create_user'); @@ -1628,7 +1628,7 @@ function twitter_fetchhometimeline(App $a, $uid) 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 == "") { $application_name = DI::baseUrl()->getHostname(); @@ -1803,8 +1803,8 @@ function twitter_fetchhometimeline(App $a, $uid) function twitter_fetch_own_contact(App $a, $uid) { - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); + $ckey = DI::config()->get('twitter', 'consumerkey'); + $csecret = DI::config()->get('twitter', 'consumersecret'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); @@ -1878,8 +1878,8 @@ function twitter_is_retweet(App $a, $uid, $body) Logger::log('twitter_is_retweet: Retweeting id ' . $id . ' for user ' . $uid, Logger::DEBUG); - $ckey = Config::get('twitter', 'consumerkey'); - $csecret = Config::get('twitter', 'consumersecret'); + $ckey = DI::config()->get('twitter', 'consumerkey'); + $csecret = DI::config()->get('twitter', 'consumersecret'); $otoken = DI::pConfig()->get($uid, 'twitter', 'oauthtoken'); $osecret = DI::pConfig()->get($uid, 'twitter', 'oauthsecret'); diff --git a/twitter/twitter_sync.php b/twitter/twitter_sync.php index d320763ba..aec8ead00 100644 --- a/twitter/twitter_sync.php +++ b/twitter/twitter_sync.php @@ -11,7 +11,7 @@ function twitter_sync_run($argv, $argc) if (function_exists('sys_getloadavg')) { $load = sys_getloadavg(); - if (intval($load[0]) > Config::get('system', 'maxloadavg', 50)) { + if (intval($load[0]) > DI::config()->get('system', 'maxloadavg', 50)) { Logger::log('system: load ' . $load[0] . ' too high. Twitter sync deferred to next scheduled run.'); return; } diff --git a/webrtc/webrtc.php b/webrtc/webrtc.php index 23a29ed96..661ebbc16 100644 --- a/webrtc/webrtc.php +++ b/webrtc/webrtc.php @@ -29,7 +29,7 @@ function webrtc_addon_admin (&$a, &$o) { $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/webrtc/" ); $o = Renderer::replaceMacros( $t, [ '$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) { @@ -46,7 +46,7 @@ function webrtc_content(&$a) { $o = ''; /* landingpage to create chatrooms */ - $webrtcurl = Config::get('webrtc','webrtcurl'); + $webrtcurl = DI::config()->get('webrtc','webrtcurl'); /* embedd the landing page in an iframe */ $o .= '