archive = $update->archive; $this->path = Common::getConstant('BASE_PATH'); $this->protocol = $this->check_protocol(); //Trigger update $this->update(); } function check_protocol() { if( extension_loaded( 'curl' ) ) { //Curl is loaded return "curl"; } elseif( ini_get('allow_url_fopen') ) { //Remote get file is enabled return "fopen"; } else { //None are enabled exit. return "none"; } } function copyr( $source, $dest ) { // Check for symlinks if (is_link($source)) { return symlink(readlink($source), $dest); } // Simple copy for a file if (is_file($source)) { return copy($source, $dest); } // Make destination directory if (!is_dir($dest)) { mkdir($dest); } // Loop through the folder $dir = dir( $source ); while (false !== $entry = $dir->read()) { // Skip pointers if ($entry == '.' || $entry == '..') { continue; } // Deep copy directories $this->copyr("$source/$entry", "$dest/$entry"); } // Clean up $dir->close(); return true; } ////////////////////////////////////////////////////////////////// // Download latest archive ////////////////////////////////////////////////////////////////// function download() { switch( $this->protocol ) { case( "curl" ): $filepath = $this->path . "/update.zip"; if( file_exists( $filepath ) ) { unlink( $filepath ); } $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $this->archive); //curl_setopt($curl, CURLOPT_POSTFIELDS, ""); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13'); $raw_file_data = curl_exec($curl); curl_close($curl); file_put_contents( $filepath, $raw_file_data ); return ( filesize( $filepath ) > 0 ) ? true : false; break; case( "fopen" ): break; } } function extract() { if ( ! extension_loaded( 'zip' ) ) { echo ""; return false; } $zip = new ZipArchive; if ( $zip->open( $this->path . "/update.zip" ) === TRUE ) { $zip->extractTo( $this->path ); $zip->close(); return true; } else { return false; } } function remove_directory( $path ) { $files = glob($path . '/*'); foreach ($files as $file) { is_dir($file) ? $this->remove_directory($file) : unlink($file); } rmdir($path); return; } function update() { echo ""; if ( ! $this->download() ) { echo ""; return; } echo ""; if ( ! $this->extract() ) { echo ""; return; } echo ""; $src = $this->path . "/codiad-master/"; $src_folder = $this->path . "/codiad-master"; $dest = $this->path . "/"; $this->copyr( $src, $dest ); echo ""; $this->remove_directory( $src ); } } ?> Codiad Update

Telaaedifex Codiad Updater

Starting Update ...
archive = $update->archive; $this->path = Common::getConstant('BASE_PATH'); $this->protocol = $this->check_protocol(); //Trigger update $this->update(); } function check_protocol() { if( extension_loaded( 'curl' ) ) { //Curl is loaded return "curl"; } elseif( ini_get('allow_url_fopen') ) { //Remote get file is enabled return "fopen"; } else { //None are enabled exit. return "none"; } } ////////////////////////////////////////////////////////////////// // Download latest archive ////////////////////////////////////////////////////////////////// function download() { switch( $this->protocol ) { case( "curl" ): $filepath = $this->path . "/update.zip"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $this->archive); //curl_setopt($curl, CURLOPT_POSTFIELDS, ""); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13'); $raw_file_data = curl_exec($curl); curl_close($curl); file_put_contents( $filepath, $raw_file_data ); return ( filesize( $filepath ) > 0 ) ? true : false; break; case( "fopen" ): break; } } function extract() { if ( ! extension_loaded( 'zip' ) ) { echo ""; return false; } $zip = new ZipArchive; if ( $zip->open( $this->path . "/update.zip", ZipArchive::OVERWRITE ) === TRUE ) { $zip->extractTo( $this->path ); $zip->close(); return true; } else { return false; } } function update() { echo ""; if ( ! $this->download() ) { echo ""; } echo ""; if ( ! $this->extract() ) { echo ""; } echo ""; try { exec( "cp -a " ); } catch ( exception $e ) { echo ""; return; } echo ""; exec( "rm -rf " . $this->path . "/update.zip;rm -rf " . $this->path . "/codiad-master" ); } } ?> Codiad Update

Telaaedifex Codiad Updater

Starting Update ...