Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace App\File; use Symfony\Component\Finder\Finder; use App\System\CommandExe..

Decoded Output download

<?php 
 namespace App\File; use Symfony\Component\Finder\Finder; use App\System\CommandExecutor; use App\System\Command; use App\System\Command\CopyFileCommand; use App\System\Command\ChownCommand; use App\System\Command\ChmodCommand; use App\System\Command\FindChmodCommand; use App\System\Command\MoveFileCommand; use App\System\Command\CreateDirectoryCommand; use App\System\Command\DeleteFileCommand; use App\System\Command\DeleteDirectoryCommand; use App\System\Command\BsdTarExtractCommand; use App\System\Command\GunzipCommand; class Manager { private const MAX_FILES_TO_COMPRESS = 100000; private const TYPE_FOLDER = "folder"; private string $user; protected CommandExecutor $commandExecutor; private array $fileExtensionMap = ["ai" => "ai", "aut" => "aut", "avi" => "avi", "bin" => "bin", "bmp" => "bmp", "bmp" => "bmp", "cad" => "cad", "cdr" => "cdr", "css" => "css", "csv" => "csv", "db" => "db", "doc" => "doc", "docx" => "docx", "eps" => "eps", "exe" => "exe", "flv" => "flv", "gif" => "gif", "hlp" => "hlp", "htm" => "htm", "ini" => "ini", "iso" => "iso", "java" => "java", "jpg" => "jpg", "jpeg" => "jpg", "js" => "js", "mkv" => "mkv", "mov" => "mov", "mp3" => "mp3", "mp4" => "mp4", "mpg" => "mpg", "mpeg" => "mpeg", "html" => "html", "php" => "php", "phtml" => "php", "pdf" => "pdf", "png" => "png", "ppt" => "ppt", "ps" => "ps", "psd" => "psd", "rar" => "rar", "rss" => "rss", "rtf" => "rtf", "sql" => "sql", "svg" => "svg", "swf" => "swf", "sys" => "sys", "txt" => "txt", "wma" => "wma", "xls" => "xls", "xml" => "xml", "gz" => "gz", "tgz" => "gz", "tar" => "tar", "zip" => "zip"]; private array $fileGroups = ["code" => ["html", "htm", "js", "json", "css", "scss", "sass", "less", "php", "phtml", "sh", "coffee", "txt", "log", "md", "go", "yml", "files"], "document" => ["docx", "doc", "odt", "xls", "xslx", "pdf", "djvu", "djv", "pptx", "ppt"], "archive" => ["rar", "tar", "tgz", "gz", "zip"], "audio" => ["mp3", "ogg", "flac", "wav"], "video" => ["mpg", "mp4", "avi", "mkv", "ogv"], "image" => ["png", "jpg", "jpeg", "webp", "gif", "tiff", "tif", "svg"]]; public function __construct(string $user) { $this->user = $user; $this->commandExecutor = new CommandExecutor(); } public function getFolders(string $directory) : array { goto F545f; E8790: $i = 0; goto a8343; C0df0: C2778: goto D87c8; a6d40: $finder->depth(0); goto a9fce; a8343: foreach ($finder as $splFileInfo) { goto C6d89; Ffb0e: $id = implode("/", array_slice($realPath, 2, count($realPath))); goto ef09c; d612c: d5c9e: goto daafe; A3f3f: $folders[$i] = ["value" => htmlspecialchars($splFileInfo->getFilename(), ENT_QUOTES), "id" => sprintf("/%s", htmlspecialchars($id, ENT_QUOTES)), "size" => 4096, "date" => $splFileInfo->getMTime(), "permissions" => $filePermissions, "type" => "folder"]; goto Ff966; C6d89: $realPath = array_filter(explode("/", $splFileInfo->getRealPath())); goto Ffb0e; c5e3c: unset($folders[$i]["data"]); goto d612c; ef09c: $filePermissions = substr(sprintf("%o", $splFileInfo->getPerms()), -4); goto A3f3f; d9a65: $i++; goto C0b08; Ff966: if (!(true === empty($folders[$i]["data"]))) { goto d5c9e; } goto c5e3c; C0b08: D89e1: goto d1414; daafe: usort($folders, function ($a, $b) { return strcasecmp($a["value"], $b["value"]); }); goto d9a65; d1414: } goto e6d53; e6d53: C3764: goto C0df0; F1783: if (!(true === $finder->hasResults())) { goto C2778; } goto E8790; a9fce: $finder->sortByName(true); goto F1783; Dd40a: $finder = new Finder(); goto fcbe7; fcbe7: $finder->in($directory); goto C1d1f; d1520: $finder->directories(); goto a6d40; D87c8: return $folders; goto dfdd7; C1d1f: $finder->ignoreDotFiles(false); goto d1520; F545f: $folders = []; goto Dd40a; dfdd7: } public function getFiles(string $directory) : array { goto b9692; E4dbc: $tmpFiles = []; goto f26e3; Ef666: return $files; goto Ee590; ff9ed: fd2b9: goto F780e; F780e: $files = array_merge($tmpFolders, $tmpFiles); goto f31b2; c08ab: if (!(true === $finder->hasResults())) { goto D54b3; } goto fab87; f26e3: foreach ($finder as $fileInfo) { goto a986e; a986e: $file = $this->getFileData($fileInfo); goto A5456; Ffa18: dd9e1: goto D9b3f; d4598: Cf9b9: goto E5422; A5456: if (true === isset($file["type"]) && self::TYPE_FOLDER == $file["type"]) { goto Cf9b9; } goto C7aa8; b4579: C7105: goto Ffa18; C7aa8: $tmpFiles[] = $file; goto df831; E5422: $tmpFolders[] = $file; goto b4579; df831: goto C7105; goto d4598; D9b3f: } goto ff9ed; ceffd: $finder->ignoreDotFiles(false); goto Dda98; Fb046: $finder = new Finder(); goto d4beb; b9692: $files = []; goto Fb046; Dda98: $finder->depth(0); goto d9ece; d9ece: $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strnatcasecmp($a->getRealPath(), $b->getRealPath()); }); goto c08ab; f31b2: D54b3: goto Ef666; fab87: $tmpFolders = []; goto E4dbc; d4beb: $finder->in($directory); goto ceffd; Ee590: } public function getFileContent(string $file) : string { goto afed9; b4069: $fileContent = file_get_contents($file); goto ad321; afed9: $fileContent = ''; goto A5757; E42c7: return $fileContent; goto B3f3c; ad321: Db309: goto E42c7; A5757: if (!(true === file_exists($file))) { goto Db309; } goto b4069; B3f3c: } public function writeFileContent(string $file, string $content) : array { goto Cd625; de770: b8f1a: goto B3bfd; A3f68: return $data; goto af7cc; ee0ab: $data = $this->getFileData($fileInfo); goto de770; Fcb38: $fileInfo = new \SplFileInfo($file); goto bd198; f7ad1: if (!(true === file_exists($file))) { goto D5b86; } goto E28f7; bd198: $this->resetPermissions($fileInfo); goto ee0ab; B3bfd: D5b86: goto A3f68; Cd625: $data = []; goto f7ad1; E28f7: if (!file_put_contents($file, $content)) { goto b8f1a; } goto Fcb38; af7cc: } public function rename(string $from, string $to) : array { goto fc166; E6995: $fileData = $this->getFileData($fileInfo); goto db818; Eed27: return $data; goto Bcd82; fc166: $data = []; goto a2a0c; B0747: $this->resetPermissions($fileInfo); goto E6995; db818: $data = ["invalid" => false, "error" => '', "id" => $fileData["id"]]; goto D6ac1; e61cf: $fileInfo = new \SplFileInfo($to); goto B0747; f4cca: $to = sprintf("%s/%s", $fileInfo->getPath(), $to); goto d5cb8; D6ac1: ede02: goto Eed27; d5cb8: @rename($from, $to); goto e61cf; a2a0c: if (!(true === file_exists($from))) { goto ede02; } goto cd53c; cd53c: $fileInfo = new \SplFileInfo($from); goto f4cca; Bcd82: } public function delete(string $file) : array { goto a6b4e; D3eca: try { goto df5b7; b0c11: Fce2d: goto D1fa2; ac273: goto Bd65f; goto b0c11; D1fa2: $deleteCommand = new DeleteDirectoryCommand(); goto Faa64; fd219: $deleteCommand = new DeleteFileCommand(); goto E50df; Faa64: $deleteCommand->setDirectory($file); goto af614; Febcb: if (true === $fileInfo->isDir()) { goto Fce2d; } goto fd219; E50df: $deleteCommand->setFile($file); goto ac273; bb542: $data = ["invalid" => false, "error" => '', "id" => '']; goto C1e93; A7b6c: $this->executeCommand($deleteCommand); goto bb542; af614: Bd65f: goto A7b6c; df5b7: $fileInfo = new \SplFileInfo($file); goto Febcb; C1e93: } catch (\Exception $e) { } goto ab5b8; ea9d8: if (!(true === file_exists($file))) { goto b6f6f; } goto D3eca; a6b4e: $data = []; goto ea9d8; f4fc9: return $data; goto c3075; ab5b8: b6f6f: goto f4fc9; c3075: } public function download(string $file) : void { goto f2fbd; Ee7bc: $fileInfo = new \SplFileInfo($file); goto Edd3f; c2843: exit; goto e8c4e; B6e0c: header("Content-Disposition: attachment; filename=" . $filename); goto B3aa9; Ba71c: header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); goto d4aae; a873f: $finfo = finfo_open(FILEINFO_MIME_TYPE); goto aede5; B3aa9: header("Content-Transfer-Encoding: binary"); goto C5f7c; Edd3f: $filename = $fileInfo->getFilename(); goto a873f; A042b: readfile($file); goto c2843; c853f: ob_clean(); goto A238c; d4aae: header("Pragma: public"); goto f192f; f192f: header("Content-Length: " . filesize($file)); goto c853f; A238c: flush(); goto A042b; f2fbd: if (!(true === file_exists($file))) { goto ddf20; } goto Ee7bc; e8c4e: ddf20: goto eaa36; C5f7c: header("Expires: 0"); goto Ba71c; aede5: header("Content-Type: " . finfo_file($finfo, $file)); goto E5535; f054a: header("Content-Description: File Transfer"); goto B6e0c; E5535: finfo_close($finfo); goto f054a; eaa36: } public function upload(string $fileUploadPath, string $directory, string $tmpFile, string $id) : array { goto d9a8b; Ec2c9: $fileInfo = new \SplFileInfo($file); goto c5935; d381d: $fileUploadDirectory = $filePathInfo->getPathName(); goto C6fe4; a0ec5: $this->resetPermissions($fileInfo, true); goto Ec2c9; E3daa: return $data; goto b457c; Ac7e0: $filePathInfo = $fileInfo->getPathInfo(); goto d381d; A4f72: Aaa2e: goto b09a4; b57ed: $fileInfo = new \SplFileInfo($file); goto Ac7e0; b09a4: d8b35: goto E3daa; C6fe4: if (!(false === is_null($fileUploadDirectory))) { goto Aaa2e; } goto f7cd6; d9a8b: $data = []; goto Ad320; ac37b: $fileInfo = new \SplFileInfo($directory); goto a0ec5; Ff092: @move_uploaded_file($tmpFile, $file); goto ac37b; c5935: $data = $this->getFileData($fileInfo); goto c822e; c822e: $data["uid"] = $id; goto A4f72; De738: $file = sprintf("%s/%s", rtrim($directory, "/"), $fileUploadPath); goto b57ed; f7cd6: @mkdir($fileUploadDirectory, 0777, true); goto Ff092; Ad320: if (!(true === is_dir($directory) && true === file_exists($tmpFile))) { goto d8b35; } goto De738; b457c: } public function copy(string $file, string $directory) : array { goto b93e8; A2ca2: goto eb0f2; goto aeb1f; D270b: $filename = $fileInfo->getFilename(); goto D0667; b93e8: $data = []; goto B911f; cef26: return $data; goto e7957; efc35: $copyFileCommand->setDestinationFile($fileToCopy); goto Bead6; F31c2: $fileInfo = new \SplFileInfo($file); goto D270b; A36a7: $data = $this->getFileData($fileInfo); goto Bcd98; aeb1f: d662e: goto Bb93a; e508b: $fileToCopy = sprintf("%s/%s", rtrim($directory, "/)"), $copiedFilename); goto A2ca2; Bead6: $copyFileCommand->setRecursive(true); goto b0752; a39e4: $copyFileCommand = new CopyFileCommand(); goto efd5a; b0752: $this->executeCommand($copyFileCommand); goto B6811; B911f: if (!(true === file_exists($file) && true === is_dir($directory))) { goto a7b60; } goto F31c2; d54ee: $fileToCopy = sprintf("%s/%s", rtrim($directory, "/)"), $copiedFilename); goto Fc7d7; Bcd98: a7b60: goto cef26; Fc823: $fileExtension = $fileInfo->getExtension(); goto df4ee; df4ee: $copiedFilename = str_replace([sprintf(".%s", $fileExtension)], [''], $filename); goto fe2ab; fe2ab: $copiedFilename = sprintf("%s_copy.%s", $copiedFilename, $fileExtension); goto e508b; B6811: $fileInfo = new \SplFileInfo($fileToCopy); goto C12aa; Fc7d7: eb0f2: goto a39e4; C12aa: $this->resetPermissions($fileInfo, false); goto A36a7; efd5a: $copyFileCommand->setSourceFile($file); goto efc35; D0667: if (true === $fileInfo->isDir()) { goto d662e; } goto Fc823; Bb93a: $copiedFilename = sprintf("%s_copy", $filename); goto d54ee; e7957: } public function move(string $file, string $directory) : array { goto b1cab; af048: $moveFileCommand = new MoveFileCommand(); goto A6b78; f84ef: c0339: goto f3738; fb5ee: $fileInfo = new \SplFileInfo($fileToMove); goto b5481; a43b8: $filename = $fileInfo->getFilename(); goto d0e22; Abc27: $moveFileCommand->setDestinationFile($fileToMove); goto ab9c5; b5481: $this->resetPermissions($fileInfo, false); goto ca9c9; ca9c9: $data = $this->getFileData($fileInfo); goto f84ef; f3738: return $data; goto Be840; ab9c5: $this->executeCommand($moveFileCommand); goto fb5ee; d0e22: $fileToMove = sprintf("%s/%s", rtrim($directory, "/)"), $filename); goto af048; A6b78: $moveFileCommand->setSourceFile($file); goto Abc27; b1cab: $data = []; goto D7825; D7825: if (!(true === file_exists($file) && true === is_dir($directory))) { goto c0339; } goto b5d7f; b5d7f: $fileInfo = new \SplFileInfo($file); goto a43b8; Be840: } public function makeFile(string $filename, string $directory, string $homeDirectory) : array { goto dad31; Ef4c0: $this->resetPermissions($fileInfo, false); goto ad39b; ec405: $file = sprintf("%s/%s", rtrim($directory, "/"), $filename); goto cbb51; Cc50c: $fileInfo = new \SplFileInfo($file); goto dc550; De3ed: Cf36d: goto fa5d3; be1df: exit(sprintf("Not a valid file: %s", $realpathFile)); goto De3ed; Dec77: if (!(true === is_dir($directory))) { goto daaf1; } goto ec405; cbb51: @touch($file); goto Cc50c; dc550: if (!(true === $fileInfo->isLink())) { goto D3728; } goto B2469; Eb816: return $data; goto Cfc72; fa5d3: D3728: goto Ef4c0; B2469: $realpathFile = $fileInfo->getRealPath(); goto F65d1; F65d1: if (!(false === str_starts_with($realpathFile, $homeDirectory))) { goto Cf36d; } goto be1df; dad31: $data = []; goto Dec77; ad39b: $data = $this->getFileData($fileInfo); goto ee9c9; ee9c9: daaf1: goto Eb816; Cfc72: } public function makeDirectory(string $directoryName, $directory) : array { goto ea678; f51d5: $data = $this->getFileData($fileInfo); goto e6d49; eff25: $fileInfo = new \SplFileInfo($newDirectory); goto c2ff1; ee7cc: if (!(true === is_dir($directory))) { goto b4cbb; } goto Dc86a; ea678: $data = []; goto ee7cc; Dc86a: $newDirectory = sprintf("%s/%s", rtrim($directory, "/"), $directoryName); goto a9344; a9344: @mkdir($newDirectory); goto eff25; e6d49: b4cbb: goto ba963; ba963: return $data; goto F0304; c2ff1: $this->resetPermissions($fileInfo, false); goto f51d5; F0304: } private function getFileData(\SplFileInfo $fileInfo) : array { goto C9e1e; C9e1e: $fileData = []; goto Af8cc; Af8cc: try { goto f2c10; aa743: $id = implode("/", array_slice($realPath, 2, count($realPath))); goto Aa184; D503c: $fileOwner = sprintf("%s:%s", $fileOwnerInformation["name"] ?? '', $fileGroupInformation["name"] ?? ''); goto C9dc4; B9027: $fileGroupInformation = posix_getgrgid($fileInfo->getGroup()); goto D503c; Fcd56: if (!(false === $fileInfo->isDir())) { goto D41cc; } goto F25ae; ddc3f: $fileData = ["value" => htmlspecialchars($filename, ENT_QUOTES), "id" => sprintf("/%s", htmlspecialchars($id, ENT_QUOTES)), "size" => $fileSize, "owner" => $fileOwner, "permissions" => $filePermissions, "date" => $fileDate, "type" => $fileType]; goto Fcd56; f2c10: $filename = $fileInfo->getFilename(); goto Afab3; faa8f: $fileOwnerInformation = posix_getpwuid($fileInfo->getOwner()); goto B9027; F25ae: $fileExtension = $this->mapFileExtension($fileInfo->getExtension()); goto b7d54; b7d54: $fileData["ext"] = $fileExtension; goto Ee4a8; Afab3: $realPath = array_filter(explode("/", $fileInfo->getRealPath())); goto aa743; Ee4a8: D41cc: goto fd621; f05f1: $filePermissions = substr(sprintf("%o", $fileInfo->getPerms()), -4); goto faa8f; C9dc4: $fileDate = $fileInfo->getMTime(); goto B79ee; Aa184: $fileSize = $fileInfo->getSize(); goto f05f1; B79ee: $fileType = $this->getFileType($fileInfo); goto ddc3f; fd621: } catch (\Exception $e) { } goto A2172; A2172: return $fileData; goto b3e40; b3e40: } private function getFileType(\SplFileInfo $fileInfo) { goto C83b8; d1880: if (true === $fileInfo->isDir()) { goto Ce91e; } goto c78f2; A8beb: Fece3: goto a3b2c; C83b8: $fileType = "code"; goto d1880; bc688: foreach ($this->fileGroups as $type => $extensions) { goto D5de8; a80ed: goto cbb69; goto C4e16; C4e16: F3373: goto e4ea2; D5de8: if (!(true === in_array($fileExtension, $extensions))) { goto F3373; } goto c65c1; e4ea2: B6692: goto Ac33f; c65c1: $fileType = $type; goto a80ed; Ac33f: } goto b8ef4; c78f2: $fileExtension = $fileInfo->getExtension(); goto bc688; c587e: Ce91e: goto b9e8a; e2adb: goto Fece3; goto c587e; a3b2c: return $fileType; goto eaddd; b8ef4: cbb69: goto e2adb; b9e8a: $fileType = "folder"; goto A8beb; eaddd: } public function permissions(string $file, string $permissions) : array { goto C9992; bc3ee: Dd8ba: goto bb63f; F0a2e: $chownCommand->setRecursive(true); goto D1686; b7230: $this->executeCommand($chmodCommand, 600); goto cf867; ecf54: $chmodCommand->setFile($file); goto d4cee; C6c7a: $chmodCommand->setFileChmod($permissions); goto B5788; dc96b: $data = ["invalid" => false, "error" => '', "id" => $fileData["id"], "permissions" => $permissions]; goto bc3ee; e7179: $chownCommand->setFile($file); goto F0a2e; D1686: $chownCommand->setUser($this->user); goto b1050; c52c5: $chownCommand = new ChownCommand(); goto e7179; ac0ce: $fileInfo = new \SplFileInfo($file); goto c52c5; d4cee: $chmodCommand->setDirectoryChmod($permissions); goto C6c7a; cf867: $fileData = $this->getFileData($fileInfo); goto dc96b; bb63f: return $data; goto A88ea; D8e45: $file = realpath($file); goto D3ac0; B5788: $this->executeCommand($chownCommand, 600); goto b7230; c0632: $chmodCommand = new FindChmodCommand(); goto ecf54; C9992: $data = []; goto D8e45; b1050: $chownCommand->setGroup($this->user); goto c0632; D2367: if (!(true === str_starts_with($file, $homeDirectory) && true === file_exists($file))) { goto Dd8ba; } goto ac0ce; D3ac0: $homeDirectory = sprintf("/home/%s/", $this->user); goto D2367; A88ea: } public function extract(string $file, string $destinationDirectoryName) : array { goto A4163; Ed042: return $data; goto ac3d9; A4163: $data = []; goto E1337; E1337: try { goto Fbec7; c238b: $copyFileCommand->setDestinationFile($gzipFile); goto Cc2d3; C9ff1: if ("tar.gz" == substr($filename, -6)) { goto F2331; } goto A30ea; B64d7: $destinationDirectory = sprintf("%s/%s", rtrim($filePathInfo->getPathName(), "/"), rtrim($destinationDirectoryName, "/")); goto c88e3; dfd43: $bsdTarExtractCommand->setSourceFile($file); goto cf33d; e6203: $data["path"] = $path; goto B64d7; d68b0: $filePathInfo = $fileInfo->getPathInfo(); goto e17c0; C68fd: if (!(true === is_dir($destinationDirectory))) { goto D2e4b; } goto d6990; A30ea: $fileExtension = $fileInfo->getExtension(); goto Bc239; B0ce6: df389: goto C68fd; aba15: D2e4b: goto F4004; A1fca: $this->executeCommand($createDirectoryCommand); goto E1b34; D4d16: $this->resetPermissions($fileInfo, true); goto aba15; cbd73: $this->executeCommand($copyFileCommand); goto F22db; F4004: E4eff: goto e4efa; f22f1: $fileExtension = "tar.gz"; goto cd16b; d6990: $fileInfo = new \SplFileInfo($destinationDirectory); goto D4d16; D912c: $fileInfo = new \SplFileInfo($file); goto dce66; A057b: $copyFileCommand = new CopyFileCommand(); goto ac201; Bc239: goto F99dd; goto B16b5; c88e3: if (true === in_array($fileExtension, ["tar", "tgz", "tar.gz", "rar", "zip"])) { goto E1265; } goto Becde; c15ae: $createDirectoryCommand->setDirectory($destinationDirectory); goto A057b; A8a31: $path = array_slice($path, 2, count($path)); goto A1a39; F8c7d: E1265: goto Cf4fb; db82a: acee9: goto c4b01; e17c0: $path = array_filter(explode("/", $fileInfo->getRealPath())); goto A8a31; cd16b: F99dd: goto d68b0; c4b01: goto df389; goto F8c7d; B6e9c: $createDirectoryCommand = new CreateDirectoryCommand(); goto c15ae; ac201: $copyFileCommand->setSourceFile($file); goto c238b; Becde: if (!("gz" == $fileExtension)) { goto acee9; } goto bbf4d; Fb8d2: $this->executeCommand($createDirectoryCommand); goto cbd73; Cf4fb: $createDirectoryCommand = new CreateDirectoryCommand(); goto e5261; E4938: $bsdTarExtractCommand = new BsdTarExtractCommand(); goto dfd43; Fbec7: if (!(true === file_exists($file))) { goto E4eff; } goto D912c; Cc2d3: $gunzipCommand = new GunzipCommand(); goto F13ca; cf33d: $bsdTarExtractCommand->setDestinationFile($destinationDirectory); goto A1fca; A1a39: array_pop($path); goto d4ba6; bbf4d: $gzipFile = sprintf("%s/%s", rtrim($destinationDirectory, "/"), $filename); goto B6e9c; F22db: $this->executeCommand($gunzipCommand); goto db82a; E1b34: $this->executeCommand($bsdTarExtractCommand, 3600); goto B0ce6; e5261: $createDirectoryCommand->setDirectory($destinationDirectory); goto E4938; B16b5: F2331: goto f22f1; F13ca: $gunzipCommand->setFile($gzipFile); goto Fb8d2; dce66: $filename = $fileInfo->getFilename(); goto C9ff1; d4ba6: $path = sprintf("/%s", implode("/", $path)); goto e6203; e4efa: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["error"] = $errorMessage; } goto Ed042; ac3d9: } public function compress(array $files, string $targetDirectory, string $id, string $homeDirectory) : array { goto C7ad0; Bc8e0: return $data; goto c38c9; E00ec: try { goto F08fa; d2b7e: $this->resetPermissions($fileInfo); goto E38a3; Ba6f7: throw new \Exception(sprintf("Cannot create zip file "%s".", $zipArchive)); goto b166a; c497c: a2893: goto a97c7; B5000: foreach ($files as $file) { goto F7103; db387: if (!(true === $fileInfo->isDir())) { goto d3ad2; } goto e60d3; Cc76e: f2eb0: goto Ad7db; e60d3: $directory = $fileInfo->getPathname(); goto D8c00; Ad7db: b63b1: goto e9b15; D8ebb: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto E561f; A793f: $entryName = ltrim(str_replace($targetDirectory, '', $fileInfo->getPathname()), "/"); goto cbc2b; cbc2b: $entryName = array_filter(explode("/", $entryName)); goto c0047; c52c2: a4b6e: goto A793f; f63cd: exit(sprintf("Not a valid file: %s", $realpathFile)); goto Bb246; E47e2: if (!(false === str_starts_with($realpathFile, $homeDirectory))) { goto B7cc9; } goto f63cd; c6aeb: f8d0c: goto ec8c9; A7c5e: if (!(true === $fileInfo->isLink())) { goto a4b6e; } goto Ae17f; ec8c9: C002e: goto ef69f; C9c2f: $filepath = $fileInfo->getPathname(); goto A7c5e; E561f: if (!(true === $fileInfo->isFile())) { goto f8d0c; } goto D0a97; e8980: $zip->addEmptyDir($directory); goto e1187; D879f: $directory = implode("/", $entryName); goto e8980; Bb246: B7cc9: goto c52c2; c0047: array_pop($entryName); goto D879f; D0a97: $filename = $fileInfo->getFilename(); goto C9c2f; Ae17f: $realpathFile = $fileInfo->getRealPath(); goto E47e2; e1187: $entryName = sprintf("%s/%s", rtrim($directory, "/"), $filename); goto bdd07; bdd07: $zip->addFile($filepath, $entryName); goto c6aeb; ef69f: } goto Bad84; Aba4a: $filepath = $fileInfo->getPathname(); goto d7900; daee6: a3016: goto db387; febee: d3ad2: goto Cc76e; d7900: $zip->addFile($filepath, $filename); goto daee6; Bad84: B53f4: goto febee; D8c00: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto D8ebb; af798: $filename = $fileInfo->getFilename(); goto Aba4a; Ce929: $fileInfo = new \SplFileInfo($file); goto C0815; C0815: if (!(true === $fileInfo->isFile())) { goto a3016; } goto af798; F7103: if (!(true === file_exists($file))) { goto f2eb0; } goto Ce929; e9b15: } goto c497c; a97c7: $zip->close(); goto c5a64; a029e: ceaf2: goto Dc423; b166a: Ae56f: goto B5000; E54fa: goto d21a9; goto c0c31; Bd803: $zip = new \ZipArchive(); goto fd6f3; c0c31: E9d79: goto Bb56e; E2c0e: throw new \Exception(sprintf("Target directory "%s" does not exist.", $targetDirectory)); goto Af3a6; E38a3: $data = ["path" => $id]; goto bf9f7; C585b: d21a9: goto a029e; fd6f3: if (!(true !== $zip->open($zipArchive, \ZipArchive::CREATE))) { goto Ae56f; } goto Ba6f7; Bb56e: $zipArchive = sprintf("%s/archive.zip", rtrim($targetDirectory, "/")); goto Bd803; e894e: throw new \Exception(sprintf("Too many files, maximum of "%s" files are allowed.", self::MAX_FILES_TO_COMPRESS)); goto E54fa; bf9f7: Ef2fe: goto C585b; c5a64: if (!(true === file_exists($zipArchive))) { goto Ef2fe; } goto E08e4; b0608: E3306: goto Ad703; F08fa: if (true === is_dir($targetDirectory) && false === empty($files)) { goto E3306; } goto E2c0e; Ad703: $numberOfFiles = $this->countFilesToCompress($files); goto eb8f4; Af3a6: goto ceaf2; goto b0608; E08e4: $fileInfo = new \SplFileInfo($zipArchive); goto d2b7e; eb8f4: if ($numberOfFiles < self::MAX_FILES_TO_COMPRESS) { goto E9d79; } goto e894e; Dc423: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["error"] = $errorMessage; } goto Bc8e0; C7ad0: $data = []; goto E00ec; c38c9: } private function countFilesToCompress(array $files) : int { goto ff52e; E00bd: D3dbd: goto bc99e; C1a01: foreach ($files as $file) { goto C65ab; A0e49: D8645: goto d2148; A1dd2: $fileInfo = new \SplFileInfo($file); goto ed969; Ac7dc: F478a: goto A7fac; e3890: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto Af879; D68e0: e35e8: goto E2a3a; Af879: if (!(true === $fileInfo->isFile())) { goto ae66f; } goto Eba93; be9b4: ae66f: goto D68e0; Eba93: ++$numberOfFiles; goto be9b4; E2a3a: } goto f1124; B8b08: a5873: goto de8d2; A7fac: A16eb: goto B8b08; f0c57: $directory = $fileInfo->getPathname(); goto a1f01; C65ab: if (!(true === file_exists($file))) { goto A16eb; } goto A1dd2; d2148: if (!(true === $fileInfo->isDir())) { goto F478a; } goto f0c57; f1124: A70f9: goto Ac7dc; b3e89: ++$numberOfFiles; goto A0e49; ed969: if (!(true === $fileInfo->isFile())) { goto D8645; } goto b3e89; a1f01: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto e3890; de8d2: } goto E00bd; ff52e: $numberOfFiles = 0; goto C1a01; bc99e: return $numberOfFiles; goto da6ab; da6ab: } private function resetPermissions(\SplFileInfo $fileInfo, $recursive = false) { goto eba45; fa642: $chownCommand->setFile($filename); goto bbcb1; E4bca: $this->executeCommand($chmodCommand); goto C9555; F571b: $chownCommand = new ChownCommand(); goto fa642; bbcb1: $chownCommand->setRecursive($recursive); goto Ae41a; eba45: $filename = $fileInfo->getPathname(); goto F571b; c4821: $this->executeCommand($chownCommand); goto E4bca; C815f: $chmodCommand->setFileChmod(770); goto Dad50; d1226: goto edeff; goto F124c; F124c: F4820: goto d98b6; Ace73: if (true === $fileInfo->isDir() && true === $recursive) { goto F4820; } goto Bc744; c206a: edeff: goto c4821; d98b6: $chmodCommand = new FindChmodCommand(); goto a4a4a; Bc744: $chmodCommand = new ChmodCommand(); goto Bcdb0; a4a4a: $chmodCommand->setFile($filename); goto c4921; c4921: $chmodCommand->setDirectoryChmod(770); goto C815f; Bcdb0: $chmodCommand->setFile($filename); goto f301d; f301d: $chmodCommand->setChmod(770); goto d1226; B24d6: $chownCommand->setGroup($this->user); goto Ace73; Ae41a: $chownCommand->setUser($this->user); goto B24d6; Dad50: $chmodCommand->setRunInBackground(true); goto c206a; C9555: } private function mapFileExtension(string $fileExtension) : string { goto b0f10; b0f10: $mappedFileExtension = "default"; goto E2e52; E2e52: if (!(true === isset($this->fileExtensionMap[$fileExtension]))) { goto E9f7b; } goto dadfb; eea86: return $mappedFileExtension; goto De360; fc903: E9f7b: goto eea86; dadfb: $mappedFileExtension = $this->fileExtensionMap[$fileExtension]; goto fc903; De360: } private function executeCommand(Command $command, $timeout = 600) { $this->commandExecutor->execute($command, $timeout); } } 
 ?>

Did this file decode correctly?

Original Code

<?php
 namespace App\File; use Symfony\Component\Finder\Finder; use App\System\CommandExecutor; use App\System\Command; use App\System\Command\CopyFileCommand; use App\System\Command\ChownCommand; use App\System\Command\ChmodCommand; use App\System\Command\FindChmodCommand; use App\System\Command\MoveFileCommand; use App\System\Command\CreateDirectoryCommand; use App\System\Command\DeleteFileCommand; use App\System\Command\DeleteDirectoryCommand; use App\System\Command\BsdTarExtractCommand; use App\System\Command\GunzipCommand; class Manager { private const MAX_FILES_TO_COMPRESS = 100000; private const TYPE_FOLDER = "\146\x6f\154\x64\x65\162"; private string $user; protected CommandExecutor $commandExecutor; private array $fileExtensionMap = ["\x61\151" => "\141\x69", "\x61\x75\164" => "\141\165\164", "\x61\x76\151" => "\141\166\x69", "\142\151\x6e" => "\x62\151\x6e", "\x62\155\x70" => "\142\x6d\x70", "\142\x6d\x70" => "\142\155\x70", "\143\141\x64" => "\143\x61\144", "\143\144\x72" => "\x63\144\162", "\x63\163\163" => "\143\163\163", "\x63\163\166" => "\143\x73\x76", "\144\x62" => "\144\142", "\144\x6f\x63" => "\x64\157\x63", "\144\157\x63\x78" => "\x64\x6f\143\170", "\x65\160\x73" => "\145\x70\163", "\145\x78\x65" => "\145\170\x65", "\x66\x6c\166" => "\x66\x6c\x76", "\147\151\146" => "\x67\x69\146", "\x68\x6c\160" => "\150\x6c\160", "\150\x74\x6d" => "\150\164\x6d", "\x69\156\x69" => "\x69\x6e\151", "\151\x73\157" => "\151\163\x6f", "\x6a\x61\x76\x61" => "\x6a\141\x76\141", "\152\160\147" => "\152\x70\147", "\152\x70\x65\x67" => "\x6a\x70\x67", "\x6a\x73" => "\152\x73", "\x6d\x6b\166" => "\155\153\166", "\x6d\x6f\166" => "\x6d\157\166", "\155\x70\63" => "\155\160\x33", "\x6d\x70\64" => "\x6d\x70\x34", "\x6d\x70\x67" => "\x6d\160\147", "\155\x70\145\x67" => "\155\160\145\x67", "\x68\164\155\x6c" => "\150\x74\x6d\154", "\x70\x68\x70" => "\160\x68\160", "\160\x68\x74\x6d\x6c" => "\160\150\160", "\x70\144\x66" => "\x70\144\x66", "\160\156\147" => "\x70\x6e\147", "\x70\x70\164" => "\x70\160\164", "\x70\x73" => "\160\x73", "\x70\x73\144" => "\x70\163\144", "\162\x61\162" => "\162\141\162", "\x72\163\163" => "\x72\163\163", "\162\x74\146" => "\x72\x74\x66", "\163\x71\154" => "\163\161\154", "\x73\x76\x67" => "\163\166\x67", "\x73\167\146" => "\x73\x77\146", "\x73\171\x73" => "\163\171\163", "\x74\170\x74" => "\164\170\x74", "\x77\155\141" => "\x77\x6d\x61", "\x78\154\163" => "\x78\x6c\x73", "\170\155\154" => "\x78\155\x6c", "\x67\172" => "\x67\172", "\x74\147\x7a" => "\147\172", "\164\141\x72" => "\164\141\162", "\x7a\x69\160" => "\x7a\151\160"]; private array $fileGroups = ["\x63\157\144\145" => ["\x68\x74\155\154", "\x68\164\x6d", "\152\x73", "\x6a\x73\157\x6e", "\x63\163\x73", "\x73\x63\x73\163", "\163\141\163\163", "\154\145\x73\163", "\160\x68\160", "\x70\x68\164\x6d\154", "\163\150", "\143\x6f\x66\x66\145\x65", "\x74\x78\x74", "\x6c\157\x67", "\x6d\x64", "\147\x6f", "\171\155\x6c", "\146\151\154\145\x73"], "\x64\x6f\143\165\x6d\145\x6e\x74" => ["\x64\x6f\143\x78", "\x64\x6f\x63", "\x6f\144\x74", "\x78\154\x73", "\x78\x73\154\x78", "\x70\144\x66", "\144\x6a\166\165", "\144\152\166", "\160\160\x74\x78", "\160\x70\164"], "\x61\162\x63\150\x69\x76\145" => ["\x72\x61\x72", "\x74\x61\x72", "\x74\147\x7a", "\x67\172", "\172\151\x70"], "\x61\165\x64\x69\x6f" => ["\155\160\63", "\x6f\147\147", "\x66\154\x61\x63", "\167\141\166"], "\x76\x69\144\145\x6f" => ["\x6d\x70\x67", "\155\x70\64", "\141\x76\x69", "\x6d\153\166", "\157\x67\166"], "\151\155\141\147\x65" => ["\x70\156\147", "\152\x70\147", "\x6a\x70\145\x67", "\x77\145\142\x70", "\147\x69\146", "\164\x69\x66\146", "\164\x69\146", "\163\x76\x67"]]; public function __construct(string $user) { $this->user = $user; $this->commandExecutor = new CommandExecutor(); } public function getFolders(string $directory) : array { goto F545f; E8790: $i = 0; goto a8343; C0df0: C2778: goto D87c8; a6d40: $finder->depth(0); goto a9fce; a8343: foreach ($finder as $splFileInfo) { goto C6d89; Ffb0e: $id = implode("\x2f", array_slice($realPath, 2, count($realPath))); goto ef09c; d612c: d5c9e: goto daafe; A3f3f: $folders[$i] = ["\166\141\154\x75\x65" => htmlspecialchars($splFileInfo->getFilename(), ENT_QUOTES), "\151\x64" => sprintf("\x2f\45\x73", htmlspecialchars($id, ENT_QUOTES)), "\x73\151\172\145" => 4096, "\x64\x61\x74\x65" => $splFileInfo->getMTime(), "\160\145\162\x6d\151\163\x73\x69\x6f\x6e\163" => $filePermissions, "\x74\171\160\145" => "\x66\157\x6c\144\145\x72"]; goto Ff966; C6d89: $realPath = array_filter(explode("\x2f", $splFileInfo->getRealPath())); goto Ffb0e; c5e3c: unset($folders[$i]["\x64\141\164\141"]); goto d612c; ef09c: $filePermissions = substr(sprintf("\x25\x6f", $splFileInfo->getPerms()), -4); goto A3f3f; d9a65: $i++; goto C0b08; Ff966: if (!(true === empty($folders[$i]["\x64\141\164\141"]))) { goto d5c9e; } goto c5e3c; C0b08: D89e1: goto d1414; daafe: usort($folders, function ($a, $b) { return strcasecmp($a["\166\x61\154\x75\x65"], $b["\166\x61\154\165\145"]); }); goto d9a65; d1414: } goto e6d53; e6d53: C3764: goto C0df0; F1783: if (!(true === $finder->hasResults())) { goto C2778; } goto E8790; a9fce: $finder->sortByName(true); goto F1783; Dd40a: $finder = new Finder(); goto fcbe7; fcbe7: $finder->in($directory); goto C1d1f; d1520: $finder->directories(); goto a6d40; D87c8: return $folders; goto dfdd7; C1d1f: $finder->ignoreDotFiles(false); goto d1520; F545f: $folders = []; goto Dd40a; dfdd7: } public function getFiles(string $directory) : array { goto b9692; E4dbc: $tmpFiles = []; goto f26e3; Ef666: return $files; goto Ee590; ff9ed: fd2b9: goto F780e; F780e: $files = array_merge($tmpFolders, $tmpFiles); goto f31b2; c08ab: if (!(true === $finder->hasResults())) { goto D54b3; } goto fab87; f26e3: foreach ($finder as $fileInfo) { goto a986e; a986e: $file = $this->getFileData($fileInfo); goto A5456; Ffa18: dd9e1: goto D9b3f; d4598: Cf9b9: goto E5422; A5456: if (true === isset($file["\164\x79\160\x65"]) && self::TYPE_FOLDER == $file["\x74\x79\x70\x65"]) { goto Cf9b9; } goto C7aa8; b4579: C7105: goto Ffa18; C7aa8: $tmpFiles[] = $file; goto df831; E5422: $tmpFolders[] = $file; goto b4579; df831: goto C7105; goto d4598; D9b3f: } goto ff9ed; ceffd: $finder->ignoreDotFiles(false); goto Dda98; Fb046: $finder = new Finder(); goto d4beb; b9692: $files = []; goto Fb046; Dda98: $finder->depth(0); goto d9ece; d9ece: $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strnatcasecmp($a->getRealPath(), $b->getRealPath()); }); goto c08ab; f31b2: D54b3: goto Ef666; fab87: $tmpFolders = []; goto E4dbc; d4beb: $finder->in($directory); goto ceffd; Ee590: } public function getFileContent(string $file) : string { goto afed9; b4069: $fileContent = file_get_contents($file); goto ad321; afed9: $fileContent = ''; goto A5757; E42c7: return $fileContent; goto B3f3c; ad321: Db309: goto E42c7; A5757: if (!(true === file_exists($file))) { goto Db309; } goto b4069; B3f3c: } public function writeFileContent(string $file, string $content) : array { goto Cd625; de770: b8f1a: goto B3bfd; A3f68: return $data; goto af7cc; ee0ab: $data = $this->getFileData($fileInfo); goto de770; Fcb38: $fileInfo = new \SplFileInfo($file); goto bd198; f7ad1: if (!(true === file_exists($file))) { goto D5b86; } goto E28f7; bd198: $this->resetPermissions($fileInfo); goto ee0ab; B3bfd: D5b86: goto A3f68; Cd625: $data = []; goto f7ad1; E28f7: if (!file_put_contents($file, $content)) { goto b8f1a; } goto Fcb38; af7cc: } public function rename(string $from, string $to) : array { goto fc166; E6995: $fileData = $this->getFileData($fileInfo); goto db818; Eed27: return $data; goto Bcd82; fc166: $data = []; goto a2a0c; B0747: $this->resetPermissions($fileInfo); goto E6995; db818: $data = ["\x69\x6e\x76\141\154\151\x64" => false, "\x65\x72\x72\x6f\162" => '', "\151\x64" => $fileData["\x69\x64"]]; goto D6ac1; e61cf: $fileInfo = new \SplFileInfo($to); goto B0747; f4cca: $to = sprintf("\45\163\57\45\163", $fileInfo->getPath(), $to); goto d5cb8; D6ac1: ede02: goto Eed27; d5cb8: @rename($from, $to); goto e61cf; a2a0c: if (!(true === file_exists($from))) { goto ede02; } goto cd53c; cd53c: $fileInfo = new \SplFileInfo($from); goto f4cca; Bcd82: } public function delete(string $file) : array { goto a6b4e; D3eca: try { goto df5b7; b0c11: Fce2d: goto D1fa2; ac273: goto Bd65f; goto b0c11; D1fa2: $deleteCommand = new DeleteDirectoryCommand(); goto Faa64; fd219: $deleteCommand = new DeleteFileCommand(); goto E50df; Faa64: $deleteCommand->setDirectory($file); goto af614; Febcb: if (true === $fileInfo->isDir()) { goto Fce2d; } goto fd219; E50df: $deleteCommand->setFile($file); goto ac273; bb542: $data = ["\x69\x6e\166\x61\x6c\x69\144" => false, "\x65\162\162\157\162" => '', "\151\144" => '']; goto C1e93; A7b6c: $this->executeCommand($deleteCommand); goto bb542; af614: Bd65f: goto A7b6c; df5b7: $fileInfo = new \SplFileInfo($file); goto Febcb; C1e93: } catch (\Exception $e) { } goto ab5b8; ea9d8: if (!(true === file_exists($file))) { goto b6f6f; } goto D3eca; a6b4e: $data = []; goto ea9d8; f4fc9: return $data; goto c3075; ab5b8: b6f6f: goto f4fc9; c3075: } public function download(string $file) : void { goto f2fbd; Ee7bc: $fileInfo = new \SplFileInfo($file); goto Edd3f; c2843: exit; goto e8c4e; B6e0c: header("\103\157\156\164\x65\156\164\55\x44\x69\x73\160\x6f\x73\x69\164\151\x6f\x6e\72\40\x61\164\x74\x61\x63\150\155\145\156\164\73\40\146\x69\154\x65\x6e\x61\155\145\x3d" . $filename); goto B3aa9; Ba71c: header("\103\141\143\x68\x65\x2d\x43\157\156\x74\x72\157\154\72\40\155\165\x73\164\55\x72\x65\166\x61\x6c\x69\144\141\x74\145\x2c\40\x70\157\163\164\55\143\150\145\x63\153\75\x30\54\x20\x70\162\x65\x2d\143\x68\145\x63\x6b\x3d\x30"); goto d4aae; a873f: $finfo = finfo_open(FILEINFO_MIME_TYPE); goto aede5; B3aa9: header("\x43\x6f\x6e\x74\x65\x6e\x74\55\124\162\x61\x6e\163\x66\x65\162\x2d\x45\x6e\x63\157\144\151\x6e\147\x3a\40\x62\x69\x6e\141\x72\171"); goto C5f7c; Edd3f: $filename = $fileInfo->getFilename(); goto a873f; A042b: readfile($file); goto c2843; c853f: ob_clean(); goto A238c; d4aae: header("\120\162\x61\147\x6d\x61\72\x20\160\165\142\154\151\x63"); goto f192f; f192f: header("\x43\157\x6e\164\x65\156\164\x2d\x4c\x65\x6e\x67\x74\150\72\x20" . filesize($file)); goto c853f; A238c: flush(); goto A042b; f2fbd: if (!(true === file_exists($file))) { goto ddf20; } goto Ee7bc; e8c4e: ddf20: goto eaa36; C5f7c: header("\105\x78\x70\151\162\145\x73\x3a\40\60"); goto Ba71c; aede5: header("\x43\x6f\x6e\x74\x65\156\164\x2d\124\171\160\x65\x3a\x20" . finfo_file($finfo, $file)); goto E5535; f054a: header("\x43\157\156\164\145\156\x74\x2d\x44\145\x73\143\162\151\x70\x74\x69\x6f\156\x3a\40\x46\x69\x6c\145\40\x54\162\x61\x6e\x73\x66\x65\162"); goto B6e0c; E5535: finfo_close($finfo); goto f054a; eaa36: } public function upload(string $fileUploadPath, string $directory, string $tmpFile, string $id) : array { goto d9a8b; Ec2c9: $fileInfo = new \SplFileInfo($file); goto c5935; d381d: $fileUploadDirectory = $filePathInfo->getPathName(); goto C6fe4; a0ec5: $this->resetPermissions($fileInfo, true); goto Ec2c9; E3daa: return $data; goto b457c; Ac7e0: $filePathInfo = $fileInfo->getPathInfo(); goto d381d; A4f72: Aaa2e: goto b09a4; b57ed: $fileInfo = new \SplFileInfo($file); goto Ac7e0; b09a4: d8b35: goto E3daa; C6fe4: if (!(false === is_null($fileUploadDirectory))) { goto Aaa2e; } goto f7cd6; d9a8b: $data = []; goto Ad320; ac37b: $fileInfo = new \SplFileInfo($directory); goto a0ec5; Ff092: @move_uploaded_file($tmpFile, $file); goto ac37b; c5935: $data = $this->getFileData($fileInfo); goto c822e; c822e: $data["\165\151\x64"] = $id; goto A4f72; De738: $file = sprintf("\45\163\57\x25\x73", rtrim($directory, "\x2f"), $fileUploadPath); goto b57ed; f7cd6: @mkdir($fileUploadDirectory, 0777, true); goto Ff092; Ad320: if (!(true === is_dir($directory) && true === file_exists($tmpFile))) { goto d8b35; } goto De738; b457c: } public function copy(string $file, string $directory) : array { goto b93e8; A2ca2: goto eb0f2; goto aeb1f; D270b: $filename = $fileInfo->getFilename(); goto D0667; b93e8: $data = []; goto B911f; cef26: return $data; goto e7957; efc35: $copyFileCommand->setDestinationFile($fileToCopy); goto Bead6; F31c2: $fileInfo = new \SplFileInfo($file); goto D270b; A36a7: $data = $this->getFileData($fileInfo); goto Bcd98; aeb1f: d662e: goto Bb93a; e508b: $fileToCopy = sprintf("\x25\x73\57\45\x73", rtrim($directory, "\x2f\51"), $copiedFilename); goto A2ca2; Bead6: $copyFileCommand->setRecursive(true); goto b0752; a39e4: $copyFileCommand = new CopyFileCommand(); goto efd5a; b0752: $this->executeCommand($copyFileCommand); goto B6811; B911f: if (!(true === file_exists($file) && true === is_dir($directory))) { goto a7b60; } goto F31c2; d54ee: $fileToCopy = sprintf("\45\x73\x2f\x25\163", rtrim($directory, "\x2f\51"), $copiedFilename); goto Fc7d7; Bcd98: a7b60: goto cef26; Fc823: $fileExtension = $fileInfo->getExtension(); goto df4ee; df4ee: $copiedFilename = str_replace([sprintf("\56\45\x73", $fileExtension)], [''], $filename); goto fe2ab; fe2ab: $copiedFilename = sprintf("\x25\163\137\143\157\160\171\x2e\x25\x73", $copiedFilename, $fileExtension); goto e508b; B6811: $fileInfo = new \SplFileInfo($fileToCopy); goto C12aa; Fc7d7: eb0f2: goto a39e4; C12aa: $this->resetPermissions($fileInfo, false); goto A36a7; efd5a: $copyFileCommand->setSourceFile($file); goto efc35; D0667: if (true === $fileInfo->isDir()) { goto d662e; } goto Fc823; Bb93a: $copiedFilename = sprintf("\45\163\137\143\x6f\x70\x79", $filename); goto d54ee; e7957: } public function move(string $file, string $directory) : array { goto b1cab; af048: $moveFileCommand = new MoveFileCommand(); goto A6b78; f84ef: c0339: goto f3738; fb5ee: $fileInfo = new \SplFileInfo($fileToMove); goto b5481; a43b8: $filename = $fileInfo->getFilename(); goto d0e22; Abc27: $moveFileCommand->setDestinationFile($fileToMove); goto ab9c5; b5481: $this->resetPermissions($fileInfo, false); goto ca9c9; ca9c9: $data = $this->getFileData($fileInfo); goto f84ef; f3738: return $data; goto Be840; ab9c5: $this->executeCommand($moveFileCommand); goto fb5ee; d0e22: $fileToMove = sprintf("\45\x73\57\45\x73", rtrim($directory, "\57\51"), $filename); goto af048; A6b78: $moveFileCommand->setSourceFile($file); goto Abc27; b1cab: $data = []; goto D7825; D7825: if (!(true === file_exists($file) && true === is_dir($directory))) { goto c0339; } goto b5d7f; b5d7f: $fileInfo = new \SplFileInfo($file); goto a43b8; Be840: } public function makeFile(string $filename, string $directory, string $homeDirectory) : array { goto dad31; Ef4c0: $this->resetPermissions($fileInfo, false); goto ad39b; ec405: $file = sprintf("\x25\163\57\x25\x73", rtrim($directory, "\x2f"), $filename); goto cbb51; Cc50c: $fileInfo = new \SplFileInfo($file); goto dc550; De3ed: Cf36d: goto fa5d3; be1df: exit(sprintf("\116\157\x74\40\x61\x20\166\x61\154\x69\x64\40\x66\151\154\145\72\40\x25\163", $realpathFile)); goto De3ed; Dec77: if (!(true === is_dir($directory))) { goto daaf1; } goto ec405; cbb51: @touch($file); goto Cc50c; dc550: if (!(true === $fileInfo->isLink())) { goto D3728; } goto B2469; Eb816: return $data; goto Cfc72; fa5d3: D3728: goto Ef4c0; B2469: $realpathFile = $fileInfo->getRealPath(); goto F65d1; F65d1: if (!(false === str_starts_with($realpathFile, $homeDirectory))) { goto Cf36d; } goto be1df; dad31: $data = []; goto Dec77; ad39b: $data = $this->getFileData($fileInfo); goto ee9c9; ee9c9: daaf1: goto Eb816; Cfc72: } public function makeDirectory(string $directoryName, $directory) : array { goto ea678; f51d5: $data = $this->getFileData($fileInfo); goto e6d49; eff25: $fileInfo = new \SplFileInfo($newDirectory); goto c2ff1; ee7cc: if (!(true === is_dir($directory))) { goto b4cbb; } goto Dc86a; ea678: $data = []; goto ee7cc; Dc86a: $newDirectory = sprintf("\45\163\x2f\45\163", rtrim($directory, "\x2f"), $directoryName); goto a9344; a9344: @mkdir($newDirectory); goto eff25; e6d49: b4cbb: goto ba963; ba963: return $data; goto F0304; c2ff1: $this->resetPermissions($fileInfo, false); goto f51d5; F0304: } private function getFileData(\SplFileInfo $fileInfo) : array { goto C9e1e; C9e1e: $fileData = []; goto Af8cc; Af8cc: try { goto f2c10; aa743: $id = implode("\x2f", array_slice($realPath, 2, count($realPath))); goto Aa184; D503c: $fileOwner = sprintf("\45\x73\72\45\163", $fileOwnerInformation["\x6e\x61\x6d\x65"] ?? '', $fileGroupInformation["\x6e\141\x6d\x65"] ?? ''); goto C9dc4; B9027: $fileGroupInformation = posix_getgrgid($fileInfo->getGroup()); goto D503c; Fcd56: if (!(false === $fileInfo->isDir())) { goto D41cc; } goto F25ae; ddc3f: $fileData = ["\x76\141\154\x75\x65" => htmlspecialchars($filename, ENT_QUOTES), "\x69\144" => sprintf("\57\x25\x73", htmlspecialchars($id, ENT_QUOTES)), "\x73\151\x7a\145" => $fileSize, "\x6f\x77\156\145\162" => $fileOwner, "\x70\x65\x72\x6d\151\163\163\151\157\156\163" => $filePermissions, "\x64\141\164\x65" => $fileDate, "\164\x79\160\145" => $fileType]; goto Fcd56; f2c10: $filename = $fileInfo->getFilename(); goto Afab3; faa8f: $fileOwnerInformation = posix_getpwuid($fileInfo->getOwner()); goto B9027; F25ae: $fileExtension = $this->mapFileExtension($fileInfo->getExtension()); goto b7d54; b7d54: $fileData["\145\170\164"] = $fileExtension; goto Ee4a8; Afab3: $realPath = array_filter(explode("\x2f", $fileInfo->getRealPath())); goto aa743; Ee4a8: D41cc: goto fd621; f05f1: $filePermissions = substr(sprintf("\x25\x6f", $fileInfo->getPerms()), -4); goto faa8f; C9dc4: $fileDate = $fileInfo->getMTime(); goto B79ee; Aa184: $fileSize = $fileInfo->getSize(); goto f05f1; B79ee: $fileType = $this->getFileType($fileInfo); goto ddc3f; fd621: } catch (\Exception $e) { } goto A2172; A2172: return $fileData; goto b3e40; b3e40: } private function getFileType(\SplFileInfo $fileInfo) { goto C83b8; d1880: if (true === $fileInfo->isDir()) { goto Ce91e; } goto c78f2; A8beb: Fece3: goto a3b2c; C83b8: $fileType = "\x63\x6f\x64\x65"; goto d1880; bc688: foreach ($this->fileGroups as $type => $extensions) { goto D5de8; a80ed: goto cbb69; goto C4e16; C4e16: F3373: goto e4ea2; D5de8: if (!(true === in_array($fileExtension, $extensions))) { goto F3373; } goto c65c1; e4ea2: B6692: goto Ac33f; c65c1: $fileType = $type; goto a80ed; Ac33f: } goto b8ef4; c78f2: $fileExtension = $fileInfo->getExtension(); goto bc688; c587e: Ce91e: goto b9e8a; e2adb: goto Fece3; goto c587e; a3b2c: return $fileType; goto eaddd; b8ef4: cbb69: goto e2adb; b9e8a: $fileType = "\146\x6f\154\x64\x65\x72"; goto A8beb; eaddd: } public function permissions(string $file, string $permissions) : array { goto C9992; bc3ee: Dd8ba: goto bb63f; F0a2e: $chownCommand->setRecursive(true); goto D1686; b7230: $this->executeCommand($chmodCommand, 600); goto cf867; ecf54: $chmodCommand->setFile($file); goto d4cee; C6c7a: $chmodCommand->setFileChmod($permissions); goto B5788; dc96b: $data = ["\x69\x6e\166\x61\154\x69\144" => false, "\x65\162\x72\x6f\162" => '', "\x69\144" => $fileData["\151\144"], "\x70\x65\162\x6d\151\163\163\x69\157\x6e\x73" => $permissions]; goto bc3ee; e7179: $chownCommand->setFile($file); goto F0a2e; D1686: $chownCommand->setUser($this->user); goto b1050; c52c5: $chownCommand = new ChownCommand(); goto e7179; ac0ce: $fileInfo = new \SplFileInfo($file); goto c52c5; d4cee: $chmodCommand->setDirectoryChmod($permissions); goto C6c7a; cf867: $fileData = $this->getFileData($fileInfo); goto dc96b; bb63f: return $data; goto A88ea; D8e45: $file = realpath($file); goto D3ac0; B5788: $this->executeCommand($chownCommand, 600); goto b7230; c0632: $chmodCommand = new FindChmodCommand(); goto ecf54; C9992: $data = []; goto D8e45; b1050: $chownCommand->setGroup($this->user); goto c0632; D2367: if (!(true === str_starts_with($file, $homeDirectory) && true === file_exists($file))) { goto Dd8ba; } goto ac0ce; D3ac0: $homeDirectory = sprintf("\57\150\x6f\155\x65\x2f\x25\x73\57", $this->user); goto D2367; A88ea: } public function extract(string $file, string $destinationDirectoryName) : array { goto A4163; Ed042: return $data; goto ac3d9; A4163: $data = []; goto E1337; E1337: try { goto Fbec7; c238b: $copyFileCommand->setDestinationFile($gzipFile); goto Cc2d3; C9ff1: if ("\x74\141\x72\x2e\147\172" == substr($filename, -6)) { goto F2331; } goto A30ea; B64d7: $destinationDirectory = sprintf("\x25\163\57\x25\163", rtrim($filePathInfo->getPathName(), "\57"), rtrim($destinationDirectoryName, "\x2f")); goto c88e3; dfd43: $bsdTarExtractCommand->setSourceFile($file); goto cf33d; e6203: $data["\x70\x61\x74\150"] = $path; goto B64d7; d68b0: $filePathInfo = $fileInfo->getPathInfo(); goto e17c0; C68fd: if (!(true === is_dir($destinationDirectory))) { goto D2e4b; } goto d6990; A30ea: $fileExtension = $fileInfo->getExtension(); goto Bc239; B0ce6: df389: goto C68fd; aba15: D2e4b: goto F4004; A1fca: $this->executeCommand($createDirectoryCommand); goto E1b34; D4d16: $this->resetPermissions($fileInfo, true); goto aba15; cbd73: $this->executeCommand($copyFileCommand); goto F22db; F4004: E4eff: goto e4efa; f22f1: $fileExtension = "\x74\x61\162\x2e\147\x7a"; goto cd16b; d6990: $fileInfo = new \SplFileInfo($destinationDirectory); goto D4d16; D912c: $fileInfo = new \SplFileInfo($file); goto dce66; A057b: $copyFileCommand = new CopyFileCommand(); goto ac201; Bc239: goto F99dd; goto B16b5; c88e3: if (true === in_array($fileExtension, ["\164\x61\162", "\x74\x67\172", "\164\141\162\x2e\x67\172", "\x72\x61\x72", "\172\x69\x70"])) { goto E1265; } goto Becde; c15ae: $createDirectoryCommand->setDirectory($destinationDirectory); goto A057b; A8a31: $path = array_slice($path, 2, count($path)); goto A1a39; F8c7d: E1265: goto Cf4fb; db82a: acee9: goto c4b01; e17c0: $path = array_filter(explode("\x2f", $fileInfo->getRealPath())); goto A8a31; cd16b: F99dd: goto d68b0; c4b01: goto df389; goto F8c7d; B6e9c: $createDirectoryCommand = new CreateDirectoryCommand(); goto c15ae; ac201: $copyFileCommand->setSourceFile($file); goto c238b; Becde: if (!("\147\172" == $fileExtension)) { goto acee9; } goto bbf4d; Fb8d2: $this->executeCommand($createDirectoryCommand); goto cbd73; Cf4fb: $createDirectoryCommand = new CreateDirectoryCommand(); goto e5261; E4938: $bsdTarExtractCommand = new BsdTarExtractCommand(); goto dfd43; Fbec7: if (!(true === file_exists($file))) { goto E4eff; } goto D912c; Cc2d3: $gunzipCommand = new GunzipCommand(); goto F13ca; cf33d: $bsdTarExtractCommand->setDestinationFile($destinationDirectory); goto A1fca; A1a39: array_pop($path); goto d4ba6; bbf4d: $gzipFile = sprintf("\45\x73\x2f\45\163", rtrim($destinationDirectory, "\x2f"), $filename); goto B6e9c; F22db: $this->executeCommand($gunzipCommand); goto db82a; E1b34: $this->executeCommand($bsdTarExtractCommand, 3600); goto B0ce6; e5261: $createDirectoryCommand->setDirectory($destinationDirectory); goto E4938; B16b5: F2331: goto f22f1; F13ca: $gunzipCommand->setFile($gzipFile); goto Fb8d2; dce66: $filename = $fileInfo->getFilename(); goto C9ff1; d4ba6: $path = sprintf("\57\45\x73", implode("\x2f", $path)); goto e6203; e4efa: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["\x65\162\162\157\162"] = $errorMessage; } goto Ed042; ac3d9: } public function compress(array $files, string $targetDirectory, string $id, string $homeDirectory) : array { goto C7ad0; Bc8e0: return $data; goto c38c9; E00ec: try { goto F08fa; d2b7e: $this->resetPermissions($fileInfo); goto E38a3; Ba6f7: throw new \Exception(sprintf("\103\x61\x6e\x6e\157\164\40\143\162\x65\141\164\x65\x20\x7a\x69\x70\x20\146\x69\x6c\145\x20\42\45\x73\42\56", $zipArchive)); goto b166a; c497c: a2893: goto a97c7; B5000: foreach ($files as $file) { goto F7103; db387: if (!(true === $fileInfo->isDir())) { goto d3ad2; } goto e60d3; Cc76e: f2eb0: goto Ad7db; e60d3: $directory = $fileInfo->getPathname(); goto D8c00; Ad7db: b63b1: goto e9b15; D8ebb: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto E561f; A793f: $entryName = ltrim(str_replace($targetDirectory, '', $fileInfo->getPathname()), "\57"); goto cbc2b; cbc2b: $entryName = array_filter(explode("\57", $entryName)); goto c0047; c52c2: a4b6e: goto A793f; f63cd: exit(sprintf("\x4e\157\x74\40\x61\40\166\141\154\151\x64\40\146\x69\x6c\x65\72\x20\45\x73", $realpathFile)); goto Bb246; E47e2: if (!(false === str_starts_with($realpathFile, $homeDirectory))) { goto B7cc9; } goto f63cd; c6aeb: f8d0c: goto ec8c9; A7c5e: if (!(true === $fileInfo->isLink())) { goto a4b6e; } goto Ae17f; ec8c9: C002e: goto ef69f; C9c2f: $filepath = $fileInfo->getPathname(); goto A7c5e; E561f: if (!(true === $fileInfo->isFile())) { goto f8d0c; } goto D0a97; e8980: $zip->addEmptyDir($directory); goto e1187; D879f: $directory = implode("\57", $entryName); goto e8980; Bb246: B7cc9: goto c52c2; c0047: array_pop($entryName); goto D879f; D0a97: $filename = $fileInfo->getFilename(); goto C9c2f; Ae17f: $realpathFile = $fileInfo->getRealPath(); goto E47e2; e1187: $entryName = sprintf("\45\x73\x2f\x25\x73", rtrim($directory, "\57"), $filename); goto bdd07; bdd07: $zip->addFile($filepath, $entryName); goto c6aeb; ef69f: } goto Bad84; Aba4a: $filepath = $fileInfo->getPathname(); goto d7900; daee6: a3016: goto db387; febee: d3ad2: goto Cc76e; d7900: $zip->addFile($filepath, $filename); goto daee6; Bad84: B53f4: goto febee; D8c00: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto D8ebb; af798: $filename = $fileInfo->getFilename(); goto Aba4a; Ce929: $fileInfo = new \SplFileInfo($file); goto C0815; C0815: if (!(true === $fileInfo->isFile())) { goto a3016; } goto af798; F7103: if (!(true === file_exists($file))) { goto f2eb0; } goto Ce929; e9b15: } goto c497c; a97c7: $zip->close(); goto c5a64; a029e: ceaf2: goto Dc423; b166a: Ae56f: goto B5000; E54fa: goto d21a9; goto c0c31; Bd803: $zip = new \ZipArchive(); goto fd6f3; c0c31: E9d79: goto Bb56e; E2c0e: throw new \Exception(sprintf("\x54\141\162\147\x65\x74\40\144\x69\x72\145\143\164\x6f\162\x79\x20\42\x25\x73\x22\40\144\x6f\145\163\40\x6e\x6f\164\40\x65\x78\151\163\x74\x2e", $targetDirectory)); goto Af3a6; E38a3: $data = ["\x70\141\164\150" => $id]; goto bf9f7; C585b: d21a9: goto a029e; fd6f3: if (!(true !== $zip->open($zipArchive, \ZipArchive::CREATE))) { goto Ae56f; } goto Ba6f7; Bb56e: $zipArchive = sprintf("\x25\x73\x2f\x61\x72\x63\150\x69\x76\145\x2e\172\x69\160", rtrim($targetDirectory, "\57")); goto Bd803; e894e: throw new \Exception(sprintf("\124\x6f\157\x20\155\x61\x6e\171\40\146\x69\x6c\x65\163\x2c\x20\155\x61\x78\151\x6d\x75\x6d\40\157\x66\x20\x22\45\163\42\x20\x66\151\x6c\145\x73\x20\x61\162\x65\40\141\x6c\154\157\167\x65\x64\56", self::MAX_FILES_TO_COMPRESS)); goto E54fa; bf9f7: Ef2fe: goto C585b; c5a64: if (!(true === file_exists($zipArchive))) { goto Ef2fe; } goto E08e4; b0608: E3306: goto Ad703; F08fa: if (true === is_dir($targetDirectory) && false === empty($files)) { goto E3306; } goto E2c0e; Ad703: $numberOfFiles = $this->countFilesToCompress($files); goto eb8f4; Af3a6: goto ceaf2; goto b0608; E08e4: $fileInfo = new \SplFileInfo($zipArchive); goto d2b7e; eb8f4: if ($numberOfFiles < self::MAX_FILES_TO_COMPRESS) { goto E9d79; } goto e894e; Dc423: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["\145\162\162\x6f\x72"] = $errorMessage; } goto Bc8e0; C7ad0: $data = []; goto E00ec; c38c9: } private function countFilesToCompress(array $files) : int { goto ff52e; E00bd: D3dbd: goto bc99e; C1a01: foreach ($files as $file) { goto C65ab; A0e49: D8645: goto d2148; A1dd2: $fileInfo = new \SplFileInfo($file); goto ed969; Ac7dc: F478a: goto A7fac; e3890: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto Af879; D68e0: e35e8: goto E2a3a; Af879: if (!(true === $fileInfo->isFile())) { goto ae66f; } goto Eba93; be9b4: ae66f: goto D68e0; Eba93: ++$numberOfFiles; goto be9b4; E2a3a: } goto f1124; B8b08: a5873: goto de8d2; A7fac: A16eb: goto B8b08; f0c57: $directory = $fileInfo->getPathname(); goto a1f01; C65ab: if (!(true === file_exists($file))) { goto A16eb; } goto A1dd2; d2148: if (!(true === $fileInfo->isDir())) { goto F478a; } goto f0c57; f1124: A70f9: goto Ac7dc; b3e89: ++$numberOfFiles; goto A0e49; ed969: if (!(true === $fileInfo->isFile())) { goto D8645; } goto b3e89; a1f01: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto e3890; de8d2: } goto E00bd; ff52e: $numberOfFiles = 0; goto C1a01; bc99e: return $numberOfFiles; goto da6ab; da6ab: } private function resetPermissions(\SplFileInfo $fileInfo, $recursive = false) { goto eba45; fa642: $chownCommand->setFile($filename); goto bbcb1; E4bca: $this->executeCommand($chmodCommand); goto C9555; F571b: $chownCommand = new ChownCommand(); goto fa642; bbcb1: $chownCommand->setRecursive($recursive); goto Ae41a; eba45: $filename = $fileInfo->getPathname(); goto F571b; c4821: $this->executeCommand($chownCommand); goto E4bca; C815f: $chmodCommand->setFileChmod(770); goto Dad50; d1226: goto edeff; goto F124c; F124c: F4820: goto d98b6; Ace73: if (true === $fileInfo->isDir() && true === $recursive) { goto F4820; } goto Bc744; c206a: edeff: goto c4821; d98b6: $chmodCommand = new FindChmodCommand(); goto a4a4a; Bc744: $chmodCommand = new ChmodCommand(); goto Bcdb0; a4a4a: $chmodCommand->setFile($filename); goto c4921; c4921: $chmodCommand->setDirectoryChmod(770); goto C815f; Bcdb0: $chmodCommand->setFile($filename); goto f301d; f301d: $chmodCommand->setChmod(770); goto d1226; B24d6: $chownCommand->setGroup($this->user); goto Ace73; Ae41a: $chownCommand->setUser($this->user); goto B24d6; Dad50: $chmodCommand->setRunInBackground(true); goto c206a; C9555: } private function mapFileExtension(string $fileExtension) : string { goto b0f10; b0f10: $mappedFileExtension = "\144\145\146\x61\x75\154\164"; goto E2e52; E2e52: if (!(true === isset($this->fileExtensionMap[$fileExtension]))) { goto E9f7b; } goto dadfb; eea86: return $mappedFileExtension; goto De360; fc903: E9f7b: goto eea86; dadfb: $mappedFileExtension = $this->fileExtensionMap[$fileExtension]; goto fc903; De360: } private function executeCommand(Command $command, $timeout = 600) { $this->commandExecutor->execute($command, $timeout); } }

Function Calls

None

Variables

None

Stats

MD5 16b836819c5813ddbb3b407c69403092
Eval Count 0
Decode Time 60 ms