@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $tokenExpiry = date('Y-m-d H:i:s', strtotime($date)); |
103 | 103 | if($tokenExpiry > $this->defaultUserExpiry){ |
104 | 104 | $this->set(self::EXPIRY, $tokenExpiry); |
105 | - }else{ |
|
105 | + } else{ |
|
106 | 106 | $this->clear(); |
107 | 107 | } |
108 | 108 | } |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | $days = $this->getAcknowledgeDays(); |
125 | 125 | if($days <= $max * 0.2 && $days > $max * 0.1){ |
126 | 126 | return self::LEVEL_YELLOW; |
127 | - }elseif ($days <= $max * 0.1){ |
|
127 | + } elseif ($days <= $max * 0.1){ |
|
128 | 128 | return self::LEVEL_RED; |
129 | - }else{ |
|
129 | + } else{ |
|
130 | 130 | return self::LEVEL_GREEN; |
131 | 131 | } |
132 | 132 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | foreach ($this->certificates as $certificate) { |
213 | 213 | $certificate->revoke($profile); |
214 | 214 | } |
215 | - }else{ |
|
215 | + } else{ |
|
216 | 216 | $this->set(self::DEACTIVATION_TIME, '0000-00-00 00:00:00'); |
217 | 217 | } |
218 | 218 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @author Zilvinas Vaira |
7 | 7 | * |
8 | 8 | */ |
9 | -class SilverbulletUser extends PersistentEntity{ |
|
9 | +class SilverbulletUser extends PersistentEntity { |
|
10 | 10 | |
11 | 11 | const LEVEL_GREEN = 0; |
12 | 12 | const LEVEL_YELLOW = 1; |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | * @param int $profileId |
90 | 90 | * @param string $username |
91 | 91 | */ |
92 | - public function __construct($profileId, $username){ |
|
92 | + public function __construct($profileId, $username) { |
|
93 | 93 | parent::__construct(self::TABLE, self::TYPE_INST); |
94 | 94 | $this->setAttributeType(self::PROFILEID, Attribute::TYPE_INTEGER); |
95 | 95 | |
96 | 96 | $this->set(self::PROFILEID, $profileId); |
97 | 97 | $this->set(self::USERNAME, $username); |
98 | 98 | //$this->set(self::EXPIRY, 'NOW() + INTERVAL 1 WEEK'); |
99 | - $this->defaultUserExpiry = date('Y-m-d H:i:s',strtotime("today")); |
|
99 | + $this->defaultUserExpiry = date('Y-m-d H:i:s', strtotime("today")); |
|
100 | 100 | //$this->set(self::EXPIRY, $this->defaultUserExpiry); |
101 | 101 | } |
102 | 102 | |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @param string $date Takes any string value that can passed to strtotime() function. |
107 | 107 | */ |
108 | - public function setExpiry($date){ |
|
108 | + public function setExpiry($date) { |
|
109 | 109 | $tokenExpiry = date('Y-m-d H:i:s', strtotime($date)); |
110 | - if($tokenExpiry > $this->defaultUserExpiry){ |
|
110 | + if ($tokenExpiry > $this->defaultUserExpiry) { |
|
111 | 111 | $this->set(self::EXPIRY, $tokenExpiry); |
112 | - }else{ |
|
112 | + } else { |
|
113 | 113 | $this->clear(); |
114 | 114 | } |
115 | 115 | } |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | /** |
118 | 118 | * |
119 | 119 | */ |
120 | - public function makeAcknowledged(){ |
|
121 | - $this->set(self::LAST_ACKNOWLEDGE, date('Y-m-d H:i:s',strtotime("now"))); |
|
120 | + public function makeAcknowledged() { |
|
121 | + $this->set(self::LAST_ACKNOWLEDGE, date('Y-m-d H:i:s', strtotime("now"))); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return int One of the following constants LEVEL_GREEN, LEVEL_YELLOW, LEVEL_RED. |
128 | 128 | */ |
129 | - public function getAcknowledgeLevel(){ |
|
129 | + public function getAcknowledgeLevel() { |
|
130 | 130 | $max = CONFIG_CONFASSISTANT['SILVERBULLET']['gracetime'] ?? SilverbulletUser::MAX_ACKNOWLEDGE; |
131 | 131 | $days = $this->getAcknowledgeDays(); |
132 | - if($days <= $max * 0.2 && $days > $max * 0.1){ |
|
132 | + if ($days <= $max * 0.2 && $days > $max * 0.1) { |
|
133 | 133 | return self::LEVEL_YELLOW; |
134 | - }elseif ($days <= $max * 0.1){ |
|
134 | + }elseif ($days <= $max * 0.1) { |
|
135 | 135 | return self::LEVEL_RED; |
136 | - }else{ |
|
136 | + } else { |
|
137 | 137 | return self::LEVEL_GREEN; |
138 | 138 | } |
139 | 139 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @return number Number of days from 0 to maximum period. |
145 | 145 | */ |
146 | - public function getAcknowledgeDays(){ |
|
146 | + public function getAcknowledgeDays() { |
|
147 | 147 | $max = CONFIG_CONFASSISTANT['SILVERBULLET']['gracetime'] ?? SilverbulletUser::MAX_ACKNOWLEDGE; |
148 | 148 | $lastAcknowledge = strtotime($this->get(self::LAST_ACKNOWLEDGE)); |
149 | 149 | $now = strtotime('now'); |
@@ -151,11 +151,11 @@ discard block |
||
151 | 151 | return $days > 0 ? $days : 0; |
152 | 152 | } |
153 | 153 | |
154 | - public function getProfileId(){ |
|
154 | + public function getProfileId() { |
|
155 | 155 | return $this->get(self::PROFILEID); |
156 | 156 | } |
157 | 157 | |
158 | - public function getUsername(){ |
|
158 | + public function getUsername() { |
|
159 | 159 | return $this->get(self::USERNAME); |
160 | 160 | } |
161 | 161 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return boolean |
165 | 165 | */ |
166 | - public function isExpired(){ |
|
166 | + public function isExpired() { |
|
167 | 167 | $expiryTime = strtotime($this->get(self::EXPIRY)); |
168 | 168 | $currentTime = time(); |
169 | 169 | return $currentTime > $expiryTime; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - public function getExpiry(){ |
|
176 | + public function getExpiry() { |
|
177 | 177 | return date('Y-m-d', strtotime($this->get(self::EXPIRY))); |
178 | 178 | } |
179 | 179 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @return \web\lib\admin\domain\SilverbulletCertificate |
183 | 183 | */ |
184 | - public function getCertificates(){ |
|
184 | + public function getCertificates() { |
|
185 | 185 | return $this->certificates; |
186 | 186 | } |
187 | 187 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @return \web\lib\admin\domain\SilverbulletInvitation |
191 | 191 | */ |
192 | - public function getInvitations(){ |
|
192 | + public function getInvitations() { |
|
193 | 193 | return $this->invitations; |
194 | 194 | } |
195 | 195 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @return boolean |
199 | 199 | */ |
200 | - public function hasCertificates(){ |
|
200 | + public function hasCertificates() { |
|
201 | 201 | return count($this->certificates) > 0; |
202 | 202 | } |
203 | 203 | |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return boolean |
207 | 207 | */ |
208 | - public function hasActiveCertificates(){ |
|
208 | + public function hasActiveCertificates() { |
|
209 | 209 | $count = 0; |
210 | 210 | foreach ($this->certificates as $certificate) { |
211 | - if(!$certificate->isExpired() && !$certificate->isRevoked()){ |
|
211 | + if (!$certificate->isExpired() && !$certificate->isRevoked()) { |
|
212 | 212 | $count++; |
213 | 213 | } |
214 | 214 | } |
@@ -220,14 +220,14 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @param boolean $isDeactivated |
222 | 222 | */ |
223 | - public function setDeactivated($isDeactivated, $profile){ |
|
223 | + public function setDeactivated($isDeactivated, $profile) { |
|
224 | 224 | $this->set(self::DEACTIVATION_STATUS, $isDeactivated ? self::INACTIVE : self::ACTIVE); |
225 | - if($isDeactivated){ |
|
225 | + if ($isDeactivated) { |
|
226 | 226 | $this->set(self::DEACTIVATION_TIME, date('Y-m-d H:i:s', strtotime("now"))); |
227 | 227 | foreach ($this->certificates as $certificate) { |
228 | 228 | $certificate->revoke($profile); |
229 | 229 | } |
230 | - }else{ |
|
230 | + } else { |
|
231 | 231 | $this->set(self::DEACTIVATION_TIME, '0000-00-00 00:00:00'); |
232 | 232 | } |
233 | 233 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return boolean |
238 | 238 | */ |
239 | - public function isDeactivated(){ |
|
239 | + public function isDeactivated() { |
|
240 | 240 | return $this->get(self::DEACTIVATION_STATUS) == self::INACTIVE; |
241 | 241 | } |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * {@inheritDoc} |
246 | 246 | * @see \web\lib\admin\domain\PersistentInterface::load() |
247 | 247 | */ |
248 | - public function load($searchAttribute = null){ |
|
248 | + public function load($searchAttribute = null) { |
|
249 | 249 | $state = parent::load(); |
250 | 250 | $this->certificates = SilverbulletCertificate::getList($this, $searchAttribute); |
251 | 251 | $this->invitations = SilverbulletInvitation::getList($this); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * {@inheritDoc} |
258 | 258 | * @see \web\lib\admin\domain\PersistentInterface::delete() |
259 | 259 | */ |
260 | - public function delete(){ |
|
260 | + public function delete() { |
|
261 | 261 | $state = parent::delete(); |
262 | 262 | foreach ($this->certificates as $certificate) { |
263 | 263 | $certificate->delete(); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @param integer $userId |
274 | 274 | * @return \web\lib\admin\domain\SilverbulletUser |
275 | 275 | */ |
276 | - public static function prepare($userId){ |
|
276 | + public static function prepare($userId) { |
|
277 | 277 | $instance = new SilverbulletUser(null, ''); |
278 | 278 | $instance->set(self::ID, $userId); |
279 | 279 | return $instance; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | } |
123 | 123 | break; |
124 | 124 | case "boolean": |
125 | - $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off") ) . "</strong></td></tr>"; |
|
125 | + $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off")) . "</strong></td></tr>"; |
|
126 | 126 | break; |
127 | 127 | default: |
128 | 128 | $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>$content</strong></td></tr>"; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | $details['name'] = preg_replace('/(.)\/(.)/', "$1<br/>$2", $details['name']); |
193 | 193 | $details['name'] = preg_replace('/\//', "", $details['name']); |
194 | - $certstatus = ( $details['root'] == 1 ? "R" : "I"); |
|
194 | + $certstatus = ($details['root'] == 1 ? "R" : "I"); |
|
195 | 195 | if ($details['ca'] == 0 && $details['root'] != 1) { |
196 | 196 | return "<div class='ca-summary' style='background-color:red'><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:maroon; border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>S</div></div>" . _("This is a <strong>SERVER</strong> certificate!") . "<br/>" . $details['name'] . "</div>"; |
197 | 197 | } |
@@ -120,6 +120,9 @@ discard block |
||
120 | 120 | return $find[0]; |
121 | 121 | } |
122 | 122 | |
123 | + /** |
|
124 | + * @param string $input |
|
125 | + */ |
|
123 | 126 | public function tooltip($input) { |
124 | 127 | $descriptions = []; |
125 | 128 | if (count(CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']) > 0) { |
@@ -256,6 +259,10 @@ discard block |
||
256 | 259 | return $number . " B"; |
257 | 260 | } |
258 | 261 | |
262 | + /** |
|
263 | + * @param string $ref |
|
264 | + * @param boolean $checkpublic |
|
265 | + */ |
|
259 | 266 | public static function getBlobFromDB($ref, $checkpublic) { |
260 | 267 | $validator = new \web\lib\common\InputValidation(); |
261 | 268 | $reference = $validator->databaseReference($ref); |
@@ -402,7 +409,7 @@ discard block |
||
402 | 409 | * @param string $text the text to display |
403 | 410 | * @param string $caption the caption to display |
404 | 411 | * @param bool $omittabletags the output usually has tr/td table tags, this option suppresses them |
405 | - * @return type |
|
412 | + * @return string |
|
406 | 413 | */ |
407 | 414 | public function boxOkay(string $text = NULL, string $caption = NULL, bool $omittabletags = FALSE) { |
408 | 415 | return $this->boxFlexible(\core\common\Entity::L_OK, $text, $caption, $omittabletags); |
@@ -414,7 +421,7 @@ discard block |
||
414 | 421 | * @param string $text the text to display |
415 | 422 | * @param string $caption the caption to display |
416 | 423 | * @param bool $omittabletags the output usually has tr/td table tags, this option suppresses them |
417 | - * @return type |
|
424 | + * @return string |
|
418 | 425 | */ |
419 | 426 | public function boxRemark(string $text = NULL, string $caption = NULL, bool $omittabletags = FALSE) { |
420 | 427 | return $this->boxFlexible(\core\common\Entity::L_REMARK, $text, $caption, $omittabletags); |
@@ -426,7 +433,7 @@ discard block |
||
426 | 433 | * @param string $text the text to display |
427 | 434 | * @param string $caption the caption to display |
428 | 435 | * @param bool $omittabletags the output usually has tr/td table tags, this option suppresses them |
429 | - * @return type |
|
436 | + * @return string |
|
430 | 437 | */ |
431 | 438 | public function boxWarning(string $text = NULL, string $caption = NULL, bool $omittabletags = FALSE) { |
432 | 439 | return $this->boxFlexible(\core\common\Entity::L_WARN, $text, $caption, $omittabletags); |
@@ -438,7 +445,7 @@ discard block |
||
438 | 445 | * @param string $text the text to display |
439 | 446 | * @param string $caption the caption to display |
440 | 447 | * @param bool $omittabletags the output usually has tr/td table tags, this option suppresses them |
441 | - * @return type |
|
448 | + * @return string |
|
442 | 449 | */ |
443 | 450 | public function boxError(string $text = NULL, string $caption = NULL, bool $omittabletags = FALSE) { |
444 | 451 | return $this->boxFlexible(\core\common\Entity::L_ERROR, $text, $caption, $omittabletags); |
@@ -97,14 +97,14 @@ |
||
97 | 97 | case "SUCCESS": |
98 | 98 | $cryptText = ""; |
99 | 99 | switch ($_GET['transportsecurity']) { |
100 | - case "ENCRYPTED": |
|
101 | - $cryptText = _("and <b>encrypted</b> to the mail domain"); |
|
102 | - break; |
|
103 | - case "CLEAR": |
|
104 | - $cryptText = _("but <b>in clear text</b> to the mail domain"); |
|
105 | - break; |
|
106 | - default: |
|
107 | - throw new Exception("Error: unknown encryption status of invitation!?!"); |
|
100 | + case "ENCRYPTED": |
|
101 | + $cryptText = _("and <b>encrypted</b> to the mail domain"); |
|
102 | + break; |
|
103 | + case "CLEAR": |
|
104 | + $cryptText = _("but <b>in clear text</b> to the mail domain"); |
|
105 | + break; |
|
106 | + default: |
|
107 | + throw new Exception("Error: unknown encryption status of invitation!?!"); |
|
108 | 108 | } |
109 | 109 | echo $uiElements->boxRemark(sprintf(_("The invitation email was sent successfully %s."), $cryptText), _("The invitation email was sent.")); |
110 | 110 | break; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $ownermgmt = new \core\UserManagement(); |
80 | 80 | $ownermgmt->addAdminToIdp($my_inst, $_SESSION['user']); |
81 | 81 | } else { |
82 | - echo "Fatal Error: you wanted to take control over an ".CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_institution'].", but are not a ".CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_federation']." operator!"; |
|
82 | + echo "Fatal Error: you wanted to take control over an " . CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_institution'] . ", but are not a " . CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_federation'] . " operator!"; |
|
83 | 83 | exit(1); |
84 | 84 | } |
85 | 85 | } |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | |
123 | 123 | if ($isFedAdmin) { |
124 | 124 | echo "<div class='ca-summary' style='position:relative;'><table>"; |
125 | - echo $uiElements->boxRemark(sprintf(_("You are the %s administrator of this %s. You can invite new administrators, who can in turn appoint further administrators on their own."),$uiElements->nomenclature_fed, $uiElements->nomenclature_inst), sprintf(_("%s Administrator"),$uiElements->nomenclature_fed)); |
|
125 | + echo $uiElements->boxRemark(sprintf(_("You are the %s administrator of this %s. You can invite new administrators, who can in turn appoint further administrators on their own."), $uiElements->nomenclature_fed, $uiElements->nomenclature_inst), sprintf(_("%s Administrator"), $uiElements->nomenclature_fed)); |
|
126 | 126 | echo "</table></div>"; |
127 | 127 | } |
128 | 128 | |
129 | 129 | if (!$isFedAdmin && $is_admin_with_blessing) { |
130 | 130 | echo "<div class='ca-summary' style='position:relative;'><table>"; |
131 | - echo $uiElements->boxRemark(sprintf(_("You are an administrator of this %s, and were directly appointed by the %s administrator. You can appoint further administrators, but these can't in turn appoint any more administrators."),$uiElements->nomenclature_inst ,$uiElements->nomenclature_fed), _("Directly Appointed IdP Administrator")); |
|
131 | + echo $uiElements->boxRemark(sprintf(_("You are an administrator of this %s, and were directly appointed by the %s administrator. You can appoint further administrators, but these can't in turn appoint any more administrators."), $uiElements->nomenclature_inst, $uiElements->nomenclature_fed), _("Directly Appointed IdP Administrator")); |
|
132 | 132 | echo "</table></div>"; |
133 | 133 | } |
134 | 134 | ?> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | echo "</td> |
158 | 158 | <td> |
159 | - <form action='inc/manageAdmins.inc.php?inst_id=" . $my_inst->identifier . "' method='post' " . ( $oneowner['ID'] != $_SESSION['user'] ? "onsubmit='popupRedirectWindow(this); return false;'" : "" ) . " accept-charset='UTF-8'> |
|
159 | + <form action='inc/manageAdmins.inc.php?inst_id=" . $my_inst->identifier . "' method='post' " . ($oneowner['ID'] != $_SESSION['user'] ? "onsubmit='popupRedirectWindow(this); return false;'" : "") . " accept-charset='UTF-8'> |
|
160 | 160 | <input type='hidden' name='admin_id' value='" . $oneowner['ID'] . "'></input> |
161 | 161 | <button type='submit' name='submitbutton' class='delete' value='" . web\lib\admin\FormElements::BUTTON_DELETE . "'>" . _("Delete Administrator") . "</button> |
162 | 162 | </form> |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @author Zilvinas Vaira |
7 | 7 | * |
8 | 8 | */ |
9 | -interface TabbedElementInterface extends PageElementInterface{ |
|
9 | +interface TabbedElementInterface extends PageElementInterface { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @return boolean |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @author Zilvinas Vaira |
11 | 11 | * |
12 | 12 | */ |
13 | -class TabbedPanelsBox implements PageElementInterface{ |
|
13 | +class TabbedPanelsBox implements PageElementInterface { |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * @param integer $index |
42 | 42 | * @return string |
43 | 43 | */ |
44 | - private function composeTabId($index){ |
|
45 | - return PageElementInterface::TABS_CLASS.'-'.($index+1); |
|
44 | + private function composeTabId($index) { |
|
45 | + return PageElementInterface::TABS_CLASS . '-' . ($index + 1); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | * @param string $title |
51 | 51 | * @param TabbedElementInterface $element |
52 | 52 | */ |
53 | - public function addTabbedPanel($title, $element){ |
|
53 | + public function addTabbedPanel($title, $element) { |
|
54 | 54 | $li = new CompositeTag('li'); |
55 | 55 | $a = new Tag('a'); |
56 | - $a->addAttribute('href', '#'.$this->composeTabId($this->index)); |
|
56 | + $a->addAttribute('href', '#' . $this->composeTabId($this->index)); |
|
57 | 57 | $a->addText($title); |
58 | 58 | $li->addTag($a); |
59 | 59 | $this->titles [$this->index] = $li; |
60 | 60 | $this->elements [$this->index] = $element; |
61 | - if($element->isActive()){ |
|
61 | + if ($element->isActive()) { |
|
62 | 62 | $this->active = $this->index; |
63 | 63 | } |
64 | 64 | $this->index++; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * {@inheritDoc} |
70 | 70 | * @see \web\lib\admin\view\PageElementInterface::render() |
71 | 71 | */ |
72 | - public function render(){ |
|
72 | + public function render() { |
|
73 | 73 | ?> |
74 | 74 | <div id="<?php echo PageElementInterface::TABS_CLASS; ?>" active="<?php echo $this->active; ?>"> |
75 | 75 | <ul> |
@@ -32,7 +32,7 @@ |
||
32 | 32 | $userCount++; |
33 | 33 | } |
34 | 34 | }else{ |
35 | - $this->storeErrorMessage(sprintf(_('Username or expiry date missing for %s record!'), $userCount + 1)); |
|
35 | + $this->storeErrorMessage(sprintf(_('Username or expiry date missing for %s record!'), $userCount + 1)); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | if($userCount>0){ |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Zilvinas Vaira |
9 | 9 | * |
10 | 10 | */ |
11 | -class AddUsersCommand extends AbstractInvokerCommand{ |
|
11 | +class AddUsersCommand extends AbstractInvokerCommand { |
|
12 | 12 | |
13 | 13 | const COMMAND = 'newusers'; |
14 | 14 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param string $commandToken |
24 | 24 | * @param SilverbulletContext $context |
25 | 25 | */ |
26 | - public function __construct($commandToken, $context){ |
|
26 | + public function __construct($commandToken, $context) { |
|
27 | 27 | parent::__construct($commandToken, $context); |
28 | 28 | $this->context = $context; |
29 | 29 | } |
@@ -33,27 +33,27 @@ discard block |
||
33 | 33 | * {@inheritDoc} |
34 | 34 | * @see \web\lib\admin\http\AbstractCommand::execute() |
35 | 35 | */ |
36 | - public function execute(){ |
|
36 | + public function execute() { |
|
37 | 37 | $parser = new CSVParser($_FILES[self::COMMAND], "\n", ','); |
38 | - if(!$parser->isValid()){ |
|
38 | + if (!$parser->isValid()) { |
|
39 | 39 | $this->storeErrorMessage(_('File either is empty or is not CSV file!')); |
40 | 40 | } |
41 | 41 | $userCount = 0; |
42 | 42 | $invitationsCount = 0; |
43 | - while($parser->hasMoreRows()){ |
|
43 | + while ($parser->hasMoreRows()) { |
|
44 | 44 | $row = $parser->nextRow(); |
45 | - if(isset($row[0]) && isset($row[1])){ |
|
45 | + if (isset($row[0]) && isset($row[1])) { |
|
46 | 46 | $user = $this->context->createUser($row[0], $row[1], $this); |
47 | 47 | $max = empty($row[2]) ? 1 : intval($row[2]); |
48 | - if(!empty($user->getIdentifier())){ |
|
48 | + if (!empty($user->getIdentifier())) { |
|
49 | 49 | $this->context->createInvitation($user, $this, $max); |
50 | 50 | $userCount++; |
51 | 51 | } |
52 | - }else{ |
|
52 | + } else { |
|
53 | 53 | $this->storeErrorMessage(sprintf(_('Username or expiry date missing for %s record!'), $userCount + 1)); |
54 | 54 | } |
55 | 55 | } |
56 | - if($userCount>0){ |
|
56 | + if ($userCount > 0) { |
|
57 | 57 | $this->storeInfoMessage(sprintf(_('%s total users were imported and %s invitations created!'), $userCount, $invitationsCount)); |
58 | 58 | } |
59 | 59 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $this->context->createInvitation($user, $this, $max); |
50 | 50 | $userCount++; |
51 | 51 | } |
52 | - }else{ |
|
52 | + } else{ |
|
53 | 53 | $this->storeErrorMessage(sprintf(_('Username or expiry date missing for %s record!'), $userCount + 1)); |
54 | 54 | } |
55 | 55 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @author Zilvinas Vaira |
7 | 7 | * |
8 | 8 | */ |
9 | -abstract class AbstractForm implements TabbedElementInterface{ |
|
9 | +abstract class AbstractForm implements TabbedElementInterface { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @var string |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return boolean |
42 | 42 | */ |
43 | - public function isActive(){ |
|
43 | + public function isActive() { |
|
44 | 44 | return $this->messageBox->hasMessages(); |
45 | 45 | } |
46 | 46 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @author Zilvinas Vaira |
10 | 10 | * |
11 | 11 | */ |
12 | -class AddNewUserForm extends AbstractForm{ |
|
12 | +class AddNewUserForm extends AbstractForm { |
|
13 | 13 | |
14 | 14 | const ADDNEWUSER_CLASS = 'sb-add-new-user'; |
15 | 15 | |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | * {@inheritDoc} |
29 | 29 | * @see \web\lib\admin\view\PageElementInterface::render() |
30 | 30 | */ |
31 | - public function render(){ |
|
31 | + public function render() { |
|
32 | 32 | ?> |
33 | - <form method="post" action="<?php echo $this->action;?>" accept-charset="utf-8"> |
|
33 | + <form method="post" action="<?php echo $this->action; ?>" accept-charset="utf-8"> |
|
34 | 34 | <div class="<?php echo self::ADDNEWUSER_CLASS; ?>"> |
35 | - <?php $this->messageBox->render();?> |
|
35 | + <?php $this->messageBox->render(); ?> |
|
36 | 36 | <label for="<?php echo AddUserCommand::PARAM_NAME; ?>"><?php echo $this->description; ?></label> |
37 | 37 | <div style="margin: 5px 0px 10px 0px;"> |
38 | 38 | <input type="text" name="<?php echo AddUserCommand::PARAM_NAME; ?>"> |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | $lookFor .= "$name"; |
186 | 186 | } |
187 | - $finding = preg_match("/^(".$lookFor."):(.*)/", $oneRow->user_id, $matches); |
|
187 | + $finding = preg_match("/^(" . $lookFor . "):(.*)/", $oneRow->user_id, $matches); |
|
188 | 188 | if ($finding === 0 || $finding === FALSE) { |
189 | 189 | return FALSE; |
190 | 190 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | case $providerStrings[3]: |
207 | 207 | case $providerStrings[4]: |
208 | 208 | case $providerStrings[5]: |
209 | - if (!in_array(User::PROVIDER_STRINGS[$matches[1]],$listOfProviders)) { |
|
209 | + if (!in_array(User::PROVIDER_STRINGS[$matches[1]], $listOfProviders)) { |
|
210 | 210 | $listOfProviders[] = User::PROVIDER_STRINGS[$matches[1]]; |
211 | 211 | } |
212 | 212 | break; |