838077f18b71321a685c84329342e6a711d22d09
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) 
5) Written 2008-2012 by schokokeks.org Hosting, namely
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) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
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) 
25) if (isset($_REQUEST['vhost']))
26) {
27)   $v = get_vhost_details($_REQUEST['vhost']);
28) 
29)   if (isset($_REQUEST['public']))
30)   {
31)     $v['stats'] = ($_REQUEST['public'] == 1) ? 'public' : 'private';
32)   }
33)   if (isset($_REQUEST['action']))
34)   {
35)     if ($_REQUEST['action'] == 'delete')
36)       $v['stats'] = NULL;
37)     elseif ($_REQUEST['action'] == 'new')
38)       check_form_token('stats_new');
39)   }
40)   save_vhost($v);
41)   redirect('stats');
42) }
43) else
44) {
45) 
46) $all_vhosts = list_vhosts();
47) $stats_vhosts = array();
48) 
49) foreach ($all_vhosts AS $v)
50)   if ($v['stats'])
51)     $stats_vhosts[] = $v;
52) 
53) 
bernd Benutze überall title() sta...

bernd authored 13 years ago

54) 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

55) 
56) <h3>Statistiken für Ihre Seiten</h3>
57) ');
58) 
59) if (count($stats_vhosts) > 0)
60) {
61)   output('
62)   <table><tr><th>Für Website</th><th>Öffentlich abrufbar?</th><th>Operationen</th></tr>
63)   ');
64) 
65)   foreach ($stats_vhosts AS $v)
66)   {
67)     output("<tr>");
68)     output("<td>".internal_link('showstats', $v['fqdn'], "vhost={$v['id']}")."</td>");
69) 
70)     if ($v['stats'] == 'public')
bernd Hole Stats-Hostname aus mis...

bernd authored 14 years ago

71)       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>");
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

72)     else
73)       output("<td>".icon_disabled("Diese Statistiken können nur hier im Webinterface betrachtet werden.")."</td>");
74)     
75)     output("<td>");
76)     if ($v['stats'] == 'public')
77)       output(internal_link("", other_icon("lock.png", "Statistiken nicht mehr öffentlich anzeigen"), "vhost={$v['id']}&public=0"));
78)     else
79)       output(internal_link("", other_icon("world.png", "Statistiken veröffentlichen"), "vhost={$v['id']}&public=1"));
80)     output(" &#160; ".internal_link("", icon_delete("Diese Statistiken löschen"), "vhost={$v['id']}&action=delete")."</td>");
81)     output("</tr>");
82)   
bernd Diverse XML-Fehler behoben

bernd authored 14 years ago

83) }
84) output('</table>');
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

85) }
86) else
87)   output('<em>Für Ihre Seiten werden bisher keine Statistiken erzeugt</em>');
88) 
89) 
90) output("<h3>Weitere Statistiken</h3>");
91) 
92) $sel = array();
93) foreach ($all_vhosts AS $v)
94) {
95)   if ($v['logtype'])
96)   {
97)     $found = False;
98)     foreach ($stats_vhosts AS $s)
99)       if ($s['id'] == $v['id'])
100)         $found = True;
101)     if (! $found)
102)       $sel[$v['id']] = $v['fqdn'];
103)   }
104) }
105) 
106) 
bernd Zeige Meldung an, wenn kein...

bernd authored 14 years ago

107) if (count($sel) > 0)
108) {
109) 
110)   output(html_form('stats_new', '', 'action=new', "<p>".html_select("vhost", $sel).'<br/>
bernd Webalizer/Statistik-Funktio...

bernd authored 14 years ago

111) <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

112) <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

113) <input type="submit" value="Neue Statistiken erzeugen" /></p>
114) '));
115) 
116) 
bernd Zeige Meldung an, wenn kein...

bernd authored 14 years ago

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

bernd authored 14 years ago

118) 
119) <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>
120) ');
bernd Zeige Meldung an, wenn kein...

bernd authored 14 years ago

121) }
122) else
123) {
124)   # keine VHosts mehr verfügbar
125)   output('<p><em>Sie haben aktuell keine Domains/Subdomains, für die Protokolle erstellt aber noch nicht ausgewertet werden.</em></p>');
126) }
127)