if ($schritt eq "1")
{
$x = 0;
my $update_year = "$prog_lib/update";
opendir(DIR,$update_year) or die $!;
@update_years = grep{-d $update_year.'/'.$_ && $_ =~ /^\d{4}$/}readdir(DIR);
closedir(DIR);
my $year = ();
foreach $year (@update_years)
{
my $update_month = "$prog_lib/update/" . $year;
opendir(DIR,$update_month) or die $!;
@update_months = grep{-d $update_month.'/'.$_ && $_ =~ /^\d{2}$/}readdir(DIR);
closedir(DIR);
my $month = ();
foreach $month (@update_months)
{
my $update_day = "$prog_lib/update/" . $year . "/" . $month;
@update_days = ();
find(sub {push(@update_days,$_) unless $_ eq '.' or $_ eq '..' or $_ eq 'Thumbs.db'},$update_day);
my $day =();
foreach $day (@update_days)
{
my $filetoopen = "$prog_lib/update/" . $year . "/" . $month . "/" . $day;
open(FILE, "$filetoopen") or die $!;
@events = <FILE>;
close(FILE);
my @sortevents = sort{ $a <=> $b }@events;
foreach (@sortevents)
{
$x++;
my $beginn = ();
my $name = ();
my $veranstalter = ();
my $titel = ();
my $ort = ();
my $location = ();
my $am = ();
my $art = ();
my $mail = ();
my $url = ();
my $sonstiges = ();
my $ipaddress = ();
my $mday = ();
my $mon = ();
my $myear = ();
my $hour = ();
my $min = ();
my $time = ();
($beginn, $name, $veranstalter, $titel, $ort, $location, $am, $art, $mail, $url, $sonstiges, $ipaddress) = split(/\|/,$_);
# Timestamp errechnen für $day
eval
{
($mday, $mon, $myear) = split ('\.', $day, 3);
($hour, $min) = split ('\:', $beginn, 2);
$time = timelocal(00,$min,$hour,$mday,$mon-1,$myear);
};
# Ende Timestamp für $am
# Timestamp für Eintragszeit
my $timestamp = time();
# Timestamp für Eintragszeit
$dbh = DBI->connect( "$dbms:$dbname","$dbuser","$dbpasswd", {PrintError => 0, RaiseError => 1}) || die
"Verbindung zur Datenbank fehlgeschlagen: $DBI::errstr";
$sql = qq{INSERT INTO ${table_prefix}topic (name, veranstalter, veranstaltungsort, location, time, titel, mail, url, beschreibung, timestamp, poster_ip) VALUES(?,?,?,?,?,?,?,?,?,?,?)};
$sth = $dbh->prepare($sql) or die $dbh->errstr();
$sth->execute($name,$veranstalter,$ort,$location,$time,$titel,$mail,$url,$sonstiges,$timestamp,$ipaddress) or die $dbh->errstr();
}
}
}
}
print "Content-type: text/html\n\n";
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', "\n";
print "<html><head><title>Update</title>\n";
print "<style type=\"text/css\">
body{
color:
background-color:#EFF6FB;
}
a:link,a:active,a:visited{
color : #0B70A2;
}
td.update{
background-image:url(../../yambe/bilder/cellpic3a.gif);
}
</style>
</head>
<body>
<br />
<table align=\"center\" width=\"75%\" border=\"1\">
<tr>
<td>
<table width=\"100%\" border=\"0\">
<tr>
<td>
<center>
<font size=5 color=\"#000000\"><b>Willkommen beim Update von v1.x auf v2.0.0</b></font>
<br />
</center>
</td>
</tr>
</table>
<br />
<table width=\"100%\" border=\"0\">
<tr>
<td class=\"update\">
<center>
<font size=4 color=\"#000000\"><b>Update erfolgreich abgeschlossen</b></font>
</center>
</td>
</tr>
</table>
<br />
<form name=\"Schritt1\" method=post action=\"event.cgi\">
<input type=hidden name=\"schritt\" value=\"1\">
<center>
<b>Das Update wurde erfolgreich abgeschlossen, es wurden insgesamt $x Events hinzugefügt.<br />
<br/>
Klicken Sie jetzt auf \"YAMBE starten\" um YAMBE aufzurufen.</b>
</center>
<br />
<table width=\"100%\" border=\"0\">
<tr>
<td align=\"center\" class=\"update\" height=25></td>
</tr>
<tr>
<td>
<div align=\"center\">
<br />
<input type=\"submit\" name=\"Button2\" value=YAMBE starten>
</div>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
";
};