$OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_YEARS--}</strong></td>\n";
}
- if (ereg("M", $display) || (empty($display))) {
+ if (ereg('M', $display) || (empty($display))) {
$OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_MONTHS--}</strong></td>\n";
}
$OUT .= "<INPUT type=\"hidden\" name=\"" . $prefix."_ye\" value=\"0\" />\n";
}
- if (ereg("M", $display) || (empty($display))) {
+ if (ereg('M', $display) || (empty($display))) {
// Generate month selection
$OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"" . $prefix."_mo\" size=\"1\">\n";
for ($idx = 0; $idx <= 11; $idx++)
//
function registerMustFillout () {
- $result = SQL_QUERY("SELECT field_name, field_required FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`",
- __FUNCTION__, __LINE__);
+ $result = SQL_QUERY("SELECT `field_name`, `field_required` FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id` ASC",
+ __FUNCTION__, __LINE__);
while ($content = SQL_FETCHARRAY($result)) {
$value = '';
}
//
-function REGISTER_CHECK_REQUIRED_FIELDS (&$array) {
- $ret = false;
+function ifRequiredRegisterFieldsAreSet (&$array) {
+ // By default all is fine
+ $ret = true;
foreach ($array as $key => $value) {
- $result = SQL_QUERY("SELECT field_required FROM `{!_MYSQL_PREFIX!}_must_register` WHERE field_name='".$key."' LIMIT 1",
- __FUNCTION__, __LINE__);
+ // Check all fields that must register
+ $result = SQL_QUERY("SELECT `id` FROM `{!_MYSQL_PREFIX!}_must_register` WHERE `field_name`='".$key."' AND `field_required`='Y' LIMIT 1",
+ __FUNCTION__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
- // "Must-line" found
- list($chk) = SQL_FETCHROW($result);
-
// Check if extension country is not found (you have to enter the 2-chars long country code) or
// if extensions is present check if country code was selected
// 01 2 21 12 3 32 234 5 54 4 43 34 4 4 5 5432 2 3 3210
- $country = ((!EXT_IS_ACTIVE('country')) || ((EXT_IS_ACTIVE('country')) && (((empty($value)) && ($key == "cntry")) || (($key == "country_code") && (!empty($value)))) && (!empty($array['country_code']))));
- if ((empty($value)) && ($chk == 'Y') && (!$country))
- {
+ $country = ((!EXT_IS_ACTIVE('country')) || ((EXT_IS_ACTIVE('country')) && (((empty($value)) && ($key == 'cntry')) || (($key == 'country_code') && (!empty($value)))) && (!empty($array['country_code']))));
+ if ((empty($value)) && (!$country)) {
// Required field not set
$array[$key] = '!';
- $ret = true;
- }
- }
+ $ret = false;
+ } // END - if
+ } // END - if
// Free result
SQL_FREERESULT($result);
- }
+ } // END - foreach
+
+ // Return result
return $ret;
}
-//
+// @TODO This function is no longer used???
function REGISTER_OUTPUT_REQUIRE_CHECK (&$array) {
+ // Get all fields for output
$result = SQL_QUERY("SELECT `field_name`, `field_required` FROM `{!_MYSQL_PREFIX!}_must_register` ORDER BY `id`", __FUNCTION__, __LINE__);
+
+ // Loop through them
while ($content = SQL_FETCHARRAY($result)) {
if (($array[$content['field_name']] == '!') && ($content['field_required'] == 'Y')) {
// Empty entry found
// Cannot validate the login data and hash
LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_VALIDATION_RESET_LOGIN_HASH_FAILED'));
}
- } elseif ((REQUEST_ISSET_POST('reset_pass')) && (REQUEST_ISSET_POST('hash')) && (REQUEST_ISSET_POST('login')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
+ } elseif ((REQUEST_ISSET_POST('reset_pass')) && (REQUEST_ISSET_POST('hash')) && (REQUEST_ISSET_POST('login')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
// Okay, we shall the admin password here. So first revalidate the hash
if (ADMIN_VALIDATE_RESET_LINK_HASH_LOGIN(REQUEST_POST('hash'), REQUEST_POST('login'))) {
// Set the password now
// Display form is default
$FORM = true;
-if ((REQUEST_ISSET_POST('add')) && (REQUEST_ISSET_POST('login')) && (REQUEST_ISSET_POST('email')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))) && (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
+if ((REQUEST_ISSET_POST('add')) && (REQUEST_ISSET_POST('login')) && (REQUEST_ISSET_POST('email')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2')) && (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
// Add admin when not added already
if (REGISTER_ADMIN(REQUEST_POST('login'), generateHash(REQUEST_POST('pass1')), REQUEST_POST('email')) == 'done') {
// Do not ouput any form!
// Personal data
switch ($DATA['gender'])
{
- case "M":
+ case 'M':
define('__GENDER_M', ' selected="selected"');
define('__GENDER_F', '');
define('__GENDER_C', '');
break;
- case "F":
+ case 'F':
define('__GENDER_M', '');
define('__GENDER_F', ' selected="selected"');
define('__GENDER_C', '');
break;
- case "C":
+ case 'C':
define('__GENDER_M', '');
define('__GENDER_F', '');
define('__GENDER_C', ' selected="selected"');
define('__CELL' , $DATA['cell']);
define('__EMAIL' , $DATA['email']);
define('__URL' , $DATA['url']);
+
// Warning because low points
- define('__REC_WARNING', ADD_SELECTION('yn', $DATA['receive_warnings'], "receive_warning"));
- define('__INTERVAL' , createTimeSelections($DATA['warning_interval'], "warning_interval", "MWDh"));
+ define('__REC_WARNING', ADD_SELECTION('yn', $DATA['receive_warnings'], 'receive_warning'));
+ define('__INTERVAL' , createTimeSelections($DATA['warning_interval'], 'warning_interval', 'MWDh'));
// Init variables here
$TPL = sprintf("admin_edit_sponsor_%s", REQUEST_GET('mode'));
case 'edit': // Edit sponsor account
$PASS = true;
- if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) || ((!REQUEST_ISSET_POST(('pass1'))) && (!REQUEST_ISSET_POST(('pass1'))))) {
+ if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) || ((!REQUEST_ISSET_POST('pass1')) && (!REQUEST_ISSET_POST('pass1')))) {
// Remove passwords
- REQUEST_UNSET_POST(('pass1'));
- REQUEST_UNSET_POST(('pass2'));
+ REQUEST_UNSET_POST('pass1');
+ REQUEST_UNSET_POST('pass2');
$PASS = false;
}
FROM `{!_MYSQL_PREFIX!}_user_data`
WHERE userid=%s
LIMIT 1",
- array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
+ array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
}
if ((SQL_NUMROWS($result_main) == 1) || (!REQUEST_ISSET_GET('uid')))
{
// Ok, change the account...
$PASS = false; $add = '';
- if ((!REQUEST_ISSET_POST(('pass1'))) && (!REQUEST_ISSET_POST(('pass2'))))
- {
+ if ((!REQUEST_ISSET_POST('pass1')) && (!REQUEST_ISSET_POST('pass2'))) {
// Don't change the password
$PASS = true;
- }
- elseif ((REQUEST_POST('pass1') == REQUEST_POST('pass2')))
- {
+ } elseif ((REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
// Change the password
$PASS = true;
- $add = ", password='".generateHash(REQUEST_POST('pass1'))."'";
+ $add = ", `password`='" . generateHash(REQUEST_POST('pass1')) . "'";
}
- if ($PASS)
- {
+
+ if ($PASS) {
// We have to add the following things: birthday and max receive mails
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET
-gender='%s',
-surname='%s',
-family='%s',
-street_nr='%s',
-country='%s',
-zip=%s,
-city='%s',
-email='%s'
+`gender`='%s',
+`surname`='%s',
+`family`='%s',
+`street_nr`='%s',
+`country`='%s',
+`zip`=%s,
+`city`='%s',
+`email`='%s'
".$add."
WHERE userid=%s LIMIT 1",
array(
- substr(REQUEST_POST('gender'), 0, 1),
- REQUEST_POST('surname'),
- REQUEST_POST('family'),
- REQUEST_POST('street_nr'),
- REQUEST_POST('country'),
- bigintval(REQUEST_POST('zip')),
- REQUEST_POST('city'),
- REQUEST_POST('email'),
- bigintval(REQUEST_GET('uid')),
+ substr(REQUEST_POST('gender'), 0, 1),
+ REQUEST_POST('surname'),
+ REQUEST_POST('family'),
+ REQUEST_POST('street_nr'),
+ REQUEST_POST('country'),
+ bigintval(REQUEST_POST('zip')),
+ REQUEST_POST('city'),
+ REQUEST_POST('email'),
+ bigintval(REQUEST_GET('uid')),
), __FILE__, __LINE__);
- $content = USER_ACCOUNT_SAVED;
- }
- else
- {
+ $content = getMessage('USER_ACCOUNT_SAVED');
+ } else {
// Problem while saving data
- $content = USER_ACCOUNT_NOT_SAVED;
+ $content = getMessage('USER_ACCOUNT_NOT_SAVED');
}
// Load template
LOAD_TEMPLATE('admin_settings_saved', false, $content);
- }
- else
- {
+ } else {
// Display form to edit
list($gender, $surname, $family, $street, $zip, $city, $country, $email, $bday, $bmonth, $byear, $max) = SQL_FETCHROW($result_main);
- SQL_FREERESULT($result_main);
// Transfer data to constants for the template
- switch ($gender)
- {
- case "M":
+ switch ($gender) {
+ case 'M':
define('_GENDER_M', ' selected="selected"');
define('_GENDER_F', '');
define('_GENDER_C', '');
break;
- case "F":
+ case 'F':
define('_GENDER_M', '');
define('_GENDER_F', ' selected="selected"');
define('_GENDER_C', '');
break;
- case "C":
+ case 'C':
define('_GENDER_M', '');
define('_GENDER_F', '');
define('_GENDER_C', ' selected="selected"');
define('_COUNTRY', $country); define('_EMAIL' , $email);
// Load template
- LOAD_TEMPLATE("admin_edit_user", false, bigintval(REQUEST_GET('uid')));
+ LOAD_TEMPLATE('admin_edit_user', false, bigintval(REQUEST_GET('uid')));
}
} else {
// Account does not exists!
LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
}
+// Free the result
+SQL_FREERESULT($result_main);
+
//
?>
if (!REQUEST_ISSET_POST(('addy'))) REQUEST_SET_POST('addy' , '');
if (!REQUEST_ISSET_POST(('surname'))) REQUEST_SET_POST('surname' , '');
if (!REQUEST_ISSET_POST(('family'))) REQUEST_SET_POST('family' , '');
-if (!REQUEST_ISSET_POST(('pass1'))) REQUEST_SET_POST('pass1' , '');
-if (!REQUEST_ISSET_POST(('pass2'))) REQUEST_SET_POST('pass2' , '');
+if (!REQUEST_ISSET_POST('pass1')) REQUEST_SET_POST('pass1' , '');
+if (!REQUEST_ISSET_POST('pass2')) REQUEST_SET_POST('pass2' , '');
if (!REQUEST_ISSET_POST(('day'))) REQUEST_SET_POST('day' , '');
if (!REQUEST_ISSET_POST(('month'))) REQUEST_SET_POST('month' , '');
if (!REQUEST_ISSET_POST(('year'))) REQUEST_SET_POST('year' , '');
$isFailed = true;
} // END - if
+ // Get temporary array for modification
+ $postArray = REQUEST_POST_ARRAY();
+
// Check for required fields
- if ($isFailed === false) $isFailed = REGISTER_CHECK_REQUIRED_FIELDS(REQUEST_POST_ARRAY());
+ if ($isFailed === false) $isFailed = ifRequiredRegisterFieldsAreSet($postArray);
+
+ // Set it back in request
+ REQUEST_SET_POST_ARRAY($postArray);
// Did he enter his password twice?
- if (((!REQUEST_ISSET_POST(('pass1'))) || (!REQUEST_ISSET_POST(('pass2')))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))))) {
- if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2')))) {
+ if (((!REQUEST_ISSET_POST('pass1')) || (!REQUEST_ISSET_POST('pass2'))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2')))) {
+ if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2'))) {
REQUEST_SET_POST('pass1', '!');
REQUEST_SET_POST('pass2', '!');
} else {
- if (!REQUEST_ISSET_POST(('pass1'))) { REQUEST_SET_POST('pass1', '!'); } else { REQUEST_SET_POST('pass1', ''); }
- if (!REQUEST_ISSET_POST(('pass2'))) { REQUEST_SET_POST('pass2', '!'); } else { REQUEST_SET_POST('pass2', ''); }
+ if (!REQUEST_ISSET_POST('pass1')) { REQUEST_SET_POST('pass1', '!'); } else { REQUEST_SET_POST('pass1', ''); }
+ if (!REQUEST_ISSET_POST('pass2')) { REQUEST_SET_POST('pass2', '!'); } else { REQUEST_SET_POST('pass2', ''); }
}
$isFailed = true;
} // END - if
}
// Did he enter his password twice?
- if (((!REQUEST_ISSET_POST(('pass1'))) || (!REQUEST_ISSET_POST(('pass2')))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))))) {
- if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2')))) {
+ if (((!REQUEST_ISSET_POST('pass1')) || (!REQUEST_ISSET_POST('pass2'))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2')))) {
+ if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2'))) {
// Passwords missmatch
$FORM_ERRORS[] = getMessage('SPONSOR_PASSWORDS_MISMATCH');
} else {
- if (!REQUEST_ISSET_POST(('pass1'))) {
+ if (!REQUEST_ISSET_POST('pass1')) {
// Password 1 is empty
$FORM_ERRORS[] = getMessage('SPONSOR_PASSWORD1_EMPTY');
}
- if (!REQUEST_ISSET_POST(('pass2'))) {
+ if (!REQUEST_ISSET_POST('pass2')) {
// Password 2 is empty
$FORM_ERRORS[] = getMessage('SPONSOR_PASSWORD2_EMPTY');
}
// Check for gender selection
switch (REQUEST_POST('gender'))
{
- case "M": // Male
+ case 'M': // Male
define('__GENDER_M' , ' selected="selected"');
define('__GENDER_F' , '');
define('__GENDER_C' , '');
break;
- case "F": // Female
+ case 'F': // Female
define('__GENDER_M' , '');
define('__GENDER_F' , ' selected="selected"');
define('__GENDER_C' , '');
break;
- case "C": // Company
+ case 'C': // Company
define('__GENDER_M' , '');
define('__GENDER_F' , '');
define('__GENDER_C' , ' selected="selected"');
} else {
// Generate hash
$hash = generateHash(REQUEST_POST('pass1'), substr($DATA[1], 0, -40));
- if ((($hash == $DATA[1]) || (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) && (REQUEST_ISSET_POST(('pass1')))) {
+ if ((($hash == $DATA[1]) || (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) && (REQUEST_ISSET_POST('pass1'))) {
// Only on simple changes normal mode is active = no email or password changed
$mode = 'normal'; $AND = '';
}
// Data for the formular
-$result = SQL_QUERY_ESC("SELECT company, position, tax_ident,
-gender, surname, family, street_nr1, street_nr2, zip, city, country,
-phone, fax, cell, email, url,
-status, receive_warnings
+$result = SQL_QUERY_ESC("SELECT `company`, `position`, `tax_ident`,
+`gender`, `surname`, `family`, `street_nr1`, `street_nr2`, `zip`, `city`, `country`,
+`phone`, `fax`, `cell`, `email`, `url`,
+`status`, `receive_warnings`
FROM `{!_MYSQL_PREFIX!}_sponsor_data`
-WHERE `id`='%s' AND password='%s' LIMIT 1",
-array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FILE__, __LINE__);
+WHERE `id`='%s' AND `password`='%s' LIMIT 1",
+ array(bigintval(getSession('sponsorid')), getSession('sponsorpass')), __FILE__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
} elseif (md5(REQUEST_POST('pass_old')) != getSession('sponsorpass')) {
// Entered password didn't match password in DB
$message = getMessage('SPONSOR_CURRENT_PASSWORD_DIDNOT_MATCH_DB');
- } elseif ((REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))) && (REQUEST_POST('pass1') != REQUEST_POST('pass2'))) {
+ } elseif ((REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2')) && (REQUEST_POST('pass1') != REQUEST_POST('pass2'))) {
// Both new passwords did not match
$message = getMessage('SPONSOR_BOTH_NEW_PASSWORDS_DIDNOT_MATCH');
- } elseif ((!REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2')))) {
+ } elseif ((!REQUEST_ISSET_POST('pass1')) && (REQUEST_ISSET_POST('pass2'))) {
// No password one entered
$message = getMessage('SPONSOR_PASSWORD_ONE_EMPTY');
- } elseif ((REQUEST_ISSET_POST(('pass1'))) && (!REQUEST_ISSET_POST(('pass2')))) {
+ } elseif ((REQUEST_ISSET_POST('pass1')) && (!REQUEST_ISSET_POST('pass2'))) {
// No password two entered
$message = getMessage('SPONSOR_PASSWORD_TWO_EMPTY');
- } elseif ((REQUEST_ISSET_POST(('pass1'))) && (strlen(REQUEST_POST('pass1')) < getConfig('pass_len'))) {
+ } elseif ((REQUEST_ISSET_POST('pass1')) && (strlen(REQUEST_POST('pass1')) < getConfig('pass_len'))) {
// Too short password
$message = sprintf(getMessage('SPONSOR_PASSWORD_TOO_SHORT'), getConfig('pass_len'));
} else {
$PASS_AND = ''; $PASS_DATA = '';
// Check if we want to change password or not
- if ((REQUEST_POST('pass1') == REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_POST('pass1') != REQUEST_POST('pass_old'))) {
+ if ((REQUEST_POST('pass1') == REQUEST_POST('pass2')) && (REQUEST_ISSET_POST('pass1')) && (REQUEST_POST('pass1') != REQUEST_POST('pass_old'))) {
// Change current password
$PASS_AND = ", password='%s'";
$PASS_DATA = md5(REQUEST_POST('pass1'));
// Check for gender selection
switch ($content['gender'])
{
- case "M": // Male
+ case 'M': // Male
define('__GENDER_M', ' selected="selected"');
define('__GENDER_F', '');
define('__GENDER_C', '');
break;
- case "F": // Female
+ case 'F': // Female
define('__GENDER_M', '');
define('__GENDER_F', ' selected="selected"');
define('__GENDER_C', '');
break;
- case "C": // Company
+ case 'C': // Company
define('__GENDER_M', '');
define('__GENDER_F', '');
define('__GENDER_C', ' selected="selected"');
}
// Output formular
- $OUT = LOAD_TEMPLATE("sponsor_account_form", true, $content);
+ $OUT = LOAD_TEMPLATE('sponsor_account_form', true, $content);
}
} else {
// Locked or so?