Passed
Push — master ( 24687e...3d1824 )
by Tomasz
03:18
created
web/admin/inc/manageAdmins.inc.php 2 patches
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -97,14 +97,14 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             $ownermgmt = new \core\UserManagement();
79 79
             $ownermgmt->addAdminToIdp($my_inst, $_SESSION['user']);
80 80
         } else {
81
-            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!";
81
+            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 82
             exit(1);
83 83
         }
84 84
     }
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 
122 122
 if ($isFedAdmin) {
123 123
     echo "<div class='ca-summary' style='position:relative;'><table>";
124
-    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));
124
+    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 125
     echo "</table></div>";
126 126
 }
127 127
 
128 128
 if (!$isFedAdmin && $is_admin_with_blessing) {
129 129
     echo "<div class='ca-summary' style='position:relative;'><table>";
130
-    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"));
130
+    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 131
     echo "</table></div>";
132 132
 }
133 133
 ?>
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
         echo "</td>
157 157
               <td>
158
-                <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'>
158
+                <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 159
                 <input type='hidden' name='admin_id' value='" . $oneowner['ID'] . "'></input>
160 160
                 <button type='submit' name='submitbutton' class='delete' value='" . web\lib\common\FormElements::BUTTON_DELETE . "'>" . _("Delete Administrator") . "</button>
161 161
                 </form>
Please login to merge, or discard this patch.
web/lib/admin/view/TabbedElementInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
web/lib/admin/view/TabbedPanelsBox.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
web/lib/admin/http/AddUsersCommand.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
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){
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
web/lib/admin/view/AbstractForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
web/lib/admin/view/AddNewUserForm.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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; ?>">
Please login to merge, or discard this patch.
core/User.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
web/lib/common/InputValidation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
      */
135 135
     public function string($input, $allowWhitespace = FALSE) {
136 136
     // always chop out invalid characters, and surrounding whitespace
137
-    $retvalStep0 =  iconv("UTF-8", "UTF-8//TRANSLIT", $input);
137
+    $retvalStep0 = iconv("UTF-8", "UTF-8//TRANSLIT", $input);
138 138
     if ($retvalStep0 === FALSE) {
139 139
         throw new Exception("iconv failure for string sanitisation. With TRANSLIT, this should never happen!");
140 140
     }
Please login to merge, or discard this patch.
web/diag/action_userdiag.php 2 patches
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -134,8 +134,9 @@  discard block
 block discarded – undo
134 134
                     array_multisort($name, SORT_ASC, SORT_LOCALE_STRING, $displaylist);
135 135
                     setlocale(LC_ALL, $current_locale);
136 136
 
137
-                    foreach ($displaylist as $id => $oneinst)
138
-                        echo "<option id='" . $id . "' value='" . $oneinst['realmlist'] . "'>" . $oneinst['name'] . "</option>";
137
+                    foreach ($displaylist as $id => $oneinst) {
138
+                                            echo "<option id='" . $id . "' value='" . $oneinst['realmlist'] . "'>" . $oneinst['name'] . "</option>";
139
+                    }
139 140
                     ?>
140 141
                 </select>
141 142
                 <button type='submit' class='submit'><?php echo _("Submit Information"); ?></button>
@@ -197,10 +198,12 @@  discard block
 block discarded – undo
197 198
                 $checkresult[$number] = $check['instance']->UDP_reachability($number, FALSE, FALSE);
198 199
                 if ($checkresult[$number] == \core\diag\RADIUSTests::RETVAL_CONVERSATION_REJECT) { // so now things work?!
199 200
                     // either a packet size or Operator-Name problem!
200
-                    if ($check['instance']->UDP_reachability($number, TRUE, FALSE) != \core\diag\RADIUSTests::RETVAL_CONVERSATION_REJECT)
201
-                        $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "OPERATOR-NAME", "FROM" => $probe['display_name'], "DETAIL" => ""];
202
-                    if ($check['instance']->UDP_reachability($number, FALSE, TRUE) != \core\diag\RADIUSTests::RETVAL_CONVERSATION_REJECT)
203
-                        $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "PACKETSIZE", "FROM" => $probe['display_name'], "DETAIL" => ""];
201
+                    if ($check['instance']->UDP_reachability($number, TRUE, FALSE) != \core\diag\RADIUSTests::RETVAL_CONVERSATION_REJECT) {
202
+                                            $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "OPERATOR-NAME", "FROM" => $probe['display_name'], "DETAIL" => ""];
203
+                    }
204
+                    if ($check['instance']->UDP_reachability($number, FALSE, TRUE) != \core\diag\RADIUSTests::RETVAL_CONVERSATION_REJECT) {
205
+                                            $realmproblems[] = ["REALM" => $check['realm'], "STATUS" => "PACKETSIZE", "FROM" => $probe['display_name'], "DETAIL" => ""];
206
+                    }
204 207
                 } else { // still no response or immediate reject
205 208
                     // if this is a CAT realm with anon ID set, we can't be seeing an NPS ignorance problem
206 209
                     // and consequently, the realm has actual issues
@@ -234,12 +237,13 @@  discard block
 block discarded – undo
234 237
 // re-write check history with that extra knowledge
235 238
     $copycat = $realmproblems;
236 239
 
237
-    foreach ($realmproblems as &$problem)
238
-        if ($problem['STATUS'] == "REALM_POSSIBLY_NPS")
240
+    foreach ($realmproblems as &$problem) {
241
+            if ($problem['STATUS'] == "REALM_POSSIBLY_NPS")
239 242
             foreach ($copycat as $otherproblem)
240 243
                 if ($problem['REALM'] == $otherproblem['REALM'] && $problem['FROM'] != $otherproblem['FROM'] && $otherproblem['STATUS'] != "REALM_POSSIBLY_NPS")
241 244
                     if ($otherproblem['STATUS'] == "REACHABLE") { // worked elsewhere, but not on this probe:
242 245
                         $problem['STATUS'] = "REALM_DOWN";
246
+    }
243 247
                     } else { // inherit other problem; in any case not an NPS problem
244 248
                         $problem['STATUS'] = $otherproblem['STATUS'];
245 249
                     }
@@ -249,11 +253,12 @@  discard block
 block discarded – undo
249 253
 
250 254
     $copycat = $realmproblems;
251 255
 
252
-    foreach ($realmproblems as &$problem)
253
-        if ($problem['STATUS'] == "REALM_DOWN")
256
+    foreach ($realmproblems as &$problem) {
257
+            if ($problem['STATUS'] == "REALM_DOWN")
254 258
             foreach ($copycat as $otherproblem)
255 259
                 if ($problem['REALM'] == $otherproblem['REALM'] && $problem['FROM'] != $otherproblem['FROM'] && $otherproblem['STATUS'] == "REACHABLE")
256 260
                     $problem['STATUS'] = "INFRASTRUCTURE";
261
+    }
257 262
     unset($problem);
258 263
 
259 264
 // finally, extract all certprobs we got from the reachability checks; merge from all
@@ -264,8 +269,9 @@  discard block
 block discarded – undo
264 269
     foreach ($checks as $check) {
265 270
         $instance = $check['instance'];
266 271
         $resultset = $instance->UDP_reachability_result;
267
-        foreach ($resultset as $result)
268
-            $all_certprobs = array_merge($all_certprobs, $result['cert_oddities']);
272
+        foreach ($resultset as $result) {
273
+                    $all_certprobs = array_merge($all_certprobs, $result['cert_oddities']);
274
+        }
269 275
     }
270 276
 
271 277
 // now we have something to say...
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -167,10 +167,10 @@
 block discarded – undo
167 167
             $checks[] = ["realm" => $sanitised_realm, "instance" => new \core\diag\RADIUSTests($sanitised_realm, $profile->getRealmCheckOuterUsername(), $profile->getEapMethodsinOrderOfPreference(1), $profile->getCollapsedAttributes()['eap:server_name'], $profile->getCollapsedAttributes()['eap:ca_file']), "class" => "CAT", "profile" => $profile];
168 168
             echo "Debugging CAT Profile $profile_id for $sanitised_realm<br/>";
169 169
         } else if (!empty($cat->getExternalDBEntityDetails(0, $realm))) {
170
-            $checks[] = ["realm" => $sanitised_realm, "instance" => new \core\diag\RADIUSTests($sanitised_realm, "@".$sanitised_realm), "class" => "EXT_DB"];
170
+            $checks[] = ["realm" => $sanitised_realm, "instance" => new \core\diag\RADIUSTests($sanitised_realm, "@" . $sanitised_realm), "class" => "EXT_DB"];
171 171
             echo "Debugging non-CAT but existing realm $sanitised_realm<br/>";
172 172
         } else {
173
-            $checks[] = ["realm" => $sanitised_realm, "instance" => new \core\diag\RADIUSTests($sanitised_realm, "@".$sanitised_realm), "class" => "ALIEN"];
173
+            $checks[] = ["realm" => $sanitised_realm, "instance" => new \core\diag\RADIUSTests($sanitised_realm, "@" . $sanitised_realm), "class" => "ALIEN"];
174 174
             echo "Debugging non-existing realm $sanitised_realm<br/>";
175 175
         }
176 176
     }
Please login to merge, or discard this patch.