From e69c04db5a6466fda1e0095158a861450e022f14 Mon Sep 17 00:00:00 2001 From: gbateson Date: Thu, 14 Sep 2006 21:50:37 +0000 Subject: [PATCH] do not add $restore->course_startdateoffset to ANY empty dates --- mod/hotpot/restorelib.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/mod/hotpot/restorelib.php b/mod/hotpot/restorelib.php index d0a45c39fa..cdd04c2e7b 100644 --- a/mod/hotpot/restorelib.php +++ b/mod/hotpot/restorelib.php @@ -119,19 +119,14 @@ function hotpot_restore_mods($mod, $restore) { fwrite ($restorelog, "
Hotpot - ".$xml['NAME'][0]['#']."
"); // loop through time fields - $TAGS = array('TIMEOPEN'=>1, 'TIMECLOSE'=>1, 'TIMECREATED'=>0, 'TIMEMODIFIED'=>0); - foreach ($TAGS as $TAG=>$ignoreifempty) { + $TAGS = array('TIMEOPEN', 'TIMECLOSE', 'TIMECREATED', 'TIMEMODIFIED'); + foreach ($TAGS as $TAG) { + + // check $TAG has a sensible value + if (!empty($xml[$TAG][0]['#']) && is_string($xml[$TAG][0]['#'])) { - // get $TAG value - if (isset($xml[$TAG][0]['#'])) { - $value = $xml[$TAG][0]['#']; - } else { - $value = 0; - } - if (empty($value) && $ignoreifempty) { - // do nothing - } else { // write old date to $restorelog + $value = $xml[$TAG][0]['#']; $date = usergetdate($value); fwrite ($restorelog, "$TAG was ". $date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']); @@ -144,7 +139,6 @@ function hotpot_restore_mods($mod, $restore) { $xml[$TAG][0]['#'] = $value; } } - fclose($restorelog); } $status = hotpot_restore_records( -- 2.39.5