|
@@ -84,7 +84,7 @@ discard block |
|
|
block discarded – undo |
|
84
|
84
|
'collectionOf' => $collectionOf, |
|
85
|
85
|
'supportedFileExtensions' => $supportedFileExtensions |
|
86
|
86
|
); |
|
87
|
|
- if(count(self::$backendTypes) === 1) { |
|
|
87
|
+ if (count(self::$backendTypes) === 1) { |
|
88
|
88
|
Util::addScript('core', 'dist/share_backend'); |
|
89
|
89
|
} |
|
90
|
90
|
return true; |
|
@@ -154,7 +154,7 @@ discard block |
|
|
block discarded – undo |
|
154
|
154
|
|
|
155
|
155
|
$select = self::createSelectStatement(self::FORMAT_NONE, $fileDependent); |
|
156
|
156
|
|
|
157
|
|
- $where .= ' `' . $column . '` = ? AND `item_type` = ? '; |
|
|
157
|
+ $where .= ' `'.$column.'` = ? AND `item_type` = ? '; |
|
158
|
158
|
$arguments = array($itemSource, $itemType); |
|
159
|
159
|
// for link shares $user === null |
|
160
|
160
|
if ($user !== null) { |
|
@@ -172,7 +172,7 @@ discard block |
|
|
block discarded – undo |
|
172
|
172
|
$arguments[] = $owner; |
|
173
|
173
|
} |
|
174
|
174
|
|
|
175
|
|
- $query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $fileDependentWhere . $where); |
|
|
175
|
+ $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$fileDependentWhere.$where); |
|
176
|
176
|
|
|
177
|
177
|
$result = \OC_DB::executeAudited($query, $arguments); |
|
178
|
178
|
|
|
@@ -180,7 +180,7 @@ discard block |
|
|
block discarded – undo |
|
180
|
180
|
if ($fileDependent && !self::isFileReachable($row['path'], $row['storage_id'])) { |
|
181
|
181
|
continue; |
|
182
|
182
|
} |
|
183
|
|
- if ($fileDependent && (int)$row['file_parent'] === -1) { |
|
|
183
|
+ if ($fileDependent && (int) $row['file_parent'] === -1) { |
|
184
|
184
|
// if it is a mount point we need to get the path from the mount manager |
|
185
|
185
|
$mountManager = \OC\Files\Filesystem::getMountManager(); |
|
186
|
186
|
$mountPoint = $mountManager->findByStorageId($row['storage_id']); |
|
@@ -191,7 +191,7 @@ discard block |
|
|
block discarded – undo |
|
191
|
191
|
$row['path'] = $path; |
|
192
|
192
|
} else { |
|
193
|
193
|
\OC::$server->getLogger()->warning( |
|
194
|
|
- 'Could not resolve mount point for ' . $row['storage_id'], |
|
|
194
|
+ 'Could not resolve mount point for '.$row['storage_id'], |
|
195
|
195
|
['app' => 'OCP\Share'] |
|
196
|
196
|
); |
|
197
|
197
|
} |
|
@@ -200,7 +200,7 @@ discard block |
|
|
block discarded – undo |
|
200
|
200
|
} |
|
201
|
201
|
|
|
202
|
202
|
//if didn't found a result than let's look for a group share. |
|
203
|
|
- if(empty($shares) && $user !== null) { |
|
|
203
|
+ if (empty($shares) && $user !== null) { |
|
204
|
204
|
$userObject = \OC::$server->getUserManager()->get($user); |
|
205
|
205
|
$groups = []; |
|
206
|
206
|
if ($userObject) { |
|
@@ -208,7 +208,7 @@ discard block |
|
|
block discarded – undo |
|
208
|
208
|
} |
|
209
|
209
|
|
|
210
|
210
|
if (!empty($groups)) { |
|
211
|
|
- $where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
|
211
|
+ $where = $fileDependentWhere.' WHERE `'.$column.'` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
212
|
212
|
$arguments = array($itemSource, $itemType, $groups); |
|
213
|
213
|
$types = array(null, null, IQueryBuilder::PARAM_STR_ARRAY); |
|
214
|
214
|
|
|
@@ -222,7 +222,7 @@ discard block |
|
|
block discarded – undo |
|
222
|
222
|
// class isn't static anymore... |
|
223
|
223
|
$conn = \OC::$server->getDatabaseConnection(); |
|
224
|
224
|
$result = $conn->executeQuery( |
|
225
|
|
- 'SELECT ' . $select . ' FROM `*PREFIX*share` ' . $where, |
|
|
225
|
+ 'SELECT '.$select.' FROM `*PREFIX*share` '.$where, |
|
226
|
226
|
$arguments, |
|
227
|
227
|
$types |
|
228
|
228
|
); |
|
@@ -264,7 +264,7 @@ discard block |
|
|
block discarded – undo |
|
264
|
264
|
$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?', 1); |
|
265
|
265
|
$result = $query->execute(array($token)); |
|
266
|
266
|
if ($result === false) { |
|
267
|
|
- \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, ILogger::ERROR); |
|
|
267
|
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage().', token='.$token, ILogger::ERROR); |
|
268
|
268
|
} |
|
269
|
269
|
$row = $result->fetchRow(); |
|
270
|
270
|
if ($row === false) { |
|
@@ -371,12 +371,12 @@ discard block |
|
|
block discarded – undo |
|
371
|
371
|
|
|
372
|
372
|
//verify that we don't share a folder which already contains a share mount point |
|
373
|
373
|
if ($itemType === 'folder') { |
|
374
|
|
- $path = '/' . $uidOwner . '/files' . \OC\Files\Filesystem::getPath($itemSource) . '/'; |
|
|
374
|
+ $path = '/'.$uidOwner.'/files'.\OC\Files\Filesystem::getPath($itemSource).'/'; |
|
375
|
375
|
$mountManager = \OC\Files\Filesystem::getMountManager(); |
|
376
|
376
|
$mounts = $mountManager->findIn($path); |
|
377
|
377
|
foreach ($mounts as $mount) { |
|
378
|
378
|
if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) { |
|
379
|
|
- $message = 'Sharing "' . $itemSourceName . '" failed, because it contains files shared with you!'; |
|
|
379
|
+ $message = 'Sharing "'.$itemSourceName.'" failed, because it contains files shared with you!'; |
|
380
|
380
|
\OCP\Util::writeLog('OCP\Share', $message, ILogger::DEBUG); |
|
381
|
381
|
throw new \Exception($message); |
|
382
|
382
|
} |
|
@@ -386,7 +386,7 @@ discard block |
|
|
block discarded – undo |
|
386
|
386
|
|
|
387
|
387
|
// single file shares should never have delete permissions |
|
388
|
388
|
if ($itemType === 'file') { |
|
389
|
|
- $permissions = (int)$permissions & ~\OCP\Constants::PERMISSION_DELETE; |
|
|
389
|
+ $permissions = (int) $permissions & ~\OCP\Constants::PERMISSION_DELETE; |
|
390
|
390
|
} |
|
391
|
391
|
|
|
392
|
392
|
//Validate expirationDate |
|
@@ -540,7 +540,7 @@ discard block |
|
|
block discarded – undo |
|
540
|
540
|
} else { |
|
541
|
541
|
// reuse the already set password, but only if we change permissions |
|
542
|
542
|
// otherwise the user disabled the password protection |
|
543
|
|
- if ($checkExists && (int)$permissions !== (int)$oldPermissions) { |
|
|
543
|
+ if ($checkExists && (int) $permissions !== (int) $oldPermissions) { |
|
544
|
544
|
$shareWith = $checkExists['share_with']; |
|
545
|
545
|
} |
|
546
|
546
|
} |
|
@@ -612,10 +612,10 @@ discard block |
|
|
block discarded – undo |
|
612
|
612
|
throw new \Exception($message_t); |
|
613
|
613
|
} |
|
614
|
614
|
|
|
615
|
|
- $token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_UPPER . |
|
|
615
|
+ $token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_UPPER. |
|
616
|
616
|
\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
617
|
617
|
|
|
618
|
|
- $shareWith = $user . '@' . $remote; |
|
|
618
|
+ $shareWith = $user.'@'.$remote; |
|
619
|
619
|
$shareId = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, null, $token, $itemSourceName); |
|
620
|
620
|
|
|
621
|
621
|
$send = false; |
|
@@ -666,12 +666,12 @@ discard block |
|
|
block discarded – undo |
|
666
|
666
|
$currentUser = $owner ? $owner : \OC_User::getUser(); |
|
667
|
667
|
foreach ($items as $item) { |
|
668
|
668
|
// delete the item with the expected share_type and owner |
|
669
|
|
- if ((int)$item['share_type'] === (int)$shareType && $item['uid_owner'] === $currentUser) { |
|
|
669
|
+ if ((int) $item['share_type'] === (int) $shareType && $item['uid_owner'] === $currentUser) { |
|
670
|
670
|
$toDelete = $item; |
|
671
|
671
|
// if there is more then one result we don't have to delete the children |
|
672
|
672
|
// but update their parent. For group shares the new parent should always be |
|
673
|
673
|
// the original group share and not the db entry with the unique name |
|
674
|
|
- } else if ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
|
674
|
+ } else if ((int) $item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
675
|
675
|
$newParent = $item['parent']; |
|
676
|
676
|
} else { |
|
677
|
677
|
$newParent = $item['id']; |
|
@@ -703,7 +703,7 @@ discard block |
|
|
block discarded – undo |
|
703
|
703
|
|
|
704
|
704
|
$result = $query->execute(array($status, $itemType, $itemSource, $shareType, $recipient)); |
|
705
|
705
|
|
|
706
|
|
- if($result === false) { |
|
|
706
|
+ if ($result === false) { |
|
707
|
707
|
\OCP\Util::writeLog('OCP\Share', 'Couldn\'t set send mail status', ILogger::ERROR); |
|
708
|
708
|
} |
|
709
|
709
|
} |
|
@@ -729,7 +729,7 @@ discard block |
|
|
block discarded – undo |
|
729
|
729
|
if ($defaultExpireDateEnforced && $shareTime === null) { |
|
730
|
730
|
$items = self::getItemShared($itemType, $itemSource); |
|
731
|
731
|
$firstItem = reset($items); |
|
732
|
|
- $shareTime = (int)$firstItem['stime']; |
|
|
732
|
+ $shareTime = (int) $firstItem['stime']; |
|
733
|
733
|
} |
|
734
|
734
|
|
|
735
|
735
|
if ($defaultExpireDateEnforced) { |
|
@@ -737,9 +737,9 @@ discard block |
|
|
block discarded – undo |
|
737
|
737
|
$maxDate = new \DateTime(); |
|
738
|
738
|
$maxDate->setTimestamp($shareTime); |
|
739
|
739
|
$maxDays = \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
740
|
|
- $maxDate->add(new \DateInterval('P' . $maxDays . 'D')); |
|
|
740
|
+ $maxDate->add(new \DateInterval('P'.$maxDays.'D')); |
|
741
|
741
|
if ($date > $maxDate) { |
|
742
|
|
- $warning = 'Cannot set expiration date. Shares cannot expire later than ' . $maxDays . ' after they have been shared'; |
|
|
742
|
+ $warning = 'Cannot set expiration date. Shares cannot expire later than '.$maxDays.' after they have been shared'; |
|
743
|
743
|
$warning_t = $l->t('Cannot set expiration date. Shares cannot expire later than %s after they have been shared', array($maxDays)); |
|
744
|
744
|
\OCP\Util::writeLog('OCP\Share', $warning, ILogger::WARN); |
|
745
|
745
|
throw new \Exception($warning_t); |
|
@@ -801,7 +801,7 @@ discard block |
|
|
block discarded – undo |
|
801
|
801
|
*/ |
|
802
|
802
|
protected static function unshareItem(array $item, $newParent = null) { |
|
803
|
803
|
|
|
804
|
|
- $shareType = (int)$item['share_type']; |
|
|
804
|
+ $shareType = (int) $item['share_type']; |
|
805
|
805
|
$shareWith = null; |
|
806
|
806
|
if ($shareType !== \OCP\Share::SHARE_TYPE_LINK) { |
|
807
|
807
|
$shareWith = $item['share_with']; |
|
@@ -817,7 +817,7 @@ discard block |
|
|
block discarded – undo |
|
817
|
817
|
'itemParent' => $item['parent'], |
|
818
|
818
|
'uidOwner' => $item['uid_owner'], |
|
819
|
819
|
); |
|
820
|
|
- if($item['item_type'] === 'file' || $item['item_type'] === 'folder') { |
|
|
820
|
+ if ($item['item_type'] === 'file' || $item['item_type'] === 'folder') { |
|
821
|
821
|
$hookParams['fileSource'] = $item['file_source']; |
|
822
|
822
|
$hookParams['fileTarget'] = $item['file_target']; |
|
823
|
823
|
} |
|
@@ -827,7 +827,7 @@ discard block |
|
|
block discarded – undo |
|
827
|
827
|
$deletedShares[] = $hookParams; |
|
828
|
828
|
$hookParams['deletedShares'] = $deletedShares; |
|
829
|
829
|
\OC_Hook::emit(\OCP\Share::class, 'post_unshare', $hookParams); |
|
830
|
|
- if ((int)$item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
|
830
|
+ if ((int) $item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
831
|
831
|
list(, $remote) = Helper::splitUserRemote($item['share_with']); |
|
832
|
832
|
self::sendRemoteUnshare($remote, $item['id'], $item['token']); |
|
833
|
833
|
} |
|
@@ -988,7 +988,7 @@ discard block |
|
|
block discarded – undo |
|
988
|
988
|
// Get filesystem root to add it to the file target and remove from the |
|
989
|
989
|
// file source, match file_source with the file cache |
|
990
|
990
|
if ($itemType == 'file' || $itemType == 'folder') { |
|
991
|
|
- if(!is_null($uidOwner)) { |
|
|
991
|
+ if (!is_null($uidOwner)) { |
|
992
|
992
|
$root = \OC\Files\Filesystem::getRoot(); |
|
993
|
993
|
} else { |
|
994
|
994
|
$root = ''; |
|
@@ -1133,7 +1133,7 @@ discard block |
|
|
block discarded – undo |
|
1133
|
1133
|
$result = $query->execute($queryArgs); |
|
1134
|
1134
|
if ($result === false) { |
|
1135
|
1135
|
\OCP\Util::writeLog('OCP\Share', |
|
1136
|
|
- \OC_DB::getErrorMessage() . ', select=' . $select . ' where=', |
|
|
1136
|
+ \OC_DB::getErrorMessage().', select='.$select.' where=', |
|
1137
|
1137
|
ILogger::ERROR); |
|
1138
|
1138
|
} |
|
1139
|
1139
|
$items = array(); |
|
@@ -1175,14 +1175,14 @@ discard block |
|
|
block discarded – undo |
|
1175
|
1175
|
} |
|
1176
|
1176
|
// Switch ids if sharing permission is granted on only |
|
1177
|
1177
|
// one share to ensure correct parent is used if resharing |
|
1178
|
|
- if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
1179
|
|
- && (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
|
1178
|
+ if (~(int) $items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
|
1179
|
+ && (int) $row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
1180
|
1180
|
$items[$row['id']] = $items[$id]; |
|
1181
|
1181
|
$switchedItems[$id] = $row['id']; |
|
1182
|
1182
|
unset($items[$id]); |
|
1183
|
1183
|
$id = $row['id']; |
|
1184
|
1184
|
} |
|
1185
|
|
- $items[$id]['permissions'] |= (int)$row['permissions']; |
|
|
1185
|
+ $items[$id]['permissions'] |= (int) $row['permissions']; |
|
1186
|
1186
|
|
|
1187
|
1187
|
} |
|
1188
|
1188
|
continue; |
|
@@ -1196,8 +1196,8 @@ discard block |
|
|
block discarded – undo |
|
1196
|
1196
|
$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?'); |
|
1197
|
1197
|
$parentResult = $query->execute(array($row['parent'])); |
|
1198
|
1198
|
if ($result === false) { |
|
1199
|
|
- \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' . |
|
1200
|
|
- \OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where, |
|
|
1199
|
+ \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: '. |
|
|
1200
|
+ \OC_DB::getErrorMessage().', select='.$select.' where='.$where, |
|
1201
|
1201
|
ILogger::ERROR); |
|
1202
|
1202
|
} else { |
|
1203
|
1203
|
$parentRow = $parentResult->fetchRow(); |
|
@@ -1207,7 +1207,7 @@ discard block |
|
|
block discarded – undo |
|
1207
|
1207
|
$subPath = substr($row['path'], $pos); |
|
1208
|
1208
|
$splitPath = explode('/', $subPath); |
|
1209
|
1209
|
foreach (array_slice($splitPath, 2) as $pathPart) { |
|
1210
|
|
- $tmpPath = $tmpPath . '/' . $pathPart; |
|
|
1210
|
+ $tmpPath = $tmpPath.'/'.$pathPart; |
|
1211
|
1211
|
} |
|
1212
|
1212
|
$row['path'] = $tmpPath; |
|
1213
|
1213
|
} |
|
@@ -1226,7 +1226,7 @@ discard block |
|
|
block discarded – undo |
|
1226
|
1226
|
} |
|
1227
|
1227
|
} |
|
1228
|
1228
|
|
|
1229
|
|
- if($checkExpireDate) { |
|
|
1229
|
+ if ($checkExpireDate) { |
|
1230
|
1230
|
if (self::expireItem($row)) { |
|
1231
|
1231
|
continue; |
|
1232
|
1232
|
} |
|
@@ -1237,11 +1237,11 @@ discard block |
|
|
block discarded – undo |
|
1237
|
1237
|
} |
|
1238
|
1238
|
// Add display names to result |
|
1239
|
1239
|
$row['share_with_displayname'] = $row['share_with']; |
|
1240
|
|
- if ( isset($row['share_with']) && $row['share_with'] != '' && |
|
|
1240
|
+ if (isset($row['share_with']) && $row['share_with'] != '' && |
|
1241
|
1241
|
$row['share_type'] === self::SHARE_TYPE_USER) { |
|
1242
|
1242
|
$shareWithUser = \OC::$server->getUserManager()->get($row['share_with']); |
|
1243
|
1243
|
$row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName(); |
|
1244
|
|
- } else if(isset($row['share_with']) && $row['share_with'] != '' && |
|
|
1244
|
+ } else if (isset($row['share_with']) && $row['share_with'] != '' && |
|
1245
|
1245
|
$row['share_type'] === self::SHARE_TYPE_REMOTE) { |
|
1246
|
1246
|
$addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']); |
|
1247
|
1247
|
foreach ($addressBookEntries as $entry) { |
|
@@ -1252,7 +1252,7 @@ discard block |
|
|
block discarded – undo |
|
1252
|
1252
|
} |
|
1253
|
1253
|
} |
|
1254
|
1254
|
} |
|
1255
|
|
- if ( isset($row['uid_owner']) && $row['uid_owner'] != '') { |
|
|
1255
|
+ if (isset($row['uid_owner']) && $row['uid_owner'] != '') { |
|
1256
|
1256
|
$ownerUser = \OC::$server->getUserManager()->get($row['uid_owner']); |
|
1257
|
1257
|
$row['displayname_owner'] = $ownerUser === null ? $row['uid_owner'] : $ownerUser->getDisplayName(); |
|
1258
|
1258
|
} |
|
@@ -1401,7 +1401,7 @@ discard block |
|
|
block discarded – undo |
|
1401
|
1401
|
// for file/folder shares we need to compare file_source, otherwise we compare item_source |
|
1402
|
1402
|
// only group shares if they already point to the same target, otherwise the file where shared |
|
1403
|
1403
|
// before grouping of shares was added. In this case we don't group them toi avoid confusions |
|
1404
|
|
- if (( $fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) || |
|
|
1404
|
+ if (($fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) || |
|
1405
|
1405
|
(!$fileSharing && $item['item_source'] === $r['item_source'] && $item['item_target'] === $r['item_target'])) { |
|
1406
|
1406
|
// add the first item to the list of grouped shares |
|
1407
|
1407
|
if (!isset($result[$key]['grouped'])) { |
|
@@ -1447,7 +1447,7 @@ discard block |
|
|
block discarded – undo |
|
1447
|
1447
|
$groupItemTarget = $itemTarget = $fileSource = $parent = 0; |
|
1448
|
1448
|
|
|
1449
|
1449
|
$result = self::checkReshare($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $itemSourceName, $expirationDate); |
|
1450
|
|
- if(!empty($result)) { |
|
|
1450
|
+ if (!empty($result)) { |
|
1451
|
1451
|
$parent = $result['parent']; |
|
1452
|
1452
|
$itemSource = $result['itemSource']; |
|
1453
|
1453
|
$fileSource = $result['fileSource']; |
|
@@ -1541,11 +1541,11 @@ discard block |
|
|
block discarded – undo |
|
1541
|
1541
|
$itemTarget = $sourceExists['item_target']; |
|
1542
|
1542
|
|
|
1543
|
1543
|
// for group shares we don't need a additional entry if the target is the same |
|
1544
|
|
- if($isGroupShare && $groupItemTarget === $itemTarget) { |
|
|
1544
|
+ if ($isGroupShare && $groupItemTarget === $itemTarget) { |
|
1545
|
1545
|
continue; |
|
1546
|
1546
|
} |
|
1547
|
1547
|
|
|
1548
|
|
- } elseif(!$sourceExists && !$isGroupShare) { |
|
|
1548
|
+ } elseif (!$sourceExists && !$isGroupShare) { |
|
1549
|
1549
|
|
|
1550
|
1550
|
$itemTarget = Helper::generateTarget($itemType, $itemSource, $userShareType, $user, |
|
1551
|
1551
|
$uidOwner, $suggestedItemTarget, $parent); |
|
@@ -1676,8 +1676,8 @@ discard block |
|
|
block discarded – undo |
|
1676
|
1676
|
|
|
1677
|
1677
|
if ($checkReshare && $checkReshare['uid_owner'] !== \OC_User::getUser()) { |
|
1678
|
1678
|
// Check if share permissions is granted |
|
1679
|
|
- if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
1680
|
|
- if (~(int)$checkReshare['permissions'] & $permissions) { |
|
|
1679
|
+ if (self::isResharingAllowed() && (int) $checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
|
1680
|
+ if (~(int) $checkReshare['permissions'] & $permissions) { |
|
1681
|
1681
|
$message = 'Sharing %1$s failed, because the permissions exceed permissions granted to %2$s'; |
|
1682
|
1682
|
$message_t = $l->t('Sharing %1$s failed, because the permissions exceed permissions granted to %2$s', array($itemSourceName, $uidOwner)); |
|
1683
|
1683
|
|
|
@@ -1689,7 +1689,7 @@ discard block |
|
|
block discarded – undo |
|
1689
|
1689
|
|
|
1690
|
1690
|
$result['expirationDate'] = $expirationDate; |
|
1691
|
1691
|
// $checkReshare['expiration'] could be null and then is always less than any value |
|
1692
|
|
- if(isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) { |
|
|
1692
|
+ if (isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) { |
|
1693
|
1693
|
$result['expirationDate'] = $checkReshare['expiration']; |
|
1694
|
1694
|
} |
|
1695
|
1695
|
|
|
@@ -1781,7 +1781,7 @@ discard block |
|
|
block discarded – undo |
|
1781
|
1781
|
|
|
1782
|
1782
|
$id = false; |
|
1783
|
1783
|
if ($result) { |
|
1784
|
|
- $id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share'); |
|
|
1784
|
+ $id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share'); |
|
1785
|
1785
|
} |
|
1786
|
1786
|
|
|
1787
|
1787
|
return $id; |
|
@@ -1809,8 +1809,8 @@ discard block |
|
|
block discarded – undo |
|
1809
|
1809
|
return true; |
|
1810
|
1810
|
} |
|
1811
|
1811
|
|
|
1812
|
|
- if ( \OC::$server->getSession()->exists('public_link_authenticated') |
|
1813
|
|
- && \OC::$server->getSession()->get('public_link_authenticated') === (string)$linkItem['id'] ) { |
|
|
1812
|
+ if (\OC::$server->getSession()->exists('public_link_authenticated') |
|
|
1813
|
+ && \OC::$server->getSession()->get('public_link_authenticated') === (string) $linkItem['id']) { |
|
1814
|
1814
|
return true; |
|
1815
|
1815
|
} |
|
1816
|
1816
|
|
|
@@ -1912,7 +1912,7 @@ discard block |
|
|
block discarded – undo |
|
1912
|
1912
|
* @param array $parameters additional format parameters |
|
1913
|
1913
|
* @return array format result |
|
1914
|
1914
|
*/ |
|
1915
|
|
- private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) { |
|
|
1915
|
+ private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE, $parameters = null) { |
|
1916
|
1916
|
if ($format === self::FORMAT_NONE) { |
|
1917
|
1917
|
return $items; |
|
1918
|
1918
|
} else if ($format === self::FORMAT_STATUSES) { |
|
@@ -1969,13 +1969,13 @@ discard block |
|
|
block discarded – undo |
|
1969
|
1969
|
$try = 0; |
|
1970
|
1970
|
$discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class); |
|
1971
|
1971
|
while ($result['success'] === false && $try < 2) { |
|
1972
|
|
- $federationEndpoints = $discoveryService->discover($protocol . $remoteDomain, 'FEDERATED_SHARING'); |
|
|
1972
|
+ $federationEndpoints = $discoveryService->discover($protocol.$remoteDomain, 'FEDERATED_SHARING'); |
|
1973
|
1973
|
$endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
|
1974
|
1974
|
$client = \OC::$server->getHTTPClientService()->newClient(); |
|
1975
|
1975
|
|
|
1976
|
1976
|
try { |
|
1977
|
1977
|
$response = $client->post( |
|
1978
|
|
- $protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, |
|
|
1978
|
+ $protocol.$remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT, |
|
1979
|
1979
|
[ |
|
1980
|
1980
|
'body' => $fields, |
|
1981
|
1981
|
'connect_timeout' => 10, |
|
@@ -2066,7 +2066,7 @@ discard block |
|
|
block discarded – undo |
|
2066
|
2066
|
* @return int |
|
2067
|
2067
|
*/ |
|
2068
|
2068
|
public static function getExpireInterval() { |
|
2069
|
|
- return (int)\OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
|
2069
|
+ return (int) \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
2070
|
2070
|
} |
|
2071
|
2071
|
|
|
2072
|
2072
|
/** |