Test Setup Failed
Push — release_2_0 ( 26ade9...5d1ce5 )
by Stefan
06:36
created
web/lib/admin/UIElements.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         $find = array_keys($displayNames, $input, TRUE);
130 130
 
131 131
         if (count($find) == 0) { // this is an error! throw an Exception
132
-            throw new \Exception("The translation of an option name was requested, but the option is not known to the system: " . htmlentities($input));
132
+            throw new \Exception("The translation of an option name was requested, but the option is not known to the system: ".htmlentities($input));
133 133
         }
134 134
         \core\common\Entity::outOfThePotatoes();
135 135
         return $find[0];
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
         foreach ($optionlist as $option) {
152 152
             $type = $optioninfo->optionType($option['name']);
153
-            if (preg_match('/^' . $class . '/', $option['name']) && $option['level'] == "$level") {
153
+            if (preg_match('/^'.$class.'/', $option['name']) && $option['level'] == "$level") {
154 154
                 // all non-multilang attribs get this assignment ...
155 155
                 $language = "";
156 156
                 $content = $option['value'];
@@ -168,19 +168,19 @@  discard block
 block discarded – undo
168 168
                         $locationMarkers[] = $coords;
169 169
                         break;
170 170
                     case "file":
171
-                        $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td>";
171
+                        $retval .= "<tr><td>".$this->displayName($option['name'])."</td><td>$language</td><td>";
172 172
                         switch ($option['name']) {
173 173
                             case "general:logo_file":
174 174
                             case "fed:logo_file":
175
-                                $retval .= $this->previewImageinHTML('ROWID-' . $option['level'] . '-' . $option['row']);
175
+                                $retval .= $this->previewImageinHTML('ROWID-'.$option['level'].'-'.$option['row']);
176 176
                                 break;
177 177
                             case "eap:ca_file":
178 178
                             // fall-through intended: display both the same way
179 179
                             case "fed:minted_ca_file":
180
-                                $retval .= $this->previewCAinHTML('ROWID-' . $option['level'] . '-' . $option['row']);
180
+                                $retval .= $this->previewCAinHTML('ROWID-'.$option['level'].'-'.$option['row']);
181 181
                                 break;
182 182
                             case "support:info_file":
183
-                                $retval .= $this->previewInfoFileinHTML('ROWID-' . $option['level'] . '-' . $option['row']);
183
+                                $retval .= $this->previewInfoFileinHTML('ROWID-'.$option['level'].'-'.$option['row']);
184 184
                                 break;
185 185
                             default:
186 186
                         }
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
                             // do not display the option at all; it gets auto-set by the ProfileSilverbullet constructor and doesn't have to be seen
191 191
                             break;
192 192
                         }
193
-                        $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>" . ($content == "on" ? _("on") : _("off") ) . "</strong></td></tr>";
193
+                        $retval .= "<tr><td>".$this->displayName($option['name'])."</td><td>$language</td><td><strong>".($content == "on" ? _("on") : _("off"))."</strong></td></tr>";
194 194
                         break;
195 195
                     default:
196
-                        $retval .= "<tr><td>" . $this->displayName($option['name']) . "</td><td>$language</td><td><strong>$content</strong></td></tr>";
196
+                        $retval .= "<tr><td>".$this->displayName($option['name'])."</td><td>$language</td><td><strong>$content</strong></td></tr>";
197 197
                 }
198 198
             }
199 199
         }
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
             $locationCount = 0;
203 203
             foreach ($locationMarkers as $g) {
204 204
                 $locationCount++;
205
-                $marker .= '<marker name="' . $locationCount . '" lat="' . $g['lat'] . '" lng="' . $g['lon'] . '" />';
205
+                $marker .= '<marker name="'.$locationCount.'" lat="'.$g['lat'].'" lng="'.$g['lon'].'" />';
206 206
             }
207 207
             $marker .= '<\/markers>'; // some validator says this should be escaped
208 208
             $jMarker = json_encode($locationMarkers);
209
-            $retval .= '<tr><td><script>markers=\'' . $marker . '\'; jmarkers = \'' . $jMarker . '\';</script></td><td></td><td></td></tr>';
209
+            $retval .= '<tr><td><script>markers=\''.$marker.'\'; jmarkers = \''.$jMarker.'\';</script></td><td></td><td></td></tr>';
210 210
         }
211 211
         \core\common\Entity::outOfThePotatoes();
212 212
         return $retval;
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
         \core\common\Entity::intoThePotatoes();
223 223
         $idpoptions = $myInst->getAttributes();
224 224
         $retval = "<div class='infobox'>
225
-        <h2>" . sprintf(_("General %s details"), $this->nomenclatureInst) . "</h2>
225
+        <h2>" . sprintf(_("General %s details"), $this->nomenclatureInst)."</h2>
226 226
         <table>
227 227
             <tr>
228 228
                 <td>
229
-                    " . _("Country:") . "
229
+                    " . _("Country:")."
230 230
                 </td>
231 231
                 <td>
232 232
                 </td>
@@ -236,16 +236,16 @@  discard block
 block discarded – undo
236 236
         $retval .= $myFed->name;
237 237
         $retval .= "</strong>
238 238
                 </td>
239
-            </tr>" . $this->infoblock($idpoptions, "general", "IdP") . "
239
+            </tr>" . $this->infoblock($idpoptions, "general", "IdP")."
240 240
         </table>
241 241
     </div>";
242 242
 
243 243
         $blocks = [["support", _("Global Helpdesk Details")], ["media", _("Media Properties")]];
244 244
         foreach ($blocks as $block) {
245 245
             $retval .= "<div class='infobox'>
246
-            <h2>" . $block[1] . "</h2>
246
+            <h2>" . $block[1]."</h2>
247 247
             <table>" .
248
-                    $this->infoblock($idpoptions, $block[0], "IdP") .
248
+                    $this->infoblock($idpoptions, $block[0], "IdP").
249 249
                     "</table>
250 250
         </div>";
251 251
         }
@@ -260,12 +260,12 @@  discard block
 block discarded – undo
260 260
      */
261 261
     private function displaySize(int $number) {
262 262
         if ($number > 1024 * 1024) {
263
-            return round($number / 1024 / 1024, 2) . " MiB";
263
+            return round($number / 1024 / 1024, 2)." MiB";
264 264
         }
265 265
         if ($number > 1024) {
266
-            return round($number / 1024, 2) . " KiB";
266
+            return round($number / 1024, 2)." KiB";
267 267
         }
268
-        return $number . " B";
268
+        return $number." B";
269 269
     }
270 270
 
271 271
     /**
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         $this->checkROWIDpresence($cAReference);
338 338
         $rawResult = UIElements::getBlobFromDB($cAReference, FALSE);
339 339
         if (is_bool($rawResult)) { // we didn't actually get a CA!
340
-            $retval = "<div class='ca-summary'>" . _("There was an error while retrieving the certificate from the database!") . "</div>";
340
+            $retval = "<div class='ca-summary'>"._("There was an error while retrieving the certificate from the database!")."</div>";
341 341
             \core\common\Entity::outOfThePotatoes();
342 342
             return $retval;
343 343
         }
@@ -353,14 +353,14 @@  discard block
 block discarded – undo
353 353
 
354 354
         $details['name'] = preg_replace('/(.)\/(.)/', "$1<br/>$2", $details['name']);
355 355
         $details['name'] = preg_replace('/\//', "", $details['name']);
356
-        $certstatus = ( $details['root'] == 1 ? "R" : "I");
357
-        $certTooltip = ( $details['root'] == 1 ? _("Root CA") : _("Intermediate CA"));
356
+        $certstatus = ($details['root'] == 1 ? "R" : "I");
357
+        $certTooltip = ($details['root'] == 1 ? _("Root CA") : _("Intermediate CA"));
358 358
         if ($details['ca'] == 0 && $details['root'] != 1) {
359
-            $retval = "<div class='ca-summary' style='background-color:red'><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:maroon;  border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>S</div></div>" . _("This is a <strong>SERVER</strong> certificate!") . "<br/>" . $details['name'] . "</div>";
359
+            $retval = "<div class='ca-summary' style='background-color:red'><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:maroon;  border-radius:10px; text-align: center;'><div style='padding-top:3px; font-weight:bold; color:#ffffff;'>S</div></div>"._("This is a <strong>SERVER</strong> certificate!")."<br/>".$details['name']."</div>";
360 360
             \core\common\Entity::outOfThePotatoes();
361 361
             return $retval;
362 362
         }
363
-        $retval = "<div class='ca-summary'                                ><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:#0000ff; border-radius:10px; text-align: center;'><div title='$certTooltip' style='padding-top:3px; font-weight:bold; color:#ffffff;'>$certstatus</div></div>" . $details['name'] . "</div>";
363
+        $retval = "<div class='ca-summary'                                ><div style='position:absolute; right: 0px; width:20px; height:20px; background-color:#0000ff; border-radius:10px; text-align: center;'><div title='$certTooltip' style='padding-top:3px; font-weight:bold; color:#ffffff;'>$certstatus</div></div>".$details['name']."</div>";
364 364
         \core\common\Entity::outOfThePotatoes();
365 365
         return $retval;
366 366
     }
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
     public function previewImageinHTML($imageReference) {
375 375
         \core\common\Entity::intoThePotatoes();
376 376
         $this->checkROWIDpresence($imageReference);
377
-        $retval = "<img style='max-width:150px' src='inc/filepreview.php?id=" . $imageReference . "' alt='" . _("Preview of logo file") . "'/>";
377
+        $retval = "<img style='max-width:150px' src='inc/filepreview.php?id=".$imageReference."' alt='"._("Preview of logo file")."'/>";
378 378
         \core\common\Entity::outOfThePotatoes();
379 379
         return $retval;
380 380
     }
@@ -390,13 +390,13 @@  discard block
 block discarded – undo
390 390
         $this->checkROWIDpresence($fileReference);
391 391
         $fileBlob = UIElements::getBlobFromDB($fileReference, FALSE);
392 392
         if (is_bool($fileBlob)) { // we didn't actually get a file!
393
-            $retval = "<div class='ca-summary'>" . _("There was an error while retrieving the file from the database!") . "</div>";
393
+            $retval = "<div class='ca-summary'>"._("There was an error while retrieving the file from the database!")."</div>";
394 394
             \core\common\Entity::outOfThePotatoes();
395 395
             return $retval;
396 396
         }
397 397
         $decodedFileBlob = base64_decode($fileBlob);
398 398
         $fileinfo = new \finfo();
399
-        $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>";
399
+        $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>";
400 400
         \core\common\Entity::outOfThePotatoes();
401 401
         return $retval;
402 402
     }
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
             $retval .= "<tr><td>";
425 425
         }
426 426
         $finalCaption = ($caption !== NULL ? $caption : $uiMessages[$level]['text']);
427
-        $retval .= "<img class='icon' src='" . $uiMessages[$level]['icon'] . "' alt='" . $finalCaption . "' title='" . $finalCaption . "'/>";
427
+        $retval .= "<img class='icon' src='".$uiMessages[$level]['icon']."' alt='".$finalCaption."' title='".$finalCaption."'/>";
428 428
         if (!$omittabletags) {
429 429
             $retval .= "</td><td>";
430 430
         }
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
             return "";
505 505
         }
506 506
 
507
-        $loggerInstance->debug(4, "Consortium logo is at: " . ROOT . "/web/resources/images/consortium_logo_large.png");
508
-        $logogd = imagecreatefrompng(ROOT . "/web/resources/images/consortium_logo_large.png");
507
+        $loggerInstance->debug(4, "Consortium logo is at: ".ROOT."/web/resources/images/consortium_logo_large.png");
508
+        $logogd = imagecreatefrompng(ROOT."/web/resources/images/consortium_logo_large.png");
509 509
         if ($logogd === FALSE) { // consortium logo is bogus; don't do anything
510 510
             return "";
511 511
         }
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
         $scale = sqrt($maxoccupy / $totallogopixels);
521 521
         $loggerInstance->debug(4, "Scaling info: $scale, $maxoccupy, $totallogopixels\n");
522 522
         // determine final pixel size - round to multitude of $symbolsize to match exact symbol boundary
523
-        $targetwidth = (int)($symbolsize * round($sizelogo[0] * $scale / $symbolsize));
524
-        $targetheight = (int)($symbolsize * round($sizelogo[1] * $scale / $symbolsize));
523
+        $targetwidth = (int) ($symbolsize * round($sizelogo[0] * $scale / $symbolsize));
524
+        $targetheight = (int) ($symbolsize * round($sizelogo[1] * $scale / $symbolsize));
525 525
         // paint white below the logo, in case it has transparencies (looks bad)
526 526
         // have one symbol in each direction extra white space
527 527
         $whiteimage = imagecreate($targetwidth + 2 * $symbolsize, $targetheight + 2 * $symbolsize);
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
         }
531 531
         imagecolorallocate($whiteimage, 255, 255, 255);
532 532
         // also make sure the initial placement is a multitude of 12; otherwise "two half" symbols might be affected
533
-        $targetplacementx = (int)($symbolsize * round(($sizeinput[0] / 2 - ($targetwidth - $symbolsize) / 2) / $symbolsize));
534
-        $targetplacementy = (int)($symbolsize * round(($sizeinput[1] / 2 - ($targetheight - $symbolsize) / 2) / $symbolsize));
533
+        $targetplacementx = (int) ($symbolsize * round(($sizeinput[0] / 2 - ($targetwidth - $symbolsize) / 2) / $symbolsize));
534
+        $targetplacementy = (int) ($symbolsize * round(($sizeinput[1] / 2 - ($targetheight - $symbolsize) / 2) / $symbolsize));
535 535
         imagecopyresized($inputgd, $whiteimage, $targetplacementx - $symbolsize, $targetplacementy - $symbolsize, 0, 0, $targetwidth + 2 * $symbolsize, $targetheight + 2 * $symbolsize, $targetwidth + 2 * $symbolsize, $targetheight + 2 * $symbolsize);
536 536
         imagecopyresized($inputgd, $logogd, $targetplacementx, $targetplacementy, 0, 0, $targetwidth, $targetheight, $sizelogo[0], $sizelogo[1]);
537 537
         ob_start();
Please login to merge, or discard this patch.