Commit 5e827024 authored by Darryl Hamilton's avatar Darryl Hamilton
Browse files

Provide sanity check warning for broken timezone formatting



Bug #771597 - This appears to be only for Windows hosts, which
return a full string identifier (eg New Zealand Standard Time)
where others return +1200.

Also, modified the format string to have better compatibility
with more hosts for hour:minute:second formatting.

Change-Id: I979f2b6f1d5e0d08ac3aa6dec05036b718bb8ee1
Signed-off-by: default avatarDarryl Hamilton <darrylh@catalyst.net.nz>
parent aece6859
...@@ -94,6 +94,16 @@ if (isset($register)) { ...@@ -94,6 +94,16 @@ if (isset($register)) {
$smarty->assign('closed', $closed); $smarty->assign('closed', $closed);
$smarty->assign('closeform', $closeform); $smarty->assign('closeform', $closeform);
// site warnings for the admin to consider
$warnings = array();
// Check if the host returns a usable value for the timezone identifier %z
$tz_count = preg_match("/\+[0-9]{4}/", strftime("%z"));
if ($tz_count == 0 || $tz_count == FALSE) {
$warnings[] = get_string('timezoneidentifierunusable', 'error');
}
$smarty->assign('warnings', $warnings);
$smarty->display('admin/index.tpl'); $smarty->display('admin/index.tpl');
function close_site_submit(Pieform $form, $values) { function close_site_submit(Pieform $form, $values) {
......
...@@ -128,6 +128,8 @@ $string['newfiltersdescription'] = 'If you have downloaded a new set of HTML fil ...@@ -128,6 +128,8 @@ $string['newfiltersdescription'] = 'If you have downloaded a new set of HTML fil
$string['filtersinstalled'] = 'Filters installed.'; $string['filtersinstalled'] = 'Filters installed.';
$string['nofiltersinstalled'] = 'No html filters installed.'; $string['nofiltersinstalled'] = 'No html filters installed.';
// sanity check warnings
$string['warnings'] = 'Warning';
// Group management // Group management
$string['groupcategories'] = 'Group Categories'; $string['groupcategories'] = 'Group Categories';
......
...@@ -114,4 +114,6 @@ $string['missingparamorder'] = 'Missing order specification'; ...@@ -114,4 +114,6 @@ $string['missingparamorder'] = 'Missing order specification';
$string['missingparamid'] = 'Missing id'; $string['missingparamid'] = 'Missing id';
$string['themenameinvalid'] = "The name of the theme '%s' contains invalid characters."; $string['themenameinvalid'] = "The name of the theme '%s' contains invalid characters.";
$string['timezoneidentifierunusable'] = 'PHP on your website host does not return a useful value for the timezone identifier (%%z) - certain date formatting, such as the LEAP2A export, will be broken.';
?> ?>
...@@ -41,7 +41,7 @@ $string['strftimerecent'] = '%%d %%b, %%k:%%M'; ...@@ -41,7 +41,7 @@ $string['strftimerecent'] = '%%d %%b, %%k:%%M';
$string['strftimerecentfull'] = '%%a, %%d %%b %%Y, %%l:%%M %%p'; $string['strftimerecentfull'] = '%%a, %%d %%b %%Y, %%l:%%M %%p';
$string['strftimetime'] = '%%l:%%M %%p'; $string['strftimetime'] = '%%l:%%M %%p';
$string['strfdaymonthyearshort'] = '%%d/%%m/%%Y'; $string['strfdaymonthyearshort'] = '%%d/%%m/%%Y';
$string['strftimew3cdatetime'] = '%%Y-%%m-%%dT%%T%%z'; $string['strftimew3cdatetime'] = '%%Y-%%m-%%dT%%H:%%I:%%S%%z';
$string['strftimew3cdate'] = '%%Y-%%m-%%d'; $string['strftimew3cdate'] = '%%Y-%%m-%%d';
$string['thislanguage'] = 'English'; $string['thislanguage'] = 'English';
$string['locales'] = 'en_US.utf8,en_GB.utf8,en,english-us,english-uk,english'; $string['locales'] = 'en_US.utf8,en_GB.utf8,en,english-us,english-uk,english';
......
...@@ -664,3 +664,15 @@ form#uploadcsv { ...@@ -664,3 +664,15 @@ form#uploadcsv {
#edituser_institution tr.submit td { #edituser_institution tr.submit td {
padding-top: 5px; padding-top: 5px;
} }
/* warnings for the admin screen */
.admin-warning-box {
border: 1px solid #e98a88;
background: #fbeceb;
margin-bottom: 5px;
padding: 5px;
}
.admin-warning-box h3 {
color: #CA0000;
}
{include file='header.tpl'} {include file='header.tpl'}
{if $warnings}
<div class="admin-warning-box">
<h3>{str tag="warnings" section=admin}</h3>
<ul>
{foreach from=$warnings key=key item=warning}
<li>{$warning}</li>
{/foreach}
</ul>
</div>
{/if}
<div id="adminhome"> <div id="adminhome">
{if $register} {if $register}
<div class="message" id="register-site"> <div class="message" id="register-site">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment