]> _ Git - cubist_cms-back.git/commitdiff
wip #6108 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 21 Jul 2023 17:57:41 +0000 (19:57 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 21 Jul 2023 17:57:41 +0000 (19:57 +0200)
src/app/Http/Controllers/Base/XSendFileController.php
src/app/Http/Controllers/CubistStorageController.php
src/app/Magic/Fields/FormSeparator.php
src/resources/views/fields/form_section_description.blade.php
src/routes/cubist/backpack/storage.php

index 18d6b4ba720f8b3fca6448185f27edee9fab5da4..ac36032d3556395353a893e4d5f057f444e36967 100644 (file)
@@ -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);
     }
 }
index de05a17059ee41d712a16cddd48e9e0554524592..d35a109d5c45a8ad5b0557871a76f1da1008e09c 100644 (file)
@@ -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));
     }
 }
index 393ac06a1f2c8b4ecef05803b50feaa5cfc5619c..bf50735db9d3de05ee428104995204693d3bd480 100644 (file)
@@ -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));
+    }
 }
index b6343bd1e9ddfa9269f3f745f621b61c65acd589..a0f50895e0b8b92ff499fe1809f0f4bebb2a17da 100644 (file)
@@ -1 +1,3 @@
+@include('crud::fields.inc.wrapper_start')
 <p>{{$field['label']}}</p>
+@include('crud::fields.inc.wrapper_end')
index 275a950d886d0b6e5bf2824cee7b9fb3f48646c4..d94408cb4525cf17b4d82a4b3389d730a55b747b 100644 (file)
@@ -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' => '.*']);
 });