Skip to content
Snippets Groups Projects
Commit cbe92756 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Kleinere Bugfixes

parent ac88c373
No related branches found
No related tags found
No related merge requests found
......@@ -106,6 +106,10 @@ abstract class Document
$abs .= '@';
}
if (!isset($host)) {
#die(var_dump($this->baseUrl));
}
$abs .= $host;
/* did somebody sneak in a port? */
if (isset($port)) {
......
......@@ -36,11 +36,13 @@ class HtmlDocument extends Document
$dom->loadHtml($this->htmlString);
foreach ($dom->getElementsByTagName('base') as $base) {
$href = $base->getAttribute('href');
# Convert all relative Links to absolute Ones
$href = $this->convertRelativeToAbsoluteLink($href);
$this->baseUrl = $href;
# Delete Base Tag
if ($base->hasAttribute("href")) {
$href = $base->getAttribute('href');
# Convert all relative Links to absolute Ones
$href = $this->convertRelativeToAbsoluteLink($href);
$this->baseUrl = $href;
# Delete Base Tag
}
$base->parentNode->removeChild($base);
}
......@@ -290,6 +292,16 @@ class HtmlDocument extends Document
$cssElement->proxifyContent();
$el->setAttribute("style", $cssElement->getResult());
}
# Some old sites might use the background attribute Let's parse them, too
if ($el->hasAttribute("background")) {
# Convert all relative Links to absolute Ones
$el->setAttribute("background", $this->convertRelativeToAbsoluteLink($el->getAttribute("background")));
# Convert all Links to the proxified Version
# All of this Links should NOT target to the top Level
$el->setAttribute("background", $this->proxifyUrl($el->getAttribute("background"), false));
}
# We Will Remove all Javascript Event attributes
# To keep things simple we're gonna remove all Attributes which names start with "on"
foreach ($el->attributes as $attr) {
......
......@@ -153,6 +153,7 @@ class ProxyController extends Controller
$httpcode = $result["http_code"];
extract(parse_url($targetUrl));
$base = $scheme . "://" . $host;
# We will parse whether we have a parser for this document type.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment