aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2012-03-13 17:16:09 -0400
committerJoey Hess <joey@kitenet.net>2012-03-13 17:55:47 -0400
commita1d7aad40119cd3f2bc970fc7ce10625d0da7106 (patch)
tree072423db8cac699481913785c7ba1ca186227dbc
parenta0e071739405787cb1c0c7151c62567178cd2e8c (diff)
downloadikiwiki-a1d7aad40119cd3f2bc970fc7ce10625d0da7106.tar
ikiwiki-a1d7aad40119cd3f2bc970fc7ce10625d0da7106.tar.gz
fix writing of kml file
It just didn't work, but also, it didn't use writefile, which is not desirable for security. Fixed both issues. Also removed some unnecessary debug messages.
-rw-r--r--IkiWiki/Plugin/osm.pm17
1 files changed, 7 insertions, 10 deletions
diff --git a/IkiWiki/Plugin/osm.pm b/IkiWiki/Plugin/osm.pm
index 2b5d0d5f1..47c752881 100644
--- a/IkiWiki/Plugin/osm.pm
+++ b/IkiWiki/Plugin/osm.pm
@@ -341,8 +341,7 @@ sub writejson($;$) {
"geometry" => { "type" => "LineString", "coordinates" => $linestring });
push @{$geojson{'features'}}, \%json;
}
- debug('writing pois file pois.json in ' . $config{destdir} . "/$map");
- writefile("pois.json",$config{destdir} . "/$map",to_json(\%geojson));
+ writefile("pois.json", $config{destdir} . "/$map", to_json(\%geojson));
}
}
@@ -352,7 +351,6 @@ sub writekml($;$) {
eval q{use XML::Writer};
error $@ if $@;
foreach my $map (keys %waypoints) {
- debug("writing pois file pois.kml in " . $config{destdir} . "/$map");
=pod
Sample placemark:
@@ -388,10 +386,9 @@ Sample style:
=cut
- use IO::File;
- my $output = IO::File->new(">".$config{destdir} . "/$map/pois.kml");
-
- my $writer = XML::Writer->new( OUTPUT => $output, DATA_MODE => 1, ENCODING => 'UTF-8');
+ my $output;
+ my $writer = XML::Writer->new( OUTPUT => \$output,
+ DATA_MODE => 1, ENCODING => 'UTF-8');
$writer->xmlDecl();
$writer->startTag("kml", "xmlns" => "http://www.opengis.net/kml/2.2");
@@ -454,7 +451,8 @@ Sample style:
}
$writer->endTag();
$writer->end();
- $output->close();
+
+ writefile("pois.kmp", $config{destdir} . "/$map", $output);
}
}
@@ -472,8 +470,7 @@ sub writecsvs($;$) {
$options{'icon'} . "\n";
$poisf .= $line;
}
- debug("writing pois file pois.txt in " . $config{destdir} . "/$map");
- writefile("pois.txt",$config{destdir} . "/$map",$poisf);
+ writefile("pois.txt", $config{destdir} . "/$map", $poisf);
}
}