server/lib/search/provider/file.php

17 lines
499 B
PHP
Raw Normal View History

2011-07-29 19:03:53 +00:00
<?php
class OC_Search_Provider_File extends OC_Search_Provider{
function search($query){
2011-07-29 19:36:03 +00:00
$files=OC_Filesystem::search($query);
2011-07-29 19:03:53 +00:00
$results=array();
foreach($files as $file){
2011-07-29 19:36:03 +00:00
if(OC_Filesystem::is_dir($file)){
$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'index.php?dir='.$file ),'Files');
2011-07-29 19:03:53 +00:00
}else{
$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Files');
2011-07-29 19:03:53 +00:00
}
}
return $results;
}
}