Move PConfig::set() to DI::pConfig()->set()
This commit is contained in:
parent
9e9429b56d
commit
88bb66371c
17 changed files with 68 additions and 82 deletions
|
@ -19,21 +19,6 @@ use Friendica\DI;
|
|||
*/
|
||||
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.
|
||||
*
|
||||
|
|
|
@ -159,7 +159,7 @@ class UserImport
|
|||
}
|
||||
$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) {
|
||||
|
|
|
@ -223,12 +223,12 @@ class FileTag
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -260,7 +260,7 @@ class FileTag
|
|||
$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'));
|
||||
|
@ -313,7 +313,7 @@ class FileTag
|
|||
|
||||
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;
|
||||
|
|
|
@ -69,7 +69,7 @@ class Invite extends BaseModule
|
|||
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;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class Invite extends BaseModule
|
|||
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;
|
||||
|
|
|
@ -293,7 +293,7 @@ class Register extends BaseModule
|
|||
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
|
||||
|
@ -339,7 +339,7 @@ class Register extends BaseModule
|
|||
// 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
|
||||
|
|
|
@ -37,7 +37,7 @@ class Index extends BaseSettingsModule
|
|||
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'));
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class Verify extends BaseSettingsModule
|
|||
$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.'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue