Completed
Push — master ( b4d558...794865 )
by Stefan
08:35
created
web/admin/edit_profile.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -315,49 +315,49 @@  discard block
 block discarded – undo
315 315
             <tr>
316 316
                 <!-- checkbox for "verify-->
317 317
                 <td>
318
-                    <span id='verify_label' style='<?php echo ($realm == "" ? "color:#999999" : "" ); ?>'>
318
+                    <span id='verify_label' style='<?php echo ($realm == "" ? "color:#999999" : ""); ?>'>
319 319
                         <?php echo _("Verify user input to contain realm suffix:"); ?>
320 320
                     </span>
321 321
                 </td>
322 322
                 <td>
323
-                    <input type='checkbox' <?php echo ($verify != FALSE ? "checked" : "" );
324
-                        echo ($realm == "" ? "disabled" : "" ); ?> name='verify_support' onclick='
323
+                    <input type='checkbox' <?php echo ($verify != FALSE ? "checked" : "");
324
+                        echo ($realm == "" ? "disabled" : ""); ?> name='verify_support' onclick='
325 325
                             if (this.form.elements["verify_support"].checked != true) {
326 326
                                 this.form.elements["hint_support"].setAttribute("disabled", "disabled");
327 327
                             } else {
328 328
                                 this.form.elements["hint_support"].removeAttribute("disabled");
329 329
                             }
330 330
                             ;'/>
331
-                    <span id='hint_label' style='<?php echo ($realm == "" ? "color:#999999" : "" ); ?>'>
331
+                    <span id='hint_label' style='<?php echo ($realm == "" ? "color:#999999" : ""); ?>'>
332 332
 <?php echo _("Prefill user input with realm suffix:"); ?>
333 333
                     </span>
334
-                    <input type='checkbox' <?php echo ($verify == FALSE ? "disabled" : "" ); ?> name='hint_support' <?php echo ( $hint != FALSE ? "checked" : "" ); ?> />
334
+                    <input type='checkbox' <?php echo ($verify == FALSE ? "disabled" : ""); ?> name='hint_support' <?php echo ($hint != FALSE ? "checked" : ""); ?> />
335 335
                 </td>
336 336
             </tr>
337 337
             <tr>
338 338
                 <?php
339 339
                 // checkbox and input field for anonymity support, available only when realm is known
340
-                echo "<td><span id='anon_support_label' style='" . ($realm == "" ? "color:#999999" : "" ) . "'>" . _("Enable Anonymous Outer Identity:") . "</span></td>
341
-                <td><input type='checkbox' " . ($use_anon != FALSE ? "checked" : "" ) . ($realm == "" ? "disabled" : "" ) . " name='anon_support' onclick='
340
+                echo "<td><span id='anon_support_label' style='" . ($realm == "" ? "color:#999999" : "") . "'>" . _("Enable Anonymous Outer Identity:") . "</span></td>
341
+                <td><input type='checkbox' " . ($use_anon != FALSE ? "checked" : "") . ($realm == "" ? "disabled" : "") . " name='anon_support' onclick='
342 342
                            if (this.form.elements[\"anon_support\"].checked != true) {
343 343
                            this.form.elements[\"anon_local\"].setAttribute(\"disabled\", \"disabled\");
344 344
                            } else {
345 345
                            this.form.elements[\"anon_local\"].removeAttribute(\"disabled\");
346 346
                            };'/>
347
-                           <input type='text' " . ($checkuser_outer == FALSE ? "disabled" : "" ) . " name='anon_local' value='$anon_local'/></td>";
347
+                           <input type='text' " . ($checkuser_outer == FALSE ? "disabled" : "") . " name='anon_local' value='$anon_local'/></td>";
348 348
                 ?>
349 349
                 </tr>
350 350
                 <tr>
351 351
                     <?php
352 352
                 // checkbox and input field for check realm outer id, available only when realm is known
353
-                echo "<td><span id='checkuser_label' style='" . ($realm == "" ? "color:#999999" : "" ) . "'>" . _("Use special Outer Identity for realm checks:") . "</span></td>
354
-                <td><input type='checkbox' " . ($checkuser_outer != FALSE ? "checked" : "" ) . ($realm == "" ? "disabled" : "" ) . " name='checkuser_support' onclick='
353
+                echo "<td><span id='checkuser_label' style='" . ($realm == "" ? "color:#999999" : "") . "'>" . _("Use special Outer Identity for realm checks:") . "</span></td>
354
+                <td><input type='checkbox' " . ($checkuser_outer != FALSE ? "checked" : "") . ($realm == "" ? "disabled" : "") . " name='checkuser_support' onclick='
355 355
                            if (this.form.elements[\"checkuser_support\"].checked != true) {
356 356
                            this.form.elements[\"checkuser_local\"].setAttribute(\"disabled\", \"disabled\");
357 357
                            } else {
358 358
                            this.form.elements[\"checkuser_local\"].removeAttribute(\"disabled\");
359 359
                            };'/>
360
-                           <input type='text' " . ($checkuser_outer == FALSE ? "disabled" : "" ) . " name='checkuser_local' value='$checkuser_value'/></td>";
360
+                           <input type='text' " . ($checkuser_outer == FALSE ? "disabled" : "") . " name='checkuser_local' value='$checkuser_value'/></td>";
361 361
                 ?>
362 362
                 </tr>
363 363
         </table>
@@ -373,14 +373,14 @@  discard block
 block discarded – undo
373 373
     <p>
374 374
 
375 375
         <?php
376
-        echo "<span id='redirect_label' style='" . ($realm == "" ? "color:#999999" : "" ) . "'><label for='redirect'>" . _("Redirect end users to own web page:") . "</label></span>
377
-                          <input type='checkbox'  name='redirect' id='redirect' " . ($blacklisted === FALSE ? "" : "checked " ) . "onclick='
376
+        echo "<span id='redirect_label' style='" . ($realm == "" ? "color:#999999" : "") . "'><label for='redirect'>" . _("Redirect end users to own web page:") . "</label></span>
377
+                          <input type='checkbox'  name='redirect' id='redirect' " . ($blacklisted === FALSE ? "" : "checked ") . "onclick='
378 378
                               if (this.form.elements[\"redirect\"].checked != true) {
379 379
                                 this.form.elements[\"redirect_target\"].setAttribute(\"disabled\", \"disabled\");
380 380
                               } else {
381 381
                                 this.form.elements[\"redirect_target\"].removeAttribute(\"disabled\");
382 382
                               };'/>
383
-                          <input type='text' name='redirect_target' " . ($blacklisted !== FALSE ? "value='$blacklisted'" : "disabled" ) . "/>";
383
+                          <input type='text' name='redirect_target' " . ($blacklisted !== FALSE ? "value='$blacklisted'" : "disabled") . "/>";
384 384
         ?>
385 385
     </p>
386 386
 
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
     function priority($eapType, $isenabled, $priority) {
397 397
         echo "<td><select id='$eapType-priority' name='$eapType-priority' " . (!$isenabled ? "disabled='disabled'" : "") . ">";
398 398
         for ($a = 1; $a < 7; $a = $a + 1)
399
-            echo "<option id='$eapType-$a' value='$a' " . ( $isenabled && $a == $priority ? "selected" : "" ) . ">$a</option>";
399
+            echo "<option id='$eapType-$a' value='$a' " . ($isenabled && $a == $priority ? "selected" : "") . ">$a</option>";
400 400
         echo "</select></td>";
401 401
     }
402 402
 
Please login to merge, or discard this patch.
Braces   +68 added lines, -46 removed lines patch added patch discarded remove patch
@@ -157,9 +157,10 @@  discard block
 block discarded – undo
157 157
     if (count($blacklisted) > 0) {
158 158
         $blacklisted = unserialize($blacklisted[0]['value']);
159 159
         $blacklisted = $blacklisted['content'];
160
-    } else
161
-        $blacklisted = FALSE;
162
-} else {
160
+    } else {
161
+            $blacklisted = FALSE;
162
+    }
163
+    } else {
163 164
     $wizard_style = TRUE;
164 165
     $edit_mode = FALSE;
165 166
 }
@@ -173,10 +174,11 @@  discard block
 block discarded – undo
173 174
     ?>
174 175
     <h1>
175 176
         <?php
176
-        if ($wizard_style)
177
-            echo _("Step 3: Defining a user group profile");
178
-        else
179
-            printf(_("Edit profile '%s' ..."), $prefill_name);
177
+        if ($wizard_style) {
178
+                    echo _("Step 3: Defining a user group profile");
179
+        } else {
180
+                    printf(_("Edit profile '%s' ..."), $prefill_name);
181
+        }
180 182
         ?>
181 183
     </h1>
182 184
     <div class='infobox'>
@@ -219,8 +221,9 @@  discard block
 block discarded – undo
219 221
             <strong><?php echo _("General Profile properties"); ?></strong>
220 222
         </legend>
221 223
         <?php
222
-        if ($wizard_style)
223
-            echo "<p>" . _("We will now define a profile for your user group(s).  You can add as many profiles as you like by choosing the appropriate button on the end of the page. After we are done, the wizard is finished and you will be taken to the main IdP administration page.") . "</p>";
224
+        if ($wizard_style) {
225
+                    echo "<p>" . _("We will now define a profile for your user group(s).  You can add as many profiles as you like by choosing the appropriate button on the end of the page. After we are done, the wizard is finished and you will be taken to the main IdP administration page.") . "</p>";
226
+        }
224 227
         ?>
225 228
         <h3><?php echo _("Profile Name and RADIUS realm"); ?></h3>
226 229
         <?php
@@ -228,8 +231,9 @@  discard block
 block discarded – undo
228 231
             echo "<p>" . _("First of all we need a name for the profile. This will be displayed to end users, so you may want to choose a descriptive name like 'Professors', 'Students of the Faculty of Bioscience', etc.") . "</p>";
229 232
             echo "<p>" . _("Optionally, you can provide a longer descriptive text about who this profile is for. If you specify it, it will be displayed on the download page after the user has selected the profile name in the list.") . "</p>";
230 233
             echo "<p>" . _("You can also tell us your RADIUS realm. ");
231
-            if (count(Config::$RADIUSTESTS['UDP-hosts']) > 0 || Config::$RADIUSTESTS['TLS-discoverytag'] != "")
232
-                printf(_("This is useful if you want to use the sanity check module later, which tests reachability of your realm in the %s infrastructure. "), CONFIG::$CONSORTIUM['name']);
234
+            if (count(Config::$RADIUSTESTS['UDP-hosts']) > 0 || Config::$RADIUSTESTS['TLS-discoverytag'] != "") {
235
+                            printf(_("This is useful if you want to use the sanity check module later, which tests reachability of your realm in the %s infrastructure. "), CONFIG::$CONSORTIUM['name']);
236
+            }
233 237
             echo _("It is required to enter the realm name if you want to support anonymous outer identities (see below).") . "</p>";
234 238
         }
235 239
         ?>
@@ -240,9 +244,10 @@  discard block
 block discarded – undo
240 244
             if ($edit_mode) {
241 245
                 $existing_attribs = $my_profile->getAttributes();
242 246
 
243
-                foreach ($existing_attribs as $existing_attribute)
244
-                    if ($existing_attribute['level'] == "Profile")
247
+                foreach ($existing_attribs as $existing_attribute) {
248
+                                    if ($existing_attribute['level'] == "Profile")
245 249
                         $prepopulate[] = $existing_attribute;
250
+                }
246 251
             }
247 252
             add_option("profile", $prepopulate);
248 253
             ?>
@@ -367,8 +372,9 @@  discard block
 block discarded – undo
367 372
     <h3><?php echo _("Installer Download Location"); ?></h3>
368 373
 
369 374
     <?php
370
-    if ($wizard_style)
371
-        echo "<p>" . _("The CAT has a download area for end users. There, they will, for example, learn about the support pointers you entered earlier. The CAT can also immediately offer the installers for the profile for download. If you don't want that, you can instead enter a web site location where you want your users to be redirected to. You, as the administrator, can still download the profiles to place them on that page (see the 'Compatibility Matrix' button on the dashboard).") . "</p>";
375
+    if ($wizard_style) {
376
+            echo "<p>" . _("The CAT has a download area for end users. There, they will, for example, learn about the support pointers you entered earlier. The CAT can also immediately offer the installers for the profile for download. If you don't want that, you can instead enter a web site location where you want your users to be redirected to. You, as the administrator, can still download the profiles to place them on that page (see the 'Compatibility Matrix' button on the dashboard).") . "</p>";
377
+    }
372 378
     ?>
373 379
     <p>
374 380
 
@@ -388,15 +394,17 @@  discard block
 block discarded – undo
388 394
 <fieldset class="option_container">
389 395
     <legend><strong><?php echo _("Supported EAP types"); ?></strong></legend>
390 396
     <?php
391
-    if ($wizard_style)
392
-        echo "<p>" . _("Now, we need to know which EAP types your IdP supports. If you support multiple EAP types, you can assign every type a priority (1=highest). This tool will always generate an automatic installer for the EAP type with the highest priority; only if the user's device can't use that EAP type, we will use an EAP type further down in the list.") . "</p>";
397
+    if ($wizard_style) {
398
+            echo "<p>" . _("Now, we need to know which EAP types your IdP supports. If you support multiple EAP types, you can assign every type a priority (1=highest). This tool will always generate an automatic installer for the EAP type with the highest priority; only if the user's device can't use that EAP type, we will use an EAP type further down in the list.") . "</p>";
399
+    }
393 400
     ?>
394 401
     <?php
395 402
 
396 403
     function priority($eapType, $isenabled, $priority) {
397 404
         echo "<td><select id='$eapType-priority' name='$eapType-priority' " . (!$isenabled ? "disabled='disabled'" : "") . ">";
398
-        for ($a = 1; $a < 7; $a = $a + 1)
399
-            echo "<option id='$eapType-$a' value='$a' " . ( $isenabled && $a == $priority ? "selected" : "" ) . ">$a</option>";
405
+        for ($a = 1; $a < 7; $a = $a + 1) {
406
+                    echo "<option id='$eapType-$a' value='$a' " . ( $isenabled && $a == $priority ? "selected" : "" ) . ">$a</option>";
407
+        }
400 408
         echo "</select></td>";
401 409
     }
402 410
 
@@ -405,18 +413,20 @@  discard block
 block discarded – undo
405 413
 
406 414
         $eapoptions = [];
407 415
 
408
-        foreach ($idpwideoptions as $option)
409
-            if ($option['level'] == "IdP" && preg_match('/^eap/', $option['name']))
416
+        foreach ($idpwideoptions as $option) {
417
+                    if ($option['level'] == "IdP" && preg_match('/^eap/', $option['name']))
410 418
                 $eapoptions[] = $option['name'];
419
+        }
411 420
 
412 421
         $eapoptions = array_count_values($eapoptions);
413 422
 
414 423
         if (count($eapoptions) > 0) {
415 424
             echo "<strong>" . _("EAP options inherited from Global level:") . "</strong><br />";
416
-            foreach ($eapoptions as $optionname => $count)
417
-            /// option count and enumeration
425
+            foreach ($eapoptions as $optionname => $count) {
426
+                        /// option count and enumeration
418 427
             /// Example: "(3x) Server Name"
419 428
                 printf(_("(%dx) %s") . "<br />", $count, display_name($optionname));
429
+            }
420 430
         }
421 431
 
422 432
         echo "</div></td>";
@@ -431,10 +441,11 @@  discard block
 block discarded – undo
431 441
     foreach ($methods as $a) {
432 442
         $display = display_name($a);
433 443
         $enabled = FALSE;
434
-        if ($edit_mode)
435
-            foreach ($prefill_methods as $prio => $value) {
444
+        if ($edit_mode) {
445
+                    foreach ($prefill_methods as $prio => $value) {
436 446
                 if (display_name($a) == display_name($value)) {
437 447
                     $enabled = TRUE;
448
+        }
438 449
                     $countactive = $prio + 1;
439 450
                 }
440 451
             }
@@ -473,8 +484,9 @@  discard block
 block discarded – undo
473 484
                         <?php
474 485
                         foreach ($methods as $a) {
475 486
                             $display = display_name($a);
476
-                            if (!isset($D[display_name($a)]))
477
-                                print '<li class="eap1">' . display_name($a) . "</li>\n";
487
+                            if (!isset($D[display_name($a)])) {
488
+                                                            print '<li class="eap1">' . display_name($a) . "</li>\n";
489
+                            }
478 490
                         }
479 491
                         ?>
480 492
                     </ol>
@@ -498,13 +510,15 @@  discard block
 block discarded – undo
498 510
         <?php
499 511
         $idp_options = $my_inst->getAttributes();
500 512
         $has_support_options = [];
501
-        foreach ($idp_options as $idp_option)
502
-            if (preg_match("/^support:/", $idp_option['name']))
513
+        foreach ($idp_options as $idp_option) {
514
+                    if (preg_match("/^support:/", $idp_option['name']))
503 515
                 $has_support_options[$idp_option['name']] = "SET";
516
+        }
504 517
         if (count($has_support_options) > 0) {
505 518
             $text = "<ul>";
506
-            foreach ($has_support_options as $key => $value)
507
-                $text .= "<li><strong>" . display_name($key) . "</strong></li>";
519
+            foreach ($has_support_options as $key => $value) {
520
+                            $text .= "<li><strong>" . display_name($key) . "</strong></li>";
521
+            }
508 522
             $text .= "</ul>";
509 523
             printf(ngettext("The option %s is already defined IdP-wide. If you set it here on profile level, this setting will override the IdP-wide one.", "The options %s are already defined IdP-wide. If you set them here on profile level, these settings will override the IdP-wide ones.", count($has_support_options)), $text);
510 524
         }
@@ -515,9 +529,10 @@  discard block
 block discarded – undo
515 529
         $prepopulate = [];
516 530
         if ($edit_mode) {
517 531
             $existing_attribs = $my_profile->getAttributes();
518
-            foreach ($existing_attribs as $existing_attribute)
519
-                if ($existing_attribute['level'] == "Profile")
532
+            foreach ($existing_attribs as $existing_attribute) {
533
+                            if ($existing_attribute['level'] == "Profile")
520 534
                     $prepopulate[] = $existing_attribute;
535
+            }
521 536
         }
522 537
         add_option("support", $prepopulate);
523 538
         ?>
@@ -529,13 +544,15 @@  discard block
 block discarded – undo
529 544
     <p>
530 545
         <?php
531 546
         $has_eap_options = [];
532
-        foreach ($idp_options as $idp_option)
533
-            if (preg_match("/^eap:/", $idp_option['name']))
547
+        foreach ($idp_options as $idp_option) {
548
+                    if (preg_match("/^eap:/", $idp_option['name']))
534 549
                 $has_eap_options[$idp_option['name']] = "SET";
550
+        }
535 551
         if (count($has_eap_options) > 0) {
536 552
             $text = "<ul>";
537
-            foreach ($has_eap_options as $key => $value)
538
-                $text .= "<li><strong>" . display_name($key) . "</strong></li>";
553
+            foreach ($has_eap_options as $key => $value) {
554
+                            $text .= "<li><strong>" . display_name($key) . "</strong></li>";
555
+            }
539 556
             $text .= "</ul>";
540 557
             printf(ngettext("The option %s is already defined IdP-wide. If you set it here on profile level, this setting will override the IdP-wide one.", "The options %s are already defined IdP-wide. If you set them here on profile level, these settings will override the IdP-wide ones.", count($has_eap_options)), $text);
541 558
         }
@@ -546,9 +563,10 @@  discard block
 block discarded – undo
546 563
         $prepopulate = [];
547 564
         if ($edit_mode) {
548 565
             $existing_attribs = $my_profile->getAttributes();
549
-            foreach ($existing_attribs as $existing_attribute)
550
-                if ($existing_attribute['level'] == "Profile")
566
+            foreach ($existing_attribs as $existing_attribute) {
567
+                            if ($existing_attribute['level'] == "Profile")
551 568
                     $prepopulate[] = $existing_attribute;
569
+            }
552 570
         }
553 571
         add_option("eap", $prepopulate);
554 572
         ?>
@@ -561,13 +579,15 @@  discard block
 block discarded – undo
561 579
         <?php
562 580
         $idp_options = $my_inst->getAttributes();
563 581
         $has_support_options = array();
564
-        foreach ($idp_options as $idp_option)
565
-            if (preg_match("/^media:/", $idp_option['name']))
582
+        foreach ($idp_options as $idp_option) {
583
+                    if (preg_match("/^media:/", $idp_option['name']))
566 584
                 $has_support_options[$idp_option['name']] = "SET";
585
+        }
567 586
         if (count($has_support_options) > 0) {
568 587
             $text = "<ul>";
569
-            foreach ($has_support_options as $key => $value)
570
-                $text .= "<li><strong>" . display_name($key) . "</strong></li>";
588
+            foreach ($has_support_options as $key => $value) {
589
+                            $text .= "<li><strong>" . display_name($key) . "</strong></li>";
590
+            }
571 591
             $text .= "</ul>";
572 592
             printf(ngettext("The option %s is already defined IdP-wide. If you set it here on profile level, this setting will override the IdP-wide one.", "The options %s are already defined IdP-wide. If you set them here on profile level, these settings will override the IdP-wide ones.", count($has_support_options)), $text);
573 593
         }
@@ -578,16 +598,18 @@  discard block
 block discarded – undo
578 598
         $prepopulate = array();
579 599
         if ($edit_mode) {
580 600
             $existing_attribs = $my_profile->getAttributes();
581
-            foreach ($existing_attribs as $existing_attribute)
582
-                if ($existing_attribute['level'] == "Profile")
601
+            foreach ($existing_attribs as $existing_attribute) {
602
+                            if ($existing_attribute['level'] == "Profile")
583 603
                     $prepopulate[] = $existing_attribute;
604
+            }
584 605
         }
585 606
         add_option("media", $prepopulate);
586 607
         ?>
587 608
     </table>
588 609
     <button type='button' class='newoption' onclick='addDefaultMediaOptions()'><?php echo _("Add new option"); ?></button></fieldset>
589 610
 <?php
590
-if ($wizard_style)
611
+if ($wizard_style) {
591 612
     echo "<p>" . _("When you are sure that everything is correct, please click on 'Save data' and you will be taken to your IdP Dashboard page.") . "</p>";
613
+}
592 614
 echo "<p><button type='submit' name='submitbutton' value='" . BUTTON_SAVE . "'>" . _("Save data") . "</button><button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location = \"overview_idp.php?inst_id=$my_inst->identifier\"'>" . _("Discard changes") . "</button></p></form>";
593 615
 footer();
Please login to merge, or discard this patch.