0, 'error' => 'Kein Server ausgewählt' ] ) ); } if ( empty( $idLong ) ){ die( json_encode( [ 'status' => 0, 'error' => 'Keine Identität ausgewählt' ] ) ); } if ( empty( $_REQUEST['eventId'] ) || empty( $_REQUEST['votingId'] ) ){ die( json_encode( [ 'status' => 0, 'error' => 'Daten unvollständig' ] ) ); } $actions = [ 'start' => 'voting-start-declaration', 'stop' => 'voting-end-declaration', 'count' => 'vote-count-request', ]; if ( ! in_array( $_REQUEST['action'], array_keys( $actions ) ) ){ die( json_encode( [ 'status' => 0, 'error' => 'Ungültige Aktion' ] ) ); } $msg = new ParTCP_Outgoing_Message( $serverLong, $idLong, $actions[ $_REQUEST['action'] ] ); $msg->set( 'Event-Id', $_REQUEST['eventId'] ); $msg->set( 'Voting-Id', $_REQUEST['votingId'] ); if ( $_REQUEST['action'] != 'count' ){ $msg->set( 'Polling-Interval', 60 ); } $response = pas_check_response( $msg->send() ); if ( is_string( $response ) ){ die( json_encode( [ 'status' => 0, 'error' => $response ] ) ); } echo json_encode( [ 'status' => 1, 'error' => '' ] ); // end of file ajax/control_voting.php