From 9e1e088c098f1ab375b7cf849f97ec3398c3d1ae Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 10 Jul 2018 08:38:36 -0400 Subject: [PATCH] [various] Replace direct accesses to $a->config with Config::get --- morechoice/morechoice.php | 16 +++++++++------- notifyall/notifyall.php | 25 +++++++++++++------------ public_server/public_server.php | 2 +- pumpio/pumpio.php | 2 +- securemail/securemail.php | 5 +++-- testdrive/testdrive.php | 2 +- 6 files changed, 28 insertions(+), 24 deletions(-) diff --git a/morechoice/morechoice.php b/morechoice/morechoice.php index b8a170a1..0d929430 100644 --- a/morechoice/morechoice.php +++ b/morechoice/morechoice.php @@ -7,7 +7,9 @@ * - who takes no responsibility for any additional content which may appear herein * */ + use Friendica\Core\Addon; +use Friendica\Core\Config; function morechoice_install() { @@ -28,17 +30,17 @@ function morechoice_uninstall() { } -// We aren't going to bother translating these to other languages. +// We aren't going to bother translating these to other languages. function morechoice_gender_selector($a,&$b) { - if($a->config['system']['language'] == 'en') { + if(Config::get('system', 'language') == 'en') { $b[] = 'Androgyne'; - $b[] = 'Bear'; - $b[] = 'Bigender'; + $b[] = 'Bear'; + $b[] = 'Bigender'; $b[] = 'Cross dresser'; $b[] = 'Drag queen'; $b[] = 'Eunuch'; - $b[] = 'Faux queen'; + $b[] = 'Faux queen'; $b[] = 'Gender fluid'; $b[] = 'Kathoey'; $b[] = 'Lady'; @@ -59,7 +61,7 @@ function morechoice_gender_selector($a,&$b) { } function morechoice_sexpref_selector($a,&$b) { - if($a->config['system']['language'] == 'en') { + if(Config::get('system', 'language') == 'en') { $b[] = 'Girls with big tits'; $b[] = 'Millionaires'; $b[] = 'Guys with big schlongs'; @@ -114,7 +116,7 @@ function morechoice_sexpref_selector($a,&$b) { } function morechoice_marital_selector($a,&$b) { - if($a->config['system']['language'] == 'en') { + if(Config::get('system', 'language') == 'en') { $b[] = 'Married to my job'; $b[] = 'Polygamist'; $b[] = 'Half married'; diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index c58d8c8e..408e74a3 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -8,53 +8,54 @@ * Author: Rabuzarus (Port to Friendica) */ +use Friendica\App; use Friendica\Content\Text\BBCode; +use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Util\Emailer; -use Friendica\App; -function notifyall_install() +function notifyall_install() { logger("installed notifyall"); } -function notifyall_uninstall() +function notifyall_uninstall() { logger("removed notifyall"); } function notifyall_module() {} -function notifyall_addon_admin(App $a, &$o) +function notifyall_addon_admin(App $a, &$o) { $o = '
    ' . L10n::t('Send email to all members') . '
'; } -function notifyall_post(App $a) +function notifyall_post(App $a) { if(!is_site_admin()) { return; } $text = trim($_REQUEST['text']); - + if(! $text) { return; } - $sitename = $a->config['sitename']; + $sitename = Config::get('config', 'sitename'); - if (empty($a->config['admin_name'])) { + if (empty(Config::get('config', 'admin_name'))) { $sender_name = '"' . L10n::t('%s Administrator', $sitename) . '"'; } else { - $sender_name = '"' . L10n::t('%1$s, %2$s Administrator', $a->config['admin_name'], $sitename) . '"'; + $sender_name = '"' . L10n::t('%1$s, %2$s Administrator', Config::get('config', 'admin_name'), $sitename) . '"'; } - if (! x($a->config['sender_email'])) { + if (! x(Config::get('config', 'sender_email'))) { $sender_email = 'noreply@' . $a->get_hostname(); } else { - $sender_email = $a->config['sender_email']; + $sender_email = Config::get('config', 'sender_email'); } $subject = $_REQUEST['subject']; @@ -67,7 +68,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 = $a->config['admin_email']; + $email = Config::get('config', 'admin_email'); $email = "'" . str_replace([" ",","], ["","','"], $email) . "'"; } $sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : ''); diff --git a/public_server/public_server.php b/public_server/public_server.php index b33897a3..0469a576 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -124,7 +124,7 @@ function public_server_enotify(&$a, &$b) $b['itemlink'] = $a->get_baseurl(); $b['epreamble'] = $b['preamble'] = L10n::t('Your account on %s will expire in a few days.', Config::get('system', 'sitename')); $b['subject'] = L10n::t('Your Friendica account is about to expire.'); - $b['body'] = 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=" . $app->config["system"]["url"] . "]" . $app->config["sitename"] . "[/url]"); + $b['body'] = 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]"); } } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index c0d70e1c..9fc47974 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -103,7 +103,7 @@ function pumpio_registerclient(&$a, $host) $application_name = $a->get_hostname(); } - $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email'])); + $adminlist = explode(",", str_replace(" ", "", Config::get('config', 'admin_email'))); $params["type"] = "client_associate"; $params["contacts"] = $adminlist[0]; diff --git a/securemail/securemail.php b/securemail/securemail.php index d63c2ee9..87941e79 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -8,6 +8,7 @@ use Friendica\App; use Friendica\Core\Addon; +use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Util\Emailer; @@ -94,14 +95,14 @@ function securemail_settings_post(App &$a, array &$b){ info(L10n::t('Secure Mail Settings saved.') . EOL); if ($_POST['securemail-submit'] == L10n::t('Save and send test')) { - $sitename = $a->config['sitename']; + $sitename = Config::get('config', 'sitename'); $hostname = $a->get_hostname(); if (strpos($hostname, ':')) { $hostname = substr($hostname, 0, strpos($hostname, ':')); } - $sender_email = $a->config['sender_email']; + $sender_email = Config::get('config', 'sender_email'); if (empty($sender_email)) { $sender_email = 'noreply@' . $hostname; } diff --git a/testdrive/testdrive.php b/testdrive/testdrive.php index 2f778d57..da6dd702 100644 --- a/testdrive/testdrive.php +++ b/testdrive/testdrive.php @@ -100,6 +100,6 @@ function testdrive_enotify(&$a, &$b) { $b['itemlink'] = $a->get_baseurl(); $b['epreamble'] = $b['preamble'] = L10n::t('Your account on %s will expire in a few days.', Config::get('system', 'sitename')); $b['subject'] = L10n::t('Your Friendica test account is about to expire.'); - $b['body'] = 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 http://friendica.com.", $b['params']['to_name'], "[url=".$app->config["system"]["url"]."]".$app->config["sitename"]."[/url]", get_server()); + $b['body'] = 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 http://friendica.com.", $b['params']['to_name'], "[url=".Config::get('system', 'url')."]".Config::get('config', 'sitename')."[/url]", get_server()); } } -- 2.39.5