@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | use OCP\IUserManager; |
27 | 27 | |
28 | 28 | class Utils { |
29 | - /** |
|
30 | - * Gets the unix epoch UTC timestamp |
|
31 | - * @return int |
|
32 | - */ |
|
29 | + /** |
|
30 | + * Gets the unix epoch UTC timestamp |
|
31 | + * @return int |
|
32 | + */ |
|
33 | 33 | public static function getTime() { |
34 | 34 | return (new \DateTime())->getTimestamp(); |
35 | 35 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | return microtime(true); |
41 | 41 | } |
42 | 42 | |
43 | - /** |
|
44 | - * Generates a Globally Unique ID |
|
45 | - * @return string |
|
46 | - */ |
|
43 | + /** |
|
44 | + * Generates a Globally Unique ID |
|
45 | + * @return string |
|
46 | + */ |
|
47 | 47 | public static function GUID() { |
48 | 48 | if (function_exists('com_create_guid') === true) |
49 | 49 | { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param IUserManager $userManager |
59 | 59 | * @return string |
60 | 60 | */ |
61 | - public static function getNameByUid(string $uid, IUserManager $userManager){ |
|
61 | + public static function getNameByUid(string $uid, IUserManager $userManager) { |
|
62 | 62 | $u = $userManager->get($uid); |
63 | 63 | return $u->getDisplayName(); |
64 | 64 | } |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | * @param array $results |
69 | 69 | * @return array|mixed |
70 | 70 | */ |
71 | - public static function getDirContents(string $dir, &$results = array()){ |
|
71 | + public static function getDirContents(string $dir, &$results = array()) { |
|
72 | 72 | $files = scandir($dir); |
73 | 73 | |
74 | - foreach($files as $value){ |
|
75 | - $path = realpath($dir.DIRECTORY_SEPARATOR.$value); |
|
76 | - if(!is_dir($path)) { |
|
74 | + foreach ($files as $value) { |
|
75 | + $path = realpath($dir . DIRECTORY_SEPARATOR . $value); |
|
76 | + if (!is_dir($path)) { |
|
77 | 77 | $results[] = $path; |
78 | - } else if($value != "." && $value != "..") { |
|
78 | + } else if ($value != "." && $value != "..") { |
|
79 | 79 | Utils::getDirContents($path, $results); |
80 | 80 | $results[] = $path; |
81 | 81 | } |
@@ -45,8 +45,7 @@ discard block |
||
45 | 45 | * @return string |
46 | 46 | */ |
47 | 47 | public static function GUID() { |
48 | - if (function_exists('com_create_guid') === true) |
|
49 | - { |
|
48 | + if (function_exists('com_create_guid') === true) { |
|
50 | 49 | return trim(com_create_guid(), '{}'); |
51 | 50 | } |
52 | 51 | |
@@ -58,7 +57,7 @@ discard block |
||
58 | 57 | * @param IUserManager $userManager |
59 | 58 | * @return string |
60 | 59 | */ |
61 | - public static function getNameByUid(string $uid, IUserManager $userManager){ |
|
60 | + public static function getNameByUid(string $uid, IUserManager $userManager) { |
|
62 | 61 | $u = $userManager->get($uid); |
63 | 62 | return $u->getDisplayName(); |
64 | 63 | } |
@@ -68,10 +67,10 @@ discard block |
||
68 | 67 | * @param array $results |
69 | 68 | * @return array|mixed |
70 | 69 | */ |
71 | - public static function getDirContents(string $dir, &$results = array()){ |
|
70 | + public static function getDirContents(string $dir, &$results = array()) { |
|
72 | 71 | $files = scandir($dir); |
73 | 72 | |
74 | - foreach($files as $value){ |
|
73 | + foreach($files as $value) { |
|
75 | 74 | $path = realpath($dir.DIRECTORY_SEPARATOR.$value); |
76 | 75 | if(!is_dir($path)) { |
77 | 76 | $results[] = $path; |
@@ -51,18 +51,18 @@ |
||
51 | 51 | private $offset = 0; |
52 | 52 | |
53 | 53 | public function __construct($AppName, |
54 | - IRequest $request, |
|
55 | - $UserId, |
|
56 | - IGroupManager $groupManager, |
|
57 | - IUserManager $userManager, |
|
58 | - ActivityService $activityService, |
|
59 | - VaultService $vaultService, |
|
60 | - ShareService $shareService, |
|
61 | - CredentialService $credentialService, |
|
62 | - NotificationService $notificationService, |
|
63 | - FileService $fileService, |
|
64 | - SettingsService $config, |
|
65 | - IManager $IManager |
|
54 | + IRequest $request, |
|
55 | + $UserId, |
|
56 | + IGroupManager $groupManager, |
|
57 | + IUserManager $userManager, |
|
58 | + ActivityService $activityService, |
|
59 | + VaultService $vaultService, |
|
60 | + ShareService $shareService, |
|
61 | + CredentialService $credentialService, |
|
62 | + NotificationService $notificationService, |
|
63 | + FileService $fileService, |
|
64 | + SettingsService $config, |
|
65 | + IManager $IManager |
|
66 | 66 | ) { |
67 | 67 | parent::__construct( |
68 | 68 | $AppName, |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @NoCSRFRequired |
58 | 58 | */ |
59 | 59 | public function getSingleIcon($base64Url) { |
60 | - $url = base64_decode(str_replace('_','/', $base64Url)); |
|
60 | + $url = base64_decode(str_replace('_', '/', $base64Url)); |
|
61 | 61 | if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { |
62 | 62 | $url = "http://" . $url; |
63 | 63 | } |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | $icon = new IconService($url); |
67 | 67 | |
68 | 68 | if ($icon->icoExists) { |
69 | - $icon_json['type']= $icon->icoType; |
|
70 | - $icon_json['content']= base64_encode($icon->icoData); |
|
69 | + $icon_json['type'] = $icon->icoType; |
|
70 | + $icon_json['content'] = base64_encode($icon->icoData); |
|
71 | 71 | return new JSONResponse($icon_json); |
72 | 72 | } |
73 | 73 | |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | * @NoCSRFRequired |
80 | 80 | */ |
81 | 81 | public function getIcon($base64Url, $credentialId) { |
82 | - $url = base64_decode(str_replace('_','/', $base64Url)); |
|
82 | + $url = base64_decode(str_replace('_', '/', $base64Url)); |
|
83 | 83 | |
84 | - if($credentialId && $credentialId != "null") { |
|
84 | + if ($credentialId && $credentialId != "null") { |
|
85 | 85 | try { |
86 | 86 | $credential = $this->credentialService->getCredentialById($credentialId, $this->userId); |
87 | 87 | $credential = $credential->jsonSerialize(); |
88 | - } catch (DoesNotExistException $e){ |
|
88 | + } catch (DoesNotExistException $e) { |
|
89 | 89 | // Credential is not found, continue |
90 | 90 | $credential = false; |
91 | 91 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | try { |
99 | 99 | $icon = new IconService($url); |
100 | - } catch (\InvalidArgumentException $e){ |
|
100 | + } catch (\InvalidArgumentException $e) { |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ]; |
116 | 116 | $credential['icon'] = json_encode($iconData); |
117 | 117 | try { |
118 | - if($credential) { |
|
118 | + if ($credential) { |
|
119 | 119 | $this->credentialService->updateCredential($credential); |
120 | 120 | } |
121 | 121 | } catch (DriverException $exception) { |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | $pack = explode('/', $path[1])[2]; |
157 | 157 | $mime = mime_content_type($iconPath); |
158 | 158 | //print_r($path); |
159 | - if($mime !== 'directory') { |
|
159 | + if ($mime !== 'directory') { |
|
160 | 160 | $icon = []; |
161 | 161 | $icon['mimetype'] = mime_content_type($iconPath); |
162 | 162 | $icon['url'] = $this->urlGenerator->linkTo('passman', $path[1]); |
163 | 163 | $icon['pack'] = $pack; |
164 | - if(!isset($icons[$pack])){ |
|
164 | + if (!isset($icons[$pack])) { |
|
165 | 165 | $icons[$pack] = []; |
166 | 166 | } |
167 | 167 | $icons[$pack][] = $icon; |