File: selectidp-links.php

package info (click to toggle)
simplesamlphp 1.19.7-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 42,920 kB
  • sloc: php: 202,044; javascript: 14,867; xml: 2,700; sh: 225; perl: 82; makefile: 70; python: 5
file content (94 lines) | stat: -rw-r--r-- 4,585 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php

if (!array_key_exists('header', $this->data)) {
    $this->data['header'] = 'selectidp';
}
$this->data['header'] = $this->t($this->data['header']);
$this->data['autofocus'] = 'preferredidp';
$this->includeAtTemplateBase('includes/header.php');
foreach ($this->data['idplist'] as $idpentry) {
    if (isset($idpentry['name'])) {
        $this->getTranslator()->includeInlineTranslation('idpname_'.$idpentry['entityid'], $idpentry['name']);
    } elseif (isset($idpentry['OrganizationDisplayName'])) {
        $this->getTranslator()->includeInlineTranslation(
            'idpname_'.$idpentry['entityid'],
            $idpentry['OrganizationDisplayName']
        );
    }
    if (isset($idpentry['description'])) {
        $this->getTranslator()->includeInlineTranslation('idpdesc_'.$idpentry['entityid'], $idpentry['description']);
    }
}
?>
    <h2><?php echo $this->data['header']; ?></h2>
    <form method="get" action="<?php echo $this->data['urlpattern']; ?>">
        <input type="hidden" name="entityID" value="<?php echo htmlspecialchars($this->data['entityID']); ?>"/>
        <input type="hidden" name="return" value="<?php echo htmlspecialchars($this->data['return']); ?>"/>
        <input type="hidden" name="returnIDParam"
               value="<?php echo htmlspecialchars($this->data['returnIDParam']); ?>"/>
        <p><?php
            echo $this->t('selectidp_full');
            if ($this->data['rememberenabled']) {
                echo('<br/><input type="checkbox" id="remember" name="remember" value="1"');
                if ($this->data['rememberchecked']) {
                    echo(' checked');
                }
                echo(' /><label for="remember">'.$this->t('remember').'</label>');
            }
            ?></p>
<?php
        usort($this->data['idplist'], function($idpentry1, $idpentry2) {
            return strcasecmp(
                $this->t('idpname_'.$idpentry1['entityid']),
                $this->t('idpname_'.$idpentry2['entityid'])
            );
        });

        if (!empty($this->data['preferredidp'])) {
            foreach ($this->data['idplist'] as $idpentry) {
                if ($idpentry['entityid'] != $this->data['preferredidp']) {
                    continue;
                }
                echo '<div class="preferredidp">';
                echo '	<img src="/'.$this->data['baseurlpath'].
                    'resources/icons/experience/gtk-about.64x64.png" class="float-r" alt="'.
                    $this->t('icon_prefered_idp').'" />';

                if (array_key_exists('icon', $idpentry) && $idpentry['icon'] !== null) {
                    $iconUrl = \SimpleSAML\Utils\HTTP::resolveURL($idpentry['icon']);
                    echo '<img class="float-l" style="margin: 1em; padding: 3px; border: 1px solid #999" src="'.
                        htmlspecialchars($iconUrl).'" />';
                }
                echo "\n".'	<h3 style="margin-top: 8px">'.
                    htmlspecialchars($this->t('idpname_'.$idpentry['entityid'])).'</h3>';

                if (!empty($idpentry['description'])) {
                    echo '	<p>'.htmlspecialchars($this->t('idpdesc_'.$idpentry['entityid'])).'<br />';
                }
                echo('<button id="preferredidp" type="submit" class="btn" name="idp_'.
                    htmlspecialchars($idpentry['entityid']).'">'.
                    $this->t('select').'</button></p>');
                echo '</div>';
            }
        }

        foreach ($this->data['idplist'] as $idpentry) {
            if ($idpentry['entityid'] != $this->data['preferredidp']) {
                if (array_key_exists('icon', $idpentry) && $idpentry['icon'] !== null) {
                    $iconUrl = \SimpleSAML\Utils\HTTP::resolveURL($idpentry['icon']);
                    echo '<img class="float-l" style="clear: both; margin: 1em; padding: 3px; border: 1px solid #999"'.
                        ' src="'.htmlspecialchars($iconUrl).'" />';
                }
                echo "\n".'	<h3 style="margin-top: 8px">'.htmlspecialchars($this->t('idpname_'.$idpentry['entityid']));
                echo '</h3>';

                if (!empty($idpentry['description'])) {
                    echo '	<p>'.htmlspecialchars($this->t('idpdesc_'.$idpentry['entityid'])).'<br />';
                }
                echo '<button type="submit" class="btn" name="idp_'.htmlspecialchars($idpentry['entityid']).'">'.
                    $this->t('select').'</button></p>';
            }
        }
?>
    </form>
<?php $this->includeAtTemplateBase('includes/footer.php');