@@ -30,82 +30,82 @@ |
||
30 | 30 | |
31 | 31 | class Manager { |
32 | 32 | |
33 | - /** @var ContactsStore */ |
|
34 | - private $store; |
|
35 | - |
|
36 | - /** @var ActionProviderStore */ |
|
37 | - private $actionProviderStore; |
|
38 | - |
|
39 | - /** @var IAppManager */ |
|
40 | - private $appManager; |
|
41 | - |
|
42 | - /** |
|
43 | - * @param ContactsStore $store |
|
44 | - * @param ActionProviderStore $actionProviderStore |
|
45 | - * @param IAppManager $appManager |
|
46 | - */ |
|
47 | - public function __construct(ContactsStore $store, ActionProviderStore $actionProviderStore, IAppManager $appManager) { |
|
48 | - $this->store = $store; |
|
49 | - $this->actionProviderStore = $actionProviderStore; |
|
50 | - $this->appManager = $appManager; |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * @param IUser $user |
|
55 | - * @param string $filter |
|
56 | - * @return array |
|
57 | - */ |
|
58 | - public function getEntries(IUser $user, $filter) { |
|
59 | - $entries = $this->store->getContacts($user, $filter); |
|
60 | - |
|
61 | - $sortedEntries = $this->sortEntries($entries); |
|
62 | - $topEntries = array_slice($sortedEntries, 0, 25); |
|
63 | - $this->processEntries($topEntries, $user); |
|
64 | - |
|
65 | - $contactsEnabled = $this->appManager->isEnabledForUser('contacts', $user); |
|
66 | - return [ |
|
67 | - 'contacts' => $topEntries, |
|
68 | - 'contactsAppEnabled' => $contactsEnabled, |
|
69 | - ]; |
|
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * @param IUser $user |
|
74 | - * @param integer $shareType |
|
75 | - * @param string $shareWith |
|
76 | - * @return IEntry |
|
77 | - */ |
|
78 | - public function findOne(IUser $user, $shareType, $shareWith) { |
|
79 | - $entry = $this->store->findOne($user, $shareType, $shareWith); |
|
80 | - if ($entry) { |
|
81 | - $this->processEntries([$entry], $user); |
|
82 | - } |
|
83 | - |
|
84 | - return $entry; |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * @param IEntry[] $entries |
|
89 | - * @return IEntry[] |
|
90 | - */ |
|
91 | - private function sortEntries(array $entries) { |
|
92 | - usort($entries, function(IEntry $entryA, IEntry $entryB) { |
|
93 | - return strcasecmp($entryA->getFullName(), $entryB->getFullName()); |
|
94 | - }); |
|
95 | - return $entries; |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * @param IEntry[] $entries |
|
100 | - * @param IUser $user |
|
101 | - */ |
|
102 | - private function processEntries(array $entries, IUser $user) { |
|
103 | - $providers = $this->actionProviderStore->getProviders($user); |
|
104 | - foreach ($entries as $entry) { |
|
105 | - foreach ($providers as $provider) { |
|
106 | - $provider->process($entry); |
|
107 | - } |
|
108 | - } |
|
109 | - } |
|
33 | + /** @var ContactsStore */ |
|
34 | + private $store; |
|
35 | + |
|
36 | + /** @var ActionProviderStore */ |
|
37 | + private $actionProviderStore; |
|
38 | + |
|
39 | + /** @var IAppManager */ |
|
40 | + private $appManager; |
|
41 | + |
|
42 | + /** |
|
43 | + * @param ContactsStore $store |
|
44 | + * @param ActionProviderStore $actionProviderStore |
|
45 | + * @param IAppManager $appManager |
|
46 | + */ |
|
47 | + public function __construct(ContactsStore $store, ActionProviderStore $actionProviderStore, IAppManager $appManager) { |
|
48 | + $this->store = $store; |
|
49 | + $this->actionProviderStore = $actionProviderStore; |
|
50 | + $this->appManager = $appManager; |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * @param IUser $user |
|
55 | + * @param string $filter |
|
56 | + * @return array |
|
57 | + */ |
|
58 | + public function getEntries(IUser $user, $filter) { |
|
59 | + $entries = $this->store->getContacts($user, $filter); |
|
60 | + |
|
61 | + $sortedEntries = $this->sortEntries($entries); |
|
62 | + $topEntries = array_slice($sortedEntries, 0, 25); |
|
63 | + $this->processEntries($topEntries, $user); |
|
64 | + |
|
65 | + $contactsEnabled = $this->appManager->isEnabledForUser('contacts', $user); |
|
66 | + return [ |
|
67 | + 'contacts' => $topEntries, |
|
68 | + 'contactsAppEnabled' => $contactsEnabled, |
|
69 | + ]; |
|
70 | + } |
|
71 | + |
|
72 | + /** |
|
73 | + * @param IUser $user |
|
74 | + * @param integer $shareType |
|
75 | + * @param string $shareWith |
|
76 | + * @return IEntry |
|
77 | + */ |
|
78 | + public function findOne(IUser $user, $shareType, $shareWith) { |
|
79 | + $entry = $this->store->findOne($user, $shareType, $shareWith); |
|
80 | + if ($entry) { |
|
81 | + $this->processEntries([$entry], $user); |
|
82 | + } |
|
83 | + |
|
84 | + return $entry; |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * @param IEntry[] $entries |
|
89 | + * @return IEntry[] |
|
90 | + */ |
|
91 | + private function sortEntries(array $entries) { |
|
92 | + usort($entries, function(IEntry $entryA, IEntry $entryB) { |
|
93 | + return strcasecmp($entryA->getFullName(), $entryB->getFullName()); |
|
94 | + }); |
|
95 | + return $entries; |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * @param IEntry[] $entries |
|
100 | + * @param IUser $user |
|
101 | + */ |
|
102 | + private function processEntries(array $entries, IUser $user) { |
|
103 | + $providers = $this->actionProviderStore->getProviders($user); |
|
104 | + foreach ($entries as $entry) { |
|
105 | + foreach ($providers as $provider) { |
|
106 | + $provider->process($entry); |
|
107 | + } |
|
108 | + } |
|
109 | + } |
|
110 | 110 | |
111 | 111 | } |
@@ -30,110 +30,110 @@ |
||
30 | 30 | |
31 | 31 | class ContactsStore { |
32 | 32 | |
33 | - /** @var IManager */ |
|
34 | - private $contactsManager; |
|
35 | - |
|
36 | - /** |
|
37 | - * @param IManager $contactsManager |
|
38 | - */ |
|
39 | - public function __construct(IManager $contactsManager) { |
|
40 | - $this->contactsManager = $contactsManager; |
|
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * @param IUser $user |
|
45 | - * @param string|null $filter |
|
46 | - * @return IEntry[] |
|
47 | - */ |
|
48 | - public function getContacts(IUser $user, $filter) { |
|
49 | - $allContacts = $this->contactsManager->search($filter ?: '', [ |
|
50 | - 'FN', |
|
51 | - ]); |
|
52 | - |
|
53 | - $self = $user->getUID(); |
|
54 | - $entries = array_map(function(array $contact) { |
|
55 | - return $this->contactArrayToEntry($contact); |
|
56 | - }, $allContacts); |
|
57 | - return array_filter($entries, function(IEntry $entry) use ($self) { |
|
58 | - return $entry->getProperty('UID') !== $self; |
|
59 | - }); |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * @param IUser $user |
|
64 | - * @param integer $shareType |
|
65 | - * @param string $shareWith |
|
66 | - * @return IEntry|null |
|
67 | - */ |
|
68 | - public function findOne(IUser $user, $shareType, $shareWith) { |
|
69 | - switch($shareType) { |
|
70 | - case 0: |
|
71 | - case 6: |
|
72 | - $filter = ['UID']; |
|
73 | - break; |
|
74 | - case 4: |
|
75 | - $filter = ['EMAIL']; |
|
76 | - break; |
|
77 | - default: |
|
78 | - return null; |
|
79 | - } |
|
80 | - |
|
81 | - $userId = $user->getUID(); |
|
82 | - $allContacts = $this->contactsManager->search($shareWith, $filter); |
|
83 | - $contacts = array_filter($allContacts, function($contact) use ($userId) { |
|
84 | - return $contact['UID'] !== $userId; |
|
85 | - }); |
|
86 | - $match = null; |
|
87 | - |
|
88 | - foreach ($contacts as $contact) { |
|
89 | - if ($shareType === 4 && isset($contact['EMAIL'])) { |
|
90 | - if (in_array($shareWith, $contact['EMAIL'])) { |
|
91 | - $match = $contact; |
|
92 | - break; |
|
93 | - } |
|
94 | - } |
|
95 | - if ($shareType === 0 || $shareType === 6) { |
|
96 | - if ($contact['UID'] === $shareWith && $contact['isLocalSystemBook'] === true) { |
|
97 | - $match = $contact; |
|
98 | - break; |
|
99 | - } |
|
100 | - } |
|
101 | - } |
|
102 | - |
|
103 | - return $match ? $this->contactArrayToEntry($match) : null; |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * @param array $contact |
|
108 | - * @return Entry |
|
109 | - */ |
|
110 | - private function contactArrayToEntry(array $contact) { |
|
111 | - $entry = new Entry(); |
|
112 | - |
|
113 | - if (isset($contact['id'])) { |
|
114 | - $entry->setId($contact['id']); |
|
115 | - } |
|
116 | - |
|
117 | - if (isset($contact['FN'])) { |
|
118 | - $entry->setFullName($contact['FN']); |
|
119 | - } |
|
120 | - |
|
121 | - $avatarPrefix = "VALUE=uri:"; |
|
122 | - if (isset($contact['PHOTO']) && strpos($contact['PHOTO'], $avatarPrefix) === 0) { |
|
123 | - $entry->setAvatar(substr($contact['PHOTO'], strlen($avatarPrefix))); |
|
124 | - } |
|
125 | - |
|
126 | - if (isset($contact['EMAIL'])) { |
|
127 | - foreach ($contact['EMAIL'] as $email) { |
|
128 | - $entry->addEMailAddress($email); |
|
129 | - } |
|
130 | - } |
|
131 | - |
|
132 | - // Attach all other properties to the entry too because some |
|
133 | - // providers might make use of it. |
|
134 | - $entry->setProperties($contact); |
|
135 | - |
|
136 | - return $entry; |
|
137 | - } |
|
33 | + /** @var IManager */ |
|
34 | + private $contactsManager; |
|
35 | + |
|
36 | + /** |
|
37 | + * @param IManager $contactsManager |
|
38 | + */ |
|
39 | + public function __construct(IManager $contactsManager) { |
|
40 | + $this->contactsManager = $contactsManager; |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * @param IUser $user |
|
45 | + * @param string|null $filter |
|
46 | + * @return IEntry[] |
|
47 | + */ |
|
48 | + public function getContacts(IUser $user, $filter) { |
|
49 | + $allContacts = $this->contactsManager->search($filter ?: '', [ |
|
50 | + 'FN', |
|
51 | + ]); |
|
52 | + |
|
53 | + $self = $user->getUID(); |
|
54 | + $entries = array_map(function(array $contact) { |
|
55 | + return $this->contactArrayToEntry($contact); |
|
56 | + }, $allContacts); |
|
57 | + return array_filter($entries, function(IEntry $entry) use ($self) { |
|
58 | + return $entry->getProperty('UID') !== $self; |
|
59 | + }); |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * @param IUser $user |
|
64 | + * @param integer $shareType |
|
65 | + * @param string $shareWith |
|
66 | + * @return IEntry|null |
|
67 | + */ |
|
68 | + public function findOne(IUser $user, $shareType, $shareWith) { |
|
69 | + switch($shareType) { |
|
70 | + case 0: |
|
71 | + case 6: |
|
72 | + $filter = ['UID']; |
|
73 | + break; |
|
74 | + case 4: |
|
75 | + $filter = ['EMAIL']; |
|
76 | + break; |
|
77 | + default: |
|
78 | + return null; |
|
79 | + } |
|
80 | + |
|
81 | + $userId = $user->getUID(); |
|
82 | + $allContacts = $this->contactsManager->search($shareWith, $filter); |
|
83 | + $contacts = array_filter($allContacts, function($contact) use ($userId) { |
|
84 | + return $contact['UID'] !== $userId; |
|
85 | + }); |
|
86 | + $match = null; |
|
87 | + |
|
88 | + foreach ($contacts as $contact) { |
|
89 | + if ($shareType === 4 && isset($contact['EMAIL'])) { |
|
90 | + if (in_array($shareWith, $contact['EMAIL'])) { |
|
91 | + $match = $contact; |
|
92 | + break; |
|
93 | + } |
|
94 | + } |
|
95 | + if ($shareType === 0 || $shareType === 6) { |
|
96 | + if ($contact['UID'] === $shareWith && $contact['isLocalSystemBook'] === true) { |
|
97 | + $match = $contact; |
|
98 | + break; |
|
99 | + } |
|
100 | + } |
|
101 | + } |
|
102 | + |
|
103 | + return $match ? $this->contactArrayToEntry($match) : null; |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * @param array $contact |
|
108 | + * @return Entry |
|
109 | + */ |
|
110 | + private function contactArrayToEntry(array $contact) { |
|
111 | + $entry = new Entry(); |
|
112 | + |
|
113 | + if (isset($contact['id'])) { |
|
114 | + $entry->setId($contact['id']); |
|
115 | + } |
|
116 | + |
|
117 | + if (isset($contact['FN'])) { |
|
118 | + $entry->setFullName($contact['FN']); |
|
119 | + } |
|
120 | + |
|
121 | + $avatarPrefix = "VALUE=uri:"; |
|
122 | + if (isset($contact['PHOTO']) && strpos($contact['PHOTO'], $avatarPrefix) === 0) { |
|
123 | + $entry->setAvatar(substr($contact['PHOTO'], strlen($avatarPrefix))); |
|
124 | + } |
|
125 | + |
|
126 | + if (isset($contact['EMAIL'])) { |
|
127 | + foreach ($contact['EMAIL'] as $email) { |
|
128 | + $entry->addEMailAddress($email); |
|
129 | + } |
|
130 | + } |
|
131 | + |
|
132 | + // Attach all other properties to the entry too because some |
|
133 | + // providers might make use of it. |
|
134 | + $entry->setProperties($contact); |
|
135 | + |
|
136 | + return $entry; |
|
137 | + } |
|
138 | 138 | |
139 | 139 | } |
@@ -66,7 +66,7 @@ |
||
66 | 66 | * @return IEntry|null |
67 | 67 | */ |
68 | 68 | public function findOne(IUser $user, $shareType, $shareWith) { |
69 | - switch($shareType) { |
|
69 | + switch ($shareType) { |
|
70 | 70 | case 0: |
71 | 71 | case 6: |
72 | 72 | $filter = ['UID']; |
@@ -195,38 +195,38 @@ |
||
195 | 195 | $emailVerified = isset($oldData[self::PROPERTY_EMAIL]['verified']) && $oldData[self::PROPERTY_EMAIL]['verified'] === self::VERIFIED; |
196 | 196 | |
197 | 197 | // keep old verification status if we don't have a new one |
198 | - if(!isset($newData[self::PROPERTY_TWITTER]['verified'])) { |
|
198 | + if (!isset($newData[self::PROPERTY_TWITTER]['verified'])) { |
|
199 | 199 | // keep old verification status if value didn't changed and an old value exists |
200 | 200 | $keepOldStatus = $newData[self::PROPERTY_TWITTER]['value'] === $oldData[self::PROPERTY_TWITTER]['value'] && isset($oldData[self::PROPERTY_TWITTER]['verified']); |
201 | 201 | $newData[self::PROPERTY_TWITTER]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_TWITTER]['verified'] : self::NOT_VERIFIED; |
202 | 202 | } |
203 | 203 | |
204 | - if(!isset($newData[self::PROPERTY_WEBSITE]['verified'])) { |
|
204 | + if (!isset($newData[self::PROPERTY_WEBSITE]['verified'])) { |
|
205 | 205 | // keep old verification status if value didn't changed and an old value exists |
206 | 206 | $keepOldStatus = $newData[self::PROPERTY_WEBSITE]['value'] === $oldData[self::PROPERTY_WEBSITE]['value'] && isset($oldData[self::PROPERTY_WEBSITE]['verified']); |
207 | 207 | $newData[self::PROPERTY_WEBSITE]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_WEBSITE]['verified'] : self::NOT_VERIFIED; |
208 | 208 | } |
209 | 209 | |
210 | - if(!isset($newData[self::PROPERTY_EMAIL]['verified'])) { |
|
210 | + if (!isset($newData[self::PROPERTY_EMAIL]['verified'])) { |
|
211 | 211 | // keep old verification status if value didn't changed and an old value exists |
212 | 212 | $keepOldStatus = $newData[self::PROPERTY_EMAIL]['value'] === $oldData[self::PROPERTY_EMAIL]['value'] && isset($oldData[self::PROPERTY_EMAIL]['verified']); |
213 | 213 | $newData[self::PROPERTY_EMAIL]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_EMAIL]['verified'] : self::VERIFICATION_IN_PROGRESS; |
214 | 214 | } |
215 | 215 | |
216 | 216 | // reset verification status if a value from a previously verified data was changed |
217 | - if($twitterVerified && |
|
217 | + if ($twitterVerified && |
|
218 | 218 | $oldData[self::PROPERTY_TWITTER]['value'] !== $newData[self::PROPERTY_TWITTER]['value'] |
219 | 219 | ) { |
220 | 220 | $newData[self::PROPERTY_TWITTER]['verified'] = self::NOT_VERIFIED; |
221 | 221 | } |
222 | 222 | |
223 | - if($websiteVerified && |
|
223 | + if ($websiteVerified && |
|
224 | 224 | $oldData[self::PROPERTY_WEBSITE]['value'] !== $newData[self::PROPERTY_WEBSITE]['value'] |
225 | 225 | ) { |
226 | 226 | $newData[self::PROPERTY_WEBSITE]['verified'] = self::NOT_VERIFIED; |
227 | 227 | } |
228 | 228 | |
229 | - if($emailVerified && |
|
229 | + if ($emailVerified && |
|
230 | 230 | $oldData[self::PROPERTY_EMAIL]['value'] !== $newData[self::PROPERTY_EMAIL]['value'] |
231 | 231 | ) { |
232 | 232 | $newData[self::PROPERTY_EMAIL]['verified'] = self::NOT_VERIFIED; |
@@ -39,292 +39,292 @@ |
||
39 | 39 | */ |
40 | 40 | class AccountManager { |
41 | 41 | |
42 | - /** nobody can see my account details */ |
|
43 | - const VISIBILITY_PRIVATE = 'private'; |
|
44 | - /** only contacts, especially trusted servers can see my contact details */ |
|
45 | - const VISIBILITY_CONTACTS_ONLY = 'contacts'; |
|
46 | - /** every body ca see my contact detail, will be published to the lookup server */ |
|
47 | - const VISIBILITY_PUBLIC = 'public'; |
|
48 | - |
|
49 | - const PROPERTY_AVATAR = 'avatar'; |
|
50 | - const PROPERTY_DISPLAYNAME = 'displayname'; |
|
51 | - const PROPERTY_PHONE = 'phone'; |
|
52 | - const PROPERTY_EMAIL = 'email'; |
|
53 | - const PROPERTY_WEBSITE = 'website'; |
|
54 | - const PROPERTY_ADDRESS = 'address'; |
|
55 | - const PROPERTY_TWITTER = 'twitter'; |
|
56 | - |
|
57 | - const NOT_VERIFIED = '0'; |
|
58 | - const VERIFICATION_IN_PROGRESS = '1'; |
|
59 | - const VERIFIED = '2'; |
|
60 | - |
|
61 | - /** @var IDBConnection database connection */ |
|
62 | - private $connection; |
|
63 | - |
|
64 | - /** @var string table name */ |
|
65 | - private $table = 'accounts'; |
|
66 | - |
|
67 | - /** @var EventDispatcherInterface */ |
|
68 | - private $eventDispatcher; |
|
69 | - |
|
70 | - /** @var IJobList */ |
|
71 | - private $jobList; |
|
72 | - |
|
73 | - /** |
|
74 | - * AccountManager constructor. |
|
75 | - * |
|
76 | - * @param IDBConnection $connection |
|
77 | - * @param EventDispatcherInterface $eventDispatcher |
|
78 | - * @param IJobList $jobList |
|
79 | - */ |
|
80 | - public function __construct(IDBConnection $connection, |
|
81 | - EventDispatcherInterface $eventDispatcher, |
|
82 | - IJobList $jobList) { |
|
83 | - $this->connection = $connection; |
|
84 | - $this->eventDispatcher = $eventDispatcher; |
|
85 | - $this->jobList = $jobList; |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * update user record |
|
90 | - * |
|
91 | - * @param IUser $user |
|
92 | - * @param $data |
|
93 | - */ |
|
94 | - public function updateUser(IUser $user, $data) { |
|
95 | - $userData = $this->getUser($user); |
|
96 | - $updated = true; |
|
97 | - if (empty($userData)) { |
|
98 | - $this->insertNewUser($user, $data); |
|
99 | - } elseif ($userData !== $data) { |
|
100 | - $data = $this->checkEmailVerification($userData, $data, $user); |
|
101 | - $data = $this->updateVerifyStatus($userData, $data); |
|
102 | - $this->updateExistingUser($user, $data); |
|
103 | - } else { |
|
104 | - // nothing needs to be done if new and old data set are the same |
|
105 | - $updated = false; |
|
106 | - } |
|
107 | - |
|
108 | - if ($updated) { |
|
109 | - $this->eventDispatcher->dispatch( |
|
110 | - 'OC\AccountManager::userUpdated', |
|
111 | - new GenericEvent($user, $data) |
|
112 | - ); |
|
113 | - } |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * get stored data from a given user |
|
118 | - * |
|
119 | - * @param IUser $user |
|
120 | - * @return array |
|
121 | - */ |
|
122 | - public function getUser(IUser $user) { |
|
123 | - $uid = $user->getUID(); |
|
124 | - $query = $this->connection->getQueryBuilder(); |
|
125 | - $query->select('data')->from($this->table) |
|
126 | - ->where($query->expr()->eq('uid', $query->createParameter('uid'))) |
|
127 | - ->setParameter('uid', $uid); |
|
128 | - $query->execute(); |
|
129 | - $result = $query->execute()->fetchAll(); |
|
130 | - |
|
131 | - if (empty($result)) { |
|
132 | - $userData = $this->buildDefaultUserRecord($user); |
|
133 | - $this->insertNewUser($user, $userData); |
|
134 | - return $userData; |
|
135 | - } |
|
136 | - |
|
137 | - $userDataArray = json_decode($result[0]['data'], true); |
|
138 | - |
|
139 | - $userDataArray = $this->addMissingDefaultValues($userDataArray); |
|
140 | - |
|
141 | - return $userDataArray; |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * check if we need to ask the server for email verification, if yes we create a cronjob |
|
146 | - * |
|
147 | - * @param $oldData |
|
148 | - * @param $newData |
|
149 | - * @param IUser $user |
|
150 | - * @return array |
|
151 | - */ |
|
152 | - protected function checkEmailVerification($oldData, $newData, IUser $user) { |
|
153 | - if ($oldData[self::PROPERTY_EMAIL]['value'] !== $newData[self::PROPERTY_EMAIL]['value']) { |
|
154 | - $this->jobList->add('OC\Settings\BackgroundJobs\VerifyUserData', |
|
155 | - [ |
|
156 | - 'verificationCode' => '', |
|
157 | - 'data' => $newData[self::PROPERTY_EMAIL]['value'], |
|
158 | - 'type' => self::PROPERTY_EMAIL, |
|
159 | - 'uid' => $user->getUID(), |
|
160 | - 'try' => 0, |
|
161 | - 'lastRun' => time() |
|
162 | - ] |
|
163 | - ); |
|
164 | - $newData[AccountManager::PROPERTY_EMAIL]['verified'] = AccountManager::VERIFICATION_IN_PROGRESS; |
|
165 | - } |
|
166 | - |
|
167 | - return $newData; |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * make sure that all expected data are set |
|
172 | - * |
|
173 | - * @param array $userData |
|
174 | - * @return array |
|
175 | - */ |
|
176 | - protected function addMissingDefaultValues(array $userData) { |
|
177 | - |
|
178 | - foreach ($userData as $key => $value) { |
|
179 | - if (!isset($userData[$key]['verified'])) { |
|
180 | - $userData[$key]['verified'] = self::NOT_VERIFIED; |
|
181 | - } |
|
182 | - } |
|
183 | - |
|
184 | - return $userData; |
|
185 | - } |
|
186 | - |
|
187 | - /** |
|
188 | - * reset verification status if personal data changed |
|
189 | - * |
|
190 | - * @param array $oldData |
|
191 | - * @param array $newData |
|
192 | - * @return array |
|
193 | - */ |
|
194 | - protected function updateVerifyStatus($oldData, $newData) { |
|
195 | - |
|
196 | - // which account was already verified successfully? |
|
197 | - $twitterVerified = isset($oldData[self::PROPERTY_TWITTER]['verified']) && $oldData[self::PROPERTY_TWITTER]['verified'] === self::VERIFIED; |
|
198 | - $websiteVerified = isset($oldData[self::PROPERTY_WEBSITE]['verified']) && $oldData[self::PROPERTY_WEBSITE]['verified'] === self::VERIFIED; |
|
199 | - $emailVerified = isset($oldData[self::PROPERTY_EMAIL]['verified']) && $oldData[self::PROPERTY_EMAIL]['verified'] === self::VERIFIED; |
|
200 | - |
|
201 | - // keep old verification status if we don't have a new one |
|
202 | - if(!isset($newData[self::PROPERTY_TWITTER]['verified'])) { |
|
203 | - // keep old verification status if value didn't changed and an old value exists |
|
204 | - $keepOldStatus = $newData[self::PROPERTY_TWITTER]['value'] === $oldData[self::PROPERTY_TWITTER]['value'] && isset($oldData[self::PROPERTY_TWITTER]['verified']); |
|
205 | - $newData[self::PROPERTY_TWITTER]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_TWITTER]['verified'] : self::NOT_VERIFIED; |
|
206 | - } |
|
207 | - |
|
208 | - if(!isset($newData[self::PROPERTY_WEBSITE]['verified'])) { |
|
209 | - // keep old verification status if value didn't changed and an old value exists |
|
210 | - $keepOldStatus = $newData[self::PROPERTY_WEBSITE]['value'] === $oldData[self::PROPERTY_WEBSITE]['value'] && isset($oldData[self::PROPERTY_WEBSITE]['verified']); |
|
211 | - $newData[self::PROPERTY_WEBSITE]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_WEBSITE]['verified'] : self::NOT_VERIFIED; |
|
212 | - } |
|
213 | - |
|
214 | - if(!isset($newData[self::PROPERTY_EMAIL]['verified'])) { |
|
215 | - // keep old verification status if value didn't changed and an old value exists |
|
216 | - $keepOldStatus = $newData[self::PROPERTY_EMAIL]['value'] === $oldData[self::PROPERTY_EMAIL]['value'] && isset($oldData[self::PROPERTY_EMAIL]['verified']); |
|
217 | - $newData[self::PROPERTY_EMAIL]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_EMAIL]['verified'] : self::VERIFICATION_IN_PROGRESS; |
|
218 | - } |
|
219 | - |
|
220 | - // reset verification status if a value from a previously verified data was changed |
|
221 | - if($twitterVerified && |
|
222 | - $oldData[self::PROPERTY_TWITTER]['value'] !== $newData[self::PROPERTY_TWITTER]['value'] |
|
223 | - ) { |
|
224 | - $newData[self::PROPERTY_TWITTER]['verified'] = self::NOT_VERIFIED; |
|
225 | - } |
|
226 | - |
|
227 | - if($websiteVerified && |
|
228 | - $oldData[self::PROPERTY_WEBSITE]['value'] !== $newData[self::PROPERTY_WEBSITE]['value'] |
|
229 | - ) { |
|
230 | - $newData[self::PROPERTY_WEBSITE]['verified'] = self::NOT_VERIFIED; |
|
231 | - } |
|
232 | - |
|
233 | - if($emailVerified && |
|
234 | - $oldData[self::PROPERTY_EMAIL]['value'] !== $newData[self::PROPERTY_EMAIL]['value'] |
|
235 | - ) { |
|
236 | - $newData[self::PROPERTY_EMAIL]['verified'] = self::NOT_VERIFIED; |
|
237 | - } |
|
238 | - |
|
239 | - return $newData; |
|
240 | - |
|
241 | - } |
|
242 | - |
|
243 | - /** |
|
244 | - * add new user to accounts table |
|
245 | - * |
|
246 | - * @param IUser $user |
|
247 | - * @param array $data |
|
248 | - */ |
|
249 | - protected function insertNewUser(IUser $user, $data) { |
|
250 | - $uid = $user->getUID(); |
|
251 | - $jsonEncodedData = json_encode($data); |
|
252 | - $query = $this->connection->getQueryBuilder(); |
|
253 | - $query->insert($this->table) |
|
254 | - ->values( |
|
255 | - [ |
|
256 | - 'uid' => $query->createNamedParameter($uid), |
|
257 | - 'data' => $query->createNamedParameter($jsonEncodedData), |
|
258 | - ] |
|
259 | - ) |
|
260 | - ->execute(); |
|
261 | - } |
|
262 | - |
|
263 | - /** |
|
264 | - * update existing user in accounts table |
|
265 | - * |
|
266 | - * @param IUser $user |
|
267 | - * @param array $data |
|
268 | - */ |
|
269 | - protected function updateExistingUser(IUser $user, $data) { |
|
270 | - $uid = $user->getUID(); |
|
271 | - $jsonEncodedData = json_encode($data); |
|
272 | - $query = $this->connection->getQueryBuilder(); |
|
273 | - $query->update($this->table) |
|
274 | - ->set('data', $query->createNamedParameter($jsonEncodedData)) |
|
275 | - ->where($query->expr()->eq('uid', $query->createNamedParameter($uid))) |
|
276 | - ->execute(); |
|
277 | - } |
|
278 | - |
|
279 | - /** |
|
280 | - * build default user record in case not data set exists yet |
|
281 | - * |
|
282 | - * @param IUser $user |
|
283 | - * @return array |
|
284 | - */ |
|
285 | - protected function buildDefaultUserRecord(IUser $user) { |
|
286 | - return [ |
|
287 | - self::PROPERTY_DISPLAYNAME => |
|
288 | - [ |
|
289 | - 'value' => $user->getDisplayName(), |
|
290 | - 'scope' => self::VISIBILITY_CONTACTS_ONLY, |
|
291 | - 'verified' => self::NOT_VERIFIED, |
|
292 | - ], |
|
293 | - self::PROPERTY_ADDRESS => |
|
294 | - [ |
|
295 | - 'value' => '', |
|
296 | - 'scope' => self::VISIBILITY_PRIVATE, |
|
297 | - 'verified' => self::NOT_VERIFIED, |
|
298 | - ], |
|
299 | - self::PROPERTY_WEBSITE => |
|
300 | - [ |
|
301 | - 'value' => '', |
|
302 | - 'scope' => self::VISIBILITY_PRIVATE, |
|
303 | - 'verified' => self::NOT_VERIFIED, |
|
304 | - ], |
|
305 | - self::PROPERTY_EMAIL => |
|
306 | - [ |
|
307 | - 'value' => $user->getEMailAddress(), |
|
308 | - 'scope' => self::VISIBILITY_CONTACTS_ONLY, |
|
309 | - 'verified' => self::NOT_VERIFIED, |
|
310 | - ], |
|
311 | - self::PROPERTY_AVATAR => |
|
312 | - [ |
|
313 | - 'scope' => self::VISIBILITY_CONTACTS_ONLY |
|
314 | - ], |
|
315 | - self::PROPERTY_PHONE => |
|
316 | - [ |
|
317 | - 'value' => '', |
|
318 | - 'scope' => self::VISIBILITY_PRIVATE, |
|
319 | - 'verified' => self::NOT_VERIFIED, |
|
320 | - ], |
|
321 | - self::PROPERTY_TWITTER => |
|
322 | - [ |
|
323 | - 'value' => '', |
|
324 | - 'scope' => self::VISIBILITY_PRIVATE, |
|
325 | - 'verified' => self::NOT_VERIFIED, |
|
326 | - ], |
|
327 | - ]; |
|
328 | - } |
|
42 | + /** nobody can see my account details */ |
|
43 | + const VISIBILITY_PRIVATE = 'private'; |
|
44 | + /** only contacts, especially trusted servers can see my contact details */ |
|
45 | + const VISIBILITY_CONTACTS_ONLY = 'contacts'; |
|
46 | + /** every body ca see my contact detail, will be published to the lookup server */ |
|
47 | + const VISIBILITY_PUBLIC = 'public'; |
|
48 | + |
|
49 | + const PROPERTY_AVATAR = 'avatar'; |
|
50 | + const PROPERTY_DISPLAYNAME = 'displayname'; |
|
51 | + const PROPERTY_PHONE = 'phone'; |
|
52 | + const PROPERTY_EMAIL = 'email'; |
|
53 | + const PROPERTY_WEBSITE = 'website'; |
|
54 | + const PROPERTY_ADDRESS = 'address'; |
|
55 | + const PROPERTY_TWITTER = 'twitter'; |
|
56 | + |
|
57 | + const NOT_VERIFIED = '0'; |
|
58 | + const VERIFICATION_IN_PROGRESS = '1'; |
|
59 | + const VERIFIED = '2'; |
|
60 | + |
|
61 | + /** @var IDBConnection database connection */ |
|
62 | + private $connection; |
|
63 | + |
|
64 | + /** @var string table name */ |
|
65 | + private $table = 'accounts'; |
|
66 | + |
|
67 | + /** @var EventDispatcherInterface */ |
|
68 | + private $eventDispatcher; |
|
69 | + |
|
70 | + /** @var IJobList */ |
|
71 | + private $jobList; |
|
72 | + |
|
73 | + /** |
|
74 | + * AccountManager constructor. |
|
75 | + * |
|
76 | + * @param IDBConnection $connection |
|
77 | + * @param EventDispatcherInterface $eventDispatcher |
|
78 | + * @param IJobList $jobList |
|
79 | + */ |
|
80 | + public function __construct(IDBConnection $connection, |
|
81 | + EventDispatcherInterface $eventDispatcher, |
|
82 | + IJobList $jobList) { |
|
83 | + $this->connection = $connection; |
|
84 | + $this->eventDispatcher = $eventDispatcher; |
|
85 | + $this->jobList = $jobList; |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * update user record |
|
90 | + * |
|
91 | + * @param IUser $user |
|
92 | + * @param $data |
|
93 | + */ |
|
94 | + public function updateUser(IUser $user, $data) { |
|
95 | + $userData = $this->getUser($user); |
|
96 | + $updated = true; |
|
97 | + if (empty($userData)) { |
|
98 | + $this->insertNewUser($user, $data); |
|
99 | + } elseif ($userData !== $data) { |
|
100 | + $data = $this->checkEmailVerification($userData, $data, $user); |
|
101 | + $data = $this->updateVerifyStatus($userData, $data); |
|
102 | + $this->updateExistingUser($user, $data); |
|
103 | + } else { |
|
104 | + // nothing needs to be done if new and old data set are the same |
|
105 | + $updated = false; |
|
106 | + } |
|
107 | + |
|
108 | + if ($updated) { |
|
109 | + $this->eventDispatcher->dispatch( |
|
110 | + 'OC\AccountManager::userUpdated', |
|
111 | + new GenericEvent($user, $data) |
|
112 | + ); |
|
113 | + } |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * get stored data from a given user |
|
118 | + * |
|
119 | + * @param IUser $user |
|
120 | + * @return array |
|
121 | + */ |
|
122 | + public function getUser(IUser $user) { |
|
123 | + $uid = $user->getUID(); |
|
124 | + $query = $this->connection->getQueryBuilder(); |
|
125 | + $query->select('data')->from($this->table) |
|
126 | + ->where($query->expr()->eq('uid', $query->createParameter('uid'))) |
|
127 | + ->setParameter('uid', $uid); |
|
128 | + $query->execute(); |
|
129 | + $result = $query->execute()->fetchAll(); |
|
130 | + |
|
131 | + if (empty($result)) { |
|
132 | + $userData = $this->buildDefaultUserRecord($user); |
|
133 | + $this->insertNewUser($user, $userData); |
|
134 | + return $userData; |
|
135 | + } |
|
136 | + |
|
137 | + $userDataArray = json_decode($result[0]['data'], true); |
|
138 | + |
|
139 | + $userDataArray = $this->addMissingDefaultValues($userDataArray); |
|
140 | + |
|
141 | + return $userDataArray; |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * check if we need to ask the server for email verification, if yes we create a cronjob |
|
146 | + * |
|
147 | + * @param $oldData |
|
148 | + * @param $newData |
|
149 | + * @param IUser $user |
|
150 | + * @return array |
|
151 | + */ |
|
152 | + protected function checkEmailVerification($oldData, $newData, IUser $user) { |
|
153 | + if ($oldData[self::PROPERTY_EMAIL]['value'] !== $newData[self::PROPERTY_EMAIL]['value']) { |
|
154 | + $this->jobList->add('OC\Settings\BackgroundJobs\VerifyUserData', |
|
155 | + [ |
|
156 | + 'verificationCode' => '', |
|
157 | + 'data' => $newData[self::PROPERTY_EMAIL]['value'], |
|
158 | + 'type' => self::PROPERTY_EMAIL, |
|
159 | + 'uid' => $user->getUID(), |
|
160 | + 'try' => 0, |
|
161 | + 'lastRun' => time() |
|
162 | + ] |
|
163 | + ); |
|
164 | + $newData[AccountManager::PROPERTY_EMAIL]['verified'] = AccountManager::VERIFICATION_IN_PROGRESS; |
|
165 | + } |
|
166 | + |
|
167 | + return $newData; |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * make sure that all expected data are set |
|
172 | + * |
|
173 | + * @param array $userData |
|
174 | + * @return array |
|
175 | + */ |
|
176 | + protected function addMissingDefaultValues(array $userData) { |
|
177 | + |
|
178 | + foreach ($userData as $key => $value) { |
|
179 | + if (!isset($userData[$key]['verified'])) { |
|
180 | + $userData[$key]['verified'] = self::NOT_VERIFIED; |
|
181 | + } |
|
182 | + } |
|
183 | + |
|
184 | + return $userData; |
|
185 | + } |
|
186 | + |
|
187 | + /** |
|
188 | + * reset verification status if personal data changed |
|
189 | + * |
|
190 | + * @param array $oldData |
|
191 | + * @param array $newData |
|
192 | + * @return array |
|
193 | + */ |
|
194 | + protected function updateVerifyStatus($oldData, $newData) { |
|
195 | + |
|
196 | + // which account was already verified successfully? |
|
197 | + $twitterVerified = isset($oldData[self::PROPERTY_TWITTER]['verified']) && $oldData[self::PROPERTY_TWITTER]['verified'] === self::VERIFIED; |
|
198 | + $websiteVerified = isset($oldData[self::PROPERTY_WEBSITE]['verified']) && $oldData[self::PROPERTY_WEBSITE]['verified'] === self::VERIFIED; |
|
199 | + $emailVerified = isset($oldData[self::PROPERTY_EMAIL]['verified']) && $oldData[self::PROPERTY_EMAIL]['verified'] === self::VERIFIED; |
|
200 | + |
|
201 | + // keep old verification status if we don't have a new one |
|
202 | + if(!isset($newData[self::PROPERTY_TWITTER]['verified'])) { |
|
203 | + // keep old verification status if value didn't changed and an old value exists |
|
204 | + $keepOldStatus = $newData[self::PROPERTY_TWITTER]['value'] === $oldData[self::PROPERTY_TWITTER]['value'] && isset($oldData[self::PROPERTY_TWITTER]['verified']); |
|
205 | + $newData[self::PROPERTY_TWITTER]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_TWITTER]['verified'] : self::NOT_VERIFIED; |
|
206 | + } |
|
207 | + |
|
208 | + if(!isset($newData[self::PROPERTY_WEBSITE]['verified'])) { |
|
209 | + // keep old verification status if value didn't changed and an old value exists |
|
210 | + $keepOldStatus = $newData[self::PROPERTY_WEBSITE]['value'] === $oldData[self::PROPERTY_WEBSITE]['value'] && isset($oldData[self::PROPERTY_WEBSITE]['verified']); |
|
211 | + $newData[self::PROPERTY_WEBSITE]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_WEBSITE]['verified'] : self::NOT_VERIFIED; |
|
212 | + } |
|
213 | + |
|
214 | + if(!isset($newData[self::PROPERTY_EMAIL]['verified'])) { |
|
215 | + // keep old verification status if value didn't changed and an old value exists |
|
216 | + $keepOldStatus = $newData[self::PROPERTY_EMAIL]['value'] === $oldData[self::PROPERTY_EMAIL]['value'] && isset($oldData[self::PROPERTY_EMAIL]['verified']); |
|
217 | + $newData[self::PROPERTY_EMAIL]['verified'] = $keepOldStatus ? $oldData[self::PROPERTY_EMAIL]['verified'] : self::VERIFICATION_IN_PROGRESS; |
|
218 | + } |
|
219 | + |
|
220 | + // reset verification status if a value from a previously verified data was changed |
|
221 | + if($twitterVerified && |
|
222 | + $oldData[self::PROPERTY_TWITTER]['value'] !== $newData[self::PROPERTY_TWITTER]['value'] |
|
223 | + ) { |
|
224 | + $newData[self::PROPERTY_TWITTER]['verified'] = self::NOT_VERIFIED; |
|
225 | + } |
|
226 | + |
|
227 | + if($websiteVerified && |
|
228 | + $oldData[self::PROPERTY_WEBSITE]['value'] !== $newData[self::PROPERTY_WEBSITE]['value'] |
|
229 | + ) { |
|
230 | + $newData[self::PROPERTY_WEBSITE]['verified'] = self::NOT_VERIFIED; |
|
231 | + } |
|
232 | + |
|
233 | + if($emailVerified && |
|
234 | + $oldData[self::PROPERTY_EMAIL]['value'] !== $newData[self::PROPERTY_EMAIL]['value'] |
|
235 | + ) { |
|
236 | + $newData[self::PROPERTY_EMAIL]['verified'] = self::NOT_VERIFIED; |
|
237 | + } |
|
238 | + |
|
239 | + return $newData; |
|
240 | + |
|
241 | + } |
|
242 | + |
|
243 | + /** |
|
244 | + * add new user to accounts table |
|
245 | + * |
|
246 | + * @param IUser $user |
|
247 | + * @param array $data |
|
248 | + */ |
|
249 | + protected function insertNewUser(IUser $user, $data) { |
|
250 | + $uid = $user->getUID(); |
|
251 | + $jsonEncodedData = json_encode($data); |
|
252 | + $query = $this->connection->getQueryBuilder(); |
|
253 | + $query->insert($this->table) |
|
254 | + ->values( |
|
255 | + [ |
|
256 | + 'uid' => $query->createNamedParameter($uid), |
|
257 | + 'data' => $query->createNamedParameter($jsonEncodedData), |
|
258 | + ] |
|
259 | + ) |
|
260 | + ->execute(); |
|
261 | + } |
|
262 | + |
|
263 | + /** |
|
264 | + * update existing user in accounts table |
|
265 | + * |
|
266 | + * @param IUser $user |
|
267 | + * @param array $data |
|
268 | + */ |
|
269 | + protected function updateExistingUser(IUser $user, $data) { |
|
270 | + $uid = $user->getUID(); |
|
271 | + $jsonEncodedData = json_encode($data); |
|
272 | + $query = $this->connection->getQueryBuilder(); |
|
273 | + $query->update($this->table) |
|
274 | + ->set('data', $query->createNamedParameter($jsonEncodedData)) |
|
275 | + ->where($query->expr()->eq('uid', $query->createNamedParameter($uid))) |
|
276 | + ->execute(); |
|
277 | + } |
|
278 | + |
|
279 | + /** |
|
280 | + * build default user record in case not data set exists yet |
|
281 | + * |
|
282 | + * @param IUser $user |
|
283 | + * @return array |
|
284 | + */ |
|
285 | + protected function buildDefaultUserRecord(IUser $user) { |
|
286 | + return [ |
|
287 | + self::PROPERTY_DISPLAYNAME => |
|
288 | + [ |
|
289 | + 'value' => $user->getDisplayName(), |
|
290 | + 'scope' => self::VISIBILITY_CONTACTS_ONLY, |
|
291 | + 'verified' => self::NOT_VERIFIED, |
|
292 | + ], |
|
293 | + self::PROPERTY_ADDRESS => |
|
294 | + [ |
|
295 | + 'value' => '', |
|
296 | + 'scope' => self::VISIBILITY_PRIVATE, |
|
297 | + 'verified' => self::NOT_VERIFIED, |
|
298 | + ], |
|
299 | + self::PROPERTY_WEBSITE => |
|
300 | + [ |
|
301 | + 'value' => '', |
|
302 | + 'scope' => self::VISIBILITY_PRIVATE, |
|
303 | + 'verified' => self::NOT_VERIFIED, |
|
304 | + ], |
|
305 | + self::PROPERTY_EMAIL => |
|
306 | + [ |
|
307 | + 'value' => $user->getEMailAddress(), |
|
308 | + 'scope' => self::VISIBILITY_CONTACTS_ONLY, |
|
309 | + 'verified' => self::NOT_VERIFIED, |
|
310 | + ], |
|
311 | + self::PROPERTY_AVATAR => |
|
312 | + [ |
|
313 | + 'scope' => self::VISIBILITY_CONTACTS_ONLY |
|
314 | + ], |
|
315 | + self::PROPERTY_PHONE => |
|
316 | + [ |
|
317 | + 'value' => '', |
|
318 | + 'scope' => self::VISIBILITY_PRIVATE, |
|
319 | + 'verified' => self::NOT_VERIFIED, |
|
320 | + ], |
|
321 | + self::PROPERTY_TWITTER => |
|
322 | + [ |
|
323 | + 'value' => '', |
|
324 | + 'scope' => self::VISIBILITY_PRIVATE, |
|
325 | + 'verified' => self::NOT_VERIFIED, |
|
326 | + ], |
|
327 | + ]; |
|
328 | + } |
|
329 | 329 | |
330 | 330 | } |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | <div id="app-navigation"> |
12 | 12 | <ul class="with-icon"> |
13 | 13 | <?php foreach($_['forms'] as $form) { |
14 | - if (isset($form['anchor'])) { |
|
15 | - $anchor = '#' . $form['anchor']; |
|
16 | - $class = 'nav-icon-' . $form['anchor']; |
|
17 | - $sectionName = $form['section-name']; |
|
18 | - print_unescaped(sprintf("<li><a href='%s' class='%s'>%s</a></li>", \OCP\Util::sanitizeHTML($anchor), |
|
19 | - \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName))); |
|
20 | - } |
|
21 | - }?> |
|
14 | + if (isset($form['anchor'])) { |
|
15 | + $anchor = '#' . $form['anchor']; |
|
16 | + $class = 'nav-icon-' . $form['anchor']; |
|
17 | + $sectionName = $form['section-name']; |
|
18 | + print_unescaped(sprintf("<li><a href='%s' class='%s'>%s</a></li>", \OCP\Util::sanitizeHTML($anchor), |
|
19 | + \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName))); |
|
20 | + } |
|
21 | + }?> |
|
22 | 22 | </ul> |
23 | 23 | </div> |
24 | 24 | |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | <p id="quotatext"> |
31 | 31 | <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?> |
32 | 32 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>', |
33 | - [$_['usage'], $_['total_space']]));?> |
|
33 | + [$_['usage'], $_['total_space']]));?> |
|
34 | 34 | <?php else: ?> |
35 | 35 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)', |
36 | - [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
36 | + [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
37 | 37 | <?php endif ?> |
38 | 38 | </p> |
39 | 39 | </div> |
@@ -101,17 +101,17 @@ discard block |
||
101 | 101 | </h2> |
102 | 102 | <div class="verify <?php if ($_['email'] === '') p('hidden'); ?>"> |
103 | 103 | <img id="verify-email" <?php |
104 | - switch($_['emailVerification']) { |
|
105 | - case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
106 | - print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="' . \OC::$server->getL10N()->t('Verifying …') . '"'); |
|
107 | - break; |
|
108 | - case \OC\Accounts\AccountManager::VERIFIED: |
|
109 | - print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"' . \OC::$server->getL10N()->t('Verified') . '"'); |
|
110 | - break; |
|
111 | - default: |
|
112 | - print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="' . \OC::$server->getL10N()->t('Verify') . '"'); |
|
113 | - } |
|
114 | - ?>> |
|
104 | + switch($_['emailVerification']) { |
|
105 | + case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
106 | + print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="' . \OC::$server->getL10N()->t('Verifying …') . '"'); |
|
107 | + break; |
|
108 | + case \OC\Accounts\AccountManager::VERIFIED: |
|
109 | + print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"' . \OC::$server->getL10N()->t('Verified') . '"'); |
|
110 | + break; |
|
111 | + default: |
|
112 | + print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="' . \OC::$server->getL10N()->t('Verify') . '"'); |
|
113 | + } |
|
114 | + ?>> |
|
115 | 115 | </div> |
116 | 116 | <input type="email" name="email" id="email" value="<?php p($_['email']); ?>" |
117 | 117 | <?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> |
@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | </h2> |
168 | 168 | <div class="verify <?php if ($_['website'] === '') p('hidden'); ?>"> |
169 | 169 | <img id="verify-website" <?php |
170 | - switch($_['websiteVerification']) { |
|
171 | - case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
172 | - print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="' . \OC::$server->getL10N()->t('Verifying …') . '"'); |
|
173 | - break; |
|
174 | - case \OC\Accounts\AccountManager::VERIFIED: |
|
175 | - print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"' . \OC::$server->getL10N()->t('Verified') . '"'); |
|
176 | - break; |
|
177 | - default: |
|
178 | - print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="' . \OC::$server->getL10N()->t('Verify') . '" class="verify-action"'); |
|
179 | - } |
|
180 | - ?>> |
|
170 | + switch($_['websiteVerification']) { |
|
171 | + case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
172 | + print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="' . \OC::$server->getL10N()->t('Verifying …') . '"'); |
|
173 | + break; |
|
174 | + case \OC\Accounts\AccountManager::VERIFIED: |
|
175 | + print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"' . \OC::$server->getL10N()->t('Verified') . '"'); |
|
176 | + break; |
|
177 | + default: |
|
178 | + print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="' . \OC::$server->getL10N()->t('Verify') . '" class="verify-action"'); |
|
179 | + } |
|
180 | + ?>> |
|
181 | 181 | <div class="verification-dialog popovermenu bubble menu"> |
182 | 182 | <div class="verification-dialog-content"> |
183 | 183 | <p class="explainVerification"></p> |
@@ -201,17 +201,17 @@ discard block |
||
201 | 201 | </h2> |
202 | 202 | <div class="verify <?php if ($_['twitter'] === '') p('hidden'); ?>"> |
203 | 203 | <img id="verify-twitter" <?php |
204 | - switch($_['twitterVerification']) { |
|
205 | - case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
206 | - print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="' . \OC::$server->getL10N()->t('Verifying …') . '"'); |
|
207 | - break; |
|
208 | - case \OC\Accounts\AccountManager::VERIFIED: |
|
209 | - print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"' . \OC::$server->getL10N()->t('Verified') . '"'); |
|
210 | - break; |
|
211 | - default: |
|
212 | - print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="' . \OC::$server->getL10N()->t('Verify') . '" class="verify-action"'); |
|
213 | - } |
|
214 | - ?>> |
|
204 | + switch($_['twitterVerification']) { |
|
205 | + case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
|
206 | + print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="' . \OC::$server->getL10N()->t('Verifying …') . '"'); |
|
207 | + break; |
|
208 | + case \OC\Accounts\AccountManager::VERIFIED: |
|
209 | + print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"' . \OC::$server->getL10N()->t('Verified') . '"'); |
|
210 | + break; |
|
211 | + default: |
|
212 | + print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="' . \OC::$server->getL10N()->t('Verify') . '" class="verify-action"'); |
|
213 | + } |
|
214 | + ?>> |
|
215 | 215 | <div class="verification-dialog popovermenu bubble menu"> |
216 | 216 | <div class="verification-dialog-content"> |
217 | 217 | <p class="explainVerification"></p> |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | <?php |
244 | 244 | if($_['passwordChangeSupported']) { |
245 | - script('jquery-showpassword'); |
|
245 | + script('jquery-showpassword'); |
|
246 | 246 | ?> |
247 | 247 | <form id="passwordform" class="section"> |
248 | 248 | <h2 class="inlineblock"><?php p($l->t('Password'));?></h2> |
@@ -311,15 +311,15 @@ discard block |
||
311 | 311 | |
312 | 312 | <p> |
313 | 313 | <?php print_unescaped(str_replace( |
314 | - [ |
|
315 | - '{contributeopen}', |
|
316 | - '{linkclose}', |
|
317 | - ], |
|
318 | - [ |
|
319 | - '<a href="https://nextcloud.com/contribute" target="_blank" rel="noreferrer">', |
|
320 | - '</a>', |
|
321 | - ], |
|
322 | - $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?> |
|
314 | + [ |
|
315 | + '{contributeopen}', |
|
316 | + '{linkclose}', |
|
317 | + ], |
|
318 | + [ |
|
319 | + '<a href="https://nextcloud.com/contribute" target="_blank" rel="noreferrer">', |
|
320 | + '</a>', |
|
321 | + ], |
|
322 | + $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?> |
|
323 | 323 | </p> |
324 | 324 | |
325 | 325 | <?php if(OC_APP::isEnabled('firstrunwizard')) {?> |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | </div> |
381 | 381 | |
382 | 382 | <?php foreach($_['forms'] as $form) { |
383 | - if (isset($form['form'])) {?> |
|
383 | + if (isset($form['form'])) {?> |
|
384 | 384 | <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div> |
385 | 385 | <?php } |
386 | 386 | };?> |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | |
11 | 11 | <div id="app-navigation"> |
12 | 12 | <ul class="with-icon"> |
13 | - <?php foreach($_['forms'] as $form) { |
|
13 | + <?php foreach ($_['forms'] as $form) { |
|
14 | 14 | if (isset($form['anchor'])) { |
15 | - $anchor = '#' . $form['anchor']; |
|
16 | - $class = 'nav-icon-' . $form['anchor']; |
|
15 | + $anchor = '#'.$form['anchor']; |
|
16 | + $class = 'nav-icon-'.$form['anchor']; |
|
17 | 17 | $sectionName = $form['section-name']; |
18 | 18 | print_unescaped(sprintf("<li><a href='%s' class='%s'>%s</a></li>", \OCP\Util::sanitizeHTML($anchor), |
19 | 19 | \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName))); |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | <div id="app-content"> |
26 | 26 | |
27 | 27 | <div id="quota" class="section"> |
28 | - <div style="width:<?php p($_['usage_relative']);?>%" |
|
29 | - <?php if($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>> |
|
28 | + <div style="width:<?php p($_['usage_relative']); ?>%" |
|
29 | + <?php if ($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>> |
|
30 | 30 | <p id="quotatext"> |
31 | 31 | <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?> |
32 | 32 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>', |
33 | - [$_['usage'], $_['total_space']]));?> |
|
33 | + [$_['usage'], $_['total_space']])); ?> |
|
34 | 34 | <?php else: ?> |
35 | 35 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)', |
36 | - [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
36 | + [$_['usage'], $_['total_space'], $_['usage_relative']])); ?> |
|
37 | 37 | <?php endif ?> |
38 | 38 | </p> |
39 | 39 | </div> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | </div> |
68 | 68 | </div> |
69 | 69 | <span class="icon-checkmark hidden"/> |
70 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
70 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
71 | 71 | <input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>"> |
72 | 72 | <?php } ?> |
73 | 73 | </form> |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | <span class="icon-password"/> |
82 | 82 | </h2> |
83 | 83 | <input type="text" id="displayname" name="displayname" |
84 | - <?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> |
|
84 | + <?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> |
|
85 | 85 | value="<?php p($_['displayName']) ?>" |
86 | 86 | autocomplete="on" autocapitalize="none" autocorrect="off" /> |
87 | - <?php if(!$_['displayNameChangeSupported']) { ?> |
|
88 | - <span><?php if(isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span> |
|
87 | + <?php if (!$_['displayNameChangeSupported']) { ?> |
|
88 | + <span><?php if (isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span> |
|
89 | 89 | <?php } ?> |
90 | 90 | <span class="icon-checkmark hidden"/> |
91 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
91 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
92 | 92 | <input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>"> |
93 | 93 | <?php } ?> |
94 | 94 | </form> |
@@ -101,36 +101,36 @@ discard block |
||
101 | 101 | </h2> |
102 | 102 | <div class="verify <?php if ($_['email'] === '') p('hidden'); ?>"> |
103 | 103 | <img id="verify-email" <?php |
104 | - switch($_['emailVerification']) { |
|
104 | + switch ($_['emailVerification']) { |
|
105 | 105 | case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
106 | - print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="' . \OC::$server->getL10N()->t('Verifying …') . '"'); |
|
106 | + print_unescaped('src="'.image_path('core', 'actions/verifying.svg').'" title="'.\OC::$server->getL10N()->t('Verifying …').'"'); |
|
107 | 107 | break; |
108 | 108 | case \OC\Accounts\AccountManager::VERIFIED: |
109 | - print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"' . \OC::$server->getL10N()->t('Verified') . '"'); |
|
109 | + print_unescaped('src="'.image_path('core', 'actions/verified.svg').'"'.\OC::$server->getL10N()->t('Verified').'"'); |
|
110 | 110 | break; |
111 | 111 | default: |
112 | - print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="' . \OC::$server->getL10N()->t('Verify') . '"'); |
|
112 | + print_unescaped('src="'.image_path('core', 'actions/verify.svg').'" title="'.\OC::$server->getL10N()->t('Verify').'"'); |
|
113 | 113 | } |
114 | 114 | ?>> |
115 | 115 | </div> |
116 | 116 | <input type="email" name="email" id="email" value="<?php p($_['email']); ?>" |
117 | - <?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> |
|
117 | + <?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> |
|
118 | 118 | placeholder="<?php p($l->t('Your email address')); ?>" |
119 | 119 | autocomplete="on" autocapitalize="none" autocorrect="off" /> |
120 | - <?php if(!$_['displayNameChangeSupported']) { ?> |
|
121 | - <span><?php if(isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span> |
|
120 | + <?php if (!$_['displayNameChangeSupported']) { ?> |
|
121 | + <span><?php if (isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span> |
|
122 | 122 | <?php } ?> |
123 | - <?php if($_['displayNameChangeSupported']) { ?> |
|
123 | + <?php if ($_['displayNameChangeSupported']) { ?> |
|
124 | 124 | <br /> |
125 | 125 | <em><?php p($l->t('For password reset and notifications')); ?></em> |
126 | 126 | <?php } ?> |
127 | 127 | <span class="icon-checkmark hidden"/> |
128 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
128 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
129 | 129 | <input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>"> |
130 | 130 | <?php } ?> |
131 | 131 | </form> |
132 | 132 | </div> |
133 | - <?php if($_['lookupServerUploadEnabled']) { ?> |
|
133 | + <?php if ($_['lookupServerUploadEnabled']) { ?> |
|
134 | 134 | <div class="personal-settings-setting-box"> |
135 | 135 | <form id="phoneform" class="section"> |
136 | 136 | <h2> |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | </h2> |
168 | 168 | <div class="verify <?php if ($_['website'] === '') p('hidden'); ?>"> |
169 | 169 | <img id="verify-website" <?php |
170 | - switch($_['websiteVerification']) { |
|
170 | + switch ($_['websiteVerification']) { |
|
171 | 171 | case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
172 | - print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="' . \OC::$server->getL10N()->t('Verifying …') . '"'); |
|
172 | + print_unescaped('src="'.image_path('core', 'actions/verifying.svg').'" title="'.\OC::$server->getL10N()->t('Verifying …').'"'); |
|
173 | 173 | break; |
174 | 174 | case \OC\Accounts\AccountManager::VERIFIED: |
175 | - print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"' . \OC::$server->getL10N()->t('Verified') . '"'); |
|
175 | + print_unescaped('src="'.image_path('core', 'actions/verified.svg').'"'.\OC::$server->getL10N()->t('Verified').'"'); |
|
176 | 176 | break; |
177 | 177 | default: |
178 | - print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="' . \OC::$server->getL10N()->t('Verify') . '" class="verify-action"'); |
|
178 | + print_unescaped('src="'.image_path('core', 'actions/verify.svg').'" title="'.\OC::$server->getL10N()->t('Verify').'" class="verify-action"'); |
|
179 | 179 | } |
180 | 180 | ?>> |
181 | 181 | <div class="verification-dialog popovermenu bubble menu"> |
182 | 182 | <div class="verification-dialog-content"> |
183 | 183 | <p class="explainVerification"></p> |
184 | 184 | <p class="verificationCode"></p> |
185 | - <p><?php p(\OC::$server->getL10N('settings')->t('It can take up to 24 hours before the account is displayed as verified.'));?></p> |
|
185 | + <p><?php p(\OC::$server->getL10N('settings')->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p> |
|
186 | 186 | </div> |
187 | 187 | </div> |
188 | 188 | </div> |
@@ -201,22 +201,22 @@ discard block |
||
201 | 201 | </h2> |
202 | 202 | <div class="verify <?php if ($_['twitter'] === '') p('hidden'); ?>"> |
203 | 203 | <img id="verify-twitter" <?php |
204 | - switch($_['twitterVerification']) { |
|
204 | + switch ($_['twitterVerification']) { |
|
205 | 205 | case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
206 | - print_unescaped('src="' . image_path('core', 'actions/verifying.svg') . '" title="' . \OC::$server->getL10N()->t('Verifying …') . '"'); |
|
206 | + print_unescaped('src="'.image_path('core', 'actions/verifying.svg').'" title="'.\OC::$server->getL10N()->t('Verifying …').'"'); |
|
207 | 207 | break; |
208 | 208 | case \OC\Accounts\AccountManager::VERIFIED: |
209 | - print_unescaped('src="' . image_path('core', 'actions/verified.svg') . '"' . \OC::$server->getL10N()->t('Verified') . '"'); |
|
209 | + print_unescaped('src="'.image_path('core', 'actions/verified.svg').'"'.\OC::$server->getL10N()->t('Verified').'"'); |
|
210 | 210 | break; |
211 | 211 | default: |
212 | - print_unescaped('src="' . image_path('core', 'actions/verify.svg') . '" title="' . \OC::$server->getL10N()->t('Verify') . '" class="verify-action"'); |
|
212 | + print_unescaped('src="'.image_path('core', 'actions/verify.svg').'" title="'.\OC::$server->getL10N()->t('Verify').'" class="verify-action"'); |
|
213 | 213 | } |
214 | 214 | ?>> |
215 | 215 | <div class="verification-dialog popovermenu bubble menu"> |
216 | 216 | <div class="verification-dialog-content"> |
217 | 217 | <p class="explainVerification"></p> |
218 | 218 | <p class="verificationCode"></p> |
219 | - <p><?php p(\OC::$server->getL10N('settings')->t('It can take up to 24 hours before the account is displayed as verified.'));?></p> |
|
219 | + <p><?php p(\OC::$server->getL10N('settings')->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p> |
|
220 | 220 | </div> |
221 | 221 | </div> |
222 | 222 | </div> |
@@ -241,19 +241,19 @@ discard block |
||
241 | 241 | </div> |
242 | 242 | |
243 | 243 | <?php |
244 | -if($_['passwordChangeSupported']) { |
|
244 | +if ($_['passwordChangeSupported']) { |
|
245 | 245 | script('jquery-showpassword'); |
246 | 246 | ?> |
247 | 247 | <form id="passwordform" class="section"> |
248 | - <h2 class="inlineblock"><?php p($l->t('Password'));?></h2> |
|
248 | + <h2 class="inlineblock"><?php p($l->t('Password')); ?></h2> |
|
249 | 249 | <div id="password-error-msg" class="msg success inlineblock" style="display: none;">Saved</div> |
250 | 250 | <br> |
251 | 251 | <label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label> |
252 | 252 | <input type="password" id="pass1" name="oldpassword" |
253 | - placeholder="<?php p($l->t('Current password'));?>" |
|
253 | + placeholder="<?php p($l->t('Current password')); ?>" |
|
254 | 254 | autocomplete="off" autocapitalize="none" autocorrect="off" /> |
255 | 255 | <div class="personal-show-container"> |
256 | - <label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label> |
|
256 | + <label for="pass2" class="hidden-visually"><?php p($l->t('New password')); ?>: </label> |
|
257 | 257 | <input type="password" id="pass2" name="newpassword" |
258 | 258 | placeholder="<?php p($l->t('New password')); ?>" |
259 | 259 | data-typetoggle="#personal-show" |
@@ -269,44 +269,44 @@ discard block |
||
269 | 269 | |
270 | 270 | <form id="language" class="section"> |
271 | 271 | <h2> |
272 | - <label for="languageinput"><?php p($l->t('Language'));?></label> |
|
272 | + <label for="languageinput"><?php p($l->t('Language')); ?></label> |
|
273 | 273 | </h2> |
274 | - <select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language'));?>"> |
|
275 | - <option value="<?php p($_['activelanguage']['code']);?>"> |
|
276 | - <?php p($_['activelanguage']['name']);?> |
|
274 | + <select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language')); ?>"> |
|
275 | + <option value="<?php p($_['activelanguage']['code']); ?>"> |
|
276 | + <?php p($_['activelanguage']['name']); ?> |
|
277 | 277 | </option> |
278 | - <?php foreach($_['commonlanguages'] as $language):?> |
|
279 | - <option value="<?php p($language['code']);?>"> |
|
280 | - <?php p($language['name']);?> |
|
278 | + <?php foreach ($_['commonlanguages'] as $language):?> |
|
279 | + <option value="<?php p($language['code']); ?>"> |
|
280 | + <?php p($language['name']); ?> |
|
281 | 281 | </option> |
282 | - <?php endforeach;?> |
|
282 | + <?php endforeach; ?> |
|
283 | 283 | <optgroup label="––––––––––"></optgroup> |
284 | - <?php foreach($_['languages'] as $language):?> |
|
285 | - <option value="<?php p($language['code']);?>"> |
|
286 | - <?php p($language['name']);?> |
|
284 | + <?php foreach ($_['languages'] as $language):?> |
|
285 | + <option value="<?php p($language['code']); ?>"> |
|
286 | + <?php p($language['name']); ?> |
|
287 | 287 | </option> |
288 | - <?php endforeach;?> |
|
288 | + <?php endforeach; ?> |
|
289 | 289 | </select> |
290 | 290 | <a href="https://www.transifex.com/nextcloud/nextcloud/" |
291 | 291 | target="_blank" rel="noreferrer"> |
292 | - <em><?php p($l->t('Help translate'));?></em> |
|
292 | + <em><?php p($l->t('Help translate')); ?></em> |
|
293 | 293 | </a> |
294 | 294 | </form> |
295 | 295 | |
296 | 296 | |
297 | 297 | <div id="clientsbox" class="section clientsbox"> |
298 | - <h2><?php p($l->t('Get the apps to sync your files'));?></h2> |
|
298 | + <h2><?php p($l->t('Get the apps to sync your files')); ?></h2> |
|
299 | 299 | <a href="<?php p($_['clients']['desktop']); ?>" rel="noreferrer" target="_blank"> |
300 | 300 | <img src="<?php print_unescaped(image_path('core', 'desktopapp.svg')); ?>" |
301 | - alt="<?php p($l->t('Desktop client'));?>" /> |
|
301 | + alt="<?php p($l->t('Desktop client')); ?>" /> |
|
302 | 302 | </a> |
303 | 303 | <a href="<?php p($_['clients']['android']); ?>" rel="noreferrer" target="_blank"> |
304 | 304 | <img src="<?php print_unescaped(image_path('core', 'googleplay.png')); ?>" |
305 | - alt="<?php p($l->t('Android app'));?>" /> |
|
305 | + alt="<?php p($l->t('Android app')); ?>" /> |
|
306 | 306 | </a> |
307 | 307 | <a href="<?php p($_['clients']['ios']); ?>" rel="noreferrer" target="_blank"> |
308 | 308 | <img src="<?php print_unescaped(image_path('core', 'appstore.svg')); ?>" |
309 | - alt="<?php p($l->t('iOS app'));?>" /> |
|
309 | + alt="<?php p($l->t('iOS app')); ?>" /> |
|
310 | 310 | </a> |
311 | 311 | |
312 | 312 | <p> |
@@ -322,19 +322,19 @@ discard block |
||
322 | 322 | $l->t('If you want to support the project {contributeopen}join development{linkclose} or {contributeopen}spread the word{linkclose}!'))); ?> |
323 | 323 | </p> |
324 | 324 | |
325 | - <?php if(OC_APP::isEnabled('firstrunwizard')) {?> |
|
326 | - <p><a class="button" href="#" id="showWizard"><?php p($l->t('Show First Run Wizard again'));?></a></p> |
|
325 | + <?php if (OC_APP::isEnabled('firstrunwizard')) {?> |
|
326 | + <p><a class="button" href="#" id="showWizard"><?php p($l->t('Show First Run Wizard again')); ?></a></p> |
|
327 | 327 | <?php }?> |
328 | 328 | </div> |
329 | 329 | |
330 | 330 | <div id="sessions" class="section"> |
331 | - <h2><?php p($l->t('Sessions'));?></h2> |
|
332 | - <span class="hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.'));?></span> |
|
331 | + <h2><?php p($l->t('Sessions')); ?></h2> |
|
332 | + <span class="hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.')); ?></span> |
|
333 | 333 | <table class="icon-loading"> |
334 | 334 | <thead class="token-list-header"> |
335 | 335 | <tr> |
336 | - <th><?php p($l->t('Device'));?></th> |
|
337 | - <th><?php p($l->t('Last activity'));?></th> |
|
336 | + <th><?php p($l->t('Device')); ?></th> |
|
337 | + <th><?php p($l->t('Last activity')); ?></th> |
|
338 | 338 | <th></th> |
339 | 339 | </tr> |
340 | 340 | </thead> |
@@ -344,13 +344,13 @@ discard block |
||
344 | 344 | </div> |
345 | 345 | |
346 | 346 | <div id="apppasswords" class="section"> |
347 | - <h2><?php p($l->t('App passwords'));?></h2> |
|
348 | - <p><?php p($l->t('Passcodes that give an app or device permissions to access your account.'));?></p> |
|
347 | + <h2><?php p($l->t('App passwords')); ?></h2> |
|
348 | + <p><?php p($l->t('Passcodes that give an app or device permissions to access your account.')); ?></p> |
|
349 | 349 | <table class="icon-loading"> |
350 | 350 | <thead class="hidden-when-empty"> |
351 | 351 | <tr> |
352 | - <th><?php p($l->t('Name'));?></th> |
|
353 | - <th><?php p($l->t('Last activity'));?></th> |
|
352 | + <th><?php p($l->t('Name')); ?></th> |
|
353 | + <th><?php p($l->t('Last activity')); ?></th> |
|
354 | 354 | <th></th> |
355 | 355 | </tr> |
356 | 356 | </thead> |
@@ -379,14 +379,14 @@ discard block |
||
379 | 379 | </div> |
380 | 380 | </div> |
381 | 381 | |
382 | -<?php foreach($_['forms'] as $form) { |
|
382 | +<?php foreach ($_['forms'] as $form) { |
|
383 | 383 | if (isset($form['form'])) {?> |
384 | - <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div> |
|
384 | + <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p(''); ?>"><?php print_unescaped($form['form']); ?></div> |
|
385 | 385 | <?php } |
386 | 386 | };?> |
387 | 387 | |
388 | 388 | <div class="section"> |
389 | - <h2><?php p($l->t('Version'));?></h2> |
|
389 | + <h2><?php p($l->t('Version')); ?></h2> |
|
390 | 390 | <p><a href="<?php print_unescaped($theme->getBaseUrl()); ?>" target="_blank"><?php p($theme->getTitle()); ?></a> <?php p(OC_Util::getHumanVersion()) ?></p> |
391 | 391 | <p><?php include('settings.development.notice.php'); ?></p> |
392 | 392 | </div> |
@@ -31,9 +31,12 @@ discard block |
||
31 | 31 | <?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?> |
32 | 32 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>', |
33 | 33 | [$_['usage'], $_['total_space']]));?> |
34 | - <?php else: ?> |
|
34 | + <?php else { |
|
35 | + : ?> |
|
35 | 36 | <?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)', |
36 | - [$_['usage'], $_['total_space'], $_['usage_relative']]));?> |
|
37 | + [$_['usage'], $_['total_space'], $_['usage_relative']])); |
|
38 | +} |
|
39 | +?> |
|
37 | 40 | <?php endif ?> |
38 | 41 | </p> |
39 | 42 | </div> |
@@ -55,8 +58,11 @@ discard block |
||
55 | 58 | <div class="hidden button icon-delete svg" id="removeavatar" title="<?php p($l->t('Remove image')); ?>"></div> |
56 | 59 | <input type="file" name="files[]" id="uploadavatar" class="hiddenuploadfield"> |
57 | 60 | <p><em><?php p($l->t('png or jpg, max. 20 MB')); ?></em></p> |
58 | - <?php else: ?> |
|
59 | - <?php p($l->t('Picture provided by original account')); ?> |
|
61 | + <?php else { |
|
62 | + : ?> |
|
63 | + <?php p($l->t('Picture provided by original account')); |
|
64 | +} |
|
65 | +?> |
|
60 | 66 | <?php endif; ?> |
61 | 67 | </div> |
62 | 68 | |
@@ -99,7 +105,10 @@ discard block |
||
99 | 105 | <label for="email"><?php p($l->t('Email')); ?></label> |
100 | 106 | <span class="icon-password"/> |
101 | 107 | </h2> |
102 | - <div class="verify <?php if ($_['email'] === '') p('hidden'); ?>"> |
|
108 | + <div class="verify <?php if ($_['email'] === '') { |
|
109 | + p('hidden'); |
|
110 | +} |
|
111 | +?>"> |
|
103 | 112 | <img id="verify-email" <?php |
104 | 113 | switch($_['emailVerification']) { |
105 | 114 | case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
@@ -165,7 +174,10 @@ discard block |
||
165 | 174 | <label for="website"><?php p($l->t('Website')); ?></label> |
166 | 175 | <span class="icon-password"/> |
167 | 176 | </h2> |
168 | - <div class="verify <?php if ($_['website'] === '') p('hidden'); ?>"> |
|
177 | + <div class="verify <?php if ($_['website'] === '') { |
|
178 | + p('hidden'); |
|
179 | +} |
|
180 | +?>"> |
|
169 | 181 | <img id="verify-website" <?php |
170 | 182 | switch($_['websiteVerification']) { |
171 | 183 | case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |
@@ -199,7 +211,10 @@ discard block |
||
199 | 211 | <label for="twitter"><?php p($l->t('Twitter')); ?></label> |
200 | 212 | <span class="icon-password"/> |
201 | 213 | </h2> |
202 | - <div class="verify <?php if ($_['twitter'] === '') p('hidden'); ?>"> |
|
214 | + <div class="verify <?php if ($_['twitter'] === '') { |
|
215 | + p('hidden'); |
|
216 | +} |
|
217 | +?>"> |
|
203 | 218 | <img id="verify-twitter" <?php |
204 | 219 | switch($_['twitterVerification']) { |
205 | 220 | case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: |