function peer($seed) { if (is_string($seed)) { $this->seed = peer::getArrayFromSeed($seed); } else { if (is_array($seed)) { $this->seed = $seed; } } }
function decodeSeedList($list) { $seeds = explode("\n", $list); $r = array(); foreach ($seeds as $seed) { $peer = new peer($seed); $r[strtolower($peer->getName())] = $peer; } return $r; }
$currentrec = get_record('auth_instance_config', 'instance', $authinstance->id, 'field', $field); 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";