Skip to content

Commit 59582f5

Browse files
committed
Merge branch 'feature-upgrade-1.17' into devel
2 parents f645fb8 + 9c6c91e commit 59582f5

File tree

12 files changed

+131
-177
lines changed

12 files changed

+131
-177
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ Temporary Items
3131
*.swo
3232
**/css
3333
**/.sass-cache
34+
**/*.un~

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
9+
### Added
10+
- Add languages (Xhosa, Zulu, Afrikaans).
11+
12+
### Changed
13+
- Rename disco-tpl.php->disco.tpl.php as needed by simplesamlphp>1.14.
14+
- Update translation functionality as needed by simplesamlphp>1.14.
15+
716
## [v2.3.1](https://github.com/rciam/simplesamlphp-module-themevanilla/compare/v2.3.0...v2.3.1) - 2019-09-12
817

918
### Fixed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,19 @@ To modify the cookie banner and cookie policy page, you must edit the following
247247
and to modify the table in cookie policy page:
248248
`<path-to-simplesamlphp>/config/module_themevanilla.php`.
249249

250-
## Compatibility Note
251-
252-
If you want to use the theme with **SimpleSAMLphp version greater than 1.14**, you
253-
need to rename the template of the discopower module:
254-
```
255-
themes/ssp/discopower/disco-tpl.php -> themes/ssp/discopower/disco.tpl.php
256-
```
257-
258250
## About SimpleSAMLphp themes
259251

260252
You can read more about themes in a SimpleSAMLphp installation from the
261253
[official documentation](https://simplesamlphp.org/docs/stable/simplesamlphp-theming).
262254

255+
## Compatibility matrix
256+
257+
This table matches the theme version with the supported SimpleSAMLphp version.
258+
259+
| Theme | SimpleSAMLphp |
260+
|:------:|:--------------:|
261+
| v2.3.1 | v1.14 |
262+
| v3.0.0 | v1.17 |
263263

264264
## License
265265

templates/policy.tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
$themeConfig = SimpleSAML_Configuration::getConfig('module_themevanilla.php');
2+
$themeConfig = SimpleSAML\Configuration::getConfig('module_themevanilla.php');
33
$cookies = $themeConfig->getValue('cookiePolicy');
44
$this->data['header'] = (strpos($this->t('{themevanilla:policy:page_title}'), 'not translated') === FALSE ? $this->t('{themevanilla:policy:page_title}') : '');
55
$this->includeAtTemplateBase('includes/header.php');

themes/ssp/consent/consentform.php

Lines changed: 71 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -19,84 +19,64 @@
1919
* Template form for giving consent.
2020
*
2121
* Parameters:
22-
* - 'srcMetadata': Metadata/configuration for the source.
23-
* - 'dstMetadata': Metadata/configuration for the destination.
2422
* - 'yesTarget': Target URL for the yes-button. This URL will receive a POST request.
25-
* - 'yesData': Parameters which should be included in the yes-request.
2623
* - 'noTarget': Target URL for the no-button. This URL will receive a GET request.
27-
* - 'noData': Parameters which should be included in the no-request.
28-
* - 'attributes': The attributes which are about to be released.
2924
* - 'sppp': URL to the privacy policy of the destination, or FALSE.
3025
*
3126
* @package SimpleSAMLphp
3227
*/
33-
assert('is_array($this->data["srcMetadata"])');
34-
assert('is_array($this->data["dstMetadata"])');
35-
assert('is_string($this->data["yesTarget"])');
36-
assert('is_array($this->data["yesData"])');
37-
assert('is_string($this->data["noTarget"])');
38-
assert('is_array($this->data["noData"])');
39-
assert('is_array($this->data["attributes"])');
40-
assert('is_array($this->data["hiddenAttributes"])');
41-
assert('$this->data["sppp"] === false || is_string($this->data["sppp"])');
28+
assert(is_string($this->data['yesTarget']));
29+
assert(is_string($this->data['noTarget']));
30+
assert($this->data['sppp'] === false || is_string($this->data['sppp']));
31+
32+
// Needed for present_attributes_ssp()
33+
$globalConfig = \SimpleSAML\Configuration::getInstance();
34+
$t = new \SimpleSAML\XHTML\Template($globalConfig, 'consent:consentform.php');
4235

4336
// Parse parameters
44-
if (array_key_exists('name', $this->data['srcMetadata'])) {
45-
$srcName = $this->data['srcMetadata']['name'];
46-
} elseif (array_key_exists('OrganizationDisplayName', $this->data['srcMetadata'])) {
47-
$srcName = $this->data['srcMetadata']['OrganizationDisplayName'];
48-
} else {
49-
$srcName = $this->data['srcMetadata']['entityid'];
50-
}
37+
$dstName = $this->data['dstName'];
38+
$srcName = $this->data['srcName'];
5139

52-
if (is_array($srcName)) {
53-
$srcName = $this->t($srcName);
54-
}
40+
$id = $_REQUEST['StateId'];
41+
$state = \SimpleSAML\Auth\State::loadState($id, 'consent:request');
5542

56-
if (array_key_exists('name', $this->data['dstMetadata'])) {
57-
$dstName = $this->data['dstMetadata']['name'];
58-
} elseif (array_key_exists('OrganizationDisplayName', $this->data['dstMetadata'])) {
59-
$dstName = $this->data['dstMetadata']['OrganizationDisplayName'];
43+
if (array_key_exists('consent:hiddenAttributes', $state)) {
44+
$t->data['hiddenAttributes'] = $state['consent:hiddenAttributes'];
6045
} else {
61-
$dstName = $this->data['dstMetadata']['entityid'];
62-
}
63-
64-
if (is_array($dstName)) {
65-
$dstName = $this->t($dstName);
46+
$t->data['hiddenAttributes'] = [];
6647
}
6748

68-
$srcName = htmlspecialchars($srcName);
69-
$dstName = htmlspecialchars($dstName);
70-
7149
$attributes = $this->data['attributes'];
7250

7351
$this->data['header'] = $this->t('{consent:consent:consent_header}');
7452
$this->data['jquery'] = array('core' => TRUE);
7553

7654
$this->includeAtTemplateBase('includes/header.php');
7755
?>
56+
<h2 class="text-center"><?php echo $this->data['consent_accept']; ?></h2>
57+
<div class="row js-spread">
58+
<div class="col-sm-12 ssp-content-group js-spread">
59+
60+
<?php
61+
echo $this->data['attributes_html'] = present_attributes_ssp($t, $attributes, '');
7862

79-
<?php
80-
if ($this->data['sppp'] !== false) {
81-
echo "<p>" . htmlspecialchars($this->t('{consent:consent:consent_privacypolicy}')) . " ";
82-
echo "<a target='_blank' href='" . htmlspecialchars($this->data['sppp']) . "'>" . $dstName . "</a>";
83-
echo "</p>";
84-
}
8563

8664
/**
8765
* Recursive attribute array listing function
8866
*
89-
* @param SimpleSAML_XHTML_Template $t Template object
67+
* @param \SimpleSAML\XHTML\Template $t Template object
9068
* @param array $attributes Attributes to be presented
9169
* @param string $nameParent Name of parent element
9270
*
9371
* @return string HTML representation of the attributes
9472
*/
95-
function present_attributes($t, $attributes, $nameParent)
73+
function present_attributes_ssp($t, $attributes, $nameParent)
9674
{
97-
$alternate = array('ssp-table--tr__odd', 'ssp-table--tr__even');
75+
$translator = $t->getTranslator();
76+
77+
$alternate = ['ssp-table--tr__odd', 'ssp-table--tr__even'];
9878
$i = 0;
99-
$summary = 'summary="' . $t->t('{consent:consent:table_summary}') . '"';
79+
$summary = 'summary="'.$translator->t('{consent:consent:table_summary}').'"';
10080

10181
if (strlen($nameParent) > 0) {
10282
$parentStr = strtolower($nameParent) . '_';
@@ -108,49 +88,48 @@ function present_attributes($t, $attributes, $nameParent)
10888

10989
foreach ($attributes as $name => $value) {
11090
$nameraw = $name;
111-
$name = $t->getAttributeTranslation($parentStr . $nameraw);
91+
$name = $translator->getAttributeTranslation($parentStr.$nameraw);
11292

11393
if (preg_match('/^child_/', $nameraw)) {
11494
// insert child table
11595
$parentName = preg_replace('/^child_/', '', $nameraw);
11696
foreach ($value as $child) {
117-
$str .= "\n" . '<tr class="odd ssp--table--tr__odd"><td>' .
118-
present_attributes($t, $child, $parentName) . '</td></tr>';
97+
$str .= "\n" . '<tr class="odd ssp--table--tr__odd"><td>'.
98+
present_attributes_ssp($t, $child, $parentName) . '</td></tr>';
11999
}
120100
} else {
121101
// insert values directly
122102

123103
$str .= "\n" . '<tr class="' . $alternate[($i++ % 2)] .
124104
'"><td><div class="attrname ssp-table--attrname">' . htmlspecialchars($name) . '</div>';
125105

106+
126107
$isHidden = in_array($nameraw, $t->data['hiddenAttributes'], true);
127108
if ($isHidden) {
128-
$hiddenId = SimpleSAML\Utils\Random::generateID();
129-
109+
$hiddenId = \SimpleSAML\Utils\Random::generateID();
130110
$str .= '<div class="attrvalue ssp-table--attrvalue" style="display: none;" id="hidden_' . $hiddenId . '">';
131111
} else {
132112
$str .= '<div class="attrvalue ssp-table--attrvalue">';
133113
}
134114

135115
if (sizeof($value) > 1) {
136-
// we hawe several values
116+
// we have several values
137117
$str .= '<ul class="list-unstyled ssp-table--attrvalue--list">';
138118
foreach ($value as $listitem) {
139119
if ($nameraw === 'jpegPhoto') {
140120
$str .= '<li class="ssp-table--attrvalue--list--item"><img src="data:image/jpeg;base64,' .
141-
htmlspecialchars($listitem) .
142-
'" alt="User photo" /></li>';
121+
htmlspecialchars($listitem).'" alt="User photo" /></li>';
143122
} else {
144123
$str .= '<li class="ssp-table--attrvalue--list--item">' . htmlspecialchars($listitem) . '</li>';
145124
}
146125
}
147126
$str .= '</ul>';
127+
148128
} elseif (isset($value[0])) {
149-
// we hawe only one value
129+
// we have only one value
150130
if ($nameraw === 'jpegPhoto') {
151-
$str .= '<img src="data:image/jpeg;base64,' .
152-
htmlspecialchars($value[0]) .
153-
'" alt="User photo" />';
131+
$str .= '<img src="data:image/jpeg;base64,'.
132+
htmlspecialchars($value[0]).'" alt="User photo" />';
154133
} else {
155134
$str .= htmlspecialchars($value[0]);
156135
}
@@ -168,64 +147,55 @@ function present_attributes($t, $attributes, $nameParent)
168147
}
169148

170149
$str .= '</td></tr>';
171-
} // end else: not child table
172-
} // end foreach
150+
} // end else: not child table
151+
} // end foreach
173152
$str .= isset($attributes)? '</table></div>':'';
174153
return $str;
175154
}
176-
177-
echo '<h2 class="text-center">' .
178-
$this->t(
179-
'{consent:consent:consent_accept}',
180-
array( 'SPNAME' => $dstName, 'IDPNAME' => $srcName)).
181-
'</h2>
182-
<div class="row js-spread">
183-
<div class="col-sm-12 ssp-content-group js-spread">';
184155
?>
185156

186-
<?php
187-
echo present_attributes($this, $attributes, '');
188-
?>
189-
<div class="ssp-btns-container">
190-
<form style="display: inline-block"
191-
action="<?php echo htmlspecialchars($this->data['yesTarget']); ?>">
192-
<p class"ssp-btns-container--checkbox>
193157

194158
<?php
195-
if ($this->data['usestorage']) {
196-
$checked = ($this->data['checked'] ? 'checked="checked"' : '');
197-
echo '<input type="checkbox" name="saveconsent" ' . $checked .
198-
' value="1" /> ' . $this->t('{consent:consent:remember}');
199-
}
200-
201-
// Embed hidden fields...
202-
foreach ($this->data['yesData'] as $name => $value) {
203-
echo '<input type="hidden" name="' . htmlspecialchars($name) .
204-
'" value="' . htmlspecialchars($value) . '" />';
159+
if (isset($this->data['consent_purpose'])) {
160+
echo '<p>'.$this->data['consent_purpose'].'</p>';
205161
}
206162
?>
207-
</p>
208-
<button type="submit" name="yes" class=" ssp-btn btn ssp-btn__action ssp-btns-container--btn__left text-uppercase" id="yesbutton">
209-
<?php echo htmlspecialchars($this->t('{consent:consent:yes}')) ?>
210-
</button>
211-
</form>
212163

213-
<form style="display: inline-block;" action="<?php echo htmlspecialchars($this->data['noTarget']); ?>"
214-
method="get">
215164

165+
<div class="ssp-btns-container">
166+
<form id="consent_yes" action="<?php echo htmlspecialchars($this->data['yesTarget']); ?>" style="display:inline-block;">
167+
<p class="ssp-btns-container--checkbox">
216168
<?php
217-
foreach ($this->data['noData'] as $name => $value) {
218-
echo('<input type="hidden" name="' . htmlspecialchars($name) .
219-
'" value="' . htmlspecialchars($value) . '" />');
220-
}
169+
if ($this->data['usestorage']) {
170+
$checked = ($this->data['checked'] ? 'checked="checked"' : '');
171+
echo '<input type="checkbox" name="saveconsent" '.$checked.
172+
' value="1" /> '.$this->t('{consent:consent:remember}');
173+
} // Embed hidden fields...
221174
?>
222-
<button type="submit" class="ssp-btn ssp-btn__secondary btn ssp-btns-container--btn__right text-uppercase" name="no" id="nobutton">
223-
<?php echo htmlspecialchars($this->t('{consent:consent:no}')) ?>
224-
</button>
175+
<input type="hidden" name="StateId" value="<?php echo htmlspecialchars($this->data['stateId']); ?>" />
176+
</p>
177+
<button type="submit" name="yes" class="ssp-btn btn ssp-btn__action ssp-btns-container--btn__left text-uppercase" id="yesbutton">
178+
<?php echo htmlspecialchars($this->t('{consent:consent:yes}')) ?>
179+
</button>
180+
</form>
181+
182+
<form id="consent_no" action="<?php echo htmlspecialchars($this->data['noTarget']); ?>" style="display:inline-block;">
183+
<input type="hidden" name="StateId" value="<?php echo htmlspecialchars($this->data['stateId']); ?>" />
184+
<button type="submit" class="ssp-btn ssp-btn__secondary btn ssp-btns-container--btn__right text-uppercase" name="no" id="nobutton">
185+
<?php echo htmlspecialchars($this->t('{consent:consent:no}')) ?>
186+
</button>
225187
</form>
226-
</div> <!-- /ssp-btns-container -->
188+
</div> <!--/ssp-btns-container-->
227189
</div> <!-- /ssp-content-group -->
228190
</div> <!-- /row -->
191+
229192
<?php
193+
if ($this->data['sppp'] !== false) {
194+
echo "<p>".htmlspecialchars($this->t('{consent:consent:consent_privacypolicy}'))." ";
195+
echo '<a target="_blank" href="'.htmlspecialchars($this->data['sppp']).'">'.$dstName."</a>";
196+
echo "</p>";
197+
}
198+
199+
200+
230201
$this->includeAtTemplateBase('includes/footer.php');
231-
?>

themes/ssp/consent/logout_completed.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
$this->data['header'] = $this->t('{logout:title}');
4+
$this->data['jquery'] = array('core' => TRUE);
45
$this->includeAtTemplateBase('includes/header.php');
56

67
echo('<h2>' . $this->data['header'] . '</h2>');

themes/ssp/consent/noconsent.php

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
<?php
22

3-
if (array_key_exists('name', $this->data['dstMetadata'])) {
4-
$dstName = $this->data['dstMetadata']['name'];
5-
} elseif (array_key_exists('OrganizationDisplayName', $this->data['dstMetadata'])) {
6-
$dstName = $this->data['dstMetadata']['OrganizationDisplayName'];
7-
} else {
8-
$dstName = $this->data['dstMetadata']['entityid'];
9-
}
10-
if (is_array($dstName)) {
11-
$dstName = $this->t($dstName);
12-
}
13-
$dstName = htmlspecialchars($dstName);
14-
15-
16-
$this->data['header'] = $this->t('{consent:consent:noconsent_title}');;
3+
$this->data['header'] = $this->t('{consent:consent:noconsent_title}');
4+
$this->data['jquery'] = array('core' => TRUE);
175

186
$this->includeAtTemplateBase('includes/header.php');
197

20-
echo '<h3>' . $this->data['header'] . '</h3>';
21-
echo '<p>' . $this->t('{consent:consent:noconsent_text}', array('SPNAME' => $dstName)) . '</p>';
8+
echo '<h3>'.$this->data['header'].'</h3>';
9+
echo '<p>'.$this->data['noconsent_text'].'</p>';
2210

2311
echo '<div class="ssp-btns-container">';
2412
if ($this->data['resumeFrom']) {
25-
echo('<a href="' . htmlspecialchars($this->data['resumeFrom']) . '" class="ssp-btn btn ssp-btn__action ssp-btns-container--btn__left text-uppercase">');
13+
echo('<a href="'.htmlspecialchars($this->data['resumeFrom']).'" class="ssp-btn btn ssp-btn__action ssp-btns-container--btn__left text-uppercase">');
2614
echo($this->t('{consent:consent:noconsent_return}'));
2715
echo('</a>');
2816
}
2917

3018
if ($this->data['aboutService']) {
31-
echo('<a href="' . htmlspecialchars($this->data['aboutService']) . '" class="ssp-btn btn text-uppercase">');
19+
echo('<a href="'.htmlspecialchars($this->data['aboutService']).'" class="ssp-btn btn text-uppercase" >');
3220
echo($this->t('{consent:consent:noconsent_goto_about}'));
3321
echo('</a>');
3422
}
35-
echo('<a href="' . htmlspecialchars($this->data['logoutLink']) . '" class="ssp-btn btn ssp-btn__warning text-uppercase ssp-btns-container--btn__right">' . $this->t('{consent:consent:abort}', array('SPNAME' => $dstName)) . '</a>');
23+
24+
echo('<a href="'.htmlspecialchars($this->data['logoutLink']).'" class="ssp-btn btn ssp-btn__warning text-uppercase ssp-btns-container--btn__right">'.$this->data['noconsent_abort'].'</a>');
3625
echo '</div>'; //ssp-btns-container
3726

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

themes/ssp/core/no_state.tpl.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
echo('<h2>' . $this->t('{core:no_state:suggestions}') . '</h2>');
44
echo('<ul class="list-unstyled">');
5+
echo '<li>' . $this->t('{core:no_state:suggestion_badlink}') . '</li>';
56
echo('<li>' . $this->t('{core:no_state:suggestion_goback}') . '</li>');
67
echo('<li>' . $this->t('{core:no_state:suggestion_closebrowser}') . '</li>');
78
echo('</ul>');
89

910
echo('<h3>' . $this->t('{core:no_state:causes}') . '</h3>');
1011
echo('<ul class="list-unstyled">');
12+
echo '<li>' . $this->t('{core:no_state:cause_badlink}') . '</li>';
1113
echo('<li>' . $this->t('{core:no_state:cause_backforward}') . '</li>');
1214
echo('<li>' . $this->t('{core:no_state:cause_openbrowser}') . '</li>');
1315
echo('<li>' . $this->t('{core:no_state:cause_nocookie}') . '</li>');

0 commit comments

Comments
 (0)