Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
edf8ce32cf
commit
caff1023ea
|
@ -91,5 +91,4 @@ class AccessibilityProvider {
|
|||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,7 +107,6 @@ class ConfigController extends OCSController {
|
|||
*/
|
||||
public function setConfig(string $key, $value): DataResponse {
|
||||
if ($key === 'theme' || $key === 'font' || $key === 'highcontrast') {
|
||||
|
||||
if ($value === false || $value === '') {
|
||||
throw new OCSBadRequestException('Invalid value: ' . $value);
|
||||
}
|
||||
|
@ -142,7 +141,6 @@ class ConfigController extends OCSController {
|
|||
*/
|
||||
public function deleteConfig(string $key): DataResponse {
|
||||
if ($key === 'theme' || $key === 'font' || $key === 'highcontrast') {
|
||||
|
||||
$this->config->deleteUserValue($this->userId, $this->appName, $key);
|
||||
$userValues = $this->config->getUserKeys($this->userId, $this->appName);
|
||||
|
||||
|
@ -156,5 +154,4 @@ class ConfigController extends OCSController {
|
|||
|
||||
throw new OCSBadRequestException('Invalid key: ' . $key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,5 +86,4 @@ class RepairUserConfig implements IRepairStep {
|
|||
});
|
||||
$output->finishProgress();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -53,8 +53,8 @@ class Action {
|
|||
array $params,
|
||||
array $elements,
|
||||
bool $obfuscateParameters = false) {
|
||||
foreach($elements as $element) {
|
||||
if(!isset($params[$element])) {
|
||||
foreach ($elements as $element) {
|
||||
if (!isset($params[$element])) {
|
||||
if ($obfuscateParameters) {
|
||||
$this->logger->critical(
|
||||
'$params["'.$element.'"] was missing.',
|
||||
|
@ -74,8 +74,8 @@ class Action {
|
|||
}
|
||||
|
||||
$replaceArray = [];
|
||||
foreach($elements as $element) {
|
||||
if($params[$element] instanceof \DateTime) {
|
||||
foreach ($elements as $element) {
|
||||
if ($params[$element] instanceof \DateTime) {
|
||||
$params[$element] = $params[$element]->format('Y-m-d H:i:s');
|
||||
}
|
||||
$replaceArray[] = $params[$element];
|
||||
|
|
|
@ -43,7 +43,7 @@ class Sharing extends Action {
|
|||
* @param array $params
|
||||
*/
|
||||
public function shared(array $params) {
|
||||
if($params['shareType'] === Share::SHARE_TYPE_LINK) {
|
||||
if ($params['shareType'] === Share::SHARE_TYPE_LINK) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been shared via link with permissions "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -55,7 +55,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_USER) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_USER) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been shared to the user "%s" with permissions "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -68,7 +68,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_GROUP) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been shared to the group "%s" with permissions "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -81,7 +81,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_ROOM) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_ROOM) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been shared to the room "%s" with permissions "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -94,7 +94,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_EMAIL) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_EMAIL) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been shared to the email recipient "%s" with permissions "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -107,7 +107,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_CIRCLE) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_CIRCLE) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been shared to the circle "%s" with permissions "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -120,7 +120,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_REMOTE) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been shared to the remote user "%s" with permissions "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -133,7 +133,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE_GROUP) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_REMOTE_GROUP) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been shared to the remote group "%s" with permissions "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -155,7 +155,7 @@ class Sharing extends Action {
|
|||
* @param array $params
|
||||
*/
|
||||
public function unshare(array $params) {
|
||||
if($params['shareType'] === Share::SHARE_TYPE_LINK) {
|
||||
if ($params['shareType'] === Share::SHARE_TYPE_LINK) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been unshared (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -166,7 +166,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_USER) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_USER) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been unshared from the user "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -178,7 +178,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_GROUP) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been unshared from the group "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -190,7 +190,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_ROOM) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_ROOM) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been unshared from the room "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -202,7 +202,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_EMAIL) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_EMAIL) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been unshared from the email recipient "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -214,7 +214,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_CIRCLE) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_CIRCLE) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been unshared from the circle "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -226,7 +226,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_REMOTE) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been unshared from the remote user "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
@ -238,7 +238,7 @@ class Sharing extends Action {
|
|||
'id',
|
||||
]
|
||||
);
|
||||
} elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE_GROUP) {
|
||||
} elseif ($params['shareType'] === Share::SHARE_TYPE_REMOTE_GROUP) {
|
||||
$this->log(
|
||||
'The %s "%s" with ID "%s" has been unshared from the remote group "%s" (Share ID: %s)',
|
||||
$params,
|
||||
|
|
|
@ -29,7 +29,6 @@ declare(strict_types=1);
|
|||
namespace OCA\AdminAudit\Actions;
|
||||
|
||||
class Trashbin extends Action {
|
||||
|
||||
public function delete(array $params) {
|
||||
$this->log('File "%s" deleted from trash bin.',
|
||||
['path' => $params['path']], ['path']
|
||||
|
@ -41,5 +40,4 @@ class Trashbin extends Action {
|
|||
['path' => $params['filePath']], ['path']
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ class UserManagement extends Action {
|
|||
* @param array $params
|
||||
*/
|
||||
public function change(array $params) {
|
||||
switch($params['feature']) {
|
||||
switch ($params['feature']) {
|
||||
case 'enabled':
|
||||
$this->log(
|
||||
$params['value'] === true
|
||||
|
@ -130,7 +130,7 @@ class UserManagement extends Action {
|
|||
* @param IUser $user
|
||||
*/
|
||||
public function setPassword(IUser $user) {
|
||||
if($user->getBackendClassName() === 'Database') {
|
||||
if ($user->getBackendClassName() === 'Database') {
|
||||
$this->log(
|
||||
'Password of user "%s" has been changed',
|
||||
[
|
||||
|
|
|
@ -29,7 +29,6 @@ declare(strict_types=1);
|
|||
namespace OCA\AdminAudit\Actions;
|
||||
|
||||
class Versions extends Action {
|
||||
|
||||
public function rollback(array $params) {
|
||||
$this->log('Version "%s" of "%s" was restored.',
|
||||
[
|
||||
|
@ -46,5 +45,4 @@ class Versions extends Action {
|
|||
['path']
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -74,12 +74,11 @@ class Application extends App {
|
|||
|
||||
$default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log';
|
||||
$logFile = $config->getAppValue('admin_audit', 'logfile', $default);
|
||||
if($logFile === null) {
|
||||
if ($logFile === null) {
|
||||
$this->logger = $c->getLogger();
|
||||
return;
|
||||
}
|
||||
$this->logger = $c->getLogFactory()->getCustomLogger($logFile);
|
||||
|
||||
}
|
||||
|
||||
public function register() {
|
||||
|
@ -152,7 +151,6 @@ class Application extends App {
|
|||
}
|
||||
|
||||
protected function appHooks() {
|
||||
|
||||
$eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher();
|
||||
$eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function (ManagerEvent $event) {
|
||||
$appActions = new AppManagement($this->logger);
|
||||
|
@ -166,7 +164,6 @@ class Application extends App {
|
|||
$appActions = new AppManagement($this->logger);
|
||||
$appActions->disableApp($event->getAppID());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected function consoleHooks() {
|
||||
|
|
|
@ -38,14 +38,14 @@ class Rotate extends TimedJob {
|
|||
$default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/audit.log';
|
||||
$this->filePath = $config->getAppValue('admin_audit', 'logfile', $default);
|
||||
|
||||
if($this->filePath === '') {
|
||||
if ($this->filePath === '') {
|
||||
// default log file, nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
$this->maxSize = $config->getSystemValue('log_rotate_size', 100 * 1024 * 1024);
|
||||
|
||||
if($this->shouldRotateBySize()) {
|
||||
if ($this->shouldRotateBySize()) {
|
||||
$this->rotate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,5 +73,4 @@ class SecurityTest extends TestCase {
|
|||
|
||||
$this->security->twofactorSuccess($this->user, ['provider' => 'myprovider']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ use OCA\CloudFederationAPI\Capabilities;
|
|||
use OCP\AppFramework\App;
|
||||
|
||||
class Application extends App {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct('cloud_federation_api');
|
||||
|
||||
|
|
|
@ -55,5 +55,4 @@ class Config {
|
|||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ class RequestHandlerController extends Controller {
|
|||
}
|
||||
|
||||
if ($shareType === 'group') {
|
||||
if(!$this->groupManager->groupExists($shareWith)) {
|
||||
if (!$this->groupManager->groupExists($shareWith)) {
|
||||
return new JSONResponse(
|
||||
['message' => 'Group "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()],
|
||||
Http::STATUS_BAD_REQUEST
|
||||
|
@ -208,14 +208,13 @@ class RequestHandlerController extends Controller {
|
|||
|
||||
$user = $this->userManager->get($shareWith);
|
||||
$recipientDisplayName = '';
|
||||
if($user) {
|
||||
if ($user) {
|
||||
$recipientDisplayName = $user->getDisplayName();
|
||||
}
|
||||
|
||||
return new JSONResponse(
|
||||
['recipientDisplayName' => $recipientDisplayName],
|
||||
Http::STATUS_CREATED);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -267,8 +266,7 @@ class RequestHandlerController extends Controller {
|
|||
return new JSONResponse($e->getReturnMessage(), Http::STATUS_BAD_REQUEST);
|
||||
} catch (AuthenticationFailedException $e) {
|
||||
return new JSONResponse(["message" => "RESOURCE_NOT_FOUND"], Http::STATUS_FORBIDDEN);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
return new JSONResponse(
|
||||
['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()],
|
||||
Http::STATUS_BAD_REQUEST
|
||||
|
@ -276,7 +274,6 @@ class RequestHandlerController extends Controller {
|
|||
}
|
||||
|
||||
return new JSONResponse($result,Http::STATUS_CREATED);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -297,5 +294,4 @@ class RequestHandlerController extends Controller {
|
|||
|
||||
return $uid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ use OCP\EventDispatcher\IEventDispatcher;
|
|||
use OCP\Util;
|
||||
|
||||
class Application extends App {
|
||||
|
||||
const APP_ID = 'comments';
|
||||
|
||||
public function __construct(array $urlParams = []) {
|
||||
|
|
|
@ -48,12 +48,12 @@ class CommentersSorter implements ISorter {
|
|||
*/
|
||||
public function sort(array &$sortArray, array $context) {
|
||||
$commenters = $this->retrieveCommentsInformation($context['itemType'], $context['itemId']);
|
||||
if(count($commenters) === 0) {
|
||||
if (count($commenters) === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($sortArray as $type => &$byType) {
|
||||
if(!isset($commenters[$type])) {
|
||||
if (!isset($commenters[$type])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ class CommentersSorter implements ISorter {
|
|||
|
||||
usort($workArray, function ($a, $b) use ($commenters, $type) {
|
||||
$r = $this->compare($a[1], $b[1], $commenters[$type]);
|
||||
if($r === 0) {
|
||||
if ($r === 0) {
|
||||
$r = $a[0] - $b[0];
|
||||
}
|
||||
return $r;
|
||||
|
@ -84,16 +84,16 @@ class CommentersSorter implements ISorter {
|
|||
*/
|
||||
protected function retrieveCommentsInformation($type, $id) {
|
||||
$comments = $this->commentsManager->getForObject($type, $id);
|
||||
if(count($comments) === 0) {
|
||||
if (count($comments) === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$actors = [];
|
||||
foreach ($comments as $comment) {
|
||||
if(!isset($actors[$comment->getActorType()])) {
|
||||
if (!isset($actors[$comment->getActorType()])) {
|
||||
$actors[$comment->getActorType()] = [];
|
||||
}
|
||||
if(!isset($actors[$comment->getActorType()][$comment->getActorId()])) {
|
||||
if (!isset($actors[$comment->getActorType()][$comment->getActorId()])) {
|
||||
$actors[$comment->getActorType()][$comment->getActorId()] = 1;
|
||||
} else {
|
||||
$actors[$comment->getActorType()][$comment->getActorId()]++;
|
||||
|
|
|
@ -108,7 +108,7 @@ class Notifications extends Controller {
|
|||
|
||||
try {
|
||||
$comment = $this->commentsManager->get($id);
|
||||
if($comment->getObjectType() !== 'files') {
|
||||
if ($comment->getObjectType() !== 'files') {
|
||||
return new NotFoundResponse();
|
||||
}
|
||||
$userFolder = $this->rootFolder->getUserFolder($currentUser->getUID());
|
||||
|
|
|
@ -49,13 +49,13 @@ class EventHandler implements ICommentsEventHandler {
|
|||
* @param CommentsEvent $event
|
||||
*/
|
||||
public function handle(CommentsEvent $event) {
|
||||
if($event->getComment()->getObjectType() !== 'files') {
|
||||
if ($event->getComment()->getObjectType() !== 'files') {
|
||||
// this is a 'files'-specific Handler
|
||||
return;
|
||||
}
|
||||
|
||||
$eventType = $event->getEvent();
|
||||
if($eventType === CommentsEvent::EVENT_ADD
|
||||
if ($eventType === CommentsEvent::EVENT_ADD
|
||||
) {
|
||||
$this->notificationHandler($event);
|
||||
$this->activityHandler($event);
|
||||
|
@ -67,7 +67,7 @@ class EventHandler implements ICommentsEventHandler {
|
|||
CommentsEvent::EVENT_UPDATE,
|
||||
CommentsEvent::EVENT_DELETE,
|
||||
];
|
||||
if(in_array($eventType, $applicableEvents)) {
|
||||
if (in_array($eventType, $applicableEvents)) {
|
||||
$this->notificationHandler($event);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -43,5 +43,4 @@ class LoadAdditionalScripts implements IEventListener {
|
|||
// we properly split it between files list and sidebar
|
||||
Util::addScript(Application::APP_ID, 'comments');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,5 +42,4 @@ class LoadSidebarScripts implements IEventListener {
|
|||
// we properly split it between files list and sidebar
|
||||
Util::addScript(Application::APP_ID, 'comments');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ class Listener {
|
|||
IManager $notificationManager,
|
||||
IUserManager $userManager
|
||||
) {
|
||||
|
||||
$this->notificationManager = $notificationManager;
|
||||
$this->userManager = $userManager;
|
||||
}
|
||||
|
@ -57,15 +56,15 @@ class Listener {
|
|||
$comment = $event->getComment();
|
||||
|
||||
$mentions = $this->extractMentions($comment->getMentions());
|
||||
if(empty($mentions)) {
|
||||
if (empty($mentions)) {
|
||||
// no one to notify
|
||||
return;
|
||||
}
|
||||
|
||||
$notification = $this->instantiateNotification($comment);
|
||||
|
||||
foreach($mentions as $uid) {
|
||||
if(($comment->getActorType() === 'users' && $uid === $comment->getActorId())
|
||||
foreach ($mentions as $uid) {
|
||||
if (($comment->getActorType() === 'users' && $uid === $comment->getActorId())
|
||||
|| !$this->userManager->userExists($uid)
|
||||
) {
|
||||
// do not notify unknown users or yourself
|
||||
|
@ -73,9 +72,8 @@ class Listener {
|
|||
}
|
||||
|
||||
$notification->setUser($uid);
|
||||
if($event->getEvent() === CommentsEvent::EVENT_DELETE
|
||||
|| $event->getEvent() === CommentsEvent::EVENT_PRE_UPDATE)
|
||||
{
|
||||
if ($event->getEvent() === CommentsEvent::EVENT_DELETE
|
||||
|| $event->getEvent() === CommentsEvent::EVENT_PRE_UPDATE) {
|
||||
$this->notificationManager->markProcessed($notification);
|
||||
} else {
|
||||
$this->notificationManager->notify($notification);
|
||||
|
@ -107,12 +105,12 @@ class Listener {
|
|||
* @return string[] containing the mentions, e.g. ['alice', 'bob']
|
||||
*/
|
||||
public function extractMentions(array $mentions) {
|
||||
if(empty($mentions)) {
|
||||
if (empty($mentions)) {
|
||||
return [];
|
||||
}
|
||||
$uids = [];
|
||||
foreach($mentions as $mention) {
|
||||
if($mention['type'] === 'user') {
|
||||
foreach ($mentions as $mention) {
|
||||
if ($mention['type'] === 'user') {
|
||||
$uids[] = $mention['id'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,12 +96,12 @@ class Notifier implements INotifier {
|
|||
* @since 9.0.0
|
||||
*/
|
||||
public function prepare(INotification $notification, string $languageCode): INotification {
|
||||
if($notification->getApp() !== 'comments') {
|
||||
if ($notification->getApp() !== 'comments') {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
try {
|
||||
$comment = $this->commentsManager->get($notification->getObjectId());
|
||||
} catch(NotFoundException $e) {
|
||||
} catch (NotFoundException $e) {
|
||||
// needs to be converted to InvalidArgumentException, otherwise none Notifications will be shown at all
|
||||
throw new \InvalidArgumentException('Comment not found', 0, $e);
|
||||
}
|
||||
|
@ -118,12 +118,12 @@ class Notifier implements INotifier {
|
|||
switch ($notification->getSubject()) {
|
||||
case 'mention':
|
||||
$parameters = $notification->getSubjectParameters();
|
||||
if($parameters[0] !== 'files') {
|
||||
if ($parameters[0] !== 'files') {
|
||||
throw new \InvalidArgumentException('Unsupported comment object');
|
||||
}
|
||||
$userFolder = $this->rootFolder->getUserFolder($notification->getUser());
|
||||
$nodes = $userFolder->getById((int)$parameters[1]);
|
||||
if(empty($nodes)) {
|
||||
if (empty($nodes)) {
|
||||
throw new AlreadyProcessedException();
|
||||
}
|
||||
$node = $nodes[0];
|
||||
|
|
|
@ -29,7 +29,6 @@ use OCP\Files\NotFoundException;
|
|||
use OCP\Search\Result as BaseResult;
|
||||
|
||||
class Result extends BaseResult {
|
||||
|
||||
public $type = 'comment';
|
||||
public $comment;
|
||||
public $authorId;
|
||||
|
@ -108,5 +107,4 @@ class Result extends BaseResult {
|
|||
|
||||
return $prefix . mb_substr($message, $start, $end - $start) . $suffix;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ class ApplicationTest extends TestCase {
|
|||
Notifier::class,
|
||||
];
|
||||
|
||||
foreach($services as $service) {
|
||||
foreach ($services as $service) {
|
||||
$s = $c->query($service);
|
||||
$this->assertInstanceOf($service, $s);
|
||||
}
|
||||
|
|
|
@ -49,9 +49,9 @@ class CommentersSorterTest extends TestCase {
|
|||
*/
|
||||
public function testSort($data) {
|
||||
$commentMocks = [];
|
||||
foreach($data['actors'] as $actorType => $actors) {
|
||||
foreach ($data['actors'] as $actorType => $actors) {
|
||||
foreach ($actors as $actorId => $noOfComments) {
|
||||
for($i=0;$i<$noOfComments;$i++) {
|
||||
for ($i=0;$i<$noOfComments;$i++) {
|
||||
$mock = $this->createMock(IComment::class);
|
||||
$mock->expects($this->atLeastOnce())
|
||||
->method('getActorType')
|
||||
|
|
|
@ -116,5 +116,4 @@ class EventHandlerTest extends TestCase {
|
|||
|
||||
$this->eventHandler->handle($event);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -616,5 +616,4 @@ class NotifierTest extends TestCase {
|
|||
|
||||
$this->notifier->prepare($this->notification, $this->lc);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ use Sabre\DAVACL\ACLTrait;
|
|||
use Sabre\DAVACL\IACL;
|
||||
|
||||
class AddressBook extends ExternalAddressBook implements IACL {
|
||||
|
||||
public const URI = 'recent';
|
||||
|
||||
use ACLTrait;
|
||||
|
@ -174,5 +173,4 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
|||
list(, $uid) = \Sabre\Uri\split($this->principalUri);
|
||||
return $uid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,5 +77,4 @@ class AddressBookProvider implements IAddressBookProvider {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ use OCP\Contacts\Events\ContactInteractedWithEvent;
|
|||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
|
||||
class Application extends App {
|
||||
|
||||
public const APP_ID = 'contactsinteraction';
|
||||
|
||||
public function __construct() {
|
||||
|
@ -43,5 +42,4 @@ class Application extends App {
|
|||
private function registerListeners(IEventDispatcher $dispatcher): void {
|
||||
$dispatcher->addServiceListener(ContactInteractedWithEvent::class, ContactInteractionListener::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,5 +48,4 @@ class CleanupJob extends TimedJob {
|
|||
$time->modify('-7days');
|
||||
$this->mapper->cleanUp($time->getTimestamp());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ use Sabre\DAVACL\ACLTrait;
|
|||
use Sabre\DAVACL\IACL;
|
||||
|
||||
class Card implements ICard, IACL {
|
||||
|
||||
use ACLTrait;
|
||||
|
||||
/** @var RecentContact */
|
||||
|
@ -133,5 +132,4 @@ class Card implements ICard, IACL {
|
|||
function getLastModified(): ?int {
|
||||
return $this->contact->getLastContact();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -88,5 +88,4 @@ class CardSearchDao {
|
|||
|
||||
return $card;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,5 +69,4 @@ class RecentContact extends Entity {
|
|||
$this->addType('card', 'string');
|
||||
$this->addType('lastContact', 'int');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ use OCP\IDBConnection;
|
|||
use OCP\IUser;
|
||||
|
||||
class RecentContactMapper extends QBMapper {
|
||||
|
||||
public const TABLE_NAME = 'recent_contact';
|
||||
|
||||
public function __construct(IDBConnection $db) {
|
||||
|
@ -114,5 +113,4 @@ class RecentContactMapper extends QBMapper {
|
|||
|
||||
$delete->execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -167,5 +167,4 @@ class ContactInteractionListener implements IEventListener {
|
|||
|
||||
return (new VCard($props))->serialize();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,5 +89,4 @@ class Version010000Date20200304152605 extends SimpleMigrationStep {
|
|||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ $eventHandler = function () use ($app) {
|
|||
$job = $app->getContainer()->query(\OCA\DAV\BackgroundJob\UpdateCalendarResourcesRoomsBackgroundJob::class);
|
||||
$job->run([]);
|
||||
$app->getContainer()->getServer()->getJobList()->setLastRun($job);
|
||||
} catch(\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
$app->getContainer()->getServer()->getLogger()->logException($ex);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -65,7 +65,7 @@ $size = filesize($file);
|
|||
$stream = fopen($file, 'r');
|
||||
|
||||
$index = 0;
|
||||
while(!feof($stream)) {
|
||||
while (!feof($stream)) {
|
||||
request($client, 'PUT', "$uploadUrl/$index", fread($stream, $chunkSize));
|
||||
$index++;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ use OCP\IUser;
|
|||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
class Application extends App {
|
||||
|
||||
const APP_ID = 'dav';
|
||||
|
||||
/**
|
||||
|
@ -265,9 +264,8 @@ class Application extends App {
|
|||
$notificationProviderManager->registerProvider(AudioProvider::class);
|
||||
$notificationProviderManager->registerProvider(EmailProvider::class);
|
||||
$notificationProviderManager->registerProvider(PushProvider::class);
|
||||
} catch(\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
$this->getContainer()->getServer()->getLogger()->logException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -303,5 +303,4 @@ class PluginManager {
|
|||
$this->calendarPlugins[] = $instantiatedCalendarPlugin;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class AvatarHome implements ICollection {
|
|||
return [
|
||||
$this->getChild('96.jpeg')
|
||||
];
|
||||
} catch(NotFound $exception) {
|
||||
} catch (NotFound $exception) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +116,4 @@ class AvatarHome implements ICollection {
|
|||
public function getLastModified() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -93,6 +93,5 @@ class AvatarNode extends File {
|
|||
return (int)$timestamp;
|
||||
}
|
||||
return $timestamp;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,5 +47,4 @@ class RootCollection extends AbstractPrincipalCollection {
|
|||
public function getName() {
|
||||
return 'avatars';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class BuildReminderIndexBackgroundJob extends QueuedJob {
|
|||
->orderBy('id', 'ASC');
|
||||
|
||||
$stmt = $query->execute();
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$offset = $row['id'];
|
||||
if (is_resource($row['calendardata'])) {
|
||||
$row['calendardata'] = stream_get_contents($row['calendardata']);
|
||||
|
@ -126,7 +126,7 @@ class BuildReminderIndexBackgroundJob extends QueuedJob {
|
|||
|
||||
try {
|
||||
$this->reminderService->onTouchCalendarObject('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', $row);
|
||||
} catch(\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
$this->logger->logException($ex);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,5 +48,4 @@ class CleanupDirectLinksJob extends TimedJob {
|
|||
// Delete all shares expired 24 hours ago
|
||||
$this->mapper->deleteExpired($this->timeFactory->getTime() - 60*60*24);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class RefreshWebcalJob extends Job {
|
|||
try {
|
||||
/** @var DateInterval $dateInterval */
|
||||
$dateInterval = DateTimeParser::parseDuration($refreshRate);
|
||||
} catch(InvalidDataException $ex) {
|
||||
} catch (InvalidDataException $ex) {
|
||||
$this->logger->logException($ex);
|
||||
$this->logger->warning("Subscription $subscriptionId could not be refreshed, refreshrate in database is invalid");
|
||||
return;
|
||||
|
@ -142,7 +142,7 @@ class RefreshWebcalJob extends Job {
|
|||
RefreshWebcalService::STRIP_TODOS,
|
||||
];
|
||||
|
||||
foreach($forceInt as $column) {
|
||||
foreach ($forceInt as $column) {
|
||||
if (isset($row[$column])) {
|
||||
$row[$column] = (int) $row[$column];
|
||||
}
|
||||
|
|
|
@ -64,5 +64,4 @@ class RegisterRegenerateBirthdayCalendars extends QueuedJob {
|
|||
]);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
string $principalPrefix):void {
|
||||
$backends = $backendManager->getBackends();
|
||||
|
||||
foreach($backends as $backend) {
|
||||
foreach ($backends as $backend) {
|
||||
$backendId = $backend->getBackendIdentifier();
|
||||
|
||||
try {
|
||||
|
@ -115,7 +115,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
} else {
|
||||
$list = $backend->listAllRooms();
|
||||
}
|
||||
} catch(BackendTemporarilyUnavailableException $ex) {
|
||||
} catch (BackendTemporarilyUnavailableException $ex) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
$deletedIds = array_diff($cachedList, $list);
|
||||
$editedIds = array_intersect($list, $cachedList);
|
||||
|
||||
foreach($newIds as $newId) {
|
||||
foreach ($newIds as $newId) {
|
||||
try {
|
||||
if ($backend instanceof IResourceBackend) {
|
||||
$resource = $backend->getResource($newId);
|
||||
|
@ -136,7 +136,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
if ($resource instanceof IMetadataProvider) {
|
||||
$metadata = $this->getAllMetadataOfBackend($resource);
|
||||
}
|
||||
} catch(BackendTemporarilyUnavailableException $ex) {
|
||||
} catch (BackendTemporarilyUnavailableException $ex) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
// when an event is actually scheduled with this resource / room
|
||||
}
|
||||
|
||||
foreach($deletedIds as $deletedId) {
|
||||
foreach ($deletedIds as $deletedId) {
|
||||
$id = $this->getIdForBackendAndResource($dbTable, $backendId, $deletedId);
|
||||
$this->deleteFromCache($dbTable, $id);
|
||||
$this->deleteMetadataFromCache($dbTableMetadata, $foreignKey, $id);
|
||||
|
@ -155,7 +155,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
$this->deleteCalendarDataForResource($principalPrefix, $principalName);
|
||||
}
|
||||
|
||||
foreach($editedIds as $editedId) {
|
||||
foreach ($editedIds as $editedId) {
|
||||
$id = $this->getIdForBackendAndResource($dbTable, $backendId, $editedId);
|
||||
|
||||
try {
|
||||
|
@ -169,7 +169,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
if ($resource instanceof IMetadataProvider) {
|
||||
$metadata = $this->getAllMetadataOfBackend($resource);
|
||||
}
|
||||
} catch(BackendTemporarilyUnavailableException $ex) {
|
||||
} catch (BackendTemporarilyUnavailableException $ex) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
string $foreignKey,
|
||||
int $foreignId,
|
||||
array $metadata):void {
|
||||
foreach($metadata as $key => $value) {
|
||||
foreach ($metadata as $key => $value) {
|
||||
$query = $this->dbConnection->getQueryBuilder();
|
||||
$query->insert($table)
|
||||
->values([
|
||||
|
@ -308,7 +308,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
->execute();
|
||||
}
|
||||
|
||||
foreach($deletedMetadata as $key => $value) {
|
||||
foreach ($deletedMetadata as $key => $value) {
|
||||
$query = $this->dbConnection->getQueryBuilder();
|
||||
$query->delete($dbTable)
|
||||
->where($query->expr()->eq($foreignKey, $query->createNamedParameter($id)))
|
||||
|
@ -317,7 +317,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
}
|
||||
|
||||
$existingKeys = array_keys(array_intersect_key($metadata, $cachedMetadata));
|
||||
foreach($existingKeys as $existingKey) {
|
||||
foreach ($existingKeys as $existingKey) {
|
||||
if ($metadata[$existingKey] !== $cachedMetadata[$existingKey]) {
|
||||
$query = $this->dbConnection->getQueryBuilder();
|
||||
$query->update($dbTable)
|
||||
|
@ -352,7 +352,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
|
||||
$keys = $resource->getAllAvailableMetadataKeys();
|
||||
$metadata = [];
|
||||
foreach($keys as $key) {
|
||||
foreach ($keys as $key) {
|
||||
$metadata[$key] = $resource->getMetadataForKey($key);
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
|||
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
$metadata = [];
|
||||
foreach($rows as $row) {
|
||||
foreach ($rows as $row) {
|
||||
$metadata[$row['key']] = $row['value'];
|
||||
}
|
||||
|
||||
|
|
|
@ -86,5 +86,4 @@ class UploadCleanup extends TimedJob {
|
|||
$this->jobList->remove(self::class, $argument);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -469,7 +469,7 @@ class Backend {
|
|||
protected function getObjectNameAndType(array $objectData) {
|
||||
$vObject = Reader::read($objectData['calendardata']);
|
||||
$component = $componentType = null;
|
||||
foreach($vObject->getComponents() as $component) {
|
||||
foreach ($vObject->getComponents() as $component) {
|
||||
if (in_array($component->name, ['VEVENT', 'VTODO'])) {
|
||||
$componentType = $component->name;
|
||||
break;
|
||||
|
|
|
@ -36,7 +36,6 @@ use OCP\IUserManager;
|
|||
use OCP\L10N\IFactory;
|
||||
|
||||
class Calendar extends Base {
|
||||
|
||||
const SUBJECT_ADD = 'calendar_add';
|
||||
const SUBJECT_UPDATE = 'calendar_update';
|
||||
const SUBJECT_DELETE = 'calendar_delete';
|
||||
|
@ -111,12 +110,10 @@ class Calendar extends Base {
|
|||
$subject = $this->l->t('{actor} updated calendar {calendar}');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_UPDATE . '_self') {
|
||||
$subject = $this->l->t('You updated calendar {calendar}');
|
||||
|
||||
} elseif ($event->getSubject() === self::SUBJECT_PUBLISH . '_self') {
|
||||
$subject = $this->l->t('You shared calendar {calendar} as public link');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_UNPUBLISH . '_self') {
|
||||
$subject = $this->l->t('You removed public link for calendar {calendar}');
|
||||
|
||||
} elseif ($event->getSubject() === self::SUBJECT_SHARE_USER) {
|
||||
$subject = $this->l->t('{actor} shared calendar {calendar} with you');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_SHARE_USER . '_you') {
|
||||
|
@ -131,7 +128,6 @@ class Calendar extends Base {
|
|||
$subject = $this->l->t('{actor} unshared calendar {calendar} from {user}');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_self') {
|
||||
$subject = $this->l->t('{actor} unshared calendar {calendar} from themselves');
|
||||
|
||||
} elseif ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_you') {
|
||||
$subject = $this->l->t('You shared calendar {calendar} with group {group}');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_by') {
|
||||
|
|
|
@ -34,7 +34,6 @@ use OCP\IUserManager;
|
|||
use OCP\L10N\IFactory;
|
||||
|
||||
class Event extends Base {
|
||||
|
||||
const SUBJECT_OBJECT_ADD = 'object_add';
|
||||
const SUBJECT_OBJECT_UPDATE = 'object_update';
|
||||
const SUBJECT_OBJECT_DELETE = 'object_delete';
|
||||
|
|
|
@ -60,7 +60,6 @@ class Todo extends Event {
|
|||
$subject = $this->l->t('{actor} updated todo {todo} in list {calendar}');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') {
|
||||
$subject = $this->l->t('You updated todo {todo} in list {calendar}');
|
||||
|
||||
} elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') {
|
||||
$subject = $this->l->t('{actor} solved todo {todo} in list {calendar}');
|
||||
} elseif ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') {
|
||||
|
|
|
@ -49,7 +49,6 @@ use Sabre\VObject\Reader;
|
|||
* @package OCA\DAV\CalDAV
|
||||
*/
|
||||
class BirthdayService {
|
||||
|
||||
const BIRTHDAY_CALENDAR_URI = 'contact_birthdays';
|
||||
|
||||
/** @var GroupPrincipalBackend */
|
||||
|
@ -298,7 +297,7 @@ class BirthdayService {
|
|||
$calendar = $this->calDavBackEnd->getCalendarByUri($principal, self::BIRTHDAY_CALENDAR_URI);
|
||||
$calendarObjects = $this->calDavBackEnd->getCalendarObjects($calendar['id'], CalDavBackend::CALENDAR_TYPE_CALENDAR);
|
||||
|
||||
foreach($calendarObjects as $calendarObject) {
|
||||
foreach ($calendarObjects as $calendarObject) {
|
||||
$this->calDavBackEnd->deleteCalendarObject($calendar['id'], $calendarObject['uri'], CalDavBackend::CALENDAR_TYPE_CALENDAR);
|
||||
}
|
||||
}
|
||||
|
@ -311,9 +310,9 @@ class BirthdayService {
|
|||
$principal = 'principals/users/'.$user;
|
||||
$this->ensureCalendarExists($principal);
|
||||
$books = $this->cardDavBackEnd->getAddressBooksForUser($principal);
|
||||
foreach($books as $book) {
|
||||
foreach ($books as $book) {
|
||||
$cards = $this->cardDavBackEnd->getCards($book['id']);
|
||||
foreach($cards as $card) {
|
||||
foreach ($cards as $card) {
|
||||
$this->onCardChanged((int) $book['id'], $card['uri'], $card['carddata']);
|
||||
}
|
||||
}
|
||||
|
@ -455,7 +454,7 @@ class BirthdayService {
|
|||
return '';
|
||||
}
|
||||
} else {
|
||||
switch($field) {
|
||||
switch ($field) {
|
||||
case 'BDAY':
|
||||
return implode('', [
|
||||
$name,
|
||||
|
|
|
@ -136,7 +136,6 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
|
||||
$obj['acl'] = $this->getChildACL();
|
||||
return new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,7 +145,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id'], CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
|
||||
|
||||
$children = [];
|
||||
foreach($objs as $obj) {
|
||||
foreach ($objs as $obj) {
|
||||
$children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj);
|
||||
}
|
||||
|
||||
|
@ -161,7 +160,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
|
|||
$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
|
||||
|
||||
$children = [];
|
||||
foreach($objs as $obj) {
|
||||
foreach ($objs as $obj) {
|
||||
$children[] = new CachedSubscriptionObject($this->caldavBackend, $this->calendarInfo, $obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,6 @@ use Symfony\Component\EventDispatcher\GenericEvent;
|
|||
* @package OCA\DAV\CalDAV
|
||||
*/
|
||||
class CalDavBackend extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport {
|
||||
|
||||
const CALENDAR_TYPE_CALENDAR = 0;
|
||||
const CALENDAR_TYPE_SUBSCRIPTION = 1;
|
||||
|
||||
|
@ -273,8 +272,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$stmt = $query->execute();
|
||||
|
||||
$calendars = [];
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$components = [];
|
||||
if ($row['components']) {
|
||||
$components = explode(',',$row['components']);
|
||||
|
@ -291,7 +289,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint),
|
||||
];
|
||||
|
||||
foreach($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -332,7 +330,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
->execute();
|
||||
|
||||
$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
|
||||
while($row = $result->fetch()) {
|
||||
while ($row = $result->fetch()) {
|
||||
if ($row['principaluri'] === $principalUri) {
|
||||
continue;
|
||||
}
|
||||
|
@ -369,7 +367,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$readOnlyPropertyName => $readOnly,
|
||||
];
|
||||
|
||||
foreach($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -402,7 +400,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
->orderBy('calendarorder', 'ASC');
|
||||
$stmt = $query->execute();
|
||||
$calendars = [];
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$components = [];
|
||||
if ($row['components']) {
|
||||
$components = explode(',',$row['components']);
|
||||
|
@ -416,7 +414,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components),
|
||||
'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
|
||||
];
|
||||
foreach($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -471,7 +469,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
->andWhere($query->expr()->eq('s.type', $query->createNamedParameter('calendar')))
|
||||
->execute();
|
||||
|
||||
while($row = $result->fetch()) {
|
||||
while ($row = $result->fetch()) {
|
||||
list(, $name) = Uri\split($row['principaluri']);
|
||||
$row['displayname'] = $row['displayname'] . "($name)";
|
||||
$components = [];
|
||||
|
@ -491,7 +489,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
|
||||
];
|
||||
|
||||
foreach($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -557,14 +555,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC,
|
||||
];
|
||||
|
||||
foreach($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
$this->addOwnerPrincipal($calendar);
|
||||
|
||||
return $calendar;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -610,7 +607,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
|
||||
];
|
||||
|
||||
foreach($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -660,7 +657,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
|
||||
];
|
||||
|
||||
foreach($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
$calendar[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
||||
|
@ -704,7 +701,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
|
||||
];
|
||||
|
||||
foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
|
||||
if (!is_null($row[$dbName])) {
|
||||
$subscription[$xmlName] = $row[$dbName];
|
||||
}
|
||||
|
@ -753,7 +750,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent');
|
||||
}
|
||||
|
||||
foreach($this->propertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->propertyMap as $xmlName=>$dbName) {
|
||||
if (isset($properties[$xmlName])) {
|
||||
$values[$dbName] = $properties[$xmlName];
|
||||
}
|
||||
|
@ -761,7 +758,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->insert('calendars');
|
||||
foreach($values as $column => $value) {
|
||||
foreach ($values as $column => $value) {
|
||||
$query->setValue($column, $query->createNamedParameter($value));
|
||||
}
|
||||
$query->execute();
|
||||
|
@ -803,7 +800,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) {
|
||||
$newValues = [];
|
||||
foreach ($mutations as $propertyName => $propertyValue) {
|
||||
|
||||
switch ($propertyName) {
|
||||
case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp':
|
||||
$fieldName = 'transparent';
|
||||
|
@ -814,7 +810,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$newValues[$fieldName] = $propertyValue;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('calendars');
|
||||
|
@ -923,7 +918,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$stmt = $query->execute();
|
||||
|
||||
$result = [];
|
||||
foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
|
||||
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
|
||||
$result[] = [
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
|
@ -966,7 +961,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$stmt = $query->execute();
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if(!$row) {
|
||||
if (!$row) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1326,7 +1321,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$requirePostFilter = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$columns = ['uri'];
|
||||
if ($requirePostFilter) {
|
||||
|
@ -1352,13 +1346,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$stmt = $query->execute();
|
||||
|
||||
$result = [];
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if ($requirePostFilter) {
|
||||
// validateFilterForObject will parse the calendar data
|
||||
// catch parsing errors
|
||||
try {
|
||||
$matches = $this->validateFilterForObject($row, $filters);
|
||||
} catch(ParseException $ex) {
|
||||
} catch (ParseException $ex) {
|
||||
$this->logger->logException($ex, [
|
||||
'app' => 'dav',
|
||||
'message' => 'Caught parsing exception for calendar data. This usually indicates invalid calendar data. calendar-id:'.$id.' uri:'.$row['uri']
|
||||
|
@ -1400,7 +1394,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
$uriMapper = [];
|
||||
|
||||
foreach($calendars as $calendar) {
|
||||
foreach ($calendars as $calendar) {
|
||||
if ($calendar['{http://owncloud.org/ns}owner-principal'] === $principalUri) {
|
||||
$ownCalendars[] = $calendar['id'];
|
||||
} else {
|
||||
|
@ -1415,14 +1409,14 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$query = $this->db->getQueryBuilder();
|
||||
// Calendar id expressions
|
||||
$calendarExpressions = [];
|
||||
foreach($ownCalendars as $id) {
|
||||
foreach ($ownCalendars as $id) {
|
||||
$calendarExpressions[] = $query->expr()->andX(
|
||||
$query->expr()->eq('c.calendarid',
|
||||
$query->createNamedParameter($id)),
|
||||
$query->expr()->eq('c.calendartype',
|
||||
$query->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
|
||||
}
|
||||
foreach($sharedCalendars as $id) {
|
||||
foreach ($sharedCalendars as $id) {
|
||||
$calendarExpressions[] = $query->expr()->andX(
|
||||
$query->expr()->eq('c.calendarid',
|
||||
$query->createNamedParameter($id)),
|
||||
|
@ -1440,7 +1434,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
// Component expressions
|
||||
$compExpressions = [];
|
||||
foreach($filters['comps'] as $comp) {
|
||||
foreach ($filters['comps'] as $comp) {
|
||||
$compExpressions[] = $query->expr()
|
||||
->eq('c.componenttype', $query->createNamedParameter($comp));
|
||||
}
|
||||
|
@ -1459,13 +1453,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
}
|
||||
|
||||
$propParamExpressions = [];
|
||||
foreach($filters['props'] as $prop) {
|
||||
foreach ($filters['props'] as $prop) {
|
||||
$propParamExpressions[] = $query->expr()->andX(
|
||||
$query->expr()->eq('i.name', $query->createNamedParameter($prop)),
|
||||
$query->expr()->isNull('i.parameter')
|
||||
);
|
||||
}
|
||||
foreach($filters['params'] as $param) {
|
||||
foreach ($filters['params'] as $param) {
|
||||
$propParamExpressions[] = $query->expr()->andX(
|
||||
$query->expr()->eq('i.name', $query->createNamedParameter($param['property'])),
|
||||
$query->expr()->eq('i.parameter', $query->createNamedParameter($param['parameter']))
|
||||
|
@ -1497,7 +1491,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$stmt = $query->execute();
|
||||
|
||||
$result = [];
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$path = $uriMapper[$row['calendarid']] . '/' . $row['uri'];
|
||||
if (!in_array($path, $result)) {
|
||||
$result[] = $path;
|
||||
|
@ -1538,7 +1532,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
}
|
||||
|
||||
$or = $innerQuery->expr()->orX();
|
||||
foreach($searchProperties as $searchProperty) {
|
||||
foreach ($searchProperties as $searchProperty) {
|
||||
$or->add($innerQuery->expr()->eq('op.name',
|
||||
$outerQuery->createNamedParameter($searchProperty)));
|
||||
}
|
||||
|
@ -1557,7 +1551,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTime) {
|
||||
$outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence',
|
||||
$outerQuery->createNamedParameter($options['timerange']['start']->getTimeStamp())));
|
||||
|
||||
}
|
||||
if (isset($options['timerange']['end']) && $options['timerange']['end'] instanceof DateTime) {
|
||||
$outerQuery->andWhere($outerQuery->expr()->lt('firstoccurence',
|
||||
|
@ -1567,7 +1560,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
if (isset($options['types'])) {
|
||||
$or = $outerQuery->expr()->orX();
|
||||
foreach($options['types'] as $type) {
|
||||
foreach ($options['types'] as $type) {
|
||||
$or->add($outerQuery->expr()->eq('componenttype',
|
||||
$outerQuery->createNamedParameter($type)));
|
||||
}
|
||||
|
@ -1592,7 +1585,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$comps = $calendarData->getComponents();
|
||||
$objects = [];
|
||||
$timezones = [];
|
||||
foreach($comps as $comp) {
|
||||
foreach ($comps as $comp) {
|
||||
if ($comp instanceof VTimeZone) {
|
||||
$timezones[] = $comp;
|
||||
} else {
|
||||
|
@ -1629,7 +1622,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
});
|
||||
$validationRules = $comp->getValidationRules();
|
||||
|
||||
foreach($subComponents as $subComponent) {
|
||||
foreach ($subComponents as $subComponent) {
|
||||
$name = $subComponent->name;
|
||||
if (!isset($data[$name])) {
|
||||
$data[$name] = [];
|
||||
|
@ -1637,7 +1630,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$data[$name][] = $this->transformSearchData($subComponent);
|
||||
}
|
||||
|
||||
foreach($properties as $property) {
|
||||
foreach ($properties as $property) {
|
||||
$name = $property->name;
|
||||
if (!isset($validationRules[$name])) {
|
||||
$validationRules[$name] = '*';
|
||||
|
@ -1696,7 +1689,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @return string|null
|
||||
*/
|
||||
function getCalendarObjectByUID($principalUri, $uid) {
|
||||
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi')
|
||||
->from('calendarobjects', 'co')
|
||||
|
@ -1789,7 +1781,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
];
|
||||
|
||||
if ($syncToken) {
|
||||
|
||||
$query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? AND `calendartype` = ? ORDER BY `synctoken`";
|
||||
if ($limit>0) {
|
||||
$query.= " LIMIT " . (int)$limit;
|
||||
|
@ -1803,15 +1794,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
// This loop ensures that any duplicates are overwritten, only the
|
||||
// last change on a node is relevant.
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$changes[$row['uri']] = $row['operation'];
|
||||
|
||||
}
|
||||
|
||||
foreach($changes as $uri => $operation) {
|
||||
|
||||
switch($operation) {
|
||||
foreach ($changes as $uri => $operation) {
|
||||
switch ($operation) {
|
||||
case 1:
|
||||
$result['added'][] = $uri;
|
||||
break;
|
||||
|
@ -1822,7 +1810,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$result['deleted'][] = $uri;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
// No synctoken supplied, this is the initial sync.
|
||||
|
@ -1833,7 +1820,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
|
||||
}
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1885,8 +1871,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$stmt =$query->execute();
|
||||
|
||||
$subscriptions = [];
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$subscription = [
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
|
@ -1898,14 +1883,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
|
||||
];
|
||||
|
||||
foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
|
||||
if (!is_null($row[$dbName])) {
|
||||
$subscription[$xmlName] = $row[$dbName];
|
||||
}
|
||||
}
|
||||
|
||||
$subscriptions[] = $subscription;
|
||||
|
||||
}
|
||||
|
||||
return $subscriptions;
|
||||
|
@ -1923,7 +1907,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @return mixed
|
||||
*/
|
||||
function createSubscription($principalUri, $uri, array $properties) {
|
||||
|
||||
if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
|
||||
throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
|
||||
}
|
||||
|
@ -1937,7 +1920,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
$propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments'];
|
||||
|
||||
foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
|
||||
foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) {
|
||||
if (array_key_exists($xmlName, $properties)) {
|
||||
$values[$dbName] = $properties[$xmlName];
|
||||
if (in_array($dbName, $propertiesBoolean)) {
|
||||
|
@ -1994,10 +1977,9 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @suppress SqlInjectionChecker
|
||||
*/
|
||||
$propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) {
|
||||
|
||||
$newValues = [];
|
||||
|
||||
foreach($mutations as $propertyName=>$propertyValue) {
|
||||
foreach ($mutations as $propertyName=>$propertyValue) {
|
||||
if ($propertyName === '{http://calendarserver.org/ns/}source') {
|
||||
$newValues['source'] = $propertyValue->getHref();
|
||||
} else {
|
||||
|
@ -2009,7 +1991,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('calendarsubscriptions')
|
||||
->set('lastmodified', $query->createNamedParameter(time()));
|
||||
foreach($newValues as $fieldName=>$value) {
|
||||
foreach ($newValues as $fieldName=>$value) {
|
||||
$query->set($fieldName, $query->createNamedParameter($value));
|
||||
}
|
||||
$query->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId)))
|
||||
|
@ -2024,7 +2006,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
]));
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2090,7 +2071,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if(!$row) {
|
||||
if (!$row) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -2122,7 +2103,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
->execute();
|
||||
|
||||
$result = [];
|
||||
foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
|
||||
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
|
||||
$result[] = [
|
||||
'calendardata' => $row['calendardata'],
|
||||
'uri' => $row['uri'],
|
||||
|
@ -2205,7 +2186,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$stmt->execute([
|
||||
$calendarId
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2224,7 +2204,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @return array
|
||||
*/
|
||||
public function getDenormalizedData($calendarData) {
|
||||
|
||||
$vObject = Reader::read($calendarData);
|
||||
$componentType = null;
|
||||
$component = null;
|
||||
|
@ -2232,7 +2211,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$lastOccurrence = null;
|
||||
$uid = null;
|
||||
$classification = self::CLASSIFICATION_PUBLIC;
|
||||
foreach($vObject->getComponents() as $component) {
|
||||
foreach ($vObject->getComponents() as $component) {
|
||||
if ($component->name!=='VTIMEZONE') {
|
||||
$componentType = $component->name;
|
||||
$uid = (string)$component->UID;
|
||||
|
@ -2266,14 +2245,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$lastOccurrence = $maxDate->getTimestamp();
|
||||
} else {
|
||||
$end = $it->getDtEnd();
|
||||
while($it->valid() && $end < $maxDate) {
|
||||
while ($it->valid() && $end < $maxDate) {
|
||||
$end = $it->getDtEnd();
|
||||
$it->next();
|
||||
|
||||
}
|
||||
$lastOccurrence = $end->getTimestamp();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2297,7 +2274,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'uid' => $uid,
|
||||
'classification' => $classification
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2346,7 +2322,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @return string|null
|
||||
*/
|
||||
public function setPublishStatus($value, $calendar) {
|
||||
|
||||
$calendarId = $calendar->getResourceId();
|
||||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::publishCalendar', new GenericEvent(
|
||||
'\OCA\DAV\CalDAV\CalDavBackend::updateShares',
|
||||
|
@ -2490,7 +2465,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
->execute();
|
||||
|
||||
$ids = $result->fetchAll();
|
||||
foreach($ids as $id) {
|
||||
foreach ($ids as $id) {
|
||||
$this->deleteCalendar($id['id']);
|
||||
}
|
||||
}
|
||||
|
@ -2507,7 +2482,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$stmt = $query->execute();
|
||||
|
||||
$uris = [];
|
||||
foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
|
||||
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
|
||||
$uris[] = $row['uri'];
|
||||
}
|
||||
$stmt->closeCursor();
|
||||
|
@ -2528,7 +2503,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
->andWhere($query->expr()->eq('calendartype', $query->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION)))
|
||||
->execute();
|
||||
|
||||
foreach($uris as $uri) {
|
||||
foreach ($uris as $uri) {
|
||||
$this->addChange($subscriptionId, $uri, 3, self::CALENDAR_TYPE_SUBSCRIPTION);
|
||||
}
|
||||
}
|
||||
|
@ -2540,8 +2515,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
* @param string $uriOrigin
|
||||
* @param string $uriDestination
|
||||
*/
|
||||
public function moveCalendar($uriName, $uriOrigin, $uriDestination)
|
||||
{
|
||||
public function moveCalendar($uriName, $uriOrigin, $uriDestination) {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('calendars')
|
||||
->set('principaluri', $query->createNamedParameter($uriDestination))
|
||||
|
|
|
@ -280,7 +280,6 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
}
|
||||
|
||||
public function getChild($name) {
|
||||
|
||||
$obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name);
|
||||
|
||||
if (!$obj) {
|
||||
|
@ -294,11 +293,9 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
$obj['acl'] = $this->getChildACL();
|
||||
|
||||
return new CalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj);
|
||||
|
||||
}
|
||||
|
||||
public function getChildren() {
|
||||
|
||||
$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']);
|
||||
$children = [];
|
||||
foreach ($objs as $obj) {
|
||||
|
@ -309,11 +306,9 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
$children[] = new CalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj);
|
||||
}
|
||||
return $children;
|
||||
|
||||
}
|
||||
|
||||
public function getMultipleChildren(array $paths) {
|
||||
|
||||
$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths);
|
||||
$children = [];
|
||||
foreach ($objs as $obj) {
|
||||
|
@ -324,7 +319,6 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
$children[] = new CalendarObject($this->caldavBackend, $this->l10n, $this->calendarInfo, $obj);
|
||||
}
|
||||
return $children;
|
||||
|
||||
}
|
||||
|
||||
public function childExists($name) {
|
||||
|
@ -340,7 +334,6 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
}
|
||||
|
||||
public function calendarQuery(array $filters) {
|
||||
|
||||
$uris = $this->caldavBackend->calendarQuery($this->calendarInfo['id'], $filters);
|
||||
if ($this->isShared()) {
|
||||
return array_filter($uris, function ($uri) {
|
||||
|
|
|
@ -101,7 +101,7 @@ class CalendarImpl implements ICalendar {
|
|||
$permissions = $this->calendar->getACL();
|
||||
$result = 0;
|
||||
foreach ($permissions as $permission) {
|
||||
switch($permission['privilege']) {
|
||||
switch ($permission['privilege']) {
|
||||
case '{DAV:}read':
|
||||
$result |= Constants::PERMISSION_READ;
|
||||
break;
|
||||
|
|
|
@ -66,7 +66,7 @@ class CalendarManager {
|
|||
* @param array $calendars
|
||||
*/
|
||||
private function register(IManager $cm, array $calendars) {
|
||||
foreach($calendars as $calendarInfo) {
|
||||
foreach ($calendars as $calendarInfo) {
|
||||
$calendar = new Calendar($this->backend, $calendarInfo, $this->l10n, $this->config);
|
||||
$cm->registerCalendar(new CalendarImpl(
|
||||
$calendar,
|
||||
|
|
|
@ -96,19 +96,19 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject {
|
|||
private function createConfidentialObject(Component\VCalendar $vObject) {
|
||||
/** @var Component $vElement */
|
||||
$vElement = null;
|
||||
if(isset($vObject->VEVENT)) {
|
||||
if (isset($vObject->VEVENT)) {
|
||||
$vElement = $vObject->VEVENT;
|
||||
}
|
||||
if(isset($vObject->VJOURNAL)) {
|
||||
if (isset($vObject->VJOURNAL)) {
|
||||
$vElement = $vObject->VJOURNAL;
|
||||
}
|
||||
if(isset($vObject->VTODO)) {
|
||||
if (isset($vObject->VTODO)) {
|
||||
$vElement = $vObject->VTODO;
|
||||
}
|
||||
if(!is_null($vElement)) {
|
||||
if (!is_null($vElement)) {
|
||||
foreach ($vElement->children() as &$property) {
|
||||
/** @var Property $property */
|
||||
switch($property->name) {
|
||||
switch ($property->name) {
|
||||
case 'CREATED':
|
||||
case 'DTSTART':
|
||||
case 'RRULE':
|
||||
|
@ -136,7 +136,7 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject {
|
|||
private function removeVAlarms(Component\VCalendar $vObject) {
|
||||
$subcomponents = $vObject->getComponents();
|
||||
|
||||
foreach($subcomponents as $subcomponent) {
|
||||
foreach ($subcomponents as $subcomponent) {
|
||||
unset($subcomponent->VALARM);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
namespace OCA\DAV\CalDAV;
|
||||
|
||||
class CalendarRoot extends \Sabre\CalDAV\CalendarRoot {
|
||||
|
||||
function getChildForPrincipal(array $principal) {
|
||||
return new CalendarHome($this->caldavBackend, $principal);
|
||||
}
|
||||
|
|
|
@ -93,5 +93,4 @@ class ICSExportPlugin extends \Sabre\CalDAV\ICSExportPlugin {
|
|||
|
||||
return $vcalendar;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,7 +89,6 @@ abstract class ExternalCalendar implements CalDAV\ICalendar, DAV\IProperties {
|
|||
*/
|
||||
final public function createDirectory($name) {
|
||||
throw new DAV\Exception\MethodNotAllowed('Creating collections in calendar objects is not allowed');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,5 +67,4 @@ interface ICalendarProvider {
|
|||
* @return ExternalCalendar|null Calendar if it exists, null otherwise
|
||||
*/
|
||||
public function getCalendarInCalendarHome(string $principalUri, string $calendarUri): ?ExternalCalendar;
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
namespace OCA\DAV\CalDAV;
|
||||
|
||||
class Plugin extends \Sabre\CalDAV\Plugin {
|
||||
|
||||
const SYSTEM_CALENDAR_ROOT = 'system-calendars';
|
||||
|
||||
/**
|
||||
|
@ -52,5 +51,4 @@ class Plugin extends \Sabre\CalDAV\Plugin {
|
|||
return self::SYSTEM_CALENDAR_ROOT . '/calendar-rooms/' . $principalId;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,5 +39,4 @@ class Collection extends \Sabre\CalDAV\Principal\Collection {
|
|||
function getChildForPrincipal(array $principalInfo) {
|
||||
return new User($this->principalBackend, $principalInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,5 +51,4 @@ class User extends \Sabre\CalDAV\Principal\User {
|
|||
];
|
||||
return $acl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ use OCP\IDBConnection;
|
|||
* @package OCA\DAV\CalDAV\Proxy
|
||||
*/
|
||||
class ProxyMapper extends QBMapper {
|
||||
|
||||
const PERMISSION_READ = 1;
|
||||
const PERMISSION_WRITE = 2;
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ class PublicCalendarRoot extends Collection {
|
|||
$this->caldavBackend = $caldavBackend;
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -99,7 +99,7 @@ class EmailProvider extends AbstractProvider {
|
|||
$sortedByLanguage = $this->sortEMailAddressesByLanguage($emailAddresses, $fallbackLanguage);
|
||||
$organizer = $this->getOrganizerEMailAndNameFromEvent($vevent);
|
||||
|
||||
foreach($sortedByLanguage as $lang => $emailAddresses) {
|
||||
foreach ($sortedByLanguage as $lang => $emailAddresses) {
|
||||
if (!$this->hasL10NForLang($lang)) {
|
||||
$lang = $fallbackLanguage;
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ class EmailProvider extends AbstractProvider {
|
|||
string $defaultLanguage):array {
|
||||
$sortedByLanguage = [];
|
||||
|
||||
foreach($emails as $emailAddress => $parameters) {
|
||||
foreach ($emails as $emailAddress => $parameters) {
|
||||
if (isset($parameters['LANG'])) {
|
||||
$lang = $parameters['LANG'];
|
||||
} else {
|
||||
|
@ -260,7 +260,7 @@ class EmailProvider extends AbstractProvider {
|
|||
}
|
||||
|
||||
$emailAddressesOfDelegates = $delegates->getParts();
|
||||
foreach($emailAddressesOfDelegates as $addressesOfDelegate) {
|
||||
foreach ($emailAddressesOfDelegates as $addressesOfDelegate) {
|
||||
if (strcasecmp($addressesOfDelegate, 'mailto:') === 0) {
|
||||
$emailAddresses[substr($addressesOfDelegate, 7)] = [];
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ class EmailProvider extends AbstractProvider {
|
|||
private function getEMailAddressesOfAllUsersWithWriteAccessToCalendar(array $users):array {
|
||||
$emailAddresses = [];
|
||||
|
||||
foreach($users as $user) {
|
||||
foreach ($users as $user) {
|
||||
$emailAddress = $user->getEMailAddress();
|
||||
if ($emailAddress) {
|
||||
$lang = $this->getLangForUser($user);
|
||||
|
|
|
@ -39,5 +39,4 @@ class ProviderNotAvailableException extends \Exception {
|
|||
public function __construct(string $type) {
|
||||
parent::__construct("No notification provider for type $type available");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class PushProvider extends AbstractProvider {
|
|||
// Empty Notification ObjectId will be catched by OC\Notification\Notification
|
||||
$eventUUIDHash = $eventUUID ? hash('sha256', $eventUUID, false) : '';
|
||||
|
||||
foreach($users as $user) {
|
||||
foreach ($users as $user) {
|
||||
/** @var INotification $notification */
|
||||
$notification = $this->manager->createNotification();
|
||||
$notification->setApp(Application::APP_ID)
|
||||
|
|
|
@ -38,5 +38,4 @@ class NotificationTypeDoesNotExistException extends \Exception {
|
|||
public function __construct(string $type) {
|
||||
parent::__construct("Type $type is not an accepted type of notification");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ class Notifier implements INotifier {
|
|||
$this->l10n = $this->l10nFactory->get('dav', $languageCode);
|
||||
|
||||
// Handle notifier subjects
|
||||
switch($notification->getSubject()) {
|
||||
switch ($notification->getSubject()) {
|
||||
case 'calendar_reminder':
|
||||
return $this->prepareReminderNotification($notification);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ class ReminderService {
|
|||
public function processReminders():void {
|
||||
$reminders = $this->backend->getRemindersToProcess();
|
||||
|
||||
foreach($reminders as $reminder) {
|
||||
foreach ($reminders as $reminder) {
|
||||
$calendarData = is_resource($reminder['calendardata'])
|
||||
? stream_get_contents($reminder['calendardata'])
|
||||
: $reminder['calendardata'];
|
||||
|
@ -163,7 +163,7 @@ class ReminderService {
|
|||
return;
|
||||
}
|
||||
|
||||
switch($action) {
|
||||
switch ($action) {
|
||||
case '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject':
|
||||
$this->onCalendarObjectCreate($objectData);
|
||||
break;
|
||||
|
@ -206,14 +206,14 @@ class ReminderService {
|
|||
$now = $this->timeFactory->getDateTime();
|
||||
$isRecurring = $masterItem ? $this->isRecurring($masterItem) : false;
|
||||
|
||||
foreach($recurrenceExceptions as $recurrenceException) {
|
||||
foreach ($recurrenceExceptions as $recurrenceException) {
|
||||
$eventHash = $this->getEventHash($recurrenceException);
|
||||
|
||||
if (!isset($recurrenceException->VALARM)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach($recurrenceException->VALARM as $valarm) {
|
||||
foreach ($recurrenceException->VALARM as $valarm) {
|
||||
/** @var VAlarm $valarm */
|
||||
$alarmHash = $this->getAlarmHash($valarm);
|
||||
$triggerTime = $valarm->getEffectiveTriggerTime();
|
||||
|
@ -237,7 +237,7 @@ class ReminderService {
|
|||
return;
|
||||
}
|
||||
|
||||
foreach($masterItem->VALARM as $valarm) {
|
||||
foreach ($masterItem->VALARM as $valarm) {
|
||||
$masterAlarms[] = $this->getAlarmHash($valarm);
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ class ReminderService {
|
|||
return;
|
||||
}
|
||||
|
||||
while($iterator->valid() && count($processedAlarms) < count($masterAlarms)) {
|
||||
while ($iterator->valid() && count($processedAlarms) < count($masterAlarms)) {
|
||||
$event = $iterator->getEventObject();
|
||||
|
||||
// Recurrence-exceptions are handled separately, so just ignore them here
|
||||
|
@ -259,7 +259,7 @@ class ReminderService {
|
|||
continue;
|
||||
}
|
||||
|
||||
foreach($event->VALARM as $valarm) {
|
||||
foreach ($event->VALARM as $valarm) {
|
||||
/** @var VAlarm $valarm */
|
||||
$alarmHash = $this->getAlarmHash($valarm);
|
||||
if (\in_array($alarmHash, $processedAlarms, true)) {
|
||||
|
@ -365,7 +365,7 @@ class ReminderService {
|
|||
];
|
||||
|
||||
$repeat = isset($valarm->REPEAT) ? (int) $valarm->REPEAT->getValue() : 0;
|
||||
for($i = 0; $i < $repeat; $i++) {
|
||||
for ($i = 0; $i < $repeat; $i++) {
|
||||
if ($valarm->DURATION === null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ class ReminderService {
|
|||
* @param array $reminders
|
||||
*/
|
||||
private function writeRemindersToDatabase(array $reminders): void {
|
||||
foreach($reminders as $reminder) {
|
||||
foreach ($reminders as $reminder) {
|
||||
$this->backend->insertReminder(
|
||||
(int) $reminder['calendar_id'],
|
||||
(int) $reminder['object_id'],
|
||||
|
@ -422,7 +422,6 @@ class ReminderService {
|
|||
!$reminder['is_recurring'] ||
|
||||
!$reminder['is_relative'] ||
|
||||
$reminder['is_recurrence_exception']) {
|
||||
|
||||
$this->backend->removeReminder($reminder['id']);
|
||||
return;
|
||||
}
|
||||
|
@ -440,7 +439,7 @@ class ReminderService {
|
|||
return;
|
||||
}
|
||||
|
||||
while($iterator->valid()) {
|
||||
while ($iterator->valid()) {
|
||||
$event = $iterator->getEventObject();
|
||||
|
||||
// Recurrence-exceptions are handled separately, so just ignore them here
|
||||
|
@ -455,7 +454,7 @@ class ReminderService {
|
|||
continue;
|
||||
}
|
||||
|
||||
foreach($event->VALARM as $valarm) {
|
||||
foreach ($event->VALARM as $valarm) {
|
||||
/** @var VAlarm $valarm */
|
||||
$alarmHash = $this->getAlarmHash($valarm);
|
||||
if ($alarmHash !== $reminder['alarm_hash']) {
|
||||
|
@ -608,7 +607,7 @@ class ReminderService {
|
|||
|
||||
// Handle recurrence-exceptions first, because recurrence-expansion is expensive
|
||||
if ($isRecurrenceException) {
|
||||
foreach($recurrenceExceptions as $recurrenceException) {
|
||||
foreach ($recurrenceExceptions as $recurrenceException) {
|
||||
if ($this->getEffectiveRecurrenceIdOfVEvent($recurrenceException) === $recurrenceId) {
|
||||
return $recurrenceException;
|
||||
}
|
||||
|
@ -678,7 +677,7 @@ class ReminderService {
|
|||
try {
|
||||
return VObject\Reader::read($calendarData,
|
||||
VObject\Reader::OPTION_FORGIVING);
|
||||
} catch(ParseException $ex) {
|
||||
} catch (ParseException $ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -707,7 +706,7 @@ class ReminderService {
|
|||
private function getAllVEventsFromVCalendar(VObject\Component\VCalendar $vcalendar):array {
|
||||
$vevents = [];
|
||||
|
||||
foreach($vcalendar->children() as $child) {
|
||||
foreach ($vcalendar->children() as $child) {
|
||||
if (!($child instanceof VObject\Component)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
$metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
$metaDataById = [];
|
||||
foreach($metaDataRows as $metaDataRow) {
|
||||
foreach ($metaDataRows as $metaDataRow) {
|
||||
if (!isset($metaDataById[$metaDataRow[$this->dbForeignKeyName]])) {
|
||||
$metaDataById[$metaDataRow[$this->dbForeignKeyName]] = [];
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
$metaDataRow['value'];
|
||||
}
|
||||
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$id = $row['id'];
|
||||
|
||||
if (isset($metaDataById[$id])) {
|
||||
|
@ -142,7 +142,6 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
} else {
|
||||
$principals[] = $this->rowToPrincipal($row);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
@ -175,7 +174,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
$stmt = $query->execute();
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if(!$row) {
|
||||
if (!$row) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -187,7 +186,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
$metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$metadata = [];
|
||||
|
||||
foreach($metaDataRows as $metaDataRow) {
|
||||
foreach ($metaDataRows as $metaDataRow) {
|
||||
$metadata[$metaDataRow['key']] = $metaDataRow['value'];
|
||||
}
|
||||
|
||||
|
@ -206,7 +205,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
$stmt = $query->execute();
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if(!$row) {
|
||||
if (!$row) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -218,7 +217,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
$metaDataRows = $metaDataStmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
$metadata = [];
|
||||
|
||||
foreach($metaDataRows as $metaDataRow) {
|
||||
foreach ($metaDataRows as $metaDataRow) {
|
||||
$metadata[$metaDataRow['key']] = $metaDataRow['value'];
|
||||
}
|
||||
|
||||
|
@ -265,7 +264,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
|
||||
$stmt = $query->execute();
|
||||
$principals = [];
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (!$this->isAllowedToAccessResource($row, $usersGroups)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -284,7 +283,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
|
||||
$stmt = $query->execute();
|
||||
$principals = [];
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (!$this->isAllowedToAccessResource($row, $usersGroups)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -352,7 +351,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
$stmt = $query->execute();
|
||||
|
||||
$rows = [];
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$id = $row[$this->dbForeignKeyName];
|
||||
|
||||
$principalRow = $this->getPrincipalById($id);
|
||||
|
@ -388,7 +387,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
$stmt = $query->execute();
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if(!$row) {
|
||||
if (!$row) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isAllowedToAccessResource($row, $usersGroups)) {
|
||||
|
@ -415,7 +414,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
|||
$stmt = $query->execute();
|
||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if(!$row) {
|
||||
if (!$row) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isAllowedToAccessResource($row, $usersGroups)) {
|
||||
|
|
|
@ -316,7 +316,7 @@ class IMipPlugin extends SabreIMipPlugin {
|
|||
$this->logger->error('Unable to deliver message to {failed}', ['app' => 'dav', 'failed' => implode(', ', $failed)]);
|
||||
$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
|
||||
}
|
||||
} catch(\Exception $ex) {
|
||||
} catch (\Exception $ex) {
|
||||
$this->logger->logException($ex, ['app' => 'dav']);
|
||||
$iTipMessage->scheduleStatus = '5.0; EMail delivery failed';
|
||||
}
|
||||
|
@ -358,10 +358,9 @@ class IMipPlugin extends SabreIMipPlugin {
|
|||
$lastOccurrence = $maxDate->getTimestamp();
|
||||
} else {
|
||||
$end = $it->getDtEnd();
|
||||
while($it->valid() && $end < $maxDate) {
|
||||
while ($it->valid() && $end < $maxDate) {
|
||||
$end = $it->getDtEnd();
|
||||
$it->next();
|
||||
|
||||
}
|
||||
$lastOccurrence = $end->getTimestamp();
|
||||
}
|
||||
|
|
|
@ -142,7 +142,6 @@ class SearchPlugin extends ServerPlugin {
|
|||
// If we're dealing with the calendar home, the calendar home itself is
|
||||
// responsible for the calendar-query
|
||||
if ($node instanceof CalendarHome && $depth === 2) {
|
||||
|
||||
$nodePaths = $node->calendarSearch($report->filters, $report->limit, $report->offset);
|
||||
|
||||
foreach ($nodePaths as $path) {
|
||||
|
|
|
@ -45,7 +45,6 @@ class ParamFilter implements XmlDeserializable {
|
|||
|
||||
if (!is_string($property)) {
|
||||
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid property attribute');
|
||||
|
||||
}
|
||||
if (!is_string($parameter)) {
|
||||
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}param-filter requires a valid parameter attribute');
|
||||
|
|
|
@ -111,7 +111,7 @@ class Plugin extends ServerPlugin {
|
|||
}
|
||||
|
||||
$calendarHome->enableCachedSubscriptionsForThisRequest();
|
||||
} catch(NotFound $ex) {
|
||||
} catch (NotFound $ex) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ class RefreshWebcalService {
|
|||
$calendarData = $vObject->serialize();
|
||||
try {
|
||||
$this->calDavBackend->createCalendarObject($subscription['id'], $uri, $calendarData, CalDavBackend::CALENDAR_TYPE_SUBSCRIPTION);
|
||||
} catch(BadRequest $ex) {
|
||||
} catch (BadRequest $ex) {
|
||||
$this->logger->logException($ex);
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ class RefreshWebcalService {
|
|||
}
|
||||
|
||||
$this->updateSubscription($subscription, $mutations);
|
||||
} catch(ParseException $ex) {
|
||||
} catch (ParseException $ex) {
|
||||
$subscriptionId = $subscription['id'];
|
||||
|
||||
$this->logger->logException($ex);
|
||||
|
@ -274,11 +274,11 @@ class RefreshWebcalService {
|
|||
|
||||
$contentType = $response->getHeader('Content-Type');
|
||||
$contentType = explode(';', $contentType, 2)[0];
|
||||
switch($contentType) {
|
||||
switch ($contentType) {
|
||||
case 'application/calendar+json':
|
||||
try {
|
||||
$jCalendar = Reader::readJson($body, Reader::OPTION_FORGIVING);
|
||||
} catch(Exception $ex) {
|
||||
} catch (Exception $ex) {
|
||||
// In case of a parsing error return null
|
||||
$this->logger->debug("Subscription $subscriptionId could not be parsed");
|
||||
return null;
|
||||
|
@ -288,7 +288,7 @@ class RefreshWebcalService {
|
|||
case 'application/calendar+xml':
|
||||
try {
|
||||
$xCalendar = Reader::readXML($body);
|
||||
} catch(Exception $ex) {
|
||||
} catch (Exception $ex) {
|
||||
// In case of a parsing error return null
|
||||
$this->logger->debug("Subscription $subscriptionId could not be parsed");
|
||||
return null;
|
||||
|
@ -299,14 +299,14 @@ class RefreshWebcalService {
|
|||
default:
|
||||
try {
|
||||
$vCalendar = Reader::read($body);
|
||||
} catch(Exception $ex) {
|
||||
} catch (Exception $ex) {
|
||||
// In case of a parsing error return null
|
||||
$this->logger->debug("Subscription $subscriptionId could not be parsed");
|
||||
return null;
|
||||
}
|
||||
return $vCalendar->serialize();
|
||||
}
|
||||
} catch(Exception $ex) {
|
||||
} catch (Exception $ex) {
|
||||
$this->logger->logException($ex);
|
||||
$this->logger->warning("Subscription $subscriptionId could not be refreshed due to a network error");
|
||||
|
||||
|
@ -349,7 +349,7 @@ class RefreshWebcalService {
|
|||
// check if new refresh rate is even valid
|
||||
try {
|
||||
DateTimeParser::parseDuration($newRefreshRate);
|
||||
} catch(InvalidDataException $ex) {
|
||||
} catch (InvalidDataException $ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace OCA\DAV;
|
|||
use OCP\Capabilities\ICapability;
|
||||
|
||||
class Capabilities implements ICapability {
|
||||
|
||||
public function getCapabilities() {
|
||||
return [
|
||||
'dav' => [
|
||||
|
|
|
@ -155,14 +155,12 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
|
|||
}
|
||||
|
||||
public function getChild($name) {
|
||||
|
||||
$obj = $this->carddavBackend->getCard($this->addressBookInfo['id'], $name);
|
||||
if (!$obj) {
|
||||
throw new NotFound('Card not found');
|
||||
}
|
||||
$obj['acl'] = $this->getChildACL();
|
||||
return new Card($this->carddavBackend, $this->addressBookInfo, $obj);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,7 +65,6 @@ class AddressBookImpl implements IAddressBook {
|
|||
array $addressBookInfo,
|
||||
CardDavBackend $backend,
|
||||
IURLGenerator $urlGenerator) {
|
||||
|
||||
$this->addressBook = $addressBook;
|
||||
$this->addressBookInfo = $addressBookInfo;
|
||||
$this->backend = $backend;
|
||||
|
@ -156,7 +155,6 @@ class AddressBookImpl implements IAddressBook {
|
|||
}
|
||||
|
||||
return $this->vCard2Array($uri, $vCard);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,7 +165,7 @@ class AddressBookImpl implements IAddressBook {
|
|||
$permissions = $this->addressBook->getACL();
|
||||
$result = 0;
|
||||
foreach ($permissions as $permission) {
|
||||
switch($permission['privilege']) {
|
||||
switch ($permission['privilege']) {
|
||||
case '{DAV:}read':
|
||||
$result |= Constants::PERMISSION_READ;
|
||||
break;
|
||||
|
@ -261,7 +259,6 @@ class AddressBookImpl implements IAddressBook {
|
|||
]) . '?photo';
|
||||
|
||||
$result['PHOTO'] = 'VALUE=uri:' . $url;
|
||||
|
||||
} elseif ($property->name === 'X-SOCIALPROFILE') {
|
||||
$type = $this->getTypeFromProperty($property);
|
||||
|
||||
|
@ -288,8 +285,6 @@ class AddressBookImpl implements IAddressBook {
|
|||
} else {
|
||||
$result[$property->name][] = $property->getValue();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
$result[$property->name] = $property->getValue();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,6 @@ class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot {
|
|||
}
|
||||
|
||||
function getName() {
|
||||
|
||||
if ($this->principalPrefix === 'principals') {
|
||||
return parent::getName();
|
||||
}
|
||||
|
@ -70,7 +69,5 @@ class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot {
|
|||
|
||||
// We are only interested in the second part.
|
||||
return $parts[1];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
class CardDavBackend implements BackendInterface, SyncSupport {
|
||||
|
||||
const PERSONAL_ADDRESSBOOK_URI = 'contacts';
|
||||
const PERSONAL_ADDRESSBOOK_NAME = 'Contacts';
|
||||
|
||||
|
@ -155,7 +154,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$addressBooks = [];
|
||||
|
||||
$result = $query->execute();
|
||||
while($row = $result->fetch()) {
|
||||
while ($row = $result->fetch()) {
|
||||
$addressBooks[$row['id']] = [
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
|
@ -190,7 +189,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
->execute();
|
||||
|
||||
$readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
|
||||
while($row = $result->fetch()) {
|
||||
while ($row = $result->fetch()) {
|
||||
if ($row['principaluri'] === $principalUri) {
|
||||
continue;
|
||||
}
|
||||
|
@ -241,7 +240,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$addressBooks = [];
|
||||
|
||||
$result = $query->execute();
|
||||
while($row = $result->fetch()) {
|
||||
while ($row = $result->fetch()) {
|
||||
$addressBooks[$row['id']] = [
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
|
@ -364,11 +363,9 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
* @suppress SqlInjectionChecker
|
||||
*/
|
||||
$propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
|
||||
|
||||
$updates = [];
|
||||
foreach($mutations as $property=>$newValue) {
|
||||
|
||||
switch($property) {
|
||||
foreach ($mutations as $property=>$newValue) {
|
||||
switch ($property) {
|
||||
case '{DAV:}displayname':
|
||||
$updates['displayname'] = $newValue;
|
||||
break;
|
||||
|
@ -380,7 +377,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$query = $this->db->getQueryBuilder();
|
||||
$query->update('addressbooks');
|
||||
|
||||
foreach($updates as $key=>$value) {
|
||||
foreach ($updates as $key=>$value) {
|
||||
$query->set($key, $query->createNamedParameter($value));
|
||||
}
|
||||
$query->where($query->expr()->eq('id', $query->createNamedParameter($addressBookId)))
|
||||
|
@ -389,7 +386,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$this->addChange($addressBookId, "", 2);
|
||||
|
||||
return true;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -411,9 +407,8 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
'synctoken' => 1
|
||||
];
|
||||
|
||||
foreach($properties as $property=>$newValue) {
|
||||
|
||||
switch($property) {
|
||||
foreach ($properties as $property=>$newValue) {
|
||||
switch ($property) {
|
||||
case '{DAV:}displayname':
|
||||
$values['displayname'] = $newValue;
|
||||
break;
|
||||
|
@ -423,12 +418,11 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
default:
|
||||
throw new BadRequest('Unknown property: ' . $property);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Fallback to make sure the displayname is set. Some clients may refuse
|
||||
// to work with addressbooks not having a displayname.
|
||||
if(is_null($values['displayname'])) {
|
||||
if (is_null($values['displayname'])) {
|
||||
$values['displayname'] = $url;
|
||||
}
|
||||
|
||||
|
@ -475,7 +469,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$query->delete($this->dbCardsPropertiesTable)
|
||||
->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)))
|
||||
->execute();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -506,7 +499,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$cards = [];
|
||||
|
||||
$result = $query->execute();
|
||||
while($row = $result->fetch()) {
|
||||
while ($row = $result->fetch()) {
|
||||
$row['etag'] = '"' . $row['etag'] . '"';
|
||||
$row['carddata'] = $this->readBlob($row['carddata']);
|
||||
$cards[] = $row;
|
||||
|
@ -680,7 +673,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
* @return string
|
||||
*/
|
||||
function updateCard($addressBookId, $cardUri, $cardData) {
|
||||
|
||||
$uid = $this->getUID($cardData);
|
||||
$etag = md5($cardData);
|
||||
$query = $this->db->getQueryBuilder();
|
||||
|
@ -804,7 +796,9 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$stmt->execute([ $addressBookId ]);
|
||||
$currentToken = $stmt->fetchColumn(0);
|
||||
|
||||
if (is_null($currentToken)) return null;
|
||||
if (is_null($currentToken)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$result = [
|
||||
'syncToken' => $currentToken,
|
||||
|
@ -814,7 +808,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
];
|
||||
|
||||
if ($syncToken) {
|
||||
|
||||
$query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`";
|
||||
if ($limit>0) {
|
||||
$query .= " LIMIT " . (int)$limit;
|
||||
|
@ -828,15 +821,12 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
|
||||
// This loop ensures that any duplicates are overwritten, only the
|
||||
// last change on a node is relevant.
|
||||
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
|
||||
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$changes[$row['uri']] = $row['operation'];
|
||||
|
||||
}
|
||||
|
||||
foreach($changes as $uri => $operation) {
|
||||
|
||||
switch($operation) {
|
||||
foreach ($changes as $uri => $operation) {
|
||||
switch ($operation) {
|
||||
case 1:
|
||||
$result['added'][] = $uri;
|
||||
break;
|
||||
|
@ -847,7 +837,6 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
$result['deleted'][] = $uri;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
// No synctoken supplied, this is the initial sync.
|
||||
|
@ -924,7 +913,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
|
||||
// No need for like when the pattern is empty
|
||||
if ('' !== $pattern) {
|
||||
if(\array_key_exists('escape_like_param', $options) && $options['escape_like_param'] === false) {
|
||||
if (\array_key_exists('escape_like_param', $options) && $options['escape_like_param'] === false) {
|
||||
$query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter($pattern)));
|
||||
} else {
|
||||
$query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
|
||||
|
@ -1053,11 +1042,11 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
);
|
||||
|
||||
foreach ($vCard->children() as $property) {
|
||||
if(!in_array($property->name, self::$indexProperties)) {
|
||||
if (!in_array($property->name, self::$indexProperties)) {
|
||||
continue;
|
||||
}
|
||||
$preferred = 0;
|
||||
foreach($property->parameters as $parameter) {
|
||||
foreach ($property->parameters as $parameter) {
|
||||
if ($parameter->name === 'TYPE' && strtoupper($parameter->getValue()) === 'PREF') {
|
||||
$preferred = 1;
|
||||
break;
|
||||
|
|
|
@ -86,5 +86,4 @@ class ContactsManager {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ class Converter {
|
|||
* @return VCard|null
|
||||
*/
|
||||
public function createCardFromUser(IUser $user) {
|
||||
|
||||
$userData = $this->accountManager->getUser($user);
|
||||
|
||||
$uid = $user->getUID();
|
||||
|
@ -68,7 +67,6 @@ class Converter {
|
|||
}
|
||||
|
||||
foreach ($userData as $property => $value) {
|
||||
|
||||
$shareWithTrustedServers =
|
||||
$value['scope'] === AccountManager::VISIBILITY_CONTACTS_ONLY ||
|
||||
$value['scope'] === AccountManager::VISIBILITY_PUBLIC;
|
||||
|
@ -150,5 +148,4 @@ class Converter {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ class HasPhotoPlugin extends ServerPlugin {
|
|||
* @return void
|
||||
*/
|
||||
function propFind(PropFind $propFind, INode $node) {
|
||||
|
||||
$ns = '{http://nextcloud.com/ns}';
|
||||
|
||||
if ($node instanceof Card) {
|
||||
|
@ -96,7 +95,5 @@ class HasPhotoPlugin extends ServerPlugin {
|
|||
'name' => $this->getPluginName(),
|
||||
'description' => 'Return a boolean stating if the vcard have a photo property set or not.'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -65,7 +65,6 @@ class ImageExportPlugin extends ServerPlugin {
|
|||
* @return bool
|
||||
*/
|
||||
public function httpGet(RequestInterface $request, ResponseInterface $response) {
|
||||
|
||||
$queryParams = $request->getQueryParameters();
|
||||
// TODO: in addition to photo we should also add logo some point in time
|
||||
if (!array_key_exists('photo', $queryParams)) {
|
||||
|
|
|
@ -87,7 +87,6 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties {
|
|||
*/
|
||||
final public function createDirectory($name) {
|
||||
throw new DAV\Exception\MethodNotAllowed('Creating collections in address book objects is not allowed');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,5 +129,4 @@ abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties {
|
|||
public static function doesViolateReservedName(string $uri): bool {
|
||||
return strpos($uri, self::PREFIX) === 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,5 +68,4 @@ interface IAddressBookProvider {
|
|||
*@since 19.0.0
|
||||
*/
|
||||
public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook;
|
||||
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ class MultiGetExportPlugin extends DAV\ServerPlugin {
|
|||
* @return bool
|
||||
*/
|
||||
public function httpReport(RequestInterface $request, ResponseInterface $response) {
|
||||
|
||||
$queryParams = $request->getQueryParameters();
|
||||
if (!array_key_exists('export', $queryParams)) {
|
||||
return;
|
||||
|
@ -118,7 +117,5 @@ class MultiGetExportPlugin extends DAV\ServerPlugin {
|
|||
'name' => $this->getPluginName(),
|
||||
'description' => 'Intercept a multi-get request and return a single vcf file instead.'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -164,7 +164,6 @@ class PhotoCache {
|
|||
$file = $folder->newFile($path);
|
||||
$file->putContent($photo->data());
|
||||
} catch (NotPermittedException $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,7 +179,7 @@ class PhotoCache {
|
|||
try {
|
||||
return $this->appData->getFolder($hash);
|
||||
} catch (NotFoundException $e) {
|
||||
if($createIfNotExists) {
|
||||
if ($createIfNotExists) {
|
||||
return $this->appData->newFolder($hash);
|
||||
} else {
|
||||
throw $e;
|
||||
|
|
|
@ -30,7 +30,6 @@ use Sabre\DAV\PropFind;
|
|||
use Sabre\DAV\Server;
|
||||
|
||||
class Plugin extends \Sabre\CardDAV\Plugin {
|
||||
|
||||
function initialize(Server $server) {
|
||||
$server->on('propFind', [$this, 'propFind']);
|
||||
parent::initialize($server);
|
||||
|
@ -65,11 +64,9 @@ class Plugin extends \Sabre\CardDAV\Plugin {
|
|||
* @return void
|
||||
*/
|
||||
function propFind(PropFind $propFind, INode $node) {
|
||||
|
||||
$ns = '{http://owncloud.org/ns}';
|
||||
|
||||
if ($node instanceof AddressBook) {
|
||||
|
||||
$propFind->handle($ns . 'groups', function () use ($node) {
|
||||
return new Groups($node->getContactsGroups());
|
||||
});
|
||||
|
|
|
@ -225,7 +225,6 @@ class SyncService {
|
|||
* @return string
|
||||
*/
|
||||
private function buildSyncCollectionRequestBody($syncToken) {
|
||||
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->formatOutput = true;
|
||||
$root = $dom->createElementNS('DAV:', 'd:sync-collection');
|
||||
|
@ -297,7 +296,7 @@ class SyncService {
|
|||
*/
|
||||
public function deleteUser($userOrCardId) {
|
||||
$systemAddressBook = $this->getLocalSystemAddressBook();
|
||||
if ($userOrCardId instanceof IUser){
|
||||
if ($userOrCardId instanceof IUser) {
|
||||
$name = $userOrCardId->getBackendClassName();
|
||||
$userId = $userOrCardId->getUID();
|
||||
|
||||
|
@ -331,7 +330,7 @@ class SyncService {
|
|||
|
||||
// remove no longer existing
|
||||
$allCards = $this->backend->getCards($systemAddressBook['id']);
|
||||
foreach($allCards as $card) {
|
||||
foreach ($allCards as $card) {
|
||||
$vCard = Reader::read($card['carddata']);
|
||||
$uid = $vCard->UID->getValue();
|
||||
// load backend and see if user exists
|
||||
|
@ -340,6 +339,4 @@ class SyncService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -108,7 +108,6 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
|
|||
* @return array
|
||||
*/
|
||||
function getACL() {
|
||||
|
||||
$acl = parent::getACL();
|
||||
if ($this->principalUri === 'principals/system/system') {
|
||||
$acl[] = [
|
||||
|
@ -120,5 +119,4 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
|
|||
|
||||
return $acl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class ListCalendars extends Command {
|
|||
$calendars = $this->caldav->getCalendarsForUser("principals/users/$user");
|
||||
|
||||
$calendarTableData = [];
|
||||
foreach($calendars as $calendar) {
|
||||
foreach ($calendars as $calendar) {
|
||||
// skip birthday calendar
|
||||
if ($calendar['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI) {
|
||||
continue;
|
||||
|
@ -101,5 +101,4 @@ class ListCalendars extends Command {
|
|||
$output->writeln("<info>User <$user> has no calendars</info>");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -146,8 +146,7 @@ class MoveCalendar extends Command {
|
|||
* @param string $userDestination
|
||||
* @param bool $force
|
||||
*/
|
||||
private function checkShares(array $calendar, string $userOrigin, string $userDestination, bool $force = false)
|
||||
{
|
||||
private function checkShares(array $calendar, string $userOrigin, string $userDestination, bool $force = false) {
|
||||
$shares = $this->calDav->getShares($calendar['id']);
|
||||
foreach ($shares as $share) {
|
||||
list(, $prefix, $userOrGroup) = explode('/', $share['href'], 3);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue