Test Setup Failed
Push — master ( 97cc44...b1b146 )
by Stefan
19:54
created
web/lib/admin/OptionDisplay.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     public function prefilledOptionTable(string $attributePrefix, $fed)
114 114
     {
115
-        $retval = "<table id='expandable_$attributePrefix" . "_options'>";
115
+        $retval = "<table id='expandable_$attributePrefix"."_options'>";
116 116
 
117 117
         $prepopulate = [];
118 118
         foreach ($this->listOfOptions as $existingAttribute) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                 $prepopulate[] = $existingAttribute;
121 121
             }
122 122
         }
123
-        if (is_array($prepopulate) && ( count($prepopulate) > 0 || $attributePrefix == "device-specific" || $attributePrefix == "eap-specific" )) { // editing... fill with values
123
+        if (is_array($prepopulate) && (count($prepopulate) > 0 || $attributePrefix == "device-specific" || $attributePrefix == "eap-specific")) { // editing... fill with values
124 124
             $retval .= $this->addOptionEdit($attributePrefix, $prepopulate);
125 125
         } else {
126 126
             $retval .= $this->addOptionNew($attributePrefix, $fed);
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 $optiontypearray = $optioninfo->optionType($option['name']);
154 154
                 $loggerInstance = new \core\common\Logging();
155 155
                 $loggerInstance->debug(5, "About to execute optiontext with PREFILL!\n");
156
-                $retval .= $this->optiontext([$option['name']], ($optiontypearray["type"] == "file" ? 'ROWID-' . $option['level'] . '-' . $option['row'] : $option['value']), $option['lang']);
156
+                $retval .= $this->optiontext([$option['name']], ($optiontypearray["type"] == "file" ? 'ROWID-'.$option['level'].'-'.$option['row'] : $option['value']), $option['lang']);
157 157
             }
158 158
         }
159 159
         return $retval;
@@ -252,18 +252,18 @@  discard block
 block discarded – undo
252 252
         }
253 253
         $descriptions["media:force_proxy"] = sprintf(_("The format of this option is: IPv4|IPv6|hostname:port . Forcing your users through a content filter of your own is a significant invasion of user self-determination. It also has technical issues. Please throughly read the discussion at %s before specifying a proxy with this option. This feature is currently experimental and only has an effect in Apple installers."), "https://github.com/GEANT/CAT/issues/96");
254 254
         $descriptions["managedsp:realmforvlan"] = sprintf(_("If you are also using %s, then your own realm is automatically tagged with the VLAN you choose, there is no need to add it here manually."), \core\ProfileSilverbullet::PRODUCTNAME);
255
-        $descriptions["media:openroaming"] = sprintf(_("By opting in to OpenRoaming, you agree to be bound by the %s."), "eduroam Ecosystem Broker OpenRoaming Identity Provider Policy") .
256
-                " " .
257
-                sprintf(_("Note that your requirement to inform users about the OpenRoaming End User Terms and Conditions is fulfilled when directing your end users to the %s download portal for installer download. Any other means of providing the installers needs to present this information via its own channel."), \config\Master::APPEARANCE['productname']) .
258
-                " " .
259
-                _("You are also aware that for best technical interoperability, you need to add a DNS entry into the DNS zone of your RADIUS realm.") .
260
-                " " .
255
+        $descriptions["media:openroaming"] = sprintf(_("By opting in to OpenRoaming, you agree to be bound by the %s."), "eduroam Ecosystem Broker OpenRoaming Identity Provider Policy").
256
+                " ".
257
+                sprintf(_("Note that your requirement to inform users about the OpenRoaming End User Terms and Conditions is fulfilled when directing your end users to the %s download portal for installer download. Any other means of providing the installers needs to present this information via its own channel."), \config\Master::APPEARANCE['productname']).
258
+                " ".
259
+                _("You are also aware that for best technical interoperability, you need to add a DNS entry into the DNS zone of your RADIUS realm.").
260
+                " ".
261 261
                 _("Read the instructions in the wiki.");
262 262
         \core\common\Entity::outOfThePotatoes();
263 263
         if (!isset($descriptions[$input])) {
264 264
             return "";
265 265
         }
266
-        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>";
266
+        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>";
267 267
     }
268 268
 
269 269
     /**
@@ -277,19 +277,19 @@  discard block
 block discarded – undo
277 277
     private function selectElement($rowid, $list)
278 278
     {
279 279
         $jsmagic = "onchange='
280
-                               if (/#ML#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
280
+                               if (/#ML#/.test(document.getElementById(\"option-S" . $rowid."-select\").value)) {
281 281
                                    document.getElementById(\"S$rowid-input-langselect\").style.display = \"block\";
282 282
                                    } else {
283 283
                                    document.getElementById(\"S$rowid-input-langselect\").style.display = \"none\";
284 284
                                    }";
285 285
         foreach (array_keys($this->htmlDatatypeTexts) as $key) {
286
-            $jsmagic .= "if (/#" . $key . "#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
287
-                                  document.getElementById(\"S$rowid-input-file\").style.display = \"" . ($key == \core\Options::TYPECODE_FILE ? "block" : "none") . "\";
288
-                                  document.getElementById(\"S$rowid-input-text\").style.display = \"" . ($key == \core\Options::TYPECODE_TEXT ? "block" : "none") . "\";
289
-                                  document.getElementById(\"S$rowid-input-string\").style.display = \"" . ($key == \core\Options::TYPECODE_STRING ? "block" : "none") . "\";
290
-                                  document.getElementById(\"S$rowid-input-enum_openroaming\").style.display = \"" . ($key == \core\Options::TYPECODE_ENUM_OPENROAMING ? "block" : "none") . "\";
291
-                                  document.getElementById(\"S$rowid-input-boolean\").style.display = \"" . ($key == \core\Options::TYPECODE_BOOLEAN ? "block" : "none") . "\";
292
-                                  document.getElementById(\"S$rowid-input-integer\").style.display = \"" . ($key == \core\Options::TYPECODE_INTEGER ? "block" : "none") . "\";
286
+            $jsmagic .= "if (/#".$key."#/.test(document.getElementById(\"option-S".$rowid."-select\").value)) {
287
+                                  document.getElementById(\"S$rowid-input-file\").style.display = \"".($key == \core\Options::TYPECODE_FILE ? "block" : "none")."\";
288
+                                  document.getElementById(\"S$rowid-input-text\").style.display = \"".($key == \core\Options::TYPECODE_TEXT ? "block" : "none")."\";
289
+                                  document.getElementById(\"S$rowid-input-string\").style.display = \"".($key == \core\Options::TYPECODE_STRING ? "block" : "none")."\";
290
+                                  document.getElementById(\"S$rowid-input-enum_openroaming\").style.display = \"".($key == \core\Options::TYPECODE_ENUM_OPENROAMING ? "block" : "none")."\";
291
+                                  document.getElementById(\"S$rowid-input-boolean\").style.display = \"".($key == \core\Options::TYPECODE_BOOLEAN ? "block" : "none")."\";
292
+                                  document.getElementById(\"S$rowid-input-integer\").style.display = \"".($key == \core\Options::TYPECODE_INTEGER ? "block" : "none")."\";
293 293
                              }
294 294
                              ";
295 295
             // hide all tooltips (each is a <span>, and there are no other <span>s)
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
                 $value = array_shift($list);
321 321
                 $listtype = $optioninfo->optionType($value);
322 322
                 $retval .= $uiElements->displayName($value);
323
-                $retval .= "<input type='hidden' name='option[S$rowid]' value='$value#" . $listtype["type"] . "#" . $listtype["flag"] . "#'/>";
323
+                $retval .= "<input type='hidden' name='option[S$rowid]' value='$value#".$listtype["type"]."#".$listtype["flag"]."#'/>";
324 324
                 $activelisttype = $listtype;
325 325
                 $tooltips = $this->tooltip($rowid, $value, TRUE);
326 326
                 break;
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
                 $retval .= "<select id='option-S$rowid-select' name='option[S$rowid]' $jsmagic>";
329 329
                 foreach ($list as $value) {
330 330
                     $listtype = $optioninfo->optionType($value);
331
-                    $retval .= "<option id='option-S$rowid-v-$value' value='$value#" . $listtype["type"] . "#" . $listtype["flag"] . "#' ";
331
+                    $retval .= "<option id='option-S$rowid-v-$value' value='$value#".$listtype["type"]."#".$listtype["flag"]."#' ";
332 332
                     if ($iterator == $this->optionIterator) {
333 333
                         $retval .= "selected='selected'";
334 334
                         $activelisttype = $listtype;
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
                     } else {
337 337
                         $tooltips .= $this->tooltip($rowid, $value, FALSE);
338 338
                     }
339
-                    $retval .= ">" . $uiElements->displayName($value) . "</option>";
339
+                    $retval .= ">".$uiElements->displayName($value)."</option>";
340 340
                     $iterator++;
341 341
                 }
342 342
 
@@ -362,9 +362,9 @@  discard block
 block discarded – undo
362 362
     private function selectLanguage($rowid, $makeVisible)
363 363
     {
364 364
         \core\common\Entity::intoThePotatoes();
365
-        $retval = "<select style='display:" . ($makeVisible ? "block" : "none") . "' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect'>
366
-            <option value='' name='select_language' selected>" . _("select language") . "</option>
367
-            <option value='C' name='all_languages'>" . _("default/other languages") . "</option>";
365
+        $retval = "<select style='display:".($makeVisible ? "block" : "none")."' name='value[S$rowid-lang]' id='S".$rowid."-input-langselect'>
366
+            <option value='' name='select_language' selected>" . _("select language")."</option>
367
+            <option value='C' name='all_languages'>" . _("default/other languages")."</option>";
368 368
         foreach (\config\Master::LANGUAGES as $langindex => $possibleLang) {
369 369
             $thislang = $possibleLang['display'];
370 370
             $retval .= "<option value='$langindex' name='$langindex'>$thislang</option>";
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
     {
386 386
         $retval = "";
387 387
         foreach ($this->htmlDatatypeTexts as $key => $type) {
388
-            $retval .= "<" . $type['html'] . " style='display:" . ($activetype['type'] == $key ? "block" : "none") . "' name='value[S$rowid-$key]' id='S" . $rowid . "-input-" . $key . "'" . $type['tail'] . ">";
388
+            $retval .= "<".$type['html']." style='display:".($activetype['type'] == $key ? "block" : "none")."' name='value[S$rowid-$key]' id='S".$rowid."-input-".$key."'".$type['tail'].">";
389 389
         }
390 390
         return $retval;
391 391
     }
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
     {
402 402
         // first column: the <select> element with the names of options and their field-toggling JS magic
403 403
         $selectorInfo = $this->selectElement($rowid, $list);
404
-        $retval = "<td>" . $selectorInfo["TEXT"] . "</td>";
404
+        $retval = "<td>".$selectorInfo["TEXT"]."</td>";
405 405
         // second column: the <select> element for language selection - only visible if the active option is multi-lang
406
-        $retval .= "<td>" . $this->selectLanguage($rowid, $selectorInfo['ACTIVE']['flag'] == "ML") . "</td>";
406
+        $retval .= "<td>".$this->selectLanguage($rowid, $selectorInfo['ACTIVE']['flag'] == "ML")."</td>";
407 407
         // third column: the actual input fields; the data type of the active option is visible, all others hidden
408
-        $retval .= "<td>" . $this->inputFields($rowid, $selectorInfo['ACTIVE']) . "</td>";
408
+        $retval .= "<td>".$this->inputFields($rowid, $selectorInfo['ACTIVE'])."</td>";
409 409
         return $retval;
410 410
     }
411 411
 
@@ -429,20 +429,20 @@  discard block
 block discarded – undo
429 429
         $retval .= "<td>";
430 430
         $uiElements = new UIElements();
431 431
         $listtype = $optioninfo->optionType($optionName);
432
-        $retval .= "<span style='display:flex;'>" . $uiElements->displayName($optionName);
433
-        $retval .= $this->tooltip($rowid, $optionName, TRUE) . "</span>";
434
-        $retval .= "<input type='hidden' id='option-S$rowid-select' name='option[S$rowid]' value='$optionName#" . $listtype["type"] . "#" . $listtype["flag"] . "#' ></td>";
432
+        $retval .= "<span style='display:flex;'>".$uiElements->displayName($optionName);
433
+        $retval .= $this->tooltip($rowid, $optionName, TRUE)."</span>";
434
+        $retval .= "<input type='hidden' id='option-S$rowid-select' name='option[S$rowid]' value='$optionName#".$listtype["type"]."#".$listtype["flag"]."#' ></td>";
435 435
 
436 436
         // language tag if any
437 437
         $retval .= "<td>";
438 438
         if ($listtype["flag"] == "ML") {
439 439
 
440
-            $language = "(" . strtoupper($optionLang) . ")";
440
+            $language = "(".strtoupper($optionLang).")";
441 441
             if ($optionLang == 'C') {
442 442
                 $language = _("(default/other languages)");
443 443
             }
444 444
             $retval .= $language;
445
-            $retval .= "<input type='hidden' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect' value='" . $optionLang . "' style='display:block'>";
445
+            $retval .= "<input type='hidden' name='value[S$rowid-lang]' id='S".$rowid."-input-langselect' value='".$optionLang."' style='display:block'>";
446 446
         }
447 447
         $retval .= "</td>";
448 448
 // attribute content
@@ -452,12 +452,12 @@  discard block
 block discarded – undo
452 452
             case \core\Options::TYPECODE_COORDINATES:
453 453
                 $this->allLocationCount = $this->allLocationCount + 1;
454 454
                 // display of the locations varies by map provider
455
-                $classname = "\web\lib\admin\Map" . \config\ConfAssistant::MAPPROVIDER['PROVIDER'];
455
+                $classname = "\web\lib\admin\Map".\config\ConfAssistant::MAPPROVIDER['PROVIDER'];
456 456
                 $link = $classname::optionListDisplayCode($optionValue, $this->allLocationCount);
457
-                $retval .= "<input readonly style='display:none' type='text' name='value[S$rowid-" . \core\Options::TYPECODE_TEXT . "]' id='S$rowid-input-text' value='$optionValue'>$link";
457
+                $retval .= "<input readonly style='display:none' type='text' name='value[S$rowid-".\core\Options::TYPECODE_TEXT."]' id='S$rowid-input-text' value='$optionValue'>$link";
458 458
                 break;
459 459
             case \core\Options::TYPECODE_FILE:
460
-                $retval .= "<input readonly type='text' name='value[S$rowid-" . \core\Options::TYPECODE_STRING . "]' id='S" . $rowid . "-input-string' style='display:none' value='" . urlencode($optionValue) . "'>";
460
+                $retval .= "<input readonly type='text' name='value[S$rowid-".\core\Options::TYPECODE_STRING."]' id='S".$rowid."-input-string' style='display:none' value='".urlencode($optionValue)."'>";
461 461
                 $uiElements = new UIElements();
462 462
                 switch ($optionName) {
463 463
                     case "eap:ca_file":
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
                 break;
480 480
             case \core\Options::TYPECODE_ENUM_OPENROAMING: // is a string after all
481 481
                 $displayedVariant = $this->enumPrettyPrints[$optionValue];
482
-                $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'>";
482
+                $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'>";
483 483
                 break;
484 484
             case \core\Options::TYPECODE_STRING:
485 485
             // fall-thorugh is intentional; mostly identical HTML code for the three types
@@ -487,11 +487,11 @@  discard block
 block discarded – undo
487 487
             // fall-thorugh is intentional; mostly identical HTML code for the three types
488 488
             case \core\Options::TYPECODE_TEXT:
489 489
                 $displayedVariant = $optionValue; // for all three types, value tag and actual display are identical
490
-                $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'>";
490
+                $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'>";
491 491
                 break;
492 492
             case \core\Options::TYPECODE_BOOLEAN:
493 493
                 $displayedVariant = ($optionValue == "on" ? _("on") : _("off"));
494
-                $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'>";
494
+                $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'>";
495 495
                 break;
496 496
             default:
497 497
                 // this should never happen!
@@ -537,10 +537,10 @@  discard block
 block discarded – undo
537 537
        <td>
538 538
           <button type='button' class='delete' onclick='";
539 539
         if ($prefillValue !== NULL && $item == "general:geo_coordinates") {
540
-            $funcname = "Map" . \config\ConfAssistant::MAPPROVIDER['PROVIDER'] . 'DeleteCoord';
541
-            $retval .= 'if (typeof ' . $funcname . ' === "function") { ' . $funcname . '(' . $this->allLocationCount . '); } ';
540
+            $funcname = "Map".\config\ConfAssistant::MAPPROVIDER['PROVIDER'].'DeleteCoord';
541
+            $retval .= 'if (typeof '.$funcname.' === "function") { '.$funcname.'('.$this->allLocationCount.'); } ';
542 542
         }
543
-        $retval .= 'deleteOption("option-S' . $rowid . '")';
543
+        $retval .= 'deleteOption("option-S'.$rowid.'")';
544 544
         $retval .= "'>-</button>
545 545
        </td>
546 546
     </tr>";
Please login to merge, or discard this patch.