Passed
Push — release_2_1 ( 3551c4...9fef4b )
by Tomasz
22:08
created
web/lib/admin/UIElements.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             sprintf(_("%s: Do not terminate EAP"), \core\ProfileSilverbullet::PRODUCTNAME) => "fed:silverbullet-noterm",
136 136
             sprintf(_("%s: max users per profile"), \core\ProfileSilverbullet::PRODUCTNAME) => "fed:silverbullet-maxusers",
137 137
             sprintf(_("Mint %s with CA on creation"), $this->nomenclatureIdP) => "fed:minted_ca_file",
138
-            sprintf(_("OpenRoaming: Allow %s Opt-In"),$this->nomenclatureParticipant) => "fed:openroaming",
138
+            sprintf(_("OpenRoaming: Allow %s Opt-In"), $this->nomenclatureParticipant) => "fed:openroaming",
139 139
             _("OpenRoaming: Custom NAPTR Target") => "fed:openroaming_customtarget",
140 140
             $ssidText => "media:SSID",
141 141
             $passpointOiText => "media:consortium_OI",
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         $find = array_keys($displayNames, $input, TRUE);
148 148
 
149 149
         if (count($find) == 0) { // this is an error! throw an Exception
150
-            throw new \Exception("The translation of an option name was requested, but the option is not known to the system: " . htmlentities($input));
150
+            throw new \Exception("The translation of an option name was requested, but the option is not known to the system: ".htmlentities($input));
151 151
         }
152 152
         \core\common\Entity::outOfThePotatoes();
153 153
         // none of the strings have HTML in them, only translators can provide own text for it -> no threat, but complained about by the security review
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
         foreach ($optionlist as $option) {
171 171
             $type = $optioninfo->optionType($option['name']);
172
-            if (preg_match('/^' . $class . '/', $option['name']) && $option['level'] == "$level") {
172
+            if (preg_match('/^'.$class.'/', $option['name']) && $option['level'] == "$level") {
173 173
                 // all non-multilang attribs get this assignment ...
174 174
                 $language = "";
175 175
                 $content = $option['value'];
@@ -187,19 +187,19 @@  discard block
 block discarded – undo
187 187
                         $locationMarkers[] = $coords;
188 188
                         break;
189 189
                     case "file":
190
-                        $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td>";
190
+                        $retval .= "<tr><td>".$this->displayName($option['name'])."</td><td>$language</td><td>";
191 191
                         switch ($option['name']) {
192 192
                             case "general:logo_file":
193 193
                             case "fed:logo_file":
194
-                                $retval .= $this->previewImageinHTML('ROWID-' . $option['level'] . '-' . $option['row_id']);
194
+                                $retval .= $this->previewImageinHTML('ROWID-'.$option['level'].'-'.$option['row_id']);
195 195
                                 break;
196 196
                             case "eap:ca_file":
197 197
                             // fall-through intended: display both the same way
198 198
                             case "fed:minted_ca_file":
199
-                                $retval .= $this->previewCAinHTML('ROWID-' . $option['level'] . '-' . $option['row_id']);
199
+                                $retval .= $this->previewCAinHTML('ROWID-'.$option['level'].'-'.$option['row_id']);
200 200
                                 break;
201 201
                             case "support:info_file":
202
-                                $retval .= $this->previewInfoFileinHTML('ROWID-' . $option['level'] . '-' . $option['row_id']);
202
+                                $retval .= $this->previewInfoFileinHTML('ROWID-'.$option['level'].'-'.$option['row_id']);
203 203
                                 break;
204 204
                             default:
205 205
                         }
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
                             // do not display the option at all; it gets auto-set by the ProfileSilverbullet constructor and doesn't have to be seen
210 210
                             break;
211 211
                         }
212
-                        $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off") ) . "</strong></td></tr>";
212
+                        $retval .= "<tr><td>".$this->displayName($option['name'])."</td><td>$language</td><td><strong>".($content == "on" ? _("on") : _("off"))."</strong></td></tr>";
213 213
                         break;
214 214
                     default:
215
-                        $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>$content</strong></td></tr>";
215
+                        $retval .= "<tr><td>".$this->displayName($option['name'])."</td><td>$language</td><td><strong>$content</strong></td></tr>";
216 216
                 }
217 217
             }
218 218
         }
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
             $locationCount = 0;
222 222
             foreach ($locationMarkers as $g) {
223 223
                 $locationCount++;
224
-                $marker .= '<marker name="' . $locationCount . '" lat="' . $g['lat'] . '" lng="' . $g['lon'] . '" />';
224
+                $marker .= '<marker name="'.$locationCount.'" lat="'.$g['lat'].'" lng="'.$g['lon'].'" />';
225 225
             }
226 226
             $marker .= '<\/markers>'; // some validator says this should be escaped
227 227
             $jMarker = json_encode($locationMarkers);
228
-            $retval .= '<tr><td><script>markers=\'' . $marker . '\'; jmarkers = \'' . $jMarker . '\';</script></td><td></td><td></td></tr>';
228
+            $retval .= '<tr><td><script>markers=\''.$marker.'\'; jmarkers = \''.$jMarker.'\';</script></td><td></td><td></td></tr>';
229 229
         }
230 230
         \core\common\Entity::outOfThePotatoes();
231 231
         return $retval;
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
         \core\common\Entity::intoThePotatoes();
242 242
         $idpoptions = $myInst->getAttributes();
243 243
         $retval = "<div class='infobox'>
244
-        <h2>" . sprintf(_("General %s details"), $this->nomenclatureParticipant) . "</h2>
244
+        <h2>" . sprintf(_("General %s details"), $this->nomenclatureParticipant)."</h2>
245 245
         <table>
246 246
             <tr>
247 247
                 <td>
248
-                    " . _("Country:") . "
248
+                    " . _("Country:")."
249 249
                 </td>
250 250
                 <td>
251 251
                 </td>
@@ -255,16 +255,16 @@  discard block
 block discarded – undo
255 255
         $retval .= $myFed->name;
256 256
         $retval .= "</strong>
257 257
                 </td>
258
-            </tr>" . $this->infoblock($idpoptions, "general", "IdP") . "
258
+            </tr>" . $this->infoblock($idpoptions, "general", "IdP")."
259 259
         </table>
260 260
     </div>";
261 261
 
262 262
         $blocks = [["support", _("Global Helpdesk Details")], ["media", _("Media Properties")]];
263 263
         foreach ($blocks as $block) {
264 264
             $retval .= "<div class='infobox'>
265
-            <h2>" . $block[1] . "</h2>
265
+            <h2>" . $block[1]."</h2>
266 266
             <table>" .
267
-                    $this->infoblock($idpoptions, $block[0], "IdP") .
267
+                    $this->infoblock($idpoptions, $block[0], "IdP").
268 268
                     "</table>
269 269
         </div>";
270 270
         }
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
      */
280 280
     private function displaySize(int $number) {
281 281
         if ($number > 1024 * 1024) {
282
-            return round($number / 1024 / 1024, 2) . " MiB";
282
+            return round($number / 1024 / 1024, 2)." MiB";
283 283
         }
284 284
         if ($number > 1024) {
285
-            return round($number / 1024, 2) . " KiB";
285
+            return round($number / 1024, 2)." KiB";
286 286
         }
287
-        return $number . " B";
287
+        return $number." B";
288 288
     }
289 289
 
290 290
     /**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         $caExpiryTrashhold = 5184000; // 60 days
340 340
         $rawResult = UIElements::getBlobFromDB($ref['table'], $ref['rowindex'], FALSE);
341 341
         if (is_bool($rawResult)) { // we didn't actually get a CA!
342
-            $retval = "<div class='ca-summary'>" . _("There was an error while retrieving the certificate from the database!") . "</div>";
342
+            $retval = "<div class='ca-summary'>"._("There was an error while retrieving the certificate from the database!")."</div>";
343 343
             \core\common\Entity::outOfThePotatoes();
344 344
             return $retval;
345 345
         }
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 
356 356
         $details['name'] = preg_replace('/(.)\/(.)/', "$1<br/>$2", $details['name']);
357 357
         $details['name'] = preg_replace('/\//', "", $details['name']);
358
-        $certstatus = ( $details['root'] == 1 ? "R" : "I");
359
-        $certTooltip = ( $details['root'] == 1 ? _("Root CA") : _("Intermediate CA"));
358
+        $certstatus = ($details['root'] == 1 ? "R" : "I");
359
+        $certTooltip = ($details['root'] == 1 ? _("Root CA") : _("Intermediate CA"));
360 360
         $innerbgColor = "#0000ff";
361 361
         $leftBorderColor = "#00ff00";
362 362
         $message = "";
@@ -364,34 +364,34 @@  discard block
 block discarded – undo
364 364
             $leftBorderColor = "red";
365 365
             $message = _("This is a <strong>SERVER</strong> certificate!");
366 366
             if (\config\ConfAssistant::CERT_GUIDELINES !== '') {
367
-                $message .= "<br/><a target='_blank' href='".\config\ConfAssistant::CERT_GUIDELINES."'>". _("more info")."</a>";
367
+                $message .= "<br/><a target='_blank' href='".\config\ConfAssistant::CERT_GUIDELINES."'>"._("more info")."</a>";
368 368
             }
369 369
             $message .= "<br/>";
370
-            $retval = "<div class='ca-summary' style='border-left-color: $leftBorderColor'><div style='position:absolute; right: -15px; width:20px; height:20px; background-color:$innerbgColor; border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>S</div></div>" . $message . $details['name'] . "</div>";
370
+            $retval = "<div class='ca-summary' style='border-left-color: $leftBorderColor'><div style='position:absolute; right: -15px; width:20px; height:20px; background-color:$innerbgColor; border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>S</div></div>".$message.$details['name']."</div>";
371 371
             \core\common\Entity::outOfThePotatoes();
372 372
             return $retval;
373 373
         }
374 374
         if (time() > $details['full_details']['validTo_time_t']) {
375 375
             $leftBorderColor = "red";
376
-            $message = _("Certificate expired!") . "<br>";
377
-        } elseif(time() > $details['full_details']['validTo_time_t'] - $caExpiryTrashhold) {
376
+            $message = _("Certificate expired!")."<br>";
377
+        } elseif (time() > $details['full_details']['validTo_time_t'] - $caExpiryTrashhold) {
378 378
             if ($leftBorderColor == "#00ff00") {
379 379
                 $leftBorderColor = "yellow";
380 380
             }
381
-            $message = _("Certificate close to expiry!") . "<br/>";            
381
+            $message = _("Certificate close to expiry!")."<br/>";            
382 382
         }
383 383
    
384 384
         if ($details['root'] == 1 && $details['basicconstraints_set'] == 0) {
385 385
             if ($leftBorderColor == "#00ff00") {
386 386
                 $leftBorderColor = "yellow";
387 387
             }
388
-            $message .= "<div style='max-width: 25em'><strong>" . _("Improper root certificate, required critical CA extension missing, will not reliably install!") . "</strong>";
388
+            $message .= "<div style='max-width: 25em'><strong>"._("Improper root certificate, required critical CA extension missing, will not reliably install!")."</strong>";
389 389
             if (\config\ConfAssistant::CERT_GUIDELINES !== '') {
390
-                $message .= "<br/><a target='_blank' href='".\config\ConfAssistant::CERT_GUIDELINES."'>". _("more info")."</a>";
390
+                $message .= "<br/><a target='_blank' href='".\config\ConfAssistant::CERT_GUIDELINES."'>"._("more info")."</a>";
391 391
             }
392 392
             $message .= "</div><br/>";
393 393
         }
394
-        $retval =  "<div class='ca-summary' style='border-left-color: $leftBorderColor'><div style='position:absolute; right: -15px; width:20px; height:20px; background-color:$innerbgColor; border-radius:10px; text-align: center;'><div title='$certTooltip' style='padding-top:3px; font-weight:bold; color:#ffffff;'>$certstatus</div></div>" . $message . $details['name'] . "<br>" . $this->displayName('eap:ca_vailduntil') . " " . gmdate('Y-m-d H:i:s', $details['full_details']['validTo_time_t']) . " UTC</div>";
394
+        $retval = "<div class='ca-summary' style='border-left-color: $leftBorderColor'><div style='position:absolute; right: -15px; width:20px; height:20px; background-color:$innerbgColor; border-radius:10px; text-align: center;'><div title='$certTooltip' style='padding-top:3px; font-weight:bold; color:#ffffff;'>$certstatus</div></div>".$message.$details['name']."<br>".$this->displayName('eap:ca_vailduntil')." ".gmdate('Y-m-d H:i:s', $details['full_details']['validTo_time_t'])." UTC</div>";
395 395
         \core\common\Entity::outOfThePotatoes();
396 396
         return $retval;
397 397
     }
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
      */
405 405
     public function previewImageinHTML($imageReference) {
406 406
         \core\common\Entity::intoThePotatoes();
407
-        $retval = "<img style='max-width:150px' src='inc/filepreview.php?id=" . $imageReference . "' alt='" . _("Preview of logo file") . "'/>";
407
+        $retval = "<img style='max-width:150px' src='inc/filepreview.php?id=".$imageReference."' alt='"._("Preview of logo file")."'/>";
408 408
         \core\common\Entity::outOfThePotatoes();
409 409
         return $retval;
410 410
     }
@@ -421,13 +421,13 @@  discard block
 block discarded – undo
421 421
         $ref = $validator->databaseReference($fileReference);
422 422
         $fileBlob = UIElements::getBlobFromDB($ref['table'], $ref['rowindex'], FALSE);
423 423
         if (is_bool($fileBlob)) { // we didn't actually get a file!
424
-            $retval = "<div class='ca-summary'>" . _("There was an error while retrieving the file from the database!") . "</div>";
424
+            $retval = "<div class='ca-summary'>"._("There was an error while retrieving the file from the database!")."</div>";
425 425
             \core\common\Entity::outOfThePotatoes();
426 426
             return $retval;
427 427
         }
428 428
         $decodedFileBlob = base64_decode($fileBlob);
429 429
         $fileinfo = new \finfo();
430
-        $retval = "<div class='ca-summary'>" . _("File exists") . " (" . $fileinfo->buffer($decodedFileBlob, FILEINFO_MIME_TYPE) . ", " . $this->displaySize(strlen($decodedFileBlob)) . ")<br/><a href='inc/filepreview.php?id=$fileReference'>" . _("Preview") . "</a></div>";
430
+        $retval = "<div class='ca-summary'>"._("File exists")." (".$fileinfo->buffer($decodedFileBlob, FILEINFO_MIME_TYPE).", ".$this->displaySize(strlen($decodedFileBlob)).")<br/><a href='inc/filepreview.php?id=$fileReference'>"._("Preview")."</a></div>";
431 431
         \core\common\Entity::outOfThePotatoes();
432 432
         return $retval;
433 433
     }
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
             $retval .= "<tr><td>";
456 456
         }
457 457
         $finalCaption = ($caption !== NULL ? $caption : $uiMessages[$level]['text']);
458
-        $retval .= "<img class='icon' src='" . $uiMessages[$level]['icon'] . "' alt='" . $finalCaption . "' title='" . $finalCaption . "'/>";
458
+        $retval .= "<img class='icon' src='".$uiMessages[$level]['icon']."' alt='".$finalCaption."' title='".$finalCaption."'/>";
459 459
         if (!$omittabletags) {
460 460
             $retval .= "</td><td>";
461 461
         }
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
             return "";
538 538
         }
539 539
 
540
-        $loggerInstance->debug(4, "Consortium logo is at: " . ROOT . "/web/resources/images/consortium_logo_large.png");
541
-        $logogd = imagecreatefrompng(ROOT . "/web/resources/images/consortium_logo_large.png");
540
+        $loggerInstance->debug(4, "Consortium logo is at: ".ROOT."/web/resources/images/consortium_logo_large.png");
541
+        $logogd = imagecreatefrompng(ROOT."/web/resources/images/consortium_logo_large.png");
542 542
         if ($logogd === FALSE) { // consortium logo is bogus; don't do anything
543 543
             return "";
544 544
         }
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
         imagecolorallocate($whiteimage, 255, 255, 255);
565 565
         // also make sure the initial placement is a multitude of 12; otherwise "two half" symbols might be affected
566 566
         $targetplacementx = (int) ($symbolsize * round(($sizeinput[0] / 2 - ($targetwidth - $symbolsize + 1) / 2) / $symbolsize));
567
-        $targetplacementy = (int) ($symbolsize * round(($sizeinput[1] / 2 - ($targetheight - $symbolsize + 1 ) / 2) / $symbolsize));
567
+        $targetplacementy = (int) ($symbolsize * round(($sizeinput[1] / 2 - ($targetheight - $symbolsize + 1) / 2) / $symbolsize));
568 568
         imagecopyresized($inputgd, $whiteimage, $targetplacementx - $symbolsize, $targetplacementy - $symbolsize, 0, 0, $targetwidth + 2 * $symbolsize, $targetheight + 2 * $symbolsize, $targetwidth + 2 * $symbolsize, $targetheight + 2 * $symbolsize);
569 569
         imagecopyresized($inputgd, $logogd, $targetplacementx, $targetplacementy, 0, 0, $targetwidth, $targetheight, $sizelogo[0], $sizelogo[1]);
570 570
         ob_start();
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
                 $message = "Your configuration appears to be fine.";
615 615
                 break;
616 616
             default:
617
-                throw new Exception("The result code level " . $test->test_result['global'] . " is not defined!");
617
+                throw new Exception("The result code level ".$test->test_result['global']." is not defined!");
618 618
         }
619
-        $out .= $this->boxFlexible($test->test_result['global'], "<br><strong>Test Summary</strong><br>" . $message . "<br>See below for details<br><hr>");
619
+        $out .= $this->boxFlexible($test->test_result['global'], "<br><strong>Test Summary</strong><br>".$message."<br>See below for details<br><hr>");
620 620
         foreach ($test->out as $testValue) {
621 621
             foreach ($testValue as $o) {
622 622
                 $out .= $this->boxFlexible($o['level'], $o['message']);
Please login to merge, or discard this patch.