Passed
Push — release_2_0 ( 46c9ba...b90bc6 )
by Tomasz
07:37
created
web/admin/edit_idp.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *          <base_url>/copyright.php after deploying the software
20 20
  */
21 21
 
22
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
22
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
23 23
 
24 24
 $auth = new \web\lib\admin\Authentication();
25 25
 $deco = new \web\lib\admin\PageDecoration();
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
         </table>
95 95
     </div>
96 96
     <?php
97
-    echo "<form enctype='multipart/form-data' action='edit_idp_result.php?inst_id=$my_inst->identifier" . ($wizardStyle ? "&wizard=true" : "") . "' method='post' accept-charset='UTF-8'>
98
-              <input type='hidden' name='MAX_FILE_SIZE' value='" . CONFIG['MAX_UPLOAD_SIZE'] . "'>";
97
+    echo "<form enctype='multipart/form-data' action='edit_idp_result.php?inst_id=$my_inst->identifier".($wizardStyle ? "&wizard=true" : "")."' method='post' accept-charset='UTF-8'>
98
+              <input type='hidden' name='MAX_FILE_SIZE' value='" . CONFIG['MAX_UPLOAD_SIZE']."'>";
99 99
 
100 100
     if ($wizardStyle) {
101
-        echo "<p>" .
102
-        sprintf(_("Hello, newcomer. The %s is new to us. This wizard will ask you several questions about it, so that we can generate beautiful profiles for you in the end. All of the information below is optional, but it is important to fill out as many fields as possible for the benefit of your end users."), $uiElements->nomenclatureInst) . "</p>";
101
+        echo "<p>".
102
+        sprintf(_("Hello, newcomer. The %s is new to us. This wizard will ask you several questions about it, so that we can generate beautiful profiles for you in the end. All of the information below is optional, but it is important to fill out as many fields as possible for the benefit of your end users."), $uiElements->nomenclatureInst)."</p>";
103 103
     }
104 104
     $optionDisplay = new web\lib\admin\OptionDisplay($idpoptions, "IdP");
105 105
     ?>
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
         <legend><strong><?php echo _("General Information"); ?></strong></legend>
108 108
         <?php
109 109
         if ($wizardStyle) {
110
-            echo "<p>" .
111
-            _("Some properties are valid across all deployment profiles. This is the place where you can describe those properties in a fine-grained way. The solicited information is used as follows:") . "</p>
110
+            echo "<p>".
111
+            _("Some properties are valid across all deployment profiles. This is the place where you can describe those properties in a fine-grained way. The solicited information is used as follows:")."</p>
112 112
                       <ul>
113
-                         <li>" . _("<strong>Logo</strong>: When you submit a logo, we will embed this logo into all installers where a custom logo is possible. We accept any image format, but for best results, we suggest SVG. If you don't upload a logo, we will use the generic logo instead (see top-right corner of this page).") . "</li>
114
-                         <li>" . sprintf(_("<strong>Name</strong>: The %s may have names in multiple languages. It is recommended to always populate at least the 'default/other' language, as it is used as a fallback if the system does not have a name in the exact language the user requests a download in."),$uiElements->nomenclatureInst) . "</li>";
113
+                         <li>" . _("<strong>Logo</strong>: When you submit a logo, we will embed this logo into all installers where a custom logo is possible. We accept any image format, but for best results, we suggest SVG. If you don't upload a logo, we will use the generic logo instead (see top-right corner of this page).")."</li>
114
+                         <li>" . sprintf(_("<strong>Name</strong>: The %s may have names in multiple languages. It is recommended to always populate at least the 'default/other' language, as it is used as a fallback if the system does not have a name in the exact language the user requests a download in."), $uiElements->nomenclatureInst)."</li>";
115 115
             echo "</ul>";
116 116
         }
117 117
         echo $optionDisplay->prefilledOptionTable("general");
@@ -125,47 +125,47 @@  discard block
 block discarded – undo
125 125
         <legend><strong><?php echo _("Media Properties"); ?></strong></legend>
126 126
         <?php
127 127
         if ($wizardStyle) {
128
-            echo "<p>" .
129
-            sprintf(_("In this section, you define on which media %s should be configured on user devices."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']) . "</p>
128
+            echo "<p>".
129
+            sprintf(_("In this section, you define on which media %s should be configured on user devices."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'])."</p>
130 130
           <ul>";
131 131
             echo "<li>";
132
-            echo "<strong>" . ( count(CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']) > 0 ? _("Additional SSIDs:") : _("SSIDs:")) . " </strong>";
132
+            echo "<strong>".(count(CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']) > 0 ? _("Additional SSIDs:") : _("SSIDs:"))." </strong>";
133 133
             if (count(CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']) > 0) {
134 134
                 $ssidlist = "";
135 135
                 foreach (CONFIG_CONFASSISTANT['CONSORTIUM']['ssid'] as $ssid) {
136
-                    $ssidlist .= ", '<strong>" . $ssid . "</strong>'";
136
+                    $ssidlist .= ", '<strong>".$ssid."</strong>'";
137 137
                 }
138 138
                 $ssidlist = substr($ssidlist, 2);
139 139
                 echo sprintf(ngettext("We will always configure this SSID for WPA2/AES: %s.", "We will always configure these SSIDs for WPA2/AES: %s.", count(CONFIG_CONFASSISTANT['CONSORTIUM']['ssid'])), $ssidlist);
140 140
                 if (CONFIG_CONFASSISTANT['CONSORTIUM']['tkipsupport']) {
141
-                    echo " " . _("They will also be configured for WPA/TKIP if the device supports multiple encryption types.");
141
+                    echo " "._("They will also be configured for WPA/TKIP if the device supports multiple encryption types.");
142 142
                 }
143
-                echo "<br/>" . sprintf(_("It is also possible to define custom additional SSIDs with the options '%s' and '%s' below."), $uiElements->displayName("media:SSID"), $uiElements->displayName("media:SSID_with_legacy"));
143
+                echo "<br/>".sprintf(_("It is also possible to define custom additional SSIDs with the options '%s' and '%s' below."), $uiElements->displayName("media:SSID"), $uiElements->displayName("media:SSID_with_legacy"));
144 144
             } else {
145 145
                 echo _("Please configure which SSIDs should be configured in the installers.");
146 146
             }
147
-            echo " " . _("By default, we will only configure the SSIDs with WPA2/AES encryption. By using the '(with WPA/TKIP)' option you can specify that we should include legacy support for WPA/TKIP where possible.");
147
+            echo " "._("By default, we will only configure the SSIDs with WPA2/AES encryption. By using the '(with WPA/TKIP)' option you can specify that we should include legacy support for WPA/TKIP where possible.");
148 148
             echo "</li>";
149 149
 
150 150
             echo "<li>";
151
-            echo "<strong>" . ( count(CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']) > 0 ? _("Additional Hotspot 2.0 / Passpoint Consortia:") : _("Hotspot 2.0 / Passpoint Consortia:")) . " </strong>";
151
+            echo "<strong>".(count(CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']) > 0 ? _("Additional Hotspot 2.0 / Passpoint Consortia:") : _("Hotspot 2.0 / Passpoint Consortia:"))." </strong>";
152 152
             if (count(CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi']) > 0) {
153 153
                 $consortiumlist = "";
154 154
                 foreach (CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi'] as $oi) {
155
-                    $consortiumlist .= ", '<strong>" . $oi . "</strong>'";
155
+                    $consortiumlist .= ", '<strong>".$oi."</strong>'";
156 156
                 }
157 157
                 $consortiumlist = substr($consortiumlist, 2);
158 158
                 echo sprintf(ngettext("We will always configure this Consortium OI: %s.", "We will always configure these Consortium OIs: %s.", count(CONFIG_CONFASSISTANT['CONSORTIUM']['interworking-consortium-oi'])), $consortiumlist);
159 159
 
160
-                echo "<br/>" . sprintf(_("It is also possible to define custom additional OIs with the option '%s' below."), $uiElements->displayName("media:consortium_OI"));
160
+                echo "<br/>".sprintf(_("It is also possible to define custom additional OIs with the option '%s' below."), $uiElements->displayName("media:consortium_OI"));
161 161
             } else {
162 162
                 echo _("Please configure which Consortium OIs should be configured in the installers.");
163 163
             }
164 164
             echo "</li>";
165
-            echo "<li><strong>" . _("Support for wired IEEE 802.1X:") . " </strong>"
166
-            . _("If you want to configure your users' devices with IEEE 802.1X support for wired ethernet, please check the corresponding box. Note that this makes the installation process a bit more difficult on some platforms (Windows: needs administrator privileges; Apple: attempting to install a profile with wired support on a device without an active wired ethernet card will fail).") .
165
+            echo "<li><strong>"._("Support for wired IEEE 802.1X:")." </strong>"
166
+            . _("If you want to configure your users' devices with IEEE 802.1X support for wired ethernet, please check the corresponding box. Note that this makes the installation process a bit more difficult on some platforms (Windows: needs administrator privileges; Apple: attempting to install a profile with wired support on a device without an active wired ethernet card will fail).").
167 167
             "</li>";
168
-            echo "<li><strong>" . _("Removal of bootstrap/onboarding SSIDs:") . " </strong>"
168
+            echo "<li><strong>"._("Removal of bootstrap/onboarding SSIDs:")." </strong>"
169 169
             . _("If you use a captive portal to distribute configurations, you may want to unconfigure/disable that SSID after the bootstrap process. With this option, the SSID will either be removed, or be defined as 'Only connect manually'.")
170 170
             . "</li>";
171 171
             echo "</ul>";
@@ -181,16 +181,16 @@  discard block
 block discarded – undo
181 181
             echo "<p>"._("This section can be used to upload specific Terms of Use for your users and to display details of how your users can reach your local helpdesk.")."</p>";
182 182
             
183 183
             if (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_RADIUS'] == "LOCAL") {
184
-                echo "<p>" .
184
+                echo "<p>".
185 185
                         
186
-                sprintf(_("Do you provide helpdesk services for your users? If so, it would be nice if you would tell us the pointers to this helpdesk."),$uiElements->nomenclatureInst)  . "</p>" .
187
-                "<p>" .
188
-                _("If you enter a value here, it will be added to the installers for all your users, and will be displayed on the download page. If you operate separate helpdesks for different user groups (we call this 'profiles') specify per-profile helpdesk information later in this wizard. If you operate no help desk at all, just leave these fields empty.") . "</p>";
186
+                sprintf(_("Do you provide helpdesk services for your users? If so, it would be nice if you would tell us the pointers to this helpdesk."), $uiElements->nomenclatureInst)."</p>".
187
+                "<p>".
188
+                _("If you enter a value here, it will be added to the installers for all your users, and will be displayed on the download page. If you operate separate helpdesks for different user groups (we call this 'profiles') specify per-profile helpdesk information later in this wizard. If you operate no help desk at all, just leave these fields empty.")."</p>";
189 189
                 if (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] == "LOCAL") {
190
-                echo "<p>" . sprintf(_("For %s deployments, providing at least a local e-mail contact is required."), core\ProfileSilverbullet::PRODUCTNAME) ." " . _("This is the contact point for your end users' level 1 support.") . "</p>";
190
+                echo "<p>".sprintf(_("For %s deployments, providing at least a local e-mail contact is required."), core\ProfileSilverbullet::PRODUCTNAME)." "._("This is the contact point for your end users' level 1 support.")."</p>";
191 191
                 }
192 192
             } elseif (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] == "LOCAL") {
193
-                echo "<p>". _("Providing at least a local support e-mail contact is required.")." "._("This is the contact point for your end users' level 1 support.")."</p>";
193
+                echo "<p>"._("Providing at least a local support e-mail contact is required.")." "._("This is the contact point for your end users' level 1 support.")."</p>";
194 194
             }
195 195
             
196 196
         }
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
         <button type='button' class='newoption' onclick='getXML("support")'><?php echo _("Add new option"); ?></button></fieldset>
201 201
     <?php
202 202
     if ($wizardStyle) {
203
-        echo "<p>" . sprintf(_("When you are sure that everything is correct, please click on %sContinue ...%s"), "<button type='submit' name='submitbutton' value='" . web\lib\common\FormElements::BUTTON_CONTINUE . "'>", "</button>") . "</p></form>";
203
+        echo "<p>".sprintf(_("When you are sure that everything is correct, please click on %sContinue ...%s"), "<button type='submit' name='submitbutton' value='".web\lib\common\FormElements::BUTTON_CONTINUE."'>", "</button>")."</p></form>";
204 204
     } else {
205
-        echo "<div><button type='submit' name='submitbutton' value='" . web\lib\common\FormElements::BUTTON_SAVE . "'>" . _("Save data") . "</button> <button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location = \"overview_idp.php?inst_id=$my_inst->identifier\"'>" . _("Discard changes") . "</button></div></form>";
205
+        echo "<div><button type='submit' name='submitbutton' value='".web\lib\common\FormElements::BUTTON_SAVE."'>"._("Save data")."</button> <button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location = \"overview_idp.php?inst_id=$my_inst->identifier\"'>"._("Discard changes")."</button></div></form>";
206 206
     }
207 207
     echo $deco->footer();
Please login to merge, or discard this patch.
web/lib/admin/OptionDisplay.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 use Exception;
26 26
 
27
-require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php";
27
+require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php";
28 28
 
29 29
 /**
30 30
  * We need to display previously set options in various forms. This class covers
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @return string HTML code <table>
88 88
      */
89 89
     public function prefilledOptionTable(string $attributePrefix) {
90
-        $retval = "<table id='expandable_$attributePrefix" . "_options'>";
90
+        $retval = "<table id='expandable_$attributePrefix"."_options'>";
91 91
 
92 92
         $prepopulate = [];
93 93
         foreach ($this->listOfOptions as $existingAttribute) {
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
         if (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] == "LOCAL" && CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_RADIUS'] != "LOCAL") {
120 120
             $blackListOnPrefill .= "|fed:silverbullet";
121 121
         }
122
-        if (is_array($prepopulate) && ( count($prepopulate) > 1 || $class == "device-specific" || $class == "eap-specific")) { // editing... fill with values
122
+        if (is_array($prepopulate) && (count($prepopulate) > 1 || $class == "device-specific" || $class == "eap-specific")) { // editing... fill with values
123 123
             foreach ($prepopulate as $option) {
124 124
                 if (preg_match("/$class:/", $option['name']) && !preg_match("/($blackListOnPrefill)/", $option['name'])) {
125 125
                     $optiontypearray = $optioninfo->optionType($option['name']);
126 126
                     $loggerInstance = new \core\common\Logging();
127 127
                     $loggerInstance->debug(5, "About to execute optiontext with PREFILL!\n");
128
-                    $retval .= $this->optiontext([$option['name']], ($optiontypearray["type"] == "file" ? 'ROWID-' . $option['level'] . '-' . $option['row'] : $option['value']), $option['lang']);
128
+                    $retval .= $this->optiontext([$option['name']], ($optiontypearray["type"] == "file" ? 'ROWID-'.$option['level'].'-'.$option['row'] : $option['value']), $option['lang']);
129 129
                 }
130 130
             }
131 131
         } else { // not editing exist, this in new: add empty list
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         if (!isset($descriptions[$input])) {
188 188
             return "";
189 189
         }
190
-        return "<span class='tooltip' id='S$rowid-tooltip-$input' style='display:" . ($isVisible ? "block" : "none") . "' onclick='alert(\"" . $descriptions[$input] . "\")'><img src='../resources/images/icons/question-mark-icon.png" . "'></span>";
190
+        return "<span class='tooltip' id='S$rowid-tooltip-$input' style='display:".($isVisible ? "block" : "none")."' onclick='alert(\"".$descriptions[$input]."\")'><img src='../resources/images/icons/question-mark-icon.png"."'></span>";
191 191
     }
192 192
 
193 193
     /**
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
      */
201 201
     private function selectElement($rowid, $list) {
202 202
         $jsmagic = "onchange='
203
-                               if (/#ML#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
203
+                               if (/#ML#/.test(document.getElementById(\"option-S" . $rowid."-select\").value)) {
204 204
                                    document.getElementById(\"S$rowid-input-langselect\").style.display = \"block\";
205 205
                                    } else {
206 206
                                    document.getElementById(\"S$rowid-input-langselect\").style.display = \"none\";
207 207
                                    }";
208 208
         foreach (array_keys(OptionDisplay::HTML_DATATYPE_TEXTS) as $key) {
209
-            $jsmagic .= "if (/#" . $key . "#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
210
-                                  document.getElementById(\"S$rowid-input-file\").style.display = \"" . ($key == \core\Options::TYPECODE_FILE ? "block" : "none") . "\";
211
-                                  document.getElementById(\"S$rowid-input-text\").style.display = \"" . ($key == \core\Options::TYPECODE_TEXT ? "block" : "none") . "\";
212
-                                  document.getElementById(\"S$rowid-input-string\").style.display = \"" . ($key == \core\Options::TYPECODE_STRING ? "block" : "none") . "\";
213
-                                  document.getElementById(\"S$rowid-input-boolean\").style.display = \"" . ($key == \core\Options::TYPECODE_BOOLEAN ? "block" : "none") . "\";
214
-                                  document.getElementById(\"S$rowid-input-integer\").style.display = \"" . ($key == \core\Options::TYPECODE_INTEGER ? "block" : "none") . "\";
209
+            $jsmagic .= "if (/#".$key."#/.test(document.getElementById(\"option-S".$rowid."-select\").value)) {
210
+                                  document.getElementById(\"S$rowid-input-file\").style.display = \"".($key == \core\Options::TYPECODE_FILE ? "block" : "none")."\";
211
+                                  document.getElementById(\"S$rowid-input-text\").style.display = \"".($key == \core\Options::TYPECODE_TEXT ? "block" : "none")."\";
212
+                                  document.getElementById(\"S$rowid-input-string\").style.display = \"".($key == \core\Options::TYPECODE_STRING ? "block" : "none")."\";
213
+                                  document.getElementById(\"S$rowid-input-boolean\").style.display = \"".($key == \core\Options::TYPECODE_BOOLEAN ? "block" : "none")."\";
214
+                                  document.getElementById(\"S$rowid-input-integer\").style.display = \"".($key == \core\Options::TYPECODE_INTEGER ? "block" : "none")."\";
215 215
                              }
216 216
                              ";
217 217
             // hide all tooltips (each is a <span>, and there are no other <span>s)
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         $activelisttype = [];
241 241
         foreach ($list as $value) {
242 242
             $listtype = $optioninfo->optionType($value);
243
-            $retval .= "<option id='option-S$rowid-v-$value' value='$value#" . $listtype["type"] . "#" . $listtype["flag"] . "#' ";
243
+            $retval .= "<option id='option-S$rowid-v-$value' value='$value#".$listtype["type"]."#".$listtype["flag"]."#' ";
244 244
             if ($iterator == $this->optionIterator) {
245 245
                 $retval .= "selected='selected'";
246 246
                 $activelisttype = $listtype;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
             } else {
249 249
                 $tooltips .= $this->tooltip($rowid, $value, FALSE);
250 250
             }
251
-            $retval .= ">" . $uiElements->displayName($value) . "</option>";
251
+            $retval .= ">".$uiElements->displayName($value)."</option>";
252 252
             $iterator++;
253 253
         }
254 254
         if (count($activelisttype) == 0) {
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
      */
272 272
     private function selectLanguage($rowid, $makeVisible) {
273 273
         \core\common\Entity::intoThePotatoes();
274
-        $retval = "<select style='display:" . ($makeVisible ? "block" : "none") . "' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect'>
275
-            <option value='' name='select_language' selected>" . _("select language") . "</option>
276
-            <option value='C' name='all_languages'>" . _("default/other languages") . "</option>";
274
+        $retval = "<select style='display:".($makeVisible ? "block" : "none")."' name='value[S$rowid-lang]' id='S".$rowid."-input-langselect'>
275
+            <option value='' name='select_language' selected>" . _("select language")."</option>
276
+            <option value='C' name='all_languages'>" . _("default/other languages")."</option>";
277 277
         foreach (CONFIG['LANGUAGES'] as $langindex => $possibleLang) {
278 278
             $thislang = $possibleLang['display'];
279 279
             $retval .= "<option value='$langindex' name='$langindex'>$thislang</option>";
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     private function inputFields($rowid, $activetype) {
302 302
         $retval = "";
303 303
         foreach (OptionDisplay::HTML_DATATYPE_TEXTS as $key => $type) {
304
-            $retval .= "<" . $type['html'] . " style='display:" . ($activetype['type'] == $key ? "block" : "none") . "' name='value[S$rowid-$key]' id='S" . $rowid . "-input-" . $key . "'" . $type['tail'] . ">";
304
+            $retval .= "<".$type['html']." style='display:".($activetype['type'] == $key ? "block" : "none")."' name='value[S$rowid-$key]' id='S".$rowid."-input-".$key."'".$type['tail'].">";
305 305
         }
306 306
         return $retval;
307 307
     }
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
     private function noPrefillText(int $rowid, array $list) {
317 317
         // first column: the <select> element with the names of options and their field-toggling JS magic
318 318
         $selectorInfo = $this->selectElement($rowid, $list);
319
-        $retval = "<td>" . $selectorInfo["TEXT"] . "</td>";
319
+        $retval = "<td>".$selectorInfo["TEXT"]."</td>";
320 320
         // second column: the <select> element for language selection - only visible if the active option is multi-lang
321
-        $retval .= "<td>" . $this->selectLanguage($rowid, $selectorInfo['ACTIVE']['flag'] == "ML") . "</td>";
321
+        $retval .= "<td>".$this->selectLanguage($rowid, $selectorInfo['ACTIVE']['flag'] == "ML")."</td>";
322 322
         // third column: the actual input fields; the data type of the active option is visible, all others hidden
323
-        $retval .= "<td>" . $this->inputFields($rowid, $selectorInfo['ACTIVE']) . "</td>";
323
+        $retval .= "<td>".$this->inputFields($rowid, $selectorInfo['ACTIVE'])."</td>";
324 324
         return $retval;
325 325
     }
326 326
 
@@ -343,20 +343,20 @@  discard block
 block discarded – undo
343 343
         $retval .= "<td>";
344 344
         $uiElements = new UIElements();
345 345
         $listtype = $optioninfo->optionType($optionName);
346
-        $retval .= "<span style='display:flex;'>" . $uiElements->displayName($optionName);
347
-        $retval .= $this->tooltip($rowid, $optionName, TRUE) . "</span>";
348
-        $retval .= "<input type='hidden' id='option-S$rowid-select' name='option[S$rowid]' value='$optionName#" . $listtype["type"] . "#" . $listtype["flag"] . "#' ></td>";
346
+        $retval .= "<span style='display:flex;'>".$uiElements->displayName($optionName);
347
+        $retval .= $this->tooltip($rowid, $optionName, TRUE)."</span>";
348
+        $retval .= "<input type='hidden' id='option-S$rowid-select' name='option[S$rowid]' value='$optionName#".$listtype["type"]."#".$listtype["flag"]."#' ></td>";
349 349
 
350 350
         // language tag if any
351 351
         $retval .= "<td>";
352 352
         if ($listtype["flag"] == "ML") {
353 353
 
354
-            $language = "(" . strtoupper($optionLang) . ")";
354
+            $language = "(".strtoupper($optionLang).")";
355 355
             if ($optionLang == 'C') {
356 356
                 $language = _("(default/other languages)");
357 357
             }
358 358
             $retval .= $language;
359
-            $retval .= "<input type='hidden' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect' value='" . $optionLang . "' style='display:block'>";
359
+            $retval .= "<input type='hidden' name='value[S$rowid-lang]' id='S".$rowid."-input-langselect' value='".$optionLang."' style='display:block'>";
360 360
         }
361 361
         $retval .= "</td>";
362 362
 // attribute content
@@ -366,12 +366,12 @@  discard block
 block discarded – undo
366 366
             case \core\Options::TYPECODE_COORDINATES:
367 367
                 $this->allLocationCount = $this->allLocationCount + 1;
368 368
                 // display of the locations varies by map provider
369
-                $classname = "\web\lib\admin\Map" . CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER'];
369
+                $classname = "\web\lib\admin\Map".CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER'];
370 370
                 $link = $classname::optionListDisplayCode($optionValue, $this->allLocationCount);
371
-                $retval .= "<input readonly style='display:none' type='text' name='value[S$rowid-" . \core\Options::TYPECODE_TEXT . "]' id='S$rowid-input-text' value='$optionValue'>$link";
371
+                $retval .= "<input readonly style='display:none' type='text' name='value[S$rowid-".\core\Options::TYPECODE_TEXT."]' id='S$rowid-input-text' value='$optionValue'>$link";
372 372
                 break;
373 373
             case \core\Options::TYPECODE_FILE:
374
-                $retval .= "<input readonly type='text' name='value[S$rowid-" . \core\Options::TYPECODE_STRING . "]' id='S" . $rowid . "-input-string' style='display:none' value='" . urlencode($optionValue) . "'>";
374
+                $retval .= "<input readonly type='text' name='value[S$rowid-".\core\Options::TYPECODE_STRING."]' id='S".$rowid."-input-string' style='display:none' value='".urlencode($optionValue)."'>";
375 375
                 $uiElements = new UIElements();
376 376
                 switch ($optionName) {
377 377
                     case "eap:ca_file":
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
                 if ($listtype['type'] == \core\Options::TYPECODE_BOOLEAN) {// only modify in this one case
402 402
                     $displayedVariant = ($optionValue == "on" ? _("on") : _("off"));
403 403
                 }
404
-                $retval .= "<strong>$displayedVariant</strong><input type='hidden' name='value[S$rowid-" . $listtype['type'] . "]' id='S" . $rowid . "-input-" . $listtype["type"] . "' value=\"" . htmlspecialchars($optionValue) . "\" style='display:block'>";
404
+                $retval .= "<strong>$displayedVariant</strong><input type='hidden' name='value[S$rowid-".$listtype['type']."]' id='S".$rowid."-input-".$listtype["type"]."' value=\"".htmlspecialchars($optionValue)."\" style='display:block'>";
405 405
                 break;
406 406
             default:
407 407
                 // this should never happen!
@@ -445,10 +445,10 @@  discard block
 block discarded – undo
445 445
        <td>
446 446
           <button type='button' class='delete' onclick='";
447 447
         if ($prefillValue !== NULL && $item == "general:geo_coordinates") {
448
-            $funcname = "Map" . CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER'] . 'DeleteCoord';
449
-            $retval .= 'if (typeof ' . $funcname . ' === "function") { ' . $funcname . '(' . $this->allLocationCount . '); } ';
448
+            $funcname = "Map".CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER'].'DeleteCoord';
449
+            $retval .= 'if (typeof '.$funcname.' === "function") { '.$funcname.'('.$this->allLocationCount.'); } ';
450 450
         }
451
-        $retval .= 'deleteOption("option-S' . $rowid . '")';
451
+        $retval .= 'deleteOption("option-S'.$rowid.'")';
452 452
         $retval .= "'>-</button>
453 453
        </td>
454 454
     </tr>";
Please login to merge, or discard this patch.
web/skins/modern/diag/diag.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  */
28 28
 function my_nonce($optSalt = '') {
29 29
     $remote = filter_input(INPUT_SERVER, 'REMOTE_ADDR');
30
-    return hash_hmac('sha256', session_id() . $optSalt, date("YmdG") . '1qaz2wsx3edc!QAZ@WSX#EDC' . $remote);
30
+    return hash_hmac('sha256', session_id().$optSalt, date("YmdG").'1qaz2wsx3edc!QAZ@WSX#EDC'.$remote);
31 31
 }
32 32
 error_reporting(E_ALL | E_STRICT);
33 33
 $Gui->defaultPagePrelude();
@@ -51,16 +51,16 @@  discard block
 block discarded – undo
51 51
 <?php
52 52
 $admin = filter_input(INPUT_GET, 'admin', FILTER_VALIDATE_INT);
53 53
 $profile_list_size = 1;
54
-require_once dirname(__DIR__) . '/Divs.php';
54
+require_once dirname(__DIR__).'/Divs.php';
55 55
 $divs = new Divs($Gui);
56 56
 $visibility = 'index';
57 57
 $operatingSystem = $Gui->detectOS();
58 58
 $Gui->loggerInstance->debug(4, $operatingSystem);
59 59
 $uiElements = new web\lib\admin\UIElements();
60 60
 if ($operatingSystem) {
61
-    print "recognisedOS = '" . $operatingSystem['device'] . "';\n";
61
+    print "recognisedOS = '".$operatingSystem['device']."';\n";
62 62
 }
63
-require dirname(__DIR__) . '/user/js/cat_js.php';
63
+require dirname(__DIR__).'/user/js/cat_js.php';
64 64
 ?>
65 65
 
66 66
 </script>
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
             <?php echo $divs->div_pagetitle(_("Diagnostics site"), ""); ?>
94 94
             <div id="user_info" style='padding-top: 10px;'>
95 95
             <div id='diagnostic_choice'>
96
-                <?php echo _("The diagnostics system will do its best to identify and resolve your problems!") . ' ' . _("Please help the system by answering the questions as precisely as possible.") . "<br/>" . _("Are you a") . ' '; ?>
97
-                <input type='radio' name='diagnostic_usertype' value='0'><?php echo _("end-user") . ' ' . _("or"); ?>   
98
-                <input type='radio' name='diagnostic_usertype' value='1' <?php if ($admin == 1) { echo " checked"; } ?> > <?php echo _("eduroam administrator") .'?'; ?>
96
+                <?php echo _("The diagnostics system will do its best to identify and resolve your problems!").' '._("Please help the system by answering the questions as precisely as possible.")."<br/>"._("Are you a").' '; ?>
97
+                <input type='radio' name='diagnostic_usertype' value='0'><?php echo _("end-user").' '._("or"); ?>   
98
+                <input type='radio' name='diagnostic_usertype' value='1' <?php if ($admin == 1) { echo " checked"; } ?> > <?php echo _("eduroam administrator").'?'; ?>
99 99
             </div>
100 100
             <div id='diagnostic_enduser' style='display: none;'>
101 101
                 <h2><?php echo _("Tools for End Users"); ?></h2>
@@ -105,24 +105,24 @@  discard block
 block discarded – undo
105 105
                 ?>
106 106
                 </p>
107 107
                 <?php
108
-                    echo '<div id="before_stage_1"><h3>' . _("The system needs some information on your home institution - issuer of your account") . '</h3>';
108
+                    echo '<div id="before_stage_1"><h3>'._("The system needs some information on your home institution - issuer of your account").'</h3>';
109 109
                     echo _("What is the realm part of your user account (the part behind the @ of 'your.username@<b>realm.tld</b>):");
110 110
                 ?>
111 111
                 <input type='text' name='user_realm' id='user_realm' value=''>
112 112
                 <?php
113
-                    echo '<div id="realm_by_select"><br/>' . _("alternatively") . '<br/>';
114
-                    echo _("You can select your home institution from the following list") . '<br/>';
113
+                    echo '<div id="realm_by_select"><br/>'._("alternatively").'<br/>';
114
+                    echo _("You can select your home institution from the following list").'<br/>';
115 115
                     echo '<div id="select_idp_country"><a href="" id="idp_countries_list">';    
116
-                    echo '<span id="realmselect">' . _("Click to select your country/region and organisation") . '</span></a></div>';
116
+                    echo '<span id="realmselect">'._("Click to select your country/region and organisation").'</span></a></div>';
117 117
                 ?>
118 118
                 <div id="select_idp_area" style="display:none;">
119 119
                 </div>
120 120
                 </div>
121 121
                 <div id="position_info">
122 122
                     <?php
123
-                        echo '<h3>' . _("Optionally, to improve tests, you can provide information on your current location") . '</h3>';
123
+                        echo '<h3>'._("Optionally, to improve tests, you can provide information on your current location").'</h3>';
124 124
                         echo '<div id="select_sp_country"><a href="" id="sp_countries_list">';    
125
-                        echo '<span id="spselect">' . _("Click to select a location in which you have an eduroam problem") . '</span></a></div>';
125
+                        echo '<span id="spselect">'._("Click to select a location in which you have an eduroam problem").'</span></a></div>';
126 126
                     ?>
127 127
                     <div id="select_sp_area" style="display:none;">
128 128
                     </div>
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
                             echo 'none';
158 158
                         }
159 159
                         echo ";'>";
160
-                        echo '<h3>' . _("Which problem are you reporting?") . '</h3>';
160
+                        echo '<h3>'._("Which problem are you reporting?").'</h3>';
161 161
                         echo '<input type="radio" name="problem_type" value="1">';
162
-                        echo _("SP contacting IdP due to technical problems or abuse") . '<br>';
162
+                        echo _("SP contacting IdP due to technical problems or abuse").'<br>';
163 163
                         echo '<input type="radio" name="problem_type" value="2">';
164 164
                         echo _("IdP contacting SP due to technical problems");
165 165
                         echo "<div id='idp_contact_area'></div>";
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
                         echo "</div>"; 
169 169
                     } else {
170 170
                         echo "0\">";
171
-                        echo _("This service is for authenticated admins only.") . '<br>';
172
-                        echo "<a href=\"diag.php?admin=1\">" .
173
-                            _("eduroam® admin access is needed") . "</a>";
171
+                        echo _("This service is for authenticated admins only.").'<br>';
172
+                        echo "<a href=\"diag.php?admin=1\">".
173
+                            _("eduroam® admin access is needed")."</a>";
174 174
                     }
175 175
                 ?>
176 176
             </div> 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         if (type === 'idp' || type === 'sp') {
195 195
             shtml = '<table><tbody><tr id="row_'+type+'_country"></tr>';
196 196
             shtml = shtml + '<tr id="row_'+type+'_institution" style="visibility: collapse;">';
197
-            shtml = shtml + '<td>' + <?php echo '"' . _("Select institiution:") . '"'; ?> + '</td><td></td></tr>';
197
+            shtml = shtml + '<td>' + <?php echo '"'._("Select institiution:").'"'; ?> + '</td><td></td></tr>';
198 198
             if (type === 'idp') {
199 199
                 shtml = shtml + '<tr id="row_idp_realm"></tr>';
200 200
             }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         var options = '';
220 220
         var selecthead = '';
221 221
         if (type1 === 'sp' || type1 === 'idp') {
222
-            selecthead = <?php echo '"<td>' . _("Select country or region:") . ' </td>"'; ?>;
222
+            selecthead = <?php echo '"<td>'._("Select country or region:").' </td>"'; ?>;
223 223
             selecthead = selecthead + '<td>\n';
224 224
         }
225 225
         var select = '<select id="' + type1 + '_country" name="' + type1 + '_country" style="margin-left:0px; width:400px;">';
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             options = ($('#'+type2+'_country').html());
228 228
             countryAddSelect(selecthead, select + options + '</select>', type1);
229 229
         } else {
230
-            var comment = <?php echo '"<br><br>' . _("Fetching country/region list") . '..."'; ?>;
230
+            var comment = <?php echo '"<br><br>'._("Fetching country/region list").'..."'; ?>;
231 231
             inProgress(1, comment);
232 232
             $.ajax({
233 233
                 url: "findRealm.php",
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         return false;
261 261
     }
262 262
     function testSociopath(realm, answer) {
263
-        var comment = <?php echo '"' . _("Testing realm") . '..."'; ?>; 
263
+        var comment = <?php echo '"'._("Testing realm").'..."'; ?>; 
264 264
         inProgress(1, comment);
265 265
         if ($('#tested_realm').length == 0) {
266 266
             console.log('MGW, tested_realm=0')
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
                                 query = '<input type="hidden" id="tested_realm" value="' + realm + '">';
288 288
                             }    
289 289
                             query = query + '<div id="current_query">'+data['TEXT']+'</div>';
290
-                            query = query + '<div><button id="answer_yes">' + <?php echo '"' . _("Yes") . '"'; ?> + '</button>';
291
-                            query = query + '<button style="margin-left:20px;" id="answer_no">' + <?php echo '"' . _("No") . '"'; ?> + '</button>';
292
-                            query = query + '<button style="margin-left:20px;" id="answer_noidea">' + <?php echo '"' . _("I don't know") . '"'; ?> + '</button></div>';
290
+                            query = query + '<div><button id="answer_yes">' + <?php echo '"'._("Yes").'"'; ?> + '</button>';
291
+                            query = query + '<button style="margin-left:20px;" id="answer_no">' + <?php echo '"'._("No").'"'; ?> + '</button>';
292
+                            query = query + '<button style="margin-left:20px;" id="answer_noidea">' + <?php echo '"'._("I don't know").'"'; ?> + '</button></div>';
293 293
                             $('#sociopath_queries').html(query);
294 294
                             $('#sociopath_query_area').show();
295 295
                         }
@@ -318,55 +318,55 @@  discard block
 block discarded – undo
318 318
        }); 
319 319
     }
320 320
     function finalVerdict(realm, verdict) {
321
-        var title = <?php echo '"' . _("Diagnostic tests results for selected realm") . '"'; ?>;
321
+        var title = <?php echo '"'._("Diagnostic tests results for selected realm").'"'; ?>;
322 322
         result = '<div class="padding">';
323 323
         result = result + '<div><h3>';
324
-        result = result + <?php echo '"' . _("The result for tested realm:") . ' "'; ?> + realm;
324
+        result = result + <?php echo '"'._("The result for tested realm:").' "'; ?> + realm;
325 325
         result = result + '</h3></p><div style="padding: 5px;"><div style="padding: 0px;">';
326
-        result = result + <?php echo '"' . _("The system identified") . '" '; ?>  + ' ';
326
+        result = result + <?php echo '"'._("The system identified").'" '; ?>  + ' ';
327 327
         result = result + Object.keys(verdict).length + ' ';
328
-        result = result + <?php echo '"' . _("suspected areas which potentially can cause a problem.") . '"'; ?> + '<br>';
329
-        result = result + <?php echo '"' . _("Next to the problem description we show a speculated probability of this event.") . '"'; ?>;
328
+        result = result + <?php echo '"'._("suspected areas which potentially can cause a problem.").'"'; ?> + '<br>';
329
+        result = result + <?php echo '"'._("Next to the problem description we show a speculated probability of this event.").'"'; ?>;
330 330
         result = result + '</div><div style="padding: 5px;"><table>';
331 331
         k = 1;
332 332
         for (key in verdict) {
333 333
             result = result + '<tr><td>' + k + '.</td>';
334 334
             k = k + 1;
335 335
             if (key === 'INFRA_DEVICE') {
336
-                result = result + '<td>' + <?php echo '"' . _("Your device configuration is broken") . '"'; ?> + '</td>';
336
+                result = result + '<td>' + <?php echo '"'._("Your device configuration is broken").'"'; ?> + '</td>';
337 337
             }
338 338
             if (key === 'INFRA_SP_80211') {
339
-                result = result + '<td>' + <?php echo '"' . _("The Wi-Fi network in your vicinity has quality issues") . '"'; ?> + '</td>';
339
+                result = result + '<td>' + <?php echo '"'._("The Wi-Fi network in your vicinity has quality issues").'"'; ?> + '</td>';
340 340
             }
341 341
             if (key === 'INFRA_SP_LAN') {
342
-                result = result + '<td>' + <?php echo '"' . _("The network environment around you is broken") . '"'; ?> + '</td>';
342
+                result = result + '<td>' + <?php echo '"'._("The network environment around you is broken").'"'; ?> + '</td>';
343 343
             }
344 344
             if (key === 'INFRA_SP_RADIUS') {
345
-                result = result + '<td>' + <?php echo '"' . _("The RADIUS server of your service provider is the source of the problem") . '"'; ?> + '</td>';
345
+                result = result + '<td>' + <?php echo '"'._("The RADIUS server of your service provider is the source of the problem").'"'; ?> + '</td>';
346 346
             }
347 347
             if (key === 'INFRA_IDP_AUTHBACKEND') {
348
-                result = result + '<td>' + <?php echo '"' . _("The RADIUS server in your home institution is currently unable to authenticate you") . '"'; ?> + '</td>';
348
+                result = result + '<td>' + <?php echo '"'._("The RADIUS server in your home institution is currently unable to authenticate you").'"'; ?> + '</td>';
349 349
             }
350 350
             if (key === 'INFRA_NRO_SP') {
351
-                result = result + '<td>' + <?php echo '"' . _("The national server in the country/region you are visiting is not functioning correctly") . '"'; ?> + '</td>';
351
+                result = result + '<td>' + <?php echo '"'._("The national server in the country/region you are visiting is not functioning correctly").'"'; ?> + '</td>';
352 352
             }
353 353
             if (key === 'INFRA_LINK_ETLR_NRO_SP') {
354
-                result = result + '<td>' + <?php echo '"' . _("The link between the national server of the country/region you are visiting and the top-level server is broken") . '"'; ?> + '</td>';
354
+                result = result + '<td>' + <?php echo '"'._("The link between the national server of the country/region you are visiting and the top-level server is broken").'"'; ?> + '</td>';
355 355
             }
356 356
             if (key === 'INFRA_LINK_ETLR_NRO_IdP') {
357
-                result = result + '<td>' + <?php echo '"' . _("The link between the national server of your home country/region and the top-level server is broken") . '"'; ?> + '</td>';
357
+                result = result + '<td>' + <?php echo '"'._("The link between the national server of your home country/region and the top-level server is broken").'"'; ?> + '</td>';
358 358
             }
359 359
             if (key === 'INFRA_ETLR') {
360
-                result = result + '<td>' + <?php echo '"' . _("The communication to the top-level server is down") . '"'; ?> + '</td>';
360
+                result = result + '<td>' + <?php echo '"'._("The communication to the top-level server is down").'"'; ?> + '</td>';
361 361
             }
362 362
             if (key === 'INFRA_NRO_IdP') {
363
-                result = result + '<td>' + <?php echo '"' . _("The national server in your home country/region is not functioning properly.") . '"'; ?> + '</td>';
363
+                result = result + '<td>' + <?php echo '"'._("The national server in your home country/region is not functioning properly.").'"'; ?> + '</td>';
364 364
             }
365 365
             if (key === 'INFRA_IdP_RADIUS') {
366
-                result = result + '<td>' + <?php echo '"' . _("The RADIUS server of your home institution is the source of the problem") . '"'; ?> + '</td>';
366
+                result = result + '<td>' + <?php echo '"'._("The RADIUS server of your home institution is the source of the problem").'"'; ?> + '</td>';
367 367
             }
368 368
             if (key === 'INFRA_NONEXISTENTREALM') {
369
-                result = result + '<td>' + <?php echo '"' . _("This realm does not exist") . '"'; ?> + '</td>';
369
+                result = result + '<td>' + <?php echo '"'._("This realm does not exist").'"'; ?> + '</td>';
370 370
             }
371 371
             result = result + '<td style="padding-left: 5px;">' + (verdict[key] * 100).toFixed(2) + "%</td></tr>";
372 372
         }
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
         return false;
473 473
     });
474 474
     $(document).on('change', '#idp_country, #sp_country, #asp_country' , function() {
475
-        var comment = <?php echo '"' . _("Fetching institutions list") . '..."'; ?>;  
475
+        var comment = <?php echo '"'._("Fetching institutions list").'..."'; ?>;  
476 476
         var id = $(this).attr('id');
477 477
         var k = id.indexOf('_');
478 478
         var type = id.substr(0,k);
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
                         var shtml = '';
491 491
                         var select = '';
492 492
                         if (type !== 'asp') {
493
-                            shtml = <?php echo '"<td>' . _("Select institution:") . '</td><td>"'; ?>;
493
+                            shtml = <?php echo '"<td>'._("Select institution:").'</td><td>"'; ?>;
494 494
                         }
495 495
                         select = '<select id="' + type + '_inst" name="' + type + '_inst" style="margin-left:0px; width:400px;"><option value=""></option>';
496 496
                         for (var i in institutions) {
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
             $('#start_test_area').hide();
530 530
             return false;
531 531
         }
532
-        var comment = <?php echo '"' . _("Fetching realms list") . '..."'; ?>;
532
+        var comment = <?php echo '"'._("Fetching realms list").'..."'; ?>;
533 533
         inProgress(1, comment);
534 534
         $.ajax({
535 535
             url: "findRealm.php",
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
                     var realms = data.realms;
542 542
                     var realmselect = '';
543 543
                     if (realms.length > 1) {
544
-                        realmselect = <?php echo '"<td>' . _("Check realm(s):") . '</td>"'; ?>;
544
+                        realmselect = <?php echo '"<td>'._("Check realm(s):").'</td>"'; ?>;
545 545
                         realmselect = realmselect + '<td>' + "<span style='margin-left: 10px'>";
546 546
                         for (var i in realms) {
547 547
                             realmselect = realmselect + '<input type="radio" name="realm" ';
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
                         }
554 554
                         realmselect = realmselect + '</span></td>';
555 555
                     } else {
556
-                        realmselect = <?php echo '"<td>' . _("Realm:") . '</td>"'; ?>;
556
+                        realmselect = <?php echo '"<td>'._("Realm:").'</td>"'; ?>;
557 557
                         realmselect = realmselect + '<td>' + "<span style='margin-left: 10px'>";
558 558
                         realmselect = realmselect + realms[0] + '</span>';
559 559
                         realmselect = realmselect + '<input type="hidden" name="realm" value="' + realms[0] + '">';
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
             });
608 608
             t = 1;
609 609
         }
610
-        var comment = <?php echo '"' . _("Running realm tests") . '..."'; ?>;
610
+        var comment = <?php echo '"'._("Running realm tests").'..."'; ?>;
611 611
         inProgress(1, comment);
612 612
         /*waiting(comment);*/
613 613
         $.ajax({
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
                             }
652 652
                         });
653 653
                         $('#sp_questions > tbody').append('<tr class="error_row"><td>' +
654
-                                <?php echo '"' . _("Realm is not registered with the eduroam database:") . '"'; ?> +
654
+                                <?php echo '"'._("Realm is not registered with the eduroam database:").'"'; ?> +
655 655
                                 '</td><td>' + realm + '</td></tr>');
656 656
                         $('#admin_realm').val('');
657 657
                     }    
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
         testSociopath('', answer);
677 677
     });
678 678
     $('#realmtest').click(function(event){
679
-        var comment = <?php echo '"<br><br>' . _("Running realm tests") . '..."'; ?>;
679
+        var comment = <?php echo '"<br><br>'._("Running realm tests").'..."'; ?>;
680 680
         inProgress(1, comment);
681 681
         $('#start_test_area').hide();
682 682
         if ($('#select_sp_area').is(':hidden')) {
@@ -724,13 +724,13 @@  discard block
 block discarded – undo
724 724
                         console.log('calling testSociopath');
725 725
                         testSociopath(realm, 0);
726 726
                     } else {
727
-                        var title = <?php echo '"' . _("Diagnostics results for selected realms") . '"'; ?>;
728
-                        result = '<div class="padding"><h3>' + <?php echo '"' . _("An unknown problem occured") . '"'; ?>;
727
+                        var title = <?php echo '"'._("Diagnostics results for selected realms").'"'; ?>;
728
+                        result = '<div class="padding"><h3>' + <?php echo '"'._("An unknown problem occured").'"'; ?>;
729 729
                         result = result + '</h3>'
730 730
                         if (r.length == 1) {
731
-                            result = result + <?php echo '"' . _("This test includes checking of the following realm") . '"'; ?>;
731
+                            result = result + <?php echo '"'._("This test includes checking of the following realm").'"'; ?>;
732 732
                         } else {    
733
-                            result = result + <?php echo '"' . _("This test includes checking of the following realms") . '"'; ?>;
733
+                            result = result + <?php echo '"'._("This test includes checking of the following realms").'"'; ?>;
734 734
                         }
735 735
                         result = result + ': '
736 736
                         for (var i=0; i < r.length; i++) {
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
                             result = result + r[i];
741 741
                         }
742 742
                         result = result + '.<br>';
743
-                        result = result + <?php echo '"' . _("You should report this to") . '"'; ?> + ' <a href="mailto:[email protected]">[email protected]</a>';
743
+                        result = result + <?php echo '"'._("You should report this to").'"'; ?> + ' <a href="mailto:[email protected]">[email protected]</a>';
744 744
                         result = result + '</div>';
745 745
                         $('#after_stage_1').hide();
746 746
                         $('#before_stage_1').show();
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
                 });
793 793
             });
794 794
         });
795
-        var comment = <?php echo '"' . _("Running realm tests") . '..."'; ?>;
795
+        var comment = <?php echo '"'._("Running realm tests").'..."'; ?>;
796 796
         inProgress(1, comment);
797 797
         $.ajax({
798 798
             url: "findRealm.php",
@@ -865,29 +865,29 @@  discard block
 block discarded – undo
865 865
             success:function(data) {
866 866
                 if (data.status === 1) {
867 867
                     var result = '';
868
-                    var title = <?php echo '"' . _("eduroam admin report submission") . '"'; ?>;
868
+                    var title = <?php echo '"'._("eduroam admin report submission").'"'; ?>;
869 869
                     result = '<div class="padding">';
870 870
                     if (type == 'idp_send') {
871
-                        result = result + '<h3>'+ <?php echo '"' . _("SP contacting IdP due to technical problems or abuse") . '"'; ?> + '</h3>';
871
+                        result = result + '<h3>'+ <?php echo '"'._("SP contacting IdP due to technical problems or abuse").'"'; ?> + '</h3>';
872 872
                         result = result + '<table>';
873
-                        result = result + '<tr><td>' + <?php echo '"' . _("Reason") . '"'; ?> + '</td><td>' + data.reason + '</td></tr>';
874
-                        result = result + '<tr><td>' + <?php echo '"' . _("SP email") . '"'; ?> + '</td><td>' + data.email + '</td></tr>';
875
-                        result = result + '<tr><td>' + <?php echo '"' . _("IdP email(s)") . '"'; ?> + '</td><td>' + data.idpcontact + '</td></tr>';
876
-                        result = result + '<tr><td>' + <?php echo '"' . _("Event's timestamp") . '"'; ?> + '</td><td>' + data.timestamp + '</td></tr>';
877
-                        result = result + '<tr><td>' + <?php echo '"' . _("Calling-Station-Id") . '"'; ?> + '</td><td>' + data.mac + '</td></tr>';
878
-                        result = result + '<tr><td>' + <?php echo '"' . _("Additional description") . '"'; ?> +'</td><td>' + data.freetext + '</td></tr>';
873
+                        result = result + '<tr><td>' + <?php echo '"'._("Reason").'"'; ?> + '</td><td>' + data.reason + '</td></tr>';
874
+                        result = result + '<tr><td>' + <?php echo '"'._("SP email").'"'; ?> + '</td><td>' + data.email + '</td></tr>';
875
+                        result = result + '<tr><td>' + <?php echo '"'._("IdP email(s)").'"'; ?> + '</td><td>' + data.idpcontact + '</td></tr>';
876
+                        result = result + '<tr><td>' + <?php echo '"'._("Event's timestamp").'"'; ?> + '</td><td>' + data.timestamp + '</td></tr>';
877
+                        result = result + '<tr><td>' + <?php echo '"'._("Calling-Station-Id").'"'; ?> + '</td><td>' + data.mac + '</td></tr>';
878
+                        result = result + '<tr><td>' + <?php echo '"'._("Additional description").'"'; ?> +'</td><td>' + data.freetext + '</td></tr>';
879 879
                     }
880 880
                     if (type == 'sp_send') {
881
-                        result = result + '<h3>'+ <?php echo '"' . _("IdP contacting SP due to technical problems or abuse") . '"'; ?> + '</h3>';
881
+                        result = result + '<h3>'+ <?php echo '"'._("IdP contacting SP due to technical problems or abuse").'"'; ?> + '</h3>';
882 882
                         result = result + '<table>';
883
-                        result = result + '<tr><td>' + <?php echo '"' . _("Reason") . '"'; ?> + '</td><td>' + data.reason + '</td></tr>';
884
-                        result = result + '<tr><td>' + <?php echo '"' . _("SP's Operator-Name") . '"'; ?> + '</td><td>' + data.opname + '</td></tr>';
885
-                        result = result + '<tr><td>' + <?php echo '"' . _("User's outer ID") . '"'; ?> + '</td><td>' + data.outerid + '</td></tr>';
886
-                        result = result + '<tr><td>' + <?php echo '"' . _("IdP email") . '"'; ?> + '</td><td>' + data.email + '</td></tr>';
887
-                        result = result + '<tr><td>' + <?php echo '"' . _("Event's timestamp") . '"'; ?> + '</td><td>' + data.timestamp + '</td></tr>';
888
-                        result = result + '<tr><td>' + <?php echo '"' . _("Calling-Station-Id") . '"'; ?> + '</td><td>' + data.mac + '</td></tr>';
889
-                        result = result + '<tr><td>' + <?php echo '"' . _("Additional description") . '"'; ?> +'</td><td>' + data.freetext + '</td></tr>';
890
-                        result = result + '<tr><td>' + <?php echo '"' . _("How to contact the user") . '"'; ?> +'</td><td>' + data.cdetails + '</td></tr>';
883
+                        result = result + '<tr><td>' + <?php echo '"'._("Reason").'"'; ?> + '</td><td>' + data.reason + '</td></tr>';
884
+                        result = result + '<tr><td>' + <?php echo '"'._("SP's Operator-Name").'"'; ?> + '</td><td>' + data.opname + '</td></tr>';
885
+                        result = result + '<tr><td>' + <?php echo '"'._("User's outer ID").'"'; ?> + '</td><td>' + data.outerid + '</td></tr>';
886
+                        result = result + '<tr><td>' + <?php echo '"'._("IdP email").'"'; ?> + '</td><td>' + data.email + '</td></tr>';
887
+                        result = result + '<tr><td>' + <?php echo '"'._("Event's timestamp").'"'; ?> + '</td><td>' + data.timestamp + '</td></tr>';
888
+                        result = result + '<tr><td>' + <?php echo '"'._("Calling-Station-Id").'"'; ?> + '</td><td>' + data.mac + '</td></tr>';
889
+                        result = result + '<tr><td>' + <?php echo '"'._("Additional description").'"'; ?> +'</td><td>' + data.freetext + '</td></tr>';
890
+                        result = result + '<tr><td>' + <?php echo '"'._("How to contact the user").'"'; ?> +'</td><td>' + data.cdetails + '</td></tr>';
891 891
                     }
892 892
                     result = result + '</div>';
893 893
                     showInfo(result, title);
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
         if ($('#mac').val().length > 0) {
905 905
             if ($('#mac').val().length != 17) {
906 906
                 $('#mac').addClass('error_input');
907
-                $('#mac').attr('title', <?php echo '"' . _("MAC address is incomplete") . '"'; ?>);
907
+                $('#mac').attr('title', <?php echo '"'._("MAC address is incomplete").'"'; ?>);
908 908
             } else {
909 909
                 $('#mac').removeClass('error_input'); 
910 910
                 $('#mac').attr('title', '');
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
         if ($(this).attr('id') == 'email' &&  $(this).val().length > 0) {
914 914
             if (!isEmail($(this).val())) {
915 915
                 $('#email').addClass('error_input');
916
-                $('#email').attr('title', <?php echo '"' . _("Wrong format of email") . '"'; ?>);
916
+                $('#email').attr('title', <?php echo '"'._("Wrong format of email").'"'; ?>);
917 917
             } else {
918 918
                 $('#email').removeClass('error_input');
919 919
                 $('#email').attr('title', '');
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
         if ($(this).attr('id') == 'outer_id' &&  $(this).val().length > 0) {
923 923
             if (!isEmail($(this).val(), true)) {
924 924
                 $('#outer_id').addClass('error_input');
925
-                $('#outer_id').attr('title', <?php echo '"' . _("Wrong format of outer ID") . '"'; ?>);
925
+                $('#outer_id').attr('title', <?php echo '"'._("Wrong format of outer ID").'"'; ?>);
926 926
             } else {
927 927
                 $('#outer_id').removeClass('error_input');
928 928
                 $('#outer_id').attr('title', '');
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
         if ($(this).attr('id') == 'opname' && $('#opname').val().length > 0) {
932 932
             if (!isOperatorName($(this).val())) {
933 933
                 $('#opname').addClass('error_input');
934
-                $('#opname').attr('title', <?php echo '"' . _("Wrong string given as OperatorName") . '"'; ?>);
934
+                $('#opname').attr('title', <?php echo '"'._("Wrong string given as OperatorName").'"'; ?>);
935 935
                 $('#spmanually').show();
936 936
             } else {
937 937
                 $('#opname').removeClass('error_input');
Please login to merge, or discard this patch.
web/admin/API.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  *          <base_url>/copyright.php after deploying the software
21 21
  */
22 22
 
23
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
23
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
24 24
 
25 25
 /**
26 26
  * Checks if the profile is a valid SB profile belonging to the federation
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 $inputRaw = file_get_contents('php://input');
70 70
 $inputDecoded = json_decode($inputRaw, TRUE);
71 71
 if (!is_array($inputDecoded)) {
72
-    $adminApi->returnError(web\lib\admin\API::ERROR_MALFORMED_REQUEST, "Unable to decode JSON POST data." . json_last_error_msg() . $inputRaw);
72
+    $adminApi->returnError(web\lib\admin\API::ERROR_MALFORMED_REQUEST, "Unable to decode JSON POST data.".json_last_error_msg().$inputRaw);
73 73
     exit(1);
74 74
 }
75 75
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             throw new Exception("A required parameter is missing, and this wasn't caught earlier?!");
159 159
         }
160 160
         $newtokens = $mgmt->createTokens(true, [$admin], $idp);
161
-        $URL = "https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/action_enrollment.php?token=" . array_keys($newtokens)[0];
161
+        $URL = "https://".$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME'])."/action_enrollment.php?token=".array_keys($newtokens)[0];
162 162
         $success = ["TOKEN URL" => $URL, "TOKEN" => array_keys($newtokens)[0]];
163 163
         // done with the essentials - display in response. But if we also have an email address, send it there
164 164
         $email = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TARGETMAIL);
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         if ($found) {
196 196
             $adminApi->returnSuccess([]);
197 197
         }
198
-        $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP " . $idp->identifier);
198
+        $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP ".$idp->identifier);
199 199
         break;
200 200
     case web\lib\admin\API::ACTION_STATISTICS_FED:
201 201
         $adminApi->returnSuccess($fed->downloadStats("array"));
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
                 $outer = "";
243 243
                 $profile->setAnonymousIDSupport(FALSE);
244 244
             } else {
245
-                $outer = $outer . "@";
245
+                $outer = $outer."@";
246 246
                 $profile->setAnonymousIDSupport(TRUE);
247 247
             }
248
-            $profile->setRealm($outer . $realm);
248
+            $profile->setRealm($outer.$realm);
249 249
         }
250 250
         /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */
251 251
         $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER);
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
         // extract relevant subset of information from cert objects
474 474
         $certDetails = [];
475 475
         foreach ($certs as $cert) {
476
-            $certDetails[$cert->ca_type . ":" . $cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation];
476
+            $certDetails[$cert->ca_type.":".$cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation];
477 477
         }
478 478
         $adminApi->returnSuccess($certDetails);
479 479
         break;
Please login to merge, or discard this patch.
Switch Indentation   +353 added lines, -353 removed lines patch added patch discarded remove patch
@@ -115,212 +115,212 @@  discard block
 block discarded – undo
115 115
 }
116 116
 
117 117
 switch ($inputDecoded['ACTION']) {
118
-    case web\lib\admin\API::ACTION_NEWINST:
119
-        // create the inst, no admin, no attributes
120
-        $idp = new \core\IdP($fed->newIdP("PENDING", "API"));
121
-        // now add all submitted attributes
122
-        $inputs = $adminApi->uglify($scrubbedParameters);
123
-        $optionParser->processSubmittedFields($idp, $inputs["POST"], $inputs["FILES"]);
124
-        $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_CAT_INST_ID => $idp->identifier]);
125
-        break;
126
-    case web\lib\admin\API::ACTION_DELINST:
127
-        try {
128
-            $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
129
-        } catch (Exception $e) {
130
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
131
-            exit(1);
132
-        }
133
-        $idp->destroy();
134
-        $adminApi->returnSuccess([]);
135
-        break;
136
-    case web\lib\admin\API::ACTION_ADMIN_LIST:
137
-        try {
138
-            $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
139
-        } catch (Exception $e) {
140
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
141
-            exit(1);
142
-        }
143
-        $adminApi->returnSuccess($idp->listOwners());
144
-        break;
145
-    case web\lib\admin\API::ACTION_ADMIN_ADD:
146
-        // IdP in question
147
-        try {
148
-            $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
149
-        } catch (Exception $e) {
150
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
151
-            exit(1);
152
-        }
153
-        // here is the token
154
-        $mgmt = new core\UserManagement();
155
-        // we know we have an admin ID but scrutinizer wants this checked more explicitly
156
-        $admin = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID);
157
-        if ($admin === FALSE) {
158
-            throw new Exception("A required parameter is missing, and this wasn't caught earlier?!");
159
-        }
160
-        $newtokens = $mgmt->createTokens(true, [$admin], $idp);
161
-        $URL = "https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/action_enrollment.php?token=" . array_keys($newtokens)[0];
162
-        $success = ["TOKEN URL" => $URL, "TOKEN" => array_keys($newtokens)[0]];
163
-        // done with the essentials - display in response. But if we also have an email address, send it there
164
-        $email = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TARGETMAIL);
165
-        if ($email !== FALSE) {
166
-            $sent = \core\common\OutsideComm::adminInvitationMail($email, "EXISTING-FED", array_keys($newtokens)[0], $idp->name, $fed);
167
-            $success["EMAIL SENT"] = $sent["SENT"];
168
-            if ($sent["SENT"] === TRUE) {
169
-                $success["EMAIL TRANSPORT SECURE"] = $sent["TRANSPORT"];
170
-            }
171
-        }
172
-        $adminApi->returnSuccess($success);
173
-        break;
174
-    case web\lib\admin\API::ACTION_ADMIN_DEL:
175
-        // IdP in question
176
-        try {
177
-            $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
178
-        } catch (Exception $e) {
179
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
180
-            exit(1);
181
-        }
182
-        $currentAdmins = $idp->listOwners();
183
-        $toBeDeleted = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID);
184
-        if ($toBeDeleted === FALSE) {
185
-            throw new Exception("A required parameter is missing, and this wasn't caught earlier?!");
186
-        }
187
-        $found = FALSE;
188
-        foreach ($currentAdmins as $oneAdmin) {
189
-            if ($oneAdmin['MAIL'] == $toBeDeleted) {
190
-                $found = TRUE;
191
-                $mgmt = new core\UserManagement();
192
-                $mgmt->removeAdminFromIdP($idp, $oneAdmin['ID']);
118
+        case web\lib\admin\API::ACTION_NEWINST:
119
+            // create the inst, no admin, no attributes
120
+            $idp = new \core\IdP($fed->newIdP("PENDING", "API"));
121
+            // now add all submitted attributes
122
+            $inputs = $adminApi->uglify($scrubbedParameters);
123
+            $optionParser->processSubmittedFields($idp, $inputs["POST"], $inputs["FILES"]);
124
+            $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_CAT_INST_ID => $idp->identifier]);
125
+            break;
126
+        case web\lib\admin\API::ACTION_DELINST:
127
+            try {
128
+                $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
129
+            } catch (Exception $e) {
130
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
131
+                exit(1);
193 132
             }
194
-        }
195
-        if ($found) {
133
+            $idp->destroy();
196 134
             $adminApi->returnSuccess([]);
197
-        }
198
-        $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP " . $idp->identifier);
199
-        break;
200
-    case web\lib\admin\API::ACTION_STATISTICS_FED:
201
-        $adminApi->returnSuccess($fed->downloadStats("array"));
202
-        break;
203
-    case \web\lib\admin\API::ACTION_NEWPROF_RADIUS:
204
-    // fall-through intended: both get mostly identical treatment
205
-    case web\lib\admin\API::ACTION_NEWPROF_SB:
206
-        try {
207
-            $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
208
-        } catch (Exception $e) {
209
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
210
-            exit(1);
211
-        }
212
-        if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_RADIUS) {
213
-            $type = "RADIUS";
214
-        } else {
215
-            $type = "SILVERBULLET";
216
-        }
217
-        $profile = $idp->newProfile($type);
218
-        if ($profile === NULL) {
219
-            $adminApi->returnError(\web\lib\admin\API::ERROR_INTERNAL_ERROR, "Unable to create a new Profile, for no apparent reason. Please contact support.");
220
-            exit(1);
221
-        }
222
-        $inputs = $adminApi->uglify($scrubbedParameters);
223
-        $optionParser->processSubmittedFields($profile, $inputs["POST"], $inputs["FILES"]);
224
-        if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_SB) {
225
-            // auto-accept ToU?
226
-            if ($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_TOU) !== FALSE) {
227
-                $profile->addAttribute("hiddenprofile:tou_accepted", NULL, 1);
228
-            }
229
-            // we're done at this point
230
-            $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profile->identifier]);
231
-            continue;
232
-        }
233
-        if (!$profile instanceof core\ProfileRADIUS) {
234
-            throw new Exception("Can't be. This is only here to convince Scrutinizer that we're really talking RADIUS.");
235
-        }
236
-        /* const AUXATTRIB_PROFILE_REALM = 'ATTRIB-PROFILE-REALM';
237
-          const AUXATTRIB_PROFILE_OUTERVALUE = 'ATTRIB-PROFILE-OUTERVALUE'; */
238
-        $realm = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_REALM);
239
-        $outer = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_OUTERVALUE);
240
-        if ($realm !== FALSE) {
241
-            if ($outer === FALSE) {
242
-                $outer = "";
243
-                $profile->setAnonymousIDSupport(FALSE);
135
+            break;
136
+        case web\lib\admin\API::ACTION_ADMIN_LIST:
137
+            try {
138
+                $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
139
+            } catch (Exception $e) {
140
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
141
+                exit(1);
142
+            }
143
+            $adminApi->returnSuccess($idp->listOwners());
144
+            break;
145
+        case web\lib\admin\API::ACTION_ADMIN_ADD:
146
+            // IdP in question
147
+            try {
148
+                $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
149
+            } catch (Exception $e) {
150
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
151
+                exit(1);
152
+            }
153
+            // here is the token
154
+            $mgmt = new core\UserManagement();
155
+            // we know we have an admin ID but scrutinizer wants this checked more explicitly
156
+            $admin = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID);
157
+            if ($admin === FALSE) {
158
+                throw new Exception("A required parameter is missing, and this wasn't caught earlier?!");
159
+            }
160
+            $newtokens = $mgmt->createTokens(true, [$admin], $idp);
161
+            $URL = "https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/action_enrollment.php?token=" . array_keys($newtokens)[0];
162
+            $success = ["TOKEN URL" => $URL, "TOKEN" => array_keys($newtokens)[0]];
163
+            // done with the essentials - display in response. But if we also have an email address, send it there
164
+            $email = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TARGETMAIL);
165
+            if ($email !== FALSE) {
166
+                $sent = \core\common\OutsideComm::adminInvitationMail($email, "EXISTING-FED", array_keys($newtokens)[0], $idp->name, $fed);
167
+                $success["EMAIL SENT"] = $sent["SENT"];
168
+                if ($sent["SENT"] === TRUE) {
169
+                    $success["EMAIL TRANSPORT SECURE"] = $sent["TRANSPORT"];
170
+                }
171
+            }
172
+            $adminApi->returnSuccess($success);
173
+            break;
174
+        case web\lib\admin\API::ACTION_ADMIN_DEL:
175
+            // IdP in question
176
+            try {
177
+                $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
178
+            } catch (Exception $e) {
179
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
180
+                exit(1);
181
+            }
182
+            $currentAdmins = $idp->listOwners();
183
+            $toBeDeleted = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID);
184
+            if ($toBeDeleted === FALSE) {
185
+                throw new Exception("A required parameter is missing, and this wasn't caught earlier?!");
186
+            }
187
+            $found = FALSE;
188
+            foreach ($currentAdmins as $oneAdmin) {
189
+                if ($oneAdmin['MAIL'] == $toBeDeleted) {
190
+                    $found = TRUE;
191
+                    $mgmt = new core\UserManagement();
192
+                    $mgmt->removeAdminFromIdP($idp, $oneAdmin['ID']);
193
+                }
194
+            }
195
+            if ($found) {
196
+                $adminApi->returnSuccess([]);
197
+            }
198
+            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP " . $idp->identifier);
199
+            break;
200
+        case web\lib\admin\API::ACTION_STATISTICS_FED:
201
+            $adminApi->returnSuccess($fed->downloadStats("array"));
202
+            break;
203
+        case \web\lib\admin\API::ACTION_NEWPROF_RADIUS:
204
+        // fall-through intended: both get mostly identical treatment
205
+        case web\lib\admin\API::ACTION_NEWPROF_SB:
206
+            try {
207
+                $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID));
208
+            } catch (Exception $e) {
209
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!");
210
+                exit(1);
211
+            }
212
+            if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_RADIUS) {
213
+                $type = "RADIUS";
244 214
             } else {
245
-                $outer = $outer . "@";
246
-                $profile->setAnonymousIDSupport(TRUE);
215
+                $type = "SILVERBULLET";
247 216
             }
248
-            $profile->setRealm($outer . $realm);
249
-        }
250
-        /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */
251
-        $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER);
252
-        if ($testuser !== FALSE) {
253
-            $profile->setRealmCheckUser(TRUE, $testuser);
254
-        }
255
-        /* const AUXATTRIB_PROFILE_INPUT_HINT = 'ATTRIB-PROFILE-HINTREALM';
217
+            $profile = $idp->newProfile($type);
218
+            if ($profile === NULL) {
219
+                $adminApi->returnError(\web\lib\admin\API::ERROR_INTERNAL_ERROR, "Unable to create a new Profile, for no apparent reason. Please contact support.");
220
+                exit(1);
221
+            }
222
+            $inputs = $adminApi->uglify($scrubbedParameters);
223
+            $optionParser->processSubmittedFields($profile, $inputs["POST"], $inputs["FILES"]);
224
+            if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_SB) {
225
+                // auto-accept ToU?
226
+                if ($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_TOU) !== FALSE) {
227
+                    $profile->addAttribute("hiddenprofile:tou_accepted", NULL, 1);
228
+                }
229
+                // we're done at this point
230
+                $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profile->identifier]);
231
+                continue;
232
+            }
233
+            if (!$profile instanceof core\ProfileRADIUS) {
234
+                throw new Exception("Can't be. This is only here to convince Scrutinizer that we're really talking RADIUS.");
235
+            }
236
+            /* const AUXATTRIB_PROFILE_REALM = 'ATTRIB-PROFILE-REALM';
237
+          const AUXATTRIB_PROFILE_OUTERVALUE = 'ATTRIB-PROFILE-OUTERVALUE'; */
238
+            $realm = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_REALM);
239
+            $outer = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_OUTERVALUE);
240
+            if ($realm !== FALSE) {
241
+                if ($outer === FALSE) {
242
+                    $outer = "";
243
+                    $profile->setAnonymousIDSupport(FALSE);
244
+                } else {
245
+                    $outer = $outer . "@";
246
+                    $profile->setAnonymousIDSupport(TRUE);
247
+                }
248
+                $profile->setRealm($outer . $realm);
249
+            }
250
+            /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */
251
+            $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER);
252
+            if ($testuser !== FALSE) {
253
+                $profile->setRealmCheckUser(TRUE, $testuser);
254
+            }
255
+            /* const AUXATTRIB_PROFILE_INPUT_HINT = 'ATTRIB-PROFILE-HINTREALM';
256 256
           const AUXATTRIB_PROFILE_INPUT_VERIFY = 'ATTRIB-PROFILE-VERIFYREALM'; */
257
-        $hint = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_HINT);
258
-        $enforce = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_VERIFY);
259
-        if ($enforce !== FALSE) {
260
-            $profile->setInputVerificationPreference($enforce, $hint);
261
-        }
262
-        /* const AUXATTRIB_PROFILE_EAPTYPE */
263
-        $iterator = 1;
264
-        foreach ($scrubbedParameters as $oneParam) {
265
-            if ($oneParam['NAME'] == web\lib\admin\API::AUXATTRIB_PROFILE_EAPTYPE && is_int($oneParam["VALUE"])) {
266
-                $type = new \core\common\EAP($oneParam["VALUE"]);
267
-                $profile->addSupportedEapMethod($type, $iterator);
268
-                $iterator = $iterator + 1;
257
+            $hint = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_HINT);
258
+            $enforce = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_VERIFY);
259
+            if ($enforce !== FALSE) {
260
+                $profile->setInputVerificationPreference($enforce, $hint);
269 261
             }
270
-        }
271
-        // reinstantiate $profile freshly from DB - it was updated in the process
272
-        $profileFresh = new core\ProfileRADIUS($profile->identifier);
273
-        $profileFresh->prepShowtime();
274
-        $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profileFresh->identifier]);
275
-        break;
276
-    case web\lib\admin\API::ACTION_ENDUSER_NEW:
277
-        $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
278
-        if ($prof_id === FALSE) {
279
-            exit(1);
280
-        }
281
-        $evaluation = commonSbProfileChecks($fed, $prof_id);
282
-        if ($evaluation === FALSE) {
283
-            exit(1);
284
-        }
285
-        list($idp, $profile) = $evaluation;
286
-        $user = $validator->string($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME));
287
-        $expiryRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_EXPIRY);
288
-        if ($expiryRaw === FALSE) {
289
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The expiry date wasn't found in the request.");
290
-            exit(1);
291
-        }
292
-        $expiry = new DateTime($expiryRaw);
293
-        try {
294
-            $retval = $profile->addUser($user, $expiry);
295
-        } catch (Exception $e) {
296
-            $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed. Maybe a duplicate username, or malformed expiry date?");
297
-            exit(1);
298
-        }
299
-        if ($retval == 0) {// that didn't work, it seems
300
-            $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed subtly. Contact the administrators.");
301
-            exit(1);
302
-        }
303
-        $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_SB_USERNAME => $user, \web\lib\admin\API::AUXATTRIB_SB_USERID => $retval]);
304
-        break;
305
-    case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE:
306
-    // fall-through intended: both actions are very similar
307
-    case \web\lib\admin\API::ACTION_TOKEN_NEW:
308
-        $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
309
-        if ($profile_id === FALSE) {
310
-            exit(1);
311
-        }
312
-        $evaluation = commonSbProfileChecks($fed, $profile_id);
313
-        if ($evaluation === FALSE) {
314
-            exit(1);
315
-        }
316
-        list($idp, $profile) = $evaluation;
317
-        $userId = $validator->integer($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID));
318
-        if ($userId === FALSE) {
319
-            $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "User ID is not an integer.");
320
-            exit(1);
321
-        }
322
-        $additionalInfo = [];
323
-        switch ($inputDecoded['ACTION']) { // this is where the two differ
262
+            /* const AUXATTRIB_PROFILE_EAPTYPE */
263
+            $iterator = 1;
264
+            foreach ($scrubbedParameters as $oneParam) {
265
+                if ($oneParam['NAME'] == web\lib\admin\API::AUXATTRIB_PROFILE_EAPTYPE && is_int($oneParam["VALUE"])) {
266
+                    $type = new \core\common\EAP($oneParam["VALUE"]);
267
+                    $profile->addSupportedEapMethod($type, $iterator);
268
+                    $iterator = $iterator + 1;
269
+                }
270
+            }
271
+            // reinstantiate $profile freshly from DB - it was updated in the process
272
+            $profileFresh = new core\ProfileRADIUS($profile->identifier);
273
+            $profileFresh->prepShowtime();
274
+            $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profileFresh->identifier]);
275
+            break;
276
+        case web\lib\admin\API::ACTION_ENDUSER_NEW:
277
+            $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
278
+            if ($prof_id === FALSE) {
279
+                exit(1);
280
+            }
281
+            $evaluation = commonSbProfileChecks($fed, $prof_id);
282
+            if ($evaluation === FALSE) {
283
+                exit(1);
284
+            }
285
+            list($idp, $profile) = $evaluation;
286
+            $user = $validator->string($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME));
287
+            $expiryRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_EXPIRY);
288
+            if ($expiryRaw === FALSE) {
289
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The expiry date wasn't found in the request.");
290
+                exit(1);
291
+            }
292
+            $expiry = new DateTime($expiryRaw);
293
+            try {
294
+                $retval = $profile->addUser($user, $expiry);
295
+            } catch (Exception $e) {
296
+                $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed. Maybe a duplicate username, or malformed expiry date?");
297
+                exit(1);
298
+            }
299
+            if ($retval == 0) {// that didn't work, it seems
300
+                $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed subtly. Contact the administrators.");
301
+                exit(1);
302
+            }
303
+            $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_SB_USERNAME => $user, \web\lib\admin\API::AUXATTRIB_SB_USERID => $retval]);
304
+            break;
305
+        case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE:
306
+        // fall-through intended: both actions are very similar
307
+        case \web\lib\admin\API::ACTION_TOKEN_NEW:
308
+            $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
309
+            if ($profile_id === FALSE) {
310
+                exit(1);
311
+            }
312
+            $evaluation = commonSbProfileChecks($fed, $profile_id);
313
+            if ($evaluation === FALSE) {
314
+                exit(1);
315
+            }
316
+            list($idp, $profile) = $evaluation;
317
+            $userId = $validator->integer($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID));
318
+            if ($userId === FALSE) {
319
+                $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "User ID is not an integer.");
320
+                exit(1);
321
+            }
322
+            $additionalInfo = [];
323
+            switch ($inputDecoded['ACTION']) { // this is where the two differ
324 324
             case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE:
325 325
                 $result = $profile->deactivateUser($userId);
326 326
                 break;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
                     }
354 354
                 }
355 355
                 break;
356
-        }
356
+            }
357 357
 
358 358
         if ($result !== TRUE) {
359 359
             $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "These parameters did not lead to an existing, active user.");
@@ -361,65 +361,65 @@  discard block
 block discarded – undo
361 361
         }
362 362
         $adminApi->returnSuccess($additionalInfo);
363 363
         break;
364
-    case \web\lib\admin\API::ACTION_ENDUSER_IDENTIFY:
365
-        $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
366
-        if ($profile_id === FALSE) {
367
-            exit(1);
368
-        }
369
-        $evaluation = commonSbProfileChecks($fed, $profile_id);
370
-        if ($evaluation === FALSE) {
371
-            exit(1);
372
-        }
373
-        list($idp, $profile) = $evaluation;
374
-        $userId = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID);
375
-        $userName = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME);
376
-        $certSerial = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
377
-        if ($userId === FALSE && $userName === FALSE && $certSerial === FALSE) {
378
-            // we need at least one of those
379
-            $adminApi->returnError(\web\lib\admin\API::ERROR_MISSING_PARAMETER, "At least one of User ID, Username, or certificate serial is required.");
380
-        }
381
-        $userlist = $profile->listAllUsers();
382
-        if ($userName === FALSE && $certSerial === FALSE) { // we got a user ID
383
-            if (!isset($userlist[$userId])) {
384
-                return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This user ID does not exist in this profile.");
364
+        case \web\lib\admin\API::ACTION_ENDUSER_IDENTIFY:
365
+            $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
366
+            if ($profile_id === FALSE) {
367
+                exit(1);
385 368
             }
386
-            $adminApi->returnSuccess([$userId => $userlist[$userId]]);
387
-        }
388
-        if ($userId === FALSE && $certSerial === FALSE) { // we got a username
389
-            $key = array_search($userName, $userlist);
390
-            if ($key === FALSE) {
391
-                return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This username does not exist in this profile.");
369
+            $evaluation = commonSbProfileChecks($fed, $profile_id);
370
+            if ($evaluation === FALSE) {
371
+                exit(1);
392 372
             }
393
-            $adminApi->returnSuccess([$key => $userlist[$key]]);
394
-        }
395
-        if ($userId === FALSE && $userName === FALSE) { // we got a cert serial
396
-            $serial = explode(":", $certSerial);
397
-            $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
398
-            if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
399
-                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
373
+            list($idp, $profile) = $evaluation;
374
+            $userId = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID);
375
+            $userName = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME);
376
+            $certSerial = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
377
+            if ($userId === FALSE && $userName === FALSE && $certSerial === FALSE) {
378
+                // we need at least one of those
379
+                $adminApi->returnError(\web\lib\admin\API::ERROR_MISSING_PARAMETER, "At least one of User ID, Username, or certificate serial is required.");
400 380
             }
401
-            if ($cert->profileId != $profile->identifier) {
402
-                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
381
+            $userlist = $profile->listAllUsers();
382
+            if ($userName === FALSE && $certSerial === FALSE) { // we got a user ID
383
+                if (!isset($userlist[$userId])) {
384
+                    return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This user ID does not exist in this profile.");
385
+                }
386
+                $adminApi->returnSuccess([$userId => $userlist[$userId]]);
403 387
             }
404
-            $adminApi->returnSuccess([$cert->userId => $userlist[$cert->userId]]);
405
-        }
406
-        $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "Only exactly one of User ID, username or cert serial can be specified.");
407
-        break;
408
-    case \web\lib\admin\API::ACTION_ENDUSER_LIST:
409
-    // fall-through: those two are similar
410
-    case \web\lib\admin\API::ACTION_TOKEN_LIST:
411
-        $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
412
-        if ($profile_id === FALSE) {
413
-            exit(1);
414
-        }
415
-        $evaluation = commonSbProfileChecks($fed, $profile_id);
416
-        if ($evaluation === FALSE) {
417
-            exit(1);
418
-        }
419
-        list($idp, $profile) = $evaluation;
420
-        $allUsers = $profile->listAllUsers();
421
-        // this is where they differ
422
-        switch ($inputDecoded['ACTION']) {
388
+            if ($userId === FALSE && $certSerial === FALSE) { // we got a username
389
+                $key = array_search($userName, $userlist);
390
+                if ($key === FALSE) {
391
+                    return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This username does not exist in this profile.");
392
+                }
393
+                $adminApi->returnSuccess([$key => $userlist[$key]]);
394
+            }
395
+            if ($userId === FALSE && $userName === FALSE) { // we got a cert serial
396
+                $serial = explode(":", $certSerial);
397
+                $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
398
+                if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
399
+                    $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
400
+                }
401
+                if ($cert->profileId != $profile->identifier) {
402
+                    $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
403
+                }
404
+                $adminApi->returnSuccess([$cert->userId => $userlist[$cert->userId]]);
405
+            }
406
+            $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "Only exactly one of User ID, username or cert serial can be specified.");
407
+            break;
408
+        case \web\lib\admin\API::ACTION_ENDUSER_LIST:
409
+        // fall-through: those two are similar
410
+        case \web\lib\admin\API::ACTION_TOKEN_LIST:
411
+            $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
412
+            if ($profile_id === FALSE) {
413
+                exit(1);
414
+            }
415
+            $evaluation = commonSbProfileChecks($fed, $profile_id);
416
+            if ($evaluation === FALSE) {
417
+                exit(1);
418
+            }
419
+            list($idp, $profile) = $evaluation;
420
+            $allUsers = $profile->listAllUsers();
421
+            // this is where they differ
422
+            switch ($inputDecoded['ACTION']) {
423 423
             case \web\lib\admin\API::ACTION_ENDUSER_LIST:
424 424
                 $adminApi->returnSuccess($allUsers);
425 425
                 break;
@@ -438,105 +438,105 @@  discard block
 block discarded – undo
438 438
                     $infoSet[$oneTokenObject->userId] = [\web\lib\admin\API::AUXATTRIB_TOKEN => $oneTokenObject->invitationTokenString, "STATUS" => $oneTokenObject->invitationTokenStatus];
439 439
                 }
440 440
                 $adminApi->returnSuccess($infoSet);
441
-        }
442
-        break;
443
-    case \web\lib\admin\API::ACTION_TOKEN_REVOKE:
444
-        $tokenRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TOKEN);
445
-        if ($tokenRaw === FALSE) {
446
-            exit(1);
447
-        }
448
-        $token = new core\SilverbulletInvitation($tokenRaw);
449
-        if ($token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_VALID && $token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_PARTIALLY_REDEEMED) {
450
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "This is not a currently valid token.");
451
-            exit(1);
452
-        }
453
-        $token->revokeInvitation();
454
-        $adminApi->returnSuccess([]);
455
-        break;
456
-    case \web\lib\admin\API::ACTION_CERT_LIST:
457
-        $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
458
-        $user_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID);
459
-        if ($prof_id === FALSE || !is_int($user_id)) {
460
-            exit(1);
461
-        }
462
-        $evaluation = commonSbProfileChecks($fed, $prof_id);
463
-        if ($evaluation === FALSE) {
464
-            exit(1);
465
-        }
466
-        list($idp, $profile) = $evaluation;
467
-        $invitations = $profile->userStatus($user_id);
468
-        // now pull out cert information from the object
469
-        $certs = [];
470
-        foreach ($invitations as $oneInvitation) {
471
-            $certs = array_merge($certs, $oneInvitation->associatedCertificates);
472
-        }
473
-        // extract relevant subset of information from cert objects
474
-        $certDetails = [];
475
-        foreach ($certs as $cert) {
476
-            $certDetails[$cert->ca_type . ":" . $cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation];
477
-        }
478
-        $adminApi->returnSuccess($certDetails);
479
-        break;
480
-    case \web\lib\admin\API::ACTION_CERT_REVOKE:
481
-        $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
482
-        if ($prof_id === FALSE) {
483
-            exit(1);
484
-        }
485
-        $evaluation = commonSbProfileChecks($fed, $prof_id);
486
-        if ($evaluation === FALSE) {
487
-            exit(1);
488
-        }
489
-        list($idp, $profile) = $evaluation;
490
-        // tear apart the serial
491
-        $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
492
-        if ($serialRaw === FALSE) {
493
-            exit(1);
494
-        }
495
-        $serial = explode(":", $serialRaw);
496
-        $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
497
-        if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
498
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
499
-        }
500
-        if ($cert->profileId != $profile->identifier) {
501
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
502
-        }
503
-        $cert->revokeCertificate();
504
-        $adminApi->returnSuccess([]);
441
+            }
505 442
         break;
506
-    case \web\lib\admin\API::ACTION_CERT_ANNOTATE:
507
-        $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
508
-        if ($prof_id === FALSE) {
509
-            exit(1);
510
-        }
511
-        $evaluation = commonSbProfileChecks($fed, $prof_id);
512
-        if ($evaluation === FALSE) {
513
-            exit(1);
514
-        }
515
-        list($idp, $profile) = $evaluation;
516
-        // tear apart the serial
517
-        $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
518
-        if ($serialRaw === FALSE) {
519
-            exit(1);
520
-        }
521
-        $serial = explode(":", $serialRaw);
522
-        $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
523
-        if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
524
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
525
-        }
526
-        if ($cert->profileId != $profile->identifier) {
527
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
528
-        }
529
-        $annotationRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTANNOTATION);
530
-        if ($annotationRaw === FALSE) {
531
-            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Unable to extract annotation.");
443
+        case \web\lib\admin\API::ACTION_TOKEN_REVOKE:
444
+            $tokenRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TOKEN);
445
+            if ($tokenRaw === FALSE) {
446
+                exit(1);
447
+            }
448
+            $token = new core\SilverbulletInvitation($tokenRaw);
449
+            if ($token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_VALID && $token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_PARTIALLY_REDEEMED) {
450
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "This is not a currently valid token.");
451
+                exit(1);
452
+            }
453
+            $token->revokeInvitation();
454
+            $adminApi->returnSuccess([]);
532 455
             break;
533
-        }
534
-        $annotation = json_decode($annotationRaw, TRUE);
535
-        $cert->annotate($annotation);
536
-        $adminApi->returnSuccess([]);
456
+        case \web\lib\admin\API::ACTION_CERT_LIST:
457
+            $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
458
+            $user_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID);
459
+            if ($prof_id === FALSE || !is_int($user_id)) {
460
+                exit(1);
461
+            }
462
+            $evaluation = commonSbProfileChecks($fed, $prof_id);
463
+            if ($evaluation === FALSE) {
464
+                exit(1);
465
+            }
466
+            list($idp, $profile) = $evaluation;
467
+            $invitations = $profile->userStatus($user_id);
468
+            // now pull out cert information from the object
469
+            $certs = [];
470
+            foreach ($invitations as $oneInvitation) {
471
+                $certs = array_merge($certs, $oneInvitation->associatedCertificates);
472
+            }
473
+            // extract relevant subset of information from cert objects
474
+            $certDetails = [];
475
+            foreach ($certs as $cert) {
476
+                $certDetails[$cert->ca_type . ":" . $cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation];
477
+            }
478
+            $adminApi->returnSuccess($certDetails);
479
+            break;
480
+        case \web\lib\admin\API::ACTION_CERT_REVOKE:
481
+            $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
482
+            if ($prof_id === FALSE) {
483
+                exit(1);
484
+            }
485
+            $evaluation = commonSbProfileChecks($fed, $prof_id);
486
+            if ($evaluation === FALSE) {
487
+                exit(1);
488
+            }
489
+            list($idp, $profile) = $evaluation;
490
+            // tear apart the serial
491
+            $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
492
+            if ($serialRaw === FALSE) {
493
+                exit(1);
494
+            }
495
+            $serial = explode(":", $serialRaw);
496
+            $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
497
+            if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
498
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
499
+            }
500
+            if ($cert->profileId != $profile->identifier) {
501
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
502
+            }
503
+            $cert->revokeCertificate();
504
+            $adminApi->returnSuccess([]);
505
+            break;
506
+        case \web\lib\admin\API::ACTION_CERT_ANNOTATE:
507
+            $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID);
508
+            if ($prof_id === FALSE) {
509
+                exit(1);
510
+            }
511
+            $evaluation = commonSbProfileChecks($fed, $prof_id);
512
+            if ($evaluation === FALSE) {
513
+                exit(1);
514
+            }
515
+            list($idp, $profile) = $evaluation;
516
+            // tear apart the serial
517
+            $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL);
518
+            if ($serialRaw === FALSE) {
519
+                exit(1);
520
+            }
521
+            $serial = explode(":", $serialRaw);
522
+            $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]);
523
+            if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) {
524
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found.");
525
+            }
526
+            if ($cert->profileId != $profile->identifier) {
527
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile.");
528
+            }
529
+            $annotationRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTANNOTATION);
530
+            if ($annotationRaw === FALSE) {
531
+                $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Unable to extract annotation.");
532
+                break;
533
+            }
534
+            $annotation = json_decode($annotationRaw, TRUE);
535
+            $cert->annotate($annotation);
536
+            $adminApi->returnSuccess([]);
537 537
         
538
-        break;
538
+            break;
539 539
         
540
-    default:
541
-        $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_ACTION, "Not implemented yet.");
540
+        default:
541
+            $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_ACTION, "Not implemented yet.");
542 542
 }
543 543
\ No newline at end of file
Please login to merge, or discard this patch.
core/diag/Sociopath.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -67,45 +67,45 @@
 block discarded – undo
67 67
         // let's start the numbering at 1
68 68
         $this->qaArray = [
69 69
             1 => ["AREA" => AbstractTest::INFRA_DEVICE,
70
-                  "TXT" => _("Have you ever used the network succesfully, e.g. at your home institution without roaming?"),
71
-                  "FACTOR_YES" => 0.8, // that's good, but it doesn't mean strikingly much
72
-                  "FACTOR_NO" => 2, // that's bad, and points strongly to a config on this end
73
-                  "VERDICTLECTURE" => sprintf(_("If your device has never worked before with this setup, then very likely your device configuation is wrong. %s"), $confAssistantText)],
70
+                    "TXT" => _("Have you ever used the network succesfully, e.g. at your home institution without roaming?"),
71
+                    "FACTOR_YES" => 0.8, // that's good, but it doesn't mean strikingly much
72
+                    "FACTOR_NO" => 2, // that's bad, and points strongly to a config on this end
73
+                    "VERDICTLECTURE" => sprintf(_("If your device has never worked before with this setup, then very likely your device configuation is wrong. %s"), $confAssistantText)],
74 74
             2 => ["AREA" => AbstractTest::INFRA_DEVICE, 
75
-                  "TXT" => _("Did the device previously work when roaming, i.e. at other hotspots away from your home institution?"), 
76
-                  "FACTOR_YES" => 0.6, // that's good, and somewhat encouraging
77
-                  "FACTOR_NO" => 3, // that is almost a smoking gun
78
-                  "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at your home organisation, but can not be used when roaming. %s"),$confAssistantText)],
75
+                    "TXT" => _("Did the device previously work when roaming, i.e. at other hotspots away from your home institution?"), 
76
+                    "FACTOR_YES" => 0.6, // that's good, and somewhat encouraging
77
+                    "FACTOR_NO" => 3, // that is almost a smoking gun
78
+                    "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at your home organisation, but can not be used when roaming. %s"),$confAssistantText)],
79 79
             3 => ["AREA" => AbstractTest::INFRA_DEVICE, 
80
-                  "TXT" => _("Did you recently change the configuration on your device?"), 
81
-                  "FACTOR_YES" => 3, // that is almost a smoking gun
82
-                  "FACTOR_NO" => 0.6, // encouraging
83
-                  "VERDICTLECTURE" => _("Accounts only need to be configured once, and can then be used anywhere on the planet without any changes. If you recently changed the configuration, that change may very well be at fault. You should never change your network configuration unless explicitly instructed so by your Identity Provider; even in the case of temporary login issues.")],
80
+                    "TXT" => _("Did you recently change the configuration on your device?"), 
81
+                    "FACTOR_YES" => 3, // that is almost a smoking gun
82
+                    "FACTOR_NO" => 0.6, // encouraging
83
+                    "VERDICTLECTURE" => _("Accounts only need to be configured once, and can then be used anywhere on the planet without any changes. If you recently changed the configuration, that change may very well be at fault. You should never change your network configuration unless explicitly instructed so by your Identity Provider; even in the case of temporary login issues.")],
84 84
             4 => ["AREA" => AbstractTest::INFRA_DEVICE, 
85
-                  "TXT" => _("Did you recently change your password?"), 
86
-                  "FACTOR_YES" => 1.5, // that doesn't mean it is the source of the problem, but it /might/ be that the user forgot to provide the new password
87
-                  "FACTOR_NO" => 0.6, // encouraging
88
-                  "VERDICTLECTURE" => _("When you change your password, you also need to supply the new password in the device configuration.")],
85
+                    "TXT" => _("Did you recently change your password?"), 
86
+                    "FACTOR_YES" => 1.5, // that doesn't mean it is the source of the problem, but it /might/ be that the user forgot to provide the new password
87
+                    "FACTOR_NO" => 0.6, // encouraging
88
+                    "VERDICTLECTURE" => _("When you change your password, you also need to supply the new password in the device configuration.")],
89 89
             5 => ["AREA" => AbstractTest::INFRA_DEVICE, 
90
-                  "TXT" => _("If you use more than one device: do your other devices still work?"),
91
-                  "FACTOR_YES" => 0.33, // seems that all is okay with the account as such
92
-                  "FACTOR_NO" => 3, // now that is suspicious indeed
93
-                  "VERDICTLECTURE" => _("If all devices stopped working simultaneously, there may be a problem with your account as such. Maybe your account expired, or you were forced to change the password? These questions are best answered by your Identity Provider [MGW: display contact info]"),],
90
+                    "TXT" => _("If you use more than one device: do your other devices still work?"),
91
+                    "FACTOR_YES" => 0.33, // seems that all is okay with the account as such
92
+                    "FACTOR_NO" => 3, // now that is suspicious indeed
93
+                    "VERDICTLECTURE" => _("If all devices stopped working simultaneously, there may be a problem with your account as such. Maybe your account expired, or you were forced to change the password? These questions are best answered by your Identity Provider [MGW: display contact info]"),],
94 94
             6 => ["AREA" => AbstractTest::INFRA_SP_80211, 
95
-                  "TXT" => _("Is the place you are currently at heavily crowded, or is a network-intensive workload going on?"), 
96
-                  "FACTOR_YES" => 3,
97
-                  "FACTOR_NO" => 0.33,
98
-                  "VERDICTLECTURE" => _("The network is likely overloaded at this location and point in time. You may have to wait until later before you get a better connectivity. If you think the network should be reinforced for more capacity at this place, you should inform the hotspot provider. [MGW: add contact info]")],            
95
+                    "TXT" => _("Is the place you are currently at heavily crowded, or is a network-intensive workload going on?"), 
96
+                    "FACTOR_YES" => 3,
97
+                    "FACTOR_NO" => 0.33,
98
+                    "VERDICTLECTURE" => _("The network is likely overloaded at this location and point in time. You may have to wait until later before you get a better connectivity. If you think the network should be reinforced for more capacity at this place, you should inform the hotspot provider. [MGW: add contact info]")],            
99 99
             7 => ["AREA" => AbstractTest::INFRA_SP_80211, 
100
-                  "TXT" => _("Does the connection get better when you move around?"), 
101
-                  "FACTOR_YES" => 3,
102
-                  "FACTOR_NO" => 0.33,
103
-                  "VERDICTLECTURE" => _("You should move to a different location to achieve better network coverage and service. If you think the exact spot you are at deserves better coverage, you should inform the hotspot provider. [MGW: add contact info]")],
100
+                    "TXT" => _("Does the connection get better when you move around?"), 
101
+                    "FACTOR_YES" => 3,
102
+                    "FACTOR_NO" => 0.33,
103
+                    "VERDICTLECTURE" => _("You should move to a different location to achieve better network coverage and service. If you think the exact spot you are at deserves better coverage, you should inform the hotspot provider. [MGW: add contact info]")],
104 104
             8 => ["AREA" => AbstractTest::INFRA_SP_LAN, 
105
-                  "TXT" => _("Do you see errors stating something similar to 'Unable to get IP address'?"), 
106
-                  "FACTOR_YES" => 5, // gotcha
107
-                  "FACTOR_YES" => 0.5, // the user saying no is not conclusive; maybe the device isn't that verbose or he's not looking at the right spot
108
-                  "VERDICTLECTURE" => _("The evidence at hand suggests that there may be an infrastructure problem at this particular hotspot provider. There is nothing you can do to solve this problem locally. Please be patient and try again at a later time.")],
105
+                    "TXT" => _("Do you see errors stating something similar to 'Unable to get IP address'?"), 
106
+                    "FACTOR_YES" => 5, // gotcha
107
+                    "FACTOR_YES" => 0.5, // the user saying no is not conclusive; maybe the device isn't that verbose or he's not looking at the right spot
108
+                    "VERDICTLECTURE" => _("The evidence at hand suggests that there may be an infrastructure problem at this particular hotspot provider. There is nothing you can do to solve this problem locally. Please be patient and try again at a later time.")],
109 109
         ];
110 110
         \core\common\Entity::outOfThePotatoes();
111 111
     }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
 use \Exception;
25 25
 
26
-require_once dirname(dirname(__DIR__)) . "/config/_config.php";
26
+require_once dirname(dirname(__DIR__))."/config/_config.php";
27 27
 
28 28
 /**
29 29
  * This class talks to end users, asking them annoying questions to get to the
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                   "TXT" => _("Did the device previously work when roaming, i.e. at other hotspots away from your home institution?"), 
76 76
                   "FACTOR_YES" => 0.6, // that's good, and somewhat encouraging
77 77
                   "FACTOR_NO" => 3, // that is almost a smoking gun
78
-                  "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at your home organisation, but can not be used when roaming. %s"),$confAssistantText)],
78
+                  "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at your home organisation, but can not be used when roaming. %s"), $confAssistantText)],
79 79
             3 => ["AREA" => AbstractTest::INFRA_DEVICE, 
80 80
                   "TXT" => _("Did you recently change the configuration on your device?"), 
81 81
                   "FACTOR_YES" => 3, // that is almost a smoking gun
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                   "TXT" => _("If you use more than one device: do your other devices still work?"),
91 91
                   "FACTOR_YES" => 0.33, // seems that all is okay with the account as such
92 92
                   "FACTOR_NO" => 3, // now that is suspicious indeed
93
-                  "VERDICTLECTURE" => _("If all devices stopped working simultaneously, there may be a problem with your account as such. Maybe your account expired, or you were forced to change the password? These questions are best answered by your Identity Provider [MGW: display contact info]"),],
93
+                  "VERDICTLECTURE" => _("If all devices stopped working simultaneously, there may be a problem with your account as such. Maybe your account expired, or you were forced to change the password? These questions are best answered by your Identity Provider [MGW: display contact info]"), ],
94 94
             6 => ["AREA" => AbstractTest::INFRA_SP_80211, 
95 95
                   "TXT" => _("Is the place you are currently at heavily crowded, or is a network-intensive workload going on?"), 
96 96
                   "FACTOR_YES" => 3,
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
         $questionDetails = $this->qaArray[$questionNumber];
125 125
         if ($answer === TRUE) {
126 126
             $this->possibleFailureReasons[$questionDetails['AREA']] = $this->possibleFailureReasons[$questionDetails['AREA']] * $questionDetails["FACTOR_YES"];
127
-            $this->loggerInstance->debug(3,"Adjusting ".$questionDetails['AREA']." by ".$questionDetails["FACTOR_YES"]."\n");
127
+            $this->loggerInstance->debug(3, "Adjusting ".$questionDetails['AREA']." by ".$questionDetails["FACTOR_YES"]."\n");
128 128
             $factor = $questionDetails["FACTOR_YES"];
129 129
         } elseif ($answer === FALSE) {
130 130
             $this->possibleFailureReasons[$questionDetails['AREA']] = $this->possibleFailureReasons[$questionDetails['AREA']] * $questionDetails["FACTOR_NO"];
131
-            $this->loggerInstance->debug(3,"Adjusting ".$questionDetails['AREA']." by ".$questionDetails["FACTOR_NO"]."\n");
131
+            $this->loggerInstance->debug(3, "Adjusting ".$questionDetails['AREA']." by ".$questionDetails["FACTOR_NO"]."\n");
132 132
             $factor = $questionDetails["FACTOR_NO"];
133 133
         } else {
134 134
             $factor = 1;
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
         $this->additionalFindings["QUESTIONSASKED"] = $this->previousQuestions;
139 139
         $_SESSION["SUSPECTS"] = $this->possibleFailureReasons;
140 140
         $_SESSION["EVIDENCE"] = $this->additionalFindings;
141
-        $this->loggerInstance->debug(3,$_SESSION['SUSPECTS']);
142
-        $this->loggerInstance->debug(3,$_SESSION['EVIDENCE']);
141
+        $this->loggerInstance->debug(3, $_SESSION['SUSPECTS']);
142
+        $this->loggerInstance->debug(3, $_SESSION['EVIDENCE']);
143 143
     }
144 144
     
145 145
     /**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         // if both are identical, take any of the questions in the pool of both
159 159
         foreach ($this->qaArray as $questionNumber => $questionDetails) {
160 160
             // if we find a question we didn't ask before AND it is related to our currently high-scoring problem area, ask it
161
-            if (!array_key_exists($questionNumber, $this->previousQuestions) && ( $questionDetails["AREA"] == $highestCategory || $questionDetails["AREA"] == $nextCategory) ) {
161
+            if (!array_key_exists($questionNumber, $this->previousQuestions) && ($questionDetails["AREA"] == $highestCategory || $questionDetails["AREA"] == $nextCategory)) {
162 162
                 return json_encode(["NEXTEXISTS" => TRUE, "NUMBER" => $questionNumber, "TEXT" => $questionDetails["TXT"]]);
163 163
             }
164 164
         }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      * @return string JSON encoded array with all the info we have
172 172
      */
173 173
     public function getCurrentGuessState() {
174
-        return json_encode([ "SUSPECTS" => $this->possibleFailureReasons, "EVIDENCE" => $this->additionalFindings ]);
174
+        return json_encode(["SUSPECTS" => $this->possibleFailureReasons, "EVIDENCE" => $this->additionalFindings]);
175 175
     }
176 176
     
177 177
     /**
Please login to merge, or discard this patch.