4 # type [access] {transfer, access}
5 # period [day] {day, week, month, year, thismonth}
8 if (isset($_GET["type"]) && $_GET["type"] === 'transfer')
13 $periods = array('day','week','month','year','thismonth');
14 if (isset($_GET["period"]) && in_array($_GET["period"], $periods, true) === true)
15 $period = $_GET["period"];
19 if (isset($_GET["site"]) && is_dir($_GET["site"]) && $_GET["site"][0] != '.')
20 $site = $_GET["site"];
26 if (isset($_GET["year"]) && is_numeric($_GET["year"]) && $_GET["year"] >= $minyear && $_GET["year"] <= $maxyear)
27 $year = $_GET["year"];
31 $thispage = explode('/', $_SERVER['REQUEST_URI']);
32 $thispage = $thispage[count($thispage)-1];
36 #include <infodrom.style>
38 <page func="Infodrom Oldenburg" title="Statistics">
42 function emit_image($site, $type, $period, $link)
44 $fname = sprintf ("%s/%s-%s.png", $site, $type, $period);
45 if (!is_file($fname)) return;
46 $size = getimagesize($fname);
48 echo ('<div style="padding-top: 1em"></div>');
49 echo ('<div align="center">');
51 printf ('<a href="%s">', $link);
52 printf ('<img src="%s" %s border="0" />',
61 while (($dent = readdir($dir)) !== false) {
62 if (!is_dir($dent) || $dent[0] == '.') continue;
63 if ($dent === 'total') continue;
70 foreach ($sites as $site) {
71 $link = sprintf("%s?type=%s&site=%s", $thispage, $type, urlencode($site));
72 emit_image ($site, $type, $period, $link);
74 $link = sprintf("%s?type=%s&site=%s", $thispage, $type, 'total');
75 emit_image ('total', $type, $period, $link);
77 if ($period === 'thismonth') {
78 for ($mon = 1; $mon <= 12; $mon++) {
79 emit_image($site, $type, sprintf('%04d-%02d', $year, $mon), '');
82 foreach ($periods as $period) {
83 if ($period == 'thismonth') {
84 $link = sprintf("%s?type=%s&period=thismonth&site=%s", $thispage, $type, urlencode($site));
85 emit_image ($site, $type, $period, $link);
87 emit_image ($site, $type, $period, '');
94 <div style="padding-top: 1em"></div>