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 151 /*
152 152 Altera o registro de um WS
153 153 */
154   -function alterarWS()
155   -{
  154 +function alterarWS(){
156 155 global $esquemaadmin,$id_ws,$desc_ws,$nome_ws,$link_ws,$autor_ws,$tipo_ws;
157   - try
158   - {
  156 + try{
159 157 require_once("conexao.php");
160   - if($convUTF)
161   - {
  158 + if($convUTF){
162 159 $nome_ws = utf8_encode($nome_ws);
163 160 $desc_ws = utf8_encode($desc_ws);
164 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 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 186 $dbhw = null;
182 187 $dbh = null;
183 188 return $retorna;
184 189 }
185   - catch (PDOException $e)
186   - {
  190 + catch (PDOException $e){
187 191 return "Error!: " . $e->getMessage();
188 192 }
189 193 }
190   -function excluirWS()
191   -{
  194 +function excluirWS(){
192 195 global $id,$esquemaadmin;
193   - try
194   - {
  196 + try{
195 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 201 $dbhw = null;
198 202 $dbh = null;
199 203 return "ok";
200 204 }
201   - catch (PDOException $e)
202   - {
  205 + catch (PDOException $e){
203 206 return "Error!: " . $e->getMessage();
204 207 }
205 208 }
206   -function adicionaAcesso($id_ws,$sucesso)
207   -{
  209 +function adicionaAcesso($id_ws,$sucesso){
208 210 global $esquemaadmin;
209   - try
210   - {
  211 + try {
211 212 if($id_ws == ""){
212 213 return;
213 214 }
... ... @@ -229,12 +230,15 @@ function adicionaAcesso($id_ws,$sucesso)
229 230 if($ok == ""){
230 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 238 $dbhw = null;
234 239 $dbh = null;
235 240 }
236   - catch (PDOException $e)
237   - {
  241 + catch (PDOException $e){
238 242 return "Error!: " . $e->getMessage();
239 243 }
240 244 }
... ...