From 73d6b3456df9b424e5f2ba80e61ad04ad1343958 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Tue, 27 Jan 2009 08:33:14 +0000
Subject: [PATCH] fix bug where consent tried to use undefined variable

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1194 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/consent/templates/consentform.php | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/modules/consent/templates/consentform.php b/modules/consent/templates/consentform.php
index 12eaeb004..c92c64807 100644
--- a/modules/consent/templates/consentform.php
+++ b/modules/consent/templates/consentform.php
@@ -46,14 +46,6 @@ if (array_key_exists('name', $this->data['dstMetadata'])) {
 	$dstName = $this->data['dstMetadata']['entityid'];
 }
 
-if (array_key_exists('descr_purpose', $this->data['dstMetadata'])) {
-	$spPurpose = $this->data['dstMetadata']['descr_purpose'];
-	if (is_array($spPurpose)) {
-		$spPurpose = $this->t($spPurpose);
-	}
-}
-
-
 
 $attributes = $this->data['attributes'];
 
@@ -89,18 +81,19 @@ $(document).ready(function() {
 ';
 
 
-
-
-
-
 $this->includeAtTemplateBase('includes/header.php');
 
 ?>
 
 <p>
 <?php
-  echo $this->t('{consent:consent_notice}', array( 'SPNAME' => $dstName ));
-  if ($spPurpose) echo '</p><p>' . $this->t('{consent:consent_purpose}', array( 'SPNAME' => $dstName, 'SPDESC' => $spPurpose ));
+	echo $this->t('{consent:consent_notice}', array( 'SPNAME' => $dstName ));
+	if (array_key_exists('descr_purpose', $this->data['dstMetadata'])) {
+		echo '</p><p>' . $this->t('{consent:consent_purpose}', array(
+			'SPNAME' => $dstName,
+			'SPDESC' => $this->getTranslation(SimpleSAML_Utilities::arrayize($this->data['dstMetadata']['descr_purpose'], 'en')),
+		));
+	}
 ?>
 </p>
 
-- 
GitLab