From f8cacdb0a7a79aab925be28f835fbd967f000275 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Mon, 12 Oct 2009 09:25:11 +0000
Subject: [PATCH] Fix for portal module in template header and footer. Footer
 content is not set properly. Resolve problem with missing end divs reported
 by WAYF...

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1842 44740490-163a-0410-bde0-09ae8108e29a
---
 templates/includes/footer.php |  8 +++++---
 templates/includes/header.php | 28 +++++++++++++++++++++++-----
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/templates/includes/footer.php b/templates/includes/footer.php
index 7f6fe648c..42c8394d9 100644
--- a/templates/includes/footer.php
+++ b/templates/includes/footer.php
@@ -1,12 +1,14 @@
+<?php
 
 
-<?php
 
-if(isset($htmlContentPost)) {
-	foreach($htmlContentPost AS $c) {
+if(!empty($this->data['htmlinject']['htmlContentPost'])) {
+	foreach($this->data['htmlinject']['htmlContentPost'] AS $c) {
 		echo $c;
 	}
 }
+
+
 ?>
 
 
diff --git a/templates/includes/header.php b/templates/includes/header.php
index c537af760..c8ac0edc3 100644
--- a/templates/includes/header.php
+++ b/templates/includes/header.php
@@ -6,14 +6,25 @@
 /**
  * Support the htmlinject hook, which allows modules to change header, pre and post body on all pages.
  */
-$htmlContentPre = array(); $htmlContentPost = array(); $htmlContentHead = array(); 
+$this->data['htmlinject'] = array(
+	'htmlContentPre' => array(),
+	'htmlContentPost' => array(),
+	'htmlContentHead' => array(),
+);
+
 
 $jquery = array();
 if (array_key_exists('jquery', $this->data)) $jquery = $this->data['jquery'];
 
-
 if (array_key_exists('pageid', $this->data)) {
-	$hookinfo = array('pre' => &$htmlContentPre, 'post' => &$htmlContentPost, 'head' => &$htmlContentHead, 'jquery' => &$jquery, 'page' => $this->data['pageid']);
+	$hookinfo = array(
+		'pre' => &$this->data['htmlinject']['htmlContentPre'], 
+		'post' => &$this->data['htmlinject']['htmlContentPost'], 
+		'head' => &$this->data['htmlinject']['htmlContentHead'], 
+		'jquery' => &$jquery, 
+		'page' => $this->data['pageid']
+	);
+		
 	SimpleSAML_Module::callHooks('htmlinject', $hookinfo);	
 }
 // - o - o - o - o - o - o - o - o - o - o - o - o -
@@ -68,6 +79,13 @@ if(!empty($jquery)) {
 	}
 }
 
+if(!empty($this->data['htmlinject']['htmlContentHead'])) {
+	foreach($this->data['htmlinject']['htmlContentHead'] AS $c) {
+		echo $c;
+	}
+}
+
+
 
 
 ?>
@@ -166,8 +184,8 @@ if($onLoad !== '') {
 
 <?php
 
-if(isset($htmlContentPre)) {
-	foreach($htmlContentPre AS $c) {
+if(!empty($this->data['htmlinject']['htmlContentPre'])) {
+	foreach($this->data['htmlinject']['htmlContentPre'] AS $c) {
 		echo $c;
 	}
 }
-- 
GitLab