/** * Send activation email * @param $email */ public static function Reactivate($email) { global $objSettings; // deny all operations in demo version if (strtolower(SITE_MODE) == 'demo') { self::$static_error = _OPERATION_BLOCKED; return false; } if (!empty($email)) { if (check_email_address($email)) { $sql = 'SELECT id, first_name, last_name, user_name, registration_code, preferred_language, is_active '; if (!PASSWORDS_ENCRYPTION) { $sql .= ', user_password '; } else { if (strtolower(PASSWORDS_ENCRYPTION_TYPE) == 'aes') { $sql .= ', AES_DECRYPT(user_password, \'' . PASSWORDS_ENCRYPT_KEY . '\') as user_password '; } else { if (strtolower(PASSWORDS_ENCRYPTION_TYPE) == 'md5') { $sql .= ', \'\' as user_password '; } } } $sql .= 'FROM ' . TABLE_CUSTOMERS . ' WHERE email = \'' . $email . '\''; $temp = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY); if (is_array($temp) && count($temp) > 0) { if ($temp['registration_code'] != '' && $temp['is_active'] == '0') { //////////////////////////////////////////////////////// if (!PASSWORDS_ENCRYPTION) { $user_password = $temp['user_password']; } else { if (strtolower(PASSWORDS_ENCRYPTION_TYPE) == 'aes') { $user_password = $temp['user_password']; } else { if (strtolower(PASSWORDS_ENCRYPTION_TYPE) == 'md5') { $user_password = get_random_string(8); $sql = 'UPDATE ' . TABLE_CUSTOMERS . ' SET user_password = \'' . md5($user_password) . '\' WHERE id = ' . $temp['id']; database_void_query($sql); } } } send_email($email, $objSettings->GetParameter('admin_email'), 'new_account_created_confirm_by_email', array('{FIRST NAME}' => $temp['first_name'], '{LAST NAME}' => $temp['last_name'], '{USER NAME}' => $temp['user_name'], '{USER PASSWORD}' => $user_password, '{REGISTRATION CODE}' => $temp['registration_code'], '{WEB SITE}' => $_SERVER['SERVER_NAME'], '{BASE URL}' => APPHP_BASE, '{YEAR}' => date('Y')), $temp['preferred_language']); //////////////////////////////////////////////////////// return true; } else { self::$static_error = _EMAILS_SENT_ERROR; return false; } } else { self::$static_error = _EMAIL_NOT_EXISTS; return false; } } else { self::$static_error = _EMAIL_IS_WRONG; return false; } } else { self::$static_error = _EMAIL_EMPTY_ALERT; return false; } return true; }