Server IP : 104.21.14.48 / Your IP : 18.219.24.151 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/plugins/wp-file-manager/classes/ |
Upload File : |
<?php class wp_file_manager_files_restore { public function extract($source, $destination) { if (extension_loaded('zip') === true) { if (file_exists($source) === true) { $zip = new ZipArchive(); $res = $zip->open($source); if ($res === TRUE) { $allfiles = []; for($i = 0; $i < $zip->numFiles; $i++) { $filename = $zip->getNameIndex($i); if (strpos($filename,'wp-file-manager') === false) { $allfiles[] = $zip->getNameIndex($i); } } $zip->extractTo($destination, $allfiles); $zip->close(); $isLocal = explode(':\\',$destination); $path = count($isLocal) > 1 ? str_replace(DIRECTORY_SEPARATOR,'/',$isLocal[1]) : str_replace(DIRECTORY_SEPARATOR,'/',$isLocal[0]); if(is_dir($destination.'/'.$path)){ $is_copied = copy_dir( $destination.'/'.$path, $destination); if($is_copied){ $folderarr = explode('/',$path); if(is_dir($destination.'/'.$folderarr[0])){ $is_deleted = $this->fm_rmdir($destination.'/'.$folderarr[0]); } return true; } } return true; } else { return false; } } else { return false; } } return false; } public function fm_rmdir($src) { $dir = opendir($src); while(false !== ( $file = readdir($dir)) ) { if (( $file != '.' ) && ( $file != '..' )) { $full = $src . '/' . $file; if ( is_dir($full) ) { $this->fm_rmdir($full); } else { unlink($full); } } } closedir($dir); rmdir($src); } }