From 5153b8b293b5485b9aa3d321f6a93979ec302068 Mon Sep 17 00:00:00 2001
From: Bart Visscher <bartv@thisnet.nl>
Date: Mon, 3 Sep 2012 19:12:52 +0200
Subject: [PATCH] Add url-params to url with new parameter in linkTo function

---
 apps/files_versions/templates/history.php |  2 +-
 core/lostpassword/index.php               |  2 +-
 lib/search/provider/file.php              | 10 +++++-----
 lib/util.php                              |  2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/apps/files_versions/templates/history.php b/apps/files_versions/templates/history.php
index d4f875a36e..99bc153a81 100644
--- a/apps/files_versions/templates/history.php
+++ b/apps/files_versions/templates/history.php
@@ -22,7 +22,7 @@ if( isset( $_['message'] ) ) {
 	foreach ( $_['versions'] as $v ) {
 		echo ' ';
 		echo OCP\Util::formatDate( doubleval($v['version']) );
-		echo ' <a href="'.OCP\Util::linkTo('files_versions', 'history.php').'?path='.urlencode( $_['path'] ).'&revert='. $v['version'] .'" class="button">Revert</a><br /><br />';
+		echo ' <a href="'.OCP\Util::linkTo('files_versions', 'history.php', array('path' => urlencode( $_['path'] ), 'revert' => $v['version'])) .'" class="button">Revert</a><br /><br />';
 		if ( $v['cur'] ) { echo '  (<b>Current</b>)'; }
 		echo '<br /><br />';
 	}
diff --git a/core/lostpassword/index.php b/core/lostpassword/index.php
index 8f86fe23aa..58dab59732 100644
--- a/core/lostpassword/index.php
+++ b/core/lostpassword/index.php
@@ -17,7 +17,7 @@ if (isset($_POST['user'])) {
 		OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token);
 		$email = OC_Preferences::getValue($_POST['user'], 'settings', 'email', '');
 		if (!empty($email) and isset($_POST['sectoken']) and isset($_SESSION['sectoken']) and ($_POST['sectoken']==$_SESSION['sectoken']) ) {
-			$link = OC_Helper::linkToAbsolute('core/lostpassword', 'resetpassword.php').'?user='.urlencode($_POST['user']).'&token='.$token;
+			$link = OC_Helper::linkToAbsolute('core/lostpassword', 'resetpassword.php', array('user' => urlencode($_POST['user']), 'token' => $token));
 			$tmpl = new OC_Template('core/lostpassword', 'email');
 			$tmpl->assign('link', $link, false);
 			$msg = $tmpl->fetchPage();
diff --git a/lib/search/provider/file.php b/lib/search/provider/file.php
index a37af49559..12a535876f 100644
--- a/lib/search/provider/file.php
+++ b/lib/search/provider/file.php
@@ -8,23 +8,23 @@ class OC_Search_Provider_File extends OC_Search_Provider{
 			$file=$fileData['path'];
 			$mime=$fileData['mimetype'];
 			if($mime=='httpd/unix-directory'){
-				$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'index.php' ).'?dir='.$file,'Files');
+				$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'index.php', array('dir' => $file)),'Files');
 			}else{
 				$mimeBase=$fileData['mimepart'];
 				switch($mimeBase){
 					case 'audio':
 						break;
 					case 'text':
-						$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Text');
+						$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('dir' => $file) ),'Text');
 						break;
 					case 'image':
-						$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Images');
+						$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('dir' => $file) ),'Images');
 						break;
 					default:
 						if($mime=='application/xml'){
-							$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Text');
+							$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('dir' => $file) ),'Text');
 						}else{
-							$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php' ).'?file='.$file,'Files');
+							$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php', array('dir' => $file) ),'Files');
 						}
 				}
 			}
diff --git a/lib/util.php b/lib/util.php
index 581b6bdb31..42a0f5c7df 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -320,7 +320,7 @@ class OC_Util {
 	public static function checkLoggedIn(){
 		// Check if we are a user
 		if( !OC_User::isLoggedIn()){
-			header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php' ).'?redirect_url='.urlencode($_SERVER["REQUEST_URI"]));
+			header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php', array('redirect_url' => urlencode($_SERVER["REQUEST_URI"]))));
 			exit();
 		}
 	}
-- 
GitLab