]> git.mjollnir.org Git - moodle.git/commitdiff
merged fixing notices
authortoyomoyo <toyomoyo>
Thu, 12 Oct 2006 06:58:14 +0000 (06:58 +0000)
committertoyomoyo <toyomoyo>
Thu, 12 Oct 2006 06:58:14 +0000 (06:58 +0000)
backup/restorelib.php

index d67b2de57962285ca7a035a3411cc7fd1406ce10..3ed8ec1930b0e7fdd7b4df09e229fbae7e55d9da 100644 (file)
             $course->lang = addslashes($course_header->course_lang);
             $course->theme = addslashes($course_header->course_theme);
             $course->cost = addslashes($course_header->course_cost);
-            $course->currency = addslashes($course_header->course_currency);
+            $course->currency = isset($course_header->course_currency)?addslashes($course_header->course_currency):'';
             $course->marker = addslashes($course_header->course_marker);
             $course->visible = addslashes($course_header->course_visible);
             $course->hiddensections = addslashes($course_header->course_hiddensections);
                             // Yu: This part is called repeatedly for every instance, 
                             // so it is necessary to set the granular flag and check isset() 
                             // when the first instance of this type of mod is processed.
-                            if (!isset($restore->mods[$mod->type]->granular) && is_array($restore->mods[$mod->type]->instances)) {
+                            if (!isset($restore->mods[$mod->type]->granular) && isset($restore->mods[$mod->type]->instances) && is_array($restore->mods[$mod->type]->instances)) {
                                 // This defines whether we want to restore specific
                                 // instances of the modules (granular restore), or
                                 // whether we don't care and just want to restore
                             }
                           
                             //Check if we've to restore this module (and instance) 
-                            if ($restore->mods[$mod->type]->restore) {                      
+                            if (!empty($restore->mods[$mod->type]->restore)) {                      
                                 if (empty($restore->mods[$mod->type]->granular)  // we don't care about per instance
                                     || (array_key_exists($mod->instance,$restore->mods[$mod->type]->instances) 
                                         && !empty($restore->mods[$mod->type]->instances[$mod->instance]->restore))) {
                     $mod_id = $data["MOD"]["#"]["ID"]["0"]["#"];
                     $mod_type = $data["MOD"]["#"]["MODTYPE"]["0"]["#"];
                     //Only if we've selected to restore it
-                    if  ($this->preferences->mods[$mod_type]->restore) {
+                    if  (!empty($this->preferences->mods[$mod_type]->restore)) {
                         //Save to db
                         $status = backup_putid($this->preferences->backup_unique_code,$mod_type,$mod_id,
                                      null,$data);
             // would have loaded it anyway, if there is any assignments. 
             // fix for MDL-6831
             $newcontext = get_context_instance(CONTEXT_COURSE, $restore->course_id);
-            if (!has_capability('course:manageactivities', $newcontext)) {
+            if (!has_capability('moodle/course:manageactivities', $newcontext)) {
                 if ($legacyteachers = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM, SITEID))) {
                     if ($legacyteacher = array_shift($legacyteachers)) {
                         role_assign($legacyteacher->id, $USER->id, 0, $newcontext->id);