Issues (212)

Security Analysis    12 potential vulnerabilities

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting (2)
Response Splitting can be used to send arbitrary responses.
  File Manipulation (5)
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection (1)
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting (2)
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

web/admin/overview_federation.php (2 issues)

1
<?php
2
/*
3
 * *****************************************************************************
4
 * Contributions to this work were made on behalf of the GÉANT project, a 
5
 * project that has received funding from the European Union’s Framework 
6
 * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus),
7
 * Horizon 2020 research and innovation programme under Grant Agreements No. 
8
 * 691567 (GN4-1) and No. 731122 (GN4-2).
9
 * On behalf of the aforementioned projects, GEANT Association is the sole owner
10
 * of the copyright in all material which was developed by a member of the GÉANT
11
 * project. GÉANT Vereniging (Association) is registered with the Chamber of 
12
 * Commerce in Amsterdam with registration number 40535155 and operates in the 
13
 * UK as a branch of GÉANT Vereniging.
14
 * 
15
 * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. 
16
 * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK
17
 *
18
 * License: see the web/copyright.inc.php file in the file structure or
19
 *          <base_url>/copyright.php after deploying the software
20
 */
21
22
/**
23
 * This page displays the dashboard overview of a Federation.
24
 * 
25
 * @author Stefan Winter <[email protected]>
26
 * @author Tomasz Wolniewicz <[email protected]>
27
 */
28
29
require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php";
30
31
$deco = new \web\lib\admin\PageDecoration();
32
$uiElements = new web\lib\admin\UIElements();
33
$validator = new \web\lib\common\InputValidation();
34
$cat = new \core\CAT(); // initialises Entity static members
35
36
//$OpenRoamingSymbol = "<img src='../resources/images/icons/or.svg' alt='OpenRoaming' title='OpenRoaming' class='cat-icon'>";
37
$OpenRoamingSymbol = "OR";
38
$fedArray = [];
39
$stausIcons = [
40
    \core\IdP::PROFILES_SHOWTIME => ['img' => 'Tabler/checks-green.svg', 'text' => _("At least one profile is fully configured and visible in the user interface")],
41
    \core\IdP::PROFILES_CONFIGURED => ['img' => 'Tabler/check-green.svg', 'text' => _("At least one profile is fully configured but none are set as production-ready therefore the institution is not visible in the user interface")],
42
];
43
44
echo $deco->defaultPagePrelude(sprintf(_("%s: %s Management"), \config\Master::APPEARANCE['productname'], $uiElements->nomenclatureFed));
45
$user = new \core\User($_SESSION['user']);
46
?>
47
<script src="js/XHR.js" type="text/javascript"></script>
48
<script src="js/popup_redirect.js" type="text/javascript"></script>
49
<script>
50
var show_downloads = "<?php echo _("Show downloads") ?>";                
51
var hide_downloads = "<?php echo _("Hide downloads") ?>";
52
</script>
53
<script src="js/nro.js" type="text/javascript"></script>
54
<script type="text/javascript" src="../external/jquery/jquery-ui.js"></script> 
55
<link rel="stylesheet" type="text/css" href="../external/jquery/jquery-ui.css" />
56
</head>
57
<body>
58
    <?php
59
    echo $deco->productheader("FEDERATION");
60
    $readonly = \config\Master::DB['INST']['readonly'];
61
    ?>
62
    <div id="main_content">
63
    <h1>
64
        <?php echo sprintf(_("%s Overview"), $uiElements->nomenclatureFed); ?>
65
    </h1>
66
    <div class="infobox">
67
        <h2><?php $tablecaption = _("Your Personal Information"); echo $tablecaption; ?></h2>
68
        <table>
69
            <caption><?php echo $tablecaption; ?></caption>
70
            <tr>
71
                <th class="wai-invisible" scope="col"><?php echo _("Property Type"); ?></th>
72
                <th class="wai-invisible" scope="col"><?php echo _("Language if applicable"); ?></th>
73
                <th class="wai-invisible" scope="col"><?php echo _("Property Value"); ?></th>
74
            </tr>            
75
            <?php echo $uiElements->infoblock($user->getAttributes(), "user", "User"); ?>
76
            <tr>
77
                <td>
78
                    <?php echo ""._("Unique Identifier") ?>
79
                </td>
80
                <td>
81
                </td>
82
                <td>
83
                    <span class='tooltip' style='cursor: pointer;' onclick='alert("<?php echo str_replace('\'', '\x27', str_replace('"', '\x22', $_SESSION["user"])); ?>")'><?php echo _("click to display"); ?></span>
84
                </td>
85
            </tr>
86
        </table>
87
    </div>
88
    <?php if ($user->isSuperadmin() || $user->isSupport()) {
89
        $fed_id = '';
90
        $countryList = $cat->printCountryList(1);
91
        $fedIdentifiers = array_keys($countryList);
92
        if (isset($_GET['fed_id'])) {
93
            [$fed, $editMode] = $validator->existingFederationInt($_GET['fed_id'], $_SESSION['user']);
94
            $fed_id = $fed->tld;
95
            $_SESSION['selected_fed'] = $fed_id;
96
            $feds = [['name'=>'user:fedadmin', 'value' => $fed_id, 'mode' => '']];
97
        } elseif (isset($_SESSION['selected_fed'])) {
98
            [$fed, $editMode] = $validator->existingFederationInt($_SESSION['selected_fed'], $_SESSION['user']);
99
            $fed_id = $fed->tld;
100
            $feds = [['name'=>'user:fedadmin', 'value' => $fed_id, 'mode' => '']];
101
        } else {
102
            $feds = $user->getAttributes("user:fedadmin");
103
            $editMode = 'fullaccess';
104
        }        
105
        ?>
106
    <div class="infobox"><h1><?php echo _("Select a different federation") ?></h1>
107
        <select id="fed_selection">
108
            <option value="XX"><?php echo _("select from below") ?></option>
109
    <?php
110
    foreach ($cat->printCountryList(1) as $country => $name) {
111
        $selected = '';
112
        if ($country == strtoupper($fed_id)) {
113
            $selected = 'selected';
114
        }
115
    echo "<option value='$country' $selected>$name</option>\n";
116
    }    
117
    ?>
118
        </select>
119
    
120
    
121
    </div>
122
    <?php } 
123
    $mgmt = new \core\UserManagement();
124
    $fed_id = '';
125
    if (!$user->isSuperadmin() && !$user->isSupport()) {
126
        if (!$user->isFederationAdmin()) {
127
            echo "<p>".sprintf(_("You are not a %s manager."), $uiElements->nomenclatureFed)."</p>";
128
            echo $deco->footer();
129
            exit(0);
130
        } else {
131
            $feds = $user->getAttributes("user:fedadmin");
132
            $editMode = 'fullaccess';
133
        }
134
    }    
135
  
136
    foreach ($feds as $onefed) {
137
        $fedId = strtoupper($onefed['value']);
138
        $fedArray[$fedId] = new \core\Federation($fedId);
139
    }
140
    
141
    foreach ($fedArray as $fedId => $thefed) {
142
        ?>
143
        <br>
144
145
        <div class='infobox'><h2>
146
                <?php $tablecaption2 = sprintf(_("%s Properties: %s"), $uiElements->nomenclatureFed, $thefed->name); echo $tablecaption2; ?>
147
            </h2>
148
            <table>
149
            <caption><?php echo $tablecaption2; ?></caption>
150
            <tr>
151
                <th class="wai-invisible" scope="col"><?php echo _("Property Type"); ?></th>
152
                <th class="wai-invisible" scope="col"><?php echo _("Language if applicable"); ?></th>
153
                <th class="wai-invisible" scope="col"><?php echo _("Property Value"); ?></th>
154
            </tr>
155
                <!-- fed properties -->
156
                <tr>
157
                    <td>
158
                        <?php echo ""._("Country") ?>
159
                    </td>
160
                    <td>
161
                    </td>
162
                    <td>
163
                        <strong><?php
164
                            echo $thefed->name;
165
                            ?></strong>
166
                    </td>
167
                </tr>
168
                <?php
169
                echo $uiElements->infoblock($thefed->getAttributes(), "fed", "FED");
170
                if ($readonly === FALSE) {
171
                        if ($editMode == 'fullaccess') {
172
                            $editLabel = _("Edit ...");
173
                        } else {
174
                            $editLabel = _("View ...");
175
                        }
176
                    ?>
177
                    <tr>
178
                        <td colspan='3' style='text-align:right;'><form action='edit_federation.php' method='POST'><input type="hidden" name='fed_id' value='<?php echo strtoupper($thefed->tld); ?>'/><button type="submit"><?php echo $editLabel ?></button></form></td>
179
                    </tr>
180
                    <?php
181
                }
182
                ?>
183
            </table>
184
        </div>
185
        <?php if (\core\CAT::radiusProfilesEnabled()) { ?>
186
        <div class='infobox'>
187
            <h2>
188
                <?php $tablecaption3 = sprintf(_("%s Statistics: %s"), $uiElements->nomenclatureFed, $thefed->name); echo $tablecaption3; ?>
189
            </h2>
190
            <table width='100%'>
191
                <tbody>
192
                <!-- idp stats -->
193
                <tr>
194
                    <th scope='col' style='text-align:left;'> <?php echo _("IdPs Total"); ?></th>
195
                    <th scope='col' style='text-align:right;' colspan='3'> <?php echo _("Public Download") ?></th>
196
                </tr>
197
                <tr>
198
                    <td> <?php echo count($thefed->listIdentityProviders(0)); ?></td>
199
                    <td style='text-align:right;' colspan='3'> <?php echo count($thefed->listIdentityProviders(1)); ?>
200
                    </td>
201
                </tr>
202
                </tbody>
203
                <tbody style="display:none" class="stat-downloads">
204
                <!-- download stats -->
205
                <tr><td colspan='3'></td></tr>
206
                <tr>
207
                    <th scope='col' style='text-align:left;'> <?php echo _("Downloads"); ?></th>
208
                    <th scope='col' style='text-align:left;'> <?php echo _("Admin"); ?></th>
209
                    <th scope='col' style='text-align:left;'> <?php echo \core\ProfileSilverbullet::PRODUCTNAME ?></th>
210
                    <th scope='col' style='text-align:left;'> <?php 
211
/// this should not be translated as "Username"
212
                    echo _("User"); 
213
                    ?></th>
214
                </tr>
215
                <?php echo $thefed->downloadStats("table", "FEDERATION"); ?>
216
                </tbody>
217
            </table>
218
            <button style="position:absolute; bottom:9px;" class="stat-button"><?php echo _("Show downloads") ?></button>
219
        </div>
220
        <?php } ?>
221
        <br>
222
            <?php        
223
    if ($editMode === 'fullaccess') {
224
    ?>
225
    <form action='overview_certificates.php' method='GET' accept-charset='UTF-8'>
226
        <input type="hidden" name='fed_id' value='<?php echo strtoupper($thefed->tld); ?>'/>
227
        <button type='submit'><?php echo sprintf(_('RADIUS/TLS Certificate management')); ?></button>
228
    </form>
229
230
    <?php
231
    }
232
    }
233
234
    if (isset($_POST['submitbutton']) &&
235
            $_POST['submitbutton'] == web\lib\common\FormElements::BUTTON_DELETE &&
236
            isset($_POST['invitation_id'])) {
237
        $mgmt->invalidateToken(htmlspecialchars(strip_tags(filter_input(INPUT_POST, 'invitation_id'))));
238
    }
239
240
    if (isset($_GET['invitation'])) {
241
        echo "<div class='ca-summary' style='position:relative;'><table>";
242
        $counter = $validator->integer($_GET['successcount']);
243
        if ($counter === FALSE) {
244
            $counter = 1;
245
        }
246
        switch ($_GET['invitation']) {
247
            case "SUCCESS":
248
                $cryptText = "";
249
                switch ($_GET['transportsecurity']) {
250
                    case "ENCRYPTED":
251
                        $cryptText = ngettext("It was sent with transport security (encryption).", "They were sent with transport security (encryption).", $counter);
252
                        break;
253
                    case "CLEAR":
254
                        $cryptText = ngettext("It was sent in clear text (no encryption).", "They were sent in clear text (no encryption).", $counter);
255
                        break;
256
                    case "PARTIAL":
257
                        $cryptText = _("A subset of the mails were sent with transport encryption, the rest in clear text.");
258
                        break;
259
                    default:
260
                        throw new Exception("Error: unknown encryption status of invitation!?!");
261
                }
262
                echo $uiElements->boxRemark(ngettext("The invitation email was sent successfully.", "All invitation emails were sent successfully.", $counter)." ".$cryptText, _("Sent successfully."));
263
                break;
264
            case "FAILURE":
265
                echo $uiElements->boxError(_("No invitation email could be sent!"), _("Sending failure!"));
266
                break;
267
            case "PARTIAL":
268
                $cryptText = "";
269
                switch ($_GET['transportsecurity']) {
270
                    case "ENCRYPTED":
271
                        $cryptText = ngettext("The successful one was sent with transport security (encryption).", "The successful ones were sent with transport security (encryption).", $counter);
272
                        break;
273
                    case "CLEAR":
274
                        $cryptText = ngettext("The successful one was sent in clear text (no encryption).", "The successful ones were sent in clear text (no encryption).", $counter);
275
                        break;
276
                    case "PARTIAL":
277
                        $cryptText = _("A subset of the successfully sent mails were sent with transport encryption, the rest in clear text.");
278
                        break;
279
                    default:
280
                        throw new Exception("Error: unknown encryption status of invitation!?!");
281
                }
282
                echo $uiElements->boxWarning(sprintf(_("Some invitation emails were sent successfully (%s in total), the others failed."), $counter)." ".$cryptText, _("Partial success."));
283
                break;
284
            case "INVALIDSYNTAX":
285
                echo $uiElements->boxError(_("The invitation email address was malformed, no invitation was sent!"), _("The invitation email address was malformed, no invitation was sent!"));
286
                break;
287
            default:
288
                echo $uiElements->boxError(_("Error: unknown result code of invitation!?!"), _("Unknown result!"));
289
        }
290
        echo "</table></div>";
291
    }
292
    // our own location, to give to diag URLs
293
    if (isset($_SERVER['HTTPS'])) {
294
        $link = 'https://';
295
    } else {
296
        $link = 'http://';
297
    }
298
    $link .= $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
299
    $link = htmlspecialchars($link);
300
    if (\core\CAT::radiusProfilesEnabled() && core\CAT::diagnosticsEnabled()) {
301
        echo "<table><tr>
302
                        <td>".sprintf(_("Diagnose reachability and connection parameters of any %s %s"), \config\ConfAssistant::CONSORTIUM['display_name'], $uiElements->nomenclatureIdP)."</td>
303
                        <td><form method='post' action='../diag/action_realmcheck.php' accept-charset='UTF-8'>
304
                              <input type='hidden' name='comefrom' id='comefrom' value='$link'/>
305
                              <button id='realmcheck' style='cursor:pointer;' type='submit'>"._("Go!")."</button>
306
                            </form>
307
                        </td>
308
                    </tr>
309
                    </table>";
310
    }
311
    if (\config\ConfAssistant::CONSORTIUM['name'] == 'eduroam') {
312
        $helptext = "<h3>".sprintf(_("Need help? Refer to the <a href='%s'>%s manual</a>"), "https://wiki.geant.org/x/qJg7Bw", $uiElements->nomenclatureFed)."</h3>";
313
    } else {
314
        $helptext = "";
315
    }
316
    ?>
317
    <table class='user_overview' style='border:0px; width:unset'>
318
        <caption><?php echo _("Participant Details"); ?></caption>
319
        </tr>
320
        <?php
321
        $userIdps = $user->listOwnerships();
322
        foreach ($fedArray as $fedId => $thefed) {
0 ignored issues
show
Comprehensibility Bug introduced by
$thefed is overwriting a variable from outer foreach loop.
Loading history...
Comprehensibility Bug introduced by
$fedId is overwriting a variable from outer foreach loop.
Loading history...
323
            $hideWarningsFlag = $thefed->getAttributes('fed:hide-admin-warnings');
324
            $hideWarnings = false;
325
            if ($hideWarningsFlag !== []) {
326
                $hideWarnings = true;
327
            }
328
            echo "<tr><td colspan='9'><strong>".sprintf(_("The following %s are in your %s %s:"), $uiElements->nomenclatureParticipant, $uiElements->nomenclatureFed, '<span style="color:green">'.$thefed->name.'</span>')."</strong></td></tr>";            
329
            ?>
330
        <tr>
331
            <th scope='col'><?php echo sprintf(_("%s Name"), $uiElements->nomenclatureParticipant); ?></th>
332
            <?php if (\core\CAT::radiusProfilesEnabled()) { ?>
333
            <th scope='col'><?php echo _("Status") ?></th>
334
            <th scope='col'><?php echo $OpenRoamingSymbol ?></th>
335
            <th scope='col'><?php echo _("Cert"); ?></th>
336
            <?php
337
            }
338
            $pending_invites = $mgmt->listPendingInvitations();
339
            if (\core\CAT::hostedSPEnabled()) {
340
            echo "<th scope='col'>"._("MSP")."</th>";
341
            }
342
            if (\config\Master::DB['enforce-external-sync']) {
343
                echo "<th scope='col' style='max-width: 12em'>".sprintf(_("%s Database Link Status"), \config\ConfAssistant::CONSORTIUM['display_name'])."</th>";
344
            }
345
            ?>
346
347
            <th scope='col'>
348
                <?php
349
                if ($readonly === FALSE) {
350
                    echo _("Administrator Management");
351
                }
352
                ?>
353
            </th>
354
        </tr>
355
        <?php
356
            /// nomenclature for 'federation', federation name, nomenclature for 'inst'
357
            echo "<tbody class='fedlist'>";
358
            echo "<tr><td colspan='1'><strong>"._("Quick search:")." </strong><input style='background:#eeeeee;' type='text' id='qsearch_".$fedId."'></td>";
359
            if (\core\CAT::radiusProfilesEnabled()) {
360
                echo "<td style='border-bottom-style: dotted;border-bottom-width: 1px;'><input type='checkbox' name='profilecheck' id='profile_ck_".$fedId."'></td>";
361
                echo "<td style='border-bottom-style: dotted;border-bottom-width: 1px;'><input type='checkbox' name='orcheck' id='or_ck_".$fedId."'></td>";
362
                echo "<td style='border-bottom-style: dotted;border-bottom-width: 1px;'><input type='checkbox' name='brokencert' id='brokencert_ck_".$fedId."'></td>";
363
            }
364
            if (\core\CAT::hostedSPEnabled()) {
365
                echo "<td style='border-bottom-style: dotted;border-bottom-width: 1px;'>&nbsp;</td>";
366
            }
367
            echo "<td style='border-bottom-style: dotted;border-bottom-width: 1px;'><input type='checkbox' name='unlinked' id='unlinked_ck_".$fedId."'></td>";
368
            if ($hideWarnings) {
369
                $adminCheckbox = '&nbsp;';
370
            } else {
371
                $adminCheckbox = "<input type='checkbox' name='adminproblem' id='adminproblem_ck_".$fedId."'>";
372
            }
373
            echo "<td colspan='5' style='border-bottom-style: dotted;border-bottom-width: 1px;'>$adminCheckbox</td>";
374
            echo "</tr>";
375
            // extract only pending invitations for *this* fed
376
            $display_pendings = FALSE;
377
            foreach ($pending_invites as $oneinvite) {
378
                if (strtoupper($oneinvite['country']) == strtoupper($thefed->tld)) {
379
                    // echo "PENDINGS!";
380
                    $display_pendings = TRUE;
381
                }
382
            }
383
            $idps = $thefed->listIdentityProviders(0);
384
            $certStatus = $thefed->getIdentityProvidersCertStatus();
385
            $thefed->loadAdminsLogins();
386
            $my_idps = [];
387
            foreach ($idps as $index => $idp) {
388
                $my_idps[$idp['entityID']] = mb_strtolower($idp['title']).'==='.$idp['realms'];
389
            }
390
            asort($my_idps);
391
392
            foreach ($my_idps as $index => $my_idp) {
393
                $idp_instance = $idps[$index]['instance'];                
394
                // get max profile status
395
                $profileClass = '';
396
                $maxProfileStatus = $idp_instance->maxProfileStatus();
397
                if ($maxProfileStatus === \core\IdP::PROFILES_REDIRECTED) {
398
                    $status = \core\IdP::PROFILES_REDIRECTED;
399
                    $profileClass = 'profileredirected profileok';
400
                } elseif ($maxProfileStatus >= \core\IdP::PROFILES_SHOWTIME) {
401
                    $status = \core\IdP::PROFILES_SHOWTIME;
402
                    $profileClass = 'profileok';
403
                } elseif ($maxProfileStatus >= \core\IdP::PROFILES_CONFIGURED) {
404
                    $status = \core\IdP::PROFILES_CONFIGURED;
405
                    $profileClass = 'profilewarn';                    
406
                } else {
407
                    $status = \core\IdP::PROFILES_INCOMPLETE;
408
                    $profileClass = 'profilewarn';                                        
409
                }
410
                $profileIconData = $uiElements->iconData(\core\IdP::PROFILES_INDEX[$status]);  
411
                $profileIcon = $uiElements->catIcon($profileIconData);
412
                
413
                if (\core\CAT::hostedSPEnabled()) {
414
                    $deploymentIcon = '-';
415
                    $maxDeploymentStatus = $idp_instance->maxDeploymentStatus();
416
                    switch ($maxDeploymentStatus) {
417
                        case \core\IdP::DEPLOYMENTS_ACTIVE:
418
                            $deploymentIconData = $uiElements->iconData('DEPLOYMENTS_ACTIVE');
419
                            break;
420
                        case \core\IdP::DEPLOYMENTS_INACTIVE:
421
                            $deploymentIconData = $uiElements->iconData('DEPLOYMENTS_INACTIVE');
422
                            break;
423
                        default:
424
                            $deploymentIconData = null;
425
                            break;
426
                    }
427
                    $deploymentIcon = $deploymentIconData  === null ? '-' : $uiElements->catIcon($deploymentIconData);
428
                }
429
                
430
                // verify the certificates status for this IdP
431
                if (isset($certStatus[$index])) {
432
                    $certIconData = $uiElements->iconData(\core\AbstractProfile::CERT_STATUS_INDEX[$certStatus[$index]]);
433
                    if ($certStatus[$index] > 0) {
434
                        $certClass = 'certproblem';
435
                    } else {
436
                        $certClass = 'certok';
437
                    }
438
                } else {
439
                    $certIconData = $uiElements->iconData('CERTS_NOT_SHOWN');
440
                    $certClass = 'certok';
441
                }
442
                $certIcon = $uiElements->catIcon($certIconData);
443
444
                // verify DB sync status for this IdP
445
                $linkClass = 'nosync';
446
                $linkIcon = '';
447
                // external DB sync, if configured as being necessary
448
                if (\config\Master::DB['enforce-external-sync']) {
449
                    switch ($idp_instance->getExternalDBSyncState()) {
450
                        case \core\IdP::EXTERNAL_DB_SYNCSTATE_NOTSUBJECTTOSYNCING:
451
                            break;
452
                        case \core\IdP::EXTERNAL_DB_SYNCSTATE_SYNCED:
453
                            $linkClass = 'linked';
454
                            $linkIcon = $uiElements->catIcon($uiElements->iconData('IDP_LINKED'));
455
                            break;
456
                        case \core\IdP::EXTERNAL_DB_SYNCSTATE_NOT_SYNCED:
457
                            $linkClass = 'notlinked';
458
                            $linkIcon = $uiElements->catIcon($uiElements->iconData('IDP_NOT_LINKED'));
459
                            break;
460
                    }                
461
                }
462
463
                // verify the OpenRoaming status for this IdP
464
                $orStatus = $idp_instance->maxOpenRoamingStatus();
465
                $orClass = 'orok';
466
                $orIcon = '';
467
                switch ($orStatus) {
468
                    case \core\AbstractProfile::OVERALL_OPENROAMING_LEVEL_NO:
469
                        $orIcon = "-";
470
                        break;
471
                    case \core\AbstractProfile::OVERALL_OPENROAMING_LEVEL_GOOD:
472
                        break;
473
                    case \core\AbstractProfile::OVERALL_OPENROAMING_LEVEL_NOTE:
474
                    case \core\AbstractProfile::OVERALL_OPENROAMING_LEVEL_WARN:
475
                    case \core\AbstractProfile::OVERALL_OPENROAMING_LEVEL_ERROR:
476
                        $orClass = 'orwarn';
477
                        break;
478
                    default:
479
                        throw new \Exception("Impossible OpenRoaming status!");
480
                }
481
                if ($orIcon === "") {
482
                        $iconData = $uiElements->iconData(\core\AbstractProfile::OVERALL_OPENROAMING_INDEX[$orStatus]);
483
                        $orIcon = $uiElements->catIcon($iconData);                    
484
                }
485
                
486
                if ($certStatus[$index] > 0) {
487
                    $certClass = 'certproblem';
488
                } else {
489
                    $certClass = 'certok';
490
                }
491
                    
492
                $adminClass = 'adminok';
493
                $adminIcon = '<span style="padding-left:20px"></span>';
494
                if (!$hideWarnings) {
495
                    if (!isset($thefed->adminLogins[$index])) {
496
                        if ($status != \core\IdP::PROFILES_REDIRECTED) {
497
                            $adminIcon = $uiElements->catIcon($uiElements->iconData('ADMINS_MISSING'));
498
                            $adminClass = 'adminproblem';
499
                        }
500
                    } elseif ($thefed->adminLogins[$index] == 1) {
501
                        $adminIcon = $uiElements->catIcon($uiElements->iconData('ADMINS_INACTIVE'));
502
                        $adminClass = 'adminproblem';
503
                    }
504
                }
505
                                
506
                // new row_id, with one IdP inside
507
                echo "<tr class='idp_tr $profileClass $linkClass $certClass $orClass $adminClass'>";
508
509
                // name; and realm of silverbullet profiles if any
510
                // instantiating all profiles is costly, so we only do this if
511
                // the deployment at hand has silverbullet enabled
512
                $listOfSilverbulletRealms = [];
513
                if (\core\CAT::hostedIDPEnabled()) {
514
                    foreach ($idp_instance->listProfiles() as $oneProfile) {
515
                        if ($oneProfile instanceof core\ProfileSilverbullet) {
516
                            $listOfSilverbulletRealms[] = $oneProfile->realm;
517
                        }
518
                    }
519
                }
520
                echo "<td class='inst_td'>
521
                         <input type='hidden' name='inst' value='" 
522
                       . $index."'>"
523
                       . "<span style='display:none' class='inst_name'>".$my_idp."</span>"
524
                       . "<span>".$idp_instance->name."</span>"
525
                       . " (<a href='overview_org.php?inst_id="
526
                       . $idp_instance->identifier."'>" 
527
                       . (in_array($index, $userIdps) ? _("manage") : _("view"))
528
                       . "</a>)"
529
                       . (empty($listOfSilverbulletRealms) ? "" : "<ul><li>") 
530
                       . implode("</li><li>", $listOfSilverbulletRealms) 
531
                       . (empty($listOfSilverbulletRealms) ? "" : "</li><ul>")
532
                       . "</td>";
533
                // deployment status; need to dive into profiles for this
534
                // show happy eyeballs if at least one profile is configured/showtime     
535
                if (\core\CAT::radiusProfilesEnabled()) {
536
                    echo  "<td>$profileIcon</td>";
537
                    echo "<td style='text-align: center'>$orIcon</td>";
538
                    echo "<td>$certIcon</td>";
539
                }
540
                if (\core\CAT::hostedSPEnabled()) {
541
                    echo "<td style='text-align: center'>$deploymentIcon</td>";
542
                }
543
                
544
                // external DB sync, if configured as being necessary
545
                if (\config\Master::DB['enforce-external-sync']) {
546
                    echo "<td>";
547
                    if ($readonly === FALSE) {
548
                        echo "<form method='post' action='inc/manageDBLink.inc.php?inst_id=".$idp_instance->identifier."' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'>";
549
                        echo    "<button type='submit' style='vertical-align:middle'>".$linkIcon."&nbsp;&nbsp;"._("Manage DB Link")."</button>";
550
                        echo "</form>";
551
                    }
552
                    echo "</td>";
553
                }
554
555
                // admin management
556
                echo "<td>";
557
                if ($readonly === FALSE) {
558
                    echo "<div style='white-space: nowrap;'>
559
                                  <form method='post' action='inc/manageAdmins.inc.php?inst_id=".$index."' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'>
560
                                      <button type='submit' style='vertical-align:middle'>" .$adminIcon."&nbsp;&nbsp;".
561
                    _("Add/Remove Administrators")."
562
                                      </button>
563
                                  </form>
564
                                </div>";
565
                }
566
                echo "</td>";
567
                // end of entry
568
                echo "</tr>";
569
            }
570
            if ($display_pendings) {
571
                echo "<tr>
572
                            <td colspan='2'>
573
                               <strong>" .
574
                sprintf(_("Pending invitations in the %s:"), $uiElements->nomenclatureFed)."
575
                               </strong>
576
                            </td>
577
                         </tr>";
578
                foreach ($pending_invites as $oneinvite) {
579
                    if (strtoupper($oneinvite['country']) == strtoupper($thefed->tld)) {
580
                        echo "<tr>
581
                                    <td>" .
582
                        $oneinvite['name']."
583
                                    </td>
584
                                    <td>" .
585
                        $oneinvite['mail']."
586
                                    </td>
587
                                    <td colspan=2>";
588
                        if ($readonly === FALSE) {
589
                            echo "<form method='post' action='overview_federation.php' accept-charset='UTF-8'>
590
                                <input type='hidden' name='invitation_id' value='".$oneinvite['token']."'/>
591
                                <button class='delete' type='submit' name='submitbutton' value='".web\lib\common\FormElements::BUTTON_DELETE."'>"._("Revoke Invitation")."</button> "
592
                           . sprintf(_("(expires %s)"), $oneinvite['expiry'])
593
                           . "</form>";
594
                        }
595
                        echo "      </td>";                          
596
                        echo "         </tr>";
597
                    }
598
                }
599
            }
600
            echo "</tbody>";         
601
        }
602
        ?>
603
    </table>
604
    
605
    <?php
606
    
607
    if ($readonly === FALSE) {
608
        ?>
609
        <hr/>
610
        <br/>
611
        <form method='post' action='inc/manageNewInst.inc.php' onsubmit='popupRedirectWindow(this);
612
                    return false;' accept-charset='UTF-8'>
613
            <button type='submit' class='download'>
614
                <?php echo sprintf(_("Register a new %s!"), $uiElements->nomenclatureParticipant); ?>
615
            </button>
616
        </form>
617
        <br/>
618
        <?php
619
    }
620
    echo "<hr/>$helptext</div> <!-- main_content -->";
621
    echo  "<img src ='../resources/images/icons/loading51.gif' id='loading_gif' style='display: block; margin-left: auto; margin-right:auto; margin-top:100px'>";
622
623
    echo $deco->footer();
624
    
625