Add timezone configuration option
This commit is contained in:
parent
01c3175c1b
commit
3bc7f019c5
@ -21,6 +21,9 @@ Router\before(function($action) {
|
||||
$language = Model\Config\get('language') ?: 'en_US';
|
||||
if ($language !== 'en_US') PicoTools\Translator\load($language);
|
||||
|
||||
// Set timezone
|
||||
date_default_timezone_set(Model\Config\get('timezone') ?: 'UTC');
|
||||
|
||||
// HTTP secure headers
|
||||
$frame_src = \PicoFeed\Filter::$iframe_whitelist;
|
||||
$frame_src[] = 'https://login.persona.org';
|
||||
|
@ -36,6 +36,7 @@ Router\get_action('config', function() {
|
||||
'values' => Model\Config\get_all(),
|
||||
'db_size' => filesize(DB_FILENAME),
|
||||
'languages' => Model\Config\get_languages(),
|
||||
'timezones' => Model\Config\get_timezones(),
|
||||
'autoflush_options' => Model\Config\get_autoflush_options(),
|
||||
'paging_options' => Model\Config\get_paging_options(),
|
||||
'theme_options' => Model\Config\get_themes(),
|
||||
@ -69,6 +70,7 @@ Router\post_action('config', function() {
|
||||
'values' => Model\Config\get_all(),
|
||||
'db_size' => filesize(DB_FILENAME),
|
||||
'languages' => Model\Config\get_languages(),
|
||||
'timezones' => Model\Config\get_timezones(),
|
||||
'autoflush_options' => Model\Config\get_autoflush_options(),
|
||||
'paging_options' => Model\Config\get_paging_options(),
|
||||
'theme_options' => Model\Config\get_themes(),
|
||||
|
@ -206,4 +206,5 @@ return array(
|
||||
'%d weeks ago' => 'Il y a %d semaines',
|
||||
'%d month ago' => 'Il y a %d mois',
|
||||
'%d months ago' => 'Il y a %d mois',
|
||||
'Timezone' => 'Fuseau horaire',
|
||||
);
|
||||
|
@ -16,7 +16,7 @@ use SimpleValidator\Validator;
|
||||
use SimpleValidator\Validators;
|
||||
use PicoDb\Database;
|
||||
|
||||
const DB_VERSION = 21;
|
||||
const DB_VERSION = 22;
|
||||
const HTTP_USERAGENT = 'Miniflux - http://miniflux.net';
|
||||
const HTTP_FAKE_USERAGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36';
|
||||
|
||||
@ -35,6 +35,13 @@ function write_debug()
|
||||
}
|
||||
}
|
||||
|
||||
// Get available timezone
|
||||
function get_timezones()
|
||||
{
|
||||
$timezones = \timezone_identifiers_list();
|
||||
return array_combine(array_values($timezones), $timezones);
|
||||
}
|
||||
|
||||
// Get all supported languages
|
||||
function get_languages()
|
||||
{
|
||||
@ -172,7 +179,7 @@ function get($name)
|
||||
}
|
||||
else {
|
||||
|
||||
if (! isset($_SESSION['config'])) {
|
||||
if (! isset($_SESSION['config'][$name])) {
|
||||
$_SESSION['config'] = get_all();
|
||||
}
|
||||
|
||||
@ -192,6 +199,7 @@ function get_all()
|
||||
->columns(
|
||||
'username',
|
||||
'language',
|
||||
'timezone',
|
||||
'autoflush',
|
||||
'nocontent',
|
||||
'items_per_page',
|
||||
|
@ -2,6 +2,11 @@
|
||||
|
||||
namespace Schema;
|
||||
|
||||
function version_22($pdo)
|
||||
{
|
||||
$pdo->exec("ALTER TABLE config ADD COLUMN timezone TEXT DEFAULT 'UTC'");
|
||||
}
|
||||
|
||||
|
||||
function version_21($pdo)
|
||||
{
|
||||
|
@ -13,6 +13,9 @@
|
||||
<?= Helper\form_label(t('Confirmation'), 'confirmation') ?>
|
||||
<?= Helper\form_password('confirmation', $values, $errors) ?><br/>
|
||||
|
||||
<?= Helper\form_label(t('Timezone'), 'timezone') ?>
|
||||
<?= Helper\form_select('timezone', $timezones, $values, $errors) ?><br/>
|
||||
|
||||
<?= Helper\form_label(t('Language'), 'language') ?>
|
||||
<?= Helper\form_select('language', $languages, $values, $errors) ?><br/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user