<?php if( $docroot == '' || !get_var("Attiva aggiornamenti") ){ die( _("Accesso negato!") ); } $tmp = $_FILES['blob']['tmp_name']; $filename = $_FILES['blob']['name']; $filetype = $_FILES['blob']['type']; $size = $_FILES['blob']['size']; $type = $_POST['type']; deltree($docroot."/modules/modulo_agg"); deltree($docroot."/modules/mod_agg"); if( $tmp != '' ){ if( extension_loaded("zip") ){ $zip = new ZipArchive(); if( is_file($tmp) ){ if( strstr( $filename, ".zip" ) ){ if( $zip->open( $tmp ) ){ $tmpdir = "tmp_aggiorna/"; if( !file_exists($docroot."/".$tmpdir) ) mkdir( $docroot."/".$tmpdir, 0755, true ); $zip -> extractTo( $docroot."/".$tmpdir ); //Salvo i file di configurazione e versione attuale $old_config = file_get_contents( $docroot."/config.inc.php" ); //Copia i file dalla cartella temporanea alla root copyr( $docroot."/".$tmpdir, $docroot,'' ); $sql = $docroot . "/tmp_aggiorna/sql_modulo.sql"; $dbo->multiQuery($sql); //Scollego l'utente per eventuali aggiornamenti del db unset( $_SESSION['idutente'] ); unset( $_SESSION['username'] ); unset( $_SESSION['is_admin'] ); redirect( $rootdir, "php" ); //Ripristino il file di configurazione dell'utente file_put_contents( $docroot."/config.inc.php", $old_config ); deltree($docroot."/".$tmpdir); } else{ array_push( $_SESSION['errors'], checkZip($tmp) ); } $zip->close(); } else{ array_push( $_SESSION['errors'], "Il file non é un archivio zip!" ); } } } //Estensione php_zip non caricata else{ array_push( $_SESSION['errors'], "Estensione php_zip non caricata!<br>Verifica e attivala sul tuo php.ini" ); } } ?>