Do urlencoding in linkTo functions

This commit is contained in:
Bart Visscher 2012-09-28 22:27:52 +02:00
parent fed34aecfa
commit 22d22d19c0
6 changed files with 8 additions and 5 deletions

View File

@ -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', array('path' => urlencode( $_['path'] ), 'revert' => $v['version'])) .'" class="button">Revert</a><br /><br />';
echo ' <a href="'.OCP\Util::linkTo('files_versions', 'history.php', array('path' => $_['path'], 'revert' => $v['version'])) .'" class="button">Revert</a><br /><br />';
if ( $v['cur'] ) { echo ' (<b>Current</b>)'; }
echo '<br /><br />';
}

View File

@ -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();

View File

@ -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.

View File

@ -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.

View File

@ -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';

View File

@ -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();
}
}