Issues (204)

Security Analysis    13 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 (6)
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 (1)
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 (\config\Master::FUNCTIONALITY_FLAGS['SINGLE_SERVICE'] !== 'MSP') { ?>
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
        <button type='submit'><?php echo sprintf(_('RADIUS/TLS Certificate management')); ?></button>
227
    </form>
228
229
    <?php
230
    }
231
    }
232
233
    if (isset($_POST['submitbutton']) &&
234
            $_POST['submitbutton'] == web\lib\common\FormElements::BUTTON_DELETE &&
235
            isset($_POST['invitation_id'])) {
236
        $mgmt->invalidateToken(htmlspecialchars(strip_tags(filter_input(INPUT_POST, 'invitation_id'))));
237
    }
238
239
    if (isset($_GET['invitation'])) {
240
        echo "<div class='ca-summary' style='position:relative;'><table>";
241
        $counter = $validator->integer($_GET['successcount']);
242
        if ($counter === FALSE) {
243
            $counter = 1;
244
        }
245
        switch ($_GET['invitation']) {
246
            case "SUCCESS":
247
                $cryptText = "";
248
                switch ($_GET['transportsecurity']) {
249
                    case "ENCRYPTED":
250
                        $cryptText = ngettext("It was sent with transport security (encryption).", "They were sent with transport security (encryption).", $counter);
251
                        break;
252
                    case "CLEAR":
253
                        $cryptText = ngettext("It was sent in clear text (no encryption).", "They were sent in clear text (no encryption).", $counter);
254
                        break;
255
                    case "PARTIAL":
256
                        $cryptText = _("A subset of the mails were sent with transport encryption, the rest in clear text.");
257
                        break;
258
                    default:
259
                        throw new Exception("Error: unknown encryption status of invitation!?!");
260
                }
261
                echo $uiElements->boxRemark(ngettext("The invitation email was sent successfully.", "All invitation emails were sent successfully.", $counter)." ".$cryptText, _("Sent successfully."));
262
                break;
263
            case "FAILURE":
264
                echo $uiElements->boxError(_("No invitation email could be sent!"), _("Sending failure!"));
265
                break;
266
            case "PARTIAL":
267
                $cryptText = "";
268
                switch ($_GET['transportsecurity']) {
269
                    case "ENCRYPTED":
270
                        $cryptText = ngettext("The successful one was sent with transport security (encryption).", "The successful ones were sent with transport security (encryption).", $counter);
271
                        break;
272
                    case "CLEAR":
273
                        $cryptText = ngettext("The successful one was sent in clear text (no encryption).", "The successful ones were sent in clear text (no encryption).", $counter);
274
                        break;
275
                    case "PARTIAL":
276
                        $cryptText = _("A subset of the successfully sent mails were sent with transport encryption, the rest in clear text.");
277
                        break;
278
                    default:
279
                        throw new Exception("Error: unknown encryption status of invitation!?!");
280
                }
281
                echo $uiElements->boxWarning(sprintf(_("Some invitation emails were sent successfully (%s in total), the others failed."), $counter)." ".$cryptText, _("Partial success."));
282
                break;
283
            case "INVALIDSYNTAX":
284
                echo $uiElements->boxError(_("The invitation email address was malformed, no invitation was sent!"), _("The invitation email address was malformed, no invitation was sent!"));
285
                break;
286
            default:
287
                echo $uiElements->boxError(_("Error: unknown result code of invitation!?!"), _("Unknown result!"));
288
        }
289
        echo "</table></div>";
290
    }
291
    // our own location, to give to diag URLs
292
    if (isset($_SERVER['HTTPS'])) {
293
        $link = 'https://';
294
    } else {
295
        $link = 'http://';
296
    }
297
    $link .= $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
298
    $link = htmlspecialchars($link);
299
    if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_RADIUS'] == 'LOCAL' && \config\Master::FUNCTIONALITY_LOCATIONS['DIAGNOSTICS'] == 'LOCAL') {
300
        echo "<table><tr>
301
                        <td>".sprintf(_("Diagnose reachability and connection parameters of any %s %s"), \config\ConfAssistant::CONSORTIUM['display_name'], $uiElements->nomenclatureIdP)."</td>
302
                        <td><form method='post' action='../diag/action_realmcheck.php' accept-charset='UTF-8'>
303
                              <input type='hidden' name='comefrom' id='comefrom' value='$link'/>
304
                              <button id='realmcheck' style='cursor:pointer;' type='submit'>"._("Go!")."</button>
305
                            </form>
306
                        </td>
307
                    </tr>
308
                    </table>";
309
    }
310
    if (\config\ConfAssistant::CONSORTIUM['name'] == 'eduroam') {
311
        $helptext = "<h3>".sprintf(_("Need help? Refer to the <a href='%s'>%s manual</a>"), "https://wiki.geant.org/x/qJg7Bw", $uiElements->nomenclatureFed)."</h3>";
312
    } else {
313
        $helptext = "";
314
    }
315
    ?>
316
    <table class='user_overview' style='border:0px; width:unset'>
317
        <caption><?php echo _("Participant Details"); ?></caption>
318
        </tr>
319
        <?php
320
        $userIdps = $user->listOwnerships();
321
        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...
322
            $hideWarningsFlag = $thefed->getAttributes('fed:hide-admin-warnings');
323
            $hideWarnings = false;
324
            if ($hideWarningsFlag !== []) {
325
                $hideWarnings = true;
326
            }
327
            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>";            
328
            ?>
329
        <tr>
330
            <th scope='col'><?php echo sprintf(_("%s Name"), $uiElements->nomenclatureParticipant); ?></th>
331
            <?php if (\config\Master::FUNCTIONALITY_FLAGS['SINGLE_SERVICE'] !== 'MSP') { ?>
332
            <th scope='col'><?php echo _("Status") ?></th>
333
            <th scope='col'><?php echo $OpenRoamingSymbol ?></th>
334
            <th scope='col'><?php echo _("Cert"); ?></th>
335
            <?php
336
            }
337
            $pending_invites = $mgmt->listPendingInvitations();
338
339
            if (\config\Master::DB['enforce-external-sync']) {
340
                echo "<th scope='col' style='max-width: 12em'>".sprintf(_("%s Database Link Status"), \config\ConfAssistant::CONSORTIUM['display_name'])."</th>";
341
            }
342
            ?>
343
            <th scope='col'>
344
                <?php
345
                if ($readonly === FALSE) {
346
                    echo _("Administrator Management");
347
                }
348
                ?>
349
            </th>
350
        </tr>
351
        <?php
352
            /// nomenclature for 'federation', federation name, nomenclature for 'inst'
353
            echo "<tbody class='fedlist'>";
354
            echo "<tr><td colspan='1'><strong>"._("Quick search:")." </strong><input style='background:#eeeeee;' type='text' id='qsearch_".$fedId."'></td>";
355
            if (\config\Master::FUNCTIONALITY_FLAGS['SINGLE_SERVICE'] !== 'MSP') {
356
                echo "<td style='border-bottom-style: dotted;border-bottom-width: 1px;'><input type='checkbox' name='profilecheck' id='profile_ck_".$fedId."'></td>";
357
                echo "<td style='border-bottom-style: dotted;border-bottom-width: 1px;'><input type='checkbox' name='orcheck' id='or_ck_".$fedId."'></td>";
358
                echo "<td style='border-bottom-style: dotted;border-bottom-width: 1px;'><input type='checkbox' name='brokencert' id='brokencert_ck_".$fedId."'></td>";
359
            }
360
            echo "<td style='border-bottom-style: dotted;border-bottom-width: 1px;'><input type='checkbox' name='unlinked' id='unlinked_ck_".$fedId."'></td>";
361
            if ($hideWarnings) {
362
                $adminCheckbox = '&nbsp;';
363
            } else {
364
                $adminCheckbox = "<input type='checkbox' name='adminproblem' id='adminproblem_ck_".$fedId."'>";
365
            }
366
            echo "<td colspan='5' style='border-bottom-style: dotted;border-bottom-width: 1px;'>$adminCheckbox</td>";
367
            echo "</tr>";
368
            // extract only pending invitations for *this* fed
369
            $display_pendings = FALSE;
370
            foreach ($pending_invites as $oneinvite) {
371
                if (strtoupper($oneinvite['country']) == strtoupper($thefed->tld)) {
372
                    // echo "PENDINGS!";
373
                    $display_pendings = TRUE;
374
                }
375
            }
376
            $idps = $thefed->listIdentityProviders(0);
377
            $certStatus = $thefed->getIdentityProvidersCertStatus();
378
            $thefed->loadAdminsLogins();
379
            $my_idps = [];
380
            foreach ($idps as $index => $idp) {
381
                $my_idps[$idp['entityID']] = mb_strtolower($idp['title']).'==='.$idp['realms'];
382
            }
383
            asort($my_idps);
384
385
            foreach ($my_idps as $index => $my_idp) {
386
                $idp_instance = $idps[$index]['instance'];                
387
                // get max profile status
388
                $profileClass = '';
389
                $maxProfileStatus = $idp_instance->maxProfileStatus();
390
                if ($maxProfileStatus == \core\IdP::PROFILES_REDIRECTED) {
391
                    $status = \core\IdP::PROFILES_REDIRECTED;
392
                    $profileClass = 'profileredirected profileok';
393
                } elseif ($maxProfileStatus >= \core\IdP::PROFILES_SHOWTIME) {
394
                    $status = \core\IdP::PROFILES_SHOWTIME;
395
                    $profileClass = 'profileok';
396
                } elseif ($maxProfileStatus >= \core\IdP::PROFILES_CONFIGURED) {
397
                    $status = \core\IdP::PROFILES_CONFIGURED;
398
                    $profileClass = 'profilewarn';                    
399
                } else {
400
                    $status = \core\IdP::PROFILES_INCOMPLETE;
401
                    $profileClass = 'profilewarn';                                        
402
                }
403
                $profileIconData = $uiElements->iconData(\core\IdP::PROFILES_INDEX[$status]);  
404
                $profileIcon = $uiElements->catIcon($profileIconData);
405
                
406
                // verify the certificates status for this IdP
407
                if (isset($certStatus[$index])) {
408
                    $certIconData = $uiElements->iconData(\core\AbstractProfile::CERT_STATUS_INDEX[$certStatus[$index]]);
409
                    if ($certStatus[$index] > 0) {
410
                        $certClass = 'certproblem';
411
                    } else {
412
                        $certClass = 'certok';
413
                    }
414
                } else {
415
                    $certIconData = $uiElements->iconData('CERTS_NOT_SHOWN');
416
                    $certClass = 'certok';
417
                }
418
                $certIcon = $uiElements->catIcon($certIconData);
419
420
                // verify DB sync status for this IdP
421
                $linkClass = 'nosync';
422
                $linkIcon = '';
423
                // external DB sync, if configured as being necessary
424
                if (\config\Master::DB['enforce-external-sync']) {
425
                    switch ($idp_instance->getExternalDBSyncState()) {
426
                        case \core\IdP::EXTERNAL_DB_SYNCSTATE_NOTSUBJECTTOSYNCING:
427
                            break;
428
                        case \core\IdP::EXTERNAL_DB_SYNCSTATE_SYNCED:
429
                            $linkClass = 'linked';
430
                            $linkIcon = $uiElements->catIcon($uiElements->iconData('IDP_LINKED'));
431
                            break;
432
                        case \core\IdP::EXTERNAL_DB_SYNCSTATE_NOT_SYNCED:
433
                            $linkClass = 'notlinked';
434
                            $linkIcon = $uiElements->catIcon($uiElements->iconData('IDP_NOT_LINKED'));
435
                            break;
436
                    }                
437
                }
438
439
                // verify the OpenRoaming status for this IdP
440
                $orStatus = $idp_instance->maxOpenRoamingStatus();
441
                $orClass = 'orok';
442
                $orIcon = '';
443
                switch ($orStatus) {
444
                    case \core\AbstractProfile::OVERALL_OPENROAMING_LEVEL_NO:
445
                        $orIcon = "-";
446
                        break;
447
                    case \core\AbstractProfile::OVERALL_OPENROAMING_LEVEL_GOOD:
448
                        break;
449
                    case \core\AbstractProfile::OVERALL_OPENROAMING_LEVEL_NOTE:
450
                    case \core\AbstractProfile::OVERALL_OPENROAMING_LEVEL_WARN:
451
                    case \core\AbstractProfile::OVERALL_OPENROAMING_LEVEL_ERROR:
452
                        $orClass = 'orwarn';
453
                        break;
454
                    default:
455
                        throw new \Exception("Impossible OpenRoaming status!");
456
                }
457
                if ($orIcon === "") {
458
                        $iconData = $uiElements->iconData(\core\AbstractProfile::OVERALL_OPENROAMING_INDEX[$orStatus]);
459
                        $orIcon = $uiElements->catIcon($iconData);                    
460
                }
461
                
462
                if ($certStatus[$index] > 0) {
463
                    $certClass = 'certproblem';
464
                } else {
465
                    $certClass = 'certok';
466
                }
467
                    
468
                $adminClass = 'adminok';
469
                $adminIcon = '<span style="padding-left:20px"></span>';
470
                if (!$hideWarnings) {
471
                    if (!isset($thefed->adminLogins[$index])) {
472
                        if ($status != \core\IdP::PROFILES_REDIRECTED) {
473
                            $adminIcon = $uiElements->catIcon($uiElements->iconData('ADMINS_MISSING'));
474
                            $adminClass = 'adminproblem';
475
                        }
476
                    } elseif ($thefed->adminLogins[$index] == 1) {
477
                        $adminIcon = $uiElements->catIcon($uiElements->iconData('ADMINS_INACTIVE'));
478
                        $adminClass = 'adminproblem';
479
                    }
480
                }
481
                                
482
                // new row_id, with one IdP inside
483
                echo "<tr class='idp_tr $profileClass $linkClass $certClass $orClass $adminClass'>";
484
485
                // name; and realm of silverbullet profiles if any
486
                // instantiating all profiles is costly, so we only do this if
487
                // the deployment at hand has silverbullet enabled
488
                $listOfSilverbulletRealms = [];
489
                if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL") {
490
                    foreach ($idp_instance->listProfiles() as $oneProfile) {
491
                        if ($oneProfile instanceof core\ProfileSilverbullet) {
492
                            $listOfSilverbulletRealms[] = $oneProfile->realm;
493
                        }
494
                    }
495
                }
496
                echo "<td class='inst_td'>
497
                         <input type='hidden' name='inst' value='" 
498
                       . $index."'>"
499
                       . "<span style='display:none' class='inst_name'>".$my_idp."</span>"
500
                       . "<span>".$idp_instance->name."</span>"
501
                       . " (<a href='overview_org.php?inst_id="
502
                       . $idp_instance->identifier."'>" 
503
                       . (in_array($index, $userIdps) ? _("manage") : _("view"))
504
                       . "</a>)"
505
                       . (empty($listOfSilverbulletRealms) ? "" : "<ul><li>") 
506
                       . implode("</li><li>", $listOfSilverbulletRealms) 
507
                       . (empty($listOfSilverbulletRealms) ? "" : "</li><ul>")
508
                       . "</td>";
509
                // deployment status; need to dive into profiles for this
510
                // show happy eyeballs if at least one profile is configured/showtime     
511
                if (\config\Master::FUNCTIONALITY_FLAGS['SINGLE_SERVICE'] !== 'MSP') {
512
                    echo  "<td>$profileIcon</td>";
513
                    echo "<td style='text-align: center'>$orIcon</td>";
514
                    echo "<td>$certIcon</td>";
515
                }
516
                
517
                // external DB sync, if configured as being necessary
518
                if (\config\Master::DB['enforce-external-sync']) {
519
                    echo "<td>";
520
                    if ($readonly === FALSE) {
521
                        echo "<form method='post' action='inc/manageDBLink.inc.php?inst_id=".$idp_instance->identifier."' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'>";
522
                        echo    "<button type='submit' style='vertical-align:middle'>".$linkIcon."&nbsp;&nbsp;"._("Manage DB Link")."</button>";
523
                        echo "</form>";
524
                    }
525
                    echo "</td>";
526
                }
527
528
                // admin management
529
                echo "<td>";
530
                if ($readonly === FALSE) {
531
                    echo "<div style='white-space: nowrap;'>
532
                                  <form method='post' action='inc/manageAdmins.inc.php?inst_id=".$index."' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'>
533
                                      <button type='submit' style='vertical-align:middle'>" .$adminIcon."&nbsp;&nbsp;".
534
                    _("Add/Remove Administrators")."
535
                                      </button>
536
                                  </form>
537
                                </div>";
538
                }
539
                echo "</td>";
540
                // end of entry
541
                echo "</tr>";
542
            }
543
            if ($display_pendings) {
544
                echo "<tr>
545
                            <td colspan='2'>
546
                               <strong>" .
547
                sprintf(_("Pending invitations in the %s:"), $uiElements->nomenclatureFed)."
548
                               </strong>
549
                            </td>
550
                         </tr>";
551
                foreach ($pending_invites as $oneinvite) {
552
                    if (strtoupper($oneinvite['country']) == strtoupper($thefed->tld)) {
553
                        echo "<tr>
554
                                    <td>" .
555
                        $oneinvite['name']."
556
                                    </td>
557
                                    <td>" .
558
                        $oneinvite['mail']."
559
                                    </td>
560
                                    <td colspan=2>";
561
                        if ($readonly === FALSE) {
562
                            echo "<form method='post' action='overview_federation.php' accept-charset='UTF-8'>
563
                                <input type='hidden' name='invitation_id' value='".$oneinvite['token']."'/>
564
                                <button class='delete' type='submit' name='submitbutton' value='".web\lib\common\FormElements::BUTTON_DELETE."'>"._("Revoke Invitation")."</button> "
565
                           . sprintf(_("(expires %s)"), $oneinvite['expiry'])
566
                           . "</form>";
567
                        }
568
                        echo "      </td>";                          
569
                        echo "         </tr>";
570
                    }
571
                }
572
            }
573
            echo "</tbody>";         
574
        }
575
        ?>
576
    </table>
577
    
578
    <?php
579
    
580
    if ($readonly === FALSE) {
581
        ?>
582
        <hr/>
583
        <br/>
584
        <form method='post' action='inc/manageNewInst.inc.php' onsubmit='popupRedirectWindow(this);
585
                    return false;' accept-charset='UTF-8'>
586
            <button type='submit' class='download'>
587
                <?php echo sprintf(_("Register a new %s!"), $uiElements->nomenclatureParticipant); ?>
588
            </button>
589
        </form>
590
        <br/>
591
        <?php
592
    }
593
    echo "<hr/>$helptext</div> <!-- main_content -->";
594
    echo  "<img src ='../resources/images/icons/loading51.gif' id='loading_gif' style='display: block; margin-left: auto; margin-right:auto; margin-top:100px'>";
595
596
    echo $deco->footer();
597
    
598