feed editor: show purge interval correctly if FORCE_ARTICLE_PURGE is set

This commit is contained in:
Andrew Dolgov 2021-01-07 18:16:42 +03:00
parent 0868ff9d64
commit 33a5ecd2ce
2 changed files with 15 additions and 4 deletions

View File

@ -636,14 +636,20 @@ class Pref_Feeds extends Handler_Protected {
print "<label>" . __('Article purging:') . "</label> ";
$local_purge_intervals = $purge_intervals;
$default_purge_interval = get_pref("PURGE_OLD_DAYS");
if (FORCE_ARTICLE_PURGE == 0) {
$local_purge_intervals = $purge_intervals;
$default_purge_interval = get_pref("PURGE_OLD_DAYS");
if ($default_purge_interval > 0)
$local_purge_intervals[0] .= " " . T_sprintf("(%d days)", $default_purge_interval);
if ($default_purge_interval > 0)
$local_purge_intervals[0] .= " " . T_nsprintf('(%d day)', '(%d days)', $default_purge_interval, $default_purge_interval);
else
$local_purge_intervals[0] .= " " . sprintf("(%s)", __("Disabled"));
} else {
$purge_interval = FORCE_ARTICLE_PURGE;
$local_purge_intervals = [ T_nsprintf('%d day', '%d days', $purge_interval, $purge_interval) ];
}
print_select_hash("purge_interval", $purge_interval, $local_purge_intervals,
'dojoType="fox.form.Select" ' .
((FORCE_ARTICLE_PURGE == 0) ? "" : 'disabled="1"'));

View File

@ -401,6 +401,11 @@
return vsprintf(__(array_shift($args)), $args);
}
function T_nsprintf() {
$args = func_get_args();
return vsprintf(_ngettext(array_shift($args), array_shift($args), array_shift($args)), $args);
}
function is_server_https() {
return (!empty($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] != 'off')) || $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https';
}