From db0f2a4496b929a50f3bbd613f7955d7777c4c90 Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Wed, 5 Dec 2007 06:13:17 +0000 Subject: [PATCH] MDL-12439 database preset fixes --- mod/data/lib.php | 5 +++-- mod/data/preset.php | 13 +------------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/mod/data/lib.php b/mod/data/lib.php index f0a89b9cc7..1b3a9e86f5 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -2070,10 +2070,11 @@ class PresetImporter { // existing valuas MUST be sent too - it can not work without them! foreach ($this->data as $prop=>$unused) { - if (array_key_exists($prop, $settings)) { - $this->$prop = $settings->$prop; + if (array_key_exists($prop, (array)$settings)) { + $this->data->$prop = $settings->$prop; } } + data_update_instance(addslashes_object($this->data)); if (strstr($this->folder, '/temp/')) clean_preset($this->folder); /* Removes the temporary files */ diff --git a/mod/data/preset.php b/mod/data/preset.php index 334be156ac..3f4bac9584 100644 --- a/mod/data/preset.php +++ b/mod/data/preset.php @@ -10,7 +10,6 @@ require_once('lib.php'); require_once($CFG->libdir.'/uploadlib.php'); require_once($CFG->libdir.'/xmlize.php'); - $id = optional_param('id', 0, PARAM_INT); // course module id $d = optional_param('d', 0, PARAM_INT); // database activity id $action = optional_param('action', 'base', PARAM_ALPHANUM); // current action @@ -203,8 +202,6 @@ switch ($action) { echo ''; break; - - /***************** Exporting *****************/ case 'save1': if (!data_submitted() or !confirm_sesskey()) { @@ -319,25 +316,20 @@ $options->d = $data->id; $options->sesskey = sesskey(); print_single_button('preset.php', $options, $strsave, 'post'); echo ''; - - echo '

'.$strimport.'

'; - echo ''; helpbutton('importfromfile', '', 'data'); echo ''; - echo '
'; echo '
'; echo ''; echo ''; echo ''; -echo ''; +echo 'id}&choose=uploadpreset.file', 'coursefiles', 'menubar=0,location=0,scrollbars,resizable,width=750,height=500', 0".');" type="button" />'; echo ''; echo '
'; echo ''; - echo ''; helpbutton('usepreset', '', 'data'); echo ''; @@ -381,7 +373,4 @@ echo ''; print_footer($course); - - - ?> -- 2.39.5