Skip to content

Commit

Permalink
maps: check if map desc files exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Anrijs committed Jun 14, 2020
1 parent fc95ae7 commit 5c7b4e0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion www/map.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@
if(!is_dir($_R["layers"] . $l)) {
continue;
}
$name = file_get_contents($_R["layers"] . $l . "/name");
$name = $l;
if (file_exists($_R["layers"] . $l . "/name")) $name = file_get_contents($_R["layers"] . $l . "/name");
$ol = array();
$ol["name"] = trim(preg_replace('/\s\s+/', ' ', $name));
$ol["id"] = $l;
Expand Down
12 changes: 9 additions & 3 deletions www/maps.add2layer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@
$body .= "<h3>No valid map images found</h3>";
} else {
foreach ($layersf as $layer) {
$name = file_get_contents($_R["layers"] . $layer . "/name");
$zoom = file_get_contents($_R["layers"] . $layer . "/zoom");
$maps = explode(";",file_get_contents($_R["layers"] . $layer . "/maps"));
if (!is_dir($_R["layers"] . $layer)) continue;

$name = "";
$zoom = "";
$maps = array();

if (file_exists($_R["layers"] . $layer . "/name")) $name = file_get_contents($_R["layers"] . $layer . "/name");
if (file_exists($_R["layers"] . $layer . "/zoom")) $zoom = file_get_contents($_R["layers"] . $layer . "/zoom");
if (file_exists($_R["layers"] . $layer . "/maps")) $maps = explode(";",file_get_contents($_R["layers"] . $layer . "/maps"));

$body .= '<form action="maps.layer.process.php" method="post">';
$body .= '<input type="hidden" name="luid" id="luid" value="'.$layer.'">';
Expand Down
5 changes: 5 additions & 0 deletions www/maps.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ function regenerateInfo($target_dir, $target_file) {
continue;
}

$name = $map;
$fsize = 0;

if (!file_exists($_R["maps"] . $map . "/name")) continue;

$name = file_get_contents($_R["maps"] . $map . "/name");
$fname = $map;
$fsize = dirsize($_R["maps"].$map);
Expand Down

0 comments on commit 5c7b4e0

Please sign in to comment.