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 | 1603 | if ($data == "") |
| 1604 | 1604 | { |
| 1605 | 1605 | $def[] = array("ID","C","50"); |
| 1606 | - $db = xbase_create($nomeshp.".dbf", $def); | |
| 1607 | - $dbname = $nomeshp.".dbf"; | |
| 1608 | 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 | 1617 | $s = $layer->getshape(-1,0); |
| 1612 | 1618 | $result = $layer->getResult(0); |
| 1613 | 1619 | $shpi = $result->shapeindex; |
| ... | ... | @@ -1629,7 +1635,10 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) |
| 1629 | 1635 | // |
| 1630 | 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 | 1642 | $dbname = $nomeshp.".dbf"; |
| 1634 | 1643 | $reg = array(); |
| 1635 | 1644 | $novoshpf = ms_newShapefileObj($nomeshp.".shp", -2); |
| ... | ... | @@ -1659,10 +1668,16 @@ function criaSHP($tema,$map_file,$locaplic,$dir_tmp,$nomeRand=TRUE) |
| 1659 | 1668 | $reg[] = $shape->values[$ni]; |
| 1660 | 1669 | } |
| 1661 | 1670 | $novoshpf->addShape($shape); |
| 1671 | + if(!function_exists("dbase_create")) | |
| 1662 | 1672 | xbase_add_record($db,$reg); |
| 1673 | + else | |
| 1674 | + dbase_add_record($db,$reg); | |
| 1663 | 1675 | $reg = array(); |
| 1664 | 1676 | } |
| 1677 | + if(!function_exists("dbase_create")) | |
| 1665 | 1678 | xbase_close($db); |
| 1679 | + else | |
| 1680 | + dbase_close($db); | |
| 1666 | 1681 | $novoshpf->free(); |
| 1667 | 1682 | $layer->close(); |
| 1668 | 1683 | } | ... | ... |