0, 'error' => 'Kein Server ausgewählt' ] ) ); } if ( empty( $idLong ) ){ die( json_encode( [ 'status' => 0, 'error' => 'Keine Identität ausgewählt' ] ) ); } if ( empty( $_REQUEST['name'] ) || empty( $_REQUEST['date'] ) || empty( $_REQUEST['estimated_turnout'] ) ){ die( json_encode( [ 'status' => 0, 'error' => 'Daten unvollständig' . "\n" . var_export( $_REQUEST, TRUE ) ] ) ); } $msg = new ParTCP_Outgoing_Message( $serverLong, $idLong, 'event-definition' ); if ( ! empty( $_REQUEST['groupId'] ) ){ $msg->set( 'Group-Id', $_REQUEST['groupId'] ); } $msg->set( 'Event-Data', [ 'name' => $_REQUEST['name'], 'date' => $_REQUEST['date'], 'estimated_turnout' => (int) $_REQUEST['estimated_turnout'], 'description' => $_REQUEST['description'] ?? '', 'short_description' => $_REQUEST['shortDescription'] ?? '', 'link_url' => $_REQUEST['linkUrl'], ]); $response = pas_check_response( $msg->send() ); if ( is_string( $response ) ){ die( json_encode( [ 'status' => 0, 'error' => $response ] ) ); } $data = $response->get('Event-Data'); echo json_encode( [ 'status' => 1, 'error' => '', 'redirect' => "{$BaseUrl}/event/{$data['id']}" ] ); // end of file ajax/create_event.php