[378] | 1 | <?php
|
---|
| 2 | /************************************************************************/
|
---|
| 3 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
| 4 | /* by Roberto Gigli & Luciano Apolito */
|
---|
| 5 | /* http://www.eleonline.it */
|
---|
| 6 | /* info@eleonline.it luciano@aniene.net rgigli@libero.it */
|
---|
| 7 | /************************************************************************/
|
---|
| 8 | /* Modulo Inserimento dati */
|
---|
| 9 | /* Amministrazione */
|
---|
| 10 | /************************************************************************/
|
---|
[379] | 11 | if (!defined('ADMIN_FILE')) {
|
---|
| 12 | die ("You can't access this file directly...");
|
---|
| 13 | }
|
---|
[378] | 14 |
|
---|
[392] | 15 | echo "<style>
|
---|
| 16 | body
|
---|
| 17 | {
|
---|
| 18 | width:100%;
|
---|
| 19 | margin:0 auto;
|
---|
| 20 | padding:0px;
|
---|
| 21 | font-family:helvetica;
|
---|
| 22 | background-color:#A9D0F5;
|
---|
| 23 | }
|
---|
| 24 | #wrapper
|
---|
| 25 | {
|
---|
| 26 | text-align:left;
|
---|
| 27 | margin-left:20px;
|
---|
| 28 | padding:0px;
|
---|
| 29 | width:995px;
|
---|
| 30 | }
|
---|
| 31 | #wrapperleft
|
---|
| 32 | {
|
---|
| 33 | text-align:center;
|
---|
| 34 | margin:0 auto;
|
---|
| 35 | padding:0px;
|
---|
| 36 | width:995px;
|
---|
| 37 | }
|
---|
| 38 | #wrapper h1
|
---|
| 39 | {
|
---|
| 40 | margin-top:100px;
|
---|
| 41 | font-size:40px;
|
---|
| 42 | }
|
---|
| 43 | #wrapper h1 p
|
---|
| 44 | {
|
---|
| 45 | font-size:17px;
|
---|
| 46 | }
|
---|
| 47 | #wrapper #feed_div
|
---|
| 48 | {
|
---|
| 49 | background-color:white;
|
---|
| 50 | width:550px;
|
---|
| 51 | height:320px;
|
---|
| 52 | overflow-y:scroll;
|
---|
| 53 | margin-left:20px;
|
---|
| 54 | margin-top:20px;
|
---|
| 55 | text-align:left;
|
---|
| 56 | border:1px solid silver;
|
---|
| 57 | padding:10px;
|
---|
| 58 | }
|
---|
| 59 | #wrapper #feed_div h2
|
---|
| 60 | {
|
---|
| 61 | font-size:17px;
|
---|
| 62 | }
|
---|
| 63 | #wrapper #feed_div .title a
|
---|
| 64 | {
|
---|
| 65 | text-decoration:none;
|
---|
| 66 | color:#0080FF;
|
---|
| 67 | }
|
---|
| 68 | </style>";
|
---|
[412] | 69 |
|
---|
| 70 | global $dbi;
|
---|
| 71 | $aid=$_SESSION['aid'];
|
---|
| 72 | $prefix=$_SESSION['prefix'];
|
---|
| 73 | $id_comune=$_SESSION['id_comune'];
|
---|
| 74 | $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
|
---|
| 75 | if(isset($param['id_cons_gen'])) $id_cons_gen=intval($param['id_cons_gen']); else $id_cons_gen=0;
|
---|
| 76 | $perms=ChiSei(0);
|
---|
| 77 | if ($perms!=256) return; # $mex = htmlspecialchars("Non sono disponibili nuovi aggiornamenti");
|
---|
| 78 |
|
---|
| 79 | include("modules/Elezioni/ele.php");
|
---|
| 80 | global $righe,$righedb;
|
---|
| 81 |
|
---|
| 82 | function aggiornadb(){
|
---|
| 83 | global $righedb,$prefix,$dbi,$dbname;
|
---|
| 84 | $righedb='';
|
---|
| 85 | global $ctrlerr;
|
---|
| 86 | $ctrlerr=0;
|
---|
| 87 | if(file_exists(dirname(__FILE__)."/aggiornadb.php")) {
|
---|
| 88 | ob_start();
|
---|
| 89 | include (dirname(__FILE__).'/aggiornadb.php');
|
---|
| 90 | $righedb=ob_get_contents();
|
---|
| 91 | ob_end_clean();
|
---|
| 92 | }
|
---|
| 93 | }
|
---|
| 94 | function risultati()
|
---|
| 95 | {
|
---|
[427] | 96 | global $ctrlerr,$righe,$righedb,$varmex;
|
---|
[412] | 97 | if($ctrlerr)
|
---|
| 98 | echo "<hr><br><h2 style=\"text-align:center;color:red;\">Aggiornamento completato con errori<br>Controllare i log di aggiornamento del database</h2><hr>";
|
---|
[427] | 99 | else
|
---|
| 100 | echo "<hr><br><h2 style=\"text-align:center;\">Aggiornamento completato $varmex</h2><br><hr>";
|
---|
[412] | 101 | echo "<br><h3>Log delle operazioni</h3>";
|
---|
| 102 |
|
---|
| 103 | echo $righe;
|
---|
| 104 | echo "<div id=\"wrapper\">";
|
---|
| 105 | echo "<br><p>Operazioni effettuate sul db: </p>";
|
---|
| 106 | echo "<div id=\"feed_div\">";
|
---|
| 107 | echo $righedb;
|
---|
| 108 | echo "</div>";
|
---|
| 109 | echo "</div>";
|
---|
| 110 | echo "<br><b>Operazioni di aggiornamento concluse.</b><br>";
|
---|
| 111 | }
|
---|
| 112 | //if ($perms<128 or !$id_cons_gen) die("$perms Non hai i permessi per inserire dati, o non hai scelto la consultazione!");
|
---|
| 113 | if(isset($param['file'])) $pfile=$param['file']; else $pfile='';
|
---|
| 114 | if (isset($param['errmex'])) {
|
---|
| 115 | switch ($param['errmex']) {
|
---|
| 116 | case 1:
|
---|
| 117 | $mex='Non sono disponibili nuovi aggiornamenti';
|
---|
| 118 | break;
|
---|
| 119 | case 2:
|
---|
| 120 | $mex="Non c'Ú connessione con il server";
|
---|
| 121 | break;
|
---|
| 122 | case 3:
|
---|
| 123 | $mex="E' presente un file di nome $pfile nella cartella admin, va cancellato per poter aggiornare";
|
---|
| 124 | break;
|
---|
| 125 | case 4:
|
---|
| 126 | $mex="Errore durante la copia del pacchetto $pfile - aggiornamento interrotto";
|
---|
| 127 | break;
|
---|
| 128 | case 5:
|
---|
| 129 | $mex="Errore nell'estrazione del file zip! Aggiornamento interrotto";
|
---|
| 130 | break;
|
---|
| 131 | case 6:
|
---|
| 132 | $mex="Errore durante la creazione della directory $pfile (controllare i permessi), aggiornamento interrotto";
|
---|
| 133 | break;
|
---|
| 134 | case 7:
|
---|
| 135 | $mex="Errore durante la creazione della directory $pfile (controllare i permessi), aggiornamento interrotto";
|
---|
| 136 | break;
|
---|
| 137 | case 8:
|
---|
| 138 | $mex="Errore durante la copia del file $pfile (controllare i permessi), aggiornamento interrotto";
|
---|
| 139 | break;
|
---|
| 140 | default:
|
---|
| 141 | $mex='';
|
---|
| 142 | }
|
---|
| 143 | } else $mex='';
|
---|
| 144 |
|
---|
| 145 | if (isset($param['procedi'])) $procedi=intval($param['procedi']); else $procedi=0;
|
---|
| 146 | if(isset($param['errmex']) and $param['errmex']<3) {
|
---|
| 147 | ele();
|
---|
| 148 | if(!$procedi){
|
---|
| 149 | echo "<hr><br><h2 style=\"text-align:center;\">$mex</h2><br><hr>";
|
---|
| 150 | echo "<form name=\"conferma\" action=\"admin.php\"><input type=\"hidden\" name=\"errmex\" value=\"1\"><input type=\"hidden\" name=\"op\" value=\"aggiorna\">";
|
---|
| 151 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"><input type=\"hidden\" name=\"procedi\" value=\"1\">";
|
---|
[426] | 152 | echo "<br><table align=\"center\"><tr><td><h3>Procedo con verifica e aggiornamento del solo db (all'ultima versione scaricata)?<br><i>E' consigliato procedere solo dopo aver prodotto una copia di backup</i></h3></td><td><input type=\"submit\" name=\"vai\" value=\""._OK."\"></td></tr></table></form>";
|
---|
[412] | 153 | }else{
|
---|
| 154 | aggiornadb();
|
---|
| 155 | risultati();
|
---|
| 156 | }
|
---|
| 157 | include("footer.php");
|
---|
| 158 | die();
|
---|
| 159 | }
|
---|
| 160 | if(phpversion()<5.6) $host="http://80.211.143.127";
|
---|
| 161 | else $host="https://trac.eleonline.it";
|
---|
[426] | 162 | ######################
|
---|
| 163 | $rev=0;
|
---|
| 164 | if ($stream = fopen('http://mail.eleonline.it/version/risposta.php', 'r')) {
|
---|
| 165 | $rev= stream_get_contents($stream, 4);
|
---|
| 166 | fclose($stream);
|
---|
| 167 |
|
---|
| 168 | $newrev=(int) filter_var($rev, FILTER_SANITIZE_NUMBER_INT);
|
---|
| 169 | $_SESSION['remoterev']=$newrev;
|
---|
[412] | 170 | }else{
|
---|
| 171 | $errmex=2;
|
---|
| 172 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex"); exit;
|
---|
| 173 | }
|
---|
| 174 | #$newrev=$_SESSION['remoterev'];
|
---|
[426] | 175 | #$myrev=$_SESSION['localrev'];
|
---|
| 176 | include('versione.php');
|
---|
| 177 | $myrev=intval(substr($versione,-4,4));
|
---|
| 178 | $_SESSION['localrev']=$myrev;
|
---|
| 179 |
|
---|
[412] | 180 | if (isset($_SESSION['forzadb'])) $myrev=378;
|
---|
[424] | 181 | if($newrev<=$myrev) {
|
---|
[412] | 182 | $errmex=1;
|
---|
| 183 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex"); exit;
|
---|
| 184 | }
|
---|
| 185 | #####
|
---|
[380] | 186 | if(!$procedi){
|
---|
| 187 | ele();
|
---|
[397] | 188 | if (isset($_SESSION['forzadb']))
|
---|
| 189 | echo "<hr><br><h2 style=\"text-align:center;\">E' necessario riallineare il DB, confermare l'aggiornamento.";
|
---|
| 190 | else
|
---|
| 191 | echo "<hr><br><h2 style=\"text-align:center;\">Revisione installata: $myrev";
|
---|
| 192 | echo "<br>Revisione disponibile: $newrev</h2><br><hr>";
|
---|
| 193 |
|
---|
| 194 | unset($_SESSION['forzadb']);
|
---|
| 195 |
|
---|
[383] | 196 | #####
|
---|
[392] | 197 |
|
---|
[383] | 198 | echo "<div id=\"wrapper\">";
|
---|
| 199 | echo "<br><br><p>Log delle modifiche (massimo 100 righe)</p>";
|
---|
| 200 | echo "<div id=\"feed_div\">";
|
---|
[392] | 201 | $myrev++;
|
---|
[383] | 202 | $rss = simplexml_load_file("$host/ele3/log?format=rss&mode=stop_on_copy&rev=$newrev&stop_rev=$myrev&format=rss&max=100&verbose=on#");
|
---|
| 203 | #$rss = simplexml_load_file("$host/ele3/log?action=follow_copy&mode=stop_on_copy&rev=$newrev&stop_rev=$myrev&limit=100&verbose=on#");
|
---|
| 204 |
|
---|
| 205 | echo '<h2>'. $rss->channel->title . '</h2>';
|
---|
| 206 | foreach ($rss->channel->item as $item)
|
---|
| 207 | {
|
---|
| 208 | echo '<p class="title"><a href="'. $item->link .'">' . $item->title . "</a></p>";
|
---|
| 209 | $str=preg_replace('/\s\--/','<br>--',$item->description);
|
---|
[426] | 210 | echo "<p class='desc'>" . $str . "</p>";
|
---|
[383] | 211 | }
|
---|
| 212 | echo "</div>";
|
---|
| 213 | echo "</div>";
|
---|
| 214 | #####
|
---|
[381] | 215 | $file = file("$host/ele3/log/?format=changelog&limit=100&mode=stop_on_copy&rev=$newrev&stop_rev=$myrev&verbose=off");
|
---|
[380] | 216 | # echo "<br>Procedo con l'aggiornamento? ";
|
---|
| 217 | echo "<form name=\"conferma\" action=\"admin.php\"><input type=\"hidden\" name=\"op\" value=\"aggiorna\">";
|
---|
| 218 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"><input type=\"hidden\" name=\"procedi\" value=\"1\">";
|
---|
| 219 | echo "<br><table align=\"center\"><tr><td><h3>Procedo con l'aggiornamento?</h3></td><td><input type=\"submit\" name=\"vai\" value=\""._OK."\"></td></tr></table></form>";
|
---|
[381] | 220 | $filename = "$host/ele3/changeset?format=zip&new=$newrev&new_path=%2F&old=$myrev&old_path=%2F";
|
---|
| 221 |
|
---|
| 222 | $za = new ZipArchive();
|
---|
[378] | 223 | $path = "./files/";
|
---|
[382] | 224 | $righe='';
|
---|
[379] | 225 | if(file_exists($path)) {
|
---|
| 226 | if (!is_dir($path)) {
|
---|
[412] | 227 | $errmex=3;
|
---|
| 228 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=$path"); exit;
|
---|
[379] | 229 | }
|
---|
| 230 | else
|
---|
| 231 | $righe.= "<br>La cartella $path Ú già presente, procedo con l'aggiornamento";
|
---|
| 232 | }else{
|
---|
[378] | 233 | $righe.= "<br>La cartella $path non Ú presente, procedo con la creazione";
|
---|
| 234 | mkdir($path, 0777, true);
|
---|
| 235 | }
|
---|
[383] | 236 | /* $newfile=$path."aggiornamento".$newrev;
|
---|
[381] | 237 | copy($filename,$newfile);
|
---|
| 238 | $za->open($newfile);
|
---|
| 239 | echo "<br>prima";
|
---|
| 240 | for( $i = 0; $i < $za->numFiles; $i++ ){
|
---|
| 241 | echo "<br>$i - dentro";
|
---|
| 242 | $stat = $za->statIndex( $i );
|
---|
| 243 | print_r( $stat['name'] . PHP_EOL );
|
---|
| 244 | }
|
---|
[383] | 245 | */ ############
|
---|
| 246 | include("footer.php");die();
|
---|
[412] | 247 | }
|
---|
[383] | 248 | $admin = '../admin';
|
---|
| 249 | $client = '../client';
|
---|
[381] | 250 | # $path = "/tmp/files";
|
---|
[392] | 251 | $backup = "backup".$myrev;
|
---|
[383] | 252 | $path = "./files/";
|
---|
| 253 | $righe='';
|
---|
[381] | 254 | /* if(file_exists($path)) {
|
---|
[383] | 255 | $i=1;
|
---|
| 256 | $ispath=$path;
|
---|
| 257 | while(file_exists($ispath))
|
---|
| 258 | $ispath=$path.$i++;
|
---|
| 259 | $path.=--$i.'/';
|
---|
| 260 | }else $path.='/';
|
---|
| 261 | if (!is_dir($path)) {
|
---|
| 262 | if(false===rename($path,$path."_da_".$myrev."_a_".$newrev)) {
|
---|
| 263 | $errmex="E' presente un file di nome $path nella cartella admin, va cancellato per poter aggiornare";
|
---|
| 264 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex"); exit;
|
---|
[381] | 265 | }
|
---|
[383] | 266 | $righe.= "<br>La cartella $path non Ú presente, procedo con la creazione";
|
---|
| 267 | mkdir($path, 0777, true);
|
---|
[379] | 268 | }
|
---|
[383] | 269 | else
|
---|
| 270 | $righe.= "<br>La cartella $path Ú già presente, procedo con l'aggiornamento";
|
---|
| 271 | }else{
|
---|
| 272 | $righe.= "<br>Creo la cartella $path";
|
---|
| 273 | mkdir($path, 0777, true);*/
|
---|
| 274 | $trunk=$path.'trunk';
|
---|
| 275 | $trunkadm=$trunk.'/admin';
|
---|
| 276 | $trunkcli=$trunk.'/client';
|
---|
| 277 | # }
|
---|
| 278 | # if(!file_exists($trunk)) if (false === mkdir($trunk)) { die("Impossibile creare la cartella trunk, il programma viene interrotto");}
|
---|
| 279 | # if(!copy($file,$trunkadm)){ $righe.= "<br>Errore durante la copia del pacchetto di aggiornamento<br>";}
|
---|
| 280 | // Nome del file zip : https://trac.eleonline.it/ele3/changeset?format=zip&new=377&new_path=%2F&old=360&old_path=%2F
|
---|
| 281 | # https://trac.eleonline.it/ele3/browser/trunk?format=zip&rev=377
|
---|
| 282 |
|
---|
| 283 | $filename = "$host/ele3/changeset?format=zip&new=$newrev&new_path=%2F&old=$myrev&old_path=%2F";
|
---|
| 284 | $newfile=$path."aggiornamento".$newrev;
|
---|
| 285 | if(!copy($filename,$newfile)){
|
---|
[412] | 286 | $errmex=4;
|
---|
| 287 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=$newfile"); exit;
|
---|
[383] | 288 | }
|
---|
| 289 | $zip = new ZipArchive;
|
---|
| 290 | $res = $zip->open($newfile);
|
---|
[382] | 291 | ############
|
---|
| 292 | #$za = new ZipArchive();
|
---|
[381] | 293 |
|
---|
| 294 | #$za->open('theZip.zip');
|
---|
[382] | 295 | # $za->open($newfile);
|
---|
| 296 | /*
|
---|
[381] | 297 | for( $i = 0; $i < $za->numFiles; $i++ ){
|
---|
| 298 | $stat = $za->statIndex( $i );
|
---|
| 299 | print_r( basename( $stat['name'] ) . PHP_EOL );
|
---|
| 300 | }
|
---|
[382] | 301 | die(); */
|
---|
[381] | 302 | ################
|
---|
[378] | 303 | $righe.= "<br>$newfile scaricato";
|
---|
| 304 | if ($res === TRUE) {
|
---|
| 305 | $zip->extractTo($path);
|
---|
| 306 | $zip->close();
|
---|
| 307 | $righe.= '<br>File zip estratto';
|
---|
| 308 | } else {
|
---|
[412] | 309 | $errmex= 5;
|
---|
[379] | 310 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex"); exit;
|
---|
[378] | 311 | }
|
---|
[381] | 312 | if(file_exists($path.$backup)) {
|
---|
| 313 | $i=1;
|
---|
| 314 | $isback=$path.$backup;
|
---|
| 315 | while(file_exists($isback))
|
---|
| 316 | $isback=$path.$backup.$i++;
|
---|
| 317 | $backup=$path.$backup.$i.'/';
|
---|
| 318 | } else $backup=$path.$backup.'/';
|
---|
| 319 | /* if(false===rename($backup,$backup."_a_".$myrev)) {
|
---|
| 320 | $errmex="E' presente un file di nome $backup_a_$myrev nella cartella admin e non posso rinominare l'ultimo eseguito, va fatto a mano per poter aggiornare";
|
---|
[380] | 321 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex"); exit;
|
---|
[381] | 322 | }
|
---|
| 323 | }else{ */
|
---|
| 324 | $righe.= "<br>Creo la cartella di backup: $backup";
|
---|
| 325 | mkdir($backup, 0755);
|
---|
| 326 | # }
|
---|
[427] | 327 |
|
---|
| 328 | if(file_exists("$trunkadm/variabili.php")) {
|
---|
| 329 | rename("$trunkadm/variabili.php","$trunkadm/variabili_new.php");
|
---|
| 330 | $righe.= "<h3>NOTA: Nell'aggiornamento Ú presente una modifica al file variabili.php, il file Ú stato salvato come variabili_new.php.<br>Va eseguito un controllo e un eventuale aggiornamento manuale del file.</h3>";
|
---|
| 331 |
|
---|
| 332 | }
|
---|
[378] | 333 | $righe.= "<br><br><b>Copio i nuovi files nell'installazione di amministrazione locale</b>";
|
---|
[381] | 334 | recurse_copy($trunkadm,$admin,$backup.'/admin/');
|
---|
[378] | 335 | $righe.= "<br>Files di aggiornamento copiati correttamente.";
|
---|
| 336 | $righe.= "<br><br><b>Copio i nuovi files nell'installazione client locale</b>";
|
---|
[381] | 337 | recurse_copy($trunkcli,$client,$backup.'/client/');
|
---|
[378] | 338 | $righe.= "<br>Files di aggiornamento copiati correttamente.";
|
---|
[380] | 339 | function recurse_copy($src,$dst,$bck) {
|
---|
[378] | 340 | $dir = opendir($src);
|
---|
[379] | 341 | if(!file_exists($dst))
|
---|
| 342 | if(@mkdir($dst)==false) {
|
---|
[412] | 343 | $errmex= 6;
|
---|
| 344 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=$dst"); exit;
|
---|
[379] | 345 | }
|
---|
[380] | 346 | if(!file_exists($bck))
|
---|
[381] | 347 | if(mkdir($bck,0777,true)==false) {
|
---|
[412] | 348 | $errmex= 7;
|
---|
| 349 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=$bck"); exit;
|
---|
[380] | 350 | }
|
---|
[378] | 351 | while(false !== ( $file = readdir($dir)) ) {
|
---|
| 352 | if (( $file != '.' ) && ( $file != '..' )) {
|
---|
| 353 | if ( is_dir($src . '/' . $file) ) {
|
---|
[380] | 354 | recurse_copy($src . '/' . $file,$dst . '/' . $file,$bck . '/' . $file);
|
---|
[378] | 355 | }
|
---|
| 356 | else {
|
---|
[381] | 357 | if(file_exists($dst . '/' . $file))
|
---|
| 358 | if(false===copy($dst . '/' . $file,$bck . '/' . $file)) {
|
---|
[412] | 359 | $errmex= 8;
|
---|
| 360 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=$bck/$file"); exit;
|
---|
[381] | 361 | }
|
---|
[380] | 362 | if(!copy($src . '/' . $file,$dst . '/' . $file)) {
|
---|
[412] | 363 | $errmex= 8;
|
---|
| 364 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=".$dst . '/' . $file); exit;
|
---|
[379] | 365 | }
|
---|
[378] | 366 | }
|
---|
| 367 | }
|
---|
| 368 | }
|
---|
| 369 | closedir($dir);
|
---|
| 370 | }
|
---|
[412] | 371 |
|
---|
[378] | 372 | $righedb='';
|
---|
[400] | 373 | global $ctrlerr;
|
---|
| 374 | $ctrlerr=0;
|
---|
[392] | 375 | if(file_exists($trunkadm."/modules/Elezioni/aggiornadb.php")) {
|
---|
[378] | 376 | ob_start();
|
---|
[380] | 377 | include ('modules/Elezioni/aggiornadb.php');
|
---|
[378] | 378 | $righedb=ob_get_contents();
|
---|
| 379 | ob_end_clean();
|
---|
| 380 | }
|
---|
[383] | 381 | #$dir = "./files/";
|
---|
| 382 | if(file_exists($path)){
|
---|
| 383 | $di = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS);
|
---|
[378] | 384 | $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
|
---|
| 385 | foreach ( $ri as $file ) {
|
---|
[381] | 386 | chmod($file, 0777);
|
---|
[378] | 387 | $file->isDir() ? rmdir($file) : unlink($file);
|
---|
| 388 | }
|
---|
| 389 | }
|
---|
[380] | 390 | $_SESSION['localrev']=$newrev;
|
---|
[379] | 391 | ele();
|
---|
[392] | 392 | if($ctrlerr)
|
---|
| 393 | echo "<hr><br><h2 style=\"text-align:center;color:red;\">Aggiornamento completato con errori<br>Controllare i log di aggiornamento del database</h2><hr>";
|
---|
| 394 | else
|
---|
| 395 | echo "<hr><br><h2 style=\"text-align:center;\">Aggiornamento completato</h2><br><hr>";
|
---|
| 396 | echo "<br><h3>Log delle operazioni</h3>";
|
---|
| 397 |
|
---|
[379] | 398 | echo $righe;
|
---|
[392] | 399 | echo "<div id=\"wrapper\">";
|
---|
[427] | 400 | if(strlen($righedb)) {
|
---|
| 401 | echo "<br><p>Operazioni effettuate sul db: </p>";
|
---|
| 402 | echo "<div id=\"feed_div\">";
|
---|
| 403 | echo $righedb;
|
---|
| 404 | echo "</div>";
|
---|
| 405 | } else echo "<br><b>Non ci sono operazioni da eseguire sul DB</b></p>";
|
---|
[392] | 406 | echo "</div>";
|
---|
| 407 | echo "<br><b>Operazioni di aggiornamento concluse.</b><br>";
|
---|
[379] | 408 | include("footer.php");
|
---|
| 409 | die();
|
---|
[378] | 410 |
|
---|
| 411 | ?>
|
---|