X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fwernis_functions.php;h=7a3adca9ba04417b5094f557595e695e0f17e7be;hb=4277ede0c1a5f15c319ee0bf187f0fdda43d3475;hp=90e88a01e7ffe298f3c3067112999490019b6e3a;hpb=5bddb923258560efde6501e698873112871bf8ae;p=mailer.git diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index 90e88a01e7..7a3adca9ba 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -529,21 +529,32 @@ function doDisplayWernisUserRegistrationForm () { // Finish user registration with WDS66 API function doWernisFinishUserRegistration ($challenge, $challengeResponse, $status) { - // Check status from GET parameters and stored value + // Check status from GET parameters and if the form has been sent if (($status == '1') && (isFormSent('wernis_register'))) { - // Form has been sent - die(__FUNCTION__ . ':' . __LINE__ . ': Reached!'); + // The form has been sent and challenge is fine + die(__FUNCTION__ . ':' . __LINE__ . '
'.print_r(postRequestArray(), TRUE).'
'); } elseif ($status == '1') { // Get mapped data based on challenge - $return = getWernisMapedDataFromApiByChallenge($challenge, $status); + $return = getWernisMappedDataFromApiByChallenge($challenge, $status); // Is the array filled? if ((count($return['mapped_data']) > 0) && (empty($return['message']))) { + // Set must-fillout fields + $return['mapped_data'] = runFilterChain('register_must_fillout', $return['mapped_data']); + + // Add missing elements + $return['mapped_data']['gender'] = NULL; + $return['mapped_data']['birthday_selection'] = generateDayMonthYearSelectionBox($return['mapped_data']['birth_day'], $return['mapped_data']['birth_month'], $return['mapped_data']['birth_year']); + $return['mapped_data']['challenge'] = getRequestElement('challenge'); + $return['mapped_data']['__challenge_response'] = getRequestElement('__challenge_response'); + // Display form loadTemplate('guest_wernis_registration_form', FALSE, $return['mapped_data']); + + // All fine return TRUE; } else { - // Something bad happened + // Something unexpected happened (e.g. no API requests left) displayMessage($return['message']); return FALSE; } @@ -554,7 +565,7 @@ function doWernisFinishUserRegistration ($challenge, $challengeResponse, $status } // "Getter" for mapped data by calling the API and given challenge and status -function getWernisMapedDataFromApiByChallenge ($challenge, $status) { +function getWernisMappedDataFromApiByChallenge ($challenge, $status) { // Get stored registration data $rows = getWernisRegistrationDataByKey('api_redirect_challenge', $challenge); @@ -587,7 +598,7 @@ function getWernisMapedDataFromApiByChallenge ($challenge, $status) { } // END - if // Now call "get.php" - $response = executeWernisApiGet($rows[0], 'data', 'anrede|vorname|name|strasse|plz|ort|birth_day|birth_month|birth_year|email|werber'); + $response = executeWernisApiGet($rows[0], 'data', 'vorname|name|strasse|plz|ort|birth_day|birth_month|birth_year|email|werber'); // Was the status okay? if (isHttpResponseStatusOkay($response)) { @@ -602,10 +613,10 @@ function getWernisMapedDataFromApiByChallenge ($challenge, $status) { /* * Do some checks on the decoded string, it should be a - * serialized array with 11 entries (see above + * serialized array with 10 entries (see above * executeWernisApiGet() call). */ - assert(substr($decodedData, 0, 6) == 'a:11:{'); + assert(substr($decodedData, 0, 6) == 'a:10:{'); assert(substr($decodedData, -1, 1) == '}'); // The array seems to be fine, unserialize it @@ -613,7 +624,6 @@ function getWernisMapedDataFromApiByChallenge ($challenge, $status) { // All mappings WDS66->mailer $mappings = array( - 'anrede' => 'gender', 'vorname' => 'surname', 'name' => 'family', 'strasse' => 'street_nr', @@ -789,7 +799,7 @@ function doWernisAuthAccepted ($args) { // auth_key and wernis_userid must be set assert(isset($args['auth_key'])); assert(isset($args['wernis_userid'])); - die(__FUNCTION__ . '
'.print_r($args, TRUE).'
'); + die(__FUNCTION__ . ':' . __LINE__ . '
' . print_r($args, TRUE) . '
'); } //-----------------------------------------------------------------------------