@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $apps = $this->appManager->getEnabledAppsForUser($this->currentUser); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - foreach($apps as $app) { |
|
| 111 | + foreach ($apps as $app) { |
|
| 112 | 112 | $apps_paths[$app] = \OC_App::getAppWebPath($app); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | $outgoingServer2serverShareEnabled = $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes'; |
| 122 | 122 | |
| 123 | 123 | $countOfDataLocation = 0; |
| 124 | - $dataLocation = str_replace(\OC::$SERVERROOT .'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
| 125 | - if($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) { |
|
| 124 | + $dataLocation = str_replace(\OC::$SERVERROOT.'/', '', $this->config->getSystemValue('datadirectory', ''), $countOfDataLocation); |
|
| 125 | + if ($countOfDataLocation !== 1 || !$this->groupManager->isAdmin($uid)) { |
|
| 126 | 126 | $dataLocation = false; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -144,61 +144,61 @@ discard block |
||
| 144 | 144 | "datepickerFormatDate" => json_encode($this->l->l('jsdate', null)), |
| 145 | 145 | 'nc_lastLogin' => $lastConfirmTimestamp, |
| 146 | 146 | "dayNames" => json_encode([ |
| 147 | - (string)$this->l->t('Sunday'), |
|
| 148 | - (string)$this->l->t('Monday'), |
|
| 149 | - (string)$this->l->t('Tuesday'), |
|
| 150 | - (string)$this->l->t('Wednesday'), |
|
| 151 | - (string)$this->l->t('Thursday'), |
|
| 152 | - (string)$this->l->t('Friday'), |
|
| 153 | - (string)$this->l->t('Saturday') |
|
| 147 | + (string) $this->l->t('Sunday'), |
|
| 148 | + (string) $this->l->t('Monday'), |
|
| 149 | + (string) $this->l->t('Tuesday'), |
|
| 150 | + (string) $this->l->t('Wednesday'), |
|
| 151 | + (string) $this->l->t('Thursday'), |
|
| 152 | + (string) $this->l->t('Friday'), |
|
| 153 | + (string) $this->l->t('Saturday') |
|
| 154 | 154 | ]), |
| 155 | 155 | "dayNamesShort" => json_encode([ |
| 156 | - (string)$this->l->t('Sun.'), |
|
| 157 | - (string)$this->l->t('Mon.'), |
|
| 158 | - (string)$this->l->t('Tue.'), |
|
| 159 | - (string)$this->l->t('Wed.'), |
|
| 160 | - (string)$this->l->t('Thu.'), |
|
| 161 | - (string)$this->l->t('Fri.'), |
|
| 162 | - (string)$this->l->t('Sat.') |
|
| 156 | + (string) $this->l->t('Sun.'), |
|
| 157 | + (string) $this->l->t('Mon.'), |
|
| 158 | + (string) $this->l->t('Tue.'), |
|
| 159 | + (string) $this->l->t('Wed.'), |
|
| 160 | + (string) $this->l->t('Thu.'), |
|
| 161 | + (string) $this->l->t('Fri.'), |
|
| 162 | + (string) $this->l->t('Sat.') |
|
| 163 | 163 | ]), |
| 164 | 164 | "dayNamesMin" => json_encode([ |
| 165 | - (string)$this->l->t('Su'), |
|
| 166 | - (string)$this->l->t('Mo'), |
|
| 167 | - (string)$this->l->t('Tu'), |
|
| 168 | - (string)$this->l->t('We'), |
|
| 169 | - (string)$this->l->t('Th'), |
|
| 170 | - (string)$this->l->t('Fr'), |
|
| 171 | - (string)$this->l->t('Sa') |
|
| 165 | + (string) $this->l->t('Su'), |
|
| 166 | + (string) $this->l->t('Mo'), |
|
| 167 | + (string) $this->l->t('Tu'), |
|
| 168 | + (string) $this->l->t('We'), |
|
| 169 | + (string) $this->l->t('Th'), |
|
| 170 | + (string) $this->l->t('Fr'), |
|
| 171 | + (string) $this->l->t('Sa') |
|
| 172 | 172 | ]), |
| 173 | 173 | "monthNames" => json_encode([ |
| 174 | - (string)$this->l->t('January'), |
|
| 175 | - (string)$this->l->t('February'), |
|
| 176 | - (string)$this->l->t('March'), |
|
| 177 | - (string)$this->l->t('April'), |
|
| 178 | - (string)$this->l->t('May'), |
|
| 179 | - (string)$this->l->t('June'), |
|
| 180 | - (string)$this->l->t('July'), |
|
| 181 | - (string)$this->l->t('August'), |
|
| 182 | - (string)$this->l->t('September'), |
|
| 183 | - (string)$this->l->t('October'), |
|
| 184 | - (string)$this->l->t('November'), |
|
| 185 | - (string)$this->l->t('December') |
|
| 174 | + (string) $this->l->t('January'), |
|
| 175 | + (string) $this->l->t('February'), |
|
| 176 | + (string) $this->l->t('March'), |
|
| 177 | + (string) $this->l->t('April'), |
|
| 178 | + (string) $this->l->t('May'), |
|
| 179 | + (string) $this->l->t('June'), |
|
| 180 | + (string) $this->l->t('July'), |
|
| 181 | + (string) $this->l->t('August'), |
|
| 182 | + (string) $this->l->t('September'), |
|
| 183 | + (string) $this->l->t('October'), |
|
| 184 | + (string) $this->l->t('November'), |
|
| 185 | + (string) $this->l->t('December') |
|
| 186 | 186 | ]), |
| 187 | 187 | "monthNamesShort" => json_encode([ |
| 188 | - (string)$this->l->t('Jan.'), |
|
| 189 | - (string)$this->l->t('Feb.'), |
|
| 190 | - (string)$this->l->t('Mar.'), |
|
| 191 | - (string)$this->l->t('Apr.'), |
|
| 192 | - (string)$this->l->t('May.'), |
|
| 193 | - (string)$this->l->t('Jun.'), |
|
| 194 | - (string)$this->l->t('Jul.'), |
|
| 195 | - (string)$this->l->t('Aug.'), |
|
| 196 | - (string)$this->l->t('Sep.'), |
|
| 197 | - (string)$this->l->t('Oct.'), |
|
| 198 | - (string)$this->l->t('Nov.'), |
|
| 199 | - (string)$this->l->t('Dec.') |
|
| 188 | + (string) $this->l->t('Jan.'), |
|
| 189 | + (string) $this->l->t('Feb.'), |
|
| 190 | + (string) $this->l->t('Mar.'), |
|
| 191 | + (string) $this->l->t('Apr.'), |
|
| 192 | + (string) $this->l->t('May.'), |
|
| 193 | + (string) $this->l->t('Jun.'), |
|
| 194 | + (string) $this->l->t('Jul.'), |
|
| 195 | + (string) $this->l->t('Aug.'), |
|
| 196 | + (string) $this->l->t('Sep.'), |
|
| 197 | + (string) $this->l->t('Oct.'), |
|
| 198 | + (string) $this->l->t('Nov.'), |
|
| 199 | + (string) $this->l->t('Dec.') |
|
| 200 | 200 | ]), |
| 201 | - "firstDay" => json_encode($this->l->l('firstday', null)) , |
|
| 201 | + "firstDay" => json_encode($this->l->l('firstday', null)), |
|
| 202 | 202 | "oc_config" => json_encode([ |
| 203 | 203 | 'session_lifetime' => min($this->config->getSystemValue('session_lifetime', $this->iniWrapper->getNumeric('session.gc_maxlifetime')), $this->iniWrapper->getNumeric('session.gc_maxlifetime')), |
| 204 | 204 | 'session_keepalive' => $this->config->getSystemValue('session_keepalive', true), |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | if ($this->currentUser !== null) { |
| 241 | 241 | $array['oc_userconfig'] = json_encode([ |
| 242 | 242 | 'avatar' => [ |
| 243 | - 'version' => (int)$this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
| 243 | + 'version' => (int) $this->config->getUserValue($uid, 'avatar', 'version', 0), |
|
| 244 | 244 | ] |
| 245 | 245 | ]); |
| 246 | 246 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | // Echo it |
| 254 | 254 | foreach ($array as $setting => $value) { |
| 255 | - $result .= 'var '. $setting . '='. $value . ';' . PHP_EOL; |
|
| 255 | + $result .= 'var '.$setting.'='.$value.';'.PHP_EOL; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | return $result; |
@@ -41,6 +41,6 @@ |
||
| 41 | 41 | * @return string |
| 42 | 42 | */ |
| 43 | 43 | public function getResourcePath() { |
| 44 | - return $this->webPath . '/' . $this->resource; |
|
| 44 | + return $this->webPath.'/'.$this->resource; |
|
| 45 | 45 | } |
| 46 | 46 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @param string[] $dirs |
| 34 | 34 | */ |
| 35 | - public function __construct( $dirs ) { |
|
| 35 | + public function __construct($dirs) { |
|
| 36 | 36 | $this->dirs = $dirs; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | * @return string |
| 42 | 42 | * @throws \Exception |
| 43 | 43 | */ |
| 44 | - public function find( $template ) { |
|
| 44 | + public function find($template) { |
|
| 45 | 45 | if ($template === '') { |
| 46 | 46 | throw new \InvalidArgumentException('Empty template name'); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - foreach($this->dirs as $dir) { |
|
| 49 | + foreach ($this->dirs as $dir) { |
|
| 50 | 50 | $file = $dir.$template.'.php'; |
| 51 | 51 | if (is_file($file)) { |
| 52 | 52 | $this->path = $dir; |
@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $requirements = array()) { |
| 93 | 93 | $name = strtolower($method).$url; |
| 94 | 94 | $name = str_replace(array('/', '{', '}'), '_', $name); |
| 95 | - if(!isset(self::$actions[$name])) { |
|
| 95 | + if (!isset(self::$actions[$name])) { |
|
| 96 | 96 | $oldCollection = OC::$server->getRouter()->getCurrentCollection(); |
| 97 | 97 | OC::$server->getRouter()->useCollection('ocs'); |
| 98 | 98 | OC::$server->getRouter()->create($name, $url) |
@@ -115,17 +115,17 @@ discard block |
||
| 115 | 115 | $method = $request->getMethod(); |
| 116 | 116 | |
| 117 | 117 | // Prepare the request variables |
| 118 | - if($method === 'PUT') { |
|
| 118 | + if ($method === 'PUT') { |
|
| 119 | 119 | $parameters['_put'] = $request->getParams(); |
| 120 | - } else if($method === 'DELETE') { |
|
| 120 | + } else if ($method === 'DELETE') { |
|
| 121 | 121 | $parameters['_delete'] = $request->getParams(); |
| 122 | 122 | } |
| 123 | 123 | $name = $parameters['_route']; |
| 124 | 124 | // Foreach registered action |
| 125 | 125 | $responses = array(); |
| 126 | - foreach(self::$actions[$name] as $action) { |
|
| 126 | + foreach (self::$actions[$name] as $action) { |
|
| 127 | 127 | // Check authentication and availability |
| 128 | - if(!self::isAuthorised($action)) { |
|
| 128 | + if (!self::isAuthorised($action)) { |
|
| 129 | 129 | $responses[] = array( |
| 130 | 130 | 'app' => $action['app'], |
| 131 | 131 | 'response' => new OC_OCS_Result(null, API::RESPOND_UNAUTHORISED, 'Unauthorised'), |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | ); |
| 134 | 134 | continue; |
| 135 | 135 | } |
| 136 | - if(!is_callable($action['action'])) { |
|
| 136 | + if (!is_callable($action['action'])) { |
|
| 137 | 137 | $responses[] = array( |
| 138 | 138 | 'app' => $action['app'], |
| 139 | 139 | 'response' => new OC_OCS_Result(null, API::RESPOND_NOT_FOUND, 'Api method not found'), |
@@ -173,15 +173,15 @@ discard block |
||
| 173 | 173 | 'failed' => array(), |
| 174 | 174 | ); |
| 175 | 175 | |
| 176 | - foreach($responses as $response) { |
|
| 177 | - if($response['shipped'] || ($response['app'] === 'core')) { |
|
| 178 | - if($response['response']->succeeded()) { |
|
| 176 | + foreach ($responses as $response) { |
|
| 177 | + if ($response['shipped'] || ($response['app'] === 'core')) { |
|
| 178 | + if ($response['response']->succeeded()) { |
|
| 179 | 179 | $shipped['succeeded'][$response['app']] = $response; |
| 180 | 180 | } else { |
| 181 | 181 | $shipped['failed'][$response['app']] = $response; |
| 182 | 182 | } |
| 183 | 183 | } else { |
| 184 | - if($response['response']->succeeded()) { |
|
| 184 | + if ($response['response']->succeeded()) { |
|
| 185 | 185 | $thirdparty['succeeded'][$response['app']] = $response; |
| 186 | 186 | } else { |
| 187 | 187 | $thirdparty['failed'][$response['app']] = $response; |
@@ -190,14 +190,14 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // Remove any error responses if there is one shipped response that succeeded |
| 193 | - if(!empty($shipped['failed'])) { |
|
| 193 | + if (!empty($shipped['failed'])) { |
|
| 194 | 194 | // Which shipped response do we use if they all failed? |
| 195 | 195 | // They may have failed for different reasons (different status codes) |
| 196 | 196 | // Which response code should we return? |
| 197 | 197 | // Maybe any that are not \OCP\API::RESPOND_SERVER_ERROR |
| 198 | 198 | // Merge failed responses if more than one |
| 199 | 199 | $data = array(); |
| 200 | - foreach($shipped['failed'] as $failure) { |
|
| 200 | + foreach ($shipped['failed'] as $failure) { |
|
| 201 | 201 | $data = array_merge_recursive($data, $failure['response']->getData()); |
| 202 | 202 | } |
| 203 | 203 | $picked = reset($shipped['failed']); |
@@ -206,12 +206,12 @@ discard block |
||
| 206 | 206 | $headers = $picked['response']->getHeaders(); |
| 207 | 207 | $response = new OC_OCS_Result($data, $code, $meta['message'], $headers); |
| 208 | 208 | return $response; |
| 209 | - } elseif(!empty($shipped['succeeded'])) { |
|
| 209 | + } elseif (!empty($shipped['succeeded'])) { |
|
| 210 | 210 | $responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']); |
| 211 | - } elseif(!empty($thirdparty['failed'])) { |
|
| 211 | + } elseif (!empty($thirdparty['failed'])) { |
|
| 212 | 212 | // Merge failed responses if more than one |
| 213 | 213 | $data = array(); |
| 214 | - foreach($thirdparty['failed'] as $failure) { |
|
| 214 | + foreach ($thirdparty['failed'] as $failure) { |
|
| 215 | 215 | $data = array_merge_recursive($data, $failure['response']->getData()); |
| 216 | 216 | } |
| 217 | 217 | $picked = reset($thirdparty['failed']); |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | $codes = []; |
| 229 | 229 | $header = []; |
| 230 | 230 | |
| 231 | - foreach($responses as $response) { |
|
| 232 | - if($response['shipped']) { |
|
| 231 | + foreach ($responses as $response) { |
|
| 232 | + if ($response['shipped']) { |
|
| 233 | 233 | $data = array_merge_recursive($response['response']->getData(), $data); |
| 234 | 234 | } else { |
| 235 | 235 | $data = array_merge_recursive($data, $response['response']->getData()); |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | // Use any non 100 status codes |
| 243 | 243 | $statusCode = 100; |
| 244 | 244 | $statusMessage = null; |
| 245 | - foreach($codes as $code) { |
|
| 246 | - if($code['code'] != 100) { |
|
| 245 | + foreach ($codes as $code) { |
|
| 246 | + if ($code['code'] != 100) { |
|
| 247 | 247 | $statusCode = $code['code']; |
| 248 | 248 | $statusMessage = $code['meta']['message']; |
| 249 | 249 | break; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | private static function isAuthorised($action) { |
| 262 | 262 | $level = $action['authlevel']; |
| 263 | - switch($level) { |
|
| 263 | + switch ($level) { |
|
| 264 | 264 | case API::GUEST_AUTH: |
| 265 | 265 | // Anyone can access |
| 266 | 266 | return true; |
@@ -270,16 +270,16 @@ discard block |
||
| 270 | 270 | case API::SUBADMIN_AUTH: |
| 271 | 271 | // Check for subadmin |
| 272 | 272 | $user = self::loginUser(); |
| 273 | - if(!$user) { |
|
| 273 | + if (!$user) { |
|
| 274 | 274 | return false; |
| 275 | 275 | } else { |
| 276 | 276 | $userObject = \OC::$server->getUserSession()->getUser(); |
| 277 | - if($userObject === null) { |
|
| 277 | + if ($userObject === null) { |
|
| 278 | 278 | return false; |
| 279 | 279 | } |
| 280 | 280 | $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); |
| 281 | 281 | $admin = OC_User::isAdminUser($user); |
| 282 | - if($isSubAdmin || $admin) { |
|
| 282 | + if ($isSubAdmin || $admin) { |
|
| 283 | 283 | return true; |
| 284 | 284 | } else { |
| 285 | 285 | return false; |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | case API::ADMIN_AUTH: |
| 289 | 289 | // Check for admin |
| 290 | 290 | $user = self::loginUser(); |
| 291 | - if(!$user) { |
|
| 291 | + if (!$user) { |
|
| 292 | 292 | return false; |
| 293 | 293 | } else { |
| 294 | 294 | return OC_User::isAdminUser($user); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * @return string|false (username, or false on failure) |
| 305 | 305 | */ |
| 306 | 306 | private static function loginUser() { |
| 307 | - if(self::$isLoggedIn === true) { |
|
| 307 | + if (self::$isLoggedIn === true) { |
|
| 308 | 308 | return \OC_User::getUser(); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -358,13 +358,13 @@ discard block |
||
| 358 | 358 | * @param OC_OCS_Result $result |
| 359 | 359 | * @param string $format the format xml|json |
| 360 | 360 | */ |
| 361 | - public static function respond($result, $format='xml') { |
|
| 361 | + public static function respond($result, $format = 'xml') { |
|
| 362 | 362 | $request = \OC::$server->getRequest(); |
| 363 | 363 | |
| 364 | 364 | // Send 401 headers if unauthorised |
| 365 | - if($result->getStatusCode() === API::RESPOND_UNAUTHORISED) { |
|
| 365 | + if ($result->getStatusCode() === API::RESPOND_UNAUTHORISED) { |
|
| 366 | 366 | // If request comes from JS return dummy auth request |
| 367 | - if($request->getHeader('X-Requested-With') === 'XMLHttpRequest') { |
|
| 367 | + if ($request->getHeader('X-Requested-With') === 'XMLHttpRequest') { |
|
| 368 | 368 | header('WWW-Authenticate: DummyBasic realm="Authorisation Required"'); |
| 369 | 369 | } else { |
| 370 | 370 | header('WWW-Authenticate: Basic realm="Authorisation Required"'); |
@@ -372,8 +372,8 @@ discard block |
||
| 372 | 372 | header('HTTP/1.0 401 Unauthorized'); |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - foreach($result->getHeaders() as $name => $value) { |
|
| 376 | - header($name . ': ' . $value); |
|
| 375 | + foreach ($result->getHeaders() as $name => $value) { |
|
| 376 | + header($name.': '.$value); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | $meta = $result->getMeta(); |
@@ -395,14 +395,14 @@ discard block |
||
| 395 | 395 | * @param XMLWriter $writer |
| 396 | 396 | */ |
| 397 | 397 | private static function toXML($array, $writer) { |
| 398 | - foreach($array as $k => $v) { |
|
| 398 | + foreach ($array as $k => $v) { |
|
| 399 | 399 | if ($k[0] === '@') { |
| 400 | 400 | $writer->writeAttribute(substr($k, 1), $v); |
| 401 | 401 | continue; |
| 402 | 402 | } else if (is_numeric($k)) { |
| 403 | 403 | $k = 'element'; |
| 404 | 404 | } |
| 405 | - if(is_array($v)) { |
|
| 405 | + if (is_array($v)) { |
|
| 406 | 406 | $writer->startElement($k); |
| 407 | 407 | self::toXML($v, $writer); |
| 408 | 408 | $writer->endElement(); |