Bernd Wurst commited on 2018-02-20 11:35:39
Zeige 6 geänderte Dateien mit 77 Einfügungen und 10 Löschungen.
... | ... |
@@ -375,7 +375,7 @@ function html_form($form_id, $scriptname, $querystring, $content) |
375 | 375 |
{ |
376 | 376 |
$querystring = encode_querystring($querystring); |
377 | 377 |
$ret = ''; |
378 |
- $ret .= '<form action="'.$scriptname.$querystring.'" method="post">'."\n"; |
|
378 |
+ $ret .= '<form id="'.$form_id.'" action="'.$scriptname.$querystring.'" method="post">'."\n"; |
|
379 | 379 |
$ret .= '<p style="display: none;"><input type="hidden" name="formtoken" value="'.generate_form_token($form_id).'" /></p>'."\n"; |
380 | 380 |
$ret .= $content; |
381 | 381 |
$ret .= '</form>'; |
... | ... |
@@ -45,8 +45,12 @@ $section = 'domains_domains'; |
45 | 45 |
|
46 | 46 |
// Block zuständiger Useraccount |
47 | 47 |
|
48 |
+$is_current_user = true; |
|
48 | 49 |
$useraccounts = list_useraccounts(); |
49 | 50 |
if (have_role(ROLE_CUSTOMER) && count($useraccounts) > 1) { |
51 |
+ if ($dom->useraccount != $_SESSION['userinfo']['uid']) { |
|
52 |
+ $is_current_user = false; |
|
53 |
+ } |
|
50 | 54 |
// Mehrere User vorhanden |
51 | 55 |
$options = array(); |
52 | 56 |
foreach ($useraccounts as $u) { |
... | ... |
@@ -61,6 +65,36 @@ if (have_role(ROLE_CUSTOMER) && count($useraccounts) > 1) { |
61 | 65 |
} |
62 | 66 |
|
63 | 67 |
|
68 |
+// Block Nutzung |
|
69 |
+ |
|
70 |
+if ($is_current_user) { |
|
71 |
+ $used = false; |
|
72 |
+ output("<h4>Aktuelle Nutzung dieser Domain</h4>"); |
|
73 |
+ if (have_module('dns') && $dom->dns == 1 && dns_in_use($dom->id)) { |
|
74 |
+ output("<p>Es sind manuell gesetzte DNS-Einträge unter dieser Domain aktiv. ".internal_link('../dns/dns_domain', '→ Bearbeiten', 'dom='.$dom->id)."</p>"); |
|
75 |
+ $used = true; |
|
76 |
+ } |
|
77 |
+ if (have_module('email') && mail_in_use($dom->id)) { |
|
78 |
+ output("<p>Es gibt E-Mail-Postfächer unter dieser Domain ".internal_link('../email/vmail', '→ Bearbeiten', 'domain='.$dom->fqdn)."</p>"); |
|
79 |
+ $used = true; |
|
80 |
+ } |
|
81 |
+ if (have_module('mailman') && mailman_subdomains($dom->id)) { |
|
82 |
+ output("<p>Diese Domain wird für Mailinglisten verwendet ".internal_link('../mailman/lists', '→ Bearbeiten')."</p>"); |
|
83 |
+ $used = true; |
|
84 |
+ } |
|
85 |
+ if (have_module('vhosts') && web_in_use($dom->id)) { |
|
86 |
+ output("<p>Es gibt Website-Einstellungen für diese Domain ".internal_link('../vhosts/vhosts', '→ Bearbeiten', 'filter='.$dom->fqdn)."</p>"); |
|
87 |
+ $used = true; |
|
88 |
+ } |
|
89 |
+ if (have_module('jabber') && $dom->jabber == 1) { |
|
90 |
+ output("<p>Diese Domain wird für Jabber verwendet ".internal_link('../jabber/accounts', '→ Bearbeiten')."</p>"); |
|
91 |
+ $used = true; |
|
92 |
+ } |
|
93 |
+ if (! $used) { |
|
94 |
+ output('<p><em>Aktuell wird diese Domain nicht verwendet!</em></p>'); |
|
95 |
+ } |
|
96 |
+} |
|
97 |
+ |
|
64 | 98 |
// Block Domain-Inhaber |
65 | 99 |
|
66 | 100 |
if (have_role(ROLE_CUSTOMER) && config('http.net-apikey') && $dom->provider == 'terions' && ($dom->cancel_date === NULL || $dom->cancel_date > date('Y-m-d'))) { |
... | ... |
@@ -50,14 +50,14 @@ function autoipv6_address($vhost_id, $mode = 1) |
50 | 50 |
} |
51 | 51 |
|
52 | 52 |
|
53 |
-function list_vhosts($domainname=NULL) |
|
53 |
+function list_vhosts($filter=NULL) |
|
54 | 54 |
{ |
55 | 55 |
$uid = (int) $_SESSION['userinfo']['uid']; |
56 | 56 |
$query = "SELECT vh.id,fqdn,domain,docroot,docroot_is_default,php,cgi,vh.certid AS cert, vh.ssl, vh.options,logtype,errorlog,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp, stats FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE uid=:uid ORDER BY domain,hostname"; |
57 | 57 |
$params = array(":uid" => $uid); |
58 |
- if ($domainname) { |
|
59 |
- $query = "SELECT vh.id,fqdn,domain,docroot,docroot_is_default,php,cgi,vh.certid AS cert, vh.ssl, vh.options,logtype,errorlog,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp, stats FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE domain=:domain AND uid=:uid ORDER BY hostname"; |
|
60 |
- $params[":domain"] = $domainname; |
|
58 |
+ if ($filter) { |
|
59 |
+ $query = "SELECT vh.id,fqdn,domain,docroot,docroot_is_default,php,cgi,vh.certid AS cert, vh.ssl, vh.options,logtype,errorlog,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp, stats FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE (vh.fqdn LIKE :filter OR vh.id IN (SELECT vhost FROM vhosts.v_alias WHERE fqdn LIKE :filter)) AND uid=:uid ORDER BY hostname"; |
|
60 |
+ $params[":filter"] = "%$filter%"; |
|
61 | 61 |
} |
62 | 62 |
$result = db_query($query, $params); |
63 | 63 |
$ret = array(); |
... | ... |
@@ -9,3 +9,15 @@ div.alias { |
9 | 9 |
font-size: 1.5em; |
10 | 10 |
font-weight: bold; |
11 | 11 |
} |
12 |
+ |
|
13 |
+input#filter { |
|
14 |
+ padding-right: 25px; |
|
15 |
+} |
|
16 |
+button#clear { |
|
17 |
+ width: 20px; |
|
18 |
+ margin-left: -22px; |
|
19 |
+ margin-right: 1em; |
|
20 |
+ padding: 0 5px; |
|
21 |
+ background-color: #fff; |
|
22 |
+ border: 0; |
|
23 |
+} |
... | ... |
@@ -18,6 +18,9 @@ require_once('inc/debug.php'); |
18 | 18 |
require_once('inc/security.php'); |
19 | 19 |
require_once('inc/icons.php'); |
20 | 20 |
|
21 |
+require_once('inc/jquery.php'); |
|
22 |
+javascript(); |
|
23 |
+ |
|
21 | 24 |
require_once('vhosts.php'); |
22 | 25 |
|
23 | 26 |
title("Subdomains"); |
... | ... |
@@ -32,12 +35,16 @@ output("<p>Mit dieser Funktion legen Sie fest, welche Domains und Subdomains als |
32 | 35 |
"); |
33 | 36 |
|
34 | 37 |
|
35 |
-$domain = NULL; |
|
36 |
-if (isset($_REQUEST['domain']) && $_REQUEST['domain'] != '') { |
|
37 |
- $domain = $_REQUEST['domain']; |
|
38 |
- output('<p class="warning"><strong>Filter aktiv!</strong> Momentan werden nur Einstellungen für die Domain <strong>'.filter_input_general($domain).'</strong> angezeigt. Klicken Sie '.internal_link('', 'hier', 'domain=').' um alle Einstellungen anzuzeigen.</p>'); |
|
38 |
+$filter = ""; |
|
39 |
+if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != '') { |
|
40 |
+ $filter = $_REQUEST['filter']; |
|
41 |
+} |
|
42 |
+if (isset($_REQUEST['clear']) && $_REQUEST['clear'] == 'X') { |
|
43 |
+ $filter = ""; |
|
39 | 44 |
} |
40 |
-$vhosts = list_vhosts($domain); |
|
45 |
+$vhosts = list_vhosts($filter); |
|
46 |
+ |
|
47 |
+ |
|
41 | 48 |
$traffic_sum = 0; |
42 | 49 |
$letsencrypt = false; |
43 | 50 |
foreach ($vhosts as $vh) { |
... | ... |
@@ -45,6 +52,11 @@ foreach ($vhosts as $vh) { |
45 | 52 |
$letsencrypt = true; |
46 | 53 |
} |
47 | 54 |
} |
55 |
+// Filter-Funktion |
|
56 |
+if (count($vhosts) > 10 || $filter) { |
|
57 |
+ $form = '<p><label for="filter">Filter für die Anzeige:</label> <input type="text" name="filter" id="filter" value="'.$filter.'"><button type="button" id="clear" title="Filter leeren">×</button><input type="submit" value="Filtern!"></p>'; |
|
58 |
+ output(html_form('vhosts_filter', 'vhosts', '', $form)); |
|
59 |
+} |
|
48 | 60 |
|
49 | 61 |
if (count($vhosts) > 0) |
50 | 62 |
{ |
... | ... |
@@ -194,6 +206,9 @@ if (count($vhosts) > 0) |
194 | 206 |
output('<p style="font-size: 90%;"><sup>*</sup>) Dieser Wert stellt den Datenverkehr dieser Website für die letzten 30 Tage dar.</p>'); |
195 | 207 |
output('<p style="font-size: 90%;"><sup>**</sup>) schwach geschriebene Pfadangaben bezeichnen die Standardeinstellung. Ist ein Pfad fett dargestellt, so haben Sie einen davon abweichenden Wert eingegeben.</p>'); |
196 | 208 |
} |
209 |
+elseif ($filter) { |
|
210 |
+ output("<p><strong><em>Keine Einträge für Ihre aktuellen Filterkrieterien.</em></strong></p>"); |
|
211 |
+} |
|
197 | 212 |
else // keine VHosts vorhanden |
198 | 213 |
{ |
199 | 214 |
output("<p><strong><em>Bisher haben Sie keine Domain bzw. Subdomain eingerichtet.</em></strong></p>"); |
200 | 215 |