exec.php
1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
include_once(dirname(__FILE__)."/../inicia.php");
//
//faz a busca da função que deve ser executada
//
$retorno = ""; //string que será retornada ao browser via JSON
switch (strtoupper($funcao))
{
/*
Valor: APLICAR
Aplica a substituicao de chaves pelos valores enviados
*/
case "APLICAR":
$map = ms_newMapObj($map_file);
$layer = $map->getlayerbyname($tema);
$data = $layer->data;
//verifica se o layer ja teve os parametros substituidos anteriormente
//nesse caso, o data he obtido do metadata que guarda o valor original
if($layer->getmetadata("DATAORIGINAL") != ""){
$data = $layer->getmetadata("DATAORIGINAL");
}
else{
$layer->setmetadata("DATAORIGINAL",$data);
}
$chaves = explode(",",$chaves);
$valores = explode(",",$valores);
$n = count($chaves);
for($i = 0; $i < $n; $i++){
$data = str_replace($chaves[$i],$valores[$i],$data);
}
$layer->set("data",$data);
$layer->set("status",MS_DEFAULT);
$layer->setmetadata("PLUGINI3GEO","");
$layer->setmetadata("TEMA",$layer->getmetadata("TEMA")." - ".implode(",",$valores));
$layer->set("name","plugin".nomeRandomico());
if (connection_aborted()){
exit();
}
$salvo = $map->save($map_file);
$retorno = "ok";
break;
case "REMOVER":
$map = ms_newMapObj($map_file);
$layer = $map->getlayerbyname($tema);
if($layer != ""){
$layer->set("status",MS_DELETE);
$salvo = $map->save($map_file);
}
$retorno = "ok";
break;
case "INCLUDEPROG":
if(file_exists($locaplic."/".$prog)){
include($locaplic."/".$prog);
}
break;
}
if (!connection_aborted()){
cpjson($retorno);
}
else
{exit();}
?>