@@ -18,8 +18,11 @@ discard block |
||
18 | 18 | <?php if(is_array($err)):?> |
19 | 19 | <?php print_unescaped($err['error']); ?> |
20 | 20 | <span class='hint'><?php print_unescaped($err['hint']); ?></span> |
21 | - <?php else: ?> |
|
22 | - <?php print_unescaped($err); ?> |
|
21 | + <?php else { |
|
22 | + : ?> |
|
23 | + <?php print_unescaped($err); |
|
24 | +} |
|
25 | +?> |
|
23 | 26 | <?php endif; ?> |
24 | 27 | </p> |
25 | 28 | <?php endforeach; ?> |
@@ -75,8 +78,12 @@ discard block |
||
75 | 78 | |
76 | 79 | <?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
77 | 80 | <fieldset id='databaseBackend'> |
78 | - <?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) |
|
79 | - $hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?> |
|
81 | + <?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) { |
|
82 | + $hasOtherDB = true; |
|
83 | +} else { |
|
84 | + $hasOtherDB =false; |
|
85 | + } |
|
86 | + //other than SQLite ?> |
|
80 | 87 | <legend><?php p($l->t( 'Configure the database' )); ?></legend> |
81 | 88 | <div id="selectDbType"> |
82 | 89 | <?php foreach($_['databases'] as $type => $label): ?> |
@@ -88,11 +95,14 @@ discard block |
||
88 | 95 | <?php p($l->t( 'For more details check out the documentation.' )); ?> ↗</a> |
89 | 96 | </p> |
90 | 97 | <input type="hidden" id="dbtype" name="dbtype" value="<?php p($type) ?>"> |
91 | - <?php else: ?> |
|
98 | + <?php else { |
|
99 | + : ?> |
|
92 | 100 | <input type="radio" name="dbtype" value="<?php p($type) ?>" id="<?php p($type) ?>" |
93 | 101 | <?php print_unescaped($_['dbtype'] === $type ? 'checked="checked" ' : '') ?>/> |
94 | 102 | <label class="<?php p($type) ?>" for="<?php p($type) ?>"><?php p($label) ?></label> |
95 | - <?php endif; ?> |
|
103 | + <?php endif; |
|
104 | +} |
|
105 | +?> |
|
96 | 106 | <?php endforeach; ?> |
97 | 107 | </div> |
98 | 108 | </fieldset> |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | <input type='hidden' id='hasOracle' value='<?php p($_['hasOracle']) ?>'> |
11 | 11 | <form action="index.php" method="post"> |
12 | 12 | <input type="hidden" name="install" value="true"> |
13 | - <?php if(count($_['errors']) > 0): ?> |
|
13 | + <?php if (count($_['errors']) > 0): ?> |
|
14 | 14 | <fieldset class="warning"> |
15 | - <legend><strong><?php p($l->t('Error'));?></strong></legend> |
|
16 | - <?php foreach($_['errors'] as $err): ?> |
|
15 | + <legend><strong><?php p($l->t('Error')); ?></strong></legend> |
|
16 | + <?php foreach ($_['errors'] as $err): ?> |
|
17 | 17 | <p> |
18 | - <?php if(is_array($err)):?> |
|
18 | + <?php if (is_array($err)):?> |
|
19 | 19 | <?php print_unescaped($err['error']); ?> |
20 | 20 | <span class='hint'><?php print_unescaped($err['hint']); ?></span> |
21 | 21 | <?php else: ?> |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | <?php endforeach; ?> |
26 | 26 | </fieldset> |
27 | 27 | <?php endif; ?> |
28 | - <?php if(!$_['htaccessWorking']): ?> |
|
28 | + <?php if (!$_['htaccessWorking']): ?> |
|
29 | 29 | <fieldset class="warning"> |
30 | - <legend><strong><?php p($l->t('Security warning'));?></strong></legend> |
|
31 | - <p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br> |
|
30 | + <legend><strong><?php p($l->t('Security warning')); ?></strong></legend> |
|
31 | + <p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.')); ?><br> |
|
32 | 32 | <?php print_unescaped($l->t( |
33 | 33 | 'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer noopener">documentation</a>.', |
34 | 34 | [link_to_docs('admin-install')] |
@@ -36,35 +36,35 @@ discard block |
||
36 | 36 | </fieldset> |
37 | 37 | <?php endif; ?> |
38 | 38 | <fieldset id="adminaccount"> |
39 | - <legend><?php print_unescaped($l->t( 'Create an <strong>admin account</strong>' )); ?></legend> |
|
39 | + <legend><?php print_unescaped($l->t('Create an <strong>admin account</strong>')); ?></legend> |
|
40 | 40 | <p class="grouptop"> |
41 | 41 | <input type="text" name="adminlogin" id="adminlogin" |
42 | - placeholder="<?php p($l->t( 'Username' )); ?>" |
|
42 | + placeholder="<?php p($l->t('Username')); ?>" |
|
43 | 43 | value="<?php p($_['adminlogin']); ?>" |
44 | 44 | autocomplete="off" autocapitalize="none" autocorrect="off" autofocus required> |
45 | - <label for="adminlogin" class="infield"><?php p($l->t( 'Username' )); ?></label> |
|
45 | + <label for="adminlogin" class="infield"><?php p($l->t('Username')); ?></label> |
|
46 | 46 | </p> |
47 | 47 | <p class="groupbottom"> |
48 | 48 | <input type="password" name="adminpass" data-typetoggle="#show" id="adminpass" |
49 | - placeholder="<?php p($l->t( 'Password' )); ?>" |
|
49 | + placeholder="<?php p($l->t('Password')); ?>" |
|
50 | 50 | value="<?php p($_['adminpass']); ?>" |
51 | 51 | autocomplete="off" autocapitalize="none" autocorrect="off" required> |
52 | - <label for="adminpass" class="infield"><?php p($l->t( 'Password' )); ?></label> |
|
52 | + <label for="adminpass" class="infield"><?php p($l->t('Password')); ?></label> |
|
53 | 53 | <input type="checkbox" id="show" class="hidden-visually" name="show"> |
54 | 54 | <label for="show"></label> |
55 | 55 | </p> |
56 | 56 | </fieldset> |
57 | 57 | |
58 | - <?php if(!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
58 | + <?php if (!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
59 | 59 | <fieldset id="advancedHeader"> |
60 | - <legend><a id="showAdvanced" tabindex="0" href="#"><?php p($l->t( 'Storage & database' )); ?><img src="<?php print_unescaped(image_path('', 'actions/caret-white.svg')); ?>" /></a></legend> |
|
60 | + <legend><a id="showAdvanced" tabindex="0" href="#"><?php p($l->t('Storage & database')); ?><img src="<?php print_unescaped(image_path('', 'actions/caret-white.svg')); ?>" /></a></legend> |
|
61 | 61 | </fieldset> |
62 | 62 | <?php endif; ?> |
63 | 63 | |
64 | - <?php if(!$_['directoryIsSet'] OR count($_['errors']) > 0): ?> |
|
64 | + <?php if (!$_['directoryIsSet'] OR count($_['errors']) > 0): ?> |
|
65 | 65 | <fieldset id="datadirField"> |
66 | 66 | <div id="datadirContent"> |
67 | - <label for="directory"><?php p($l->t( 'Data folder' )); ?></label> |
|
67 | + <label for="directory"><?php p($l->t('Data folder')); ?></label> |
|
68 | 68 | <input type="text" name="directory" id="directory" |
69 | 69 | placeholder="<?php p(OC::$SERVERROOT.'/data'); ?>" |
70 | 70 | value="<?php p($_['directory']); ?>" |
@@ -73,19 +73,19 @@ discard block |
||
73 | 73 | </fieldset> |
74 | 74 | <?php endif; ?> |
75 | 75 | |
76 | - <?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
76 | + <?php if (!$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
77 | 77 | <fieldset id='databaseBackend'> |
78 | - <?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) |
|
79 | - $hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?> |
|
80 | - <legend><?php p($l->t( 'Configure the database' )); ?></legend> |
|
78 | + <?php if ($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) |
|
79 | + $hasOtherDB = true; else $hasOtherDB = false; //other than SQLite ?> |
|
80 | + <legend><?php p($l->t('Configure the database')); ?></legend> |
|
81 | 81 | <div id="selectDbType"> |
82 | - <?php foreach($_['databases'] as $type => $label): ?> |
|
83 | - <?php if(count($_['databases']) === 1): ?> |
|
82 | + <?php foreach ($_['databases'] as $type => $label): ?> |
|
83 | + <?php if (count($_['databases']) === 1): ?> |
|
84 | 84 | <p class="info"> |
85 | - <?php p($l->t( 'Only %s is available.', array($label) )); ?> |
|
86 | - <?php p($l->t( 'Install and activate additional PHP modules to choose other database types.' )); ?><br> |
|
85 | + <?php p($l->t('Only %s is available.', array($label))); ?> |
|
86 | + <?php p($l->t('Install and activate additional PHP modules to choose other database types.')); ?><br> |
|
87 | 87 | <a href="<?php print_unescaped(link_to_docs('admin-source_install')); ?>" target="_blank" rel="noreferrer noopener"> |
88 | - <?php p($l->t( 'For more details check out the documentation.' )); ?> ↗</a> |
|
88 | + <?php p($l->t('For more details check out the documentation.')); ?> ↗</a> |
|
89 | 89 | </p> |
90 | 90 | <input type="hidden" id="dbtype" name="dbtype" value="<?php p($type) ?>"> |
91 | 91 | <?php else: ?> |
@@ -97,75 +97,75 @@ discard block |
||
97 | 97 | </div> |
98 | 98 | </fieldset> |
99 | 99 | |
100 | - <?php if($hasOtherDB): ?> |
|
100 | + <?php if ($hasOtherDB): ?> |
|
101 | 101 | <fieldset id='databaseField'> |
102 | 102 | <div id="use_other_db"> |
103 | 103 | <p class="grouptop"> |
104 | - <label for="dbuser" class="infield"><?php p($l->t( 'Database user' )); ?></label> |
|
104 | + <label for="dbuser" class="infield"><?php p($l->t('Database user')); ?></label> |
|
105 | 105 | <input type="text" name="dbuser" id="dbuser" |
106 | - placeholder="<?php p($l->t( 'Database user' )); ?>" |
|
106 | + placeholder="<?php p($l->t('Database user')); ?>" |
|
107 | 107 | value="<?php p($_['dbuser']); ?>" |
108 | 108 | autocomplete="off" autocapitalize="none" autocorrect="off"> |
109 | 109 | </p> |
110 | 110 | <p class="groupmiddle"> |
111 | 111 | <input type="password" name="dbpass" id="dbpass" data-typetoggle="#dbpassword-toggle" |
112 | - placeholder="<?php p($l->t( 'Database password' )); ?>" |
|
112 | + placeholder="<?php p($l->t('Database password')); ?>" |
|
113 | 113 | value="<?php p($_['dbpass']); ?>" |
114 | 114 | autocomplete="off" autocapitalize="none" autocorrect="off"> |
115 | - <label for="dbpass" class="infield"><?php p($l->t( 'Database password' )); ?></label> |
|
115 | + <label for="dbpass" class="infield"><?php p($l->t('Database password')); ?></label> |
|
116 | 116 | <input type="checkbox" id="dbpassword-toggle" class="hidden-visually" name="dbpassword-toggle"> |
117 | 117 | <label for="dbpassword-toggle"></label> |
118 | 118 | </p> |
119 | 119 | <p class="groupmiddle"> |
120 | - <label for="dbname" class="infield"><?php p($l->t( 'Database name' )); ?></label> |
|
120 | + <label for="dbname" class="infield"><?php p($l->t('Database name')); ?></label> |
|
121 | 121 | <input type="text" name="dbname" id="dbname" |
122 | - placeholder="<?php p($l->t( 'Database name' )); ?>" |
|
122 | + placeholder="<?php p($l->t('Database name')); ?>" |
|
123 | 123 | value="<?php p($_['dbname']); ?>" |
124 | 124 | autocomplete="off" autocapitalize="none" autocorrect="off" |
125 | 125 | pattern="[0-9a-zA-Z$_-]+"> |
126 | 126 | </p> |
127 | - <?php if($_['hasOracle']): ?> |
|
127 | + <?php if ($_['hasOracle']): ?> |
|
128 | 128 | <div id="use_oracle_db"> |
129 | 129 | <p class="groupmiddle"> |
130 | - <label for="dbtablespace" class="infield"><?php p($l->t( 'Database tablespace' )); ?></label> |
|
130 | + <label for="dbtablespace" class="infield"><?php p($l->t('Database tablespace')); ?></label> |
|
131 | 131 | <input type="text" name="dbtablespace" id="dbtablespace" |
132 | - placeholder="<?php p($l->t( 'Database tablespace' )); ?>" |
|
132 | + placeholder="<?php p($l->t('Database tablespace')); ?>" |
|
133 | 133 | value="<?php p($_['dbtablespace']); ?>" |
134 | 134 | autocomplete="off" autocapitalize="none" autocorrect="off"> |
135 | 135 | </p> |
136 | 136 | </div> |
137 | 137 | <?php endif; ?> |
138 | 138 | <p class="groupbottom"> |
139 | - <label for="dbhost" class="infield"><?php p($l->t( 'Database host' )); ?></label> |
|
139 | + <label for="dbhost" class="infield"><?php p($l->t('Database host')); ?></label> |
|
140 | 140 | <input type="text" name="dbhost" id="dbhost" |
141 | - placeholder="<?php p($l->t( 'Database host' )); ?>" |
|
141 | + placeholder="<?php p($l->t('Database host')); ?>" |
|
142 | 142 | value="<?php p($_['dbhost']); ?>" |
143 | 143 | autocomplete="off" autocapitalize="none" autocorrect="off"> |
144 | 144 | </p> |
145 | 145 | <p class="info"> |
146 | - <?php p($l->t( 'Please specify the port number along with the host name (e.g., localhost:5432).' )); ?> |
|
146 | + <?php p($l->t('Please specify the port number along with the host name (e.g., localhost:5432).')); ?> |
|
147 | 147 | </p> |
148 | 148 | </div> |
149 | 149 | </fieldset> |
150 | 150 | <?php endif; ?> |
151 | 151 | <?php endif; ?> |
152 | 152 | |
153 | - <?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
153 | + <?php if (!$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
|
154 | 154 | <fieldset id="sqliteInformation" class="warning"> |
155 | - <legend><?php p($l->t('Performance warning'));?></legend> |
|
156 | - <p><?php p($l->t('You chose SQLite as database.'));?></p> |
|
157 | - <p><?php p($l->t('SQLite should only be used for minimal and development instances. For production we recommend a different database backend.'));?></p> |
|
155 | + <legend><?php p($l->t('Performance warning')); ?></legend> |
|
156 | + <p><?php p($l->t('You chose SQLite as database.')); ?></p> |
|
157 | + <p><?php p($l->t('SQLite should only be used for minimal and development instances. For production we recommend a different database backend.')); ?></p> |
|
158 | 158 | <p><?php p($l->t('If you use clients for file syncing, the use of SQLite is highly discouraged.')); ?></p> |
159 | 159 | </fieldset> |
160 | 160 | <?php endif ?> |
161 | 161 | |
162 | 162 | <div class="icon-loading-dark float-spinner"> </div> |
163 | 163 | |
164 | - <div class="buttons"><input type="submit" class="primary" value="<?php p($l->t( 'Finish setup' )); ?>" data-finishing="<?php p($l->t( 'Finishing …' )); ?>"></div> |
|
164 | + <div class="buttons"><input type="submit" class="primary" value="<?php p($l->t('Finish setup')); ?>" data-finishing="<?php p($l->t('Finishing …')); ?>"></div> |
|
165 | 165 | |
166 | 166 | <p class="info"> |
167 | 167 | <span class="icon-info-white"></span> |
168 | - <?php p($l->t('Need help?'));?> |
|
169 | - <a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation'));?> ↗</a> |
|
168 | + <?php p($l->t('Need help?')); ?> |
|
169 | + <a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation')); ?> ↗</a> |
|
170 | 170 | </p> |
171 | 171 | </form> |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | script('core', [ |
3 | - 'installation' |
|
3 | + 'installation' |
|
4 | 4 | ]); |
5 | 5 | ?> |
6 | 6 | <input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'> |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | <legend><strong><?php p($l->t('Security warning'));?></strong></legend> |
30 | 30 | <p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br> |
31 | 31 | <?php print_unescaped($l->t( |
32 | - 'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer noopener">documentation</a>.', |
|
33 | - [link_to_docs('admin-install')] |
|
34 | - )); ?></p> |
|
32 | + 'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer noopener">documentation</a>.', |
|
33 | + [link_to_docs('admin-install')] |
|
34 | + )); ?></p> |
|
35 | 35 | </fieldset> |
36 | 36 | <?php endif; ?> |
37 | 37 | <fieldset id="adminaccount"> |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | <?php if(!$_['dbIsSet'] OR count($_['errors']) > 0): ?> |
76 | 76 | <fieldset id='databaseBackend'> |
77 | 77 | <?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) |
78 | - $hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?> |
|
78 | + $hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?> |
|
79 | 79 | <legend><?php p($l->t( 'Configure the database' )); ?></legend> |
80 | 80 | <div id="selectDbType"> |
81 | 81 | <?php foreach($_['databases'] as $type => $label): ?> |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | - /** @var array $_ */ |
|
3 | - /** @var \OCP\IL10N $l */ |
|
2 | + /** @var array $_ */ |
|
3 | + /** @var \OCP\IL10N $l */ |
|
4 | 4 | |
5 | 5 | style('core', ['styles', 'header']); |
6 | 6 | ?> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | <ul> |
15 | 15 | <li><?php p($l->t('Remote Address: %s', [$_['remoteAddr']])) ?></li> |
16 | 16 | <li><?php p($l->t('Request ID: %s', [$_['requestID']])) ?></li> |
17 | - <?php if($_['debugMode']): ?> |
|
17 | + <?php if ($_['debugMode']): ?> |
|
18 | 18 | <li><?php p($l->t('Type: %s', [$_['errorClass']])) ?></li> |
19 | 19 | <li><?php p($l->t('Code: %s', [$_['errorCode']])) ?></li> |
20 | 20 | <li><?php p($l->t('Message: %s', [$_['errorMsg']])) ?></li> |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | <?php endif; ?> |
24 | 24 | </ul> |
25 | 25 | |
26 | - <?php if($_['debugMode']): ?> |
|
26 | + <?php if ($_['debugMode']): ?> |
|
27 | 27 | <br /> |
28 | 28 | <h3><?php p($l->t('Trace')) ?></h3> |
29 | 29 | <pre><?php p($_['trace']) ?></pre> |
@@ -29,46 +29,46 @@ |
||
29 | 29 | use \OCP\IUserManager; |
30 | 30 | |
31 | 31 | class UserController extends Controller { |
32 | - /** |
|
33 | - * @var IUserManager |
|
34 | - */ |
|
35 | - protected $userManager; |
|
32 | + /** |
|
33 | + * @var IUserManager |
|
34 | + */ |
|
35 | + protected $userManager; |
|
36 | 36 | |
37 | - public function __construct($appName, |
|
38 | - IRequest $request, |
|
39 | - IUserManager $userManager |
|
40 | - ) { |
|
41 | - parent::__construct($appName, $request); |
|
42 | - $this->userManager = $userManager; |
|
43 | - } |
|
37 | + public function __construct($appName, |
|
38 | + IRequest $request, |
|
39 | + IUserManager $userManager |
|
40 | + ) { |
|
41 | + parent::__construct($appName, $request); |
|
42 | + $this->userManager = $userManager; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Lookup user display names |
|
47 | - * |
|
48 | - * @NoAdminRequired |
|
49 | - * |
|
50 | - * @param array $users |
|
51 | - * |
|
52 | - * @return JSONResponse |
|
53 | - */ |
|
54 | - public function getDisplayNames($users) { |
|
55 | - $result = array(); |
|
45 | + /** |
|
46 | + * Lookup user display names |
|
47 | + * |
|
48 | + * @NoAdminRequired |
|
49 | + * |
|
50 | + * @param array $users |
|
51 | + * |
|
52 | + * @return JSONResponse |
|
53 | + */ |
|
54 | + public function getDisplayNames($users) { |
|
55 | + $result = array(); |
|
56 | 56 | |
57 | - foreach ($users as $user) { |
|
58 | - $userObject = $this->userManager->get($user); |
|
59 | - if (is_object($userObject)) { |
|
60 | - $result[$user] = $userObject->getDisplayName(); |
|
61 | - } else { |
|
62 | - $result[$user] = $user; |
|
63 | - } |
|
64 | - } |
|
57 | + foreach ($users as $user) { |
|
58 | + $userObject = $this->userManager->get($user); |
|
59 | + if (is_object($userObject)) { |
|
60 | + $result[$user] = $userObject->getDisplayName(); |
|
61 | + } else { |
|
62 | + $result[$user] = $user; |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | - $json = array( |
|
67 | - 'users' => $result, |
|
68 | - 'status' => 'success' |
|
69 | - ); |
|
66 | + $json = array( |
|
67 | + 'users' => $result, |
|
68 | + 'status' => 'success' |
|
69 | + ); |
|
70 | 70 | |
71 | - return new JSONResponse($json); |
|
71 | + return new JSONResponse($json); |
|
72 | 72 | |
73 | - } |
|
73 | + } |
|
74 | 74 | } |
@@ -34,28 +34,28 @@ |
||
34 | 34 | |
35 | 35 | class RemoveCertificate extends Base { |
36 | 36 | |
37 | - /** @var ICertificateManager */ |
|
38 | - protected $certificateManager; |
|
39 | - |
|
40 | - public function __construct(ICertificateManager $certificateManager) { |
|
41 | - $this->certificateManager = $certificateManager; |
|
42 | - parent::__construct(); |
|
43 | - } |
|
44 | - |
|
45 | - protected function configure() { |
|
46 | - $this |
|
47 | - ->setName('security:certificates:remove') |
|
48 | - ->setDescription('remove trusted certificate') |
|
49 | - ->addArgument( |
|
50 | - 'name', |
|
51 | - InputArgument::REQUIRED, |
|
52 | - 'the file name of the certificate to remove' |
|
53 | - ); |
|
54 | - } |
|
55 | - |
|
56 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
57 | - $name = $input->getArgument('name'); |
|
58 | - |
|
59 | - $this->certificateManager->removeCertificate($name); |
|
60 | - } |
|
37 | + /** @var ICertificateManager */ |
|
38 | + protected $certificateManager; |
|
39 | + |
|
40 | + public function __construct(ICertificateManager $certificateManager) { |
|
41 | + $this->certificateManager = $certificateManager; |
|
42 | + parent::__construct(); |
|
43 | + } |
|
44 | + |
|
45 | + protected function configure() { |
|
46 | + $this |
|
47 | + ->setName('security:certificates:remove') |
|
48 | + ->setDescription('remove trusted certificate') |
|
49 | + ->addArgument( |
|
50 | + 'name', |
|
51 | + InputArgument::REQUIRED, |
|
52 | + 'the file name of the certificate to remove' |
|
53 | + ); |
|
54 | + } |
|
55 | + |
|
56 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
57 | + $name = $input->getArgument('name'); |
|
58 | + |
|
59 | + $this->certificateManager->removeCertificate($name); |
|
60 | + } |
|
61 | 61 | } |
@@ -34,64 +34,64 @@ |
||
34 | 34 | |
35 | 35 | class ListCertificates extends Base { |
36 | 36 | |
37 | - /** @var ICertificateManager */ |
|
38 | - protected $certificateManager; |
|
39 | - /** @var IL10N */ |
|
40 | - protected $l; |
|
37 | + /** @var ICertificateManager */ |
|
38 | + protected $certificateManager; |
|
39 | + /** @var IL10N */ |
|
40 | + protected $l; |
|
41 | 41 | |
42 | - public function __construct(ICertificateManager $certificateManager, IL10N $l) { |
|
43 | - $this->certificateManager = $certificateManager; |
|
44 | - $this->l = $l; |
|
45 | - parent::__construct(); |
|
46 | - } |
|
42 | + public function __construct(ICertificateManager $certificateManager, IL10N $l) { |
|
43 | + $this->certificateManager = $certificateManager; |
|
44 | + $this->l = $l; |
|
45 | + parent::__construct(); |
|
46 | + } |
|
47 | 47 | |
48 | - protected function configure() { |
|
49 | - $this |
|
50 | - ->setName('security:certificates') |
|
51 | - ->setDescription('list trusted certificates'); |
|
52 | - parent::configure(); |
|
53 | - } |
|
48 | + protected function configure() { |
|
49 | + $this |
|
50 | + ->setName('security:certificates') |
|
51 | + ->setDescription('list trusted certificates'); |
|
52 | + parent::configure(); |
|
53 | + } |
|
54 | 54 | |
55 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
56 | - $outputType = $input->getOption('output'); |
|
57 | - if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) { |
|
58 | - $certificates = array_map(function (ICertificate $certificate) { |
|
59 | - return [ |
|
60 | - 'name' => $certificate->getName(), |
|
61 | - 'common_name' => $certificate->getCommonName(), |
|
62 | - 'organization' => $certificate->getOrganization(), |
|
63 | - 'expire' => $certificate->getExpireDate()->format(\DateTime::ATOM), |
|
64 | - 'issuer' => $certificate->getIssuerName(), |
|
65 | - 'issuer_organization' => $certificate->getIssuerOrganization(), |
|
66 | - 'issue_date' => $certificate->getIssueDate()->format(\DateTime::ATOM) |
|
67 | - ]; |
|
68 | - }, $this->certificateManager->listCertificates()); |
|
69 | - if ($outputType === self::OUTPUT_FORMAT_JSON) { |
|
70 | - $output->writeln(json_encode(array_values($certificates))); |
|
71 | - } else { |
|
72 | - $output->writeln(json_encode(array_values($certificates), JSON_PRETTY_PRINT)); |
|
73 | - } |
|
74 | - } else { |
|
75 | - $table = new Table($output); |
|
76 | - $table->setHeaders([ |
|
77 | - 'File Name', |
|
78 | - 'Common Name', |
|
79 | - 'Organization', |
|
80 | - 'Valid Until', |
|
81 | - 'Issued By' |
|
82 | - ]); |
|
55 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
56 | + $outputType = $input->getOption('output'); |
|
57 | + if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) { |
|
58 | + $certificates = array_map(function (ICertificate $certificate) { |
|
59 | + return [ |
|
60 | + 'name' => $certificate->getName(), |
|
61 | + 'common_name' => $certificate->getCommonName(), |
|
62 | + 'organization' => $certificate->getOrganization(), |
|
63 | + 'expire' => $certificate->getExpireDate()->format(\DateTime::ATOM), |
|
64 | + 'issuer' => $certificate->getIssuerName(), |
|
65 | + 'issuer_organization' => $certificate->getIssuerOrganization(), |
|
66 | + 'issue_date' => $certificate->getIssueDate()->format(\DateTime::ATOM) |
|
67 | + ]; |
|
68 | + }, $this->certificateManager->listCertificates()); |
|
69 | + if ($outputType === self::OUTPUT_FORMAT_JSON) { |
|
70 | + $output->writeln(json_encode(array_values($certificates))); |
|
71 | + } else { |
|
72 | + $output->writeln(json_encode(array_values($certificates), JSON_PRETTY_PRINT)); |
|
73 | + } |
|
74 | + } else { |
|
75 | + $table = new Table($output); |
|
76 | + $table->setHeaders([ |
|
77 | + 'File Name', |
|
78 | + 'Common Name', |
|
79 | + 'Organization', |
|
80 | + 'Valid Until', |
|
81 | + 'Issued By' |
|
82 | + ]); |
|
83 | 83 | |
84 | - $rows = array_map(function (ICertificate $certificate) { |
|
85 | - return [ |
|
86 | - $certificate->getName(), |
|
87 | - $certificate->getCommonName(), |
|
88 | - $certificate->getOrganization(), |
|
89 | - $this->l->l('date', $certificate->getExpireDate()), |
|
90 | - $certificate->getIssuerName() |
|
91 | - ]; |
|
92 | - }, $this->certificateManager->listCertificates()); |
|
93 | - $table->setRows($rows); |
|
94 | - $table->render(); |
|
95 | - } |
|
96 | - } |
|
84 | + $rows = array_map(function (ICertificate $certificate) { |
|
85 | + return [ |
|
86 | + $certificate->getName(), |
|
87 | + $certificate->getCommonName(), |
|
88 | + $certificate->getOrganization(), |
|
89 | + $this->l->l('date', $certificate->getExpireDate()), |
|
90 | + $certificate->getIssuerName() |
|
91 | + ]; |
|
92 | + }, $this->certificateManager->listCertificates()); |
|
93 | + $table->setRows($rows); |
|
94 | + $table->render(); |
|
95 | + } |
|
96 | + } |
|
97 | 97 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | protected function execute(InputInterface $input, OutputInterface $output) { |
56 | 56 | $outputType = $input->getOption('output'); |
57 | 57 | if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) { |
58 | - $certificates = array_map(function (ICertificate $certificate) { |
|
58 | + $certificates = array_map(function(ICertificate $certificate) { |
|
59 | 59 | return [ |
60 | 60 | 'name' => $certificate->getName(), |
61 | 61 | 'common_name' => $certificate->getCommonName(), |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 'Issued By' |
82 | 82 | ]); |
83 | 83 | |
84 | - $rows = array_map(function (ICertificate $certificate) { |
|
84 | + $rows = array_map(function(ICertificate $certificate) { |
|
85 | 85 | return [ |
86 | 86 | $certificate->getName(), |
87 | 87 | $certificate->getCommonName(), |
@@ -33,36 +33,36 @@ |
||
33 | 33 | |
34 | 34 | class ImportCertificate extends Base { |
35 | 35 | |
36 | - /** @var ICertificateManager */ |
|
37 | - protected $certificateManager; |
|
36 | + /** @var ICertificateManager */ |
|
37 | + protected $certificateManager; |
|
38 | 38 | |
39 | - public function __construct(ICertificateManager $certificateManager) { |
|
40 | - $this->certificateManager = $certificateManager; |
|
41 | - parent::__construct(); |
|
42 | - } |
|
39 | + public function __construct(ICertificateManager $certificateManager) { |
|
40 | + $this->certificateManager = $certificateManager; |
|
41 | + parent::__construct(); |
|
42 | + } |
|
43 | 43 | |
44 | - protected function configure() { |
|
45 | - $this |
|
46 | - ->setName('security:certificates:import') |
|
47 | - ->setDescription('import trusted certificate') |
|
48 | - ->addArgument( |
|
49 | - 'path', |
|
50 | - InputArgument::REQUIRED, |
|
51 | - 'path to the certificate to import' |
|
52 | - ); |
|
53 | - } |
|
44 | + protected function configure() { |
|
45 | + $this |
|
46 | + ->setName('security:certificates:import') |
|
47 | + ->setDescription('import trusted certificate') |
|
48 | + ->addArgument( |
|
49 | + 'path', |
|
50 | + InputArgument::REQUIRED, |
|
51 | + 'path to the certificate to import' |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | |
55 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
56 | - $path = $input->getArgument('path'); |
|
55 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
56 | + $path = $input->getArgument('path'); |
|
57 | 57 | |
58 | - if (!file_exists($path)) { |
|
59 | - $output->writeln('<error>certificate not found</error>'); |
|
60 | - return; |
|
61 | - } |
|
58 | + if (!file_exists($path)) { |
|
59 | + $output->writeln('<error>certificate not found</error>'); |
|
60 | + return; |
|
61 | + } |
|
62 | 62 | |
63 | - $certData = file_get_contents($path); |
|
64 | - $name = basename($path); |
|
63 | + $certData = file_get_contents($path); |
|
64 | + $name = basename($path); |
|
65 | 65 | |
66 | - $this->certificateManager->addCertificate($certData, $name); |
|
67 | - } |
|
66 | + $this->certificateManager->addCertificate($certData, $name); |
|
67 | + } |
|
68 | 68 | } |
@@ -37,69 +37,69 @@ |
||
37 | 37 | * @package OC\Core\Command\Integrity |
38 | 38 | */ |
39 | 39 | class SignCore extends Command { |
40 | - /** @var Checker */ |
|
41 | - private $checker; |
|
42 | - /** @var FileAccessHelper */ |
|
43 | - private $fileAccessHelper; |
|
40 | + /** @var Checker */ |
|
41 | + private $checker; |
|
42 | + /** @var FileAccessHelper */ |
|
43 | + private $fileAccessHelper; |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param Checker $checker |
|
47 | - * @param FileAccessHelper $fileAccessHelper |
|
48 | - */ |
|
49 | - public function __construct(Checker $checker, |
|
50 | - FileAccessHelper $fileAccessHelper) { |
|
51 | - parent::__construct(null); |
|
52 | - $this->checker = $checker; |
|
53 | - $this->fileAccessHelper = $fileAccessHelper; |
|
54 | - } |
|
45 | + /** |
|
46 | + * @param Checker $checker |
|
47 | + * @param FileAccessHelper $fileAccessHelper |
|
48 | + */ |
|
49 | + public function __construct(Checker $checker, |
|
50 | + FileAccessHelper $fileAccessHelper) { |
|
51 | + parent::__construct(null); |
|
52 | + $this->checker = $checker; |
|
53 | + $this->fileAccessHelper = $fileAccessHelper; |
|
54 | + } |
|
55 | 55 | |
56 | - protected function configure() { |
|
57 | - $this |
|
58 | - ->setName('integrity:sign-core') |
|
59 | - ->setDescription('Sign core using a private key.') |
|
60 | - ->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing') |
|
61 | - ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing') |
|
62 | - ->addOption('path', null, InputOption::VALUE_REQUIRED, 'Path of core to sign'); |
|
63 | - } |
|
56 | + protected function configure() { |
|
57 | + $this |
|
58 | + ->setName('integrity:sign-core') |
|
59 | + ->setDescription('Sign core using a private key.') |
|
60 | + ->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing') |
|
61 | + ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing') |
|
62 | + ->addOption('path', null, InputOption::VALUE_REQUIRED, 'Path of core to sign'); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * {@inheritdoc } |
|
67 | - */ |
|
68 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
69 | - $privateKeyPath = $input->getOption('privateKey'); |
|
70 | - $keyBundlePath = $input->getOption('certificate'); |
|
71 | - $path = $input->getOption('path'); |
|
72 | - if(is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) { |
|
73 | - $output->writeln('--privateKey, --certificate and --path are required.'); |
|
74 | - return null; |
|
75 | - } |
|
65 | + /** |
|
66 | + * {@inheritdoc } |
|
67 | + */ |
|
68 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
69 | + $privateKeyPath = $input->getOption('privateKey'); |
|
70 | + $keyBundlePath = $input->getOption('certificate'); |
|
71 | + $path = $input->getOption('path'); |
|
72 | + if(is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) { |
|
73 | + $output->writeln('--privateKey, --certificate and --path are required.'); |
|
74 | + return null; |
|
75 | + } |
|
76 | 76 | |
77 | - $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
|
78 | - $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
|
77 | + $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
|
78 | + $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
|
79 | 79 | |
80 | - if($privateKey === false) { |
|
81 | - $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
|
82 | - return null; |
|
83 | - } |
|
80 | + if($privateKey === false) { |
|
81 | + $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
|
82 | + return null; |
|
83 | + } |
|
84 | 84 | |
85 | - if($keyBundle === false) { |
|
86 | - $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
|
87 | - return null; |
|
88 | - } |
|
85 | + if($keyBundle === false) { |
|
86 | + $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
|
87 | + return null; |
|
88 | + } |
|
89 | 89 | |
90 | - $rsa = new RSA(); |
|
91 | - $rsa->loadKey($privateKey); |
|
92 | - $x509 = new X509(); |
|
93 | - $x509->loadX509($keyBundle); |
|
94 | - $x509->setPrivateKey($rsa); |
|
90 | + $rsa = new RSA(); |
|
91 | + $rsa->loadKey($privateKey); |
|
92 | + $x509 = new X509(); |
|
93 | + $x509->loadX509($keyBundle); |
|
94 | + $x509->setPrivateKey($rsa); |
|
95 | 95 | |
96 | - try { |
|
97 | - $this->checker->writeCoreSignature($x509, $rsa, $path); |
|
98 | - $output->writeln('Successfully signed "core"'); |
|
99 | - } catch (\Exception $e){ |
|
100 | - $output->writeln('Error: ' . $e->getMessage()); |
|
101 | - return 1; |
|
102 | - } |
|
103 | - return 0; |
|
104 | - } |
|
96 | + try { |
|
97 | + $this->checker->writeCoreSignature($x509, $rsa, $path); |
|
98 | + $output->writeln('Successfully signed "core"'); |
|
99 | + } catch (\Exception $e){ |
|
100 | + $output->writeln('Error: ' . $e->getMessage()); |
|
101 | + return 1; |
|
102 | + } |
|
103 | + return 0; |
|
104 | + } |
|
105 | 105 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $privateKeyPath = $input->getOption('privateKey'); |
70 | 70 | $keyBundlePath = $input->getOption('certificate'); |
71 | 71 | $path = $input->getOption('path'); |
72 | - if(is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) { |
|
72 | + if (is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) { |
|
73 | 73 | $output->writeln('--privateKey, --certificate and --path are required.'); |
74 | 74 | return null; |
75 | 75 | } |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
78 | 78 | $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
79 | 79 | |
80 | - if($privateKey === false) { |
|
80 | + if ($privateKey === false) { |
|
81 | 81 | $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
82 | 82 | return null; |
83 | 83 | } |
84 | 84 | |
85 | - if($keyBundle === false) { |
|
85 | + if ($keyBundle === false) { |
|
86 | 86 | $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
87 | 87 | return null; |
88 | 88 | } |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | try { |
97 | 97 | $this->checker->writeCoreSignature($x509, $rsa, $path); |
98 | 98 | $output->writeln('Successfully signed "core"'); |
99 | - } catch (\Exception $e){ |
|
100 | - $output->writeln('Error: ' . $e->getMessage()); |
|
99 | + } catch (\Exception $e) { |
|
100 | + $output->writeln('Error: '.$e->getMessage()); |
|
101 | 101 | return 1; |
102 | 102 | } |
103 | 103 | return 0; |
@@ -38,76 +38,76 @@ |
||
38 | 38 | * @package OC\Core\Command\Integrity |
39 | 39 | */ |
40 | 40 | class SignApp extends Command { |
41 | - /** @var Checker */ |
|
42 | - private $checker; |
|
43 | - /** @var FileAccessHelper */ |
|
44 | - private $fileAccessHelper; |
|
45 | - /** @var IURLGenerator */ |
|
46 | - private $urlGenerator; |
|
41 | + /** @var Checker */ |
|
42 | + private $checker; |
|
43 | + /** @var FileAccessHelper */ |
|
44 | + private $fileAccessHelper; |
|
45 | + /** @var IURLGenerator */ |
|
46 | + private $urlGenerator; |
|
47 | 47 | |
48 | - /** |
|
49 | - * @param Checker $checker |
|
50 | - * @param FileAccessHelper $fileAccessHelper |
|
51 | - * @param IURLGenerator $urlGenerator |
|
52 | - */ |
|
53 | - public function __construct(Checker $checker, |
|
54 | - FileAccessHelper $fileAccessHelper, |
|
55 | - IURLGenerator $urlGenerator) { |
|
56 | - parent::__construct(null); |
|
57 | - $this->checker = $checker; |
|
58 | - $this->fileAccessHelper = $fileAccessHelper; |
|
59 | - $this->urlGenerator = $urlGenerator; |
|
60 | - } |
|
48 | + /** |
|
49 | + * @param Checker $checker |
|
50 | + * @param FileAccessHelper $fileAccessHelper |
|
51 | + * @param IURLGenerator $urlGenerator |
|
52 | + */ |
|
53 | + public function __construct(Checker $checker, |
|
54 | + FileAccessHelper $fileAccessHelper, |
|
55 | + IURLGenerator $urlGenerator) { |
|
56 | + parent::__construct(null); |
|
57 | + $this->checker = $checker; |
|
58 | + $this->fileAccessHelper = $fileAccessHelper; |
|
59 | + $this->urlGenerator = $urlGenerator; |
|
60 | + } |
|
61 | 61 | |
62 | - protected function configure() { |
|
63 | - $this |
|
64 | - ->setName('integrity:sign-app') |
|
65 | - ->setDescription('Signs an app using a private key.') |
|
66 | - ->addOption('path', null, InputOption::VALUE_REQUIRED, 'Application to sign') |
|
67 | - ->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing') |
|
68 | - ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing'); |
|
69 | - } |
|
62 | + protected function configure() { |
|
63 | + $this |
|
64 | + ->setName('integrity:sign-app') |
|
65 | + ->setDescription('Signs an app using a private key.') |
|
66 | + ->addOption('path', null, InputOption::VALUE_REQUIRED, 'Application to sign') |
|
67 | + ->addOption('privateKey', null, InputOption::VALUE_REQUIRED, 'Path to private key to use for signing') |
|
68 | + ->addOption('certificate', null, InputOption::VALUE_REQUIRED, 'Path to certificate to use for signing'); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * {@inheritdoc } |
|
73 | - */ |
|
74 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
75 | - $path = $input->getOption('path'); |
|
76 | - $privateKeyPath = $input->getOption('privateKey'); |
|
77 | - $keyBundlePath = $input->getOption('certificate'); |
|
78 | - if(is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) { |
|
79 | - $documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity'); |
|
80 | - $output->writeln('This command requires the --path, --privateKey and --certificate.'); |
|
81 | - $output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"'); |
|
82 | - $output->writeln('For more information please consult the documentation: '. $documentationUrl); |
|
83 | - return null; |
|
84 | - } |
|
71 | + /** |
|
72 | + * {@inheritdoc } |
|
73 | + */ |
|
74 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
75 | + $path = $input->getOption('path'); |
|
76 | + $privateKeyPath = $input->getOption('privateKey'); |
|
77 | + $keyBundlePath = $input->getOption('certificate'); |
|
78 | + if(is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) { |
|
79 | + $documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity'); |
|
80 | + $output->writeln('This command requires the --path, --privateKey and --certificate.'); |
|
81 | + $output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"'); |
|
82 | + $output->writeln('For more information please consult the documentation: '. $documentationUrl); |
|
83 | + return null; |
|
84 | + } |
|
85 | 85 | |
86 | - $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
|
87 | - $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
|
86 | + $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
|
87 | + $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
|
88 | 88 | |
89 | - if($privateKey === false) { |
|
90 | - $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
|
91 | - return null; |
|
92 | - } |
|
89 | + if($privateKey === false) { |
|
90 | + $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
|
91 | + return null; |
|
92 | + } |
|
93 | 93 | |
94 | - if($keyBundle === false) { |
|
95 | - $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
|
96 | - return null; |
|
97 | - } |
|
94 | + if($keyBundle === false) { |
|
95 | + $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
|
96 | + return null; |
|
97 | + } |
|
98 | 98 | |
99 | - $rsa = new RSA(); |
|
100 | - $rsa->loadKey($privateKey); |
|
101 | - $x509 = new X509(); |
|
102 | - $x509->loadX509($keyBundle); |
|
103 | - $x509->setPrivateKey($rsa); |
|
104 | - try { |
|
105 | - $this->checker->writeAppSignature($path, $x509, $rsa); |
|
106 | - $output->writeln('Successfully signed "'.$path.'"'); |
|
107 | - } catch (\Exception $e){ |
|
108 | - $output->writeln('Error: ' . $e->getMessage()); |
|
109 | - return 1; |
|
110 | - } |
|
111 | - return 0; |
|
112 | - } |
|
99 | + $rsa = new RSA(); |
|
100 | + $rsa->loadKey($privateKey); |
|
101 | + $x509 = new X509(); |
|
102 | + $x509->loadX509($keyBundle); |
|
103 | + $x509->setPrivateKey($rsa); |
|
104 | + try { |
|
105 | + $this->checker->writeAppSignature($path, $x509, $rsa); |
|
106 | + $output->writeln('Successfully signed "'.$path.'"'); |
|
107 | + } catch (\Exception $e){ |
|
108 | + $output->writeln('Error: ' . $e->getMessage()); |
|
109 | + return 1; |
|
110 | + } |
|
111 | + return 0; |
|
112 | + } |
|
113 | 113 | } |
@@ -75,23 +75,23 @@ discard block |
||
75 | 75 | $path = $input->getOption('path'); |
76 | 76 | $privateKeyPath = $input->getOption('privateKey'); |
77 | 77 | $keyBundlePath = $input->getOption('certificate'); |
78 | - if(is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) { |
|
78 | + if (is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) { |
|
79 | 79 | $documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity'); |
80 | 80 | $output->writeln('This command requires the --path, --privateKey and --certificate.'); |
81 | 81 | $output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"'); |
82 | - $output->writeln('For more information please consult the documentation: '. $documentationUrl); |
|
82 | + $output->writeln('For more information please consult the documentation: '.$documentationUrl); |
|
83 | 83 | return null; |
84 | 84 | } |
85 | 85 | |
86 | 86 | $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); |
87 | 87 | $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); |
88 | 88 | |
89 | - if($privateKey === false) { |
|
89 | + if ($privateKey === false) { |
|
90 | 90 | $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); |
91 | 91 | return null; |
92 | 92 | } |
93 | 93 | |
94 | - if($keyBundle === false) { |
|
94 | + if ($keyBundle === false) { |
|
95 | 95 | $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); |
96 | 96 | return null; |
97 | 97 | } |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | try { |
105 | 105 | $this->checker->writeAppSignature($path, $x509, $rsa); |
106 | 106 | $output->writeln('Successfully signed "'.$path.'"'); |
107 | - } catch (\Exception $e){ |
|
108 | - $output->writeln('Error: ' . $e->getMessage()); |
|
107 | + } catch (\Exception $e) { |
|
108 | + $output->writeln('Error: '.$e->getMessage()); |
|
109 | 109 | return 1; |
110 | 110 | } |
111 | 111 | return 0; |
@@ -34,34 +34,34 @@ |
||
34 | 34 | * @package OC\Core\Command\Integrity |
35 | 35 | */ |
36 | 36 | class CheckCore extends Base { |
37 | - /** |
|
38 | - * @var Checker |
|
39 | - */ |
|
40 | - private $checker; |
|
37 | + /** |
|
38 | + * @var Checker |
|
39 | + */ |
|
40 | + private $checker; |
|
41 | 41 | |
42 | - public function __construct(Checker $checker) { |
|
43 | - parent::__construct(); |
|
44 | - $this->checker = $checker; |
|
45 | - } |
|
42 | + public function __construct(Checker $checker) { |
|
43 | + parent::__construct(); |
|
44 | + $this->checker = $checker; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * {@inheritdoc } |
|
49 | - */ |
|
50 | - protected function configure() { |
|
51 | - parent::configure(); |
|
52 | - $this |
|
53 | - ->setName('integrity:check-core') |
|
54 | - ->setDescription('Check integrity of core code using a signature.'); |
|
55 | - } |
|
47 | + /** |
|
48 | + * {@inheritdoc } |
|
49 | + */ |
|
50 | + protected function configure() { |
|
51 | + parent::configure(); |
|
52 | + $this |
|
53 | + ->setName('integrity:check-core') |
|
54 | + ->setDescription('Check integrity of core code using a signature.'); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritdoc } |
|
59 | - */ |
|
60 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
61 | - $result = $this->checker->verifyCoreSignature(); |
|
62 | - $this->writeArrayInOutputFormat($input, $output, $result); |
|
63 | - if (count($result)>0){ |
|
64 | - return 1; |
|
65 | - } |
|
66 | - } |
|
57 | + /** |
|
58 | + * {@inheritdoc } |
|
59 | + */ |
|
60 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
61 | + $result = $this->checker->verifyCoreSignature(); |
|
62 | + $this->writeArrayInOutputFormat($input, $output, $result); |
|
63 | + if (count($result)>0){ |
|
64 | + return 1; |
|
65 | + } |
|
66 | + } |
|
67 | 67 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | protected function execute(InputInterface $input, OutputInterface $output) { |
61 | 61 | $result = $this->checker->verifyCoreSignature(); |
62 | 62 | $this->writeArrayInOutputFormat($input, $output, $result); |
63 | - if (count($result)>0){ |
|
63 | + if (count($result) > 0) { |
|
64 | 64 | return 1; |
65 | 65 | } |
66 | 66 | } |