--- /dev/null
+#include <infodrom.style>
+#include "calendar.inc"
+
+<page func="Infodrom Oldenburg" title="Events">
+
+<?
+
+ $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
+ or die("Unable to connect to SQL server");
+
+ pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+ $query = "SELECT $event_cols FROM events WHERE ";
+ if (length ($key)) {
+ $where = sprintf ("name ~* '%s' OR city ~* '%s' OR url ~* '%s' OR comment ~* '%s' ",
+ addslashes ($key),addslashes ($key),addslashes ($key));
+ if (length ($country)) {
+ $where = sprintf ("country = '%s' AND ( %s ) ",
+ addslashes ($country), $where);
+ }
+ } else {
+ if (length ($country)) {
+ $where = sprintf ("country = '%s' ", addslashes ($country));
+ } else {
+ $where = '';
+ echo "<h3>Empty search? Euh?</h3>";
+ }
+ }
+ $query .= "ORDER BY start,name";
+
+ if (length ($where)) {
+ $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+ $year = 0;
+ for ($i=0; $i < pg_NumRows ($sth); $i++) {
+ $row = pg_fetch_array ($sth, $i);
+
+ $date = explode (" ", $row['start']);
+ $date = explode ("-", $date[0]);
+ $end = explode (" ", $row[3]);
+ $end = explode ("-", $end[0]);
+ $thisyear = $date[0];
+
+ $date = format_date ($date, $end);
+
+ if ($thisyear != $year) {
+ if ($year > 0) {
+ echo ($event_table_end);
+ }
+ $color = $nowcolor;
+ printf ("<h3>Upcoming events in %s</h3>", $thisyear);
+ echo ($event_table_start);
+ $year = $thisyear;
+ }
+
+ $row['name'] = ereg_replace (" ", " ", $row['name']);
+ $row['city'] = ereg_replace (" ", " ", $row['city']);
+ $row['country'] = ereg_replace (" ", " ", $row['country']);
+
+ printf ($event_row, $color, $row['oid'], $row['name'], $row['cancelled'] == 1?" *cancelled*":"",
+ $row['city'], $row['country'], $date);
+ }
+ }
+ echo ($event_table_end);
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end: