Navigation Menu

Skip to content

Commit

Permalink
T3: Fix injection after body when body tag has attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
joomlart committed Nov 15, 2013
1 parent 559c559 commit 515d9be
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/plg_system_t3/includes/core/template.php
Expand Up @@ -490,7 +490,7 @@ function snippet()

$places = array();
$contents = array();

if (($openhead = $this->getParam('snippet_open_head', ''))) {
$places[] = '<head>'; //not sure that any attritube can be place in head open tag, profile is not support in html5
$contents[] = "<head>\n" . $openhead;
Expand All @@ -500,11 +500,12 @@ function snippet()
$contents[] = $closehead . "\n</head>";
}
if (($openbody = $this->getParam('snippet_open_body', ''))) {
$body = JResponse::getBody();

if(strpos($body, '<body>') !== false){
$places[] = '<body>';
$contents[] = "<body>\n" . $openbody;
} else { //in case the body has other attribute
$body = JResponse::getBody();
} else { //in case the body has other attribute
$body = preg_replace('@<body[^>]*?>@msU', "$0\n" . $openbody, $body);
JResponse::setBody($body);
}
Expand Down

0 comments on commit 515d9be

Please sign in to comment.