4b53992acd279ca46c5a12e40930639c942fb198
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
15) */
16) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

17) require_once('inc/debug.php');
18) require_once('inc/security.php');
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

19) require_once('inc/icons.php');
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

20) 
Bernd Wurst Domain-Nutzung mit Deeplink...

Bernd Wurst authored 6 years ago

21) require_once('inc/jquery.php');
22) javascript();
23) 
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

24) require_once('vhosts.php');
25) 
bernd Benutze überall title() sta...

bernd authored 13 years ago

26) title("Subdomains");
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

27) $error = '';
28) 
29) require_role(ROLE_SYSTEMUSER);
30) 
bernd VHost-Löschen als icon

bernd authored 16 years ago

31) global $prefix;
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

32) 
bernd Benutze überall title() sta...

bernd authored 13 years ago

33) output("<p>Mit dieser Funktion legen Sie fest, welche Domains und Subdomains als Webserver-Ressource verfügbar sein sollen und welches Verzeichnis die Dateien enthalten soll.</p>
bernd Beta-Hinweis im vhost-modul

bernd authored 16 years ago

34) <p>Änderungen an Ihren Einstellungen werden im 5-Minuten-Takt auf dem Server übernommen.</p>
35) ");
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

36) 
bernd Bugfix: Funktion-Dopplung v...

bernd authored 16 years ago

37) 
Bernd Wurst Domain-Nutzung mit Deeplink...

Bernd Wurst authored 6 years ago

38) $filter = "";
39) if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != '') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

40)     $filter = filter_input_general($_REQUEST['filter']);
Bernd Wurst Domain-Nutzung mit Deeplink...

Bernd Wurst authored 6 years ago

41) }
42) $vhosts = list_vhosts($filter);
43) 
44) 
Bernd Wurst Traffic-Statistik im Webint...

Bernd Wurst authored 11 years ago

45) $traffic_sum = 0;
Bernd Wurst Beta-Warnung bei aktivierte...

Bernd Wurst authored 8 years ago

46) $letsencrypt = false;
47) foreach ($vhosts as $vh) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

48)     if (strstr($vh['options'], 'letsencrypt')) {
49)         $letsencrypt = true;
50)     }
Bernd Wurst Beta-Warnung bei aktivierte...

Bernd Wurst authored 8 years ago

51) }
Bernd Wurst Domain-Nutzung mit Deeplink...

Bernd Wurst authored 6 years ago

52) // Filter-Funktion
53) if (count($vhosts) > 10 || $filter) {
54)     $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">&times;</button><input type="submit" value="Filtern!"></p>';
55)     output(html_form('vhosts_filter', 'vhosts', '', $form));
56) }
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

57) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

58) if (count($vhosts) > 0) {
59)     /*
60)     if ($letsencrypt) {
61)       warning("Sie haben für eine oder mehrere Domains die Nutzung eines Let's-Encrypt-Zertifikats aktiviert. Wir haben diese Funktion nach allgemeiner Verfügbarkeit von Let's Encrypt umgehend freigeschaltet und sind mit der ersten Erfahrungen sehr zufrieden. Dennoch befindet sich Let's Encrypt momentan im Beta-Betrieb (d.h. Testbetrieb). Störungen sind daher nicht auszuschließen.");
62)       warning("Die Bereitstellung eines Zertifikats von Let's Encrypt kann momentan bis zu 15 Minuten in Anspruch nehmen.");
63)     }
64)     */
65)     if (count($vhosts) > 10) {
66)         addnew('edit', 'Neue Domain bzw. Subdomain einrichten');
67)     }
68)     output("<table><tr><th>(Sub-)Domain</th><th></th><th>Zusätzliche Alias-Namen</th><th>Protokoll</th><th>HTTPS</th><th>Traffic<sup>*</sup></th><th>PHP</th><th>Lokaler Pfad<sup>**</sup></th></tr>\n");
69) 
70)     $even = true;
71) 
72)     foreach ($vhosts as $vhost) {
73)         $even = ! $even;
74)         $fqdn = $vhost['fqdn'];
75)         $class = 'odd';
76)         if ($even) {
77)             $class = 'even';
78)         }
79)         $proto = 'http';
80)         if ($vhost['ssl'] == 'https' || $vhost['ssl'] == 'forward') {
81)             $proto = 'https';
82)         }
83)         $linkuri = $vhost['fqdn'];
84)         if (strstr($vhost['options'], 'aliaswww')) {
85)             $linkuri = "www.".$vhost['fqdn'];
86)         }
87)         output("<tr class=\"{$class}\"><td>".internal_link('edit', $fqdn, "vhost={$vhost['id']}", 'title="Einstellungen bearbeiten"')."</td><td><a href=\"{$proto}://{$linkuri}\">".other_icon('world_link.png', 'Website aufrufen')."</a> ".internal_link('save', icon_delete("»{$vhost['fqdn']}« löschen"), 'action=delete&vhost='.$vhost['id'])."</td><td>");
88)         $aliases = get_all_aliases($vhost);
89)         $tmp = '';
90)         if (count($aliases) > 0) {
91)             foreach ($aliases as $alias) {
92)                 $tmp .= $alias['fqdn'].'<br />';
93)             }
94)         } else {
95)             $tmp = '<em>- keine -</em>';
96)         }
97)         output(internal_link('aliases', $tmp, 'vhost='.$vhost['id'], 'title="Aliase verwalten"'));
98)         output('</td>');
99)         $logfiles = 'Kein Log';
100)         if ($vhost['logtype'] == 'default') {
101)             $logfiles = 'Zugriffe ';
102)         } elseif ($vhost['logtype'] == 'anonymous') {
103)             $logfiles = 'Anonym';
104)         }
105)         if ($vhost['errorlog'] == 1) {
106)             if ($vhost['logtype'] == null) {
107)                 $logfiles = 'Fehler';
108)             } else {
109)                 $logfiles .= ' + Fehler';
110)             }
111)         }
112)         $stats = $vhost['stats'] ? internal_link("showstats", other_icon("chart_bar.png", "Statistiken anzeigen"), "vhost={$vhost['id']}").' ' : '';
113)         output("<td>{$stats}{$logfiles}</td>");
Hanno remove whitespace in empty...

Hanno authored 5 years ago

114) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

115)         if ($vhost['ssl'] == 'http') {
116)             output("<td>".icon_disabled('HTTPS ausgeschaltet')."</td>");
117)         } elseif (strstr($vhost['options'], "letsencrypt") && $vhost['cert']) {
118)             $forward = '';
119)             if ($vhost['ssl'] == 'forward') {
120)                 $forward = " ".other_icon("refresh.png", 'Auf HTTPS umleiten');
121)             } else {
122)                 $forward = " ".other_icon("warning.png", 'Ungeschützter Aufruf weiterhin möglich');
123)             }
124)             output("<td>".other_icon("letsencrypt.png", "Automatische Zertifikatsverwaltung mit Let's Encrypt").$forward."</td>");
125)         } elseif ($vhost['cert']) {
126)             output("<td>".other_icon("key.png", "HTTPS mit eigenem Zertifikat")."</td>");
127)         } elseif (strstr($vhost['options'], "letsencrypt")) {
128)             // Letsencrypt gewählt aber noch nicht aktiv
129)             $message = "Let's Encrypt-Zertifikat ist noch nicht bereit";
130)             output("<td>".other_icon("letsencrypt.png", $message).icon_warning($message)."</td>");
131)         } else {
132)             output("<td>".icon_enabled('HTTPS eingeschaltet')."</td>");
133)         }
134) 
135)         $traffic = traffic_month($vhost['id']);
136)         $traffic_sum += (int) $traffic;
137)         $traffic_string = $traffic.' MB';
138)         if ($traffic > 1024) {
139)             $traffic_string = round($traffic / 1024, 2).' GB';
140)         }
141)         if ($traffic === null) {
142)             $traffic_string = '--';
143)         }
144)         output("<td style=\"text-align: right;\">{$traffic_string}</td>");
145) 
146)         if ($vhost['is_webapp'] == 1) {
147)             output('<td colspan="2"><em><strong>Sonderanwendung:</strong> Vorinstallierte Webanwendung</em></td>');
148)         } elseif ($vhost['is_dav'] == 1) {
149)             output('<td colspan="2"><em><strong>Sonderanwendung:</strong> WebDAV</em></td>');
150)         } elseif ($vhost['is_svn'] == 1) {
151)             output('<td colspan="2"><em><strong>Sonderanwendung:</strong> Subversion-Server</em></td>');
152)         } else {
153)             $php = $vhost['php'];
Bernd Wurst read available php versions...

Bernd Wurst authored 5 years ago

154)             $phpinfo = valid_php_versions($php);
155)             if (array_key_exists($php, $phpinfo)) {
156)                 $phpinfo = $phpinfo[$php];
157)                 /* To create new PHP icon:
158)                    convert ok.png -gravity center -draw "text 0,0 '7.2'" ok-php72.png
159)                 */
160)                 $php = icon_enabled_phpxx('PHP in Version '.$phpinfo['major'].'.'.$phpinfo['minor'].' eingeschaltet', $phpinfo['major'], $phpinfo['minor']);
161)                 if ($phpinfo['status'] == 'deprecated') {
162)                     $php .= ' '.icon_warning('Diese PHP-Version ist veraltet!');
163)                 }
164)             } else {
165)                 $php = icon_disabled('PHP ausgeschaltet');
166)             }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

167)             output("<td>{$php}</td>");
168)             if ($vhost['docroot_is_default'] == 1) {
169)                 output("<td><span style=\"color:#777;\">{$vhost['docroot']}</span></td>");
170)             } else {
171)                 output("<td><strong>{$vhost['docroot']}</strong></td>");
172)             }
173)         }
174)         output("</tr>\n");
175)     }
176)     output('</table>');
177)     if ($traffic_sum > 0) {
178)         $traffic_string = $traffic_sum.' MB';
179)         if ($traffic_sum > 1024) {
180)             $traffic_string = round($traffic_sum / 1024, 2).' GB';
181)         }
182)         output('<p><strong>Traffic insgesamt: '.$traffic_string.'</strong> in den letzten 30 Tagen</p>');
183)     }
184)     output('<p style="font-size: 90%;"><sup>*</sup>)&#160;Dieser Wert stellt den Datenverkehr dieser Website für die letzten 30 Tage dar.</p>');
185)     output('<p style="font-size: 90%;"><sup>**</sup>)&#160;schwach geschriebene Pfadangaben bezeichnen die Standardeinstellung. Ist ein Pfad fett dargestellt, so haben Sie einen davon abweichenden Wert eingegeben.</p>');
186) } elseif ($filter) {
187)     output("<p><strong><em>Keine Einträge für Ihre aktuellen Filterkrieterien.</em></strong></p>");
188) } else { // keine VHosts vorhanden
189)     output("<p><strong><em>Bisher haben Sie keine Domain bzw. Subdomain eingerichtet.</em></strong></p>");
bernd Deutlich machen wenn keine...

bernd authored 14 years ago

190) }
bernd neues VHosts-Modul (unbenut...

bernd authored 16 years ago

191) 
bernd addnew() eingeführt

bernd authored 14 years ago

192) addnew('edit', 'Neue Domain bzw. Subdomain einrichten');
193)