From: Roland Haeder Date: Wed, 16 Apr 2014 19:27:16 +0000 (+0200) Subject: Some more improvements: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8862a2901206c02479261c49de78609ffb2ce9c2;p=mailer.git Some more improvements: - 'provider' renamed to 'registration_provider' (GET parameter) - Added developer-only code (do only use if you are developing on the registration and don't want to have registrations, e.g. because you are implementing a new registration provider. Signed-off-by: Roland Häder --- diff --git a/inc/filter/register_filter.php b/inc/filter/register_filter.php index 1eac55824e..6ae844248d 100644 --- a/inc/filter/register_filter.php +++ b/inc/filter/register_filter.php @@ -123,7 +123,7 @@ function FILTER_GENERIC_USER_REGISTRATION ($filterData) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Is generic user registration selected? - if ((isPostRequestElementSet('provider')) && (postRequestElement('provider') == 'register')) { + if ((isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'register')) { // Run it $filterData['status'] = doGenericUserRegistration(); @@ -143,7 +143,7 @@ function FILTER_GENERIC_USER_REGISTRATION_CHECK () { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Is the registration provider set? - if ((isFormSent()) && (isPostRequestElementSet('provider')) && (postRequestElement('provider') == 'register')) { + if ((isFormSent()) && (isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'register')) { // Check form $isFormSent = isRegistrationDataComplete(); @@ -161,7 +161,7 @@ function FILTER_GENERIC_USER_REGISTRATION_DONE () { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Is generic user registration selected? - if ((isPostRequestElementSet('provider')) && (postRequestElement('provider') == 'register')) { + if ((isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'register')) { // Run it displayMessage('{--REGISTRATION_DONE--}'); @@ -178,7 +178,7 @@ function FILTER_GENERIC_USER_REGISTRATION_FAILED () { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Is generic user registration selected? - if ((isPostRequestElementSet('provider')) && (postRequestElement('provider') == 'register')) { + if ((isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'register')) { // This should not be reached reportBug(__FUNCTION__, __LINE__, 'This filter should not handle it.'); } // END - if @@ -192,7 +192,7 @@ function FILTER_GENERIC_USER_REGISTRATION_FORM () { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Is generic user registration selected? - if (((isGetRequestElementSet('provider')) && (getRequestElement('provider') == 'register')) || ((!isGetRequestElementSet('provider')) && (getDefaultRegistrationProvider() == 'register'))) { + if (((isGetRequestElementSet('registration_provider')) && (getRequestElement('registration_provider') == 'register')) || ((!isGetRequestElementSet('registration_provider')) && (getDefaultRegistrationProvider() == 'register'))) { // Display generic form doDisplayGenericUserRegistrationForm(); diff --git a/inc/filter/wernis_filter.php b/inc/filter/wernis_filter.php index 0de661bac3..902473adfb 100644 --- a/inc/filter/wernis_filter.php +++ b/inc/filter/wernis_filter.php @@ -45,7 +45,7 @@ function FILTER_WERNIS_USER_REGISTRATION ($filterData) { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Is generic user registration selected? - if ((isPostRequestElementSet('provider')) && (postRequestElement('provider') == 'wernis')) { + if ((isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'wernis')) { // Run it $filterData['status'] = doWernisUserRegistration(); @@ -64,7 +64,7 @@ function FILTER_WERNIS_USER_REGISTRATION_DONE () { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Is generic user registration selected? - if ((isPostRequestElementSet('provider')) && (postRequestElement('provider') == 'wernis')) { + if ((isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'wernis')) { // Run it // Interrupt filter chain @@ -82,7 +82,7 @@ function FILTER_WERNIS_USER_REGISTRATION_FAILED () { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Is generic user registration selected? - if ((isPostRequestElementSet('provider')) && (postRequestElement('provider') == 'wernis')) { + if ((isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'wernis')) { // Run it // Interrupt filter chain @@ -100,7 +100,7 @@ function FILTER_WERNIS_USER_REGISTRATION_FORM () { //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Is WDS66 user registration selected? - if (((isGetRequestElementSet('provider')) && (getRequestElement('provider') == 'wernis')) || ((!isGetRequestElementSet('provider')) && (getDefaultRegistrationProvider() == 'wernis'))) { + if (((isGetRequestElementSet('registration_provider')) && (getRequestElement('registration_provider') == 'wernis')) || ((!isGetRequestElementSet('registration_provider')) && (getDefaultRegistrationProvider() == 'wernis'))) { // Run it doDisplayWernisUserRegistrationForm(); @@ -114,31 +114,42 @@ function FILTER_WERNIS_USER_REGISTRATION_FORM () { } // Filter to run WDS66 API user registation check -function FILTER_WERNIS_USER_REGISTRATION_CHECK ($filterData) { +function FILTER_WERNIS_USER_REGISTRATION_CHECK () { + // Default is form is not sent + $isFormSent = FALSE; //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + // Is the registration provider set? + if ((isFormSent('wernis_register')) && (isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'wernis')) { + // Check form + $isFormSent = isRegistrationDataComplete(); + + // Interrupt filter chain + interruptFilterChain(); + } // END - if + // Return it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $filterData; + return $isFormSent; } // Filter for WDS66 API user login // @TODO 0% done function FILTER_WERNIS_USER_LOGIN ($filterData) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Return filter data - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); return $filterData; } // Filter for WDS66 API user login check // @TODO 0% done function FILTER_WERNIS_USER_LOGIN_CHECK ($filterData) { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); // Return filter data - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); return $filterData; } diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index 0880221a1a..c6f458a565 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -328,6 +328,14 @@ function doGenericUserRegistration () { return FALSE; } // END - if + // These elements must be set + assert(isset($GLOBALS['register_country_row'])); + assert(isset($GLOBALS['register_country_data'])); + assert(isset($GLOBALS['register_confirm_hash'])); + + // Only comment this in if you develop + //* DEVELOPER-CODE: */ return TRUE; + // Create user's account... sqlQueryEscaped("INSERT INTO `{?_MYSQL_PREFIX?}_user_data` diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index b17121d365..7a3adca9ba 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -529,13 +529,13 @@ 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']))) { @@ -565,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); @@ -799,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) . '
'); } //----------------------------------------------------------------------------- diff --git a/inc/modules/guest/what-register.php b/inc/modules/guest/what-register.php index 6d158ca226..c174554151 100644 --- a/inc/modules/guest/what-register.php +++ b/inc/modules/guest/what-register.php @@ -64,7 +64,7 @@ if (runFilterChain('check_user_registration') === TRUE) { } } else { // Is a registration provider selected? - if (!isGetRequestElementSet('provider')) { + if (!isGetRequestElementSet('registration_provider')) { // Display selector form loadTemplate('guest_registration_select'); } // END - if diff --git a/templates/de/html/guest/guest_registration_provider_row.tpl b/templates/de/html/guest/guest_registration_provider_row.tpl index 53ae0cc1db..560c0dffae 100644 --- a/templates/de/html/guest/guest_registration_provider_row.tpl +++ b/templates/de/html/guest/guest_registration_provider_row.tpl @@ -1 +1 @@ -
  • {%pipe,translateRegistrationProviderName=$content[provider_name]%}
  • +
  • {%pipe,translateRegistrationProviderName=$content[provider_name]%}
  • diff --git a/templates/de/html/guest/guest_wernis_registration_form.tpl b/templates/de/html/guest/guest_wernis_registration_form.tpl index 8fed6a763b..2494f4e1ec 100644 --- a/templates/de/html/guest/guest_wernis_registration_form.tpl +++ b/templates/de/html/guest/guest_wernis_registration_form.tpl @@ -1,6 +1,6 @@
    -{%form,formMethodPost,formNameWernis_register=modules.php?module=index&what=register&provider=wernis&status=1&challenge=$content[challenge]&__challenge_response=$content[__challenge_response]%} - +{%form,formMethodPost,formNameWernis_register=modules.php?module=index&what=register&registration_provider=wernis&status=1&challenge=$content[challenge]&__challenge_response=$content[__challenge_response]%} +
    diff --git a/templates/de/html/guest/guest_wernis_registration_rpc_form.tpl b/templates/de/html/guest/guest_wernis_registration_rpc_form.tpl index 74d606aee2..04ed0877c1 100644 --- a/templates/de/html/guest/guest_wernis_registration_rpc_form.tpl +++ b/templates/de/html/guest/guest_wernis_registration_rpc_form.tpl @@ -1,6 +1,6 @@
    - {%form,formMethodPost=modules.php?module=index&what=register&provider=wernis%} + {%form,formMethodPost=modules.php?module=index&what=register&registration_provider=wernis%}
    {--GUEST_WERNIS_REGISTRATION_TITLE--}