Passed
Push — release_2_1 ( 1cb6d0...7c84e2 )
by Tomasz
08:48
created
web/lib/admin/UIElements.php 1 patch
Spacing   +38 added lines, -38 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,16 +355,16 @@  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
         $mainbgColor = "#ccccff";
361 361
         $innerbgColor = "#0000ff";
362 362
         $message = "";
363 363
         if ($details['ca'] == 0 && $details['root'] != 1) {
364 364
             $mainbgColor = "red";
365 365
             $innerbgColor = "maroon";
366
-            $message = _("This is a <strong>SERVER</strong> certificate!") . "<br/>";
367
-            $retval = "<div class='ca-summary' style='background-color:$mainbgColor'><div style='position:absolute; right: 0px; 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>";
366
+            $message = _("This is a <strong>SERVER</strong> certificate!")."<br/>";
367
+            $retval = "<div class='ca-summary' style='background-color:$mainbgColor'><div style='position:absolute; right: 0px; 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>";
368 368
             \core\common\Entity::outOfThePotatoes();
369 369
             return $retval;
370 370
         }
@@ -372,21 +372,21 @@  discard block
 block discarded – undo
372 372
         if (time() > $details['full_details']['validTo_time_t']) {
373 373
             $mainbgColor = "red";
374 374
             $innerbgColor = "maroon";
375
-            $message = _("Certificate expired!") . "<br>";
376
-        } elseif(time() > $details['full_details']['validTo_time_t'] - $caExpiryTrashhold) {
375
+            $message = _("Certificate expired!")."<br>";
376
+        } elseif (time() > $details['full_details']['validTo_time_t'] - $caExpiryTrashhold) {
377 377
             $mainbgColor = "yellow";
378 378
             $innerbgColor = "#0000ff";
379
-            $message = _("Certificate close to expiry!") . "<br>";            
379
+            $message = _("Certificate close to expiry!")."<br>";            
380 380
         }
381 381
    
382 382
         if ($details['root'] == 1 && $details['basicconstraints_set'] == 0) {
383 383
             if ($mainbgColor == "#ccccff") {
384 384
                 $mainbgColor = "yellow";
385 385
             }
386
-            $message .= "<div style='max-width: 25em'><strong>" . _("Improper root certificate, required critical CA extension missing, will not reliably install!") . "</strong><br><a target='_blank' href=''>". _("more info")."</a></div><br>";
386
+            $message .= "<div style='max-width: 25em'><strong>"._("Improper root certificate, required critical CA extension missing, will not reliably install!")."</strong><br><a target='_blank' href=''>"._("more info")."</a></div><br>";
387 387
         }
388 388
         
389
-        $retval =     "<div class='ca-summary' style='background-color:$mainbgColor'><div style='position:absolute; right: 0px; 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>";
389
+        $retval = "<div class='ca-summary' style='background-color:$mainbgColor'><div style='position:absolute; right: 0px; 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>";
390 390
         \core\common\Entity::outOfThePotatoes();
391 391
         return $retval;
392 392
     }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
      */
400 400
     public function previewImageinHTML($imageReference) {
401 401
         \core\common\Entity::intoThePotatoes();
402
-        $retval = "<img style='max-width:150px' src='inc/filepreview.php?id=" . $imageReference . "' alt='" . _("Preview of logo file") . "'/>";
402
+        $retval = "<img style='max-width:150px' src='inc/filepreview.php?id=".$imageReference."' alt='"._("Preview of logo file")."'/>";
403 403
         \core\common\Entity::outOfThePotatoes();
404 404
         return $retval;
405 405
     }
@@ -416,13 +416,13 @@  discard block
 block discarded – undo
416 416
         $ref = $validator->databaseReference($fileReference);
417 417
         $fileBlob = UIElements::getBlobFromDB($ref['table'], $ref['rowindex'], FALSE);
418 418
         if (is_bool($fileBlob)) { // we didn't actually get a file!
419
-            $retval = "<div class='ca-summary'>" . _("There was an error while retrieving the file from the database!") . "</div>";
419
+            $retval = "<div class='ca-summary'>"._("There was an error while retrieving the file from the database!")."</div>";
420 420
             \core\common\Entity::outOfThePotatoes();
421 421
             return $retval;
422 422
         }
423 423
         $decodedFileBlob = base64_decode($fileBlob);
424 424
         $fileinfo = new \finfo();
425
-        $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>";
425
+        $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>";
426 426
         \core\common\Entity::outOfThePotatoes();
427 427
         return $retval;
428 428
     }
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
             $retval .= "<tr><td>";
451 451
         }
452 452
         $finalCaption = ($caption !== NULL ? $caption : $uiMessages[$level]['text']);
453
-        $retval .= "<img class='icon' src='" . $uiMessages[$level]['icon'] . "' alt='" . $finalCaption . "' title='" . $finalCaption . "'/>";
453
+        $retval .= "<img class='icon' src='".$uiMessages[$level]['icon']."' alt='".$finalCaption."' title='".$finalCaption."'/>";
454 454
         if (!$omittabletags) {
455 455
             $retval .= "</td><td>";
456 456
         }
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
             return "";
533 533
         }
534 534
 
535
-        $loggerInstance->debug(4, "Consortium logo is at: " . ROOT . "/web/resources/images/consortium_logo_large.png");
536
-        $logogd = imagecreatefrompng(ROOT . "/web/resources/images/consortium_logo_large.png");
535
+        $loggerInstance->debug(4, "Consortium logo is at: ".ROOT."/web/resources/images/consortium_logo_large.png");
536
+        $logogd = imagecreatefrompng(ROOT."/web/resources/images/consortium_logo_large.png");
537 537
         if ($logogd === FALSE) { // consortium logo is bogus; don't do anything
538 538
             return "";
539 539
         }
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
         imagecolorallocate($whiteimage, 255, 255, 255);
560 560
         // also make sure the initial placement is a multitude of 12; otherwise "two half" symbols might be affected
561 561
         $targetplacementx = (int) ($symbolsize * round(($sizeinput[0] / 2 - ($targetwidth - $symbolsize + 1) / 2) / $symbolsize));
562
-        $targetplacementy = (int) ($symbolsize * round(($sizeinput[1] / 2 - ($targetheight - $symbolsize + 1 ) / 2) / $symbolsize));
562
+        $targetplacementy = (int) ($symbolsize * round(($sizeinput[1] / 2 - ($targetheight - $symbolsize + 1) / 2) / $symbolsize));
563 563
         imagecopyresized($inputgd, $whiteimage, $targetplacementx - $symbolsize, $targetplacementy - $symbolsize, 0, 0, $targetwidth + 2 * $symbolsize, $targetheight + 2 * $symbolsize, $targetwidth + 2 * $symbolsize, $targetheight + 2 * $symbolsize);
564 564
         imagecopyresized($inputgd, $logogd, $targetplacementx, $targetplacementy, 0, 0, $targetwidth, $targetheight, $sizelogo[0], $sizelogo[1]);
565 565
         ob_start();
@@ -609,9 +609,9 @@  discard block
 block discarded – undo
609 609
                 $message = "Your configuration appears to be fine.";
610 610
                 break;
611 611
             default:
612
-                throw new Exception("The result code level " . $test->test_result['global'] . " is not defined!");
612
+                throw new Exception("The result code level ".$test->test_result['global']." is not defined!");
613 613
         }
614
-        $out .= $this->boxFlexible($test->test_result['global'], "<br><strong>Test Summary</strong><br>" . $message . "<br>See below for details<br><hr>");
614
+        $out .= $this->boxFlexible($test->test_result['global'], "<br><strong>Test Summary</strong><br>".$message."<br>See below for details<br><hr>");
615 615
         foreach ($test->out as $testValue) {
616 616
             foreach ($testValue as $o) {
617 617
                 $out .= $this->boxFlexible($o['level'], $o['message']);
Please login to merge, or discard this patch.