e9b63255568ea139d01349d6b2b3b529581c9c60
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) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

5) Written 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) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 16 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

17) 
Bernd Wurst removed jquery and jqueryUI...

Bernd Wurst authored 1 year ago

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

Bernd Wurst authored 6 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 5 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 5 years ago

30) 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 16 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 4 years ago

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

Bernd Wurst authored 6 years ago

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

Bernd Wurst authored 11 years ago

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

Bernd Wurst authored 8 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 8 years ago

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

Bernd Wurst authored 6 years ago

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

Hanno Böck authored 6 months ago

51)     $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 6 years ago

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

bernd authored 16 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 5 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 5 years ago

65)     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 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

84)         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 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 4 years ago

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

Hanno authored 5 years ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 5 years ago

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

Bernd Wurst authored 3 years ago

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

Hanno Böck authored 6 months ago

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

Bernd Wurst authored 3 years ago

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

Hanno Böck authored 6 months ago

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

Bernd Wurst authored 3 years ago

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

Bernd Wurst authored 5 years ago

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

Hanno Böck authored 5 months ago

163)                    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 5 years ago

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

Hanno Böck authored 6 months ago

165)                 $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 5 years ago

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

Hanno Böck authored 6 months ago

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

Bernd Wurst authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Bernd Wurst authored 5 years ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Hanno Böck authored 6 months ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 5 years ago

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

bernd authored 14 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 5 years ago

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

bernd authored 14 years ago

200)