// 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']);
}
}
// 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
]);
}
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(DI::pConfig()->get($uid, 'ostatus', 'legacy_friends'));
$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) {
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;
*/
class PConfig
{
- /**
- * @brief Sets a configuration value for a user
- *
- * @param int $uid The user_id
- * @param string $cat The category of the configuration value
- * @param string $key The configuration key to set
- * @param mixed $value The value to store
- *
- * @return bool Operation success
- */
- public static function set(int $uid, string $cat, string $key, $value)
- {
- return DI::pConfig()->set($uid, $cat, $key, $value);
- }
-
/**
* @brief Deletes the given key from the users's configuration.
*
}
$newuid = self::lastInsertId();
- PConfig::set($newuid, 'system', 'previous_addr', $old_handle);
+ DI::pConfig()->set($newuid, 'system', 'previous_addr', $old_handle);
foreach ($account['profile'] as &$profile) {
foreach ($profile as $k => &$v) {
}
if ($saved != $filetags_updated) {
- PConfig::set($uid, 'system', 'filetags', $filetags_updated);
+ DI::pConfig()->set($uid, 'system', 'filetags', $filetags_updated);
}
return true;
} elseif (strlen($file_new)) {
- PConfig::set($uid, 'system', 'filetags', $file_new);
+ DI::pConfig()->set($uid, 'system', 'filetags', $file_new);
}
return true;
$saved = DI::pConfig()->get($uid, 'system', 'filetags');
if (!strlen($saved) || !stristr($saved, '[' . self::encode($file) . ']')) {
- PConfig::set($uid, 'system', 'filetags', $saved . '[' . self::encode($file) . ']');
+ DI::pConfig()->set($uid, 'system', 'filetags', $saved . '[' . self::encode($file) . ']');
}
info(L10n::t('Item filed'));
if (!DBA::isResult($r)) {
$saved = DI::pConfig()->get($uid, 'system', 'filetags');
- PConfig::set($uid, 'system', 'filetags', str_replace($pattern, '', $saved));
+ DI::pConfig()->set($uid, 'system', 'filetags', str_replace($pattern, '', $saved));
}
return true;
if (!is_site_admin()) {
$invites_remaining--;
if ($invites_remaining >= 0) {
- PConfig::set(local_user(), 'system', 'invites_remaining', $invites_remaining);
+ DI::pConfig()->set(local_user(), 'system', 'invites_remaining', $invites_remaining);
} else {
return;
}
if ($res) {
$total++;
$current_invites++;
- PConfig::set(local_user(), 'system', 'sent_invites', $current_invites);
+ DI::pConfig()->set(local_user(), 'system', 'sent_invites', $current_invites);
if ($current_invites > $max_invites) {
notice(L10n::t('Invitation limit exceeded. Please contact your site administrator.') . EOL);
return;
if (intval(Config::get('config', 'register_policy')) === self::OPEN) {
if ($using_invites && $invite_id) {
Model\Register::deleteByHash($invite_id);
- PConfig::set($user['uid'], 'system', 'invites_remaining', $num_invites);
+ DI::pConfig()->set($user['uid'], 'system', 'invites_remaining', $num_invites);
}
// Only send a password mail when the password wasn't manually provided
// invite system
if ($using_invites && $invite_id) {
Model\Register::deleteByHash($invite_id);
- PConfig::set($user['uid'], 'system', 'invites_remaining', $num_invites);
+ DI::pConfig()->set($user['uid'], 'system', 'invites_remaining', $num_invites);
}
// send email to admins
if (!$has_secret && !$verified) {
$Google2FA = new Google2FA();
- PConfig::set(local_user(), '2fa', 'secret', $Google2FA->generateSecretKey(32));
+ DI::pConfig()->set(local_user(), '2fa', 'secret', $Google2FA->generateSecretKey(32));
DI::baseUrl()->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
$valid = $google2fa->verifyKey(DI::pConfig()->get(local_user(), '2fa', 'secret'), $_POST['verify_code'] ?? '');
if ($valid) {
- PConfig::set(local_user(), '2fa', 'verified', true);
+ DI::pConfig()->set(local_user(), '2fa', 'verified', true);
Session::set('2fa', true);
notice(L10n::t('Two-factor authentication successfully activated.'));
use Friendica\Core\Update;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\Item;
if ($key === 'show_on_profile') {
if ($value) {
- PConfig::set($uid, feature, forumlist_profile, $value);
+ DI::pConfig()->set($uid, feature, forumlist_profile, $value);
}
PConfig::delete($uid, $family, $key);
if ($key === 'show_on_network') {
if ($value) {
- PConfig::set($uid, feature, forumlist_widget, $value);
+ DI::pConfig()->set($uid, feature, forumlist_widget, $value);
}
PConfig::delete($uid, $family, $key);
}
if (isset($_POST['duepuntozero-settings-submit'])) {
- PConfig::set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
+ DI::pConfig()->set(local_user(), 'duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
}
}
}
if (isset($_POST['frio-settings-submit'])) {
- PConfig::set(local_user(), 'frio', 'scheme', $_POST['frio_scheme'] ?? '');
- PConfig::set(local_user(), 'frio', 'nav_bg', $_POST['frio_nav_bg'] ?? '');
- PConfig::set(local_user(), 'frio', 'nav_icon_color', $_POST['frio_nav_icon_color'] ?? '');
- PConfig::set(local_user(), 'frio', 'link_color', $_POST['frio_link_color'] ?? '');
- PConfig::set(local_user(), 'frio', 'background_color', $_POST['frio_background_color'] ?? '');
- PConfig::set(local_user(), 'frio', 'contentbg_transp', $_POST['frio_contentbg_transp'] ?? '');
- PConfig::set(local_user(), 'frio', 'background_image', $_POST['frio_background_image'] ?? '');
- PConfig::set(local_user(), 'frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? '');
- PConfig::set(local_user(), 'frio', 'css_modified', time());
- PConfig::set(local_user(), 'frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0);
+ DI::pConfig()->set(local_user(), 'frio', 'scheme', $_POST['frio_scheme'] ?? '');
+ DI::pConfig()->set(local_user(), 'frio', 'nav_bg', $_POST['frio_nav_bg'] ?? '');
+ DI::pConfig()->set(local_user(), 'frio', 'nav_icon_color', $_POST['frio_nav_icon_color'] ?? '');
+ DI::pConfig()->set(local_user(), 'frio', 'link_color', $_POST['frio_link_color'] ?? '');
+ DI::pConfig()->set(local_user(), 'frio', 'background_color', $_POST['frio_background_color'] ?? '');
+ DI::pConfig()->set(local_user(), 'frio', 'contentbg_transp', $_POST['frio_contentbg_transp'] ?? '');
+ DI::pConfig()->set(local_user(), 'frio', 'background_image', $_POST['frio_background_image'] ?? '');
+ DI::pConfig()->set(local_user(), 'frio', 'bg_image_option', $_POST['frio_bg_image_option'] ?? '');
+ DI::pConfig()->set(local_user(), 'frio', 'css_modified', time());
+ DI::pConfig()->set(local_user(), 'frio', 'enable_compose', $_POST['frio_enable_compose'] ?? 0);
}
}
}
if (isset($_POST['quattro-settings-submit'])){
- PConfig::set(local_user(), 'quattro', 'align', $_POST['quattro_align']);
- PConfig::set(local_user(), 'quattro', 'color', $_POST['quattro_color']);
- PConfig::set(local_user(), 'quattro', 'tfs', $_POST['quattro_tfs']);
- PConfig::set(local_user(), 'quattro', 'pfs', $_POST['quattro_pfs']);
+ DI::pConfig()->set(local_user(), 'quattro', 'align', $_POST['quattro_align']);
+ DI::pConfig()->set(local_user(), 'quattro', 'color', $_POST['quattro_color']);
+ DI::pConfig()->set(local_user(), 'quattro', 'tfs', $_POST['quattro_tfs']);
+ DI::pConfig()->set(local_user(), 'quattro', 'pfs', $_POST['quattro_pfs']);
}
}
}
if (isset($_POST['vier-settings-submit'])) {
- PConfig::set(local_user(), 'vier', 'style', $_POST['vier_style']);
- PConfig::set(local_user(), 'vier', 'show_pages', $_POST['vier_show_pages']);
- PConfig::set(local_user(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
- PConfig::set(local_user(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
- PConfig::set(local_user(), 'vier', 'show_services', $_POST['vier_show_services']);
- PConfig::set(local_user(), 'vier', 'show_friends', $_POST['vier_show_friends']);
- PConfig::set(local_user(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']);
+ DI::pConfig()->set(local_user(), 'vier', 'style', $_POST['vier_style']);
+ DI::pConfig()->set(local_user(), 'vier', 'show_pages', $_POST['vier_show_pages']);
+ DI::pConfig()->set(local_user(), 'vier', 'show_profiles', $_POST['vier_show_profiles']);
+ DI::pConfig()->set(local_user(), 'vier', 'show_helpers', $_POST['vier_show_helpers']);
+ DI::pConfig()->set(local_user(), 'vier', 'show_services', $_POST['vier_show_services']);
+ DI::pConfig()->set(local_user(), 'vier', 'show_friends', $_POST['vier_show_friends']);
+ DI::pConfig()->set(local_user(), 'vier', 'show_lastusers', $_POST['vier_show_lastusers']);
}
}