Hilfsfunktionen bzgl. mehrerer Server
bernd

bernd commited on 2009-12-08 16:23:10
Zeige 1 geänderte Dateien mit 33 Einfügungen und 0 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1534 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -33,6 +33,39 @@ function redirect($target)
33 33
 }
34 34
 
35 35
 
36
+function my_server_id()
37
+{
38
+  $uid = (int) $_SESSION['userinfo']['uid'];
39
+  $result = db_query("SELECT server FROM system.useraccounts WHERE uid={$uid}");
40
+  $r = mysql_fetch_assoc($result);
41
+  DEBUG($r);
42
+  return $r['server'];
43
+}
44
+
45
+
46
+function additional_servers()
47
+{
48
+  $uid = (int) $_SESSION['userinfo']['uid'];
49
+  $result = db_query("SELECT server FROM system.user_server WHERE uid={$uid}");
50
+  $servers = array();
51
+  while ($s = mysql_fetch_assoc($result))
52
+    $servers[] = $s['server'];
53
+  DEBUG($servers);
54
+  return $servers;
55
+}
56
+
57
+
58
+function server_names()
59
+{
60
+  $result = db_query("SELECT id, hostname FROM system.servers");
61
+  $servers = array();
62
+  while ($s = mysql_fetch_assoc($result))
63
+    $servers[$s['id']] = $s['hostname'];
64
+  DEBUG($servers);
65
+  return $servers;
66
+}
67
+
68
+
36 69
 function db_query($query)
37 70
 {
38 71
   DEBUG($query);
39 72