diff --git a/boot.php b/boot.php index 390a6ef9c2..c863cda723 100644 --- a/boot.php +++ b/boot.php @@ -17,9 +17,7 @@ * easily as email does today. */ -use Friendica\App; use Friendica\Core\Config; -use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBA; @@ -322,7 +320,7 @@ function info($s) { $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; } diff --git a/doc/themes.md b/doc/themes.md index 6193fa2d22..577d6a5da9 100644 --- a/doc/themes.md +++ b/doc/themes.md @@ -129,7 +129,7 @@ The selected 1st part will be saved in the database by the theme_post function. // if the one specific submit button was pressed then proceed if (isset($_POST['duepuntozero-settings-submit'])){ // and save the selection key into the personal config of the user - PConfig::set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']); + DI::pConfig()->set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']); } } @@ -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*. There you'll find somethink alike - $colorset = PConfig::get( local_user(), 'duepuntozero','colorset'); + $colorset = DI::pConfig()->get( local_user(), 'duepuntozero','colorset'); if (!$colorset) $colorset = Config::get('duepuntozero', 'colorset'); if ($colorset) { diff --git a/include/api.php b/include/api.php index 8dd00bae81..8220e7bb16 100644 --- a/include/api.php +++ b/include/api.php @@ -15,7 +15,6 @@ use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; -use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\Session; use Friendica\Core\System; @@ -728,7 +727,7 @@ function api_get_user(App $a, $contact_id = null) if ($ret['self']) { $theme_info = DBA::selectFirst('user', ['theme'], ['uid' => $ret['uid']]); if ($theme_info['theme'] === 'frio') { - $schema = PConfig::get($ret['uid'], 'frio', 'schema'); + $schema = DI::pConfig()->get($ret['uid'], 'frio', 'schema'); if ($schema && ($schema != '---')) { if (file_exists('view/theme/frio/schema/'.$schema.'.php')) { @@ -736,9 +735,9 @@ function api_get_user(App $a, $contact_id = null) require_once $schemefile; } } else { - $nav_bg = PConfig::get($ret['uid'], 'frio', 'nav_bg'); - $link_color = PConfig::get($ret['uid'], 'frio', 'link_color'); - $bgcolor = PConfig::get($ret['uid'], 'frio', 'background_color'); + $nav_bg = DI::pConfig()->get($ret['uid'], 'frio', 'nav_bg'); + $link_color = DI::pConfig()->get($ret['uid'], 'frio', 'link_color'); + $bgcolor = DI::pConfig()->get($ret['uid'], 'frio', 'background_color'); } if (empty($nav_bg)) { $nav_bg = "#708fa0"; diff --git a/include/conversation.php b/include/conversation.php index bbabcc4372..5c1b140f4c 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -12,7 +12,6 @@ use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; -use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Core\Session; @@ -419,7 +418,7 @@ function conv_get_blocklist() return []; } - $str_blocked = PConfig::get(local_user(), 'system', 'blocked'); + $str_blocked = DI::pConfig()->get(local_user(), 'system', 'blocked'); if (empty($str_blocked)) { return []; } @@ -666,7 +665,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ 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']); } else { $title = $item['title']; @@ -1469,7 +1468,7 @@ function conv_sort(array $item_list, $order) $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) { $parents[$i] = smart_flatten_conversation($parent); } diff --git a/mod/community.php b/mod/community.php index 22c1c5d76e..8ed0c14dca 100644 --- a/mod/community.php +++ b/mod/community.php @@ -11,7 +11,6 @@ use Friendica\Content\Widget\TrendingTags; use Friendica\Core\ACL; use Friendica\Core\Config; use Friendica\Core\L10n; -use Friendica\Core\PConfig; use Friendica\Core\Renderer; use Friendica\Core\Session; use Friendica\Database\DBA; @@ -138,9 +137,9 @@ function community_content(App $a, $update = 0) // check if we serve a mobile device and get the user settings accordingly 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 { - $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 diff --git a/mod/network.php b/mod/network.php index 59e3b80b5b..d4e371c152 100644 --- a/mod/network.php +++ b/mod/network.php @@ -16,7 +16,6 @@ use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; -use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Core\Session; @@ -70,7 +69,7 @@ function network_init(App $a) $sel_nets = $_GET['nets'] ?? ''; $sel_tabs = network_query_get_sel_tab($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'); @@ -219,10 +218,10 @@ function networkPager(App $a, Pager $pager, $update) // check if we serve a mobile device and get the user settings // accordingly 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); } 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); } @@ -282,7 +281,7 @@ function networkConversation(App $a, $items, Pager $pager, $mode, $update, $orde $o = conversation($a, $items, $pager, $mode, $update, false, $ordering, local_user()); if (!$update) { - if (PConfig::get(local_user(), 'system', 'infinite_scroll')) { + if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) { $o .= HTML::scrollLoader(); } else { $o .= $pager->renderMinimal(count($items)); @@ -491,7 +490,7 @@ function networkThreadedView(App $a, $update, $parent) $tabs = network_tabs($a); $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.", "Warning: This group contains %s members from a network that doesn't allow non public messages.", $t) . EOL); @@ -612,7 +611,7 @@ function networkThreadedView(App $a, $update, $parent) 'id' => 'network', ]) . $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); } } else { @@ -770,7 +769,7 @@ function networkThreadedView(App $a, $update, $parent) // 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) - $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']) && (($bottom_limit < $_SESSION['network_last_date']) || ($top_limit == $bottom_limit)) && @@ -959,7 +958,7 @@ function network_tabs(App $a) // save selected tab, but only if not in file mode if (empty($_GET['file'])) { - PConfig::set(local_user(), 'network.view', 'tab.selected', [ + DI::pConfig()->set(local_user(), 'network.view', 'tab.selected', [ $all_active, $post_active, $conv_active, $new_active, $starred_active, $bookmarked_active ]); } @@ -994,7 +993,7 @@ function network_infinite_scroll_head(App $a, &$htmlhead) */ global $pager; - if (PConfig::get(local_user(), 'system', 'infinite_scroll') + if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll') && ($_GET['mode'] ?? '') != 'minimal' ) { $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl'); diff --git a/mod/ostatus_subscribe.php b/mod/ostatus_subscribe.php index e199b2818c..f6d826e85a 100644 --- a/mod/ostatus_subscribe.php +++ b/mod/ostatus_subscribe.php @@ -5,7 +5,6 @@ use Friendica\App; use Friendica\Core\L10n; -use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\DI; use Friendica\Model\Contact; @@ -26,17 +25,17 @@ function ostatus_subscribe_content(App $a) $counter = intval($_REQUEST['counter']); - if (PConfig::get($uid, 'ostatus', 'legacy_friends') == '') { + if (DI::pConfig()->get($uid, 'ostatus', 'legacy_friends') == '') { if ($_REQUEST['url'] == '') { - PConfig::delete($uid, 'ostatus', 'legacy_contact'); + DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact'); return $o . L10n::t('No contact provided.'); } $contact = Probe::uri($_REQUEST['url']); if (!$contact) { - PConfig::delete($uid, 'ostatus', 'legacy_contact'); + DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact'); return $o . L10n::t('Couldn\'t fetch information for contact.'); } @@ -46,14 +45,14 @@ function ostatus_subscribe_content(App $a) $curlResult = Network::curl($api . 'statuses/friends.json?screen_name=' . $contact['nick']); if (!$curlResult->isSuccess()) { - PConfig::delete($uid, 'ostatus', 'legacy_contact'); + DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact'); return $o . L10n::t('Couldn\'t fetch friends for contact.'); } - PConfig::set($uid, 'ostatus', 'legacy_friends', $curlResult->getBody()); + DI::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)) { $friends = []; @@ -63,8 +62,8 @@ function ostatus_subscribe_content(App $a) if ($counter >= $total) { DI::page()['htmlhead'] = ''; - PConfig::delete($uid, 'ostatus', 'legacy_friends'); - PConfig::delete($uid, 'ostatus', 'legacy_contact'); + DI::pConfig()->delete($uid, 'ostatus', 'legacy_friends'); + DI::pConfig()->delete($uid, 'ostatus', 'legacy_contact'); $o .= L10n::t('Done'); return $o; } diff --git a/mod/ping.php b/mod/ping.php index 6e4f32927d..2f6d8a9a58 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -10,7 +10,6 @@ use Friendica\Core\Cache\Duration; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; -use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; @@ -453,7 +452,7 @@ function ping_get_notifications($uid) && empty($result[$notification["parent"]]) ) { // 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; } else { $result[$notification["parent"]] = $notification; diff --git a/mod/profiles.php b/mod/profiles.php index 575d3443fb..f333e302f0 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -11,7 +11,6 @@ use Friendica\Content\Nav; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; -use Friendica\Core\PConfig; use Friendica\Core\Renderer; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -338,7 +337,7 @@ function profiles_post(App $a) { $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); - PConfig::set(local_user(), 'system', 'detailled_profile', !empty($_POST['detailed_profile']) ? 1: 0); + DI::pConfig()->set(local_user(), 'system', 'detailled_profile', !empty($_POST['detailed_profile']) ? 1: 0); $changes = []; if ($is_default) { @@ -535,7 +534,7 @@ function profiles_content(App $a) { $personal_account = !(in_array($a->user["page-flags"], [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); $tpl = Renderer::getMarkupTemplate("profile_edit.tpl"); diff --git a/mod/profperm.php b/mod/profperm.php index 218d1973ee..a79358c819 100644 --- a/mod/profperm.php +++ b/mod/profperm.php @@ -5,10 +5,10 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; -use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Content\Text\HTML; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Profile; function profperm_init(App $a) @@ -41,7 +41,7 @@ function profperm_content(App $a) { // 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)) { $switchtotext = Config::get('system','groupedit_image_limit', 400); } diff --git a/mod/salmon.php b/mod/salmon.php index 313c2cb0bb..c7b25a6655 100644 --- a/mod/salmon.php +++ b/mod/salmon.php @@ -5,9 +5,9 @@ use Friendica\App; use Friendica\Core\Logger; -use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Contact; use Friendica\Protocol\ActivityNamespace; use Friendica\Protocol\OStatus; @@ -158,7 +158,7 @@ function salmon_post(App $a, $xml = '') { if (!DBA::isResult($r)) { 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); if ($result['success']) { diff --git a/mod/settings.php b/mod/settings.php index 4f44e9a00e..8213fda7c9 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -12,7 +12,6 @@ use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; -use Friendica\Core\PConfig; use Friendica\Core\Renderer; use Friendica\Core\Session; use Friendica\Core\Theme; @@ -233,13 +232,13 @@ function settings_post(App $a) BaseModule::checkFormSecurityTokenRedirectOnError('/settings/connectors', 'settings_connectors'); if (!empty($_POST['general-submit'])) { - PConfig::set(local_user(), 'system', 'accept_only_sharer', intval($_POST['accept_only_sharer'])); - PConfig::set(local_user(), 'system', 'disable_cw', intval($_POST['disable_cw'])); - PConfig::set(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening'])); - PConfig::set(local_user(), 'system', 'attach_link_title', intval($_POST['attach_link_title'])); - PConfig::set(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow'])); - PConfig::set(local_user(), 'ostatus', 'default_group', $_POST['group-selection']); - PConfig::set(local_user(), 'ostatus', 'legacy_contact', $_POST['legacy_contact']); + DI::pConfig()->set(local_user(), 'system', 'accept_only_sharer', intval($_POST['accept_only_sharer'])); + DI::pConfig()->set(local_user(), 'system', 'disable_cw', intval($_POST['disable_cw'])); + DI::pConfig()->set(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening'])); + DI::pConfig()->set(local_user(), 'system', 'attach_link_title', intval($_POST['attach_link_title'])); + DI::pConfig()->set(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow'])); + DI::pConfig()->set(local_user(), 'ostatus', 'default_group', $_POST['group-selection']); + DI::pConfig()->set(local_user(), 'ostatus', 'legacy_contact', $_POST['legacy_contact']); } elseif (!empty($_POST['imap-submit'])) { $mail_server = $_POST['mail_server'] ?? ''; $mail_port = $_POST['mail_port'] ?? ''; @@ -314,7 +313,7 @@ function settings_post(App $a) BaseModule::checkFormSecurityTokenRedirectOnError('/settings/features', 'settings_features'); foreach ($_POST as $k => $v) { if (strpos($k, 'feature_') === 0) { - PConfig::set(local_user(), 'feature', substr($k, 8), ((intval($v)) ? 1 : 0)); + DI::pConfig()->set(local_user(), 'feature', substr($k, 8), ((intval($v)) ? 1 : 0)); } } info(L10n::t('Features updated') . EOL); @@ -352,20 +351,20 @@ function settings_post(App $a) } if ($mobile_theme !== '') { - PConfig::set(local_user(), 'system', 'mobile_theme', $mobile_theme); + DI::pConfig()->set(local_user(), 'system', 'mobile_theme', $mobile_theme); } - PConfig::set(local_user(), 'system', 'nowarn_insecure' , $nowarn_insecure); - PConfig::set(local_user(), 'system', 'update_interval' , $browser_update); - PConfig::set(local_user(), 'system', 'itemspage_network' , $itemspage_network); - PConfig::set(local_user(), 'system', 'itemspage_mobile_network', $itemspage_mobile_network); - PConfig::set(local_user(), 'system', 'no_smilies' , $nosmile); - PConfig::set(local_user(), 'system', 'first_day_of_week' , $first_day_of_week); - PConfig::set(local_user(), 'system', 'ignore_info' , $noinfo); - PConfig::set(local_user(), 'system', 'infinite_scroll' , $infinite_scroll); - PConfig::set(local_user(), 'system', 'no_auto_update' , $no_auto_update); - PConfig::set(local_user(), 'system', 'bandwidth_saver' , $bandwidth_saver); - PConfig::set(local_user(), 'system', 'no_smart_threading' , $no_smart_threading); + DI::pConfig()->set(local_user(), 'system', 'nowarn_insecure' , $nowarn_insecure); + DI::pConfig()->set(local_user(), 'system', 'update_interval' , $browser_update); + DI::pConfig()->set(local_user(), 'system', 'itemspage_network' , $itemspage_network); + DI::pConfig()->set(local_user(), 'system', 'itemspage_mobile_network', $itemspage_mobile_network); + DI::pConfig()->set(local_user(), 'system', 'no_smilies' , $nosmile); + DI::pConfig()->set(local_user(), 'system', 'first_day_of_week' , $first_day_of_week); + DI::pConfig()->set(local_user(), 'system', 'ignore_info' , $noinfo); + DI::pConfig()->set(local_user(), 'system', 'infinite_scroll' , $infinite_scroll); + DI::pConfig()->set(local_user(), 'system', 'no_auto_update' , $no_auto_update); + DI::pConfig()->set(local_user(), 'system', 'bandwidth_saver' , $bandwidth_saver); + DI::pConfig()->set(local_user(), 'system', 'no_smart_threading' , $no_smart_threading); if (in_array($theme, Theme::getAllowedList())) { if ($theme == $a->user['theme']) { @@ -568,16 +567,16 @@ function settings_post(App $a) $str_group_deny = !empty($_POST['group_deny']) ? $aclFormatter->toString($_POST['group_deny']) : ''; $str_contact_deny = !empty($_POST['contact_deny']) ? $aclFormatter->toString($_POST['contact_deny']) : ''; - PConfig::set(local_user(), 'expire', 'items', $expire_items); - PConfig::set(local_user(), 'expire', 'notes', $expire_notes); - PConfig::set(local_user(), 'expire', 'starred', $expire_starred); - PConfig::set(local_user(), 'expire', 'photos', $expire_photos); - PConfig::set(local_user(), 'expire', 'network_only', $expire_network_only); + DI::pConfig()->set(local_user(), 'expire', 'items', $expire_items); + DI::pConfig()->set(local_user(), 'expire', 'notes', $expire_notes); + DI::pConfig()->set(local_user(), 'expire', 'starred', $expire_starred); + DI::pConfig()->set(local_user(), 'expire', 'photos', $expire_photos); + DI::pConfig()->set(local_user(), 'expire', 'network_only', $expire_network_only); - PConfig::set(local_user(), 'system', 'suggestme', $suggestme); + DI::pConfig()->set(local_user(), 'system', 'suggestme', $suggestme); - PConfig::set(local_user(), 'system', 'email_textonly', $email_textonly); - PConfig::set(local_user(), 'system', 'detailed_notif', $detailed_notif); + DI::pConfig()->set(local_user(), 'system', 'email_textonly', $email_textonly); + DI::pConfig()->set(local_user(), 'system', 'detailed_notif', $detailed_notif); if ($page_flags == User::PAGE_FLAGS_PRVGROUP) { $hidewall = 1; @@ -776,13 +775,13 @@ function settings_content(App $a) } if (($a->argc > 1) && ($a->argv[1] === 'connectors')) { - $accept_only_sharer = intval(PConfig::get(local_user(), 'system', 'accept_only_sharer')); - $disable_cw = intval(PConfig::get(local_user(), 'system', 'disable_cw')); - $no_intelligent_shortening = intval(PConfig::get(local_user(), 'system', 'no_intelligent_shortening')); - $attach_link_title = intval(PConfig::get(local_user(), 'system', 'attach_link_title')); - $ostatus_autofriend = intval(PConfig::get(local_user(), 'system', 'ostatus_autofriend')); - $default_group = PConfig::get(local_user(), 'ostatus', 'default_group'); - $legacy_contact = PConfig::get(local_user(), 'ostatus', 'legacy_contact'); + $accept_only_sharer = intval(DI::pConfig()->get(local_user(), 'system', 'accept_only_sharer')); + $disable_cw = intval(DI::pConfig()->get(local_user(), 'system', 'disable_cw')); + $no_intelligent_shortening = intval(DI::pConfig()->get(local_user(), 'system', 'no_intelligent_shortening')); + $attach_link_title = intval(DI::pConfig()->get(local_user(), 'system', 'attach_link_title')); + $ostatus_autofriend = intval(DI::pConfig()->get(local_user(), 'system', 'ostatus_autofriend')); + $default_group = DI::pConfig()->get(local_user(), 'ostatus', 'default_group'); + $legacy_contact = DI::pConfig()->get(local_user(), 'ostatus', 'legacy_contact'); if (!empty($legacy_contact)) { /// @todo Isn't it supposed to be a $a->internalRedirect() call? @@ -915,27 +914,27 @@ function settings_content(App $a) $theme_selected = $a->user['theme'] ?: $default_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) { $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_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 - $nosmile = PConfig::get(local_user(), 'system', 'no_smilies', 0); - $first_day_of_week = PConfig::get(local_user(), 'system', 'first_day_of_week', 0); + $nosmile = DI::pConfig()->get(local_user(), 'system', 'no_smilies', 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")]; - $noinfo = PConfig::get(local_user(), 'system', 'ignore_info', 0); - $infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll', 0); - $no_auto_update = PConfig::get(local_user(), 'system', 'no_auto_update', 0); - $bandwidth_saver = PConfig::get(local_user(), 'system', 'bandwidth_saver', 0); - $no_smart_threading = PConfig::get(local_user(), 'system', 'no_smart_threading', 0); + $noinfo = DI::pConfig()->get(local_user(), 'system', 'ignore_info', 0); + $infinite_scroll = DI::pConfig()->get(local_user(), 'system', 'infinite_scroll', 0); + $no_auto_update = DI::pConfig()->get(local_user(), 'system', 'no_auto_update', 0); + $bandwidth_saver = DI::pConfig()->get(local_user(), 'system', 'bandwidth_saver', 0); + $no_smart_threading = DI::pConfig()->get(local_user(), 'system', 'no_smart_threading', 0); $theme_config = ""; if (($themeconfigfile = get_theme_config_file($theme_selected)) !== null) { @@ -1000,12 +999,12 @@ function settings_content(App $a) $unkmail = $a->user['unkmail']; $cntunkmail = $a->user['cntunkmail']; - $expire_items = PConfig::get(local_user(), 'expire', 'items', true); - $expire_notes = PConfig::get(local_user(), 'expire', 'notes', true); - $expire_starred = PConfig::get(local_user(), 'expire', 'starred', true); - $expire_photos = PConfig::get(local_user(), 'expire', 'photos', false); - $expire_network_only = PConfig::get(local_user(), 'expire', 'network_only', false); - $suggestme = PConfig::get(local_user(), 'system', 'suggestme', false); + $expire_items = DI::pConfig()->get(local_user(), 'expire', 'items', true); + $expire_notes = DI::pConfig()->get(local_user(), 'expire', 'notes', true); + $expire_starred = DI::pConfig()->get(local_user(), 'expire', 'starred', true); + $expire_photos = DI::pConfig()->get(local_user(), 'expire', 'photos', false); + $expire_network_only = DI::pConfig()->get(local_user(), 'expire', 'network_only', false); + $suggestme = DI::pConfig()->get(local_user(), 'system', 'suggestme', false); // nowarn_insecure @@ -1244,11 +1243,11 @@ function settings_content(App $a) '$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'), - 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')], '$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.')], '$h_advn' => L10n::t('Advanced Account/Page Type Settings'), diff --git a/mod/update_community.php b/mod/update_community.php index e15520320e..2f23bb7deb 100644 --- a/mod/update_community.php +++ b/mod/update_community.php @@ -4,7 +4,7 @@ use Friendica\App; use Friendica\Core\L10n; -use Friendica\Core\PConfig; +use Friendica\DI; require_once 'mod/community.php'; @@ -19,7 +19,7 @@ function update_community_content(App $a) { $text = ''; } - if (PConfig::get(local_user(), "system", "bandwidth_saver")) { + if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) { $replace = "
".L10n::t("[Embedded content - reload page to view]")."
"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $text = preg_replace($pattern, $replace, $text); diff --git a/mod/update_contact.php b/mod/update_contact.php index bea33b4841..5092dd835c 100644 --- a/mod/update_contact.php +++ b/mod/update_contact.php @@ -4,7 +4,7 @@ use Friendica\App; use Friendica\Core\L10n; -use Friendica\Core\PConfig; +use Friendica\DI; use Friendica\Module\Contact; function update_contact_content(App $a) @@ -19,7 +19,7 @@ function update_contact_content(App $a) $text = ''; } - if (PConfig::get(local_user(), "system", "bandwidth_saver")) { + if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) { $replace = "
".L10n::t("[Embedded content - reload page to view]")."
"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $text = preg_replace($pattern, $replace, $text); diff --git a/mod/update_display.php b/mod/update_display.php index 4059332510..569c76ab31 100644 --- a/mod/update_display.php +++ b/mod/update_display.php @@ -6,7 +6,7 @@ use Friendica\App; use Friendica\Core\L10n; -use Friendica\Core\PConfig; +use Friendica\DI; require_once "mod/display.php"; @@ -20,7 +20,7 @@ function update_display_content(App $a) $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 = "
" . L10n::t("[Embedded content - reload page to view]") . "
"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $text = preg_replace($pattern, $replace, $text); diff --git a/mod/update_network.php b/mod/update_network.php index 6ba761d04a..2ae9ccb787 100644 --- a/mod/update_network.php +++ b/mod/update_network.php @@ -6,7 +6,7 @@ use Friendica\App; use Friendica\Core\L10n; -use Friendica\Core\PConfig; +use Friendica\DI; require_once "mod/network.php"; @@ -23,13 +23,13 @@ function update_network_content(App $a) echo "\r\n"; echo "
"; - 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); } else { $text = ""; } - if (PConfig::get(local_user(), "system", "bandwidth_saver")) { + if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) { $replace = "
" . L10n::t("[Embedded content - reload page to view]") . "
"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $text = preg_replace($pattern, $replace, $text); diff --git a/mod/update_notes.php b/mod/update_notes.php index 10f60c1ef1..989af976a2 100644 --- a/mod/update_notes.php +++ b/mod/update_notes.php @@ -7,7 +7,7 @@ use Friendica\App; use Friendica\Core\L10n; -use Friendica\Core\PConfig; +use Friendica\DI; require_once("mod/notes.php"); @@ -32,7 +32,7 @@ function update_notes_content(App $a) { $text = notes_content($a, $profile_uid); - if (PConfig::get(local_user(), "system", "bandwidth_saver")) { + if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) { $replace = "
".L10n::t("[Embedded content - reload page to view]")."
"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $text = preg_replace($pattern, $replace, $text); diff --git a/mod/update_profile.php b/mod/update_profile.php index 85ca3d3c97..38802866d9 100644 --- a/mod/update_profile.php +++ b/mod/update_profile.php @@ -7,7 +7,7 @@ use Friendica\App; use Friendica\Core\L10n; -use Friendica\Core\PConfig; +use Friendica\DI; use Friendica\Module\Profile; function update_profile_content(App $a) { @@ -30,7 +30,7 @@ function update_profile_content(App $a) { $text = Profile::content([], $profile_uid); - if (PConfig::get(local_user(), "system", "bandwidth_saver")) { + if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) { $replace = "
".L10n::t("[Embedded content - reload page to view]")."
"; $pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i"; $text = preg_replace($pattern, $replace, $text); diff --git a/src/App.php b/src/App.php index 4a62031381..7f22cfd91d 100644 --- a/src/App.php +++ b/src/App.php @@ -7,7 +7,6 @@ namespace Friendica; use Exception; use Friendica\App\Arguments; use Friendica\App\BaseURL; -use Friendica\App\Page; use Friendica\App\Authentication; use Friendica\Core\Config\Cache\ConfigCache; use Friendica\Core\Config\IConfiguration; @@ -118,6 +117,11 @@ class App */ private $process; + /** + * @var IPConfiguration + */ + private $pConfig; + /** * Returns the current config cache of this node * @@ -149,8 +153,9 @@ class App * @param L10n $l10n The translator instance * @param App\Arguments $args The Friendica Arguments of the call * @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->config = $config; @@ -161,6 +166,7 @@ class App $this->l10n = $l10n; $this->args = $args; $this->process = $process; + $this->pConfig = $pConfig; $this->argv = $args->getArgv(); $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. // This works only if the user is on the same server $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']; } } @@ -368,8 +374,8 @@ class App if ($this->profile_uid && ($this->profile_uid != local_user())) { // 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 - if (!Core\PConfig::get(local_user(), 'system', 'always_my_theme')) { - $page_mobile_theme = Core\PConfig::get($this->profile_uid, 'system', 'mobile-theme'); + if (!$this->pConfig->get(local_user(), 'system', 'always_my_theme')) { + $page_mobile_theme = $this->pConfig->get($this->profile_uid, 'system', 'mobile-theme'); } } diff --git a/src/App/Authentication.php b/src/App/Authentication.php index 39c684ffd3..2ffa5814a2 100644 --- a/src/App/Authentication.php +++ b/src/App/Authentication.php @@ -9,8 +9,8 @@ namespace Friendica\App; use Exception; use Friendica\App; use Friendica\Core\Config\IConfiguration; +use Friendica\Core\Config\IPConfiguration; use Friendica\Core\Hook; -use Friendica\Core\PConfig; use Friendica\Core\Session; use Friendica\Core\System; use Friendica\Database\Database; @@ -46,6 +46,8 @@ class Authentication private $cookie; /** @var Session\ISession */ private $session; + /** @var IPConfiguration */ + private $pConfig; /** * Authentication constructor. @@ -58,17 +60,19 @@ class Authentication * @param LoggerInterface $logger * @param User\Cookie $cookie * @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->mode = $mode; + $this->mode = $mode; $this->baseUrl = $baseUrl; $this->l10n = $l10n; $this->dba = $dba; $this->logger = $logger; - $this->cookie = $cookie; + $this->cookie = $cookie; $this->session = $session; + $this->pConfig = $pConfig; } /** @@ -295,7 +299,7 @@ class Authentication $this->session->setMultiple([ 'uid' => $user_record['uid'], '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, 'page_flags' => $user_record['page-flags'], 'my_url' => $this->baseUrl->get() . '/profile/' . $user_record['nickname'], @@ -395,7 +399,7 @@ class Authentication private function twoFactorCheck(int $uid, App $a) { // Check user setting, if 2FA disabled return - if (!PConfig::get($uid, '2fa', 'verified')) { + if (!$this->pConfig->get($uid, '2fa', 'verified')) { return; } diff --git a/src/Content/Feature.php b/src/Content/Feature.php index 0f119d3054..995f33292b 100644 --- a/src/Content/Feature.php +++ b/src/Content/Feature.php @@ -8,7 +8,7 @@ namespace Friendica\Content; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; -use Friendica\Core\PConfig; +use Friendica\DI; class Feature { @@ -25,7 +25,7 @@ class Feature $x = Config::get('feature_lock', $feature, false); if ($x === false) { - $x = PConfig::get($uid, 'feature', $feature, false); + $x = DI::pConfig()->get($uid, 'feature', $feature, false); } if ($x === false) { diff --git a/src/Content/Smilies.php b/src/Content/Smilies.php index 08c6309018..cafc6f3147 100644 --- a/src/Content/Smilies.php +++ b/src/Content/Smilies.php @@ -16,7 +16,6 @@ namespace Friendica\Content; use Friendica\Core\Config; use Friendica\Core\Hook; -use Friendica\Core\PConfig; use Friendica\DI; use Friendica\Util\Strings; @@ -210,7 +209,7 @@ class Smilies public static function replaceFromArray($text, array $smilies, $no_images = false) { 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; } diff --git a/src/Content/Widget.php b/src/Content/Widget.php index 8f88a0d836..74955be020 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -7,7 +7,6 @@ namespace Friendica\Content; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; -use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Core\Session; @@ -51,7 +50,7 @@ class Widget $global_dir = Config::get('system', 'directory'); 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()) { DI::page()['aside'] .= '