remotes/origin/stable4
parent
d2bd78c41a
commit
736739bbbd
@ -1 +1 @@ |
||||
0.3 |
||||
0.4 |
||||
@ -1 +1 @@ |
||||
0.1 |
||||
0.2 |
||||
@ -1 +1 @@ |
||||
1.0 |
||||
1.1 |
||||
@ -0,0 +1,46 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2012 Robin Appelman <icewind@owncloud.com> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
class Test_CryptProxy extends UnitTestCase { |
||||
|
||||
public function setUp(){ |
||||
//set testing key |
||||
$_SESSION['enckey']=md5(time()); |
||||
|
||||
//clear all proxies and hooks so we can do clean testing |
||||
OC_FileProxy::clearProxies(); |
||||
OC_Hook::clear('OC_Filesystem'); |
||||
|
||||
//enable only the encryption hook |
||||
OC_FileProxy::register(new OC_FileProxy_Encryption()); |
||||
|
||||
//set up temporary storage |
||||
OC_Filesystem::clearMounts(); |
||||
OC_Filesystem::mount('OC_Filestorage_Temporary',array(),'/'); |
||||
|
||||
//set up the users home folder in the temp storage |
||||
$rootView=new OC_FilesystemView(''); |
||||
$rootView->mkdir('/'.OC_User::getUser()); |
||||
$rootView->mkdir('/'.OC_User::getUser().'/files'); |
||||
} |
||||
|
||||
public function testSimple(){ |
||||
$file=OC::$SERVERROOT.'/3rdparty/MDB2.php'; |
||||
$original=file_get_contents($file); |
||||
|
||||
OC_Filesystem::file_put_contents('/file',$original); |
||||
|
||||
OC_FileProxy::$enabled=false; |
||||
$stored=OC_Filesystem::file_get_contents('/file'); |
||||
OC_FileProxy::$enabled=true; |
||||
|
||||
$fromFile=OC_Filesystem::file_get_contents('/file'); |
||||
$this->assertNotEqual($original,$stored); |
||||
$this->assertEqual($original,$fromFile); |
||||
} |
||||
} |
||||
@ -1 +1 @@ |
||||
0.4.1 |
||||
0.4.2 |
||||
|
||||
@ -1 +1 @@ |
||||
0.3 |
||||
0.4 |
||||
@ -1,78 +0,0 @@ |
||||
<?php |
||||
|
||||
/** |
||||
* ownCloud - media plugin |
||||
* |
||||
* @author Robin Appelman |
||||
* @copyright 2010 Robin Appelman icewind1991@gmail.com |
||||
* |
||||
* This library is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
* License as published by the Free Software Foundation; either |
||||
* version 3 of the License, or any later version. |
||||
* |
||||
* This library is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
||||
* |
||||
* You should have received a copy of the GNU Lesser General Public |
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
||||
* |
||||
*/ |
||||
|
||||
$_POST=$_GET; //debug |
||||
|
||||
OCP\JSON::checkAppEnabled('media'); |
||||
require_once(OC::$APPSROOT . '/apps/media/lib_collection.php'); |
||||
|
||||
$user=isset($_POST['user'])?$_POST['user']:''; |
||||
$pass=isset($_POST['pass'])?$_POST['pass']:''; |
||||
if(OCP\User::checkPassword($user,$pass)){ |
||||
OC_Util::setupFS($user); |
||||
OC_MEDIA_COLLECTION::$uid=$user; |
||||
}else{ |
||||
exit; |
||||
} |
||||
|
||||
if(isset($_POST['play']) and $_POST['play']=='true'){ |
||||
if(!isset($_POST['song'])){ |
||||
exit; |
||||
} |
||||
$song=OC_MEDIA_COLLECTION::getSong($_POST['song']); |
||||
$ftype=OC_Filesystem::getMimeType( $song['song_path'] ); |
||||
header('Content-Type:'.$ftype); |
||||
OCP\Response::disableCaching(); |
||||
header('Content-Length: '.OC_Filesystem::filesize($song['song_path'])); |
||||
|
||||
OC_Filesystem::readfile($song['song_path']); |
||||
} |
||||
|
||||
$artist=isset($_POST['artist'])?'%'.$_POST['artist'].'%':''; |
||||
$album=isset($_POST['album'])?'%'.$_POST['album'].'%':''; |
||||
$song=isset($_POST['song'])?$_POST['song']:''; |
||||
|
||||
$artist=OC_MEDIA_COLLECTION::getArtistId($artist); |
||||
$album=OC_MEDIA_COLLECTION::getAlbumId($album,$artist); |
||||
|
||||
$songs=OC_MEDIA_COLLECTION::getSongs($artist,$album,$song); |
||||
|
||||
$baseUrl=$baseuri; |
||||
|
||||
$results=array(); |
||||
foreach($songs as $song) { |
||||
$results[] = (Object) array( |
||||
'artist' => OC_MEDIA_COLLECTION::getArtistName($song['song_artist']), |
||||
'album' => OC_MEDIA_COLLECTION::getAlbumName($song['song_album']), |
||||
'track' => $song['song_name'], |
||||
'source' => 'ownCloud', |
||||
'mimetype' => OC_Filesystem::getMimeType($song['song_path']), |
||||
'extension' => substr($song['song_path'],strrpos($song['song_path'],'.')), |
||||
'url' => $baseUrl.'?play=true&song='.$song['song_id'], |
||||
'bitrate' => round($song['song_id']/$song['song_length'],0), |
||||
'duration' => round($song['song_length'],0), |
||||
'size' => $song['song_size'], |
||||
'score' => (float)1.0 |
||||
); |
||||
} |
||||
OCP\JSON::encodedPrint($results); |
||||
Loading…
Reference in new issue