Test Failed
Push — master ( 6f90ed...56e405 )
by Maja
10:12
created

radius_ready()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 7
c 1
b 0
f 0
nc 3
nop 1
dl 0
loc 10
rs 10
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 an entire IdP.
24
 * 
25
 * @author Stefan Winter <[email protected]>
26
 * @author Maja Górecka-Wolniewicz <[email protected]>
27
 */
28
?>
29
<?php
30
require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php";
31
32
function displaySilverbulletPropertyWidget(&$theProfile, $readonly, &$uiElements) {
33
    ?>
34
    <div style='padding-bottom:20px;'>
35
        <h2><?php echo $theProfile->name; ?></h2>
36
        <?php
37
        $maxusers = $theProfile->getAttributes("internal:silverbullet_maxusers");
38
        $completeness = $theProfile->isEapTypeDefinitionComplete(new core\common\EAP(core\common\EAP::INTEGER_SILVERBULLET));
39
        // do we have all info needed for showtime? particularly: support email
40
        if (is_array($completeness)) {
41
            ?>
42
            <div class='notacceptable'>
43
                <?php echo _("Information needed!"); ?>
44
                <ul style='margin:1px'>
45
                    <?php
46
                    foreach ($completeness as $missing_attrib) {
47
                        echo "<li>" . $uiElements->displayName($missing_attrib) . "</li>";
48
                    }
49
                    ?>
50
                </ul>
51
            </div>
52
            <?php
53
        } else {
54
            echo sprintf(_("You can create up to %d users."), $maxusers[0]['value']) . "<br/>" . sprintf(_("Their credentials will carry the name <strong>%s</strong>."), $theProfile->realm);
55
        }
56
        ?>
57
        <br/>
58
        <br/>
59
        <?php
60
        if ($readonly === FALSE) {
61
            ?>
62
            <form action='edit_silverbullet.php?inst_id=<?php echo $theProfile->institution; ?>&amp;profile_id=<?php echo $theProfile->identifier; ?>' method='POST'>
63
                <button <?php echo ( is_array($completeness) ? "disabled" : "" ); ?> type='submit' name='sb_action' value='sb_edit'><?php echo _("Manage User Base"); ?></button>
64
            </form>
65
            <?php
66
        }
67
        ?>
68
    </div>
69
    <?php
70
}
71
72
/**
73
 * display an infocard with overview data of a RADIUS profile
74
 * 
75
 * @param \core\Profile             $theProfile the profile we display
76
 * @param boolean                   $readonly     are we in readonly mode? No edit buttons then...
77
 * @param \web\lib\admin\UIElements $uiElements   some UI elements
78
 * @param string                    $editMode 'fullaccess', 'readonly'
79
 * @throws Exception
80
 */
81
function displayRadiusPropertyWidget(&$theProfile, $readonly, &$uiElements, $editMode) {
82
    ?>
83
    <div style='padding-bottom:20px;'>
84
        <?php $profile_name = $theProfile->name; ?>
85
        <div style='margin-bottom:10px; display:block;'>
86
            <h2 style='overflow:auto; display:inline; padding-bottom: 10px;'><?php printf(_("Profile: %s"), $profile_name); ?></h2>
87
        </div>
88
        <?php
89
        // see if there are any profile-level overrides
90
        $attribs = $theProfile->getAttributes();
91
        // write things into a buffer; we need some function calls to determine
92
        // readiness - but want to display it before!
93
        $has_overrides = FALSE;
94
        foreach ($attribs as $attrib) {
95
            if ($attrib['level'] == \core\Options::LEVEL_PROFILE && !preg_match("/^(internal:|profile:name|profile:description|eap:)/", $attrib['name'])) {
96
                $has_overrides = TRUE;
97
            }
98
        }
99
        $buffer_eaptypediv = "<div style='margin-bottom:40px; float:left;'>" . _("<strong>EAP Types</strong> (in order of preference):") . "<br/>";
100
        $typelist = $theProfile->getEapMethodsinOrderOfPreference();
101
        $allcomplete = TRUE;
102
        foreach ($typelist as $eaptype) {
103
            $buffer_eaptypediv .= $eaptype->getPrintableRep();
104
            $completeness = $theProfile->isEapTypeDefinitionComplete($eaptype);
105
            if ($completeness === true) {
106
                $buffer_eaptypediv .= " <div class='acceptable'>" . _("OK") . "</div>";
107
            } else {
108
                $buffer_eaptypediv .= " <div class='notacceptable'>";
109
                $buffer_eaptypediv .= _("Information needed!");
110
                if (is_array($completeness)) {
111
                    $buffer_eaptypediv .= "<ul style='margin:1px'>";
112
                    foreach ($completeness as $missing_attrib) {
113
                        $buffer_eaptypediv .= "<li>" . $uiElements->displayName($missing_attrib) . "</li>";
114
                    }
115
                    $buffer_eaptypediv .= "</ul>";
116
                }
117
                $buffer_eaptypediv .= "</div>";
118
                $allcomplete = FALSE;
119
            }
120
            $attribs = $theProfile->getAttributes();
121
            $justOnce = FALSE;
122
            foreach ($attribs as $attrib) {
123
                if ($attrib['level'] == \core\Options::LEVEL_METHOD && !preg_match("/^internal:/", $attrib['name']) && !$justOnce) {
124
                    $justOnce = TRUE;
125
                    $buffer_eaptypediv .= "<img src='../resources/images/icons/Tabler/square-rounded-letter-e-blue.svg' alt='" . _("Options on EAP Method/Device level are in effect.") . "'>";
126
                }
127
            }
128
            $buffer_eaptypediv .= "<br/>";
129
        }
130
        $buffer_eaptypediv .= "</div>";
131
132
        $buffer_headline = "<div style='float:right;padding-left:10px'>";
133
        $readiness = $theProfile->readinessLevel();
134
        if ($has_overrides) {
135
            $buffer_headline .= $uiElements->boxRemark("", _("Option override on profile level is in effect."), TRUE);
136
        }
137
        $buffer_headline .= "<br/>";
138
        if (!$allcomplete) {
139
            $buffer_headline .= $uiElements->boxError("", _("The information in this profile is incomplete."), TRUE);
140
        }
141
        switch ($readiness) {
142
            case core\AbstractProfile::READINESS_LEVEL_SHOWTIME:
143
                $buffer_headline .= $uiElements->boxOkay("", _("This profile is shown on the user download interface."), TRUE);
144
                break;
145
            case core\AbstractProfile::READINESS_LEVEL_SUFFICIENTCONFIG:
146
                $buffer_headline .= $uiElements->boxWarning("", sprintf(_("This profile is NOT shown on the user download interface, even though we have enough information to show. To enable the profile, add the attribute \"%s\" and tick the corresponding box."), $uiElements->displayName("profile:production")), TRUE);
147
        }
148
        if ($theProfile->isRedirected()) {
149
            $iconData = $uiElements->iconData('PROFILES_REDIRECTED');
150
            $iconData['text'] = _("Profile redirected");
151
            $buffer_headline .= "<br/>" . $uiElements->catIcon(($iconData));
152
            
153
        } 
154
        
155
        $certStatus = $theProfile->certificateStatus();
156
        switch ($certStatus) {
157
            case core\AbstractProfile::CERT_STATUS_OK:
158
                $iconData = $uiElements->iconData('CERT_STATUS_OK');
159
                $buffer_headline .= "<br/>" . $uiElements->catIcon(($iconData));
160
                break;
161
            case core\AbstractProfile::CERT_STATUS_WARN:
162
                $iconData = $uiElements->iconData('CERT_STATUS_WARN');
163
                $buffer_headline .= "<br/>" . $uiElements->catIcon(($iconData));                
164
                break;
165
            case core\AbstractProfile::CERT_STATUS_ERROR:
166
                $iconData = $uiElements->iconData('CERT_STATUS_ERROR');
167
                $buffer_headline .= "<br/>" . $uiElements->catIcon(($iconData));
168
                break;            
169
        }
170
        $buffer_headline .= "</div>";
171
172
        echo $buffer_headline;
173
        echo $buffer_eaptypediv;
174
175
        $has_eaptypes = count($theProfile->getEapMethodsInOrderOfPreference(1));
176
        $hasRealmArray = $theProfile->getAttributes("internal:realm");
177
        $has_realm = $hasRealmArray[0]['value'];
178
179
        // our own base location, to give to diag URLs
180
        if (isset($_SERVER['HTTPS'])) {
181
            $link = 'https://';
182
        } else {
183
            $link = 'http://';
184
        }
185
        $link .= $_SERVER['SERVER_NAME'];
186
        ?>
187
        <div class='profilemodulebuttons' style='float:right;'>
188
            <?php
189
            if (\config\Master::FUNCTIONALITY_LOCATIONS['DIAGNOSTICS'] !== NULL) {
190
                if (\config\Master::FUNCTIONALITY_LOCATIONS['DIAGNOSTICS'] == "LOCAL") {
191
                    $diagUrl = "../diag/";
192
                } else {
193
                    $diagUrl = \config\Master::FUNCTIONALITY_LOCATIONS['DIAGNOSTICS'] . "/diag/";
194
                }
195
                ?>
196
                <form action='<?php echo $diagUrl . "action_realmcheck.php?inst_id=" . $theProfile->institution . "&profile_id=" . $theProfile->identifier ?>' method='post' accept-charset='UTF-8'>
197
                    <input type='hidden' name='comefrom' value='<?php echo htmlspecialchars($link . $_SERVER['SCRIPT_NAME']); ?>'/>
198
                    <button type='submit' name='profile_action' value='check' <?php echo ($has_realm ? "" : "disabled='disabled'"); ?> title='<?php echo _("The realm can only be checked if you configure the realm!"); ?>'>
199
                        <?php echo _("Check realm reachability"); ?>
200
                    </button>
201
                </form>
202
                <?php
203
            }
204
            ?>
205
            <form action='overview_installers.php?inst_id=<?php echo $theProfile->institution; ?>&amp;profile_id=<?php echo $theProfile->identifier; ?>' method='post' accept-charset='UTF-8'>
206
                <button type='submit' name='profile_action' value='check' <?php echo ($has_eaptypes ? "" : "disabled='disabled'"); ?> title='<?php echo _("You have not fully configured any supported EAP types!"); ?>'>
207
                    <?php echo _("Installer Fine-Tuning and Download"); ?>
208
                </button>
209
            </form>
210
        </div>
211
        <div class='buttongroupprofilebox' style='clear:both; display: flex;'>
212
            <?php 
213
                if ($editMode == 'readonly') {
214
                    $editLabel = _("View");
215
                }
216
                if ($editMode == 'fullaccess') {
217
                    $editLabel = _("Edit");
218
                }
219
            if ($readonly === FALSE) { ?>
220
                <div style='margin-right: 200px; display: ruby'>
221
                    <form action='edit_profile.php?inst_id=<?php echo $theProfile->institution; ?>&amp;profile_id=<?php echo $theProfile->identifier; ?>' method='post' accept-charset='UTF-8'>
222
                        <hr/>
223
                        <button type='submit' name='profile_action' value='edit'><?php echo $editLabel; ?></button>
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $editLabel does not seem to be defined for all execution paths leading up to this point.
Loading history...
224
                    </form>
225
                    <?php if ($editMode == 'fullaccess') { ?>
226
                    <form action='edit_profile_result.php?inst_id=<?php echo $theProfile->institution; ?>&amp;profile_id=<?php echo $theProfile->identifier; ?>' method='post' accept-charset='UTF-8'>
227
                        <button class='delete' type='submit' name='submitbutton' value='<?php echo web\lib\common\FormElements::BUTTON_DELETE; ?>' onclick="return confirm('<?php echo sprintf(_("Do you really want to delete the profile %s?"), $profile_name); ?>')">
228
                            <?php echo _("Delete") ?>
229
                        </button>
230
                    </form>
231
                    <form action='duplicate_profile.php?inst_id=<?php echo $theProfile->institution; ?>&amp;profile_id=<?php echo $theProfile->identifier; ?>' method='post' accept-charset='UTF-8'>
232
                        <button type='submit' name='profile_duplicate'>
233
                            <?php echo _("Duplicate this profile"); ?>
234
                	</button>
235
                    </form>
236
                    <?php } ?>
237
                </div>
238
                <?php
239
            }
240
            if ($readiness == core\AbstractProfile::READINESS_LEVEL_SHOWTIME) {
241
                ?>
242
                <div style='display: flex;'>
243
                    <?php
244
                    $idpLevelUrl = $link . dirname(dirname($_SERVER['SCRIPT_NAME'])) . "?idp=" . $theProfile->institution;
245
                    $displayurl = $idpLevelUrl . "&amp;profile=" . $theProfile->identifier;
246
                    $QRurl = $idpLevelUrl . "&profile=" . $theProfile->identifier;
247
                    $qrCode = new \chillerlan\QRCode\QRCode(new \chillerlan\QRCode\QROptions([
248
                                'outputType' => \chillerlan\QRCode\QRCode::OUTPUT_IMAGE_PNG,
249
                                'eccLevel' => \chillerlan\QRCode\QRCode::ECC_H,
250
                                'scale' => web\lib\admin\UIElements::QRCODE_PIXELS_PER_SYMBOL,
251
                                'imageBase64' => false,
252
                    ]));
253
                    echo "<a href='$displayurl' style='white-space: nowrap; text-align: center;'>";
254
                    $rawQr = $qrCode->render($QRurl);
255
                    if (empty($rawQr)) {
256
                        throw new Exception("Something went seriously wrong during QR code generation!");
257
                    }
258
                    $uri = "data:image/png;base64," . base64_encode($uiElements->pngInjectConsortiumLogo($rawQr, web\lib\admin\UIElements::QRCODE_PIXELS_PER_SYMBOL));
259
                    $size = getimagesize($uri);
260
                    echo "<img width='" . ($size[0] / 4) . "' height='" . ($size[1] / 4) . "' src='$uri' alt='QR-code'/>";
261
262
                    //echo "<nobr>$displayurl</nobr></a>";
263
                    echo "<p>$displayurl</p></a>";
264
                    ?>
265
                </div>
266
                <?php
267
            }
268
            ?>
269
        </div>
270
    </div>
271
    <?php
272
}
273
274
/**
275
 * displays an infocard about a Managed SP deployment
276
 * 
277
 * @param \core\DeploymentManaged $deploymentObject the deployment to work with
278
 * @throws Exception
279
 */
280
function displayDeploymentPropertyWidget(&$deploymentObject) {
281
    // RADIUS status icons
282
    $radiusMessages = [ 
283
        \core\AbstractDeployment::RADIUS_OK => ['icon' => '../resources/images/icons/Tabler/square-rounded-check-filled-green.svg', 'text' => _("Successfully set profile")],
284
        \core\AbstractDeployment::RADIUS_FAILURE => ['icon' => '../resources/images/icons/Tabler/square-rounded-x-filled-red.svg', 'text' => _("Some problem occurred during profile update")],
285
    ];
286
    $radius_status = array();
287
    $radius_status[0] = $deploymentObject->radius_status_1;
288
    $radius_status[1] = $deploymentObject->radius_status_2;
289
    $cacert = file_get_contents(ROOT .  "/config/ManagedSPCerts/eduroamSP-CA.pem");
290
    $retry = $deploymentObject->checkRADIUSHostandConfigDaemon();
291
    $isradiusready = radius_ready($deploymentObject);
292
    if (is_array($retry)) {
293
        foreach ($retry as $id => $stat) {
294
            if ($stat) {
295
                $response = $deploymentObject->setRADIUSconfig($id, 1);
0 ignored issues
show
Unused Code introduced by
The assignment to $response is dead and can be removed.
Loading history...
296
            }
297
        }
298
    }
299
    ?>
300
    <div style='display: table-row_id;'>
301
        <div class='profilebox' id="profilebox_<?php echo $deploymentObject->identifier;?>" style='display: table-cell;'>
302
            <h2><?php
303
                switch ($deploymentObject->consortium) {
304
                    case "eduroam":
305
                        $displayname = config\ConfAssistant::CONSORTIUM['name'] . " " . core\DeploymentManaged::PRODUCTNAME;
306
                        break;
307
                    case "OpenRoaming":
308
                        $displayname = "OpenRoaming ANP";
309
                        break;
310
                    default:
311
                        throw new Exception("We are supposed to operate on a roaming consortium we don't know.");
312
                }
313
                echo $displayname . " (<span style='color:" . ( $deploymentObject->status == \core\AbstractDeployment::INACTIVE ? "red;'>" . _("inactive") : "green;'>" . _("active") ) . "</span>)";
314
                ?></h2>
315
            <table>
316
                <caption><?php echo _("Deployment Details"); ?></caption>
317
                <form action="?inst_id=<?php echo $deploymentObject->institution; ?>" method="post">
318
                <tr>
319
                    <th class='wai-invisible' scope='col'><?php echo("Server IP addresses"); ?></th>
320
                    <th class='wai-invisible' scope='col'><?php echo("Server Port label"); ?></th>
321
                    <th class='wai-invisible' scope='col'><?php echo("Server Port value"); ?></th>
322
                    <th class='wai-invisible' scope='col'><?php echo("Deployment Status"); ?></th>
323
                </tr>
324
                <tr>
325
                    <td>
326
                        <strong><?php echo _("Your primary RADIUS server") ?></strong>
327
                    </td>
328
                    <td>
329
                        <?php
330
                        if ($deploymentObject->host1_v4 !== NULL) {
331
                            echo _("IPv4") . ": " . $deploymentObject->host1_v4;
332
                        }
333
                        if ($deploymentObject->host1_v4 !== NULL && $deploymentObject->host1_v6 !== NULL) {
334
                            echo "<br/>";
335
                        }
336
                        if ($deploymentObject->host1_v6 !== NULL) {
337
                            echo _("IPv6") . ": " . $deploymentObject->host1_v6;
338
                        }
339
                        ?>
340
                    </td>
341
                    <td></td>
342
                </tr>
343
                <tr>
344
                    <td>
345
                        <strong><?php echo _("RADIUS port number (UDP)"); ?></strong>
346
                    </td>
347
                    <td>
348
                        <?php echo $deploymentObject->port1; ?>
349
                    </td>
350
                    <td>
351
                        <?php
352
                        if ($deploymentObject->status) {
353
                            echo "<img src='" . $radiusMessages[$deploymentObject->radius_status_1]['icon'] .
354
                                "' alt='" . $radiusMessages[$deploymentObject->radius_status_1]['text'] .
355
                                "' title='" . $radiusMessages[$deploymentObject->radius_status_1]['text'] . "' class='cat-icon'>";
356
                        }
357
                        ?>
358
                    </td>
359
                </tr>
360
                <tr>
361
                    <td>
362
                        <strong><?php echo _("Your secondary RADIUS server") ?></strong>
363
                    </td>
364
                    <td>
365
                        <?php
366
                        if ($deploymentObject->host2_v4 !== NULL) {
367
                            echo _("IPv4") . ": " . $deploymentObject->host1_v4;
368
                        }
369
                        if ($deploymentObject->host2_v4 !== NULL && $deploymentObject->host2_v6 !== NULL) {
370
                            echo "<br/>";
371
                        }
372
                        if ($deploymentObject->host2_v6 !== NULL) {
373
                            echo _("IPv6") . ": " . $deploymentObject->host2_v6;
374
                        }
375
                        ?>
376
                    </td>
377
                    <td></td>
378
                </tr>
379
                <tr>
380
                    <td>
381
                        <strong><?php echo _("RADIUS port number (UDP)"); ?></strong>
382
                    </td>
383
                    <td>
384
                        <?php echo $deploymentObject->port2; ?>
385
                    </td>
386
                    <td>
387
                        <?php
388
                        if ($deploymentObject->status) {
389
                            echo "<img src='" . $radiusMessages[$deploymentObject->radius_status_2]['icon'] .
390
                                "' alt='" . $radiusMessages[$deploymentObject->radius_status_2]['text'] .
391
                            "' title='" . $radiusMessages[$deploymentObject->radius_status_2]['text'] . "' class='cat-icon'>";
392
                        }
393
                        ?>
394
                    </td>
395
                </tr>
396
                <tr>
397
                    <td>
398
                        <strong><?php echo _("RADSEC ports for both servers:"); ?></strong>
399
                    </td>
400
                    <td>
401
                        <?php echo _("RADSEC over TLS"); ?>
402
                        2083<br>
403
                        <?php echo _("RADSEC TLS-PSK"); ?>
404
                        2084
405
                    </td>
406
                    <td></td>
407
                </tr>
408
               
409
                <tr>
410
                    <td><strong><?php echo _("RADIUS shared secret"); ?></strong></td>
411
                    <td><?php echo $deploymentObject->secret; ?></td>
412
                </tr>
413
                <?php if ($deploymentObject->radsec_priv != '' && $deploymentObject->radsec_cert != '') { 
414
                    $data = openssl_x509_parse($deploymentObject->radsec_cert);
415
                    
416
                    ?>
417
                <tr>
418
                    <td><strong><?php echo _("RADSEC over TLS credentials"); ?></strong></td>
419
                        <td>
420
                            <input type="hidden" id="priv_key_data_<?php echo $deploymentObject->identifier;?>" value="<?php echo $deploymentObject->radsec_priv;?>">
421
                            <input type="hidden" id="cert_data_<?php echo $deploymentObject->identifier;?>" value="<?php echo $deploymentObject->radsec_cert;?>">
422
                            <input type="hidden" id="ca_cert_data" value="<?php echo $cacert;?>">
423
                            <button class="sp_priv_key" id="priv_key_<?php echo $deploymentObject->identifier;?>" name="showc" style="background-color: gray; color: white" type="submit"><?php echo _('private key');?></button>
424
                            <button class="sp_cert" id="cert_<?php echo $deploymentObject->identifier;?>" name="showp" style="background-color: gray; color: white" type="submit"><?php echo _('certificate');?></button>
425
                            <button class="ca_cert" name="showca" style="background-color: gray; color: white" type="submit"><?php echo _('CA certificate');?></button>
426
                            <button name="sendzip" onclick="location.href='inc/sendzip.inc.php?inst_id=<?php echo $deploymentObject->institution;?>&dep_id=<?php echo $deploymentObject->identifier;?>'" style="background-color: gray; color: white" type="button"><?php echo _('download ZIP-file with full data');?></button>
427
                        </td
428
                </tr>
429
                <tr> <td></td><td>
430
                    <?php 
431
                    echo _('Not valid after:') . ' '. date_create_from_format('ymdGis', substr($data['validTo'], 0, -1))->format('Y-m-d H:i:s') . ' UTC';
432
                    $dleft = floor(($data['validTo_time_t']-time())/(24*60*60));
433
                    if ($dleft > 0) {
434
                        echo '<br>' . _('Number of days to expiry:') . ' ' . $dleft;
435
                    } else {
436
                        echo '<br>' . _('If you are using RADSEC over TLS you should urgently renew your credentisls') . '!';
437
                    }
438
                    ?></td></tr>
439
                <tr> <td></td><td>
440
                        <?php
441
                        if ($deploymentObject->radsec_cert != NULL) {
442
                            echo _('If your certificate is close to expiry or you need to create new RADSEC over TLS credentials') . '<br>' .
443
                                 _('click on "Renew RADSEC over TLS credentials" button');
444
                        }
445
                        ?>
446
                </td></tr>
447
                <?php         
448
                  
449
                }
450
                if ($deploymentObject->pskkey != '') {?>
451
                <tr>
452
                        <td><strong><?php echo _("RADSEC TLS-PSK identity"); ?></strong></td>
453
                        <td>
454
                           SP_<?php echo $deploymentObject->identifier . '-' . $deploymentObject->institution;?>
455
                        </td>
456
                </tr>
457
                
458
                <tr>
459
                        <td><strong><?php echo _("RADSEC TLS-PSK key"); ?></strong></td>
460
                        <td>
461
                           <?php echo $deploymentObject->pskkey;?>
462
                        </td>
463
                </tr>
464
                <?php } ?>
465
                <tr><td colspan="4"><hr></td></tr>
466
                <?php if ($opname = $deploymentObject->getAttributes("managedsp:operatorname")[0]['value'] ?? NULL) { ?>
467
                    <tr>
468
                        <td><strong><?php echo _("Custom Operator-Name"); ?></strong></td>
469
                        <td><?php echo $opname; ?></td>
470
                    </tr>
471
                    <?php
472
                }
473
                if ($vlan = $deploymentObject->getAttributes("managedsp:vlan")[0]['value'] ?? NULL) {
474
                    ?>
475
                    <tr>
476
                        <td><strong><?php echo _("VLAN tag for own users"); ?></strong></td>
477
                        <td><?php echo $vlan; ?></td>
478
                    </tr>
479
                <?php } 
480
                $allRealms = array_values(array_unique(array_column($deploymentObject->getAttributes("managedsp:realmforvlan"), "value")));
481
                if (!empty($allRealms) || $vlan = $deploymentObject->getAttributes("managedsp:vlan")[0]['value'] ?? NULL) {
0 ignored issues
show
Unused Code introduced by
The assignment to $vlan is dead and can be removed.
Loading history...
482
                ?>
483
                
484
                <tr>
485
                        <td><strong><?php echo _("Realm to be considered own users"); ?></strong></td>
486
                        <td>
487
                <?php
488
                
489
                if (!empty($allRealms)) {
490
                    echo implode(', ', $allRealms);
491
                } else {
492
                    echo _('not set, be aware that VLAN setting is not used until a realm is added');
493
                }
494
                }
495
                ?>
496
                </td></tr>
497
                </form>
498
            </table>
499
            <?php
500
            if ($isradiusready) { ?>
501
            <div class='buttongroupprofilebox' style='clear:both;'>
502
               
503
                <form action='edit_hotspot.php?inst_id=<?php echo $deploymentObject->institution; ?>&amp;deployment_id=<?php echo $deploymentObject->identifier; ?>' method='post' accept-charset='UTF-8'>
504
                    <br/>
505
                    <button type='submit' name='profile_action' style='cursor:pointer;' value='edit'><?php echo _("Advanced Configuration"); ?></button>
506
                </form>
507
                <?php if ($deploymentObject->status == \core\AbstractDeployment::ACTIVE) { ?>
508
                    <form action='edit_hotspot.php?inst_id=<?php echo $deploymentObject->institution; ?>&amp;deployment_id=<?php echo $deploymentObject->identifier; ?>' method='post' accept-charset='UTF-8'>
509
                        <button class='delete' type='submit' style='cursor:pointer;' name='submitbutton' value='<?php echo web\lib\common\FormElements::BUTTON_DELETE; ?>' onclick="return confirm('<?php printf(_("Do you really want to deactivate the %s deployment?"), core\DeploymentManaged::PRODUCTNAME); ?>')">
510
                            <?php echo _("Deactivate"); ?>
511
                        </button>
512
                        <?php
513
                        if (isset($_GET['res']) && is_array($_GET['res'])) {
514
                            $res = array_count_values($_GET['res']);
515
                            if (array_key_exists('FAILURE', $res) && $res['FAILURE'] > 0) {
516
                                echo '<br>';
517
                                if ($res['FAILURE'] == 2) {
518
                                    echo ' <span style="color: red;">' . _("Activation failure.") . '</span>';
519
                                } else {
520
                                    if (isset($_GET['res'][1]) && $_GET['res']['1'] == 'FAILURE') {
521
                                        echo ' <span style="color: red;">' . _("Activation failure for your primary RADIUS server.") . '</span>';
522
                                    } else {
523
                                        echo ' <span style="color: red;">' . _("Activation failure for your backup RADIUS server.") . '</span>';
524
                                    }
525
                                }
526
                            }
527
                        }
528
                        ?>
529
                    </form>
530
                    <?php
531
                } elseif (count($deploymentObject->getAttributes("hiddenmanagedsp:tou_accepted")) == 0) {
532
                    ?>
533
                    <form action='edit_hotspot.php?inst_id=<?php echo $deploymentObject->institution; ?>&amp;deployment_id=<?php echo $deploymentObject->identifier; ?>' method='post' accept-charset='UTF-8'>
534
                        <button class='delete' style='background-color: yellow; color: black;' type='submit' name='submitbutton' value='<?php echo web\lib\common\FormElements::BUTTON_TERMSOFUSE_NEEDACCEPTANCE; ?>'>
535
                            <?php echo _("Accept Terms of Use"); ?>
536
                        </button>
537
                    </form>
538
                    <div align="right">
539
                    <form action='edit_hotspot.php?inst_id=<?php echo $deploymentObject->institution; ?>&amp;deployment_id=<?php echo $deploymentObject->identifier; ?>' method='post' accept-charset='UTF-8'>
540
                            <button class='delete' style='background-color: yellow; color: black' type='submit' name='submitbutton' value='<?php echo web\lib\common\FormElements::BUTTON_REMOVESP; ?>' onclick="return confirm('<?php printf(_("Do you really want to remove this %s deployment?"), core\DeploymentManaged::PRODUCTNAME); ?>')">
541
                                <?php echo _("Remove deployment"); ?>
542
                            </button>
543
                    </form>
544
                    </div>
545
                    <?php
546
                    } else {
547
                        ?>
548
                        <form action='edit_hotspot.php?inst_id=<?php echo $deploymentObject->institution; ?>&amp;deployment_id=<?php echo $deploymentObject->identifier; ?>' method='post' accept-charset='UTF-8'>
549
                            <button class='delete' style='background-color: green;' type='submit' name='submitbutton' value='<?php echo web\lib\common\FormElements::BUTTON_ACTIVATE; ?>'>
550
                                <?php echo _("Activate"); ?>
551
                            </button>
552
                            <?php
553
                            if (isset($_GET['res']) && is_array($_GET['res'])) {
554
                                $res = array_count_values($_GET['res']);
555
                                if (array_key_exists('FAILURE', $res) && $res['FAILURE'] > 0) {
556
                                    echo '<br>';
557
                                    if ($res['FAILURE'] == 2) {
558
                                        echo ' <span style="color: red;">' . _("Failure during deactivation, your request is queued for handling") . '</span>';
559
                                    } else {
560
                                        if (isset($_GET['res'][1]) && $_GET['res']['1'] == 'FAILURE') {
561
                                            echo ' <span style="color: red;">' . _("Deactivation failure for your primary RADIUS server, your request is queued.") . '</span>';
562
                                        } else {
563
                                            echo ' <span style="color: red;">' . _("Deactivation failure for your backup RADIUS server, your request is queued.") . '</span>';
564
                                        }
565
                                    }
566
                                }
567
                            }
568
                            ?>
569
                        </form>
570
                        <div align="right">
571
                        <form action='edit_hotspot.php?inst_id=<?php echo $deploymentObject->institution; ?>&amp;deployment_id=<?php echo $deploymentObject->identifier; ?>' method='post' accept-charset='UTF-8'>
572
                            <button class='delete' style='background-color: yellow; color: black' type='submit' name='submitbutton' value='<?php echo web\lib\common\FormElements::BUTTON_REMOVESP; ?>' onclick="return confirm('<?php printf(_("Do you really want to remove this %s deployment?"), core\DeploymentManaged::PRODUCTNAME); ?>')">
573
                                <?php echo _("Remove deployment"); ?>
574
                            </button>
575
                        </form>
576
                        </div>
577
                        <?php
578
                    }
579
                    ?>
580
                    <div align="right">
581
                    <form action='edit_hotspot.php?inst_id=<?php echo $deploymentObject->institution; ?>&amp;deployment_id=<?php echo $deploymentObject->identifier; ?>' method='post' accept-charset='UTF-8'>
582
                            <button class='renewtls' style='background-color: yellow; color: black' type='submit' name='submitbutton' value='<?php echo web\lib\common\FormElements::BUTTON_RENEWTLS; ?>' onclick="return confirm('<?php printf(_("Do you really want to replace TLS credentials for this %s deployment?"), core\DeploymentManaged::PRODUCTNAME); ?>')">
583
                                <?php echo _("Renew RADSEC over TLS credentials"); ?>
584
                            </button>
585
                    </form>
586
                    </div>
587
            </div>
588
            <?php } else { echo _("We are not able to handle a new configuration request now.") . '<br>' . _("Check later.");} ?>
589
        </div>
590
        <div style='width:20px;'></div> <!-- QR code space, reserved -->
591
        <div style='display: table-cell; min-width:200px;'>
592
            <?php $tablecaption = _("Hotspot Usage Statistics");?>
593
            <h1><?php echo $tablecaption; ?></h1>
594
            <h2><?php echo _("5 most recent authentications");?></h2>
595
            <p><?php echo _("(AP Identifier is a /-separated tuple of NAS-Identifier/NAS-IP-Address/NAS-IPv6-Address/Called-Station-Id)");?></p>
596
            <table class='authrecord'>
597
    <caption><?php echo $tablecaption;?></caption>
598
    <tr style='text-align: left;'>
599
        <th scope="col"><strong><?php echo _("Timestamp (UTC)");?></strong></th>
600
        <th scope="col"><strong><?php echo _("Realm");?></strong></th>
601
        <th scope="col"><strong><?php echo _("MAC Address");?></strong></th>
602
        <th scope="col"><strong><?php echo _("Chargeable-User-Identity");?></strong></th>
603
        <th scope="col"><strong><?php echo _("Result");?></strong></th>
604
        <th scope="col"><strong><?php echo _("AP Identifier");?></strong></th>
605
    </tr>
606
    <?php
607
    $userAuthData = $deploymentObject->retrieveStatistics(0,5);
608
    foreach ($userAuthData as $oneRecord) {
609
        echo "<tr class='".($oneRecord['result'] == "OK" ? "auth-success" : "auth-fail" )."'>"
610
                . "<td>".$oneRecord['activity_time']."</td>"
611
                . "<td>".$oneRecord['realm']."</td>"
612
                . "<td>".$oneRecord['mac']."</td>"
613
                . "<td>".$oneRecord['cui']."</td>"
614
                . "<td>".($oneRecord['result'] == "OK" ? _("Success") : _("Failure"))."</td>"
615
                . "<td>".$oneRecord['ap_id']."</td>"
616
                . "</tr>";
617
    }
618
    ?>
619
</table>
620
            <div style='display: ruby;'><form action="inc/deploymentStats.inc.php?inst_id=<?php echo $deploymentObject->institution; ?>&amp;deployment_id=<?php echo $deploymentObject->identifier; ?>" onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8' method='post'>
621
                <button type='submit' id='stats-hour' name='stats' value='HOUR'><?php echo _("Last hour"); ?></button>
622
            </form>
623
            <form action="inc/deploymentStats.inc.php?inst_id=<?php echo $deploymentObject->institution; ?>&amp;deployment_id=<?php echo $deploymentObject->identifier; ?>" onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8' method='post'>
624
                <button type='submit' id='stats-month' name='stats' value='MONTH'><?php echo _("Last 30 days"); ?></button>
625
            </form>
626
            <form action="inc/deploymentStats.inc.php?inst_id=<?php echo $deploymentObject->institution; ?>&amp;deployment_id=<?php echo $deploymentObject->identifier; ?>" onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8' method='post'>
627
                <button type='submit' id='stats-full' name='stats' value='FULL'><?php echo _("Last 6 months"); ?></button>
628
            </form>
629
            </div>
630
        </div><!-- statistics space -->
631
    </div> 
632
    <!-- dummy div to keep a little distance-->
633
    <div style='height:20px'></div>
634
    <?php
635
}
636
637
/**
638
 * displays a eduroam DB entry for SPs. Not implemented yet.
639
 * 
640
 * @param \core\DeploymentClassic $deploymentObject the deployment to work with
641
 */
642
function displayClassicHotspotPropertyWidget($deploymentObject) {
0 ignored issues
show
Unused Code introduced by
The parameter $deploymentObject is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

642
function displayClassicHotspotPropertyWidget(/** @scrutinizer ignore-unused */ $deploymentObject) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
643
    
644
}
645
646
/**
647
 * checks if both RADIUS servers are ready to accept reconfiguration requests
648
 * 
649
 * 
650
 */
651
function radius_ready($dsp) {
652
    foreach (array($dsp->host1_v4, $dsp->host2_v4) as $host) {
653
        $connection = @fsockopen($host, \config\Master::MANAGEDSP['radiusconfigport']);
654
        if (is_resource($connection)) {
655
           fclose($connection);
656
        } else {
657
           return false;
658
        }
659
    }
660
    return true;
661
}
662
$deco = new \web\lib\admin\PageDecoration();
663
$validator = new \web\lib\common\InputValidation();
664
$uiElements = new web\lib\admin\UIElements();
665
echo $deco->defaultPagePrelude(sprintf(_("%s: %s Dashboard"), \config\Master::APPEARANCE['productname'], $uiElements->nomenclatureParticipant));
666
require_once "inc/click_button_js.php";
667
668
// let's check if the inst handle actually exists in the DB
669
[$my_inst, $editMode] = $validator->existingIdPInt($_GET['inst_id'], $_SESSION['user']);
670
671
$myfed = new \core\Federation($my_inst->federation);
672
673
// delete stored realm
674
675
if (isset($_SESSION['check_realm'])) {
676
    unset($_SESSION['check_realm']);
677
}
678
$mapCode = web\lib\admin\AbstractMap::instance($my_inst, TRUE);
679
echo $mapCode->htmlHeadCode();
680
?>
681
<script src="js/XHR.js" type="text/javascript"></script>    
682
<script src="js/popup_redirect.js" type="text/javascript"></script>
683
<script type="text/javascript" src="../external/jquery/jquery-ui.js"></script> 
684
<link rel="stylesheet" type="text/css" href="../external/jquery/jquery-ui.css" />
685
<script>
686
$(document).ready(function() {    
687
    $("img.cat-icon").tooltip();
688
});
689
$(document).on('click', '.sp_priv_key' , function(e) {
690
    var did = $(this).attr('id').substring('priv_key_'.length);
691
    var OpenWindow = window.open('','_blank','width=600,height=800,resizable=1');
692
    var content = $("#priv_key_data_" + did).val();
693
    OpenWindow.document.write('<html><head><title>Private key</title><body><pre>'+content+'</body>');
694
    OpenWindow.document.write('</body></html>');
695
    e.preventDefault();
696
});
697
$(document).on('click', '.sp_cert' , function(e) {
698
    var did = $(this).attr('id').substring('cert_'.length);
699
    var OpenWindow = window.open('','_blank','width=600,height=500,resizable=1');
700
    var content = $("#cert_data_" + did).val();
701
    OpenWindow.document.write('<html><head><title>Certificate</title><body><pre>'+content+'</body>');
702
    OpenWindow.document.write('</body></html>');
703
    e.preventDefault();
704
});
705
$(document).on('click', '.ca_cert' , function(e) {
706
    var OpenWindow = window.open('','_blank','width=600,height=500,resizable=1');
707
    var content = $("#ca_cert_data").val();
708
    OpenWindow.document.write('<html><head><title>CA Certificate</title><body><pre>'+content+'</body>');
709
    OpenWindow.document.write('</body></html>');
710
    e.preventDefault();
711
});
712
$(document).on('click', '.send_zip' , function(e) {
713
    var OpenWindow = window.open();
714
    var content = $("#zip_data").val();
715
    OpenWindow.document.write(content);
716
    e.preventDefault();
717
});
718
</script>        
719
        
720
<body <?php echo $mapCode->bodyTagCode(); ?>>
721
    <?php
722
    echo $deco->productheader("ADMIN-PARTICIPANT");
723
724
// Sanity check complete. Show what we know about this IdP.
725
    $idpoptions = $my_inst->getAttributes();
726
    if ($editMode == 'readonly') {
727
        $editLabel = _("View ...");
728
    }
729
    if ($editMode == 'fullaccess') {
730
        $editLabel = _("Edit ...");
731
    }
732
    ?>
733
    <h1><?php echo sprintf(_("%s Overview"), $uiElements->nomenclatureParticipant); ?></h1>
734
    <hr/>
735
    <div>
736
        <h2 style='display: flex;'><?php echo sprintf(_("%s general settings"), $uiElements->nomenclatureParticipant); ?>&nbsp;
737
            <form action='edit_participant.php?inst_id=<?php echo $my_inst->identifier; ?>' method='post' accept-charset='UTF-8'>
738
                <button type='submit' name='submitbutton' value='<?php echo \web\lib\common\FormElements::BUTTON_EDIT; ?>'><?php echo $editLabel; ?></button>
739
            </form>
740
        </h2>
741
        <?php
742
        echo $uiElements->instLevelInfoBoxes($my_inst);
743
        ?>
744
        <?php
745
        foreach ($idpoptions as $optionname => $optionvalue) {
746
            if ($optionvalue['name'] == "general:geo_coordinates") {
747
                echo '<div class="infobox">';
748
                echo $mapCode->htmlShowtime();
749
                echo '</div>';
750
                break;
751
            }
752
        }
753
        ?>
754
755
    </div>
756
    <hr/>
757
    <?php
758
    $readonly = \config\Master::DB['INST']['readonly'];
759
    if (preg_match("/IdP/", $my_inst->type)) {
760
        ?>
761
        <h2 style='display: flex;'><?php printf(_("%s: %s Deployment Details"), $uiElements->nomenclatureParticipant, $uiElements->nomenclatureIdP); ?>&nbsp;
762
            <?php
763
            $profiles_for_this_idp = $my_inst->listProfiles();
764
            if ($readonly === FALSE) {
765
766
                // the opportunity to add a new silverbullet profile is only shown if
767
                // a) there is no SB profile yet
768
                // b) federation wants this to happen
769
                // first find out if we already have SB profiles
770
                $sbProfileExists = FALSE;
771
                foreach ($profiles_for_this_idp as $profilecount => $profile_list) {
772
                    switch (get_class($profile_list)) {
773
                        case "core\ProfileSilverbullet":
774
                            $sbProfileExists = TRUE;
775
                            break;
776
                        default:
777
                    }
778
                }
779
                if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL" && count($myfed->getAttributes("fed:silverbullet")) > 0 && $sbProfileExists === FALSE) {
780
                    // the button is greyed out if there's no support email address configured...
781
                    $hasMail = count($my_inst->getAttributes("support:email"));
782
                    ?>
783
                    <form action='edit_silverbullet.php?inst_id=<?php echo $my_inst->identifier; ?>' method='post' accept-charset='UTF-8'>
784
                        <div>
785
                            <button type='submit' <?php echo ($hasMail > 0 ? "" : "disabled"); ?> name='profile_action' value='new'>
786
                                <?php echo sprintf(_("Add %s profile ..."), \core\ProfileSilverbullet::PRODUCTNAME); ?>
787
                            </button>
788
                        </div>
789
                    </form>&nbsp;
790
                    <?php
791
                }
792
                ?>
793
794
                <?php
795
                // adding a normal profile is always possible if we're configured for it
796
                if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_RADIUS'] == "LOCAL" && $editMode === 'fullaccess') {
797
                    ?>
798
                    <form action='edit_profile.php?inst_id=<?php echo $my_inst->identifier; ?>' method='post' accept-charset='UTF-8'>
799
                        <div>
800
                            <button type='submit' name='profile_action' value='new'>
801
                                <?php echo _("New RADIUS/EAP profile (manual setup) ..."); ?>
802
                            </button>
803
                        </div>
804
                    </form>&nbsp;
805
                    <form method='post' action='inc/profileAutodetectCA.inc.php?inst_id=<?php echo $my_inst->identifier; ?>' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'>
806
                        <div>
807
                            <button type='submit' name='profile_action' value='new'>
808
                                <?php echo _("New RADIUS/EAP profile (autodetect server details) ..."); ?>
809
                            </button>
810
                        </div>
811
                    </form>
812
                    <?php
813
                }
814
            }
815
            ?>
816
        </h2>
817
        <?php if(count($profiles_for_this_idp) > 1 && $readonly === FALSE && $editMode === 'fullaccess') { ?>
818
                    <form method='post' action='sort_profiles.php?inst_id=<?php echo $my_inst->identifier; ?>' accept-charset='UTF-8'>
819
                        <div>
820
                            <button type='submit' name='profile_sorting'>
821
                                <?php echo _("Change the order of profiles"); ?>
822
                            </button>
823
                        </div>
824
                    </form>  <p>
825
        <?php }
826
        if (count($profiles_for_this_idp) == 0) { // no profiles yet.
827
            printf(_("There are not yet any profiles for your %s."), $uiElements->nomenclatureIdP);
828
        }
829
// if there is one profile and it is of type Silver Bullet, display a very
830
// simple widget with just a "Manage" button
831
        foreach ($profiles_for_this_idp as $profilecount => $profile_list) {
832
            ?>
833
            <div style='display: table-row_id; margin-bottom: 20px;'>
834
                <div class='profilebox' style='display: table-cell; min-width: 650px;'>
835
                    <?php
836
                    switch (get_class($profile_list)) {
837
                        case "core\ProfileSilverbullet":
838
                            displaySilverbulletPropertyWidget($profile_list, $readonly, $uiElements);
839
                            break;
840
                        case "core\ProfileRADIUS":
841
                            displayRadiusPropertyWidget($profile_list, $readonly, $uiElements, $editMode);
842
                            break;
843
                        default:
844
                            throw new Exception("We were asked to operate on something that is neither a RADIUS nor Silverbullet profile!");
845
                    }
846
                    ?>
847
                </div>
848
                <!-- dummy width to keep a little distance -->
849
                <div style='width:20px;'></div>
850
                <div style='display: table-cell; min-width:200px;'>
851
                    <p>
852
                        <strong><?php echo _("User Downloads"); ?></strong>
853
                    </p>
854
                    <table>
855
                        <?php
856
                        $stats = $profile_list->getUserDownloadStats();
857
                        foreach ($stats as $dev => $count) {
858
                            echo "<tr><td><strong>$dev</strong></td><td>$count</td></tr>";
859
                        }
860
                        ?>
861
                    </table>
862
                </div>
863
            </div>
864
            <!-- dummy div to keep a little distance-->
865
            <div style='height:20px'></div>
866
            <?php
867
        }
868
        ?>
869
        <hr/>
870
        <?php
871
    }
872
    if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL" && count($myfed->getAttributes("fed:silverbullet")) > 0) {
873
    if (preg_match("/SP/", $my_inst->type)) {
874
        ?>
875
        <h2 style='display: flex;'><?php printf(_("%s: %s Deployment Details"), $uiElements->nomenclatureParticipant, $uiElements->nomenclatureHotspot); ?>&nbsp;
876
            <?php
877
            if ($readonly === FALSE && $editMode === 'fullaccess') {
878
                if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL" && count($myfed->getAttributes("fed:silverbullet")) > 0) {
879
                    // the button is greyed out if there's no support email address configured...
880
                    $hasMail = count($my_inst->getAttributes("support:email"));
881
                    ?>
882
                    <form action='edit_hotspot.php?inst_id=<?php echo $my_inst->identifier; ?>' method='post' accept-charset='UTF-8'>
883
                        <div>
884
                            <input type="hidden" name="consortium" value="eduroam"/>
885
                            <button type='submit' <?php echo ($hasMail > 0 ? "" : "disabled"); ?> name='profile_action' value='new'>
886
                                <?php echo sprintf(_("Add %s deployment ..."), \config\ConfAssistant::CONSORTIUM['name'] . " " . \core\DeploymentManaged::PRODUCTNAME); ?>
887
                            </button>
888
                            <span style='color: red;'>
889
                            <?php if ($hasMail == 0) { 
890
                              echo _("Helpdesk mail address is required but missing!");  
891
                            }
892
                            ?>
893
                            </span>
894
                        </div>
895
                    </form>
896
                    
897
                    <?php 
898
                    /*
899
                    if (count($myfed->getAttributes("fed:openroaming")) > 0) {
900
                        ?>
901
                        &nbsp;
902
                        <form action='edit_hotspot.php?inst_id=<?php echo $my_inst->identifier; ?>' method='post' accept-charset='UTF-8'>
903
                            <div>
904
                                <input type="hidden" name="consortium" value="OpenRoaming"/>
905
                                <button type='submit' <?php echo ($hasMail > 0 ? "" : "disabled"); ?> name='profile_action' value='new'>
906
                                    <?php echo sprintf(_("Add %s deployment ..."), "OpenRoaming ANP"); ?>
907
                                </button>
908
909
                            </div>
910
                        </form>
911
                        <?php
912
                    }
913
                    */
914
                }
915
            }
916
            ?>
917
        </h2>
918
        <?php 
919
        $hotspotProfiles = $my_inst->listDeployments();
920
        if (count($hotspotProfiles) == 0) { // no profiles yet.
921
            echo sprintf(_("There are not yet any known deployments for your %s."), $uiElements->nomenclatureHotspot);
922
        }
923
924
        foreach ($hotspotProfiles as $counter => $deploymentObject) {
925
            switch (get_class($deploymentObject)) {
926
                case "core\DeploymentManaged":
927
                    displayDeploymentPropertyWidget($deploymentObject);
928
                    break;
929
                case "core\DeploymentClassic":
930
                    displayClassicHotspotPropertyWidget($deploymentObject);
931
                    break;
932
                default:
933
                    throw new Exception("We were asked to operate on something that is neither a classic nor a Managed hotspot deployment!");
934
            }
935
        }
936
    }
937
    }
938
    echo $deco->footer();
939
    
940