Merge branch 'master' of git://gitorious.org/owncloud/owncloud
This commit is contained in:
commit
49c2efee27
|
@ -33,7 +33,7 @@ abstract class OC_USER_BACKEND {
|
||||||
* Check if the login button is pressed and log the user in
|
* Check if the login button is pressed and log the user in
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
abstract public static function loginLisener();
|
abstract public static function loginListener();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to create a new user
|
* Try to create a new user
|
||||||
|
@ -55,7 +55,7 @@ abstract class OC_USER_BACKEND {
|
||||||
* Check if the logout button is pressed and logout the user
|
* Check if the logout button is pressed and logout the user
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
abstract public static function logoutLisener();
|
abstract public static function logoutListener();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if some user is logged in
|
* Check if some user is logged in
|
||||||
|
|
|
@ -36,7 +36,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND {
|
||||||
* Check if the login button is pressed and log the user in
|
* Check if the login button is pressed and log the user in
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function loginLisener(){
|
public static function loginListener(){
|
||||||
if ( isset($_POST['loginbutton']) AND isset($_POST['password']) AND isset($_POST['login']) ) {
|
if ( isset($_POST['loginbutton']) AND isset($_POST['password']) AND isset($_POST['login']) ) {
|
||||||
if ( OC_USER::login($_POST['login'], $_POST['password']) ) {
|
if ( OC_USER::login($_POST['login'], $_POST['password']) ) {
|
||||||
echo 1;
|
echo 1;
|
||||||
|
@ -111,7 +111,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND {
|
||||||
* Check if the logout button is pressed and logout the user
|
* Check if the logout button is pressed and logout the user
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function logoutLisener() {
|
public static function logoutListener() {
|
||||||
global $WEBROOT;
|
global $WEBROOT;
|
||||||
if ( isset($_GET['logoutbutton']) AND isset($_SESSION['username']) ) {
|
if ( isset($_GET['logoutbutton']) AND isset($_SESSION['username']) ) {
|
||||||
OC_LOG::event($_SESSION['username'], 2, '');
|
OC_LOG::event($_SESSION['username'], 2, '');
|
||||||
|
|
|
@ -102,8 +102,8 @@ OC_UTIL::setupFS();
|
||||||
OC_UTIL::checkserver();
|
OC_UTIL::checkserver();
|
||||||
|
|
||||||
// listen for login or logout actions
|
// listen for login or logout actions
|
||||||
OC_USER::logoutlisener();
|
OC_USER::logoutlistener();
|
||||||
$loginresult=OC_USER::loginlisener();
|
$loginresult=OC_USER::loginlistener();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for utility functions
|
* Class for utility functions
|
||||||
|
|
|
@ -45,7 +45,7 @@ class OC_CONFIG{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createUserLisener(){
|
public static function createUserListener(){
|
||||||
if(OC_USER::isLoggedIn()){
|
if(OC_USER::isLoggedIn()){
|
||||||
if(OC_USER::ingroup($_SESSION['username'],'admin')){
|
if(OC_USER::ingroup($_SESSION['username'],'admin')){
|
||||||
if(isset($_POST['new_username']) and isset($_POST['new_password'])){
|
if(isset($_POST['new_username']) and isset($_POST['new_password'])){
|
||||||
|
@ -63,7 +63,7 @@ class OC_CONFIG{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createGroupLisener(){
|
public static function createGroupListener(){
|
||||||
if(OC_USER::isLoggedIn()){
|
if(OC_USER::isLoggedIn()){
|
||||||
if(isset($_POST['creategroup']) and $_POST['creategroup']==1){
|
if(isset($_POST['creategroup']) and $_POST['creategroup']==1){
|
||||||
if(OC_USER::creategroup($_POST['groupname'])){
|
if(OC_USER::creategroup($_POST['groupname'])){
|
||||||
|
@ -81,10 +81,10 @@ class OC_CONFIG{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lisen for configuration changes
|
* listen for configuration changes
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function configLisener(){
|
public static function configListener(){
|
||||||
if(OC_USER::isLoggedIn()){
|
if(OC_USER::isLoggedIn()){
|
||||||
if(isset($_POST['config']) and $_POST['config']==1){
|
if(isset($_POST['config']) and $_POST['config']==1){
|
||||||
$error='';
|
$error='';
|
||||||
|
@ -139,10 +139,10 @@ class OC_CONFIG{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* lisen for admin configuration changes and write it to the file
|
* listen for admin configuration changes and write it to the file
|
||||||
*4bd0be1185e76
|
*4bd0be1185e76
|
||||||
*/
|
*/
|
||||||
public static function writeAdminLisener(){
|
public static function writeAdminListener(){
|
||||||
global $CONFIG_INSTALLED;
|
global $CONFIG_INSTALLED;
|
||||||
$allow=false;
|
$allow=false;
|
||||||
if(!$CONFIG_INSTALLED){
|
if(!$CONFIG_INSTALLED){
|
||||||
|
|
|
@ -111,7 +111,7 @@ class OC_FILESYSTEM{
|
||||||
if(substr($path,0,1)!=='/'){
|
if(substr($path,0,1)!=='/'){
|
||||||
$path='/'.$path;
|
$path='/'.$path;
|
||||||
}
|
}
|
||||||
if(strstr($path,'/../')){
|
if(strstr($path,'/../') || strrchr($path, '/') === '/..' ){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;//dummy untill premissions are correctly implemented, also the correcty value because for now users are locked in their seperate data dir and can read/write everything in there
|
return true;//dummy untill premissions are correctly implemented, also the correcty value because for now users are locked in their seperate data dir and can read/write everything in there
|
||||||
|
@ -125,7 +125,7 @@ class OC_FILESYSTEM{
|
||||||
if(substr($path,0,1)!=='/'){
|
if(substr($path,0,1)!=='/'){
|
||||||
$path='/'.$path;
|
$path='/'.$path;
|
||||||
}
|
}
|
||||||
if(strstr($path,'/../')){
|
if(strstr($path,'/../') || strrchr($path, '/') === '/..' ){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;//dummy untill premissions are correctly implemented, also the correcty value because for now users are locked in their seperate data dir and can read/write everything in there
|
return true;//dummy untill premissions are correctly implemented, also the correcty value because for now users are locked in their seperate data dir and can read/write everything in there
|
||||||
|
|
|
@ -59,8 +59,10 @@ class OC_PLUGIN{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($data['runtime'] as $include){
|
if(isset($data['runtime'])){
|
||||||
include($SERVERROOT.'/plugins/'.$id.'/'.$include);
|
foreach($data['runtime'] as $include){
|
||||||
|
include($SERVERROOT.'/plugins/'.$id.'/'.$include);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -78,8 +78,8 @@ class OC_USER {
|
||||||
* Check if the login button is pressed and log the user in
|
* Check if the login button is pressed and log the user in
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function loginLisener() {
|
public static function loginListener() {
|
||||||
return self::$_backend->loginLisener();
|
return self::$_backend->loginListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,8 +106,8 @@ class OC_USER {
|
||||||
* Check if the logout button is pressed and logout the user
|
* Check if the logout button is pressed and logout the user
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function logoutLisener() {
|
public static function logoutListener() {
|
||||||
return self::$_backend->logoutLisener();
|
return self::$_backend->logoutListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,14 +51,14 @@ if(!OC_UTIL::hasSmallScreen()){
|
||||||
|
|
||||||
|
|
||||||
// check if already configured. otherwise start configuration wizard
|
// check if already configured. otherwise start configuration wizard
|
||||||
$error=OC_CONFIG::writeadminlisener();
|
$error=OC_CONFIG::writeadminlistener();
|
||||||
if($e=OC_CONFIG::configlisener()){
|
if($e=OC_CONFIG::configlistener()){
|
||||||
$error.=$e;
|
$error.=$e;
|
||||||
}
|
}
|
||||||
if($e=OC_CONFIG::createuserlisener()){
|
if($e=OC_CONFIG::createuserlistener()){
|
||||||
$error.=$e;
|
$error.=$e;
|
||||||
}
|
}
|
||||||
if($e=OC_CONFIG::creategrouplisener()){
|
if($e=OC_CONFIG::creategrouplistener()){
|
||||||
$error.=$e;
|
$error.=$e;
|
||||||
}
|
}
|
||||||
$CONFIG_ERROR=$error;
|
$CONFIG_ERROR=$error;
|
||||||
|
|
|
@ -225,6 +225,10 @@ OC_FILES.newFile=function(type,name,dir){
|
||||||
arg=new Object;
|
arg=new Object;
|
||||||
arg.name=name;
|
arg.name=name;
|
||||||
arg.dir=dir;
|
arg.dir=dir;
|
||||||
|
if(OC_FILES.cache.files[name]){//check if the file already exists
|
||||||
|
alert(((type=='dir')?'folder ':'file ')+name+' already exists.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
arg.type=type;
|
arg.type=type;
|
||||||
OC_API.run('new',{dir:dir,name:name,type:type},OC_FILES.new_callback,arg)
|
OC_API.run('new',{dir:dir,name:name,type:type},OC_FILES.new_callback,arg)
|
||||||
if(!OC_FILES.cache.incomplete[dir]){
|
if(!OC_FILES.cache.incomplete[dir]){
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
This plugin implements a very basic HTML5 audio preview for ownCloud.
|
||||||
|
|
||||||
|
Only formats supported by the browser can be played.
|
||||||
|
Sadly, those are very limited and not coherent among browsers, see http://html5doctor.com/native-audio-in-the-browser/ for more info.
|
||||||
|
|
||||||
|
Ideas to change that (TODO):
|
||||||
|
- Flashplayer fallback
|
||||||
|
and/or
|
||||||
|
- on-the-fly transcoding
|
|
@ -0,0 +1,66 @@
|
||||||
|
OC_AudioPlayer = new Object();
|
||||||
|
|
||||||
|
OC_AudioPlayer.playAudio = function(dir, file, type) {
|
||||||
|
var path = WEBROOT + '/files/api?action=get&dir='+encodeURIComponent(dir)+'&file='+encodeURIComponent(file);
|
||||||
|
|
||||||
|
OC_AudioPlayer.audioFrame = document.createElement('div');
|
||||||
|
OC_AudioPlayer.audioFrame.setAttribute('id', 'audioframe');
|
||||||
|
OC_AudioPlayer.audioFrame.setAttribute('class', 'center');
|
||||||
|
var div = document.createElement('div');
|
||||||
|
var inner = document.createElement('div');
|
||||||
|
var audio = document.createElement('audio');
|
||||||
|
var source = document.createElement('source');
|
||||||
|
|
||||||
|
// if (!(!!(audio.canPlayType) && (audio.canPlayType(type) != "no") && (audio.canPlayType(type) != ""))) {
|
||||||
|
// // use a flash player fallback
|
||||||
|
// // or implement some nice on-the-fly recoding here
|
||||||
|
// alert("Native playing of '"+type+"' format is not supported by your browser.");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
audio.setAttribute('controls', 'controls');
|
||||||
|
audio.setAttribute('preload', 'auto');
|
||||||
|
audio.setAttribute('autoplay', 'autoplay');
|
||||||
|
audio.setAttribute('autobuffer', 'autobuffer');
|
||||||
|
source.setAttribute('src', path);
|
||||||
|
source.setAttribute('type', type);
|
||||||
|
|
||||||
|
audio.appendChild(source);
|
||||||
|
inner.appendChild(audio);
|
||||||
|
div.appendChild(inner);
|
||||||
|
OC_AudioPlayer.audioFrame.appendChild(div);
|
||||||
|
|
||||||
|
OC_AudioPlayer.audioFrame.addEvent('onclick', OC_AudioPlayer.hidePlayer);
|
||||||
|
inner.addEvent('onclick', function(e){e.stopPropagation();}); // don't close if clicked on player
|
||||||
|
|
||||||
|
body = document.getElementsByTagName('body').item(0);
|
||||||
|
body.appendChild(OC_AudioPlayer.audioFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
OC_AudioPlayer.hidePlayer = function(){
|
||||||
|
var div = document.getElementById('audioframe');
|
||||||
|
div.parentNode.removeChild(div);
|
||||||
|
}
|
||||||
|
|
||||||
|
// only register "play" option for file formats the browser claims to support
|
||||||
|
OC_AudioPlayer.formats = {
|
||||||
|
'audio/mpeg':"mp3",
|
||||||
|
'audio/ogg':"ogg",
|
||||||
|
'application/ogg':"ogg",
|
||||||
|
'audio/wav':"wav",
|
||||||
|
'audio/wave':"wav",
|
||||||
|
'audio/x-wav':"wav",
|
||||||
|
'audio/basic':"au",
|
||||||
|
'audio/x-aiff':"aif"
|
||||||
|
};
|
||||||
|
var audio = document.createElement('audio');
|
||||||
|
for(format in OC_AudioPlayer.formats) {
|
||||||
|
if (!!(audio.canPlayType) && (audio.canPlayType(format) != "no") && (audio.canPlayType(format) != "")) {
|
||||||
|
if(!OC_FILES.fileActions[format]) {
|
||||||
|
OC_FILES.fileActions[format] = new Object();
|
||||||
|
}
|
||||||
|
OC_FILES.fileActions[format].play = function() {
|
||||||
|
OC_AudioPlayer.playAudio(this.dir, this.file, this.mime);
|
||||||
|
}
|
||||||
|
OC_FILES.fileActions[format]['default'] = OC_FILES.fileActions[format].play;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
//load the required js and css files
|
||||||
|
OC_UTIL::addScript('plugins/audioplayer/audioplayer.js');
|
||||||
|
OC_UTIL::addStyle('plugins/audioplayer/style.css');
|
||||||
|
?>
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<plugin version='1.0'>
|
||||||
|
<info>
|
||||||
|
<id>audioplayer</id>
|
||||||
|
<name>A simple HTML5 based audio player for ownCloud</name>
|
||||||
|
<version>0.1</version>
|
||||||
|
<licence>AGPL</licence>
|
||||||
|
<author>ente</author>
|
||||||
|
<require>1.1</require>
|
||||||
|
</info>
|
||||||
|
<runtime>
|
||||||
|
<include>lib_audioplayer.php</include>
|
||||||
|
</runtime>
|
||||||
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#audioframe{
|
||||||
|
position:absolute;
|
||||||
|
top:0px;
|
||||||
|
left:0px;
|
||||||
|
height:100%;
|
||||||
|
width:100%;
|
||||||
|
background:rgb(20,20,20);
|
||||||
|
background:rgba(20,20,20,0.9);
|
||||||
|
text-align:center;
|
||||||
|
display:table;
|
||||||
|
}
|
||||||
|
|
||||||
|
#audioframe>div{
|
||||||
|
display:table-cell;
|
||||||
|
vertical-align:middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#audioframe>div>div{
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class OC_USER_LDAP extends OC_USER_BACKEND {
|
||||||
* Check if the login button is pressed and log the user in
|
* Check if the login button is pressed and log the user in
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function loginLisener() {
|
public static function loginListener() {
|
||||||
return('');
|
return('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class OC_USER_LDAP extends OC_USER_BACKEND {
|
||||||
* Check if the logout button is pressed and logout the user
|
* Check if the logout button is pressed and logout the user
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function logoutLisener() {
|
public static function logoutListener() {
|
||||||
if ( isset($_GET['logoutbutton']) AND isset($_SESSION['username']) ) {
|
if ( isset($_GET['logoutbutton']) AND isset($_SESSION['username']) ) {
|
||||||
header('WWW-Authenticate: Basic realm="ownCloud"');
|
header('WWW-Authenticate: Basic realm="ownCloud"');
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
|
|
Loading…
Reference in New Issue