Commit d9dedd7ddfb97e9d02b2f0cfc597e4b428d780c6

Authored by Edmar Moretti
1 parent 5e46d3be
Exists in master and in 1 other branch docker

Implantação do log de transações #62

Showing 2 changed files with 192 additions and 127 deletions   Show diff stats
admin/admin.db
No preview for this file type
admin/php/menutemas.php
... ... @@ -880,8 +880,7 @@ function alteraMenus()
880 880 i3GeoAdminUpdate($dbhw,"i3geoadmin_menus",$dataCol,"WHERE id_menu = $id_menu");
881 881 $retorna = "ok";
882 882 }
883   - else
884   - {
  883 + else{
885 884 $dataCol = array(
886 885 "en" => "",
887 886 "es" => "",
... ... @@ -898,13 +897,11 @@ function alteraMenus()
898 897 $dbh = null;
899 898 return $retorna;
900 899 }
901   - catch (PDOException $e)
902   - {
  900 + catch (PDOException $e){
903 901 return "Error!: " . $e->getMessage();
904 902 }
905 903 }
906   -function alteraPerfis()
907   -{
  904 +function alteraPerfis(){
908 905 global $perfil,$id,$esquemaadmin;
909 906 try
910 907 {
... ... @@ -912,69 +909,88 @@ function alteraPerfis()
912 909 include("conexao.php");
913 910 if($convUTF) $perfil = utf8_encode($perfil);
914 911 $retorna = "";
915   - if($id != "")
916   - {
  912 + if($id != ""){
917 913 $original = "";
918   - foreach($dbh->query("select * from ".$esquemaadmin."i3geoadmin_perfis where id_perfil = $id") as $row)
919   - {
  914 + foreach($dbh->query("select * from ".$esquemaadmin."i3geoadmin_perfis where id_perfil = $id") as $row){
920 915 $original = $row["perfil"];
921 916 }
922   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_perfis SET perfil = '$perfil' WHERE id_perfil = $id");
923   - if($original != "")
924   - {
  917 + $dataCol = array(
  918 + "perfil" => $perfil
  919 + );
  920 + i3GeoAdminUpdate($dbhw,"i3geoadmin_perfis",$dataCol,"WHERE id_perfil = $id");
  921 +
  922 + if($original != ""){
925 923 $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_mapas");
926   - foreach($q as $row)
927   - {
  924 + foreach($q as $row){
928 925 $t = $row['perfil_mapa'];
929 926 $i = $row['id_mapa'];
930 927 $ts = str_replace($original,$perfil,$t);
931   - if($t != $ts)
932   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_mapas SET perfil_mapa = '$ts' WHERE id_mapa = $i");
  928 + if($t != $ts){
  929 + $dataCol = array(
  930 + "perfil_mapa" => $ts
  931 + );
  932 + i3GeoAdminUpdate($dbhw,"i3geoadmin_mapas",$dataCol,"WHERE id_mapa = $i");
  933 + }
933 934 }
934 935 $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_menus");
935   - foreach($q as $row)
936   - {
  936 + foreach($q as $row){
937 937 $t = $row['perfil_menu'];
938 938 $i = $row['id_menu'];
939 939 $ts = str_replace($original,$perfil,$t);
940   - if($t != $ts)
941   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_menus SET perfil_menu = '$ts' WHERE id_menu = $i");
  940 + if($t != $ts){
  941 + $dataCol = array(
  942 + "perfil_menu" => $ts
  943 + );
  944 + i3GeoAdminUpdate($dbhw,"i3geoadmin_menus",$dataCol,"WHERE id_menu = $i");
  945 + }
942 946 }
943 947 $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_n1");
944   - foreach($q as $row)
945   - {
  948 + foreach($q as $row){
946 949 $t = $row['n1_perfil'];
947 950 $i = $row['id_n1'];
948 951 $ts = str_replace($original,$perfil,$t);
949   - if($t != $ts)
950   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_n1 SET n1_perfil = '$ts' WHERE id_n1 = $i");
  952 + if($t != $ts){
  953 + $dataCol = array(
  954 + "n1_perfil" => $ts
  955 + );
  956 + i3GeoAdminUpdate($dbhw,"i3geoadmin_n1",$dataCol,"WHERE id_n1 = $i");
  957 + }
951 958 }
952 959 $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_n2");
953   - foreach($q as $row)
954   - {
  960 + foreach($q as $row){
955 961 $t = $row['n2_perfil'];
956 962 $i = $row['id_n2'];
957 963 $ts = str_replace($original,$perfil,$t);
958   - if($t != $ts)
959   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_n2 SET n2_perfil = '$ts' WHERE id_n2 = $i");
  964 + if($t != $ts){
  965 + $dataCol = array(
  966 + "n2_perfil" => $ts
  967 + );
  968 + i3GeoAdminUpdate($dbhw,"i3geoadmin_n2",$dataCol,"WHERE id_n2 = $i");
  969 + }
960 970 }
961 971 $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_n3");
962   - foreach($q as $row)
963   - {
  972 + foreach($q as $row){
964 973 $t = $row['n3_perfil'];
965 974 $i = $row['id_n3'];
966 975 $ts = str_replace($original,$perfil,$t);
967   - if($t != $ts)
968   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_n3 SET n3_perfil = '$ts' WHERE id_n3 = $i");
  976 + if($t != $ts){
  977 + $dataCol = array(
  978 + "n3_perfil" => $ts
  979 + );
  980 + i3GeoAdminUpdate($dbhw,"i3geoadmin_n3",$dataCol,"WHERE id_n3 = $i");
  981 + }
969 982 }
970 983 $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_raiz");
971   - foreach($q as $row)
972   - {
  984 + foreach($q as $row){
973 985 $t = $row['perfil'];
974 986 $i = $row['id_raiz'];
975 987 $ts = str_replace($original,$perfil,$t);
976   - if($t != $ts)
977   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_raiz SET perfil = '$ts' WHERE id_raiz = $i");
  988 + if($t != $ts){
  989 + $dataCol = array(
  990 + "perfil" => $ts
  991 + );
  992 + i3GeoAdminUpdate($dbhw,"i3geoadmin_raiz",$dataCol,"WHERE id_raiz = $i");
  993 + }
978 994 }
979 995 $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_sistemas");
980 996 foreach($q as $row)
... ... @@ -982,24 +998,33 @@ function alteraPerfis()
982 998 $t = $row['perfil_sistema'];
983 999 $i = $row['id_sistema'];
984 1000 $ts = str_replace($original,$perfil,$t);
985   - if($t != $ts)
986   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_sistemas SET perfil_sistema = '$ts' WHERE id_sistema = $i");
  1001 + if($t != $ts){
  1002 + $dataCol = array(
  1003 + "perfil_sistema" => $ts
  1004 + );
  1005 + i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemas",$dataCol,"WHERE id_sistema = $i");
  1006 + }
987 1007 }
988 1008 $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_sistemasf");
989   - foreach($q as $row)
990   - {
  1009 + foreach($q as $row){
991 1010 $t = $row['perfil_funcao'];
992 1011 $i = $row['id_funcao'];
993 1012 $ts = str_replace($original,$perfil,$t);
994   - if($t != $ts)
995   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_sistemasf SET perfil_funcao = '$ts' WHERE id_funcao = $i");
  1013 + if($t != $ts){
  1014 + $dataCol = array(
  1015 + "perfil_funcao" => $ts
  1016 + );
  1017 + i3GeoAdminUpdate($dbhw,"i3geoadmin_sistemasf",$dataCol,"WHERE id_funcao = $i");
  1018 + }
996 1019 }
997 1020 }
998 1021 $retorna = $id;
999 1022 }
1000   - else
1001   - {
1002   - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_perfis (perfil) VALUES ('$perfil')");
  1023 + else{
  1024 + $dataCol = array(
  1025 + "perfil" => $perfil
  1026 + );
  1027 + i3GeoAdminInsert($dbhw,"i3geoadmin_perfis",$dataCol);
1003 1028 $id = $dbh->query("SELECT * FROM ".$esquemaadmin."i3geoadmin_perfis");
1004 1029 $id = $id->fetchAll();
1005 1030 $id = intval($id[count($id)-1]['id_perfil']);
... ... @@ -1009,37 +1034,36 @@ function alteraPerfis()
1009 1034 $dbh = null;
1010 1035 return $retorna;
1011 1036 }
1012   - catch (PDOException $e)
1013   - {
  1037 + catch (PDOException $e){
1014 1038 return "Error!: " . $e->getMessage();
1015 1039 }
1016 1040 }
1017   -function alteraTags()
1018   -{
  1041 +function alteraTags(){
1019 1042 global $nome,$id,$esquemaadmin;
1020   - try
1021   - {
  1043 + try{
1022 1044 $dbh = "";
1023 1045 include("conexao.php");
1024 1046 if($convUTF) $nome = utf8_encode($nome);
1025 1047 $retorna = "";
1026   - if($id != "")
1027   - {
1028   - if(!verificaDuplicados("select * from ".$esquemaadmin."i3geoadmin_tags where nome = '$nome'",$dbh))
1029   - {
  1048 + if($id != ""){
  1049 + if(!verificaDuplicados("select * from ".$esquemaadmin."i3geoadmin_tags where nome = '$nome'",$dbh)){
1030 1050 $original = "";
1031 1051 $q = $dbh->query("select * from ".$esquemaadmin."i3geoadmin_tags where id_tag = $id");
1032   - foreach($q as $row)
1033   - {
  1052 + foreach($q as $row){
1034 1053 $original = $row["nome"];
1035 1054 }
1036   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_tags SET nome = '$nome' WHERE id_tag = $id");
  1055 + $dataCol = array(
  1056 + "nome" => $nome
  1057 + );
  1058 + i3GeoAdminUpdate($dbhw,"i3geoadmin_tags",$dataCol,"WHERE id_tag = $id");
1037 1059 }
1038 1060 $retorna = $id;
1039 1061 }
1040   - else
1041   - {
1042   - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_tags (nome) VALUES ('$nome')");
  1062 + else{
  1063 + $dataCol = array(
  1064 + "nome" => $nome
  1065 + );
  1066 + i3GeoAdminInsert($dbhw,"i3geoadmin_tags",$dataCol);
1043 1067 $id = $dbh->query("SELECT * FROM ".$esquemaadmin."i3geoadmin_tags");
1044 1068 $id = $id->fetchAll();
1045 1069 $id = intval($id[count($id)-1]['id_tag']);
... ... @@ -1049,8 +1073,7 @@ function alteraTags()
1049 1073 $dbh = null;
1050 1074 return $retorna;
1051 1075 }
1052   - catch (PDOException $e)
1053   - {
  1076 + catch (PDOException $e){
1054 1077 return "Error!: " . $e->getMessage();
1055 1078 }
1056 1079 }
... ... @@ -1060,35 +1083,40 @@ Altera o registro de um grupo. Se id for vazio acrescenta o registro
1060 1083 function alteraGrupos()
1061 1084 {
1062 1085 global $nome_grupo,$desc_grupo,$id_grupo,$en,$es,$it,$esquemaadmin;
1063   - try
1064   - {
  1086 + try{
1065 1087 require(dirname(__FILE__)."/conexao.php");
1066   - if($convUTF)
1067   - {
  1088 + if($convUTF){
1068 1089 $nome_grupo = utf8_encode($nome_grupo);
1069 1090 $desc_grupo = utf8_encode($desc_grupo);
1070 1091 $en = utf8_encode($en);
1071 1092 $es = utf8_encode($es);
1072 1093 $it = utf8_encode($it);
1073 1094 }
1074   - if($id_grupo != "")
1075   - {
1076   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_grupos SET en = '$en', es = '$es', it = '$it', nome_grupo = '$nome_grupo', desc_grupo = '$desc_grupo' WHERE id_grupo = $id_grupo");
  1095 + if($id_grupo != ""){
  1096 + $dataCol = array(
  1097 + "en" => $en,
  1098 + "es" => $es,
  1099 + "it" => $it,
  1100 + "nome_grupo" => $nome_grupo,
  1101 + "desc_grupo" => $desc_grupo
  1102 + );
  1103 + i3GeoAdminUpdate($dbhw,"i3geoadmin_grupos",$dataCol,"WHERE id_grupo = $id_grupo");
1077 1104 }
1078   - else
1079   - {
1080   - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_grupos (nome_grupo, desc_grupo, en, es, it) VALUES ('$nome_grupo', '','','','')");
1081   - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_grupos where nome_grupo = '$nome_grupo'";
1082   - $q = $dbh->query($sql,PDO::FETCH_ASSOC);
1083   - $resultado = $q->fetchAll();
1084   - $id_grupo = $resultado[0]["id_grupo"];
  1105 + else{
  1106 + $dataCol = array(
  1107 + "nome_grupo" => $nome_grupo,
  1108 + "desc_grupo" => "",
  1109 + "en" => "",
  1110 + "es" => "",
  1111 + "it" => ""
  1112 + );
  1113 + $id_grupo = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_grupos",$dataCol,"nome_grupo","id_grupo");
1085 1114 }
1086 1115 $dbhw = null;
1087 1116 $dbh = null;
1088 1117 return $id_grupo;
1089 1118 }
1090   - catch (PDOException $e)
1091   - {
  1119 + catch (PDOException $e){
1092 1120 return "Error!: " . $e->getMessage();
1093 1121 }
1094 1122 }
... ... @@ -1109,14 +1137,24 @@ function alteraSubGrupos()
1109 1137 }
1110 1138 $retorna = "";
1111 1139 if($id_subgrupo != ""){
1112   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_subgrupos SET en = '$en', es = '$es', it = '$it', nome_subgrupo = '$nome_subgrupo', desc_subgrupo = '$desc_subgrupo' WHERE id_subgrupo = $id_subgrupo");
  1140 + $dataCol = array(
  1141 + "en" => $en,
  1142 + "es" => $es,
  1143 + "it" => $it,
  1144 + "nome_subgrupo" => $nome_subgrupo,
  1145 + "desc_subgrupo" => $desc_subgrupo
  1146 + );
  1147 + i3GeoAdminUpdate($dbhw,"i3geoadmin_subgrupos",$dataCol,"WHERE id_subgrupo = $id_subgrupo");
1113 1148 }
1114 1149 else{
1115   - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_subgrupos (nome_subgrupo, desc_subgrupo, en, es, it) VALUES ('$nome_subgrupo', '','','','')");
1116   - $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_subgrupos where nome_subgrupo = '$nome_subgrupo'";
1117   - $q = $dbh->query($sql,PDO::FETCH_ASSOC);
1118   - $resultado = $q->fetchAll();
1119   - $id_subgrupo = $resultado[0]["id_subgrupo"];
  1150 + $dataCol = array(
  1151 + "nome_subgrupo" => $nome_subgrupo,
  1152 + "desc_subgrupo" => "",
  1153 + "en" => "",
  1154 + "es" => "",
  1155 + "it" => ""
  1156 + );
  1157 + $id_subgrupo = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_subgrupos",$dataCol,"nome_subgrupo","id_subgrupo");
1120 1158 }
1121 1159 $dbhw = null;
1122 1160 $dbh = null;
... ... @@ -1139,16 +1177,26 @@ function registraTema()
1139 1177 include("conexao.php");
1140 1178 $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_temas where codigo_tema = '$codigo_tema'";
1141 1179 $dados = pegaDados($sql);
1142   - if(count($dados) == 0)
1143   - {
1144   - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_temas (tipoa_tema,nome_tema,codigo_tema,kml_tema,kmz_tema,ogc_tema,download_tema,tags_tema,link_tema,desc_tema) VALUES ('','$codigo_tema','$codigo_tema','SIM','NAO','SIM','SIM','','','')");
  1180 + if(count($dados) == 0){
  1181 + $dataCol = array(
  1182 + "tipoa_tema" => '',
  1183 + "nome_tema" => $codigo_tema,
  1184 + "codigo_tema" => $codigo_tema,
  1185 + "kml_tema" => 'SIM',
  1186 + "kmz_tema" => 'NAO',
  1187 + "ogc_tema" => 'SIM',
  1188 + "download_tema" => 'SIM',
  1189 + "tags_tema" => '',
  1190 + "link_tema" => '',
  1191 + "desc_tema" => ''
  1192 + );
  1193 + i3GeoAdminInsert($dbhw,"i3geoadmin_temas",$dataCol);
1145 1194 }
1146 1195 $dbhw = null;
1147 1196 $dbh = null;
1148 1197 return "ok";
1149 1198 }
1150   - catch (PDOException $e)
1151   - {
  1199 + catch (PDOException $e){
1152 1200 return "Error!: " . $e->getMessage();
1153 1201 }
1154 1202 }
... ... @@ -1164,8 +1212,7 @@ function alteraTemas()
1164 1212 $retorna = "ok";
1165 1213 include("conexao.php");
1166 1214 $nomeo = $nome;
1167   - if($convUTF)
1168   - {
  1215 + if($convUTF){
1169 1216 $nome = utf8_encode($nome);
1170 1217 $desc = utf8_encode($desc);
1171 1218 $tags = utf8_encode($tags);
... ... @@ -1173,12 +1220,26 @@ function alteraTemas()
1173 1220 $es = utf8_encode($es);
1174 1221 $it = utf8_encode($it);
1175 1222 }
1176   - if($id != "")
1177   - {
1178   - if(!isset($kmz))
1179   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_temas SET es='$es', it='$it', en='$en', tags_tema='$tags', link_tema='$link', nome_tema ='$nome',desc_tema='$desc',codigo_tema='$codigo',tipoa_tema='$tipoa',download_tema='$download',ogc_tema='$ogc',kml_tema='$kml' WHERE id_tema = $id");
1180   - else
1181   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_temas SET es='$es', it='$it', en='$en',tags_tema='$tags', link_tema='$link', nome_tema ='$nome',desc_tema='$desc',codigo_tema='$codigo',tipoa_tema='$tipoa',download_tema='$download',ogc_tema='$ogc',kml_tema='$kml',kmz_tema='$kmz' WHERE id_tema = $id");
  1223 + if($id != ""){
  1224 + $dataCol = array(
  1225 + "en" => $en,
  1226 + "es" => $es,
  1227 + "it" => $it,
  1228 + "tags_tema" => $tags,
  1229 + "link_tema" => $link,
  1230 + "nome_tema" => $nome,
  1231 + "desc_tema" => $desc,
  1232 + "codigo_tema" => $codigo,
  1233 + "tipoa_tema" => $tipoa,
  1234 + "download_tema" => $download,
  1235 + "ogc_tema" => $ogc,
  1236 + "kml_tema" => $kml
  1237 + );
  1238 + if(isset($kmz))
  1239 + $dataCol["kmz_tema"] = $kmz;
  1240 + }
  1241 + i3GeoAdminUpdate($dbhw,"i3geoadmin_temas",$dataCol,"WHERE id_tema = $id");
  1242 +
1182 1243 $retorna = $id;
1183 1244 if(!isset($kmz)){
1184 1245 $kmz = "nao";
... ... @@ -1189,12 +1250,10 @@ function alteraTemas()
1189 1250 $mapfile = $resultado[0]["codigo_tema"];
1190 1251 if(file_exists($locaplic."/temas/".$mapfile.".map")){
1191 1252 $mapfile = $locaplic."/temas/".$mapfile.".map";
1192   - if($mapa = @ms_newMapObj($mapfile))
1193   - {
  1253 + if($mapa = @ms_newMapObj($mapfile)){
1194 1254 $mapa = ms_newMapObj($mapfile);
1195 1255 $numlayers = $mapa->numlayers;
1196   - for ($i=0;$i < $numlayers;$i++)
1197   - {
  1256 + for ($i=0;$i < $numlayers;$i++){
1198 1257 $layer = $mapa->getlayer($i);
1199 1258 $layer->setmetadata("permitedownload",strtolower($download));
1200 1259 $layer->setmetadata("download",strtolower($download));
... ... @@ -1207,8 +1266,7 @@ function alteraTemas()
1207 1266 $layer->setmetadata("METAESTAT_ID_MEDIDA_VARIAVEL","");
1208 1267 $layer->setmetadata("metaestat","");
1209 1268 }
1210   - if(count($nomes) == 1)
1211   - {
  1269 + if(count($nomes) == 1){
1212 1270 $layer->setmetadata("tema",$nomeo);
1213 1271 }
1214 1272 }
... ... @@ -1217,35 +1275,42 @@ function alteraTemas()
1217 1275 }
1218 1276 }
1219 1277 }
1220   - else
1221   - {
1222   - $idtemp = (rand (9000,10000)) * -1;
1223   - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_temas (nome_tema) VALUES ('$idtemp')");// (link_tema,kml_tema,ogc_tema,download_tema,nome_tema,desc_tema,codigo_tema,tipoa_tema,tags_tema) VALUES ('','', '','','','','','','')");
1224   - $id = $dbh->query("SELECT * ".$esquemaadmin."FROM i3geoadmin_temas WHERE nome_tema = '$idtemp'");
1225   - $id = $id->fetchAll();
1226   - $id = intval($id[0]['id_tema']);
1227   - if(!isset($kmz))
1228   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_temas SET tags_tema='', link_tema='', nome_tema ='',desc_tema='',codigo_tema='',tipoa_tema='',download_tema='',ogc_tema='',kml_tema='' WHERE id_tema = $id");
1229   - else
1230   - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_temas SET tags_tema='', link_tema='', nome_tema ='',desc_tema='',codigo_tema='',tipoa_tema='',download_tema='',ogc_tema='',kml_tema='',kmz_tema='' WHERE id_tema = $id");
1231   - $retorna = $id;
  1278 + else{
  1279 + $dataCol = array(
  1280 + "en" => "",
  1281 + "es" => "",
  1282 + "it" => "",
  1283 + "tags_tema" => "",
  1284 + "link_tema" => "",
  1285 + "nome_tema" => "",
  1286 + "desc_tema" => "",
  1287 + "codigo_tema" => "",
  1288 + "tipoa_tema" => "",
  1289 + "download_tema" => "",
  1290 + "ogc_tema" => "",
  1291 + "kml_tema" => ""
  1292 + );
  1293 + if(isset($kmz))
  1294 + $dataCol["kmz_tema"] = "";
  1295 + }
  1296 + $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_temas",$dataCol,"nome_tema","id_tema");
1232 1297 }
1233 1298 //verifica se &eacute; necess&aacute;rio adicionar algum tag novo
1234 1299 $tags = explode(" ",$tags);
1235 1300  
1236   - foreach($tags as $tag)
1237   - {
1238   - if(!(verificaDuplicados("select * from ".$esquemaadmin."i3geoadmin_tags where nome = '$tag'",$dbh)))
1239   - {
1240   - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_tags (nome) VALUES ('$tag')");
  1301 + foreach($tags as $tag){
  1302 + if(!(verificaDuplicados("select * from ".$esquemaadmin."i3geoadmin_tags where nome = '$tag'",$dbh))){
  1303 + $dataCol = array(
  1304 + "nome" => $tag
  1305 + );
  1306 + i3GeoAdminInsert($dbhw,"i3geoadmin_tags",$dataCol);
1241 1307 }
1242 1308 }
1243 1309 $dbhw = null;
1244 1310 $dbh = null;
1245 1311 return $retorna;
1246 1312 }
1247   - catch (PDOException $e)
1248   - {
  1313 + catch (PDOException $e){
1249 1314 return "Error!: " . $e->getMessage();
1250 1315 }
1251 1316 }
... ... @@ -1474,14 +1539,14 @@ function removeCabecalho($arq,$symbolset=true)
1474 1539 $teste = preg_replace('/[\n\r\t ]*/', '', $teste);
1475 1540 $testar = array("KEYIMAGE","TILEINDEX","TILEITEM","SYMBOL","LABELITEM","FILTERITEM","GROUP","ENCODING","TIP","CLASSE","ITENSDESC","CLASSESNOME","ITENSLINK","ESCALA","CLASSESSIMBOLO","MENSAGEM","EXTENSAO","CLASSESITEM","ESCONDIDO","CLASSESCOR","DOWNLOAD","CLASSESTAMANHO","ITENS","TEMA","APLICAEXTENSAO","IDENTIFICA");
1476 1541 $passou = true;
1477   - foreach ($testar as $t)
1478   - {
  1542 + foreach ($testar as $t){
1479 1543 if($teste == $t){
1480 1544 $passou = false;
1481 1545 }
1482 1546 }
1483   - if($passou)
  1547 + if($passou){
1484 1548 fwrite($handle,$f);
  1549 + }
1485 1550 }
1486 1551 fclose($handle);
1487 1552 chmod($arq, 0666);
... ...