From 2d2feaa3410421d81f5074431393ac4d191d79d0 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 16 Dec 2009 14:09:00 +0000
Subject: [PATCH] Use the new argument to getModuleURL.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2055 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Auth/Simple.php                      | 6 ++----
 lib/SimpleSAML/Utilities.php                        | 7 ++-----
 modules/consent/www/noconsent.php                   | 3 +--
 modules/core/templates/frontpage_federation.tpl.php | 2 +-
 modules/cron/www/croninfo.php                       | 2 +-
 modules/saml/lib/Auth/Source/SP.php                 | 3 +--
 modules/saml2/lib/Auth/Source/SP.php                | 3 +--
 7 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/lib/SimpleSAML/Auth/Simple.php b/lib/SimpleSAML/Auth/Simple.php
index fb36bf83d..e6b2f13f7 100644
--- a/lib/SimpleSAML/Auth/Simple.php
+++ b/lib/SimpleSAML/Auth/Simple.php
@@ -190,8 +190,7 @@ class SimpleSAML_Auth_Simple {
 			$returnTo = SimpleSAML_Utilities::selfURL();
 		}
 
-		$login = SimpleSAML_Module::getModuleURL('core/as_login.php');
-		$login = SimpleSAML_Utilities::addURLparameter($login, array(
+		$login = SimpleSAML_Module::getModuleURL('core/as_login.php', array(
 			'AuthId' => $this->authSource,
 			'ReturnTo' => $returnTo,
 		));
@@ -216,8 +215,7 @@ class SimpleSAML_Auth_Simple {
 			$returnTo = SimpleSAML_Utilities::selfURL();
 		}
 
-		$logout = SimpleSAML_Module::getModuleURL('core/as_logout.php');
-		$logout = SimpleSAML_Utilities::addURLparameter($logout, array(
+		$logout = SimpleSAML_Module::getModuleURL('core/as_logout.php', array(
 			'AuthId' => $this->authSource,
 			'ReturnTo' => $returnTo,
 		));
diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index cf7d9921c..deaac7014 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -1771,7 +1771,7 @@ class SimpleSAML_Utilities {
 			$returnTo = SimpleSAML_Utilities::selfURL();
 		}
 
-		return SimpleSAML_Module::getModuleURL('core/login-admin.php?ReturnTo=' . urlencode($returnTo));
+		return SimpleSAML_Module::getModuleURL('core/login-admin.php', array('ReturnTo' => $returnTo));
 	}
 
 
@@ -1845,10 +1845,7 @@ class SimpleSAML_Utilities {
 		$session = SimpleSAML_Session::getInstance();
 		$session->setData('core_postdatalink', $id, $postData);
 
-		return SimpleSAML_Utilities::addURLParameter(
-			SimpleSAML_Module::getModuleURL('core/postredirect.php'),
-			array('RedirId' => $id)
-			);
+		return SimpleSAML_Module::getModuleURL('core/postredirect.php', array('RedirId' => $id));
 	}
 
 
diff --git a/modules/consent/www/noconsent.php b/modules/consent/www/noconsent.php
index 60678d3fe..de677f806 100644
--- a/modules/consent/www/noconsent.php
+++ b/modules/consent/www/noconsent.php
@@ -14,8 +14,7 @@ if (!array_key_exists('StateId', $_REQUEST)) {
 $id = $_REQUEST['StateId'];
 $state = SimpleSAML_Auth_State::loadState($id, 'consent:request');
 
-$resumeFrom = SimpleSAML_Module::getModuleURL('consent/getconsent.php');
-$resumeFrom = SimpleSAML_Utilities::addURLParameter($resumeFrom, array('StateId' => $id));
+$resumeFrom = SimpleSAML_Module::getModuleURL('consent/getconsent.php', array('StateId' => $id));
 
 $aboutService = NULL;
 if(isset($state['Destination']['url.about']) ){
diff --git a/modules/core/templates/frontpage_federation.tpl.php b/modules/core/templates/frontpage_federation.tpl.php
index 6bc4039ee..2d5d134bf 100644
--- a/modules/core/templates/frontpage_federation.tpl.php
+++ b/modules/core/templates/frontpage_federation.tpl.php
@@ -78,7 +78,7 @@ foreach($this->data['metaentries']['remote'] AS $setkey => $set) {
 	foreach($set AS $entry) {
 		echo '<li>';
 		echo ('<a href="' . 
-			SimpleSAML_Module::getModuleURL('core/show_metadata.php?entityid=' . urlencode($entry['entityid']) . '&amp;set=' . urlencode($setkey) ) . 
+			htmlspecialchars(SimpleSAML_Module::getModuleURL('core/show_metadata.php', array('entityid' => $entry['entityid'], 'set' => $setkey ))) .
 			'">');
 		if (array_key_exists('name', $entry)) {
 			echo $this->getTranslation(SimpleSAML_Utilities::arrayize($entry['name'], 'en'));
diff --git a/modules/cron/www/croninfo.php b/modules/cron/www/croninfo.php
index 1c1458eb1..0e5571563 100644
--- a/modules/cron/www/croninfo.php
+++ b/modules/cron/www/croninfo.php
@@ -28,7 +28,7 @@ $def = array(
 $urls = array();
 foreach ($tags AS $tag) {
 	$urls[] = array(
-		'href' => SimpleSAML_Module::getModuleURL('cron/cron.php?key=' . $key . '&amp;tag=' . $tag),
+		'href' => SimpleSAML_Module::getModuleURL('cron/cron.php', array('key' => $key, 'tag' => $tag)),
 		'tag' => $tag,
 		'int' => (array_key_exists($tag, $def) ? $def[$tag] : $def['default']),
 	);
diff --git a/modules/saml/lib/Auth/Source/SP.php b/modules/saml/lib/Auth/Source/SP.php
index ab3c73b5c..5aa750569 100644
--- a/modules/saml/lib/Auth/Source/SP.php
+++ b/modules/saml/lib/Auth/Source/SP.php
@@ -260,8 +260,7 @@ class sspmod_saml_Auth_Source_SP extends SimpleSAML_Auth_Source {
 			$discoURL = SimpleSAML_Module::getModuleURL('saml/disco.php');
 		}
 
-		$returnTo = SimpleSAML_Module::getModuleURL('saml/sp/discoresp.php');
-		$returnTo = SimpleSAML_Utilities::addURLparameter($returnTo, array('AuthID' => $id));
+		$returnTo = SimpleSAML_Module::getModuleURL('saml/sp/discoresp.php', array('AuthID' => $id));
 
 		SimpleSAML_Utilities::redirect($discoURL, array(
 			'entityID' => $this->entityId,
diff --git a/modules/saml2/lib/Auth/Source/SP.php b/modules/saml2/lib/Auth/Source/SP.php
index c5320df1d..503f8183b 100644
--- a/modules/saml2/lib/Auth/Source/SP.php
+++ b/modules/saml2/lib/Auth/Source/SP.php
@@ -156,8 +156,7 @@ class sspmod_saml2_Auth_Source_SP extends SimpleSAML_Auth_Source {
 			$discoURL = SimpleSAML_Module::getModuleURL('saml2/disco.php');
 		}
 
-		$returnTo = SimpleSAML_Module::getModuleURL('saml2/sp/discoresp.php');
-		$returnTo = SimpleSAML_Utilities::addURLparameter($returnTo, array('AuthID' => $id));
+		$returnTo = SimpleSAML_Module::getModuleURL('saml2/sp/discoresp.php', array('AuthID' => $id));
 
 		SimpleSAML_Utilities::redirect($discoURL, array(
 			'entityID' => $this->entityId,
-- 
GitLab