Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mahara
mahara
Commits
5f2dc258
Commit
5f2dc258
authored
Oct 31, 2019
by
Cecilia Vela Gurovic
Committed by
Gerrit Code Review
Oct 31, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Bug 1843513: Allow for 'normal' a href links not to change to https"
parents
117de2fd
c3677ec5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
htdocs/lib/htmlpurifiercustom/MixedContent.php
htdocs/lib/htmlpurifiercustom/MixedContent.php
+20
-6
No files found.
htdocs/lib/htmlpurifiercustom/MixedContent.php
View file @
5f2dc258
...
...
@@ -4,11 +4,25 @@ class HTMLPurifier_URIFilter_MixedContent extends HTMLPurifier_URIFilter {
public
$name
=
'MixedContent'
;
public
function
filter
(
&
$uri
,
$config
,
$context
)
{
// Make sure that if we're an HTTPS site, the iframe is also HTTPS
if
(
is_https
()
&&
$uri
->
scheme
==
'http'
)
{
// Convert it to a protocol-relative URL
$uri
->
scheme
=
null
;
}
return
$uri
;
$currenttoken
=
$context
->
get
(
'CurrentToken'
);
// Make sure that if we're an HTTPS site, then the URI link is also HTTPS
// Unless the link is a static <A HREF> link
$fixscheme
=
true
;
if
(
$currenttoken
->
name
==
'a'
)
{
if
(
isset
(
$currenttoken
->
attr
)
&&
isset
(
$currenttoken
->
attr
[
'class'
])
&&
preg_match
(
'/embedly-card/'
,
$currenttoken
->
attr
[
'class'
]))
{
$fixscheme
=
true
;
}
else
{
$fixscheme
=
false
;
}
}
if
(
is_https
()
&&
$uri
->
scheme
==
'http'
&&
$fixscheme
)
{
// Convert it to a protocol-relative URL
$uri
->
scheme
=
null
;
}
return
$uri
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment