@@ -58,23 +58,25 @@ public function show()
58
58
59
59
60
60
private function setPathAndType ()
61
- {
61
+ {
62
+ // dd('type:'.Input::get('type'));
63
+
62
64
if (Input::has ('type ' ) && Input::get ('type ' ) === 'Files ' ) {
63
65
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 ' ) {
67
69
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 ' ) );
70
72
}
71
73
}
72
74
73
75
74
76
private function checkMyFolderExists ()
75
77
{
76
78
if (\Config::get ('lfm.allow_multi_user ' ) === true ) {
77
- $ path = base_path ( $ this ->file_location . Input:: get ( ' working_dir ' ) );
79
+ $ path = $ this ->getPath ( );
78
80
79
81
if (!File::exists ($ path )) {
80
82
File::makeDirectory ($ path , $ mode = 0777 , true , true );
@@ -85,7 +87,7 @@ private function checkMyFolderExists()
85
87
86
88
private function checkSharedFolderExists ()
87
89
{
88
- $ path = base_path ( $ this ->file_location . Config:: get ( ' lfm.shared_folder_name ' ) );
90
+ $ path = $ this ->getPath ( ' share ' );
89
91
90
92
if (!File::exists ($ path )) {
91
93
File::makeDirectory ($ path , $ mode = 0777 , true , true );
@@ -95,6 +97,10 @@ private function checkSharedFolderExists()
95
97
96
98
private function formatLocation ($ location , $ type = null )
97
99
{
100
+ if ($ type === 'share ' ) {
101
+ return $ location . Config::get ('lfm.shared_folder_name ' ) . '/ ' ;
102
+ }
103
+
98
104
$ working_dir = Input::get ('working_dir ' );
99
105
100
106
if ($ working_dir !== '/ ' ) {
@@ -116,7 +122,7 @@ private function formatLocation($location, $type = null)
116
122
117
123
public function getPath ($ type = null )
118
124
{
119
- $ path = base_path () . '/ ' . $ this -> file_location ;
125
+ $ path = base_path () . '/ ' . Session:: get ( ' lfm. file_location' ) ;
120
126
121
127
$ path = $ this ->formatLocation ($ path , $ type );
122
128
@@ -126,7 +132,7 @@ public function getPath($type = null)
126
132
127
133
public function getUrl ($ type = null )
128
134
{
129
- $ url = $ this -> dir_location ;
135
+ $ url = Session:: get ( ' lfm. dir_location' ) ;
130
136
131
137
$ url = $ this ->formatLocation ($ url , $ type );
132
138
@@ -137,7 +143,7 @@ public function getUrl($type = null)
137
143
public function getDirectories ($ path )
138
144
{
139
145
$ thumb_folder_name = Config::get ('lfm.thumb_folder_name ' );
140
- $ all_directories = File::directories (base_path ( $ path) );
146
+ $ all_directories = File::directories ($ path );
141
147
142
148
$ arr_dir = [];
143
149
0 commit comments