update 1.0.8.0
Commits for version update
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
<?php namespace Unisharp\Laravelfilemanager\controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Unisharp\Laravelfilemanager\controllers\Controller;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Str;
|
||||
use Lang;
|
||||
use Unisharp\Laravelfilemanager\Events\ImageWasRenamed;
|
||||
use Unisharp\Laravelfilemanager\Events\FolderWasRenamed;
|
||||
|
||||
/**
|
||||
* Class RenameController
|
||||
@@ -19,7 +22,7 @@ class RenameController extends LfmController {
|
||||
public function getRename()
|
||||
{
|
||||
$old_name = Input::get('file');
|
||||
$new_name = Input::get('new_name');
|
||||
$new_name = trim(Input::get('new_name'));
|
||||
|
||||
$file_path = parent::getPath('directory');
|
||||
$thumb_path = parent::getPath('thumb');
|
||||
@@ -33,12 +36,15 @@ class RenameController extends LfmController {
|
||||
|
||||
$new_file = $file_path . $new_name;
|
||||
|
||||
if (File::exists($new_file)) {
|
||||
if (Config::get('lfm.alphanumeric_directory') && preg_match('/[^\w-]/i', $new_name)) {
|
||||
return Lang::get('laravel-filemanager::lfm.error-folder-alnum');
|
||||
} elseif (File::exists($new_file)) {
|
||||
return Lang::get('laravel-filemanager::lfm.error-rename');
|
||||
}
|
||||
|
||||
if (File::isDirectory($old_file)) {
|
||||
File::move($old_file, $new_file);
|
||||
Event::fire(new FolderWasRenamed($old_file, $new_file));
|
||||
return 'OK';
|
||||
}
|
||||
|
||||
@@ -48,6 +54,8 @@ class RenameController extends LfmController {
|
||||
File::move($thumb_path . $old_name, $thumb_path . $new_name);
|
||||
}
|
||||
|
||||
Event::fire(new ImageWasRenamed($old_file, $new_file));
|
||||
|
||||
return 'OK';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user