'; $changes = array(); } if (count($changes)) { if (!empty($_REQUEST['id'])) { $result = dbQuery('UPDATE Servers SET '.implode(', ', $changes).' WHERE Id = ?', array($_REQUEST['id']) ); } else { $result = dbQuery('INSERT INTO Servers SET '.implode(', ', $changes)); } if ($result === null) { $error_message .= 'Error saving server: '.htmlspecialchars(dbLastError()).'
'; } else { ZM\AuditAction((!empty($_REQUEST['id']) ? 'update' : 'create'), 'server', !empty($_REQUEST['id']) ? $_REQUEST['id'] : dbInsertId(), 'Changed: '.implode(', ', array_keys($changes))); $refreshParent = true; } } if (!$error_message) { $redirect = '?view=options&tab=servers'; } else { // The modal form posts view=server, which has no view file. Render the // options page instead so that the error is shown. $view = 'options'; $_REQUEST['tab'] = 'servers'; } } else { ZM\Error("Unknown action $action in saving Server"); } ?>