Completed
Pull Request — master (#5585)
by Lukas
15:54
created
apps/dav/appinfo/app.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -30,27 +30,27 @@
 block discarded – undo
30 30
 $app->registerHooks();
31 31
 
32 32
 \OC::$server->registerService('CardDAVSyncService', function() use ($app) {
33
-	return $app->getSyncService();
33
+    return $app->getSyncService();
34 34
 });
35 35
 
36 36
 $eventDispatcher = \OC::$server->getEventDispatcher();
37 37
 
38 38
 $eventDispatcher->addListener('OCP\Federation\TrustedServerEvent::remove',
39
-	function(GenericEvent $event) use ($app) {
40
-		/** @var CardDavBackend $cardDavBackend */
41
-		$cardDavBackend = $app->getContainer()->query(CardDavBackend::class);
42
-		$addressBookUri = $event->getSubject();
43
-		$addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri);
44
-		if (!is_null($addressBook)) {
45
-			$cardDavBackend->deleteAddressBook($addressBook['id']);
46
-		}
47
-	}
39
+    function(GenericEvent $event) use ($app) {
40
+        /** @var CardDavBackend $cardDavBackend */
41
+        $cardDavBackend = $app->getContainer()->query(CardDavBackend::class);
42
+        $addressBookUri = $event->getSubject();
43
+        $addressBook = $cardDavBackend->getAddressBooksByUri('principals/system/system', $addressBookUri);
44
+        if (!is_null($addressBook)) {
45
+            $cardDavBackend->deleteAddressBook($addressBook['id']);
46
+        }
47
+    }
48 48
 );
49 49
 
50 50
 $cm = \OC::$server->getContactsManager();
51 51
 $cm->register(function() use ($cm, $app) {
52
-	$user = \OC::$server->getUserSession()->getUser();
53
-	if (!is_null($user)) {
54
-		$app->setupContactsProvider($cm, $user->getUID());
55
-	}
52
+    $user = \OC::$server->getUserSession()->getUser();
53
+    if (!is_null($user)) {
54
+        $app->setupContactsProvider($cm, $user->getUID());
55
+    }
56 56
 });
Please login to merge, or discard this patch.
lib/private/Contacts/ContactsMenu/ContactsStore.php 4 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -24,14 +24,12 @@
 block discarded – undo
24 24
 
25 25
 namespace OC\Contacts\ContactsMenu;
26 26
 
27
-use OC\Share\Share;
28 27
 use OCP\Contacts\ContactsMenu\IEntry;
29 28
 use OCP\Contacts\IManager;
30 29
 use OCP\IConfig;
31 30
 use OCP\IGroupManager;
32 31
 use OCP\IUser;
33 32
 use OCP\IUserManager;
34
-use OCP\IUserSession;
35 33
 
36 34
 class ContactsStore {
37 35
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 	/**
64 64
 	 * @param IUser $user
65 65
 	 * @param string|null $filter
66
-	 * @return IEntry[]
66
+	 * @return Entry[]
67 67
 	 */
68 68
 	public function getContacts(IUser $user, $filter) {
69 69
 		$allContacts = $this->contactsManager->search($filter ?: '', [
Please login to merge, or discard this patch.
Indentation   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -36,220 +36,220 @@
 block discarded – undo
36 36
 
37 37
 class ContactsStore {
38 38
 
39
-	/** @var IManager */
40
-	private $contactsManager;
41
-
42
-	/** @var IConfig */
43
-	private $config;
44
-
45
-	/** @var IUserManager */
46
-	private $userManager;
47
-
48
-	/** @var IGroupManager */
49
-	private $groupManager;
50
-
51
-	/**
52
-	 * @param IManager $contactsManager
53
-	 * @param IConfig $config
54
-	 * @param IUserManager $userManager
55
-	 * @param IGroupManager $groupManager
56
-	 */
57
-	public function __construct(IManager $contactsManager,
58
-								IConfig $config,
59
-								IUserManager $userManager,
60
-								IGroupManager $groupManager) {
61
-		$this->contactsManager = $contactsManager;
62
-		$this->config = $config;
63
-		$this->userManager = $userManager;
64
-		$this->groupManager = $groupManager;
65
-	}
66
-
67
-	/**
68
-	 * @param IUser $user
69
-	 * @param string|null $filter
70
-	 * @return IEntry[]
71
-	 */
72
-	public function getContacts(IUser $user, $filter) {
73
-		$allContacts = $this->contactsManager->search($filter ?: '', [
74
-			'FN',
75
-			'EMAIL'
76
-		]);
77
-
78
-		$entries = array_map(function(array $contact) {
79
-			return $this->contactArrayToEntry($contact);
80
-		}, $allContacts);
81
-		return $this->filterContacts(
82
-			$user,
83
-			$entries,
84
-			$filter
85
-		);
86
-	}
87
-
88
-	/**
89
-	 * Filters the contacts. Applies 3 filters:
90
-	 *  1. filter the current user
91
-	 *  2. if the `shareapi_allow_share_dialog_user_enumeration` config option is
92
-	 * enabled it will filter all local users
93
-	 *  3. if the `shareapi_exclude_groups` config option is enabled and the
94
-	 * current user is in an excluded group it will filter all local users.
95
-	 *  4. if the `shareapi_only_share_with_group_members` config option is
96
-	 * enabled it will filter all users which doens't have a common group
97
-	 * with the current user.
98
-	 *
99
-	 * @param IUser $self
100
-	 * @param Entry[] $entries
101
-	 * @param string $filter
102
-	 * @return Entry[] the filtered contacts
103
-	 */
104
-	private function filterContacts(IUser $self,
105
-									array $entries,
106
-									$filter) {
107
-		$disallowEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') !== 'yes';
108
-		$excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes';
109
-
110
-		// whether to filter out local users
111
-		$skipLocal = false;
112
-		// whether to filter out all users which doesn't have the same group as the current user
113
-		$ownGroupsOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes';
114
-
115
-		$selfGroups = $this->groupManager->getUserGroupIds($self);
116
-
117
-		if ($excludedGroups) {
118
-			$excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '');
119
-			$decodedExcludeGroups = json_decode($excludedGroups, true);
120
-			$excludeGroupsList = ($decodedExcludeGroups !== null) ? $decodedExcludeGroups :  [];
121
-
122
-			if (count(array_intersect($excludeGroupsList, $selfGroups)) !== 0) {
123
-				// a group of the current user is excluded -> filter all local users
124
-				$skipLocal = true;
125
-			}
126
-		}
127
-
128
-		$selfUID = $self->getUID();
129
-
130
-		return array_values(array_filter($entries, function(IEntry $entry) use ($self, $skipLocal, $ownGroupsOnly, $selfGroups, $selfUID, $disallowEnumeration, $filter) {
131
-			if ($skipLocal && $entry->getProperty('isLocalSystemBook') === true) {
132
-				return false;
133
-			}
134
-
135
-			// Prevent enumerating local users
136
-			if($disallowEnumeration && $entry->getProperty('isLocalSystemBook')) {
137
-				$filterUser = true;
138
-
139
-				$mailAddresses = $entry->getEMailAddresses();
140
-				foreach($mailAddresses as $mailAddress) {
141
-					if($mailAddress === $filter) {
142
-						$filterUser = false;
143
-						break;
144
-					}
145
-				}
146
-
147
-				if($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) {
148
-					$filterUser = false;
149
-				}
150
-
151
-				if($filterUser) {
152
-					return false;
153
-				}
154
-			}
155
-
156
-			if ($ownGroupsOnly && $entry->getProperty('isLocalSystemBook') === true) {
157
-				$contactGroups = $this->groupManager->getUserGroupIds($this->userManager->get($entry->getProperty('UID')));
158
-				if (count(array_intersect($contactGroups, $selfGroups)) === 0) {
159
-					// no groups in common, so shouldn't see the contact
160
-					return false;
161
-				}
162
-			}
163
-
164
-			return $entry->getProperty('UID') !== $selfUID;
165
-		}));
166
-	}
167
-
168
-	/**
169
-	 * @param IUser $user
170
-	 * @param integer $shareType
171
-	 * @param string $shareWith
172
-	 * @return IEntry|null
173
-	 */
174
-	public function findOne(IUser $user, $shareType, $shareWith) {
175
-		switch($shareType) {
176
-			case 0:
177
-			case 6:
178
-				$filter = ['UID'];
179
-				break;
180
-			case 4:
181
-				$filter = ['EMAIL'];
182
-				break;
183
-			default:
184
-				return null;
185
-		}
186
-
187
-		$userId = $user->getUID();
188
-		$allContacts = $this->contactsManager->search($shareWith, $filter);
189
-		$contacts = array_filter($allContacts, function($contact) use ($userId) {
190
-			return $contact['UID'] !== $userId;
191
-		});
192
-		$match = null;
193
-
194
-		foreach ($contacts as $contact) {
195
-			if ($shareType === 4 && isset($contact['EMAIL'])) {
196
-				if (in_array($shareWith, $contact['EMAIL'])) {
197
-					$match = $contact;
198
-					break;
199
-				}
200
-			}
201
-			if ($shareType === 0 || $shareType === 6) {
202
-				if ($contact['UID'] === $shareWith && $contact['isLocalSystemBook'] === true) {
203
-					$match = $contact;
204
-					break;
205
-				}
206
-			}
207
-		}
208
-
209
-		if ($match) {
210
-			$match = $this->filterContacts($user, [$this->contactArrayToEntry($match)], $shareWith);
211
-			if (count($match) === 1) {
212
-				$match = $match[0];
213
-			} else {
214
-				$match = null;
215
-			}
216
-
217
-		}
218
-
219
-		return $match;
220
-	}
221
-
222
-	/**
223
-	 * @param array $contact
224
-	 * @return Entry
225
-	 */
226
-	private function contactArrayToEntry(array $contact) {
227
-		$entry = new Entry();
228
-
229
-		if (isset($contact['id'])) {
230
-			$entry->setId($contact['id']);
231
-		}
232
-
233
-		if (isset($contact['FN'])) {
234
-			$entry->setFullName($contact['FN']);
235
-		}
236
-
237
-		$avatarPrefix = "VALUE=uri:";
238
-		if (isset($contact['PHOTO']) && strpos($contact['PHOTO'], $avatarPrefix) === 0) {
239
-			$entry->setAvatar(substr($contact['PHOTO'], strlen($avatarPrefix)));
240
-		}
241
-
242
-		if (isset($contact['EMAIL'])) {
243
-			foreach ($contact['EMAIL'] as $email) {
244
-				$entry->addEMailAddress($email);
245
-			}
246
-		}
247
-
248
-		// Attach all other properties to the entry too because some
249
-		// providers might make use of it.
250
-		$entry->setProperties($contact);
251
-
252
-		return $entry;
253
-	}
39
+    /** @var IManager */
40
+    private $contactsManager;
41
+
42
+    /** @var IConfig */
43
+    private $config;
44
+
45
+    /** @var IUserManager */
46
+    private $userManager;
47
+
48
+    /** @var IGroupManager */
49
+    private $groupManager;
50
+
51
+    /**
52
+     * @param IManager $contactsManager
53
+     * @param IConfig $config
54
+     * @param IUserManager $userManager
55
+     * @param IGroupManager $groupManager
56
+     */
57
+    public function __construct(IManager $contactsManager,
58
+                                IConfig $config,
59
+                                IUserManager $userManager,
60
+                                IGroupManager $groupManager) {
61
+        $this->contactsManager = $contactsManager;
62
+        $this->config = $config;
63
+        $this->userManager = $userManager;
64
+        $this->groupManager = $groupManager;
65
+    }
66
+
67
+    /**
68
+     * @param IUser $user
69
+     * @param string|null $filter
70
+     * @return IEntry[]
71
+     */
72
+    public function getContacts(IUser $user, $filter) {
73
+        $allContacts = $this->contactsManager->search($filter ?: '', [
74
+            'FN',
75
+            'EMAIL'
76
+        ]);
77
+
78
+        $entries = array_map(function(array $contact) {
79
+            return $this->contactArrayToEntry($contact);
80
+        }, $allContacts);
81
+        return $this->filterContacts(
82
+            $user,
83
+            $entries,
84
+            $filter
85
+        );
86
+    }
87
+
88
+    /**
89
+     * Filters the contacts. Applies 3 filters:
90
+     *  1. filter the current user
91
+     *  2. if the `shareapi_allow_share_dialog_user_enumeration` config option is
92
+     * enabled it will filter all local users
93
+     *  3. if the `shareapi_exclude_groups` config option is enabled and the
94
+     * current user is in an excluded group it will filter all local users.
95
+     *  4. if the `shareapi_only_share_with_group_members` config option is
96
+     * enabled it will filter all users which doens't have a common group
97
+     * with the current user.
98
+     *
99
+     * @param IUser $self
100
+     * @param Entry[] $entries
101
+     * @param string $filter
102
+     * @return Entry[] the filtered contacts
103
+     */
104
+    private function filterContacts(IUser $self,
105
+                                    array $entries,
106
+                                    $filter) {
107
+        $disallowEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') !== 'yes';
108
+        $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes';
109
+
110
+        // whether to filter out local users
111
+        $skipLocal = false;
112
+        // whether to filter out all users which doesn't have the same group as the current user
113
+        $ownGroupsOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes';
114
+
115
+        $selfGroups = $this->groupManager->getUserGroupIds($self);
116
+
117
+        if ($excludedGroups) {
118
+            $excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '');
119
+            $decodedExcludeGroups = json_decode($excludedGroups, true);
120
+            $excludeGroupsList = ($decodedExcludeGroups !== null) ? $decodedExcludeGroups :  [];
121
+
122
+            if (count(array_intersect($excludeGroupsList, $selfGroups)) !== 0) {
123
+                // a group of the current user is excluded -> filter all local users
124
+                $skipLocal = true;
125
+            }
126
+        }
127
+
128
+        $selfUID = $self->getUID();
129
+
130
+        return array_values(array_filter($entries, function(IEntry $entry) use ($self, $skipLocal, $ownGroupsOnly, $selfGroups, $selfUID, $disallowEnumeration, $filter) {
131
+            if ($skipLocal && $entry->getProperty('isLocalSystemBook') === true) {
132
+                return false;
133
+            }
134
+
135
+            // Prevent enumerating local users
136
+            if($disallowEnumeration && $entry->getProperty('isLocalSystemBook')) {
137
+                $filterUser = true;
138
+
139
+                $mailAddresses = $entry->getEMailAddresses();
140
+                foreach($mailAddresses as $mailAddress) {
141
+                    if($mailAddress === $filter) {
142
+                        $filterUser = false;
143
+                        break;
144
+                    }
145
+                }
146
+
147
+                if($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) {
148
+                    $filterUser = false;
149
+                }
150
+
151
+                if($filterUser) {
152
+                    return false;
153
+                }
154
+            }
155
+
156
+            if ($ownGroupsOnly && $entry->getProperty('isLocalSystemBook') === true) {
157
+                $contactGroups = $this->groupManager->getUserGroupIds($this->userManager->get($entry->getProperty('UID')));
158
+                if (count(array_intersect($contactGroups, $selfGroups)) === 0) {
159
+                    // no groups in common, so shouldn't see the contact
160
+                    return false;
161
+                }
162
+            }
163
+
164
+            return $entry->getProperty('UID') !== $selfUID;
165
+        }));
166
+    }
167
+
168
+    /**
169
+     * @param IUser $user
170
+     * @param integer $shareType
171
+     * @param string $shareWith
172
+     * @return IEntry|null
173
+     */
174
+    public function findOne(IUser $user, $shareType, $shareWith) {
175
+        switch($shareType) {
176
+            case 0:
177
+            case 6:
178
+                $filter = ['UID'];
179
+                break;
180
+            case 4:
181
+                $filter = ['EMAIL'];
182
+                break;
183
+            default:
184
+                return null;
185
+        }
186
+
187
+        $userId = $user->getUID();
188
+        $allContacts = $this->contactsManager->search($shareWith, $filter);
189
+        $contacts = array_filter($allContacts, function($contact) use ($userId) {
190
+            return $contact['UID'] !== $userId;
191
+        });
192
+        $match = null;
193
+
194
+        foreach ($contacts as $contact) {
195
+            if ($shareType === 4 && isset($contact['EMAIL'])) {
196
+                if (in_array($shareWith, $contact['EMAIL'])) {
197
+                    $match = $contact;
198
+                    break;
199
+                }
200
+            }
201
+            if ($shareType === 0 || $shareType === 6) {
202
+                if ($contact['UID'] === $shareWith && $contact['isLocalSystemBook'] === true) {
203
+                    $match = $contact;
204
+                    break;
205
+                }
206
+            }
207
+        }
208
+
209
+        if ($match) {
210
+            $match = $this->filterContacts($user, [$this->contactArrayToEntry($match)], $shareWith);
211
+            if (count($match) === 1) {
212
+                $match = $match[0];
213
+            } else {
214
+                $match = null;
215
+            }
216
+
217
+        }
218
+
219
+        return $match;
220
+    }
221
+
222
+    /**
223
+     * @param array $contact
224
+     * @return Entry
225
+     */
226
+    private function contactArrayToEntry(array $contact) {
227
+        $entry = new Entry();
228
+
229
+        if (isset($contact['id'])) {
230
+            $entry->setId($contact['id']);
231
+        }
232
+
233
+        if (isset($contact['FN'])) {
234
+            $entry->setFullName($contact['FN']);
235
+        }
236
+
237
+        $avatarPrefix = "VALUE=uri:";
238
+        if (isset($contact['PHOTO']) && strpos($contact['PHOTO'], $avatarPrefix) === 0) {
239
+            $entry->setAvatar(substr($contact['PHOTO'], strlen($avatarPrefix)));
240
+        }
241
+
242
+        if (isset($contact['EMAIL'])) {
243
+            foreach ($contact['EMAIL'] as $email) {
244
+                $entry->addEMailAddress($email);
245
+            }
246
+        }
247
+
248
+        // Attach all other properties to the entry too because some
249
+        // providers might make use of it.
250
+        $entry->setProperties($contact);
251
+
252
+        return $entry;
253
+    }
254 254
 
255 255
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		if ($excludedGroups) {
118 118
 			$excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '');
119 119
 			$decodedExcludeGroups = json_decode($excludedGroups, true);
120
-			$excludeGroupsList = ($decodedExcludeGroups !== null) ? $decodedExcludeGroups :  [];
120
+			$excludeGroupsList = ($decodedExcludeGroups !== null) ? $decodedExcludeGroups : [];
121 121
 
122 122
 			if (count(array_intersect($excludeGroupsList, $selfGroups)) !== 0) {
123 123
 				// a group of the current user is excluded -> filter all local users
@@ -133,22 +133,22 @@  discard block
 block discarded – undo
133 133
 			}
134 134
 
135 135
 			// Prevent enumerating local users
136
-			if($disallowEnumeration && $entry->getProperty('isLocalSystemBook')) {
136
+			if ($disallowEnumeration && $entry->getProperty('isLocalSystemBook')) {
137 137
 				$filterUser = true;
138 138
 
139 139
 				$mailAddresses = $entry->getEMailAddresses();
140
-				foreach($mailAddresses as $mailAddress) {
141
-					if($mailAddress === $filter) {
140
+				foreach ($mailAddresses as $mailAddress) {
141
+					if ($mailAddress === $filter) {
142 142
 						$filterUser = false;
143 143
 						break;
144 144
 					}
145 145
 				}
146 146
 
147
-				if($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) {
147
+				if ($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) {
148 148
 					$filterUser = false;
149 149
 				}
150 150
 
151
-				if($filterUser) {
151
+				if ($filterUser) {
152 152
 					return false;
153 153
 				}
154 154
 			}
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 * @return IEntry|null
173 173
 	 */
174 174
 	public function findOne(IUser $user, $shareType, $shareWith) {
175
-		switch($shareType) {
175
+		switch ($shareType) {
176 176
 			case 0:
177 177
 			case 6:
178 178
 				$filter = ['UID'];
Please login to merge, or discard this patch.
settings/templates/settings/admin/sharing.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -27,81 +27,81 @@
 block discarded – undo
27 27
 ?>
28 28
 
29 29
 <div class="section" id="shareAPI">
30
-	<h2><?php p($l->t('Sharing'));?></h2>
30
+	<h2><?php p($l->t('Sharing')); ?></h2>
31 31
 	<a target="_blank" rel="noreferrer" class="icon-info"
32
-	   title="<?php p($l->t('Open documentation'));?>"
32
+	   title="<?php p($l->t('Open documentation')); ?>"
33 33
 	   href="<?php p(link_to_docs('admin-sharing')); ?>"></a>
34
-        <p class="settings-hint"><?php p($l->t('As admin you can fine-tune the sharing behavior. Please see the documentation for more information.'));?></p>
34
+        <p class="settings-hint"><?php p($l->t('As admin you can fine-tune the sharing behavior. Please see the documentation for more information.')); ?></p>
35 35
 	<p id="enable">
36 36
 		<input type="checkbox" name="shareapi_enabled" id="shareAPIEnabled" class="checkbox"
37 37
 			   value="1" <?php if ($_['shareAPIEnabled'] === 'yes') print_unescaped('checked="checked"'); ?> />
38
-		<label for="shareAPIEnabled"><?php p($l->t('Allow apps to use the Share API'));?></label><br/>
38
+		<label for="shareAPIEnabled"><?php p($l->t('Allow apps to use the Share API')); ?></label><br/>
39 39
 	</p>
40
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
40
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
41 41
 		<input type="checkbox" name="shareapi_allow_links" id="allowLinks" class="checkbox"
42 42
 			   value="1" <?php if ($_['allowLinks'] === 'yes') print_unescaped('checked="checked"'); ?> />
43
-		<label for="allowLinks"><?php p($l->t('Allow users to share via link'));?></label><br/>
43
+		<label for="allowLinks"><?php p($l->t('Allow users to share via link')); ?></label><br/>
44 44
 	</p>
45 45
 
46 46
 	<p id="publicLinkSettings" class="indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
47 47
 		<input type="checkbox" name="shareapi_allow_public_upload" id="allowPublicUpload" class="checkbox"
48 48
 			   value="1" <?php if ($_['allowPublicUpload'] == 'yes') print_unescaped('checked="checked"'); ?> />
49
-		<label for="allowPublicUpload"><?php p($l->t('Allow public uploads'));?></label><br/>
49
+		<label for="allowPublicUpload"><?php p($l->t('Allow public uploads')); ?></label><br/>
50 50
 		<input type="checkbox" name="shareapi_enable_link_password_by_default" id="enableLinkPasswordByDefault" class="checkbox"
51 51
 			   value="1" <?php if ($_['enableLinkPasswordByDefault'] === 'yes') print_unescaped('checked="checked"'); ?> />
52
-		<label for="enableLinkPasswordByDefault"><?php p($l->t('Always ask for a password'));?></label><br/>
52
+		<label for="enableLinkPasswordByDefault"><?php p($l->t('Always ask for a password')); ?></label><br/>
53 53
 		<input type="checkbox" name="shareapi_enforce_links_password" id="enforceLinkPassword" class="checkbox"
54 54
 			   value="1" <?php if ($_['enforceLinkPassword']) print_unescaped('checked="checked"'); ?> />
55
-		<label for="enforceLinkPassword"><?php p($l->t('Enforce password protection'));?></label><br/>
55
+		<label for="enforceLinkPassword"><?php p($l->t('Enforce password protection')); ?></label><br/>
56 56
 
57 57
 		<input type="checkbox" name="shareapi_default_expire_date" id="shareapiDefaultExpireDate" class="checkbox"
58 58
 			   value="1" <?php if ($_['shareDefaultExpireDateSet'] === 'yes') print_unescaped('checked="checked"'); ?> />
59
-		<label for="shareapiDefaultExpireDate"><?php p($l->t('Set default expiration date'));?></label><br/>
59
+		<label for="shareapiDefaultExpireDate"><?php p($l->t('Set default expiration date')); ?></label><br/>
60 60
 
61 61
 	</p>
62
-	<p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden');?>">
63
-		<?php p($l->t( 'Expire after ' )); ?>
62
+	<p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
63
+		<?php p($l->t('Expire after ')); ?>
64 64
 		<input type="text" name='shareapi_expire_after_n_days' id="shareapiExpireAfterNDays" placeholder="<?php p('7')?>"
65 65
 			   value='<?php p($_['shareExpireAfterNDays']) ?>' />
66
-		<?php p($l->t( 'days' )); ?>
66
+		<?php p($l->t('days')); ?>
67 67
 		<input type="checkbox" name="shareapi_enforce_expire_date" id="shareapiEnforceExpireDate" class="checkbox"
68 68
 			   value="1" <?php if ($_['shareEnforceExpireDate'] === 'yes') print_unescaped('checked="checked"'); ?> />
69
-		<label for="shareapiEnforceExpireDate"><?php p($l->t('Enforce expiration date'));?></label><br/>
69
+		<label for="shareapiEnforceExpireDate"><?php p($l->t('Enforce expiration date')); ?></label><br/>
70 70
 	</p>
71
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
71
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
72 72
 		<input type="checkbox" name="shareapi_allow_resharing" id="allowResharing" class="checkbox"
73 73
 			   value="1" <?php if ($_['allowResharing'] === 'yes') print_unescaped('checked="checked"'); ?> />
74
-		<label for="allowResharing"><?php p($l->t('Allow resharing'));?></label><br/>
74
+		<label for="allowResharing"><?php p($l->t('Allow resharing')); ?></label><br/>
75 75
 	</p>
76
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
76
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
77 77
 		<input type="checkbox" name="shareapi_allow_group_sharing" id="allowGroupSharing" class="checkbox"
78 78
 			   value="1" <?php if ($_['allowGroupSharing'] === 'yes') print_unescaped('checked="checked"'); ?> />
79
-		<label for="allowGroupSharing"><?php p($l->t('Allow sharing with groups'));?></label><br />
79
+		<label for="allowGroupSharing"><?php p($l->t('Allow sharing with groups')); ?></label><br />
80 80
 	</p>
81
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
81
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
82 82
 		<input type="checkbox" name="shareapi_only_share_with_group_members" id="onlyShareWithGroupMembers" class="checkbox"
83 83
 			   value="1" <?php if ($_['onlyShareWithGroupMembers']) print_unescaped('checked="checked"'); ?> />
84
-		<label for="onlyShareWithGroupMembers"><?php p($l->t('Restrict users to only share with users in their groups'));?></label><br/>
84
+		<label for="onlyShareWithGroupMembers"><?php p($l->t('Restrict users to only share with users in their groups')); ?></label><br/>
85 85
 	</p>
86
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
86
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
87 87
 		<input type="checkbox" name="shareapi_exclude_groups" id="shareapiExcludeGroups" class="checkbox"
88 88
 			   value="1" <?php if ($_['shareExcludeGroups']) print_unescaped('checked="checked"'); ?> />
89
-		<label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing'));?></label><br/>
89
+		<label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing')); ?></label><br/>
90 90
 	</p>
91 91
 	<p id="selectExcludedGroups" class="indent <?php if (!$_['shareExcludeGroups'] || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
92 92
 		<input name="shareapi_exclude_groups_list" type="hidden" id="excludedGroups" value="<?php p($_['shareExcludedGroupsList']) ?>" style="width: 400px" class="noJSAutoUpdate"/>
93 93
 		<br />
94 94
 		<em><?php p($l->t('These groups will still be able to receive shares, but not to initiate them.')); ?></em>
95 95
 	</p>
96
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
96
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
97 97
 		<input type="checkbox" name="shareapi_allow_share_dialog_user_enumeration" value="1" id="shareapi_allow_share_dialog_user_enumeration" class="checkbox"
98 98
 			<?php if ($_['allowShareDialogUserEnumeration'] === 'yes') print_unescaped('checked="checked"'); ?> />
99
-		<label for="shareapi_allow_share_dialog_user_enumeration"><?php p($l->t('Allow username autocompletion in share dialog. If this is disabled the full username or email address needs to be entered.'));?></label><br />
99
+		<label for="shareapi_allow_share_dialog_user_enumeration"><?php p($l->t('Allow username autocompletion in share dialog. If this is disabled the full username or email address needs to be entered.')); ?></label><br />
100 100
 	</p>
101 101
 	<p>
102 102
 		<input type="checkbox" id="publicShareDisclaimer" class="checkbox noJSAutoUpdate"
103 103
 			<?php if ($_['publicShareDisclaimerText'] !== null) print_unescaped('checked="checked"'); ?> />
104
-		<label for="publicShareDisclaimer"><?php p($l->t('Show disclaimer text on the public link upload page. (Only shown when the file list is hidden.)'));?></label>
104
+		<label for="publicShareDisclaimer"><?php p($l->t('Show disclaimer text on the public link upload page. (Only shown when the file list is hidden.)')); ?></label>
105 105
 		<span id="publicShareDisclaimerStatus" class="msg" style="display:none"></span>
106 106
 		<br/>
107 107
 		<textarea placeholder="<?php p($l->t('This text will be shown on the public link upload page when the file list is hidden.')) ?>" id="publicShareDisclaimerText" <?php if ($_['publicShareDisclaimerText'] === null) { print_unescaped('class="hidden"'); } ?>><?php p($_['publicShareDisclaimerText']) ?></textarea>
Please login to merge, or discard this patch.
Braces   +88 added lines, -22 removed lines patch added patch discarded remove patch
@@ -34,73 +34,139 @@
 block discarded – undo
34 34
         <p class="settings-hint"><?php p($l->t('As admin you can fine-tune the sharing behavior. Please see the documentation for more information.'));?></p>
35 35
 	<p id="enable">
36 36
 		<input type="checkbox" name="shareapi_enabled" id="shareAPIEnabled" class="checkbox"
37
-			   value="1" <?php if ($_['shareAPIEnabled'] === 'yes') print_unescaped('checked="checked"'); ?> />
37
+			   value="1" <?php if ($_['shareAPIEnabled'] === 'yes') {
38
+    print_unescaped('checked="checked"');
39
+}
40
+?> />
38 41
 		<label for="shareAPIEnabled"><?php p($l->t('Allow apps to use the Share API'));?></label><br/>
39 42
 	</p>
40
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
43
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
44
+    p('hidden');
45
+}
46
+?>">
41 47
 		<input type="checkbox" name="shareapi_allow_links" id="allowLinks" class="checkbox"
42
-			   value="1" <?php if ($_['allowLinks'] === 'yes') print_unescaped('checked="checked"'); ?> />
48
+			   value="1" <?php if ($_['allowLinks'] === 'yes') {
49
+    print_unescaped('checked="checked"');
50
+}
51
+?> />
43 52
 		<label for="allowLinks"><?php p($l->t('Allow users to share via link'));?></label><br/>
44 53
 	</p>
45 54
 
46
-	<p id="publicLinkSettings" class="indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
55
+	<p id="publicLinkSettings" class="indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareAPIEnabled'] === 'no') {
56
+    p('hidden');
57
+}
58
+?>">
47 59
 		<input type="checkbox" name="shareapi_allow_public_upload" id="allowPublicUpload" class="checkbox"
48
-			   value="1" <?php if ($_['allowPublicUpload'] == 'yes') print_unescaped('checked="checked"'); ?> />
60
+			   value="1" <?php if ($_['allowPublicUpload'] == 'yes') {
61
+    print_unescaped('checked="checked"');
62
+}
63
+?> />
49 64
 		<label for="allowPublicUpload"><?php p($l->t('Allow public uploads'));?></label><br/>
50 65
 		<input type="checkbox" name="shareapi_enable_link_password_by_default" id="enableLinkPasswordByDefault" class="checkbox"
51
-			   value="1" <?php if ($_['enableLinkPasswordByDefault'] === 'yes') print_unescaped('checked="checked"'); ?> />
66
+			   value="1" <?php if ($_['enableLinkPasswordByDefault'] === 'yes') {
67
+    print_unescaped('checked="checked"');
68
+}
69
+?> />
52 70
 		<label for="enableLinkPasswordByDefault"><?php p($l->t('Always ask for a password'));?></label><br/>
53 71
 		<input type="checkbox" name="shareapi_enforce_links_password" id="enforceLinkPassword" class="checkbox"
54
-			   value="1" <?php if ($_['enforceLinkPassword']) print_unescaped('checked="checked"'); ?> />
72
+			   value="1" <?php if ($_['enforceLinkPassword']) {
73
+    print_unescaped('checked="checked"');
74
+}
75
+?> />
55 76
 		<label for="enforceLinkPassword"><?php p($l->t('Enforce password protection'));?></label><br/>
56 77
 
57 78
 		<input type="checkbox" name="shareapi_default_expire_date" id="shareapiDefaultExpireDate" class="checkbox"
58
-			   value="1" <?php if ($_['shareDefaultExpireDateSet'] === 'yes') print_unescaped('checked="checked"'); ?> />
79
+			   value="1" <?php if ($_['shareDefaultExpireDateSet'] === 'yes') {
80
+    print_unescaped('checked="checked"');
81
+}
82
+?> />
59 83
 		<label for="shareapiDefaultExpireDate"><?php p($l->t('Set default expiration date'));?></label><br/>
60 84
 
61 85
 	</p>
62
-	<p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden');?>">
86
+	<p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') {
87
+    p('hidden');
88
+}
89
+?>">
63 90
 		<?php p($l->t( 'Expire after ' )); ?>
64 91
 		<input type="text" name='shareapi_expire_after_n_days' id="shareapiExpireAfterNDays" placeholder="<?php p('7')?>"
65 92
 			   value='<?php p($_['shareExpireAfterNDays']) ?>' />
66 93
 		<?php p($l->t( 'days' )); ?>
67 94
 		<input type="checkbox" name="shareapi_enforce_expire_date" id="shareapiEnforceExpireDate" class="checkbox"
68
-			   value="1" <?php if ($_['shareEnforceExpireDate'] === 'yes') print_unescaped('checked="checked"'); ?> />
95
+			   value="1" <?php if ($_['shareEnforceExpireDate'] === 'yes') {
96
+    print_unescaped('checked="checked"');
97
+}
98
+?> />
69 99
 		<label for="shareapiEnforceExpireDate"><?php p($l->t('Enforce expiration date'));?></label><br/>
70 100
 	</p>
71
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
101
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
102
+    p('hidden');
103
+}
104
+?>">
72 105
 		<input type="checkbox" name="shareapi_allow_resharing" id="allowResharing" class="checkbox"
73
-			   value="1" <?php if ($_['allowResharing'] === 'yes') print_unescaped('checked="checked"'); ?> />
106
+			   value="1" <?php if ($_['allowResharing'] === 'yes') {
107
+    print_unescaped('checked="checked"');
108
+}
109
+?> />
74 110
 		<label for="allowResharing"><?php p($l->t('Allow resharing'));?></label><br/>
75 111
 	</p>
76
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
112
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
113
+    p('hidden');
114
+}
115
+?>">
77 116
 		<input type="checkbox" name="shareapi_allow_group_sharing" id="allowGroupSharing" class="checkbox"
78
-			   value="1" <?php if ($_['allowGroupSharing'] === 'yes') print_unescaped('checked="checked"'); ?> />
117
+			   value="1" <?php if ($_['allowGroupSharing'] === 'yes') {
118
+    print_unescaped('checked="checked"');
119
+}
120
+?> />
79 121
 		<label for="allowGroupSharing"><?php p($l->t('Allow sharing with groups'));?></label><br />
80 122
 	</p>
81
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
123
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
124
+    p('hidden');
125
+}
126
+?>">
82 127
 		<input type="checkbox" name="shareapi_only_share_with_group_members" id="onlyShareWithGroupMembers" class="checkbox"
83
-			   value="1" <?php if ($_['onlyShareWithGroupMembers']) print_unescaped('checked="checked"'); ?> />
128
+			   value="1" <?php if ($_['onlyShareWithGroupMembers']) {
129
+    print_unescaped('checked="checked"');
130
+}
131
+?> />
84 132
 		<label for="onlyShareWithGroupMembers"><?php p($l->t('Restrict users to only share with users in their groups'));?></label><br/>
85 133
 	</p>
86
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
134
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
135
+    p('hidden');
136
+}
137
+?>">
87 138
 		<input type="checkbox" name="shareapi_exclude_groups" id="shareapiExcludeGroups" class="checkbox"
88
-			   value="1" <?php if ($_['shareExcludeGroups']) print_unescaped('checked="checked"'); ?> />
139
+			   value="1" <?php if ($_['shareExcludeGroups']) {
140
+    print_unescaped('checked="checked"');
141
+}
142
+?> />
89 143
 		<label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing'));?></label><br/>
90 144
 	</p>
91
-	<p id="selectExcludedGroups" class="indent <?php if (!$_['shareExcludeGroups'] || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>">
145
+	<p id="selectExcludedGroups" class="indent <?php if (!$_['shareExcludeGroups'] || $_['shareAPIEnabled'] === 'no') {
146
+    p('hidden');
147
+}
148
+?>">
92 149
 		<input name="shareapi_exclude_groups_list" type="hidden" id="excludedGroups" value="<?php p($_['shareExcludedGroupsList']) ?>" style="width: 400px" class="noJSAutoUpdate"/>
93 150
 		<br />
94 151
 		<em><?php p($l->t('These groups will still be able to receive shares, but not to initiate them.')); ?></em>
95 152
 	</p>
96
-	<p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>">
153
+	<p class="<?php if ($_['shareAPIEnabled'] === 'no') {
154
+    p('hidden');
155
+}
156
+?>">
97 157
 		<input type="checkbox" name="shareapi_allow_share_dialog_user_enumeration" value="1" id="shareapi_allow_share_dialog_user_enumeration" class="checkbox"
98
-			<?php if ($_['allowShareDialogUserEnumeration'] === 'yes') print_unescaped('checked="checked"'); ?> />
158
+			<?php if ($_['allowShareDialogUserEnumeration'] === 'yes') {
159
+    print_unescaped('checked="checked"');
160
+}
161
+?> />
99 162
 		<label for="shareapi_allow_share_dialog_user_enumeration"><?php p($l->t('Allow username autocompletion in share dialog. If this is disabled the full username or email address needs to be entered.'));?></label><br />
100 163
 	</p>
101 164
 	<p>
102 165
 		<input type="checkbox" id="publicShareDisclaimer" class="checkbox noJSAutoUpdate"
103
-			<?php if ($_['publicShareDisclaimerText'] !== null) print_unescaped('checked="checked"'); ?> />
166
+			<?php if ($_['publicShareDisclaimerText'] !== null) {
167
+    print_unescaped('checked="checked"');
168
+}
169
+?> />
104 170
 		<label for="publicShareDisclaimer"><?php p($l->t('Show disclaimer text on the public link upload page. (Only shown when the file list is hidden.)'));?></label>
105 171
 		<span id="publicShareDisclaimerStatus" class="msg" style="display:none"></span>
106 172
 		<br/>
Please login to merge, or discard this patch.