3ef995c2108fe77d22c0b556fb9717cb848bc48f
bernd neues VHosts-Modul (unbenut...

bernd authored 18 years ago

1) <?php
Hanno Böck Add newlines before comment...

Hanno Böck authored 11 months ago

2) 
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 13 years ago

3) /*
4) This file belongs to the Webinterface of schokokeks.org Hosting
5) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 3 years ago

6) Written by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 13 years ago

7)   Bernd Wurst <bernd@schokokeks.org>
8)   Hanno Böck <hanno@schokokeks.org>
9) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 3 years ago

10) This code is published under a 0BSD license.
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 13 years ago

11) 
12) 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.
13) */
14) 
bernd neues VHosts-Modul (unbenut...

bernd authored 18 years ago

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

bernd authored 16 years ago

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

bernd authored 18 years ago

18) 
Bernd Wurst removed jquery and jqueryUI...

Bernd Wurst authored 2 years ago

19) require_once('inc/javascript.php');
Bernd Wurst Domain-Nutzung mit Deeplink...

Bernd Wurst authored 7 years ago

20) javascript();
21) 
bernd neues VHosts-Modul (unbenut...

bernd authored 18 years ago

22) require_once('vhosts.php');
23) 
Bernd Wurst Beschriftung im VHosts-Modu...

Bernd Wurst authored 6 years ago

24) title("Websites");
bernd neues VHosts-Modul (unbenut...

bernd authored 18 years ago

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

bernd authored 18 years ago

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

bernd authored 18 years ago

30) 
Bernd Wurst Beschriftung im VHosts-Modu...

Bernd Wurst authored 6 years ago

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

bernd authored 18 years ago

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

bernd authored 18 years ago

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

bernd authored 18 years ago

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

Bernd Wurst authored 7 years ago

36) $filter = "";
37) if (isset($_REQUEST['filter']) && $_REQUEST['filter'] != '') {
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 7 years ago

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

Bernd Wurst authored 12 years ago

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

Bernd Wurst authored 10 years ago

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

Hanno authored 7 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 7 years ago

50) // Filter-Funktion
51) if (count($vhosts) > 10 || $filter) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

52)     $form = '<p><label for="filter">Filter für die Anzeige:</label> <input type="text" name="filter" id="filter" value="' . filter_output_html($filter) . '"><button type="button" id="clear" title="Filter leeren">&times;</button><input type="submit" value="Filtern!"></p>';
Bernd Wurst Domain-Nutzung mit Deeplink...

Bernd Wurst authored 7 years ago

53)     output(html_form('vhosts_filter', 'vhosts', '', $form));
54) }
bernd neues VHosts-Modul (unbenut...

bernd authored 18 years ago

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

Hanno authored 7 years ago

56) if (count($vhosts) > 0) {
57)     /*
58)     if ($letsencrypt) {
59)       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.");
60)       warning("Die Bereitstellung eines Zertifikats von Let's Encrypt kann momentan bis zu 15 Minuten in Anspruch nehmen.");
61)     }
62)     */
63)     if (count($vhosts) > 10) {
Bernd Wurst Beschriftung im VHosts-Modu...

Bernd Wurst authored 6 years ago

64)         addnew('edit', 'Neue Website einrichten');
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

65)     }
Bernd Wurst Beschriftung im VHosts-Modu...

Bernd Wurst authored 6 years ago

66)     output("<table><tr><th>Haupt-Adresse</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");
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

67) 
68)     $even = true;
69) 
70)     foreach ($vhosts as $vhost) {
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 2 years ago

71)         $even = !$even;
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

72)         $fqdn = $vhost['fqdn'];
73)         $class = 'odd';
74)         if ($even) {
75)             $class = 'even';
76)         }
77)         $proto = 'http';
78)         if ($vhost['ssl'] == 'https' || $vhost['ssl'] == 'forward') {
79)             $proto = 'https';
80)         }
81)         $linkuri = $vhost['fqdn'];
82)         if (strstr($vhost['options'], 'aliaswww')) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

83)             $linkuri = "www." . $vhost['fqdn'];
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

84)         }
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

85)         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>");
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

86)         $aliases = get_all_aliases($vhost);
87)         $tmp = '';
88)         if (count($aliases) > 0) {
89)             foreach ($aliases as $alias) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

90)                 $tmp .= $alias['fqdn'] . '<br />';
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

91)             }
92)         } else {
93)             $tmp = '<em>- keine -</em>';
94)         }
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

95)         output(internal_link('aliases', $tmp, 'vhost=' . $vhost['id'], 'title="Aliase verwalten"'));
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

96)         output('</td>');
97)         $logfiles = 'Kein Log';
98)         if ($vhost['logtype'] == 'default') {
99)             $logfiles = 'Zugriffe ';
100)         } elseif ($vhost['logtype'] == 'anonymous') {
101)             $logfiles = 'Anonym';
102)         }
103)         if ($vhost['errorlog'] == 1) {
104)             if ($vhost['logtype'] == null) {
105)                 $logfiles = 'Fehler';
106)             } else {
107)                 $logfiles .= ' + Fehler';
108)             }
109)         }
Bernd Wurst Logfile-Status wieder angez...

Bernd Wurst authored 6 years ago

110)         output("<td>{$logfiles}</td>");
111) 
Hanno remove whitespace in empty...

Hanno authored 7 years ago

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

Hanno authored 7 years ago

113)         if ($vhost['ssl'] == 'http') {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

114)             output("<td>" . icon_disabled('HTTPS ausgeschaltet') . "</td>");
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

115)         } elseif (strstr($vhost['options'], "letsencrypt") && $vhost['cert']) {
116)             $forward = '';
117)             if ($vhost['ssl'] == 'forward') {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

118)                 $forward = " " . other_icon("refresh.png", 'Auf HTTPS umleiten');
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

119)             } else {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

120)                 $forward = " " . other_icon("warning.png", 'Ungeschützter Aufruf weiterhin möglich');
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

121)             }
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

122)             output("<td>" . other_icon("letsencrypt.png", "Automatische Zertifikatsverwaltung mit Let's Encrypt") . $forward . "</td>");
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

123)         } elseif ($vhost['cert']) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

124)             output("<td>" . other_icon("key.png", "HTTPS mit eigenem Zertifikat") . "</td>");
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

125)         } elseif (strstr($vhost['options'], "letsencrypt")) {
126)             // Letsencrypt gewählt aber noch nicht aktiv
127)             $message = "Let's Encrypt-Zertifikat ist noch nicht bereit";
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

128)             output("<td>" . other_icon("letsencrypt.png", $message) . icon_warning($message) . "</td>");
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

129)         } else {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

130)             output("<td>" . icon_enabled('HTTPS eingeschaltet') . "</td>");
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

131)         }
132) 
133)         $traffic = traffic_month($vhost['id']);
134)         $traffic_sum += (int) $traffic;
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

135)         $traffic_string = $traffic . ' MB';
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

136)         if ($traffic > 1024) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

137)             $traffic_string = round($traffic / 1024, 2) . ' GB';
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

138)         }
139)         if ($traffic === null) {
140)             $traffic_string = '--';
141)         }
142)         output("<td style=\"text-align: right;\">{$traffic_string}</td>");
143) 
144)         if ($vhost['is_webapp'] == 1) {
145)             output('<td colspan="2"><em><strong>Sonderanwendung:</strong> Vorinstallierte Webanwendung</em></td>');
146)         } elseif ($vhost['is_dav'] == 1) {
147)             output('<td colspan="2"><em><strong>Sonderanwendung:</strong> WebDAV</em></td>');
148)         } elseif ($vhost['is_svn'] == 1) {
149)             output('<td colspan="2"><em><strong>Sonderanwendung:</strong> Subversion-Server</em></td>');
150)         } else {
151)             $php = $vhost['php'];
Bernd Wurst read available php versions...

Bernd Wurst authored 7 years ago

152)             $phpinfo = valid_php_versions($php);
Bernd Wurst added php version tag "defa...

Bernd Wurst authored 5 years ago

153)             if ($php == 'default') {
154)                 $php_default_version = null;
155)                 foreach ($phpinfo as $v) {
156)                     if ($v['default'] == true) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

157)                         $php_default_version = $v['major'] . '.' . $v['minor'];
Bernd Wurst added php version tag "defa...

Bernd Wurst authored 5 years ago

158)                     }
159)                 }
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

160)                 $php = icon_enabled('PHP in der empfohlenen Version eingeschaltet (' . $php_default_version . ')');
Bernd Wurst added php version tag "defa...

Bernd Wurst authored 5 years ago

161)             } elseif (array_key_exists($php, $phpinfo)) {
Bernd Wurst read available php versions...

Bernd Wurst authored 7 years ago

162)                 $phpinfo = $phpinfo[$php];
163)                 /* To create new PHP icon:
Hanno Böck better php icons

Hanno Böck authored 2 years ago

164)                    convert ok.png -font "DejaVu-Sans-Book" -pointsize 10  -gravity center -draw "text 0,0 '7.2'" ok-php72.png
Bernd Wurst read available php versions...

Bernd Wurst authored 7 years ago

165)                 */
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

166)                 $php = icon_enabled_phpxx('PHP in Version ' . $phpinfo['major'] . '.' . $phpinfo['minor'] . ' eingeschaltet', $phpinfo['major'], $phpinfo['minor']);
Bernd Wurst read available php versions...

Bernd Wurst authored 7 years ago

167)                 if ($phpinfo['status'] == 'deprecated') {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

168)                     $php .= ' ' . icon_warning('Diese PHP-Version ist veraltet!');
Bernd Wurst Bestandsschutz für eigentli...

Bernd Wurst authored 7 years ago

169)                 } elseif ($phpinfo['status'] == 'used') {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

170)                     $php .= ' ' . icon_warning('Diese PHP-Version hat für Sie aktuell nur noch Bestandsschutz');
Bernd Wurst read available php versions...

Bernd Wurst authored 7 years ago

171)                 }
172)             } else {
173)                 $php = icon_disabled('PHP ausgeschaltet');
174)             }
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

175)             output("<td>{$php}</td>");
176)             if ($vhost['docroot_is_default'] == 1) {
177)                 output("<td><span style=\"color:#777;\">{$vhost['docroot']}</span></td>");
178)             } else {
179)                 output("<td><strong>{$vhost['docroot']}</strong></td>");
180)             }
181)         }
182)         output("</tr>\n");
183)     }
184)     output('</table>');
185)     if ($traffic_sum > 0) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

186)         $traffic_string = $traffic_sum . ' MB';
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

187)         if ($traffic_sum > 1024) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

188)             $traffic_string = round($traffic_sum / 1024, 2) . ' GB';
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

189)         }
Hanno Böck Spaces between string conca...

Hanno Böck authored 2 years ago

190)         output('<p><strong>Traffic insgesamt: ' . $traffic_string . '</strong> in den letzten 30 Tagen</p>');
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

191)     }
192)     output('<p style="font-size: 90%;"><sup>*</sup>)&#160;Dieser Wert stellt den Datenverkehr dieser Website für die letzten 30 Tage dar.</p>');
193)     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>');
194) } elseif ($filter) {
195)     output("<p><strong><em>Keine Einträge für Ihre aktuellen Filterkrieterien.</em></strong></p>");
196) } else { // keine VHosts vorhanden
Bernd Wurst Beschriftung im VHosts-Modu...

Bernd Wurst authored 6 years ago

197)     output("<p><strong><em>Bisher haben Sie keine Website eingerichtet.</em></strong></p>");
bernd Deutlich machen wenn keine...

bernd authored 16 years ago

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

bernd authored 18 years ago

199) 
Bernd Wurst Beschriftung im VHosts-Modu...

Bernd Wurst authored 6 years ago

200) addnew('edit', 'Neue Website einrichten');
bernd addnew() eingeführt

bernd authored 16 years ago

201)