From: Roland Häder Date: Wed, 31 Jul 2013 01:34:28 +0000 (+0000) Subject: Continued with registration provider: X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=dabf3d37a62230bc705be02682c656f4cb4a344f Continued with registration provider: - Added a lot filter for both ext-register/wernis to handle (partly finished) registration requests and forms - Add config entry (currently not changeable in web interface) for default registration and login provider --- diff --git a/.gitattributes b/.gitattributes index af7a7ce1b4..80a004b10a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -295,6 +295,8 @@ inc/extensions/user/.htaccess svneol=native#text/plain inc/extensions/user/mode-remove.php svneol=native#text/plain inc/extensions/user/mode-setup.php svneol=native#text/plain inc/extensions/user/mode-update.php svneol=native#text/plain +inc/extensions/wernis/.htaccess svneol=native#text/plain +inc/extensions/wernis/mode-update.php svneol=native#text/plain inc/filter-functions.php svneol=native#text/plain inc/filter/.htaccess svneol=native#text/plain inc/filter/_filter.php svneol=native#text/plain @@ -327,6 +329,7 @@ inc/filter/timezone_filter.php svneol=native#text/plain inc/filter/transaction_filter.php svneol=native#text/plain inc/filter/uberwach_filter.php svneol=native#text/plain inc/filter/user_filter.php svneol=native#text/plain +inc/filter/wernis_filter.php svneol=native#text/plain inc/filters.php svneol=native#text/plain inc/fix_filters.php svneol=native#text/plain inc/fix_menu.php svneol=native#text/plain diff --git a/inc/extensions/ext-register.php b/inc/extensions/ext-register.php index 21fad5d869..9047131111 100644 --- a/inc/extensions/ext-register.php +++ b/inc/extensions/ext-register.php @@ -41,10 +41,10 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.5.9'); +setThisExtensionVersion('0.6.0'); // Version history array (add more with , '0.0.1' and so on) -setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9')); +setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0')); switch (getExtensionMode()) { case 'setup': // Do stuff when installation is running @@ -65,6 +65,11 @@ switch (getExtensionMode()) { // Unregister filter unregisterFilter(__FILE__, __LINE__, 'register_must_fillout', 'REGISTER_MUST_FILLOUT', TRUE, isExtensionDryRun()); unregisterFilter(__FILE__, __LINE__, 'pre_user_registration', 'PRE_USER_REGISTRATION_GENERIC', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'user_registration', 'GENERIC_USER_REGISTRATION', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'user_registration_done', 'GENERIC_USER_REGISTRATION_DONE', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'user_registration_failed', 'GENERIC_USER_REGISTRATION_FAILED', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'user_registration_form', 'GENERIC_USER_REGISTRATION_FORM', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'check_user_registration', 'GENERIC_USER_REGISTRATION_CHECK', TRUE, isExtensionDryRun()); break; case 'activate': // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index 4dcc4c25ae..960827873c 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -41,10 +41,10 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.6.1'); +setThisExtensionVersion('0.6.2'); // Version history array (add more with , '0.0.1' and so on) -setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1')); +setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2')); // Keep this extension always active! setExtensionAlwaysActive('Y'); diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index 79256cda88..3c5e659fcb 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.6'); +setThisExtensionVersion('0.0.7'); // 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')); +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')); switch (getExtensionMode()) { case 'setup': // Do stuff when installation is running @@ -94,6 +94,13 @@ INDEX (`userid`)", // Unregister points data unregisterExtensionPointsData('wernis_withdraw'); + + // Unregister all filters + unregisterFilter(__FILE__, __LINE__, 'user_registration', 'WERNIS_USER_REGISTRATION', TRUE, isExtensionDryRun()); + unregisterFilter(__FILE__, __LINE__, 'user_registration_done', 'WERNIS_USER_REGISTRATION_DONE', TRUE, isExtensionDryRun()); + 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()); break; case 'activate': // Do stuff when admin activates this extension @@ -109,62 +116,6 @@ INDEX (`userid`)", break; case 'update': // Update an extension - switch (getCurrentExtensionVersion()) { - case '0.0.1': // SQL queries for v0.0.1 - addConfigAddSql('wernis_payout_active', "ENUM ('Y','N') NOT NULL DEFAULT 'Y'"); - addConfigAddSql('wernis_withdraw_active', "ENUM ('Y','N') NOT NULL DEFAULT 'Y'"); - addConfigAddSql('wernis_payout_factor', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000'); - addConfigAddSql('wernis_withdraw_factor', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000'); - addConfigAddSql('wernis_payout_fee_percent', 'FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000'); - addConfigAddSql('wernis_withdraw_fee_percent', 'FLOAT(8,5) UNSIGNED NOT NULL DEFAULT 0.00000'); - addConfigAddSql('wernis_payout_fee_fix', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); - addConfigAddSql('wernis_withdraw_fee_fix', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0'); - - // Update notes (these will be set as task text!) - setExtensionUpdateNotes("Ein-/Auszahlungsfunktion getrennt ein- und ausschaltbar, sowie mit Umrechungsfaktoren {?POINTS?}->Wernis versehen. Prozentualer Abzug als "Betreibergebühr hinzugefügt, was z.B. für Wechselstuben interessant ist."); - break; - - case '0.0.2': // SQL queries for v0.0.2 - addConfigAddSql('wernis_pass_md5', "VARCHAR(32) NOT NULL DEFAULT ''"); - - // Update notes (these will be set as task text!) - setExtensionUpdateNotes("Auszahlungsfunktion an die neue API 0.2-BETA angepasst. Demnach muss Ihr Wernis-Passwort beim Auszahlen benutzt werden und in Ihrem {?mt_word?} als MD5-Hash gespeichert werden."); - break; - - case '0.0.3': // SQL queries for v0.0.3 - addConfigAddSql('wernis_refid', 'INT(5) UNSIGNED ZEROFILL NOT NULL DEFAULT 00000'); - - // Update notes (these will be set as task text!) - setExtensionUpdateNotes("WDS66-Username muss nun eintragen werden (API-Anpassung)."); - break; - - case '0.0.4': // SQL queries for v0.0.4 - // Register points data - registerExtensionPointsData('wernis_withdraw', 'order_points', 'LOCKED', 'DIRECT'); - - // Update notes - setExtensionUpdateNotes("Überweisungen vom Portal werden nun über die Tabelle {OPEN_CONFIG}_MYSQL_PREFIX{CLOSE_CONFIG}_points_data verwaltet."); - break; - - case '0.0.5': // SQL queries for v0.0.5 - addExtensionChangeTableColumnSql('user_wernis', 'wernis_type', 'wernis_type', "ENUM('WITHDRAW','PAYOUT','FAILED') NOT NULL DEFAULT 'FAILED'"); - - // Update notes - setExtensionUpdateNotes("IN/OUT ersetzt mit WITHDRAW/PAYOUT."); - break; - - case '0.0.6': // SQL queries for v0.0.6 - addExtensionChangeTableColumnSql('config', 'wernis_pass_md5', 'wernis_pass_md5', " VARCHAR(255) NOT NULL DEFAULT ''"); - - // Update notes - setExtensionUpdateNotes("Es wird seit API-Version 0.6-BETA SHA256 (hexadezimal kodiert) verwendet."); - break; - - case '0.0.7': // SQL queries for v0.0.7 - // Update notes - setExtensionUpdateNotes(""); - break; - } // END - switch break; case 'modify': // When the extension got modified diff --git a/inc/extensions/register/mode-update.php b/inc/extensions/register/mode-update.php index 99576ee687..d5dc82b620 100644 --- a/inc/extensions/register/mode-update.php +++ b/inc/extensions/register/mode-update.php @@ -337,7 +337,7 @@ PRIMARY KEY (`id`)", addCreateTableSql('user_register_provider', " `provider_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `provider_name` VARCHAR(255) NOT NULL DEFAULT 'local_generic_user_register', -`provider_extension` VARCHAR(255) NOT NULL DEFAULT 'user', +`provider_extension` VARCHAR(255) NOT NULL DEFAULT 'register', `provider_is_active` ENUM('Y','N') NOT NULL DEFAULT 'N', PRIMARY KEY (`provider_id`)", 'User register providers'); @@ -351,6 +351,28 @@ PRIMARY KEY (`provider_id`)", // Update notes (these will be set as task text!) setExtensionUpdateNotes("Tabelle für Mitgliedsanmelde-Provider hinzugefügt."); break; + + case '0.6.0': // SQL queries for v0.6.0 + // Register a filter + registerFilter(__FILE__, __LINE__, 'user_registration', 'GENERIC_USER_REGISTRATION', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'user_registration_done', 'GENERIC_USER_REGISTRATION_DONE', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'user_registration_failed', 'GENERIC_USER_REGISTRATION_FAILED', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'user_registration_form', 'GENERIC_USER_REGISTRATION_FORM', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'check_user_registration', 'GENERIC_USER_REGISTRATION_CHECK', FALSE, TRUE, isExtensionDryRun()); + + // Update default entry + addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_user_register_provider` SET `provider_extension`='register' WHERE `provider_extension`='user'"); + + // Add config entry + // @TODO Make configurable through web interface + addConfigAddSql('default_registration_provider', "VARCHAR(255) NOT NULL DEFAULT 'register'"); + + // Add column for registration provider + addExtensionAddTableColumnSql('user_data', 'registration_provider', "VARCHAR(255) NOT NULL DEFAULT 'register'"); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Filter für das Handling der Anmeldeanfragen hinzugeügt."); + break; } // END - switch // [EOF] diff --git a/inc/extensions/user/mode-remove.php b/inc/extensions/user/mode-remove.php index 2760f86cac..58f5830cce 100644 --- a/inc/extensions/user/mode-remove.php +++ b/inc/extensions/user/mode-remove.php @@ -72,6 +72,8 @@ unregisterFilter(__FILE__, __LINE__, 'update_referral_data', 'GENERIC_UPDATE_USE unregisterFilter(__FILE__, __LINE__, 'update_referral_data', 'UPDATE_USER_SUBID', TRUE, isExtensionDryRun()); unregisterFilter(__FILE__, __LINE__, 'member_admin_actions', 'ADD_USER_SUBID_MEMBER_ACTION', TRUE, isExtensionDryRun()); unregisterFilter(__FILE__, __LINE__, 'member_reflink_extra_content', 'MEMBER_REFLINK_USER_SUBIDS_CONTENT', TRUE, isExtensionDryRun()); +unregisterFilter(__FILE__, __LINE__, 'user_login', 'GENERIC_USER_LOGIN', TRUE, isExtensionDryRun()); +unregisterFilter(__FILE__, __LINE__, 'check_user_login', 'GENERIC_USER_LOGIN_CHECK', TRUE, isExtensionDryRun()); // [EOF] ?> diff --git a/inc/extensions/user/mode-update.php b/inc/extensions/user/mode-update.php index 7ff71f3a9a..3a914dc42b 100644 --- a/inc/extensions/user/mode-update.php +++ b/inc/extensions/user/mode-update.php @@ -546,6 +546,22 @@ PRIMARY KEY (`provider_id`)", // Update notes (these will be set as task text!) setExtensionUpdateNotes("Tabelle für Mitgliedslogin-Provider hinzugefügt."); break; + + case '0.6.2': // SQL queries for v0.6.2 + // Register a filter + registerFilter(__FILE__, __LINE__, 'user_login', 'GENERIC_USER_LOGIN', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'check_user_login', 'GENERIC_USER_LOGIN_CHECK', FALSE, TRUE, isExtensionDryRun()); + + // Add column for login provider + addExtensionAddTableColumnSql('user_data', 'login_provider', "VARCHAR (255) NOT NULL DEFAULT 'user'"); + + // Add config entry + // @TODO Make configurable through web interface + addConfigAddSql('default_login_provider', "VARCHAR(255) NOT NULL DEFAULT 'login'"); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Filter für das Handling der Loginanfragen hinzugeügt."); + break; } // END - switch // [EOF] diff --git a/inc/extensions/wernis/.htaccess b/inc/extensions/wernis/.htaccess new file mode 100644 index 0000000000..3a42882788 --- /dev/null +++ b/inc/extensions/wernis/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/extensions/wernis/mode-update.php b/inc/extensions/wernis/mode-update.php new file mode 100644 index 0000000000..6be7b14ec7 --- /dev/null +++ b/inc/extensions/wernis/mode-update.php @@ -0,0 +1,119 @@ +{OPEN_CONFIG}_MYSQL_PREFIX{CLOSE_CONFIG}_points_data verwaltet."); + break; + + case '0.0.5': // SQL queries for v0.0.5 + addExtensionChangeTableColumnSql('user_wernis', 'wernis_type', 'wernis_type', "ENUM('WITHDRAW','PAYOUT','FAILED') NOT NULL DEFAULT 'FAILED'"); + + // Update notes + setExtensionUpdateNotes("IN/OUT ersetzt mit WITHDRAW/PAYOUT."); + break; + + case '0.0.6': // SQL queries for v0.0.6 + addExtensionChangeTableColumnSql('config', 'wernis_pass_md5', 'wernis_pass_md5', " VARCHAR(255) NOT NULL DEFAULT ''"); + + // Update notes + setExtensionUpdateNotes("Es wird seit API-Version 0.6-BETA SHA256 (hexadezimal kodiert) verwendet."); + break; + + case '0.0.7': // SQL queries for v0.0.7 + // This update depends on ext-register and ext-user + addExtensionDependency('register'); + addExtensionDependency('user'); + + // Add data to both tables + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_user_register_provider` (`provider_name`, `provider_extension`) VALUES ('wernis_user_registration', 'wernis')"); + addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_user_login_provider` (`provider_name`, `provider_extension`) VALUES ('wernis_user_login', 'wernis')"); + + // Register all filters + registerFilter(__FILE__, __LINE__, 'user_registration', 'WERNIS_USER_REGISTRATION', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'user_registration_done', 'WERNIS_USER_REGISTRATION_DONE', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'user_registration_failed', 'WERNIS_USER_REGISTRATION_FAILED', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'user_registration_form', 'WERNIS_USER_REGISTRATION_FORM', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'user_login', 'WERNIS_USER_LOGIN', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'check_user_registration', 'WERNIS_USER_REGISTRATION_CHECK', FALSE, TRUE, isExtensionDryRun()); + registerFilter(__FILE__, __LINE__, 'check_user_login', 'WERNIS_USER_LOGIN_CHECK', FALSE, TRUE, isExtensionDryRun()); + + // Update notes + setExtensionUpdateNotes("Anmeldung ürber WDS66 API angefangen: Filter registriert."); + break; +} // END - switch + +// [EOF] +?> diff --git a/inc/filter/register_filter.php b/inc/filter/register_filter.php index 156362c264..a96e34080b 100644 --- a/inc/filter/register_filter.php +++ b/inc/filter/register_filter.php @@ -118,5 +118,79 @@ function FILTER_PRE_USER_REGISTRATION_GENERIC ($filterData) { return $filterData; } +// Filter to run generic user registation (default) +function FILTER_GENERIC_USER_REGISTRATION ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Is generic user registration selected? + if ((isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'register')) { + // Run it + $filterData['status'] = doGenericUserRegistration(); + } // END - if + + // Return it + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $filterData; +} + +// Filter to run generic user registation check (default) +function FILTER_GENERIC_USER_REGISTRATION_CHECK () { + // Default is form is not sent + $isFormSent = FALSE; + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Is the registration provider set? + if ((isFormSent()) && (isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'register')) { + // Check form + $isFormSent = isRegistrationDataComplete(); + } // END - if + + // Return it + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $isFormSent; +} + +// Filter to run generic things on registration done +function FILTER_GENERIC_USER_REGISTRATION_DONE () { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Is generic user registration selected? + if ((isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'register')) { + // Run it + displayMessage('{--REGISTRATION_DONE--}'); + } // END - if + + // Return NULL + return NULL; +} + +// Filter to run generic things on registration failed +function FILTER_GENERIC_USER_REGISTRATION_FAILED () { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Is generic user registration selected? + if ((isPostRequestElementSet('registration_provider')) && (postRequestElement('registration_provider') == 'register')) { + // This should not be reached + reportBug(__FUNCTION__, __LINE__, 'This filter should not handle it.'); + } // END - if + + // Return NULL + return NULL; +} + +// Filter to run generic things on registration form +function FILTER_GENERIC_USER_REGISTRATION_FORM () { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Is generic user registration selected? + if (((isGetRequestElementSet('registration_provider')) && (getRequestElement('registration_provider') == 'register')) || (getDefaultRegistrationProvider() == 'register')) { + // Display generic form + doDisplayGenericUserRegistrationForm(); + } // END - if + + // Return NULL + return NULL; +} + // [EOF] ?> diff --git a/inc/filter/user_filter.php b/inc/filter/user_filter.php index fde26ce488..067a154ae3 100644 --- a/inc/filter/user_filter.php +++ b/inc/filter/user_filter.php @@ -175,6 +175,8 @@ function FILTER_SUBID_USER_REGISTRATION_ADD_SQL_COLUMNS ($filterData) { // Generic filter for updating referral counter of currently detected referral id function FILTER_GENERIC_UPDATE_USER_REFERRAL ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + // Make sure the referral id is detected assert(isValidReferralId()); @@ -182,6 +184,7 @@ function FILTER_GENERIC_UPDATE_USER_REFERRAL ($filterData) { sqlQuery('UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `ref_clicks`=`ref_clicks`+1 WHERE `userid`={%pipe,getReferralId%} LIMIT 1', __FUNCTION__, __LINE__); // Return filter data + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); return $filterData; } @@ -272,5 +275,25 @@ function FILTER_MEMBER_REFLINK_USER_SUBIDS_CONTENT ($content = '') { return $content; } +// Filter for generic user login +// @TODO 0% done +function FILTER_GENERIC_USER_LOGIN ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Return filter data + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $filterData; +} + +// Filter for generic user login check +// @TODO 0% done +function FILTER_GENERIC_USER_LOGIN_CHECK ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Return filter data + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + return $filterData; +} + // [EOF] ?> diff --git a/inc/filter/wernis_filter.php b/inc/filter/wernis_filter.php new file mode 100644 index 0000000000..e36364535b --- /dev/null +++ b/inc/filter/wernis_filter.php @@ -0,0 +1,133 @@ + diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index deabc18733..a13a124877 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -1097,7 +1097,7 @@ function isNetworkTypeHandlerConfigured ($networkId, $networkTypeId) { 'network_handler_config', 'network_data_id', 'network_type_id', - true, + TRUE, sprintf(' AND `network_id`=%s', bigintval($networkId)) ) == 1); } // END - if @@ -2406,8 +2406,8 @@ function doAdminNetworkProcessAddNetworkArrayTranslation () { 'network_array_translation', 'network_array_id', 'network_id', - true, - sprintf(" AND `network_type_id`=%s", bigintval(postRequestElement('network_type_id'))) + TRUE, + sprintf(' AND `network_type_id`=%s', bigintval(postRequestElement('network_type_id'))) ) + 1)); // Add the whole request to database diff --git a/inc/libs/register_functions.php b/inc/libs/register_functions.php index 9fdf938c69..b330fea6c1 100644 --- a/inc/libs/register_functions.php +++ b/inc/libs/register_functions.php @@ -289,6 +289,21 @@ function doUserRegistration () { reportBug(__FUNCTION__, __LINE__, 'Tried to register a user account without ext-user installed.'); } // END - if + // Init filter data array + $filterData = array( + // Registration status is always FALSE by default + 'status' => FALSE, + ); + + // Run filter chain for user registration + $filterData = runFilterChain('user_registration', $filterData); + + // Return status + return $filterData['status']; +} + +// Generic user registration +function doGenericUserRegistration () { // Init extra SQL data initExtraRegistrationSql(); @@ -612,6 +627,18 @@ function isRegisterGeneratePasswordEmptyEnabled () { return $GLOBALS[__FUNCTION__]; } +// Getter for 'default_registration_provider' +function getDefaultRegistrationProvider () { + // Is the cache entry set? + if (!isset($GLOBALS[__FUNCTION__])) { + // No, so determine it + $GLOBALS[__FUNCTION__] = getConfig('default_registration_provider'); + } // END - if + + // Return cached entry + return $GLOBALS[__FUNCTION__]; +} + // "Getter" for least_cats function getLeastCats () { // Is there cache? diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 34c2c5d8e8..fbf7c455dd 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -875,8 +875,8 @@ function isUserSubIdAssignedToMember ($subId, $userid = NULL) { 'user_subids', 'id', 'userid', - true, - sprintf(" AND `id`=%s", bigintval($subId)) + TRUE, + sprintf(' AND `id`=%s', bigintval($subId)) ) == 1 ) ); @@ -923,6 +923,91 @@ function getTotalMemberSubIds () { return $GLOBALS[__FUNCTION__]; } +// Displays generic user registration form +function doDisplayGenericUserRegistrationForm () { + // Do this only if form is sent + if (isFormSent()) { + if (postRequestElement('agree') == '!') { + registerOutputFailedMessage('HAVE_TO_AGREE'); + } // END - if + + if (postRequestElement('email') == '!') { + registerOutputFailedMessage('ENTER_EMAIL'); + setPostRequestElement('email', ''); + } elseif (postRequestElement('email') == '?') { + registerOutputFailedMessage('GUEST_EMAIL_IS_ALREADY_REGISTERED'); + setPostRequestElement('email', ''); + } + + if (postRequestElement('surname') == '!') { + registerOutputFailedMessage('ENTER_SURNAME'); + setPostRequestElement('surname', ''); + } // END - if + + if (postRequestElement('family') == '!') { + registerOutputFailedMessage('ENTER_FAMILY'); + setPostRequestElement('family', ''); + } // END - if + + if ((postRequestElement('password1') == '!') && (postRequestElement('password2') == '!')) { + registerOutputFailedMessage('ENTER_BOTH_PASSWORDS'); + } elseif (postRequestElement('password1') == '!') { + registerOutputFailedMessage('ENTER_PASSWORD1'); + } elseif (postRequestElement('password2') == '!') { + registerOutputFailedMessage('ENTER_PASSWORD2'); + } + + if ((isset($GLOBALS['registration_weak_password'])) && ($GLOBALS['registration_weak_password'] === TRUE)) { + registerOutputFailedMessage('GUEST_WEAK_PASSWORD'); + } // END - if + + if ((isset($GLOBALS['registration_ip_timeout'])) && ($GLOBALS['registration_ip_timeout'] === TRUE)) { + registerOutputFailedMessage('REMOTE_ADDR_TIMEOUT'); + } // END - if + + if ((!empty($GLOBALS['registration_selected_cats'])) && ($GLOBALS['registration_selected_cats'] < getLeastCats())) { + registerOutputFailedMessage('', '{--CHOOSE_MORE_CATEGORIES--}'); + } // END - if + } // END - if + + // Generate birthday selection + switch (getLanguage()) { + case 'de': // German date format + $content['birthday_selection'] = addSelectionBox('da', postRequestElement('day')).addSelectionBox('mo', postRequestElement('month')).addSelectionBox('ye', postRequestElement('year')); + break; + + default: // Default is the US date format... :) + $content['birthday_selection'] = addSelectionBox('mo', postRequestElement('month')).addSelectionBox('da', postRequestElement('day')).addSelectionBox('ye', postRequestElement('year')); + break; + } // END - switch + + // Shall I display the refid or shall I make it editable? + if (isDisplayRefidEnabled()) { + // Load "hide" form template + $content['refid_content'] = loadTemplate('guest_register_refid_hide', TRUE); + } else { + // Load template to enter it + $content['refid_content'] = loadTemplate('guest_register_refid', TRUE); + } + + // ZIP codes are numerical values + $content['zip'] = ''; + if ((isPostRequestElementSet('zip')) && (isValidNumber(postRequestElement('zip')))) { + $content['zip'] = bigintval(postRequestElement('zip')); + } // END - if + + // Other values + foreach (array('gender', 'surname', 'family', 'street_nr', 'city', 'email') as $entry) { + $content[$entry] = sqlEscapeString(postRequestElement($entry)); + } // END - foreach + + // Set must-fillout fields + $content = runFilterChain('register_must_fillout', $content); + + // Display registration form + loadTemplate('guest_register', FALSE, $content); +} + //----------------------------------------------------------------------------- // EL code functions //----------------------------------------------------------------------------- diff --git a/inc/modules/guest/what-register.php b/inc/modules/guest/what-register.php index d30a787e3f..c174554151 100644 --- a/inc/modules/guest/what-register.php +++ b/inc/modules/guest/what-register.php @@ -53,94 +53,24 @@ if (!isExtensionActive('register')) { // Is the form sent and all went fine? //* DEBUG: */ debugOutput('isFormSent=' . intval(isFormSent()) . ',isRegistrationDataComplete=' . intval(isRegistrationDataComplete()) . ',isAdmin=' . intval(isAdmin())); -if ((isFormSent()) && (isRegistrationDataComplete())) { +if (runFilterChain('check_user_registration') === TRUE) { // Do the registration here - doUserRegistration(); - - // Output success registration - displayMessage('{--REGISTRATION_DONE--}'); -} else { - // Do this only if form is sent - if (isFormSent()) { - if (postRequestElement('agree') == '!') { - registerOutputFailedMessage('HAVE_TO_AGREE'); - } // END - if - - if (postRequestElement('email') == '!') { - registerOutputFailedMessage('ENTER_EMAIL'); - setPostRequestElement('email', ''); - } elseif (postRequestElement('email') == '?') { - registerOutputFailedMessage('GUEST_EMAIL_IS_ALREADY_REGISTERED'); - setPostRequestElement('email', ''); - } - - if (postRequestElement('surname') == '!') { - registerOutputFailedMessage('ENTER_SURNAME'); - setPostRequestElement('surname', ''); - } // END - if - - if (postRequestElement('family') == '!') { - registerOutputFailedMessage('ENTER_FAMILY'); - setPostRequestElement('family', ''); - } // END - if - - if ((postRequestElement('password1') == '!') && (postRequestElement('password2') == '!')) { - registerOutputFailedMessage('ENTER_BOTH_PASSWORDS'); - } elseif (postRequestElement('password1') == '!') { - registerOutputFailedMessage('ENTER_PASSWORD1'); - } elseif (postRequestElement('password2') == '!') { - registerOutputFailedMessage('ENTER_PASSWORD2'); - } - - if ((isset($GLOBALS['registration_weak_password'])) && ($GLOBALS['registration_weak_password'] === TRUE)) { - registerOutputFailedMessage('GUEST_WEAK_PASSWORD'); - } // END - if - - if ((isset($GLOBALS['registration_ip_timeout'])) && ($GLOBALS['registration_ip_timeout'] === TRUE)) { - registerOutputFailedMessage('REMOTE_ADDR_TIMEOUT'); - } // END - if - - if ((!empty($GLOBALS['registration_selected_cats'])) && ($GLOBALS['registration_selected_cats'] < getLeastCats())) { - registerOutputFailedMessage('', '{--CHOOSE_MORE_CATEGORIES--}'); - } // END - if - } // END - if - - // Generate birthday selection - switch (getLanguage()) { - case 'de': // German date format - $content['birthday_selection'] = addSelectionBox('da', postRequestElement('day')).addSelectionBox('mo', postRequestElement('month')).addSelectionBox('ye', postRequestElement('year')); - break; - - default: // Default is the US date format... :) - $content['birthday_selection'] = addSelectionBox('mo', postRequestElement('month')).addSelectionBox('da', postRequestElement('day')).addSelectionBox('ye', postRequestElement('year')); - break; - } // END - switch - - // Shall I display the refid or shall I make it editable? - if (isDisplayRefidEnabled()) { - // Load "hide" form template - $content['refid_content'] = loadTemplate('guest_register_refid_hide', TRUE); + if (doUserRegistration()) { + // All done + runFilterChain('user_registration_done'); } else { - // Load template to enter it - $content['refid_content'] = loadTemplate('guest_register_refid', TRUE); + // Something failed + runFilterChain('user_registration_failed'); } - - // ZIP codes are numerical values - $content['zip'] = ''; - if ((isPostRequestElementSet('zip')) && (isValidNumber(postRequestElement('zip')))) { - $content['zip'] = bigintval(postRequestElement('zip')); +} else { + // Is a registration provider selected? + if (!isGetRequestElementSet('registration_provider')) { + // Display selector form + loadTemplate('guest_registration_select'); } // END - if - // Other values - foreach (array('gender', 'surname', 'family', 'street_nr', 'city', 'email') as $entry) { - $content[$entry] = sqlEscapeString(postRequestElement($entry)); - } // END - foreach - - // Set must-fillout fields - $content = runFilterChain('register_must_fillout', $content); - // Display registration form - loadTemplate('guest_register', FALSE, $content); + runFilterChain('user_registration_form'); } // [EOF] diff --git a/templates/de/html/guest/guest_register.tpl b/templates/de/html/guest/guest_register.tpl index 33b82024b0..9b2d2e3b2f 100644 --- a/templates/de/html/guest/guest_register.tpl +++ b/templates/de/html/guest/guest_register.tpl @@ -1,5 +1,6 @@
{%form,formMethodPost,formNameRegister=modules.php?module=index&what=register%} +