@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * make preview_icon available as a simple function |
185 | 185 | * Returns the path to the preview of the image. |
186 | 186 | * @param string $path path of file |
187 | - * @return link to the preview |
|
187 | + * @return string to the preview |
|
188 | 188 | * |
189 | 189 | * For further information have a look at OC_Helper::previewIcon |
190 | 190 | */ |
@@ -194,6 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | /** |
196 | 196 | * @param string $path |
197 | + * @param string $token |
|
197 | 198 | */ |
198 | 199 | function publicPreview_icon ( $path, $token ) { |
199 | 200 | return OC_Helper::publicPreviewIcon( $path, $token ); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param string $string the string which will be escaped and printed |
36 | 36 | */ |
37 | 37 | function p($string) { |
38 | - print(\OCP\Util::sanitizeHTML($string)); |
|
38 | + print(\OCP\Util::sanitizeHTML($string)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string|array $string the string which will be printed as it is |
45 | 45 | */ |
46 | 46 | function print_unescaped($string) { |
47 | - print($string); |
|
47 | + print($string); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | * if an array is given it will add all scripts |
55 | 55 | */ |
56 | 56 | function script($app, $file = null) { |
57 | - if(is_array($file)) { |
|
58 | - foreach($file as $f) { |
|
59 | - OC_Util::addScript($app, $f); |
|
60 | - } |
|
61 | - } else { |
|
62 | - OC_Util::addScript($app, $file); |
|
63 | - } |
|
57 | + if(is_array($file)) { |
|
58 | + foreach($file as $f) { |
|
59 | + OC_Util::addScript($app, $f); |
|
60 | + } |
|
61 | + } else { |
|
62 | + OC_Util::addScript($app, $file); |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | * if an array is given it will add all scripts |
71 | 71 | */ |
72 | 72 | function vendor_script($app, $file = null) { |
73 | - if(is_array($file)) { |
|
74 | - foreach($file as $f) { |
|
75 | - OC_Util::addVendorScript($app, $f); |
|
76 | - } |
|
77 | - } else { |
|
78 | - OC_Util::addVendorScript($app, $file); |
|
79 | - } |
|
73 | + if(is_array($file)) { |
|
74 | + foreach($file as $f) { |
|
75 | + OC_Util::addVendorScript($app, $f); |
|
76 | + } |
|
77 | + } else { |
|
78 | + OC_Util::addVendorScript($app, $file); |
|
79 | + } |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | * if an array is given it will add all styles |
87 | 87 | */ |
88 | 88 | function style($app, $file = null) { |
89 | - if(is_array($file)) { |
|
90 | - foreach($file as $f) { |
|
91 | - OC_Util::addStyle($app, $f); |
|
92 | - } |
|
93 | - } else { |
|
94 | - OC_Util::addStyle($app, $file); |
|
95 | - } |
|
89 | + if(is_array($file)) { |
|
90 | + foreach($file as $f) { |
|
91 | + OC_Util::addStyle($app, $f); |
|
92 | + } |
|
93 | + } else { |
|
94 | + OC_Util::addStyle($app, $file); |
|
95 | + } |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | * if an array is given it will add all styles |
103 | 103 | */ |
104 | 104 | function vendor_style($app, $file = null) { |
105 | - if(is_array($file)) { |
|
106 | - foreach($file as $f) { |
|
107 | - OC_Util::addVendorStyle($app, $f); |
|
108 | - } |
|
109 | - } else { |
|
110 | - OC_Util::addVendorStyle($app, $file); |
|
111 | - } |
|
105 | + if(is_array($file)) { |
|
106 | + foreach($file as $f) { |
|
107 | + OC_Util::addVendorStyle($app, $f); |
|
108 | + } |
|
109 | + } else { |
|
110 | + OC_Util::addVendorStyle($app, $file); |
|
111 | + } |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * if an array is given it will add all styles |
118 | 118 | */ |
119 | 119 | function translation($app) { |
120 | - OC_Util::addTranslations($app); |
|
120 | + OC_Util::addTranslations($app); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | * if an array is given it will add all components |
128 | 128 | */ |
129 | 129 | function component($app, $file) { |
130 | - if(is_array($file)) { |
|
131 | - foreach($file as $f) { |
|
132 | - $url = link_to($app, 'component/' . $f . '.html'); |
|
133 | - OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
|
134 | - } |
|
135 | - } else { |
|
136 | - $url = link_to($app, 'component/' . $file . '.html'); |
|
137 | - OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
|
138 | - } |
|
130 | + if(is_array($file)) { |
|
131 | + foreach($file as $f) { |
|
132 | + $url = link_to($app, 'component/' . $f . '.html'); |
|
133 | + OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
|
134 | + } |
|
135 | + } else { |
|
136 | + $url = link_to($app, 'component/' . $file . '.html'); |
|
137 | + OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
|
138 | + } |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * For further information have a look at \OCP\IURLGenerator::linkTo |
149 | 149 | */ |
150 | 150 | function link_to( $app, $file, $args = array() ) { |
151 | - return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); |
|
151 | + return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @return string url to the online documentation |
157 | 157 | */ |
158 | 158 | function link_to_docs($key) { |
159 | - return \OC::$server->getURLGenerator()->linkToDocs($key); |
|
159 | + return \OC::$server->getURLGenerator()->linkToDocs($key); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * For further information have a look at \OCP\IURLGenerator::imagePath |
169 | 169 | */ |
170 | 170 | function image_path( $app, $image ) { |
171 | - return \OC::$server->getURLGenerator()->imagePath( $app, $image ); |
|
171 | + return \OC::$server->getURLGenerator()->imagePath( $app, $image ); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @return string link to the image |
178 | 178 | */ |
179 | 179 | function mimetype_icon( $mimetype ) { |
180 | - return \OC::$server->getMimeTypeDetector()->mimeTypeIcon( $mimetype ); |
|
180 | + return \OC::$server->getMimeTypeDetector()->mimeTypeIcon( $mimetype ); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | * For further information have a look at OC_Helper::previewIcon |
190 | 190 | */ |
191 | 191 | function preview_icon( $path ) { |
192 | - return OC_Helper::previewIcon( $path ); |
|
192 | + return OC_Helper::previewIcon( $path ); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
196 | 196 | * @param string $path |
197 | 197 | */ |
198 | 198 | function publicPreview_icon ( $path, $token ) { |
199 | - return OC_Helper::publicPreviewIcon( $path, $token ); |
|
199 | + return OC_Helper::publicPreviewIcon( $path, $token ); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * For further information have a look at OC_Helper::humanFileSize |
208 | 208 | */ |
209 | 209 | function human_file_size( $bytes ) { |
210 | - return OC_Helper::humanFileSize( $bytes ); |
|
210 | + return OC_Helper::humanFileSize( $bytes ); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | * @return $timestamp without time value |
217 | 217 | */ |
218 | 218 | function strip_time($timestamp){ |
219 | - $date = new \DateTime("@{$timestamp}"); |
|
220 | - $date->setTime(0, 0, 0); |
|
221 | - return intval($date->format('U')); |
|
219 | + $date = new \DateTime("@{$timestamp}"); |
|
220 | + $date->setTime(0, 0, 0); |
|
221 | + return intval($date->format('U')); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /** |
@@ -230,39 +230,39 @@ discard block |
||
230 | 230 | * @return string timestamp |
231 | 231 | */ |
232 | 232 | function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false) { |
233 | - /** @var \OC\DateTimeFormatter $formatter */ |
|
234 | - $formatter = \OC::$server->query('DateTimeFormatter'); |
|
233 | + /** @var \OC\DateTimeFormatter $formatter */ |
|
234 | + $formatter = \OC::$server->query('DateTimeFormatter'); |
|
235 | 235 | |
236 | - if ($dateOnly){ |
|
237 | - return $formatter->formatDateSpan($timestamp, $fromTime); |
|
238 | - } |
|
239 | - return $formatter->formatTimeSpan($timestamp, $fromTime); |
|
236 | + if ($dateOnly){ |
|
237 | + return $formatter->formatDateSpan($timestamp, $fromTime); |
|
238 | + } |
|
239 | + return $formatter->formatTimeSpan($timestamp, $fromTime); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | function html_select_options($options, $selected, $params=array()) { |
243 | - if (!is_array($selected)) { |
|
244 | - $selected=array($selected); |
|
245 | - } |
|
246 | - if (isset($params['combine']) && $params['combine']) { |
|
247 | - $options = array_combine($options, $options); |
|
248 | - } |
|
249 | - $value_name = $label_name = false; |
|
250 | - if (isset($params['value'])) { |
|
251 | - $value_name = $params['value']; |
|
252 | - } |
|
253 | - if (isset($params['label'])) { |
|
254 | - $label_name = $params['label']; |
|
255 | - } |
|
256 | - $html = ''; |
|
257 | - foreach($options as $value => $label) { |
|
258 | - if ($value_name && is_array($label)) { |
|
259 | - $value = $label[$value_name]; |
|
260 | - } |
|
261 | - if ($label_name && is_array($label)) { |
|
262 | - $label = $label[$label_name]; |
|
263 | - } |
|
264 | - $select = in_array($value, $selected) ? ' selected="selected"' : ''; |
|
265 | - $html .= '<option value="' . \OCP\Util::sanitizeHTML($value) . '"' . $select . '>' . \OCP\Util::sanitizeHTML($label) . '</option>'."\n"; |
|
266 | - } |
|
267 | - return $html; |
|
243 | + if (!is_array($selected)) { |
|
244 | + $selected=array($selected); |
|
245 | + } |
|
246 | + if (isset($params['combine']) && $params['combine']) { |
|
247 | + $options = array_combine($options, $options); |
|
248 | + } |
|
249 | + $value_name = $label_name = false; |
|
250 | + if (isset($params['value'])) { |
|
251 | + $value_name = $params['value']; |
|
252 | + } |
|
253 | + if (isset($params['label'])) { |
|
254 | + $label_name = $params['label']; |
|
255 | + } |
|
256 | + $html = ''; |
|
257 | + foreach($options as $value => $label) { |
|
258 | + if ($value_name && is_array($label)) { |
|
259 | + $value = $label[$value_name]; |
|
260 | + } |
|
261 | + if ($label_name && is_array($label)) { |
|
262 | + $label = $label[$label_name]; |
|
263 | + } |
|
264 | + $select = in_array($value, $selected) ? ' selected="selected"' : ''; |
|
265 | + $html .= '<option value="' . \OCP\Util::sanitizeHTML($value) . '"' . $select . '>' . \OCP\Util::sanitizeHTML($label) . '</option>'."\n"; |
|
266 | + } |
|
267 | + return $html; |
|
268 | 268 | } |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * if an array is given it will add all scripts |
55 | 55 | */ |
56 | 56 | function script($app, $file = null) { |
57 | - if(is_array($file)) { |
|
58 | - foreach($file as $f) { |
|
57 | + if (is_array($file)) { |
|
58 | + foreach ($file as $f) { |
|
59 | 59 | OC_Util::addScript($app, $f); |
60 | 60 | } |
61 | 61 | } else { |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * if an array is given it will add all scripts |
71 | 71 | */ |
72 | 72 | function vendor_script($app, $file = null) { |
73 | - if(is_array($file)) { |
|
74 | - foreach($file as $f) { |
|
73 | + if (is_array($file)) { |
|
74 | + foreach ($file as $f) { |
|
75 | 75 | OC_Util::addVendorScript($app, $f); |
76 | 76 | } |
77 | 77 | } else { |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * if an array is given it will add all styles |
87 | 87 | */ |
88 | 88 | function style($app, $file = null) { |
89 | - if(is_array($file)) { |
|
90 | - foreach($file as $f) { |
|
89 | + if (is_array($file)) { |
|
90 | + foreach ($file as $f) { |
|
91 | 91 | OC_Util::addStyle($app, $f); |
92 | 92 | } |
93 | 93 | } else { |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * if an array is given it will add all styles |
103 | 103 | */ |
104 | 104 | function vendor_style($app, $file = null) { |
105 | - if(is_array($file)) { |
|
106 | - foreach($file as $f) { |
|
105 | + if (is_array($file)) { |
|
106 | + foreach ($file as $f) { |
|
107 | 107 | OC_Util::addVendorStyle($app, $f); |
108 | 108 | } |
109 | 109 | } else { |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | * if an array is given it will add all components |
128 | 128 | */ |
129 | 129 | function component($app, $file) { |
130 | - if(is_array($file)) { |
|
131 | - foreach($file as $f) { |
|
132 | - $url = link_to($app, 'component/' . $f . '.html'); |
|
130 | + if (is_array($file)) { |
|
131 | + foreach ($file as $f) { |
|
132 | + $url = link_to($app, 'component/'.$f.'.html'); |
|
133 | 133 | OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
134 | 134 | } |
135 | 135 | } else { |
136 | - $url = link_to($app, 'component/' . $file . '.html'); |
|
136 | + $url = link_to($app, 'component/'.$file.'.html'); |
|
137 | 137 | OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
138 | 138 | } |
139 | 139 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * |
148 | 148 | * For further information have a look at \OCP\IURLGenerator::linkTo |
149 | 149 | */ |
150 | -function link_to( $app, $file, $args = array() ) { |
|
150 | +function link_to($app, $file, $args = array()) { |
|
151 | 151 | return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); |
152 | 152 | } |
153 | 153 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * |
168 | 168 | * For further information have a look at \OCP\IURLGenerator::imagePath |
169 | 169 | */ |
170 | -function image_path( $app, $image ) { |
|
171 | - return \OC::$server->getURLGenerator()->imagePath( $app, $image ); |
|
170 | +function image_path($app, $image) { |
|
171 | + return \OC::$server->getURLGenerator()->imagePath($app, $image); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | * @param string $mimetype mimetype |
177 | 177 | * @return string link to the image |
178 | 178 | */ |
179 | -function mimetype_icon( $mimetype ) { |
|
180 | - return \OC::$server->getMimeTypeDetector()->mimeTypeIcon( $mimetype ); |
|
179 | +function mimetype_icon($mimetype) { |
|
180 | + return \OC::$server->getMimeTypeDetector()->mimeTypeIcon($mimetype); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | * |
189 | 189 | * For further information have a look at OC_Helper::previewIcon |
190 | 190 | */ |
191 | -function preview_icon( $path ) { |
|
192 | - return OC_Helper::previewIcon( $path ); |
|
191 | +function preview_icon($path) { |
|
192 | + return OC_Helper::previewIcon($path); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
196 | 196 | * @param string $path |
197 | 197 | */ |
198 | -function publicPreview_icon ( $path, $token ) { |
|
199 | - return OC_Helper::publicPreviewIcon( $path, $token ); |
|
198 | +function publicPreview_icon($path, $token) { |
|
199 | + return OC_Helper::publicPreviewIcon($path, $token); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | * |
207 | 207 | * For further information have a look at OC_Helper::humanFileSize |
208 | 208 | */ |
209 | -function human_file_size( $bytes ) { |
|
210 | - return OC_Helper::humanFileSize( $bytes ); |
|
209 | +function human_file_size($bytes) { |
|
210 | + return OC_Helper::humanFileSize($bytes); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @param int $timestamp UNIX timestamp to strip |
216 | 216 | * @return $timestamp without time value |
217 | 217 | */ |
218 | -function strip_time($timestamp){ |
|
218 | +function strip_time($timestamp) { |
|
219 | 219 | $date = new \DateTime("@{$timestamp}"); |
220 | 220 | $date->setTime(0, 0, 0); |
221 | 221 | return intval($date->format('U')); |
@@ -233,15 +233,15 @@ discard block |
||
233 | 233 | /** @var \OC\DateTimeFormatter $formatter */ |
234 | 234 | $formatter = \OC::$server->query('DateTimeFormatter'); |
235 | 235 | |
236 | - if ($dateOnly){ |
|
236 | + if ($dateOnly) { |
|
237 | 237 | return $formatter->formatDateSpan($timestamp, $fromTime); |
238 | 238 | } |
239 | 239 | return $formatter->formatTimeSpan($timestamp, $fromTime); |
240 | 240 | } |
241 | 241 | |
242 | -function html_select_options($options, $selected, $params=array()) { |
|
242 | +function html_select_options($options, $selected, $params = array()) { |
|
243 | 243 | if (!is_array($selected)) { |
244 | - $selected=array($selected); |
|
244 | + $selected = array($selected); |
|
245 | 245 | } |
246 | 246 | if (isset($params['combine']) && $params['combine']) { |
247 | 247 | $options = array_combine($options, $options); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $label_name = $params['label']; |
255 | 255 | } |
256 | 256 | $html = ''; |
257 | - foreach($options as $value => $label) { |
|
257 | + foreach ($options as $value => $label) { |
|
258 | 258 | if ($value_name && is_array($label)) { |
259 | 259 | $value = $label[$value_name]; |
260 | 260 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $label = $label[$label_name]; |
263 | 263 | } |
264 | 264 | $select = in_array($value, $selected) ? ' selected="selected"' : ''; |
265 | - $html .= '<option value="' . \OCP\Util::sanitizeHTML($value) . '"' . $select . '>' . \OCP\Util::sanitizeHTML($label) . '</option>'."\n"; |
|
265 | + $html .= '<option value="'.\OCP\Util::sanitizeHTML($value).'"'.$select.'>'.\OCP\Util::sanitizeHTML($label).'</option>'."\n"; |
|
266 | 266 | } |
267 | 267 | return $html; |
268 | 268 | } |
@@ -30,7 +30,6 @@ |
||
30 | 30 | * StorageAuthException constructor. |
31 | 31 | * |
32 | 32 | * @param string $message |
33 | - * @param int $code |
|
34 | 33 | * @param \Exception $previous |
35 | 34 | * @since 9.0.0 |
36 | 35 | */ |
@@ -27,16 +27,16 @@ |
||
27 | 27 | */ |
28 | 28 | class StorageAuthException extends StorageNotAvailableException { |
29 | 29 | |
30 | - /** |
|
31 | - * StorageAuthException constructor. |
|
32 | - * |
|
33 | - * @param string $message |
|
34 | - * @param int $code |
|
35 | - * @param \Exception $previous |
|
36 | - * @since 9.0.0 |
|
37 | - */ |
|
38 | - public function __construct($message = '', \Exception $previous = null) { |
|
39 | - $l = \OC::$server->getL10N('core'); |
|
40 | - parent::__construct($l->t('Storage unauthorized. %s', $message), self::STATUS_UNAUTHORIZED, $previous); |
|
41 | - } |
|
30 | + /** |
|
31 | + * StorageAuthException constructor. |
|
32 | + * |
|
33 | + * @param string $message |
|
34 | + * @param int $code |
|
35 | + * @param \Exception $previous |
|
36 | + * @since 9.0.0 |
|
37 | + */ |
|
38 | + public function __construct($message = '', \Exception $previous = null) { |
|
39 | + $l = \OC::$server->getL10N('core'); |
|
40 | + parent::__construct($l->t('Storage unauthorized. %s', $message), self::STATUS_UNAUTHORIZED, $previous); |
|
41 | + } |
|
42 | 42 | } |
@@ -30,7 +30,6 @@ |
||
30 | 30 | * ExtStorageBadConfigException constructor. |
31 | 31 | * |
32 | 32 | * @param string $message |
33 | - * @param int $code |
|
34 | 33 | * @param \Exception $previous |
35 | 34 | * @since 9.0.0 |
36 | 35 | */ |
@@ -27,17 +27,17 @@ |
||
27 | 27 | */ |
28 | 28 | class StorageBadConfigException extends StorageNotAvailableException { |
29 | 29 | |
30 | - /** |
|
31 | - * ExtStorageBadConfigException constructor. |
|
32 | - * |
|
33 | - * @param string $message |
|
34 | - * @param int $code |
|
35 | - * @param \Exception $previous |
|
36 | - * @since 9.0.0 |
|
37 | - */ |
|
38 | - public function __construct($message = '', \Exception $previous = null) { |
|
39 | - $l = \OC::$server->getL10N('core'); |
|
40 | - parent::__construct($l->t('Storage incomplete configuration. %s', $message), self::STATUS_INCOMPLETE_CONF, $previous); |
|
41 | - } |
|
30 | + /** |
|
31 | + * ExtStorageBadConfigException constructor. |
|
32 | + * |
|
33 | + * @param string $message |
|
34 | + * @param int $code |
|
35 | + * @param \Exception $previous |
|
36 | + * @since 9.0.0 |
|
37 | + */ |
|
38 | + public function __construct($message = '', \Exception $previous = null) { |
|
39 | + $l = \OC::$server->getL10N('core'); |
|
40 | + parent::__construct($l->t('Storage incomplete configuration. %s', $message), self::STATUS_INCOMPLETE_CONF, $previous); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | } |
@@ -30,7 +30,6 @@ |
||
30 | 30 | * StorageConnectionException constructor. |
31 | 31 | * |
32 | 32 | * @param string $message |
33 | - * @param int $code |
|
34 | 33 | * @param \Exception $previous |
35 | 34 | * @since 9.0.0 |
36 | 35 | */ |
@@ -27,16 +27,16 @@ |
||
27 | 27 | */ |
28 | 28 | class StorageConnectionException extends StorageNotAvailableException { |
29 | 29 | |
30 | - /** |
|
31 | - * StorageConnectionException constructor. |
|
32 | - * |
|
33 | - * @param string $message |
|
34 | - * @param int $code |
|
35 | - * @param \Exception $previous |
|
36 | - * @since 9.0.0 |
|
37 | - */ |
|
38 | - public function __construct($message = '', \Exception $previous = null) { |
|
39 | - $l = \OC::$server->getL10N('core'); |
|
40 | - parent::__construct($l->t('Storage connection error. %s', $message), self::STATUS_NETWORK_ERROR, $previous); |
|
41 | - } |
|
30 | + /** |
|
31 | + * StorageConnectionException constructor. |
|
32 | + * |
|
33 | + * @param string $message |
|
34 | + * @param int $code |
|
35 | + * @param \Exception $previous |
|
36 | + * @since 9.0.0 |
|
37 | + */ |
|
38 | + public function __construct($message = '', \Exception $previous = null) { |
|
39 | + $l = \OC::$server->getL10N('core'); |
|
40 | + parent::__construct($l->t('Storage connection error. %s', $message), self::STATUS_NETWORK_ERROR, $previous); |
|
41 | + } |
|
42 | 42 | } |
@@ -19,14 +19,14 @@ |
||
19 | 19 | <tr> |
20 | 20 | <th id='headerName' class="hidden column-name"> |
21 | 21 | <div id="headerName-container"> |
22 | - <a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a> |
|
22 | + <a class="name sort columntitle" data-sort="name"><span><?php p($l->t('Name')); ?></span><span class="sort-indicator"></span></a> |
|
23 | 23 | </div> |
24 | 24 | </th> |
25 | 25 | <th id="headerSize" class="hidden column-size"> |
26 | 26 | <a class="size sort columntitle" data-sort="size"><span><?php p($l->t('Size')); ?></span><span class="sort-indicator"></span></a> |
27 | 27 | </th> |
28 | 28 | <th id="headerDate" class="hidden column-mtime"> |
29 | - <a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t( 'Modified' )); ?></span><span class="sort-indicator"></span></a> |
|
29 | + <a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t('Modified')); ?></span><span class="sort-indicator"></span></a> |
|
30 | 30 | <span class="selectedActions"><a href="" class="delete-selected"> |
31 | 31 | <?php p($l->t('Delete'))?> |
32 | 32 | <img class="svg" alt="<?php p($l->t('Delete'))?>" |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $dir = '/'; |
27 | 27 | |
28 | 28 | if (isset($_GET['dir'])) { |
29 | - $dir = (string)$_GET['dir']; |
|
29 | + $dir = (string)$_GET['dir']; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | OCP\JSON::checkLoggedIn(); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | // send back json |
36 | 36 | try { |
37 | - OCP\JSON::success(array('data' => \OCA\Files\Helper::buildFileStorageStatistics($dir))); |
|
37 | + OCP\JSON::success(array('data' => \OCA\Files\Helper::buildFileStorageStatistics($dir))); |
|
38 | 38 | } catch (\OCP\Files\NotFoundException $e) { |
39 | - OCP\JSON::error(['data' => ['message' => 'Folder not found']]); |
|
39 | + OCP\JSON::error(['data' => ['message' => 'Folder not found']]); |
|
40 | 40 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $dir = '/'; |
27 | 27 | |
28 | 28 | if (isset($_GET['dir'])) { |
29 | - $dir = (string)$_GET['dir']; |
|
29 | + $dir = (string) $_GET['dir']; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | OCP\JSON::checkLoggedIn(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $l = \OC::$server->getL10N('files'); |
29 | 29 | |
30 | 30 | // Load the files |
31 | -$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : ''; |
|
31 | +$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : ''; |
|
32 | 32 | $dir = \OC\Files\Filesystem::normalizePath($dir); |
33 | 33 | |
34 | 34 | try { |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | $data = array(); |
42 | - $baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir='; |
|
42 | + $baseUrl = OCP\Util::linkTo('files', 'index.php').'?dir='; |
|
43 | 43 | |
44 | 44 | $permissions = $dirInfo->getPermissions(); |
45 | 45 | |
46 | - $sortAttribute = isset($_GET['sort']) ? (string)$_GET['sort'] : 'name'; |
|
46 | + $sortAttribute = isset($_GET['sort']) ? (string) $_GET['sort'] : 'name'; |
|
47 | 47 | $sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false; |
48 | 48 | $mimetypeFilters = isset($_GET['mimetypes']) ? json_decode($_GET['mimetypes']) : ''; |
49 | 49 |
@@ -32,73 +32,73 @@ |
||
32 | 32 | $dir = \OC\Files\Filesystem::normalizePath($dir); |
33 | 33 | |
34 | 34 | try { |
35 | - $dirInfo = \OC\Files\Filesystem::getFileInfo($dir); |
|
36 | - if (!$dirInfo || !$dirInfo->getType() === 'dir') { |
|
37 | - header("HTTP/1.0 404 Not Found"); |
|
38 | - exit(); |
|
39 | - } |
|
35 | + $dirInfo = \OC\Files\Filesystem::getFileInfo($dir); |
|
36 | + if (!$dirInfo || !$dirInfo->getType() === 'dir') { |
|
37 | + header("HTTP/1.0 404 Not Found"); |
|
38 | + exit(); |
|
39 | + } |
|
40 | 40 | |
41 | - $data = array(); |
|
42 | - $baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir='; |
|
41 | + $data = array(); |
|
42 | + $baseUrl = OCP\Util::linkTo('files', 'index.php') . '?dir='; |
|
43 | 43 | |
44 | - $permissions = $dirInfo->getPermissions(); |
|
44 | + $permissions = $dirInfo->getPermissions(); |
|
45 | 45 | |
46 | - $sortAttribute = isset($_GET['sort']) ? (string)$_GET['sort'] : 'name'; |
|
47 | - $sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false; |
|
48 | - $mimetypeFilters = isset($_GET['mimetypes']) ? json_decode($_GET['mimetypes']) : ''; |
|
46 | + $sortAttribute = isset($_GET['sort']) ? (string)$_GET['sort'] : 'name'; |
|
47 | + $sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false; |
|
48 | + $mimetypeFilters = isset($_GET['mimetypes']) ? json_decode($_GET['mimetypes']) : ''; |
|
49 | 49 | |
50 | - $files = []; |
|
51 | - // Clean up duplicates from array |
|
52 | - if (is_array($mimetypeFilters) && count($mimetypeFilters)) { |
|
53 | - $mimetypeFilters = array_unique($mimetypeFilters); |
|
50 | + $files = []; |
|
51 | + // Clean up duplicates from array |
|
52 | + if (is_array($mimetypeFilters) && count($mimetypeFilters)) { |
|
53 | + $mimetypeFilters = array_unique($mimetypeFilters); |
|
54 | 54 | |
55 | - if (!in_array('httpd/unix-directory', $mimetypeFilters)) { |
|
56 | - // append folder filter to be able to browse folders |
|
57 | - $mimetypeFilters[] = 'httpd/unix-directory'; |
|
58 | - } |
|
55 | + if (!in_array('httpd/unix-directory', $mimetypeFilters)) { |
|
56 | + // append folder filter to be able to browse folders |
|
57 | + $mimetypeFilters[] = 'httpd/unix-directory'; |
|
58 | + } |
|
59 | 59 | |
60 | - // create filelist with mimetype filter - as getFiles only supports on |
|
61 | - // mimetype filter at once we will filter this folder for each |
|
62 | - // mimetypeFilter |
|
63 | - foreach ($mimetypeFilters as $mimetypeFilter) { |
|
64 | - $files = array_merge($files, \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection, $mimetypeFilter)); |
|
65 | - } |
|
60 | + // create filelist with mimetype filter - as getFiles only supports on |
|
61 | + // mimetype filter at once we will filter this folder for each |
|
62 | + // mimetypeFilter |
|
63 | + foreach ($mimetypeFilters as $mimetypeFilter) { |
|
64 | + $files = array_merge($files, \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection, $mimetypeFilter)); |
|
65 | + } |
|
66 | 66 | |
67 | - // sort the files accordingly |
|
68 | - $files = \OCA\Files\Helper::sortFiles($files, $sortAttribute, $sortDirection); |
|
69 | - } else { |
|
70 | - // create file list without mimetype filter |
|
71 | - $files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection); |
|
72 | - } |
|
67 | + // sort the files accordingly |
|
68 | + $files = \OCA\Files\Helper::sortFiles($files, $sortAttribute, $sortDirection); |
|
69 | + } else { |
|
70 | + // create file list without mimetype filter |
|
71 | + $files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection); |
|
72 | + } |
|
73 | 73 | |
74 | - $files = \OCA\Files\Helper::populateTags($files); |
|
75 | - $data['directory'] = $dir; |
|
76 | - $data['files'] = \OCA\Files\Helper::formatFileInfos($files); |
|
77 | - $data['permissions'] = $permissions; |
|
74 | + $files = \OCA\Files\Helper::populateTags($files); |
|
75 | + $data['directory'] = $dir; |
|
76 | + $data['files'] = \OCA\Files\Helper::formatFileInfos($files); |
|
77 | + $data['permissions'] = $permissions; |
|
78 | 78 | |
79 | - OCP\JSON::success(array('data' => $data)); |
|
79 | + OCP\JSON::success(array('data' => $data)); |
|
80 | 80 | } catch (\OCP\Files\StorageNotAvailableException $e) { |
81 | - \OCP\Util::logException('files', $e); |
|
82 | - OCP\JSON::error(array( |
|
83 | - 'data' => array( |
|
84 | - 'exception' => '\OCP\Files\StorageNotAvailableException', |
|
85 | - 'message' => $l->t('Storage not available') |
|
86 | - ) |
|
87 | - )); |
|
81 | + \OCP\Util::logException('files', $e); |
|
82 | + OCP\JSON::error(array( |
|
83 | + 'data' => array( |
|
84 | + 'exception' => '\OCP\Files\StorageNotAvailableException', |
|
85 | + 'message' => $l->t('Storage not available') |
|
86 | + ) |
|
87 | + )); |
|
88 | 88 | } catch (\OCP\Files\StorageInvalidException $e) { |
89 | - \OCP\Util::logException('files', $e); |
|
90 | - OCP\JSON::error(array( |
|
91 | - 'data' => array( |
|
92 | - 'exception' => '\OCP\Files\StorageInvalidException', |
|
93 | - 'message' => $l->t('Storage invalid') |
|
94 | - ) |
|
95 | - )); |
|
89 | + \OCP\Util::logException('files', $e); |
|
90 | + OCP\JSON::error(array( |
|
91 | + 'data' => array( |
|
92 | + 'exception' => '\OCP\Files\StorageInvalidException', |
|
93 | + 'message' => $l->t('Storage invalid') |
|
94 | + ) |
|
95 | + )); |
|
96 | 96 | } catch (\Exception $e) { |
97 | - \OCP\Util::logException('files', $e); |
|
98 | - OCP\JSON::error(array( |
|
99 | - 'data' => array( |
|
100 | - 'exception' => '\Exception', |
|
101 | - 'message' => $l->t('Unknown error') |
|
102 | - ) |
|
103 | - )); |
|
97 | + \OCP\Util::logException('files', $e); |
|
98 | + OCP\JSON::error(array( |
|
99 | + 'data' => array( |
|
100 | + 'exception' => '\Exception', |
|
101 | + 'message' => $l->t('Unknown error') |
|
102 | + ) |
|
103 | + )); |
|
104 | 104 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $files_list = json_decode($files); |
38 | 38 | // in case we get only a single file |
39 | 39 | if (!is_array($files_list)) { |
40 | - $files_list = array($files); |
|
40 | + $files_list = array($files); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * alphanumeric characters |
47 | 47 | */ |
48 | 48 | if(isset($_GET['downloadStartSecret']) |
49 | - && !isset($_GET['downloadStartSecret'][32]) |
|
50 | - && preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) { |
|
51 | - setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/'); |
|
49 | + && !isset($_GET['downloadStartSecret'][32]) |
|
50 | + && preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) { |
|
51 | + setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | $server_params = array( 'head' => \OC::$server->getRequest()->getMethod() == 'HEAD' ); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * Http range requests support |
58 | 58 | */ |
59 | 59 | if (isset($_SERVER['HTTP_RANGE'])) { |
60 | - $server_params['range'] = \OC::$server->getRequest()->getHeader('Range'); |
|
60 | + $server_params['range'] = \OC::$server->getRequest()->getHeader('Range'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | OC_Files::get($dir, $files_list, $server_params); |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | OCP\User::checkLoggedIn(); |
32 | 32 | \OC::$server->getSession()->close(); |
33 | 33 | |
34 | -$files = isset($_GET['files']) ? (string)$_GET['files'] : ''; |
|
35 | -$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : ''; |
|
34 | +$files = isset($_GET['files']) ? (string) $_GET['files'] : ''; |
|
35 | +$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : ''; |
|
36 | 36 | |
37 | 37 | $files_list = json_decode($files); |
38 | 38 | // in case we get only a single file |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * the content must not be longer than 32 characters and must only contain |
46 | 46 | * alphanumeric characters |
47 | 47 | */ |
48 | -if(isset($_GET['downloadStartSecret']) |
|
48 | +if (isset($_GET['downloadStartSecret']) |
|
49 | 49 | && !isset($_GET['downloadStartSecret'][32]) |
50 | 50 | && preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) { |
51 | 51 | setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/'); |
52 | 52 | } |
53 | 53 | |
54 | -$server_params = array( 'head' => \OC::$server->getRequest()->getMethod() == 'HEAD' ); |
|
54 | +$server_params = array('head' => \OC::$server->getRequest()->getMethod() == 'HEAD'); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Http range requests support |
@@ -30,11 +30,11 @@ |
||
30 | 30 | $filename = $_GET["file"]; |
31 | 31 | |
32 | 32 | if(!\OC\Files\Filesystem::file_exists($filename)) { |
33 | - header("HTTP/1.0 404 Not Found"); |
|
34 | - $tmpl = new OCP\Template( '', '404', 'guest' ); |
|
35 | - $tmpl->assign('file', $filename); |
|
36 | - $tmpl->printPage(); |
|
37 | - exit; |
|
33 | + header("HTTP/1.0 404 Not Found"); |
|
34 | + $tmpl = new OCP\Template( '', '404', 'guest' ); |
|
35 | + $tmpl->assign('file', $filename); |
|
36 | + $tmpl->printPage(); |
|
37 | + exit; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $ftype=\OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType( $filename )); |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | |
30 | 30 | $filename = $_GET["file"]; |
31 | 31 | |
32 | -if(!\OC\Files\Filesystem::file_exists($filename)) { |
|
32 | +if (!\OC\Files\Filesystem::file_exists($filename)) { |
|
33 | 33 | header("HTTP/1.0 404 Not Found"); |
34 | - $tmpl = new OCP\Template( '', '404', 'guest' ); |
|
34 | + $tmpl = new OCP\Template('', '404', 'guest'); |
|
35 | 35 | $tmpl->assign('file', $filename); |
36 | 36 | $tmpl->printPage(); |
37 | 37 | exit; |
38 | 38 | } |
39 | 39 | |
40 | -$ftype=\OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType( $filename )); |
|
40 | +$ftype = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename)); |
|
41 | 41 | |
42 | 42 | header('Content-Type:'.$ftype); |
43 | 43 | OCP\Response::setContentDispositionHeader(basename($filename), 'attachment'); |
@@ -45,4 +45,4 @@ discard block |
||
45 | 45 | OCP\Response::setContentLengthHeader(\OC\Files\Filesystem::filesize($filename)); |
46 | 46 | |
47 | 47 | OC_Util::obEnd(); |
48 | -\OC\Files\Filesystem::readfile( $filename ); |
|
48 | +\OC\Files\Filesystem::readfile($filename); |