-$MODE = "show"; // Show his data
-if (REQUEST_ISSET_POST(('save'))) $MODE = "save"; // Save entered data
-if (REQUEST_ISSET_POST('edit')) $MODE = "edit"; // Edit data
-if (REQUEST_ISSET_POST(('notify'))) $MODE = "notify"; // Switch off notification
-
-switch ($MODE)
-{
-case "show": // Show his data
- if (EXT_IS_ACTIVE('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",
- array(UID_VALUE), __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",
- array(UID_VALUE), __FILE__, __LINE__);
- }
- $DATA = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
-
- // Translate / add some things
- $DATA[10] = TRANSLATE_GENDER($DATA[10]);
- $DATA[13] = MAKE_DATETIME($DATA[13], "0");
-
- // How far is last change on his profile away from now?
- if ((($DATA[13] + getConfig('profile_lock')) > time()) && (!IS_ADMIN()) && (getConfig('profile_lock') > 0)) {
- // You cannot change your account
- define('CHANGE', "<div class=\"member_failed\">".sprintf(getMessage('MEMBER_PROFILE_LOCKED'), MAKE_DATETIME($DATA[13] + getConfig('profile_lock'), "0"))."</div>");
- } else {
- // He is allowed to change his profile
- define('CHANGE', LOAD_TEMPLATE("member_mydata_button", true));
- }
-
- if (strlen($DATA[7]) == 1) $DATA[7] = "0".$DATA[7];
- if (strlen($DATA[8]) == 1) $DATA[8] = "0".$DATA[8];
-
- switch (GET_LANGUAGE()) {
- case "de": define('DOB', $DATA[7].".".$DATA[8].".".$DATA[9]); break;
- default : define('DOB', $DATA[8]."-".$DATA[7]."-".$DATA[9]); break;
- }
-
- if (EXT_IS_ACTIVE('country')) {
- // Load country's description and code
- $DATA[3] = COUNTRY_GENERATE_INFO($DATA[3]);
- }
-
- // Load template
- LOAD_TEMPLATE("member_mydata_overview");
- break;
-
-case "edit": // Edit data
- if (EXT_IS_ACTIVE('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",
- array(constant('UID_VALUE')), __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",
- array(constant('UID_VALUE')), __FILE__, __LINE__);
- }
-
- $DATA = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- $DATA[13] = $DATA[12] + getConfig('profile_lock');
-
- // How far is last change on his profile away from now?
- if (($DATA[13] > time()) && (!IS_ADMIN()) && (getConfig('profile_lock') > 0)) {
- $DATA[13] = MAKE_DATETIME($DATA[13] + getConfig('profile_lock'), "0");
- // You cannot change your account
- LOAD_TEMPLATE("member_mydata_locked");
- } else {
- // He is allowed to change his profile
- switch ($DATA[10])
- {
- case "M":
- define('M_DEFAULT', " selected=\"selected\"");
- define('F_DEFAULT', '');
- define('C_DEFAULT', '');
- break;
-
- case "F":
- define('M_DEFAULT', '');
- define('F_DEFAULT', " selected=\"selected\"");
- define('C_DEFAULT', '');
- break;
-
- case "C":
- define('M_DEFAULT', '');
- define('F_DEFAULT', '');
- define('C_DEFAULT', " selected=\"selected\"");
- break;
- }
- $DOB = '';
- switch (GET_LANGUAGE())
- {
- case "de": // German date format
- // Day
- $DOB .= ADD_SELECTION("day", $DATA[7]);
-
- // Month
- $DOB .= ADD_SELECTION("month", $DATA[8]);
-
- // Year
- $DOB .= ADD_SELECTION("year", $DATA[9]);
- break;
-
- default: // Default is the US date format... :)
- break;