Do the url encoding once, only in breadcrumbs template

fixes issue #438
This commit is contained in:
Bart Visscher 2012-11-16 12:58:24 +01:00
parent d1c0f2a739
commit 20c24f234f
3 changed files with 7 additions and 6 deletions

View File

@ -25,7 +25,7 @@ if($doBreadcrumb) {
}
$breadcrumbNav = new OCP\Template( "files", "part.breadcrumb", "" );
$breadcrumbNav->assign( "breadcrumb", $breadcrumb );
$breadcrumbNav->assign( "breadcrumb", $breadcrumb, false );
$data['breadcrumb'] = $breadcrumbNav->fetchPage();
}

View File

@ -36,7 +36,7 @@ if(!isset($_SESSION['timezone'])) {
}
OCP\App::setActiveNavigationEntry( 'files_index' );
// Load the files
$dir = isset( $_GET['dir'] ) ? rawurldecode(stripslashes($_GET['dir'])) : '';
$dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : '';
// Redirect if directory does not exist
if(!OC_Filesystem::is_dir($dir.'/')) {
header('Location: '.$_SERVER['SCRIPT_NAME'].'');
@ -67,7 +67,7 @@ $breadcrumb = array();
$pathtohere = '';
foreach( explode( '/', $dir ) as $i ) {
if( $i != '' ) {
$pathtohere .= '/'.str_replace('+', '%20', urlencode($i));
$pathtohere .= '/'.$i;
$breadcrumb[] = array( 'dir' => $pathtohere, 'name' => $i );
}
}

View File

@ -1,6 +1,7 @@
<?php for($i=0; $i<count($_["breadcrumb"]); $i++):
$crumb = $_["breadcrumb"][$i]; ?>
<div class="crumb <?php if($i == count($_["breadcrumb"])-1) echo 'last';?> svg" data-dir='<?php echo urlencode($crumb["dir"]);?>' style='background-image:url("<?php echo OCP\image_path('core', 'breadcrumb.png');?>")'>
<a href="<?php echo $_['baseURL'].urlencode($crumb["dir"]); ?>"><?php echo OCP\Util::sanitizeHTML($crumb["name"]); ?></a>
$crumb = $_["breadcrumb"][$i];
$dir = str_replace('+','%20', urlencode($crumb["dir"])); ?>
<div class="crumb <?php if($i == count($_["breadcrumb"])-1) echo 'last';?> svg" data-dir='<?php echo $dir;?>' style='background-image:url("<?php echo OCP\image_path('core', 'breadcrumb.png');?>")'>
<a href="<?php echo $_['baseURL'].$dir; ?>"><?php echo OCP\Util::sanitizeHTML($crumb["name"]); ?></a>
</div>
<?php endfor;?>