From 39ee636c3cc608ed3fe7e1431802ce6a1dcb2322 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Tue, 14 Oct 2008 11:59:57 +0000
Subject: [PATCH] Notification when metadata is sent. Fix error in metadata
 template

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@918 44740490-163a-0410-bde0-09ae8108e29a
---
 metadata-templates/saml20-idp-remote.php |  4 ++--
 templates/default/metadata.php           | 16 +++++++++++++++-
 www/saml2/sp/metadata.php                |  6 ++++--
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/metadata-templates/saml20-idp-remote.php b/metadata-templates/saml20-idp-remote.php
index 58f81c789..fc05ee184 100644
--- a/metadata-templates/saml20-idp-remote.php
+++ b/metadata-templates/saml20-idp-remote.php
@@ -81,8 +81,8 @@ $metadata = array(
 	'max.feide.no' =>  array(
 		'name'					=>	array(
 			'en' => 'Feide Test environment',
-			'en' => 'Feide testmiljż',
-		)
+			'no' => 'Feide testmiljø',
+		),
 		'description'			=> 'Feide test environment (max.feide.no). Authenticate with your identity from a school or university in Norway.',
 		'send_metadata_email' 	=> 'moria-support@uninett.no',
 		'SingleSignOnService'	=>	'https://max.feide.no/amserver/SSORedirect/metaAlias/idp',
diff --git a/templates/default/metadata.php b/templates/default/metadata.php
index a76bc3d72..07a49d02b 100644
--- a/templates/default/metadata.php
+++ b/templates/default/metadata.php
@@ -20,7 +20,21 @@ $this->includeAtTemplateBase('includes/header.php');
 		?>
 			<div style="border: 1px solid #444; margin: .5em 2em .5em 2em; padding: .5em 1em 1em 1em; background: #FFFFCC">
 
-				<h2 style="margin-top: 0px" ></h2>
+				
+
+
+				<h2 style="margin-top: 0px" ><?php echo $this->t('metadata_send_title2'); ?></h2>
+				
+				<?php
+
+				if ($this->data['sentok'] === TRUE) {
+				
+					echo '<p><strong>' . $this->t('metadata_send_success') . '</strong></p>';
+				
+				}
+				
+				?>
+				
 
 				<form action="metadata.php" method="post">
 
diff --git a/www/saml2/sp/metadata.php b/www/saml2/sp/metadata.php
index 8e7a4732e..f32d097e6 100644
--- a/www/saml2/sp/metadata.php
+++ b/www/saml2/sp/metadata.php
@@ -74,12 +74,13 @@ try {
 	);
 	
 
-	
+	$sentok = FALSE;
 	/*
 	 * Send metadata to Identity Provider, if the user filled submitted the form
 	 */
 	if (array_key_exists('sendtoidp', $_POST)) {
 		
+		
 		if (!array_key_exists($_POST['sendtoidp'], $idpsend))
 			throw new Exception('Entity ID ' . $_POST['sendtoidp'] . ' not found in metadata. Cannot send metadata to this IdP.');
 		
@@ -117,7 +118,7 @@ try {
 		$email = new SimpleSAML_XHTML_EMail($emailadr, 'simpleSAMLphp SAML 2.0 Service Provider Metadata', $from);
 		$email->setBody($message);
 		$email->send();
-		
+		$sentok = TRUE;
 	}
 	
 	
@@ -140,6 +141,7 @@ try {
 		$t->data['metaurl'] = SimpleSAML_Utilities::selfURLNoQuery();
 		
 		$t->data['idpsend'] = $idpsend;
+		$t->data['sentok'] = $sentok;
 		$t->data['adminok'] = $adminok;
 		$t->data['adminlogin'] = $adminlogin;
 		
-- 
GitLab