Skip to content

Commit 9bfe0c0

Browse files
committed
modify lfm controller
1 parent fdb3ed5 commit 9bfe0c0

File tree

1 file changed

+25
-40
lines changed

1 file changed

+25
-40
lines changed

src/controllers/LfmController.php

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,47 @@ class LfmController extends Controller {
2626
*/
2727
public function __construct()
2828
{
29-
$this->setFilePath();
30-
31-
$this->setDirPath();
29+
$this->setPathAndType();
3230

3331
$this->checkMyFolderExists();
3432

3533
$this->checkSharedFolderExists();
3634
}
3735

3836

37+
/**
38+
* Show the filemanager
39+
*
40+
* @return mixed
41+
*/
42+
public function show()
43+
{
44+
if (Input::has('working_dir')) {
45+
$working_dir = Input::get('working_dir');
46+
} else {
47+
$working_dir = '/';
48+
}
49+
50+
return View::make('laravel-filemanager::index')
51+
->with('working_dir', $working_dir);
52+
}
53+
54+
3955
/*****************************
4056
*** Private Functions ***
4157
*****************************/
4258

4359

44-
private function setFilePath()
45-
{
46-
if ((Session::has('lfm_type')) && (Session::get('lfm_type') == 'Files')) {
60+
private function setPathAndType()
61+
{
62+
if (Input::has('type') && Input::get('type') === 'Files') {
63+
Session::put('lfm_type', 'Files');
4764
$this->file_location = Config::get('lfm.files_dir');
65+
$this->dir_location = Config::get('lfm.files_url');
4866
} else {
67+
Session::put('lfm_type', 'Images');
4968
$this->file_location = Config::get('lfm.images_dir');
50-
}
51-
}
52-
53-
54-
private function setDirPath()
55-
{
56-
if ((Session::has('lfm_type')) && (Session::get('lfm_type') == "Images")) {
5769
$this->dir_location = Config::get('lfm.images_url');
58-
} else {
59-
$this->dir_location = Config::get('lfm.files_url');
6070
}
6171
}
6272

@@ -151,29 +161,4 @@ public function getFileName($file)
151161

152162
return $filename;
153163
}
154-
155-
156-
/**
157-
* Show the filemanager
158-
*
159-
* @return mixed
160-
*/
161-
public function show()
162-
{
163-
if ((Input::has('type')) && (Input::get('type') == "Files")) {
164-
Session::put('lfm_type', 'Files');
165-
} else {
166-
Session::put('lfm_type', 'Images');
167-
}
168-
169-
if (Input::has('working_dir')) {
170-
$working_dir = Input::get('working_dir');
171-
} else {
172-
$working_dir = '/';
173-
}
174-
175-
return View::make('laravel-filemanager::index')
176-
->with('working_dir', $working_dir);
177-
}
178-
179164
}

0 commit comments

Comments
 (0)