Commit 45d6c874ab231ed47129205ae533b0d8087bee2d
1 parent
efde4764
Exists in
master
and in
7 other branches
Crítica no uso da função xdbase passando a usar a função dbase quando a extensão…
… dbase estiver instalada no PHP.
Showing
1 changed file
with
20 additions
and
5 deletions
Show diff stats
classesphp/funcoes_gerais.php
| @@ -1603,11 +1603,17 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | @@ -1603,11 +1603,17 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | ||
| 1603 | if ($data == "") | 1603 | if ($data == "") |
| 1604 | { | 1604 | { |
| 1605 | $def[] = array("ID","C","50"); | 1605 | $def[] = array("ID","C","50"); |
| 1606 | - $db = xbase_create($nomeshp.".dbf", $def); | ||
| 1607 | - $dbname = $nomeshp.".dbf"; | ||
| 1608 | $reg[] = 0; | 1606 | $reg[] = 0; |
| 1609 | - xbase_add_record($db,$reg); | ||
| 1610 | - xbase_close($db); | 1607 | + if(!function_exists("dbase_create")){ |
| 1608 | + $db = xbase_create($nomeshp.".dbf", $def); | ||
| 1609 | + xbase_add_record($db,$reg); | ||
| 1610 | + xbase_close($db); | ||
| 1611 | + } | ||
| 1612 | + else{ | ||
| 1613 | + $db = dbase_create($nomeshp.".dbf", $def); | ||
| 1614 | + dbase_add_record($db,$reg); | ||
| 1615 | + dbase_close($db); | ||
| 1616 | + } | ||
| 1611 | $s = $layer->getshape(-1,0); | 1617 | $s = $layer->getshape(-1,0); |
| 1612 | $result = $layer->getResult(0); | 1618 | $result = $layer->getResult(0); |
| 1613 | $shpi = $result->shapeindex; | 1619 | $shpi = $result->shapeindex; |
| @@ -1629,7 +1635,10 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | @@ -1629,7 +1635,10 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | ||
| 1629 | // | 1635 | // |
| 1630 | $def[] = array($temp,"C","254"); | 1636 | $def[] = array($temp,"C","254"); |
| 1631 | } | 1637 | } |
| 1632 | - $db = xbase_create($nomeshp.".dbf", $def); | 1638 | + if(!function_exists("dbase_create")) |
| 1639 | + {$db = xbase_create($nomeshp.".dbf", $def);} | ||
| 1640 | + else | ||
| 1641 | + {$db = dbase_create($nomeshp.".dbf", $def);} | ||
| 1633 | $dbname = $nomeshp.".dbf"; | 1642 | $dbname = $nomeshp.".dbf"; |
| 1634 | $reg = array(); | 1643 | $reg = array(); |
| 1635 | $novoshpf = ms_newShapefileObj($nomeshp.".shp", -2); | 1644 | $novoshpf = ms_newShapefileObj($nomeshp.".shp", -2); |
| @@ -1659,10 +1668,16 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | @@ -1659,10 +1668,16 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) | ||
| 1659 | $reg[] = $shape->values[$ni]; | 1668 | $reg[] = $shape->values[$ni]; |
| 1660 | } | 1669 | } |
| 1661 | $novoshpf->addShape($shape); | 1670 | $novoshpf->addShape($shape); |
| 1671 | + if(!function_exists("dbase_create")) | ||
| 1662 | xbase_add_record($db,$reg); | 1672 | xbase_add_record($db,$reg); |
| 1673 | + else | ||
| 1674 | + dbase_add_record($db,$reg); | ||
| 1663 | $reg = array(); | 1675 | $reg = array(); |
| 1664 | } | 1676 | } |
| 1677 | + if(!function_exists("dbase_create")) | ||
| 1665 | xbase_close($db); | 1678 | xbase_close($db); |
| 1679 | + else | ||
| 1680 | + dbase_close($db); | ||
| 1666 | $novoshpf->free(); | 1681 | $novoshpf->free(); |
| 1667 | $layer->close(); | 1682 | $layer->close(); |
| 1668 | } | 1683 | } |