X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffilter%2Fregister_filter.php;h=1eac55824e5311d6b74cfc43d8f6942e108d1193;hb=a00ad7dd8c36a5322e28f38d8d641efb90c00c92;hp=7bd56bc650fd1b7d7b9442e311e38e8a6a90cc49;hpb=0f3a135204757cc8750262871c8e62c42300acb4;p=mailer.git diff --git a/inc/filter/register_filter.php b/inc/filter/register_filter.php index 7bd56bc650..1eac55824e 100644 --- a/inc/filter/register_filter.php +++ b/inc/filter/register_filter.php @@ -16,8 +16,8 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2011 by Mailer Developer Team * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2013 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -41,14 +41,14 @@ if (!defined('__SECURITY')) { } // END - if // Run a filter for must-fillout fields -function FILTER_REGISTER_MUST_FILLOUT ($content) { +function FILTER_REGISTER_MUST_FILLOUT ($filterData) { // Get all fields for output //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); - $result = SQL_QUERY('SELECT `field_name`,`field_required` FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id` ASC', + $result = sqlQuery('SELECT `field_name`, `field_required` FROM `{?_MYSQL_PREFIX?}_must_register` ORDER BY `id` ASC', __FUNCTION__, __LINE__); // Walk through all entries - while ($row = SQL_FETCHARRAY($result)) { + while ($row = sqlFetchArray($result)) { // Must the user fill out this element? $value = ''; if ($row['field_required'] == 'Y') { @@ -56,15 +56,152 @@ function FILTER_REGISTER_MUST_FILLOUT ($content) { } // END - if // Add it - $content['must_fillout_' . strtolower($row['field_name']) . ''] = $value; + $filterData['must_fillout_' . strtolower($row['field_name']) . ''] = $value; } // END - while // Free memory - SQL_FREERESULT($result); + sqlFreeResult($result); // Return it //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); - return $content; + return $filterData; +} + +/** + * Run a filter for pre user registration - generic code (e.g. create hash, + * init global array elements). WARNING: This filter MUST run filter before all + * others, make your extension/-update depending on ext-register to avoid + * missing global array elements, etc. + * + * @param $filterData Filter data from previous filter + * @return $filterData Unchanged filter data + */ +function FILTER_PRE_USER_REGISTRATION_GENERIC ($filterData) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!'); + + // Generate hash which will be inserted into confirmation mail + $GLOBALS['register_confirm_hash'] = generateHash(sha1( + // Get total confirmed, ... + getTotalConfirmedUser() . getEncryptSeparator() . + // ... unconfirmed ... + getTotalUnconfirmedUser() . getEncryptSeparator() . + // ... and locked users + getTotalLockedUser() . getEncryptSeparator() . + postRequestElement('month') . '-' . + postRequestElement('day') . '-' . + postRequestElement('year') . getEncryptSeparator() . + postRequestElement('password1') . getEncryptSeparator() . + detectServerName() . getEncryptSeparator() . + detectRemoteAddr() . getEncryptSeparator() . + detectUserAgent() . '/' . + getSiteKey() . '/' . + getDateKey() . '/' . + getConfig('CACHE_BUSTER') + )); + + // Old way with enterable two-char-code + $GLOBALS['register_country_row'] = '`country`'; + $GLOBALS['register_country_data'] = substr(postRequestElement('cntry'), 0, 2); + + // Init "status" as for many users + setPostRequestElement('status', 'UNCONFIRMED'); + + // Add ip for later POST pings + setPostRequestElement('remote_addr', detectRemoteAddr()); + + // Generic initialization is done + $filterData['init_done'] = TRUE; + + // Return it + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!'); + //* NOISY-DEBUG: */ print __FUNCTION__.':filterData=
'.print_r($filterData,TRUE).'
'; + 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('provider')) && (postRequestElement('provider') == 'register')) { + // Run it + $filterData['status'] = doGenericUserRegistration(); + + // Interrupt filter chain + interruptFilterChain(); + } // 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('provider')) && (postRequestElement('provider') == 'register')) { + // Check form + $isFormSent = isRegistrationDataComplete(); + + // Interrupt filter chain + interruptFilterChain(); + } // 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('provider')) && (postRequestElement('provider') == 'register')) { + // Run it + displayMessage('{--REGISTRATION_DONE--}'); + + // Interrupt filter chain + interruptFilterChain(); + } // 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('provider')) && (postRequestElement('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('provider')) && (getRequestElement('provider') == 'register')) || ((!isGetRequestElementSet('provider')) && (getDefaultRegistrationProvider() == 'register'))) { + // Display generic form + doDisplayGenericUserRegistrationForm(); + + // Interrupt filter chain + interruptFilterChain(); + } // END - if + + // Return NULL + return NULL; } // [EOF]