@@ -58,23 +58,25 @@ public function show()
5858
5959
6060 private function setPathAndType ()
61- {
61+ {
62+ // dd('type:'.Input::get('type'));
63+
6264 if (Input::has ('type ' ) && Input::get ('type ' ) === 'Files ' ) {
6365 Session::put ('lfm_type ' , 'Files ' );
64- $ this -> file_location = Config::get ('lfm.files_dir ' );
65- $ this -> dir_location = Config::get ('lfm.files_url ' );
66- } else {
66+ Session:: put ( ' lfm. file_location' , Config::get ('lfm.files_dir ' ) );
67+ Session:: put ( ' lfm. dir_location' , Config::get ('lfm.files_url ' ) );
68+ } else if (Input:: has ( ' type ' ) && Input:: get ( ' type ' ) === ' Images ' ) {
6769 Session::put ('lfm_type ' , 'Images ' );
68- $ this -> file_location = Config::get ('lfm.images_dir ' );
69- $ this -> dir_location = Config::get ('lfm.images_url ' );
70+ Session:: put ( ' lfm. file_location' , Config::get ('lfm.images_dir ' ) );
71+ Session:: put ( ' lfm. dir_location' , Config::get ('lfm.images_url ' ) );
7072 }
7173 }
7274
7375
7476 private function checkMyFolderExists ()
7577 {
7678 if (\Config::get ('lfm.allow_multi_user ' ) === true ) {
77- $ path = base_path ( $ this ->file_location . Input:: get ( ' working_dir ' ) );
79+ $ path = $ this ->getPath ( );
7880
7981 if (!File::exists ($ path )) {
8082 File::makeDirectory ($ path , $ mode = 0777 , true , true );
@@ -85,7 +87,7 @@ private function checkMyFolderExists()
8587
8688 private function checkSharedFolderExists ()
8789 {
88- $ path = base_path ( $ this ->file_location . Config:: get ( ' lfm.shared_folder_name ' ) );
90+ $ path = $ this ->getPath ( ' share ' );
8991
9092 if (!File::exists ($ path )) {
9193 File::makeDirectory ($ path , $ mode = 0777 , true , true );
@@ -95,6 +97,10 @@ private function checkSharedFolderExists()
9597
9698 private function formatLocation ($ location , $ type = null )
9799 {
100+ if ($ type === 'share ' ) {
101+ return $ location . Config::get ('lfm.shared_folder_name ' ) . '/ ' ;
102+ }
103+
98104 $ working_dir = Input::get ('working_dir ' );
99105
100106 if ($ working_dir !== '/ ' ) {
@@ -116,7 +122,7 @@ private function formatLocation($location, $type = null)
116122
117123 public function getPath ($ type = null )
118124 {
119- $ path = base_path () . '/ ' . $ this -> file_location ;
125+ $ path = base_path () . '/ ' . Session:: get ( ' lfm. file_location' ) ;
120126
121127 $ path = $ this ->formatLocation ($ path , $ type );
122128
@@ -126,7 +132,7 @@ public function getPath($type = null)
126132
127133 public function getUrl ($ type = null )
128134 {
129- $ url = $ this -> dir_location ;
135+ $ url = Session:: get ( ' lfm. dir_location' ) ;
130136
131137 $ url = $ this ->formatLocation ($ url , $ type );
132138
@@ -137,7 +143,7 @@ public function getUrl($type = null)
137143 public function getDirectories ($ path )
138144 {
139145 $ thumb_folder_name = Config::get ('lfm.thumb_folder_name ' );
140- $ all_directories = File::directories (base_path ( $ path) );
146+ $ all_directories = File::directories ($ path );
141147
142148 $ arr_dir = [];
143149
0 commit comments