���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
repositories
/
portal-cutunix
/
modules
/
File
/
Services
/
Viewing: Uploader.php
<?php namespace Modules\File\Services; use App\Exceptions\FileExistsException; use Illuminate\Http\Request; use Modules\File\Models\File; class Uploader { private StorageManager $storageManager; private $file; private $fileClientOriginalName; private $filePath; private $fileExtension; private $fileClientMimeType; public function __construct(Request $request, StorageManager $storageManager) { $this->storageManager = $storageManager; $this->file = $request->file; } public function upload(string $disk, $extraFile = null, $filePath = null, $mimeType = null) { // if ($this->isFileExists()) throw new FileExistsException(); if (is_null($this->file)) { $this->file = $extraFile; $this->fileExtension = $extension = $this->getExtensionFromMimeType($mimeType); $this->filePath = $filePath; $this->fileClientOriginalName = time() . '.' . $extension; $this->fileClientMimeType = $mimeType; } $this->storageManager->setDisk($disk); $this->putFileIntoStorage(); return $this->saveFileIntoDatabase(); } public function putFileIntoStorage() { // $method = 'putFileAsPublic'; // $this->storageManager->$method($this->fileClientOriginalName, $this->file, $this->filePath); $this->storageManager->putFile($this->fileClientOriginalName, $this->file, $this->filePath); } private function getType() { if (is_string($this->file)) { return $this->fileClientMimeType; } if ($this->file?->getClientMimeType() !== null) { return [ File::MIMETYPE_IMAGE => File::TYPE_IMAGE, File::MIMETYPE_VIDEO => File::TYPE_VIDEO, File::MIMETYPE_APPLICATION_ZIP => File::TYPE_ARCHIVE, ][$this->file->getClientMimeType()]; } } public function getExtensionFromMimeType($mimeType) { if (strpos($mimeType, File::MIMETYPE_AUDIO_WEBM) !== false) { return 'webm'; } elseif (strpos($mimeType, File::MIMETYPE_AUDIO_OGG) !== false) { return 'ogg'; } elseif (strpos($mimeType, File::MIMETYPE_AUDIO_WAV) !== false) { return 'wav'; } return 'webm'; // default } public function saveFileIntoDatabase() { $file = File::create([ 'name' => $this->fileClientOriginalName, 'type' => $this->getType(), 'size' => $this->getSize(), 'address' => $this->filePath, 'is_private' => $this->isPrivate(), 'host' => config("filesystems.disks.{$this->storageManager?->disk}.download_host"), 'path_prefix' => trim(config("filesystems.disks.{$this->storageManager?->disk}.root"), '/') ]); return $file; } private function isPrivate() { return false; } private function getSize() { } private function getTime(File $file) { if (!$file->isMedia()) return null; } private function isFileExists() { return $this->storageManager->isFileExists( $this->fileClientOriginalName, $this->getType(), $this->isPrivate() ); } public function getFileName() { return $this->fileClientOriginalName; } public function getFileType() { return $this->fileClientMimeType; } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa