-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetAnexoExpedienteCarpeta.php
executable file
·309 lines (122 loc) · 6.96 KB
/
GetAnexoExpedienteCarpeta.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<?php
require_once ("lib/nusoap.php");
if (!isset($_SESSION['VAR_SESSIONES'])) {
$cliente = new nusoap_client("http://laws.com.co/ws/GetDetailSuscriptorKeys.wsdl", true);
$error = $cliente->getError();
if ($error) {
echo "<h2>Constructor error</h2><pre>" . $error . "</pre>";
}
$array = array("id" => $_SERVER['HTTP_HOST'], "key" => $_SESSION['user_key']);
$result = $cliente->call("GetDataSesion", $array);
if ($cliente->fault) {
echo "<h2>Fault</h2><pre>";
echo "</pre>";
}else{
$error = $cliente->getError();
if ($error) {
echo "<h2>Error</h2><pre>" . $error . "</pre>";
}else {
if ($result == "") {
echo "No se creo el WS";
}else{
$x = explode(",", $result);
if ($x[0] != 'errno') {
$_SESSION["pzhkCSC0XMwpGMT"] = desencriptar($x[0], $_SESSION['user_key']);
$_SESSION["kYg8omRSc1EDj3u"] = desencriptar($x[1], $_SESSION['user_key']);
$_SESSION["1oKU35BSbQ7CG5Q"] = desencriptar($x[2], $_SESSION['user_key']);
$_SESSION["71c029wus3yJWEN"] = desencriptar($x[3], $_SESSION['user_key']);
$_SESSION['VAR_SESSIONES'] = true;
}else{
$_SESSION['VAR_SESSIONES'] = false;
}
}
}
}
}
$id_gestion = $_REQUEST['id_gestion'];
if($id_gestion == ""){
?>
<form id='form' action='' method='POST'>
<div class='title right'>Cargar Anexos Carpetas</div>
<input type='text' class='title_act' placeholder='id gestion' name='id_gestion' id='id_gestion' maxlength='' />
<input type='submit' value='Cargar Imagenes' style='margin:10px;'/>
</form>
<?php
exit;
}
include_once('../app/basePaths.inc.php');
include_once(ROOT.DS.'DALC'.DS.'/mySql.php');
include_once('../app/controller/consultas.php');
include_once('../app/controller/funciones.php');
include_once(MODELS.DS.'Gestion_anexosM.php');
include_once(MODELS.DS.'Events_gestionM.php');
include_once(MODELS.DS.'Gestion_folderM.php');
$con = new ConexionBaseDatos;
$con->Connect($con);
$c = new Consultas;
$f = new Funciones;
$variable = explode(',', $id_gestion);
foreach ($variable as $key => $value) {
GetAnexoExpedienteCarpeta($value);
}
function GetAnexoExpedienteCarpeta($id) {
global $con;
/*Se verifica que exista el expediente*/
$ges = $con->FetchAssoc($con->Query("select * from gestion where id = '".$id."'"));
$id_gestion = $ges['id'];
if($id_gestion <= 0){
echo "El expediente ($id) no existe<br>";
exit;
}
$us = $con->FetchAssoc($con->Query("select * from usuarios where user_id = '".$ges['usuario_registra']."'"));
/**SE CREA LA CARPETA DEL EXPEDIENTE SI NO EXISTE*/
$filename=UPLOADS.DS.$id_gestion.'/';
if (!file_exists($filename)) {
mkdir(UPLOADS.DS . $id_gestion, 0777);
}
$filename=UPLOADS.DS.$id_gestion.'/anexos/';
if (!file_exists($filename)) {
mkdir(UPLOADS.DS . $id_gestion.'/anexos', 0777);
}
$dir = opendir(UPLOADS.DS . $id_gestion.'/anexos');
$files = array();
while ($current = readdir($dir)){
echo "Leyendo ".$current.'<br>';
if( $current != "." && $current != "..") {
if(is_dir($path.$current)) {
//showFiles($path.$current.'/');
}
else {
$archi = explode('@@', $current);
echo "Insertando ".$current.'<br>';
if($archi[1] != ""){/*se maneja con subcarpeta*/
/*crear carpeta*/
$gfolder = $con->FetchAssoc($con->Query("select * from gestion_folder where gestion_id = '$id_gestion' and nombre = '$archi[0]' "));
//$filename=UPLOADS.DS.$id_gestion.'/anexos/'.$archi[0].'/';
if ($gfolder['id'] <= 0) {
//mkdir(UPLOADS.DS . $id_gestion.'/anexos/'.$archi[0], 0777);
$MGestion_folder = new MGestion_folder;
// USANDO LA FUNCION DE INSERTAR DEL OBJETO PARA ENVIAR LA INFORMACION A LA BASE DE DATOA
$create = $MGestion_folder->InsertGestion_folder($archi[0], "0", $id_gestion, $ges['usuario_registra'], date('Y-m-d'), "1", "1");
}
$gfolder = $con->FetchAssoc($con->Query("select * from gestion_folder where gestion_id = '$id_gestion' and nombre = '$archi[0]' "));
$an = new MGestion_anexos;
$an->InsertGestion_anexos($id_gestion, $archi[1], $value, $ges['usuario_registra'], date("Y-m-d"), date("H:i:s"), $_SERVER['REMOTE_ADDR'], "", "1", $i, $i);
$con->Query("update gestion_anexos set folder_id = '$gfolder[id]' where user_id = '$ges[usuario_registra]' and gestion_id = '$id_gestion' and url = '$value' and nombre = '$archi[1]' ");
//$MEvents_gestion = new MEvents_gestion;
//$MEvents_gestion->InsertEvents_gestion($ges['usuario_registra'], $id_gestion, date("Y-m-d"), "Correspondencia Digitalizada", "Se Ha anexado al expediente la guia digitalizada del operador postal", date("Y-m-d"), 0, date("H:i:s"), 0, 0, 0, date("Y-m-d"), 0, $ges['oficina'], $ges['dependencia_destino'], $ges['dependencia_destino'], $us['a_i'], "an", $id_gestion);
}else{
$an = new MGestion_anexos;
$an->InsertGestion_anexos($id_gestion, $archi[0], $archi[0], $ges['usuario_registra'], date("Y-m-d"), date("H:i:s"), $_SERVER['REMOTE_ADDR'], "", "1", $i, $i);
//$MEvents_gestion = new MEvents_gestion;
//$MEvents_gestion->InsertEvents_gestion($ges['usuario_registra'], $id_gestion, date("Y-m-d"), "Correspondencia Digitalizada", "Se Ha anexado al expediente la guia digitalizada del operador postal", date("Y-m-d"), 0, date("H:i:s"), 0, 0, 0, date("Y-m-d"), 0, $ges['oficina'], $ges['dependencia_destino'], $ges['dependencia_destino'], $us['a_i'], "an", $id_gestion);
}
}
}
}
}
function desencriptar($cadena, $key){
$decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($cadena), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
return $decrypted; //Devuelve el string desencriptado
}
?>