} } break; } // set dvd if (boolParam('dvdenabled')) { if ($slot != 'ide0') { $slot = 'ide0'; } else { $slot = 'ide1'; } $machine->{$slot} = dvdParam('dvd'); } // set fdd if (boolParam('fddenabled')) { $machine->fd0 = fddParam('fdd'); } // set nic $machine->nic0 = array('type' => 'bridged', 'driver' => '82545EM', 'adapter' => 'eth0', 'connected' => 'on'); header('Location: machine.php?machine=' . $machine->id); exit; } break; case 'import': $machine = Repository::importMachine(stringParam('file')); if ($machine && $machine->exists()) { header('Location: machine.php?machine=' . $machine->id); exit; } break; }
} } } if ($machine->destroy()) { header('Location: index.php'); exit; } case 'set': // mount foreach (arrayParam('slot') as $slot) { switch (stringParam($slot)) { case 'dvd': $machine->{$slot} = dvdParam('dvd_' . $slot); break; case 'fdd': $machine->{$slot} = fddParam('fdd_' . $slot); break; case 'hdd': $machine->{$slot} = hddParam('hdd_' . $slot); break; default: $machine->{$slot} = NULL; break; } } if ($machine->state == 'poweroff') { // network foreach (arrayParam('net') as $net) { $machine->{$net} = array('type' => stringParam($net . '_type', 'none'), 'driver' => stringParam($net . '_driver', '82543GC'), 'mac' => str_replace(':', '', stringParam($net . '_mac', 'auto')), 'adapter' => stringParam($net . '_adapter', FALSE), 'connected' => 'on'); } // options