Passed
Push — master ( da9ad9...c724eb )
by Roeland
13:33 queued 01:55
created
lib/private/Tagging/Tag.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -36,54 +36,54 @@
 block discarded – undo
36 36
  * @method void setName(string $name)
37 37
  */
38 38
 class Tag extends Entity {
39
-	protected $owner;
40
-	protected $type;
41
-	protected $name;
39
+    protected $owner;
40
+    protected $type;
41
+    protected $name;
42 42
 
43
-	/**
44
-	 * Constructor.
45
-	 *
46
-	 * @param string $owner The tag's owner
47
-	 * @param string $type The type of item this tag is used for
48
-	 * @param string $name The tag's name
49
-	 */
50
-	public function __construct($owner = null, $type = null, $name = null) {
51
-		$this->setOwner($owner);
52
-		$this->setType($type);
53
-		$this->setName($name);
54
-	}
43
+    /**
44
+     * Constructor.
45
+     *
46
+     * @param string $owner The tag's owner
47
+     * @param string $type The type of item this tag is used for
48
+     * @param string $name The tag's name
49
+     */
50
+    public function __construct($owner = null, $type = null, $name = null) {
51
+        $this->setOwner($owner);
52
+        $this->setType($type);
53
+        $this->setName($name);
54
+    }
55 55
 
56
-	/**
57
-	 * Transform a database columnname to a property
58
-	 *
59
-	 * @param string $columnName the name of the column
60
-	 * @return string the property name
61
-	 * @todo migrate existing database columns to the correct names
62
-	 * to be able to drop this direct mapping
63
-	 */
64
-	public function columnToProperty($columnName) {
65
-		if ($columnName === 'category') {
66
-			return 'name';
67
-		} elseif ($columnName === 'uid') {
68
-			return 'owner';
69
-		} else {
70
-			return parent::columnToProperty($columnName);
71
-		}
72
-	}
56
+    /**
57
+     * Transform a database columnname to a property
58
+     *
59
+     * @param string $columnName the name of the column
60
+     * @return string the property name
61
+     * @todo migrate existing database columns to the correct names
62
+     * to be able to drop this direct mapping
63
+     */
64
+    public function columnToProperty($columnName) {
65
+        if ($columnName === 'category') {
66
+            return 'name';
67
+        } elseif ($columnName === 'uid') {
68
+            return 'owner';
69
+        } else {
70
+            return parent::columnToProperty($columnName);
71
+        }
72
+    }
73 73
 
74
-	/**
75
-	 * Transform a property to a database column name
76
-	 *
77
-	 * @param string $property the name of the property
78
-	 * @return string the column name
79
-	 */
80
-	public function propertyToColumn($property) {
81
-		if ($property === 'name') {
82
-			return 'category';
83
-		} elseif ($property === 'owner') {
84
-			return 'uid';
85
-		} else {
86
-			return parent::propertyToColumn($property);
87
-		}
88
-	}
74
+    /**
75
+     * Transform a property to a database column name
76
+     *
77
+     * @param string $property the name of the property
78
+     * @return string the column name
79
+     */
80
+    public function propertyToColumn($property) {
81
+        if ($property === 'name') {
82
+            return 'category';
83
+        } elseif ($property === 'owner') {
84
+            return 'uid';
85
+        } else {
86
+            return parent::propertyToColumn($property);
87
+        }
88
+    }
89 89
 }
Please login to merge, or discard this patch.
Middleware/Security/Exceptions/StrictCookieMissingException.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
  * @package OC\AppFramework\Middleware\Security\Exceptions
33 33
  */
34 34
 class StrictCookieMissingException extends SecurityException {
35
-	public function __construct() {
36
-		parent::__construct('Strict Cookie has not been found in request.', Http::STATUS_PRECONDITION_FAILED);
37
-	}
35
+    public function __construct() {
36
+        parent::__construct('Strict Cookie has not been found in request.', Http::STATUS_PRECONDITION_FAILED);
37
+    }
38 38
 }
Please login to merge, or discard this patch.
apps/dav/lib/Comments/EntityTypeCollection.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -43,84 +43,84 @@
 block discarded – undo
43 43
  */
44 44
 class EntityTypeCollection extends RootCollection {
45 45
 
46
-	/** @var ILogger */
47
-	protected $logger;
46
+    /** @var ILogger */
47
+    protected $logger;
48 48
 
49
-	/** @var IUserManager */
50
-	protected $userManager;
49
+    /** @var IUserManager */
50
+    protected $userManager;
51 51
 
52
-	/** @var \Closure */
53
-	protected $childExistsFunction;
52
+    /** @var \Closure */
53
+    protected $childExistsFunction;
54 54
 
55
-	/**
56
-	 * @param string $name
57
-	 * @param ICommentsManager $commentsManager
58
-	 * @param IUserManager $userManager
59
-	 * @param IUserSession $userSession
60
-	 * @param ILogger $logger
61
-	 * @param \Closure $childExistsFunction
62
-	 */
63
-	public function __construct(
64
-		$name,
65
-		ICommentsManager $commentsManager,
66
-		IUserManager $userManager,
67
-		IUserSession $userSession,
68
-		ILogger $logger,
69
-		\Closure $childExistsFunction
70
-	) {
71
-		$name = trim($name);
72
-		if (empty($name) || !is_string($name)) {
73
-			throw new \InvalidArgumentException('"name" parameter must be non-empty string');
74
-		}
75
-		$this->name = $name;
76
-		$this->commentsManager = $commentsManager;
77
-		$this->logger = $logger;
78
-		$this->userManager = $userManager;
79
-		$this->userSession = $userSession;
80
-		$this->childExistsFunction = $childExistsFunction;
81
-	}
55
+    /**
56
+     * @param string $name
57
+     * @param ICommentsManager $commentsManager
58
+     * @param IUserManager $userManager
59
+     * @param IUserSession $userSession
60
+     * @param ILogger $logger
61
+     * @param \Closure $childExistsFunction
62
+     */
63
+    public function __construct(
64
+        $name,
65
+        ICommentsManager $commentsManager,
66
+        IUserManager $userManager,
67
+        IUserSession $userSession,
68
+        ILogger $logger,
69
+        \Closure $childExistsFunction
70
+    ) {
71
+        $name = trim($name);
72
+        if (empty($name) || !is_string($name)) {
73
+            throw new \InvalidArgumentException('"name" parameter must be non-empty string');
74
+        }
75
+        $this->name = $name;
76
+        $this->commentsManager = $commentsManager;
77
+        $this->logger = $logger;
78
+        $this->userManager = $userManager;
79
+        $this->userSession = $userSession;
80
+        $this->childExistsFunction = $childExistsFunction;
81
+    }
82 82
 
83
-	/**
84
-	 * Returns a specific child node, referenced by its name
85
-	 *
86
-	 * This method must throw Sabre\DAV\Exception\NotFound if the node does not
87
-	 * exist.
88
-	 *
89
-	 * @param string $name
90
-	 * @return \Sabre\DAV\INode
91
-	 * @throws NotFound
92
-	 */
93
-	public function getChild($name) {
94
-		if (!$this->childExists($name)) {
95
-			throw new NotFound('Entity does not exist or is not available');
96
-		}
97
-		return new EntityCollection(
98
-			$name,
99
-			$this->name,
100
-			$this->commentsManager,
101
-			$this->userManager,
102
-			$this->userSession,
103
-			$this->logger
104
-		);
105
-	}
83
+    /**
84
+     * Returns a specific child node, referenced by its name
85
+     *
86
+     * This method must throw Sabre\DAV\Exception\NotFound if the node does not
87
+     * exist.
88
+     *
89
+     * @param string $name
90
+     * @return \Sabre\DAV\INode
91
+     * @throws NotFound
92
+     */
93
+    public function getChild($name) {
94
+        if (!$this->childExists($name)) {
95
+            throw new NotFound('Entity does not exist or is not available');
96
+        }
97
+        return new EntityCollection(
98
+            $name,
99
+            $this->name,
100
+            $this->commentsManager,
101
+            $this->userManager,
102
+            $this->userSession,
103
+            $this->logger
104
+        );
105
+    }
106 106
 
107
-	/**
108
-	 * Returns an array with all the child nodes
109
-	 *
110
-	 * @return \Sabre\DAV\INode[]
111
-	 * @throws MethodNotAllowed
112
-	 */
113
-	public function getChildren() {
114
-		throw new MethodNotAllowed('No permission to list folder contents');
115
-	}
107
+    /**
108
+     * Returns an array with all the child nodes
109
+     *
110
+     * @return \Sabre\DAV\INode[]
111
+     * @throws MethodNotAllowed
112
+     */
113
+    public function getChildren() {
114
+        throw new MethodNotAllowed('No permission to list folder contents');
115
+    }
116 116
 
117
-	/**
118
-	 * Checks if a child-node with the specified name exists
119
-	 *
120
-	 * @param string $name
121
-	 * @return bool
122
-	 */
123
-	public function childExists($name) {
124
-		return call_user_func($this->childExistsFunction, $name);
125
-	}
117
+    /**
118
+     * Checks if a child-node with the specified name exists
119
+     *
120
+     * @param string $name
121
+     * @return bool
122
+     */
123
+    public function childExists($name) {
124
+        return call_user_func($this->childExistsFunction, $name);
125
+    }
126 126
 }
Please login to merge, or discard this patch.
apps/dav/lib/Command/SyncSystemAddressBook.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -29,36 +29,36 @@
 block discarded – undo
29 29
 
30 30
 class SyncSystemAddressBook extends Command {
31 31
 
32
-	/** @var SyncService */
33
-	private $syncService;
32
+    /** @var SyncService */
33
+    private $syncService;
34 34
 
35
-	/**
36
-	 * @param SyncService $syncService
37
-	 */
38
-	public function __construct(SyncService $syncService) {
39
-		parent::__construct();
40
-		$this->syncService = $syncService;
41
-	}
35
+    /**
36
+     * @param SyncService $syncService
37
+     */
38
+    public function __construct(SyncService $syncService) {
39
+        parent::__construct();
40
+        $this->syncService = $syncService;
41
+    }
42 42
 
43
-	protected function configure() {
44
-		$this
45
-			->setName('dav:sync-system-addressbook')
46
-			->setDescription('Synchronizes users to the system addressbook');
47
-	}
43
+    protected function configure() {
44
+        $this
45
+            ->setName('dav:sync-system-addressbook')
46
+            ->setDescription('Synchronizes users to the system addressbook');
47
+    }
48 48
 
49
-	/**
50
-	 * @param InputInterface $input
51
-	 * @param OutputInterface $output
52
-	 */
53
-	protected function execute(InputInterface $input, OutputInterface $output) {
54
-		$output->writeln('Syncing users ...');
55
-		$progress = new ProgressBar($output);
56
-		$progress->start();
57
-		$this->syncService->syncInstance(function () use ($progress) {
58
-			$progress->advance();
59
-		});
49
+    /**
50
+     * @param InputInterface $input
51
+     * @param OutputInterface $output
52
+     */
53
+    protected function execute(InputInterface $input, OutputInterface $output) {
54
+        $output->writeln('Syncing users ...');
55
+        $progress = new ProgressBar($output);
56
+        $progress->start();
57
+        $this->syncService->syncInstance(function () use ($progress) {
58
+            $progress->advance();
59
+        });
60 60
 
61
-		$progress->finish();
62
-		$output->writeln('');
63
-	}
61
+        $progress->finish();
62
+        $output->writeln('');
63
+    }
64 64
 }
Please login to merge, or discard this patch.
apps/dav/lib/Avatars/AvatarNode.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -26,71 +26,71 @@
 block discarded – undo
26 26
 use Sabre\DAV\File;
27 27
 
28 28
 class AvatarNode extends File {
29
-	private $ext;
30
-	private $size;
31
-	private $avatar;
29
+    private $ext;
30
+    private $size;
31
+    private $avatar;
32 32
 
33
-	/**
34
-	 * AvatarNode constructor.
35
-	 *
36
-	 * @param integer $size
37
-	 * @param string $ext
38
-	 * @param IAvatar $avatar
39
-	 */
40
-	public function __construct($size, $ext, $avatar) {
41
-		$this->size = $size;
42
-		$this->ext = $ext;
43
-		$this->avatar = $avatar;
44
-	}
33
+    /**
34
+     * AvatarNode constructor.
35
+     *
36
+     * @param integer $size
37
+     * @param string $ext
38
+     * @param IAvatar $avatar
39
+     */
40
+    public function __construct($size, $ext, $avatar) {
41
+        $this->size = $size;
42
+        $this->ext = $ext;
43
+        $this->avatar = $avatar;
44
+    }
45 45
 
46
-	/**
47
-	 * Returns the name of the node.
48
-	 *
49
-	 * This is used to generate the url.
50
-	 *
51
-	 * @return string
52
-	 */
53
-	public function getName() {
54
-		return "$this->size.$this->ext";
55
-	}
46
+    /**
47
+     * Returns the name of the node.
48
+     *
49
+     * This is used to generate the url.
50
+     *
51
+     * @return string
52
+     */
53
+    public function getName() {
54
+        return "$this->size.$this->ext";
55
+    }
56 56
 
57
-	public function get() {
58
-		$image = $this->avatar->get($this->size);
59
-		$res = $image->resource();
57
+    public function get() {
58
+        $image = $this->avatar->get($this->size);
59
+        $res = $image->resource();
60 60
 
61
-		ob_start();
62
-		if ($this->ext === 'png') {
63
-			imagepng($res);
64
-		} else {
65
-			imagejpeg($res);
66
-		}
61
+        ob_start();
62
+        if ($this->ext === 'png') {
63
+            imagepng($res);
64
+        } else {
65
+            imagejpeg($res);
66
+        }
67 67
 
68
-		return ob_get_clean();
69
-	}
68
+        return ob_get_clean();
69
+    }
70 70
 
71
-	/**
72
-	 * Returns the mime-type for a file
73
-	 *
74
-	 * If null is returned, we'll assume application/octet-stream
75
-	 *
76
-	 * @return string|null
77
-	 */
78
-	public function getContentType() {
79
-		if ($this->ext === 'png') {
80
-			return 'image/png';
81
-		}
82
-		return 'image/jpeg';
83
-	}
71
+    /**
72
+     * Returns the mime-type for a file
73
+     *
74
+     * If null is returned, we'll assume application/octet-stream
75
+     *
76
+     * @return string|null
77
+     */
78
+    public function getContentType() {
79
+        if ($this->ext === 'png') {
80
+            return 'image/png';
81
+        }
82
+        return 'image/jpeg';
83
+    }
84 84
 
85
-	public function getETag() {
86
-		return $this->avatar->getFile($this->size)->getEtag();
87
-	}
85
+    public function getETag() {
86
+        return $this->avatar->getFile($this->size)->getEtag();
87
+    }
88 88
 
89
-	public function getLastModified() {
90
-		$timestamp = $this->avatar->getFile($this->size)->getMTime();
91
-		if (!empty($timestamp)) {
92
-			return (int)$timestamp;
93
-		}
94
-		return $timestamp;
95
-	}
89
+    public function getLastModified() {
90
+        $timestamp = $this->avatar->getFile($this->size)->getMTime();
91
+        if (!empty($timestamp)) {
92
+            return (int)$timestamp;
93
+        }
94
+        return $timestamp;
95
+    }
96 96
 }
Please login to merge, or discard this patch.
apps/dav/lib/CardDAV/ImageExportPlugin.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -32,84 +32,84 @@
 block discarded – undo
32 32
 
33 33
 class ImageExportPlugin extends ServerPlugin {
34 34
 
35
-	/** @var Server */
36
-	protected $server;
37
-	/** @var PhotoCache */
38
-	private $cache;
39
-
40
-	/**
41
-	 * ImageExportPlugin constructor.
42
-	 *
43
-	 * @param PhotoCache $cache
44
-	 */
45
-	public function __construct(PhotoCache $cache) {
46
-		$this->cache = $cache;
47
-	}
48
-
49
-	/**
50
-	 * Initializes the plugin and registers event handlers
51
-	 *
52
-	 * @param Server $server
53
-	 * @return void
54
-	 */
55
-	public function initialize(Server $server) {
56
-		$this->server = $server;
57
-		$this->server->on('method:GET', [$this, 'httpGet'], 90);
58
-	}
59
-
60
-	/**
61
-	 * Intercepts GET requests on addressbook urls ending with ?photo.
62
-	 *
63
-	 * @param RequestInterface $request
64
-	 * @param ResponseInterface $response
65
-	 * @return bool
66
-	 */
67
-	public function httpGet(RequestInterface $request, ResponseInterface $response) {
68
-		$queryParams = $request->getQueryParameters();
69
-		// TODO: in addition to photo we should also add logo some point in time
70
-		if (!array_key_exists('photo', $queryParams)) {
71
-			return true;
72
-		}
73
-
74
-		$size = isset($queryParams['size']) ? (int)$queryParams['size'] : -1;
75
-
76
-		$path = $request->getPath();
77
-		$node = $this->server->tree->getNodeForPath($path);
78
-
79
-		if (!($node instanceof Card)) {
80
-			return true;
81
-		}
82
-
83
-		$this->server->transactionType = 'carddav-image-export';
84
-
85
-		// Checking ACL, if available.
86
-		if ($aclPlugin = $this->server->getPlugin('acl')) {
87
-			/** @var \Sabre\DAVACL\Plugin $aclPlugin */
88
-			$aclPlugin->checkPrivileges($path, '{DAV:}read');
89
-		}
90
-
91
-		// Fetch addressbook
92
-		$addressbookpath = explode('/', $path);
93
-		array_pop($addressbookpath);
94
-		$addressbookpath = implode('/', $addressbookpath);
95
-		/** @var AddressBook $addressbook */
96
-		$addressbook = $this->server->tree->getNodeForPath($addressbookpath);
97
-
98
-		$response->setHeader('Cache-Control', 'private, max-age=3600, must-revalidate');
99
-		$response->setHeader('Etag', $node->getETag());
100
-		$response->setHeader('Pragma', 'public');
101
-
102
-		try {
103
-			$file = $this->cache->get($addressbook->getResourceId(), $node->getName(), $size, $node);
104
-			$response->setHeader('Content-Type', $file->getMimeType());
105
-			$response->setHeader('Content-Disposition', 'attachment');
106
-			$response->setStatus(200);
107
-
108
-			$response->setBody($file->getContent());
109
-		} catch (NotFoundException $e) {
110
-			$response->setStatus(404);
111
-		}
112
-
113
-		return false;
114
-	}
35
+    /** @var Server */
36
+    protected $server;
37
+    /** @var PhotoCache */
38
+    private $cache;
39
+
40
+    /**
41
+     * ImageExportPlugin constructor.
42
+     *
43
+     * @param PhotoCache $cache
44
+     */
45
+    public function __construct(PhotoCache $cache) {
46
+        $this->cache = $cache;
47
+    }
48
+
49
+    /**
50
+     * Initializes the plugin and registers event handlers
51
+     *
52
+     * @param Server $server
53
+     * @return void
54
+     */
55
+    public function initialize(Server $server) {
56
+        $this->server = $server;
57
+        $this->server->on('method:GET', [$this, 'httpGet'], 90);
58
+    }
59
+
60
+    /**
61
+     * Intercepts GET requests on addressbook urls ending with ?photo.
62
+     *
63
+     * @param RequestInterface $request
64
+     * @param ResponseInterface $response
65
+     * @return bool
66
+     */
67
+    public function httpGet(RequestInterface $request, ResponseInterface $response) {
68
+        $queryParams = $request->getQueryParameters();
69
+        // TODO: in addition to photo we should also add logo some point in time
70
+        if (!array_key_exists('photo', $queryParams)) {
71
+            return true;
72
+        }
73
+
74
+        $size = isset($queryParams['size']) ? (int)$queryParams['size'] : -1;
75
+
76
+        $path = $request->getPath();
77
+        $node = $this->server->tree->getNodeForPath($path);
78
+
79
+        if (!($node instanceof Card)) {
80
+            return true;
81
+        }
82
+
83
+        $this->server->transactionType = 'carddav-image-export';
84
+
85
+        // Checking ACL, if available.
86
+        if ($aclPlugin = $this->server->getPlugin('acl')) {
87
+            /** @var \Sabre\DAVACL\Plugin $aclPlugin */
88
+            $aclPlugin->checkPrivileges($path, '{DAV:}read');
89
+        }
90
+
91
+        // Fetch addressbook
92
+        $addressbookpath = explode('/', $path);
93
+        array_pop($addressbookpath);
94
+        $addressbookpath = implode('/', $addressbookpath);
95
+        /** @var AddressBook $addressbook */
96
+        $addressbook = $this->server->tree->getNodeForPath($addressbookpath);
97
+
98
+        $response->setHeader('Cache-Control', 'private, max-age=3600, must-revalidate');
99
+        $response->setHeader('Etag', $node->getETag());
100
+        $response->setHeader('Pragma', 'public');
101
+
102
+        try {
103
+            $file = $this->cache->get($addressbook->getResourceId(), $node->getName(), $size, $node);
104
+            $response->setHeader('Content-Type', $file->getMimeType());
105
+            $response->setHeader('Content-Disposition', 'attachment');
106
+            $response->setStatus(200);
107
+
108
+            $response->setBody($file->getContent());
109
+        } catch (NotFoundException $e) {
110
+            $response->setStatus(404);
111
+        }
112
+
113
+        return false;
114
+    }
115 115
 }
Please login to merge, or discard this patch.
apps/dav/lib/DAV/PublicAuth.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -26,66 +26,66 @@
 block discarded – undo
26 26
 
27 27
 class PublicAuth implements BackendInterface {
28 28
 
29
-	/** @var string[] */
30
-	private $publicURLs;
29
+    /** @var string[] */
30
+    private $publicURLs;
31 31
 
32
-	public function __construct() {
33
-		$this->publicURLs = [
34
-			'public-calendars',
35
-			'principals/system/public'
36
-		];
37
-	}
32
+    public function __construct() {
33
+        $this->publicURLs = [
34
+            'public-calendars',
35
+            'principals/system/public'
36
+        ];
37
+    }
38 38
 
39
-	/**
40
-	 * When this method is called, the backend must check if authentication was
41
-	 * successful.
42
-	 *
43
-	 * The returned value must be one of the following
44
-	 *
45
-	 * [true, "principals/username"]
46
-	 * [false, "reason for failure"]
47
-	 *
48
-	 * If authentication was successful, it's expected that the authentication
49
-	 * backend returns a so-called principal url.
50
-	 *
51
-	 * Examples of a principal url:
52
-	 *
53
-	 * principals/admin
54
-	 * principals/user1
55
-	 * principals/users/joe
56
-	 * principals/uid/123457
57
-	 *
58
-	 * If you don't use WebDAV ACL (RFC3744) we recommend that you simply
59
-	 * return a string such as:
60
-	 *
61
-	 * principals/users/[username]
62
-	 *
63
-	 * @param RequestInterface $request
64
-	 * @param ResponseInterface $response
65
-	 * @return array
66
-	 */
67
-	public function check(RequestInterface $request, ResponseInterface $response) {
68
-		if ($this->isRequestPublic($request)) {
69
-			return [true, "principals/system/public"];
70
-		}
71
-		return [false, "No public access to this resource."];
72
-	}
39
+    /**
40
+     * When this method is called, the backend must check if authentication was
41
+     * successful.
42
+     *
43
+     * The returned value must be one of the following
44
+     *
45
+     * [true, "principals/username"]
46
+     * [false, "reason for failure"]
47
+     *
48
+     * If authentication was successful, it's expected that the authentication
49
+     * backend returns a so-called principal url.
50
+     *
51
+     * Examples of a principal url:
52
+     *
53
+     * principals/admin
54
+     * principals/user1
55
+     * principals/users/joe
56
+     * principals/uid/123457
57
+     *
58
+     * If you don't use WebDAV ACL (RFC3744) we recommend that you simply
59
+     * return a string such as:
60
+     *
61
+     * principals/users/[username]
62
+     *
63
+     * @param RequestInterface $request
64
+     * @param ResponseInterface $response
65
+     * @return array
66
+     */
67
+    public function check(RequestInterface $request, ResponseInterface $response) {
68
+        if ($this->isRequestPublic($request)) {
69
+            return [true, "principals/system/public"];
70
+        }
71
+        return [false, "No public access to this resource."];
72
+    }
73 73
 
74
-	/**
75
-	 * @inheritdoc
76
-	 */
77
-	public function challenge(RequestInterface $request, ResponseInterface $response) {
78
-	}
74
+    /**
75
+     * @inheritdoc
76
+     */
77
+    public function challenge(RequestInterface $request, ResponseInterface $response) {
78
+    }
79 79
 
80
-	/**
81
-	 * @param RequestInterface $request
82
-	 * @return bool
83
-	 */
84
-	private function isRequestPublic(RequestInterface $request) {
85
-		$url = $request->getPath();
86
-		$matchingUrls = array_filter($this->publicURLs, function ($publicUrl) use ($url) {
87
-			return strpos($url, $publicUrl, 0) === 0;
88
-		});
89
-		return !empty($matchingUrls);
90
-	}
80
+    /**
81
+     * @param RequestInterface $request
82
+     * @return bool
83
+     */
84
+    private function isRequestPublic(RequestInterface $request) {
85
+        $url = $request->getPath();
86
+        $matchingUrls = array_filter($this->publicURLs, function ($publicUrl) use ($url) {
87
+            return strpos($url, $publicUrl, 0) === 0;
88
+        });
89
+        return !empty($matchingUrls);
90
+    }
91 91
 }
Please login to merge, or discard this patch.
apps/dav/lib/DAV/Sharing/IShareable.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -29,47 +29,47 @@
 block discarded – undo
29 29
  */
30 30
 interface IShareable extends INode {
31 31
 
32
-	/**
33
-	 * Updates the list of shares.
34
-	 *
35
-	 * The first array is a list of people that are to be added to the
36
-	 * resource.
37
-	 *
38
-	 * Every element in the add array has the following properties:
39
-	 *   * href - A url. Usually a mailto: address
40
-	 *   * commonName - Usually a first and last name, or false
41
-	 *   * summary - A description of the share, can also be false
42
-	 *   * readOnly - A boolean value
43
-	 *
44
-	 * Every element in the remove array is just the address string.
45
-	 *
46
-	 * @param array $add
47
-	 * @param array $remove
48
-	 * @return void
49
-	 */
50
-	public function updateShares(array $add, array $remove);
32
+    /**
33
+     * Updates the list of shares.
34
+     *
35
+     * The first array is a list of people that are to be added to the
36
+     * resource.
37
+     *
38
+     * Every element in the add array has the following properties:
39
+     *   * href - A url. Usually a mailto: address
40
+     *   * commonName - Usually a first and last name, or false
41
+     *   * summary - A description of the share, can also be false
42
+     *   * readOnly - A boolean value
43
+     *
44
+     * Every element in the remove array is just the address string.
45
+     *
46
+     * @param array $add
47
+     * @param array $remove
48
+     * @return void
49
+     */
50
+    public function updateShares(array $add, array $remove);
51 51
 
52
-	/**
53
-	 * Returns the list of people whom this resource is shared with.
54
-	 *
55
-	 * Every element in this array should have the following properties:
56
-	 *   * href - Often a mailto: address
57
-	 *   * commonName - Optional, for example a first + last name
58
-	 *   * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants.
59
-	 *   * readOnly - boolean
60
-	 *   * summary - Optional, a description for the share
61
-	 *
62
-	 * @return array
63
-	 */
64
-	public function getShares();
52
+    /**
53
+     * Returns the list of people whom this resource is shared with.
54
+     *
55
+     * Every element in this array should have the following properties:
56
+     *   * href - Often a mailto: address
57
+     *   * commonName - Optional, for example a first + last name
58
+     *   * status - See the Sabre\CalDAV\SharingPlugin::STATUS_ constants.
59
+     *   * readOnly - boolean
60
+     *   * summary - Optional, a description for the share
61
+     *
62
+     * @return array
63
+     */
64
+    public function getShares();
65 65
 
66
-	/**
67
-	 * @return int
68
-	 */
69
-	public function getResourceId();
66
+    /**
67
+     * @return int
68
+     */
69
+    public function getResourceId();
70 70
 
71
-	/**
72
-	 * @return string
73
-	 */
74
-	public function getOwner();
71
+    /**
72
+     * @return string
73
+     */
74
+    public function getOwner();
75 75
 }
Please login to merge, or discard this patch.
apps/dav/lib/DAV/Sharing/Xml/Invite.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -41,120 +41,120 @@
 block discarded – undo
41 41
  */
42 42
 class Invite implements XmlSerializable {
43 43
 
44
-	/**
45
-	 * The list of users a calendar has been shared to.
46
-	 *
47
-	 * @var array
48
-	 */
49
-	protected $users;
44
+    /**
45
+     * The list of users a calendar has been shared to.
46
+     *
47
+     * @var array
48
+     */
49
+    protected $users;
50 50
 
51
-	/**
52
-	 * The organizer contains information about the person who shared the
53
-	 * object.
54
-	 *
55
-	 * @var array|null
56
-	 */
57
-	protected $organizer;
51
+    /**
52
+     * The organizer contains information about the person who shared the
53
+     * object.
54
+     *
55
+     * @var array|null
56
+     */
57
+    protected $organizer;
58 58
 
59
-	/**
60
-	 * Creates the property.
61
-	 *
62
-	 * Users is an array. Each element of the array has the following
63
-	 * properties:
64
-	 *
65
-	 *   * href - Often a mailto: address
66
-	 *   * commonName - Optional, for example a first and lastname for a user.
67
-	 *   * status - One of the SharingPlugin::STATUS_* constants.
68
-	 *   * readOnly - true or false
69
-	 *   * summary - Optional, description of the share
70
-	 *
71
-	 * The organizer key is optional to specify. It's only useful when a
72
-	 * 'sharee' requests the sharing information.
73
-	 *
74
-	 * The organizer may have the following properties:
75
-	 *   * href - Often a mailto: address.
76
-	 *   * commonName - Optional human-readable name.
77
-	 *   * firstName - Optional first name.
78
-	 *   * lastName - Optional last name.
79
-	 *
80
-	 * If you wonder why these two structures are so different, I guess a
81
-	 * valid answer is that the current spec is still a draft.
82
-	 *
83
-	 * @param array $users
84
-	 */
85
-	public function __construct(array $users, array $organizer = null) {
86
-		$this->users = $users;
87
-		$this->organizer = $organizer;
88
-	}
59
+    /**
60
+     * Creates the property.
61
+     *
62
+     * Users is an array. Each element of the array has the following
63
+     * properties:
64
+     *
65
+     *   * href - Often a mailto: address
66
+     *   * commonName - Optional, for example a first and lastname for a user.
67
+     *   * status - One of the SharingPlugin::STATUS_* constants.
68
+     *   * readOnly - true or false
69
+     *   * summary - Optional, description of the share
70
+     *
71
+     * The organizer key is optional to specify. It's only useful when a
72
+     * 'sharee' requests the sharing information.
73
+     *
74
+     * The organizer may have the following properties:
75
+     *   * href - Often a mailto: address.
76
+     *   * commonName - Optional human-readable name.
77
+     *   * firstName - Optional first name.
78
+     *   * lastName - Optional last name.
79
+     *
80
+     * If you wonder why these two structures are so different, I guess a
81
+     * valid answer is that the current spec is still a draft.
82
+     *
83
+     * @param array $users
84
+     */
85
+    public function __construct(array $users, array $organizer = null) {
86
+        $this->users = $users;
87
+        $this->organizer = $organizer;
88
+    }
89 89
 
90
-	/**
91
-	 * Returns the list of users, as it was passed to the constructor.
92
-	 *
93
-	 * @return array
94
-	 */
95
-	public function getValue() {
96
-		return $this->users;
97
-	}
90
+    /**
91
+     * Returns the list of users, as it was passed to the constructor.
92
+     *
93
+     * @return array
94
+     */
95
+    public function getValue() {
96
+        return $this->users;
97
+    }
98 98
 
99
-	/**
100
-	 * The xmlSerialize metod is called during xml writing.
101
-	 *
102
-	 * Use the $writer argument to write its own xml serialization.
103
-	 *
104
-	 * An important note: do _not_ create a parent element. Any element
105
-	 * implementing XmlSerializble should only ever write what's considered
106
-	 * its 'inner xml'.
107
-	 *
108
-	 * The parent of the current element is responsible for writing a
109
-	 * containing element.
110
-	 *
111
-	 * This allows serializers to be re-used for different element names.
112
-	 *
113
-	 * If you are opening new elements, you must also close them again.
114
-	 *
115
-	 * @param Writer $writer
116
-	 * @return void
117
-	 */
118
-	public function xmlSerialize(Writer $writer) {
119
-		$cs = '{' . Plugin::NS_OWNCLOUD . '}';
99
+    /**
100
+     * The xmlSerialize metod is called during xml writing.
101
+     *
102
+     * Use the $writer argument to write its own xml serialization.
103
+     *
104
+     * An important note: do _not_ create a parent element. Any element
105
+     * implementing XmlSerializble should only ever write what's considered
106
+     * its 'inner xml'.
107
+     *
108
+     * The parent of the current element is responsible for writing a
109
+     * containing element.
110
+     *
111
+     * This allows serializers to be re-used for different element names.
112
+     *
113
+     * If you are opening new elements, you must also close them again.
114
+     *
115
+     * @param Writer $writer
116
+     * @return void
117
+     */
118
+    public function xmlSerialize(Writer $writer) {
119
+        $cs = '{' . Plugin::NS_OWNCLOUD . '}';
120 120
 
121
-		if (!is_null($this->organizer)) {
122
-			$writer->startElement($cs . 'organizer');
123
-			$writer->writeElement('{DAV:}href', $this->organizer['href']);
121
+        if (!is_null($this->organizer)) {
122
+            $writer->startElement($cs . 'organizer');
123
+            $writer->writeElement('{DAV:}href', $this->organizer['href']);
124 124
 
125
-			if (isset($this->organizer['commonName']) && $this->organizer['commonName']) {
126
-				$writer->writeElement($cs . 'common-name', $this->organizer['commonName']);
127
-			}
128
-			if (isset($this->organizer['firstName']) && $this->organizer['firstName']) {
129
-				$writer->writeElement($cs . 'first-name', $this->organizer['firstName']);
130
-			}
131
-			if (isset($this->organizer['lastName']) && $this->organizer['lastName']) {
132
-				$writer->writeElement($cs . 'last-name', $this->organizer['lastName']);
133
-			}
134
-			$writer->endElement(); // organizer
135
-		}
125
+            if (isset($this->organizer['commonName']) && $this->organizer['commonName']) {
126
+                $writer->writeElement($cs . 'common-name', $this->organizer['commonName']);
127
+            }
128
+            if (isset($this->organizer['firstName']) && $this->organizer['firstName']) {
129
+                $writer->writeElement($cs . 'first-name', $this->organizer['firstName']);
130
+            }
131
+            if (isset($this->organizer['lastName']) && $this->organizer['lastName']) {
132
+                $writer->writeElement($cs . 'last-name', $this->organizer['lastName']);
133
+            }
134
+            $writer->endElement(); // organizer
135
+        }
136 136
 
137
-		foreach ($this->users as $user) {
138
-			$writer->startElement($cs . 'user');
139
-			$writer->writeElement('{DAV:}href', $user['href']);
140
-			if (isset($user['commonName']) && $user['commonName']) {
141
-				$writer->writeElement($cs . 'common-name', $user['commonName']);
142
-			}
143
-			$writer->writeElement($cs . 'invite-accepted');
137
+        foreach ($this->users as $user) {
138
+            $writer->startElement($cs . 'user');
139
+            $writer->writeElement('{DAV:}href', $user['href']);
140
+            if (isset($user['commonName']) && $user['commonName']) {
141
+                $writer->writeElement($cs . 'common-name', $user['commonName']);
142
+            }
143
+            $writer->writeElement($cs . 'invite-accepted');
144 144
 
145
-			$writer->startElement($cs . 'access');
146
-			if ($user['readOnly']) {
147
-				$writer->writeElement($cs . 'read');
148
-			} else {
149
-				$writer->writeElement($cs . 'read-write');
150
-			}
151
-			$writer->endElement(); // access
145
+            $writer->startElement($cs . 'access');
146
+            if ($user['readOnly']) {
147
+                $writer->writeElement($cs . 'read');
148
+            } else {
149
+                $writer->writeElement($cs . 'read-write');
150
+            }
151
+            $writer->endElement(); // access
152 152
 
153
-			if (isset($user['summary']) && $user['summary']) {
154
-				$writer->writeElement($cs . 'summary', $user['summary']);
155
-			}
153
+            if (isset($user['summary']) && $user['summary']) {
154
+                $writer->writeElement($cs . 'summary', $user['summary']);
155
+            }
156 156
 
157
-			$writer->endElement(); //user
158
-		}
159
-	}
157
+            $writer->endElement(); //user
158
+        }
159
+    }
160 160
 }
Please login to merge, or discard this patch.