From 25d546f45bdf68f8d843f7357d53eec4a7eacaa9 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 17 Apr 2014 23:36:08 +0200 Subject: [PATCH] Added new pre-registration filter for WDS66-based registration (unfinished). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- inc/extensions/ext-wernis.php | 5 +++-- inc/extensions/wernis/mode-update.php | 13 ++++++++----- inc/filter/wernis_filter.php | 15 +++++++++++++++ inc/libs/wernis_functions.php | 25 ++++++++++++++++++++----- 4 files changed, 46 insertions(+), 12 deletions(-) diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index 0fbf56ee83..3065afcc0a 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -41,10 +41,10 @@ if (!defined('__SECURITY')) { } // END - if // Version of this extension -setThisExtensionVersion('0.0.8'); +setThisExtensionVersion('0.0.9'); // Version history array (add more with , '0.0.1' and so on) -setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8')); +setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9')); switch (getExtensionMode()) { case 'setup': // Do stuff when installation is running @@ -103,6 +103,7 @@ INDEX (`userid`)", unregisterFilter(__FILE__, __LINE__, 'user_registration_failed', 'WERNIS_USER_REGISTRATION_FAILED', TRUE, isExtensionDryRun()); unregisterFilter(__FILE__, __LINE__, 'user_registration_form', 'WERNIS_USER_REGISTRATION_FORM', TRUE, isExtensionDryRun()); unregisterFilter(__FILE__, __LINE__, 'user_login', 'WERNIS_USER_LOGIN', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'PRE_USER_REGISTRATION_WERNIS', TRUE, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/wernis/mode-update.php b/inc/extensions/wernis/mode-update.php index 4f431d409d..70cde3703c 100644 --- a/inc/extensions/wernis/mode-update.php +++ b/inc/extensions/wernis/mode-update.php @@ -10,11 +10,6 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Auszahlung-Erweiterung * * -------------------------------------------------------------------- * - * $Revision:: $ * - * $Date:: $ * - * $Tag:: 0.2.1-FINAL $ * - * $Author:: $ * - * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * * Copyright (c) 2009 - 2013 by Mailer Developer Team * * For more information visit: http://mxchange.org * @@ -134,6 +129,14 @@ INDEX (`wernis_userid`)", // Update notes (these will be set as task text!) setExtensionUpdateNotes("Basis-URL für alle Scripte (Referral-Link, auth.php-Umleitung usw. nicht aber API) und Tabelle für API-Aufrufe von auth.php hinzugefügt."); break; + + case '0.0.9': // SQL queries for v0.0.9 + // Register a filter + registerFilter(__FILE__, __LINE__, 'pre_user_registration', 'PRE_USER_REGISTRATION_WERNIS', FALSE, TRUE, isExtensionDryRun()); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Basis-URL für alle Scripte (Referral-Link, auth.php-Umleitung usw. nicht aber API) und Tabelle für API-Aufrufe von auth.php hinzugefügt."); + break; } // END - switch // [EOF] diff --git a/inc/filter/wernis_filter.php b/inc/filter/wernis_filter.php index 902473adfb..2bedc8c7b0 100644 --- a/inc/filter/wernis_filter.php +++ b/inc/filter/wernis_filter.php @@ -153,5 +153,20 @@ function FILTER_WERNIS_USER_LOGIN_CHECK ($filterData) { return $filterData; } +/** + * Run a filter for pre user registration + * + * @param $filterData Filter data from previous filter + * @return $filterData Unchanged filter data + */ +function FILTER_PRE_USER_REGISTRATION_WERNIS ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Return it + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + /* NOISY-DEBUG: */ print __FUNCTION__.':filterData=
'.print_r($filterData,TRUE).'
'; + return $filterData; +} + // [EOF] ?> diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index 7a3adca9ba..922cb56ff8 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -529,11 +529,8 @@ function doDisplayWernisUserRegistrationForm () { // Finish user registration with WDS66 API function doWernisFinishUserRegistration ($challenge, $challengeResponse, $status) { - // Check status from GET parameters and if the form has been sent - if (($status == '1') && (isFormSent('wernis_register'))) { - // The form has been sent and challenge is fine - die(__FUNCTION__ . ':' . __LINE__ . '
'.print_r(postRequestArray(), TRUE).'
'); - } elseif ($status == '1') { + // Is the status 1? (= all fine with API call) + if ($status == '1') { // Get mapped data based on challenge $return = getWernisMappedDataFromApiByChallenge($challenge, $status); @@ -729,6 +726,24 @@ LIMIT %d", return $rows; } +// Do local user registration with data from WDS66 API +function doWernisUserRegistration () { + // Call generic registration function + $status = doGenericUserRegistration(); + + // Does this went fine? + if ($status === FALSE) { + // No, then abort here silently + return FALSE; + } // END - if + + // Make sure the user id is valid + assert(isset($GLOBALS['register_userid'])); + assert(isValidId($GLOBALS['register_userid'])); + + // Generic registration is finished, so add more data: +} + //----------------------------------------------------------------------------- // Auth status callback functions //----------------------------------------------------------------------------- -- 2.39.2