summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2011-07-30 19:40:19 -0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2011-07-30 19:40:19 -0400
commit11d162751381963e0c8a86cf15c811cc99003654 (patch)
tree276b5b1e67a66491ef553346087b2959f35b3bc7 /apps
parentd13ba0ee2d93080ba56776442b9d39a53e2b6321 (diff)
parentd6faa89ed720da7319923cba33a83d0210216d57 (diff)
downloadnextcloud-server-11d162751381963e0c8a86cf15c811cc99003654.tar.gz
nextcloud-server-11d162751381963e0c8a86cf15c811cc99003654.zip
Merge branch 'master' into sharing. Integrate with changes in master, rename classes
Conflicts: lib/base.php
Diffstat (limited to 'apps')
-rw-r--r--apps/files_imageviewer/appinfo/app.php6
-rw-r--r--apps/files_publiclink/admin.php17
-rw-r--r--apps/files_publiclink/appinfo/app.php2
-rw-r--r--apps/files_publiclink/get.php25
-rw-r--r--apps/files_publiclink/lib_public.php10
-rw-r--r--apps/files_sharing/ajax/share.php2
-rw-r--r--apps/files_sharing/ajax/unshare.php2
-rw-r--r--apps/files_sharing/ajax/userautocomplete.php6
-rw-r--r--apps/files_sharing/appinfo/app.php6
-rw-r--r--apps/files_sharing/lib_share.php38
-rw-r--r--apps/files_sharing/list.php11
-rw-r--r--apps/files_sharing/sharedstorage.php94
-rw-r--r--apps/media/ajax/api.php19
-rw-r--r--apps/media/ajax/autoupdate.php2
-rw-r--r--apps/media/appinfo/app.php40
-rw-r--r--apps/media/css/music.css12
-rw-r--r--apps/media/css/player.css2
-rw-r--r--apps/media/index.php28
-rw-r--r--apps/media/js/collection.js150
-rw-r--r--apps/media/js/music.js95
-rw-r--r--apps/media/js/player.js43
-rw-r--r--apps/media/js/playlist.js141
-rw-r--r--apps/media/lib_ampache.php6
-rw-r--r--apps/media/lib_collection.php6
-rw-r--r--apps/media/lib_media.php20
-rw-r--r--apps/media/lib_scanner.php14
-rw-r--r--apps/media/settings.php17
-rw-r--r--apps/media/templates/collection.php10
-rw-r--r--apps/media/templates/music.php4
-rw-r--r--apps/media/templates/playlist.php30
-rw-r--r--apps/media/tomahawk.php14
-rw-r--r--apps/user_ldap/appinfo/app.php6
-rw-r--r--apps/user_ldap/settings.php15
-rw-r--r--apps/user_ldap/user_ldap.php16
-rw-r--r--apps/user_openid/appinfo/app.php8
-rw-r--r--apps/user_openid/phpmyid.php7
-rw-r--r--apps/user_openid/settings.php15
-rw-r--r--apps/user_openid/user.php2
-rw-r--r--apps/user_openid/user_openid.php3
39 files changed, 615 insertions, 329 deletions
diff --git a/apps/files_imageviewer/appinfo/app.php b/apps/files_imageviewer/appinfo/app.php
index 50a7253e01b..6d32e2d628e 100644
--- a/apps/files_imageviewer/appinfo/app.php
+++ b/apps/files_imageviewer/appinfo/app.php
@@ -1,8 +1,8 @@
<?php
-if(OC_APP::getCurrentApp()=='files'){
- OC_UTIL::addScript( 'files_imageviewer', 'lightbox' );
- OC_UTIL::addStyle( 'files_imageviewer', 'lightbox' );
+if(OC_App::getCurrentApp()=='files'){
+ OC_Util::addScript( 'files_imageviewer', 'lightbox' );
+ OC_Util::addStyle( 'files_imageviewer', 'lightbox' );
}
?>
diff --git a/apps/files_publiclink/admin.php b/apps/files_publiclink/admin.php
index afb726da312..8187039c3a6 100644
--- a/apps/files_publiclink/admin.php
+++ b/apps/files_publiclink/admin.php
@@ -25,29 +25,28 @@
// Init owncloud
require_once('../../lib/base.php');
require_once( 'lib_public.php' );
-require( 'template.php' );
// Check if we are a user
-if( !OC_USER::isLoggedIn()){
- header( "Location: ".OC_HELPER::linkTo( "index.php" ));
+if( !OC_User::isLoggedIn()){
+ header( "Location: ".OC_Helper::linkTo( "index.php" ));
exit();
}
-OC_APP::setActiveNavigationEntry( "files_publiclink_administration" );
+OC_App::setActiveNavigationEntry( "files_publiclink_administration" );
-OC_UTIL::addStyle( 'files_publiclink', 'admin' );
-OC_UTIL::addScript( 'files_publiclink', 'admin' );
+OC_Util::addStyle( 'files_publiclink', 'admin' );
+OC_Util::addScript( 'files_publiclink', 'admin' );
if(isset($_SERVER['HTTPS'])) {
- $baseUrl= "https://". $_SERVER['SERVER_NAME'] . OC_HELPER::linkTo('files_publiclink','get.php');
+ $baseUrl= "https://". $_SERVER['SERVER_NAME'] . OC_Helper::linkTo('files_publiclink','get.php');
}else{
- $baseUrl= "http://". $_SERVER['SERVER_NAME'] . OC_HELPER::linkTo('files_publiclink','get.php');
+ $baseUrl= "http://". $_SERVER['SERVER_NAME'] . OC_Helper::linkTo('files_publiclink','get.php');
}
// return template
-$tmpl = new OC_TEMPLATE( "files_publiclink", "admin", "admin" );
+$tmpl = new OC_Template( "files_publiclink", "admin", "admin" );
$tmpl->assign( 'links', OC_PublicLink::getLinks());
$tmpl->assign('baseUrl',$baseUrl);
$tmpl->printPage();
diff --git a/apps/files_publiclink/appinfo/app.php b/apps/files_publiclink/appinfo/app.php
index 894327e83d3..314a3bf896a 100644
--- a/apps/files_publiclink/appinfo/app.php
+++ b/apps/files_publiclink/appinfo/app.php
@@ -1,6 +1,6 @@
<?php
-OC_APP::addSettingsPage( array( "id" => "files_publiclink_administration", "order" => 1, "href" => OC_HELPER::linkTo( "files_publiclink", "admin.php" ), "name" => "Public Links", "icon" => OC_HELPER::imagePath( "files_publiclink", "share.png" )));
+OC_App::addSettingsPage( array( "id" => "files_publiclink_administration", "order" => 1, "href" => OC_Helper::linkTo( "files_publiclink", "admin.php" ), "name" => "Public Links", "icon" => OC_Helper::imagePath( "files_publiclink", "share.png" )));
?>
diff --git a/apps/files_publiclink/get.php b/apps/files_publiclink/get.php
index d3e3022e761..6bcefc2e4e8 100644
--- a/apps/files_publiclink/get.php
+++ b/apps/files_publiclink/get.php
@@ -3,7 +3,6 @@ $RUNTIME_NOAPPS=true; //no need to load the apps
$RUNTIME_NOSETUPFS=true; //don't setup the fs yet
require_once '../../lib/base.php';
-require( 'template.php' );
require_once 'lib_public.php';
@@ -19,18 +18,18 @@ if($path!==false){
$subPath='';
}
$path.=$subPath;
- if(!OC_FILESYSTEM::file_exists($path)){
+ if(!OC_Filesystem::file_exists($path)){
header("HTTP/1.0 404 Not Found");
- $tmpl = new OC_TEMPLATE( '', '404', 'guest' );
+ $tmpl = new OC_Template( '', '404', 'guest' );
$tmpl->assign('file',$subPath);
$tmpl->printPage();
exit;
}
- if(OC_FILESYSTEM::is_dir($path)){
+ if(OC_Filesystem::is_dir($path)){
$files = array();
$rootLength=strlen($root);
- foreach( OC_FILES::getdirectorycontent( $path ) as $i ){
- $i['date'] = OC_UTIL::formatDate($i['mtime'] );
+ foreach( OC_Files::getdirectorycontent( $path ) as $i ){
+ $i['date'] = OC_Util::formatDate($i['mtime'] );
$i['directory']=substr($i['directory'],$rootLength);
if($i['directory']=='/'){
$i['directory']='';
@@ -48,36 +47,36 @@ if($path!==false){
}
}
- $breadcrumbNav = new OC_TEMPLATE( "files_publiclink", "breadcrumb", "" );
+ $breadcrumbNav = new OC_Template( "files_publiclink", "breadcrumb", "" );
$breadcrumbNav->assign( "breadcrumb", $breadcrumb );
$breadcrumbNav->assign('token',$token);
- $list = new OC_TEMPLATE( 'files_publiclink', 'files', '' );
+ $list = new OC_Template( 'files_publiclink', 'files', '' );
$list->assign( 'files', $files );
$list->assign('token',$token);
- $tmpl = new OC_TEMPLATE( 'files_publiclink', 'index', 'user' );
+ $tmpl = new OC_Template( 'files_publiclink', 'index', 'user' );
$tmpl->assign('fileList', $list->fetchPage());
$tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() );
$tmpl->printPage();
}else{
//get time mimetype and set the headers
- $mimetype=OC_FILESYSTEM::getMimeType($path);
+ $mimetype=OC_Filesystem::getMimeType($path);
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: attachment; filename="'.basename($path).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Type: ' . $mimetype);
- header('Content-Length: ' . OC_FILESYSTEM::filesize($path));
+ header('Content-Length: ' . OC_Filesystem::filesize($path));
//download the file
@ob_clean();
- OC_FILESYSTEM::readfile($path);
+ OC_Filesystem::readfile($path);
}
}else{
header("HTTP/1.0 404 Not Found");
- $tmpl = new OC_TEMPLATE( '', '404', 'guest' );
+ $tmpl = new OC_Template( '', '404', 'guest' );
$tmpl->printPage();
die();
}
diff --git a/apps/files_publiclink/lib_public.php b/apps/files_publiclink/lib_public.php
index b4bc86505ae..ff1df130834 100644
--- a/apps/files_publiclink/lib_public.php
+++ b/apps/files_publiclink/lib_public.php
@@ -6,8 +6,8 @@ class OC_PublicLink{
* @param int (optional) expiretime time the link expires, as timestamp
*/
public function __construct($path,$expiretime=0){
- if($path and OC_FILESYSTEM::file_exists($path) and OC_FILESYSTEM::is_readable($path)){
- $user=OC_USER::getUser();
+ if($path and OC_Filesystem::file_exists($path) and OC_Filesystem::is_readable($path)){
+ $user=OC_User::getUser();
$token=sha1("$user-$path-$expiretime");
$query=OC_DB::prepare("INSERT INTO *PREFIX*publiclink VALUES(?,?,?,?)");
$result=$query->execute(array($token,$path,$user,$expiretime));
@@ -38,7 +38,7 @@ class OC_PublicLink{
$user=$data[0]['user'];
//prepare the filesystem
- OC_UTIL::setupFS($user);
+ OC_Util::setupFS($user);
return $path;
}else{
@@ -60,7 +60,7 @@ class OC_PublicLink{
*/
static public function getLinks(){
$query=OC_DB::prepare("SELECT * FROM *PREFIX*publiclink WHERE user=?");
- return $query->execute(array(OC_USER::getUser()))->fetchAll();
+ return $query->execute(array(OC_User::getUser()))->fetchAll();
}
/**
@@ -69,7 +69,7 @@ class OC_PublicLink{
static public function delete($token){
$query=OC_DB::prepare("SELECT user,path FROM *PREFIX*publiclink WHERE token=?");
$result=$query->execute(array($token))->fetchAll();
- if(count($result)>0 and $result[0]['user']==OC_USER::getUser()){
+ if(count($result)>0 and $result[0]['user']==OC_User::getUser()){
$query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE token=?");
$query->execute(array($token));
}
diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php
index b2c3a477958..6e860d584ea 100644
--- a/apps/files_sharing/ajax/share.php
+++ b/apps/files_sharing/ajax/share.php
@@ -9,7 +9,7 @@ $uid_shared_with = $_GET['uid_shared_with'];
$permissions = $_GET['permissions'];
foreach ($sources as $source) {
foreach ($uid_shared_with as $uid) {
- new OC_SHARE($source, $uid, $permissions);
+ new OC_Share($source, $uid, $permissions);
}
}
diff --git a/apps/files_sharing/ajax/unshare.php b/apps/files_sharing/ajax/unshare.php
index 4d83d332257..78d7d2e25f0 100644
--- a/apps/files_sharing/ajax/unshare.php
+++ b/apps/files_sharing/ajax/unshare.php
@@ -6,6 +6,6 @@ require_once('../lib_share.php');
$source = $_GET['source'];
$uid_shared_with = $_GET['uid_shared_with'];
-OC_SHARE::unshare($source, $uid_shared_with);
+OC_Share::unshare($source, $uid_shared_with);
?> \ No newline at end of file
diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php
index 6e1469ae348..816e01ba9ee 100644
--- a/apps/files_sharing/ajax/userautocomplete.php
+++ b/apps/files_sharing/ajax/userautocomplete.php
@@ -3,7 +3,7 @@ $RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
-if (!OC_USER::isLoggedIn()) {
+if (!OC_User::isLoggedIn()) {
echo json_encode(array("status" => "error", "data" => array("message" => "Authentication error")));
exit();
}
@@ -11,8 +11,8 @@ $query = $_GET['term'];
$length = strlen($query);
$query = strtolower($query);
$users = array();
-$ocusers = OC_USER::getUsers();
-$self = OC_USER::getUser();
+$ocusers = OC_User::getUsers();
+$self = OC_User::getUser();
$groups = OC_GROUP::getUserGroups($self);
foreach ($ocusers as $user) {
if ($user != $self && substr(strtolower($user), 0, $length) == $query) {
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php
index 60abcda50f9..e7e19869d2a 100644
--- a/apps/files_sharing/appinfo/app.php
+++ b/apps/files_sharing/appinfo/app.php
@@ -2,11 +2,11 @@
require_once('apps/files_sharing/lib_share.php');
-OC_UTIL::addScript("files_sharing", "share");
-OC_APP::addNavigationSubEntry("files_index", array(
+OC_Util::addScript("files_sharing", "share");
+OC_App::addNavigationSubEntry("files_index", array(
"id" => "files_sharing_list",
"order" => 10,
- "href" => OC_HELPER::linkTo( "files_sharing", "list.php" ),
+ "href" => OC_Helper::linkTo( "files_sharing", "list.php" ),
"name" => "Shared"));
?>
diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php
index fa74cd14ee9..f8b00aa905d 100644
--- a/apps/files_sharing/lib_share.php
+++ b/apps/files_sharing/lib_share.php
@@ -20,13 +20,13 @@
*
*/
-OC_HOOK::connect("OC_FILESYSTEM","post_delete", "OC_SHARE", "deleteItem");
-OC_HOOK::connect("OC_FILESYSTEM","post_rename", "OC_SHARE", "renameItem");
+OC_Hook::connect("OC_FILESYSTEM","post_delete", "OC_Share", "deleteItem");
+OC_Hook::connect("OC_FILESYSTEM","post_rename", "OC_Share", "renameItem");
/**
* This class manages shared items within the database.
*/
-class OC_SHARE {
+class OC_Share {
const WRITE = 1;
const DELETE = 2;
@@ -39,8 +39,8 @@ class OC_SHARE {
*/
public function __construct($source, $uid_shared_with, $permissions, $public = false) {
if ($source && OC_FILESYSTEM::file_exists($source) && OC_FILESYSTEM::is_readable($source)) {
- $source = "/".OC_USER::getUser()."/files".$source;
- $uid_owner = OC_USER::getUser();
+ $source = "/".OC_User::getUser()."/files".$source;
+ $uid_owner = OC_User::getUser();
if ($public) {
// TODO create token for public file
$token = sha1("$uid_owner-$item");
@@ -85,8 +85,8 @@ class OC_SHARE {
* @return An array to be used by the IN operator in a query for uid_shared_with
*/
private static function getUserAndGroups() {
- $self = OC_USER::getUser();
- $groups = OC_GROUP::getUserGroups($self);
+ $self = OC_User::getUser();
+ $groups = OC_Group::getUserGroups($self);
array_unshift($groups, $self);
return $groups;
}
@@ -104,7 +104,7 @@ class OC_SHARE {
$source = $folders['source'].substr($oldTarget, strlen($folders['target']));
$item = self::getItem($folders['target']);
$query = OC_DB::prepare("INSERT INTO *PREFIX*sharing VALUES(?,?,?,?,?)");
- $query->execute(array($item[0]['uid_owner'], OC_USER::getUser(), $source, $newTarget, $item[0]['permissions']));
+ $query->execute(array($item[0]['uid_owner'], OC_User::getUser(), $source, $newTarget, $item[0]['permissions']));
}
/**
@@ -115,7 +115,7 @@ class OC_SHARE {
public static function getItem($target) {
$target = self::cleanPath($target);
$query = OC_DB::prepare("SELECT uid_owner, source, permissions FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with = ? LIMIT 1");
- return $query->execute(array($target, OC_USER::getUser()))->fetchAll();
+ return $query->execute(array($target, OC_User::getUser()))->fetchAll();
}
/**
@@ -124,7 +124,7 @@ class OC_SHARE {
*/
public static function getMySharedItems() {
$query = OC_DB::prepare("SELECT uid_shared_with, source, permissions FROM *PREFIX*sharing WHERE uid_owner = ?");
- return $query->execute(array(OC_USER::getUser()))->fetchAll();
+ return $query->execute(array(OC_User::getUser()))->fetchAll();
}
/**
@@ -230,7 +230,7 @@ class OC_SHARE {
$oldSource = self::cleanPath($oldSource);
$newSource = self::cleanPath($newSource);
$query = OC_DB::prepare("UPDATE *PREFIX*sharing SET source = REPLACE(source, ?, ?) WHERE uid_owner = ?");
- $query->execute(array($oldSource, $newSource, OC_USER::getUser()));
+ $query->execute(array($oldSource, $newSource, OC_User::getUser()));
}
/**
@@ -245,7 +245,7 @@ class OC_SHARE {
$oldTarget = self::cleanPath($oldTarget);
$newTarget = self::cleanPath($newTarget);
$query = OC_DB::prepare("UPDATE *PREFIX*sharing SET target = REPLACE(target, ?, ?) WHERE uid_shared_with = ?");
- $query->execute(array($oldTarget, $newTarget, OC_USER::getUser()));
+ $query->execute(array($oldTarget, $newTarget, OC_User::getUser()));
}
/**
@@ -260,7 +260,7 @@ class OC_SHARE {
public static function setPermissions($source, $uid_shared_with, $permissions) {
$source = self::cleanPath($source);
$query = OC_DB::prepare("UPDATE *PREFIX*sharing SET permissions = ? WHERE SUBSTR(source, 1, ?) = ? AND uid_shared_with = ? AND uid_owner = ?");
- $query->execute(array($permissions, strlen($source), $source, $uid_shared_with, OC_USER::getUser()));
+ $query->execute(array($permissions, strlen($source), $source, $uid_shared_with, OC_User::getUser()));
}
/**
@@ -274,7 +274,7 @@ class OC_SHARE {
public static function unshare($source, $uid_shared_with) {
$source = self::cleanPath($source);
$query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_shared_with = ? AND uid_owner = ?");
- $query->execute(array(strlen($source), $source, $uid_shared_with, OC_USER::getUser()));
+ $query->execute(array(strlen($source), $source, $uid_shared_with, OC_User::getUser()));
}
/**
@@ -287,7 +287,7 @@ class OC_SHARE {
public static function unshareFromMySelf($target) {
$target = self::cleanPath($target);
$query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(target, 1, ?) = ? AND uid_shared_with = ?");
- $query->execute(array(strlen($target), $target, OC_USER::getUser()));
+ $query->execute(array(strlen($target), $target, OC_User::getUser()));
}
/**
@@ -295,10 +295,10 @@ class OC_SHARE {
* @param $arguments Array of arguments passed from OC_HOOK
*/
public static function deleteItem($arguments) {
- $source = "/".OC_USER::getUser()."/files".$arguments['path'];
+ $source = "/".OC_User::getUser()."/files".$arguments['path'];
$source = self::cleanPath($source);
$query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ?");
- $query->execute(array(strlen($source), $source, OC_USER::getUser()));
+ $query->execute(array(strlen($source), $source, OC_User::getUser()));
}
/**
@@ -306,9 +306,9 @@ class OC_SHARE {
* @param $arguments Array of arguments passed from OC_HOOK
*/
public static function renameItem($arguments) {
- $oldSource = "/".OC_USER::getUser()."/files".$arguments['oldpath'];
+ $oldSource = "/".OC_User::getUser()."/files".$arguments['oldpath'];
$oldSource = self::cleanPath($oldSource);
- $newSource = "/".OC_USER::getUser()."/files".$arguments['newpath'];
+ $newSource = "/".OC_User::getUser()."/files".$arguments['newpath'];
$newSource = self::cleanPath($newSource);
self::setSource($oldSource, $newSource);
}
diff --git a/apps/files_sharing/list.php b/apps/files_sharing/list.php
index 6c27899369d..0a11f438eb7 100644
--- a/apps/files_sharing/list.php
+++ b/apps/files_sharing/list.php
@@ -22,19 +22,18 @@
require_once('../../lib/base.php');
require_once('lib_share.php');
-require('template.php');
-if (!OC_USER::isLoggedIn()){
+if (!OC_User::isLoggedIn()){
header( "Location: ".OC_HELPER::linkTo( "index.php" ));
exit();
}
-OC_APP::setActiveNavigationEntry("files_sharing_list");
+OC_App::setActiveNavigationEntry("files_sharing_list");
-OC_UTIL::addScript("files_sharing", "list");
+OC_Util::addScript("files_sharing", "list");
-$tmpl = new OC_TEMPLATE("files_sharing", "list", "user");
-$tmpl->assign("shared_items", OC_SHARE::getMySharedItems());
+$tmpl = new OC_Template("files_sharing", "list", "user");
+$tmpl->assign("shared_items", OC_Share::getMySharedItems());
$tmpl->printPage();
?> \ No newline at end of file
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index 44a78277fc8..75767daf839 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -22,12 +22,10 @@
require_once( 'lib_share.php' );
-OC_FILESYSTEM::registerStorageType('shared','OC_FILESTORAGE_SHARED',array('datadir'=>'string'));
-
/**
* Convert target path to source path and pass the function call to the correct storage provider
*/
-class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
+class OC_Filestorage_Shared extends OC_Filestorage {
private $datadir;
private $sourcePaths = array();
@@ -37,7 +35,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
}
public function getInternalPath($path) {
- $mountPoint = OC_FILESYSTEM::getMountPoint($path);
+ $mountPoint = OC_Filesystem::getMountPoint($path);
$internalPath = substr($path, strlen($mountPoint));
return $internalPath;
}
@@ -47,7 +45,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
if (array_key_exists($target, $this->sourcePaths)) {
return $this->sourcePaths[$target];
} else {
- $source = OC_SHARE::getSource($target);
+ $source = OC_Share::getSource($target);
$this->sourcePaths[$target] = $source;
return $source;
}
@@ -60,7 +58,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
$source = $this->getSource($path);
if ($source) {
if ($this->is_writeable($path)) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->mkdir($this->getInternalPath($source));
}
}
@@ -69,14 +67,14 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function rmdir($path) {
// The folder will be removed from the database, but won't be deleted from the owner's filesystem
- OC_SHARE::unshareFromMySelf($this->datadir.$path);
+ OC_Share::unshareFromMySelf($this->datadir.$path);
}
public function opendir($path) {
if ($path == "" || $path == "/") {
global $FAKEDIRS;
$path = $this->datadir.$path;
- $sharedItems = OC_SHARE::getItemsInFolder($path);
+ $sharedItems = OC_Share::getItemsInFolder($path);
if (empty($sharedItems)) {
return false;
}
@@ -91,12 +89,12 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
} else {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
$dh = $storage->opendir($this->getInternalPath($source));
// Remove any duplicate or trailing '/'
$path = rtrim($this->datadir.$path, "/");
$path = preg_replace('{(/)\1+}', "/", $path);
- $modifiedItems = OC_SHARE::getItemsInFolder($source);
+ $modifiedItems = OC_Share::getItemsInFolder($source);
if ($modifiedItems && $dh) {
global $FAKEDIRS;
$sources = array();
@@ -147,7 +145,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
} else {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->is_dir($this->getInternalPath($source));
}
}
@@ -156,7 +154,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function is_file($path) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->is_file($this->getInternalPath($source));
}
}
@@ -181,7 +179,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
} else {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->stat($this->getInternalPath($source));
}
}
@@ -193,7 +191,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
} else {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->filetype($this->getInternalPath($source));
}
}
@@ -206,7 +204,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
} else {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->filesize($this->getInternalPath($source));
}
}
@@ -214,7 +212,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function getFolderSize($path) {
if ($path == "" || $path == "/") {
- $dbpath = $this->datadir;
+ $dbpath = OC_User::getUser()."/files/Share/";
} else {
$source = $this->getSource($path);
$dbpath = $this->getInternalPath($source);
@@ -250,7 +248,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
}
if ($size > 0) {
if ($path == "" || $path == "/") {
- $dbpath = OC_USER::getUser()."/files/Share/";
+ $dbpath = OC_User::getUser()."/files/Share/";
} else {
$source = $this->getSource($path);
$dbpath = $this->getInternalPath($source);
@@ -267,7 +265,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
}
public function is_writeable($path) {
- if ($path == "" || $path == "/" || OC_SHARE::getPermissions($this->datadir.$path) & OC_SHARE::WRITE) {
+ if ($path == "" || $path == "/" || OC_Share::getPermissions($this->datadir.$path) & OC_Share::WRITE) {
return true;
} else {
return false;
@@ -280,7 +278,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
} else {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->file_exists($this->getInternalPath($source));
}
}
@@ -289,7 +287,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function readfile($path) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->readfile($this->getInternalPath($source));
}
}
@@ -308,7 +306,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
} else {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->filectime($this->getInternalPath($source));
}
}
@@ -328,7 +326,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
} else {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->filemtime($this->getInternalPath($source));
}
}
@@ -348,7 +346,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
} else {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->fileatime($this->getInternalPath($source));
}
}
@@ -357,7 +355,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function file_get_contents($path) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->file_get_contents($this->getInternalPath($source));
}
}
@@ -366,7 +364,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
if ($this->is_writeable($path)) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->file_put_contents($this->getInternalPath($source), $data);
}
}
@@ -375,29 +373,29 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function unlink($path) {
$target = $this->datadir.$path;
// If the user has delete permission for the item, the source item will be deleted
- if (OC_SHARE::getPermissions($target) & OC_SHARE::DELETE) {
+ if (OC_Share::getPermissions($target) & OC_Share::DELETE) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->unlink($this->getInternalPath($source));
}
// The item will be removed from the database, but won't be touched on the owner's filesystem
} else {
// Check if the item is inside a shared folder
- if (OC_SHARE::getParentFolders($target)) {
+ if (OC_Share::getParentFolders($target)) {
// If entry for item already exists
- if (OC_SHARE::getItem($target)) {
- OC_SHARE::setTarget($target, "/");
+ if (OC_Share::getItem($target)) {
+ OC_Share::setTarget($target, "/");
} else {
- OC_SHARE::pullOutOfFolder($target, "/");
+ OC_Share::pullOutOfFolder($target, "/");
// If this is a folder being deleted, call setTarget in case there are any database entries inside the folder
if (self::is_dir($path)) {
- OC_SHARE::setTarget($target, "/");
+ OC_Share::setTarget($target, "/");
}
}
// Delete the database entry
} else {
- OC_SHARE::unshareFromMySelf($target);
+ OC_Share::unshareFromMySelf($target);
}
}
return true;
@@ -408,21 +406,21 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
if ($this->is_writeable($path1)) {
$source = $this->getSource($path1);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->rename($path1, $path2);
}
// The item will be renamed in the database, but won't be touched on the owner's filesystem
} else {
$oldTarget = $this->datadir.$path1;
$newTarget = $this->datadir.$path2;
- if (OC_SHARE::getItem($oldTarget)) {
- OC_SHARE::setTarget($oldTarget, $newTarget);
+ if (OC_Share::getItem($oldTarget)) {
+ OC_Share::setTarget($oldTarget, $newTarget);
// There is no entry in the database for the item, it must be inside a shared folder
} else {
- OC_SHARE::pullOutOfFolder($oldTarget, $newTarget);
+ OC_Share::pullOutOfFolder($oldTarget, $newTarget);
// If this is a folder being renamed, call setTarget in case there are any database entries inside the folder
if (self::is_dir($path1)) {
- OC_SHARE::setTarget($oldTarget, $newTarget);
+ OC_Share::setTarget($oldTarget, $newTarget);
}
}
}
@@ -445,7 +443,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function fopen($path, $mode) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->fopen($this->getInternalPath($source), $mode);
}
}
@@ -453,7 +451,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function toTmpFile($path) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->toTmpFile($this->getInternalPath($source));
}
}
@@ -462,7 +460,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
if ($this->is_writeable($path)) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->fromTmpFile($tmpFile, $this->getInternalPath($source));
}
} else {
@@ -473,7 +471,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function fromUploadedFile($tmpPath, $path) {
$source = $this->getSource($tmpPath);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->fromUploadedFile($this->getInternalPath($source), $path);
}
}
@@ -481,7 +479,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function getMimeType($path) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->getMimeType($this->getInternalPath($source));
}
}
@@ -489,7 +487,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function delTree($path) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->delTree($this->getInternalPath($source));
}
}
@@ -497,7 +495,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function find($path) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->find($this->getInternalPath($source));
}
}
@@ -505,7 +503,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function getTree($path) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->getTree($this->getInternalPath($source));
}
}
@@ -513,7 +511,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function hash($type, $path, $raw) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->hash($type, $this->getInternalPath($source), $raw);
}
}
@@ -521,7 +519,7 @@ class OC_FILESTORAGE_SHARED extends OC_FILESTORAGE {
public function free_space($path) {
$source = $this->getSource($path);
if ($source) {
- $storage = OC_FILESYSTEM::getStorage($source);
+ $storage = OC_Filesystem::getStorage($source);
return $storage->free_space($this->getInternalPath($source));
}
}
diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php
index 84d5dd17882..b86c69d0beb 100644
--- a/apps/media/ajax/api.php
+++ b/apps/media/ajax/api.php
@@ -52,22 +52,21 @@ if(!isset($arguments['album'])){
if(!isset($arguments['search'])){
$arguments['search']='';
}
-OC_MEDIA_COLLECTION::$uid=OC_USER::getUser();
+OC_MEDIA_COLLECTION::$uid=OC_User::getUser();
if($arguments['action']){
switch($arguments['action']){
case 'delete':
$path=$arguments['path'];
OC_MEDIA_COLLECTION::deleteSongByPath($path);
- $paths=explode(PATH_SEPARATOR,OC_PREFERENCES::getValue(OC_USER::getUser(),'media','paths',''));
+ $paths=explode(PATH_SEPARATOR,OC_Preferences::getValue(OC_User::getUser(),'media','paths',''));
if(array_search($path,$paths)!==false){
unset($paths[array_search($path,$paths)]);
- OC_PREFERENCES::setValue(OC_USER::getUser(),'media','paths',implode(PATH_SEPARATOR,$paths));
+ OC_Preferences::setValue(OC_User::getUser(),'media','paths',implode(PATH_SEPARATOR,$paths));
}
case 'get_collection':
$artists=OC_MEDIA_COLLECTION::getArtists();
foreach($artists as &$artist){
$artist['albums']=OC_MEDIA_COLLECTION::getAlbums($artist['artist_id']);
- $artistHasSongs=false;
foreach($artist['albums'] as &$album){
$album['songs']=OC_MEDIA_COLLECTION::getSongs($artist['artist_id'],$album['album_id']);
}
@@ -78,11 +77,11 @@ if($arguments['action']){
case 'scan':
set_time_limit(0); //recursive scan can take a while
$path=$arguments['path'];
- if(OC_FILESYSTEM::is_dir($path)){
- $paths=explode(PATH_SEPARATOR,OC_PREFERENCES::getValue(OC_USER::getUser(),'media','paths',''));
+ if(OC_Filesystem::is_dir($path)){
+ $paths=explode(PATH_SEPARATOR,OC_Preferences::getValue(OC_User::getUser(),'media','paths',''));
if(array_search($path,$paths)===false){
$paths[]=$path;
- OC_PREFERENCES::setValue(OC_USER::getUser(),'media','paths',implode(PATH_SEPARATOR,$paths));
+ OC_Preferences::setValue(OC_User::getUser(),'media','paths',implode(PATH_SEPARATOR,$paths));
}
}
echo OC_MEDIA_SCANNER::scanFolder($path);
@@ -103,7 +102,7 @@ if($arguments['action']){
case 'play':
ob_end_clean();
- $ftype=OC_FILESYSTEM::getMimeType( $arguments['path'] );
+ $ftype=OC_Filesystem::getMimeType( $arguments['path'] );
$songId=OC_MEDIA_COLLECTION::getSongByPath($arguments['path']);
OC_MEDIA_COLLECTION::registerPlay($songId);
@@ -112,9 +111,9 @@ if($arguments['action']){
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
- header('Content-Length: '.OC_FILESYSTEM::filesize($arguments['path']));
+ header('Content-Length: '.OC_Filesystem::filesize($arguments['path']));
- OC_FILESYSTEM::readfile($arguments['path']);
+ OC_Filesystem::readfile($arguments['path']);
exit;
}
}
diff --git a/apps/media/ajax/autoupdate.php b/apps/media/ajax/autoupdate.php
index 97733398225..ded1fd02bc3 100644
--- a/apps/media/ajax/autoupdate.php
+++ b/apps/media/ajax/autoupdate.php
@@ -33,7 +33,7 @@ error_log($_GET['autoupdate']);
$autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true');
error_log((integer)$autoUpdate);
-OC_PREFERENCES::setValue(OC_USER::getUser(),'media','autoupdate',(integer)$autoUpdate);
+OC_Preferences::setValue(OC_User::getUser(),'media','autoupdate',(integer)$autoUpdate);
echo json_encode( array( "status" => "success", "data" => $autoUpdate));
?> \ No newline at end of file
diff --git a/apps/media/appinfo/app.php b/apps/media/appinfo/app.php
index a41e228be4a..b29b842d23a 100644
--- a/apps/media/appinfo/app.php
+++ b/apps/media/appinfo/app.php
@@ -22,12 +22,42 @@
require_once('apps/media/lib_media.php');
-if(OC_APP::getCurrentApp()=='files'){
- OC_UTIL::addScript('media','files');
+if(OC_App::getCurrentApp()=='files'){
+ OC_Util::addScript('media','files');
}
-OC_APP::register( array( 'order' => 3, 'id' => 'media', 'name' => 'Media' ));
+OC_App::register( array( 'order' => 3, 'id' => 'media', 'name' => 'Media' ));
-OC_APP::addNavigationEntry( array( 'id' => 'media_index', 'order' => 2, 'href' => OC_HELPER::linkTo( 'media', 'index.php' ), 'icon' => OC_HELPER::imagePath( 'media', 'media.png' ), 'name' => 'Media' ));
-OC_APP::addSettingsPage( array( 'id' => 'media_settings', 'order' => 5, 'href' => OC_HELPER::linkTo( 'media', 'settings.php' ), 'name' => 'Media', 'icon' => OC_HELPER::imagePath( 'media', 'media.png' )));
+OC_App::addNavigationEntry( array( 'id' => 'media_index', 'order' => 2, 'href' => OC_Helper::linkTo( 'media', 'index.php' ), 'icon' => OC_Helper::imagePath( 'media', 'media.png' ), 'name' => 'Media' ));
+OC_App::addSettingsPage( array( 'id' => 'media_settings', 'order' => 5, 'href' => OC_Helper::linkTo( 'media', 'settings.php' ), 'name' => 'Media', 'icon' => OC_Helper::imagePath( 'media', 'media.png' )));
+
+// add subnavigations
+$entry = array(
+ 'id' => "media_playlist",
+ 'order'=>1,
+ 'href' => '#playlist',
+ 'name' => 'Playlist'
+);
+OC_App::addNavigationSubEntry( "media_index", $entry);
+$entry = array(
+ 'id' => "media_collection",
+ 'order'=>1,
+ 'href' => '#collection',
+ 'name' => 'Collection'
+);
+OC_App::addNavigationSubEntry( "media_index", $entry);
+// $entry = array(
+// 'id' => "media_recent",
+// 'order'=>1,
+// 'href' => '#recent',
+// 'name' => 'Most Recent'
+// );
+// OC_App::addNavigationSubEntry( "media_index", $entry);
+// $entry = array(
+// 'id' => "media_mostplayer",
+// 'order'=>1,
+// 'href' => '#mostplayed',
+// 'name' => 'Most Played'
+// );
+// OC_App::addNavigationSubEntry( "media_index", $entry);
?>
diff --git a/apps/media/css/music.css b/apps/media/css/music.css
index 92a4ea5e147..067da79446d 100644
--- a/apps/media/css/music.css
+++ b/apps/media/css/music.css
@@ -3,7 +3,15 @@
li button.right.prettybutton{font-size:1em;}
#collection{padding-top:1em;position:relative;width:70ex;float:left;}
#collection li.album,#collection li.song{margin-left:3ex;}
-#playlist{margin-left:72ex;}
-#playlist li.current{background-color:#ccc;}
+#playlist{width:100%;border-spacing:0;}
+#playlist th{background-color:#ccc; text-align:left; font-size:1.2em; padding:0.2em}
+#playlist tr.selected{background-color:#eee;}
+#playlist tr.current{background-color:#ccc;}
+#playlist td.time, #playlist th.time{text-align:right; padding-right:1em;}
#collection li button{float:right;}
#collection li,#playlist li{list-style-type:none;}
+.template{display:none}
+
+#collection{display:none}/*hide the collection initially*/
+#collection li{padding-right:10px;}
+img.remove{float:right;};
diff --git a/apps/media/css/player.css b/apps/media/css/player.css
index 7acb9f34c1b..94dd4d63605 100644
--- a/apps/media/css/player.css
+++ b/apps/media/css/player.css
@@ -1,4 +1,4 @@
-#jp-interface{position:fixed;z-index:100;width:25em;left:201px;top:-20px;height:80px;border-bottom:none;}
+#jp-interface{position:fixed;z-index:100;width:25em;left:201px;top:-20px;height:60px;border-bottom:none;}
#jp-interface div.player{height:0px}
#jp-interface ul.jp-controls{list-style-type:none;padding:0;}
#jp-interface ul.jp-controls li{display:inline;}
diff --git a/apps/media/index.php b/apps/media/index.php
index 26e008acab5..43423d27de6 100644
--- a/apps/media/index.php
+++ b/apps/media/index.php
@@ -25,27 +25,33 @@
require_once('../../lib/base.php');
// Check if we are a user
-if( !OC_USER::isLoggedIn()){
- header( "Location: ".OC_HELPER::linkTo( '', 'index.php' ));
+if( !OC_User::isLoggedIn()){
+ header( "Location: ".OC_Helper::linkTo( '', 'index.php' ));
exit();
}
require_once('lib_collection.php');
require_once('lib_scanner.php');
-require_once('template.php');
-OC_UTIL::addScript('media','player');
-OC_UTIL::addScript('media','music');
-OC_UTIL::addScript('media','jquery.jplayer.min');
-OC_UTIL::addStyle('media','player');
-OC_UTIL::addStyle('media','music');
+OC_Util::addScript('media','player');
+OC_Util::addScript('media','music');
+OC_Util::addScript('media','playlist');
+OC_Util::addScript('media','collection');
+OC_Util::addScript('media','jquery.jplayer.min');
+OC_Util::addStyle('media','player');
+OC_Util::addStyle('media','music');
-OC_APP::setActiveNavigationEntry( 'media_index' );
+OC_App::setActiveNavigationEntry( 'media_playlist' );
-$tmpl = new OC_TEMPLATE( 'media', 'music', 'user' );
+$tmpl = new OC_Template( 'media', 'music', 'user' );
+
+$player = new OC_Template( 'media', 'player');
+$playlist = new OC_Template( 'media', 'playlist');
+$collection= new OC_Template( 'media', 'collection');
-$player = new OC_TEMPLATE( 'media', 'player');
$tmpl->assign('player',$player->fetchPage());
+$tmpl->assign('playlist',$playlist->fetchPage());
+$tmpl->assign('collection',$collection->fetchPage());
$tmpl->printPage();
?>
diff --git a/apps/media/js/collection.js b/apps/media/js/collection.js
new file mode 100644
index 00000000000..b8fd515ba60
--- /dev/null
+++ b/apps/media/js/collection.js
@@ -0,0 +1,150 @@
+Collection={
+ artists:[],
+ loaded:false,
+ loading:false,
+ loadedListeners:[],
+ load:function(ready){
+ if(ready){
+ Collection.loadedListeners.push(ready);
+ }
+ if(!Collection.loading){
+ Collection.loading=true;
+ $.ajax({
+ url: OC.linkTo('media','ajax/api.php')+'?action=get_collection',
+ dataType: 'json',
+ success: function(collection){
+ Collection.artists=collection;
+
+ //set the album and artist fieds for the songs
+ for(var i=0;i<collection.length;i++){
+ var artist=collection[i];
+ for(var j=0;j<artist.albums.length;j++){
+ var album=artist.albums[j]
+ for(var w=0;w<album.songs.length;w++){
+ album.songs[w].album_name=album.album_name;
+ album.songs[w].artist_name=artist.artist_name;
+ }
+ }
+ }
+
+ Collection.loaded=true;
+ Collection.loading=false;
+ for(var i=0;i<Collection.loadedListeners.length;i++){
+ Collection.loadedListeners[i]();
+ }
+
+ }
+ });
+ }
+ },
+ display:function(){
+ if(Collection.parent){
+ Collection.parent.show();
+ }
+ if(!Collection.loaded){
+ Collection.load(Collection.display)
+ }else{
+ if(Collection.parent){
+ Collection.parent.children('li.artist').remove();
+ var template=Collection.parent.children('li.template');
+ for(var i=0;i<Collection.artists.length;i++){
+ var artist=Collection.artists[i];
+ var li=template.clone();
+ li.data('artist',artist);
+ li.removeClass('template');
+ li.addClass('artist');
+ li.data('type','artist');
+ li.children('span').text(artist.artist_name);
+ Collection.addButtons(li);
+ Collection.parent.append(li);
+ }
+ }
+ }
+ },
+ parent:null,
+ hide:function(){
+ if(Collection.parent){
+ Collection.parent.hide();
+ }
+ },
+ showAlbums:function(artistLi){
+ $('ul.albums').parent().removeClass('active');
+ $('ul.albums').remove();
+ var artist=artistLi.data('artist');
+ if(artist){
+ var template=Collection.parent.children('li.template');
+ var ul=$('<ul class="albums"></ul>');
+ for(var i=0;i<artist.albums.length;i++){
+ var li=template.clone();
+ var album=artist.albums[i];
+ li.removeClass('template');
+ li.addClass('album');
+ li.data('album',album);
+ li.data('type','album');
+ li.children('span').text(album.album_name);
+ Collection.addButtons(li);
+ ul.append(li);
+ }
+ artistLi.append(ul);
+ }
+ },
+ showSongs:function(albumLi){
+ $('ul.songs').parent().removeClass('active');
+ $('ul.songs').remove();
+ var album=albumLi.data('album');
+ var template=Collection.parent.children('li.template');
+ var ul=$('<ul class="songs"></ul>');
+ for(var i=0;i<album.songs.length;i++){
+ var li=template.clone();
+ var song=album.songs[i];
+ li.removeClass('template');
+ li.addClass('song');
+ li.data('song',song);
+ li.data('type','song');
+ li.children('span').text(song.song_name);
+ Collection.addButtons(li);
+ ul.append(li);
+ }
+ albumLi.append(ul);
+ },
+ registerPlay:function(){
+ var item=PlayList.items[PlayList.current];
+ for(var i=0;i<Collection.artists.length;i++){
+ var artist=Collection.artists[i];
+ for(var j=0;j<artist.albums.length;j++){
+ var album=artist.albums[j]
+ for(var w=0;w<album.songs.length;w++){
+ var song=album.songs[w];
+ if(song.song_name==item.name && song.artist_name==item.artist && song.album_name==item.album){
+ song.song_playcount++;
+ }
+ }
+ }
+ }
+ },
+ addButtons:function(parent){
+ parent.children('button.add').click(function(){
+ var type=$(this).parent().data('type');
+ PlayList.add($(this).parent().data(type));
+ });
+ parent.children('button.play').click(function(){
+ var type=$(this).parent().data('type');
+ var oldSize=PlayList.items.length;
+ PlayList.add($(this).parent().data(type));
+ PlayList.play(oldSize);
+ });
+ }
+}
+
+$(document).ready(function(){
+ Collection.parent=$('#collection');
+ Collection.load();
+ $('#collection li.artist>span').live('click',function(){
+ $(this).parent().toggleClass('active');
+ Collection.showAlbums($(this).parent());
+ });
+ $('#collection li.album>span').live('click',function(){
+ $(this).parent().toggleClass('active');
+ Collection.showSongs($(this).parent());
+ });
+});
diff --git a/apps/media/js/music.js b/apps/media/js/music.js
index ba34e66c3ba..b2464c3842f 100644
--- a/apps/media/js/music.js
+++ b/apps/media/js/music.js
@@ -1,85 +1,24 @@
$(document).ready(function(){
//load the collection
- $.ajax({
- url: OC.linkTo('media','ajax/api.php')+'?action=get_collection',
- dataType: 'json',
- success: function(collection){
- displayCollection(collection);
- }
+ $('#plugins a[href="#collection"]').click(function(){
+ $('#plugins li.subentry a.active').removeClass('active');
+ $(this).addClass('active');
+ PlayList.hide();
+ Collection.display();
});
-});
-
-function displayCollection(collection){
- $('#collection').data('collection',collection);
- $.each(collection,function(index,artist){
- var artistNode=$('<li class="artist">'+artist.artist_name+'<button class="add">Add</button><ul/></li>');
- artistNode.data('name',artist.artist_name);
- artistNode.data('stuff',artist);
- $('#collection>ul').append(artistNode);
- $.each(artist.albums,function(index,album){
- var albumNode=$('<li class="album">'+album.album_name+'<button class="add">Add</button><ul/></li>');
- albumNode.data('name',album.album_name);
- albumNode.data('stuff',album);
- artistNode.children('ul').append(albumNode);
- $.each(album.songs,function(index,song){
- var songNode=$('<li class="song">'+song.song_name+'<button class="add">Add</button></li>');
- song.artist_name=artist.artist_name;
- song.album_name=album.album_name;
- songNode.data('name',song.song_name);
- songNode.data('stuff',song);
- albumNode.children('ul').append(songNode);
- });
- });
- });
- $('li.album').hide();
- $('li.song').hide();
- $('li.artist').click(function(){
- $(this).children().children().slideToggle();
- return false;
- });
- $('li.album').click(function(){
- $(this).children().children().slideToggle();
- return false;
- });
- $('li.song').click(function(){
- return false;
+ $('#plugins a[href="#playlist"]').click(function(){
+ $('#plugins li.subentry a.active').removeClass('active');
+ $(this).addClass('active');
+ PlayList.render();
+ Collection.hide();
});
- $('li>button.add').click(function(){
- PlayList.add($(this).parent().data('stuff'));
- PlayList.render($('#playlist'));
- return false;
- });
- if(window.location.href.indexOf('#')>-1){//autoplay passed arist/album/song
- var vars=getUrlVars();
- var play;
- if(vars['artist']){
- $.each(collection,function(index,artist){
- if(artist.artist_name==vars['artist']){
- play=artist;
- if(vars['album']){
- $.each(artist.albums,function(index,album){
- if(album.album_name==vars['album']){
- play=album;
- if(vars['song']){
- $.each(album.songs,function(index,song){
- if(song.song_name==vars['song']){
- play=song;
- }
- });
- }
- }
- });
- }
- }
- });
- }
- PlayList.add(play);
- PlayList.play();
- }else{
- PlayList.init();
+ var tab=window.location.href.slice(window.location.href.indexOf('#') + 1);
+ if(tab=='collection'){
+ $('#plugins a[href="#collection"]').trigger('click');
}
-
-}
+});
+
+
function getUrlVars(){
var vars = [], hash;
@@ -94,7 +33,7 @@ function getUrlVars(){
}
function musicTypeFromFile(file){
- var extention=file.substr(file.indexOf('.')+1);
+ var extention=file.split('.').pop();
if(extention=='ogg'){
return 'oga'
}
diff --git a/apps/media/js/player.js b/apps/media/js/player.js
index f76628110a8..2e910bc0d59 100644
--- a/apps/media/js/player.js
+++ b/apps/media/js/player.js
@@ -3,13 +3,13 @@ var PlayList={
current:-1,
items:[],
player:null,
- parent:null,
next:function(){
var next=PlayList.current+1;
if(next>=PlayList.items.length){
next=0;
}
PlayList.play(next);
+ PlayList.render();
},
previous:function(){
var next=PlayList.current-1;
@@ -17,6 +17,7 @@ var PlayList={
next=PlayList.items.length-1;
}
PlayList.play(next);
+ PlayList.render();
},
play:function(index){
if(index==null){
@@ -30,7 +31,11 @@ var PlayList={
PlayList.init(PlayList.items[index].type,PlayList.play);
}else{
PlayList.player.jPlayer("setMedia", PlayList.items[PlayList.current]);
+ PlayList.items[index].playcount++;
PlayList.player.jPlayer("play");
+ if(Collection){
+ Collection.registerPlay();
+ }
}
}else{
PlayList.init(PlayList.items[index].type,PlayList.play);
@@ -66,6 +71,9 @@ var PlayList={
});
},
add:function(song){
+ if(!song){
+ return;
+ }
if(song.substr){//we are passed a string, asume it's a url to a song
PlayList.addFile(song);
}
@@ -81,7 +89,7 @@ var PlayList={
}
if(song.song_name){
var type=musicTypeFromFile(song.song_path);
- var item={name:song.song_name,type:type,artist:song.artist_name,album:song.album_name};
+ var item={name:song.song_name,type:type,artist:song.artist_name,album:song.album_name,length:song.song_length,playcount:song.song_playcount};
item[type]=PlayList.urlBase+encodeURIComponent(song.song_path);
PlayList.items.push(item);
}
@@ -92,30 +100,9 @@ var PlayList={
item[type]=PlayList.urlBase+encodeURIComponent(path);
PlayList.items.push(item);
},
- render:function(parent){//parent should be an ul element
- if(parent){
- PlayList.parent=parent;
- }else{
- parent=PlayList.parent;
- }
- if(parent){
- parent.empty();
- for(var i=0;i<PlayList.items.length;i++){
- var song=PlayList.items[i];
- var item=$('<li>'+song.artist+' - '+song.album+' - '+song.name+'</li>');
- item.data('artist',song.artist);
- item.data('album',song.album);
- item.data('name',song.name);
- item.data('index',i);
- item.click(function(){
- PlayList.play($(this).data('index'));
- PlayList.render();
- });
- if(i==PlayList.current){
- item.addClass('current');
- }
- parent.append(item);
- }
- }
- }
+ remove:function(index){
+ PlayList.items.splice(index,1);
+ PlayList.render();
+ },
+ render:function(){}
}
diff --git a/apps/media/js/playlist.js b/apps/media/js/playlist.js
new file mode 100644
index 00000000000..54fe5b792e7
--- /dev/null
+++ b/apps/media/js/playlist.js
@@ -0,0 +1,141 @@
+PlayList.render=function(){
+ $('#playlist').show();
+ PlayList.parent.empty();
+ for(var i=0;i<PlayList.items.length;i++){
+ var tr=PlayList.template.clone();
+ var item=PlayList.items[i];
+ if(i==PlayList.current){
+ tr.addClass('current');
+ }
+ tr.removeClass('template');
+ tr.data('name',item.name);
+ tr.data('artist',item.artist);
+ tr.data('album',item.album);
+ tr.data('time',item.length);
+ tr.data('plays',item.playcount);
+ tr.children('td.name').children('span').text(item.name);
+ tr.children('td.artist').text(item.artist);
+ tr.children('td.album').text(item.album);
+ var secconds=(item.length%60);
+ if(secconds<10){
+ secconds='0'+secconds;
+ }
+ var length=Math.floor(item.length/60)+':'+secconds;
+ tr.children('td.time').text(length);
+ tr.children('td.plays').text(item.playcount);
+ tr.data('index',i);
+ tr.click(function(){
+ PlayList.play($(this).data('index'));
+ PlayList.render();
+ });
+ tr.hover(function(){
+ var button=$('<img class="remove" title="Remove"/>');
+ button.attr('src',OC.imagePath('core','actions/delete'));
+ $(this).children().last().append(button);
+ button.click(function(event){
+ event.stopPropagation();
+ event.preventDefault();
+ var index=$(this).parent().parent().data('index');
+ PlayList.remove(index);
+ });
+ },function(){
+ $(this).children().last().children('img.remove').remove();
+ });
+ tr.children('td.name').children('input').click(function(event){
+ event.stopPropagation();
+ if($(this).attr('checked')){
+ $(this).parent().parent().addClass('selected');
+ if($('tbody td.name input:checkbox').length==$('tbody td.name input:checkbox:checked').length){
+ $('#selectAll').attr('checked',true);
+ }
+ }else{
+ $(this).parent().parent().removeClass('selected');
+ $('#selectAll').attr('checked',false);
+ }
+ procesSelection();
+ });
+ PlayList.parent.append(tr);
+ }
+}
+PlayList.getSelected=function(){
+ return $('tbody td.name input:checkbox:checked').parent().parent();
+}
+PlayList.hide=function(){
+ $('#playlist').hide();
+}
+
+$(document).ready(function(){
+ PlayList.parent=$('#playlist tbody');
+ PlayList.template=$('#playlist tr.template');
+ $('#selectAll').click(function(){
+ if($(this).attr('checked')){
+ // Check all
+ $('tbody td.name input:checkbox').attr('checked', true);
+ $('tbody td.name input:checkbox').parent().parent().addClass('selected');
+ }else{
+ // Uncheck all
+ $('tbody td.name input:checkbox').attr('checked', false);
+ $('tbody td.name input:checkbox').parent().parent().removeClass('selected');
+ }
+ procesSelection();
+ });
+});
+
+function procesSelection(){
+ var selected=PlayList.getSelected();
+ if(selected.length==0){
+ $('th.name span').text('Name');
+ $('th.artist').text('Artist');
+ $('th.album').text('Album');
+ $('th.time').text('Time');
+ $('th.plays').empty();
+ $('th.plays').text('Plays');
+ }else{
+ var name=selected.length+' selected';
+ var artist=$(selected[0]).data('artist');
+ var album=$(selected[0]).data('album');
+ var time=$(selected[0]).data('time');
+ var plays=$(selected[0]).data('plays');
+ for(var i=1;i<selected.length;i++){
+ var item=$(selected[i]);
+ if(artist!='mixed' && item.data('artist')!==artist){
+ artist='mixed'
+ }
+ if(album!='mixed' && item.data('album')!==album){
+ album='mixed'
+ }
+ if(time!='mixed' && item.data('time')!==time){
+ time='mixed'
+ }
+ if(plays!='mixed' && item.data('plays')!==plays){
+ plays='mixed'
+ }
+ }
+ $('th.name span').text(name);
+ $('th.artist').text(artist);
+ $('th.album').text(album);
+ if(time!='mixed'){
+ var secconds=(time%60);
+ if(secconds<10){
+ secconds='0'+secconds;
+ }
+ var time=Math.floor(time/60)+':'+secconds;
+ }
+ $('th.time').text(time);
+ $('th.plays').text(plays);
+ var button=$('<img class="remove" title="Remove"/>');
+ button.attr('src',OC.imagePath('core','actions/delete'));
+ $('th.plays').append(button);
+ button.click(function(event){
+ event.stopPropagation();
+ event.preventDefault();
+ PlayList.getSelected().each(function(index,element){
+ var index=$(element).data('index');
+ PlayList.items[index]=null;
+ });
+ PlayList.items=PlayList.items.filter(function(item){return item!==null});
+ PlayList.render();
+ procesSelection();
+ });
+ }
+} \ No newline at end of file
diff --git a/apps/media/lib_ampache.php b/apps/media/lib_ampache.php
index 3cd9bd4ab26..97dc004e218 100644
--- a/apps/media/lib_ampache.php
+++ b/apps/media/lib_ampache.php
@@ -319,11 +319,11 @@ class OC_MEDIA_AMPACHE{
return;
}
if($song=OC_MEDIA_COLLECTION::getSong($params['song'])){
- OC_UTIL::setupFS($song["song_user"]);
+ OC_Util::setupFS($song["song_user"]);
- header('Content-type: '.OC_FILESYSTEM::getMimeType($song['song_path']));
+ header('Content-type: '.OC_Filesystem::getMimeType($song['song_path']));
header('Content-Length: '.$song['song_size']);
- OC_FILESYSTEM::readfile($song['song_path']);
+ OC_Filesystem::readfile($song['song_path']);
}
}
diff --git a/apps/media/lib_collection.php b/apps/media/lib_collection.php
index 278e450b778..5a16aaee848 100644
--- a/apps/media/lib_collection.php
+++ b/apps/media/lib_collection.php
@@ -125,10 +125,10 @@ class OC_MEDIA_COLLECTION{
}
$query=OC_DB::prepare("SELECT DISTINCT *PREFIX*media_artists.artist_name AS name , *PREFIX*media_artists.artist_id AS id FROM *PREFIX*media_artists
INNER JOIN *PREFIX*media_songs ON *PREFIX*media_artists.artist_id=*PREFIX*media_songs.song_artist WHERE artist_name LIKE ? AND *PREFIX*media_songs.song_user=?");
- $artists=$query->execute(array($search,OC_USER::getUser()))->fetchAll();
+ $artists=$query->execute(array($search,OC_User::getUser()))->fetchAll();
$result=array();
foreach($artists as $artist){
- $result[$artist['id']]=array('artist_name'=>$artist['name'],'artist_id'=>$artist['id']);
+ $result[]=array('artist_name'=>$artist['name'],'artist_id'=>$artist['id']);
}
return $result;
}
@@ -179,7 +179,7 @@ class OC_MEDIA_COLLECTION{
$result=array();
foreach($albums as $album){
if(count(self::getSongs($album['album_artist'],$album['album_id']))){
- $result[$album['album_id']]=$album;
+ $result[]=$album;
}
}
return $result;
diff --git a/apps/media/lib_media.php b/apps/media/lib_media.php
index 9c3d0622360..67d111936f1 100644
--- a/apps/media/lib_media.php
+++ b/apps/media/lib_media.php
@@ -22,20 +22,20 @@
*/
//we need to have the sha256 hash of passwords for ampache
-OC_HOOK::connect('OC_USER','post_login','OC_MEDIA','loginListener');
+OC_Hook::connect('OC_User','post_login','OC_MEDIA','loginListener');
//connect to the filesystem for auto updating if configured
-if(OC_PREFERENCES::getValue(OC_USER::getUser(),'media','autoupdate',false)){
- OC_HOOK::connect('OC_FILESYSTEM','post_write','OC_MEDIA','updateFile');
+if(OC_Preferences::getValue(OC_User::getUser(),'media','autoupdate',false)){
+ OC_Hook::connect('OC_Filesystem','post_write','OC_MEDIA','updateFile');
}
//listen for file deletions to clean the database if a song is deleted
-OC_HOOK::connect('OC_FILESYSTEM','delete','OC_MEDIA','deleteFile');
+OC_Hook::connect('OC_Filesystem','delete','OC_MEDIA','deleteFile');
class OC_MEDIA{
/**
* get the sha256 hash of the password needed for ampache
- * @param array $params, parameters passed from OC_HOOK
+ * @param array $params, parameters passed from OC_Hook
*/
public static function loginListener($params){
if(isset($_POST['user']) and $_POST['password']){
@@ -56,7 +56,7 @@ class OC_MEDIA{
*/
public static function updateFile($params){
$path=$params['path'];
- $folderNames=explode(PATH_SEPARATOR,OC_PREFERENCES::getValue(OC_USER::getUser(),'media','paths',''));
+ $folderNames=explode(PATH_SEPARATOR,OC_Preferences::getValue(OC_User::getUser(),'media','paths',''));
foreach($folderNames as $folder){
if(substr($path,0,strlen($folder))==$folder){
require_once 'lib_scanner.php';
@@ -82,7 +82,7 @@ class OC_MEDIA{
}
}
-class OC_MediaSearchProvider extends OC_SearchProvider{
+class OC_MediaSearchProvider extends OC_Search_Provider{
function search($query){
require_once('lib_collection.php');
$artists=OC_MEDIA_COLLECTION::getArtists($query);
@@ -90,18 +90,18 @@ class OC_MediaSearchProvider extends OC_SearchProvider{
$songs=OC_MEDIA_COLLECTION::getSongs(0,0,$query);
$results=array();
foreach($artists as $artist){
- $results[]=new OC_SearchResult($artist['artist_name'],'',OC_HELPER::linkTo( 'apps/media', 'index.php#artist='.urlencode($artist['artist_name']) ),'Music');
+ $results[]=new OC_Search_Result($artist['artist_name'],'',OC_Helper::linkTo( 'apps/media', 'index.php#artist='.urlencode($artist['artist_name']) ),'Music');
}
foreach($albums as $album){
$artist=urlencode(OC_MEDIA_COLLECTION::getArtistName($album['album_artist']));
- $results[]=new OC_SearchResult($album['album_name'],'',OC_HELPER::linkTo( 'apps/media', 'index.php#artist='.$artist.'&album='.urlencode($album['album_name']) ),'Music');
+ $results[]=new OC_Search_Result($album['album_name'],'',OC_Helper::linkTo( 'apps/media', 'index.php#artist='.$artist.'&album='.urlencode($album['album_name']) ),'Music');
}
foreach($songs as $song){
$minutes=floor($song['song_length']/60);
$secconds=$song['song_length']%60;
$artist=urlencode(OC_MEDIA_COLLECTION::getArtistName($song['song_artist']));
$album=urlencode(OC_MEDIA_COLLECTION::getalbumName($song['song_album']));
- $results[]=new OC_SearchResult($song['song_name'],"$minutes:$secconds",OC_HELPER::linkTo( 'apps/media', 'index.php#artist='.$artist.'&album='.$album.'&song='.urlencode($song['song_name']) ),'Music');
+ $results[]=new OC_Search_Result($song['song_name'],"$minutes:$secconds",OC_Helper::linkTo( 'apps/media', 'index.php#artist='.$artist.'&album='.$album.'&song='.urlencode($song['song_name']) ),'Music');
}
return $results;
}
diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php
index 6ad04e7a1be..e3cb2f051ce 100644
--- a/apps/media/lib_scanner.php
+++ b/apps/media/lib_scanner.php
@@ -37,15 +37,15 @@ class OC_MEDIA_SCANNER{
* @return int the number of songs found
*/
public static function scanFolder($path){
- if (OC_FILESYSTEM::is_dir($path)) {
+ if (OC_Filesystem::is_dir($path)) {
$songs=0;
- if ($dh = OC_FILESYSTEM::opendir($path)) {
+ if ($dh = OC_Filesystem::opendir($path)) {
while (($filename = readdir($dh)) !== false) {
if($filename<>'.' and $filename<>'..' and substr($filename,0,1)!='.'){
$file=$path.'/'.$filename;
- if(OC_FILESYSTEM::is_dir($file)){
+ if(OC_Filesystem::is_dir($file)){
$songs+=self::scanFolder($file);
- }elseif(OC_FILESYSTEM::is_file($file)){
+ }elseif(OC_Filesystem::is_file($file)){
if(self::scanFile($file)){
$songs++;
}
@@ -53,7 +53,7 @@ class OC_MEDIA_SCANNER{
}
}
}
- }elseif(OC_FILESYSTEM::is_file($path)){
+ }elseif(OC_Filesystem::is_file($path)){
$songs=1;
self::scanFile($path);
}else{
@@ -68,8 +68,8 @@ class OC_MEDIA_SCANNER{
* @return boolean
*/
public static function scanFile($path){
- $file=OC_FILESYSTEM::getLocalFile($path);
- if(substr($path,-3)=='mp3' and OC_HELPER::canExecute("id3info") and OC_HELPER::canExecute("mp3info")){//use the command line tool id3info if possible
+ $file=OC_Filesystem::getLocalFile($path);
+ if(substr($path,-3)=='mp3' and OC_Helper::canExecute("id3info") and OC_Helper::canExecute("mp3info")){//use the command line tool id3info if possible
$output=array();
$size=filesize($file);
$length=0;
diff --git a/apps/media/settings.php b/apps/media/settings.php
index 30276601a2d..0563bc38fb3 100644
--- a/apps/media/settings.php
+++ b/apps/media/settings.php
@@ -24,20 +24,19 @@
require_once('../../lib/base.php');
-if( !OC_USER::isLoggedIn()){
- header( "Location: ".OC_HELPER::linkTo( "index.php" ));
+if( !OC_User::isLoggedIn()){
+ header( "Location: ".OC_Helper::linkTo( "index.php" ));
exit();
}
-require( 'template.php' );
require( 'lib_collection.php' );
-OC_UTIL::addStyle('media','style');
-OC_UTIL::addScript('media','settings');
+OC_Util::addStyle('media','style');
+OC_Util::addScript('media','settings');
-OC_APP::setActiveNavigationEntry( 'media_settings' );
+OC_App::setActiveNavigationEntry( 'media_settings' );
-$folderNames=explode(PATH_SEPARATOR,OC_PREFERENCES::getValue($_SESSION['user_id'],'media','paths',''));
+$folderNames=explode(PATH_SEPARATOR,OC_Preferences::getValue($_SESSION['user_id'],'media','paths',''));
$folders=array();
foreach($folderNames as $folder){
if($folder){
@@ -45,9 +44,9 @@ foreach($folderNames as $folder){
}
}
-$tmpl = new OC_TEMPLATE( 'media', 'settings', 'admin' );
+$tmpl = new OC_Template( 'media', 'settings', 'admin' );
$tmpl->assign('folders',$folders);
-$tmpl->assign('autoupdate',OC_PREFERENCES::getValue($_SESSION['user_id'],'media','autoupdate',false));
+$tmpl->assign('autoupdate',OC_Preferences::getValue($_SESSION['user_id'],'media','autoupdate',false));
$tmpl->printPage();
?>
diff --git a/apps/media/templates/collection.php b/apps/media/templates/collection.php
new file mode 100644
index 00000000000..e2c256a6480
--- /dev/null
+++ b/apps/media/templates/collection.php
@@ -0,0 +1,10 @@
+<ul id='collection'>
+ <li class='artist'>
+ <img src="<?php echo image_path('files','loading.gif') ?>" alt='loading'/>Loading Collection...
+ </li>
+ <li class='template'>
+ <span></span>
+ <button class='add'>Add</button>
+ <button class='play'>Play</button>
+ </li>
+</ul> \ No newline at end of file
diff --git a/apps/media/templates/music.php b/apps/media/templates/music.php
index 47ad64fa7c6..7a61d59c9ba 100644
--- a/apps/media/templates/music.php
+++ b/apps/media/templates/music.php
@@ -1,3 +1,3 @@
<?php echo $_['player'];?>
-<div id='collection'><ul/></div>
-<ul id="playlist"/> \ No newline at end of file
+<?php echo $_['collection'];?>
+<?php echo $_['playlist'];?>
diff --git a/apps/media/templates/playlist.php b/apps/media/templates/playlist.php
new file mode 100644
index 00000000000..bdc6ef59bb0
--- /dev/null
+++ b/apps/media/templates/playlist.php
@@ -0,0 +1,30 @@
+<table id='playlist'>
+ <thead>
+ <tr>
+ <th class='name'><input id='selectAll' type='checkbox'>Name</th>
+ <th class='artist'>Artist</th>
+ <th class='album'>Album</th>
+ <th class='time'>Time</th>
+ <th class='plays'>Plays</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ The playlist is empty
+ </td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr class='template'>
+ <td class='name'>
+ <input type='checkbox'>
+ <span></span>
+ </td>
+ <td class='artist'></td>
+ <td class='album'></td>
+ <td class='time'></td>
+ <td class='plays'></td>
+ </tr>
+ </tfoot>
+</table> \ No newline at end of file
diff --git a/apps/media/tomahawk.php b/apps/media/tomahawk.php
index 873a4e2092c..bf0c2c2a756 100644
--- a/apps/media/tomahawk.php
+++ b/apps/media/tomahawk.php
@@ -28,8 +28,8 @@ require_once('lib_collection.php');
$user=isset($_POST['user'])?$_POST['user']:'';
$pass=isset($_POST['pass'])?$_POST['pass']:'';
-if(OC_USER::checkPassword($user,$pass)){
- OC_UTIL::setupFS($user);
+if(OC_User::checkPassword($user,$pass)){
+ OC_Util::setupFS($user);
OC_MEDIA_COLLECTION::$uid=$user;
}else{
exit;
@@ -40,14 +40,14 @@ if(isset($_POST['play']) and $_POST['play']=='true'){
exit;
}
$song=OC_MEDIA_COLLECTION::getSong($_POST['song']);
- $ftype=OC_FILESYSTEM::getMimeType( $song['song_path'] );
+ $ftype=OC_Filesystem::getMimeType( $song['song_path'] );
header('Content-Type:'.$ftype);
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
- header('Content-Length: '.OC_FILESYSTEM::filesize($song['song_path']));
+ header('Content-Length: '.OC_Filesystem::filesize($song['song_path']));
- OC_FILESYSTEM::readfile($song['song_path']);
+ OC_Filesystem::readfile($song['song_path']);
}
$artist=isset($_POST['artist'])?'%'.$_POST['artist'].'%':'';
@@ -59,7 +59,7 @@ $album=OC_MEDIA_COLLECTION::getAlbumId($album,$artist);
$songs=OC_MEDIA_COLLECTION::getSongs($artist,$album,$song);
-$baseUrl=OC_UTIL::getServerURL().OC_HELPER::linkTo('media','tomahawk.php');
+$baseUrl=OC_Util::getServerURL().OC_Helper::linkTo('media','tomahawk.php');
$results=array();
foreach($songs as $song) {
@@ -68,7 +68,7 @@ foreach($songs as $song) {
'album' => OC_MEDIA_COLLECTION::getAlbumName($song['song_album']),
'track' => $song['song_name'],
'source' => 'ownCloud',
- 'mimetype' => OC_FILESYSTEM::getMimeType($song['song_path']),
+ '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),
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php
index 67b61989f7f..7f20372ea8d 100644
--- a/apps/user_ldap/appinfo/app.php
+++ b/apps/user_ldap/appinfo/app.php
@@ -27,13 +27,13 @@ require_once('apps/user_ldap/user_ldap.php');
define("OC_USER_BACKEND_LDAP_DEFAULT_PORT", 389);
// register user backend
-OC_USER::useBackend( "LDAP" );
+OC_User::useBackend( "LDAP" );
// add settings page to navigation
$entry = array(
'id' => "user_ldap_settings",
'order'=>1,
- 'href' => OC_HELPER::linkTo( "user_ldap", "settings.php" ),
+ 'href' => OC_Helper::linkTo( "user_ldap", "settings.php" ),
'name' => 'LDAP'
);
-OC_APP::addNavigationSubEntry( "core_users", $entry);
+OC_App::addNavigationSubEntry( "core_users", $entry);
diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php
index f7aff1b4614..cae3542a65b 100644
--- a/apps/user_ldap/settings.php
+++ b/apps/user_ldap/settings.php
@@ -22,10 +22,9 @@
*/
require_once('../../lib/base.php');
-require( 'template.php' );
-if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){
- header( "Location: ".OC_HELPER::linkTo( "index.php" ));
+if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){
+ header( "Location: ".OC_Helper::linkTo( "index.php" ));
exit();
}
@@ -33,20 +32,20 @@ $params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base
foreach($params as $param){
if(isset($_POST[$param])){
- OC_APPCONFIG::setValue('user_ldap', $param, $_POST[$param]);
+ OC_Appconfig::setValue('user_ldap', $param, $_POST[$param]);
}
}
-OC_APP::setActiveNavigationEntry( "user_ldap_settings" );
+OC_App::setActiveNavigationEntry( "user_ldap_settings" );
// fill template
-$tmpl = new OC_TEMPLATE( 'user_ldap', 'settings', 'admin' );
+$tmpl = new OC_Template( 'user_ldap', 'settings', 'admin' );
foreach($params as $param){
- $value = OC_APPCONFIG::getValue('user_ldap', $param,'');
+ $value = OC_Appconfig::getValue('user_ldap', $param,'');
$tmpl->assign($param, $value);
}
// ldap_port has a default value
-$tmpl->assign( 'ldap_port', OC_APPCONFIG::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT));
+$tmpl->assign( 'ldap_port', OC_Appconfig::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT));
$tmpl->printPage();
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index a2fd48cdf06..54fc51fe0cd 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -21,9 +21,7 @@
*
*/
-require_once('User/backend.php');
-
-class OC_USER_LDAP extends OC_USER_BACKEND {
+class OC_USER_LDAP extends OC_User_Backend {
protected $ds;
protected $configured = false;
@@ -37,12 +35,12 @@ class OC_USER_LDAP extends OC_USER_BACKEND {
protected $ldap_filter;
function __construct() {
- $this->ldap_host = OC_APPCONFIG::getValue('user_ldap', 'ldap_host','');
- $this->ldap_port = OC_APPCONFIG::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT );
- $this->ldap_dn = OC_APPCONFIG::getValue('user_ldap', 'ldap_dn','');
- $this->ldap_password = OC_APPCONFIG::getValue('user_ldap', 'ldap_password','');
- $this->ldap_base = OC_APPCONFIG::getValue('user_ldap', 'ldap_base','');
- $this->ldap_filter = OC_APPCONFIG::getValue('user_ldap', 'ldap_filter','');
+ $this->ldap_host = OC_Appconfig::getValue('user_ldap', 'ldap_host','');
+ $this->ldap_port = OC_Appconfig::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT );
+ $this->ldap_dn = OC_Appconfig::getValue('user_ldap', 'ldap_dn','');
+ $this->ldap_password = OC_Appconfig::getValue('user_ldap', 'ldap_password','');
+ $this->ldap_base = OC_Appconfig::getValue('user_ldap', 'ldap_base','');
+ $this->ldap_filter = OC_Appconfig::getValue('user_ldap', 'ldap_filter','');
if( !empty($this->ldap_host)
&& !empty($this->ldap_port)
diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php
index d6eacfc0a3a..74c13402caf 100644
--- a/apps/user_openid/appinfo/app.php
+++ b/apps/user_openid/appinfo/app.php
@@ -6,15 +6,15 @@ if (!in_array ('curl', get_loaded_extensions())){
}
$urlBase=((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'];
-OC_UTIL::addHeader('link',array('rel'=>'openid.server', 'href'=>$urlBase.OC_HELPER::linkTo( "user_openid", "user.php" ).'/'));
-OC_UTIL::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$urlBase.OC_HELPER::linkTo( "user_openid", "user.php" ).'/'));
+OC_Util::addHeader('link',array('rel'=>'openid.server', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'));
+OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$urlBase.OC_Helper::linkTo( "user_openid", "user.php" ).'/'));
require_once 'apps/user_openid/user_openid.php';
-OC_APP::addSettingsPage( array( "id" => "user_openid_settings", 'order'=>1, "href" => OC_HELPER::linkTo( "user_openid", "settings.php" ), "name" => "OpenID"));
+OC_App::addSettingsPage( array( "id" => "user_openid_settings", 'order'=>1, "href" => OC_Helper::linkTo( "user_openid", "settings.php" ), "name" => "OpenID"));
//active the openid backend
-OC_USER::useBackend('openid');
+OC_User::useBackend('openid');
//check for results from openid requests
if(isset($_GET['openid_mode']) and $_GET['openid_mode'] == 'id_res'){
diff --git a/apps/user_openid/phpmyid.php b/apps/user_openid/phpmyid.php
index bc2950982fa..bcab9e55cbb 100644
--- a/apps/user_openid/phpmyid.php
+++ b/apps/user_openid/phpmyid.php
@@ -12,9 +12,6 @@
* @version 0.9
*/
-require( 'template.php' );
-
-
/**
* Set a constant to indicate that phpMyID is running
*/
@@ -208,7 +205,7 @@ function authorize_mode () {
$profile['idp_url']=$IDENTITY;
if (isset($_SERVER['PHP_AUTH_USER']) && $profile['authorized'] === false && $_SERVER['PHP_AUTH_USER']==$USERNAME) {
- if (OC_USER::checkPassword($USERNAME, $_SERVER['PHP_AUTH_PW'])) {// successful login!
+ if (OC_User::checkPassword($USERNAME, $_SERVER['PHP_AUTH_PW'])) {// successful login!
// return to the refresh url if they get in
$_SESSION['openid_auth']=true;
$_SESSION['openid_user']=$USERNAME;
@@ -562,7 +559,7 @@ function logout_mode () {
*/
function no_mode () {
global $USERNAME, $profile;
- $tmpl = new OC_TEMPLATE( 'user_openid', 'nomode', 'guest' );
+ $tmpl = new OC_Template( 'user_openid', 'nomode', 'guest' );
if(substr($profile['req_url'],-1,1)!=='/'){//the identity should always end with a /
$profile['req_url'].='/';
}
diff --git a/apps/user_openid/settings.php b/apps/user_openid/settings.php
index 76316de100c..4293a6c8aaf 100644
--- a/apps/user_openid/settings.php
+++ b/apps/user_openid/settings.php
@@ -1,23 +1,22 @@
<?php
require_once('../../lib/base.php');
-require( 'template.php' );
-if( !OC_USER::isLoggedIn()){
- header( "Location: ".OC_HELPER::linkTo( "index.php" ));
+if( !OC_User::isLoggedIn()){
+ header( "Location: ".OC_Helper::linkTo( "index.php" ));
exit();
}
if(isset($_POST['input_identity'])){
- OC_PREFERENCES::setValue(OC_USER::getUser(),'user_openid','identity',$_POST['input_identity']);
+ OC_Preferences::setValue(OC_User::getUser(),'user_openid','identity',$_POST['input_identity']);
}
-OC_APP::setActiveNavigationEntry( "user_openid_settings" );
+OC_App::setActiveNavigationEntry( "user_openid_settings" );
-$identity=OC_PREFERENCES::getValue(OC_USER::getUser(),'user_openid','identity','');
+$identity=OC_Preferences::getValue(OC_User::getUser(),'user_openid','identity','');
-$tmpl = new OC_TEMPLATE( "user_openid", "settings", "admin");
+$tmpl = new OC_Template( "user_openid", "settings", "admin");
$tmpl->assign('identity',$identity);
-$tmpl->assign('user',OC_USER::getUser());
+$tmpl->assign('user',OC_User::getUser());
$tmpl->printPage();
diff --git a/apps/user_openid/user.php b/apps/user_openid/user.php
index 4b5d13e3398..3743d232b6d 100644
--- a/apps/user_openid/user.php
+++ b/apps/user_openid/user.php
@@ -38,7 +38,7 @@ $RUNTIME_NOAPPS=true;
$RUNTIME_NOAPPS=false;
require_once '../../lib/base.php';
-if(!OC_USER::userExists($USERNAME)){
+if(!OC_User::userExists($USERNAME)){
error_log($USERNAME.' doesn\'t exist');
$USERNAME='';
}
diff --git a/apps/user_openid/user_openid.php b/apps/user_openid/user_openid.php
index ddf5cc9bc23..d9af94dcafa 100644
--- a/apps/user_openid/user_openid.php
+++ b/apps/user_openid/user_openid.php
@@ -21,13 +21,12 @@
*
*/
-require_once('User/backend.php');
require_once('class.openid.v3.php');
/**
* Class for user management in a SQL Database (e.g. MySQL, SQLite)
*/
-class OC_USER_OPENID extends OC_USER_BACKEND {
+class OC_USER_OPENID extends OC_User_Backend {
/**
* @brief Check if the password is correct
* @param $uid The username