Update for new meeting culture
[infodrom.org/oldenburg.linux.de] / src / index.wml
1 #include <LUGO.style>
2 #include <tools.inc>
3
4 <?
5 setlocale(LC_TIME, "de_DE");
6
7 $max_news = 2;
8 $max_age = 7;
9 $newsdir = "News";
10 $datedb = "Termine/dates-".date("Y").".txt";
11 $max_days = 14;
12
13 function next_date()
14 {
15   global $max_days;
16   global $datedb;
17
18   $head = '<div class="news"><div class="datesbody"><h3 class="newstitle">%s</h3><div class="date">';
19   $head .= '<table class="font" cellpadding=2 cellspacing=0 width=100%%><tr class="head"><th>Wann</th><th>Was</th><th>Wo</th></tr>';
20   $foot = '</table></div></div></div>';
21   $row = '<tr class="%s"><td>%s</td><td>%s</td><td>%s</td></tr>';
22   $pivot = time() + 60*60*24*$max_days;
23   $now = mktime(0,0,0, date('m'), date('d'), date('Y'));
24
25   if (($dates = @fopen($datedb,'r')) !== false) {
26     $lines = array();
27     while (!feof($dates)) {
28       $line = fgets($dates, 200);
29
30       if (!preg_match("/\|OL\|/", $line))
31         continue;
32
33       if (preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})\|/", $line, $match)) {
34         $when = mktime(0,0,0, $match[2], $match[3], $match[1]);
35         if ($when > $pivot || $when < $now)
36           continue;
37         $lines[] = $line;
38       }
39     }
40
41     if (count($lines)) {
42       sort($lines);
43       echo '<div style="padding-top: 10px"></div>'."\n";
44       printf($head."\n", "Kommende Termine in Oldenburg");
45
46       foreach ($lines as $line) {
47         if (preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})\|([^\|]*)\|OL\|([^\|]*)\|([^\|]*)\|(.*)/", $line, $match)) {
48           $when = mktime(0,0,0, $match[2], $match[3], $match[1]);
49
50           if ($when == $now) {
51             $date = '<strong>heute, ' . $match[4].'</strong>';
52             $class = 'today';
53           } else {
54             $date = strftime("%e.%m.%y", $when) . ', ' . $match[4];
55             $class = ($class == 'row0'?'row1':'row0');
56           }
57
58           if (empty($match[7]))
59             $what = $match[5];
60           else
61             $what = '<a href="'.$match[7].'">'.$match[5].'</a>';
62
63           printf($row, $class, $date, $what, $match[6]);
64         }
65       }
66       echo $foot;
67     }
68   }
69 }
70 function display_news($when, $file)
71 {
72   global $newsdir;
73
74   $head = '<div class="news"><div class="newsbody"><h3 class="newstitle">%s</h3><div class="newscontent">';
75   $foot = '</div></div></div>';
76
77   $date = strftime("%e. %B %Y", $when);
78
79   if (($news = @fopen($newsdir.'/'.$file,'r')) !== false) {
80     $needp = 0;  // 0 = init, 1 = <p> need, 2 = no <p> needed
81
82     printf($head."\n", $date);
83     while (!feof($news)) {
84       $line = fgets($news, 200);
85
86       $line = str_replace ("\\\n", "", $line);
87
88       if ($needp == 0) {
89         if (substr($_, 0, 3) == "<p>") {
90           $needp = 2;
91         } else {
92           $needp = 1;
93           $line = '<p>'.$line;
94         }
95       }
96
97       echo $line;
98     }
99     if ($needp == 1)
100       echo '</p>';
101     echo $foot;
102   }
103 }
104
105 function newsbox()
106 {
107   global $max_news;
108   global $max_age;
109   global $newsdir;
110
111   setlocale(LC_TIME, "de_DE");
112
113   $pivot = time() - 60*60*24*$max_age;
114   $news = array();
115   if (is_dir($newsdir)) {
116     if ($dir = opendir($newsdir)) {
117       while (($file = readdir($dir)) !== false) {
118         if (!preg_match("/news-([0-9]{4})-([0-9]{2})-([0-9]{2})\.txt/", $file, $matches))
119           continue;
120         $when = mktime(0,0,0, $matches[2], $matches[3], $matches[1]);
121         if ($when < $pivot)
122           continue;
123         $news[$when] = $file;
124       }
125       closedir($dir);
126     }
127   }
128
129   if (count($news)) {
130     echo '<div style="padding-top: 10px"></div>'."\n";
131
132     krsort($news);
133
134     $cnt = 0;
135     foreach ($news as $time => $file) {
136       if ($cnt >= $max_news)
137         continue;
138       display_news($time, $file);
139       $cnt++;
140     }
141   }
142 }
143 ?>
144
145 <page>
146
147 <p>Die <strong>Linux User Group Oldenburg</strong> (LUGO) ist eine
148 Interessengemeinschaft für GNU/Linux und Freie Software in und um <a
149 href="http://www.oldenburg.de/">Oldenburg</a> in Niedersachsen.
150 Wir <a href="Termine/">treffen</a> uns unregelmäßig auf dem
151 Stammtisch und der <a href="http://www.linux-werkstatt-oldenburg.de/">Linux-Werkstatt</a>,
152 reden über GNU/Linux und verbessern unsere Systeme.  Daneben veranstalten wir in unregelmäßigen Abständen Vorträge,
153 Workshops, einen Brunch und eine öffentliche
154 Ausstellung mit Vorträgen.  Aus der LUGO hervorgegangen
155 ist der gemeinnützige <a href="http://www.ffis.de/">Verein zur
156 Förderung Freier Informationen und Software e.V.</a>.</p>
157
158 <?next_date()?>
159
160 <p>Wir pflegen bewußt kein Web-Forum für Diskussionen sondern laden
161 interessierte Anwender und Entwickler stattdessen ein, sich von
162 Angesicht zu Angesicht mit uns auf unseren <a
163 href="<root_prefix>Infos/stammtisch.html">Linux-Stammtischen</a> oder
164 in der <a href="http://www.linux-werkstatt-oldenburg.de/">Linux-Werkstatt</a>
165 zu unterhalten.  Zwischen den Stammtischen und für hartnäckige Probleme
166 nutzen wir eine <a href="<root_prefix>Infos/liste.html">\ 
167 Mailing-Liste</a>.</p>
168
169 <p>
170 <?newsbox()?>
171
172 </page>
173
174 # Local variables:
175 # mode: html
176 # mode: auto-fill
177 # end: