From 9118ee3a2c4f92bf447e04822c4135e9f1af8125 Mon Sep 17 00:00:00 2001
From: Hannes Riebl <hannes.riebl@sub.uni-goettingen.de>
Date: Fri, 18 Jul 2014 16:20:55 +0200
Subject: [PATCH] Remove spaces and diacritics from UIDs

---
 .../include/tgSqliteDB.class.php                   | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/info.textgrid.middleware.tgauth.tgaccount/include/tgSqliteDB.class.php b/info.textgrid.middleware.tgauth.tgaccount/include/tgSqliteDB.class.php
index 7fa3766..ede3c98 100644
--- a/info.textgrid.middleware.tgauth.tgaccount/include/tgSqliteDB.class.php
+++ b/info.textgrid.middleware.tgauth.tgaccount/include/tgSqliteDB.class.php
@@ -52,9 +52,17 @@ class tgSqliteDB {
   
   function getUserRequest($id) {
     $result = $this->query("SELECT * FROM user_request WHERE id=".$id);
-    
-    if ($result) return $result->fetchArray(SQLITE3_ASSOC);
-    else return false;
+
+    if ($result) {
+      $result = $result->fetchArray(SQLITE3_ASSOC);
+
+      $result["pref_uid"] = str_replace(" ", "", $result["pref_uid"]);
+      $result["perf_uid"] = iconv("UTF-8", "ASCII//TRANSLIT", $result["pref_uid"]);
+
+      return $result;
+    } else {
+      return false;
+    }
   }
   
   function insertUserRequest ($data) {
-- 
GitLab