Passed
Push — master ( e02578...44a027 )
by Stefan
10:10
created
web/lib/admin/OptionDisplay.php 1 patch
Spacing   +34 added lines, -34 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) {
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 $prepopulate[] = $existingAttribute;
96 96
             }
97 97
         }
98
-        if (is_array($prepopulate) && ( count($prepopulate) > 0 || $attributePrefix == "device-specific" || $attributePrefix == "eap-specific" )) { // editing... fill with values
98
+        if (is_array($prepopulate) && (count($prepopulate) > 0 || $attributePrefix == "device-specific" || $attributePrefix == "eap-specific")) { // editing... fill with values
99 99
             $retval .= $this->addOptionEdit($attributePrefix, $prepopulate);
100 100
         } else {
101 101
             $retval .= $this->addOptionNew($attributePrefix);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 $optiontypearray = $optioninfo->optionType($option['name']);
128 128
                 $loggerInstance = new \core\common\Logging();
129 129
                 $loggerInstance->debug(5, "About to execute optiontext with PREFILL!\n");
130
-                $retval .= $this->optiontext([$option['name']], ($optiontypearray["type"] == "file" ? 'ROWID-' . $option['level'] . '-' . $option['row'] : $option['value']), $option['lang']);
130
+                $retval .= $this->optiontext([$option['name']], ($optiontypearray["type"] == "file" ? 'ROWID-'.$option['level'].'-'.$option['row'] : $option['value']), $option['lang']);
131 131
             }
132 132
         }
133 133
         return $retval;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         if (!isset($descriptions[$input])) {
200 200
             return "";
201 201
         }
202
-        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>";
202
+        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>";
203 203
     }
204 204
 
205 205
     /**
@@ -212,18 +212,18 @@  discard block
 block discarded – undo
212 212
      */
213 213
     private function selectElement($rowid, $list) {
214 214
         $jsmagic = "onchange='
215
-                               if (/#ML#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
215
+                               if (/#ML#/.test(document.getElementById(\"option-S" . $rowid."-select\").value)) {
216 216
                                    document.getElementById(\"S$rowid-input-langselect\").style.display = \"block\";
217 217
                                    } else {
218 218
                                    document.getElementById(\"S$rowid-input-langselect\").style.display = \"none\";
219 219
                                    }";
220 220
         foreach (array_keys(OptionDisplay::HTML_DATATYPE_TEXTS) as $key) {
221
-            $jsmagic .= "if (/#" . $key . "#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
222
-                                  document.getElementById(\"S$rowid-input-file\").style.display = \"" . ($key == \core\Options::TYPECODE_FILE ? "block" : "none") . "\";
223
-                                  document.getElementById(\"S$rowid-input-text\").style.display = \"" . ($key == \core\Options::TYPECODE_TEXT ? "block" : "none") . "\";
224
-                                  document.getElementById(\"S$rowid-input-string\").style.display = \"" . ($key == \core\Options::TYPECODE_STRING ? "block" : "none") . "\";
225
-                                  document.getElementById(\"S$rowid-input-boolean\").style.display = \"" . ($key == \core\Options::TYPECODE_BOOLEAN ? "block" : "none") . "\";
226
-                                  document.getElementById(\"S$rowid-input-integer\").style.display = \"" . ($key == \core\Options::TYPECODE_INTEGER ? "block" : "none") . "\";
221
+            $jsmagic .= "if (/#".$key."#/.test(document.getElementById(\"option-S".$rowid."-select\").value)) {
222
+                                  document.getElementById(\"S$rowid-input-file\").style.display = \"".($key == \core\Options::TYPECODE_FILE ? "block" : "none")."\";
223
+                                  document.getElementById(\"S$rowid-input-text\").style.display = \"".($key == \core\Options::TYPECODE_TEXT ? "block" : "none")."\";
224
+                                  document.getElementById(\"S$rowid-input-string\").style.display = \"".($key == \core\Options::TYPECODE_STRING ? "block" : "none")."\";
225
+                                  document.getElementById(\"S$rowid-input-boolean\").style.display = \"".($key == \core\Options::TYPECODE_BOOLEAN ? "block" : "none")."\";
226
+                                  document.getElementById(\"S$rowid-input-integer\").style.display = \"".($key == \core\Options::TYPECODE_INTEGER ? "block" : "none")."\";
227 227
                              }
228 228
                              ";
229 229
             // hide all tooltips (each is a <span>, and there are no other <span>s)
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                 $value = array_shift($list);
255 255
                 $listtype = $optioninfo->optionType($value);
256 256
                 $retval .= $uiElements->displayName($value);
257
-                $retval .= "<input type='hidden' name='option[S$rowid]' value='$value#" . $listtype["type"] . "#" . $listtype["flag"] . "#'/>";
257
+                $retval .= "<input type='hidden' name='option[S$rowid]' value='$value#".$listtype["type"]."#".$listtype["flag"]."#'/>";
258 258
                 $activelisttype = $listtype;
259 259
                 $tooltips = $this->tooltip($rowid, $value, TRUE);
260 260
                 break;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 $retval .= "<select id='option-S$rowid-select' name='option[S$rowid]' $jsmagic>";
263 263
                 foreach ($list as $value) {
264 264
                     $listtype = $optioninfo->optionType($value);
265
-                    $retval .= "<option id='option-S$rowid-v-$value' value='$value#" . $listtype["type"] . "#" . $listtype["flag"] . "#' ";
265
+                    $retval .= "<option id='option-S$rowid-v-$value' value='$value#".$listtype["type"]."#".$listtype["flag"]."#' ";
266 266
                     if ($iterator == $this->optionIterator) {
267 267
                         $retval .= "selected='selected'";
268 268
                         $activelisttype = $listtype;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                     } else {
271 271
                         $tooltips .= $this->tooltip($rowid, $value, FALSE);
272 272
                     }
273
-                    $retval .= ">" . $uiElements->displayName($value) . "</option>";
273
+                    $retval .= ">".$uiElements->displayName($value)."</option>";
274 274
                     $iterator++;
275 275
                 }
276 276
 
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
      */
296 296
     private function selectLanguage($rowid, $makeVisible) {
297 297
         \core\common\Entity::intoThePotatoes();
298
-        $retval = "<select style='display:" . ($makeVisible ? "block" : "none") . "' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect'>
299
-            <option value='' name='select_language' selected>" . _("select language") . "</option>
300
-            <option value='C' name='all_languages'>" . _("default/other languages") . "</option>";
298
+        $retval = "<select style='display:".($makeVisible ? "block" : "none")."' name='value[S$rowid-lang]' id='S".$rowid."-input-langselect'>
299
+            <option value='' name='select_language' selected>" . _("select language")."</option>
300
+            <option value='C' name='all_languages'>" . _("default/other languages")."</option>";
301 301
         foreach (CONFIG['LANGUAGES'] as $langindex => $possibleLang) {
302 302
             $thislang = $possibleLang['display'];
303 303
             $retval .= "<option value='$langindex' name='$langindex'>$thislang</option>";
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     private function inputFields($rowid, $activetype) {
326 326
         $retval = "";
327 327
         foreach (OptionDisplay::HTML_DATATYPE_TEXTS as $key => $type) {
328
-            $retval .= "<" . $type['html'] . " style='display:" . ($activetype['type'] == $key ? "block" : "none") . "' name='value[S$rowid-$key]' id='S" . $rowid . "-input-" . $key . "'" . $type['tail'] . ">";
328
+            $retval .= "<".$type['html']." style='display:".($activetype['type'] == $key ? "block" : "none")."' name='value[S$rowid-$key]' id='S".$rowid."-input-".$key."'".$type['tail'].">";
329 329
         }
330 330
         return $retval;
331 331
     }
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
     private function noPrefillText(int $rowid, array $list) {
341 341
         // first column: the <select> element with the names of options and their field-toggling JS magic
342 342
         $selectorInfo = $this->selectElement($rowid, $list);
343
-        $retval = "<td>" . $selectorInfo["TEXT"] . "</td>";
343
+        $retval = "<td>".$selectorInfo["TEXT"]."</td>";
344 344
         // second column: the <select> element for language selection - only visible if the active option is multi-lang
345
-        $retval .= "<td>" . $this->selectLanguage($rowid, $selectorInfo['ACTIVE']['flag'] == "ML") . "</td>";
345
+        $retval .= "<td>".$this->selectLanguage($rowid, $selectorInfo['ACTIVE']['flag'] == "ML")."</td>";
346 346
         // third column: the actual input fields; the data type of the active option is visible, all others hidden
347
-        $retval .= "<td>" . $this->inputFields($rowid, $selectorInfo['ACTIVE']) . "</td>";
347
+        $retval .= "<td>".$this->inputFields($rowid, $selectorInfo['ACTIVE'])."</td>";
348 348
         return $retval;
349 349
     }
350 350
 
@@ -367,20 +367,20 @@  discard block
 block discarded – undo
367 367
         $retval .= "<td>";
368 368
         $uiElements = new UIElements();
369 369
         $listtype = $optioninfo->optionType($optionName);
370
-        $retval .= "<span style='display:flex;'>" . $uiElements->displayName($optionName);
371
-        $retval .= $this->tooltip($rowid, $optionName, TRUE) . "</span>";
372
-        $retval .= "<input type='hidden' id='option-S$rowid-select' name='option[S$rowid]' value='$optionName#" . $listtype["type"] . "#" . $listtype["flag"] . "#' ></td>";
370
+        $retval .= "<span style='display:flex;'>".$uiElements->displayName($optionName);
371
+        $retval .= $this->tooltip($rowid, $optionName, TRUE)."</span>";
372
+        $retval .= "<input type='hidden' id='option-S$rowid-select' name='option[S$rowid]' value='$optionName#".$listtype["type"]."#".$listtype["flag"]."#' ></td>";
373 373
 
374 374
         // language tag if any
375 375
         $retval .= "<td>";
376 376
         if ($listtype["flag"] == "ML") {
377 377
 
378
-            $language = "(" . strtoupper($optionLang) . ")";
378
+            $language = "(".strtoupper($optionLang).")";
379 379
             if ($optionLang == 'C') {
380 380
                 $language = _("(default/other languages)");
381 381
             }
382 382
             $retval .= $language;
383
-            $retval .= "<input type='hidden' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect' value='" . $optionLang . "' style='display:block'>";
383
+            $retval .= "<input type='hidden' name='value[S$rowid-lang]' id='S".$rowid."-input-langselect' value='".$optionLang."' style='display:block'>";
384 384
         }
385 385
         $retval .= "</td>";
386 386
 // attribute content
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
             case \core\Options::TYPECODE_COORDINATES:
391 391
                 $this->allLocationCount = $this->allLocationCount + 1;
392 392
                 // display of the locations varies by map provider
393
-                $classname = "\web\lib\admin\Map" . CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER'];
393
+                $classname = "\web\lib\admin\Map".CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER'];
394 394
                 $link = $classname::optionListDisplayCode($optionValue, $this->allLocationCount);
395
-                $retval .= "<input readonly style='display:none' type='text' name='value[S$rowid-" . \core\Options::TYPECODE_TEXT . "]' id='S$rowid-input-text' value='$optionValue'>$link";
395
+                $retval .= "<input readonly style='display:none' type='text' name='value[S$rowid-".\core\Options::TYPECODE_TEXT."]' id='S$rowid-input-text' value='$optionValue'>$link";
396 396
                 break;
397 397
             case \core\Options::TYPECODE_FILE:
398
-                $retval .= "<input readonly type='text' name='value[S$rowid-" . \core\Options::TYPECODE_STRING . "]' id='S" . $rowid . "-input-string' style='display:none' value='" . urlencode($optionValue) . "'>";
398
+                $retval .= "<input readonly type='text' name='value[S$rowid-".\core\Options::TYPECODE_STRING."]' id='S".$rowid."-input-string' style='display:none' value='".urlencode($optionValue)."'>";
399 399
                 $uiElements = new UIElements();
400 400
                 switch ($optionName) {
401 401
                     case "eap:ca_file":
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
                 if ($listtype['type'] == \core\Options::TYPECODE_BOOLEAN) {// only modify in this one case
426 426
                     $displayedVariant = ($optionValue == "on" ? _("on") : _("off"));
427 427
                 }
428
-                $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'>";
428
+                $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'>";
429 429
                 break;
430 430
             default:
431 431
                 // this should never happen!
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
        <td>
470 470
           <button type='button' class='delete' onclick='";
471 471
         if ($prefillValue !== NULL && $item == "general:geo_coordinates") {
472
-            $funcname = "Map" . CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER'] . 'DeleteCoord';
473
-            $retval .= 'if (typeof ' . $funcname . ' === "function") { ' . $funcname . '(' . $this->allLocationCount . '); } ';
472
+            $funcname = "Map".CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER'].'DeleteCoord';
473
+            $retval .= 'if (typeof '.$funcname.' === "function") { '.$funcname.'('.$this->allLocationCount.'); } ';
474 474
         }
475
-        $retval .= 'deleteOption("option-S' . $rowid . '")';
475
+        $retval .= 'deleteOption("option-S'.$rowid.'")';
476 476
         $retval .= "'>-</button>
477 477
        </td>
478 478
     </tr>";
Please login to merge, or discard this patch.
web/admin/edit_hotspot.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 ?>
28 28
 <?php
29
-require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
29
+require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
30 30
 
31 31
 $deco = new \web\lib\admin\PageDecoration();
32 32
 $validator = new \web\lib\common\InputValidation();
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 if (!isset($_GET['deployment_id'])) {
38 38
     $my_inst->newDeployment(\core\AbstractDeployment::DEPLOYMENTTYPE_MANAGED);
39
-    header("Location: overview_sp.php?inst_id=" . $my_inst->identifier);
39
+    header("Location: overview_sp.php?inst_id=".$my_inst->identifier);
40 40
     exit(0);
41 41
 }
42 42
 
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 if (isset($_POST['submitbutton'])) {
48 48
     if ($_POST['submitbutton'] == web\lib\common\FormElements::BUTTON_DELETE) {
49 49
         $deployment->deactivate();
50
-        header("Location: overview_sp.php?inst_id=" . $my_inst->identifier);
50
+        header("Location: overview_sp.php?inst_id=".$my_inst->identifier);
51 51
         exit(0);
52 52
     }
53 53
 
54 54
     if ($_POST['submitbutton'] == web\lib\common\FormElements::BUTTON_ACTIVATE) {
55 55
         $deployment->activate();
56
-        header("Location: overview_sp.php?inst_id=" . $my_inst->identifier);
56
+        header("Location: overview_sp.php?inst_id=".$my_inst->identifier);
57 57
         exit(0);
58 58
     }
59 59
     if ($_POST['submitbutton'] == web\lib\common\FormElements::BUTTON_SAVE) {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         }
70 70
         $optionParser->processSubmittedFields($deployment, $postArray, $_FILES);
71 71
 
72
-        header("Location: overview_sp.php?inst_id=" . $my_inst->identifier);
72
+        header("Location: overview_sp.php?inst_id=".$my_inst->identifier);
73 73
         exit(0);
74 74
     }
75 75
 }
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
     echo $uiElements->instLevelInfoBoxes($my_inst);
98 98
     $deploymentOptions = $deployment->getAttributes();
99 99
     echo "<form enctype='multipart/form-data' action='edit_hotspot.php?inst_id=$my_inst->identifier&amp;deployment_id=$deployment->identifier' method='post' accept-charset='UTF-8'>
100
-                <input type='hidden' name='MAX_FILE_SIZE' value='" . CONFIG['MAX_UPLOAD_SIZE'] . "'>";
100
+                <input type='hidden' name='MAX_FILE_SIZE' value='".CONFIG['MAX_UPLOAD_SIZE']."'>";
101 101
     $optionDisplay = new \web\lib\admin\OptionDisplay($deploymentOptions, "Profile");
102 102
     ?>
103 103
     <?php
104 104
     echo "<fieldset class='option_container' id='managedsp_override'>
105
-    <legend><strong>" . _("Options for this deployment") . "</strong></legend>";
105
+    <legend><strong>" . _("Options for this deployment")."</strong></legend>";
106 106
     ?>
107 107
     <table>
108 108
         <tr>
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             <!-- input for VLAN identifier for home users-->
121 121
             <td>
122 122
                 <span id='vlan_label'>
123
-                    <?php echo sprintf(_("VLAN tag for own users%s:"), ($vlan === NULL ? "" : " " . _("(unset with '0')"))); ?>
123
+                    <?php echo sprintf(_("VLAN tag for own users%s:"), ($vlan === NULL ? "" : " "._("(unset with '0')"))); ?>
124 124
                 </span>
125 125
             </td>
126 126
             <td>
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
     </table>
136 136
     <?php
137 137
     echo $optionDisplay->prefilledOptionTable("managedsp");
138
-    echo "<button type='button' class='newoption' onclick='getXML(\"managedsp\")'>" . _("Add new option") . "</button>";
138
+    echo "<button type='button' class='newoption' onclick='getXML(\"managedsp\")'>"._("Add new option")."</button>";
139 139
     echo "</fieldset>";
140 140
 
141 141
 
142
-    echo "<p><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_sp.php?inst_id=$my_inst->identifier\"'>" . _("Discard changes") . "</button></p></form>";
142
+    echo "<p><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_sp.php?inst_id=$my_inst->identifier\"'>"._("Discard changes")."</button></p></form>";
143 143
     echo $deco->footer();
144 144
     
145 145
\ No newline at end of file
Please login to merge, or discard this patch.