-//
-function GET_MOD_DESCR($MODE, $wht, $column="what") {
- // Fix empty "what"
- if (empty($wht)) {
- $wht = "welcome";
- if (getConfig('index_home') != "") $wht = getConfig('index_home');
- } // END - if
-
- // Default is not found
- $ret = "??? (".$wht.")";
-
- // Look for title
- $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE %s='%s' LIMIT 1",
- array($MODE, $column, $wht), __FILE__, __LINE__);
-
- // Is there an entry?
- if (SQL_NUMROWS($result) == 1) {
- // Fetch the title
- list($ret) = SQL_FETCHROW($result);
- } // END - if
-
- // Free result
- SQL_FREERESULT($result);
- return $ret;
-}
-//
-function SEND_MODE_MAILS($mod, $modes) {
- global $DATA;
-
- // Load hash
- $result_main = SQL_QUERY_ESC("SELECT password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
- array($GLOBALS['userid']), __FILE__, __LINE__);
- if (SQL_NUMROWS($result_main) == 1) {
- // Load hash from database
- list($hashDB) = SQL_FETCHROW($result_main);
-
- // Extract salt from cookie
- $salt = substr(get_session('u_hash'), 0, -40);
-
- // Now let's compare passwords
- $hash = generatePassString($hashDB);
- if (($hash == get_session('u_hash')) || (REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
- // Load user's data
- $result = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, country, zip, city, email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND password='%s' LIMIT 1",
- array($GLOBALS['userid'], $hashDB), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
- // Load the data
- $DATA = SQL_FETCHROW($result);
-
- // Free result
- SQL_FREERESULT($result);
-
- // Translate gender
- $DATA[0] = TRANSLATE_GENDER($DATA[0]);
-
- // Clear/init the content variable
- $content = "";
- $DATA['info'] = "";
-
- switch ($mod)
- {
- case "mydata":
- foreach ($modes as $mode) {
- switch ($mode)
- {
- case "normal": break; // Do not add any special lines
-
- case "email": // Email was changed!
- $content = MEMBER_CHANGED_EMAIL.": ".REQUEST_POST('old_addy')."\n";
- break;
-
- case "pass": // Password was changed
- $content = MEMBER_CHANGED_PASS."\n";
- break;
-
- default:
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown mode %s detected.", $mode));
- $content = MEMBER_UNKNOWN_MODE.": ".$mode."\n\n";
- break;
- } // END - switch
- } // END - if
-
- if (EXT_IS_ACTIVE("country")) {
- // Replace code with description
- $DATA[4] = COUNTRY_GENERATE_INFO(REQUEST_POST('country_code'));
- } // END - if
-
- // Load template
- $msg = LOAD_EMAIL_TEMPLATE("member_mydata_notify", $content, $GLOBALS['userid']);
-
- if (getConfig('admin_notify') == "Y") {
- // The admin needs to be notified about a profile change
- $msg_admin = "admin_mydata_notify";
- $sub_adm = ADMIN_CHANGED_DATA;
- } else {
- // No mail to admin
- $msg_admin = "";
- $sub_adm = "";
- }
-
- // Set subject lines
- $sub_mem = MEMBER_CHANGED_DATA;
-
- // Output success message
- $content = "<span class=\"member_done\">".MYDATA_MAIL_SENT."</span>";
- break;
-
- default:
- DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unsupported module %s detected.", $mod));
- $content = "<span class=\"member_failed\">".UNKNOWN_MODULE."</span>";
- break;
- } // END - switch
- } else {
- // Could not load profile data
- $content = "<span class=\"member_failed\">{--MEMBER_CANNOT_LOAD_PROFILE--}</span>";
- }
- } else {
- // Passwords mismatch
- $content = "<span class=\"member_failed\">{--MEMBER_PASSWORD_ERROR--}</span>";
- }
- } else {
- // Could not load profile
- $content = "<span class=\"member_failed\">{--MEMBER_CANNOT_LOAD_PROFILE--}</span>";
- }
-
- // Send email to user if required
- if ((!empty($sub_mem)) && (!empty($msg))) {
- // Send member mail
- SEND_EMAIL($DATA[7], $sub_mem, $msg);
- } // END - if
-
- // Send only if no other error has occured
- if (empty($content)) {
- if ((!empty($sub_adm)) && (!empty($msg_admin))) {
- // Send admin mail
- SEND_ADMIN_NOTIFICATION($sub_adm, $msg_admin, $content, $GLOBALS['userid']);
- } elseif (getConfig('admin_notify') == "Y") {
- // Cannot send mails to admin!
- $content = getMessage('CANNOT_SEND_ADMIN_MAILS');
- } else {
- // No mail to admin
- $content = "<span class=\"member_done\">{--MYDATA_MAIL_SENT--}</span>";
- }
- } // END - if
-
- // Load template
- LOAD_TEMPLATE("admin_settings_saved", false, $content);
-}
-// Update module counter
-function COUNT_MODULE($mod) {
- if ($mod != "css") {
- // Do count all other modules but not accesses on CSS file css.php!
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET clicks=clicks+1 WHERE module='%s' LIMIT 1",
- array($mod), __FILE__, __LINE__);
- } // END - if
-}