MDL-35412 core: Moving get_string out of if statement

This commit is contained in:
Frederic Massart 2012-10-16 11:50:25 +08:00
parent 15396bba9b
commit c5f2d11969

View File

@ -2128,7 +2128,8 @@ function userdate($date, $format = '', $timezone = 99, $fixday = true, $fixhour
function date_format_string($date, $format, $tz = 99) {
global $CFG;
if (abs($tz) > 13) {
if ($CFG->ostype == 'WINDOWS' and ($localewincharset = get_string('localewincharset', 'langconfig'))) {
if ($CFG->ostype == 'WINDOWS') {
$localewincharset = get_string('localewincharset', 'langconfig');
$format = textlib::convert($format, 'utf-8', $localewincharset);
$datestring = strftime($format, $date);
$datestring = textlib::convert($datestring, $localewincharset, 'utf-8');
@ -2136,7 +2137,8 @@ function date_format_string($date, $format, $tz = 99) {
$datestring = strftime($format, $date);
}
} else {
if ($CFG->ostype == 'WINDOWS' and ($localewincharset = get_string('localewincharset', 'langconfig'))) {
if ($CFG->ostype == 'WINDOWS') {
$localewincharset = get_string('localewincharset', 'langconfig');
$format = textlib::convert($format, 'utf-8', $localewincharset);
$datestring = gmstrftime($format, $date);
$datestring = textlib::convert($datestring, $localewincharset, 'utf-8');