@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param callable $callback |
36 | 36 | */ |
37 | 37 | public function listen($scope, $method, callable $callback) { |
38 | - $eventName = $scope . '::' . $method; |
|
38 | + $eventName = $scope.'::'.$method; |
|
39 | 39 | if (!isset($this->listeners[$eventName])) { |
40 | 40 | $this->listeners[$eventName] = array(); |
41 | 41 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $names = array(); |
54 | 54 | $allNames = array_keys($this->listeners); |
55 | 55 | if ($scope and $method) { |
56 | - $name = $scope . '::' . $method; |
|
56 | + $name = $scope.'::'.$method; |
|
57 | 57 | if (isset($this->listeners[$name])) { |
58 | 58 | $names[] = $name; |
59 | 59 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param array $arguments optional |
94 | 94 | */ |
95 | 95 | protected function emit($scope, $method, array $arguments = array()) { |
96 | - $eventName = $scope . '::' . $method; |
|
96 | + $eventName = $scope.'::'.$method; |
|
97 | 97 | if (isset($this->listeners[$eventName])) { |
98 | 98 | foreach ($this->listeners[$eventName] as $callback) { |
99 | 99 | call_user_func_array($callback, $arguments); |
@@ -30,23 +30,23 @@ |
||
30 | 30 | * error code for functions not provided by the group backend |
31 | 31 | * @deprecated Use \OC_Group_Backend::NOT_IMPLEMENTED instead |
32 | 32 | */ |
33 | -define('OC_GROUP_BACKEND_NOT_IMPLEMENTED', -501); |
|
33 | +define('OC_GROUP_BACKEND_NOT_IMPLEMENTED', -501); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * actions that user backends can define |
37 | 37 | */ |
38 | 38 | /** @deprecated Use \OC_Group_Backend::CREATE_GROUP instead */ |
39 | -define('OC_GROUP_BACKEND_CREATE_GROUP', 0x00000001); |
|
39 | +define('OC_GROUP_BACKEND_CREATE_GROUP', 0x00000001); |
|
40 | 40 | /** @deprecated Use \OC_Group_Backend::DELETE_GROUP instead */ |
41 | -define('OC_GROUP_BACKEND_DELETE_GROUP', 0x00000010); |
|
41 | +define('OC_GROUP_BACKEND_DELETE_GROUP', 0x00000010); |
|
42 | 42 | /** @deprecated Use \OC_Group_Backend::ADD_TO_GROUP instead */ |
43 | -define('OC_GROUP_BACKEND_ADD_TO_GROUP', 0x00000100); |
|
43 | +define('OC_GROUP_BACKEND_ADD_TO_GROUP', 0x00000100); |
|
44 | 44 | /** @deprecated Use \OC_Group_Backend::REMOVE_FROM_GOUP instead */ |
45 | -define('OC_GROUP_BACKEND_REMOVE_FROM_GOUP', 0x00001000); |
|
45 | +define('OC_GROUP_BACKEND_REMOVE_FROM_GOUP', 0x00001000); |
|
46 | 46 | /** @deprecated Obsolete */ |
47 | -define('OC_GROUP_BACKEND_GET_DISPLAYNAME', 0x00010000); //OBSOLETE |
|
47 | +define('OC_GROUP_BACKEND_GET_DISPLAYNAME', 0x00010000); //OBSOLETE |
|
48 | 48 | /** @deprecated Use \OC_Group_Backend::COUNT_USERS instead */ |
49 | -define('OC_GROUP_BACKEND_COUNT_USERS', 0x00100000); |
|
49 | +define('OC_GROUP_BACKEND_COUNT_USERS', 0x00100000); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Abstract base class for user management |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * if an array is given it will add all scripts |
54 | 54 | */ |
55 | 55 | function script($app, $file = null) { |
56 | - if(is_array($file)) { |
|
57 | - foreach($file as $f) { |
|
56 | + if (is_array($file)) { |
|
57 | + foreach ($file as $f) { |
|
58 | 58 | OC_Util::addScript($app, $f); |
59 | 59 | } |
60 | 60 | } else { |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | * if an array is given it will add all scripts |
70 | 70 | */ |
71 | 71 | function vendor_script($app, $file = null) { |
72 | - if(is_array($file)) { |
|
73 | - foreach($file as $f) { |
|
72 | + if (is_array($file)) { |
|
73 | + foreach ($file as $f) { |
|
74 | 74 | OC_Util::addVendorScript($app, $f); |
75 | 75 | } |
76 | 76 | } else { |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * if an array is given it will add all styles |
86 | 86 | */ |
87 | 87 | function style($app, $file = null) { |
88 | - if(is_array($file)) { |
|
89 | - foreach($file as $f) { |
|
88 | + if (is_array($file)) { |
|
89 | + foreach ($file as $f) { |
|
90 | 90 | OC_Util::addStyle($app, $f); |
91 | 91 | } |
92 | 92 | } else { |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * if an array is given it will add all styles |
102 | 102 | */ |
103 | 103 | function vendor_style($app, $file = null) { |
104 | - if(is_array($file)) { |
|
105 | - foreach($file as $f) { |
|
104 | + if (is_array($file)) { |
|
105 | + foreach ($file as $f) { |
|
106 | 106 | OC_Util::addVendorStyle($app, $f); |
107 | 107 | } |
108 | 108 | } else { |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | * if an array is given it will add all components |
127 | 127 | */ |
128 | 128 | function component($app, $file) { |
129 | - if(is_array($file)) { |
|
130 | - foreach($file as $f) { |
|
131 | - $url = link_to($app, 'component/' . $f . '.html'); |
|
129 | + if (is_array($file)) { |
|
130 | + foreach ($file as $f) { |
|
131 | + $url = link_to($app, 'component/'.$f.'.html'); |
|
132 | 132 | OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
133 | 133 | } |
134 | 134 | } else { |
135 | - $url = link_to($app, 'component/' . $file . '.html'); |
|
135 | + $url = link_to($app, 'component/'.$file.'.html'); |
|
136 | 136 | OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url)); |
137 | 137 | } |
138 | 138 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * |
147 | 147 | * For further information have a look at \OCP\IURLGenerator::linkTo |
148 | 148 | */ |
149 | -function link_to( $app, $file, $args = array() ) { |
|
149 | +function link_to($app, $file, $args = array()) { |
|
150 | 150 | return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); |
151 | 151 | } |
152 | 152 | |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * |
167 | 167 | * For further information have a look at \OCP\IURLGenerator::imagePath |
168 | 168 | */ |
169 | -function image_path( $app, $image ) { |
|
170 | - return \OC::$server->getURLGenerator()->imagePath( $app, $image ); |
|
169 | +function image_path($app, $image) { |
|
170 | + return \OC::$server->getURLGenerator()->imagePath($app, $image); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | * @param string $mimetype mimetype |
176 | 176 | * @return string link to the image |
177 | 177 | */ |
178 | -function mimetype_icon( $mimetype ) { |
|
179 | - return \OC::$server->getMimeTypeDetector()->mimeTypeIcon( $mimetype ); |
|
178 | +function mimetype_icon($mimetype) { |
|
179 | + return \OC::$server->getMimeTypeDetector()->mimeTypeIcon($mimetype); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -185,14 +185,14 @@ discard block |
||
185 | 185 | * @param string $path path of file |
186 | 186 | * @return link to the preview |
187 | 187 | */ |
188 | -function preview_icon( $path ) { |
|
188 | +function preview_icon($path) { |
|
189 | 189 | return \OC::$server->getURLGenerator()->linkToRoute('core.Preview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path]); |
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
193 | 193 | * @param string $path |
194 | 194 | */ |
195 | -function publicPreview_icon ( $path, $token ) { |
|
195 | +function publicPreview_icon($path, $token) { |
|
196 | 196 | return \OC::$server->getURLGenerator()->linkToRoute('files_sharing.PublicPreview.getPreview', ['x' => 32, 'y' => 32, 'file' => $path, 't' => $token]); |
197 | 197 | } |
198 | 198 | |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | * |
204 | 204 | * For further information have a look at OC_Helper::humanFileSize |
205 | 205 | */ |
206 | -function human_file_size( $bytes ) { |
|
207 | - return OC_Helper::humanFileSize( $bytes ); |
|
206 | +function human_file_size($bytes) { |
|
207 | + return OC_Helper::humanFileSize($bytes); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @param int $timestamp UNIX timestamp to strip |
213 | 213 | * @return $timestamp without time value |
214 | 214 | */ |
215 | -function strip_time($timestamp){ |
|
215 | +function strip_time($timestamp) { |
|
216 | 216 | $date = new \DateTime("@{$timestamp}"); |
217 | 217 | $date->setTime(0, 0, 0); |
218 | 218 | return intval($date->format('U')); |
@@ -230,15 +230,15 @@ discard block |
||
230 | 230 | /** @var \OC\DateTimeFormatter $formatter */ |
231 | 231 | $formatter = \OC::$server->query('DateTimeFormatter'); |
232 | 232 | |
233 | - if ($dateOnly){ |
|
233 | + if ($dateOnly) { |
|
234 | 234 | return $formatter->formatDateSpan($timestamp, $fromTime); |
235 | 235 | } |
236 | 236 | return $formatter->formatTimeSpan($timestamp, $fromTime); |
237 | 237 | } |
238 | 238 | |
239 | -function html_select_options($options, $selected, $params=array()) { |
|
239 | +function html_select_options($options, $selected, $params = array()) { |
|
240 | 240 | if (!is_array($selected)) { |
241 | - $selected=array($selected); |
|
241 | + $selected = array($selected); |
|
242 | 242 | } |
243 | 243 | if (isset($params['combine']) && $params['combine']) { |
244 | 244 | $options = array_combine($options, $options); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $label_name = $params['label']; |
252 | 252 | } |
253 | 253 | $html = ''; |
254 | - foreach($options as $value => $label) { |
|
254 | + foreach ($options as $value => $label) { |
|
255 | 255 | if ($value_name && is_array($label)) { |
256 | 256 | $value = $label[$value_name]; |
257 | 257 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $label = $label[$label_name]; |
260 | 260 | } |
261 | 261 | $select = in_array($value, $selected) ? ' selected="selected"' : ''; |
262 | - $html .= '<option value="' . \OCP\Util::sanitizeHTML($value) . '"' . $select . '>' . \OCP\Util::sanitizeHTML($label) . '</option>'."\n"; |
|
262 | + $html .= '<option value="'.\OCP\Util::sanitizeHTML($value).'"'.$select.'>'.\OCP\Util::sanitizeHTML($label).'</option>'."\n"; |
|
263 | 263 | } |
264 | 264 | return $html; |
265 | 265 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | static public function enableCaching($cache_time = null) { |
49 | 49 | if (is_numeric($cache_time)) { |
50 | - header('Pragma: public');// enable caching in IE |
|
50 | + header('Pragma: public'); // enable caching in IE |
|
51 | 51 | if ($cache_time > 0) { |
52 | 52 | self::setExpiresHeader('PT'.$cache_time.'S'); |
53 | 53 | header('Cache-Control: max-age='.$cache_time.', must-revalidate'); |
@@ -78,29 +78,29 @@ discard block |
||
78 | 78 | */ |
79 | 79 | static public function setStatus($status) { |
80 | 80 | $protocol = \OC::$server->getRequest()->getHttpProtocol(); |
81 | - switch($status) { |
|
81 | + switch ($status) { |
|
82 | 82 | case self::STATUS_NOT_MODIFIED: |
83 | - $status = $status . ' Not Modified'; |
|
83 | + $status = $status.' Not Modified'; |
|
84 | 84 | break; |
85 | 85 | case self::STATUS_TEMPORARY_REDIRECT: |
86 | 86 | if ($protocol == 'HTTP/1.1') { |
87 | - $status = $status . ' Temporary Redirect'; |
|
87 | + $status = $status.' Temporary Redirect'; |
|
88 | 88 | break; |
89 | 89 | } else { |
90 | 90 | $status = self::STATUS_FOUND; |
91 | 91 | // fallthrough |
92 | 92 | } |
93 | 93 | case self::STATUS_FOUND; |
94 | - $status = $status . ' Found'; |
|
94 | + $status = $status.' Found'; |
|
95 | 95 | break; |
96 | 96 | case self::STATUS_NOT_FOUND; |
97 | - $status = $status . ' Not Found'; |
|
97 | + $status = $status.' Not Found'; |
|
98 | 98 | break; |
99 | 99 | case self::STATUS_INTERNAL_SERVER_ERROR; |
100 | - $status = $status . ' Internal Server Error'; |
|
100 | + $status = $status.' Internal Server Error'; |
|
101 | 101 | break; |
102 | 102 | case self::STATUS_SERVICE_UNAVAILABLE; |
103 | - $status = $status . ' Service Unavailable'; |
|
103 | + $status = $status.' Service Unavailable'; |
|
104 | 104 | break; |
105 | 105 | } |
106 | 106 | header($protocol.' '.$status); |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | * @param string $filename file name |
181 | 181 | * @param string $type disposition type, either 'attachment' or 'inline' |
182 | 182 | */ |
183 | - static public function setContentDispositionHeader( $filename, $type = 'attachment' ) { |
|
183 | + static public function setContentDispositionHeader($filename, $type = 'attachment') { |
|
184 | 184 | if (\OC::$server->getRequest()->isUserAgent( |
185 | 185 | [ |
186 | 186 | \OC\AppFramework\Http\Request::USER_AGENT_IE, |
187 | 187 | \OC\AppFramework\Http\Request::USER_AGENT_ANDROID_MOBILE_CHROME, |
188 | 188 | \OC\AppFramework\Http\Request::USER_AGENT_FREEBOX, |
189 | 189 | ])) { |
190 | - header( 'Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode( $filename ) . '"' ); |
|
190 | + header('Content-Disposition: '.rawurlencode($type).'; filename="'.rawurlencode($filename).'"'); |
|
191 | 191 | } else { |
192 | - header( 'Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode( $filename ) |
|
193 | - . '; filename="' . rawurlencode( $filename ) . '"' ); |
|
192 | + header('Content-Disposition: '.rawurlencode($type).'; filename*=UTF-8\'\''.rawurlencode($filename) |
|
193 | + . '; filename="'.rawurlencode($filename).'"'); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | . 'font-src \'self\' data:; ' |
255 | 255 | . 'media-src *; ' |
256 | 256 | . 'connect-src *'; |
257 | - header('Content-Security-Policy:' . $policy); |
|
257 | + header('Content-Security-Policy:'.$policy); |
|
258 | 258 | |
259 | 259 | // Send fallback headers for installations that don't have the possibility to send |
260 | 260 | // custom headers on the webserver side |
261 | - if(getenv('modHeadersAvailable') !== 'true') { |
|
261 | + if (getenv('modHeadersAvailable') !== 'true') { |
|
262 | 262 | header('X-XSS-Protection: 1; mode=block'); // Enforce browser based XSS filters |
263 | 263 | header('X-Content-Type-Options: nosniff'); // Disable sniffing the content type for IE |
264 | 264 | header('X-Frame-Options: Sameorigin'); // Disallow iFraming from other domains |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * pass all other function directly to the \Doctrine\DBAL\Driver\Statement |
56 | 56 | */ |
57 | - public function __call($name,$arguments) { |
|
58 | - return call_user_func_array(array($this->statement,$name), $arguments); |
|
57 | + public function __call($name, $arguments) { |
|
58 | + return call_user_func_array(array($this->statement, $name), $arguments); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * @param array $input |
65 | 65 | * @return \OC_DB_StatementWrapper|int |
66 | 66 | */ |
67 | - public function execute($input=array()) { |
|
68 | - if(\OC::$server->getSystemConfig()->getValue( "log_query", false)) { |
|
67 | + public function execute($input = array()) { |
|
68 | + if (\OC::$server->getSystemConfig()->getValue("log_query", false)) { |
|
69 | 69 | $params_str = str_replace("\n", " ", var_export($input, true)); |
70 | 70 | \OCP\Util::writeLog('core', 'DB execute with arguments : '.$params_str, \OCP\Util::DEBUG); |
71 | 71 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param integer|null $length max length when using an OUT bind |
118 | 118 | * @return boolean |
119 | 119 | */ |
120 | - public function bindParam($column, &$variable, $type = null, $length = null){ |
|
120 | + public function bindParam($column, &$variable, $type = null, $length = null) { |
|
121 | 121 | return $this->statement->bindParam($column, $variable, $type, $length); |
122 | 122 | } |
123 | 123 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | header('X-Accel-Buffering: no'); |
61 | 61 | $this->fallback = isset($_GET['fallback']) and $_GET['fallback'] == 'true'; |
62 | 62 | if ($this->fallback) { |
63 | - $this->fallBackId = (int)$_GET['fallback_id']; |
|
63 | + $this->fallBackId = (int) $_GET['fallback_id']; |
|
64 | 64 | /** |
65 | 65 | * FIXME: The default content-security-policy of ownCloud forbids inline |
66 | 66 | * JavaScript for security reasons. IE starting on Windows 10 will |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | */ |
74 | 74 | header("Content-Security-Policy: default-src 'none'; script-src 'unsafe-inline'"); |
75 | 75 | header("Content-Type: text/html"); |
76 | - echo str_repeat('<span></span>' . PHP_EOL, 10); //dummy data to keep IE happy |
|
76 | + echo str_repeat('<span></span>'.PHP_EOL, 10); //dummy data to keep IE happy |
|
77 | 77 | } else { |
78 | 78 | header("Content-Type: text/event-stream"); |
79 | 79 | } |
80 | - if(!\OC::$server->getRequest()->passesStrictCookieCheck()) { |
|
80 | + if (!\OC::$server->getRequest()->passesStrictCookieCheck()) { |
|
81 | 81 | header('Location: '.\OC::$WEBROOT); |
82 | 82 | exit(); |
83 | 83 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function send($type, $data = null) { |
102 | 102 | if ($data and !preg_match('/^[A-Za-z0-9_]+$/', $type)) { |
103 | - throw new BadMethodCallException('Type needs to be alphanumeric ('. $type .')'); |
|
103 | + throw new BadMethodCallException('Type needs to be alphanumeric ('.$type.')'); |
|
104 | 104 | } |
105 | 105 | $this->init(); |
106 | 106 | if (is_null($data)) { |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | } |
110 | 110 | if ($this->fallback) { |
111 | 111 | $response = '<script type="text/javascript">window.parent.OC.EventSource.fallBackCallBack(' |
112 | - . $this->fallBackId . ',"' . $type . '",' . OCP\JSON::encode($data) . ')</script>' . PHP_EOL; |
|
112 | + . $this->fallBackId.',"'.$type.'",'.OCP\JSON::encode($data).')</script>'.PHP_EOL; |
|
113 | 113 | echo $response; |
114 | 114 | } else { |
115 | 115 | if ($type) { |
116 | - echo 'event: ' . $type . PHP_EOL; |
|
116 | + echo 'event: '.$type.PHP_EOL; |
|
117 | 117 | } |
118 | - echo 'data: ' . OCP\JSON::encode($data) . PHP_EOL; |
|
118 | + echo 'data: '.OCP\JSON::encode($data).PHP_EOL; |
|
119 | 119 | } |
120 | 120 | echo PHP_EOL; |
121 | 121 | flush(); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | if (!is_array($files)) { |
118 | - $filename = $dir . '/' . $files; |
|
118 | + $filename = $dir.'/'.$files; |
|
119 | 119 | if (!$view->is_dir($filename)) { |
120 | 120 | self::getSingleFile($view, $dir, $files, is_null($params) ? array() : $params); |
121 | 121 | return; |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | $name = $basename; |
131 | 131 | } |
132 | 132 | |
133 | - $filename = $dir . '/' . $name; |
|
133 | + $filename = $dir.'/'.$name; |
|
134 | 134 | } else { |
135 | - $filename = $dir . '/' . $files; |
|
135 | + $filename = $dir.'/'.$files; |
|
136 | 136 | $getType = self::ZIP_DIR; |
137 | 137 | // downloading root ? |
138 | 138 | if ($files !== '') { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | ignore_user_abort(true); |
152 | 152 | if ($getType === self::ZIP_FILES) { |
153 | 153 | foreach ($files as $file) { |
154 | - $file = $dir . '/' . $file; |
|
154 | + $file = $dir.'/'.$file; |
|
155 | 155 | if (\OC\Files\Filesystem::is_file($file)) { |
156 | 156 | $fileSize = \OC\Files\Filesystem::filesize($file); |
157 | 157 | $fileTime = \OC\Files\Filesystem::filemtime($file); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | } |
165 | 165 | } elseif ($getType === self::ZIP_DIR) { |
166 | - $file = $dir . '/' . $files; |
|
166 | + $file = $dir.'/'.$files; |
|
167 | 167 | $streamer->addDirRecursive($file); |
168 | 168 | } |
169 | 169 | $streamer->finalize(); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @return array $rangeArray ('from'=>int,'to'=>int), ... |
196 | 196 | */ |
197 | 197 | private static function parseHttpRangeHeader($rangeHeaderPos, $fileSize) { |
198 | - $rArray=explode(',', $rangeHeaderPos); |
|
198 | + $rArray = explode(',', $rangeHeaderPos); |
|
199 | 199 | $minOffset = 0; |
200 | 200 | $ind = 0; |
201 | 201 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | if ($ranges[0] < $minOffset) { // case: bytes=500-700,601-999 |
208 | 208 | $ranges[0] = $minOffset; |
209 | 209 | } |
210 | - if ($ind > 0 && $rangeArray[$ind-1]['to']+1 == $ranges[0]) { // case: bytes=500-600,601-999 |
|
210 | + if ($ind > 0 && $rangeArray[$ind - 1]['to'] + 1 == $ranges[0]) { // case: bytes=500-600,601-999 |
|
211 | 211 | $ind--; |
212 | 212 | $ranges[0] = $rangeArray[$ind]['from']; |
213 | 213 | } |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | if (is_numeric($ranges[0]) && is_numeric($ranges[1]) && $ranges[0] < $fileSize && $ranges[0] <= $ranges[1]) { |
217 | 217 | // case: x-x |
218 | 218 | if ($ranges[1] >= $fileSize) { |
219 | - $ranges[1] = $fileSize-1; |
|
219 | + $ranges[1] = $fileSize - 1; |
|
220 | 220 | } |
221 | - $rangeArray[$ind++] = array( 'from' => $ranges[0], 'to' => $ranges[1], 'size' => $fileSize ); |
|
221 | + $rangeArray[$ind++] = array('from' => $ranges[0], 'to' => $ranges[1], 'size' => $fileSize); |
|
222 | 222 | $minOffset = $ranges[1] + 1; |
223 | 223 | if ($minOffset >= $fileSize) { |
224 | 224 | break; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | elseif (is_numeric($ranges[0]) && $ranges[0] < $fileSize) { |
228 | 228 | // case: x- |
229 | - $rangeArray[$ind++] = array( 'from' => $ranges[0], 'to' => $fileSize-1, 'size' => $fileSize ); |
|
229 | + $rangeArray[$ind++] = array('from' => $ranges[0], 'to' => $fileSize - 1, 'size' => $fileSize); |
|
230 | 230 | break; |
231 | 231 | } |
232 | 232 | elseif (is_numeric($ranges[1])) { |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | if ($ranges[1] > $fileSize) { |
235 | 235 | $ranges[1] = $fileSize; |
236 | 236 | } |
237 | - $rangeArray[$ind++] = array( 'from' => $fileSize-$ranges[1], 'to' => $fileSize-1, 'size' => $fileSize ); |
|
237 | + $rangeArray[$ind++] = array('from' => $fileSize - $ranges[1], 'to' => $fileSize - 1, 'size' => $fileSize); |
|
238 | 238 | break; |
239 | 239 | } |
240 | 240 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @param array $params ; 'head' boolean to only send header of the request ; 'range' http range header |
249 | 249 | */ |
250 | 250 | private static function getSingleFile($view, $dir, $name, $params) { |
251 | - $filename = $dir . '/' . $name; |
|
251 | + $filename = $dir.'/'.$name; |
|
252 | 252 | OC_Util::obEnd(); |
253 | 253 | $view->lockFile($filename, ILockingProvider::LOCK_SHARED); |
254 | 254 | |
@@ -314,17 +314,17 @@ discard block |
||
314 | 314 | */ |
315 | 315 | public static function lockFiles($view, $dir, $files) { |
316 | 316 | if (!is_array($files)) { |
317 | - $file = $dir . '/' . $files; |
|
317 | + $file = $dir.'/'.$files; |
|
318 | 318 | $files = [$file]; |
319 | 319 | } |
320 | 320 | foreach ($files as $file) { |
321 | - $file = $dir . '/' . $file; |
|
321 | + $file = $dir.'/'.$file; |
|
322 | 322 | $view->lockFile($file, ILockingProvider::LOCK_SHARED); |
323 | 323 | if ($view->is_dir($file)) { |
324 | 324 | $contents = $view->getDirectoryContent($file); |
325 | 325 | $contents = array_map(function($fileInfo) use ($file) { |
326 | 326 | /** @var \OCP\Files\FileInfo $fileInfo */ |
327 | - return $file . '/' . $fileInfo->getName(); |
|
327 | + return $file.'/'.$fileInfo->getName(); |
|
328 | 328 | }, $contents); |
329 | 329 | self::lockFiles($view, $dir, $contents); |
330 | 330 | } |
@@ -353,8 +353,8 @@ discard block |
||
353 | 353 | |
354 | 354 | // default locations if not overridden by $files |
355 | 355 | $files = array_merge([ |
356 | - '.htaccess' => OC::$SERVERROOT . '/.htaccess', |
|
357 | - '.user.ini' => OC::$SERVERROOT . '/.user.ini' |
|
356 | + '.htaccess' => OC::$SERVERROOT.'/.htaccess', |
|
357 | + '.user.ini' => OC::$SERVERROOT.'/.user.ini' |
|
358 | 358 | ], $files); |
359 | 359 | |
360 | 360 | $updateFiles = [ |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $handle = @fopen($filename, 'r+'); |
376 | 376 | if (!$handle) { |
377 | 377 | \OCP\Util::writeLog('files', |
378 | - 'Can\'t write upload limit to ' . $filename . '. Please check the file permissions', |
|
378 | + 'Can\'t write upload limit to '.$filename.'. Please check the file permissions', |
|
379 | 379 | \OCP\Util::WARN); |
380 | 380 | $success = false; |
381 | 381 | continue; // try to update as many files as possible |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $content = $newContent; |
396 | 396 | } |
397 | 397 | if ($hasReplaced === 0) { |
398 | - $content .= "\n" . $setting; |
|
398 | + $content .= "\n".$setting; |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
@@ -426,12 +426,12 @@ discard block |
||
426 | 426 | } |
427 | 427 | if ($getType === self::ZIP_FILES) { |
428 | 428 | foreach ($files as $file) { |
429 | - $file = $dir . '/' . $file; |
|
429 | + $file = $dir.'/'.$file; |
|
430 | 430 | $view->unlockFile($file, ILockingProvider::LOCK_SHARED); |
431 | 431 | } |
432 | 432 | } |
433 | 433 | if ($getType === self::ZIP_DIR) { |
434 | - $file = $dir . '/' . $files; |
|
434 | + $file = $dir.'/'.$files; |
|
435 | 435 | $view->unlockFile($file, ILockingProvider::LOCK_SHARED); |
436 | 436 | } |
437 | 437 | } |
@@ -56,13 +56,13 @@ |
||
56 | 56 | $translations = $this->l10n->getTranslations(); |
57 | 57 | |
58 | 58 | $text = $this->text; |
59 | - if(array_key_exists($this->text, $translations)) { |
|
60 | - if(is_array($translations[$this->text])) { |
|
59 | + if (array_key_exists($this->text, $translations)) { |
|
60 | + if (is_array($translations[$this->text])) { |
|
61 | 61 | $fn = $this->l10n->getPluralFormFunction(); |
62 | 62 | $id = $fn($this->count); |
63 | 63 | $text = $translations[$this->text][$id]; |
64 | 64 | } |
65 | - else{ |
|
65 | + else { |
|
66 | 66 | $text = $translations[$this->text]; |
67 | 67 | } |
68 | 68 | } |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | public function isComplete() { |
86 | 86 | $prefix = $this->getPrefix(); |
87 | 87 | $cache = $this->getCache(); |
88 | - $chunkcount = (int)$this->info['chunkcount']; |
|
88 | + $chunkcount = (int) $this->info['chunkcount']; |
|
89 | 89 | |
90 | - for($i=($chunkcount-1); $i >= 0; $i--) { |
|
90 | + for ($i = ($chunkcount - 1); $i >= 0; $i--) { |
|
91 | 91 | if (!$cache->hasKey($prefix.$i)) { |
92 | 92 | return false; |
93 | 93 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public function cleanup() { |
144 | 144 | $cache = $this->getCache(); |
145 | 145 | $prefix = $this->getPrefix(); |
146 | - for($i=0; $i < $this->info['chunkcount']; $i++) { |
|
146 | + for ($i = 0; $i < $this->info['chunkcount']; $i++) { |
|
147 | 147 | $cache->remove($prefix.$i); |
148 | 148 | } |
149 | 149 | } |