File: consentadmin.php

package info (click to toggle)
simplesamlphp 1.16.3-1%2Bdeb10u2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 21,036 kB
  • sloc: php: 73,175; ansic: 875; sh: 83; perl: 82; xml: 52; makefile: 46
file content (132 lines) | stat: -rw-r--r-- 5,129 bytes parent folder | download
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php $this->includeAtTemplateBase('includes/header.php'); ?>
<!--  default theme -->

<script>
    function setConsentText(consentStatus, show_spid) {
        document.getElementById("consentText" + show_spid).innerHTML = consentStatus;
    }
</script>

<script src="includes/consentSimpleAjax.js"></script>

<style>
.caSPName {
    font-weight: bold;
}

td.caSPName {
    vertical-align: top;
}

.caAllowed {

}

td.caAllowed {
    vertical-align: top;
}

td.caAttributes {

}

tr.row0 td {
    background-color: #888888;
    color: black;
}

tr.row1 td {
    background-color: #aaaaaa;
    color: black;
}

a.orange {
    color: #ffd633;
}

span.showhide {

}
</style>


        <!-- <h2><?php if (isset($this->data['header'])) { echo $this->t($this->data['header']); } else { echo "Some error occurred"; } ?></h2> -->
        <h2><?php echo $this->t('{consentAdmin:consentadmin:consentadmin_header}') ?></h2>
        <p>
        <?php echo $this->t('{consentAdmin:consentadmin:consentadmin_description1}') ?> </p>


            <table>
            <tr>
                <th width="80%"><?php echo $this->t('{consentAdmin:consentadmin:service_provider_header}') ?></th>
                <th width="140"><?php echo $this->t('{consentAdmin:consentadmin:status_header}') ?></th>
            </tr>
            <?php
            $spList = $this->data['spList'];
            $show_spid = 0;
            $show_text = $this->t('{consentAdmin:consentadmin:show}');
            $hide_text = $this->t('{consentAdmin:consentadmin:hide}');
            $attributes_text = $this->t('{consentAdmin:consentadmin:attributes_text}');
            foreach ($spList AS $spName => $spValues) {
                $this->getTranslator()->includeInlineTranslation('spname', $spValues['name']);
                $this->getTranslator()->includeInlineTranslation('spdescription', $spValues['description']);
                if (!is_null($spValues['serviceurl'])) {
                    $htmlSpName = '<a href="' . $spValues['serviceurl'] . '" style="color: black; font-weight: bold;">' . htmlspecialchars($this->t('spname', array(), false, true)) . '</a>';
                } else {
                    $htmlSpName = htmlspecialchars($this->t('spname', array(), false, true));
                }
                $spDescription = htmlspecialchars($this->t('spdescription',array(), false, true));
                $checkedAttr = $spValues['consentStatus'] == 'ok' ? 'checked="checked"' : '';
                $consentValue = $spValues['consentValue'];
                $consentText = $spValues['consentStatus'] == 'changed' ? "attributes has changed" : "";
                $row_class = ($show_spid % 2) ? "row0" : "row1";
                echo <<<TRSTART
<tr class="$row_class">
<td>
    <table>
      <tr class="$row_class"><td><span class='caSPName'><span title='$spDescription'>$htmlSpName</span>&emsp;<span style="font-size: 80%;"onclick="javascript:toggleShowAttributes('$show_spid');"><span id='showing_$show_spid'>$show_text</span><span id='hiding_$show_spid' style='display:none;'>$hide_text</span> $attributes_text</span></span></td>
      <tr><td colspan="2" class="caAttributes"><div id="attributes_$show_spid" style="display: none;">
TRSTART;
                $attributes = $spValues['attributes_by_sp'];
                if ($this->data['showDescription']) {
                    echo '<p>' . $this->t('{consentAdmin:consentadmin:consentadmin_purpose}') . ' ' . $spDescription . '</p>';
                }
                echo "\n<ul>\n";
                foreach ($attributes AS $name => $value) {

                if (isset($this->data['attribute_' . htmlspecialchars(strtolower($name)) ])) {
                  $name = $this->data['attribute_' . htmlspecialchars(strtolower($name))];
                }
                $name = $this->getTranslator()->getAttributeTranslation($name); // translate
                if (sizeof($value) > 1) {
                        echo "<li>" . htmlspecialchars($name) . ":\n<ul>\n";
                        foreach ($value AS $v) {
                            echo '<li>' . htmlspecialchars($v) . "</li>\n";
                        }
                        echo "</ul>\n</li>\n";
                    } else {
                        echo "<li>" . htmlspecialchars($name) . ": " . htmlspecialchars($value[0]) . "</li>\n";
                    }
                }
                echo "</ul>";
                echo <<<TRSTART
      </div></td></tr>
  </table>
</td>

<td class='caAllowed'><input onclick="javascript:checkConsent(this.value, $show_spid, this.checked)" value='$consentValue' type='checkbox' $checkedAttr /><span id="consentText$show_spid">$consentText</span></td>
TRSTART;
            echo "</tr>\n";
            $show_spid++;
            }
            ?>
            </table>

            <p>
        <?php echo $this->t('{consentAdmin:consentadmin:consentadmin_description2}') ?> </p>

        <h2>Logout</h2>

            <p><a href="<?php echo \SimpleSAML\Module::getModuleURL('consentAdmin/consentAdmin.php', array('logout' => 1)); ?>">Logout</a></p>

<?php $this->includeAtTemplateBase('includes/footer.php');