卡塞尔 & 格林兄弟童话与世界紧密相连

链接


param('do'); $links_file = "../intern/links.txt"; $img_path = "../img"; @events = (); $new_link = ''; #################################### sub HTMLenc { my $ret = shift; my $use_br = shift; $ret =~ s/&/&/g; $ret =~ s//>/g; $ret =~ s/"/"/g; $ret =~ s/\n/
\n/g if $use_br; return $ret; } sub read_links { my $use_br = shift; open FR, "< $links_file"; while () { chomp; next if !length($_); if ($use_br) { $_ =~ s/\\n/\n/g; $_ = HTMLenc($_,0); } my ($group,$lang,$link,$text) = split /\t/,$_,4; $link =~ s/^http:\/\///i; # http vorn entfernen, wird sp鋞er angeh鋘gt push @{$links{$group}}, "$lang\t$link\t$text"; } close FR; } sub write_links { open FW, "> $links_file"; foreach my $group (keys %links) { for (@{$links{$group}}) { if (length($group) && length($_)) { print FW "$group\t$_\n"; } } } close FW; } sub read_cgi { %links = (); for (my $i=0;$i<$cgi->param('count');$i++) { my ($group,$lang,$link,$text) = ($cgi->param("group$i"),$cgi->param("lang$i"),$cgi->param("link$i"),$cgi->param("text$i")); next if !$group || !$link; $link =~ s/^http:\/\///i; push @{$links{$group}}, "$lang\t$link\t$text"; } } ############################### read_links(); print "\n"; foreach $group (sort keys %links) { my $first = "\n"; for (sort @{$links{$group}}) { my ($lang,$link,$text) = split /\t/,$_,3; print ""; if (length $first) { print $first; $first = ''; } print "\n"; print "\n"; print "\n"; print "\n"; $count++; } } print "\n"; !>