. * */ // Init owncloud require_once('../lib/base.php'); // Check if we are a user if( !OC_User::isLoggedIn()){ header( "Location: ".OC_Helper::linkTo( '', 'index.php' )); exit(); } // Load the files we need OC_Util::addStyle( 'search', 'search' ); $query=(isset($_POST['query']))?$_POST['query']:''; if($query){ $results=OC_Search::search($query); }else{ header("Location: ".$WEBROOT.'/'.OC_Appconfig::getValue("core", "defaultpage", "files/index.php")); exit(); } $resultTypes=array(); foreach($results as $result){ if(!isset($resultTypes[$result->type])){ $resultTypes[$result->type]=array(); } $resultTypes[$result->type][]=$result; } $tmpl = new OC_Template( 'search', 'index', 'user' ); $tmpl->assign('resultTypes',$resultTypes); $tmpl->printPage(); ?>