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\System;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
{
$theme = Strings::sanitizeFilePathItem($theme);
- $a = \get_app();
+ $a = DI::app();
$base_theme = $a->theme_info['extends'] ?? '';
if (file_exists("view/theme/$theme/config.php")) {
// These lines provide the javascript needed by the acl selector
$tpl = Renderer::getMarkupTemplate('settings/head.tpl');
- $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
+ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$ispublic' => L10n::t('everybody')
]);
$tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl");
- $a->page['aside'] = Renderer::replaceMacros($tabtpl, [
+ DI::page()['aside'] = Renderer::replaceMacros($tabtpl, [
'$title' => L10n::t('Settings'),
'$class' => 'settings-widget',
'$items' => $tabs,
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'] ?? '';
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);
}
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']) {
$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;
}
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?
- $a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl().'/ostatus_subscribe?url=' . urlencode($legacy_contact) . '">';
+ DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . DI::baseUrl().'/ostatus_subscribe?url=' . urlencode($legacy_contact) . '">';
}
$settings_connectors = '';
'$default_group' => Group::displayGroupSelection(local_user(), $default_group, L10n::t("Default group for OStatus contacts")),
'$legacy_contact' => ['legacy_contact', L10n::t('Your legacy GNU Social account'), $legacy_contact, L10n::t("If you enter your old GNU Social/Statusnet account name here \x28in the format user@domain.tld\x29, your contacts will be added automatically. The field will be emptied when done.")],
- '$repair_ostatus_url' => System::baseUrl() . '/repair_ostatus',
+ '$repair_ostatus_url' => DI::baseUrl() . '/repair_ostatus',
'$repair_ostatus_text' => L10n::t('Repair OStatus subscriptions'),
'$settings_connectors' => $settings_connectors,
$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) {
'$ptitle' => L10n::t('Display Settings'),
'$form_security_token' => BaseModule::getFormSecurityToken("settings_display"),
'$submit' => L10n::t('Save Settings'),
- '$baseurl' => System::baseUrl(true),
+ '$baseurl' => DI::baseUrl()->get(true),
'$uid' => local_user(),
'$theme' => ['theme', L10n::t('Display Theme:'), $theme_selected, '', $themes, true],
$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
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
} else {
$profile_in_dir = Renderer::replaceMacros($opt_tpl, [
- '$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', System::baseUrl().'/directory'), [L10n::t('No'), L10n::t('Yes')]]
+ '$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', DI::baseUrl().'/directory'), [L10n::t('No'), L10n::t('Yes')]]
]);
}
$tpl_addr = Renderer::getMarkupTemplate('settings/nick_set.tpl');
$prof_addr = Renderer::replaceMacros($tpl_addr,[
- '$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . DI::baseUrl()->getHostname() . DI::baseUrl()->getUrlPath(), System::baseUrl() . '/profile/' . $nickname),
+ '$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . DI::baseUrl()->getHostname() . DI::baseUrl()->getUrlPath(), DI::baseUrl() . '/profile/' . $nickname),
'$basepath' => DI::baseUrl()->getHostname()
]);
'$ptitle' => L10n::t('Account Settings'),
'$submit' => L10n::t('Save Settings'),
- '$baseurl' => System::baseUrl(true),
+ '$baseurl' => DI::baseUrl()->get(true),
'$uid' => local_user(),
'$form_security_token' => BaseModule::getFormSecurityToken("settings"),
'$nickname_block' => $prof_addr,
'$permissions' => L10n::t('Default Post Permissions'),
'$permdesc' => L10n::t("\x28click to open/close\x29"),
'$visibility' => $profile['net-publish'],
- '$aclselect' => ACL::getFullSelectorHTML($a->page, $a->user),
+ '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->user),
'$suggestme' => $suggestme,
'$blockwall'=> $blockwall, // array('blockwall', L10n::t('Allow friends to post to your profile page:'), !$blockwall, ''),
'$blocktags'=> $blocktags, // array('blocktags', L10n::t('Allow friends to tag your posts:'), !$blocktags, ''),
'$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'),