aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Controllers/userController.php11
-rw-r--r--app/Models/Context.php8
-rw-r--r--app/Models/UserConfiguration.php35
-rw-r--r--app/views/auth/formLogin.phtml2
-rw-r--r--app/views/auth/register.phtml2
5 files changed, 16 insertions, 42 deletions
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php
index 35851fceb..4ce02946b 100644
--- a/app/Controllers/userController.php
+++ b/app/Controllers/userController.php
@@ -54,8 +54,8 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
}
foreach ($userConfigUpdated as $configName => $configValue) {
- if ($configValue !== null) {
- $userConfig->_param($configName, $configValue);
+ if ($configName !== '' && $configValue !== null) {
+ $userConfig->_attribute($configName, $configValue);
}
}
@@ -624,7 +624,12 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
return;
}
- $userConfig->_param($field, $value);
+ if ($field === '') {
+ Minz_Error::error(400, 'Invalid field name');
+ return;
+ }
+
+ $userConfig->_attribute($field, $value);
$ok = $userConfig->save();
FreshRSS_UserDAO::touch($username);
diff --git a/app/Models/Context.php b/app/Models/Context.php
index 9a4e0192e..27b1c4309 100644
--- a/app/Models/Context.php
+++ b/app/Models/Context.php
@@ -55,10 +55,12 @@ final class FreshRSS_Context {
public static bool $isCli = false;
/**
+ * @access private
* @deprecated Will be made `private`; use `FreshRSS_Context::systemConf()` instead.
*/
public static ?FreshRSS_SystemConfiguration $system_conf = null;
/**
+ * @access private
* @deprecated Will be made `private`; use `FreshRSS_Context::userConf()` instead.
*/
public static ?FreshRSS_UserConfiguration $user_conf = null;
@@ -128,10 +130,8 @@ final class FreshRSS_Context {
FreshRSS_Context::$search = new FreshRSS_BooleanSearch('');
//Legacy
- $oldEntries = FreshRSS_Context::$user_conf->param('old_entries', 0);
- $oldEntries = is_numeric($oldEntries) ? (int)$oldEntries : 0;
- $keepMin = FreshRSS_Context::$user_conf->param('keep_history_default', -5);
- $keepMin = is_numeric($keepMin) ? (int)$keepMin : -5;
+ $oldEntries = FreshRSS_Context::$user_conf->attributeInt('old_entries') ?? 0;
+ $keepMin = FreshRSS_Context::$user_conf->attributeInt('keep_history_default') ?? -5;
if ($oldEntries > 0 || $keepMin > -5) { //Freshrss < 1.15
$archiving = FreshRSS_Context::$user_conf->archiving;
$archiving['keep_max'] = false;
diff --git a/app/Models/UserConfiguration.php b/app/Models/UserConfiguration.php
index e53de00d3..919487bf0 100644
--- a/app/Models/UserConfiguration.php
+++ b/app/Models/UserConfiguration.php
@@ -105,39 +105,4 @@ final class FreshRSS_UserConfiguration extends Minz_Configuration {
}
return $default_user_conf;
}
-
- /**
- * @param non-empty-string $key
- * @return array<int|string,mixed>|null
- */
- public function attributeArray(string $key): ?array {
- $a = parent::param($key, null);
- return is_array($a) ? $a : null;
- }
-
- /** @param non-empty-string $key */
- public function attributeBool(string $key): ?bool {
- $a = parent::param($key, null);
- return is_bool($a) ? $a : null;
- }
-
- /** @param non-empty-string $key */
- public function attributeInt(string $key): ?int {
- $a = parent::param($key, null);
- return is_numeric($a) ? (int)$a : null;
- }
-
- /** @param non-empty-string $key */
- public function attributeString(string $key): ?string {
- $a = parent::param($key, null);
- return is_string($a) ? $a : null;
- }
-
- /**
- * @param non-empty-string $key
- * @param array<string,mixed>|mixed|null $value Value, not HTML-encoded
- */
- public function _attribute(string $key, $value = null): void {
- parent::_param($key, $value);
- }
}
diff --git a/app/views/auth/formLogin.phtml b/app/views/auth/formLogin.phtml
index 6deade3f4..d72d0b1b3 100644
--- a/app/views/auth/formLogin.phtml
+++ b/app/views/auth/formLogin.phtml
@@ -38,6 +38,8 @@
</label>
</div>
+ <?= Minz_ExtensionManager::callHookString('before_login_btn') ?>
+
<div class="form-group form-group-actions">
<button id="loginButton" type="submit" class="btn btn-important" disabled="disabled">
<?= _t('gen.auth.login') ?>
diff --git a/app/views/auth/register.phtml b/app/views/auth/register.phtml
index fee221708..daaf08b8c 100644
--- a/app/views/auth/register.phtml
+++ b/app/views/auth/register.phtml
@@ -66,6 +66,8 @@
</div>
<?php } ?>
+ <?= Minz_ExtensionManager::callHookString('before_login_btn') ?>
+
<div class="form-group form-group-actions">
<?php
$redirect_url = urlencode(Minz_Url::display(