8ee6d10ab2cc5383de0ccfdded680a5628c644b9
bernd Webalizer/Statistik-Funktio...

bernd authored 14 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) */
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

16) 
17) require_once("inc/icons.php");
18) 
19) require_once("vhosts.php");
20) 
21) require_role(ROLE_SYSTEMUSER);
22) 
bernd Benutze überall title() sta...

bernd authored 13 years ago

23) title("Zugriffs-Statistiken");
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

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

Hanno authored 5 years ago

25) if (isset($_REQUEST['vhost'])) {
26)     $v = get_vhost_details($_REQUEST['vhost']);
27) 
28)     if (isset($_REQUEST['public'])) {
29)         $v['stats'] = ($_REQUEST['public'] == 1) ? 'public' : 'private';
30)     }
31)     if (isset($_REQUEST['action'])) {
32)         if ($_REQUEST['action'] == 'delete') {
33)             $v['stats'] = null;
34)         } elseif ($_REQUEST['action'] == 'new') {
35)             check_form_token('stats_new');
36)         }
37)     }
38)     save_vhost($v);
39)     redirect('stats');
40) } else {
41)     $all_vhosts = list_vhosts();
42)     $stats_vhosts = array();
43) 
44)     foreach ($all_vhosts as $v) {
45)         if ($v['stats']) {
46)             $stats_vhosts[] = $v;
47)         }
48)     }
49) 
50) 
51)     output('<p>Um die Reichweite und das Publikum Ihrer Internet-Seiten besser einschätzen zu können, besteht die Möglichkeit aus den ggf. vorhandenen Webserver-Logfiles grafisch aufbereitete Statistiken erstellen zu lassen.</p>
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

52) 
53) <h3>Statistiken für Ihre Seiten</h3>
54) ');
55) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

56)     if (count($stats_vhosts) > 0) {
57)         output('
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

58)   <table><tr><th>Für Website</th><th>Öffentlich abrufbar?</th><th>Operationen</th></tr>
59)   ');
60) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

61)         foreach ($stats_vhosts as $v) {
62)             output("<tr>");
63)             output("<td>".internal_link('showstats', $v['fqdn'], "vhost={$v['id']}")."</td>");
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

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

Hanno authored 5 years ago

65)             if ($v['stats'] == 'public') {
66)                 output("<td><a href=\"http://".config('stats_hostname')."/{$v['fqdn']}\">".icon_enabled("Diese Statistiken können von jedermann aufgerufen werden. Klicken Sie hier um die öffentliche Version zu sehen.")."</a></td>");
67)             } else {
68)                 output("<td>".icon_disabled("Diese Statistiken können nur hier im Webinterface betrachtet werden.")."</td>");
69)             }
Hanno remove whitespace in empty...

Hanno authored 5 years ago

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

Hanno authored 5 years ago

71)             output("<td>");
72)             if ($v['stats'] == 'public') {
73)                 output(internal_link("", other_icon("lock.png", "Statistiken nicht mehr öffentlich anzeigen"), "vhost={$v['id']}&public=0"));
74)             } else {
75)                 output(internal_link("", other_icon("world.png", "Statistiken veröffentlichen"), "vhost={$v['id']}&public=1"));
76)             }
77)             output(" &#160; ".internal_link("", icon_delete("Diese Statistiken löschen"), "vhost={$v['id']}&action=delete")."</td>");
78)             output("</tr>");
79)         }
80)         output('</table>');
81)     } else {
82)         output('<em>Für Ihre Seiten werden bisher keine Statistiken erzeugt</em>');
83)     }
84) 
85) 
86)     output("<h3>Weitere Statistiken</h3>");
87) 
88)     $sel = array();
89)     foreach ($all_vhosts as $v) {
90)         if ($v['logtype']) {
91)             $found = false;
92)             foreach ($stats_vhosts as $s) {
93)                 if ($s['id'] == $v['id']) {
94)                     $found = true;
95)                 }
96)             }
97)             if (! $found) {
98)                 $sel[$v['id']] = $v['fqdn'];
99)             }
100)         }
101)     }
102) 
103) 
104)     if (count($sel) > 0) {
105)         output(html_form('stats_new', '', 'action=new', "<p>".html_select("vhost", $sel).'<br/>
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

106) <input type="radio" name="public" id="public_0" value="0" checked="checked" /><label for="public_0"> Statistiken hier im Webinterface anzeigen</label><br />
bernd Hole Stats-Hostname aus mis...

bernd authored 14 years ago

107) <input type="radio" name="public" id="public_1" value="1" /><label for="public_1"> Statistiken unter '.config('stats_hostname').' veröffentlichen (Ohne Passwortschutz)</label><br />
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

108) <input type="submit" value="Neue Statistiken erzeugen" /></p>
109) '));
110) 
111) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

112)         output('
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

113) 
114) <p><strong>Hinweis:</strong> Die Statistiken werden mindestens täglich erzeugt. Bis zum ersten Durchlauf nach der Aktivierung der Statistik wird der obige Link eine Fehlermeldung erzeugen. Bitte warten Sie mindestens einen Tag ab bevor Sie die Statistik zum ersten Mal aufrufen.</p>
115) ');
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

116)     } else {
117)         # keine VHosts mehr verfügbar
Bernd Wurst Beschriftung im VHosts-Modu...

Bernd Wurst authored 5 years ago

118)         output('<p><em>Sie haben aktuell keine Websites, für die Protokolle erstellt aber noch nicht ausgewertet werden.</em></p>');
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

119)     }