[various] Replace direct accesses to $a->config with Config::get

This commit is contained in:
Hypolite Petovan 2018-07-10 08:38:36 -04:00
parent d96370bfad
commit 9e1e088c09
6 changed files with 28 additions and 24 deletions

View file

@ -7,7 +7,9 @@
* - who takes no responsibility for any additional content which may appear herein * - who takes no responsibility for any additional content which may appear herein
* *
*/ */
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config;
function morechoice_install() { function morechoice_install() {
@ -31,7 +33,7 @@ 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) { function morechoice_gender_selector($a,&$b) {
if($a->config['system']['language'] == 'en') { if(Config::get('system', 'language') == 'en') {
$b[] = 'Androgyne'; $b[] = 'Androgyne';
$b[] = 'Bear'; $b[] = 'Bear';
$b[] = 'Bigender'; $b[] = 'Bigender';
@ -59,7 +61,7 @@ function morechoice_gender_selector($a,&$b) {
} }
function morechoice_sexpref_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[] = 'Girls with big tits';
$b[] = 'Millionaires'; $b[] = 'Millionaires';
$b[] = 'Guys with big schlongs'; $b[] = 'Guys with big schlongs';
@ -114,7 +116,7 @@ function morechoice_sexpref_selector($a,&$b) {
} }
function morechoice_marital_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[] = 'Married to my job';
$b[] = 'Polygamist'; $b[] = 'Polygamist';
$b[] = 'Half married'; $b[] = 'Half married';

View file

@ -8,10 +8,11 @@
* Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus> (Port to Friendica) * Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus> (Port to Friendica)
*/ */
use Friendica\App;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Util\Emailer; use Friendica\Util\Emailer;
use Friendica\App;
function notifyall_install() function notifyall_install()
{ {
@ -43,18 +44,18 @@ function notifyall_post(App $a)
return; 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) . '"'; $sender_name = '"' . L10n::t('%s Administrator', $sitename) . '"';
} else { } 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(); $sender_email = 'noreply@' . $a->get_hostname();
} else { } else {
$sender_email = $a->config['sender_email']; $sender_email = Config::get('config', 'sender_email');
} }
$subject = $_REQUEST['subject']; $subject = $_REQUEST['subject'];
@ -67,7 +68,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 = $a->config['admin_email']; $email = 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

@ -124,7 +124,7 @@ function public_server_enotify(&$a, &$b)
$b['itemlink'] = $a->get_baseurl(); $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['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['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]");
} }
} }

View file

@ -103,7 +103,7 @@ function pumpio_registerclient(&$a, $host)
$application_name = $a->get_hostname(); $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["type"] = "client_associate";
$params["contacts"] = $adminlist[0]; $params["contacts"] = $adminlist[0];

View file

@ -8,6 +8,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Util\Emailer; use Friendica\Util\Emailer;
@ -94,14 +95,14 @@ function securemail_settings_post(App &$a, array &$b){
info(L10n::t('Secure Mail Settings saved.') . EOL); info(L10n::t('Secure Mail Settings saved.') . EOL);
if ($_POST['securemail-submit'] == L10n::t('Save and send test')) { if ($_POST['securemail-submit'] == L10n::t('Save and send test')) {
$sitename = $a->config['sitename']; $sitename = Config::get('config', 'sitename');
$hostname = $a->get_hostname(); $hostname = $a->get_hostname();
if (strpos($hostname, ':')) { if (strpos($hostname, ':')) {
$hostname = substr($hostname, 0, 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)) { if (empty($sender_email)) {
$sender_email = 'noreply@' . $hostname; $sender_email = 'noreply@' . $hostname;
} }

View file

@ -100,6 +100,6 @@ function testdrive_enotify(&$a, &$b) {
$b['itemlink'] = $a->get_baseurl(); $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['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['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());
} }
} }