From 1a97f41f523fbe891776681f83b41ad6fc2dfe5e Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 17 Apr 2014 06:49:19 +0200 Subject: [PATCH 1/2] [ADDED] System Date Format string * [ADDED] New admin panel config option in System * [UPDATED] Use new date format on all templates Fixes #2118 once merged. --- public/include/config/admin_settings.inc.php | 7 +++++++ public/include/smarty_globals.inc.php | 1 + public/templates/bootstrap/account/invitations/default.tpl | 2 +- public/templates/bootstrap/admin/monitoring/default.tpl | 2 +- public/templates/bootstrap/admin/news/default.tpl | 2 +- public/templates/bootstrap/admin/registrations/default.tpl | 2 +- public/templates/bootstrap/admin/user/default.tpl | 4 ++-- public/templates/bootstrap/home/news_accordion.tpl | 4 ++-- public/templates/bootstrap/home/news_all.tpl | 2 +- .../bootstrap/statistics/blocks/blocks_found_details.tpl | 2 +- .../templates/bootstrap/statistics/blocks/small_table.tpl | 2 +- public/templates/bootstrap/statistics/uptime/default.tpl | 4 ++-- 12 files changed, 21 insertions(+), 13 deletions(-) diff --git a/public/include/config/admin_settings.inc.php b/public/include/config/admin_settings.inc.php index e0adf7cb..f622a60d 100644 --- a/public/include/config/admin_settings.inc.php +++ b/public/include/config/admin_settings.inc.php @@ -293,6 +293,13 @@ $aSettings['system'][] = array( 'name' => 'system_error_email', 'value' => $setting->getValue('system_error_email'), 'tooltip' => 'The email address for system errors notifications, like cronjobs failures.' ); +$aSettings['system'][] = array( + 'display' => 'Date format string', 'type' => 'text', + 'site' => 25, + 'default' => '%m/%d/%Y %H:%M:%S', + 'name' => 'system_date_format', 'value' => $setting->getValue('system_date_format'), + 'tooltip' => 'Date format to be used throughout the site. Please check PHP strftime for details.' +); $aSettings['system'][] = array( 'display' => 'Disable e-mail confirmations', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes' ), diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index d19fd00b..8ccd788d 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -65,6 +65,7 @@ $aGlobal = array( 'twofactor' => $config['twofactor'], 'csrf' => $config['csrf'], 'config' => array( + 'date' => $setting->getValue('system_date_format', '%m/%d/%y %H:%M:%S'), 'website_design' => $setting->getValue('website_design'), 'poolnav_enabled' => $setting->getValue('poolnav_enabled'), 'poolnav_pools' => $setting->getValue('poolnav_pools'), diff --git a/public/templates/bootstrap/account/invitations/default.tpl b/public/templates/bootstrap/account/invitations/default.tpl index c256d41e..23ddaa19 100644 --- a/public/templates/bootstrap/account/invitations/default.tpl +++ b/public/templates/bootstrap/account/invitations/default.tpl @@ -44,7 +44,7 @@ {section name=invite loop=$INVITATIONS} {$INVITATIONS[invite].email} - {$INVITATIONS[invite].time|date_format:"%d/%m/%Y %H:%M:%S"} + {$INVITATIONS[invite].time|date_format:$GLOBAL.config.date} {/section} diff --git a/public/templates/bootstrap/admin/monitoring/default.tpl b/public/templates/bootstrap/admin/monitoring/default.tpl index de0af634..83b353a8 100644 --- a/public/templates/bootstrap/admin/monitoring/default.tpl +++ b/public/templates/bootstrap/admin/monitoring/default.tpl @@ -50,7 +50,7 @@ {else} {/if} - {$event.value|date_format:"%m/%d %H:%M:%S"} + {$event.value|date_format:$GLOBAL.config.date} {else} {$event.value|default:""} diff --git a/public/templates/bootstrap/admin/news/default.tpl b/public/templates/bootstrap/admin/news/default.tpl index caeb07ff..0d30d5f1 100644 --- a/public/templates/bootstrap/admin/news/default.tpl +++ b/public/templates/bootstrap/admin/news/default.tpl @@ -44,7 +44,7 @@
{$NEWS[news].header}
- posted {$NEWS[news].time|date_format:"%b %e, %Y at %H:%M"}{if $HIDEAUTHOR|default:"0" == 0} by {$NEWS[news].author}{/if} + posted {$NEWS[news].time|date_format:$GLOBAL.config.date}{if $HIDEAUTHOR|default:"0" == 0} by {$NEWS[news].author}{/if}
diff --git a/public/templates/bootstrap/admin/registrations/default.tpl b/public/templates/bootstrap/admin/registrations/default.tpl index 7c2e62bc..c16917fb 100644 --- a/public/templates/bootstrap/admin/registrations/default.tpl +++ b/public/templates/bootstrap/admin/registrations/default.tpl @@ -24,7 +24,7 @@ {$LASTREGISTEREDUSERS[user].id|escape} {$LASTREGISTEREDUSERS[user].mposuser} {$LASTREGISTEREDUSERS[user].email} - {$LASTREGISTEREDUSERS[user].signup_timestamp|date_format:"%d/%m %H:%M:%S"} + {$LASTREGISTEREDUSERS[user].signup_timestamp|date_format:$GLOBAL.config.date} {if !$LASTREGISTEREDUSERS[user].inviter}{else}{/if} {$LASTREGISTEREDUSERS[user].inviter} diff --git a/public/templates/bootstrap/admin/user/default.tpl b/public/templates/bootstrap/admin/user/default.tpl index 987724ba..357a8ba0 100644 --- a/public/templates/bootstrap/admin/user/default.tpl +++ b/public/templates/bootstrap/admin/user/default.tpl @@ -121,8 +121,8 @@ {$USERS[user].estimates.hours24|number_format:"8"} {/if} {$USERS[user].balance|number_format:"8"} - {$USERS[user].signup_timestamp|date_format:"%d/%m %H:%M:%S"} - {$USERS[user].last_login|date_format:"%d/%m %H:%M:%S"} + {$USERS[user].signup_timestamp|date_format:$GLOBAL.config.date} + {$USERS[user].last_login|date_format:$GLOBAL.config.date} diff --git a/public/templates/bootstrap/home/news_accordion.tpl b/public/templates/bootstrap/home/news_accordion.tpl index 26dd8736..71392775 100644 --- a/public/templates/bootstrap/home/news_accordion.tpl +++ b/public/templates/bootstrap/home/news_accordion.tpl @@ -11,7 +11,7 @@
{$NEWS[news].header}
- posted {$NEWS[news].time|date_format:"%b %e, %Y at %H:%M"}{if $HIDEAUTHOR|default:"0" == 0} by {$NEWS[news].author}{/if} + posted {$NEWS[news].time|date_format:$GLOBAL.config.date}{if $HIDEAUTHOR|default:"0" == 0} by {$NEWS[news].author}{/if}
@@ -24,4 +24,4 @@
- \ No newline at end of file + diff --git a/public/templates/bootstrap/home/news_all.tpl b/public/templates/bootstrap/home/news_all.tpl index af229f98..82769586 100644 --- a/public/templates/bootstrap/home/news_all.tpl +++ b/public/templates/bootstrap/home/news_all.tpl @@ -5,7 +5,7 @@
{$NEWS[news].header}
- posted {$NEWS[news].time|date_format:"%b %e, %Y at %H:%M"}{if $HIDEAUTHOR|default:"0" == 0} by {$NEWS[news].author}{/if} + posted {$NEWS[news].time|date_format:$GLOBAL.config.date}{if $HIDEAUTHOR|default:"0" == 0} by {$NEWS[news].author}{/if}
{$NEWS[news].content nofilter} diff --git a/public/templates/bootstrap/statistics/blocks/blocks_found_details.tpl b/public/templates/bootstrap/statistics/blocks/blocks_found_details.tpl index 53c0cf72..834c0fe2 100644 --- a/public/templates/bootstrap/statistics/blocks/blocks_found_details.tpl +++ b/public/templates/bootstrap/statistics/blocks/blocks_found_details.tpl @@ -46,7 +46,7 @@ {/if} {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} - {$BLOCKSFOUND[block].time|date_format:"%d/%m/%Y %H:%M:%S"} + {$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date} {$BLOCKSFOUND[block].difficulty|number_format:"4"} {$BLOCKSFOUND[block].amount|number_format:"2"} diff --git a/public/templates/bootstrap/statistics/blocks/small_table.tpl b/public/templates/bootstrap/statistics/blocks/small_table.tpl index 2c1c4303..544ffd22 100644 --- a/public/templates/bootstrap/statistics/blocks/small_table.tpl +++ b/public/templates/bootstrap/statistics/blocks/small_table.tpl @@ -23,7 +23,7 @@ {$BLOCKSFOUND[block].height} {/if} {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} - {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M:%S"} + {$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date} {$BLOCKSFOUND[block].shares|number_format} {/section} diff --git a/public/templates/bootstrap/statistics/uptime/default.tpl b/public/templates/bootstrap/statistics/uptime/default.tpl index e6835ed8..b89ecea3 100644 --- a/public/templates/bootstrap/statistics/uptime/default.tpl +++ b/public/templates/bootstrap/statistics/uptime/default.tpl @@ -23,7 +23,7 @@ {if $node|count > 1}{$node.1}{/if} {$CODES[$item.status]} - {$item.log.1.datetime|date_format:"%b %d, %Y %H:%M"} + {$item.log.1.datetime|date_format:$GLOBAL.config.date}
@@ -58,7 +58,7 @@
From da5414d5b5e9b10badc6a8faad268d5f44ec1900 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 17 Apr 2014 06:53:46 +0200 Subject: [PATCH 2/2] [FIX] Proper default format --- public/include/smarty_globals.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index 8ccd788d..68e920b5 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -65,7 +65,7 @@ $aGlobal = array( 'twofactor' => $config['twofactor'], 'csrf' => $config['csrf'], 'config' => array( - 'date' => $setting->getValue('system_date_format', '%m/%d/%y %H:%M:%S'), + 'date' => $setting->getValue('system_date_format', '%m/%d/%Y %H:%M:%S'), 'website_design' => $setting->getValue('website_design'), 'poolnav_enabled' => $setting->getValue('poolnav_enabled'), 'poolnav_pools' => $setting->getValue('poolnav_pools'),