Commit e2d408799fe22cd6ee988d8ce4ca51f54bddd278

Authored by Edmar Moretti
1 parent 2dcd28f8

Inclusão de log de transações #62

Showing 2 changed files with 38 additions and 34 deletions   Show diff stats
admin/admin.db
No preview for this file type
admin/php/webservices.php
@@ -151,63 +151,64 @@ switch (strtoupper($funcao)) @@ -151,63 +151,64 @@ switch (strtoupper($funcao))
151 /* 151 /*
152 Altera o registro de um WS 152 Altera o registro de um WS
153 */ 153 */
154 -function alterarWS()  
155 -{ 154 +function alterarWS(){
156 global $esquemaadmin,$id_ws,$desc_ws,$nome_ws,$link_ws,$autor_ws,$tipo_ws; 155 global $esquemaadmin,$id_ws,$desc_ws,$nome_ws,$link_ws,$autor_ws,$tipo_ws;
157 - try  
158 - { 156 + try{
159 require_once("conexao.php"); 157 require_once("conexao.php");
160 - if($convUTF)  
161 - { 158 + if($convUTF){
162 $nome_ws = utf8_encode($nome_ws); 159 $nome_ws = utf8_encode($nome_ws);
163 $desc_ws = utf8_encode($desc_ws); 160 $desc_ws = utf8_encode($desc_ws);
164 $autor_ws = utf8_encode($autor_ws); 161 $autor_ws = utf8_encode($autor_ws);
165 } 162 }
166 - if($id_ws != "")  
167 - {  
168 - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_ws SET desc_ws = '$desc_ws',nome_ws = '$nome_ws', link_ws = '$link_ws', autor_ws = '$autor_ws', tipo_ws = '$tipo_ws' WHERE id_ws = $id_ws"); 163 + if($id_ws != ""){
  164 + $dataCol = array(
  165 + "desc_ws" => $desc_ws,
  166 + "nome_ws" => $nome_ws,
  167 + "link_ws" => $link_ws,
  168 + "autor_ws" => $autor_ws,
  169 + "tipo_ws" => $tipo_ws
  170 + );
  171 + i3GeoAdminUpdate($dbhw,"i3geoadmin_ws",$dataCol,"WHERE id_ws = $id_ws");
169 $retorna = $id_ws; 172 $retorna = $id_ws;
170 } 173 }
171 - else  
172 - {  
173 - $idtemp = (rand (9000,10000)) * -1;  
174 - $dbhw->query("INSERT INTO ".$esquemaadmin."i3geoadmin_ws (nome_ws,desc_ws,autor_ws,tipo_ws,link_ws,nacessos,nacessosok) VALUES ('$idtemp','','','','',0,0)");  
175 - $id = $dbh->query("SELECT id_ws FROM ".$esquemaadmin."i3geoadmin_ws WHERE nome_ws = '$idtemp'");  
176 - $id = $id->fetchAll();  
177 - $id = $id[0]['id_ws'];  
178 - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_ws SET nome_ws = '' WHERE id_ws = $id AND nome_ws = '$idtemp'");  
179 - $retorna = $id; 174 + else{
  175 + $dataCol = array(
  176 + "desc_ws" => '',
  177 + "nome_ws" => '',
  178 + "link_ws" => '',
  179 + "autor_ws" => '',
  180 + "tipo_ws" => '',
  181 + "nacessos" => 0,
  182 + "nacessosok" => 0
  183 + );
  184 + $retorna = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_ws",$dataCol,"nome_ws","id_ws");
180 } 185 }
181 $dbhw = null; 186 $dbhw = null;
182 $dbh = null; 187 $dbh = null;
183 return $retorna; 188 return $retorna;
184 } 189 }
185 - catch (PDOException $e)  
186 - { 190 + catch (PDOException $e){
187 return "Error!: " . $e->getMessage(); 191 return "Error!: " . $e->getMessage();
188 } 192 }
189 } 193 }
190 -function excluirWS()  
191 -{ 194 +function excluirWS(){
192 global $id,$esquemaadmin; 195 global $id,$esquemaadmin;
193 - try  
194 - { 196 + try{
195 include("conexao.php"); 197 include("conexao.php");
196 - $dbhw->query("DELETE from ".$esquemaadmin."i3geoadmin_ws WHERE id_ws = $id"); 198 + $sql = "DELETE from ".$esquemaadmin."i3geoadmin_ws WHERE id_ws = $id";
  199 + $dbhw->query($sql);
  200 + i3GeoAdminInsertLog($dbhw,$sql);
197 $dbhw = null; 201 $dbhw = null;
198 $dbh = null; 202 $dbh = null;
199 return "ok"; 203 return "ok";
200 } 204 }
201 - catch (PDOException $e)  
202 - { 205 + catch (PDOException $e){
203 return "Error!: " . $e->getMessage(); 206 return "Error!: " . $e->getMessage();
204 } 207 }
205 } 208 }
206 -function adicionaAcesso($id_ws,$sucesso)  
207 -{ 209 +function adicionaAcesso($id_ws,$sucesso){
208 global $esquemaadmin; 210 global $esquemaadmin;
209 - try  
210 - { 211 + try {
211 if($id_ws == ""){ 212 if($id_ws == ""){
212 return; 213 return;
213 } 214 }
@@ -229,12 +230,15 @@ function adicionaAcesso($id_ws,$sucesso) @@ -229,12 +230,15 @@ function adicionaAcesso($id_ws,$sucesso)
229 if($ok == ""){ 230 if($ok == ""){
230 $ok = 0; 231 $ok = 0;
231 } 232 }
232 - $dbhw->query("UPDATE ".$esquemaadmin."i3geoadmin_ws SET nacessos = '$acessos',nacessosok = '$ok' WHERE id_ws = $id_ws"); 233 + $dataCol = array(
  234 + "nacessos" => $acessos,
  235 + "nacessosok" => $ok
  236 + );
  237 + i3GeoAdminUpdate($dbhw,"i3geoadmin_ws",$dataCol,"WHERE id_ws = $id_ws");
233 $dbhw = null; 238 $dbhw = null;
234 $dbh = null; 239 $dbh = null;
235 } 240 }
236 - catch (PDOException $e)  
237 - { 241 + catch (PDOException $e){
238 return "Error!: " . $e->getMessage(); 242 return "Error!: " . $e->getMessage();
239 } 243 }
240 } 244 }