From: Bart Visscher Date: Fri, 28 Sep 2012 20:27:52 +0000 (+0200) Subject: Do urlencoding in linkTo functions X-Git-Tag: v4.5.0RC2~42 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=22d22d19c079f54cf12a6b47981c22aa1432346d;p=nextcloud-server.git Do urlencoding in linkTo functions --- diff --git a/apps/files_versions/templates/history.php b/apps/files_versions/templates/history.php index 99bc153a816..854d032da62 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 ' Revert

'; + echo ' Revert

'; if ( $v['cur'] ) { echo ' (Current)'; } echo '

'; } diff --git a/core/lostpassword/index.php b/core/lostpassword/index.php index 3f58b03c982..8da86d5a360 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', array('user' => urlencode($_POST['user']), 'token' => $token)); + $link = OC_Helper::linkToAbsolute('core/lostpassword', 'resetpassword.php', array('user' => $_POST['user'], 'token' => $token)); $tmpl = new OC_Template('core/lostpassword', 'email'); $tmpl->assign('link', $link, false); $msg = $tmpl->fetchPage(); diff --git a/lib/helper.php b/lib/helper.php index 3bb30620175..8e578735f4c 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -33,6 +33,7 @@ class OC_Helper { * @param string $app app * @param string $file file * @param array $args array with param=>value, will be appended to the returned url + * The value of $args will be urlencoded * @return string the url * * Returns a url to the given app and file. @@ -65,7 +66,7 @@ class OC_Helper { if (!empty($args)) { $urlLinkTo .= '?'; foreach($args as $k => $v) { - $urlLinkTo .= '&'.$k.'='.$v; + $urlLinkTo .= '&'.$k.'='.urlencode($v); } } @@ -77,6 +78,7 @@ class OC_Helper { * @param string $app app * @param string $file file * @param array $args array with param=>value, will be appended to the returned url + * The value of $args will be urlencoded * @return string the url * * Returns a absolute url to the given app and file. diff --git a/lib/public/util.php b/lib/public/util.php index 747448e62eb..38da7e82171 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -116,6 +116,7 @@ class Util { * @param $app app * @param $file file * @param $args array with param=>value, will be appended to the returned url + * The value of $args will be urlencoded * @returns the url * * Returns a absolute url to the given app and file. @@ -151,6 +152,7 @@ class Util { * @param $app app * @param $file file * @param $args array with param=>value, will be appended to the returned url + * The value of $args will be urlencoded * @returns the url * * Returns a url to the given app and file. diff --git a/lib/search/provider/file.php b/lib/search/provider/file.php index 21fae0c1ce5..e21278f3918 100644 --- a/lib/search/provider/file.php +++ b/lib/search/provider/file.php @@ -10,7 +10,6 @@ class OC_Search_Provider_File extends OC_Search_Provider{ $name = basename($path); $text = ''; - $path = urlencode($path); if($mime=='httpd/unix-directory') { $link = OC_Helper::linkTo( 'files', 'index.php', array('dir' => $path)); $type = 'Files'; diff --git a/lib/util.php b/lib/util.php index 777cb7a28fc..d1227f8379c 100755 --- a/lib/util.php +++ b/lib/util.php @@ -344,7 +344,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', array('redirect_url' => urlencode($_SERVER["REQUEST_URI"])))); + header( 'Location: '.OC_Helper::linkToAbsolute( '', 'index.php', array('redirect_url' => $_SERVER["REQUEST_URI"]))); exit(); } }