Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
c3b7abed
Commit
c3b7abed
authored
6 years ago
by
Tim van Dijen
Browse files
Options
Downloads
Patches
Plain Diff
Fix duplicate function
parent
ca00becc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/consent/templates/consentform.php
+0
-94
0 additions, 94 deletions
modules/consent/templates/consentform.php
modules/consent/www/getconsent.php
+8
-8
8 additions, 8 deletions
modules/consent/www/getconsent.php
with
8 additions
and
102 deletions
modules/consent/templates/consentform.php
+
0
−
94
View file @
c3b7abed
...
...
@@ -59,100 +59,6 @@ if ($this->data['sppp'] !== false) {
echo
"</p>"
;
}
/**
* Recursive attribute array listing function
*
* @param \SimpleSAML\XHTML\Template $t Template object
* @param array $attributes Attributes to be presented
* @param string $nameParent Name of parent element
*
* @return string HTML representation of the attributes
*/
function
present_attributes
(
$t
,
$attributes
,
$nameParent
)
{
$translator
=
$t
->
getTranslator
();
$alternate
=
array
(
'odd'
,
'even'
);
$i
=
0
;
$summary
=
'summary="'
.
$t
->
t
(
'{consent:consent:table_summary}'
)
.
'"'
;
if
(
strlen
(
$nameParent
)
>
0
)
{
$parentStr
=
strtolower
(
$nameParent
)
.
'_'
;
$str
=
'<table class="attributes" '
.
$summary
.
'>'
;
}
else
{
$parentStr
=
''
;
$str
=
'<table id="table_with_attributes" class="attributes" '
.
$summary
.
'>'
;
$str
.
=
"
\n
"
.
'<caption>'
.
$t
->
t
(
'{consent:consent:table_caption}'
)
.
'</caption>'
;
}
foreach
(
$attributes
as
$name
=>
$value
)
{
$nameraw
=
$name
;
$name
=
$translator
->
getAttributeTranslation
(
$parentStr
.
$nameraw
);
if
(
preg_match
(
'/^child_/'
,
$nameraw
))
{
// insert child table
$parentName
=
preg_replace
(
'/^child_/'
,
''
,
$nameraw
);
foreach
(
$value
as
$child
)
{
$str
.
=
"
\n
"
.
'<tr class="odd"><td style="padding: 2em">'
.
present_attributes
(
$t
,
$child
,
$parentName
)
.
'</td></tr>'
;
}
}
else
{
// insert values directly
$str
.
=
"
\n
"
.
'<tr class="'
.
$alternate
[(
$i
++
%
2
)]
.
'"><td><span class="attrname">'
.
htmlspecialchars
(
$name
)
.
'</span>'
;
$isHidden
=
in_array
(
$nameraw
,
$t
->
data
[
'hiddenAttributes'
],
true
);
if
(
$isHidden
)
{
$hiddenId
=
SimpleSAML\Utils\Random
::
generateID
();
$str
.
=
'<div class="attrvalue" style="display: none;" id="hidden_'
.
$hiddenId
.
'">'
;
}
else
{
$str
.
=
'<div class="attrvalue">'
;
}
if
(
sizeof
(
$value
)
>
1
)
{
// we hawe several values
$str
.
=
'<ul>'
;
foreach
(
$value
as
$listitem
)
{
if
(
$nameraw
===
'jpegPhoto'
)
{
$str
.
=
'<li><img src="data:image/jpeg;base64,'
.
htmlspecialchars
(
$listitem
)
.
'" alt="User photo" /></li>'
;
}
else
{
$str
.
=
'<li>'
.
htmlspecialchars
(
$listitem
)
.
'</li>'
;
}
}
$str
.
=
'</ul>'
;
}
elseif
(
isset
(
$value
[
0
]))
{
// we hawe only one value
if
(
$nameraw
===
'jpegPhoto'
)
{
$str
.
=
'<img src="data:image/jpeg;base64,'
.
htmlspecialchars
(
$value
[
0
])
.
'" alt="User photo" />'
;
}
else
{
$str
.
=
htmlspecialchars
(
$value
[
0
]);
}
}
// end of if multivalue
$str
.
=
'</div>'
;
if
(
$isHidden
)
{
$str
.
=
'<div class="attrvalue consent_showattribute" id="visible_'
.
$hiddenId
.
'">'
;
$str
.
=
'... '
;
$str
.
=
'<a class="consent_showattributelink" href="javascript:SimpleSAML_show(\'hidden_'
.
$hiddenId
;
$str
.
=
'\'); SimpleSAML_hide(\'visible_'
.
$hiddenId
.
'\');">'
;
$str
.
=
$t
->
t
(
'{consent:consent:show_attribute}'
);
$str
.
=
'</a>'
;
$str
.
=
'</div>'
;
}
$str
.
=
'</td></tr>'
;
}
// end else: not child table
}
// end foreach
$str
.
=
isset
(
$attributes
)
?
'</table>'
:
''
;
return
$str
;
}
echo
'<h3 id="attributeheader">'
.
$this
->
t
(
'{consent:consent:consent_attributes_header}'
,
...
...
This diff is collapsed.
Click to expand it.
modules/consent/www/getconsent.php
+
8
−
8
View file @
c3b7abed
...
...
@@ -127,21 +127,21 @@ $t->data['attributes'] = $attributes;
$t
->
data
[
'checked'
]
=
$state
[
'consent:checked'
];
$t
->
data
[
'stateId'
]
=
$id
;
$srcName
=
htmlspecialchars
(
is_array
(
$srcName
)
?
$t
ranslator
->
t
(
$srcName
)
:
$srcName
);
$dstName
=
htmlspecialchars
(
is_array
(
$dstName
)
?
$t
ranslator
->
t
(
$dstName
)
:
$dstName
);
$srcName
=
htmlspecialchars
(
is_array
(
$srcName
)
?
$t
->
t
(
$srcName
)
:
$srcName
);
$dstName
=
htmlspecialchars
(
is_array
(
$dstName
)
?
$t
->
t
(
$dstName
)
:
$dstName
);
$t
->
data
[
'consent_attributes_header'
]
=
$t
ranslator
->
t
(
$t
->
data
[
'consent_attributes_header'
]
=
$t
->
t
(
'{consent:consent:consent_attributes_header}'
,
array
(
'SPNAME'
=>
$dstName
,
'IDPNAME'
=>
$srcName
)
);
$t
->
data
[
'consent_accept'
]
=
$t
ranslator
->
t
(
$t
->
data
[
'consent_accept'
]
=
$t
->
t
(
'{consent:consent:consent_accept}'
,
array
(
'SPNAME'
=>
$dstName
,
'IDPNAME'
=>
$srcName
)
);
if
(
array_key_exists
(
'descr_purpose'
,
$state
[
'Destination'
]))
{
$t
->
data
[
'consent_purpose'
]
=
$t
ranslator
->
t
(
$t
->
data
[
'consent_purpose'
]
=
$t
->
t
(
'{consent:consent:consent_purpose}'
,
array
(
'SPNAME'
=>
$dstName
,
...
...
@@ -216,7 +216,7 @@ function present_attributes($t, $attributes, $nameParent)
$alternate
=
array
(
'odd'
,
'even'
);
$i
=
0
;
$summary
=
'summary="'
.
$t
ranslator
->
t
(
'{consent:consent:table_summary}'
)
.
'"'
;
$summary
=
'summary="'
.
$t
->
t
(
'{consent:consent:table_summary}'
)
.
'"'
;
if
(
strlen
(
$nameParent
)
>
0
)
{
$parentStr
=
strtolower
(
$nameParent
)
.
'_'
;
...
...
@@ -224,7 +224,7 @@ function present_attributes($t, $attributes, $nameParent)
}
else
{
$parentStr
=
''
;
$str
=
'<table id="table_with_attributes" class="attributes" '
.
$summary
.
'>'
;
$str
.
=
"
\n
"
.
'<caption>'
.
$t
ranslator
->
t
(
'{consent:consent:table_caption}'
)
.
'</caption>'
;
$str
.
=
"
\n
"
.
'<caption>'
.
$t
->
t
(
'{consent:consent:table_caption}'
)
.
'</caption>'
;
}
foreach
(
$attributes
as
$name
=>
$value
)
{
...
...
@@ -281,7 +281,7 @@ function present_attributes($t, $attributes, $nameParent)
$str
.
=
'... '
;
$str
.
=
'<a class="consent_showattributelink" href="javascript:SimpleSAML_show(\'hidden_'
.
$hiddenId
;
$str
.
=
'\'); SimpleSAML_hide(\'visible_'
.
$hiddenId
.
'\');">'
;
$str
.
=
$t
ranslator
->
t
(
'{consent:consent:show_attribute}'
);
$str
.
=
$t
->
t
(
'{consent:consent:show_attribute}'
);
$str
.
=
'</a>'
;
$str
.
=
'</div>'
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment