registerFilter('init', 'CHECK_SVN_REVISION');
registerFilter('init', 'RUN_DAILY_RESET');
registerFilter('init', 'INIT_RANDOMIZER');
+ registerFilter('init', 'INIT_RANDOM_NUMBER');
registerFilter('init', 'TRIGGER_SENDING_POOL');
registerFilter('init', 'DETERMINE_USERNAME');
registerFilter('init', 'DETERMINE_WHAT_ACTION');
$GLOBALS['acl_allow'] = $ret;
}
+// Init random number/cache buster
+function FILTER_INIT_RANDOM_NUMBER () {
+ // Is the extension sql_patches installed and at least 0.3.6?
+ if ((isExtensionActive('sql_patches')) && (getExtensionVersion('sql_patches') >= '0.3.6')) {
+ // Generate random number
+ setConfigEntry('RAND_NUMBER', generateRandomCode(10, mt_rand(10000, 32766), getUserId(), ''));
+ } else {
+ // Generate weak (!!!) code
+ setConfigEntry('RAND_NUMBER', mt_rand(1000000, 9999999));
+ }
+
+ // Copy it to CACHE_BUSTER
+ setConfigEntry('CACHE_BUSTER', getConfig('RAND_NUMBER'));
+}
+
// [EOF]
?>
}
// Initialize variables
-$isFailed = false;
+$isOkay = true;
$shortPass = false;
$cats = 0;
$ipTimedOut = false;
// Did he agree to our Terms Of Usage?
if (postRequestElement('agree') != 'Y') {
setRequestPostElement('agree', '!');
- $isFailed = true;
+ $isOkay = false;
} // END - if
// Did he enter a valid email address? (we really don't care about
// that, he has to click on a confirmation link :P )
if ((!isPostRequestElementSet('email')) || (!isEmailValid(postRequestElement('email')))) {
setRequestPostElement('email', '!');
- $isFailed = true;
+ $isOkay = false;
} // END - if
// And what about surname and family's name?
if (!isPostRequestElementSet('surname')) {
setRequestPostElement('surname', '!');
- $isFailed = true;
+ $isOkay = false;
} // END - if
if (!isPostRequestElementSet('family')) {
setRequestPostElement('family', '!');
- $isFailed = true;
+ $isOkay = false;
} // END - if
// Get temporary array for modification
$postArray = postRequestArray();
// Check for required fields
- if ($isFailed === false) $isFailed = ifRequiredRegisterFieldsAreSet($postArray);
+ if ($isOkay === true) $isOkay = ifRequiredRegisterFieldsAreSet($postArray);
// Set it back in request
setPostRequestArray($postArray);
if (!isPostRequestElementSet('pass1')) { setRequestPostElement('pass1', '!'); } else { setRequestPostElement('pass1', ''); }
if (!isPostRequestElementSet('pass2')) { setRequestPostElement('pass2', '!'); } else { setRequestPostElement('pass2', ''); }
}
- $isFailed = true;
+ $isOkay = false;
} // END - if
// Is the password long enouth?
- if ((strlen(postRequestElement('pass1')) < getConfig('pass_len')) && ($isFailed === false)) {
+ if ((strlen(postRequestElement('pass1')) < getConfig('pass_len')) && ($isOkay === true)) {
$shortPass = true;
- $isFailed = true;
+ $isOkay = false;
} // END - if
// No admin? Admins can always register!
if ($cats < getConfig('least_cats')) {
// ... nope!
- $isFailed = true;
+ $isOkay = false;
} // END - if
} // END - if
$CHK = isEmailTaken(postRequestElement('email'));
if ($CHK === true) {
setRequestPostElement('email', '?');
- $isFailed = true;
+ $isOkay = false;
} // END - if
} // END - if
// Same IP in timeout range and different email address entered... Eat this, faker! ;-)
// But admins are allowed to fake their own exchange service.
$ipTimedOut = true;
- $isFailed = true;
+ $isOkay = false;
} // END - if
- } // END - if
- // Free memory
- SQL_FREERESULT($result);
+ // Free memory
+ SQL_FREERESULT($result);
+ } // END - if
} // END - if
-if ((isFormSent()) && (($isFailed === false) || (isAdmin()))) {
+// Is the form sent and all went fine or admin logged in?
+//* DEBUG: */ print intval(isFormSent()).'/'.intval($isOkay).'/'.intval(isAdmin()).'<br />';
+if ((isFormSent()) && (($isOkay === true) || (isAdmin()))) {
// Prepapre month and day of birth
if (strlen(postRequestElement('day')) == 1) setRequestPostElement('day' , '0'.postRequestElement('day'));
if (strlen(postRequestElement('month')) == 1) setRequestPostElement('month', '0'.postRequestElement('month'));
// Start with the gender...
$content = array(
'hash' => $hash,
- 'userid' => $userid,
+ 'userid' => $userid,
'gender' => $gender,
'surname' => SQL_ESCAPE(postRequestElement('surname')),
'family' => SQL_ESCAPE(postRequestElement('family')),
// No ZIP code entered
$content = array(
'hash' => $hash,
- 'userid' => $userid,
+ 'userid' => $userid,
'gender' => $gender,
'surname' => SQL_ESCAPE(postRequestElement('surname')),
'family' => SQL_ESCAPE(postRequestElement('family')),
return;
} // END - if
-// Remember userid
-$content['userid'] = getUserId();
+// Add userid
+$content = array(
+ 'userid' => getUserId()
+);
// Init variable to prevent notices
$URL = '';
switch ($mode) {
case 'show': // Show his data
if (isExtensionActive('country', true)) {
- // New way 0 1 2 3 4 5 6 7 8 9 10 11 12 13
- $result = SQL_QUERY_ESC("SELECT surname, family, street_nr, country_code, zip, city, email, birth_day, birth_month, birth_year, gender, max_mails, receive_mails, last_update FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
+ // New way 1 2 3 4 5 6 7 8 9 10 11 12 13 14
+ $result = SQL_QUERY_ESC("SELECT `surname`, `family`, `street_nr`, `country_code`, `zip`, `city`, `email`, `birth_day`, `birth_month`, `birth_year`, `gender`, `max_mails`, `receive_mails`, `last_update` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
array(getUserId()), __FILE__, __LINE__);
} else {
- // Old way 0 1 2 3 4 5 6 7 8 9 10 11 12 13
- $result = SQL_QUERY_ESC("SELECT surname, family, street_nr, country, zip, city, email, birth_day, birth_month, birth_year, gender, max_mails, receive_mails, last_update FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
+ // Old way 1 2 3 4 5 6 7 8 9 10 11 12 13 14
+ $result = SQL_QUERY_ESC("SELECT `surname`, `family`, `street_nr`, `country`, `zip`, `city`, `email`, `birth_day`, `birth_month`, `birth_year`, `gender`, `max_mails`, `receive_mails`, `last_update` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
array(getUserId()), __FILE__, __LINE__);
}
- $content = SQL_FETCHARRAY($result, 0, false);
+
+ // Get line
+ $content = merge_array($content, SQL_FETCHARRAY($result, 0, false));
+
+ // Free result
SQL_FREERESULT($result);
// Translate some things
$content['country'] = generateCountryInfo($content['country_code']);
} // END - if
- // Merge data in
- $content = merge_array($content, $content);
-
// Load template
loadTemplate('member_mydata_overview', false, $content);
break;
array(getUserId()), __FILE__, __LINE__);
}
- $content = SQL_FETCHARRAY($result, 0, false);
+ // Get line
+ $content = merge_array($content, SQL_FETCHARRAY($result, 0, false));
+
+ // Free result
SQL_FREERESULT($result);
+
$content['update_check'] = $content['last_update'] + getConfig('profile_lock');
// How far is last change on his profile away from now?
$content['country'] = "<input type=\"text\" name=\"cntry\" class=\"member_normal\" size=\"2\" maxlength=\"3\" value=\"".$content['country']."\" />";
}
- // Merge data in
- $content = merge_array($content, $content);
-
// Load template
loadTemplate('member_mydata_edit', false, $content);
}
// Load old email / password: 0 1 2
$result = SQL_QUERY_ESC("SELECT `email`, `password`, `last_update` FROM `{?_MYSQL_PREFIX?}_user_data` WHERE `userid`=%s LIMIT 1",
array(getUserId()), __FILE__, __LINE__);
- $content = SQL_FETCHARRAY($result, 0, false);
+
+ // Get line
+ $content = merge_array($content, SQL_FETCHARRAY($result, 0, false));
+
+ // Free result
SQL_FREERESULT($result);
+
$content['last_change'] = $content['last_update'] + getConfig('profile_lock');
// How far is last change on his profile away from now?
// Run the init filter chain
runFilterChain('init');
- // Is the extension sql_patches installed and at least 0.3.6?
- if ((isExtensionActive('sql_patches')) && (getExtensionVersion('sql_patches') >= '0.3.6')) {
- // Generate random number
- setConfigEntry('RAND_NUMBER', generateRandomCode(10, mt_rand(10000, 32766), getUserId(), ''));
- } else {
- // Generate weak (!!!) code
- setConfigEntry('RAND_NUMBER', mt_rand(1000000, 9999999));
- }
-
// Check module for permissions
$checkModule = checkModulePermissions();