diff options
| author | 2023-12-18 17:59:16 +0100 | |
|---|---|---|
| committer | 2023-12-18 17:59:16 +0100 | |
| commit | a80a5f48a16e7d232168a7aaa68e9a1804235ce1 (patch) | |
| tree | a515b88592629dea7e83b96e26e2452d3f98a98e /app/views | |
| parent | 6bb45a87268157aab961a6a4a728d9a9bbe043b0 (diff) | |
Pass PHPStan level 8 (#5946)
* Pass PHPStan level 8
And prepare for PHPStan level 9 https://phpstan.org/user-guide/rule-levels
* Revert wrong replace in comment
* Fix PHPStan level 8
* Update PHPStan and other dev dependencies
* Remove obsolete comment
* noVariableVariables and towards bleedingEdge
https://github.com/phpstan/phpstan-strict-rules
https://phpstan.org/blog/what-is-bleeding-edge
* More bleedingEdge
* A bit more PHPStan level 9
* More PHPStan level 9
* Prepare for booleansInConditions
Ignore int and null
* Revert wrong line
* More fixes
* Fix keep_max_n_unread
* Stricter attribute functions
* Stricter callHooks and more PHPStan level 9
* More typing
* A tiny more
Diffstat (limited to 'app/views')
30 files changed, 358 insertions, 329 deletions
diff --git a/app/views/auth/index.phtml b/app/views/auth/index.phtml index 78762c19e..f82adaaae 100644 --- a/app/views/auth/index.phtml +++ b/app/views/auth/index.phtml @@ -15,15 +15,15 @@ <div class="form-group"> <label class="group-name" for="auth_type"><?= _t('admin.auth.type') ?></label> <div class="group-controls"> - <select id="auth_type" name="auth_type" required="required" data-leave-validation="<?= FreshRSS_Context::$system_conf->auth_type ?>"> - <?php if (!in_array(FreshRSS_Context::$system_conf->auth_type, ['form', 'http_auth', 'none'], true)) { ?> + <select id="auth_type" name="auth_type" required="required" data-leave-validation="<?= FreshRSS_Context::systemConf()->auth_type ?>"> + <?php if (!in_array(FreshRSS_Context::systemConf()->auth_type, ['form', 'http_auth', 'none'], true)) { ?> <option selected="selected"></option> <?php } ?> - <option value="form"<?= FreshRSS_Context::$system_conf->auth_type === 'form' ? ' selected="selected"' : '', + <option value="form"<?= FreshRSS_Context::systemConf()->auth_type === 'form' ? ' selected="selected"' : '', cryptAvailable() ? '' : ' disabled="disabled"' ?>><?= _t('admin.auth.form') ?></option> - <option value="http_auth"<?= FreshRSS_Context::$system_conf->auth_type === 'http_auth' ? ' selected="selected"' : '', + <option value="http_auth"<?= FreshRSS_Context::systemConf()->auth_type === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : '' ?>><?= _t('admin.auth.http') ?> (REMOTE_USER = '<?= httpAuthUser() ?>')</option> - <option value="none"<?= FreshRSS_Context::$system_conf->auth_type === 'none' ? ' selected="selected"' : '' ?>><?= _t('admin.auth.none') ?></option> + <option value="none"<?= FreshRSS_Context::systemConf()->auth_type === 'none' ? ' selected="selected"' : '' ?>><?= _t('admin.auth.none') ?></option> </select> </div> </div> @@ -32,9 +32,9 @@ <div class="group-controls"> <label class="checkbox" for="anon_access"> <input type="checkbox" name="anon_access" id="anon_access" value="1"<?= - FreshRSS_Context::$system_conf->allow_anonymous ? ' checked="checked"' : '', - FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"' ?> data-leave-validation="<?= FreshRSS_Context::$system_conf->allow_anonymous ?>"/> - <?= _t('admin.auth.allow_anonymous', FreshRSS_Context::$system_conf->default_user) ?> + FreshRSS_Context::systemConf()->allow_anonymous ? ' checked="checked"' : '', + FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"' ?> data-leave-validation="<?= FreshRSS_Context::systemConf()->allow_anonymous ?>"/> + <?= _t('admin.auth.allow_anonymous', FreshRSS_Context::systemConf()->default_user) ?> </label> </div> </div> @@ -43,8 +43,8 @@ <div class="group-controls"> <label class="checkbox" for="anon_refresh"> <input type="checkbox" name="anon_refresh" id="anon_refresh" value="1"<?= - FreshRSS_Context::$system_conf->allow_anonymous_refresh ? ' checked="checked"' : '', - FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"' ?> data-leave-validation="<?= FreshRSS_Context::$system_conf->allow_anonymous_refresh ?>"/> + FreshRSS_Context::systemConf()->allow_anonymous_refresh ? ' checked="checked"' : '', + FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"' ?> data-leave-validation="<?= FreshRSS_Context::systemConf()->allow_anonymous_refresh ?>"/> <?= _t('admin.auth.allow_anonymous_refresh') ?> </label> </div> @@ -54,8 +54,8 @@ <div class="group-controls"> <label class="checkbox" for="unsafe_autologin"> <input type="checkbox" name="unsafe_autologin" id="unsafe_autologin" value="1"<?= - FreshRSS_Context::$system_conf->unsafe_autologin_enabled ? ' checked="checked"' : '', - FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"' ?> data-leave-validation="<?= FreshRSS_Context::$system_conf->unsafe_autologin_enabled ?>"/> + FreshRSS_Context::systemConf()->unsafe_autologin_enabled ? ' checked="checked"' : '', + FreshRSS_Auth::accessNeedsAction() ? '' : ' disabled="disabled"' ?> data-leave-validation="<?= FreshRSS_Context::systemConf()->unsafe_autologin_enabled ?>"/> <?= _t('admin.auth.unsafe_autologin') ?> <kbd><?= Minz_Url::display(array('c' => 'auth', 'a' => 'login', 'params' => array('u' => 'alice', 'p' => '1234')), 'html', true) ?></kbd> </label> @@ -66,8 +66,8 @@ <div class="group-controls"> <label class="checkbox" for="api_enabled"> <input type="checkbox" name="api_enabled" id="api_enabled" value="1"<?= - FreshRSS_Context::$system_conf->api_enabled ? ' checked="checked"' : '', - FreshRSS_Auth::accessNeedsLogin() ? '' : ' disabled="disabled"' ?> data-leave-validation="<?= FreshRSS_Context::$system_conf->api_enabled ?>"/> + FreshRSS_Context::systemConf()->api_enabled ? ' checked="checked"' : '', + FreshRSS_Auth::accessNeedsLogin() ? '' : ' disabled="disabled"' ?> data-leave-validation="<?= FreshRSS_Context::systemConf()->api_enabled ?>"/> <?= _t('admin.auth.api_enabled') ?> </label> </div> diff --git a/app/views/category/update.phtml b/app/views/category/update.phtml index daf4523bb..2ef42d207 100644 --- a/app/views/category/update.phtml +++ b/app/views/category/update.phtml @@ -5,6 +5,6 @@ declare(strict_types=1); if (!Minz_Request::paramBoolean('ajax')) { $this->partial('aside_subscription'); } -if ($this->category) { +if ($this->category !== null) { $this->renderHelper('category/update'); } diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index 6004cec1b..86b8246e3 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -17,21 +17,21 @@ <div class="form-group"> <label class="group-name" for="ttl_default"><?= _t('conf.archiving.ttl') ?></label> <div class="group-controls"> - <select class="number" name="ttl_default" id="ttl_default" required="required" data-leave-validation="<?= FreshRSS_Context::$user_conf->ttl_default ?>"><?php + <select class="number" name="ttl_default" id="ttl_default" required="required" data-leave-validation="<?= FreshRSS_Context::userConf()->ttl_default ?>"><?php $found = false; foreach (array(1200 => '20min', 1500 => '25min', 1800 => '30min', 2700 => '45min', 3600 => '1h', 5400 => '1.5h', 7200 => '2h', 10800 => '3h', 14400 => '4h', 18800 => '5h', 21600 => '6h', 25200 => '7h', 28800 => '8h', 36000 => '10h', 43200 => '12h', 64800 => '18h', 86400 => '1d', 129600 => '1.5d', 172800 => '2d', 259200 => '3d', 345600 => '4d', 432000 => '5d', 518400 => '6d', 604800 => '1wk') as $v => $t) { - echo '<option value="' . $v . (FreshRSS_Context::$user_conf->ttl_default == $v ? '" selected="selected' : '') . '">' . $t . '</option>'; - if (FreshRSS_Context::$user_conf->ttl_default == $v) { + echo '<option value="' . $v . (FreshRSS_Context::userConf()->ttl_default == $v ? '" selected="selected' : '') . '">' . $t . '</option>'; + if (FreshRSS_Context::userConf()->ttl_default == $v) { $found = true; } } if (!$found) { - echo '<option value="' . intval(FreshRSS_Context::$user_conf->ttl_default) . '" selected="selected">' - . intval(FreshRSS_Context::$user_conf->ttl_default) . 's</option>'; + echo '<option value="' . intval(FreshRSS_Context::userConf()->ttl_default) . '" selected="selected">' + . intval(FreshRSS_Context::userConf()->ttl_default) . 's</option>'; } ?></select> (<?= _t('gen.short.by_default') ?>) </div> @@ -46,10 +46,10 @@ <div class="group-controls"> <label class="checkbox" for="enable_keep_max"> <input type="checkbox" name="enable_keep_max" id="enable_keep_max" value="1"<?= - empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? '' : ' checked="checked"' ?> - data-leave-validation="<?= empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? 0 : 1 ?>"/> + empty(FreshRSS_Context::userConf()->archiving['keep_max']) ? '' : ' checked="checked"' ?> + data-leave-validation="<?= empty(FreshRSS_Context::userConf()->archiving['keep_max']) ? 0 : 1 ?>"/> <?= _t('conf.archiving.keep_max') ?> - <?php $keepMax = empty(FreshRSS_Context::$user_conf->archiving['keep_max']) ? 200 : FreshRSS_Context::$user_conf->archiving['keep_max']; ?> + <?php $keepMax = empty(FreshRSS_Context::userConf()->archiving['keep_max']) ? 200 : FreshRSS_Context::userConf()->archiving['keep_max']; ?> <input type="number" id="keep_max" name="keep_max" min="0" value="<?= $keepMax ?>" data-leave-validation="<?= $keepMax ?>"/> </label> </div> @@ -59,18 +59,18 @@ <div class="group-controls"> <label class="checkbox" for="enable_keep_period"> <input type="checkbox" name="enable_keep_period" id="enable_keep_period" value="1"<?= - FreshRSS_Context::$user_conf->volatile['enable_keep_period'] ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['enable_keep_period'] ? 1 : 0 ?>"/> + FreshRSS_Context::userConf()->volatile['enable_keep_period'] ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->volatile['enable_keep_period'] ? 1 : 0 ?>"/> <?= _t('conf.archiving.keep_period') ?> - <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= FreshRSS_Context::$user_conf->volatile['keep_period_count'] ?>" - data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['keep_period_count'] ?>"/> - <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ?>"> + <input type="number" id="keep_period_count" name="keep_period_count" min="0" value="<?= FreshRSS_Context::userConf()->volatile['keep_period_count'] ?>" + data-leave-validation="<?= FreshRSS_Context::userConf()->volatile['keep_period_count'] ?>"/> + <select class="number" name="keep_period_unit" id="keep_period_unit" data-leave-validation="<?= FreshRSS_Context::userConf()->volatile['keep_period_unit'] ?>"> <option></option> - <option value="P1Y" <?= 'P1Y' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option> - <option value="P1M" <?= 'P1M' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option> - <option value="P1W" <?= 'P1W' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option> - <option value="P1D" <?= 'P1D' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option> - <option value="PT1H" <?= 'PT1H' === FreshRSS_Context::$user_conf->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option> + <option value="P1Y" <?= 'P1Y' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.years') ?></option> + <option value="P1M" <?= 'P1M' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.months') ?></option> + <option value="P1W" <?= 'P1W' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.weeks') ?></option> + <option value="P1D" <?= 'P1D' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.days') ?></option> + <option value="PT1H" <?= 'PT1H' === FreshRSS_Context::userConf()->volatile['keep_period_unit'] ? 'selected="selected"' : '' ?>><?= _t('gen.period.hours') ?></option> </select> </label> </div> @@ -81,8 +81,8 @@ <div class="group-controls"> <label class="checkbox" for="keep_favourites"> <input type="checkbox" name="keep_favourites" id="keep_favourites" value="1"<?= - FreshRSS_Context::$user_conf->archiving['keep_favourites'] !== false ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_favourites'] !== false ? 1 : 0 ?>"/> + FreshRSS_Context::userConf()->archiving['keep_favourites'] !== false ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->archiving['keep_favourites'] !== false ? 1 : 0 ?>"/> <?= _t('conf.archiving.keep_favourites') ?> </label> </div> @@ -92,8 +92,8 @@ <div class="group-controls"> <label class="checkbox" for="keep_labels"> <input type="checkbox" name="keep_labels" id="keep_labels" value="1"<?= - FreshRSS_Context::$user_conf->archiving['keep_labels'] !== false ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_labels'] !== false ? 1 : 0 ?>"/> + FreshRSS_Context::userConf()->archiving['keep_labels'] !== false ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->archiving['keep_labels'] !== false ? 1 : 0 ?>"/> <?= _t('conf.archiving.keep_labels') ?> </label> </div> @@ -103,8 +103,8 @@ <div class="group-controls"> <label class="checkbox" for="keep_unreads"> <input type="checkbox" name="keep_unreads" id="keep_unreads" value="1"<?= - FreshRSS_Context::$user_conf->archiving['keep_unreads'] ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_unreads'] ? 1 : 0 ?>"/> + FreshRSS_Context::userConf()->archiving['keep_unreads'] ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->archiving['keep_unreads'] ? 1 : 0 ?>"/> <?= _t('conf.archiving.keep_unreads') ?> </label> </div> @@ -114,8 +114,8 @@ <div class="group-controls"> <label for="keep_min_default"><?= _t('conf.archiving.keep_min_by_feed') ?> <input type="number" id="keep_min_default" name="keep_min_default" min="0" value="<?= - FreshRSS_Context::$user_conf->archiving['keep_min'] ?>" - data-leave-validation="<?= FreshRSS_Context::$user_conf->archiving['keep_min'] ?>"> + FreshRSS_Context::userConf()->archiving['keep_min'] ?>" + data-leave-validation="<?= FreshRSS_Context::userConf()->archiving['keep_min'] ?>"> </label> </div> </div> diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index b48dcbf71..d373c0bb5 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -16,10 +16,10 @@ <div class="form-group"> <label class="group-name" for="language"><?= _t('conf.display.language') ?></label> <div class="group-controls"> - <select name="language" id="language" data-leave-validation="<?= FreshRSS_Context::$user_conf->language ?>"> + <select name="language" id="language" data-leave-validation="<?= FreshRSS_Context::userConf()->language ?>"> <?php $languages = Minz_Translate::availableLanguages(); ?> <?php foreach ($languages as $lang) { ?> - <option value="<?= $lang ?>"<?= FreshRSS_Context::$user_conf->language === $lang ? ' selected="selected"' : '' ?>><?= _t('gen.lang.' . $lang) ?></option> + <option value="<?= $lang ?>"<?= FreshRSS_Context::userConf()->language === $lang ? ' selected="selected"' : '' ?>><?= _t('gen.lang.' . $lang) ?></option> <?php } ?> </select> </div> @@ -28,15 +28,15 @@ <div class="form-group"> <label class="group-name" for="timezone"><?= _t('conf.display.timezone') ?></label> <div class="group-controls"> - <select name="timezone" id="timezone" data-leave-validation="<?= FreshRSS_Context::$user_conf->timezone ?>"> + <select name="timezone" id="timezone" data-leave-validation="<?= FreshRSS_Context::userConf()->timezone ?>"> <?php $timezones = array_merge([''], DateTimeZone::listIdentifiers()); - if (!in_array(FreshRSS_Context::$user_conf->timezone, $timezones, true)) { - FreshRSS_Context::$user_conf->timezone = ''; + if (!in_array(FreshRSS_Context::userConf()->timezone, $timezones, true)) { + FreshRSS_Context::userConf()->timezone = ''; } ?> <?php foreach ($timezones as $timezone): ?> - <option value="<?= $timezone ?>"<?= FreshRSS_Context::$user_conf->timezone === $timezone ? ' selected="selected"' : '' ?>> + <option value="<?= $timezone ?>"<?= FreshRSS_Context::userConf()->timezone === $timezone ? ' selected="selected"' : '' ?>> <?= $timezone == '' ? _t('gen.short.by_default') . ' (' . FreshRSS_Context::defaultTimeZone() . ')' : $timezone ?> </option> <?php endforeach; ?> @@ -49,16 +49,16 @@ <div class="group-controls"> <ul class="theme-preview-list"> <?php $slides = count($this->themes); $i = 1; $themeAvailable = false; ?> - <?php /** @var array{'id':string, 'deprecated':bool, 'author':string, 'name':string, 'description':string} $theme */ - foreach($this->themes as $theme) { ?> - <?php if (FreshRSS_Context::$user_conf->theme === $theme['id']) { + <?php + foreach ($this->themes as $theme) { ?> + <?php if (FreshRSS_Context::userConf()->theme === $theme['id']) { $checked = 'checked="checked"'; $themeAvailable = true; } else { $checked = ''; } ?> <input type="radio" name="theme" id="img-<?= $i ?>" <?= $checked ?> value="<?= $theme['id'] ?>" - data-leave-validation="<?= (FreshRSS_Context::$user_conf->theme === $theme['id']) ? 1 : 0 ?>" /> + data-leave-validation="<?= (FreshRSS_Context::userConf()->theme === $theme['id']) ? 1 : 0 ?>" /> <li class="preview-container"> <div class="preview"> <img src="<?= Minz_Url::display('/themes/' . $theme['id'] . '/thumbs/original.png') ?>" loading="lazy" /> @@ -98,7 +98,7 @@ <label for="img-<?= $i - 1 ?>" class="prev">‹</label> </div> <div class="properties alert-error"> - <div><?= _t('conf.display.theme_not_available', FreshRSS_Context::$user_conf->theme)?></div> + <div><?= _t('conf.display.theme_not_available', FreshRSS_Context::userConf()->theme)?></div> </div> </li> <?php }?> @@ -109,14 +109,14 @@ <div class="form-group"> <label class="group-name" for="darkMode"><?= _t('conf.display.darkMode') ?></label> <div class="group-controls"> - <select name="darkMode" id="darkMode" data-leave-validation="<?= FreshRSS_Context::$user_conf->darkMode ?>"> - <option value="no"<?= FreshRSS_Context::$user_conf->darkMode === 'no' ? ' selected' : '' ?>><?= _t('conf.display.darkMode.no') ?></option> - <option value="auto"<?= FreshRSS_Context::$user_conf->darkMode === 'auto' ? ' selected' : '' ?>><?= _t('conf.display.darkMode.auto') ?></option> + <select name="darkMode" id="darkMode" data-leave-validation="<?= FreshRSS_Context::userConf()->darkMode ?>"> + <option value="no"<?= FreshRSS_Context::userConf()->darkMode === 'no' ? ' selected' : '' ?>><?= _t('conf.display.darkMode.no') ?></option> + <option value="auto"<?= FreshRSS_Context::userConf()->darkMode === 'auto' ? ' selected' : '' ?>><?= _t('conf.display.darkMode.auto') ?></option> </select> </div> </div> - <?php $width = FreshRSS_Context::$user_conf->content_width; ?> + <?php $width = FreshRSS_Context::userConf()->content_width; ?> <div class="form-group"> <label class="group-name" for="content_width"><?= _t('conf.display.width.content') ?></label> <div class="group-controls"> @@ -137,7 +137,7 @@ </div> </div> - <?php $topline_website = FreshRSS_Context::$user_conf->topline_website; ?> + <?php $topline_website = FreshRSS_Context::userConf()->topline_website; ?> <div class="form-group"> <label class="group-name" for="topline_website"><?= _t('conf.display.website.label') ?></label> <div class="group-controls"> @@ -158,7 +158,7 @@ </div> </div> - <?php $topline_thumbnail = FreshRSS_Context::$user_conf->topline_thumbnail; ?> + <?php $topline_thumbnail = FreshRSS_Context::userConf()->topline_thumbnail; ?> <div class="form-group"> <label class="group-name" for="topline_thumbnail"><?= _t('conf.display.thumbnail.label') ?></label> <div class="group-controls"> @@ -201,50 +201,50 @@ <tr> <th><?= _t('conf.display.icon.top_line') ?></th> <td><input type="checkbox" name="topline_read" value="1"<?= - FreshRSS_Context::$user_conf->topline_read ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->topline_read ?>" /></td> + FreshRSS_Context::userConf()->topline_read ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->topline_read ?>" /></td> <td><input type="checkbox" name="topline_favorite" value="1"<?= - FreshRSS_Context::$user_conf->topline_favorite ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->topline_favorite ?>" /></td> + FreshRSS_Context::userConf()->topline_favorite ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->topline_favorite ?>" /></td> <td><input type="checkbox" disabled="disabled" /></td> <td><input type="checkbox" disabled="disabled" /></td> <td><input type="checkbox" disabled="disabled" /></td> <td><input type="checkbox" name="topline_summary" value="1"<?= - FreshRSS_Context::$user_conf->topline_summary ? 'checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->topline_summary ?>" /></td> + FreshRSS_Context::userConf()->topline_summary ? 'checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->topline_summary ?>" /></td> <td><input type="checkbox" name="topline_display_authors" value="1"<?= - FreshRSS_Context::$user_conf->topline_display_authors ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->topline_display_authors ?>" /></td> + FreshRSS_Context::userConf()->topline_display_authors ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->topline_display_authors ?>" /></td> <td><input type="checkbox" name="topline_date" value="1"<?= - FreshRSS_Context::$user_conf->topline_date ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->topline_date ?>" /></td> - <td><input type="checkbox" name="topline_link" value="1"<?= FreshRSS_Context::$user_conf->topline_link ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->topline_link ?>" /></td> + FreshRSS_Context::userConf()->topline_date ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->topline_date ?>" /></td> + <td><input type="checkbox" name="topline_link" value="1"<?= FreshRSS_Context::userConf()->topline_link ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->topline_link ?>" /></td> </tr><tr> <th><?= _t('conf.display.icon.bottom_line') ?></th> <td><input type="checkbox" name="bottomline_read" value="1"<?= - FreshRSS_Context::$user_conf->bottomline_read ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->bottomline_read ?>" /></td> + FreshRSS_Context::userConf()->bottomline_read ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->bottomline_read ?>" /></td> <td><input type="checkbox" name="bottomline_favorite" value="1"<?= - FreshRSS_Context::$user_conf->bottomline_favorite ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->bottomline_favorite ?>" /></td> + FreshRSS_Context::userConf()->bottomline_favorite ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->bottomline_favorite ?>" /></td> <td><input type="checkbox" name="bottomline_myLabels" value="1"<?= - FreshRSS_Context::$user_conf->bottomline_myLabels ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->bottomline_myLabels ?>" /></td> + FreshRSS_Context::userConf()->bottomline_myLabels ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->bottomline_myLabels ?>" /></td> <td><input type="checkbox" name="bottomline_tags" value="1"<?= - FreshRSS_Context::$user_conf->bottomline_tags ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->bottomline_tags ?>" /></td> + FreshRSS_Context::userConf()->bottomline_tags ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->bottomline_tags ?>" /></td> <td><input type="checkbox" name="bottomline_sharing" value="1"<?= - FreshRSS_Context::$user_conf->bottomline_sharing ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->bottomline_sharing ?>" /></td> + FreshRSS_Context::userConf()->bottomline_sharing ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->bottomline_sharing ?>" /></td> <td><input type="checkbox" disabled="disabled" /></td> <td><input type="checkbox" disabled="disabled" /></td> <td><input type="checkbox" name="bottomline_date" value="1"<?= - FreshRSS_Context::$user_conf->bottomline_date ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->bottomline_date ?>" /></td> + FreshRSS_Context::userConf()->bottomline_date ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->bottomline_date ?>" /></td> <td><input type="checkbox" name="bottomline_link" value="1"<?= - FreshRSS_Context::$user_conf->bottomline_link ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->bottomline_link ?>" /></td> + FreshRSS_Context::userConf()->bottomline_link ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->bottomline_link ?>" /></td> </tr> </tbody> </table> @@ -255,8 +255,8 @@ <label class="group-name" for="html5_notif_timeout"><?= _t('conf.display.notif_html5.timeout') ?></label> <div class="group-controls"> <input type="number" id="html5_notif_timeout" name="html5_notif_timeout" value="<?= - FreshRSS_Context::$user_conf->html5_notif_timeout ?>" - data-leave-validation="<?= FreshRSS_Context::$user_conf->html5_notif_timeout ?>" /> <?= _t('conf.display.notif_html5.seconds') ?> + FreshRSS_Context::userConf()->html5_notif_timeout ?>" + data-leave-validation="<?= FreshRSS_Context::userConf()->html5_notif_timeout ?>" /> <?= _t('conf.display.notif_html5.seconds') ?> </div> </div> @@ -264,8 +264,8 @@ <div class="group-controls"> <label class="checkbox" for="show_nav_buttons"> <input type="checkbox" name="show_nav_buttons" id="show_nav_buttons" value="1"<?= - FreshRSS_Context::$user_conf->show_nav_buttons ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->show_nav_buttons ?>" /> + FreshRSS_Context::userConf()->show_nav_buttons ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->show_nav_buttons ?>" /> <?= _t('conf.display.show_nav_buttons') ?> </label> </div> diff --git a/app/views/configure/integration.phtml b/app/views/configure/integration.phtml index fc3cc2a32..973ee128f 100644 --- a/app/views/configure/integration.phtml +++ b/app/views/configure/integration.phtml @@ -57,8 +57,11 @@ </template> <?php - foreach (FreshRSS_Context::$user_conf->sharing as $key => $share_options) { + foreach (FreshRSS_Context::userConf()->sharing as $key => $share_options) { $share = FreshRSS_Share::get($share_options['type']); + if ($share === null) { + continue; + } $share->update($share_options); ?> <formgroup class="group-share dragbox" id="group-share-<?= $key ?>"> diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index 94cf51977..17fdbe7c3 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -17,10 +17,10 @@ <div class="form-group"> <label class="group-name" for="view_mode"><?= _t('conf.reading.view.default') ?></label> <div class="group-controls"> - <select name="view_mode" id="view_mode" data-leave-validation="<?= FreshRSS_Context::$user_conf->view_mode ?>"> - <option value="normal"<?= FreshRSS_Context::$user_conf->view_mode === 'normal' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.view.normal') ?></option> - <option value="reader"<?= FreshRSS_Context::$user_conf->view_mode === 'reader' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.view.reader') ?></option> - <option value="global"<?= FreshRSS_Context::$user_conf->view_mode === 'global' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.view.global') ?></option> + <select name="view_mode" id="view_mode" data-leave-validation="<?= FreshRSS_Context::userConf()->view_mode ?>"> + <option value="normal"<?= FreshRSS_Context::userConf()->view_mode === 'normal' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.view.normal') ?></option> + <option value="reader"<?= FreshRSS_Context::userConf()->view_mode === 'reader' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.view.reader') ?></option> + <option value="global"<?= FreshRSS_Context::userConf()->view_mode === 'global' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.view.global') ?></option> </select> </div> </div> @@ -28,10 +28,10 @@ <div class="form-group"> <label class="group-name" for="default_view"><?= _t('conf.reading.show') ?></label> <div class="group-controls"> - <select name="default_view" id="default_view" data-leave-validation="<?= FreshRSS_Context::$user_conf->default_view ?>"> - <option value="adaptive"<?= FreshRSS_Context::$user_conf->default_view === 'adaptive' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.show.adaptive') ?></option> - <option value="all"<?= FreshRSS_Context::$user_conf->default_view === 'all' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.show.all_articles') ?></option> - <option value="unread"<?= FreshRSS_Context::$user_conf->default_view === 'unread' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.show.unread') ?></option> + <select name="default_view" id="default_view" data-leave-validation="<?= FreshRSS_Context::userConf()->default_view ?>"> + <option value="adaptive"<?= FreshRSS_Context::userConf()->default_view === 'adaptive' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.show.adaptive') ?></option> + <option value="all"<?= FreshRSS_Context::userConf()->default_view === 'all' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.show.all_articles') ?></option> + <option value="unread"<?= FreshRSS_Context::userConf()->default_view === 'unread' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.show.unread') ?></option> </select> </div> </div> @@ -40,8 +40,8 @@ <label class="group-name" for="posts_per_page"><?= _t('conf.reading.articles_per_page') ?></label> <div class="group-controls"> <input type="number" id="posts_per_page" name="posts_per_page" value="<?= - FreshRSS_Context::$user_conf->posts_per_page ?>" min="5" max="500" - data-leave-validation="<?= FreshRSS_Context::$user_conf->posts_per_page ?>"/> + FreshRSS_Context::userConf()->posts_per_page ?>" min="5" max="500" + data-leave-validation="<?= FreshRSS_Context::userConf()->posts_per_page ?>"/> <p class="help"><?= _i('help') ?> <?= _t('conf.reading.number_divided_when_reader') ?></p> </div> </div> @@ -50,8 +50,8 @@ <div class="group-controls"> <label class="checkbox" for="auto_load_more"> <input type="checkbox" name="auto_load_more" id="auto_load_more" value="1"<?= - FreshRSS_Context::$user_conf->auto_load_more ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->auto_load_more ?>"/> + FreshRSS_Context::userConf()->auto_load_more ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->auto_load_more ?>"/> <?= _t('conf.reading.auto_load_more') ?> <noscript> — <strong><?= _t('gen.js.should_be_activated') ?></strong></noscript> </label> @@ -61,9 +61,9 @@ <div class="form-group"> <label class="group-name" for="sort_order"><?= _t('conf.reading.sort') ?></label> <div class="group-controls"> - <select name="sort_order" id="sort_order" data-leave-validation="<?= FreshRSS_Context::$user_conf->sort_order ?>"> - <option value="DESC"<?= FreshRSS_Context::$user_conf->sort_order === 'DESC' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.sort.newer_first') ?></option> - <option value="ASC"<?= FreshRSS_Context::$user_conf->sort_order === 'ASC' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.sort.older_first') ?></option> + <select name="sort_order" id="sort_order" data-leave-validation="<?= FreshRSS_Context::userConf()->sort_order ?>"> + <option value="DESC"<?= FreshRSS_Context::userConf()->sort_order === 'DESC' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.sort.newer_first') ?></option> + <option value="ASC"<?= FreshRSS_Context::userConf()->sort_order === 'ASC' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.sort.older_first') ?></option> </select> </div> </div> @@ -75,14 +75,14 @@ <div class="form-group"> <label class="group-name" for="display_categories"><?= _t('conf.reading.display_categories_unfolded') ?></label> <div class="group-controls"> - <select name="display_categories" id="display_categories" data-leave-validation="<?= FreshRSS_Context::$user_conf->display_categories ?>"> - <option value="active"<?= FreshRSS_Context::$user_conf->display_categories === 'active' ? ' selected="selected"' : '' ?>><?= + <select name="display_categories" id="display_categories" data-leave-validation="<?= FreshRSS_Context::userConf()->display_categories ?>"> + <option value="active"<?= FreshRSS_Context::userConf()->display_categories === 'active' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.show.active_category') ?></option> - <option value="remember"<?= FreshRSS_Context::$user_conf->display_categories === 'remember' ? ' selected="selected"' : '' ?>><?= + <option value="remember"<?= FreshRSS_Context::userConf()->display_categories === 'remember' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.show.remember_categories') ?></option> - <option value="all"<?= FreshRSS_Context::$user_conf->display_categories === 'all' ? ' selected="selected"' : '' ?>><?= + <option value="all"<?= FreshRSS_Context::userConf()->display_categories === 'all' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.show.all_categories') ?></option> - <option value="none"<?= FreshRSS_Context::$user_conf->display_categories === 'none' ? ' selected="selected"' : '' ?>><?= + <option value="none"<?= FreshRSS_Context::userConf()->display_categories === 'none' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.show.no_category') ?></option> </select> </div> @@ -92,8 +92,8 @@ <div class="group-controls"> <label class="checkbox" for="show_fav_unread"> <input type="checkbox" name="show_fav_unread" id="show_fav_unread" value="1"<?= - FreshRSS_Context::$user_conf->show_fav_unread ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->show_fav_unread ?>"/> + FreshRSS_Context::userConf()->show_fav_unread ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->show_fav_unread ?>"/> <?= _t('conf.reading.always_show_favorites') ?> <p class="help"><?= _i('help') ?> <?= _t('conf.reading.show_fav_unread_help') ?></p> </label> @@ -104,8 +104,8 @@ <div class="group-controls"> <label class="checkbox" for="hide_read_feeds"> <input type="checkbox" name="hide_read_feeds" id="hide_read_feeds" value="1"<?= - FreshRSS_Context::$user_conf->hide_read_feeds ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->hide_read_feeds ?>"/> + FreshRSS_Context::userConf()->hide_read_feeds ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->hide_read_feeds ?>"/> <?= _t('conf.reading.hide_read_feeds') ?> </label> </div> @@ -117,32 +117,32 @@ <div class="form-group"> <label class="group-name" for="show_feed_name"><?= _t('conf.reading.article.feed_title') ?></label> <div class="group-controls"> - <select name="show_feed_name" id="show_feed_name" data-leave-validation="<?= FreshRSS_Context::$user_conf->show_feed_name ?>"> - <option value="0"<?= FreshRSS_Context::$user_conf->show_feed_name === '0' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.feed_name.none') ?></option> - <option value="t"<?= FreshRSS_Context::$user_conf->show_feed_name === 't' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.feed_name.above_title') ?></option> - <option value="a"<?= FreshRSS_Context::$user_conf->show_feed_name === 'a' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.feed_name.with_authors') ?></option> + <select name="show_feed_name" id="show_feed_name" data-leave-validation="<?= FreshRSS_Context::userConf()->show_feed_name ?>"> + <option value="0"<?= FreshRSS_Context::userConf()->show_feed_name === '0' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.feed_name.none') ?></option> + <option value="t"<?= FreshRSS_Context::userConf()->show_feed_name === 't' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.feed_name.above_title') ?></option> + <option value="a"<?= FreshRSS_Context::userConf()->show_feed_name === 'a' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.feed_name.with_authors') ?></option> </select> </div> </div> <div class="form-group"> <label class="group-name" for="show_author_date"><?= _t('conf.reading.article.authors_date') ?></label> <div class="group-controls"> - <select name="show_author_date" id="show_author_date" data-leave-validation="<?= FreshRSS_Context::$user_conf->show_author_date ?>"> - <option value="0" <?= FreshRSS_Context::$user_conf->show_author_date === '0' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.authors_date.none') ?></option> - <option value="h" <?= FreshRSS_Context::$user_conf->show_author_date === 'h' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.authors_date.header') ?></option> - <option value="f" <?= FreshRSS_Context::$user_conf->show_author_date === 'f' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.authors_date.footer') ?></option> - <option value="b" <?= FreshRSS_Context::$user_conf->show_author_date === 'b' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.authors_date.both') ?></option> + <select name="show_author_date" id="show_author_date" data-leave-validation="<?= FreshRSS_Context::userConf()->show_author_date ?>"> + <option value="0" <?= FreshRSS_Context::userConf()->show_author_date === '0' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.authors_date.none') ?></option> + <option value="h" <?= FreshRSS_Context::userConf()->show_author_date === 'h' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.authors_date.header') ?></option> + <option value="f" <?= FreshRSS_Context::userConf()->show_author_date === 'f' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.authors_date.footer') ?></option> + <option value="b" <?= FreshRSS_Context::userConf()->show_author_date === 'b' ? ' selected="selected"' : '' ?>><?= _t('conf.reading.article.authors_date.both') ?></option> </select> </div> </div> <div class="form-group"> <label class="group-name" for="show_tags"><?= _t('conf.reading.article.tags') ?></label> <div class="group-controls"> - <select class="select-input-changer" name="show_tags" id="show_tags" data-name="show_tags_max" data-leave-validation="<?= FreshRSS_Context::$user_conf->show_tags ?>"> - <option value="0" <?= FreshRSS_Context::$user_conf->show_tags === '0' ? ' selected="selected"' : '' ?> data-input-visible="false"><?= _t('conf.reading.article.tags.none') ?></option> - <option value="h" <?= FreshRSS_Context::$user_conf->show_tags === 'h' ? ' selected="selected"' : '' ?> data-input-visible="true"><?= _t('conf.reading.article.tags.header') ?></option> - <option value="f" <?= FreshRSS_Context::$user_conf->show_tags === 'f' ? ' selected="selected"' : '' ?> data-input-visible="true"><?= _t('conf.reading.article.tags.footer') ?></option> - <option value="b" <?= FreshRSS_Context::$user_conf->show_tags === 'b' ? ' selected="selected"' : '' ?> data-input-visible="true"><?= _t('conf.reading.article.tags.both') ?></option> + <select class="select-input-changer" name="show_tags" id="show_tags" data-name="show_tags_max" data-leave-validation="<?= FreshRSS_Context::userConf()->show_tags ?>"> + <option value="0" <?= FreshRSS_Context::userConf()->show_tags === '0' ? ' selected="selected"' : '' ?> data-input-visible="false"><?= _t('conf.reading.article.tags.none') ?></option> + <option value="h" <?= FreshRSS_Context::userConf()->show_tags === 'h' ? ' selected="selected"' : '' ?> data-input-visible="true"><?= _t('conf.reading.article.tags.header') ?></option> + <option value="f" <?= FreshRSS_Context::userConf()->show_tags === 'f' ? ' selected="selected"' : '' ?> data-input-visible="true"><?= _t('conf.reading.article.tags.footer') ?></option> + <option value="b" <?= FreshRSS_Context::userConf()->show_tags === 'b' ? ' selected="selected"' : '' ?> data-input-visible="true"><?= _t('conf.reading.article.tags.both') ?></option> </select> <noscript> — <strong><?= _t('gen.js.should_be_activated') ?></strong></noscript> </div> @@ -150,7 +150,7 @@ <div class="form-group" id="show_tags_max-block"> <label class="group-name" for="show_tags_max"><?= _t('conf.reading.article.tags_max') ?></label> <div class="group-controls"> - <input type="number" id="show_tags_max" name="show_tags_max" value="<?= FreshRSS_Context::$user_conf->show_tags_max ?>" min="0" data-leave-validation="<?= FreshRSS_Context::$user_conf->show_tags_max ?>" data-number="2" /> + <input type="number" id="show_tags_max" name="show_tags_max" value="<?= FreshRSS_Context::userConf()->show_tags_max ?>" min="0" data-leave-validation="<?= FreshRSS_Context::userConf()->show_tags_max ?>" data-number="2" /> <p class="help"><?= _i('help') ?> <?= _t('conf.reading.article.tags_max.help') ?></p> </div> </div> @@ -162,8 +162,8 @@ <div class="group-controls"> <label class="checkbox" for="display_posts"> <input type="checkbox" name="display_posts" id="display_posts" value="1"<?= - FreshRSS_Context::$user_conf->display_posts ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->display_posts ?>"/> + FreshRSS_Context::userConf()->display_posts ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->display_posts ?>"/> <?= _t('conf.reading.display_articles_unfolded') ?> <noscript> — <strong><?= _t('gen.js.should_be_activated') ?></strong></noscript> </label> @@ -174,8 +174,8 @@ <div class="group-controls"> <label class="checkbox" for="sticky_post"> <input type="checkbox" name="sticky_post" id="sticky_post" value="1"<?= - FreshRSS_Context::$user_conf->sticky_post ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->sticky_post ?>"/> + FreshRSS_Context::userConf()->sticky_post ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->sticky_post ?>"/> <?= _t('conf.reading.sticky_post') ?> <noscript> — <strong><?= _t('gen.js.should_be_activated') ?></strong></noscript> </label> @@ -186,8 +186,8 @@ <div class="group-controls"> <label class="checkbox" for="sides_close_article"> <input type="checkbox" name="sides_close_article" id="sides_close_article" value="1"<?= - FreshRSS_Context::$user_conf->sides_close_article ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->sides_close_article ?>"/> + FreshRSS_Context::userConf()->sides_close_article ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->sides_close_article ?>"/> <?= _t('conf.reading.sides_close_article') ?> <noscript> — <strong><?= _t('gen.js.should_be_activated') ?></strong></noscript> </label> @@ -201,8 +201,8 @@ <div class="group-controls"> <label class="checkbox" for="auto_remove_article"> <input type="checkbox" name="auto_remove_article" id="auto_remove_article" value="1"<?= - FreshRSS_Context::$user_conf->auto_remove_article ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->auto_remove_article ?>"/> + FreshRSS_Context::userConf()->auto_remove_article ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->auto_remove_article ?>"/> <?= _t('conf.reading.auto_remove_article') ?> <noscript> — <strong><?= _t('gen.js.should_be_activated') ?></strong></noscript> </label> @@ -213,8 +213,8 @@ <div class="group-controls"> <label class="checkbox" for="reading_confirm"> <input type="checkbox" name="reading_confirm" id="reading_confirm" value="1"<?= - FreshRSS_Context::$user_conf->reading_confirm ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->reading_confirm ?>"/> + FreshRSS_Context::userConf()->reading_confirm ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->reading_confirm ?>"/> <?= _t('conf.reading.confirm_enabled') ?> <noscript> — <strong><?= _t('gen.js.should_be_activated') ?></strong></noscript> </label> @@ -226,8 +226,8 @@ <div class="group-controls"> <label class="checkbox" for="onread_jump_next"> <input type="checkbox" name="onread_jump_next" id="onread_jump_next" value="1"<?= - FreshRSS_Context::$user_conf->onread_jump_next ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->onread_jump_next ?>"/> + FreshRSS_Context::userConf()->onread_jump_next ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->onread_jump_next ?>"/> <?= _t('conf.reading.jump_next') ?> </label> </div> @@ -237,8 +237,8 @@ <div class="group-controls"> <label class="checkbox" for="mark_updated_article_unread"> <input type="checkbox" name="mark_updated_article_unread" id="mark_updated_article_unread" value="1"<?= - FreshRSS_Context::$user_conf->mark_updated_article_unread ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->mark_updated_article_unread ?>"/> + FreshRSS_Context::userConf()->mark_updated_article_unread ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->mark_updated_article_unread ?>"/> <?= _t('conf.reading.mark_updated_article_unread') ?> </label> </div> @@ -249,8 +249,8 @@ <div class="group-controls"> <label class="checkbox" for="check_open_article"> <input type="checkbox" name="mark_open_article" id="check_open_article" value="1"<?= - FreshRSS_Context::$user_conf->mark_when['article'] ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->mark_when['article'] ?>"/> + FreshRSS_Context::userConf()->mark_when['article'] ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->mark_when['article'] ?>"/> <?= _t('conf.reading.read.article_viewed') ?> </label> </div> @@ -261,8 +261,8 @@ <div class="group-controls"> <label class="checkbox" for="check_open_site"> <input type="checkbox" name="mark_open_site" id="check_open_site" value="1"<?= - FreshRSS_Context::$user_conf->mark_when['site'] ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->mark_when['site'] ?>"/> + FreshRSS_Context::userConf()->mark_when['site'] ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->mark_when['site'] ?>"/> <?= _t('conf.reading.read.article_open_on_website') ?> </label> </div> @@ -273,8 +273,8 @@ <div class="group-controls"> <label class="checkbox" for="check_scroll"> <input type="checkbox" name="mark_scroll" id="check_scroll" value="1"<?= - FreshRSS_Context::$user_conf->mark_when['scroll'] ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->mark_when['scroll'] ?>"/> + FreshRSS_Context::userConf()->mark_when['scroll'] ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->mark_when['scroll'] ?>"/> <?= _t('conf.reading.read.scroll') ?> </label> </div> @@ -285,8 +285,8 @@ <div class="group-controls"> <label class="checkbox" for="check_focus"> <input type="checkbox" name="mark_focus" id="check_focus" value="1"<?= - FreshRSS_Context::$user_conf->mark_when['focus'] ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->mark_when['focus'] ?>" /> + FreshRSS_Context::userConf()->mark_when['focus'] ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->mark_when['focus'] ?>" /> <?= _t('conf.reading.read.focus') ?> </label> </div> @@ -297,10 +297,10 @@ <div class="group-controls"> <label class="checkbox" for="enable_read_when_same_title_in_feed"> <input type="checkbox" name="enable_read_when_same_title_in_feed" id="enable_read_when_same_title_in_feed" value="1"<?= - empty(FreshRSS_Context::$user_conf->mark_when['same_title_in_feed']) ? '' : ' checked="checked"' ?> - data-leave-validation="<?= empty(FreshRSS_Context::$user_conf->mark_when['same_title_in_feed']) ? 0 : 1 ?>"/> + empty(FreshRSS_Context::userConf()->mark_when['same_title_in_feed']) ? '' : ' checked="checked"' ?> + data-leave-validation="<?= empty(FreshRSS_Context::userConf()->mark_when['same_title_in_feed']) ? 0 : 1 ?>"/> <?= _t('conf.reading.read.when_same_title') ?> - <?php $read_when_same_title_in_feed = empty(FreshRSS_Context::$user_conf->mark_when['same_title_in_feed']) ? 25 : FreshRSS_Context::$user_conf->mark_when['same_title_in_feed']; ?> + <?php $read_when_same_title_in_feed = empty(FreshRSS_Context::userConf()->mark_when['same_title_in_feed']) ? 25 : FreshRSS_Context::userConf()->mark_when['same_title_in_feed']; ?> <input type="number" id="read_when_same_title_in_feed" name="read_when_same_title_in_feed" min="0" value="<?= $read_when_same_title_in_feed ?>" data-leave-validation="<?= $read_when_same_title_in_feed ?>" /> </label> @@ -312,8 +312,8 @@ <div class="group-controls"> <label class="checkbox" for="mark_upon_reception"> <input type="checkbox" name="mark_upon_reception" id="mark_upon_reception" value="1"<?= - FreshRSS_Context::$user_conf->mark_when['reception'] ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->mark_when['reception'] ?>"/> + FreshRSS_Context::userConf()->mark_when['reception'] ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->mark_when['reception'] ?>"/> <?= _t('conf.reading.read.upon_reception') ?> </label> </div> @@ -324,8 +324,8 @@ <div class="group-controls"> <label class="checkbox" for="read_upon_gone"> <input type="checkbox" name="read_upon_gone" id="read_upon_gone" value="1"<?= - FreshRSS_Context::$user_conf->mark_when['gone'] ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->mark_when['gone'] ?>"/> + FreshRSS_Context::userConf()->mark_when['gone'] ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->mark_when['gone'] ?>"/> <?= _t('conf.reading.read.upon_gone') ?> </label> </div> @@ -335,10 +335,10 @@ <div class="group-controls"> <label class="checkbox" for="keep_max_n_unread"> <input type="checkbox" name="enable_keep_max_n_unread" id="enable_keep_max_n_unread" value="1"<?= - empty(FreshRSS_Context::$user_conf->mark_when['max_n_unread']) ? '' : ' checked="checked"' ?> - data-leave-validation="<?= empty(FreshRSS_Context::$user_conf->mark_when['max_n_unread']) ? 0 : 1 ?>"/> + empty(FreshRSS_Context::userConf()->mark_when['max_n_unread']) ? '' : ' checked="checked"' ?> + data-leave-validation="<?= empty(FreshRSS_Context::userConf()->mark_when['max_n_unread']) ? 0 : 1 ?>"/> <?= _t('conf.reading.read.keep_max_n_unread') ?> - <?php $keep_max_n_unread = empty(FreshRSS_Context::$user_conf->mark_when['max_n_unread']) ? 1000 : FreshRSS_Context::$user_conf->mark_when['max_n_unread']; ?> + <?php $keep_max_n_unread = empty(FreshRSS_Context::userConf()->mark_when['max_n_unread']) ? 1000 : FreshRSS_Context::userConf()->mark_when['max_n_unread']; ?> <input type="number" id="keep_max_n_unread" name="keep_max_n_unread" min="0" value="<?= $keep_max_n_unread ?>" data-leave-validation="<?= $keep_max_n_unread ?>" /> </label> </div> @@ -351,7 +351,7 @@ <label class="group-name" for="filteractions_read"><?= _t('conf.reading.read.when') ?></label> <div class="group-controls"> <textarea name="filteractions_read" id="filteractions_read" class="w100"><?php - foreach (FreshRSS_Context::$user_conf->filtersAction('read') as $filterRead) { + foreach (FreshRSS_Context::userConf()->filtersAction('read') as $filterRead) { echo $filterRead->getRawInput(), PHP_EOL; } ?></textarea> @@ -366,8 +366,8 @@ <div class="group-controls"> <label class="checkbox" for="lazyload"> <input type="checkbox" name="lazyload" id="lazyload" value="1"<?= - FreshRSS_Context::$user_conf->lazyload ? ' checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$user_conf->lazyload ?>"/> + FreshRSS_Context::userConf()->lazyload ? ' checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::userConf()->lazyload ?>"/> <?= _t('conf.reading.img_with_lazyload') ?> <noscript> — <strong><?= _t('gen.js.should_be_activated') ?></strong></noscript> </label> diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index e578938cd..0d7ee4cb7 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -16,7 +16,7 @@ <?php } ?> </datalist> - <?php $s = FreshRSS_Context::$user_conf->shortcuts; ?> + <?php $s = FreshRSS_Context::userConf()->shortcuts; ?> <?php if ([] !== $nonStandard = getNonStandardShortcuts($s)): ?> <p class="alert alert-error"> diff --git a/app/views/configure/system.phtml b/app/views/configure/system.phtml index d19698932..09d1fe188 100644 --- a/app/views/configure/system.phtml +++ b/app/views/configure/system.phtml @@ -16,16 +16,16 @@ <div class="form-group"> <label class="group-name" for="instance-name"><?= _t('admin.system.instance-name') ?></label> <div class="group-controls"> - <input type="text" id="instance-name" name="instance-name" value="<?= FreshRSS_Context::$system_conf->title ?>" - data-leave-validation="<?= FreshRSS_Context::$system_conf->title ?>"/> + <input type="text" id="instance-name" name="instance-name" value="<?= FreshRSS_Context::systemConf()->title ?>" + data-leave-validation="<?= FreshRSS_Context::systemConf()->title ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="base-url"><?= _t('admin.system.base-url') ?></label> <div class="group-controls"> - <input type="text" id="base-url" name="base-url" value="<?= FreshRSS_Context::$system_conf->base_url ?>" - data-leave-validation="<?= FreshRSS_Context::$system_conf->base_url ?>" disabled="disabled" /> + <input type="text" id="base-url" name="base-url" value="<?= FreshRSS_Context::systemConf()->base_url ?>" + data-leave-validation="<?= FreshRSS_Context::systemConf()->base_url ?>" disabled="disabled" /> <p class="help"><?= _i('help') ?> <?= _t('admin.system.base-url.recommendation', dirname(Minz_Request::guessBaseUrl())) ?></p> <p class="help"><?= _i('help') ?> <?= _t('admin.system.sensitive-parameter') ?></p> </div> @@ -35,7 +35,7 @@ <label class="group-name" for="websub"><?= _t('sub.feed.websub') ?></label> <div class="group-controls"> <input type="checkbox" id="websub" name="websub" disabled="disabled" <?= - FreshRSS_Context::$system_conf->pubsubhubbub_enabled && Minz_Request::serverIsPublic(FreshRSS_Context::$system_conf->base_url) ? 'checked="checked"' : '' ?> /> + FreshRSS_Context::systemConf()->pubsubhubbub_enabled && Minz_Request::serverIsPublic(FreshRSS_Context::systemConf()->base_url) ? 'checked="checked"' : '' ?> /> <p class="help"><?= _i('help') ?> <?= _t('admin.system.websub.help') ?></p> <p class="help"><?= _i('help') ?> <?= _t('admin.system.sensitive-parameter') ?></p> </div> @@ -44,32 +44,32 @@ <div class="form-group"> <label class="group-name" for="auto-update-url"><?= _t('admin.system.auto-update-url') ?></label> <div class="group-controls"> - <input type="text" id="auto-update-url" name="auto-update-url" value="<?= FreshRSS_Context::$system_conf->auto_update_url ?>" - data-leave-validation="<?= FreshRSS_Context::$system_conf->auto_update_url ?>"/> + <input type="text" id="auto-update-url" name="auto-update-url" value="<?= FreshRSS_Context::systemConf()->auto_update_url ?>" + data-leave-validation="<?= FreshRSS_Context::systemConf()->auto_update_url ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="max-feeds"><?= _t('admin.system.max-feeds') ?></label> <div class="group-controls"> - <input type="number" id="max-feeds" name="max-feeds" value="<?= FreshRSS_Context::$system_conf->limits['max_feeds'] ?>" min="1" - data-leave-validation="<?= FreshRSS_Context::$system_conf->limits['max_feeds'] ?>"/> + <input type="number" id="max-feeds" name="max-feeds" value="<?= FreshRSS_Context::systemConf()->limits['max_feeds'] ?>" min="1" + data-leave-validation="<?= FreshRSS_Context::systemConf()->limits['max_feeds'] ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="max-categories"><?= _t('admin.system.max-categories') ?></label> <div class="group-controls"> - <input type="number" id="max-categories" name="max-categories" value="<?= FreshRSS_Context::$system_conf->limits['max_categories'] ?>" min="1" - data-leave-validation="<?= FreshRSS_Context::$system_conf->limits['max_categories'] ?>"/> + <input type="number" id="max-categories" name="max-categories" value="<?= FreshRSS_Context::systemConf()->limits['max_categories'] ?>" min="1" + data-leave-validation="<?= FreshRSS_Context::systemConf()->limits['max_categories'] ?>"/> </div> </div> <div class="form-group"> <label class="group-name" for="cookie-duration"><?= _t('admin.system.cookie-duration.number') ?></label> <div class="group-controls"> - <input type="number" id="cookie-duration" name="cookie-duration" value="<?= FreshRSS_Context::$system_conf->limits['cookie_duration'] ?>" min="0" - data-leave-validation="<?= FreshRSS_Context::$system_conf->limits['cookie_duration'] ?>"/> + <input type="number" id="cookie-duration" name="cookie-duration" value="<?= FreshRSS_Context::systemConf()->limits['cookie_duration'] ?>" min="0" + data-leave-validation="<?= FreshRSS_Context::systemConf()->limits['cookie_duration'] ?>"/> <p class="help"><?= _i('help') ?> <?= _t('admin.system.cookie-duration.help') ?></p> </div> </div> @@ -80,9 +80,9 @@ <label class="group-name" for="max-registrations-select"><?= _t('admin.system.registration.select.label') ?></label> <div class="group-controls"> <select class="select-input-changer" name="" data-name="max-registrations"> - <option value="1" <?= FreshRSS_Context::$system_conf->limits['max_registrations'] == 1 ? 'selected = "selected"' : ''; ?> data-input-visible="false"><?= _t('admin.system.registration.select.option.noform') ?></option> - <option value="0" <?= FreshRSS_Context::$system_conf->limits['max_registrations'] == 0 ? 'selected = "selected"' : ''; ?> data-input-visible="false"><?= _t('admin.system.registration.select.option.nolimit') ?></option> - <option value="2" <?= FreshRSS_Context::$system_conf->limits['max_registrations'] > 1 ? 'selected = "selected"' : ''; ?> data-input-visible="true"><?= _t('admin.system.registration.select.option.setaccountsnumber') ?></option> + <option value="1" <?= FreshRSS_Context::systemConf()->limits['max_registrations'] == 1 ? 'selected = "selected"' : ''; ?> data-input-visible="false"><?= _t('admin.system.registration.select.option.noform') ?></option> + <option value="0" <?= FreshRSS_Context::systemConf()->limits['max_registrations'] == 0 ? 'selected = "selected"' : ''; ?> data-input-visible="false"><?= _t('admin.system.registration.select.option.nolimit') ?></option> + <option value="2" <?= FreshRSS_Context::systemConf()->limits['max_registrations'] > 1 ? 'selected = "selected"' : ''; ?> data-input-visible="true"><?= _t('admin.system.registration.select.option.setaccountsnumber') ?></option> </select> </div> </div> @@ -91,8 +91,8 @@ <label class="group-name" for="max-registrations-input"><?= _t('admin.system.registration.number') ?></label> <div class="group-controls"> <?php $number = count(listUsers()); ?> - <input type="number" id="max-registrations-input" name="" value="<?= FreshRSS_Context::$system_conf->limits['max_registrations'] > 1 ? FreshRSS_Context::$system_conf->limits['max_registrations'] : $number + 1; ?>" min="2" - data-leave-validation="<?= FreshRSS_Context::$system_conf->limits['max_registrations'] > 1 ? FreshRSS_Context::$system_conf->limits['max_registrations'] : $number + 1; ?>" data-number="<?= $number ?>"/> + <input type="number" id="max-registrations-input" name="" value="<?= FreshRSS_Context::systemConf()->limits['max_registrations'] > 1 ? FreshRSS_Context::systemConf()->limits['max_registrations'] : $number + 1; ?>" min="2" + data-leave-validation="<?= FreshRSS_Context::systemConf()->limits['max_registrations'] > 1 ? FreshRSS_Context::systemConf()->limits['max_registrations'] : $number + 1; ?>" data-number="<?= $number ?>"/> <span id="max-registrations-status-disabled">(= <?= _t('admin.system.registration.status.disabled') ?>)</span><span id="max-registrations-status-enabled">(= <?= _t('admin.system.registration.status.enabled') ?>)</span> </div> </div> @@ -124,8 +124,8 @@ name="force-email-validation" id="force-email-validation" value="1" - <?= FreshRSS_Context::$system_conf->force_email_validation ? 'checked="checked"' : '' ?> - data-leave-validation="<?= FreshRSS_Context::$system_conf->force_email_validation ?>" + <?= FreshRSS_Context::systemConf()->force_email_validation ? 'checked="checked"' : '' ?> + data-leave-validation="<?= FreshRSS_Context::systemConf()->force_email_validation ?>" /> <?= _t('admin.system.force_email_validation') ?> </label> diff --git a/app/views/feed/add.phtml b/app/views/feed/add.phtml index c51289f56..da3bcf844 100644 --- a/app/views/feed/add.phtml +++ b/app/views/feed/add.phtml @@ -1,7 +1,7 @@ <?php declare(strict_types=1); /** @var FreshRSS_View $this */ - if ($this->feed) { + if ($this->feed !== null) { ?> <main class="post"> <h1><?= _t('sub.feed.add') ?></h1> diff --git a/app/views/feed/contentSelectorPreview.phtml b/app/views/feed/contentSelectorPreview.phtml index a5afb10f4..a93e88783 100644 --- a/app/views/feed/contentSelectorPreview.phtml +++ b/app/views/feed/contentSelectorPreview.phtml @@ -4,7 +4,7 @@ FreshRSS::preLayout(); ?> <!DOCTYPE html> -<html class="preview_background" lang="<?= FreshRSS_Context::$user_conf->language ?>" xml:lang="<?= FreshRSS_Context::$user_conf->language ?>"> +<html class="preview_background" lang="<?= FreshRSS_Context::userConf()->language ?>" xml:lang="<?= FreshRSS_Context::userConf()->language ?>"> <head> <?= FreshRSS_View::headStyle() ?> <script src="<?= Minz_Url::display('/scripts/preview.js?' . @filemtime(PUBLIC_PATH . '/scripts/preview.js')) ?>"></script> diff --git a/app/views/helpers/category/update.phtml b/app/views/helpers/category/update.phtml index 68132ad27..36c0abfe8 100644 --- a/app/views/helpers/category/update.phtml +++ b/app/views/helpers/category/update.phtml @@ -1,6 +1,9 @@ <?php declare(strict_types=1); /** @var FreshRSS_View $this */ + if ($this->category === null) { + throw new FreshRSS_Context_Exception('Category not initialised!'); + } ?> <div class="post"> <h2> @@ -28,7 +31,7 @@ <div class="form-group"> <label class="group-name" for="position"><?= _t('sub.category.position') ?></label> <div class="group-controls"> - <input type="number" name="position" id="position" min="1" value="<?= $this->category->attributes('position') ?>" /> + <input type="number" name="position" id="position" min="1" value="<?= $this->category->attributeInt('position') ?>" /> <p class="help"><?= _i('help') ?> <?= _t('sub.category.position_help') ?></p> </div> </div> @@ -46,7 +49,7 @@ <label class="group-name" for="opml_url"><?= _t('sub.category.opml_url') ?></label> <div class="group-controls"> <div class="stick"> - <input id="opml_url" name="opml_url" type="url" autocomplete="off" class="long" data-disable-update="refreshOpml" value="<?= $this->category->attributes('opml_url') ?>" /> + <input id="opml_url" name="opml_url" type="url" autocomplete="off" class="long" data-disable-update="refreshOpml" value="<?= $this->category->attributeString('opml_url') ?>" /> <button type="submit" class="btn" id="refreshOpml" formmethod="post" formaction="<?= _url('category', 'refreshOpml', 'id', $this->category->id()) ?>"> <?= _i('refresh') ?> <?= _t('gen.action.refresh_opml') ?> </button> @@ -90,7 +93,8 @@ <legend><?= _t('sub.category.archiving') ?></legend> <?php - $archiving = $this->category->attributes('archiving'); + $archiving = $this->category->attributeArray('archiving'); + /** @var array<'default'?:bool,'keep_period'?:string,'keep_max'?:int,'keep_min'?:int,'keep_favourites'?:bool,'keep_labels'?:bool,'keep_unreads'?:bool>|null $archiving */ if (empty($archiving)) { $archiving = [ 'default' => true ]; } else { @@ -101,7 +105,7 @@ 'keep_period_count' => '3', 'keep_period_unit' => 'P1M', ]; - if (!empty($archiving['keep_period'])) { + if (!empty($archiving['keep_period']) && is_string($archiving['keep_period'])) { if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) { $volatile['enable_keep_period'] = true; $volatile['keep_period_count'] = $matches['count']; @@ -109,21 +113,21 @@ } } //Defaults - if (!isset($archiving['keep_max'])) { - $archiving['keep_max'] = false; + if (!isset($archiving['keep_max']) || !is_int($archiving['keep_max'])) { + $archiving['keep_max'] = 0; } - if (!isset($archiving['keep_favourites'])) { + if (!isset($archiving['keep_min']) || !is_int($archiving['keep_min'])) { + $archiving['keep_min'] = 50; + } + if (!isset($archiving['keep_favourites']) || !is_bool($archiving['keep_favourites'])) { $archiving['keep_favourites'] = true; } - if (!isset($archiving['keep_labels'])) { + if (!isset($archiving['keep_labels']) || !is_bool($archiving['keep_labels'])) { $archiving['keep_labels'] = true; } - if (!isset($archiving['keep_unreads'])) { + if (!isset($archiving['keep_unreads']) || !is_bool($archiving['keep_unreads'])) { $archiving['keep_unreads'] = false; } - if (!isset($archiving['keep_min'])) { - $archiving['keep_min'] = 50; - } ?> <p class="alert alert-warn"> diff --git a/app/views/helpers/configure/query.phtml b/app/views/helpers/configure/query.phtml index 0f76bc202..145425271 100644 --- a/app/views/helpers/configure/query.phtml +++ b/app/views/helpers/configure/query.phtml @@ -1,6 +1,9 @@ <?php declare(strict_types=1); /** @var FreshRSS_View $this */ + if ($this->query === null) { + throw new FreshRSS_Context_Exception('Query not initialised!'); + } ?> <div class="post"> <h2><?= $this->query->getName() ?></h2> diff --git a/app/views/helpers/export/opml.phtml b/app/views/helpers/export/opml.phtml index 2c3e004fc..ce53bfc02 100644 --- a/app/views/helpers/export/opml.phtml +++ b/app/views/helpers/export/opml.phtml @@ -30,7 +30,7 @@ function feedsToOutlines(array $feeds, bool $excludeMutedFeeds = false): array { break; } /** @var array<string,string> */ - $xPathSettings = $feed->attributes('xpath'); + $xPathSettings = $feed->attributeArray('xpath') ?? []; $outline['frss:xPathItem'] = $xPathSettings['item'] ?? null; $outline['frss:xPathItemTitle'] = $xPathSettings['itemTitle'] ?? null; $outline['frss:xPathItemContent'] = $xPathSettings['itemContent'] ?? null; @@ -56,8 +56,8 @@ function feedsToOutlines(array $feeds, bool $excludeMutedFeeds = false): array { $outline['frss:cssFullContent'] = htmlspecialchars_decode($feed->pathEntries(), ENT_QUOTES); } - if ($feed->attributes('path_entries_filter') != '') { - $outline['frss:cssFullContentFilter'] = $feed->attributes('path_entries_filter'); + if ($feed->attributeString('path_entries_filter') != '') { + $outline['frss:cssFullContentFilter'] = $feed->attributeString('path_entries_filter'); } // Remove null attributes @@ -76,7 +76,7 @@ $opml_array = [ 'frss' => FreshRSS_Export_Service::FRSS_NAMESPACE, ], 'head' => [ - 'title' => FreshRSS_Context::$system_conf->title, + 'title' => FreshRSS_Context::systemConf()->title, 'dateCreated' => new DateTime(), ], 'body' => [], @@ -90,7 +90,7 @@ if (!empty($this->categories)) { ]; if ($cat->kind() === FreshRSS_Category::KIND_DYNAMIC_OPML) { - $outline['frss:opmlUrl'] = $cat->attributes('opml_url'); + $outline['frss:opmlUrl'] = $cat->attributeString('opml_url'); } $opml_array['body'][] = $outline; diff --git a/app/views/helpers/extension/configure.phtml b/app/views/helpers/extension/configure.phtml index 5cf7f9c0a..b714eb553 100644 --- a/app/views/helpers/extension/configure.phtml +++ b/app/views/helpers/extension/configure.phtml @@ -4,6 +4,9 @@ if (!Minz_Request::paramBoolean('ajax')) { $this->partial('aside_configure'); } + if ($this->extension === null) { + throw new FreshRSS_Context_Exception('Extension not initialised!'); + } ?> <div class="post"> <h2> diff --git a/app/views/helpers/extension/details.phtml b/app/views/helpers/extension/details.phtml index b8d0d784f..d1f773020 100644 --- a/app/views/helpers/extension/details.phtml +++ b/app/views/helpers/extension/details.phtml @@ -1,6 +1,9 @@ <?php declare(strict_types=1); /** @var FreshRSS_View $this */ + if ($this->ext_details === null) { + throw new FreshRSS_Context_Exception('Extension not initialised!'); + } $name_encoded = urlencode($this->ext_details->getName()); $ext_enabled = $this->ext_details->isEnabled(); diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index af2503256..5d4f1cc4b 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -1,6 +1,9 @@ <?php declare(strict_types=1); /** @var FreshRSS_View $this */ + if ($this->feed === null) { + throw new FreshRSS_Context_Exception('Feed not initialised!'); + } ?> <div class="post" id="feed_update"> <h1><?= $this->feed->name() ?></h1> @@ -184,9 +187,9 @@ <label class="group-name" for="mark_updated_article_unread"><?= _t('conf.reading.mark_updated_article_unread') ?></label> <div class="group-controls"> <select name="mark_updated_article_unread" id="mark_updated_article_unread" class="w50"> - <option value=""<?= $this->feed->attributes('mark_updated_article_unread') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option> - <option value="0"<?= $this->feed->attributes('mark_updated_article_unread') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option> - <option value="1"<?= $this->feed->attributes('mark_updated_article_unread') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option> + <option value=""<?= $this->feed->attributeBoolean('mark_updated_article_unread') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option> + <option value="0"<?= $this->feed->attributeBoolean('mark_updated_article_unread') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option> + <option value="1"<?= $this->feed->attributeBoolean('mark_updated_article_unread') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option> </select> </div> </div> @@ -195,12 +198,12 @@ <label class="group-name" for="read_when_same_title_in_feed"><?= _t('conf.reading.read.when') ?></label> <div class="group-controls"> <select name="read_when_same_title_in_feed" id="read_when_same_title_in_feed" class="w50"> - <option value=""<?= $this->feed->attributes('read_when_same_title_in_feed') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option> - <option value="0"<?= $this->feed->attributes('read_when_same_title_in_feed') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option> - <option value="10"<?= $this->feed->attributes('read_when_same_title_in_feed') == 10 ? ' selected="selected"' : '' ?>>10</option> - <option value="25"<?= $this->feed->attributes('read_when_same_title_in_feed') == 25 ? ' selected="selected"' : '' ?>>25</option> - <option value="100"<?= $this->feed->attributes('read_when_same_title_in_feed') == 100 ? ' selected="selected"' : '' ?>>100</option> - <option value="1000"<?= $this->feed->attributes('read_when_same_title_in_feed') == 1000 ? ' selected="selected"' : '' ?>>1 000</option> + <option value=""<?= $this->feed->attributeBoolean('read_when_same_title_in_feed') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option> + <option value="0"<?= $this->feed->attributeBoolean('read_when_same_title_in_feed') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option> + <option value="10"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 10 ? ' selected="selected"' : '' ?>>10</option> + <option value="25"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 25 ? ' selected="selected"' : '' ?>>25</option> + <option value="100"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 100 ? ' selected="selected"' : '' ?>>100</option> + <option value="1000"<?= $this->feed->attributeInt('read_when_same_title_in_feed') == 1000 ? ' selected="selected"' : '' ?>>1 000</option> </select> <?= _t('conf.reading.read.when_same_title') ?> </div> @@ -210,9 +213,9 @@ <label class="group-name" for="read_upon_reception"><?= _t('conf.reading.read.when') ?></label> <div class="group-controls"> <select name="read_upon_reception" id="read_upon_reception" class="w50"> - <option value=""<?= $this->feed->attributes('read_upon_reception') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option> - <option value="0"<?= $this->feed->attributes('read_upon_reception') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option> - <option value="1"<?= $this->feed->attributes('read_upon_reception') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option> + <option value=""<?= $this->feed->attributeBoolean('read_upon_reception') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option> + <option value="0"<?= $this->feed->attributeBoolean('read_upon_reception') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option> + <option value="1"<?= $this->feed->attributeBoolean('read_upon_reception') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option> </select> <?= _t('conf.reading.read.upon_reception') ?> </div> @@ -222,9 +225,9 @@ <label class="group-name" for="read_upon_gone"><?= _t('conf.reading.read.when') ?></label> <div class="group-controls"> <select name="read_upon_gone" id="read_upon_gone" class="w50"> - <option value=""<?= $this->feed->attributes('read_upon_gone') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option> - <option value="0"<?= $this->feed->attributes('read_upon_gone') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option> - <option value="1"<?= $this->feed->attributes('read_upon_gone') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option> + <option value=""<?= $this->feed->attributeBoolean('read_upon_gone') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option> + <option value="0"<?= $this->feed->attributeBoolean('read_upon_gone') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option> + <option value="1"<?= $this->feed->attributeBoolean('read_upon_gone') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option> </select> <?= _t('conf.reading.read.upon_gone') ?> </div> @@ -245,7 +248,10 @@ <div class="form-group"> <label class="group-name" for="keep_max_n_unread"><?= _t('conf.reading.read.keep_max_n_unread') ?></label> <div class="group-controls"> - <input type="number" name="keep_max_n_unread" id="keep_max_n_unread" class="w50" min="1" max="10000000" value="<?= $this->feed->attributes('keep_max_n_unread') ?>" placeholder="<?= _t('gen.short.by_default') ?>" /> + <input type="number" name="keep_max_n_unread" id="keep_max_n_unread" class="w50" min="1" max="10000000" + data-leave-validation="<?= $this->feed->attributeInt('keep_max_n_unread') ?>" + value="<?= $this->feed->attributeInt('keep_max_n_unread') ?>" + placeholder="<?= _t('gen.short.by_default') ?>" /> </div> </div> @@ -267,7 +273,8 @@ </div> </div> <?php - $archiving = $this->feed->attributes('archiving'); + $archiving = $this->feed->attributeArray('archiving'); + /** @var array<'default'?:bool,'keep_period'?:string,'keep_max'?:int,'keep_min'?:int,'keep_favourites'?:bool,'keep_labels'?:bool,'keep_unreads'?:bool>|null $archiving */ if (empty($archiving)) { $archiving = [ 'default' => true ]; } else { @@ -278,7 +285,7 @@ 'keep_period_count' => '3', 'keep_period_unit' => 'P1M', ]; - if (!empty($archiving['keep_period'])) { + if (!empty($archiving['keep_period']) && is_string($archiving['keep_period'])) { if (preg_match('/^PT?(?P<count>\d+)[YMWDH]$/', $archiving['keep_period'], $matches)) { $volatile['enable_keep_period'] = true; $volatile['keep_period_count'] = $matches['count']; @@ -286,19 +293,19 @@ } } //Defaults - if (!isset($archiving['keep_max'])) { - $archiving['keep_max'] = false; + if (!isset($archiving['keep_max']) || !is_int($archiving['keep_max'])) { + $archiving['keep_max'] = 0; } - if (!isset($archiving['keep_min'])) { + if (!isset($archiving['keep_min']) || !is_int($archiving['keep_min'])) { $archiving['keep_min'] = 50; } - if (!isset($archiving['keep_favourites'])) { + if (!isset($archiving['keep_favourites']) || !is_bool($archiving['keep_favourites'])) { $archiving['keep_favourites'] = true; } - if (!isset($archiving['keep_labels'])) { + if (!isset($archiving['keep_labels']) || !is_bool($archiving['keep_labels'])) { $archiving['keep_labels'] = true; } - if (!isset($archiving['keep_unreads'])) { + if (!isset($archiving['keep_unreads']) || !is_bool($archiving['keep_unreads'])) { $archiving['keep_unreads'] = false; } ?> @@ -406,7 +413,7 @@ <fieldset id="html_xpath"> <?php - $xpath = Minz_Helper::htmlspecialchars_utf8((array)($this->feed->attributes('xpath'))); + $xpath = Minz_Helper::htmlspecialchars_utf8($this->feed->attributeArray('xpath') ?? []); ?> <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.help') ?></p> <div class="form-group"> @@ -521,7 +528,7 @@ <div class="form-group"> <?php - $path_entries_filter = Minz_Helper::htmlspecialchars_utf8((string)($this->feed->attributes('path_entries_filter'))); + $path_entries_filter = Minz_Helper::htmlspecialchars_utf8($this->feed->attributeString('path_entries_filter') ?? ''); ?> <label class="group-name" for="path_entries_filter"><?= _t('sub.feed.css_path_filter') ?></label> <div class="group-controls"> @@ -537,13 +544,13 @@ <label class="group-name" for="curl_params_cookie"><?= _t('sub.feed.css_cookie') ?></label> <div class="group-controls"> <input type="text" name="curl_params_cookie" id="curl_params_cookie" class="w100" value="<?= - is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_COOKIE]) ? - $this->feed->attributes('curl_params')[CURLOPT_COOKIE] : '' + $this->feed->attributeArray('curl_params') !== null && !empty($this->feed->attributeArray('curl_params')[CURLOPT_COOKIE]) ? + $this->feed->attributeArray('curl_params')[CURLOPT_COOKIE] : '' ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" /> <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_cookie_help') ?></p> <label for="curl_params_cookiefile"> <input type="checkbox" name="curl_params_cookiefile" id="curl_params_cookiefile" value="1"<?= - is_array($this->feed->attributes('curl_params')) && isset($this->feed->attributes('curl_params')[CURLOPT_COOKIEFILE]) ? + $this->feed->attributeArray('curl_params') !== null && isset($this->feed->attributeArray('curl_params')[CURLOPT_COOKIEFILE]) ? ' checked="checked"' : '' ?> /> <?= _t('sub.feed.accept_cookies') ?> @@ -556,8 +563,8 @@ <label class="group-name" for="curl_params_redirects"><?= _t('sub.feed.max_http_redir') ?></label> <div class="group-controls"> <input type="number" name="curl_params_redirects" id="curl_params_redirects" class="w50" min="-1" value="<?= - is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_MAXREDIRS]) ? - $this->feed->attributes('curl_params')[CURLOPT_MAXREDIRS] : '' + $this->feed->attributeArray('curl_params') !== null && !empty($this->feed->attributeArray('curl_params')[CURLOPT_MAXREDIRS]) ? + $this->feed->attributeArray('curl_params')[CURLOPT_MAXREDIRS] : '' ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" /> <p class="help"><?= _i('help') ?> <?= _t('sub.feed.max_http_redir_help') ?></p> </div> @@ -567,9 +574,9 @@ <label class="group-name" for="content_action"><?= _t('sub.feed.content_action') ?></label> <div class="group-controls"> <select name="content_action" id="content_action" class="w50"> - <option value="replace"<?= 'replace' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.replace') ?></option> - <option value="prepend"<?= 'prepend' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.prepend') ?></option> - <option value="append"<?= 'append' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.append') ?></option> + <option value="replace"<?= 'replace' === $this->feed->attributeString('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.replace') ?></option> + <option value="prepend"<?= 'prepend' === $this->feed->attributeString('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.prepend') ?></option> + <option value="append"<?= 'append' === $this->feed->attributeString('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.append') ?></option> </select> </div> </div> @@ -578,8 +585,8 @@ <label class="group-name" for="curl_params_useragent"><?= _t('sub.feed.useragent') ?></label> <div class="group-controls"> <input type="text" name="curl_params_useragent" id="curl_params_useragent" class="w100" value="<?= - is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_USERAGENT]) ? - $this->feed->attributes('curl_params')[CURLOPT_USERAGENT] : '' + $this->feed->attributeArray('curl_params') !== null && !empty($this->feed->attributeArray('curl_params')[CURLOPT_USERAGENT]) ? + $this->feed->attributeArray('curl_params')[CURLOPT_USERAGENT] : '' ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" /> <p class="help"><?= _i('help') ?> <?= _t('sub.feed.useragent_help') ?></p> </div> @@ -590,8 +597,8 @@ <div class="group-controls"> <select name="proxy_type" id="proxy_type"><?php $type = ''; - if (is_array($this->feed->attributes('curl_params')) && isset($this->feed->attributes('curl_params')[CURLOPT_PROXYTYPE])) { - $type = $this->feed->attributes('curl_params')[CURLOPT_PROXYTYPE]; + if ($this->feed->attributeArray('curl_params') !== null && isset($this->feed->attributeArray('curl_params')[CURLOPT_PROXYTYPE])) { + $type = $this->feed->attributeArray('curl_params')[CURLOPT_PROXYTYPE]; } foreach(['' => '', 3 => 'NONE', 0 => 'HTTP', 2 => 'HTTPS', 4 => 'SOCKS4', 6 => 'SOCKS4A', 5 => 'SOCKS5', 7 => 'SOCKS5H'] as $k => $v) { echo '<option value="' . $k . ($type === $k ? '" selected="selected' : '' ) . '">' . $v . '</option>'; @@ -599,8 +606,8 @@ ?> </select> <input type="text" name="curl_params" id="curl_params" value="<?= - is_array($this->feed->attributes('curl_params')) && !empty($this->feed->attributes('curl_params')[CURLOPT_PROXY]) ? - $this->feed->attributes('curl_params')[CURLOPT_PROXY] : '' + $this->feed->attributeArray('curl_params') !== null && !empty($this->feed->attributeArray('curl_params')[CURLOPT_PROXY]) ? + $this->feed->attributeArray('curl_params')[CURLOPT_PROXY] : '' ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" /> <p class="help"><?= _i('help') ?> <?= _t('sub.feed.proxy_help') ?></p> </div> @@ -609,7 +616,7 @@ <div class="form-group"> <label class="group-name" for="timeout"><?= _t('sub.feed.timeout') ?></label> <div class="group-controls"> - <input type="number" name="timeout" id="timeout" class="w50" min="3" max="900" value="<?= $this->feed->attributes('timeout') ?>" placeholder="<?= _t('gen.short.by_default') ?>" /> + <input type="number" name="timeout" id="timeout" class="w50" min="3" max="900" value="<?= $this->feed->attributeInt('timeout') ?>" placeholder="<?= _t('gen.short.by_default') ?>" /> </div> </div> @@ -617,9 +624,9 @@ <label class="group-name" for="ssl_verify"><?= _t('sub.feed.ssl_verify') ?></label> <div class="group-controls"> <select name="ssl_verify" id="ssl_verify" class="w50"> - <option value=""<?= $this->feed->attributes('ssl_verify') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option> - <option value="0"<?= $this->feed->attributes('ssl_verify') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option> - <option value="1"<?= $this->feed->attributes('ssl_verify') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option> + <option value=""<?= $this->feed->attributeBoolean('ssl_verify') === null ? ' selected="selected"' : '' ?>><?= _t('gen.short.by_default') ?></option> + <option value="0"<?= $this->feed->attributeBoolean('ssl_verify') === false ? ' selected="selected"' : '' ?>><?= _t('gen.short.no') ?></option> + <option value="1"<?= $this->feed->attributeBoolean('ssl_verify') === true ? ' selected="selected"' : '' ?>><?= _t('gen.short.yes') ?></option> </select> </div> </div> @@ -627,7 +634,7 @@ <div class="form-group"> <div class="group-controls"> <label class="checkbox" for="clear_cache"> - <input type="checkbox" name="clear_cache" id="clear_cache" value="1"<?= $this->feed->attributes('clear_cache') ? ' checked="checked"' : '' ?> /> + <input type="checkbox" name="clear_cache" id="clear_cache" value="1"<?= $this->feed->attributeBoolean('clear_cache') ? ' checked="checked"' : '' ?> /> <?= _t('sub.feed.clear_cache') ?> </label> </div> diff --git a/app/views/helpers/index/normal/entry_bottom.phtml b/app/views/helpers/index/normal/entry_bottom.phtml index dba0e44a3..e5bfd7fd0 100644 --- a/app/views/helpers/index/normal/entry_bottom.phtml +++ b/app/views/helpers/index/normal/entry_bottom.phtml @@ -1,13 +1,13 @@ <?php declare(strict_types=1); /** @var FreshRSS_View $this */ - $bottomline_read = FreshRSS_Context::$user_conf->bottomline_read; - $bottomline_favorite = FreshRSS_Context::$user_conf->bottomline_favorite; - $bottomline_sharing = FreshRSS_Context::$user_conf->bottomline_sharing && (count(FreshRSS_Context::$user_conf->sharing) > 0); - $bottomline_myLabels = FreshRSS_Context::$user_conf->bottomline_myLabels; - $bottomline_tags = FreshRSS_Context::$user_conf->bottomline_tags; - $bottomline_date = FreshRSS_Context::$user_conf->bottomline_date; - $bottomline_link = FreshRSS_Context::$user_conf->bottomline_link; + $bottomline_read = FreshRSS_Context::userConf()->bottomline_read; + $bottomline_favorite = FreshRSS_Context::userConf()->bottomline_favorite; + $bottomline_sharing = FreshRSS_Context::userConf()->bottomline_sharing && (count(FreshRSS_Context::userConf()->sharing) > 0); + $bottomline_myLabels = FreshRSS_Context::userConf()->bottomline_myLabels; + $bottomline_tags = FreshRSS_Context::userConf()->bottomline_tags; + $bottomline_date = FreshRSS_Context::userConf()->bottomline_date; + $bottomline_link = FreshRSS_Context::userConf()->bottomline_link; ?><ul class="horizontal-list bottom"><?php if (FreshRSS_Auth::hasAccess()) { if ($bottomline_read) { @@ -81,8 +81,8 @@ <li class="dropdown-header"><?= _t('index.share') ?> <a href="<?= _url('configure', 'integration') ?>"><?= _i('configure') ?></a></li><?php $id = $this->entry->id(); $link = $this->entry->link(); - $title = $this->entry->title() . ' · ' . $this->feed->name(); - foreach (FreshRSS_Context::$user_conf->sharing as $share_options) { + $title = $this->entry->title() . ' · ' . ($this->feed === null ? '' : $this->feed->name()); + foreach (FreshRSS_Context::userConf()->sharing as $share_options) { $share = FreshRSS_Share::get($share_options['type']); if ($share === null) { continue; diff --git a/app/views/helpers/index/normal/entry_header.phtml b/app/views/helpers/index/normal/entry_header.phtml index 6a693b0a9..b324a5949 100644 --- a/app/views/helpers/index/normal/entry_header.phtml +++ b/app/views/helpers/index/normal/entry_header.phtml @@ -1,15 +1,18 @@ <?php declare(strict_types=1); /** @var FreshRSS_View $this */ - $topline_read = FreshRSS_Context::$user_conf->topline_read; - $topline_favorite = FreshRSS_Context::$user_conf->topline_favorite; - $topline_website = FreshRSS_Context::$user_conf->topline_website; - $topline_thumbnail = FreshRSS_Context::$user_conf->topline_thumbnail; - $topline_summary = FreshRSS_Context::$user_conf->topline_summary; - $topline_display_authors = FreshRSS_Context::$user_conf->topline_display_authors; - $topline_date = FreshRSS_Context::$user_conf->topline_date; - $topline_link = FreshRSS_Context::$user_conf->topline_link; - $lazyload = FreshRSS_Context::$user_conf->lazyload; + if ($this->feed === null) { + throw new FreshRSS_Context_Exception('Feed not initialised!'); + } + $topline_read = FreshRSS_Context::userConf()->topline_read; + $topline_favorite = FreshRSS_Context::userConf()->topline_favorite; + $topline_website = FreshRSS_Context::userConf()->topline_website; + $topline_thumbnail = FreshRSS_Context::userConf()->topline_thumbnail; + $topline_summary = FreshRSS_Context::userConf()->topline_summary; + $topline_display_authors = FreshRSS_Context::userConf()->topline_display_authors; + $topline_date = FreshRSS_Context::userConf()->topline_date; + $topline_link = FreshRSS_Context::userConf()->topline_link; + $lazyload = FreshRSS_Context::userConf()->lazyload; ?><ul class="horizontal-list flux_header website<?= $topline_website ?>"><?php if (FreshRSS_Auth::hasAccess()) { if ($topline_read) { @@ -37,7 +40,7 @@ if ($topline_website !== 'none'): ?><li class="item website <?= $topline_website ?>"> <a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" class="item-element" title="<?= _t('gen.action.filter') ?>: <?= $this->feed->name() ?>"> - <?php if (FreshRSS_Context::$user_conf->show_favicons && 'name' !== $topline_website): ?><img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><?php if ('icon' !== $topline_website): ?><span class="websiteName"><?= $this->feed->name() ?></span><?php endif; ?> + <?php if (FreshRSS_Context::userConf()->show_favicons && 'name' !== $topline_website): ?><img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><?php if ('icon' !== $topline_website): ?><span class="websiteName"><?= $this->feed->name() ?></span><?php endif; ?> </a> </li><?php endif; ?> diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 38a7751ee..29f78e5ee 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -1,27 +1,27 @@ <?php declare(strict_types=1); /** @var FreshRSS_View $this */ -$mark = FreshRSS_Context::$user_conf->mark_when; -$s = FreshRSS_Context::$user_conf->shortcuts; +$mark = FreshRSS_Context::userConf()->mark_when; +$s = FreshRSS_Context::userConf()->shortcuts; $extData = Minz_ExtensionManager::callHook('js_vars', []); echo htmlspecialchars(json_encode(array( 'context' => array( 'anonymous' => !FreshRSS_Auth::hasAccess(), 'auto_remove_article' => !!FreshRSS_Context::isAutoRemoveAvailable(), - 'hide_posts' => !(FreshRSS_Context::$user_conf->display_posts || Minz_Request::actionName() === 'reader'), - 'display_order' => Minz_Request::paramString('order') ?: FreshRSS_Context::$user_conf->sort_order, - 'display_categories' => FreshRSS_Context::$user_conf->display_categories, + 'hide_posts' => !(FreshRSS_Context::userConf()->display_posts || Minz_Request::actionName() === 'reader'), + 'display_order' => Minz_Request::paramString('order') ?: FreshRSS_Context::userConf()->sort_order, + 'display_categories' => FreshRSS_Context::userConf()->display_categories, 'auto_mark_article' => !!$mark['article'], 'auto_mark_site' => !!$mark['site'], 'auto_mark_scroll' => !!$mark['scroll'], 'auto_mark_focus' => !!$mark['focus'], - 'auto_load_more' => !!FreshRSS_Context::$user_conf->auto_load_more, + 'auto_load_more' => !!FreshRSS_Context::userConf()->auto_load_more, 'auto_actualize_feeds' => Minz_Session::paramBoolean('actualize_feeds'), - 'does_lazyload' => !!FreshRSS_Context::$user_conf->lazyload , - 'sides_close_article' => !!FreshRSS_Context::$user_conf->sides_close_article, + 'does_lazyload' => !!FreshRSS_Context::userConf()->lazyload , + 'sides_close_article' => !!FreshRSS_Context::userConf()->sides_close_article, 'sticky_post' => !!FreshRSS_Context::isStickyPostEnabled(), - 'html5_notif_timeout' => FreshRSS_Context::$user_conf->html5_notif_timeout, - 'auth_type' => FreshRSS_Context::$system_conf->auth_type, + 'html5_notif_timeout' => FreshRSS_Context::userConf()->html5_notif_timeout, + 'auth_type' => FreshRSS_Context::systemConf()->auth_type, 'current_view' => Minz_Request::actionName(), 'csrf' => FreshRSS_Auth::csrfToken(), 'mtime' => [ @@ -69,7 +69,7 @@ echo htmlspecialchars(json_encode(array( 'notif_request_failed' => _t('gen.js.feedback.request_failed'), 'category_empty' => _t('gen.js.category_empty'), 'labels_empty' => _t('gen.js.labels_empty'), - 'language' => FreshRSS_Context::$user_conf->language, + 'language' => FreshRSS_Context::userConf()->language, ), 'icons' => array( 'read' => rawurlencode(_i('read')), diff --git a/app/views/helpers/stream-footer.phtml b/app/views/helpers/stream-footer.phtml index 41f4315b5..0cbab601a 100644 --- a/app/views/helpers/stream-footer.phtml +++ b/app/views/helpers/stream-footer.phtml @@ -32,13 +32,13 @@ <?php } elseif ($hasAccess) { ?> <?= _t('gen.stream.nothing_to_load') ?><br /> <button id="bigMarkAsRead" - class="as-link <?= FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : '' ?>" + class="as-link <?= FreshRSS_Context::userConf()->reading_confirm ? 'confirm" disabled="disabled' : '' ?>" form="stream-footer" formaction="<?= Minz_Url::display($url_mark_read) ?>" type="submit"> <span class="bigTick">✓</span><br /> <span class="markAllRead"><?= _t('gen.stream.mark_all_read') ?></span><br /> - <?php if (FreshRSS_Context::$user_conf->onread_jump_next) { ?> + <?php if (FreshRSS_Context::userConf()->onread_jump_next) { ?> <span class="jumpNext"><?= _t('conf.reading.jump_next') ?></span> <?php } ?> </button> diff --git a/app/views/index/about.phtml b/app/views/index/about.phtml index 5ee1729cd..1c41cf4d6 100644 --- a/app/views/index/about.phtml +++ b/app/views/index/about.phtml @@ -33,8 +33,8 @@ <?= FRESHRSS_VERSION ?> <?php - $env = FreshRSS_Context::$system_conf->environment; - if ($env !== 'production' && FreshRSS_Context::$user_conf->is_admin) { ?> + $env = FreshRSS_Context::systemConf()->environment; + if ($env !== 'production' && FreshRSS_Context::userConf()->is_admin) { ?> <h2>data/config.php</h2> <code>'environment' => '<?= $env; ?>'</code><br /> <?php diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml index 0ddc22e11..6a46ec2ca 100644 --- a/app/views/index/global.phtml +++ b/app/views/index/global.phtml @@ -6,7 +6,7 @@ $class = ''; $state_unread = false; - if (FreshRSS_Context::$user_conf->hide_read_feeds && + if (FreshRSS_Context::userConf()->hide_read_feeds && FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) && !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) { $class = ' state_unread'; @@ -62,7 +62,7 @@ ?> <li id="f_<?= $feed->id() ?>" class="item feed<?= $error_class, $empty_class, $mute_class ?>" title="<?= $error_title, $empty_title ?>" data-unread="<?= $feed->nbNotRead() ?>" data-priority="<?= $feed->priority() ?>"> - <?php if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?> + <?php if (FreshRSS_Context::userConf()->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?> <a class="item-title" data-unread="<?= format_number($feed->nbNotRead()) ?>" href="<?= Minz_Url::display($url_base) ?>"><?= $feed->name() ?></a> </li> <?php } ?> @@ -82,6 +82,6 @@ <div id="overlay"> <a class="close" href="#"><?= _i('close') ?></a> - <div id="panel"<?= FreshRSS_Context::$user_conf->display_posts ? '' : ' class="hide_posts"' ?>> + <div id="panel"<?= FreshRSS_Context::userConf()->display_posts ? '' : ' class="hide_posts"' ?>> </div> </div> diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml index 0d484f518..42c2e0072 100644 --- a/app/views/index/normal.phtml +++ b/app/views/index/normal.phtml @@ -11,10 +11,10 @@ call_user_func($this->callbackBeforeEntries, $this); $display_today = true; $display_yesterday = true; $display_others = true; -$hidePosts = !FreshRSS_Context::$user_conf->display_posts; -$lazyload = FreshRSS_Context::$user_conf->lazyload; -$content_width = FreshRSS_Context::$user_conf->content_width; -$MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max; +$hidePosts = !FreshRSS_Context::userConf()->display_posts; +$lazyload = FreshRSS_Context::userConf()->lazyload; +$content_width = FreshRSS_Context::userConf()->content_width; +$MAX_TAGS_DISPLAYED = FreshRSS_Context::userConf()->show_tags_max; $useKeepUnreadImportant = !FreshRSS_Context::isImportant() && !FreshRSS_Context::isFeed(); $today = @strtotime('today'); @@ -74,12 +74,15 @@ $today = @strtotime('today'); ?>" data-priority="<?= $this->feed->priority() ?>"><?php $this->renderHelper('index/normal/entry_header'); + if ($this->feed === null) { + throw new FreshRSS_Context_Exception('Feed not initialised!'); + } $tags = null; $firstTags = array(); $remainingTags = array(); - if (FreshRSS_Context::$user_conf->show_tags === 'h' || FreshRSS_Context::$user_conf->show_tags === 'f' || FreshRSS_Context::$user_conf->show_tags === 'b') { + if (FreshRSS_Context::userConf()->show_tags === 'h' || FreshRSS_Context::userConf()->show_tags === 'f' || FreshRSS_Context::userConf()->show_tags === 'b') { $tags = $this->entry->tags(); if (!empty($tags)) { if ($MAX_TAGS_DISPLAYED > 0) { @@ -93,14 +96,14 @@ $today = @strtotime('today'); ?><article class="flux_content" dir="auto"> <div class="content <?= $content_width ?>"> <header> - <?php if (FreshRSS_Context::$user_conf->show_feed_name === 't') { ?> + <?php if (FreshRSS_Context::userConf()->show_feed_name === 't') { ?> <div class="website"><a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" title="<?= _t('gen.action.filter') ?>"> - <?php if (FreshRSS_Context::$user_conf->show_favicons): ?> + <?php if (FreshRSS_Context::userConf()->show_favicons): ?> <img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><span><?= $this->feed->name() ?></span></a> </div> <?php } ?> - <?php if (FreshRSS_Context::$user_conf->show_tags === 'h' || FreshRSS_Context::$user_conf->show_tags === 'b') { ?> + <?php if (FreshRSS_Context::userConf()->show_tags === 'h' || FreshRSS_Context::userConf()->show_tags === 'b') { ?> <div class="tags"> <?php if (!empty($tags)) { @@ -132,11 +135,11 @@ $today = @strtotime('today'); <?php } ?> <h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $this->entry->link() ?>" title="<?= _t('conf.shortcut.see_on_website')?>"><?= $this->entry->title() ?></a></h1> - <?php if (FreshRSS_Context::$user_conf->show_author_date === 'h' || FreshRSS_Context::$user_conf->show_author_date === 'b') { ?> + <?php if (FreshRSS_Context::userConf()->show_author_date === 'h' || FreshRSS_Context::userConf()->show_author_date === 'b') { ?> <div class="subtitle"> - <?php if (FreshRSS_Context::$user_conf->show_feed_name === 'a') { ?> + <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?> <div class="website"><a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" title="<?= _t('gen.action.filter') ?>"> - <?php if (FreshRSS_Context::$user_conf->show_favicons): ?> + <?php if (FreshRSS_Context::userConf()->show_favicons): ?> <img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><span><?= $this->feed->name() ?></span></a> </div> @@ -164,8 +167,8 @@ $today = @strtotime('today'); echo $lazyload && $hidePosts ? lazyimg($this->entry->content(true)) : $this->entry->content(true); ?></div> <?php - $display_authors_date = FreshRSS_Context::$user_conf->show_author_date === 'f' || FreshRSS_Context::$user_conf->show_author_date === 'b'; - $display_tags = FreshRSS_Context::$user_conf->show_tags === 'f' || FreshRSS_Context::$user_conf->show_tags === 'b'; + $display_authors_date = FreshRSS_Context::userConf()->show_author_date === 'f' || FreshRSS_Context::userConf()->show_author_date === 'b'; + $display_tags = FreshRSS_Context::userConf()->show_tags === 'f' || FreshRSS_Context::userConf()->show_tags === 'b'; if ($display_authors_date || $display_tags) { ?> @@ -173,9 +176,9 @@ $today = @strtotime('today'); <?php if ($display_authors_date) { ?> <div class="subtitle"> - <?php if (FreshRSS_Context::$user_conf->show_feed_name === 'a') { ?> + <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?> <div class="website"><a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" title="<?= _t('gen.action.filter') ?>"> - <?php if (FreshRSS_Context::$user_conf->show_favicons): ?> + <?php if (FreshRSS_Context::userConf()->show_favicons): ?> <img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><span><?= $this->feed->name() ?></span></a> </div> @@ -266,4 +269,4 @@ $today = @strtotime('today'); <?= _i('close') ?> </a> -<?php if ($nbEntries > 0 && FreshRSS_Context::$user_conf->show_nav_buttons) $this->partial('nav_entries'); ?> +<?php if ($nbEntries > 0 && FreshRSS_Context::userConf()->show_nav_buttons) $this->partial('nav_entries'); ?> diff --git a/app/views/index/reader.phtml b/app/views/index/reader.phtml index dc90a144a..f2d7ab46b 100644 --- a/app/views/index/reader.phtml +++ b/app/views/index/reader.phtml @@ -8,9 +8,9 @@ if (!Minz_Request::paramBoolean('ajax')) { call_user_func($this->callbackBeforeEntries, $this); -$lazyload = FreshRSS_Context::$user_conf->lazyload; -$content_width = FreshRSS_Context::$user_conf->content_width; -$MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max; +$lazyload = FreshRSS_Context::userConf()->lazyload; +$content_width = FreshRSS_Context::userConf()->content_width; +$MAX_TAGS_DISPLAYED = FreshRSS_Context::userConf()->show_tags_max; ?> <main id="stream" class="reader"> <h1 class="title_hidden"><?= _t('conf.reading.view.reader') ?></h1> @@ -35,7 +35,7 @@ $MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max; $firstTags = array(); $remainingTags = array(); - if (FreshRSS_Context::$user_conf->show_tags == 'h' || FreshRSS_Context::$user_conf->show_tags == 'f' || FreshRSS_Context::$user_conf->show_tags == 'b') { + if (FreshRSS_Context::userConf()->show_tags == 'h' || FreshRSS_Context::userConf()->show_tags == 'f' || FreshRSS_Context::userConf()->show_tags == 'b') { $tags = $this->entry->tags(); if (!empty($tags)) { if ($MAX_TAGS_DISPLAYED > 0) { @@ -69,15 +69,15 @@ $MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max; <a class="read" href="<?= Minz_Url::display($readUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?= _i($item->isRead() ? 'read' : 'unread') ?></a> <a class="bookmark" href="<?= Minz_Url::display($favoriteUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?= _i($item->isFavorite() ? 'starred' : 'non-starred') ?></a> <?php } ?> - <?php if (FreshRSS_Context::$user_conf->show_feed_name === 't') { ?> + <?php if (FreshRSS_Context::userConf()->show_feed_name === 't') { ?> <a class="website" href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>"> - <?php if (FreshRSS_Context::$user_conf->show_favicons): ?> + <?php if (FreshRSS_Context::userConf()->show_favicons): ?> <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><span><?= $feed->name() ?></span></a> <?php } ?> </div> - <?php if (FreshRSS_Context::$user_conf->show_tags === 'h' || FreshRSS_Context::$user_conf->show_tags === 'b') { ?> + <?php if (FreshRSS_Context::userConf()->show_tags === 'h' || FreshRSS_Context::userConf()->show_tags === 'b') { ?> <div class="tags"> <?php if (!empty($tags)) { @@ -109,11 +109,11 @@ $MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max; <?php } ?> <h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?= $item->link() ?>"><?= $item->title() ?></a></h1> - <?php if (FreshRSS_Context::$user_conf->show_author_date === 'h' || FreshRSS_Context::$user_conf->show_author_date === 'b') { ?> + <?php if (FreshRSS_Context::userConf()->show_author_date === 'h' || FreshRSS_Context::userConf()->show_author_date === 'b') { ?> <div class="subtitle"> - <?php if (FreshRSS_Context::$user_conf->show_feed_name === 'a') { ?> + <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?> <div class="website"><a href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>"> - <?php if (FreshRSS_Context::$user_conf->show_favicons): ?> + <?php if (FreshRSS_Context::userConf()->show_favicons): ?> <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><span><?= $feed->name() ?></span></a></div> <?php } ?> @@ -141,17 +141,17 @@ $MAX_TAGS_DISPLAYED = FreshRSS_Context::$user_conf->show_tags_max; <?= $item->content(true) ?> </div> <?php - $display_authors_date = FreshRSS_Context::$user_conf->show_author_date === 'f' || FreshRSS_Context::$user_conf->show_author_date === 'b'; - $display_tags = FreshRSS_Context::$user_conf->show_tags === 'f' || FreshRSS_Context::$user_conf->show_tags === 'b'; + $display_authors_date = FreshRSS_Context::userConf()->show_author_date === 'f' || FreshRSS_Context::userConf()->show_author_date === 'b'; + $display_tags = FreshRSS_Context::userConf()->show_tags === 'f' || FreshRSS_Context::userConf()->show_tags === 'b'; if ($display_authors_date || $display_tags) { ?> <footer> <?php if ($display_authors_date) { ?> <div class="subtitle"> - <?php if (FreshRSS_Context::$user_conf->show_feed_name === 'a') { ?> + <?php if (FreshRSS_Context::userConf()->show_feed_name === 'a') { ?> <div class="website"><a href="<?= _url('index', 'reader', 'get', 'f_' . $feed->id()) ?>" title="<?= _t('gen.action.filter') ?>"> - <?php if (FreshRSS_Context::$user_conf->show_favicons): ?> + <?php if (FreshRSS_Context::userConf()->show_favicons): ?> <img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><span><?= $feed->name() ?></span></a></div> <?php } ?> diff --git a/app/views/index/rss.phtml b/app/views/index/rss.phtml index a10aa806b..0205b0703 100644 --- a/app/views/index/rss.phtml +++ b/app/views/index/rss.phtml @@ -47,7 +47,7 @@ foreach ($this->entries as $item) { echo "\t\t\t", '<media:thumbnail url="' . $thumbnail['url'] . (empty($thumbnail['width']) ? '' : '" width="' . $thumbnail['width']) . (empty($thumbnail['height']) ? '' : '" height="' . $thumbnail['height']) - . (empty($thumbnail['time']) ? '' : '" time="' . $thumbnail['time']) + . (empty($thumbnail['type']) ? '' : '" type="' . $thumbnail['type']) . '" />', "\n"; } $enclosures = $item->enclosures(false); diff --git a/app/views/stats/idle.phtml b/app/views/stats/idle.phtml index a671bb83e..5390a00a3 100644 --- a/app/views/stats/idle.phtml +++ b/app/views/stats/idle.phtml @@ -36,15 +36,15 @@ $empty_class = ''; $empty_title = ''; - if ($feed != null && $feed->nbEntries() == 0) { + if ($feed !== null && $feed->nbEntries() == 0) { $empty_class = ' empty'; $empty_title = _t('sub.feed.empty'); } - $mute_class = $feed->mute() ? ' mute' : ''; + $mute_class = ($feed !== null && $feed->mute()) ? ' mute' : ''; ?> <li class="item feed<?= $error_class, $empty_class, $mute_class ?>" title="<?= $error_title, $empty_title ?>"> <a class="configure open-slider" href="<?= _url('stats', 'feed', 'id', $feedInPeriod['id'], 'sub', 'idle') ?>" title="<?= _t('gen.action.manage') ?>"><?= _i('configure') ?></a> - <?php if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $feedInPeriod['favicon'] ?>" alt="✇" loading="lazy" /><?php endif; ?> + <?php if (FreshRSS_Context::userConf()->show_favicons): ?><img class="favicon" src="<?= $feedInPeriod['favicon'] ?>" alt="✇" loading="lazy" /><?php endif; ?> <span title="<?= timestamptodate((int)($feedInPeriod['last_date']), false) ?>"><?= $feedInPeriod['name'] ?> (<?= _t('admin.stats.number_entries', $feedInPeriod['nb_articles']) ?>)</span> </li> diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml index a1a874b31..4bb966e8b 100644 --- a/app/views/subscription/index.phtml +++ b/app/views/subscription/index.phtml @@ -34,8 +34,8 @@ ?> <div class="box"> <div class="box-title"> - <a class="configure open-slider" href="<?= _url('category', 'update', 'id', $cat->id()) ?>" data-cat-position="<?= $cat->attributes('position') ?>"><?= _i('configure') ?></a> - <h2><?= $cat->name() ?><?php if ($cat->kind() == FreshRSS_Category::KIND_DYNAMIC_OPML) { echo " " . _i('opml-dyn'); } ?></h2> + <a class="configure open-slider" href="<?= _url('category', 'update', 'id', $cat->id()) ?>" data-cat-position="<?= $cat->attributeString('position') ?>"><?= _i('configure') ?></a> + <h2><?= $cat->name() ?><?php if ($cat->kind() === FreshRSS_Category::KIND_DYNAMIC_OPML) { echo " " . _i('opml-dyn'); } ?></h2> </div> <ul class="box-content drop-zone scrollbar-thin" dropzone="move" data-cat-id="<?= $cat->id() ?>"> <?php @@ -63,7 +63,7 @@ <li class="item feed<?= $error_class, $empty_class, $mute_class ?>" title="<?= $error_title, $empty_title ?>" draggable="true" data-feed-id="<?= $feed->id() ?>" data-priority="<?= $feed->priority() ?>"> <a class="configure open-slider" href="<?= _url('subscription', 'feed', 'id', $feed->id()) ?>" title="<?= _t('gen.action.manage') ?>"><?= _i('configure') ?></a> - <?php if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?> + <?php if (FreshRSS_Context::userConf()->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?> <span class="item-title"><?= $feed->name() ?></span> </li> <?php diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml index dcff153d6..12ae3d07d 100644 --- a/app/views/user/manage.phtml +++ b/app/views/user/manage.phtml @@ -21,7 +21,7 @@ <select name="new_user_language" id="new_user_language"> <?php $languages = Minz_Translate::availableLanguages(); ?> <?php foreach ($languages as $lang) { ?> - <option value="<?= $lang ?>"<?= FreshRSS_Context::$user_conf->language === $lang ? + <option value="<?= $lang ?>"<?= FreshRSS_Context::userConf()->language === $lang ? ' selected="selected"' : '' ?>><?= _t('gen.lang.' . $lang) ?></option> <?php } ?> </select> diff --git a/app/views/user/profile.phtml b/app/views/user/profile.phtml index 0a41d4dc4..576e821b2 100644 --- a/app/views/user/profile.phtml +++ b/app/views/user/profile.phtml @@ -36,7 +36,7 @@ <div class="form-group"> <label class="group-name" for="email"><?= _t('conf.profile.email') ?></label> <div class="group-controls"> - <input id="email" name="email" type="email" value="<?= FreshRSS_Context::$user_conf->mail_login ?>" /> + <input id="email" name="email" type="email" value="<?= FreshRSS_Context::userConf()->mail_login ?>" /> </div> </div> @@ -56,12 +56,12 @@ <?php if (FreshRSS_Auth::accessNeedsAction()) { ?> <div class="form-group"> <label class="group-name" for="token"><?= _t('admin.auth.token') ?></label> - <?php $token = FreshRSS_Context::$user_conf->token; ?> + <?php $token = FreshRSS_Context::userConf()->token; ?> <div class="group-controls"> <input type="text" id="token" name="token" value="<?= $token ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" data-leave-validation="<?= $token ?>"/> <p class="help"><?= _i('help') ?> <?= _t('admin.auth.token_help') ?></p> <kbd><?= Minz_Url::display(array('a' => 'rss', 'params' => array('user' => Minz_User::name(), - 'token' => $token, 'hours' => FreshRSS_Context::$user_conf->since_hours_posts_per_rss)), 'html', true) ?></kbd> + 'token' => $token, 'hours' => FreshRSS_Context::userConf()->since_hours_posts_per_rss)), 'html', true) ?></kbd> </div> </div> <?php } ?> @@ -74,7 +74,7 @@ </div> </form> - <?php if (FreshRSS_Context::$system_conf->api_enabled) { ?> + <?php if (FreshRSS_Context::systemConf()->api_enabled) { ?> <form method="post" action="<?= _url('api', 'updatePassword') ?>"> <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" /> <legend><?= _t('conf.profile.api') ?></legend> diff --git a/app/views/user/validateEmail.phtml b/app/views/user/validateEmail.phtml index 8f822fe6a..a2f486d86 100644 --- a/app/views/user/validateEmail.phtml +++ b/app/views/user/validateEmail.phtml @@ -4,11 +4,11 @@ ?> <main class="post"> <p> - <?= _t('user.email.validation.need_to', FreshRSS_Context::$system_conf->title) ?> + <?= _t('user.email.validation.need_to', FreshRSS_Context::systemConf()->title) ?> </p> <p> - <?= _t('user.email.validation.email_sent_to', FreshRSS_Context::$user_conf->mail_login) ?> + <?= _t('user.email.validation.email_sent_to', FreshRSS_Context::userConf()->mail_login) ?> </p> <form action="<?= _url('user', 'sendValidationEmail') ?>" method="post"> |
