From: Vincent Vanwaelscappel Date: Fri, 21 Jul 2023 17:57:41 +0000 (+0200) Subject: wip #6108 @0.75 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c4817377e423fb9ce5efd5d0727dcf38d92f20b8;p=cubist_cms-back.git wip #6108 @0.75 --- diff --git a/src/app/Http/Controllers/Base/XSendFileController.php b/src/app/Http/Controllers/Base/XSendFileController.php index 18d6b4b..ac36032 100644 --- a/src/app/Http/Controllers/Base/XSendFileController.php +++ b/src/app/Http/Controllers/Base/XSendFileController.php @@ -17,7 +17,7 @@ class XSendFileController extends Controller $response = response(null); $request = request(); if (!file_exists($path)) { - return $response->setStatusCode(404); + abort(404,'File not found'); } $mtime = filemtime($path); $fsize = filesize($path); @@ -35,7 +35,8 @@ class XSendFileController extends Controller return $response->header('X-Sendfile', $path); } - public static function sendfileNoCache($path){ - return self::sendfile($path,0); + public static function sendfileNoCache($path) + { + return self::sendfile($path, 0); } } diff --git a/src/app/Http/Controllers/CubistStorageController.php b/src/app/Http/Controllers/CubistStorageController.php index de05a17..d35a109 100644 --- a/src/app/Http/Controllers/CubistStorageController.php +++ b/src/app/Http/Controllers/CubistStorageController.php @@ -10,11 +10,11 @@ class CubistStorageController extends XSendFileController public function storage($file) { if (!Auth::check()) { - return response(null)->setStatusCode('401'); + return abort(401); } if (!can('edition')) { - return response(null)->setStatusCode('403'); + return abort(403); } - return $this->xSendFile(storage_path('app/public/' . $file)); + XSendFileController::sendfile(storage_path('app/public/' . $file)); } } diff --git a/src/app/Magic/Fields/FormSeparator.php b/src/app/Magic/Fields/FormSeparator.php index 393ac06..bf50735 100644 --- a/src/app/Magic/Fields/FormSeparator.php +++ b/src/app/Magic/Fields/FormSeparator.php @@ -10,4 +10,10 @@ class FormSeparator extends UnstoredField { protected $_adminType = 'form_separator'; protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields'; + + protected function _postSetAttributes() + { + parent::_postSetAttributes(); + $this->setAttribute('name', 'sep_' . rand(100000, 10000000)); + } } diff --git a/src/resources/views/fields/form_section_description.blade.php b/src/resources/views/fields/form_section_description.blade.php index b6343bd..a0f5089 100644 --- a/src/resources/views/fields/form_section_description.blade.php +++ b/src/resources/views/fields/form_section_description.blade.php @@ -1 +1,3 @@ +@include('crud::fields.inc.wrapper_start')

{{$field['label']}}

+@include('crud::fields.inc.wrapper_end') diff --git a/src/routes/cubist/backpack/storage.php b/src/routes/cubist/backpack/storage.php index 275a950..d94408c 100644 --- a/src/routes/cubist/backpack/storage.php +++ b/src/routes/cubist/backpack/storage.php @@ -4,5 +4,5 @@ Route::group([ //'prefix' => config('backpack.base.route_prefix', 'admin'), 'middleware' => ['web', config('backpack.base.middleware_key', 'admin')], ], function () { // custom admin routes - Route::any('storage/{file?}', '\Cubist\Backpack\Http\Controllers\CubistStorageController@storage')->where(['file' => '.*']); + Route::any('storage/{file?}', config('cubist.storage_controller', \Cubist\Backpack\Http\Controllers\CubistStorageController::class) . '@storage')->where(['file' => '.*']); });