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

This commit is contained in:
nupplaPhil 2020-01-19 21:21:52 +01:00
parent 1ce63185ab
commit 75143e27b5
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
25 changed files with 75 additions and 75 deletions

View file

@ -115,7 +115,7 @@ function blackout_addon_admin_post (&$a) {
$begindate = trim($_POST['startdate']);
$enddate = trim($_POST['enddate']);
$url = trim($_POST['rurl']);
Config::set('blackout','begindate',$begindate);
Config::set('blackout','enddate',$enddate);
Config::set('blackout','url',$url);
DI::config()->set('blackout','begindate',$begindate);
DI::config()->set('blackout','enddate',$enddate);
DI::config()->set('blackout','url',$url);
}

View file

@ -40,9 +40,9 @@ function blockbot_addon_admin(&$a, &$o) {
}
function blockbot_addon_admin_post(&$a) {
Config::set('blockbot', 'good_crawlers', $_POST['good_crawlers'] ?? false);
Config::set('blockbot', 'block_gab', $_POST['block_gab'] ?? false);
Config::set('blockbot', 'training', $_POST['training'] ?? false);
DI::config()->set('blockbot', 'good_crawlers', $_POST['good_crawlers'] ?? false);
DI::config()->set('blockbot', 'block_gab', $_POST['block_gab'] ?? false);
DI::config()->set('blockbot', 'training', $_POST['training'] ?? false);
info(DI::l10n()->t('Settings updated.'). EOL);
}

View file

@ -88,8 +88,8 @@ function buffer_addon_admin_post(App $a)
$client_id = (!empty($_POST['client_id']) ? Strings::escapeTags(trim($_POST['client_id'])) : '');
$client_secret = (!empty($_POST['client_secret']) ? Strings::escapeTags(trim($_POST['client_secret'])) : '');
Config::set('buffer', 'client_id' , $client_id);
Config::set('buffer', 'client_secret', $client_secret);
DI::config()->set('buffer', 'client_id' , $client_id);
DI::config()->set('buffer', 'client_secret', $client_secret);
info(DI::l10n()->t('Settings updated.'). EOL);
}

View file

@ -69,8 +69,8 @@ function cookienotice_addon_admin_post(App $a)
}
if ($_POST['cookienotice-submit']) {
Config::set('cookienotice', 'text', trim(strip_tags($_POST['cookienotice-text'])));
Config::set('cookienotice', 'oktext', trim(strip_tags($_POST['cookienotice-oktext'])));
DI::config()->set('cookienotice', 'text', trim(strip_tags($_POST['cookienotice-text'])));
DI::config()->set('cookienotice', 'oktext', trim(strip_tags($_POST['cookienotice-oktext'])));
info(DI::l10n()->t('cookienotice Settings saved.'));
}
}

View file

@ -220,8 +220,8 @@ function curweather_addon_admin_post(App $a)
}
if (!empty($_POST['curweather-submit'])) {
Config::set('curweather', 'appid', trim($_POST['appid']));
Config::set('curweather', 'cachetime', trim($_POST['cachetime']));
DI::config()->set('curweather', 'appid', trim($_POST['appid']));
DI::config()->set('curweather', 'cachetime', trim($_POST['cachetime']));
info(DI::l10n()->t('Curweather settings saved.' . PHP_EOL));
}

View file

@ -101,9 +101,9 @@ function geocoordinates_addon_admin(&$a, &$o)
function geocoordinates_addon_admin_post(&$a)
{
$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'])) : '');
Config::set('geocoordinates', 'language', $language);
DI::config()->set('geocoordinates', 'language', $language);
info(DI::l10n()->t('Settings updated.') . EOL);
}

View file

@ -124,7 +124,7 @@ function gravatar_addon_admin_post (&$a) {
$default_avatar = (!empty($_POST['avatar']) ? Strings::escapeTags(trim($_POST['avatar'])) : 'identicon');
$rating = (!empty($_POST['rating']) ? Strings::escapeTags(trim($_POST['rating'])) : 'g');
Config::set('gravatar', 'default_avatar', $default_avatar);
Config::set('gravatar', 'rating', $rating);
DI::config()->set('gravatar', 'default_avatar', $default_avatar);
DI::config()->set('gravatar', 'rating', $rating);
info(DI::l10n()->t('Gravatar settings updated.') .EOL);
}

View file

@ -93,12 +93,12 @@ function impressum_addon_admin_post (&$a) {
$notes = (!empty($_POST['notes']) ? (trim($_POST['notes'])) : '');
$email = (!empty($_POST['email']) ? Strings::escapeTags(trim($_POST['email'])) : '');
$footer_text = (!empty($_POST['footer_text']) ? (trim($_POST['footer_text'])) : '');
Config::set('impressum','owner',strip_tags($owner));
Config::set('impressum','ownerprofile',strip_tags($ownerprofile));
Config::set('impressum','postal',strip_tags($postal));
Config::set('impressum','email',strip_tags($email));
Config::set('impressum','notes',strip_tags($notes));
Config::set('impressum','footer_text',strip_tags($footer_text));
DI::config()->set('impressum','owner',strip_tags($owner));
DI::config()->set('impressum','ownerprofile',strip_tags($ownerprofile));
DI::config()->set('impressum','postal',strip_tags($postal));
DI::config()->set('impressum','email',strip_tags($email));
DI::config()->set('impressum','notes',strip_tags($notes));
DI::config()->set('impressum','footer_text',strip_tags($footer_text));
info(DI::l10n()->t('Settings updated.'). EOL );
}
function impressum_addon_admin (&$a, &$o) {

View file

@ -131,8 +131,8 @@ function irc_addon_admin_post (&$a) {
return;
if($_POST['irc-submit']) {
Config::set('irc','autochans',trim($_POST['autochans']));
Config::set('irc','sitechats',trim($_POST['sitechats']));
DI::config()->set('irc','autochans',trim($_POST['autochans']));
DI::config()->set('irc','sitechats',trim($_POST['sitechats']));
/* stupid pop-up thing */
info(DI::l10n()->t('IRC settings saved.') . EOL);
}

View file

@ -88,7 +88,7 @@ function jappixmini_install()
// set standard configuration
$info_text = DI::config()->get("jappixmini", "infotext");
if (!$info_text)
Config::set("jappixmini", "infotext", "To get the chat working, you need to know a BOSH host which works with your Jabber account. " .
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 " .
"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!"
@ -96,13 +96,13 @@ function jappixmini_install()
$bosh_proxy = DI::config()->get("jappixmini", "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
$addon_version = DI::config()->get("jappixmini", "version");
if ($addon_version === "") {
Config::set("jappixmini", "version", "1");
DI::config()->set("jappixmini", "version", "1");
}
}
@ -173,11 +173,11 @@ function jappixmini_addon_admin_post(App $a)
$default_user = intval($_REQUEST['jappixmini-defaultuser']);
$bosh_address = $_REQUEST['jappixmini-address'];
$default_server = $_REQUEST['jappixmini-server'];
Config::set("jappixmini", "infotext", $info_text);
Config::set("jappixmini", "bosh_proxy", $bosh_proxy);
Config::set("jappixmini", "bosh_address", $bosh_address);
Config::set("jappixmini", "default_server", $default_server);
Config::set("jappixmini", "default_user", $default_user);
DI::config()->set("jappixmini", "infotext", $info_text);
DI::config()->set("jappixmini", "bosh_proxy", $bosh_proxy);
DI::config()->set("jappixmini", "bosh_address", $bosh_address);
DI::config()->set("jappixmini", "default_server", $default_server);
DI::config()->set("jappixmini", "default_user", $default_user);
}
}
@ -580,7 +580,7 @@ function jappixmini_login(App $a, &$o)
function jappixmini_cron(App $a, $d)
{
// 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
$users = q("SELECT `uid` FROM `pconfig` WHERE `cat`='jappixmini' AND (`k`='autosubscribe' OR `k`='autoapprove') AND `v`='1'");

View file

@ -126,7 +126,7 @@ function leistungsschutzrecht_fetchsites()
*/
if (sizeof($sites)) {
Config::set('leistungsschutzrecht','sites',$sites);
DI::config()->set('leistungsschutzrecht','sites',$sites);
}
}
@ -171,6 +171,6 @@ function leistungsschutzrecht_cron($a,$b) {
}
}
leistungsschutzrecht_fetchsites();
Config::set('leistungsschutzrecht','last_poll', time());
DI::config()->set('leistungsschutzrecht','last_poll', time());
}
?>

View file

@ -126,6 +126,6 @@ function libravatar_addon_admin_post(&$a)
BaseModule::checkFormSecurityToken('libravatarrsave');
$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);
}

View file

@ -29,23 +29,23 @@ function mailstream_install() {
q('ALTER TABLE `mailstream_item` DROP INDEX `contact-id`');
q('ALTER TABLE `mailstream_item` DROP INDEX `plink`');
q('ALTER TABLE `mailstream_item` CHANGE `plink` `uri` char(255) NOT NULL');
Config::set('mailstream', 'dbversion', '0.2');
DI::config()->set('mailstream', 'dbversion', '0.2');
}
if (DI::config()->get('mailstream', 'dbversion') == '0.2') {
q('DELETE FROM `pconfig` WHERE `cat` = "mailstream" AND `k` = "delay"');
Config::set('mailstream', 'dbversion', '0.3');
DI::config()->set('mailstream', 'dbversion', '0.3');
}
if (DI::config()->get('mailstream', 'dbversion') == '0.3') {
q('ALTER TABLE `mailstream_item` CHANGE `created` `created` timestamp NOT NULL DEFAULT now()');
q('ALTER TABLE `mailstream_item` CHANGE `completed` `completed` timestamp NULL DEFAULT NULL');
Config::set('mailstream', 'dbversion', '0.4');
DI::config()->set('mailstream', 'dbversion', '0.4');
}
if (DI::config()->get('mailstream', 'dbversion') == '0.4') {
q('ALTER TABLE `mailstream_item` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin');
Config::set('mailstream', 'dbversion', '0.5');
DI::config()->set('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 (DI::config()->get('retriever', 'dbversion') != '1.0') {
@ -54,7 +54,7 @@ function mailstream_install() {
foreach ($arr as $a) {
$r = q($a);
}
Config::set('mailstream', 'dbversion', '1.0');
DI::config()->set('mailstream', 'dbversion', '1.0');
}
}
@ -87,7 +87,7 @@ function mailstream_addon_admin(&$a,&$o) {
function mailstream_addon_admin_post ($a) {
if (!empty($_POST['frommail'])) {
Config::set('mailstream', 'frommail', $_POST['frommail']);
DI::config()->set('mailstream', 'frommail', $_POST['frommail']);
}
}

View file

@ -58,10 +58,10 @@ function newmemberwidget_addon_admin_post(&$a)
$lsn = (!empty($_POST['localsupportname']) ? Strings::escapeTags(trim($_POST['localsupportname'])) : "");
$gs = intval($_POST['linkglobalsupport']);
$ls = intval($_POST['linklocalsupport']);
Config::set('newmemberwidget', 'freetext', trim($ft));
Config::set('newmemberwidget', 'linkglobalsupport', $gs);
Config::set('newmemberwidget', 'linklocalsupport', $ls);
Config::set('newmemberwidget', 'localsupport', trim($lsn));
DI::config()->set('newmemberwidget', 'freetext', trim($ft));
DI::config()->set('newmemberwidget', 'linkglobalsupport', $gs);
DI::config()->set('newmemberwidget', 'linklocalsupport', $ls);
DI::config()->set('newmemberwidget', 'localsupport', trim($lsn));
}
function newmemberwidget_addon_admin(&$a, &$o)

View file

@ -220,10 +220,10 @@ function openstreetmap_addon_admin_post(&$a)
$zoom = ($_POST['zoom'] ?? '') ?: OSM_ZOOM;
$marker = ($_POST['marker'] ?? '') ?: OSM_MARKER;
Config::set('openstreetmap', 'tmsserver', $urltms);
Config::set('openstreetmap', 'nomserver', $urlnom);
Config::set('openstreetmap', 'zoom', $zoom);
Config::set('openstreetmap', 'marker', $marker);
DI::config()->set('openstreetmap', 'tmsserver', $urltms);
DI::config()->set('openstreetmap', 'nomserver', $urlnom);
DI::config()->set('openstreetmap', 'zoom', $zoom);
DI::config()->set('openstreetmap', 'marker', $marker);
info(DI::l10n()->t('Settings updated.') . EOL);
}

View file

@ -50,7 +50,7 @@ function pageheader_addon_admin_post(App $a)
if(!empty($_POST['pageheader-submit'])) {
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.'));
}

View file

@ -114,9 +114,9 @@ function piwik_addon_admin_post (&$a) {
$id = (!empty($_POST['siteid']) ? trim($_POST['siteid']) : '');
$optout = (!empty($_POST['optout']) ? trim($_POST['optout']) : '');
$async = (!empty($_POST['async']) ? trim($_POST['async']) : '');
Config::set('piwik', 'baseurl', $url);
Config::set('piwik', 'siteid', $id);
Config::set('piwik', 'optout', $optout);
Config::set('piwik', 'async', $async);
DI::config()->set('piwik', 'baseurl', $url);
DI::config()->set('piwik', 'siteid', $id);
DI::config()->set('piwik', 'optout', $optout);
DI::config()->set('piwik', 'async', $async);
info(DI::l10n()->t('Settings updated.'). EOL);
}

View file

@ -154,12 +154,12 @@ function public_server_addon_admin_post(&$a)
$flagusers = (!empty($_POST['flagusers']) ? Strings::escapeTags(trim($_POST['flagusers'])) : '');
$flagposts = (!empty($_POST['flagposts']) ? Strings::escapeTags(trim($_POST['flagposts'])) : '');
$flagpostsexpire = (!empty($_POST['flagpostsexpire']) ? Strings::escapeTags(trim($_POST['flagpostsexpire'])) : '');
Config::set('public_server', 'expiredays', $expiredays);
Config::set('public_server', 'expireposts', $expireposts);
Config::set('public_server', 'nologin', $nologin);
Config::set('public_server', 'flagusers', $flagusers);
Config::set('public_server', 'flagposts', $flagposts);
Config::set('public_server', 'flagpostsexpire', $flagpostsexpire);
DI::config()->set('public_server', 'expiredays', $expiredays);
DI::config()->set('public_server', 'expireposts', $expireposts);
DI::config()->set('public_server', 'nologin', $nologin);
DI::config()->set('public_server', 'flagusers', $flagusers);
DI::config()->set('public_server', 'flagposts', $flagposts);
DI::config()->set('public_server', 'flagpostsexpire', $flagpostsexpire);
info(DI::l10n()->t('Settings saved').EOL);
}

View file

@ -745,7 +745,7 @@ function pumpio_sync(App $a)
Logger::log('pumpio: cron_end');
Config::set('pumpio', 'last_poll', time());
DI::config()->set('pumpio', 'last_poll', time());
}
function pumpio_cron(App $a, $b)

View file

@ -209,6 +209,6 @@ function remote_permissions_addon_admin(&$a, &$o){
function remote_permissions_addon_admin_post(&$a){
$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);
}

View file

@ -685,7 +685,7 @@ 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)
@ -815,7 +815,7 @@ function statusnet_cron(App $a, $b)
Logger::log('statusnet: cron_end');
Config::set('statusnet', 'last_poll', time());
DI::config()->set('statusnet', 'last_poll', time());
}
function statusnet_fetchtimeline(App $a, $uid)

View file

@ -88,8 +88,8 @@ function tumblr_addon_admin_post(App $a)
$consumer_key = (!empty($_POST['consumer_key']) ? Strings::escapeTags(trim($_POST['consumer_key'])) : '');
$consumer_secret = (!empty($_POST['consumer_secret']) ? Strings::escapeTags(trim($_POST['consumer_secret'])): '');
Config::set('tumblr', 'consumer_key',$consumer_key);
Config::set('tumblr', 'consumer_secret',$consumer_secret);
DI::config()->set('tumblr', 'consumer_key',$consumer_key);
DI::config()->set('tumblr', 'consumer_secret',$consumer_secret);
info(DI::l10n()->t('Settings updated.'). EOL);
}

View file

@ -699,7 +699,7 @@ function twitter_post_hook(App $a, array &$b)
Logger::info('twitter_post send', ['id' => $b['id'], 'result' => $result]);
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)) {
@ -716,8 +716,8 @@ function twitter_addon_admin_post(App $a)
{
$consumerkey = !empty($_POST['consumerkey']) ? Strings::escapeTags(trim($_POST['consumerkey'])) : '';
$consumersecret = !empty($_POST['consumersecret']) ? Strings::escapeTags(trim($_POST['consumersecret'])) : '';
Config::set('twitter', 'consumerkey', $consumerkey);
Config::set('twitter', 'consumersecret', $consumersecret);
DI::config()->set('twitter', 'consumerkey', $consumerkey);
DI::config()->set('twitter', 'consumersecret', $consumersecret);
info(DI::l10n()->t('Settings updated.') . EOL);
}
@ -798,7 +798,7 @@ function twitter_cron(App $a)
Logger::notice('twitter: cron_end');
Config::set('twitter', 'last_poll', time());
DI::config()->set('twitter', 'last_poll', time());
}
function twitter_expire(App $a)

View file

@ -34,7 +34,7 @@ function webrtc_addon_admin (&$a, &$o) {
}
function webrtc_addon_admin_post (&$a) {
$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);
}

View file

@ -120,8 +120,8 @@ function xmpp_addon_admin_post()
$bosh_proxy = (!empty($_POST['bosh_proxy']) ? trim($_POST['bosh_proxy']) : '');
$central_userbase = (!empty($_POST['central_userbase']) ? intval($_POST['central_userbase']) : false);
Config::set('xmpp', 'bosh_proxy', $bosh_proxy);
Config::set('xmpp', 'central_userbase', $central_userbase);
DI::config()->set('xmpp', 'bosh_proxy', $bosh_proxy);
DI::config()->set('xmpp', 'central_userbase', $central_userbase);
info(DI::l10n()->t('Settings updated.') . EOL);
}