@@ -24,7 +24,7 @@ |
||
24 | 24 | use OC\DB\QueryBuilder\QueryFunction; |
25 | 25 | |
26 | 26 | class PgSqlFunctionBuilder extends FunctionBuilder { |
27 | - public function concat($x, $y) { |
|
28 | - return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
29 | - } |
|
27 | + public function concat($x, $y) { |
|
28 | + return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
29 | + } |
|
30 | 30 | } |
@@ -25,6 +25,6 @@ |
||
25 | 25 | |
26 | 26 | class PgSqlFunctionBuilder extends FunctionBuilder { |
27 | 27 | public function concat($x, $y) { |
28 | - return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
28 | + return new QueryFunction('('.$this->helper->quoteColumnName($x).' || '.$this->helper->quoteColumnName($y).')'); |
|
29 | 29 | } |
30 | 30 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | use OC\DB\QueryBuilder\QueryFunction; |
25 | 25 | |
26 | 26 | class SqliteFunctionBuilder extends FunctionBuilder { |
27 | - public function concat($x, $y) { |
|
28 | - return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
29 | - } |
|
27 | + public function concat($x, $y) { |
|
28 | + return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
29 | + } |
|
30 | 30 | } |
@@ -25,6 +25,6 @@ |
||
25 | 25 | |
26 | 26 | class SqliteFunctionBuilder extends FunctionBuilder { |
27 | 27 | public function concat($x, $y) { |
28 | - return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
28 | + return new QueryFunction('('.$this->helper->quoteColumnName($x).' || '.$this->helper->quoteColumnName($y).')'); |
|
29 | 29 | } |
30 | 30 | } |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class RemoteShare implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'remote_share'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'remote_share'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('A file or folder was shared from <strong>another server</strong>'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('A file or folder was shared from <strong>another server</strong>'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 11; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 11; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class Shared implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'shared'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'shared'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('A file or folder has been <strong>shared</strong>'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('A file or folder has been <strong>shared</strong>'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 10; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 10; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |
@@ -24,18 +24,18 @@ |
||
24 | 24 | use OCP\Files\ObjectStore\IObjectStore; |
25 | 25 | |
26 | 26 | class S3 implements IObjectStore { |
27 | - use S3ConnectionTrait; |
|
28 | - use S3ObjectTrait; |
|
27 | + use S3ConnectionTrait; |
|
28 | + use S3ObjectTrait; |
|
29 | 29 | |
30 | - public function __construct($parameters) { |
|
31 | - $this->parseParams($parameters); |
|
32 | - } |
|
30 | + public function __construct($parameters) { |
|
31 | + $this->parseParams($parameters); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * @return string the container or bucket name where objects are stored |
|
36 | - * @since 7.0.0 |
|
37 | - */ |
|
38 | - public function getStorageId() { |
|
39 | - return $this->id; |
|
40 | - } |
|
34 | + /** |
|
35 | + * @return string the container or bucket name where objects are stored |
|
36 | + * @since 7.0.0 |
|
37 | + */ |
|
38 | + public function getStorageId() { |
|
39 | + return $this->id; |
|
40 | + } |
|
41 | 41 | } |
@@ -11,43 +11,43 @@ |
||
11 | 11 | use OCP\Share\IManager; |
12 | 12 | |
13 | 13 | class OCSShareAPIMiddleware extends Middleware { |
14 | - /** @var IManager */ |
|
15 | - private $shareManager; |
|
16 | - /** @var IL10N */ |
|
17 | - private $l; |
|
14 | + /** @var IManager */ |
|
15 | + private $shareManager; |
|
16 | + /** @var IL10N */ |
|
17 | + private $l; |
|
18 | 18 | |
19 | - public function __construct(IManager $shareManager, |
|
20 | - IL10N $l) { |
|
21 | - $this->shareManager = $shareManager; |
|
22 | - $this->l = $l; |
|
23 | - } |
|
19 | + public function __construct(IManager $shareManager, |
|
20 | + IL10N $l) { |
|
21 | + $this->shareManager = $shareManager; |
|
22 | + $this->l = $l; |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * @param Controller $controller |
|
27 | - * @param string $methodName |
|
28 | - * |
|
29 | - * @throws OCSNotFoundException |
|
30 | - */ |
|
31 | - public function beforeController($controller, $methodName) { |
|
32 | - if ($controller instanceof ShareAPIController) { |
|
33 | - if (!$this->shareManager->shareApiEnabled()) { |
|
34 | - throw new OCSNotFoundException($this->l->t('Share API is disabled')); |
|
35 | - } |
|
36 | - } |
|
37 | - } |
|
25 | + /** |
|
26 | + * @param Controller $controller |
|
27 | + * @param string $methodName |
|
28 | + * |
|
29 | + * @throws OCSNotFoundException |
|
30 | + */ |
|
31 | + public function beforeController($controller, $methodName) { |
|
32 | + if ($controller instanceof ShareAPIController) { |
|
33 | + if (!$this->shareManager->shareApiEnabled()) { |
|
34 | + throw new OCSNotFoundException($this->l->t('Share API is disabled')); |
|
35 | + } |
|
36 | + } |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param Controller $controller |
|
41 | - * @param string $methodName |
|
42 | - * @param Response $response |
|
43 | - * @return Response |
|
44 | - */ |
|
45 | - public function afterController($controller, $methodName, Response $response) { |
|
46 | - if ($controller instanceof ShareAPIController) { |
|
47 | - /** @var ShareAPIController $controller */ |
|
48 | - $controller->cleanup(); |
|
49 | - } |
|
39 | + /** |
|
40 | + * @param Controller $controller |
|
41 | + * @param string $methodName |
|
42 | + * @param Response $response |
|
43 | + * @return Response |
|
44 | + */ |
|
45 | + public function afterController($controller, $methodName, Response $response) { |
|
46 | + if ($controller instanceof ShareAPIController) { |
|
47 | + /** @var ShareAPIController $controller */ |
|
48 | + $controller->cleanup(); |
|
49 | + } |
|
50 | 50 | |
51 | - return $response; |
|
52 | - } |
|
51 | + return $response; |
|
52 | + } |
|
53 | 53 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | protected function execute(InputInterface $input, OutputInterface $output) { |
64 | - if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false'){ |
|
64 | + if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') { |
|
65 | 65 | $shippedFilter = $input->getOption('shipped') === 'true'; |
66 | 66 | } else { |
67 | 67 | $shippedFilter = null; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | //sort enabled apps above disabled apps |
75 | 75 | foreach ($apps as $app) { |
76 | - if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){ |
|
76 | + if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter) { |
|
77 | 77 | continue; |
78 | 78 | } |
79 | 79 | if ($this->manager->isInstalled($app)) { |
@@ -34,109 +34,109 @@ |
||
34 | 34 | |
35 | 35 | class ListApps extends Base { |
36 | 36 | |
37 | - /** @var IAppManager */ |
|
38 | - protected $manager; |
|
39 | - |
|
40 | - /** |
|
41 | - * @param IAppManager $manager |
|
42 | - */ |
|
43 | - public function __construct(IAppManager $manager) { |
|
44 | - parent::__construct(); |
|
45 | - $this->manager = $manager; |
|
46 | - } |
|
47 | - |
|
48 | - protected function configure() { |
|
49 | - parent::configure(); |
|
50 | - |
|
51 | - $this |
|
52 | - ->setName('app:list') |
|
53 | - ->setDescription('List all available apps') |
|
54 | - ->addOption( |
|
55 | - 'shipped', |
|
56 | - null, |
|
57 | - InputOption::VALUE_REQUIRED, |
|
58 | - 'true - limit to shipped apps only, false - limit to non-shipped apps only' |
|
59 | - ) |
|
60 | - ; |
|
61 | - } |
|
62 | - |
|
63 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
64 | - if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false'){ |
|
65 | - $shippedFilter = $input->getOption('shipped') === 'true'; |
|
66 | - } else { |
|
67 | - $shippedFilter = null; |
|
68 | - } |
|
37 | + /** @var IAppManager */ |
|
38 | + protected $manager; |
|
39 | + |
|
40 | + /** |
|
41 | + * @param IAppManager $manager |
|
42 | + */ |
|
43 | + public function __construct(IAppManager $manager) { |
|
44 | + parent::__construct(); |
|
45 | + $this->manager = $manager; |
|
46 | + } |
|
47 | + |
|
48 | + protected function configure() { |
|
49 | + parent::configure(); |
|
50 | + |
|
51 | + $this |
|
52 | + ->setName('app:list') |
|
53 | + ->setDescription('List all available apps') |
|
54 | + ->addOption( |
|
55 | + 'shipped', |
|
56 | + null, |
|
57 | + InputOption::VALUE_REQUIRED, |
|
58 | + 'true - limit to shipped apps only, false - limit to non-shipped apps only' |
|
59 | + ) |
|
60 | + ; |
|
61 | + } |
|
62 | + |
|
63 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
64 | + if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false'){ |
|
65 | + $shippedFilter = $input->getOption('shipped') === 'true'; |
|
66 | + } else { |
|
67 | + $shippedFilter = null; |
|
68 | + } |
|
69 | 69 | |
70 | - $apps = \OC_App::getAllApps(); |
|
71 | - $enabledApps = $disabledApps = []; |
|
72 | - $versions = \OC_App::getAppVersions(); |
|
73 | - |
|
74 | - //sort enabled apps above disabled apps |
|
75 | - foreach ($apps as $app) { |
|
76 | - if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){ |
|
77 | - continue; |
|
78 | - } |
|
79 | - if ($this->manager->isInstalled($app)) { |
|
80 | - $enabledApps[] = $app; |
|
81 | - } else { |
|
82 | - $disabledApps[] = $app; |
|
83 | - } |
|
84 | - } |
|
85 | - |
|
86 | - $apps = ['enabled' => [], 'disabled' => []]; |
|
87 | - |
|
88 | - sort($enabledApps); |
|
89 | - foreach ($enabledApps as $app) { |
|
90 | - $apps['enabled'][$app] = isset($versions[$app]) ? $versions[$app] : true; |
|
91 | - } |
|
92 | - |
|
93 | - sort($disabledApps); |
|
94 | - foreach ($disabledApps as $app) { |
|
95 | - $apps['disabled'][$app] = null; |
|
96 | - } |
|
97 | - |
|
98 | - $this->writeAppList($input, $output, $apps); |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * @param InputInterface $input |
|
103 | - * @param OutputInterface $output |
|
104 | - * @param array $items |
|
105 | - */ |
|
106 | - protected function writeAppList(InputInterface $input, OutputInterface $output, $items) { |
|
107 | - switch ($input->getOption('output')) { |
|
108 | - case self::OUTPUT_FORMAT_PLAIN: |
|
109 | - $output->writeln('Enabled:'); |
|
110 | - parent::writeArrayInOutputFormat($input, $output, $items['enabled']); |
|
111 | - |
|
112 | - $output->writeln('Disabled:'); |
|
113 | - parent::writeArrayInOutputFormat($input, $output, $items['disabled']); |
|
114 | - break; |
|
115 | - |
|
116 | - default: |
|
117 | - parent::writeArrayInOutputFormat($input, $output, $items); |
|
118 | - break; |
|
119 | - } |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * @param string $optionName |
|
124 | - * @param CompletionContext $completionContext |
|
125 | - * @return array |
|
126 | - */ |
|
127 | - public function completeOptionValues($optionName, CompletionContext $completionContext) { |
|
128 | - if ($optionName === 'shipped') { |
|
129 | - return ['true', 'false']; |
|
130 | - } |
|
131 | - return []; |
|
132 | - } |
|
133 | - |
|
134 | - /** |
|
135 | - * @param string $argumentName |
|
136 | - * @param CompletionContext $context |
|
137 | - * @return string[] |
|
138 | - */ |
|
139 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
140 | - return []; |
|
141 | - } |
|
70 | + $apps = \OC_App::getAllApps(); |
|
71 | + $enabledApps = $disabledApps = []; |
|
72 | + $versions = \OC_App::getAppVersions(); |
|
73 | + |
|
74 | + //sort enabled apps above disabled apps |
|
75 | + foreach ($apps as $app) { |
|
76 | + if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){ |
|
77 | + continue; |
|
78 | + } |
|
79 | + if ($this->manager->isInstalled($app)) { |
|
80 | + $enabledApps[] = $app; |
|
81 | + } else { |
|
82 | + $disabledApps[] = $app; |
|
83 | + } |
|
84 | + } |
|
85 | + |
|
86 | + $apps = ['enabled' => [], 'disabled' => []]; |
|
87 | + |
|
88 | + sort($enabledApps); |
|
89 | + foreach ($enabledApps as $app) { |
|
90 | + $apps['enabled'][$app] = isset($versions[$app]) ? $versions[$app] : true; |
|
91 | + } |
|
92 | + |
|
93 | + sort($disabledApps); |
|
94 | + foreach ($disabledApps as $app) { |
|
95 | + $apps['disabled'][$app] = null; |
|
96 | + } |
|
97 | + |
|
98 | + $this->writeAppList($input, $output, $apps); |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * @param InputInterface $input |
|
103 | + * @param OutputInterface $output |
|
104 | + * @param array $items |
|
105 | + */ |
|
106 | + protected function writeAppList(InputInterface $input, OutputInterface $output, $items) { |
|
107 | + switch ($input->getOption('output')) { |
|
108 | + case self::OUTPUT_FORMAT_PLAIN: |
|
109 | + $output->writeln('Enabled:'); |
|
110 | + parent::writeArrayInOutputFormat($input, $output, $items['enabled']); |
|
111 | + |
|
112 | + $output->writeln('Disabled:'); |
|
113 | + parent::writeArrayInOutputFormat($input, $output, $items['disabled']); |
|
114 | + break; |
|
115 | + |
|
116 | + default: |
|
117 | + parent::writeArrayInOutputFormat($input, $output, $items); |
|
118 | + break; |
|
119 | + } |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * @param string $optionName |
|
124 | + * @param CompletionContext $completionContext |
|
125 | + * @return array |
|
126 | + */ |
|
127 | + public function completeOptionValues($optionName, CompletionContext $completionContext) { |
|
128 | + if ($optionName === 'shipped') { |
|
129 | + return ['true', 'false']; |
|
130 | + } |
|
131 | + return []; |
|
132 | + } |
|
133 | + |
|
134 | + /** |
|
135 | + * @param string $argumentName |
|
136 | + * @param CompletionContext $context |
|
137 | + * @return string[] |
|
138 | + */ |
|
139 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
140 | + return []; |
|
141 | + } |
|
142 | 142 | } |
@@ -42,294 +42,294 @@ |
||
42 | 42 | */ |
43 | 43 | class DbHandler { |
44 | 44 | |
45 | - /** @var IDBConnection */ |
|
46 | - private $connection; |
|
47 | - |
|
48 | - /** @var IL10N */ |
|
49 | - private $IL10N; |
|
50 | - |
|
51 | - /** @var string */ |
|
52 | - private $dbTable = 'trusted_servers'; |
|
53 | - |
|
54 | - /** |
|
55 | - * @param IDBConnection $connection |
|
56 | - * @param IL10N $il10n |
|
57 | - */ |
|
58 | - public function __construct( |
|
59 | - IDBConnection $connection, |
|
60 | - IL10N $il10n |
|
61 | - ) { |
|
62 | - $this->connection = $connection; |
|
63 | - $this->IL10N = $il10n; |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * add server to the list of trusted servers |
|
68 | - * |
|
69 | - * @param string $url |
|
70 | - * @return int |
|
71 | - * @throws HintException |
|
72 | - */ |
|
73 | - public function addServer($url) { |
|
74 | - $hash = $this->hash($url); |
|
75 | - $url = rtrim($url, '/'); |
|
76 | - $query = $this->connection->getQueryBuilder(); |
|
77 | - $query->insert($this->dbTable) |
|
78 | - ->values( |
|
79 | - [ |
|
80 | - 'url' => $query->createParameter('url'), |
|
81 | - 'url_hash' => $query->createParameter('url_hash'), |
|
82 | - ] |
|
83 | - ) |
|
84 | - ->setParameter('url', $url) |
|
85 | - ->setParameter('url_hash', $hash); |
|
86 | - |
|
87 | - $result = $query->execute(); |
|
88 | - |
|
89 | - if ($result) { |
|
90 | - return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
91 | - } |
|
92 | - |
|
93 | - $message = 'Internal failure, Could not add trusted server: ' . $url; |
|
94 | - $message_t = $this->IL10N->t('Could not add server'); |
|
95 | - throw new HintException($message, $message_t); |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * remove server from the list of trusted servers |
|
100 | - * |
|
101 | - * @param int $id |
|
102 | - */ |
|
103 | - public function removeServer($id) { |
|
104 | - $query = $this->connection->getQueryBuilder(); |
|
105 | - $query->delete($this->dbTable) |
|
106 | - ->where($query->expr()->eq('id', $query->createParameter('id'))) |
|
107 | - ->setParameter('id', $id); |
|
108 | - $query->execute(); |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * get trusted server with given ID |
|
113 | - * |
|
114 | - * @param int $id |
|
115 | - * @return array |
|
116 | - * @throws \Exception |
|
117 | - */ |
|
118 | - public function getServerById($id) { |
|
119 | - $query = $this->connection->getQueryBuilder(); |
|
120 | - $query->select('*')->from($this->dbTable) |
|
121 | - ->where($query->expr()->eq('id', $query->createParameter('id'))) |
|
122 | - ->setParameter('id', $id); |
|
123 | - $query->execute(); |
|
124 | - $result = $query->execute()->fetchAll(); |
|
125 | - |
|
126 | - if (empty($result)) { |
|
127 | - throw new \Exception('No Server found with ID: ' . $id); |
|
128 | - } |
|
129 | - |
|
130 | - return $result[0]; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * get all trusted servers |
|
135 | - * |
|
136 | - * @return array |
|
137 | - */ |
|
138 | - public function getAllServer() { |
|
139 | - $query = $this->connection->getQueryBuilder(); |
|
140 | - $query->select(['url', 'url_hash', 'id', 'status', 'shared_secret', 'sync_token']) |
|
141 | - ->from($this->dbTable); |
|
142 | - $statement = $query->execute(); |
|
143 | - $result = $statement->fetchAll(); |
|
144 | - $statement->closeCursor(); |
|
145 | - return $result; |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * check if server already exists in the database table |
|
150 | - * |
|
151 | - * @param string $url |
|
152 | - * @return bool |
|
153 | - */ |
|
154 | - public function serverExists($url) { |
|
155 | - $hash = $this->hash($url); |
|
156 | - $query = $this->connection->getQueryBuilder(); |
|
157 | - $query->select('url') |
|
158 | - ->from($this->dbTable) |
|
159 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
160 | - ->setParameter('url_hash', $hash); |
|
161 | - $statement = $query->execute(); |
|
162 | - $result = $statement->fetchAll(); |
|
163 | - $statement->closeCursor(); |
|
164 | - |
|
165 | - return !empty($result); |
|
166 | - } |
|
167 | - |
|
168 | - /** |
|
169 | - * write token to database. Token is used to exchange the secret |
|
170 | - * |
|
171 | - * @param string $url |
|
172 | - * @param string $token |
|
173 | - */ |
|
174 | - public function addToken($url, $token) { |
|
175 | - $hash = $this->hash($url); |
|
176 | - $query = $this->connection->getQueryBuilder(); |
|
177 | - $query->update($this->dbTable) |
|
178 | - ->set('token', $query->createParameter('token')) |
|
179 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
180 | - ->setParameter('url_hash', $hash) |
|
181 | - ->setParameter('token', $token); |
|
182 | - $query->execute(); |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * get token stored in database |
|
187 | - * |
|
188 | - * @param string $url |
|
189 | - * @return string |
|
190 | - * @throws \Exception |
|
191 | - */ |
|
192 | - public function getToken($url) { |
|
193 | - $hash = $this->hash($url); |
|
194 | - $query = $this->connection->getQueryBuilder(); |
|
195 | - $query->select('token')->from($this->dbTable) |
|
196 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
197 | - ->setParameter('url_hash', $hash); |
|
198 | - |
|
199 | - $statement = $query->execute(); |
|
200 | - $result = $statement->fetch(); |
|
201 | - $statement->closeCursor(); |
|
202 | - |
|
203 | - if (!isset($result['token'])) { |
|
204 | - throw new \Exception('No token found for: ' . $url); |
|
205 | - } |
|
206 | - |
|
207 | - return $result['token']; |
|
208 | - } |
|
209 | - |
|
210 | - /** |
|
211 | - * add shared Secret to database |
|
212 | - * |
|
213 | - * @param string $url |
|
214 | - * @param string $sharedSecret |
|
215 | - */ |
|
216 | - public function addSharedSecret($url, $sharedSecret) { |
|
217 | - $hash = $this->hash($url); |
|
218 | - $query = $this->connection->getQueryBuilder(); |
|
219 | - $query->update($this->dbTable) |
|
220 | - ->set('shared_secret', $query->createParameter('sharedSecret')) |
|
221 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
222 | - ->setParameter('url_hash', $hash) |
|
223 | - ->setParameter('sharedSecret', $sharedSecret); |
|
224 | - $query->execute(); |
|
225 | - } |
|
226 | - |
|
227 | - /** |
|
228 | - * get shared secret from database |
|
229 | - * |
|
230 | - * @param string $url |
|
231 | - * @return string |
|
232 | - */ |
|
233 | - public function getSharedSecret($url) { |
|
234 | - $hash = $this->hash($url); |
|
235 | - $query = $this->connection->getQueryBuilder(); |
|
236 | - $query->select('shared_secret')->from($this->dbTable) |
|
237 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
238 | - ->setParameter('url_hash', $hash); |
|
239 | - |
|
240 | - $statement = $query->execute(); |
|
241 | - $result = $statement->fetch(); |
|
242 | - $statement->closeCursor(); |
|
243 | - return $result['shared_secret']; |
|
244 | - } |
|
245 | - |
|
246 | - /** |
|
247 | - * set server status |
|
248 | - * |
|
249 | - * @param string $url |
|
250 | - * @param int $status |
|
251 | - * @param string|null $token |
|
252 | - */ |
|
253 | - public function setServerStatus($url, $status, $token = null) { |
|
254 | - $hash = $this->hash($url); |
|
255 | - $query = $this->connection->getQueryBuilder(); |
|
256 | - $query->update($this->dbTable) |
|
257 | - ->set('status', $query->createNamedParameter($status)) |
|
258 | - ->where($query->expr()->eq('url_hash', $query->createNamedParameter($hash))); |
|
259 | - if (!is_null($token)) { |
|
260 | - $query->set('sync_token', $query->createNamedParameter($token)); |
|
261 | - } |
|
262 | - $query->execute(); |
|
263 | - } |
|
264 | - |
|
265 | - /** |
|
266 | - * get server status |
|
267 | - * |
|
268 | - * @param string $url |
|
269 | - * @return int |
|
270 | - */ |
|
271 | - public function getServerStatus($url) { |
|
272 | - $hash = $this->hash($url); |
|
273 | - $query = $this->connection->getQueryBuilder(); |
|
274 | - $query->select('status')->from($this->dbTable) |
|
275 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
276 | - ->setParameter('url_hash', $hash); |
|
277 | - |
|
278 | - $statement = $query->execute(); |
|
279 | - $result = $statement->fetch(); |
|
280 | - $statement->closeCursor(); |
|
281 | - return (int)$result['status']; |
|
282 | - } |
|
283 | - |
|
284 | - /** |
|
285 | - * create hash from URL |
|
286 | - * |
|
287 | - * @param string $url |
|
288 | - * @return string |
|
289 | - */ |
|
290 | - protected function hash($url) { |
|
291 | - $normalized = $this->normalizeUrl($url); |
|
292 | - return sha1($normalized); |
|
293 | - } |
|
294 | - |
|
295 | - /** |
|
296 | - * normalize URL, used to create the sha1 hash |
|
297 | - * |
|
298 | - * @param string $url |
|
299 | - * @return string |
|
300 | - */ |
|
301 | - protected function normalizeUrl($url) { |
|
302 | - $normalized = $url; |
|
303 | - |
|
304 | - if (strpos($url, 'https://') === 0) { |
|
305 | - $normalized = substr($url, strlen('https://')); |
|
306 | - } else if (strpos($url, 'http://') === 0) { |
|
307 | - $normalized = substr($url, strlen('http://')); |
|
308 | - } |
|
309 | - |
|
310 | - $normalized = Filesystem::normalizePath($normalized); |
|
311 | - $normalized = trim($normalized, '/'); |
|
312 | - |
|
313 | - return $normalized; |
|
314 | - } |
|
315 | - |
|
316 | - /** |
|
317 | - * @param $username |
|
318 | - * @param $password |
|
319 | - * @return bool |
|
320 | - */ |
|
321 | - public function auth($username, $password) { |
|
322 | - if ($username !== 'system') { |
|
323 | - return false; |
|
324 | - } |
|
325 | - $query = $this->connection->getQueryBuilder(); |
|
326 | - $query->select('url')->from($this->dbTable) |
|
327 | - ->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password))); |
|
328 | - |
|
329 | - $statement = $query->execute(); |
|
330 | - $result = $statement->fetch(); |
|
331 | - $statement->closeCursor(); |
|
332 | - return !empty($result); |
|
333 | - } |
|
45 | + /** @var IDBConnection */ |
|
46 | + private $connection; |
|
47 | + |
|
48 | + /** @var IL10N */ |
|
49 | + private $IL10N; |
|
50 | + |
|
51 | + /** @var string */ |
|
52 | + private $dbTable = 'trusted_servers'; |
|
53 | + |
|
54 | + /** |
|
55 | + * @param IDBConnection $connection |
|
56 | + * @param IL10N $il10n |
|
57 | + */ |
|
58 | + public function __construct( |
|
59 | + IDBConnection $connection, |
|
60 | + IL10N $il10n |
|
61 | + ) { |
|
62 | + $this->connection = $connection; |
|
63 | + $this->IL10N = $il10n; |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * add server to the list of trusted servers |
|
68 | + * |
|
69 | + * @param string $url |
|
70 | + * @return int |
|
71 | + * @throws HintException |
|
72 | + */ |
|
73 | + public function addServer($url) { |
|
74 | + $hash = $this->hash($url); |
|
75 | + $url = rtrim($url, '/'); |
|
76 | + $query = $this->connection->getQueryBuilder(); |
|
77 | + $query->insert($this->dbTable) |
|
78 | + ->values( |
|
79 | + [ |
|
80 | + 'url' => $query->createParameter('url'), |
|
81 | + 'url_hash' => $query->createParameter('url_hash'), |
|
82 | + ] |
|
83 | + ) |
|
84 | + ->setParameter('url', $url) |
|
85 | + ->setParameter('url_hash', $hash); |
|
86 | + |
|
87 | + $result = $query->execute(); |
|
88 | + |
|
89 | + if ($result) { |
|
90 | + return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
91 | + } |
|
92 | + |
|
93 | + $message = 'Internal failure, Could not add trusted server: ' . $url; |
|
94 | + $message_t = $this->IL10N->t('Could not add server'); |
|
95 | + throw new HintException($message, $message_t); |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * remove server from the list of trusted servers |
|
100 | + * |
|
101 | + * @param int $id |
|
102 | + */ |
|
103 | + public function removeServer($id) { |
|
104 | + $query = $this->connection->getQueryBuilder(); |
|
105 | + $query->delete($this->dbTable) |
|
106 | + ->where($query->expr()->eq('id', $query->createParameter('id'))) |
|
107 | + ->setParameter('id', $id); |
|
108 | + $query->execute(); |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * get trusted server with given ID |
|
113 | + * |
|
114 | + * @param int $id |
|
115 | + * @return array |
|
116 | + * @throws \Exception |
|
117 | + */ |
|
118 | + public function getServerById($id) { |
|
119 | + $query = $this->connection->getQueryBuilder(); |
|
120 | + $query->select('*')->from($this->dbTable) |
|
121 | + ->where($query->expr()->eq('id', $query->createParameter('id'))) |
|
122 | + ->setParameter('id', $id); |
|
123 | + $query->execute(); |
|
124 | + $result = $query->execute()->fetchAll(); |
|
125 | + |
|
126 | + if (empty($result)) { |
|
127 | + throw new \Exception('No Server found with ID: ' . $id); |
|
128 | + } |
|
129 | + |
|
130 | + return $result[0]; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * get all trusted servers |
|
135 | + * |
|
136 | + * @return array |
|
137 | + */ |
|
138 | + public function getAllServer() { |
|
139 | + $query = $this->connection->getQueryBuilder(); |
|
140 | + $query->select(['url', 'url_hash', 'id', 'status', 'shared_secret', 'sync_token']) |
|
141 | + ->from($this->dbTable); |
|
142 | + $statement = $query->execute(); |
|
143 | + $result = $statement->fetchAll(); |
|
144 | + $statement->closeCursor(); |
|
145 | + return $result; |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * check if server already exists in the database table |
|
150 | + * |
|
151 | + * @param string $url |
|
152 | + * @return bool |
|
153 | + */ |
|
154 | + public function serverExists($url) { |
|
155 | + $hash = $this->hash($url); |
|
156 | + $query = $this->connection->getQueryBuilder(); |
|
157 | + $query->select('url') |
|
158 | + ->from($this->dbTable) |
|
159 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
160 | + ->setParameter('url_hash', $hash); |
|
161 | + $statement = $query->execute(); |
|
162 | + $result = $statement->fetchAll(); |
|
163 | + $statement->closeCursor(); |
|
164 | + |
|
165 | + return !empty($result); |
|
166 | + } |
|
167 | + |
|
168 | + /** |
|
169 | + * write token to database. Token is used to exchange the secret |
|
170 | + * |
|
171 | + * @param string $url |
|
172 | + * @param string $token |
|
173 | + */ |
|
174 | + public function addToken($url, $token) { |
|
175 | + $hash = $this->hash($url); |
|
176 | + $query = $this->connection->getQueryBuilder(); |
|
177 | + $query->update($this->dbTable) |
|
178 | + ->set('token', $query->createParameter('token')) |
|
179 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
180 | + ->setParameter('url_hash', $hash) |
|
181 | + ->setParameter('token', $token); |
|
182 | + $query->execute(); |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * get token stored in database |
|
187 | + * |
|
188 | + * @param string $url |
|
189 | + * @return string |
|
190 | + * @throws \Exception |
|
191 | + */ |
|
192 | + public function getToken($url) { |
|
193 | + $hash = $this->hash($url); |
|
194 | + $query = $this->connection->getQueryBuilder(); |
|
195 | + $query->select('token')->from($this->dbTable) |
|
196 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
197 | + ->setParameter('url_hash', $hash); |
|
198 | + |
|
199 | + $statement = $query->execute(); |
|
200 | + $result = $statement->fetch(); |
|
201 | + $statement->closeCursor(); |
|
202 | + |
|
203 | + if (!isset($result['token'])) { |
|
204 | + throw new \Exception('No token found for: ' . $url); |
|
205 | + } |
|
206 | + |
|
207 | + return $result['token']; |
|
208 | + } |
|
209 | + |
|
210 | + /** |
|
211 | + * add shared Secret to database |
|
212 | + * |
|
213 | + * @param string $url |
|
214 | + * @param string $sharedSecret |
|
215 | + */ |
|
216 | + public function addSharedSecret($url, $sharedSecret) { |
|
217 | + $hash = $this->hash($url); |
|
218 | + $query = $this->connection->getQueryBuilder(); |
|
219 | + $query->update($this->dbTable) |
|
220 | + ->set('shared_secret', $query->createParameter('sharedSecret')) |
|
221 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
222 | + ->setParameter('url_hash', $hash) |
|
223 | + ->setParameter('sharedSecret', $sharedSecret); |
|
224 | + $query->execute(); |
|
225 | + } |
|
226 | + |
|
227 | + /** |
|
228 | + * get shared secret from database |
|
229 | + * |
|
230 | + * @param string $url |
|
231 | + * @return string |
|
232 | + */ |
|
233 | + public function getSharedSecret($url) { |
|
234 | + $hash = $this->hash($url); |
|
235 | + $query = $this->connection->getQueryBuilder(); |
|
236 | + $query->select('shared_secret')->from($this->dbTable) |
|
237 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
238 | + ->setParameter('url_hash', $hash); |
|
239 | + |
|
240 | + $statement = $query->execute(); |
|
241 | + $result = $statement->fetch(); |
|
242 | + $statement->closeCursor(); |
|
243 | + return $result['shared_secret']; |
|
244 | + } |
|
245 | + |
|
246 | + /** |
|
247 | + * set server status |
|
248 | + * |
|
249 | + * @param string $url |
|
250 | + * @param int $status |
|
251 | + * @param string|null $token |
|
252 | + */ |
|
253 | + public function setServerStatus($url, $status, $token = null) { |
|
254 | + $hash = $this->hash($url); |
|
255 | + $query = $this->connection->getQueryBuilder(); |
|
256 | + $query->update($this->dbTable) |
|
257 | + ->set('status', $query->createNamedParameter($status)) |
|
258 | + ->where($query->expr()->eq('url_hash', $query->createNamedParameter($hash))); |
|
259 | + if (!is_null($token)) { |
|
260 | + $query->set('sync_token', $query->createNamedParameter($token)); |
|
261 | + } |
|
262 | + $query->execute(); |
|
263 | + } |
|
264 | + |
|
265 | + /** |
|
266 | + * get server status |
|
267 | + * |
|
268 | + * @param string $url |
|
269 | + * @return int |
|
270 | + */ |
|
271 | + public function getServerStatus($url) { |
|
272 | + $hash = $this->hash($url); |
|
273 | + $query = $this->connection->getQueryBuilder(); |
|
274 | + $query->select('status')->from($this->dbTable) |
|
275 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
276 | + ->setParameter('url_hash', $hash); |
|
277 | + |
|
278 | + $statement = $query->execute(); |
|
279 | + $result = $statement->fetch(); |
|
280 | + $statement->closeCursor(); |
|
281 | + return (int)$result['status']; |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * create hash from URL |
|
286 | + * |
|
287 | + * @param string $url |
|
288 | + * @return string |
|
289 | + */ |
|
290 | + protected function hash($url) { |
|
291 | + $normalized = $this->normalizeUrl($url); |
|
292 | + return sha1($normalized); |
|
293 | + } |
|
294 | + |
|
295 | + /** |
|
296 | + * normalize URL, used to create the sha1 hash |
|
297 | + * |
|
298 | + * @param string $url |
|
299 | + * @return string |
|
300 | + */ |
|
301 | + protected function normalizeUrl($url) { |
|
302 | + $normalized = $url; |
|
303 | + |
|
304 | + if (strpos($url, 'https://') === 0) { |
|
305 | + $normalized = substr($url, strlen('https://')); |
|
306 | + } else if (strpos($url, 'http://') === 0) { |
|
307 | + $normalized = substr($url, strlen('http://')); |
|
308 | + } |
|
309 | + |
|
310 | + $normalized = Filesystem::normalizePath($normalized); |
|
311 | + $normalized = trim($normalized, '/'); |
|
312 | + |
|
313 | + return $normalized; |
|
314 | + } |
|
315 | + |
|
316 | + /** |
|
317 | + * @param $username |
|
318 | + * @param $password |
|
319 | + * @return bool |
|
320 | + */ |
|
321 | + public function auth($username, $password) { |
|
322 | + if ($username !== 'system') { |
|
323 | + return false; |
|
324 | + } |
|
325 | + $query = $this->connection->getQueryBuilder(); |
|
326 | + $query->select('url')->from($this->dbTable) |
|
327 | + ->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password))); |
|
328 | + |
|
329 | + $statement = $query->execute(); |
|
330 | + $result = $statement->fetch(); |
|
331 | + $statement->closeCursor(); |
|
332 | + return !empty($result); |
|
333 | + } |
|
334 | 334 | |
335 | 335 | } |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | $result = $query->execute(); |
88 | 88 | |
89 | 89 | if ($result) { |
90 | - return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
90 | + return (int) $this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
91 | 91 | } |
92 | 92 | |
93 | - $message = 'Internal failure, Could not add trusted server: ' . $url; |
|
93 | + $message = 'Internal failure, Could not add trusted server: '.$url; |
|
94 | 94 | $message_t = $this->IL10N->t('Could not add server'); |
95 | 95 | throw new HintException($message, $message_t); |
96 | 96 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $result = $query->execute()->fetchAll(); |
125 | 125 | |
126 | 126 | if (empty($result)) { |
127 | - throw new \Exception('No Server found with ID: ' . $id); |
|
127 | + throw new \Exception('No Server found with ID: '.$id); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | return $result[0]; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $statement->closeCursor(); |
202 | 202 | |
203 | 203 | if (!isset($result['token'])) { |
204 | - throw new \Exception('No token found for: ' . $url); |
|
204 | + throw new \Exception('No token found for: '.$url); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $result['token']; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $statement = $query->execute(); |
279 | 279 | $result = $statement->fetch(); |
280 | 280 | $statement->closeCursor(); |
281 | - return (int)$result['status']; |
|
281 | + return (int) $result['status']; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -45,103 +45,103 @@ |
||
45 | 45 | * @since 8.0.0 |
46 | 46 | */ |
47 | 47 | interface IGroupManager { |
48 | - /** |
|
49 | - * Checks whether a given backend is used |
|
50 | - * |
|
51 | - * @param string $backendClass Full classname including complete namespace |
|
52 | - * @return bool |
|
53 | - * @since 8.1.0 |
|
54 | - */ |
|
55 | - public function isBackendUsed($backendClass); |
|
48 | + /** |
|
49 | + * Checks whether a given backend is used |
|
50 | + * |
|
51 | + * @param string $backendClass Full classname including complete namespace |
|
52 | + * @return bool |
|
53 | + * @since 8.1.0 |
|
54 | + */ |
|
55 | + public function isBackendUsed($backendClass); |
|
56 | 56 | |
57 | - /** |
|
58 | - * @param \OCP\GroupInterface $backend |
|
59 | - * @since 8.0.0 |
|
60 | - */ |
|
61 | - public function addBackend($backend); |
|
57 | + /** |
|
58 | + * @param \OCP\GroupInterface $backend |
|
59 | + * @since 8.0.0 |
|
60 | + */ |
|
61 | + public function addBackend($backend); |
|
62 | 62 | |
63 | - /** |
|
64 | - * @since 8.0.0 |
|
65 | - */ |
|
66 | - public function clearBackends(); |
|
63 | + /** |
|
64 | + * @since 8.0.0 |
|
65 | + */ |
|
66 | + public function clearBackends(); |
|
67 | 67 | |
68 | - /** |
|
69 | - * Get the active backends |
|
70 | - * @return \OCP\GroupInterface[] |
|
71 | - * @since 13.0.0 |
|
72 | - */ |
|
73 | - public function getBackends(); |
|
68 | + /** |
|
69 | + * Get the active backends |
|
70 | + * @return \OCP\GroupInterface[] |
|
71 | + * @since 13.0.0 |
|
72 | + */ |
|
73 | + public function getBackends(); |
|
74 | 74 | |
75 | - /** |
|
76 | - * @param string $gid |
|
77 | - * @return \OCP\IGroup |
|
78 | - * @since 8.0.0 |
|
79 | - */ |
|
80 | - public function get($gid); |
|
75 | + /** |
|
76 | + * @param string $gid |
|
77 | + * @return \OCP\IGroup |
|
78 | + * @since 8.0.0 |
|
79 | + */ |
|
80 | + public function get($gid); |
|
81 | 81 | |
82 | - /** |
|
83 | - * @param string $gid |
|
84 | - * @return bool |
|
85 | - * @since 8.0.0 |
|
86 | - */ |
|
87 | - public function groupExists($gid); |
|
82 | + /** |
|
83 | + * @param string $gid |
|
84 | + * @return bool |
|
85 | + * @since 8.0.0 |
|
86 | + */ |
|
87 | + public function groupExists($gid); |
|
88 | 88 | |
89 | - /** |
|
90 | - * @param string $gid |
|
91 | - * @return \OCP\IGroup |
|
92 | - * @since 8.0.0 |
|
93 | - */ |
|
94 | - public function createGroup($gid); |
|
89 | + /** |
|
90 | + * @param string $gid |
|
91 | + * @return \OCP\IGroup |
|
92 | + * @since 8.0.0 |
|
93 | + */ |
|
94 | + public function createGroup($gid); |
|
95 | 95 | |
96 | - /** |
|
97 | - * @param string $search |
|
98 | - * @param int $limit |
|
99 | - * @param int $offset |
|
100 | - * @return \OCP\IGroup[] |
|
101 | - * @since 8.0.0 |
|
102 | - */ |
|
103 | - public function search($search, $limit = null, $offset = null); |
|
96 | + /** |
|
97 | + * @param string $search |
|
98 | + * @param int $limit |
|
99 | + * @param int $offset |
|
100 | + * @return \OCP\IGroup[] |
|
101 | + * @since 8.0.0 |
|
102 | + */ |
|
103 | + public function search($search, $limit = null, $offset = null); |
|
104 | 104 | |
105 | - /** |
|
106 | - * @param \OCP\IUser|null $user |
|
107 | - * @return \OCP\IGroup[] |
|
108 | - * @since 8.0.0 |
|
109 | - */ |
|
110 | - public function getUserGroups(IUser $user = null); |
|
105 | + /** |
|
106 | + * @param \OCP\IUser|null $user |
|
107 | + * @return \OCP\IGroup[] |
|
108 | + * @since 8.0.0 |
|
109 | + */ |
|
110 | + public function getUserGroups(IUser $user = null); |
|
111 | 111 | |
112 | - /** |
|
113 | - * @param \OCP\IUser $user |
|
114 | - * @return array with group names |
|
115 | - * @since 8.0.0 |
|
116 | - */ |
|
117 | - public function getUserGroupIds(IUser $user); |
|
112 | + /** |
|
113 | + * @param \OCP\IUser $user |
|
114 | + * @return array with group names |
|
115 | + * @since 8.0.0 |
|
116 | + */ |
|
117 | + public function getUserGroupIds(IUser $user); |
|
118 | 118 | |
119 | - /** |
|
120 | - * get a list of all display names in a group |
|
121 | - * |
|
122 | - * @param string $gid |
|
123 | - * @param string $search |
|
124 | - * @param int $limit |
|
125 | - * @param int $offset |
|
126 | - * @return array an array of display names (value) and user ids (key) |
|
127 | - * @since 8.0.0 |
|
128 | - */ |
|
129 | - public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0); |
|
119 | + /** |
|
120 | + * get a list of all display names in a group |
|
121 | + * |
|
122 | + * @param string $gid |
|
123 | + * @param string $search |
|
124 | + * @param int $limit |
|
125 | + * @param int $offset |
|
126 | + * @return array an array of display names (value) and user ids (key) |
|
127 | + * @since 8.0.0 |
|
128 | + */ |
|
129 | + public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0); |
|
130 | 130 | |
131 | - /** |
|
132 | - * Checks if a userId is in the admin group |
|
133 | - * @param string $userId |
|
134 | - * @return bool if admin |
|
135 | - * @since 8.0.0 |
|
136 | - */ |
|
137 | - public function isAdmin($userId); |
|
131 | + /** |
|
132 | + * Checks if a userId is in the admin group |
|
133 | + * @param string $userId |
|
134 | + * @return bool if admin |
|
135 | + * @since 8.0.0 |
|
136 | + */ |
|
137 | + public function isAdmin($userId); |
|
138 | 138 | |
139 | - /** |
|
140 | - * Checks if a userId is in a group |
|
141 | - * @param string $userId |
|
142 | - * @param string $group |
|
143 | - * @return bool if in group |
|
144 | - * @since 8.0.0 |
|
145 | - */ |
|
146 | - public function isInGroup($userId, $group); |
|
139 | + /** |
|
140 | + * Checks if a userId is in a group |
|
141 | + * @param string $userId |
|
142 | + * @param string $group |
|
143 | + * @return bool if in group |
|
144 | + * @since 8.0.0 |
|
145 | + */ |
|
146 | + public function isInGroup($userId, $group); |
|
147 | 147 | } |