* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2013 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2015 by Mailer Developer Team *
* For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
`sort` ASC',
__FUNCTION__, __LINE__);
- if (!ifSqlHasZeroNums($result)) {
+ if (!ifSqlHasZeroNumRows($result)) {
// List alle visible modules (or all to the admin)
$OUT .= '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
while ($content = sqlFetchArray($result)) {
}
// Outputs a 'failed message'
-function registerOutputFailedMessage ($messageId, $extra='') {
+function registerOutputFailedMessage ($messageId, $extra = '') {
if (empty($messageId)) {
outputHtml('<div class="bad">' . $extra . '</div>');
} else {
// Checks whether the registration data is complete
function isRegistrationDataComplete () {
// Init elements
- $GLOBALS['registration_ip_timeout'] = FALSE;
- $GLOBALS['registration_short_password'] = FALSE;
- $GLOBALS['registration_selected_cats'] = '0';
+ $GLOBALS['registration_ip_timeout'] = FALSE;
+ $GLOBALS['registration_weak_password'] = FALSE;
+ $GLOBALS['registration_selected_cats'] = '0';
// Default is okay
$isOkay = TRUE;
+ $isRandom = FALSE;
// First we only check the submitted data then we continue... :)
//
if ((isExtensionInstalledAndNewer('register', '0.5.5')) && (isRegisterGeneratePasswordEmptyEnabled())) {
// Generate a random password
$randomPassword = generatePassword();
+ $isRandom = TRUE;
// Set it in both entries
setPostRequestElement('password1', $randomPassword);
$isOkay = FALSE;
} // END - if
- // Is the password long enouth?
- if ((strlen(postRequestElement('password1')) < getPassLen()) && ($isOkay === TRUE)) {
- $GLOBALS['registration_short_password'] = TRUE;
+ // Is the password strong enough?
+ if (($isRandom === FALSE) && (!isStrongPassword(postRequestElement('password1')))) {
+ $GLOBALS['registration_weak_password'] = TRUE;
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'User did enter a short password.');
$isOkay = FALSE;
} // END - if
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();
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: */ $GLOBALS['register_userid'] = 1; return TRUE;
+
// Create user's account...
sqlQueryEscaped("INSERT INTO
`{?_MYSQL_PREFIX?}_user_data`
return FALSE;
} // END - if
+ // Set new user id globally
+ $GLOBALS['register_userid'] = $filterData['register_insert_id'];
+
// Shall we reset random refid? Only possible with latest ext-user
if (isExtensionInstalledAndNewer('user', '0.3.4')) {
// Reset all accounts, registration is done
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?
return registerGenerateCategoryTable('admin', $configEntry);
}
+// Template helper for generating a list of all activated user registration provider
+function doTemplateGuestRegistrationList ($templateName, $clear = FALSE) {
+ // Init output
+ $content = '';
+
+ // Default is only activated provider
+ $addSql = " AND `provider_is_active`='Y'";
+
+ // Is admin logged-in?
+ if (isAdmin()) {
+ // Then show all
+ $addSql = '';
+ } // END - if
+
+ // Search for all
+ $result = sqlQuery("SELECT
+ `provider_name`,
+ `provider_extension`
+FROM
+ `{?_MYSQL_PREFIX?}_user_register_provider`
+WHERE
+ `provider_extension` != 'register'
+ " . $addSql . "
+ORDER BY
+ `provider_name` ASC", __FUNCTION__, __LINE__);
+
+ // Are there entries?
+ if (sqlNumRows($result) > 0) {
+ // Loop through all
+ $row = '';
+ while ($content = sqlFetchArray($result)) {
+ // Load row template
+ $row .= loadTemplate('guest_registration_provider_row', TRUE, $content);
+ } // END - while
+
+ // Load main template
+ $content = loadTemplate('guest_registration_provider', TRUE, $row);
+ } else {
+ // Nothing found
+ $content = returnMessage('{--GUEST_EXTRA_REGISTRATION_PROVIDER_404--}');
+ }
+
+ // Free result
+ sqlFreeResult($result);
+
+ // Return the generated content
+ return $content;
+}
+
+// ----------------------------------------------------------------------------
+// "Translator" functions
+// ----------------------------------------------------------------------------
+
+function translateRegistrationProviderName ($providerName) {
+ // "Translate it"
+ return '{--REGISTRATION_PROVIDER_' . strtoupper($providerName) . '--}';
+}
+
// [EOF]
?>