aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2011-07-31 12:53:34 -0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2011-07-31 12:53:34 -0400
commit17058c946717e7487302e87c118223227ddb9987 (patch)
tree0503c8f0d8b1f15f789216d6da4510ebeba3e81f /lib
parent0d3ebbfefdc65a90c78fa49c28eccbd1e0dfb563 (diff)
parentb93b066a425fae11d304ee59f8d745e1251005a9 (diff)
downloadnextcloud-server-17058c946717e7487302e87c118223227ddb9987.tar.gz
nextcloud-server-17058c946717e7487302e87c118223227ddb9987.zip
Merge branch 'master' into sharing
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php15
-rw-r--r--lib/filesystem.php9
-rw-r--r--lib/search/provider/file.php12
3 files changed, 25 insertions, 11 deletions
diff --git a/lib/base.php b/lib/base.php
index bbd89e4fdb3..5a5381a890e 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -91,6 +91,14 @@ if( !OC_Config::getValue( "installed", false )){
OC_User::useBackend( OC_Config::getValue( "userbackend", "database" ));
OC_Group::setBackend( OC_Config::getValue( "groupbackend", "database" ));
+// Add the stuff we need always
+OC_Util::addScript( "jquery-1.6.2.min" );
+OC_Util::addScript( "jquery-ui-1.8.14.custom.min" );
+OC_Util::addScript( "js" );
+OC_Util::addScript('search','result');
+OC_Util::addStyle( "jquery-ui-1.8.14.custom" );
+OC_Util::addStyle( "styles" );
+
// Load Apps
// This includes plugins for users and filesystems as well
if(!$error and !$RUNTIME_NOAPPS ){
@@ -107,13 +115,6 @@ if(!$error and !$RUNTIME_NOSETUPFS ){
OC_Util::setupFS();
}
-// Add the stuff we need always
-OC_Util::addScript( "jquery-1.6.2.min" );
-OC_Util::addScript( "jquery-ui-1.8.14.custom.min" );
-OC_Util::addScript( "js" );
-OC_Util::addStyle( "jquery-ui-1.8.14.custom" );
-OC_Util::addStyle( "styles" );
-
// FROM Connect.php
function OC_CONNECT_TEST($path,$user,$password){
diff --git a/lib/filesystem.php b/lib/filesystem.php
index c2153520650..829482c7fa5 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -574,14 +574,17 @@ class OC_Filesystem{
static public function search($query){
$files=array();
- $fakeRootLength=strlen(self::$fakeRoot);
+ $fakeRoot=self::$fakeRoot;
+ $fakeRootLength=strlen($fakeRoot);
foreach(self::$storages as $mountpoint=>$storage){
$results=$storage->search($query);
if(is_array($results)){
foreach($results as $result){
$file=str_replace('//','/',$mountpoint.$result);
- $file=substr($file,$fakeRootLength);
- $files[]=$file;
+ if(substr($file,0,$fakeRootLength)==$fakeRoot){
+ $file=substr($file,$fakeRootLength);
+ $files[]=$file;
+ }
}
}
}
diff --git a/lib/search/provider/file.php b/lib/search/provider/file.php
index f84d098dd69..f3d235abdce 100644
--- a/lib/search/provider/file.php
+++ b/lib/search/provider/file.php
@@ -8,7 +8,17 @@ class OC_Search_Provider_File extends OC_Search_Provider{
if(OC_Filesystem::is_dir($file)){
$results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'index.php?dir='.$file ),'Files');
}else{
- $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Files');
+ $mime=OC_Filesystem::getMimeType($file);
+ $mimeBase=substr($mime,0,strpos($mime,'/'));
+ switch($mimeBase){
+ case 'audio':
+ break;
+ case 'image':
+ $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Images');
+ break;
+ default:
+ $results[]=new OC_Search_Result(basename($file),'',OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Files');
+ }
}
}
return $results;