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 A6236; b16a8: $finder = new Finder(); goto ec48f; A6236: $folders = []; goto b16a8; C73dd: $finder->sortByName(true); goto a4dc3; ec48f: $finder->in($directory); goto Ae184; d5c44: $finder->directories(); goto cd4cc; E39e6: foreach ($finder as $splFileInfo) { goto Aabf6; Bdc7a: usort($folders, function ($a, $b) { return strcasecmp($a["value"], $b["value"]); }); goto b1b42; Aabf6: $realPath = array_filter(explode("/", $splFileInfo->getRealPath())); goto C0acd; B9139: cdbfa: goto Bdc7a; e2ff0: $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 d424a; c1d1e: $filePermissions = substr(sprintf("%o", $splFileInfo->getPerms()), -4); goto e2ff0; b1b42: $i++; goto e5b2f; d424a: if (!(true === empty($folders[$i]["data"]))) { goto cdbfa; } goto C50e3; C0acd: $id = implode("/", array_slice($realPath, 2, count($realPath))); goto c1d1e; e5b2f: a8ddd: goto F6870; C50e3: unset($folders[$i]["data"]); goto B9139; F6870: } goto C3114; Ae184: $finder->ignoreDotFiles(false); goto d5c44; cd4cc: $finder->depth(0); goto C73dd; a4dc3: if (!(true === $finder->hasResults())) { goto a432e; } goto Fa96b; C3114: C5d29: goto a281d; a281d: a432e: goto Ea1d7; Fa96b: $i = 0; goto E39e6; Ea1d7: return $folders; goto Efa73; Efa73: } public function getFiles(string $directory) : array { goto b0bb7; d858c: if (!(true === $finder->hasResults())) { goto a988f; } goto c1466; ebb4d: $finder->depth(0); goto B5955; Cb351: a988f: goto f8650; F87dd: $files = array_merge($tmpFolders, $tmpFiles); goto Cb351; Aa567: $tmpFiles = []; goto E33c8; c1466: $tmpFolders = []; goto Aa567; B5955: $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strnatcasecmp($a->getRealPath(), $b->getRealPath()); }); goto d858c; Acb01: De64e: goto F87dd; Efe4d: $finder->in($directory); goto a03ae; b0bb7: $files = []; goto ce999; ce999: $finder = new Finder(); goto Efe4d; f8650: return $files; goto ae004; E33c8: foreach ($finder as $fileInfo) { goto edf93; Cc5b6: $tmpFiles[] = $file; goto E3d9a; ba572: if (true === isset($file["type"]) && self::TYPE_FOLDER == $file["type"]) { goto fbf9b; } goto Cc5b6; c4214: a0a21: goto F6707; F6707: ecfc6: goto Ec346; D3fcd: fbf9b: goto b646f; E3d9a: goto a0a21; goto D3fcd; edf93: $file = $this->getFileData($fileInfo); goto ba572; b646f: $tmpFolders[] = $file; goto c4214; Ec346: } goto Acb01; a03ae: $finder->ignoreDotFiles(false); goto ebb4d; ae004: } public function getFileContent(string $file) : string { goto C7ff5; ee082: $fileContent = file_get_contents($file); goto C05a0; b125c: return $fileContent; goto F6666; C7ff5: $fileContent = ''; goto E09b5; E09b5: if (!(true === file_exists($file))) { goto d5cff; } goto ee082; C05a0: d5cff: goto b125c; F6666: } public function writeFileContent(string $file, string $content) : array { goto D31de; D31de: $data = []; goto bffbf; B9283: if (!file_put_contents($file, $content)) { goto d18d2; } goto ea363; B6474: d18d2: goto E0eff; C6d24: return $data; goto ad879; bffbf: if (!(true === file_exists($file))) { goto Cd700; } goto B9283; ea363: $fileInfo = new \SplFileInfo($file); goto b7cc0; E0eff: Cd700: goto C6d24; b7cc0: $data = $this->getFileData($fileInfo); goto B6474; ad879: } public function rename(string $from, string $to) : array { goto cf755; b22e5: $data = ["invalid" => false, "error" => '', "id" => $fileData["id"]]; goto Ee0c4; Bfba8: $to = sprintf("%s/%s", $fileInfo->getPath(), $to); goto E389f; Abb77: $fileInfo = new \SplFileInfo($from); goto Bfba8; cf755: $data = []; goto c8f12; D3087: return $data; goto fa254; E389f: @rename($from, $to); goto A7ed4; C7f2b: $fileData = $this->getFileData($fileInfo); goto b22e5; c8f12: if (!(true === file_exists($from))) { goto F73fd; } goto Abb77; Ee0c4: F73fd: goto D3087; A7ed4: $fileInfo = new \SplFileInfo($to); goto C7f2b; fa254: } public function delete(string $file) : array { goto f2d7c; de848: if (!(true === file_exists($file))) { goto Da56c; } goto e39a3; e39a3: try { goto e72dc; A44a5: cc592: goto e669e; e058d: b7af6: goto e49f5; c7a8c: if (true === $fileInfo->isDir()) { goto b7af6; } goto f998a; e669e: $this->executeCommand($deleteCommand); goto Fca7c; e49f5: $deleteCommand = new DeleteDirectoryCommand(); goto d451c; a1e41: $deleteCommand->setFile($file); goto ffc96; Fca7c: $data = ["invalid" => false, "error" => '', "id" => '']; goto c1562; ffc96: goto cc592; goto e058d; f998a: $deleteCommand = new DeleteFileCommand(); goto a1e41; e72dc: $fileInfo = new \SplFileInfo($file); goto c7a8c; d451c: $deleteCommand->setDirectory($file); goto A44a5; c1562: } catch (\Exception $e) { } goto C9a06; C9a06: Da56c: goto ccb06; f2d7c: $data = []; goto de848; ccb06: return $data; goto D5703; D5703: } public function download(string $file) : void { goto ef90f; f2d79: finfo_close($finfo); goto D42c8; D42c8: header("Content-Description: File Transfer"); goto d5159; A21c6: ob_clean(); goto c135e; d0e62: B9b0e: goto a7cf1; Ad9af: $filename = $fileInfo->getFilename(); goto B9275; fe483: header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); goto C1202; c6a98: header("Content-Type: " . finfo_file($finfo, $file)); goto f2d79; c135e: flush(); goto F9152; C1202: header("Pragma: public"); goto C85ed; a17a4: header("Content-Transfer-Encoding: binary"); goto bca19; F9152: readfile($file); goto C49da; bca19: header("Expires: 0"); goto fe483; B9275: $finfo = finfo_open(FILEINFO_MIME_TYPE); goto c6a98; ef90f: if (!(true === file_exists($file))) { goto B9b0e; } goto af689; af689: $fileInfo = new \SplFileInfo($file); goto Ad9af; C49da: exit; goto d0e62; d5159: header("Content-Disposition: attachment; filename=" . $filename); goto a17a4; C85ed: header("Content-Length: " . filesize($file)); goto A21c6; a7cf1: } public function upload(string $fileUploadPath, string $directory, string $tmpFile, string $id) : array { goto Fab2a; c56a1: $fileInfo = new \SplFileInfo($file); goto F1841; F1841: $data = $this->getFileData($fileInfo); goto A1d38; Caf43: C0d4f: goto F421c; Dea13: $this->resetPermissions($fileInfo, true); goto c56a1; Fd70c: $fileInfo = new \SplFileInfo($directory); goto Dea13; c373c: $fileUploadDirectory = $filePathInfo->getPathName(); goto fc63b; E35da: @mkdir($fileUploadDirectory, 0777, true); goto Ec6ab; Ffaa4: if (!(true === is_dir($directory) && true === file_exists($tmpFile))) { goto e0502; } goto Fc5c8; Aecdc: $fileInfo = new \SplFileInfo($file); goto Ab274; fc63b: if (!(false === is_null($fileUploadDirectory))) { goto C0d4f; } goto E35da; Fab2a: $data = []; goto Ffaa4; A1d38: $data["uid"] = $id; goto Caf43; Ec6ab: @move_uploaded_file($tmpFile, $file); goto Fd70c; e9002: return $data; goto d8b07; F421c: e0502: goto e9002; Ab274: $filePathInfo = $fileInfo->getPathInfo(); goto c373c; Fc5c8: $file = sprintf("%s/%s", rtrim($directory, "/"), $fileUploadPath); goto Aecdc; d8b07: } public function copy(string $file, string $directory) : array { goto D7174; B8684: $copyFileCommand->setRecursive(true); goto e3a79; c8379: $this->resetPermissions($fileInfo, false); goto Cb843; b0c44: $fileInfo = new \SplFileInfo($fileToCopy); goto c8379; Cf625: $copiedFilename = str_replace([sprintf(".%s", $fileExtension)], [''], $filename); goto D9979; D9979: $copiedFilename = sprintf("%s_copy.%s", $copiedFilename, $fileExtension); goto E68ad; C3f3a: B37ad: goto a9098; ed159: $copyFileCommand->setDestinationFile($fileToCopy); goto B8684; f4831: bb1e3: goto Bb184; a8c64: goto a55e4; goto f4831; cce3d: $fileToCopy = sprintf("%s/%s", rtrim($directory, "/)"), $copiedFilename); goto f772d; e219c: $copyFileCommand = new CopyFileCommand(); goto bb2e3; Ece9a: if (true === $fileInfo->isDir()) { goto bb1e3; } goto D6aac; E68ad: $fileToCopy = sprintf("%s/%s", rtrim($directory, "/)"), $copiedFilename); goto a8c64; D7174: $data = []; goto f1a5e; D6aac: $fileExtension = $fileInfo->getExtension(); goto Cf625; Bb184: $copiedFilename = sprintf("%s_copy", $filename); goto cce3d; Cb843: $data = $this->getFileData($fileInfo); goto C3f3a; f772d: a55e4: goto e219c; e3a79: $this->executeCommand($copyFileCommand); goto b0c44; B429e: $filename = $fileInfo->getFilename(); goto Ece9a; bb2e3: $copyFileCommand->setSourceFile($file); goto ed159; a9098: return $data; goto b8223; A5d05: $fileInfo = new \SplFileInfo($file); goto B429e; f1a5e: if (!(true === file_exists($file) && true === is_dir($directory))) { goto B37ad; } goto A5d05; b8223: } public function move(string $file, string $directory) : array { goto Dbaef; B3440: $filename = $fileInfo->getFilename(); goto E35b8; B2673: $data = $this->getFileData($fileInfo); goto F35dc; Bcfa8: $moveFileCommand->setDestinationFile($fileToMove); goto c7e81; d8358: if (!(true === file_exists($file) && true === is_dir($directory))) { goto Dd8a8; } goto a3fb1; A301e: $this->resetPermissions($fileInfo, false); goto B2673; F1d77: return $data; goto F181a; c7e81: $this->executeCommand($moveFileCommand); goto Cd200; F35dc: Dd8a8: goto F1d77; Dbaef: $data = []; goto d8358; C4db2: $moveFileCommand->setSourceFile($file); goto Bcfa8; a3fb1: $fileInfo = new \SplFileInfo($file); goto B3440; E35b8: $fileToMove = sprintf("%s/%s", rtrim($directory, "/)"), $filename); goto f10fc; f10fc: $moveFileCommand = new MoveFileCommand(); goto C4db2; Cd200: $fileInfo = new \SplFileInfo($fileToMove); goto A301e; F181a: } public function makeFile(string $filename, string $directory, string $homeDirectory) : array { goto F9cab; D389a: return $data; goto F88a4; d43f6: $file = sprintf("%s/%s", rtrim($directory, "/"), $filename); goto d5e81; E4e40: $realpathFile = $fileInfo->getRealPath(); goto Db089; Ce7bb: $data = $this->getFileData($fileInfo); goto c0086; F1afb: D02b8: goto c5ec2; c5ec2: $this->resetPermissions($fileInfo, false); goto Ce7bb; cb547: if (!(true === is_dir($directory))) { goto A407d; } goto d43f6; f9093: $fileInfo = new \SplFileInfo($file); goto Fefe7; Ff6fe: F9756: goto F1afb; a1082: exit(sprintf("Not a valid file: %s", $realpathFile)); goto Ff6fe; c0086: A407d: goto D389a; Db089: if (!(false === str_starts_with($realpathFile, $homeDirectory))) { goto F9756; } goto a1082; F9cab: $data = []; goto cb547; Fefe7: if (!(true === $fileInfo->isLink())) { goto D02b8; } goto E4e40; d5e81: @touch($file); goto f9093; F88a4: } public function makeDirectory(string $directoryName, $directory) : array { goto bd2bc; ef328: $data = $this->getFileData($fileInfo); goto D0afc; a1389: $this->resetPermissions($fileInfo, false); goto ef328; f0f24: $fileInfo = new \SplFileInfo($newDirectory); goto a1389; bd2bc: $data = []; goto B0a62; f8514: @mkdir($newDirectory); goto f0f24; B0a62: if (!(true === is_dir($directory))) { goto b07a9; } goto A035c; D0afc: b07a9: goto ba135; A035c: $newDirectory = sprintf("%s/%s", rtrim($directory, "/"), $directoryName); goto f8514; ba135: return $data; goto C5e32; C5e32: } private function getFileData(\SplFileInfo $fileInfo) : array { goto D12ec; f97d3: return $fileData; goto F9890; D12ec: $fileData = []; goto A3239; A3239: try { goto A2ec3; A1954: $realPath = array_filter(explode("/", $fileInfo->getRealPath())); goto D3a42; f62dc: $fileData["ext"] = $fileExtension; goto Cd956; Bf9ba: $fileGroupInformation = posix_getgrgid($fileInfo->getGroup()); goto B0abd; A20b3: $filePermissions = substr(sprintf("%o", $fileInfo->getPerms()), -4); goto c4361; Cd956: a4ce6: goto bd783; d48e3: $fileDate = $fileInfo->getMTime(); goto da948; feef7: $fileSize = $fileInfo->getSize(); goto A20b3; aca5a: $fileExtension = $this->mapFileExtension($fileInfo->getExtension()); goto f62dc; c3c24: $fileData = ["value" => htmlspecialchars($filename, ENT_QUOTES), "id" => sprintf("/%s", htmlspecialchars($id, ENT_QUOTES)), "size" => $fileSize, "owner" => $fileOwner, "permissions" => $filePermissions, "date" => $fileDate, "type" => $fileType]; goto bf18c; da948: $fileType = $this->getFileType($fileInfo); goto c3c24; D3a42: $id = implode("/", array_slice($realPath, 2, count($realPath))); goto feef7; c4361: $fileOwnerInformation = posix_getpwuid($fileInfo->getOwner()); goto Bf9ba; bf18c: if (!(false === $fileInfo->isDir())) { goto a4ce6; } goto aca5a; B0abd: $fileOwner = sprintf("%s:%s", $fileOwnerInformation["name"] ?? '', $fileGroupInformation["name"] ?? ''); goto d48e3; A2ec3: $filename = $fileInfo->getFilename(); goto A1954; bd783: } catch (\Exception $e) { } goto f97d3; F9890: } private function getFileType(\SplFileInfo $fileInfo) { goto Fc06f; daa91: $fileType = "folder"; goto Ad417; b4c24: if (true === $fileInfo->isDir()) { goto F3a2f; } goto ea2f1; df64f: return $fileType; goto e3a9e; d0c8a: F3a2f: goto daa91; A0aaf: goto ee894; goto d0c8a; Ad417: ee894: goto df64f; C2f2e: foreach ($this->fileGroups as $type => $extensions) { goto a0fb8; Ea131: goto c63f9; goto fa194; cfc69: $fileType = $type; goto Ea131; a0fb8: if (!(true === in_array($fileExtension, $extensions))) { goto Efeaf; } goto cfc69; fa194: Efeaf: goto Cc98e; Cc98e: e673f: goto eeccf; eeccf: } goto A8c08; Fc06f: $fileType = "code"; goto b4c24; A8c08: c63f9: goto A0aaf; ea2f1: $fileExtension = $fileInfo->getExtension(); goto C2f2e; e3a9e: } public function permissions(string $file, string $permissions) : array { goto f1f43; d0ca6: $this->executeCommand($chownCommand, 600); goto F58ed; Eb035: $file = realpath($file); goto ebb9c; af6a1: $chownCommand->setGroup($this->user); goto D9c29; ebb9c: $homeDirectory = sprintf("/home/%s/", $this->user); goto ed5f5; F58ed: $this->executeCommand($chmodCommand, 600); goto e5d4d; D9c29: $chmodCommand = new FindChmodCommand(); goto bf0bb; dcd23: $chownCommand->setRecursive(true); goto e0146; F0cf5: $chmodCommand->setDirectoryChmod($permissions); goto F1e4a; C171a: d092b: goto D26a1; e0146: $chownCommand->setUser($this->user); goto af6a1; f1cac: $chownCommand = new ChownCommand(); goto A3916; d9a7e: $fileInfo = new \SplFileInfo($file); goto f1cac; e5d4d: $fileData = $this->getFileData($fileInfo); goto c3f18; ed5f5: if (!(true === str_starts_with($file, $homeDirectory) && true === file_exists($file))) { goto d092b; } goto d9a7e; c3f18: $data = ["invalid" => false, "error" => '', "id" => $fileData["id"], "permissions" => $permissions]; goto C171a; F1e4a: $chmodCommand->setFileChmod($permissions); goto d0ca6; D26a1: return $data; goto c0bed; f1f43: $data = []; goto Eb035; A3916: $chownCommand->setFile($file); goto dcd23; bf0bb: $chmodCommand->setFile($file); goto F0cf5; c0bed: } public function extract(string $file, string $destinationDirectoryName) : array { goto Ef03a; d7e37: return $data; goto B61d7; Ef03a: $data = []; goto b7bca; b7bca: try { goto Cea9c; aca2d: $copyFileCommand->setSourceFile($file); goto D09e4; d3a40: $bsdTarExtractCommand = new BsdTarExtractCommand(); goto e0435; eb491: $fileExtension = "tar.gz"; goto B247e; C2481: $copyFileCommand = new CopyFileCommand(); goto aca2d; e154e: $gzipFile = sprintf("%s/%s", rtrim($destinationDirectory, "/"), $filename); goto cf479; C4fcd: $filename = $fileInfo->getFilename(); goto A4484; b1cb1: $path = array_filter(explode("/", $fileInfo->getRealPath())); goto ce201; ae1cd: $data["path"] = $path; goto E419c; e6564: $gunzipCommand = new GunzipCommand(); goto c4ab2; D4668: $fileExtension = $fileInfo->getExtension(); goto E4e10; a4b5f: $this->executeCommand($bsdTarExtractCommand, 3600); goto a1daf; c4ab2: $gunzipCommand->setFile($gzipFile); goto E7443; ce201: $path = array_slice($path, 2, count($path)); goto c17af; e0435: $bsdTarExtractCommand->setSourceFile($file); goto D176b; d0685: $fileInfo = new \SplFileInfo($file); goto C4fcd; A4484: if ("tar.gz" == substr($filename, -6)) { goto bb80a; } goto D4668; F70b7: $this->resetPermissions($fileInfo, true); goto f97b1; Cea9c: if (!(true === file_exists($file))) { goto Bb912; } goto d0685; de303: $createDirectoryCommand->setDirectory($destinationDirectory); goto C2481; B247e: F04a8: goto c346a; Df82c: $fileInfo = new \SplFileInfo($destinationDirectory); goto F70b7; E419c: $destinationDirectory = sprintf("%s/%s", rtrim($filePathInfo->getPathName(), "/"), rtrim($destinationDirectoryName, "/")); goto E35f4; cf479: $createDirectoryCommand = new CreateDirectoryCommand(); goto de303; e2b95: $createDirectoryCommand = new CreateDirectoryCommand(); goto aff65; f704e: $path = sprintf("/%s", implode("/", $path)); goto ae1cd; d868a: if (!("gz" == $fileExtension)) { goto a2cd5; } goto e154e; Bcf41: $this->executeCommand($gunzipCommand); goto c5e3a; F2a74: Bb912: goto f9dd8; E4e10: goto F04a8; goto A7055; a245b: $this->executeCommand($createDirectoryCommand); goto a4b5f; A7055: bb80a: goto eb491; a4c54: $this->executeCommand($copyFileCommand); goto Bcf41; a1daf: B3efa: goto cb5af; c5e3a: a2cd5: goto A9732; D09e4: $copyFileCommand->setDestinationFile($gzipFile); goto e6564; c346a: $filePathInfo = $fileInfo->getPathInfo(); goto b1cb1; aff65: $createDirectoryCommand->setDirectory($destinationDirectory); goto d3a40; D176b: $bsdTarExtractCommand->setDestinationFile($destinationDirectory); goto a245b; E35f4: if (true === in_array($fileExtension, ["tar", "tgz", "tar.gz", "rar", "zip"])) { goto ddc25; } goto d868a; f97b1: c6d50: goto F2a74; cb5af: if (!(true === is_dir($destinationDirectory))) { goto c6d50; } goto Df82c; A9732: goto B3efa; goto C053c; c17af: array_pop($path); goto f704e; E7443: $this->executeCommand($createDirectoryCommand); goto a4c54; C053c: ddc25: goto e2b95; f9dd8: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["error"] = $errorMessage; } goto d7e37; B61d7: } public function compress(array $files, string $targetDirectory, string $id, string $homeDirectory) : array { goto f0144; b0080: try { goto d96c8; f475e: $data = ["path" => $id]; goto f339d; d0135: $numberOfFiles = $this->countFilesToCompress($files); goto Bf77a; a0d86: throw new \Exception(sprintf("Cannot create zip file "%s".", $zipArchive)); goto Bb6b5; D8dc9: $fileInfo = new \SplFileInfo($zipArchive); goto be8bc; be8bc: $this->resetPermissions($fileInfo); goto f475e; Fb2a7: b66f5: goto f9993; f339d: af982: goto Da618; d1b00: Dc9c2: goto d0135; B24c4: throw new \Exception(sprintf("Target directory "%s" does not exist.", $targetDirectory)); goto A8370; A8370: goto d4030; goto d1b00; Bb6b5: A5ccf: goto Ee1b6; b36d0: $zipArchive = sprintf("%s/archive.zip", rtrim($targetDirectory, "/")); goto E21ab; d16c7: throw new \Exception(sprintf("Too many files, maximum of "%s" files are allowed.", self::MAX_FILES_TO_COMPRESS)); goto bb258; Ec04e: d4030: goto f417d; bb258: goto c88f6; goto e5c9b; d96c8: if (true === is_dir($targetDirectory) && false === empty($files)) { goto Dc9c2; } goto B24c4; Da618: c88f6: goto Ec04e; e5c9b: Cde92: goto b36d0; E21ab: $zip = new \ZipArchive(); goto a9ff9; a9ff9: if (!(true !== $zip->open($zipArchive, \ZipArchive::CREATE))) { goto A5ccf; } goto a0d86; f9993: $zip->close(); goto c72d3; Ee1b6: foreach ($files as $file) { goto d086f; edbb9: if (!(true === $fileInfo->isFile())) { goto e2e7e; } goto E4746; ee15f: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto c7067; b1597: fbaa1: goto D9bb6; F8e71: C40d2: goto F2632; E3aa4: if (!(false === str_starts_with($realpathFile, $homeDirectory))) { goto B449b; } goto e17bc; b39d7: $realpathFile = $fileInfo->getRealPath(); goto E3aa4; c7067: if (!(true === $fileInfo->isFile())) { goto fbaa1; } goto cdd6b; Da4fc: $entryName = sprintf("%s/%s", rtrim($directory, "/"), $filename); goto D56c8; f791a: $zip->addEmptyDir($directory); goto Da4fc; e17bc: exit(sprintf("Not a valid file: %s", $realpathFile)); goto baf15; C52ee: array_pop($entryName); goto C5d2b; C5d2b: $directory = implode("/", $entryName); goto f791a; cdd6b: $filename = $fileInfo->getFilename(); goto Adf8f; baf15: B449b: goto F8e71; F5d82: if (!(true === $fileInfo->isLink())) { goto C40d2; } goto b39d7; D56c8: $zip->addFile($filepath, $entryName); goto b1597; Adf8f: $filepath = $fileInfo->getPathname(); goto F5d82; Bf432: $entryName = array_filter(explode("/", $entryName)); goto C52ee; D9bb6: b23da: goto a2779; F2632: $entryName = ltrim(str_replace($targetDirectory, '', $fileInfo->getPathname()), "/"); goto Bf432; a2779: } goto d7cac; Bf073: $zip->addFile($filepath, $filename); goto De23a; abdea: b173e: goto Dc608; E4746: $filename = $fileInfo->getFilename(); goto efb05; De23a: e2e7e: goto bf32e; A15fb: $directory = $fileInfo->getPathname(); goto e2096; d086f: if (!(true === file_exists($file))) { goto b173e; } goto f1e1b; f1e1b: $fileInfo = new \SplFileInfo($file); goto edbb9; e2096: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto ee15f; Dc608: A5c4a: goto Eda0e; efb05: $filepath = $fileInfo->getPathname(); goto Bf073; d7cac: e1483: goto b1976; b1976: Beb24: goto abdea; bf32e: if (!(true === $fileInfo->isDir())) { goto Beb24; } goto A15fb; Eda0e: } goto Fb2a7; Bf77a: if ($numberOfFiles < self::MAX_FILES_TO_COMPRESS) { goto Cde92; } goto d16c7; c72d3: if (!(true === file_exists($zipArchive))) { goto af982; } goto D8dc9; f417d: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["error"] = $errorMessage; } goto ab1ab; ab1ab: return $data; goto C46c6; f0144: $data = []; goto b0080; C46c6: } private function countFilesToCompress(array $files) : int { goto e40cc; e40cc: $numberOfFiles = 0; goto C86c2; C86c2: foreach ($files as $file) { goto Dba88; B3da0: aa602: goto C2cbd; C2cbd: D32e3: goto Fc7e4; Cdf78: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto f4005; C895a: A711f: goto c6394; c6394: Eaeba: goto dda07; f4005: if (!(true === $fileInfo->isFile())) { goto A711f; } goto E8084; E8084: ++$numberOfFiles; goto C895a; dda07: } goto C4de4; a5840: if (!(true === $fileInfo->isFile())) { goto Bc225; } goto B9c96; B1b88: if (!(true === $fileInfo->isDir())) { goto aa602; } goto A626f; d93ee: Bc225: goto B1b88; A626f: $directory = $fileInfo->getPathname(); goto Dcfa5; B9c96: ++$numberOfFiles; goto d93ee; C4de4: E15e5: goto B3da0; Dcfa5: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto Cdf78; D0db2: $fileInfo = new \SplFileInfo($file); goto a5840; Fc7e4: ee7da: goto Cdfd8; Dba88: if (!(true === file_exists($file))) { goto D32e3; } goto D0db2; Cdfd8: } goto Bd33a; Bd33a: b6cfc: goto E86e2; E86e2: return $numberOfFiles; goto F4724; F4724: } private function resetPermissions(\SplFileInfo $fileInfo, $recursive = false) { goto b77ec; Aa5c0: goto a8f8f; goto b1c36; bdc2c: $this->executeCommand($chownCommand); goto E3780; a9249: $chmodCommand = new FindChmodCommand(); goto eb29d; B72b1: $chmodCommand->setFile($filename); goto c77b5; E26d0: $chmodCommand->setRunInBackground(true); goto B4cbe; b1c36: A04cb: goto a9249; d6200: $chmodCommand->setDirectoryChmod(770); goto a6a29; e2ee0: $chmodCommand = new ChmodCommand(); goto B72b1; bd24b: $chownCommand->setGroup($this->user); goto a5a58; de2eb: $chownCommand = new ChownCommand(); goto Be702; f9a48: $chownCommand->setUser($this->user); goto bd24b; c77b5: $chmodCommand->setChmod(770); goto Aa5c0; E3780: $this->executeCommand($chmodCommand); goto db9f4; eb29d: $chmodCommand->setFile($filename); goto d6200; a5a58: if (true === $fileInfo->isDir() && true === $recursive) { goto A04cb; } goto e2ee0; b77ec: $filename = $fileInfo->getPathname(); goto de2eb; a6a29: $chmodCommand->setFileChmod(770); goto E26d0; e90a0: $chownCommand->setRecursive($recursive); goto f9a48; Be702: $chownCommand->setFile($filename); goto e90a0; B4cbe: a8f8f: goto bdc2c; db9f4: } private function mapFileExtension(string $fileExtension) : string { goto b3948; bcb71: $mappedFileExtension = $this->fileExtensionMap[$fileExtension]; goto Aae05; fd38c: return $mappedFileExtension; goto d758d; cda37: if (!(true === isset($this->fileExtensionMap[$fileExtension]))) { goto A07c6; } goto bcb71; Aae05: A07c6: goto fd38c; b3948: $mappedFileExtension = "default"; goto cda37; d758d: } 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 = "\x66\x6f\154\144\x65\x72"; private string $user; protected CommandExecutor $commandExecutor; private array $fileExtensionMap = ["\141\151" => "\141\x69", "\x61\x75\x74" => "\141\165\164", "\x61\166\x69" => "\x61\x76\x69", "\142\151\156" => "\142\x69\156", "\x62\x6d\160" => "\x62\155\x70", "\x62\x6d\160" => "\142\x6d\x70", "\143\x61\144" => "\x63\x61\x64", "\x63\x64\162" => "\x63\144\x72", "\x63\163\x73" => "\143\163\163", "\143\x73\166" => "\143\163\x76", "\144\142" => "\144\x62", "\x64\157\143" => "\144\x6f\x63", "\144\x6f\143\x78" => "\x64\157\143\x78", "\x65\160\x73" => "\x65\x70\x73", "\x65\170\x65" => "\145\170\x65", "\146\x6c\166" => "\146\154\x76", "\x67\x69\x66" => "\147\151\x66", "\150\x6c\160" => "\150\x6c\160", "\x68\164\x6d" => "\x68\x74\x6d", "\151\156\151" => "\151\156\x69", "\x69\x73\157" => "\x69\163\157", "\152\x61\166\x61" => "\152\x61\166\141", "\152\x70\x67" => "\x6a\160\147", "\x6a\160\145\147" => "\x6a\160\147", "\152\x73" => "\x6a\x73", "\x6d\x6b\166" => "\x6d\x6b\x76", "\x6d\x6f\166" => "\x6d\157\x76", "\155\x70\63" => "\x6d\x70\63", "\x6d\160\x34" => "\x6d\160\x34", "\x6d\160\x67" => "\x6d\160\147", "\155\x70\145\x67" => "\x6d\x70\145\147", "\150\x74\x6d\154" => "\150\x74\155\154", "\160\150\x70" => "\160\150\x70", "\x70\x68\x74\155\154" => "\160\x68\x70", "\x70\x64\146" => "\160\144\x66", "\x70\156\x67" => "\x70\156\147", "\160\x70\x74" => "\160\160\x74", "\160\x73" => "\x70\x73", "\160\x73\144" => "\x70\x73\x64", "\162\141\162" => "\x72\x61\162", "\162\163\x73" => "\162\x73\163", "\x72\164\x66" => "\162\x74\146", "\163\x71\154" => "\x73\x71\154", "\163\166\147" => "\x73\x76\x67", "\163\x77\146" => "\163\x77\146", "\x73\x79\163" => "\163\171\x73", "\x74\x78\x74" => "\x74\x78\x74", "\x77\155\141" => "\167\x6d\141", "\170\x6c\163" => "\170\154\163", "\170\155\x6c" => "\170\155\x6c", "\x67\x7a" => "\x67\172", "\164\x67\172" => "\147\172", "\164\x61\x72" => "\164\141\162", "\172\x69\160" => "\172\x69\160"]; private array $fileGroups = ["\x63\157\x64\145" => ["\x68\x74\155\x6c", "\x68\x74\155", "\x6a\163", "\152\x73\x6f\x6e", "\143\x73\x73", "\x73\143\x73\x73", "\163\141\163\163", "\154\x65\x73\x73", "\160\150\x70", "\160\150\164\155\154", "\163\x68", "\143\157\x66\x66\145\145", "\164\x78\x74", "\154\x6f\x67", "\x6d\x64", "\x67\x6f", "\x79\x6d\154", "\x66\x69\x6c\x65\163"], "\x64\157\143\x75\x6d\145\x6e\164" => ["\x64\157\x63\x78", "\x64\x6f\x63", "\x6f\x64\x74", "\x78\x6c\163", "\170\163\x6c\170", "\160\144\146", "\x64\152\166\x75", "\144\152\166", "\160\x70\164\x78", "\160\x70\x74"], "\x61\x72\143\x68\x69\166\x65" => ["\162\141\162", "\164\141\162", "\164\x67\172", "\x67\x7a", "\172\x69\x70"], "\141\x75\x64\x69\x6f" => ["\x6d\x70\63", "\x6f\x67\147", "\x66\x6c\x61\143", "\x77\141\x76"], "\x76\x69\x64\145\157" => ["\x6d\160\147", "\x6d\x70\64", "\x61\166\x69", "\155\153\166", "\x6f\147\x76"], "\x69\x6d\x61\147\x65" => ["\160\156\147", "\152\160\147", "\x6a\160\x65\x67", "\x77\x65\x62\160", "\147\151\x66", "\x74\151\x66\x66", "\164\x69\146", "\x73\x76\147"]]; public function __construct(string $user) { $this->user = $user; $this->commandExecutor = new CommandExecutor(); } public function getFolders(string $directory) : array { goto A6236; b16a8: $finder = new Finder(); goto ec48f; A6236: $folders = []; goto b16a8; C73dd: $finder->sortByName(true); goto a4dc3; ec48f: $finder->in($directory); goto Ae184; d5c44: $finder->directories(); goto cd4cc; E39e6: foreach ($finder as $splFileInfo) { goto Aabf6; Bdc7a: usort($folders, function ($a, $b) { return strcasecmp($a["\166\x61\154\x75\x65"], $b["\x76\141\x6c\x75\145"]); }); goto b1b42; Aabf6: $realPath = array_filter(explode("\x2f", $splFileInfo->getRealPath())); goto C0acd; B9139: cdbfa: goto Bdc7a; e2ff0: $folders[$i] = ["\x76\x61\154\165\145" => htmlspecialchars($splFileInfo->getFilename(), ENT_QUOTES), "\151\x64" => sprintf("\x2f\45\163", htmlspecialchars($id, ENT_QUOTES)), "\x73\x69\x7a\x65" => 4096, "\144\141\x74\x65" => $splFileInfo->getMTime(), "\160\x65\162\x6d\x69\163\163\151\157\x6e\x73" => $filePermissions, "\164\171\x70\145" => "\146\x6f\154\144\x65\x72"]; goto d424a; c1d1e: $filePermissions = substr(sprintf("\x25\157", $splFileInfo->getPerms()), -4); goto e2ff0; b1b42: $i++; goto e5b2f; d424a: if (!(true === empty($folders[$i]["\x64\x61\164\141"]))) { goto cdbfa; } goto C50e3; C0acd: $id = implode("\x2f", array_slice($realPath, 2, count($realPath))); goto c1d1e; e5b2f: a8ddd: goto F6870; C50e3: unset($folders[$i]["\x64\x61\x74\141"]); goto B9139; F6870: } goto C3114; Ae184: $finder->ignoreDotFiles(false); goto d5c44; cd4cc: $finder->depth(0); goto C73dd; a4dc3: if (!(true === $finder->hasResults())) { goto a432e; } goto Fa96b; C3114: C5d29: goto a281d; a281d: a432e: goto Ea1d7; Fa96b: $i = 0; goto E39e6; Ea1d7: return $folders; goto Efa73; Efa73: } public function getFiles(string $directory) : array { goto b0bb7; d858c: if (!(true === $finder->hasResults())) { goto a988f; } goto c1466; ebb4d: $finder->depth(0); goto B5955; Cb351: a988f: goto f8650; F87dd: $files = array_merge($tmpFolders, $tmpFiles); goto Cb351; Aa567: $tmpFiles = []; goto E33c8; c1466: $tmpFolders = []; goto Aa567; B5955: $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strnatcasecmp($a->getRealPath(), $b->getRealPath()); }); goto d858c; Acb01: De64e: goto F87dd; Efe4d: $finder->in($directory); goto a03ae; b0bb7: $files = []; goto ce999; ce999: $finder = new Finder(); goto Efe4d; f8650: return $files; goto ae004; E33c8: foreach ($finder as $fileInfo) { goto edf93; Cc5b6: $tmpFiles[] = $file; goto E3d9a; ba572: if (true === isset($file["\x74\171\160\145"]) && self::TYPE_FOLDER == $file["\164\x79\160\145"]) { goto fbf9b; } goto Cc5b6; c4214: a0a21: goto F6707; F6707: ecfc6: goto Ec346; D3fcd: fbf9b: goto b646f; E3d9a: goto a0a21; goto D3fcd; edf93: $file = $this->getFileData($fileInfo); goto ba572; b646f: $tmpFolders[] = $file; goto c4214; Ec346: } goto Acb01; a03ae: $finder->ignoreDotFiles(false); goto ebb4d; ae004: } public function getFileContent(string $file) : string { goto C7ff5; ee082: $fileContent = file_get_contents($file); goto C05a0; b125c: return $fileContent; goto F6666; C7ff5: $fileContent = ''; goto E09b5; E09b5: if (!(true === file_exists($file))) { goto d5cff; } goto ee082; C05a0: d5cff: goto b125c; F6666: } public function writeFileContent(string $file, string $content) : array { goto D31de; D31de: $data = []; goto bffbf; B9283: if (!file_put_contents($file, $content)) { goto d18d2; } goto ea363; B6474: d18d2: goto E0eff; C6d24: return $data; goto ad879; bffbf: if (!(true === file_exists($file))) { goto Cd700; } goto B9283; ea363: $fileInfo = new \SplFileInfo($file); goto b7cc0; E0eff: Cd700: goto C6d24; b7cc0: $data = $this->getFileData($fileInfo); goto B6474; ad879: } public function rename(string $from, string $to) : array { goto cf755; b22e5: $data = ["\x69\x6e\x76\141\154\151\x64" => false, "\x65\162\x72\157\162" => '', "\151\x64" => $fileData["\x69\144"]]; goto Ee0c4; Bfba8: $to = sprintf("\x25\x73\x2f\45\163", $fileInfo->getPath(), $to); goto E389f; Abb77: $fileInfo = new \SplFileInfo($from); goto Bfba8; cf755: $data = []; goto c8f12; D3087: return $data; goto fa254; E389f: @rename($from, $to); goto A7ed4; C7f2b: $fileData = $this->getFileData($fileInfo); goto b22e5; c8f12: if (!(true === file_exists($from))) { goto F73fd; } goto Abb77; Ee0c4: F73fd: goto D3087; A7ed4: $fileInfo = new \SplFileInfo($to); goto C7f2b; fa254: } public function delete(string $file) : array { goto f2d7c; de848: if (!(true === file_exists($file))) { goto Da56c; } goto e39a3; e39a3: try { goto e72dc; A44a5: cc592: goto e669e; e058d: b7af6: goto e49f5; c7a8c: if (true === $fileInfo->isDir()) { goto b7af6; } goto f998a; e669e: $this->executeCommand($deleteCommand); goto Fca7c; e49f5: $deleteCommand = new DeleteDirectoryCommand(); goto d451c; a1e41: $deleteCommand->setFile($file); goto ffc96; Fca7c: $data = ["\151\x6e\166\x61\154\151\x64" => false, "\x65\x72\162\x6f\x72" => '', "\x69\144" => '']; goto c1562; ffc96: goto cc592; goto e058d; f998a: $deleteCommand = new DeleteFileCommand(); goto a1e41; e72dc: $fileInfo = new \SplFileInfo($file); goto c7a8c; d451c: $deleteCommand->setDirectory($file); goto A44a5; c1562: } catch (\Exception $e) { } goto C9a06; C9a06: Da56c: goto ccb06; f2d7c: $data = []; goto de848; ccb06: return $data; goto D5703; D5703: } public function download(string $file) : void { goto ef90f; f2d79: finfo_close($finfo); goto D42c8; D42c8: header("\x43\157\x6e\164\145\156\164\x2d\104\x65\163\x63\162\x69\x70\x74\151\x6f\x6e\x3a\40\x46\151\x6c\145\x20\x54\x72\141\x6e\x73\x66\145\x72"); goto d5159; A21c6: ob_clean(); goto c135e; d0e62: B9b0e: goto a7cf1; Ad9af: $filename = $fileInfo->getFilename(); goto B9275; fe483: header("\103\141\x63\150\x65\55\x43\157\156\164\x72\x6f\x6c\72\x20\x6d\x75\163\164\55\162\145\166\x61\154\x69\x64\x61\164\x65\x2c\40\x70\x6f\x73\164\x2d\143\x68\145\143\153\x3d\60\x2c\x20\x70\x72\x65\x2d\x63\150\x65\143\x6b\x3d\60"); goto C1202; c6a98: header("\103\157\x6e\164\145\156\x74\x2d\x54\x79\x70\x65\x3a\x20" . finfo_file($finfo, $file)); goto f2d79; c135e: flush(); goto F9152; C1202: header("\x50\162\x61\x67\155\x61\72\x20\160\165\142\x6c\x69\143"); goto C85ed; a17a4: header("\x43\x6f\156\164\145\x6e\x74\x2d\124\x72\x61\156\163\x66\145\162\55\x45\156\143\157\144\151\156\147\72\x20\x62\x69\156\141\x72\x79"); goto bca19; F9152: readfile($file); goto C49da; bca19: header("\x45\170\160\151\162\145\x73\72\x20\60"); goto fe483; B9275: $finfo = finfo_open(FILEINFO_MIME_TYPE); goto c6a98; ef90f: if (!(true === file_exists($file))) { goto B9b0e; } goto af689; af689: $fileInfo = new \SplFileInfo($file); goto Ad9af; C49da: exit; goto d0e62; d5159: header("\103\x6f\156\164\x65\156\x74\55\104\151\x73\160\157\163\151\164\x69\x6f\x6e\x3a\x20\141\164\164\141\143\150\x6d\x65\156\x74\73\40\146\151\x6c\x65\156\141\155\145\75" . $filename); goto a17a4; C85ed: header("\x43\157\x6e\x74\x65\x6e\164\x2d\114\145\156\147\x74\x68\x3a\40" . filesize($file)); goto A21c6; a7cf1: } public function upload(string $fileUploadPath, string $directory, string $tmpFile, string $id) : array { goto Fab2a; c56a1: $fileInfo = new \SplFileInfo($file); goto F1841; F1841: $data = $this->getFileData($fileInfo); goto A1d38; Caf43: C0d4f: goto F421c; Dea13: $this->resetPermissions($fileInfo, true); goto c56a1; Fd70c: $fileInfo = new \SplFileInfo($directory); goto Dea13; c373c: $fileUploadDirectory = $filePathInfo->getPathName(); goto fc63b; E35da: @mkdir($fileUploadDirectory, 0777, true); goto Ec6ab; Ffaa4: if (!(true === is_dir($directory) && true === file_exists($tmpFile))) { goto e0502; } goto Fc5c8; Aecdc: $fileInfo = new \SplFileInfo($file); goto Ab274; fc63b: if (!(false === is_null($fileUploadDirectory))) { goto C0d4f; } goto E35da; Fab2a: $data = []; goto Ffaa4; A1d38: $data["\165\x69\144"] = $id; goto Caf43; Ec6ab: @move_uploaded_file($tmpFile, $file); goto Fd70c; e9002: return $data; goto d8b07; F421c: e0502: goto e9002; Ab274: $filePathInfo = $fileInfo->getPathInfo(); goto c373c; Fc5c8: $file = sprintf("\45\x73\x2f\45\x73", rtrim($directory, "\x2f"), $fileUploadPath); goto Aecdc; d8b07: } public function copy(string $file, string $directory) : array { goto D7174; B8684: $copyFileCommand->setRecursive(true); goto e3a79; c8379: $this->resetPermissions($fileInfo, false); goto Cb843; b0c44: $fileInfo = new \SplFileInfo($fileToCopy); goto c8379; Cf625: $copiedFilename = str_replace([sprintf("\x2e\45\x73", $fileExtension)], [''], $filename); goto D9979; D9979: $copiedFilename = sprintf("\45\163\x5f\x63\x6f\x70\171\x2e\45\x73", $copiedFilename, $fileExtension); goto E68ad; C3f3a: B37ad: goto a9098; ed159: $copyFileCommand->setDestinationFile($fileToCopy); goto B8684; f4831: bb1e3: goto Bb184; a8c64: goto a55e4; goto f4831; cce3d: $fileToCopy = sprintf("\x25\x73\x2f\x25\163", rtrim($directory, "\x2f\x29"), $copiedFilename); goto f772d; e219c: $copyFileCommand = new CopyFileCommand(); goto bb2e3; Ece9a: if (true === $fileInfo->isDir()) { goto bb1e3; } goto D6aac; E68ad: $fileToCopy = sprintf("\45\x73\57\x25\163", rtrim($directory, "\57\x29"), $copiedFilename); goto a8c64; D7174: $data = []; goto f1a5e; D6aac: $fileExtension = $fileInfo->getExtension(); goto Cf625; Bb184: $copiedFilename = sprintf("\45\x73\x5f\x63\157\160\171", $filename); goto cce3d; Cb843: $data = $this->getFileData($fileInfo); goto C3f3a; f772d: a55e4: goto e219c; e3a79: $this->executeCommand($copyFileCommand); goto b0c44; B429e: $filename = $fileInfo->getFilename(); goto Ece9a; bb2e3: $copyFileCommand->setSourceFile($file); goto ed159; a9098: return $data; goto b8223; A5d05: $fileInfo = new \SplFileInfo($file); goto B429e; f1a5e: if (!(true === file_exists($file) && true === is_dir($directory))) { goto B37ad; } goto A5d05; b8223: } public function move(string $file, string $directory) : array { goto Dbaef; B3440: $filename = $fileInfo->getFilename(); goto E35b8; B2673: $data = $this->getFileData($fileInfo); goto F35dc; Bcfa8: $moveFileCommand->setDestinationFile($fileToMove); goto c7e81; d8358: if (!(true === file_exists($file) && true === is_dir($directory))) { goto Dd8a8; } goto a3fb1; A301e: $this->resetPermissions($fileInfo, false); goto B2673; F1d77: return $data; goto F181a; c7e81: $this->executeCommand($moveFileCommand); goto Cd200; F35dc: Dd8a8: goto F1d77; Dbaef: $data = []; goto d8358; C4db2: $moveFileCommand->setSourceFile($file); goto Bcfa8; a3fb1: $fileInfo = new \SplFileInfo($file); goto B3440; E35b8: $fileToMove = sprintf("\45\163\x2f\x25\163", rtrim($directory, "\57\51"), $filename); goto f10fc; f10fc: $moveFileCommand = new MoveFileCommand(); goto C4db2; Cd200: $fileInfo = new \SplFileInfo($fileToMove); goto A301e; F181a: } public function makeFile(string $filename, string $directory, string $homeDirectory) : array { goto F9cab; D389a: return $data; goto F88a4; d43f6: $file = sprintf("\x25\x73\x2f\45\163", rtrim($directory, "\x2f"), $filename); goto d5e81; E4e40: $realpathFile = $fileInfo->getRealPath(); goto Db089; Ce7bb: $data = $this->getFileData($fileInfo); goto c0086; F1afb: D02b8: goto c5ec2; c5ec2: $this->resetPermissions($fileInfo, false); goto Ce7bb; cb547: if (!(true === is_dir($directory))) { goto A407d; } goto d43f6; f9093: $fileInfo = new \SplFileInfo($file); goto Fefe7; Ff6fe: F9756: goto F1afb; a1082: exit(sprintf("\116\x6f\x74\x20\x61\x20\166\141\x6c\x69\x64\x20\x66\x69\x6c\x65\x3a\40\45\x73", $realpathFile)); goto Ff6fe; c0086: A407d: goto D389a; Db089: if (!(false === str_starts_with($realpathFile, $homeDirectory))) { goto F9756; } goto a1082; F9cab: $data = []; goto cb547; Fefe7: if (!(true === $fileInfo->isLink())) { goto D02b8; } goto E4e40; d5e81: @touch($file); goto f9093; F88a4: } public function makeDirectory(string $directoryName, $directory) : array { goto bd2bc; ef328: $data = $this->getFileData($fileInfo); goto D0afc; a1389: $this->resetPermissions($fileInfo, false); goto ef328; f0f24: $fileInfo = new \SplFileInfo($newDirectory); goto a1389; bd2bc: $data = []; goto B0a62; f8514: @mkdir($newDirectory); goto f0f24; B0a62: if (!(true === is_dir($directory))) { goto b07a9; } goto A035c; D0afc: b07a9: goto ba135; A035c: $newDirectory = sprintf("\x25\x73\x2f\x25\163", rtrim($directory, "\x2f"), $directoryName); goto f8514; ba135: return $data; goto C5e32; C5e32: } private function getFileData(\SplFileInfo $fileInfo) : array { goto D12ec; f97d3: return $fileData; goto F9890; D12ec: $fileData = []; goto A3239; A3239: try { goto A2ec3; A1954: $realPath = array_filter(explode("\x2f", $fileInfo->getRealPath())); goto D3a42; f62dc: $fileData["\x65\170\x74"] = $fileExtension; goto Cd956; Bf9ba: $fileGroupInformation = posix_getgrgid($fileInfo->getGroup()); goto B0abd; A20b3: $filePermissions = substr(sprintf("\x25\x6f", $fileInfo->getPerms()), -4); goto c4361; Cd956: a4ce6: goto bd783; d48e3: $fileDate = $fileInfo->getMTime(); goto da948; feef7: $fileSize = $fileInfo->getSize(); goto A20b3; aca5a: $fileExtension = $this->mapFileExtension($fileInfo->getExtension()); goto f62dc; c3c24: $fileData = ["\x76\141\154\165\145" => htmlspecialchars($filename, ENT_QUOTES), "\x69\144" => sprintf("\57\45\x73", htmlspecialchars($id, ENT_QUOTES)), "\163\x69\x7a\145" => $fileSize, "\x6f\x77\x6e\145\162" => $fileOwner, "\160\145\162\x6d\151\163\x73\x69\157\x6e\x73" => $filePermissions, "\144\141\164\x65" => $fileDate, "\164\x79\160\145" => $fileType]; goto bf18c; da948: $fileType = $this->getFileType($fileInfo); goto c3c24; D3a42: $id = implode("\x2f", array_slice($realPath, 2, count($realPath))); goto feef7; c4361: $fileOwnerInformation = posix_getpwuid($fileInfo->getOwner()); goto Bf9ba; bf18c: if (!(false === $fileInfo->isDir())) { goto a4ce6; } goto aca5a; B0abd: $fileOwner = sprintf("\45\x73\x3a\x25\163", $fileOwnerInformation["\x6e\x61\155\145"] ?? '', $fileGroupInformation["\156\x61\x6d\x65"] ?? ''); goto d48e3; A2ec3: $filename = $fileInfo->getFilename(); goto A1954; bd783: } catch (\Exception $e) { } goto f97d3; F9890: } private function getFileType(\SplFileInfo $fileInfo) { goto Fc06f; daa91: $fileType = "\x66\x6f\154\144\145\162"; goto Ad417; b4c24: if (true === $fileInfo->isDir()) { goto F3a2f; } goto ea2f1; df64f: return $fileType; goto e3a9e; d0c8a: F3a2f: goto daa91; A0aaf: goto ee894; goto d0c8a; Ad417: ee894: goto df64f; C2f2e: foreach ($this->fileGroups as $type => $extensions) { goto a0fb8; Ea131: goto c63f9; goto fa194; cfc69: $fileType = $type; goto Ea131; a0fb8: if (!(true === in_array($fileExtension, $extensions))) { goto Efeaf; } goto cfc69; fa194: Efeaf: goto Cc98e; Cc98e: e673f: goto eeccf; eeccf: } goto A8c08; Fc06f: $fileType = "\x63\x6f\144\145"; goto b4c24; A8c08: c63f9: goto A0aaf; ea2f1: $fileExtension = $fileInfo->getExtension(); goto C2f2e; e3a9e: } public function permissions(string $file, string $permissions) : array { goto f1f43; d0ca6: $this->executeCommand($chownCommand, 600); goto F58ed; Eb035: $file = realpath($file); goto ebb9c; af6a1: $chownCommand->setGroup($this->user); goto D9c29; ebb9c: $homeDirectory = sprintf("\x2f\x68\x6f\155\x65\x2f\45\163\x2f", $this->user); goto ed5f5; F58ed: $this->executeCommand($chmodCommand, 600); goto e5d4d; D9c29: $chmodCommand = new FindChmodCommand(); goto bf0bb; dcd23: $chownCommand->setRecursive(true); goto e0146; F0cf5: $chmodCommand->setDirectoryChmod($permissions); goto F1e4a; C171a: d092b: goto D26a1; e0146: $chownCommand->setUser($this->user); goto af6a1; f1cac: $chownCommand = new ChownCommand(); goto A3916; d9a7e: $fileInfo = new \SplFileInfo($file); goto f1cac; e5d4d: $fileData = $this->getFileData($fileInfo); goto c3f18; ed5f5: if (!(true === str_starts_with($file, $homeDirectory) && true === file_exists($file))) { goto d092b; } goto d9a7e; c3f18: $data = ["\x69\156\x76\141\x6c\151\x64" => false, "\145\x72\x72\x6f\162" => '', "\x69\144" => $fileData["\x69\144"], "\160\145\x72\x6d\151\163\x73\151\157\x6e\163" => $permissions]; goto C171a; F1e4a: $chmodCommand->setFileChmod($permissions); goto d0ca6; D26a1: return $data; goto c0bed; f1f43: $data = []; goto Eb035; A3916: $chownCommand->setFile($file); goto dcd23; bf0bb: $chmodCommand->setFile($file); goto F0cf5; c0bed: } public function extract(string $file, string $destinationDirectoryName) : array { goto Ef03a; d7e37: return $data; goto B61d7; Ef03a: $data = []; goto b7bca; b7bca: try { goto Cea9c; aca2d: $copyFileCommand->setSourceFile($file); goto D09e4; d3a40: $bsdTarExtractCommand = new BsdTarExtractCommand(); goto e0435; eb491: $fileExtension = "\x74\141\x72\56\x67\172"; goto B247e; C2481: $copyFileCommand = new CopyFileCommand(); goto aca2d; e154e: $gzipFile = sprintf("\x25\x73\x2f\x25\163", rtrim($destinationDirectory, "\x2f"), $filename); goto cf479; C4fcd: $filename = $fileInfo->getFilename(); goto A4484; b1cb1: $path = array_filter(explode("\57", $fileInfo->getRealPath())); goto ce201; ae1cd: $data["\160\141\x74\x68"] = $path; goto E419c; e6564: $gunzipCommand = new GunzipCommand(); goto c4ab2; D4668: $fileExtension = $fileInfo->getExtension(); goto E4e10; a4b5f: $this->executeCommand($bsdTarExtractCommand, 3600); goto a1daf; c4ab2: $gunzipCommand->setFile($gzipFile); goto E7443; ce201: $path = array_slice($path, 2, count($path)); goto c17af; e0435: $bsdTarExtractCommand->setSourceFile($file); goto D176b; d0685: $fileInfo = new \SplFileInfo($file); goto C4fcd; A4484: if ("\164\141\162\x2e\147\172" == substr($filename, -6)) { goto bb80a; } goto D4668; F70b7: $this->resetPermissions($fileInfo, true); goto f97b1; Cea9c: if (!(true === file_exists($file))) { goto Bb912; } goto d0685; de303: $createDirectoryCommand->setDirectory($destinationDirectory); goto C2481; B247e: F04a8: goto c346a; Df82c: $fileInfo = new \SplFileInfo($destinationDirectory); goto F70b7; E419c: $destinationDirectory = sprintf("\45\x73\57\x25\x73", rtrim($filePathInfo->getPathName(), "\x2f"), rtrim($destinationDirectoryName, "\x2f")); goto E35f4; cf479: $createDirectoryCommand = new CreateDirectoryCommand(); goto de303; e2b95: $createDirectoryCommand = new CreateDirectoryCommand(); goto aff65; f704e: $path = sprintf("\57\45\163", implode("\57", $path)); goto ae1cd; d868a: if (!("\x67\172" == $fileExtension)) { goto a2cd5; } goto e154e; Bcf41: $this->executeCommand($gunzipCommand); goto c5e3a; F2a74: Bb912: goto f9dd8; E4e10: goto F04a8; goto A7055; a245b: $this->executeCommand($createDirectoryCommand); goto a4b5f; A7055: bb80a: goto eb491; a4c54: $this->executeCommand($copyFileCommand); goto Bcf41; a1daf: B3efa: goto cb5af; c5e3a: a2cd5: goto A9732; D09e4: $copyFileCommand->setDestinationFile($gzipFile); goto e6564; c346a: $filePathInfo = $fileInfo->getPathInfo(); goto b1cb1; aff65: $createDirectoryCommand->setDirectory($destinationDirectory); goto d3a40; D176b: $bsdTarExtractCommand->setDestinationFile($destinationDirectory); goto a245b; E35f4: if (true === in_array($fileExtension, ["\164\141\x72", "\164\147\x7a", "\x74\141\162\56\x67\x7a", "\162\141\x72", "\x7a\x69\160"])) { goto ddc25; } goto d868a; f97b1: c6d50: goto F2a74; cb5af: if (!(true === is_dir($destinationDirectory))) { goto c6d50; } goto Df82c; A9732: goto B3efa; goto C053c; c17af: array_pop($path); goto f704e; E7443: $this->executeCommand($createDirectoryCommand); goto a4c54; C053c: ddc25: goto e2b95; f9dd8: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["\x65\x72\162\x6f\x72"] = $errorMessage; } goto d7e37; B61d7: } public function compress(array $files, string $targetDirectory, string $id, string $homeDirectory) : array { goto f0144; b0080: try { goto d96c8; f475e: $data = ["\x70\x61\x74\x68" => $id]; goto f339d; d0135: $numberOfFiles = $this->countFilesToCompress($files); goto Bf77a; a0d86: throw new \Exception(sprintf("\x43\141\x6e\x6e\157\164\40\x63\162\145\141\164\145\x20\172\x69\x70\x20\146\151\154\145\x20\42\45\163\x22\x2e", $zipArchive)); goto Bb6b5; D8dc9: $fileInfo = new \SplFileInfo($zipArchive); goto be8bc; be8bc: $this->resetPermissions($fileInfo); goto f475e; Fb2a7: b66f5: goto f9993; f339d: af982: goto Da618; d1b00: Dc9c2: goto d0135; B24c4: throw new \Exception(sprintf("\x54\141\162\147\x65\x74\x20\144\151\x72\145\143\x74\x6f\x72\171\x20\x22\x25\x73\42\x20\x64\x6f\x65\x73\40\156\157\x74\x20\145\170\151\163\x74\56", $targetDirectory)); goto A8370; A8370: goto d4030; goto d1b00; Bb6b5: A5ccf: goto Ee1b6; b36d0: $zipArchive = sprintf("\x25\163\x2f\141\162\x63\150\151\166\145\56\x7a\151\x70", rtrim($targetDirectory, "\x2f")); goto E21ab; d16c7: throw new \Exception(sprintf("\x54\x6f\157\40\155\x61\156\x79\40\146\151\154\145\x73\54\x20\x6d\141\170\x69\x6d\x75\155\x20\157\146\x20\42\x25\163\x22\40\146\151\154\x65\x73\40\141\162\x65\x20\141\x6c\154\157\x77\145\144\56", self::MAX_FILES_TO_COMPRESS)); goto bb258; Ec04e: d4030: goto f417d; bb258: goto c88f6; goto e5c9b; d96c8: if (true === is_dir($targetDirectory) && false === empty($files)) { goto Dc9c2; } goto B24c4; Da618: c88f6: goto Ec04e; e5c9b: Cde92: goto b36d0; E21ab: $zip = new \ZipArchive(); goto a9ff9; a9ff9: if (!(true !== $zip->open($zipArchive, \ZipArchive::CREATE))) { goto A5ccf; } goto a0d86; f9993: $zip->close(); goto c72d3; Ee1b6: foreach ($files as $file) { goto d086f; edbb9: if (!(true === $fileInfo->isFile())) { goto e2e7e; } goto E4746; ee15f: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto c7067; b1597: fbaa1: goto D9bb6; F8e71: C40d2: goto F2632; E3aa4: if (!(false === str_starts_with($realpathFile, $homeDirectory))) { goto B449b; } goto e17bc; b39d7: $realpathFile = $fileInfo->getRealPath(); goto E3aa4; c7067: if (!(true === $fileInfo->isFile())) { goto fbaa1; } goto cdd6b; Da4fc: $entryName = sprintf("\45\163\57\x25\163", rtrim($directory, "\57"), $filename); goto D56c8; f791a: $zip->addEmptyDir($directory); goto Da4fc; e17bc: exit(sprintf("\116\157\164\40\141\x20\x76\x61\154\x69\x64\x20\x66\151\x6c\145\72\x20\x25\163", $realpathFile)); goto baf15; C52ee: array_pop($entryName); goto C5d2b; C5d2b: $directory = implode("\57", $entryName); goto f791a; cdd6b: $filename = $fileInfo->getFilename(); goto Adf8f; baf15: B449b: goto F8e71; F5d82: if (!(true === $fileInfo->isLink())) { goto C40d2; } goto b39d7; D56c8: $zip->addFile($filepath, $entryName); goto b1597; Adf8f: $filepath = $fileInfo->getPathname(); goto F5d82; Bf432: $entryName = array_filter(explode("\x2f", $entryName)); goto C52ee; D9bb6: b23da: goto a2779; F2632: $entryName = ltrim(str_replace($targetDirectory, '', $fileInfo->getPathname()), "\57"); goto Bf432; a2779: } goto d7cac; Bf073: $zip->addFile($filepath, $filename); goto De23a; abdea: b173e: goto Dc608; E4746: $filename = $fileInfo->getFilename(); goto efb05; De23a: e2e7e: goto bf32e; A15fb: $directory = $fileInfo->getPathname(); goto e2096; d086f: if (!(true === file_exists($file))) { goto b173e; } goto f1e1b; f1e1b: $fileInfo = new \SplFileInfo($file); goto edbb9; e2096: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto ee15f; Dc608: A5c4a: goto Eda0e; efb05: $filepath = $fileInfo->getPathname(); goto Bf073; d7cac: e1483: goto b1976; b1976: Beb24: goto abdea; bf32e: if (!(true === $fileInfo->isDir())) { goto Beb24; } goto A15fb; Eda0e: } goto Fb2a7; Bf77a: if ($numberOfFiles < self::MAX_FILES_TO_COMPRESS) { goto Cde92; } goto d16c7; c72d3: if (!(true === file_exists($zipArchive))) { goto af982; } goto D8dc9; f417d: } catch (\Exception $e) { $errorMessage = $e->getMessage(); $data["\x65\x72\162\x6f\162"] = $errorMessage; } goto ab1ab; ab1ab: return $data; goto C46c6; f0144: $data = []; goto b0080; C46c6: } private function countFilesToCompress(array $files) : int { goto e40cc; e40cc: $numberOfFiles = 0; goto C86c2; C86c2: foreach ($files as $file) { goto Dba88; B3da0: aa602: goto C2cbd; C2cbd: D32e3: goto Fc7e4; Cdf78: foreach (new \RecursiveIteratorIterator($directoryIterator) as $fileInfo) { goto f4005; C895a: A711f: goto c6394; c6394: Eaeba: goto dda07; f4005: if (!(true === $fileInfo->isFile())) { goto A711f; } goto E8084; E8084: ++$numberOfFiles; goto C895a; dda07: } goto C4de4; a5840: if (!(true === $fileInfo->isFile())) { goto Bc225; } goto B9c96; B1b88: if (!(true === $fileInfo->isDir())) { goto aa602; } goto A626f; d93ee: Bc225: goto B1b88; A626f: $directory = $fileInfo->getPathname(); goto Dcfa5; B9c96: ++$numberOfFiles; goto d93ee; C4de4: E15e5: goto B3da0; Dcfa5: $directoryIterator = new \RecursiveDirectoryIterator($directory); goto Cdf78; D0db2: $fileInfo = new \SplFileInfo($file); goto a5840; Fc7e4: ee7da: goto Cdfd8; Dba88: if (!(true === file_exists($file))) { goto D32e3; } goto D0db2; Cdfd8: } goto Bd33a; Bd33a: b6cfc: goto E86e2; E86e2: return $numberOfFiles; goto F4724; F4724: } private function resetPermissions(\SplFileInfo $fileInfo, $recursive = false) { goto b77ec; Aa5c0: goto a8f8f; goto b1c36; bdc2c: $this->executeCommand($chownCommand); goto E3780; a9249: $chmodCommand = new FindChmodCommand(); goto eb29d; B72b1: $chmodCommand->setFile($filename); goto c77b5; E26d0: $chmodCommand->setRunInBackground(true); goto B4cbe; b1c36: A04cb: goto a9249; d6200: $chmodCommand->setDirectoryChmod(770); goto a6a29; e2ee0: $chmodCommand = new ChmodCommand(); goto B72b1; bd24b: $chownCommand->setGroup($this->user); goto a5a58; de2eb: $chownCommand = new ChownCommand(); goto Be702; f9a48: $chownCommand->setUser($this->user); goto bd24b; c77b5: $chmodCommand->setChmod(770); goto Aa5c0; E3780: $this->executeCommand($chmodCommand); goto db9f4; eb29d: $chmodCommand->setFile($filename); goto d6200; a5a58: if (true === $fileInfo->isDir() && true === $recursive) { goto A04cb; } goto e2ee0; b77ec: $filename = $fileInfo->getPathname(); goto de2eb; a6a29: $chmodCommand->setFileChmod(770); goto E26d0; e90a0: $chownCommand->setRecursive($recursive); goto f9a48; Be702: $chownCommand->setFile($filename); goto e90a0; B4cbe: a8f8f: goto bdc2c; db9f4: } private function mapFileExtension(string $fileExtension) : string { goto b3948; bcb71: $mappedFileExtension = $this->fileExtensionMap[$fileExtension]; goto Aae05; fd38c: return $mappedFileExtension; goto d758d; cda37: if (!(true === isset($this->fileExtensionMap[$fileExtension]))) { goto A07c6; } goto bcb71; Aae05: A07c6: goto fd38c; b3948: $mappedFileExtension = "\x64\145\146\141\x75\x6c\164"; goto cda37; d758d: } private function executeCommand(Command $command, $timeout = 600) { $this->commandExecutor->execute($command, $timeout); } }

Function Calls

None

Variables

None

Stats

MD5 11ad87f0cdc3c251ffc06a432e5052aa
Eval Count 0
Decode Time 67 ms