@@ -64,7 +64,7 @@ private function setDirPath()
6464 private function checkMyFolderExists ()
6565 {
6666 if (\Config::get ('lfm.allow_multi_user ' ) === true ) {
67- $ path = base_path ($ this ->file_location . Input::get ('base ' ));
67+ $ path = base_path ($ this ->file_location . Input::get ('working_dir ' ));
6868
6969 if (!File::exists ($ path )) {
7070 File::makeDirectory ($ path , $ mode = 0777 , true , true );
@@ -83,24 +83,47 @@ private function checkSharedFolderExists()
8383 }
8484
8585
86+ private function formatLocation ($ location , $ type = null )
87+ {
88+ $ working_dir = Input::get ('working_dir ' );
89+
90+ if ($ working_dir !== '/ ' ) {
91+ $ location .= $ working_dir . '/ ' ;
92+ }
93+
94+ if ($ type === 'thumb ' ) {
95+ $ location = $ location . Config::get ('lfm.thumb_folder_name ' ) . '/ ' ;
96+ }
97+
98+ return $ location ;
99+ }
100+
101+
86102 /****************************
87103 *** Shared Functions ***
88104 ****************************/
89105
90106
91- public function getPath ()
107+ public function getPath ($ type = null )
92108 {
93- $ working_dir = Input::get ('working_dir ' );
94109 $ path = base_path () . '/ ' . $ this ->file_location ;
95110
96- if (strlen ($ working_dir ) !== '/ ' ) {
97- $ path .= $ working_dir . '/ ' ;
98- }
111+ $ path = $ this ->formatLocation ($ path , $ type );
99112
100113 return $ path ;
101114 }
102115
103116
117+ public function getUrl ($ type = null )
118+ {
119+ $ url = $ this ->dir_location ;
120+
121+ $ url = $ this ->formatLocation ($ url , $ type );
122+
123+ return $ url ;
124+ }
125+
126+
104127 public function getDirectories ($ path )
105128 {
106129 $ thumb_folder_name = Config::get ('lfm.thumb_folder_name ' );
@@ -121,6 +144,16 @@ public function getDirectories($path)
121144 }
122145
123146
147+ public function getFileName ($ file )
148+ {
149+ $ path_parts = explode ('/ ' , $ file );
150+
151+ $ filename = end ($ path_parts );
152+
153+ return $ filename ;
154+ }
155+
156+
124157 /**
125158 * Show the filemanager
126159 *
@@ -134,16 +167,13 @@ public function show()
134167 Session::put ('lfm_type ' , 'Images ' );
135168 }
136169
137- if (Input::has ('base ' )) {
138- $ working_dir = Input::get ('base ' );
139- $ base = $ this ->file_location . Input::get ('base ' ) . "/ " ;
170+ if (Input::has ('working_dir ' )) {
171+ $ working_dir = Input::get ('working_dir ' );
140172 } else {
141- $ working_dir = "/ " ;
142- $ base = $ this ->file_location ;
173+ $ working_dir = '/ ' ;
143174 }
144175
145176 return View::make ('laravel-filemanager::index ' )
146- ->with ('base ' , $ base )
147177 ->with ('working_dir ' , $ working_dir );
148178 }
149179
0 commit comments