Move PConfig::get() to DI::pConfig()->get()

This commit is contained in:
Philipp Holzer 2020-01-18 16:50:57 +01:00
parent 6e2880c679
commit 9e9429b56d
No known key found for this signature in database
GPG Key ID: D8365C3D36B77D90
61 changed files with 190 additions and 179 deletions

View File

@ -322,7 +322,7 @@ function info($s)
{ {
$a = DI::app(); $a = DI::app();
if (local_user() && PConfig::get(local_user(), 'system', 'ignore_info')) { if (local_user() && DI::pConfig()->get(local_user(), 'system', 'ignore_info')) {
return; return;
} }

View File

@ -137,7 +137,7 @@ Now that this information is set in the database, what should friendica do with
For this, have a look at the theme.php file of the *duepunto zero*. For this, have a look at the theme.php file of the *duepunto zero*.
There you'll find somethink alike There you'll find somethink alike
$colorset = PConfig::get( local_user(), 'duepuntozero','colorset'); $colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset');
if (!$colorset) if (!$colorset)
$colorset = Config::get('duepuntozero', 'colorset'); $colorset = Config::get('duepuntozero', 'colorset');
if ($colorset) { if ($colorset) {

View File

@ -728,7 +728,7 @@ function api_get_user(App $a, $contact_id = null)
if ($ret['self']) { if ($ret['self']) {
$theme_info = DBA::selectFirst('user', ['theme'], ['uid' => $ret['uid']]); $theme_info = DBA::selectFirst('user', ['theme'], ['uid' => $ret['uid']]);
if ($theme_info['theme'] === 'frio') { if ($theme_info['theme'] === 'frio') {
$schema = PConfig::get($ret['uid'], 'frio', 'schema'); $schema = DI::pConfig()->get($ret['uid'], 'frio', 'schema');
if ($schema && ($schema != '---')) { if ($schema && ($schema != '---')) {
if (file_exists('view/theme/frio/schema/'.$schema.'.php')) { if (file_exists('view/theme/frio/schema/'.$schema.'.php')) {
@ -736,9 +736,9 @@ function api_get_user(App $a, $contact_id = null)
require_once $schemefile; require_once $schemefile;
} }
} else { } else {
$nav_bg = PConfig::get($ret['uid'], 'frio', 'nav_bg'); $nav_bg = DI::pConfig()->get($ret['uid'], 'frio', 'nav_bg');
$link_color = PConfig::get($ret['uid'], 'frio', 'link_color'); $link_color = DI::pConfig()->get($ret['uid'], 'frio', 'link_color');
$bgcolor = PConfig::get($ret['uid'], 'frio', 'background_color'); $bgcolor = DI::pConfig()->get($ret['uid'], 'frio', 'background_color');
} }
if (empty($nav_bg)) { if (empty($nav_bg)) {
$nav_bg = "#708fa0"; $nav_bg = "#708fa0";

View File

@ -419,7 +419,7 @@ function conv_get_blocklist()
return []; return [];
} }
$str_blocked = PConfig::get(local_user(), 'system', 'blocked'); $str_blocked = DI::pConfig()->get(local_user(), 'system', 'blocked');
if (empty($str_blocked)) { if (empty($str_blocked)) {
return []; return [];
} }
@ -666,7 +666,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item); list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item);
if (!empty($item['content-warning']) && PConfig::get(local_user(), 'system', 'disable_cw', false)) { if (!empty($item['content-warning']) && DI::pConfig()->get(local_user(), 'system', 'disable_cw', false)) {
$title = ucfirst($item['content-warning']); $title = ucfirst($item['content-warning']);
} else { } else {
$title = $item['title']; $title = $item['title'];
@ -1469,7 +1469,7 @@ function conv_sort(array $item_list, $order)
$parents[$i]['children'] = sort_item_children($parents[$i]['children']); $parents[$i]['children'] = sort_item_children($parents[$i]['children']);
} }
if (!PConfig::get(local_user(), 'system', 'no_smart_threading', 0)) { if (!DI::pConfig()->get(local_user(), 'system', 'no_smart_threading', 0)) {
foreach ($parents as $i => $parent) { foreach ($parents as $i => $parent) {
$parents[$i] = smart_flatten_conversation($parent); $parents[$i] = smart_flatten_conversation($parent);
} }

View File

@ -138,9 +138,9 @@ function community_content(App $a, $update = 0)
// check if we serve a mobile device and get the user settings accordingly // check if we serve a mobile device and get the user settings accordingly
if (DI::mode()->isMobile()) { if (DI::mode()->isMobile()) {
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network', 20); $itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network', 20);
} else { } else {
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_network', 40); $itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network', 40);
} }
// now that we have the user settings, see if the theme forces // now that we have the user settings, see if the theme forces

View File

@ -70,7 +70,7 @@ function network_init(App $a)
$sel_nets = $_GET['nets'] ?? ''; $sel_nets = $_GET['nets'] ?? '';
$sel_tabs = network_query_get_sel_tab($a); $sel_tabs = network_query_get_sel_tab($a);
$sel_groups = network_query_get_sel_group($a); $sel_groups = network_query_get_sel_group($a);
$last_sel_tabs = PConfig::get(local_user(), 'network.view', 'tab.selected'); $last_sel_tabs = DI::pConfig()->get(local_user(), 'network.view', 'tab.selected');
$remember_tab = ($sel_tabs[0] === 'active' && is_array($last_sel_tabs) && $last_sel_tabs[0] !== 'active'); $remember_tab = ($sel_tabs[0] === 'active' && is_array($last_sel_tabs) && $last_sel_tabs[0] !== 'active');
@ -219,10 +219,10 @@ function networkPager(App $a, Pager $pager, $update)
// check if we serve a mobile device and get the user settings // check if we serve a mobile device and get the user settings
// accordingly // accordingly
if (DI::mode()->isMobile()) { if (DI::mode()->isMobile()) {
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network'); $itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network');
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20); $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20);
} else { } else {
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_network'); $itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network');
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 40); $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 40);
} }
@ -282,7 +282,7 @@ function networkConversation(App $a, $items, Pager $pager, $mode, $update, $orde
$o = conversation($a, $items, $pager, $mode, $update, false, $ordering, local_user()); $o = conversation($a, $items, $pager, $mode, $update, false, $ordering, local_user());
if (!$update) { if (!$update) {
if (PConfig::get(local_user(), 'system', 'infinite_scroll')) { if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
$o .= HTML::scrollLoader(); $o .= HTML::scrollLoader();
} else { } else {
$o .= $pager->renderMinimal(count($items)); $o .= $pager->renderMinimal(count($items));
@ -491,7 +491,7 @@ function networkThreadedView(App $a, $update, $parent)
$tabs = network_tabs($a); $tabs = network_tabs($a);
$o .= $tabs; $o .= $tabs;
if ($gid && ($t = Contact::getOStatusCountByGroupId($gid)) && !PConfig::get(local_user(), 'system', 'nowarn_insecure')) { if ($gid && ($t = Contact::getOStatusCountByGroupId($gid)) && !DI::pConfig()->get(local_user(), 'system', 'nowarn_insecure')) {
notice(L10n::tt("Warning: This group contains %s member from a network that doesn't allow non public messages.", notice(L10n::tt("Warning: This group contains %s member from a network that doesn't allow non public messages.",
"Warning: This group contains %s members from a network that doesn't allow non public messages.", "Warning: This group contains %s members from a network that doesn't allow non public messages.",
$t) . EOL); $t) . EOL);
@ -612,7 +612,7 @@ function networkThreadedView(App $a, $update, $parent)
'id' => 'network', 'id' => 'network',
]) . $o; ]) . $o;
if ($contact['network'] === Protocol::OSTATUS && $contact['writable'] && !PConfig::get(local_user(),'system','nowarn_insecure')) { if ($contact['network'] === Protocol::OSTATUS && $contact['writable'] && !DI::pConfig()->get(local_user(),'system','nowarn_insecure')) {
notice(L10n::t('Private messages to this person are at risk of public disclosure.') . EOL); notice(L10n::t('Private messages to this person are at risk of public disclosure.') . EOL);
} }
} else { } else {
@ -770,7 +770,7 @@ function networkThreadedView(App $a, $update, $parent)
// When checking for updates we need to fetch from the newest date to the newest date before // When checking for updates we need to fetch from the newest date to the newest date before
// Only do this, when the last stored date isn't too long ago (10 times the update interval) // Only do this, when the last stored date isn't too long ago (10 times the update interval)
$browser_update = PConfig::get(local_user(), 'system', 'update_interval', 40000) / 1000; $browser_update = DI::pConfig()->get(local_user(), 'system', 'update_interval', 40000) / 1000;
if (($browser_update > 0) && $update && !empty($_SESSION['network_last_date']) && if (($browser_update > 0) && $update && !empty($_SESSION['network_last_date']) &&
(($bottom_limit < $_SESSION['network_last_date']) || ($top_limit == $bottom_limit)) && (($bottom_limit < $_SESSION['network_last_date']) || ($top_limit == $bottom_limit)) &&
@ -994,7 +994,7 @@ function network_infinite_scroll_head(App $a, &$htmlhead)
*/ */
global $pager; global $pager;
if (PConfig::get(local_user(), 'system', 'infinite_scroll') if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')
&& ($_GET['mode'] ?? '') != 'minimal' && ($_GET['mode'] ?? '') != 'minimal'
) { ) {
$tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl'); $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');

View File

@ -26,7 +26,7 @@ function ostatus_subscribe_content(App $a)
$counter = intval($_REQUEST['counter']); $counter = intval($_REQUEST['counter']);
if (PConfig::get($uid, 'ostatus', 'legacy_friends') == '') { if (DI::pConfig()->get($uid, 'ostatus', 'legacy_friends') == '') {
if ($_REQUEST['url'] == '') { if ($_REQUEST['url'] == '') {
PConfig::delete($uid, 'ostatus', 'legacy_contact'); PConfig::delete($uid, 'ostatus', 'legacy_contact');
@ -53,7 +53,7 @@ function ostatus_subscribe_content(App $a)
PConfig::set($uid, 'ostatus', 'legacy_friends', $curlResult->getBody()); PConfig::set($uid, 'ostatus', 'legacy_friends', $curlResult->getBody());
} }
$friends = json_decode(PConfig::get($uid, 'ostatus', 'legacy_friends')); $friends = json_decode(DI::pConfig()->get($uid, 'ostatus', 'legacy_friends'));
if (empty($friends)) { if (empty($friends)) {
$friends = []; $friends = [];

View File

@ -453,7 +453,7 @@ function ping_get_notifications($uid)
&& empty($result[$notification["parent"]]) && empty($result[$notification["parent"]])
) { ) {
// Should we condense the notifications or show them all? // Should we condense the notifications or show them all?
if (PConfig::get(local_user(), 'system', 'detailed_notif')) { if (DI::pConfig()->get(local_user(), 'system', 'detailed_notif')) {
$result[$notification["id"]] = $notification; $result[$notification["id"]] = $notification;
} else { } else {
$result[$notification["parent"]] = $notification; $result[$notification["parent"]] = $notification;

View File

@ -535,7 +535,7 @@ function profiles_content(App $a) {
$personal_account = !(in_array($a->user["page-flags"], $personal_account = !(in_array($a->user["page-flags"],
[User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP])); [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP]));
$detailed_profile = (PConfig::get(local_user(), 'system', 'detailled_profile') AND $personal_account); $detailed_profile = (DI::pConfig()->get(local_user(), 'system', 'detailled_profile') AND $personal_account);
$is_default = (($r[0]['is-default']) ? 1 : 0); $is_default = (($r[0]['is-default']) ? 1 : 0);
$tpl = Renderer::getMarkupTemplate("profile_edit.tpl"); $tpl = Renderer::getMarkupTemplate("profile_edit.tpl");

View File

@ -9,6 +9,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Content\Text\HTML; use Friendica\Content\Text\HTML;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Profile; use Friendica\Model\Profile;
function profperm_init(App $a) function profperm_init(App $a)
@ -41,7 +42,7 @@ function profperm_content(App $a) {
// Switch to text mod interface if we have more than 'n' contacts or group members // Switch to text mod interface if we have more than 'n' contacts or group members
$switchtotext = PConfig::get(local_user(),'system','groupedit_image_limit'); $switchtotext = DI::pConfig()->get(local_user(),'system','groupedit_image_limit');
if (is_null($switchtotext)) { if (is_null($switchtotext)) {
$switchtotext = Config::get('system','groupedit_image_limit', 400); $switchtotext = Config::get('system','groupedit_image_limit', 400);
} }

View File

@ -8,6 +8,7 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Protocol\ActivityNamespace; use Friendica\Protocol\ActivityNamespace;
use Friendica\Protocol\OStatus; use Friendica\Protocol\OStatus;
@ -158,7 +159,7 @@ function salmon_post(App $a, $xml = '') {
if (!DBA::isResult($r)) { if (!DBA::isResult($r)) {
Logger::log('Author ' . $author_link . ' unknown to user ' . $importer['uid'] . '.'); Logger::log('Author ' . $author_link . ' unknown to user ' . $importer['uid'] . '.');
if (PConfig::get($importer['uid'], 'system', 'ostatus_autofriend')) { if (DI::pConfig()->get($importer['uid'], 'system', 'ostatus_autofriend')) {
$result = Contact::createFromProbe($importer['uid'], $author_link); $result = Contact::createFromProbe($importer['uid'], $author_link);
if ($result['success']) { if ($result['success']) {

View File

@ -776,13 +776,13 @@ function settings_content(App $a)
} }
if (($a->argc > 1) && ($a->argv[1] === 'connectors')) { if (($a->argc > 1) && ($a->argv[1] === 'connectors')) {
$accept_only_sharer = intval(PConfig::get(local_user(), 'system', 'accept_only_sharer')); $accept_only_sharer = intval(DI::pConfig()->get(local_user(), 'system', 'accept_only_sharer'));
$disable_cw = intval(PConfig::get(local_user(), 'system', 'disable_cw')); $disable_cw = intval(DI::pConfig()->get(local_user(), 'system', 'disable_cw'));
$no_intelligent_shortening = intval(PConfig::get(local_user(), 'system', 'no_intelligent_shortening')); $no_intelligent_shortening = intval(DI::pConfig()->get(local_user(), 'system', 'no_intelligent_shortening'));
$attach_link_title = intval(PConfig::get(local_user(), 'system', 'attach_link_title')); $attach_link_title = intval(DI::pConfig()->get(local_user(), 'system', 'attach_link_title'));
$ostatus_autofriend = intval(PConfig::get(local_user(), 'system', 'ostatus_autofriend')); $ostatus_autofriend = intval(DI::pConfig()->get(local_user(), 'system', 'ostatus_autofriend'));
$default_group = PConfig::get(local_user(), 'ostatus', 'default_group'); $default_group = DI::pConfig()->get(local_user(), 'ostatus', 'default_group');
$legacy_contact = PConfig::get(local_user(), 'ostatus', 'legacy_contact'); $legacy_contact = DI::pConfig()->get(local_user(), 'ostatus', 'legacy_contact');
if (!empty($legacy_contact)) { if (!empty($legacy_contact)) {
/// @todo Isn't it supposed to be a $a->internalRedirect() call? /// @todo Isn't it supposed to be a $a->internalRedirect() call?
@ -915,27 +915,27 @@ function settings_content(App $a)
$theme_selected = $a->user['theme'] ?: $default_theme; $theme_selected = $a->user['theme'] ?: $default_theme;
$mobile_theme_selected = Session::get('mobile-theme', $default_mobile_theme); $mobile_theme_selected = Session::get('mobile-theme', $default_mobile_theme);
$nowarn_insecure = intval(PConfig::get(local_user(), 'system', 'nowarn_insecure')); $nowarn_insecure = intval(DI::pConfig()->get(local_user(), 'system', 'nowarn_insecure'));
$browser_update = intval(PConfig::get(local_user(), 'system', 'update_interval')); $browser_update = intval(DI::pConfig()->get(local_user(), 'system', 'update_interval'));
if (intval($browser_update) != -1) { if (intval($browser_update) != -1) {
$browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds $browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds
} }
$itemspage_network = intval(PConfig::get(local_user(), 'system', 'itemspage_network')); $itemspage_network = intval(DI::pConfig()->get(local_user(), 'system', 'itemspage_network'));
$itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items $itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items
$itemspage_mobile_network = intval(PConfig::get(local_user(), 'system', 'itemspage_mobile_network')); $itemspage_mobile_network = intval(DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network'));
$itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : 20); // default if not set: 20 items $itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : 20); // default if not set: 20 items
$nosmile = PConfig::get(local_user(), 'system', 'no_smilies', 0); $nosmile = DI::pConfig()->get(local_user(), 'system', 'no_smilies', 0);
$first_day_of_week = PConfig::get(local_user(), 'system', 'first_day_of_week', 0); $first_day_of_week = DI::pConfig()->get(local_user(), 'system', 'first_day_of_week', 0);
$weekdays = [0 => L10n::t("Sunday"), 1 => L10n::t("Monday")]; $weekdays = [0 => L10n::t("Sunday"), 1 => L10n::t("Monday")];
$noinfo = PConfig::get(local_user(), 'system', 'ignore_info', 0); $noinfo = DI::pConfig()->get(local_user(), 'system', 'ignore_info', 0);
$infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll', 0); $infinite_scroll = DI::pConfig()->get(local_user(), 'system', 'infinite_scroll', 0);
$no_auto_update = PConfig::get(local_user(), 'system', 'no_auto_update', 0); $no_auto_update = DI::pConfig()->get(local_user(), 'system', 'no_auto_update', 0);
$bandwidth_saver = PConfig::get(local_user(), 'system', 'bandwidth_saver', 0); $bandwidth_saver = DI::pConfig()->get(local_user(), 'system', 'bandwidth_saver', 0);
$no_smart_threading = PConfig::get(local_user(), 'system', 'no_smart_threading', 0); $no_smart_threading = DI::pConfig()->get(local_user(), 'system', 'no_smart_threading', 0);
$theme_config = ""; $theme_config = "";
if (($themeconfigfile = get_theme_config_file($theme_selected)) !== null) { if (($themeconfigfile = get_theme_config_file($theme_selected)) !== null) {
@ -1000,12 +1000,12 @@ function settings_content(App $a)
$unkmail = $a->user['unkmail']; $unkmail = $a->user['unkmail'];
$cntunkmail = $a->user['cntunkmail']; $cntunkmail = $a->user['cntunkmail'];
$expire_items = PConfig::get(local_user(), 'expire', 'items', true); $expire_items = DI::pConfig()->get(local_user(), 'expire', 'items', true);
$expire_notes = PConfig::get(local_user(), 'expire', 'notes', true); $expire_notes = DI::pConfig()->get(local_user(), 'expire', 'notes', true);
$expire_starred = PConfig::get(local_user(), 'expire', 'starred', true); $expire_starred = DI::pConfig()->get(local_user(), 'expire', 'starred', true);
$expire_photos = PConfig::get(local_user(), 'expire', 'photos', false); $expire_photos = DI::pConfig()->get(local_user(), 'expire', 'photos', false);
$expire_network_only = PConfig::get(local_user(), 'expire', 'network_only', false); $expire_network_only = DI::pConfig()->get(local_user(), 'expire', 'network_only', false);
$suggestme = PConfig::get(local_user(), 'system', 'suggestme', false); $suggestme = DI::pConfig()->get(local_user(), 'system', 'suggestme', false);
// nowarn_insecure // nowarn_insecure
@ -1244,11 +1244,11 @@ function settings_content(App $a)
'$desktop_notifications' => ['desktop_notifications', L10n::t('Activate desktop notifications') , false, L10n::t('Show desktop popup on new notifications')], '$desktop_notifications' => ['desktop_notifications', L10n::t('Activate desktop notifications') , false, L10n::t('Show desktop popup on new notifications')],
'$email_textonly' => ['email_textonly', L10n::t('Text-only notification emails'), '$email_textonly' => ['email_textonly', L10n::t('Text-only notification emails'),
PConfig::get(local_user(), 'system', 'email_textonly'), DI::pConfig()->get(local_user(), 'system', 'email_textonly'),
L10n::t('Send text only notification emails, without the html part')], L10n::t('Send text only notification emails, without the html part')],
'$detailed_notif' => ['detailed_notif', L10n::t('Show detailled notifications'), '$detailed_notif' => ['detailed_notif', L10n::t('Show detailled notifications'),
PConfig::get(local_user(), 'system', 'detailed_notif'), DI::pConfig()->get(local_user(), 'system', 'detailed_notif'),
L10n::t('Per default, notifications are condensed to a single notification per item. When enabled every notification is displayed.')], L10n::t('Per default, notifications are condensed to a single notification per item. When enabled every notification is displayed.')],
'$h_advn' => L10n::t('Advanced Account/Page Type Settings'), '$h_advn' => L10n::t('Advanced Account/Page Type Settings'),

View File

@ -4,7 +4,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\DI;
require_once 'mod/community.php'; require_once 'mod/community.php';
@ -19,7 +19,7 @@ function update_community_content(App $a) {
$text = ''; $text = '';
} }
if (PConfig::get(local_user(), "system", "bandwidth_saver")) { if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />"; $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);

View File

@ -4,7 +4,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\DI;
use Friendica\Module\Contact; use Friendica\Module\Contact;
function update_contact_content(App $a) function update_contact_content(App $a)
@ -19,7 +19,7 @@ function update_contact_content(App $a)
$text = ''; $text = '';
} }
if (PConfig::get(local_user(), "system", "bandwidth_saver")) { if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />"; $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);

View File

@ -7,6 +7,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\DI;
require_once "mod/display.php"; require_once "mod/display.php";
@ -20,7 +21,7 @@ function update_display_content(App $a)
$text = display_content($a, true, $profile_uid); $text = display_content($a, true, $profile_uid);
if (PConfig::get(local_user(), "system", "bandwidth_saver")) { if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />" . L10n::t("[Embedded content - reload page to view]") . "<br />"; $replace = "<br />" . L10n::t("[Embedded content - reload page to view]") . "<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);

View File

@ -7,6 +7,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\DI;
require_once "mod/network.php"; require_once "mod/network.php";
@ -23,13 +24,13 @@ function update_network_content(App $a)
echo "<!DOCTYPE html><html><body>\r\n"; echo "<!DOCTYPE html><html><body>\r\n";
echo "<section>"; echo "<section>";
if (!PConfig::get($profile_uid, "system", "no_auto_update") || ($_GET["force"] == 1)) { if (!DI::pConfig()->get($profile_uid, "system", "no_auto_update") || ($_GET["force"] == 1)) {
$text = network_content($a, $profile_uid, $parent); $text = network_content($a, $profile_uid, $parent);
} else { } else {
$text = ""; $text = "";
} }
if (PConfig::get(local_user(), "system", "bandwidth_saver")) { if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />" . L10n::t("[Embedded content - reload page to view]") . "<br />"; $replace = "<br />" . L10n::t("[Embedded content - reload page to view]") . "<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);

View File

@ -8,6 +8,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\DI;
require_once("mod/notes.php"); require_once("mod/notes.php");
@ -32,7 +33,7 @@ function update_notes_content(App $a) {
$text = notes_content($a, $profile_uid); $text = notes_content($a, $profile_uid);
if (PConfig::get(local_user(), "system", "bandwidth_saver")) { if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />"; $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);

View File

@ -8,6 +8,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\DI;
use Friendica\Module\Profile; use Friendica\Module\Profile;
function update_profile_content(App $a) { function update_profile_content(App $a) {
@ -30,7 +31,7 @@ function update_profile_content(App $a) {
$text = Profile::content([], $profile_uid); $text = Profile::content([], $profile_uid);
if (PConfig::get(local_user(), "system", "bandwidth_saver")) { if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />"; $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text); $text = preg_replace($pattern, $replace, $text);

View File

@ -7,7 +7,6 @@ namespace Friendica;
use Exception; use Exception;
use Friendica\App\Arguments; use Friendica\App\Arguments;
use Friendica\App\BaseURL; use Friendica\App\BaseURL;
use Friendica\App\Page;
use Friendica\App\Authentication; use Friendica\App\Authentication;
use Friendica\Core\Config\Cache\ConfigCache; use Friendica\Core\Config\Cache\ConfigCache;
use Friendica\Core\Config\IConfiguration; use Friendica\Core\Config\IConfiguration;
@ -118,6 +117,11 @@ class App
*/ */
private $process; private $process;
/**
* @var IPConfiguration
*/
private $pConfig;
/** /**
* Returns the current config cache of this node * Returns the current config cache of this node
* *
@ -149,8 +153,9 @@ class App
* @param L10n $l10n The translator instance * @param L10n $l10n The translator instance
* @param App\Arguments $args The Friendica Arguments of the call * @param App\Arguments $args The Friendica Arguments of the call
* @param Core\Process $process The process methods * @param Core\Process $process The process methods
* @param IPConfiguration $pConfig Personal configuration
*/ */
public function __construct(Database $database, IConfiguration $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, Core\Process $process) public function __construct(Database $database, IConfiguration $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, Core\Process $process, IPConfiguration $pConfig)
{ {
$this->database = $database; $this->database = $database;
$this->config = $config; $this->config = $config;
@ -161,6 +166,7 @@ class App
$this->l10n = $l10n; $this->l10n = $l10n;
$this->args = $args; $this->args = $args;
$this->process = $process; $this->process = $process;
$this->pConfig = $pConfig;
$this->argv = $args->getArgv(); $this->argv = $args->getArgv();
$this->argc = $args->getArgc(); $this->argc = $args->getArgc();
@ -336,7 +342,7 @@ class App
// Allow folks to override user themes and always use their own on their own site. // Allow folks to override user themes and always use their own on their own site.
// This works only if the user is on the same server // This works only if the user is on the same server
$user = $this->database->selectFirst('user', ['theme'], ['uid' => $this->profile_uid]); $user = $this->database->selectFirst('user', ['theme'], ['uid' => $this->profile_uid]);
if ($this->database->isResult($user) && !Core\PConfig::get(local_user(), 'system', 'always_my_theme')) { if ($this->database->isResult($user) && !$this->pConfig->get(local_user(), 'system', 'always_my_theme')) {
$page_theme = $user['theme']; $page_theme = $user['theme'];
} }
} }
@ -368,8 +374,8 @@ class App
if ($this->profile_uid && ($this->profile_uid != local_user())) { if ($this->profile_uid && ($this->profile_uid != local_user())) {
// Allow folks to override user themes and always use their own on their own site. // Allow folks to override user themes and always use their own on their own site.
// This works only if the user is on the same server // This works only if the user is on the same server
if (!Core\PConfig::get(local_user(), 'system', 'always_my_theme')) { if (!$this->pConfig->get(local_user(), 'system', 'always_my_theme')) {
$page_mobile_theme = Core\PConfig::get($this->profile_uid, 'system', 'mobile-theme'); $page_mobile_theme = $this->pConfig->get($this->profile_uid, 'system', 'mobile-theme');
} }
} }

View File

@ -9,8 +9,8 @@ namespace Friendica\App;
use Exception; use Exception;
use Friendica\App; use Friendica\App;
use Friendica\Core\Config\IConfiguration; use Friendica\Core\Config\IConfiguration;
use Friendica\Core\Config\IPConfiguration;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\PConfig;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\Database; use Friendica\Database\Database;
@ -46,6 +46,8 @@ class Authentication
private $cookie; private $cookie;
/** @var Session\ISession */ /** @var Session\ISession */
private $session; private $session;
/** @var IPConfiguration */
private $pConfig;
/** /**
* Authentication constructor. * Authentication constructor.
@ -58,17 +60,19 @@ class Authentication
* @param LoggerInterface $logger * @param LoggerInterface $logger
* @param User\Cookie $cookie * @param User\Cookie $cookie
* @param Session\ISession $session * @param Session\ISession $session
* @param IPConfiguration $pConfig
*/ */
public function __construct(IConfiguration $config, App\Mode $mode, App\BaseURL $baseUrl, L10n $l10n, Database $dba, LoggerInterface $logger, User\Cookie $cookie, Session\ISession $session) public function __construct(IConfiguration $config, App\Mode $mode, App\BaseURL $baseUrl, L10n $l10n, Database $dba, LoggerInterface $logger, User\Cookie $cookie, Session\ISession $session, IPConfiguration $pConfig)
{ {
$this->config = $config; $this->config = $config;
$this->mode = $mode; $this->mode = $mode;
$this->baseUrl = $baseUrl; $this->baseUrl = $baseUrl;
$this->l10n = $l10n; $this->l10n = $l10n;
$this->dba = $dba; $this->dba = $dba;
$this->logger = $logger; $this->logger = $logger;
$this->cookie = $cookie; $this->cookie = $cookie;
$this->session = $session; $this->session = $session;
$this->pConfig = $pConfig;
} }
/** /**
@ -295,7 +299,7 @@ class Authentication
$this->session->setMultiple([ $this->session->setMultiple([
'uid' => $user_record['uid'], 'uid' => $user_record['uid'],
'theme' => $user_record['theme'], 'theme' => $user_record['theme'],
'mobile-theme' => PConfig::get($user_record['uid'], 'system', 'mobile_theme'), 'mobile-theme' => $this->pConfig->get($user_record['uid'], 'system', 'mobile_theme'),
'authenticated' => 1, 'authenticated' => 1,
'page_flags' => $user_record['page-flags'], 'page_flags' => $user_record['page-flags'],
'my_url' => $this->baseUrl->get() . '/profile/' . $user_record['nickname'], 'my_url' => $this->baseUrl->get() . '/profile/' . $user_record['nickname'],
@ -395,7 +399,7 @@ class Authentication
private function twoFactorCheck(int $uid, App $a) private function twoFactorCheck(int $uid, App $a)
{ {
// Check user setting, if 2FA disabled return // Check user setting, if 2FA disabled return
if (!PConfig::get($uid, '2fa', 'verified')) { if (!$this->pConfig->get($uid, '2fa', 'verified')) {
return; return;
} }

View File

@ -9,6 +9,7 @@ use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\DI;
class Feature class Feature
{ {
@ -25,7 +26,7 @@ class Feature
$x = Config::get('feature_lock', $feature, false); $x = Config::get('feature_lock', $feature, false);
if ($x === false) { if ($x === false) {
$x = PConfig::get($uid, 'feature', $feature, false); $x = DI::pConfig()->get($uid, 'feature', $feature, false);
} }
if ($x === false) { if ($x === false) {

View File

@ -210,7 +210,7 @@ class Smilies
public static function replaceFromArray($text, array $smilies, $no_images = false) public static function replaceFromArray($text, array $smilies, $no_images = false)
{ {
if (intval(Config::get('system', 'no_smilies')) if (intval(Config::get('system', 'no_smilies'))
|| (local_user() && intval(PConfig::get(local_user(), 'system', 'no_smilies'))) || (local_user() && intval(DI::pConfig()->get(local_user(), 'system', 'no_smilies')))
) { ) {
return $text; return $text;
} }

View File

@ -51,7 +51,7 @@ class Widget
$global_dir = Config::get('system', 'directory'); $global_dir = Config::get('system', 'directory');
if (Config::get('system', 'invitation_only')) { if (Config::get('system', 'invitation_only')) {
$x = intval(PConfig::get(local_user(), 'system', 'invites_remaining')); $x = intval(DI::pConfig()->get(local_user(), 'system', 'invites_remaining'));
if ($x || is_site_admin()) { if ($x || is_site_admin()) {
DI::page()['aside'] .= '<div class="side-link widget" id="side-invite-remain">' DI::page()['aside'] .= '<div class="side-link widget" id="side-invite-remain">'
. L10n::tt('%d invitation available', '%d invitations available', $x) . L10n::tt('%d invitation available', '%d invitations available', $x)
@ -267,7 +267,7 @@ class Widget
return ''; return '';
} }
$saved = PConfig::get(local_user(), 'system', 'filetags'); $saved = DI::pConfig()->get(local_user(), 'system', 'filetags');
if (!strlen($saved)) { if (!strlen($saved)) {
return; return;
} }
@ -310,7 +310,7 @@ class Widget
return ''; return '';
} }
$saved = PConfig::get($uid, 'system', 'filetags'); $saved = DI::pConfig()->get($uid, 'system', 'filetags');
if (!strlen($saved)) { if (!strlen($saved)) {
return; return;
} }
@ -455,7 +455,7 @@ class Widget
return $o; return $o;
} }
$visible_years = PConfig::get($uid, 'system', 'archive_visible_years', 5); $visible_years = DI::pConfig()->get($uid, 'system', 'archive_visible_years', 5);
/* arrange the list in years */ /* arrange the list in years */
$dnow = DateTimeFormat::localNow('Y-m-d'); $dnow = DateTimeFormat::localNow('Y-m-d');

View File

@ -13,6 +13,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\User; use Friendica\Model\User;
@ -34,7 +35,7 @@ class ContactBlock
{ {
$o = ''; $o = '';
$shown = PConfig::get($profile['uid'], 'system', 'display_friend_count', 24); $shown = DI::pConfig()->get($profile['uid'], 'system', 'display_friend_count', 24);
if ($shown == 0) { if ($shown == 0) {
return $o; return $o;
} }

View File

@ -14,28 +14,11 @@ use Friendica\DI;
* @brief Management of user configuration storage * @brief Management of user configuration storage
* Note: * Note:
* Please do not store booleans - convert to 0/1 integer values * Please do not store booleans - convert to 0/1 integer values
* The PConfig::get() functions return boolean false for keys that are unset, * The DI::pConfig()->get() functions return boolean false for keys that are unset,
* and this could lead to subtle bugs. * and this could lead to subtle bugs.
*/ */
class PConfig class PConfig
{ {
/**
* @brief Get a particular user's config variable given the category name
* ($cat) and a key.
*
* @param int $uid The user_id
* @param string $cat The category of the configuration value
* @param string $key The configuration key to query
* @param mixed $default_value optional, The value to return if key is not set (default: null)
* @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false)
*
* @return mixed Stored value or null if it does not exist
*/
public static function get(int $uid, string $cat, string $key, $default_value = null, bool $refresh = false)
{
return DI::pConfig()->get($uid, $cat, $key, $default_value, $refresh);
}
/** /**
* @brief Sets a configuration value for a user * @brief Sets a configuration value for a user
* *

View File

@ -379,7 +379,7 @@ class Event
public static function getStrings() public static function getStrings()
{ {
// First day of the week (0 = Sunday). // First day of the week (0 = Sunday).
$firstDay = PConfig::get(local_user(), 'system', 'first_day_of_week', 0); $firstDay = DI::pConfig()->get(local_user(), 'system', 'first_day_of_week', 0);
$i18n = [ $i18n = [
"firstDay" => $firstDay, "firstDay" => $firstDay,

View File

@ -8,6 +8,7 @@ namespace Friendica\Model;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
/** /**
* @brief This class handles FileTag related functions * @brief This class handles FileTag related functions
@ -174,7 +175,7 @@ class FileTag
return true; return true;
} }
$saved = PConfig::get($uid, 'system', 'filetags'); $saved = DI::pConfig()->get($uid, 'system', 'filetags');
if (strlen($saved)) { if (strlen($saved)) {
if ($type == 'file') { if ($type == 'file') {
@ -256,7 +257,7 @@ class FileTag
Item::update($fields, ['id' => $item_id]); Item::update($fields, ['id' => $item_id]);
} }
$saved = PConfig::get($uid, 'system', 'filetags'); $saved = DI::pConfig()->get($uid, 'system', 'filetags');
if (!strlen($saved) || !stristr($saved, '[' . self::encode($file) . ']')) { if (!strlen($saved) || !stristr($saved, '[' . self::encode($file) . ']')) {
PConfig::set($uid, 'system', 'filetags', $saved . '[' . self::encode($file) . ']'); PConfig::set($uid, 'system', 'filetags', $saved . '[' . self::encode($file) . ']');
@ -311,7 +312,7 @@ class FileTag
); );
if (!DBA::isResult($r)) { if (!DBA::isResult($r)) {
$saved = PConfig::get($uid, 'system', 'filetags'); $saved = DI::pConfig()->get($uid, 'system', 'filetags');
PConfig::set($uid, 'system', 'filetags', str_replace($pattern, '', $saved)); PConfig::set($uid, 'system', 'filetags', str_replace($pattern, '', $saved));
} }

View File

@ -3026,7 +3026,7 @@ class Item
* $expire_network_only = save your own wall posts * $expire_network_only = save your own wall posts
* and just expire conversations started by others * and just expire conversations started by others
*/ */
$expire_network_only = PConfig::get($uid, 'expire', 'network_only', false); $expire_network_only = DI::pConfig()->get($uid, 'expire', 'network_only', false);
if ($expire_network_only) { if ($expire_network_only) {
$condition[0] .= " AND NOT `wall`"; $condition[0] .= " AND NOT `wall`";
@ -3046,16 +3046,16 @@ class Item
return; return;
} }
$expire_items = PConfig::get($uid, 'expire', 'items', true); $expire_items = DI::pConfig()->get($uid, 'expire', 'items', true);
// Forcing expiring of items - but not notes and marked items // Forcing expiring of items - but not notes and marked items
if ($force) { if ($force) {
$expire_items = true; $expire_items = true;
} }
$expire_notes = PConfig::get($uid, 'expire', 'notes', true); $expire_notes = DI::pConfig()->get($uid, 'expire', 'notes', true);
$expire_starred = PConfig::get($uid, 'expire', 'starred', true); $expire_starred = DI::pConfig()->get($uid, 'expire', 'starred', true);
$expire_photos = PConfig::get($uid, 'expire', 'photos', false); $expire_photos = DI::pConfig()->get($uid, 'expire', 'photos', false);
$expired = 0; $expired = 0;
@ -3525,7 +3525,7 @@ class Item
// Compile eventual content filter reasons // Compile eventual content filter reasons
$filter_reasons = []; $filter_reasons = [];
if (!$is_preview && public_contact() != $item['author-id']) { if (!$is_preview && public_contact() != $item['author-id']) {
if (!empty($item['content-warning']) && (!local_user() || !PConfig::get(local_user(), 'system', 'disable_cw', false))) { if (!empty($item['content-warning']) && (!local_user() || !DI::pConfig()->get(local_user(), 'system', 'disable_cw', false))) {
$filter_reasons[] = L10n::t('Content warning: %s', $item['content-warning']); $filter_reasons[] = L10n::t('Content warning: %s', $item['content-warning']);
} }

View File

@ -9,6 +9,7 @@ namespace Friendica\Model;
use Friendica\Content\Text; use Friendica\Content\Text;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\DI;
class ItemContent class ItemContent
{ {
@ -158,7 +159,7 @@ class ItemContent
$post['url'] = $item['plink']; $post['url'] = $item['plink'];
} elseif (strpos($item['body'], '[share') !== false) { } elseif (strpos($item['body'], '[share') !== false) {
$post['url'] = $item['plink']; $post['url'] = $item['plink'];
} elseif (PConfig::get($item['uid'], 'system', 'no_intelligent_shortening')) { } elseif (DI::pConfig()->get($item['uid'], 'system', 'no_intelligent_shortening')) {
$post['url'] = $item['plink']; $post['url'] = $item['plink'];
} }
$msg = Text\Plaintext::shorten($msg, $limit); $msg = Text\Plaintext::shorten($msg, $limit);

View File

@ -184,12 +184,12 @@ class Profile
$a->profile = $pdata; $a->profile = $pdata;
$a->profile_uid = $pdata['profile_uid']; $a->profile_uid = $pdata['profile_uid'];
$a->profile['mobile-theme'] = PConfig::get($a->profile['profile_uid'], 'system', 'mobile_theme'); $a->profile['mobile-theme'] = DI::pConfig()->get($a->profile['profile_uid'], 'system', 'mobile_theme');
$a->profile['network'] = Protocol::DFRN; $a->profile['network'] = Protocol::DFRN;
DI::page()['title'] = $a->profile['name'] . ' @ ' . Config::get('config', 'sitename'); DI::page()['title'] = $a->profile['name'] . ' @ ' . Config::get('config', 'sitename');
if (!$profiledata && !PConfig::get(local_user(), 'system', 'always_my_theme')) { if (!$profiledata && !DI::pConfig()->get(local_user(), 'system', 'always_my_theme')) {
$a->setCurrentTheme($a->profile['theme']); $a->setCurrentTheme($a->profile['theme']);
$a->setCurrentMobileTheme($a->profile['mobile-theme']); $a->setCurrentMobileTheme($a->profile['mobile-theme']);
} }
@ -1218,7 +1218,7 @@ class Profile
public static function getThemeUid(App $a) public static function getThemeUid(App $a)
{ {
$uid = !empty($a->profile_uid) ? intval($a->profile_uid) : 0; $uid = !empty($a->profile_uid) ? intval($a->profile_uid) : 0;
if (local_user() && (PConfig::get(local_user(), 'system', 'always_my_theme') || !$uid)) { if (local_user() && (DI::pConfig()->get(local_user(), 'system', 'always_my_theme') || !$uid)) {
return local_user(); return local_user();
} }

View File

@ -275,7 +275,7 @@ class User
$default_group = 0; $default_group = 0;
if ($network == Protocol::OSTATUS) { if ($network == Protocol::OSTATUS) {
$default_group = PConfig::get($uid, "ostatus", "default_group"); $default_group = DI::pConfig()->get($uid, "ostatus", "default_group");
} }
if ($default_group != 0) { if ($default_group != 0) {
@ -326,7 +326,7 @@ class User
{ {
$user = self::getAuthenticationInfo($user_info); $user = self::getAuthenticationInfo($user_info);
if ($third_party && PConfig::get($user['uid'], '2fa', 'verified')) { if ($third_party && DI::pConfig()->get($user['uid'], '2fa', 'verified')) {
// Third-party apps can't verify two-factor authentication, we use app-specific passwords instead // Third-party apps can't verify two-factor authentication, we use app-specific passwords instead
if (AppSpecificPassword::authenticateUser($user['uid'], $password)) { if (AppSpecificPassword::authenticateUser($user['uid'], $password)) {
return $user['uid']; return $user['uid'];

View File

@ -41,7 +41,7 @@ class SaveTag extends BaseModule
} }
// return filer dialog // return filer dialog
$filetags = PConfig::get(local_user(), 'system', 'filetags', ''); $filetags = DI::pConfig()->get(local_user(), 'system', 'filetags', '');
$filetags = Model\FileTag::fileToArray($filetags); $filetags = Model\FileTag::fileToArray($filetags);
$tpl = Renderer::getMarkupTemplate("filer_dialog.tpl"); $tpl = Renderer::getMarkupTemplate("filer_dialog.tpl");

View File

@ -146,7 +146,7 @@ class Group extends BaseModule
} }
// Switch to text mode interface if we have more than 'n' contacts or group members // Switch to text mode interface if we have more than 'n' contacts or group members
$switchtotext = PConfig::get(local_user(), 'system', 'groupedit_image_limit'); $switchtotext = DI::pConfig()->get(local_user(), 'system', 'groupedit_image_limit');
if (is_null($switchtotext)) { if (is_null($switchtotext)) {
$switchtotext = Config::get('system', 'groupedit_image_limit', 200); $switchtotext = Config::get('system', 'groupedit_image_limit', 200);
} }

View File

@ -33,7 +33,7 @@ class Invite extends BaseModule
$max_invites = 50; $max_invites = 50;
} }
$current_invites = intval(PConfig::get(local_user(), 'system', 'sent_invites')); $current_invites = intval(DI::pConfig()->get(local_user(), 'system', 'sent_invites'));
if ($current_invites > $max_invites) { if ($current_invites > $max_invites) {
throw new HTTPException\ForbiddenException(L10n::t('Total invitation limit exceeded.')); throw new HTTPException\ForbiddenException(L10n::t('Total invitation limit exceeded.'));
} }
@ -48,7 +48,7 @@ class Invite extends BaseModule
if ($config->get('system', 'invitation_only')) { if ($config->get('system', 'invitation_only')) {
$invitation_only = true; $invitation_only = true;
$invites_remaining = PConfig::get(local_user(), 'system', 'invites_remaining'); $invites_remaining = DI::pConfig()->get(local_user(), 'system', 'invites_remaining');
if ((!$invites_remaining) && (!is_site_admin())) { if ((!$invites_remaining) && (!is_site_admin())) {
throw new HTTPException\ForbiddenException(); throw new HTTPException\ForbiddenException();
} }
@ -118,7 +118,7 @@ class Invite extends BaseModule
if ($config->get('system', 'invitation_only')) { if ($config->get('system', 'invitation_only')) {
$inviteOnly = true; $inviteOnly = true;
$x = PConfig::get(local_user(), 'system', 'invites_remaining'); $x = DI::pConfig()->get(local_user(), 'system', 'invites_remaining');
if ((!$x) && (!is_site_admin())) { if ((!$x) && (!is_site_admin())) {
throw new HTTPException\ForbiddenException(L10n::t('You have no more invitations available')); throw new HTTPException\ForbiddenException(L10n::t('You have no more invitations available'));
} }

View File

@ -293,9 +293,9 @@ class Profile extends BaseModule
// check if we serve a mobile device and get the user settings // check if we serve a mobile device and get the user settings
// accordingly // accordingly
if (DI::mode()->isMobile()) { if (DI::mode()->isMobile()) {
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network', 10); $itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network', 10);
} else { } else {
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_network', 20); $itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network', 20);
} }
// now that we have the user settings, see if the theme forces // now that we have the user settings, see if the theme forces

View File

@ -33,7 +33,7 @@ class Verify extends BaseModule
$code = $_POST['verify_code'] ?? ''; $code = $_POST['verify_code'] ?? '';
$valid = (new Google2FA())->verifyKey(PConfig::get(local_user(), '2fa', 'secret'), $code); $valid = (new Google2FA())->verifyKey(DI::pConfig()->get(local_user(), '2fa', 'secret'), $code);
// The same code can't be used twice even if it's valid // The same code can't be used twice even if it's valid
if ($valid && Session::get('2fa') !== $code) { if ($valid && Session::get('2fa') !== $code) {

View File

@ -27,7 +27,7 @@ class AppSpecific extends BaseSettingsModule
return; return;
} }
$verified = PConfig::get(local_user(), '2fa', 'verified'); $verified = DI::pConfig()->get(local_user(), '2fa', 'verified');
if (!$verified) { if (!$verified) {
DI::baseUrl()->redirect('settings/2fa'); DI::baseUrl()->redirect('settings/2fa');

View File

@ -29,8 +29,8 @@ class Index extends BaseSettingsModule
try { try {
User::getIdFromPasswordAuthentication(local_user(), $_POST['password'] ?? ''); User::getIdFromPasswordAuthentication(local_user(), $_POST['password'] ?? '');
$has_secret = (bool) PConfig::get(local_user(), '2fa', 'secret'); $has_secret = (bool) DI::pConfig()->get(local_user(), '2fa', 'secret');
$verified = PConfig::get(local_user(), '2fa', 'verified'); $verified = DI::pConfig()->get(local_user(), '2fa', 'verified');
switch ($_POST['action'] ?? '') { switch ($_POST['action'] ?? '') {
case 'enable': case 'enable':
@ -82,8 +82,8 @@ class Index extends BaseSettingsModule
parent::content($parameters); parent::content($parameters);
$has_secret = (bool) PConfig::get(local_user(), '2fa', 'secret'); $has_secret = (bool) DI::pConfig()->get(local_user(), '2fa', 'secret');
$verified = PConfig::get(local_user(), '2fa', 'verified'); $verified = DI::pConfig()->get(local_user(), '2fa', 'verified');
return Renderer::replaceMacros(Renderer::getMarkupTemplate('settings/twofactor/index.tpl'), [ return Renderer::replaceMacros(Renderer::getMarkupTemplate('settings/twofactor/index.tpl'), [
'$form_security_token' => self::getFormSecurityToken('settings_2fa'), '$form_security_token' => self::getFormSecurityToken('settings_2fa'),

View File

@ -25,7 +25,7 @@ class Recovery extends BaseSettingsModule
return; return;
} }
$secret = PConfig::get(local_user(), '2fa', 'secret'); $secret = DI::pConfig()->get(local_user(), '2fa', 'secret');
if (!$secret) { if (!$secret) {
DI::baseUrl()->redirect('settings/2fa'); DI::baseUrl()->redirect('settings/2fa');
@ -68,7 +68,7 @@ class Recovery extends BaseSettingsModule
$recoveryCodes = RecoveryCode::getListForUser(local_user()); $recoveryCodes = RecoveryCode::getListForUser(local_user());
$verified = PConfig::get(local_user(), '2fa', 'verified'); $verified = DI::pConfig()->get(local_user(), '2fa', 'verified');
return Renderer::replaceMacros(Renderer::getMarkupTemplate('settings/twofactor/recovery.tpl'), [ return Renderer::replaceMacros(Renderer::getMarkupTemplate('settings/twofactor/recovery.tpl'), [
'$form_security_token' => self::getFormSecurityToken('settings_2fa_recovery'), '$form_security_token' => self::getFormSecurityToken('settings_2fa_recovery'),

View File

@ -31,8 +31,8 @@ class Verify extends BaseSettingsModule
return; return;
} }
$secret = PConfig::get(local_user(), '2fa', 'secret'); $secret = DI::pConfig()->get(local_user(), '2fa', 'secret');
$verified = PConfig::get(local_user(), '2fa', 'verified'); $verified = DI::pConfig()->get(local_user(), '2fa', 'verified');
if ($secret && $verified) { if ($secret && $verified) {
DI::baseUrl()->redirect('settings/2fa'); DI::baseUrl()->redirect('settings/2fa');
@ -55,7 +55,7 @@ class Verify extends BaseSettingsModule
$google2fa = new Google2FA(); $google2fa = new Google2FA();
$valid = $google2fa->verifyKey(PConfig::get(local_user(), '2fa', 'secret'), $_POST['verify_code'] ?? ''); $valid = $google2fa->verifyKey(DI::pConfig()->get(local_user(), '2fa', 'secret'), $_POST['verify_code'] ?? '');
if ($valid) { if ($valid) {
PConfig::set(local_user(), '2fa', 'verified', true); PConfig::set(local_user(), '2fa', 'verified', true);
@ -80,7 +80,7 @@ class Verify extends BaseSettingsModule
$company = 'Friendica'; $company = 'Friendica';
$holder = Session::get('my_address'); $holder = Session::get('my_address');
$secret = PConfig::get(local_user(), '2fa', 'secret'); $secret = DI::pConfig()->get(local_user(), '2fa', 'secret');
$otpauthUrl = (new Google2FA())->getQRCodeUrl($company, $holder, $secret); $otpauthUrl = (new Google2FA())->getQRCodeUrl($company, $holder, $secret);

View File

@ -348,7 +348,7 @@ class Post
$text_e = strip_tags($body); $text_e = strip_tags($body);
$name_e = $profile_name; $name_e = $profile_name;
if (!empty($item['content-warning']) && PConfig::get(local_user(), 'system', 'disable_cw', false)) { if (!empty($item['content-warning']) && DI::pConfig()->get(local_user(), 'system', 'disable_cw', false)) {
$title_e = ucfirst($item['content-warning']); $title_e = ucfirst($item['content-warning']);
} else { } else {
$title_e = $item['title']; $title_e = $item['title'];
@ -874,7 +874,7 @@ class Post
* This should be better if done by a hook * This should be better if done by a hook
*/ */
if (Addon::isEnabled('qcomment')) { if (Addon::isEnabled('qcomment')) {
$qc = ((local_user()) ? PConfig::get(local_user(), 'qcomment', 'words') : null); $qc = ((local_user()) ? DI::pConfig()->get(local_user(), 'qcomment', 'words') : null);
$qcomment = (($qc) ? explode("\n", $qc) : null); $qcomment = (($qc) ? explode("\n", $qc) : null);
} }

View File

@ -11,6 +11,7 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\APContact; use Friendica\Model\APContact;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Event; use Friendica\Model\Event;
@ -462,7 +463,7 @@ class Processor
continue; continue;
} }
if (PConfig::get($receiver, 'system', 'accept_only_sharer', false) && ($receiver != 0) && ($item['gravity'] == GRAVITY_PARENT)) { if (DI::pConfig()->get($receiver, 'system', 'accept_only_sharer', false) && ($receiver != 0) && ($item['gravity'] == GRAVITY_PARENT)) {
$skip = !Contact::isSharingByURL($activity['author'], $receiver); $skip = !Contact::isSharingByURL($activity['author'], $receiver);
if ($skip && (($activity['type'] == 'as:Announce') || $isForum)) { if ($skip && (($activity['type'] == 'as:Announce') || $isForum)) {

View File

@ -3290,7 +3290,7 @@ class Diaspora
*/ */
public static function sendAccountMigration(array $owner, array $contact, $uid) public static function sendAccountMigration(array $owner, array $contact, $uid)
{ {
$old_handle = PConfig::get($uid, 'system', 'previous_addr'); $old_handle = DI::pConfig()->get($uid, 'system', 'previous_addr');
$profile = self::createProfileData($uid); $profile = self::createProfileData($uid);
$signed_text = 'AccountMigration:'.$old_handle.':'.$profile['author']; $signed_text = 'AccountMigration:'.$old_handle.':'.$profile['author'];
@ -3551,7 +3551,7 @@ class Diaspora
$body = $item["body"]; $body = $item["body"];
// Fetch the title from an attached link - if there is one // Fetch the title from an attached link - if there is one
if (empty($item["title"]) && PConfig::get($owner['uid'], 'system', 'attach_link_title')) { if (empty($item["title"]) && DI::pConfig()->get($owner['uid'], 'system', 'attach_link_title')) {
$page_data = BBCode::getAttachmentData($item['body']); $page_data = BBCode::getAttachmentData($item['body']);
if (!empty($page_data['type']) && !empty($page_data['title']) && ($page_data['type'] == 'link')) { if (!empty($page_data['type']) && !empty($page_data['title']) && ($page_data['type'] == 'link')) {
$title = $page_data['title']; $title = $page_data['title'];

View File

@ -494,7 +494,7 @@ class OStatus
if (!$valid) { if (!$valid) {
// If not, then it depends on this setting // If not, then it depends on this setting
$valid = ((self::$itemlist[0]['uid'] == 0) || !PConfig::get(self::$itemlist[0]['uid'], 'system', 'accept_only_sharer', false)); $valid = ((self::$itemlist[0]['uid'] == 0) || !DI::pConfig()->get(self::$itemlist[0]['uid'], 'system', 'accept_only_sharer', false));
if ($valid) { if ($valid) {
Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported due to the system settings.", Logger::DEBUG); Logger::log("Item with uri ".self::$itemlist[0]['uri']." will be imported due to the system settings.", Logger::DEBUG);
} }

View File

@ -44,7 +44,7 @@ class Emailer
$email_textonly = false; $email_textonly = false;
if (!empty($params['uid'])) { if (!empty($params['uid'])) {
$email_textonly = PConfig::get($params['uid'], "system", "email_textonly"); $email_textonly = DI::pConfig()->get($params['uid'], "system", "email_textonly");
} }
$fromName = Email::encodeHeader(html_entity_decode($params['fromName'], ENT_QUOTES, 'UTF-8'), 'UTF-8'); $fromName = Email::encodeHeader(html_entity_decode($params['fromName'], ENT_QUOTES, 'UTF-8'), 'UTF-8');

View File

@ -234,7 +234,7 @@ class ExAuth
} }
if ($Error) { if ($Error) {
$this->writeLog(LOG_INFO, 'check against alternate password for ' . $sUser . '@' . $aCommand[2]); $this->writeLog(LOG_INFO, 'check against alternate password for ' . $sUser . '@' . $aCommand[2]);
$sPassword = PConfig::get($uid, 'xmpp', 'password', null, true); $sPassword = DI::pConfig()->get($uid, 'xmpp', 'password', null, true);
$Error = ($aCommand[3] != $sPassword); $Error = ($aCommand[3] != $sPassword);
} }
} else { } else {

View File

@ -218,7 +218,7 @@ class Temporal
$required = false) $required = false)
{ {
// First day of the week (0 = Sunday) // First day of the week (0 = Sunday)
$firstDay = PConfig::get(local_user(), 'system', 'first_day_of_week', 0); $firstDay = DI::pConfig()->get(local_user(), 'system', 'first_day_of_week', 0);
$lang = substr(L10n::getCurrentLang(), 0, 2); $lang = substr(L10n::getCurrentLang(), 0, 2);

View File

@ -9,6 +9,7 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\User; use Friendica\Model\User;
@ -641,7 +642,7 @@ class OnePoll
$datarray['private'] = 1; $datarray['private'] = 1;
} }
if (!PConfig::get($importer_uid, 'system', 'allow_public_email_replies')) { if (!DI::pConfig()->get($importer_uid, 'system', 'allow_public_email_replies')) {
$datarray['private'] = 1; $datarray['private'] = 1;
$datarray['allow_cid'] = '<' . $contact['id'] . '>'; $datarray['allow_cid'] = '<' . $contact['id'] . '>';
} }

View File

@ -8,7 +8,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\DI;
function theme_content(App $a) function theme_content(App $a)
{ {
@ -16,7 +16,7 @@ function theme_content(App $a)
return; return;
} }
$colorset = PConfig::get(local_user(), 'duepuntozero', 'colorset'); $colorset = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
$user = true; $user = true;
return clean_form($a, $colorset, $user); return clean_form($a, $colorset, $user);
@ -62,7 +62,7 @@ function clean_form(App $a, &$colorset, $user)
]; ];
if ($user) { if ($user) {
$color = PConfig::get(local_user(), 'duepuntozero', 'colorset'); $color = DI::pConfig()->get(local_user(), 'duepuntozero', 'colorset');
} else { } else {
$color = Config::get('duepuntozero', 'colorset'); $color = Config::get('duepuntozero', 'colorset');
} }

View File

@ -4,6 +4,7 @@
*/ */
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\DI;
use Friendica\Model\Profile; use Friendica\Model\Profile;
if (file_exists("$THEMEPATH/style.css")) { if (file_exists("$THEMEPATH/style.css")) {
@ -13,7 +14,7 @@ if (file_exists("$THEMEPATH/style.css")) {
$uid = $_REQUEST['puid'] ?? 0; $uid = $_REQUEST['puid'] ?? 0;
$s_colorset = Config::get('duepuntozero', 'colorset'); $s_colorset = Config::get('duepuntozero', 'colorset');
$colorset = PConfig::get($uid, 'duepuntozero', 'colorset'); $colorset = DI::pConfig()->get($uid, 'duepuntozero', 'colorset');
if (empty($colorset)) { if (empty($colorset)) {
$colorset = $s_colorset; $colorset = $s_colorset;

View File

@ -10,7 +10,7 @@ function duepuntozero_init(App $a) {
Renderer::setActiveTemplateEngine('smarty3'); Renderer::setActiveTemplateEngine('smarty3');
$colorset = PConfig::get( local_user(), 'duepuntozero','colorset'); $colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset');
if (!$colorset) if (!$colorset)
$colorset = Config::get('duepuntozero', 'colorset'); // user setting have priority, then node settings $colorset = Config::get('duepuntozero', 'colorset'); // user setting have priority, then node settings
if ($colorset) { if ($colorset) {

View File

@ -6,6 +6,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI;
require_once 'view/theme/frio/php/Image.php'; require_once 'view/theme/frio/php/Image.php';
@ -60,16 +61,16 @@ function theme_content(App $a)
$node_scheme = Config::get('frio', 'scheme', Config::get('frio', 'scheme')); $node_scheme = Config::get('frio', 'scheme', Config::get('frio', 'scheme'));
$arr['scheme'] = PConfig::get(local_user(), 'frio', 'scheme', PConfig::get(local_user(), 'frio', 'schema', $node_scheme)); $arr['scheme'] = DI::pConfig()->get(local_user(), 'frio', 'scheme', DI::pConfig()->get(local_user(), 'frio', 'schema', $node_scheme));
$arr['share_string'] = ''; $arr['share_string'] = '';
$arr['nav_bg'] = PConfig::get(local_user(), 'frio', 'nav_bg' , Config::get('frio', 'nav_bg')); $arr['nav_bg'] = DI::pConfig()->get(local_user(), 'frio', 'nav_bg' , Config::get('frio', 'nav_bg'));
$arr['nav_icon_color'] = PConfig::get(local_user(), 'frio', 'nav_icon_color' , Config::get('frio', 'nav_icon_color')); $arr['nav_icon_color'] = DI::pConfig()->get(local_user(), 'frio', 'nav_icon_color' , Config::get('frio', 'nav_icon_color'));
$arr['link_color'] = PConfig::get(local_user(), 'frio', 'link_color' , Config::get('frio', 'link_color')); $arr['link_color'] = DI::pConfig()->get(local_user(), 'frio', 'link_color' , Config::get('frio', 'link_color'));
$arr['background_color'] = PConfig::get(local_user(), 'frio', 'background_color', Config::get('frio', 'background_color')); $arr['background_color'] = DI::pConfig()->get(local_user(), 'frio', 'background_color', Config::get('frio', 'background_color'));
$arr['contentbg_transp'] = PConfig::get(local_user(), 'frio', 'contentbg_transp', Config::get('frio', 'contentbg_transp')); $arr['contentbg_transp'] = DI::pConfig()->get(local_user(), 'frio', 'contentbg_transp', Config::get('frio', 'contentbg_transp'));
$arr['background_image'] = PConfig::get(local_user(), 'frio', 'background_image', Config::get('frio', 'background_image')); $arr['background_image'] = DI::pConfig()->get(local_user(), 'frio', 'background_image', Config::get('frio', 'background_image'));
$arr['bg_image_option'] = PConfig::get(local_user(), 'frio', 'bg_image_option' , Config::get('frio', 'bg_image_option')); $arr['bg_image_option'] = DI::pConfig()->get(local_user(), 'frio', 'bg_image_option' , Config::get('frio', 'bg_image_option'));
$arr['enable_compose'] = PConfig::get(local_user(), 'frio', 'enable_compose' , Config::get('frio', 'enable_compose')); $arr['enable_compose'] = DI::pConfig()->get(local_user(), 'frio', 'enable_compose' , Config::get('frio', 'enable_compose'));
return frio_form($arr); return frio_form($arr);
} }

View File

@ -44,14 +44,14 @@ $is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";
// Add the theme color meta // Add the theme color meta
// It makes mobile Chrome UI match Frio's top bar color. // It makes mobile Chrome UI match Frio's top bar color.
$uid = Profile::getThemeUid($a); $uid = Profile::getThemeUid($a);
$scheme = PConfig::get($uid, 'frio', 'scheme', PConfig::get($uid, 'frio', 'schema')); $scheme = DI::pConfig()->get($uid, 'frio', 'scheme', DI::pConfig()->get($uid, 'frio', 'schema'));
if ($scheme && is_string($scheme) && $scheme != '---') { if ($scheme && is_string($scheme) && $scheme != '---') {
if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) { if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
$schemefile = 'view/theme/frio/scheme/' . $scheme . '.php'; $schemefile = 'view/theme/frio/scheme/' . $scheme . '.php';
require_once $schemefile; require_once $schemefile;
} }
} else { } else {
$nav_bg = PConfig::get($uid, 'frio', 'nav_bg'); $nav_bg = DI::pConfig()->get($uid, 'frio', 'nav_bg');
} }
if (empty($nav_bg)) { if (empty($nav_bg)) {

View File

@ -27,7 +27,7 @@ function get_scheme_info($scheme)
$theme = DI::app()->getCurrentTheme(); $theme = DI::app()->getCurrentTheme();
$themepath = 'view/theme/' . $theme . '/'; $themepath = 'view/theme/' . $theme . '/';
if (empty($scheme)) { if (empty($scheme)) {
$scheme = PConfig::get(local_user(), 'frio', 'scheme', PConfig::get(local_user(), 'frio', 'schema')); $scheme = DI::pConfig()->get(local_user(), 'frio', 'scheme', DI::pConfig()->get(local_user(), 'frio', 'schema'));
} }
$scheme = Strings::sanitizeFilePathItem($scheme); $scheme = Strings::sanitizeFilePathItem($scheme);

View File

@ -41,15 +41,15 @@ if ($uid) {
DI::pConfig()->load($uid, 'frio'); DI::pConfig()->load($uid, 'frio');
// Only override display settings that have actually been set // Only override display settings that have actually been set
$scheme = PConfig::get($uid, 'frio', 'scheme', PConfig::get($uid, 'frio', 'schema')) ?: $scheme; $scheme = DI::pConfig()->get($uid, 'frio', 'scheme', DI::pConfig()->get($uid, 'frio', 'schema')) ?: $scheme;
$nav_bg = PConfig::get($uid, 'frio', 'nav_bg') ?: $nav_bg; $nav_bg = DI::pConfig()->get($uid, 'frio', 'nav_bg') ?: $nav_bg;
$nav_icon_color = PConfig::get($uid, 'frio', 'nav_icon_color') ?: $nav_icon_color; $nav_icon_color = DI::pConfig()->get($uid, 'frio', 'nav_icon_color') ?: $nav_icon_color;
$link_color = PConfig::get($uid, 'frio', 'link_color') ?: $link_color; $link_color = DI::pConfig()->get($uid, 'frio', 'link_color') ?: $link_color;
$background_color = PConfig::get($uid, 'frio', 'background_color') ?: $background_color; $background_color = DI::pConfig()->get($uid, 'frio', 'background_color') ?: $background_color;
$contentbg_transp = PConfig::get($uid, 'frio', 'contentbg_transp') ?: $contentbg_transp; $contentbg_transp = DI::pConfig()->get($uid, 'frio', 'contentbg_transp') ?: $contentbg_transp;
$background_image = PConfig::get($uid, 'frio', 'background_image') ?: $background_image; $background_image = DI::pConfig()->get($uid, 'frio', 'background_image') ?: $background_image;
$bg_image_option = PConfig::get($uid, 'frio', 'bg_image_option') ?: $bg_image_option; $bg_image_option = DI::pConfig()->get($uid, 'frio', 'bg_image_option') ?: $bg_image_option;
$modified = PConfig::get($uid, 'frio', 'css_modified') ?: $modified; $modified = DI::pConfig()->get($uid, 'frio', 'css_modified') ?: $modified;
} }
// Now load the scheme. If a value is changed above, we'll keep the settings // Now load the scheme. If a value is changed above, we'll keep the settings

View File

@ -43,7 +43,7 @@ function frio_init(App $a)
EOT; EOT;
} }
$enable_compose = \Friendica\Core\PConfig::get(local_user(), 'frio', 'enable_compose'); $enable_compose = DI::pConfig()->get(local_user(), 'frio', 'enable_compose');
$compose = $enable_compose === '1' || $enable_compose === null && Config::get('frio', 'enable_compose') ? 1 : 0; $compose = $enable_compose === '1' || $enable_compose === null && Config::get('frio', 'enable_compose') ? 1 : 0;
DI::page()['htmlhead'] .= <<< HTML DI::page()['htmlhead'] .= <<< HTML
<script type="text/javascript"> <script type="text/javascript">

View File

@ -9,16 +9,17 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI;
function theme_content(App $a) { function theme_content(App $a) {
if (!local_user()) { if (!local_user()) {
return; return;
} }
$align = PConfig::get(local_user(), 'quattro', 'align' ); $align = DI::pConfig()->get(local_user(), 'quattro', 'align' );
$color = PConfig::get(local_user(), 'quattro', 'color' ); $color = DI::pConfig()->get(local_user(), 'quattro', 'color' );
$tfs = PConfig::get(local_user(),"quattro","tfs"); $tfs = DI::pConfig()->get(local_user(),"quattro","tfs");
$pfs = PConfig::get(local_user(),"quattro","pfs"); $pfs = DI::pConfig()->get(local_user(),"quattro","pfs");
return quattro_form($a,$align, $color, $tfs, $pfs); return quattro_form($a,$align, $color, $tfs, $pfs);
} }

View File

@ -4,6 +4,7 @@
*/ */
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\DI;
use Friendica\Model\Profile; use Friendica\Model\Profile;
$uid = $_REQUEST['puid'] ?? 0; $uid = $_REQUEST['puid'] ?? 0;
@ -14,8 +15,8 @@ $site_color = Config::get("quattro", "color", "dark");
$site_quattro_align = Config::get("quattro", "align", false); $site_quattro_align = Config::get("quattro", "align", false);
if ($uid) { if ($uid) {
$color = PConfig::get($uid, "quattro", "color", false); $color = DI::pConfig()->get($uid, "quattro", "color", false);
$quattro_align = PConfig::get($uid, 'quattro', 'align', false); $quattro_align = DI::pConfig()->get($uid, 'quattro', 'align', false);
} }
if ($color === false) { if ($color === false) {
@ -51,8 +52,8 @@ $site_textarea_font_size = Config::get("quattro", "tfs", "20");
$site_post_font_size = Config::get("quattro", "pfs", "12"); $site_post_font_size = Config::get("quattro", "pfs", "12");
if ($uid) { if ($uid) {
$textarea_font_size = PConfig::get($uid, "quattro", "tfs", false); $textarea_font_size = DI::pConfig()->get($uid, "quattro", "tfs", false);
$post_font_size = PConfig::get($uid, "quattro", "pfs", false); $post_font_size = DI::pConfig()->get($uid, "quattro", "pfs", false);
} }
if ($textarea_font_size === false) { if ($textarea_font_size === false) {

View File

@ -9,6 +9,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI;
require_once __DIR__ . '/theme.php'; require_once __DIR__ . '/theme.php';
@ -22,7 +23,7 @@ function theme_content(App $a)
return; return;
} }
$style = PConfig::get(local_user(), 'vier', 'style'); $style = DI::pConfig()->get(local_user(), 'vier', 'style');
if ($style == "") { if ($style == "") {
$style = Config::get('vier', 'style'); $style = Config::get('vier', 'style');

View File

@ -5,11 +5,12 @@
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\DI;
use Friendica\Model\Profile; use Friendica\Model\Profile;
$uid = $_REQUEST['puid'] ?? 0; $uid = $_REQUEST['puid'] ?? 0;
$style = PConfig::get($uid, 'vier', 'style'); $style = DI::pConfig()->get($uid, 'vier', 'style');
if (empty($style)) { if (empty($style)) {
$style = Config::get('vier', 'style'); $style = Config::get('vier', 'style');

View File

@ -91,7 +91,7 @@ EOT;
function get_vier_config($key, $default = false, $admin = false) function get_vier_config($key, $default = false, $admin = false)
{ {
if (local_user() && !$admin) { if (local_user() && !$admin) {
$result = PConfig::get(local_user(), "vier", $key); $result = DI::pConfig()->get(local_user(), "vier", $key);
if (!is_null($result)) { if (!is_null($result)) {
return $result; return $result;
} }