@@ -36,6 +36,11 @@ public function __construct()
36
36
}
37
37
38
38
39
+ /*****************************
40
+ *** Private Functions ***
41
+ *****************************/
42
+
43
+
39
44
private function setFilePath ()
40
45
{
41
46
if ((Session::has ('lfm_type ' )) && (Session::get ('lfm_type ' ) == 'Files ' )) {
@@ -59,7 +64,7 @@ private function setDirPath()
59
64
private function checkMyFolderExists ()
60
65
{
61
66
if (\Config::get ('lfm.allow_multi_user ' ) === true ) {
62
- $ path = base_path ($ this ->file_location . Input::get ('base ' ));
67
+ $ path = base_path ($ this ->file_location . Input::get ('working_dir ' ));
63
68
64
69
if (!File::exists ($ path )) {
65
70
File::makeDirectory ($ path , $ mode = 0777 , true , true );
@@ -78,6 +83,47 @@ private function checkSharedFolderExists()
78
83
}
79
84
80
85
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
+
102
+ /****************************
103
+ *** Shared Functions ***
104
+ ****************************/
105
+
106
+
107
+ public function getPath ($ type = null )
108
+ {
109
+ $ path = base_path () . '/ ' . $ this ->file_location ;
110
+
111
+ $ path = $ this ->formatLocation ($ path , $ type );
112
+
113
+ return $ path ;
114
+ }
115
+
116
+
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
+
81
127
public function getDirectories ($ path )
82
128
{
83
129
$ thumb_folder_name = Config::get ('lfm.thumb_folder_name ' );
@@ -86,8 +132,7 @@ public function getDirectories($path)
86
132
$ arr_dir = [];
87
133
88
134
foreach ($ all_directories as $ directory ) {
89
- $ path_parts = explode ('/ ' , $ directory );
90
- $ dir_name = end ($ path_parts );
135
+ $ dir_name = $ this ->getFileName ($ directory );
91
136
92
137
if ($ dir_name !== $ thumb_folder_name ) {
93
138
$ arr_dir [] = $ dir_name ;
@@ -98,6 +143,16 @@ public function getDirectories($path)
98
143
}
99
144
100
145
146
+ public function getFileName ($ file )
147
+ {
148
+ $ path_parts = explode ('/ ' , $ file );
149
+
150
+ $ filename = end ($ path_parts );
151
+
152
+ return $ filename ;
153
+ }
154
+
155
+
101
156
/**
102
157
* Show the filemanager
103
158
*
@@ -111,16 +166,13 @@ public function show()
111
166
Session::put ('lfm_type ' , 'Images ' );
112
167
}
113
168
114
- if (Input::has ('base ' )) {
115
- $ working_dir = Input::get ('base ' );
116
- $ base = $ this ->file_location . Input::get ('base ' ) . "/ " ;
169
+ if (Input::has ('working_dir ' )) {
170
+ $ working_dir = Input::get ('working_dir ' );
117
171
} else {
118
- $ working_dir = "/ " ;
119
- $ base = $ this ->file_location ;
172
+ $ working_dir = '/ ' ;
120
173
}
121
174
122
175
return View::make ('laravel-filemanager::index ' )
123
- ->with ('base ' , $ base )
124
176
->with ('working_dir ' , $ working_dir );
125
177
}
126
178
0 commit comments