[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 | {
|
---|
| 96 | global $ctrlerr,$righe,$righedb;
|
---|
| 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>";
|
---|
| 99 | else
|
---|
| 100 | echo "<hr><br><h2 style=\"text-align:center;\">Aggiornamento completato</h2><br><hr>";
|
---|
| 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\">";
|
---|
| 152 | echo "<br><table align=\"center\"><tr><td><h3>Procedo con verifica e aggiornamento del solo db (all'ultima versione scaricata)?</h3></td><td><input type=\"submit\" name=\"vai\" value=\""._OK."\"></td></tr></table></form>";
|
---|
| 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";
|
---|
| 162 |
|
---|
| 163 | $headers=get_headers("$host/ele3/changeset/");
|
---|
| 164 |
|
---|
| 165 | $testurl=strlen($headers[0])>0?true:false;
|
---|
| 166 | if($testurl){
|
---|
| 167 | $file = file("$host/ele3/changeset/");
|
---|
| 168 | $cntFile = count($file);
|
---|
| 169 | $fine=0;
|
---|
| 170 | $currentLine=0;
|
---|
| 171 | foreach ($file as $line_num => $line) {
|
---|
| 172 | if(strpos($line,'<title>') ) {$fine=1; continue;}
|
---|
| 173 | if ($fine){
|
---|
| 174 | $newrev=(int) filter_var($line, FILTER_SANITIZE_NUMBER_INT);
|
---|
| 175 | $_SESSION['remoterev']=$newrev;
|
---|
| 176 | break;
|
---|
| 177 | }
|
---|
| 178 | }
|
---|
| 179 | unset($file);
|
---|
| 180 | }else{
|
---|
| 181 | $errmex=2;
|
---|
| 182 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex"); exit;
|
---|
| 183 | }
|
---|
| 184 | #$newrev=$_SESSION['remoterev'];
|
---|
| 185 | $myrev=$_SESSION['localrev'];
|
---|
| 186 | if (isset($_SESSION['forzadb'])) $myrev=378;
|
---|
| 187 | if($newrev==$myrev) {
|
---|
| 188 | $errmex=1;
|
---|
| 189 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex"); exit;
|
---|
| 190 | }
|
---|
| 191 | #####
|
---|
[380] | 192 | if(!$procedi){
|
---|
| 193 | ele();
|
---|
[397] | 194 | if (isset($_SESSION['forzadb']))
|
---|
| 195 | echo "<hr><br><h2 style=\"text-align:center;\">E' necessario riallineare il DB, confermare l'aggiornamento.";
|
---|
| 196 | else
|
---|
| 197 | echo "<hr><br><h2 style=\"text-align:center;\">Revisione installata: $myrev";
|
---|
| 198 | echo "<br>Revisione disponibile: $newrev</h2><br><hr>";
|
---|
| 199 |
|
---|
| 200 | unset($_SESSION['forzadb']);
|
---|
| 201 |
|
---|
[383] | 202 | #####
|
---|
[392] | 203 |
|
---|
[383] | 204 | echo "<div id=\"wrapper\">";
|
---|
| 205 | echo "<br><br><p>Log delle modifiche (massimo 100 righe)</p>";
|
---|
| 206 | echo "<div id=\"feed_div\">";
|
---|
[392] | 207 | $myrev++;
|
---|
[383] | 208 | $rss = simplexml_load_file("$host/ele3/log?format=rss&mode=stop_on_copy&rev=$newrev&stop_rev=$myrev&format=rss&max=100&verbose=on#");
|
---|
| 209 | #$rss = simplexml_load_file("$host/ele3/log?action=follow_copy&mode=stop_on_copy&rev=$newrev&stop_rev=$myrev&limit=100&verbose=on#");
|
---|
| 210 |
|
---|
| 211 | echo '<h2>'. $rss->channel->title . '</h2>';
|
---|
| 212 | foreach ($rss->channel->item as $item)
|
---|
| 213 | {
|
---|
| 214 | echo '<p class="title"><a href="'. $item->link .'">' . $item->title . "</a></p>";
|
---|
| 215 | #$str=preg_replace("--", "<br>--", $item->description );
|
---|
| 216 | $str=preg_replace('/\s\--/','<br>--',$item->description);
|
---|
| 217 | #$str=preg_replace("[^A-Za-z0-9\-]", "<br>", $item->description );
|
---|
| 218 | # $str=preg_replace('/\s\`echo "\040"`/','<br>--',$item->description);
|
---|
| 219 | # $str=htmlentities($item->description);
|
---|
| 220 | echo "<p class='desc'>" . $str . "</p>";
|
---|
| 221 | }
|
---|
| 222 | echo "</div>";
|
---|
| 223 | echo "</div>";
|
---|
| 224 | #####
|
---|
[381] | 225 | $file = file("$host/ele3/log/?format=changelog&limit=100&mode=stop_on_copy&rev=$newrev&stop_rev=$myrev&verbose=off");
|
---|
[380] | 226 | # echo "<br>Procedo con l'aggiornamento? ";
|
---|
| 227 | echo "<form name=\"conferma\" action=\"admin.php\"><input type=\"hidden\" name=\"op\" value=\"aggiorna\">";
|
---|
| 228 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\"><input type=\"hidden\" name=\"procedi\" value=\"1\">";
|
---|
| 229 | 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>";
|
---|
[383] | 230 | /* echo "<br><textarea name=\"log\" rows=\"15\" cols=\"150\">";
|
---|
[380] | 231 | foreach ($file as $line_num => $line) echo "$line";
|
---|
[381] | 232 |
|
---|
[380] | 233 | echo "</textarea>";
|
---|
[383] | 234 | ############Ã */
|
---|
[381] | 235 | $filename = "$host/ele3/changeset?format=zip&new=$newrev&new_path=%2F&old=$myrev&old_path=%2F";
|
---|
| 236 |
|
---|
| 237 | $za = new ZipArchive();
|
---|
[378] | 238 | $path = "./files/";
|
---|
[382] | 239 | $righe='';
|
---|
[379] | 240 | if(file_exists($path)) {
|
---|
| 241 | if (!is_dir($path)) {
|
---|
[412] | 242 | $errmex=3;
|
---|
| 243 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=$path"); exit;
|
---|
[379] | 244 | }
|
---|
| 245 | else
|
---|
| 246 | $righe.= "<br>La cartella $path Ú già presente, procedo con l'aggiornamento";
|
---|
| 247 | }else{
|
---|
[378] | 248 | $righe.= "<br>La cartella $path non Ú presente, procedo con la creazione";
|
---|
| 249 | mkdir($path, 0777, true);
|
---|
| 250 | }
|
---|
[383] | 251 | /* $newfile=$path."aggiornamento".$newrev;
|
---|
[381] | 252 | copy($filename,$newfile);
|
---|
| 253 | $za->open($newfile);
|
---|
| 254 | echo "<br>prima";
|
---|
| 255 | for( $i = 0; $i < $za->numFiles; $i++ ){
|
---|
| 256 | echo "<br>$i - dentro";
|
---|
| 257 | $stat = $za->statIndex( $i );
|
---|
| 258 | print_r( $stat['name'] . PHP_EOL );
|
---|
| 259 | }
|
---|
[383] | 260 | */ ############
|
---|
| 261 | include("footer.php");die();
|
---|
[412] | 262 | }
|
---|
[383] | 263 | $admin = '../admin';
|
---|
| 264 | $client = '../client';
|
---|
[381] | 265 | # $path = "/tmp/files";
|
---|
[392] | 266 | $backup = "backup".$myrev;
|
---|
[383] | 267 | $path = "./files/";
|
---|
| 268 | $righe='';
|
---|
[381] | 269 | /* if(file_exists($path)) {
|
---|
[383] | 270 | $i=1;
|
---|
| 271 | $ispath=$path;
|
---|
| 272 | while(file_exists($ispath))
|
---|
| 273 | $ispath=$path.$i++;
|
---|
| 274 | $path.=--$i.'/';
|
---|
| 275 | }else $path.='/';
|
---|
| 276 | if (!is_dir($path)) {
|
---|
| 277 | if(false===rename($path,$path."_da_".$myrev."_a_".$newrev)) {
|
---|
| 278 | $errmex="E' presente un file di nome $path nella cartella admin, va cancellato per poter aggiornare";
|
---|
| 279 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex"); exit;
|
---|
[381] | 280 | }
|
---|
[383] | 281 | $righe.= "<br>La cartella $path non Ú presente, procedo con la creazione";
|
---|
| 282 | mkdir($path, 0777, true);
|
---|
[379] | 283 | }
|
---|
[383] | 284 | else
|
---|
| 285 | $righe.= "<br>La cartella $path Ú già presente, procedo con l'aggiornamento";
|
---|
| 286 | }else{
|
---|
| 287 | $righe.= "<br>Creo la cartella $path";
|
---|
| 288 | mkdir($path, 0777, true);*/
|
---|
| 289 | $trunk=$path.'trunk';
|
---|
| 290 | $trunkadm=$trunk.'/admin';
|
---|
| 291 | $trunkcli=$trunk.'/client';
|
---|
| 292 | # }
|
---|
| 293 | # if(!file_exists($trunk)) if (false === mkdir($trunk)) { die("Impossibile creare la cartella trunk, il programma viene interrotto");}
|
---|
| 294 | # if(!copy($file,$trunkadm)){ $righe.= "<br>Errore durante la copia del pacchetto di aggiornamento<br>";}
|
---|
| 295 | // Nome del file zip : https://trac.eleonline.it/ele3/changeset?format=zip&new=377&new_path=%2F&old=360&old_path=%2F
|
---|
| 296 | # https://trac.eleonline.it/ele3/browser/trunk?format=zip&rev=377
|
---|
| 297 |
|
---|
| 298 | $filename = "$host/ele3/changeset?format=zip&new=$newrev&new_path=%2F&old=$myrev&old_path=%2F";
|
---|
| 299 | $newfile=$path."aggiornamento".$newrev;
|
---|
| 300 | if(!copy($filename,$newfile)){
|
---|
[412] | 301 | $errmex=4;
|
---|
| 302 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=$newfile"); exit;
|
---|
[383] | 303 | }
|
---|
| 304 | $zip = new ZipArchive;
|
---|
| 305 | $res = $zip->open($newfile);
|
---|
[382] | 306 | ############
|
---|
| 307 | #$za = new ZipArchive();
|
---|
[381] | 308 |
|
---|
| 309 | #$za->open('theZip.zip');
|
---|
[382] | 310 | # $za->open($newfile);
|
---|
| 311 | /*
|
---|
[381] | 312 | for( $i = 0; $i < $za->numFiles; $i++ ){
|
---|
| 313 | $stat = $za->statIndex( $i );
|
---|
| 314 | print_r( basename( $stat['name'] ) . PHP_EOL );
|
---|
| 315 | }
|
---|
[382] | 316 | die(); */
|
---|
[381] | 317 | ################
|
---|
[378] | 318 | $righe.= "<br>$newfile scaricato";
|
---|
| 319 | if ($res === TRUE) {
|
---|
| 320 | $zip->extractTo($path);
|
---|
| 321 | $zip->close();
|
---|
| 322 | $righe.= '<br>File zip estratto';
|
---|
| 323 | } else {
|
---|
[412] | 324 | $errmex= 5;
|
---|
[379] | 325 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex"); exit;
|
---|
[378] | 326 | }
|
---|
[381] | 327 | if(file_exists($path.$backup)) {
|
---|
| 328 | $i=1;
|
---|
| 329 | $isback=$path.$backup;
|
---|
| 330 | while(file_exists($isback))
|
---|
| 331 | $isback=$path.$backup.$i++;
|
---|
| 332 | $backup=$path.$backup.$i.'/';
|
---|
| 333 | } else $backup=$path.$backup.'/';
|
---|
| 334 | /* if(false===rename($backup,$backup."_a_".$myrev)) {
|
---|
| 335 | $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] | 336 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex"); exit;
|
---|
[381] | 337 | }
|
---|
| 338 | }else{ */
|
---|
| 339 | $righe.= "<br>Creo la cartella di backup: $backup";
|
---|
| 340 | mkdir($backup, 0755);
|
---|
| 341 | # }
|
---|
[378] | 342 | $righe.= "<br><br><b>Copio i nuovi files nell'installazione di amministrazione locale</b>";
|
---|
[381] | 343 | recurse_copy($trunkadm,$admin,$backup.'/admin/');
|
---|
[378] | 344 | $righe.= "<br>Files di aggiornamento copiati correttamente.";
|
---|
| 345 | $righe.= "<br><br><b>Copio i nuovi files nell'installazione client locale</b>";
|
---|
[381] | 346 | recurse_copy($trunkcli,$client,$backup.'/client/');
|
---|
[378] | 347 | $righe.= "<br>Files di aggiornamento copiati correttamente.";
|
---|
[380] | 348 | function recurse_copy($src,$dst,$bck) {
|
---|
[378] | 349 | $dir = opendir($src);
|
---|
[379] | 350 | if(!file_exists($dst))
|
---|
| 351 | if(@mkdir($dst)==false) {
|
---|
[412] | 352 | $errmex= 6;
|
---|
| 353 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=$dst"); exit;
|
---|
[379] | 354 | }
|
---|
[380] | 355 | if(!file_exists($bck))
|
---|
[381] | 356 | if(mkdir($bck,0777,true)==false) {
|
---|
[412] | 357 | $errmex= 7;
|
---|
| 358 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=$bck"); exit;
|
---|
[380] | 359 | }
|
---|
[378] | 360 | while(false !== ( $file = readdir($dir)) ) {
|
---|
| 361 | if (( $file != '.' ) && ( $file != '..' )) {
|
---|
| 362 | if ( is_dir($src . '/' . $file) ) {
|
---|
[380] | 363 | recurse_copy($src . '/' . $file,$dst . '/' . $file,$bck . '/' . $file);
|
---|
[378] | 364 | }
|
---|
| 365 | else {
|
---|
[381] | 366 | if(file_exists($dst . '/' . $file))
|
---|
| 367 | if(false===copy($dst . '/' . $file,$bck . '/' . $file)) {
|
---|
[412] | 368 | $errmex= 8;
|
---|
| 369 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=$bck/$file"); exit;
|
---|
[381] | 370 | }
|
---|
[380] | 371 | if(!copy($src . '/' . $file,$dst . '/' . $file)) {
|
---|
[412] | 372 | $errmex= 8;
|
---|
| 373 | Header("Location: admin.php?op=aggiorna&id_cons_gen=$id_cons_gen&errmex=$errmex&file=".$dst . '/' . $file); exit;
|
---|
[379] | 374 | }
|
---|
[378] | 375 | }
|
---|
| 376 | }
|
---|
| 377 | }
|
---|
| 378 | closedir($dir);
|
---|
| 379 | }
|
---|
[412] | 380 |
|
---|
[378] | 381 | $righedb='';
|
---|
[400] | 382 | global $ctrlerr;
|
---|
| 383 | $ctrlerr=0;
|
---|
[392] | 384 | if(file_exists($trunkadm."/modules/Elezioni/aggiornadb.php")) {
|
---|
[378] | 385 | ob_start();
|
---|
[380] | 386 | include ('modules/Elezioni/aggiornadb.php');
|
---|
[378] | 387 | $righedb=ob_get_contents();
|
---|
| 388 | ob_end_clean();
|
---|
| 389 | }
|
---|
[383] | 390 | #$dir = "./files/";
|
---|
| 391 | if(file_exists($path)){
|
---|
| 392 | $di = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS);
|
---|
[378] | 393 | $ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
|
---|
| 394 | foreach ( $ri as $file ) {
|
---|
[381] | 395 | chmod($file, 0777);
|
---|
[378] | 396 | $file->isDir() ? rmdir($file) : unlink($file);
|
---|
| 397 | }
|
---|
| 398 | }
|
---|
[380] | 399 | $_SESSION['localrev']=$newrev;
|
---|
[379] | 400 | ele();
|
---|
[392] | 401 | if($ctrlerr)
|
---|
| 402 | echo "<hr><br><h2 style=\"text-align:center;color:red;\">Aggiornamento completato con errori<br>Controllare i log di aggiornamento del database</h2><hr>";
|
---|
| 403 | else
|
---|
| 404 | echo "<hr><br><h2 style=\"text-align:center;\">Aggiornamento completato</h2><br><hr>";
|
---|
| 405 | echo "<br><h3>Log delle operazioni</h3>";
|
---|
| 406 |
|
---|
[379] | 407 | echo $righe;
|
---|
[392] | 408 | echo "<div id=\"wrapper\">";
|
---|
| 409 | echo "<br><p>Operazioni effettuate sul db: </p>";
|
---|
| 410 | echo "<div id=\"feed_div\">";
|
---|
| 411 | echo $righedb;
|
---|
| 412 | echo "</div>";
|
---|
| 413 | echo "</div>";
|
---|
| 414 | echo "<br><b>Operazioni di aggiornamento concluse.</b><br>";
|
---|
[379] | 415 | include("footer.php");
|
---|
| 416 | die();
|
---|
[378] | 417 |
|
---|
| 418 | ?>
|
---|