File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Backpack \FileManager ;
4+
5+ use Illuminate \Support \Facades \Crypt ;
6+ use Illuminate \Support \Facades \Log ;
7+
8+ class BackpackElfinderController extends \Barryvdh \Elfinder \ElfinderController
9+ {
10+ public function showPopup ($ input_id )
11+ {
12+ $ mimes = request ('mimes ' );
13+
14+ if (! isset ($ mimes )) {
15+ Log::error ('Someone attempted to tamper with mime types in elfinder popup. The attempt was blocked. ' );
16+ abort (403 , 'Unauthorized action. ' );
17+ }
18+
19+ try {
20+ $ mimes = Crypt::decrypt (urldecode (request ('mimes ' )));
21+ } catch (\Illuminate \Contracts \Encryption \DecryptException $ e ) {
22+ Log::error ('Someone attempted to tamper with mime types in elfinder popup. The attempt was blocked. ' );
23+ abort (403 , 'Unauthorized action. ' );
24+ }
25+
26+ request ()->merge (['mimes ' => urlencode (serialize ($ mimes ))]);
27+ if (! empty ($ mimes )) {
28+ request ()->merge (['mimes ' => urlencode (serialize ($ mimes ))]);
29+ } else {
30+ request ()->merge (['mimes ' => '' ]);
31+ }
32+
33+ return $ this ->app ['view ' ]
34+ ->make ($ this ->package .'::standalonepopup ' )
35+ ->with ($ this ->getViewVars ())
36+ ->with (compact ('input_id ' ));
37+ }
38+ }
Original file line number Diff line number Diff line change 44
55use Illuminate \Support \Facades \Config ;
66use Illuminate \Support \ServiceProvider ;
7+ use Barryvdh \Elfinder \ElfinderController ;
78
89class FileManagerServiceProvider extends ServiceProvider
910{
@@ -27,6 +28,11 @@ public function boot()
2728 }
2829 }
2930
31+ public function register ()
32+ {
33+ $ this ->app ->bind (ElfinderController::class, BackpackElfinderController::class);
34+ }
35+
3036 /**
3137 * Console-specific booting.
3238 *
You can’t perform that action at this time.
0 commit comments