bernd commited on 2010-12-30 09:15:44
Zeige 3 geänderte Dateien mit 17 Einfügungen und 3 Löschungen.
git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@1862 87cf0b9e-d624-0410-a070-f6ee81989793
... | ... |
@@ -134,7 +134,8 @@ if ($output_something) |
134 | 134 |
|
135 | 135 |
foreach ($users as $user) |
136 | 136 |
{ |
137 |
- $username = str_replace('_', '_ ', $user['username']); |
|
137 |
+ $username = $user["username"]; |
|
138 |
+ //$username = str_replace('_', '_ ', $user['username']); |
|
138 | 139 |
$desc = ($user['description'] ? $user['description'].' (Erstellt: '.$user['created'].')' : 'Erstellt: '.$user['created']); |
139 | 140 |
$form .= "<th><span title=\"{$desc}\">{$username}</span><br />".internal_link("", icon_delete("Benutzer »{$user['username']}« löschen"), "action=delete_user&user={$user['username']}")."</th>"; |
140 | 141 |
} |
... | ... |
@@ -145,8 +146,9 @@ if ($output_something) |
145 | 146 |
|
146 | 147 |
foreach($dbs as $db) |
147 | 148 |
{ |
149 |
+ $phpmyadmin = "https://mysql." . server_for_database($db['id']) . "/"; |
|
148 | 150 |
$desc = ($db['description'] ? $db['description'].' (Erstellt: '.$db['created'].')' : 'Erstellt: '.$db['created']); |
149 |
- $form .= "<tr><td style=\"border: 0px; font-weight: bold; text-align: right;\"><span title=\"{$desc}\">{$db['name']}</span> ".internal_link("", icon_delete("Datenbank »{$db['name']}« löschen"), "action=delete_db&db={$db['name']}")."</td>"; |
|
151 |
+ $form .= "<tr><td style=\"border: 0px; font-weight: bold; text-align: right;\"><span title=\"{$desc}\">{$db['name']}</span> ".internal_link("", icon_delete("Datenbank »{$db['name']}« löschen"), "action=delete_db&db={$db['name']}")." <a href=\"".$phpmyadmin."\">".other_icon("database_go.png", "Datenbank-Verwaltung über phpMyAdmin")."</a></td>"; |
|
150 | 152 |
foreach ($users as $user) |
151 | 153 |
$form .= '<td style="text-align: center;"><input type="checkbox" id="'.$db['name'].'_'.$user['username'].'" name="access['.$db['name'].'][]" value="'.$user['username'].'" '.(get_mysql_access($db['name'], $user['username']) ? 'checked="checked" ' : '')." /></td>"; |
152 | 154 |
$form .= "</tr>\n"; |
... | ... |
@@ -17,7 +17,7 @@ function get_mysql_accounts($UID) |
17 | 17 |
function get_mysql_databases($UID) |
18 | 18 |
{ |
19 | 19 |
$UID = (int) $UID; |
20 |
- $result = db_query("SELECT name, description, created FROM misc.mysql_database WHERE useraccount=$UID"); |
|
20 |
+ $result = db_query("SELECT id, name, description, created FROM misc.mysql_database WHERE useraccount=$UID"); |
|
21 | 21 |
if (mysql_num_rows($result) == 0) |
22 | 22 |
return array(); |
23 | 23 |
$list = array(); |
... | ... |
@@ -29,6 +29,18 @@ function get_mysql_databases($UID) |
29 | 29 |
} |
30 | 30 |
|
31 | 31 |
|
32 |
+function server_for_database($id) |
|
33 |
+{ |
|
34 |
+ $id = (int) $id; |
|
35 |
+ |
|
36 |
+ $result = db_query("SELECT hostname FROM misc.mysql_database AS db LEFT JOIN system.useraccounts AS u ON (db.useraccount=u.uid) LEFT JOIN system.servers ON (COALESCE(db.server, u.server) = servers.id) WHERE db.id={$id}"); |
|
37 |
+ if (mysql_num_rows($result) != 1) |
|
38 |
+ system_failure("Fehler beim auslesen des zuständigen Servers"); |
|
39 |
+ $s = mysql_fetch_assoc($result); |
|
40 |
+ return $s["hostname"]; |
|
41 |
+} |
|
42 |
+ |
|
43 |
+ |
|
32 | 44 |
function get_mysql_access($db, $account) |
33 | 45 |
{ |
34 | 46 |
$uid = $_SESSION['userinfo']['uid']; |
35 | 47 |