/** * de-activates a network * * @api * * @param int $network_id network id * * @return bool on success TRUE/FALSE */ function ace_network_deactivate($network_id) { $lab_id = ace_network_get_lab_id($network_id); $lab_is_active = ace_lab_is_active($lab_id); $virt_success = FALSE; if ($lab_is_active) { $virt_success = ace_virt_network_deactivate($network_id); $lab_vm_table = ace_lab_get_vm_table($lab_id); if (is_array($lab_vm_table)) { foreach ($lab_vm_table as $lab_vm) { $vm_nic_array = ace_vm_get_nic_table($lab_vm['id']); if (is_array($vm_nic_array)) { foreach ($vm_nic_array as $vm_nic) { if ($vm_nic['network_id'] == $network_id) { ace_virt_vm_nic_link_down($lab_vm['id'], $vm_nic['instance']); } } } } } } if (!$lab_is_active || $lab_is_active && $virt_success) { $success = ace_db_network_set_state($network_id, FALSE); $return = $success; } else { $return = FALSE; } return $return; }
$valid_lab_selected = FALSE; } $nonce = rand(); $user_id = $_SESSION['user_id']; $user_info = ace_user_get_info($user_id); if ($user_info['first'] . $user_info['last'] != '') { $user_display_name = $user_info['first'] . ' ' . $user_info['last']; } else { $user_display_name = $user_info['name']; } $page_links = ace_session_get_page_links(); $html_select_vm_console_buttons = ' <form name="select_console_form" action="' . _CONSOLE_URL_ . '" method="post"> <input name="lab_id" value="' . $lab_id . '" type="hidden" /> <input name="action" value="show_vm_console" type="hidden" />'; $vm_table = ace_lab_get_vm_table($lab_id); foreach ($vm_table as $vm) { if ($vm['user_visible'] == 1) { $vm_button_class = $vm['id'] == $_POST['vm_id'] ? 'active' : ''; $html_select_vm_console_buttons .= ' <div class="row_element"> <button name="vm_id" value="' . $vm['id'] . '" class="' . $vm_button_class . '" type="submit">' . $vm['display_name'] . '</button> </div>'; } } $html_select_vm_console_buttons .= ' <input name="nonce" value=' . $nonce . ' type="hidden" /> </form>'; $vm_cdrom_table = ace_vm_get_cdrom_table($_POST['vm_id']); $html_vm_cdrom_dropdown_list = NULL; foreach ($vm_cdrom_table as $cdrom) {