Commit 1b382d015601ffd88cda1ae27613ca8907060f7d
1 parent
a507d35d
Exists in
master
and in
7 other branches
--no commit message
Showing
1 changed file
with
8 additions
and
3 deletions
Show diff stats
pacotes/kmlmapserver/classes/layerserver.class.php
| ... | ... | @@ -248,8 +248,9 @@ class LayerServer { |
| 248 | 248 | */ |
| 249 | 249 | function add_networklink(&$layer_name){ |
| 250 | 250 | $nl =& $this->_xml->Document->addChild('NetworkLink'); |
| 251 | - | |
| 252 | 251 | $layer = @$this->map_object->getLayerByName($layer_name); |
| 252 | + if(!$layer) | |
| 253 | + {$layer = $this->map_object->getlayer(0);} | |
| 253 | 254 | $nl->addChild('name', $this->get_layer_description($layer)); |
| 254 | 255 | $nl->addChild('visibility', 0); |
| 255 | 256 | $link =& $nl->addChild('Link'); |
| ... | ... | @@ -264,7 +265,8 @@ class LayerServer { |
| 264 | 265 | function process_layer_request(&$layer_name){ |
| 265 | 266 | error_reporting(0); |
| 266 | 267 | $layer = @$this->map_object->getLayerByName($layer_name); |
| 267 | - | |
| 268 | + if(!$layer) | |
| 269 | + {$layer = $this->map_object->getlayer(0);} | |
| 268 | 270 | if(!$layer){ |
| 269 | 271 | $this->set_error('Nenhum layer com esse nome foi encontrado no mapfile ' . $layer_name, $layer_name); |
| 270 | 272 | return false; |
| ... | ... | @@ -992,7 +994,10 @@ class LayerServer { |
| 992 | 994 | */ |
| 993 | 995 | function get_cache_file_name(){ |
| 994 | 996 | //obtem o arquivo do metadata do layer se existir |
| 995 | - $k = $this->map_object->getlayerbyname($this->typename)->getmetadata("arquivokmz"); | |
| 997 | + $layer = @$this->map_object->getlayerbyname($this->typename); | |
| 998 | + if(!$layer) | |
| 999 | + {$layer = $this->map_object->getlayer(0);} | |
| 1000 | + $k = $layer->getmetadata("arquivokmz"); | |
| 996 | 1001 | if($k != ""){ |
| 997 | 1002 | return $k; |
| 998 | 1003 | } | ... | ... |