Esempio n. 1
0
         if (empty($currentrec)) {
             insert_record('auth_instance_config', $record);
         } else {
             update_record('auth_instance_config', $record, array('field' => $field, 'instance' => $authinstance->id));
         }
     }
     //now save pubkey stuff
     require $maharadirroot . '/lib/peer.php';
     require $maharadirroot . '/api/xmlrpc/lib.php';
     //first check to see if a host exists that needs to be deleted.
     $existinghost = get_record('host', 'institution', $newinstitution->name);
     if (!empty($existinghost)) {
         delete_records('host', 'institution', $newinstitution->name);
     }
     $peer = new peer();
     $peer->bootstrap($moodlewebroot, null, 'moodle', $authinstance->institution);
     $peer->commit();
     //now write Mahara's Webroot to a file that we can read in step 3
     $mfile = $moodledataroot . "/maharaweb.txt";
     $fh = fopen($mfile, 'w') or die("can't open file");
     fwrite($fh, $CFG->wwwroot);
     fclose($fh);
     redirect($moodlewebroot . '/admin/configmahoodle.php?step=3&mad=' . urlencode($maharadirroot));
 } elseif ($_GET['step'] == '3') {
     //now configure Moodle to connect to the Mahara install.
     require_once $moodledirroot . '/config.php';
     check_moodle();
     //check to make sure Moodle is installed and can enable Networking.
     include_once $moodledirroot . '/mnet/lib.php';
     $mfile = $CFG->dataroot . "/maharaweb.txt";
     if (!file_exists($mfile)) {