From f5c0dbd947d45520550b68dae77a894f871a0758 Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Wed, 27 Jul 2011 19:07:28 +0200 Subject: Use autoload --- lib/Connector/Sabre/auth.php | 35 ---- lib/Connector/Sabre/directory.php | 131 -------------- lib/Connector/Sabre/file.php | 89 ---------- lib/Connector/Sabre/locks.php | 154 ---------------- lib/Connector/Sabre/node.php | 161 ----------------- lib/Group/backend.php | 96 ---------- lib/Group/database.php | 179 ------------------- lib/User/backend.php | 86 --------- lib/User/database.php | 147 --------------- lib/User/example.php | 97 ---------- lib/base.php | 338 +---------------------------------- lib/connector/sabre/auth.php | 34 ++++ lib/connector/sabre/directory.php | 128 +++++++++++++ lib/connector/sabre/file.php | 87 +++++++++ lib/connector/sabre/locks.php | 152 ++++++++++++++++ lib/connector/sabre/node.php | 158 +++++++++++++++++ lib/database.php | 365 -------------------------------------- lib/db.php | 365 ++++++++++++++++++++++++++++++++++++++ lib/files.php | 3 - lib/group.php | 1 - lib/group/backend.php | 96 ++++++++++ lib/group/database.php | 177 ++++++++++++++++++ lib/hook.php | 69 +++++++ lib/user.php | 1 - lib/user/backend.php | 86 +++++++++ lib/user/database.php | 145 +++++++++++++++ lib/user/example.php | 95 ++++++++++ lib/util.php | 245 +++++++++++++++++++++++++ 28 files changed, 1845 insertions(+), 1875 deletions(-) delete mode 100644 lib/Connector/Sabre/auth.php delete mode 100644 lib/Connector/Sabre/directory.php delete mode 100644 lib/Connector/Sabre/file.php delete mode 100644 lib/Connector/Sabre/locks.php delete mode 100644 lib/Connector/Sabre/node.php delete mode 100644 lib/Group/backend.php delete mode 100644 lib/Group/database.php delete mode 100644 lib/User/backend.php delete mode 100644 lib/User/database.php delete mode 100644 lib/User/example.php create mode 100644 lib/connector/sabre/auth.php create mode 100644 lib/connector/sabre/directory.php create mode 100644 lib/connector/sabre/file.php create mode 100644 lib/connector/sabre/locks.php create mode 100644 lib/connector/sabre/node.php delete mode 100644 lib/database.php create mode 100644 lib/db.php create mode 100644 lib/group/backend.php create mode 100644 lib/group/database.php create mode 100644 lib/hook.php create mode 100644 lib/user/backend.php create mode 100644 lib/user/database.php create mode 100644 lib/user/example.php create mode 100644 lib/util.php diff --git a/lib/Connector/Sabre/auth.php b/lib/Connector/Sabre/auth.php deleted file mode 100644 index cfe7723e761..00000000000 --- a/lib/Connector/Sabre/auth.php +++ /dev/null @@ -1,35 +0,0 @@ -path . '/' . $name; - OC_FILESYSTEM::file_put_contents($newPath,$data); - - } - - /** - * Creates a new subdirectory - * - * @param string $name - * @return void - */ - public function createDirectory($name) { - - $newPath = $this->path . '/' . $name; - OC_FILESYSTEM::mkdir($newPath); - - } - - /** - * Returns a specific child node, referenced by its name - * - * @param string $name - * @throws Sabre_DAV_Exception_FileNotFound - * @return Sabre_DAV_INode - */ - public function getChild($name) { - - $path = $this->path . '/' . $name; - - if (!OC_FILESYSTEM::file_exists($path)) throw new Sabre_DAV_Exception_FileNotFound('File with name ' . $path . ' could not be located'); - - if (OC_FILESYSTEM::is_dir($path)) { - - return new OC_Connector_Sabre_Directory($path); - - } else { - - return new OC_Connector_Sabre_File($path); - - } - - } - - /** - * Returns an array with all the child nodes - * - * @return Sabre_DAV_INode[] - */ - public function getChildren() { - - $nodes = array(); - // foreach(scandir($this->path) as $node) if($node!='.' && $node!='..') $nodes[] = $this->getChild($node); - if( OC_FILESYSTEM::is_dir($this->path)){ - $dh = OC_FILESYSTEM::opendir($this->path); - while(( $node = readdir($dh)) !== false ){ - if($node!='.' && $node!='..'){ - $nodes[] = $this->getChild($node); - } - } - } - return $nodes; - - } - - /** - * Checks if a child exists. - * - * @param string $name - * @return bool - */ - public function childExists($name) { - - $path = $this->path . '/' . $name; - return OC_FILESYSTEM::file_exists($path); - - } - - /** - * Deletes all files in this directory, and then itself - * - * @return void - */ - public function delete() { - - foreach($this->getChildren() as $child) $child->delete(); - OC_FILESYSTEM::rmdir($this->path); - - } - - /** - * Returns available diskspace information - * - * @return array - */ - public function getQuotaInfo() { - - return array( - OC_FILESYSTEM::filesize('/'), - OC_FILESYSTEM::free_space() - ); - - } - -} - diff --git a/lib/Connector/Sabre/file.php b/lib/Connector/Sabre/file.php deleted file mode 100644 index bb5ab738430..00000000000 --- a/lib/Connector/Sabre/file.php +++ /dev/null @@ -1,89 +0,0 @@ -path,$data); - - } - - /** - * Returns the data - * - * @return string - */ - public function get() { - - return OC_FILESYSTEM::file_get_contents($this->path); - - } - - /** - * Delete the current file - * - * @return void - */ - public function delete() { - - OC_FILESYSTEM::unlink($this->path); - - } - - /** - * Returns the size of the node, in bytes - * - * @return int - */ - public function getSize() { - - return OC_FILESYSTEM::filesize($this->path); - - } - - /** - * Returns the ETag for a file - * - * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. - * The ETag is an arbritrary string, but MUST be surrounded by double-quotes. - * - * Return null if the ETag can not effectively be determined - * - * @return mixed - */ - public function getETag() { - - return null; - - } - - /** - * Returns the mime-type for a file - * - * If null is returned, we'll assume application/octet-stream - * - * @return mixed - */ - public function getContentType() { - - return OC_FILESYSTEM::getMimeType($this->path); - - } -} - diff --git a/lib/Connector/Sabre/locks.php b/lib/Connector/Sabre/locks.php deleted file mode 100644 index 4f3eb7bbf52..00000000000 --- a/lib/Connector/Sabre/locks.php +++ /dev/null @@ -1,154 +0,0 @@ - ? AND ((uri = ?)'; - $params = array(OC_USER::getUser(),time(),$uri); - - // We need to check locks for every part in the uri. - $uriParts = explode('/',$uri); - - // We already covered the last part of the uri - array_pop($uriParts); - - $currentPath=''; - - foreach($uriParts as $part) { - - if ($currentPath) $currentPath.='/'; - $currentPath.=$part; - - $query.=' OR (depth!=0 AND uri = ?)'; - $params[] = $currentPath; - - } - - if ($returnChildLocks) { - - $query.=' OR (uri LIKE ?)'; - $params[] = $uri . '/%'; - - } - $query.=')'; - - $stmt = OC_DB::prepare($query); - $result = $stmt->execute($params); - - $lockList = array(); - while( $row = $result->fetchRow()){ - - $lockInfo = new Sabre_DAV_Locks_LockInfo(); - $lockInfo->owner = $row['owner']; - $lockInfo->token = $row['token']; - $lockInfo->timeout = $row['timeout']; - $lockInfo->created = $row['created']; - $lockInfo->scope = $row['scope']; - $lockInfo->depth = $row['depth']; - $lockInfo->uri = $row['uri']; - $lockList[] = $lockInfo; - - } - - return $lockList; - - } - - /** - * Locks a uri - * - * @param string $uri - * @param Sabre_DAV_Locks_LockInfo $lockInfo - * @return bool - */ - public function lock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) { - - // We're making the lock timeout 5 minutes - $lockInfo->timeout = 300; - $lockInfo->created = time(); - $lockInfo->uri = $uri; - - $locks = $this->getLocks($uri,false); - $exists = false; - foreach($locks as $k=>$lock) { - if ($lock->token == $lockInfo->token) $exists = true; - } - - if ($exists) { - $query = OC_DB::prepare( 'UPDATE *PREFIX*locks SET owner = ?, timeout = ?, scope = ?, depth = ?, uri = ?, created = ? WHERE userid = ? AND token = ?' ); - $result = $query->execute( array($lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,OC_USER::getUser(),$lockInfo->token)); - } else { - $query = OC_DB::prepare( 'INSERT INTO *PREFIX*locks (userid,owner,timeout,scope,depth,uri,created,token) VALUES (?,?,?,?,?,?,?,?)' ); - $result = $query->execute( array(OC_USER::getUser(),$lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,$lockInfo->token)); - } - - return true; - - } - - /** - * Removes a lock from a uri - * - * @param string $uri - * @param Sabre_DAV_Locks_LockInfo $lockInfo - * @return bool - */ - public function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) { - - $query = OC_DB::prepare( 'DELETE FROM *PREFIX*locks WHERE userid = ? AND uri=? AND token=?' ); - $result = $query->execute( array(OC_USER::getUser(),$uri,$lockInfo->token)); - - return $result->numRows() === 1; - - } - -} - diff --git a/lib/Connector/Sabre/node.php b/lib/Connector/Sabre/node.php deleted file mode 100644 index dc1013dc524..00000000000 --- a/lib/Connector/Sabre/node.php +++ /dev/null @@ -1,161 +0,0 @@ -path = $path; - } - - - - /** - * Returns the name of the node - * - * @return string - */ - public function getName() { - - list(, $name) = Sabre_DAV_URLUtil::splitPath($this->path); - return $name; - - } - - /** - * Renames the node - * - * @param string $name The new name - * @return void - */ - public function setName($name) { - - list($parentPath, ) = Sabre_DAV_URLUtil::splitPath($this->path); - list(, $newName) = Sabre_DAV_URLUtil::splitPath($name); - - $newPath = $parentPath . '/' . $newName; - $oldPath = $this->path; - - OC_FILESYSTEM::rename($this->path,$newPath); - - $this->path = $newPath; - - $query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertypath = ? WHERE userid = ? AND propertypath = ?' ); - $query->execute( array( $newPath,OC_USER::getUser(), $oldPath )); - - } - - - - /** - * Returns the last modification time, as a unix timestamp - * - * @return int - */ - public function getLastModified() { - - return OC_FILESYSTEM::filemtime($this->path); - - } - - /** - * Updates properties on this node, - * - * @param array $mutations - * @see Sabre_DAV_IProperties::updateProperties - * @return bool|array - */ - public function updateProperties($properties) { - $existing = $this->getProperties(array()); - foreach($properties as $propertyName => $propertyValue) { - // If it was null, we need to delete the property - if (is_null($propertyValue)) { - if(array_key_exists( $propertyName, $existing )){ - $query = OC_DB::prepare( 'DELETE FROM *PREFIX*properties WHERE userid = ? AND propertypath = ? AND propertyname = ?' ); - $query->execute( array( OC_USER::getUser(), $this->path, $propertyName )); - } - } - else { - if(!array_key_exists( $propertyName, $existing )){ - $query = OC_DB::prepare( 'INSERT INTO *PREFIX*properties (userid,propertypath,propertyname,propertyvalue) VALUES(?,?,?,?)' ); - $query->execute( array( OC_USER::getUser(), $this->path, $propertyName,$propertyValue )); - } - else{ - $query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertyvalue = ? WHERE userid = ? AND propertypath = ? AND propertyname = ?' ); - $query->execute( array( $propertyValue,OC_USER::getUser(), $this->path, $propertyName )); - } - } - - } - return true; - } - - /** - * Returns a list of properties for this nodes.; - * - * The properties list is a list of propertynames the client requested, encoded as xmlnamespace#tagName, for example: http://www.example.org/namespace#author - * If the array is empty, all properties should be returned - * - * @param array $properties - * @return void - */ - function getProperties($properties) { - // At least some magic in here :-) - $query = OC_DB::prepare( 'SELECT * FROM *PREFIX*properties WHERE userid = ? AND propertypath = ?' ); - $result = $query->execute( array( OC_USER::getUser(), $this->path )); - - $existing = array(); - while( $row = $result->fetchRow()){ - $existing[$row['propertyname']] = $row['propertyvalue']; - } - - if(count($properties) == 0){ - return $existing; - } - - // if the array was empty, we need to return everything - $props = array(); - foreach($properties as $property) { - if (isset($existing[$property])) $props[$property] = $existing[$property]; - } - return $props; - } -} - diff --git a/lib/Group/backend.php b/lib/Group/backend.php deleted file mode 100644 index 298cced7ff5..00000000000 --- a/lib/Group/backend.php +++ /dev/null @@ -1,96 +0,0 @@ -. -* -*/ - - - -/** - * Abstract base class for user management - */ -abstract class OC_GROUP_BACKEND { - /** - * @brief Try to create a new group - * @param $gid The name of the group to create - * @returns true/false - * - * Trys to create a new group. If the group name already exists, false will - * be returned. - */ - public static function createGroup($gid){} - - /** - * @brief delete a group - * @param $gid gid of the group to delete - * @returns true/false - * - * Deletes a group and removes it from the group_user-table - */ - public static function removeGroup($gid){} - - /** - * @brief is user in group? - * @param $uid uid of the user - * @param $gid gid of the group - * @returns true/false - * - * Checks whether the user is member of a group or not. - */ - public static function inGroup($uid, $gid){} - - /** - * @brief Add a user to a group - * @param $uid Name of the user to add to group - * @param $gid Name of the group in which add the user - * @returns true/false - * - * Adds a user to a group. - */ - public static function addToGroup($uid, $gid){} - - /** - * @brief Removes a user from a group - * @param $uid Name of the user to remove from group - * @param $gid Name of the group from which remove the user - * @returns true/false - * - * removes the user from a group. - */ - public static function removeFromGroup($uid,$gid){} - - /** - * @brief Get all groups a user belongs to - * @param $uid Name of the user - * @returns array with group names - * - * This function fetches all groups a user belongs to. It does not check - * if the user exists at all. - */ - public static function getUserGroups($uid){} - - /** - * @brief get a list of all groups - * @returns array with group names - * - * Returns a list with all groups - */ - public static function getGroups(){} -} diff --git a/lib/Group/database.php b/lib/Group/database.php deleted file mode 100644 index 6e508a4d47c..00000000000 --- a/lib/Group/database.php +++ /dev/null @@ -1,179 +0,0 @@ -. - * - */ -/* - * - * The following SQL statement is just a help for developers and will not be - * executed! - * - * CREATE TABLE `groups` ( - * `gid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, - * PRIMARY KEY (`gid`) - * ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - * - * CREATE TABLE `group_user` ( - * `gid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, - * `uid` varchar(64) COLLATE utf8_unicode_ci NOT NULL - * ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - * - */ - -require_once( 'Group/backend.php' ); - -/** - * Class for group management in a SQL Database (e.g. MySQL, SQLite) - */ -class OC_GROUP_DATABASE extends OC_GROUP_BACKEND { - static private $userGroupCache=array(); - - /** - * @brief Try to create a new group - * @param $gid The name of the group to create - * @returns true/false - * - * Trys to create a new group. If the group name already exists, false will - * be returned. - */ - public static function createGroup( $gid ){ - // Check for existence - $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups` WHERE gid = ?" ); - $result = $query->execute( array( $gid )); - - if( $result->numRows() > 0 ){ - // Can not add an existing group - return false; - } - else{ - // Add group and exit - $query = OC_DB::prepare( "INSERT INTO `*PREFIX*groups` ( `gid` ) VALUES( ? )" ); - $result = $query->execute( array( $gid )); - - return $result ? true : false; - } - } - - /** - * @brief delete a group - * @param $gid gid of the group to delete - * @returns true/false - * - * Deletes a group and removes it from the group_user-table - */ - public static function deleteGroup( $gid ){ - // Delete the group - $query = OC_DB::prepare( "DELETE FROM `*PREFIX*groups` WHERE gid = ?" ); - $result = $query->execute( array( $gid )); - - // Delete the group-user relation - $query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE gid = ?" ); - $result = $query->execute( array( $gid )); - - return true; - } - - /** - * @brief is user in group? - * @param $uid uid of the user - * @param $gid gid of the group - * @returns true/false - * - * Checks whether the user is member of a group or not. - */ - public static function inGroup( $uid, $gid ){ - // check - $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE gid = ? AND uid = ?" ); - $result = $query->execute( array( $gid, $uid )); - - return $result->numRows() > 0 ? true : false; - } - - /** - * @brief Add a user to a group - * @param $uid Name of the user to add to group - * @param $gid Name of the group in which add the user - * @returns true/false - * - * Adds a user to a group. - */ - public static function addToGroup( $uid, $gid ){ - // No duplicate entries! - if( !self::inGroup( $uid, $gid )){ - $query = OC_DB::prepare( "INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )" ); - $result = $query->execute( array( $uid, $gid )); - } - return true; - } - - /** - * @brief Removes a user from a group - * @param $uid Name of the user to remove from group - * @param $gid Name of the group from which remove the user - * @returns true/false - * - * removes the user from a group. - */ - public static function removeFromGroup( $uid, $gid ){ - $query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE `uid` = ? AND `gid` = ?" ); - $result = $query->execute( array( $uid, $gid )); - - return true; - } - - /** - * @brief Get all groups a user belongs to - * @param $uid Name of the user - * @returns array with group names - * - * This function fetches all groups a user belongs to. It does not check - * if the user exists at all. - */ - public static function getUserGroups( $uid ){ - // No magic! - $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE uid = ?" ); - $result = $query->execute( array( $uid )); - - $groups = array(); - while( $row = $result->fetchRow()){ - $groups[] = $row["gid"]; - } - - return $groups; - } - - /** - * @brief get a list of all groups - * @returns array with group names - * - * Returns a list with all groups - */ - public static function getGroups(){ - $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups`" ); - $result = $query->execute(); - - $groups = array(); - while( $row = $result->fetchRow()){ - $groups[] = $row["gid"]; - } - - return $groups; - } -} diff --git a/lib/User/backend.php b/lib/User/backend.php deleted file mode 100644 index 1797d0c475a..00000000000 --- a/lib/User/backend.php +++ /dev/null @@ -1,86 +0,0 @@ -. - * - */ - -/** - * error code for functions not provided by the user backend - */ -define('OC_USER_BACKEND_NOT_IMPLEMENTED', -501); - -/** - * actions that user backends can define - */ -define('OC_USER_BACKEND_CREATE_USER', 0x000001); -define('OC_USER_BACKEND_DELETE_USER', 0x000010); -define('OC_USER_BACKEND_SET_PASSWORD', 0x000100); -define('OC_USER_BACKEND_CHECK_PASSWORD', 0x001000); -define('OC_USER_BACKEND_GET_USERS', 0x010000); -define('OC_USER_BACKEND_USER_EXISTS', 0x100000); - - -/** - * abstract base class for user management - * subclass this for your own backends and see OC_USER_EXAMPLE for descriptions - */ -abstract class OC_USER_BACKEND { - - protected $possibleActions = array( - OC_USER_BACKEND_CREATE_USER => 'createUser', - OC_USER_BACKEND_DELETE_USER => 'deleteUser', - OC_USER_BACKEND_SET_PASSWORD => 'setPassword', - OC_USER_BACKEND_CHECK_PASSWORD => 'checkPassword', - OC_USER_BACKEND_GET_USERS => 'getUsers', - OC_USER_BACKEND_USER_EXISTS => 'userExists' - ); - - /** - * @brief Get all supported actions - * @returns bitwise-or'ed actions - * - * Returns the supported actions as int to be - * compared with OC_USER_BACKEND_CREATE_USER etc. - */ - public function getSupportedActions(){ - $actions = 0; - foreach($this->possibleActions AS $action => $methodName){ - if(method_exists($this, $methodName)) { - $actions |= $action; - } - } - - return $actions; - } - - /** - * @brief Check if backend implements actions - * @param $actions bitwise-or'ed actions - * @returns boolean - * - * Returns the supported actions as int to be - * compared with OC_USER_BACKEND_CREATE_USER etc. - */ - public function implementsActions($actions){ - return (bool)($this->getSupportedActions() & $actions); - } -} diff --git a/lib/User/database.php b/lib/User/database.php deleted file mode 100644 index 0396ac30958..00000000000 --- a/lib/User/database.php +++ /dev/null @@ -1,147 +0,0 @@ -. - * - */ -/* - * - * The following SQL statement is just a help for developers and will not be - * executed! - * - * CREATE TABLE `users` ( - * `uid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, - * `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - * PRIMARY KEY (`uid`) - * ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - * - */ - -require_once('User/backend.php'); - -/** - * Class for user management in a SQL Database (e.g. MySQL, SQLite) - */ -class OC_USER_DATABASE extends OC_USER_BACKEND { - static private $userGroupCache=array(); - - /** - * @brief Create a new user - * @param $uid The username of the user to create - * @param $password The password of the new user - * @returns true/false - * - * Creates a new user. Basic checking of username is done in OC_USER - * itself, not in its subclasses. - */ - public function createUser( $uid, $password ){ - if( $this->userExists($uid) ){ - return false; - } - else{ - $query = OC_DB::prepare( "INSERT INTO `*PREFIX*users` ( `uid`, `password` ) VALUES( ?, ? )" ); - $result = $query->execute( array( $uid, sha1( $password ))); - - return $result ? true : false; - } - } - - /** - * @brief delete a user - * @param $uid The username of the user to delete - * @returns true/false - * - * Deletes a user - */ - public function deleteUser( $uid ){ - // Delete user-group-relation - $query = OC_DB::prepare( "DELETE FROM `*PREFIX*users` WHERE uid = ?" ); - $result = $query->execute( array( $uid )); - return true; - } - - /** - * @brief Set password - * @param $uid The username - * @param $password The new password - * @returns true/false - * - * Change the password of a user - */ - public function setPassword( $uid, $password ){ - if( $this->userExists($uid) ){ - $query = OC_DB::prepare( "UPDATE *PREFIX*users SET password = ? WHERE uid = ?" ); - $result = $query->execute( array( sha1( $password ), $uid )); - - return true; - } - else{ - return false; - } - } - - /** - * @brief Check if the password is correct - * @param $uid The username - * @param $password The password - * @returns true/false - * - * Check if the password is correct without logging in the user - */ - public function checkPassword( $uid, $password ){ - $query = OC_DB::prepare( "SELECT uid FROM *PREFIX*users WHERE uid = ? AND password = ?" ); - $result = $query->execute( array( $uid, sha1( $password ))); - - if( $result->numRows() > 0 ){ - return true; - } - else{ - return false; - } - } - - /** - * @brief Get a list of all users - * @returns array with all uids - * - * Get a list of all users. - */ - public function getUsers(){ - $query = OC_DB::prepare( "SELECT uid FROM *PREFIX*users" ); - $result = $query->execute(); - - $users=array(); - while( $row = $result->fetchRow()){ - $users[] = $row["uid"]; - } - return $users; - } - - /** - * @brief check if a user exists - * @param string $uid the username - * @return boolean - */ - public function userExists($uid){ - $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*users` WHERE uid = ?" ); - $result = $query->execute( array( $uid )); - - return $result->numRows() > 0; - } -} diff --git a/lib/User/example.php b/lib/User/example.php deleted file mode 100644 index 4abc1b3d49c..00000000000 --- a/lib/User/example.php +++ /dev/null @@ -1,97 +0,0 @@ -. - * - */ - -require_once('User/backend.php'); - -/** - * abstract reference class for user management - * this class should only be used as a reference for method signatures and their descriptions - */ -abstract class OC_USER_EXAMPLE extends OC_USER_BACKEND { - /** - * @brief Create a new user - * @param $uid The username of the user to create - * @param $password The password of the new user - * @returns true/false - * - * Creates a new user. Basic checking of username is done in OC_USER - * itself, not in its subclasses. - */ - public function createUser($uid, $password){ - return OC_USER_BACKEND_NOT_IMPLEMENTED; - } - - /** - * @brief delete a user - * @param $uid The username of the user to delete - * @returns true/false - * - * Deletes a user - */ - public function deleteUser( $uid ){ - return OC_USER_BACKEND_NOT_IMPLEMENTED; - } - - /** - * @brief Set password - * @param $uid The username - * @param $password The new password - * @returns true/false - * - * Change the password of a user - */ - public function setPassword($uid, $password){ - return OC_USER_BACKEND_NOT_IMPLEMENTED; - } - - /** - * @brief Check if the password is correct - * @param $uid The username - * @param $password The password - * @returns true/false - * - * Check if the password is correct without logging in the user - */ - public function checkPassword($uid, $password){ - return OC_USER_BACKEND_NOT_IMPLEMENTED; - } - - /** - * @brief Get a list of all users - * @returns array with all uids - * - * Get a list of all users. - */ - public function getUsers(){ - return OC_USER_BACKEND_NOT_IMPLEMENTED; - } - - /** - * @brief check if a user exists - * @param string $uid the username - * @return boolean - */ - public function userExists($uid){ - return OC_USER_BACKEND_NOT_IMPLEMENTED; - } -} diff --git a/lib/base.php b/lib/base.php index 743ed587922..7c2e7cf88c1 100644 --- a/lib/base.php +++ b/lib/base.php @@ -20,6 +20,14 @@ * */ +// Get rid of this stupid require_once OC_... +function OC_autoload($className) { + if(strpos($className,'OC_')===0) { + require_once strtolower(str_replace('_','/',substr($className,3)) . '.php'); + } +} + +spl_autoload_register('OC_autoload'); // set some stuff //ob_start(); @@ -58,9 +66,6 @@ if( !isset( $RUNTIME_NOAPPS )){ $RUNTIME_NOAPPS = false; } -// Doing the config stuff first -require_once('config.php'); - // TODO: we should get rid of this one, too // WARNING: to make everything even more confusing, DATADIRECTORY is a var that // changes and DATATIRECTORY_ROOT stays the same, but is set by @@ -76,25 +81,6 @@ if( OC_CONFIG::getValue( "forcessl", false )){ } } -// load core libs -require_once('helper.php'); -require_once('database.php'); -require_once('app.php'); -require_once('appconfig.php'); -require_once('files.php'); -require_once('filesystem.php'); -require_once('filestorage.php'); -require_once('l10n.php'); -require_once('preferences.php'); -require_once('log.php'); -require_once('user.php'); -require_once('group.php'); -require_once('ocs.php'); -require_once('ocsclient.php'); -require_once('connect.php'); -require_once('remotestorage.php'); -require_once('search.php'); - $error=(count(OC_UTIL::checkServer())>0); OC_USER::useBackend( OC_CONFIG::getValue( "userbackend", "database" )); @@ -117,313 +103,5 @@ if(!$error and !$RUNTIME_NOAPPS ){ OC_APP::loadApps(); } -/** - * Class for utility functions - * - */ -class OC_UTIL { - public static $scripts=array(); - public static $styles=array(); - public static $headers=array(); - private static $fsSetup=false; - - // Can be set up - public static function setupFS( $user = "", $root = "files" ){// configure the initial filesystem based on the configuration - if(self::$fsSetup){//setting up the filesystem twice can only lead to trouble - return false; - } - - // Global Variables - global $SERVERROOT; - global $CONFIG_DATADIRECTORY; - - $CONFIG_DATADIRECTORY_ROOT = OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); - $CONFIG_BACKUPDIRECTORY = OC_CONFIG::getValue( "backupdirectory", "$SERVERROOT/backup" ); - - // Create root dir - if(!is_dir($CONFIG_DATADIRECTORY_ROOT)){ - @mkdir($CONFIG_DATADIRECTORY_ROOT) or die("Can't create data directory ($CONFIG_DATADIRECTORY_ROOT), you can usually fix this by setting the owner of '$SERVERROOT' to the user that the web server uses (www-data for debian/ubuntu)"); - } - - // If we are not forced to load a specific user we load the one that is logged in - if( $user == "" && OC_USER::isLoggedIn()){ - $user = OC_USER::getUser(); - } - - if( $user != "" ){ //if we aren't logged in, there is no use to set up the filesystem - //first set up the local "root" storage and the backupstorage if needed - $rootStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_DATADIRECTORY_ROOT)); -// if( OC_CONFIG::getValue( "enablebackup", false )){ -// // This creates the Directorys recursively -// if(!is_dir( "$CONFIG_BACKUPDIRECTORY/$user/$root" )){ -// mkdir( "$CONFIG_BACKUPDIRECTORY/$user/$root", 0755, true ); -// } -// $backupStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_BACKUPDIRECTORY)); -// $backup=new OC_FILEOBSERVER_BACKUP(array('storage'=>$backupStorage)); -// $rootStorage->addObserver($backup); -// } - OC_FILESYSTEM::mount($rootStorage,'/'); - - $CONFIG_DATADIRECTORY = "$CONFIG_DATADIRECTORY_ROOT/$user/$root"; - if( !is_dir( $CONFIG_DATADIRECTORY )){ - mkdir( $CONFIG_DATADIRECTORY, 0755, true ); - } - -// TODO: find a cool way for doing this -// //set up the other storages according to the system settings -// foreach($CONFIG_FILESYSTEM as $storageConfig){ -// if(OC_FILESYSTEM::hasStorageType($storageConfig['type'])){ -// $arguments=$storageConfig; -// unset($arguments['type']); -// unset($arguments['mountpoint']); -// $storage=OC_FILESYSTEM::createStorage($storageConfig['type'],$arguments); -// if($storage){ -// OC_FILESYSTEM::mount($storage,$storageConfig['mountpoint']); -// } -// } -// } - - //jail the user into his "home" directory - OC_FILESYSTEM::chroot("/$user/$root"); - self::$fsSetup=true; - } - } - - public static function tearDownFS(){ - OC_FILESYSTEM::tearDown(); - self::$fsSetup=false; - } - - /** - * get the current installed version of ownCloud - * @return array - */ - public static function getVersion(){ - return array(1,60,0); - } - - /** - * add a javascript file - * - * @param url $url - */ - public static function addScript( $application, $file = null ){ - if( is_null( $file )){ - $file = $application; - $application = ""; - } - if( !empty( $application )){ - self::$scripts[] = "$application/js/$file"; - }else{ - self::$scripts[] = "js/$file"; - } - } - - /** - * add a css file - * - * @param url $url - */ - public static function addStyle( $application, $file = null ){ - if( is_null( $file )){ - $file = $application; - $application = ""; - } - if( !empty( $application )){ - self::$styles[] = "$application/css/$file"; - }else{ - self::$styles[] = "css/$file"; - } - } - - /** - * @brief Add a custom element to the header - * @param string tag tag name of the element - * @param array $attributes array of attrobutes for the element - * @param string $text the text content for the element - */ - public static function addHeader( $tag, $attributes, $text=''){ - self::$headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text); - } - - /** - * formats a timestamp in the "right" way - * - * @param int timestamp $timestamp - * @param bool dateOnly option to ommit time from the result - */ - public static function formatDate( $timestamp,$dateOnly=false){ - if(isset($_SESSION['timezone'])){//adjust to clients timezone if we know it - $systemTimeZone = intval(exec('date +%z')); - $systemTimeZone=(round($systemTimeZone/100,0)*60)+($systemTimeZone%100); - $clientTimeZone=$_SESSION['timezone']*60; - $offset=$clientTimeZone-$systemTimeZone; - $timestamp=$timestamp+$offset*60; - } - $timeformat=$dateOnly?'F j, Y':'F j, Y, H:i'; - return date($timeformat,$timestamp); - } - - /** - * Shows a pagenavi widget where you can jump to different pages. - * - * @param int $pagecount - * @param int $page - * @param string $url - * @return OC_TEMPLATE - */ - public static function getPageNavi($pagecount,$page,$url) { - - $pagelinkcount=8; - if ($pagecount>1) { - $pagestart=$page-$pagelinkcount; - if($pagestart<0) $pagestart=0; - $pagestop=$page+$pagelinkcount; - if($pagestop>$pagecount) $pagestop=$pagecount; - - $tmpl = new OC_TEMPLATE( '', 'part.pagenavi', '' ); - $tmpl->assign('page',$page); - $tmpl->assign('pagecount',$pagecount); - $tmpl->assign('pagestart',$pagestart); - $tmpl->assign('pagestop',$pagestop); - $tmpl->assign('url',$url); - return $tmpl; - } - } - - - - /** - * check if the current server configuration is suitable for ownCloud - * @return array arrays with error messages and hints - */ - public static function checkServer(){ - global $SERVERROOT; - global $CONFIG_DATADIRECTORY; - - $CONFIG_DATADIRECTORY_ROOT = OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );; - $CONFIG_BACKUPDIRECTORY = OC_CONFIG::getValue( "backupdirectory", "$SERVERROOT/backup" ); - $CONFIG_INSTALLED = OC_CONFIG::getValue( "installed", false ); - $errors=array(); - - //check for database drivers - if(!is_callable('sqlite_open') and !is_callable('mysql_connect')){ - $errors[]=array('error'=>'No database drivers (sqlite or mysql) installed.
','hint'=>'');//TODO: sane hint - } - $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" ); - $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); - - //try to get the username the httpd server runs on, used in hints - $stat=stat($_SERVER['DOCUMENT_ROOT']); - if(is_callable('posix_getpwuid')){ - $serverUser=posix_getpwuid($stat['uid']); - $serverUser='\''.$serverUser['name'].'\''; - }else{ - $serverUser='\'www-data\' for ubuntu/debian';//TODO: try to detect the distro and give a guess based on that - } - - //common hint for all file permissons error messages - $permissionsHint="Permissions can usually be fixed by setting the owner of the file or directory to the user the web server runs as ($serverUser)"; - - //check for correct file permissions - if(!stristr(PHP_OS, 'WIN')){ - $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); - if(substr($prems,-1)!='0'){ - OC_HELPER::chmodr($CONFIG_DATADIRECTORY_ROOT,0770); - clearstatcache(); - $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); - if(substr($prems,2,1)!='0'){ - $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web
','hint'=>$permissionsHint); - } - } - if( OC_CONFIG::getValue( "enablebackup", false )){ - $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); - if(substr($prems,-1)!='0'){ - OC_HELPER::chmodr($CONFIG_BACKUPDIRECTORY,0770); - clearstatcache(); - $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); - if(substr($prems,2,1)!='0'){ - $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable from the web
','hint'=>$permissionsHint); - } - } - } - }else{ - //TODO: premisions checks for windows hosts - } - if(is_dir($CONFIG_DATADIRECTORY_ROOT) and !is_writable($CONFIG_DATADIRECTORY_ROOT)){ - $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') not writable by ownCloud
','hint'=>$permissionsHint); - } - - //TODO: check for php modules - - return $errors; - } -} - -/** - * This class manages the hooks. It basically provides two functions: adding - * slots and emitting signals. - */ -class OC_HOOK{ - static private $registered = array(); - - /** - * @brief connects a function to a hook - * @param $signalclass class name of emitter - * @param $signalname name of signal - * @param $slotclass class name of slot - * @param $slotname name of slot - * @returns true/false - * - * This function makes it very easy to connect to use hooks. - * - * TODO: write example - */ - static public function connect( $signalclass, $signalname, $slotclass, $slotname ){ - // Cerate the data structure - if( !array_key_exists( $signalclass, self::$registered )){ - self::$registered[$signalclass] = array(); - } - if( !array_key_exists( $signalname, self::$registered[$signalclass] )){ - self::$registered[$signalclass][$signalname] = array(); - } - - // register hook - self::$registered[$signalclass][$signalname][] = array( - "class" => $slotclass, - "name" => $slotname ); - // No chance for failure ;-) - return true; - } - - /** - * @brief emitts a signal - * @param $signalclass class name of emitter - * @param $signalname name of signal - * @param $params defautl: array() array with additional data - * @returns true if slots exists or false if not - * - * Emits a signal. To get data from the slot use references! - * - * TODO: write example - */ - static public function emit( $signalclass, $signalname, $params = array()){ - // Return false if there are no slots - if( !array_key_exists( $signalclass, self::$registered )){ - return false; - } - if( !array_key_exists( $signalname, self::$registered[$signalclass] )){ - return false; - } - - // Call all slots - foreach( self::$registered[$signalclass][$signalname] as $i ){ - call_user_func( array( $i["class"], $i["name"] ), $params ); - } - - // return true - return true; - } -} ?> diff --git a/lib/connector/sabre/auth.php b/lib/connector/sabre/auth.php new file mode 100644 index 00000000000..4e974ad821d --- /dev/null +++ b/lib/connector/sabre/auth.php @@ -0,0 +1,34 @@ +path . '/' . $name; + OC_FILESYSTEM::file_put_contents($newPath,$data); + + } + + /** + * Creates a new subdirectory + * + * @param string $name + * @return void + */ + public function createDirectory($name) { + + $newPath = $this->path . '/' . $name; + OC_FILESYSTEM::mkdir($newPath); + + } + + /** + * Returns a specific child node, referenced by its name + * + * @param string $name + * @throws Sabre_DAV_Exception_FileNotFound + * @return Sabre_DAV_INode + */ + public function getChild($name) { + + $path = $this->path . '/' . $name; + + if (!OC_FILESYSTEM::file_exists($path)) throw new Sabre_DAV_Exception_FileNotFound('File with name ' . $path . ' could not be located'); + + if (OC_FILESYSTEM::is_dir($path)) { + + return new OC_Connector_Sabre_Directory($path); + + } else { + + return new OC_Connector_Sabre_File($path); + + } + + } + + /** + * Returns an array with all the child nodes + * + * @return Sabre_DAV_INode[] + */ + public function getChildren() { + + $nodes = array(); + // foreach(scandir($this->path) as $node) if($node!='.' && $node!='..') $nodes[] = $this->getChild($node); + if( OC_FILESYSTEM::is_dir($this->path)){ + $dh = OC_FILESYSTEM::opendir($this->path); + while(( $node = readdir($dh)) !== false ){ + if($node!='.' && $node!='..'){ + $nodes[] = $this->getChild($node); + } + } + } + return $nodes; + + } + + /** + * Checks if a child exists. + * + * @param string $name + * @return bool + */ + public function childExists($name) { + + $path = $this->path . '/' . $name; + return OC_FILESYSTEM::file_exists($path); + + } + + /** + * Deletes all files in this directory, and then itself + * + * @return void + */ + public function delete() { + + foreach($this->getChildren() as $child) $child->delete(); + OC_FILESYSTEM::rmdir($this->path); + + } + + /** + * Returns available diskspace information + * + * @return array + */ + public function getQuotaInfo() { + + return array( + OC_FILESYSTEM::filesize('/'), + OC_FILESYSTEM::free_space() + ); + + } + +} + diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php new file mode 100644 index 00000000000..fb4e559aa50 --- /dev/null +++ b/lib/connector/sabre/file.php @@ -0,0 +1,87 @@ +path,$data); + + } + + /** + * Returns the data + * + * @return string + */ + public function get() { + + return OC_FILESYSTEM::file_get_contents($this->path); + + } + + /** + * Delete the current file + * + * @return void + */ + public function delete() { + + OC_FILESYSTEM::unlink($this->path); + + } + + /** + * Returns the size of the node, in bytes + * + * @return int + */ + public function getSize() { + + return OC_FILESYSTEM::filesize($this->path); + + } + + /** + * Returns the ETag for a file + * + * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. + * The ETag is an arbritrary string, but MUST be surrounded by double-quotes. + * + * Return null if the ETag can not effectively be determined + * + * @return mixed + */ + public function getETag() { + + return null; + + } + + /** + * Returns the mime-type for a file + * + * If null is returned, we'll assume application/octet-stream + * + * @return mixed + */ + public function getContentType() { + + return OC_FILESYSTEM::getMimeType($this->path); + + } +} + diff --git a/lib/connector/sabre/locks.php b/lib/connector/sabre/locks.php new file mode 100644 index 00000000000..88bab509898 --- /dev/null +++ b/lib/connector/sabre/locks.php @@ -0,0 +1,152 @@ + ? AND ((uri = ?)'; + $params = array(OC_USER::getUser(),time(),$uri); + + // We need to check locks for every part in the uri. + $uriParts = explode('/',$uri); + + // We already covered the last part of the uri + array_pop($uriParts); + + $currentPath=''; + + foreach($uriParts as $part) { + + if ($currentPath) $currentPath.='/'; + $currentPath.=$part; + + $query.=' OR (depth!=0 AND uri = ?)'; + $params[] = $currentPath; + + } + + if ($returnChildLocks) { + + $query.=' OR (uri LIKE ?)'; + $params[] = $uri . '/%'; + + } + $query.=')'; + + $stmt = OC_DB::prepare($query); + $result = $stmt->execute($params); + + $lockList = array(); + while( $row = $result->fetchRow()){ + + $lockInfo = new Sabre_DAV_Locks_LockInfo(); + $lockInfo->owner = $row['owner']; + $lockInfo->token = $row['token']; + $lockInfo->timeout = $row['timeout']; + $lockInfo->created = $row['created']; + $lockInfo->scope = $row['scope']; + $lockInfo->depth = $row['depth']; + $lockInfo->uri = $row['uri']; + $lockList[] = $lockInfo; + + } + + return $lockList; + + } + + /** + * Locks a uri + * + * @param string $uri + * @param Sabre_DAV_Locks_LockInfo $lockInfo + * @return bool + */ + public function lock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) { + + // We're making the lock timeout 5 minutes + $lockInfo->timeout = 300; + $lockInfo->created = time(); + $lockInfo->uri = $uri; + + $locks = $this->getLocks($uri,false); + $exists = false; + foreach($locks as $k=>$lock) { + if ($lock->token == $lockInfo->token) $exists = true; + } + + if ($exists) { + $query = OC_DB::prepare( 'UPDATE *PREFIX*locks SET owner = ?, timeout = ?, scope = ?, depth = ?, uri = ?, created = ? WHERE userid = ? AND token = ?' ); + $result = $query->execute( array($lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,OC_USER::getUser(),$lockInfo->token)); + } else { + $query = OC_DB::prepare( 'INSERT INTO *PREFIX*locks (userid,owner,timeout,scope,depth,uri,created,token) VALUES (?,?,?,?,?,?,?,?)' ); + $result = $query->execute( array(OC_USER::getUser(),$lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,$lockInfo->token)); + } + + return true; + + } + + /** + * Removes a lock from a uri + * + * @param string $uri + * @param Sabre_DAV_Locks_LockInfo $lockInfo + * @return bool + */ + public function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) { + + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*locks WHERE userid = ? AND uri=? AND token=?' ); + $result = $query->execute( array(OC_USER::getUser(),$uri,$lockInfo->token)); + + return $result->numRows() === 1; + + } + +} + diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php new file mode 100644 index 00000000000..03d5e90012e --- /dev/null +++ b/lib/connector/sabre/node.php @@ -0,0 +1,158 @@ +path = $path; + } + + + + /** + * Returns the name of the node + * + * @return string + */ + public function getName() { + + list(, $name) = Sabre_DAV_URLUtil::splitPath($this->path); + return $name; + + } + + /** + * Renames the node + * + * @param string $name The new name + * @return void + */ + public function setName($name) { + + list($parentPath, ) = Sabre_DAV_URLUtil::splitPath($this->path); + list(, $newName) = Sabre_DAV_URLUtil::splitPath($name); + + $newPath = $parentPath . '/' . $newName; + $oldPath = $this->path; + + OC_FILESYSTEM::rename($this->path,$newPath); + + $this->path = $newPath; + + $query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertypath = ? WHERE userid = ? AND propertypath = ?' ); + $query->execute( array( $newPath,OC_USER::getUser(), $oldPath )); + + } + + + + /** + * Returns the last modification time, as a unix timestamp + * + * @return int + */ + public function getLastModified() { + + return OC_FILESYSTEM::filemtime($this->path); + + } + + /** + * Updates properties on this node, + * + * @param array $mutations + * @see Sabre_DAV_IProperties::updateProperties + * @return bool|array + */ + public function updateProperties($properties) { + $existing = $this->getProperties(array()); + foreach($properties as $propertyName => $propertyValue) { + // If it was null, we need to delete the property + if (is_null($propertyValue)) { + if(array_key_exists( $propertyName, $existing )){ + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*properties WHERE userid = ? AND propertypath = ? AND propertyname = ?' ); + $query->execute( array( OC_USER::getUser(), $this->path, $propertyName )); + } + } + else { + if(!array_key_exists( $propertyName, $existing )){ + $query = OC_DB::prepare( 'INSERT INTO *PREFIX*properties (userid,propertypath,propertyname,propertyvalue) VALUES(?,?,?,?)' ); + $query->execute( array( OC_USER::getUser(), $this->path, $propertyName,$propertyValue )); + } + else{ + $query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertyvalue = ? WHERE userid = ? AND propertypath = ? AND propertyname = ?' ); + $query->execute( array( $propertyValue,OC_USER::getUser(), $this->path, $propertyName )); + } + } + + } + return true; + } + + /** + * Returns a list of properties for this nodes.; + * + * The properties list is a list of propertynames the client requested, encoded as xmlnamespace#tagName, for example: http://www.example.org/namespace#author + * If the array is empty, all properties should be returned + * + * @param array $properties + * @return void + */ + function getProperties($properties) { + // At least some magic in here :-) + $query = OC_DB::prepare( 'SELECT * FROM *PREFIX*properties WHERE userid = ? AND propertypath = ?' ); + $result = $query->execute( array( OC_USER::getUser(), $this->path )); + + $existing = array(); + while( $row = $result->fetchRow()){ + $existing[$row['propertyname']] = $row['propertyvalue']; + } + + if(count($properties) == 0){ + return $existing; + } + + // if the array was empty, we need to return everything + $props = array(); + foreach($properties as $property) { + if (isset($existing[$property])) $props[$property] = $existing[$property]; + } + return $props; + } +} + diff --git a/lib/database.php b/lib/database.php deleted file mode 100644 index 8d7c76756c1..00000000000 --- a/lib/database.php +++ /dev/null @@ -1,365 +0,0 @@ -. - * - */ - -/** - * This class manages the access to the database. It basically is a wrapper for - * MDB2 with some adaptions. - */ -class OC_DB { - static private $DBConnection=false; - static private $schema=false; - static private $affected=0; - static private $result=false; - - /** - * @brief connects to the database - * @returns true if connection can be established or nothing (die()) - * - * Connects to the database as specified in config.php - */ - static public function connect(){ - // The global data we need - $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" );; - $CONFIG_DBHOST = OC_CONFIG::getValue( "dbhost", "" );; - $CONFIG_DBUSER = OC_CONFIG::getValue( "dbuser", "" );; - $CONFIG_DBPASSWORD = OC_CONFIG::getValue( "dbpassword", "" );; - $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" );; - global $SERVERROOT; - $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); - - // do nothing if the connection already has been established - if(!self::$DBConnection){ - // Require MDB2.php (not required in the head of the file so we only load it when needed) - require_once('MDB2.php'); - - // Prepare options array - $options = array( - 'portability' => MDB2_PORTABILITY_ALL, - 'log_line_break' => '
', - 'idxname_format' => '%s', - 'debug' => true, - 'quote_identifier' => true ); - - // Add the dsn according to the database type - if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ - // sqlite - $dsn = array( - 'phptype' => $CONFIG_DBTYPE, - 'database' => "$datadir/$CONFIG_DBNAME.db", - 'mode' => '0644' ); - } - elseif( $CONFIG_DBTYPE == 'mysql' ){ - // MySQL - $dsn = array( - 'phptype' => 'mysql', - 'username' => $CONFIG_DBUSER, - 'password' => $CONFIG_DBPASSWORD, - 'hostspec' => $CONFIG_DBHOST, - 'database' => $CONFIG_DBNAME ); - } - elseif( $CONFIG_DBTYPE == 'pgsql' ){ - // PostgreSQL - $dsn = array( - 'phptype' => 'pgsql', - 'username' => $CONFIG_DBUSER, - 'password' => $CONFIG_DBPASSWORD, - 'hostspec' => $CONFIG_DBHOST, - 'database' => $CONFIG_DBNAME ); - } - - // Try to establish connection - self::$DBConnection = MDB2::factory( $dsn, $options ); - - // Die if we could not connect - if( PEAR::isError( self::$DBConnection )){ - echo( 'can not connect to database, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo().')'); - $error = self::$DBConnection->getMessage(); - error_log( $error); - error_log( self::$DBConnection->getUserInfo()); - die( $error ); - } - - // We always, really always want associative arrays - self::$DBConnection->setFetchMode(MDB2_FETCHMODE_ASSOC); - - //we need to function module for query pre-procesing - self::$DBConnection->loadModule('Function'); - } - - // we are done. great! - return true; - } - - /** - * @brief SQL query - * @param $query Query string - * @returns result as MDB2_Result - * - * SQL query via MDB2 query() - */ - static public function query( $query ){ - // Optimize the query - $query = self::processQuery( $query ); - - self::connect(); - //fix differences between sql versions - - // return the result - $result = self::$DBConnection->exec( $query ); - - // Die if we have an error (error means: bad query, not 0 results!) - if( PEAR::isError($result)) { - $entry = 'DB Error: "'.$result->getMessage().'"
'; - $entry .= 'Offending command was: '.$cmd.'
'; - error_log( $entry ); - die( $entry ); - } - - return $result; - } - - /** - * @brief Prepare a SQL query - * @param $query Query string - * @returns prepared SQL query - * - * SQL query via MDB2 prepare(), needs to be execute()'d! - */ - static public function prepare( $query ){ - // Optimize the query - $query = self::processQuery( $query ); - - self::connect(); - // return the result - $result = self::$DBConnection->prepare( $query ); - - // Die if we have an error (error means: bad query, not 0 results!) - if( PEAR::isError($result)) { - $entry = 'DB Error: "'.$result->getMessage().'"
'; - $entry .= 'Offending command was: '.$query.'
'; - error_log( $entry ); - die( $entry ); - } - - return $result; - } - - /** - * @brief gets last value of autoincrement - * @returns id - * - * MDB2 lastInsertID() - * - * Call this method right after the insert command or other functions may - * cause trouble! - */ - public static function insertid(){ - self::connect(); - return self::$DBConnection->lastInsertID(); - } - - /** - * @brief Disconnect - * @returns true/false - * - * This is good bye, good bye, yeah! - */ - public static function disconnect(){ - // Cut connection if required - if(self::$DBConnection){ - self::$DBConnection->disconnect(); - self::$DBConnection=false; - } - - return true; - } - - /** - * @brief Escapes bad characters - * @param $string string with dangerous characters - * @returns escaped string - * - * MDB2 escape() - */ - public static function escape( $string ){ - self::connect(); - return self::$DBConnection->escape( $string ); - } - - /** - * @brief saves database scheme to xml file - * @param $file name of file - * @returns true/false - * - * TODO: write more documentation - */ - public static function getDbStructure( $file ){ - self::connectScheme(); - - // write the scheme - $definition = self::$schema->getDefinitionFromDatabase(); - $dump_options = array( - 'output_mode' => 'file', - 'output' => $file, - 'end_of_line' => "\n" - ); - self::$schema->dumpDatabase( $definition, $dump_options, MDB2_SCHEMA_DUMP_STRUCTURE ); - - return true; - } - - /** - * @brief Creates tables from XML file - * @param $file file to read structure from - * @returns true/false - * - * TODO: write more documentation - */ - public static function createDbFromStructure( $file ){ - $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); - $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); - - self::connectScheme(); - - // read file - $content = file_get_contents( $file ); - - // Make changes and save them to a temporary file - $file2 = tempnam( sys_get_temp_dir(), 'oc_db_scheme_' ); - $content = str_replace( '*dbname*', $CONFIG_DBNAME, $content ); - $content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content ); - file_put_contents( $file2, $content ); - - // Try to create tables - $definition = self::$schema->parseDatabaseDefinitionFile( $file2 ); - - // Delete our temporary file - unlink( $file2 ); - - // Die in case something went wrong - if( $definition instanceof MDB2_Schema_Error ){ - die( $definition->getMessage().': '.$definition->getUserInfo()); - } -// if(OC_CONFIG::getValue('dbtype','sqlite')=='sqlite'){ -// $definition['overwrite']=true;//always overwrite for sqlite -// } - $ret=self::$schema->createDatabase( $definition ); - - // Die in case something went wrong - if( $ret instanceof MDB2_Error ){ - die ($ret->getMessage() . ': ' . $ret->getUserInfo()); - } - - return true; - } - - /** - * @brief connects to a MDB2 database scheme - * @returns true/false - * - * Connects to a MDB2 database scheme - */ - private static function connectScheme(){ - // We need a database connection - self::connect(); - - // Connect if this did not happen before - if(!self::$schema){ - require_once('MDB2/Schema.php'); - self::$schema=MDB2_Schema::factory(self::$DBConnection); - } - - return true; - } - - /** - * @brief does minor chages to query - * @param $query Query string - * @returns corrected query string - * - * This function replaces *PREFIX* with the value of $CONFIG_DBTABLEPREFIX - * and replaces the ` woth ' or " according to the database driver. - */ - private static function processQuery( $query ){ - self::connect(); - // We need Database type and table prefix - $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" ); - $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); - - // differences is getting the current timestamp - $query = str_replace( 'NOW()', self::$DBConnection->now(), $query ); - $query = str_replace( 'now()', self::$DBConnection->now(), $query ); - - // differences in escaping of table names (` for mysql) - // Problem: what if there is a ` in the value we want to insert? - if( $CONFIG_DBTYPE == 'sqlite' ){ - $query = str_replace( '`', '\'', $query ); - } - elseif( $CONFIG_DBTYPE == 'pgsql' ){ - $query = str_replace( '`', '"', $query ); - } - - // replace table name prefix - $query = str_replace( '*PREFIX*', $CONFIG_DBTABLEPREFIX, $query ); - - return $query; - } - - /** - * @brief drop a table - * @param string $tableNamme the table to drop - */ - public static function dropTable($tableName){ - self::connect(); - self::$DBConnection->loadModule('Manager'); - self::$DBConnection->dropTable($tableName); - } - - /** - * remove all tables defined in a database structure xml file - * @param string $file the xml file describing the tables - */ - public static function removeDBStructure($file){ - $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); - $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); - self::connectScheme(); - - // read file - $content = file_get_contents( $file ); - - // Make changes and save them to a temporary file - $file2 = tempnam( sys_get_temp_dir(), 'oc_db_scheme_' ); - $content = str_replace( '*dbname*', $CONFIG_DBNAME, $content ); - $content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content ); - file_put_contents( $file2, $content ); - - // get the tables - $definition = self::$schema->parseDatabaseDefinitionFile( $file2 ); - - // Delete our temporary file - unlink( $file2 ); - foreach($definition['tables'] as $name=>$table){ - self::dropTable($name); - } - } -} -?> \ No newline at end of file diff --git a/lib/db.php b/lib/db.php new file mode 100644 index 00000000000..8d7c76756c1 --- /dev/null +++ b/lib/db.php @@ -0,0 +1,365 @@ +. + * + */ + +/** + * This class manages the access to the database. It basically is a wrapper for + * MDB2 with some adaptions. + */ +class OC_DB { + static private $DBConnection=false; + static private $schema=false; + static private $affected=0; + static private $result=false; + + /** + * @brief connects to the database + * @returns true if connection can be established or nothing (die()) + * + * Connects to the database as specified in config.php + */ + static public function connect(){ + // The global data we need + $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" );; + $CONFIG_DBHOST = OC_CONFIG::getValue( "dbhost", "" );; + $CONFIG_DBUSER = OC_CONFIG::getValue( "dbuser", "" );; + $CONFIG_DBPASSWORD = OC_CONFIG::getValue( "dbpassword", "" );; + $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" );; + global $SERVERROOT; + $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); + + // do nothing if the connection already has been established + if(!self::$DBConnection){ + // Require MDB2.php (not required in the head of the file so we only load it when needed) + require_once('MDB2.php'); + + // Prepare options array + $options = array( + 'portability' => MDB2_PORTABILITY_ALL, + 'log_line_break' => '
', + 'idxname_format' => '%s', + 'debug' => true, + 'quote_identifier' => true ); + + // Add the dsn according to the database type + if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){ + // sqlite + $dsn = array( + 'phptype' => $CONFIG_DBTYPE, + 'database' => "$datadir/$CONFIG_DBNAME.db", + 'mode' => '0644' ); + } + elseif( $CONFIG_DBTYPE == 'mysql' ){ + // MySQL + $dsn = array( + 'phptype' => 'mysql', + 'username' => $CONFIG_DBUSER, + 'password' => $CONFIG_DBPASSWORD, + 'hostspec' => $CONFIG_DBHOST, + 'database' => $CONFIG_DBNAME ); + } + elseif( $CONFIG_DBTYPE == 'pgsql' ){ + // PostgreSQL + $dsn = array( + 'phptype' => 'pgsql', + 'username' => $CONFIG_DBUSER, + 'password' => $CONFIG_DBPASSWORD, + 'hostspec' => $CONFIG_DBHOST, + 'database' => $CONFIG_DBNAME ); + } + + // Try to establish connection + self::$DBConnection = MDB2::factory( $dsn, $options ); + + // Die if we could not connect + if( PEAR::isError( self::$DBConnection )){ + echo( 'can not connect to database, using '.$CONFIG_DBTYPE.'. ('.self::$DBConnection->getUserInfo().')'); + $error = self::$DBConnection->getMessage(); + error_log( $error); + error_log( self::$DBConnection->getUserInfo()); + die( $error ); + } + + // We always, really always want associative arrays + self::$DBConnection->setFetchMode(MDB2_FETCHMODE_ASSOC); + + //we need to function module for query pre-procesing + self::$DBConnection->loadModule('Function'); + } + + // we are done. great! + return true; + } + + /** + * @brief SQL query + * @param $query Query string + * @returns result as MDB2_Result + * + * SQL query via MDB2 query() + */ + static public function query( $query ){ + // Optimize the query + $query = self::processQuery( $query ); + + self::connect(); + //fix differences between sql versions + + // return the result + $result = self::$DBConnection->exec( $query ); + + // Die if we have an error (error means: bad query, not 0 results!) + if( PEAR::isError($result)) { + $entry = 'DB Error: "'.$result->getMessage().'"
'; + $entry .= 'Offending command was: '.$cmd.'
'; + error_log( $entry ); + die( $entry ); + } + + return $result; + } + + /** + * @brief Prepare a SQL query + * @param $query Query string + * @returns prepared SQL query + * + * SQL query via MDB2 prepare(), needs to be execute()'d! + */ + static public function prepare( $query ){ + // Optimize the query + $query = self::processQuery( $query ); + + self::connect(); + // return the result + $result = self::$DBConnection->prepare( $query ); + + // Die if we have an error (error means: bad query, not 0 results!) + if( PEAR::isError($result)) { + $entry = 'DB Error: "'.$result->getMessage().'"
'; + $entry .= 'Offending command was: '.$query.'
'; + error_log( $entry ); + die( $entry ); + } + + return $result; + } + + /** + * @brief gets last value of autoincrement + * @returns id + * + * MDB2 lastInsertID() + * + * Call this method right after the insert command or other functions may + * cause trouble! + */ + public static function insertid(){ + self::connect(); + return self::$DBConnection->lastInsertID(); + } + + /** + * @brief Disconnect + * @returns true/false + * + * This is good bye, good bye, yeah! + */ + public static function disconnect(){ + // Cut connection if required + if(self::$DBConnection){ + self::$DBConnection->disconnect(); + self::$DBConnection=false; + } + + return true; + } + + /** + * @brief Escapes bad characters + * @param $string string with dangerous characters + * @returns escaped string + * + * MDB2 escape() + */ + public static function escape( $string ){ + self::connect(); + return self::$DBConnection->escape( $string ); + } + + /** + * @brief saves database scheme to xml file + * @param $file name of file + * @returns true/false + * + * TODO: write more documentation + */ + public static function getDbStructure( $file ){ + self::connectScheme(); + + // write the scheme + $definition = self::$schema->getDefinitionFromDatabase(); + $dump_options = array( + 'output_mode' => 'file', + 'output' => $file, + 'end_of_line' => "\n" + ); + self::$schema->dumpDatabase( $definition, $dump_options, MDB2_SCHEMA_DUMP_STRUCTURE ); + + return true; + } + + /** + * @brief Creates tables from XML file + * @param $file file to read structure from + * @returns true/false + * + * TODO: write more documentation + */ + public static function createDbFromStructure( $file ){ + $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); + $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); + + self::connectScheme(); + + // read file + $content = file_get_contents( $file ); + + // Make changes and save them to a temporary file + $file2 = tempnam( sys_get_temp_dir(), 'oc_db_scheme_' ); + $content = str_replace( '*dbname*', $CONFIG_DBNAME, $content ); + $content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content ); + file_put_contents( $file2, $content ); + + // Try to create tables + $definition = self::$schema->parseDatabaseDefinitionFile( $file2 ); + + // Delete our temporary file + unlink( $file2 ); + + // Die in case something went wrong + if( $definition instanceof MDB2_Schema_Error ){ + die( $definition->getMessage().': '.$definition->getUserInfo()); + } +// if(OC_CONFIG::getValue('dbtype','sqlite')=='sqlite'){ +// $definition['overwrite']=true;//always overwrite for sqlite +// } + $ret=self::$schema->createDatabase( $definition ); + + // Die in case something went wrong + if( $ret instanceof MDB2_Error ){ + die ($ret->getMessage() . ': ' . $ret->getUserInfo()); + } + + return true; + } + + /** + * @brief connects to a MDB2 database scheme + * @returns true/false + * + * Connects to a MDB2 database scheme + */ + private static function connectScheme(){ + // We need a database connection + self::connect(); + + // Connect if this did not happen before + if(!self::$schema){ + require_once('MDB2/Schema.php'); + self::$schema=MDB2_Schema::factory(self::$DBConnection); + } + + return true; + } + + /** + * @brief does minor chages to query + * @param $query Query string + * @returns corrected query string + * + * This function replaces *PREFIX* with the value of $CONFIG_DBTABLEPREFIX + * and replaces the ` woth ' or " according to the database driver. + */ + private static function processQuery( $query ){ + self::connect(); + // We need Database type and table prefix + $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" ); + $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); + + // differences is getting the current timestamp + $query = str_replace( 'NOW()', self::$DBConnection->now(), $query ); + $query = str_replace( 'now()', self::$DBConnection->now(), $query ); + + // differences in escaping of table names (` for mysql) + // Problem: what if there is a ` in the value we want to insert? + if( $CONFIG_DBTYPE == 'sqlite' ){ + $query = str_replace( '`', '\'', $query ); + } + elseif( $CONFIG_DBTYPE == 'pgsql' ){ + $query = str_replace( '`', '"', $query ); + } + + // replace table name prefix + $query = str_replace( '*PREFIX*', $CONFIG_DBTABLEPREFIX, $query ); + + return $query; + } + + /** + * @brief drop a table + * @param string $tableNamme the table to drop + */ + public static function dropTable($tableName){ + self::connect(); + self::$DBConnection->loadModule('Manager'); + self::$DBConnection->dropTable($tableName); + } + + /** + * remove all tables defined in a database structure xml file + * @param string $file the xml file describing the tables + */ + public static function removeDBStructure($file){ + $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); + $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); + self::connectScheme(); + + // read file + $content = file_get_contents( $file ); + + // Make changes and save them to a temporary file + $file2 = tempnam( sys_get_temp_dir(), 'oc_db_scheme_' ); + $content = str_replace( '*dbname*', $CONFIG_DBNAME, $content ); + $content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content ); + file_put_contents( $file2, $content ); + + // get the tables + $definition = self::$schema->parseDatabaseDefinitionFile( $file2 ); + + // Delete our temporary file + unlink( $file2 ); + foreach($definition['tables'] as $name=>$table){ + self::dropTable($name); + } + } +} +?> \ No newline at end of file diff --git a/lib/files.php b/lib/files.php index d8133667954..d24eb282c45 100644 --- a/lib/files.php +++ b/lib/files.php @@ -21,9 +21,6 @@ * */ -require_once("log.php"); - - /** * Class for fileserver access * diff --git a/lib/group.php b/lib/group.php index 6510838ccfc..71caaee6132 100644 --- a/lib/group.php +++ b/lib/group.php @@ -78,7 +78,6 @@ class OC_GROUP { case 'database': case 'mysql': case 'sqlite': - require_once('Group/database.php'); self::$_backend = new OC_GROUP_DATABASE(); break; default: diff --git a/lib/group/backend.php b/lib/group/backend.php new file mode 100644 index 00000000000..298cced7ff5 --- /dev/null +++ b/lib/group/backend.php @@ -0,0 +1,96 @@ +. +* +*/ + + + +/** + * Abstract base class for user management + */ +abstract class OC_GROUP_BACKEND { + /** + * @brief Try to create a new group + * @param $gid The name of the group to create + * @returns true/false + * + * Trys to create a new group. If the group name already exists, false will + * be returned. + */ + public static function createGroup($gid){} + + /** + * @brief delete a group + * @param $gid gid of the group to delete + * @returns true/false + * + * Deletes a group and removes it from the group_user-table + */ + public static function removeGroup($gid){} + + /** + * @brief is user in group? + * @param $uid uid of the user + * @param $gid gid of the group + * @returns true/false + * + * Checks whether the user is member of a group or not. + */ + public static function inGroup($uid, $gid){} + + /** + * @brief Add a user to a group + * @param $uid Name of the user to add to group + * @param $gid Name of the group in which add the user + * @returns true/false + * + * Adds a user to a group. + */ + public static function addToGroup($uid, $gid){} + + /** + * @brief Removes a user from a group + * @param $uid Name of the user to remove from group + * @param $gid Name of the group from which remove the user + * @returns true/false + * + * removes the user from a group. + */ + public static function removeFromGroup($uid,$gid){} + + /** + * @brief Get all groups a user belongs to + * @param $uid Name of the user + * @returns array with group names + * + * This function fetches all groups a user belongs to. It does not check + * if the user exists at all. + */ + public static function getUserGroups($uid){} + + /** + * @brief get a list of all groups + * @returns array with group names + * + * Returns a list with all groups + */ + public static function getGroups(){} +} diff --git a/lib/group/database.php b/lib/group/database.php new file mode 100644 index 00000000000..8c04ca5d36b --- /dev/null +++ b/lib/group/database.php @@ -0,0 +1,177 @@ +. + * + */ +/* + * + * The following SQL statement is just a help for developers and will not be + * executed! + * + * CREATE TABLE `groups` ( + * `gid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + * PRIMARY KEY (`gid`) + * ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + * + * CREATE TABLE `group_user` ( + * `gid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + * `uid` varchar(64) COLLATE utf8_unicode_ci NOT NULL + * ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + * + */ + +/** + * Class for group management in a SQL Database (e.g. MySQL, SQLite) + */ +class OC_GROUP_DATABASE extends OC_GROUP_BACKEND { + static private $userGroupCache=array(); + + /** + * @brief Try to create a new group + * @param $gid The name of the group to create + * @returns true/false + * + * Trys to create a new group. If the group name already exists, false will + * be returned. + */ + public static function createGroup( $gid ){ + // Check for existence + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups` WHERE gid = ?" ); + $result = $query->execute( array( $gid )); + + if( $result->numRows() > 0 ){ + // Can not add an existing group + return false; + } + else{ + // Add group and exit + $query = OC_DB::prepare( "INSERT INTO `*PREFIX*groups` ( `gid` ) VALUES( ? )" ); + $result = $query->execute( array( $gid )); + + return $result ? true : false; + } + } + + /** + * @brief delete a group + * @param $gid gid of the group to delete + * @returns true/false + * + * Deletes a group and removes it from the group_user-table + */ + public static function deleteGroup( $gid ){ + // Delete the group + $query = OC_DB::prepare( "DELETE FROM `*PREFIX*groups` WHERE gid = ?" ); + $result = $query->execute( array( $gid )); + + // Delete the group-user relation + $query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE gid = ?" ); + $result = $query->execute( array( $gid )); + + return true; + } + + /** + * @brief is user in group? + * @param $uid uid of the user + * @param $gid gid of the group + * @returns true/false + * + * Checks whether the user is member of a group or not. + */ + public static function inGroup( $uid, $gid ){ + // check + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE gid = ? AND uid = ?" ); + $result = $query->execute( array( $gid, $uid )); + + return $result->numRows() > 0 ? true : false; + } + + /** + * @brief Add a user to a group + * @param $uid Name of the user to add to group + * @param $gid Name of the group in which add the user + * @returns true/false + * + * Adds a user to a group. + */ + public static function addToGroup( $uid, $gid ){ + // No duplicate entries! + if( !self::inGroup( $uid, $gid )){ + $query = OC_DB::prepare( "INSERT INTO `*PREFIX*group_user` ( `uid`, `gid` ) VALUES( ?, ? )" ); + $result = $query->execute( array( $uid, $gid )); + } + return true; + } + + /** + * @brief Removes a user from a group + * @param $uid Name of the user to remove from group + * @param $gid Name of the group from which remove the user + * @returns true/false + * + * removes the user from a group. + */ + public static function removeFromGroup( $uid, $gid ){ + $query = OC_DB::prepare( "DELETE FROM `*PREFIX*group_user` WHERE `uid` = ? AND `gid` = ?" ); + $result = $query->execute( array( $uid, $gid )); + + return true; + } + + /** + * @brief Get all groups a user belongs to + * @param $uid Name of the user + * @returns array with group names + * + * This function fetches all groups a user belongs to. It does not check + * if the user exists at all. + */ + public static function getUserGroups( $uid ){ + // No magic! + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*group_user` WHERE uid = ?" ); + $result = $query->execute( array( $uid )); + + $groups = array(); + while( $row = $result->fetchRow()){ + $groups[] = $row["gid"]; + } + + return $groups; + } + + /** + * @brief get a list of all groups + * @returns array with group names + * + * Returns a list with all groups + */ + public static function getGroups(){ + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*groups`" ); + $result = $query->execute(); + + $groups = array(); + while( $row = $result->fetchRow()){ + $groups[] = $row["gid"]; + } + + return $groups; + } +} diff --git a/lib/hook.php b/lib/hook.php new file mode 100644 index 00000000000..08b6d5e8b6b --- /dev/null +++ b/lib/hook.php @@ -0,0 +1,69 @@ + $slotclass, + "name" => $slotname ); + + // No chance for failure ;-) + return true; + } + + /** + * @brief emitts a signal + * @param $signalclass class name of emitter + * @param $signalname name of signal + * @param $params defautl: array() array with additional data + * @returns true if slots exists or false if not + * + * Emits a signal. To get data from the slot use references! + * + * TODO: write example + */ + static public function emit( $signalclass, $signalname, $params = array()){ + // Return false if there are no slots + if( !array_key_exists( $signalclass, self::$registered )){ + return false; + } + if( !array_key_exists( $signalname, self::$registered[$signalclass] )){ + return false; + } + + // Call all slots + foreach( self::$registered[$signalclass][$signalname] as $i ){ + call_user_func( array( $i["class"], $i["name"] ), $params ); + } + + // return true + return true; + } +} + diff --git a/lib/user.php b/lib/user.php index a64ce05f2c9..b93e2133352 100644 --- a/lib/user.php +++ b/lib/user.php @@ -95,7 +95,6 @@ class OC_USER { case 'database': case 'mysql': case 'sqlite': - require_once('User/database.php'); self::$_usedBackends[$backend] = new OC_USER_DATABASE(); break; default: diff --git a/lib/user/backend.php b/lib/user/backend.php new file mode 100644 index 00000000000..1797d0c475a --- /dev/null +++ b/lib/user/backend.php @@ -0,0 +1,86 @@ +. + * + */ + +/** + * error code for functions not provided by the user backend + */ +define('OC_USER_BACKEND_NOT_IMPLEMENTED', -501); + +/** + * actions that user backends can define + */ +define('OC_USER_BACKEND_CREATE_USER', 0x000001); +define('OC_USER_BACKEND_DELETE_USER', 0x000010); +define('OC_USER_BACKEND_SET_PASSWORD', 0x000100); +define('OC_USER_BACKEND_CHECK_PASSWORD', 0x001000); +define('OC_USER_BACKEND_GET_USERS', 0x010000); +define('OC_USER_BACKEND_USER_EXISTS', 0x100000); + + +/** + * abstract base class for user management + * subclass this for your own backends and see OC_USER_EXAMPLE for descriptions + */ +abstract class OC_USER_BACKEND { + + protected $possibleActions = array( + OC_USER_BACKEND_CREATE_USER => 'createUser', + OC_USER_BACKEND_DELETE_USER => 'deleteUser', + OC_USER_BACKEND_SET_PASSWORD => 'setPassword', + OC_USER_BACKEND_CHECK_PASSWORD => 'checkPassword', + OC_USER_BACKEND_GET_USERS => 'getUsers', + OC_USER_BACKEND_USER_EXISTS => 'userExists' + ); + + /** + * @brief Get all supported actions + * @returns bitwise-or'ed actions + * + * Returns the supported actions as int to be + * compared with OC_USER_BACKEND_CREATE_USER etc. + */ + public function getSupportedActions(){ + $actions = 0; + foreach($this->possibleActions AS $action => $methodName){ + if(method_exists($this, $methodName)) { + $actions |= $action; + } + } + + return $actions; + } + + /** + * @brief Check if backend implements actions + * @param $actions bitwise-or'ed actions + * @returns boolean + * + * Returns the supported actions as int to be + * compared with OC_USER_BACKEND_CREATE_USER etc. + */ + public function implementsActions($actions){ + return (bool)($this->getSupportedActions() & $actions); + } +} diff --git a/lib/user/database.php b/lib/user/database.php new file mode 100644 index 00000000000..ace3c897703 --- /dev/null +++ b/lib/user/database.php @@ -0,0 +1,145 @@ +. + * + */ +/* + * + * The following SQL statement is just a help for developers and will not be + * executed! + * + * CREATE TABLE `users` ( + * `uid` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + * `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + * PRIMARY KEY (`uid`) + * ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + * + */ + +/** + * Class for user management in a SQL Database (e.g. MySQL, SQLite) + */ +class OC_USER_DATABASE extends OC_USER_BACKEND { + static private $userGroupCache=array(); + + /** + * @brief Create a new user + * @param $uid The username of the user to create + * @param $password The password of the new user + * @returns true/false + * + * Creates a new user. Basic checking of username is done in OC_USER + * itself, not in its subclasses. + */ + public function createUser( $uid, $password ){ + if( $this->userExists($uid) ){ + return false; + } + else{ + $query = OC_DB::prepare( "INSERT INTO `*PREFIX*users` ( `uid`, `password` ) VALUES( ?, ? )" ); + $result = $query->execute( array( $uid, sha1( $password ))); + + return $result ? true : false; + } + } + + /** + * @brief delete a user + * @param $uid The username of the user to delete + * @returns true/false + * + * Deletes a user + */ + public function deleteUser( $uid ){ + // Delete user-group-relation + $query = OC_DB::prepare( "DELETE FROM `*PREFIX*users` WHERE uid = ?" ); + $result = $query->execute( array( $uid )); + return true; + } + + /** + * @brief Set password + * @param $uid The username + * @param $password The new password + * @returns true/false + * + * Change the password of a user + */ + public function setPassword( $uid, $password ){ + if( $this->userExists($uid) ){ + $query = OC_DB::prepare( "UPDATE *PREFIX*users SET password = ? WHERE uid = ?" ); + $result = $query->execute( array( sha1( $password ), $uid )); + + return true; + } + else{ + return false; + } + } + + /** + * @brief Check if the password is correct + * @param $uid The username + * @param $password The password + * @returns true/false + * + * Check if the password is correct without logging in the user + */ + public function checkPassword( $uid, $password ){ + $query = OC_DB::prepare( "SELECT uid FROM *PREFIX*users WHERE uid = ? AND password = ?" ); + $result = $query->execute( array( $uid, sha1( $password ))); + + if( $result->numRows() > 0 ){ + return true; + } + else{ + return false; + } + } + + /** + * @brief Get a list of all users + * @returns array with all uids + * + * Get a list of all users. + */ + public function getUsers(){ + $query = OC_DB::prepare( "SELECT uid FROM *PREFIX*users" ); + $result = $query->execute(); + + $users=array(); + while( $row = $result->fetchRow()){ + $users[] = $row["uid"]; + } + return $users; + } + + /** + * @brief check if a user exists + * @param string $uid the username + * @return boolean + */ + public function userExists($uid){ + $query = OC_DB::prepare( "SELECT * FROM `*PREFIX*users` WHERE uid = ?" ); + $result = $query->execute( array( $uid )); + + return $result->numRows() > 0; + } +} diff --git a/lib/user/example.php b/lib/user/example.php new file mode 100644 index 00000000000..069f14492a4 --- /dev/null +++ b/lib/user/example.php @@ -0,0 +1,95 @@ +. + * + */ + +/** + * abstract reference class for user management + * this class should only be used as a reference for method signatures and their descriptions + */ +abstract class OC_USER_EXAMPLE extends OC_USER_BACKEND { + /** + * @brief Create a new user + * @param $uid The username of the user to create + * @param $password The password of the new user + * @returns true/false + * + * Creates a new user. Basic checking of username is done in OC_USER + * itself, not in its subclasses. + */ + public function createUser($uid, $password){ + return OC_USER_BACKEND_NOT_IMPLEMENTED; + } + + /** + * @brief delete a user + * @param $uid The username of the user to delete + * @returns true/false + * + * Deletes a user + */ + public function deleteUser( $uid ){ + return OC_USER_BACKEND_NOT_IMPLEMENTED; + } + + /** + * @brief Set password + * @param $uid The username + * @param $password The new password + * @returns true/false + * + * Change the password of a user + */ + public function setPassword($uid, $password){ + return OC_USER_BACKEND_NOT_IMPLEMENTED; + } + + /** + * @brief Check if the password is correct + * @param $uid The username + * @param $password The password + * @returns true/false + * + * Check if the password is correct without logging in the user + */ + public function checkPassword($uid, $password){ + return OC_USER_BACKEND_NOT_IMPLEMENTED; + } + + /** + * @brief Get a list of all users + * @returns array with all uids + * + * Get a list of all users. + */ + public function getUsers(){ + return OC_USER_BACKEND_NOT_IMPLEMENTED; + } + + /** + * @brief check if a user exists + * @param string $uid the username + * @return boolean + */ + public function userExists($uid){ + return OC_USER_BACKEND_NOT_IMPLEMENTED; + } +} diff --git a/lib/util.php b/lib/util.php new file mode 100644 index 00000000000..8beb4a884bc --- /dev/null +++ b/lib/util.php @@ -0,0 +1,245 @@ +$CONFIG_DATADIRECTORY_ROOT)); +// if( OC_CONFIG::getValue( "enablebackup", false )){ +// // This creates the Directorys recursively +// if(!is_dir( "$CONFIG_BACKUPDIRECTORY/$user/$root" )){ +// mkdir( "$CONFIG_BACKUPDIRECTORY/$user/$root", 0755, true ); +// } +// $backupStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_BACKUPDIRECTORY)); +// $backup=new OC_FILEOBSERVER_BACKUP(array('storage'=>$backupStorage)); +// $rootStorage->addObserver($backup); +// } + OC_FILESYSTEM::mount($rootStorage,'/'); + + $CONFIG_DATADIRECTORY = "$CONFIG_DATADIRECTORY_ROOT/$user/$root"; + if( !is_dir( $CONFIG_DATADIRECTORY )){ + mkdir( $CONFIG_DATADIRECTORY, 0755, true ); + } + +// TODO: find a cool way for doing this +// //set up the other storages according to the system settings +// foreach($CONFIG_FILESYSTEM as $storageConfig){ +// if(OC_FILESYSTEM::hasStorageType($storageConfig['type'])){ +// $arguments=$storageConfig; +// unset($arguments['type']); +// unset($arguments['mountpoint']); +// $storage=OC_FILESYSTEM::createStorage($storageConfig['type'],$arguments); +// if($storage){ +// OC_FILESYSTEM::mount($storage,$storageConfig['mountpoint']); +// } +// } +// } + + //jail the user into his "home" directory + OC_FILESYSTEM::chroot("/$user/$root"); + self::$fsSetup=true; + } + } + + public static function tearDownFS(){ + OC_FILESYSTEM::tearDown(); + self::$fsSetup=false; + } + + /** + * get the current installed version of ownCloud + * @return array + */ + public static function getVersion(){ + return array(1,60,0); + } + + /** + * add a javascript file + * + * @param url $url + */ + public static function addScript( $application, $file = null ){ + if( is_null( $file )){ + $file = $application; + $application = ""; + } + if( !empty( $application )){ + self::$scripts[] = "$application/js/$file"; + }else{ + self::$scripts[] = "js/$file"; + } + } + + /** + * add a css file + * + * @param url $url + */ + public static function addStyle( $application, $file = null ){ + if( is_null( $file )){ + $file = $application; + $application = ""; + } + if( !empty( $application )){ + self::$styles[] = "$application/css/$file"; + }else{ + self::$styles[] = "css/$file"; + } + } + + /** + * @brief Add a custom element to the header + * @param string tag tag name of the element + * @param array $attributes array of attrobutes for the element + * @param string $text the text content for the element + */ + public static function addHeader( $tag, $attributes, $text=''){ + self::$headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text); + } + + /** + * formats a timestamp in the "right" way + * + * @param int timestamp $timestamp + * @param bool dateOnly option to ommit time from the result + */ + public static function formatDate( $timestamp,$dateOnly=false){ + if(isset($_SESSION['timezone'])){//adjust to clients timezone if we know it + $systemTimeZone = intval(exec('date +%z')); + $systemTimeZone=(round($systemTimeZone/100,0)*60)+($systemTimeZone%100); + $clientTimeZone=$_SESSION['timezone']*60; + $offset=$clientTimeZone-$systemTimeZone; + $timestamp=$timestamp+$offset*60; + } + $timeformat=$dateOnly?'F j, Y':'F j, Y, H:i'; + return date($timeformat,$timestamp); + } + + /** + * Shows a pagenavi widget where you can jump to different pages. + * + * @param int $pagecount + * @param int $page + * @param string $url + * @return OC_TEMPLATE + */ + public static function getPageNavi($pagecount,$page,$url) { + + $pagelinkcount=8; + if ($pagecount>1) { + $pagestart=$page-$pagelinkcount; + if($pagestart<0) $pagestart=0; + $pagestop=$page+$pagelinkcount; + if($pagestop>$pagecount) $pagestop=$pagecount; + + $tmpl = new OC_TEMPLATE( '', 'part.pagenavi', '' ); + $tmpl->assign('page',$page); + $tmpl->assign('pagecount',$pagecount); + $tmpl->assign('pagestart',$pagestart); + $tmpl->assign('pagestop',$pagestop); + $tmpl->assign('url',$url); + return $tmpl; + } + } + + + + /** + * check if the current server configuration is suitable for ownCloud + * @return array arrays with error messages and hints + */ + public static function checkServer(){ + global $SERVERROOT; + global $CONFIG_DATADIRECTORY; + + $CONFIG_DATADIRECTORY_ROOT = OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );; + $CONFIG_BACKUPDIRECTORY = OC_CONFIG::getValue( "backupdirectory", "$SERVERROOT/backup" ); + $CONFIG_INSTALLED = OC_CONFIG::getValue( "installed", false ); + $errors=array(); + + //check for database drivers + if(!is_callable('sqlite_open') and !is_callable('mysql_connect')){ + $errors[]=array('error'=>'No database drivers (sqlite or mysql) installed.
','hint'=>'');//TODO: sane hint + } + $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" ); + $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); + + //try to get the username the httpd server runs on, used in hints + $stat=stat($_SERVER['DOCUMENT_ROOT']); + if(is_callable('posix_getpwuid')){ + $serverUser=posix_getpwuid($stat['uid']); + $serverUser='\''.$serverUser['name'].'\''; + }else{ + $serverUser='\'www-data\' for ubuntu/debian';//TODO: try to detect the distro and give a guess based on that + } + + //common hint for all file permissons error messages + $permissionsHint="Permissions can usually be fixed by setting the owner of the file or directory to the user the web server runs as ($serverUser)"; + + //check for correct file permissions + if(!stristr(PHP_OS, 'WIN')){ + $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); + if(substr($prems,-1)!='0'){ + OC_HELPER::chmodr($CONFIG_DATADIRECTORY_ROOT,0770); + clearstatcache(); + $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); + if(substr($prems,2,1)!='0'){ + $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web
','hint'=>$permissionsHint); + } + } + if( OC_CONFIG::getValue( "enablebackup", false )){ + $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); + if(substr($prems,-1)!='0'){ + OC_HELPER::chmodr($CONFIG_BACKUPDIRECTORY,0770); + clearstatcache(); + $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); + if(substr($prems,2,1)!='0'){ + $errors[]=array('error'=>'Data directory ('.$CONFIG_BACKUPDIRECTORY.') is readable from the web
','hint'=>$permissionsHint); + } + } + } + }else{ + //TODO: premisions checks for windows hosts + } + if(is_dir($CONFIG_DATADIRECTORY_ROOT) and !is_writable($CONFIG_DATADIRECTORY_ROOT)){ + $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') not writable by ownCloud
','hint'=>$permissionsHint); + } + + //TODO: check for php modules + + return $errors; + } +} + -- cgit v1.2.3 From 2f807a3c7f6e5a3a8a8e8317a3b3b627d3d68952 Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Wed, 27 Jul 2011 19:25:49 +0200 Subject: Delete requires in applications where possible --- admin/apps.php | 2 -- admin/system.php | 1 - admin/users.php | 1 - apps/files_publiclink/admin.php | 1 - apps/files_publiclink/get.php | 1 - apps/media/index.php | 1 - apps/media/settings.php | 1 - apps/user_ldap/settings.php | 1 - apps/user_ldap/user_ldap.php | 2 -- apps/user_openid/phpmyid.php | 3 --- apps/user_openid/settings.php | 1 - apps/user_openid/user_openid.php | 1 - core/templates/404.php | 1 - docs/skeleton/admin.php | 3 --- docs/skeleton/index.php | 1 - files/admin.php | 1 - files/ajax/list.php | 1 - files/download.php | 1 - files/index.php | 1 - files/settings.php | 1 - files/webdav.php | 5 ----- help/index.php | 1 - index.php | 4 +--- log/index.php | 1 - search/index.php | 1 - settings/index.php | 1 - tests/index.php | 2 -- 27 files changed, 1 insertion(+), 40 deletions(-) diff --git a/admin/apps.php b/admin/apps.php index bc598a6991e..4bbf1c813b0 100644 --- a/admin/apps.php +++ b/admin/apps.php @@ -22,8 +22,6 @@ */ require_once('../lib/base.php'); -include_once('../lib/installer.php'); -require( 'template.php' ); if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){ header( "Location: ".OC_HELPER::linkTo( "", "index.php" )); exit(); diff --git a/admin/system.php b/admin/system.php index 284509144ee..9286ab9c2b3 100644 --- a/admin/system.php +++ b/admin/system.php @@ -22,7 +22,6 @@ */ 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" )); exit(); diff --git a/admin/users.php b/admin/users.php index 8237d06da0b..4065cc471f1 100644 --- a/admin/users.php +++ b/admin/users.php @@ -22,7 +22,6 @@ */ 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" )); exit(); diff --git a/apps/files_publiclink/admin.php b/apps/files_publiclink/admin.php index afb726da312..9a1a9ce03c2 100644 --- a/apps/files_publiclink/admin.php +++ b/apps/files_publiclink/admin.php @@ -25,7 +25,6 @@ // Init owncloud require_once('../../lib/base.php'); require_once( 'lib_public.php' ); -require( 'template.php' ); // Check if we are a user diff --git a/apps/files_publiclink/get.php b/apps/files_publiclink/get.php index d3e3022e761..3bc961bc37d 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'; diff --git a/apps/media/index.php b/apps/media/index.php index 26e008acab5..fbf1c395d99 100644 --- a/apps/media/index.php +++ b/apps/media/index.php @@ -32,7 +32,6 @@ if( !OC_USER::isLoggedIn()){ require_once('lib_collection.php'); require_once('lib_scanner.php'); -require_once('template.php'); OC_UTIL::addScript('media','player'); OC_UTIL::addScript('media','music'); diff --git a/apps/media/settings.php b/apps/media/settings.php index 30276601a2d..4bd9acfd80b 100644 --- a/apps/media/settings.php +++ b/apps/media/settings.php @@ -29,7 +29,6 @@ if( !OC_USER::isLoggedIn()){ exit(); } -require( 'template.php' ); require( 'lib_collection.php' ); OC_UTIL::addStyle('media','style'); diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php index f7aff1b4614..8f9d282d2b1 100644 --- a/apps/user_ldap/settings.php +++ b/apps/user_ldap/settings.php @@ -22,7 +22,6 @@ */ 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" )); diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index a2fd48cdf06..a197c0a10e0 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -21,8 +21,6 @@ * */ -require_once('User/backend.php'); - class OC_USER_LDAP extends OC_USER_BACKEND { protected $ds; diff --git a/apps/user_openid/phpmyid.php b/apps/user_openid/phpmyid.php index 146eb380f73..f35e6811b84 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 */ diff --git a/apps/user_openid/settings.php b/apps/user_openid/settings.php index 76316de100c..29c18eaa497 100644 --- a/apps/user_openid/settings.php +++ b/apps/user_openid/settings.php @@ -1,7 +1,6 @@ printPage(); diff --git a/docs/skeleton/admin.php b/docs/skeleton/admin.php index aaf6136692d..723c7f7612b 100644 --- a/docs/skeleton/admin.php +++ b/docs/skeleton/admin.php @@ -31,9 +31,6 @@ require_once('../lib/base.php'); // We need the file system although we said do not load it! Do it by hand now OC_UTIL::setupFS(); -// We load OC_TEMPLATE, too. This one is not loaded by base -require( 'template.php' ); - // The user should have admin rights. This is an admin page! if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){ // Bad boy! Go to the very first page of owncloud diff --git a/docs/skeleton/index.php b/docs/skeleton/index.php index 6d237ed6152..5402990e4c9 100644 --- a/docs/skeleton/index.php +++ b/docs/skeleton/index.php @@ -24,7 +24,6 @@ // Init owncloud require_once('../lib/base.php'); -require( 'template.php' ); // Check if we are a user if( !OC_USER::isLoggedIn()){ diff --git a/files/admin.php b/files/admin.php index 5c9923aff86..c0a41335f5e 100644 --- a/files/admin.php +++ b/files/admin.php @@ -24,7 +24,6 @@ // Init owncloud require_once('../lib/base.php'); -require( 'template.php' ); // Check if we are a user diff --git a/files/ajax/list.php b/files/ajax/list.php index ef43e72fcae..26462eb5ab9 100644 --- a/files/ajax/list.php +++ b/files/ajax/list.php @@ -2,7 +2,6 @@ // Init owncloud require_once('../../lib/base.php'); -require_once('../../lib/template.php'); // We send json data header( "Content-Type: application/jsonrequest" ); diff --git a/files/download.php b/files/download.php index f7fbcd0f857..ab3dee51348 100644 --- a/files/download.php +++ b/files/download.php @@ -23,7 +23,6 @@ // Init owncloud require_once('../lib/base.php'); -require( 'template.php' ); // Check if we are a user if( !OC_USER::isLoggedIn()){ diff --git a/files/index.php b/files/index.php index 550f23541a0..4f40e70393b 100644 --- a/files/index.php +++ b/files/index.php @@ -24,7 +24,6 @@ // Init owncloud require_once('../lib/base.php'); -require( 'template.php' ); // Check if we are a user if( !OC_USER::isLoggedIn()){ diff --git a/files/settings.php b/files/settings.php index 23aed4d1b86..447a38b1815 100644 --- a/files/settings.php +++ b/files/settings.php @@ -24,7 +24,6 @@ // Init owncloud require_once('../lib/base.php'); -require( 'template.php' ); // Check if we are a user if( !OC_USER::isLoggedIn()){ diff --git a/files/webdav.php b/files/webdav.php index 7dce0b48197..a59dee70c2e 100644 --- a/files/webdav.php +++ b/files/webdav.php @@ -28,11 +28,6 @@ $RUNTIME_NOSETUPFS = true; require_once('../lib/base.php'); require_once('Sabre/autoload.php'); -require_once('Connector/Sabre/auth.php'); -require_once('Connector/Sabre/node.php'); -require_once('Connector/Sabre/file.php'); -require_once('Connector/Sabre/directory.php'); -require_once('Connector/Sabre/locks.php'); // Create ownCloud Dir $publicDir = new OC_Connector_Sabre_Directory(''); diff --git a/help/index.php b/help/index.php index de461c29412..adcb47f08f6 100644 --- a/help/index.php +++ b/help/index.php @@ -1,7 +1,6 @@ Date: Wed, 27 Jul 2011 19:52:24 +0200 Subject: One class per File --- lib/filestorage.php | 412 --------------------------------------------- lib/filestorage/local.php | 414 ++++++++++++++++++++++++++++++++++++++++++++++ lib/remote/cloud.php | 206 +++++++++++++++++++++++ 3 files changed, 620 insertions(+), 412 deletions(-) create mode 100644 lib/filestorage/local.php create mode 100644 lib/remote/cloud.php diff --git a/lib/filestorage.php b/lib/filestorage.php index 95e8c31eff2..46612687a92 100644 --- a/lib/filestorage.php +++ b/lib/filestorage.php @@ -61,416 +61,4 @@ class OC_FILESTORAGE{ OC_FILESYSTEM::registerStorageType('local','OC_FILESTORAGE_LOCAL',array('datadir'=>'string')); -/** - * for local filestore, we only have to map the paths - */ -class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ - private $datadir; - private static $mimetypes=null; - public function __construct($arguments){ - $this->datadir=$arguments['datadir']; - if(substr($this->datadir,-1)!=='/'){ - $this->datadir.='/'; - } - } - public function mkdir($path){ - if($return=mkdir($this->datadir.$path)){ - $this->clearFolderSizeCache($path); - } - return $return; - } - public function rmdir($path){ - if($return=rmdir($this->datadir.$path)){ - $this->clearFolderSizeCache($path); - } - return $return; - } - public function opendir($path){ - return opendir($this->datadir.$path); - } - public function is_dir($path){ - return (is_dir($this->datadir.$path) or substr($path,-1)=='/'); - } - public function is_file($path){ - return is_file($this->datadir.$path); - } - public function stat($path){ - return stat($this->datadir.$path); - } - public function filetype($path){ - $filetype=filetype($this->datadir.$path); - if($filetype=='link'){ - $filetype=filetype(readlink($this->datadir.$path)); - } - return $filetype; - } - public function filesize($path){ - if($this->is_dir($path)){ - return $this->getFolderSize($path); - }else{ - return filesize($this->datadir.$path); - } - } - public function is_readable($path){ - return is_readable($this->datadir.$path); - } - public function is_writeable($path){ - return is_writeable($this->datadir.$path); - } - public function file_exists($path){ - return file_exists($this->datadir.$path); - } - public function readfile($path){ - return readfile($this->datadir.$path); - } - public function filectime($path){ - return filectime($this->datadir.$path); - } - public function filemtime($path){ - return filemtime($this->datadir.$path); - } - public function fileatime($path){ - return fileatime($this->datadir.$path); - } - public function file_get_contents($path){ - return file_get_contents($this->datadir.$path); - } - public function file_put_contents($path,$data){ - if($return=file_put_contents($this->datadir.$path,$data)){ - $this->clearFolderSizeCache($path); - } - } - public function unlink($path){ - if($return=unlink($this->datadir.$path)){ - $this->clearFolderSizeCache($path); - } - return $return; - } - public function rename($path1,$path2){ - if($return=rename($this->datadir.$path1,$this->datadir.$path2)){ - $this->clearFolderSizeCache($path1); - $this->clearFolderSizeCache($path2); - } - return $return; - } - public function copy($path1,$path2){ - if($this->is_dir($path2)){ - if(!$this->file_exists($path2)){ - $this->mkdir($path2); - } - $source=substr($path1,strrpos($path1,'/')+1); - $path2.=$source; - } - if($return=copy($this->datadir.$path1,$this->datadir.$path2)){ - $this->clearFolderSizeCache($path2); - } - return $return; - } - public function fopen($path,$mode){ - if($return=fopen($this->datadir.$path,$mode)){ - switch($mode){ - case 'r': - break; - case 'r+': - case 'w+': - case 'x+': - case 'a+': - $this->clearFolderSizeCache($path); - break; - case 'w': - case 'x': - case 'a': - $this->clearFolderSizeCache($path); - break; - } - } - return $return; - } - - public function getMimeType($fspath){ - if($this->is_readable($fspath)){ - if (@is_dir($this->datadir.$fspath)) { - // directories are easy - return "httpd/unix-directory"; - }elseif (function_exists('finfo_open') and function_exists('finfo_file') and $finfo=finfo_open(FILEINFO_MIME)){ - $mimeType =strtolower(finfo_file($finfo,$this->datadir.$fspath)); - $mimeType=substr($mimeType,0,strpos($mimeType,';')); - finfo_close($finfo); - return $mimeType; - } else if (function_exists("mime_content_type")) { - // use mime magic extension if available - $mime_type = mime_content_type($this->datadir.$fspath); - } else if (self::canExecute("file")) { - // it looks like we have a 'file' command, - // lets see it it does have mime support - $fp = popen("file -i -b '{$this->datadir}$fspath' 2>/dev/null", "r"); - $reply = fgets($fp); - pclose($fp); - - //trim the character set from the end of the response - $mime_type=substr($reply,0,strrpos($reply,' ')); - } - if (empty($mime_type)) { - // Fallback solution: (try to guess the type by the file extension - if(!self::$mimetypes){ - self::$mimetypes=include('mimetypes.list.php'); - } - $extention=strtolower(strrchr(basename($fspath), ".")); - $extention=substr($extention,1);//remove leading . - $mime_type=(isset(self::$mimetypes[$extention]))?self::$mimetypes[$extention]:'application/octet-stream'; - } - return $mime_type; - } - } - - /** - * detect if a given program is found in the search PATH - * - * helper function used by _mimetype() to detect if the - * external 'file' utility is available - * - * @param string program name - * @param string optional search path, defaults to $PATH - * @return bool true if executable program found in path - */ - private function canExecute($name, $path = false) - { - // path defaults to PATH from environment if not set - if ($path === false) { - $path = getenv("PATH"); - } - - // check method depends on operating system - if (!strncmp(PHP_OS, "WIN", 3)) { - // on Windows an appropriate COM or EXE file needs to exist - $exts = array(".exe", ".com"); - $check_fn = "file_exists"; - } else { - // anywhere else we look for an executable file of that name - $exts = array(""); - $check_fn = "is_executable"; - } - - // Default check will be done with $path directories : - $dirs = explode(PATH_SEPARATOR, $path); - - // WARNING : We have to check if open_basedir is enabled : - $obd = ini_get('open_basedir'); - - if($obd != "none") - $obd_values = explode(PATH_SEPARATOR, $obd); - - if(count($obd_values) > 0) - { - // open_basedir is in effect ! - // We need to check if the program is in one of these dirs : - $dirs = $obd_values; - } - - foreach($dirs as $dir) - { - foreach($exts as $ext) - { - if($check_fn("$dir/$name".$ext)) - return true; - } - } - - return false; - } - - public function toTmpFile($path){ - $tmpFolder=sys_get_temp_dir(); - $filename=tempnam($tmpFolder,'OC_TEMP_FILE_'.substr($path,strrpos($path,'.'))); - $fileStats = stat($this->datadir.$path); - if(copy($this->datadir.$path,$filename)){ - touch($filename, $fileStats['mtime'], $fileStats['atime']); - return $filename; - }else{ - return false; - } - } - - public function fromTmpFile($tmpFile,$path){ - $fileStats = stat($tmpFile); - if(rename($tmpFile,$this->datadir.$path)){ - touch($this->datadir.$path, $fileStats['mtime'], $fileStats['atime']); - $this->clearFolderSizeCache($path); - return true; - }else{ - return false; - } - } - - public function fromUploadedFile($tmpFile,$path){ - $fileStats = stat($tmpFile); - if(move_uploaded_file($tmpFile,$this->datadir.$path)){ - touch($this->datadir.$path, $fileStats['mtime'], $fileStats['atime']); - $this->clearFolderSizeCache($path); - return true; - }else{ - return false; - } - } - - public function delTree($dir) { - $dirRelative=$dir; - $dir=$this->datadir.$dir; - if (!file_exists($dir)) return true; - if (!is_dir($dir) || is_link($dir)) return unlink($dir); - foreach (scandir($dir) as $item) { - if ($item == '.' || $item == '..') continue; - if(is_file($dir.'/'.$item)){ - if(unlink($dir.'/'.$item)){ - $this->clearFolderSizeCache($dir); - } - }elseif(is_dir($dir.'/'.$item)){ - if (!$this->delTree($dirRelative. "/" . $item)){ - return false; - }; - } - } - if($return=rmdir($dir)){ - $this->clearFolderSizeCache($dir); - } - return $return; - } - - public function find($path){ - $return=System::find($this->datadir.$path); - foreach($return as &$file){ - $file=str_replace($file,$this->datadir,''); - } - return $return; - } - - public function getTree($dir) { - if(substr($dir,-1,1)=='/'){ - $dir=substr($dir,0,-1); - } - $tree=array(); - $tree[]=$dir; - $dirRelative=$dir; - $dir=$this->datadir.$dir; - if (!file_exists($dir)) return true; - foreach (scandir($dir) as $item) { - if ($item == '.' || $item == '..') continue; - if(is_file($dir.'/'.$item)){ - $tree[]=$dirRelative.'/'.$item; - }elseif(is_dir($dir.'/'.$item)){ - if ($subTree=$this->getTree($dirRelative. "/" . $item)){ - $tree=array_merge($tree,$subTree); - } - } - } - return $tree; - } - - public function hash($type,$path,$raw){ - return hash_file($type,$this->datadir.$path,$raw); - } - - public function free_space($path){ - return disk_free_space($this->datadir.$path); - } - - public function search($query){ - return $this->searchInDir($query); - } - public function getLocalFile($path){ - return $this->datadir.$path; - } - - private function searchInDir($query,$dir=''){ - $files=array(); - foreach (scandir($this->datadir.$dir) as $item) { - if ($item == '.' || $item == '..') continue; - if(strstr(strtolower($item),strtolower($query))!==false){ - $files[]=$dir.'/'.$item; - } - if(is_dir($this->datadir.$dir.'/'.$item)){ - $files=array_merge($files,$this->searchInDir($query,$dir.'/'.$item)); - } - } - return $files; - } - - /** - * @brief get the size of folder and it's content - * @param string $path file path - * @return int size of folder and it's content - */ - public function getFolderSize($path){ - $path=str_replace('//','/',$path); - if($this->is_dir($path) and substr($path,-1)!='/'){ - $path.='/'; - } - $query=OC_DB::prepare("SELECT size FROM *PREFIX*foldersize WHERE path=?"); - $size=$query->execute(array($path))->fetchAll(); - if(count($size)>0){// we already the size, just return it - return $size[0]['size']; - }else{//the size of the folder isn't know, calulate it - return $this->calculateFolderSize($path); - } - } - - /** - * @brief calulate the size of folder and it's content and cache it - * @param string $path file path - * @return int size of folder and it's content - */ - public function calculateFolderSize($path){ - if($this->is_file($path)){ - $path=dirname($path); - } - $path=str_replace('//','/',$path); - if($this->is_dir($path) and substr($path,-1)!='/'){ - $path.='/'; - } - $size=0; - if ($dh = $this->opendir($path)) { - while (($filename = readdir($dh)) !== false) { - if($filename!='.' and $filename!='..'){ - $subFile=$path.'/'.$filename; - if($this->is_file($subFile)){ - $size+=$this->filesize($subFile); - }else{ - $size+=$this->getFolderSize($subFile); - } - } - } - if($size>0){ - $query=OC_DB::prepare("INSERT INTO *PREFIX*foldersize VALUES(?,?)"); - $result=$query->execute(array($path,$size)); - } - } - return $size; - } - - /** - * @brief clear the folder size cache of folders containing a file - * @param string $path - */ - public function clearFolderSizeCache($path){ - if($this->is_file($path)){ - $path=dirname($path); - } - $path=str_replace('//','/',$path); - if($this->is_dir($path) and substr($path,-1)!='/'){ - $path.='/'; - } - $query=OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?"); - $result=$query->execute(array($path)); - if($path!='/' and $path!=''){ - $parts=explode('/',$path); - //pop empty part - $part=array_pop($parts); - if(empty($part)){ - array_pop($parts); - } - $parent=implode('/',$parts); - $this->clearFolderSizeCache($parent); - } - } -} ?> \ No newline at end of file diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php new file mode 100644 index 00000000000..81a00dd8f4d --- /dev/null +++ b/lib/filestorage/local.php @@ -0,0 +1,414 @@ +datadir=$arguments['datadir']; + if(substr($this->datadir,-1)!=='/'){ + $this->datadir.='/'; + } + } + public function mkdir($path){ + if($return=mkdir($this->datadir.$path)){ + $this->clearFolderSizeCache($path); + } + return $return; + } + public function rmdir($path){ + if($return=rmdir($this->datadir.$path)){ + $this->clearFolderSizeCache($path); + } + return $return; + } + public function opendir($path){ + return opendir($this->datadir.$path); + } + public function is_dir($path){ + return (is_dir($this->datadir.$path) or substr($path,-1)=='/'); + } + public function is_file($path){ + return is_file($this->datadir.$path); + } + public function stat($path){ + return stat($this->datadir.$path); + } + public function filetype($path){ + $filetype=filetype($this->datadir.$path); + if($filetype=='link'){ + $filetype=filetype(readlink($this->datadir.$path)); + } + return $filetype; + } + public function filesize($path){ + if($this->is_dir($path)){ + return $this->getFolderSize($path); + }else{ + return filesize($this->datadir.$path); + } + } + public function is_readable($path){ + return is_readable($this->datadir.$path); + } + public function is_writeable($path){ + return is_writeable($this->datadir.$path); + } + public function file_exists($path){ + return file_exists($this->datadir.$path); + } + public function readfile($path){ + return readfile($this->datadir.$path); + } + public function filectime($path){ + return filectime($this->datadir.$path); + } + public function filemtime($path){ + return filemtime($this->datadir.$path); + } + public function fileatime($path){ + return fileatime($this->datadir.$path); + } + public function file_get_contents($path){ + return file_get_contents($this->datadir.$path); + } + public function file_put_contents($path,$data){ + if($return=file_put_contents($this->datadir.$path,$data)){ + $this->clearFolderSizeCache($path); + } + } + public function unlink($path){ + if($return=unlink($this->datadir.$path)){ + $this->clearFolderSizeCache($path); + } + return $return; + } + public function rename($path1,$path2){ + if($return=rename($this->datadir.$path1,$this->datadir.$path2)){ + $this->clearFolderSizeCache($path1); + $this->clearFolderSizeCache($path2); + } + return $return; + } + public function copy($path1,$path2){ + if($this->is_dir($path2)){ + if(!$this->file_exists($path2)){ + $this->mkdir($path2); + } + $source=substr($path1,strrpos($path1,'/')+1); + $path2.=$source; + } + if($return=copy($this->datadir.$path1,$this->datadir.$path2)){ + $this->clearFolderSizeCache($path2); + } + return $return; + } + public function fopen($path,$mode){ + if($return=fopen($this->datadir.$path,$mode)){ + switch($mode){ + case 'r': + break; + case 'r+': + case 'w+': + case 'x+': + case 'a+': + $this->clearFolderSizeCache($path); + break; + case 'w': + case 'x': + case 'a': + $this->clearFolderSizeCache($path); + break; + } + } + return $return; + } + + public function getMimeType($fspath){ + if($this->is_readable($fspath)){ + if (@is_dir($this->datadir.$fspath)) { + // directories are easy + return "httpd/unix-directory"; + }elseif (function_exists('finfo_open') and function_exists('finfo_file') and $finfo=finfo_open(FILEINFO_MIME)){ + $mimeType =strtolower(finfo_file($finfo,$this->datadir.$fspath)); + $mimeType=substr($mimeType,0,strpos($mimeType,';')); + finfo_close($finfo); + return $mimeType; + } else if (function_exists("mime_content_type")) { + // use mime magic extension if available + $mime_type = mime_content_type($this->datadir.$fspath); + } else if (self::canExecute("file")) { + // it looks like we have a 'file' command, + // lets see it it does have mime support + $fp = popen("file -i -b '{$this->datadir}$fspath' 2>/dev/null", "r"); + $reply = fgets($fp); + pclose($fp); + + //trim the character set from the end of the response + $mime_type=substr($reply,0,strrpos($reply,' ')); + } + if (empty($mime_type)) { + // Fallback solution: (try to guess the type by the file extension + if(!self::$mimetypes){ + self::$mimetypes=include('mimetypes.list.php'); + } + $extention=strtolower(strrchr(basename($fspath), ".")); + $extention=substr($extention,1);//remove leading . + $mime_type=(isset(self::$mimetypes[$extention]))?self::$mimetypes[$extention]:'application/octet-stream'; + } + return $mime_type; + } + } + + /** + * detect if a given program is found in the search PATH + * + * helper function used by _mimetype() to detect if the + * external 'file' utility is available + * + * @param string program name + * @param string optional search path, defaults to $PATH + * @return bool true if executable program found in path + */ + private function canExecute($name, $path = false) + { + // path defaults to PATH from environment if not set + if ($path === false) { + $path = getenv("PATH"); + } + + // check method depends on operating system + if (!strncmp(PHP_OS, "WIN", 3)) { + // on Windows an appropriate COM or EXE file needs to exist + $exts = array(".exe", ".com"); + $check_fn = "file_exists"; + } else { + // anywhere else we look for an executable file of that name + $exts = array(""); + $check_fn = "is_executable"; + } + + // Default check will be done with $path directories : + $dirs = explode(PATH_SEPARATOR, $path); + + // WARNING : We have to check if open_basedir is enabled : + $obd = ini_get('open_basedir'); + + if($obd != "none") + $obd_values = explode(PATH_SEPARATOR, $obd); + + if(count($obd_values) > 0) + { + // open_basedir is in effect ! + // We need to check if the program is in one of these dirs : + $dirs = $obd_values; + } + + foreach($dirs as $dir) + { + foreach($exts as $ext) + { + if($check_fn("$dir/$name".$ext)) + return true; + } + } + + return false; + } + + public function toTmpFile($path){ + $tmpFolder=sys_get_temp_dir(); + $filename=tempnam($tmpFolder,'OC_TEMP_FILE_'.substr($path,strrpos($path,'.'))); + $fileStats = stat($this->datadir.$path); + if(copy($this->datadir.$path,$filename)){ + touch($filename, $fileStats['mtime'], $fileStats['atime']); + return $filename; + }else{ + return false; + } + } + + public function fromTmpFile($tmpFile,$path){ + $fileStats = stat($tmpFile); + if(rename($tmpFile,$this->datadir.$path)){ + touch($this->datadir.$path, $fileStats['mtime'], $fileStats['atime']); + $this->clearFolderSizeCache($path); + return true; + }else{ + return false; + } + } + + public function fromUploadedFile($tmpFile,$path){ + $fileStats = stat($tmpFile); + if(move_uploaded_file($tmpFile,$this->datadir.$path)){ + touch($this->datadir.$path, $fileStats['mtime'], $fileStats['atime']); + $this->clearFolderSizeCache($path); + return true; + }else{ + return false; + } + } + + public function delTree($dir) { + $dirRelative=$dir; + $dir=$this->datadir.$dir; + if (!file_exists($dir)) return true; + if (!is_dir($dir) || is_link($dir)) return unlink($dir); + foreach (scandir($dir) as $item) { + if ($item == '.' || $item == '..') continue; + if(is_file($dir.'/'.$item)){ + if(unlink($dir.'/'.$item)){ + $this->clearFolderSizeCache($dir); + } + }elseif(is_dir($dir.'/'.$item)){ + if (!$this->delTree($dirRelative. "/" . $item)){ + return false; + }; + } + } + if($return=rmdir($dir)){ + $this->clearFolderSizeCache($dir); + } + return $return; + } + + public function find($path){ + $return=System::find($this->datadir.$path); + foreach($return as &$file){ + $file=str_replace($file,$this->datadir,''); + } + return $return; + } + + public function getTree($dir) { + if(substr($dir,-1,1)=='/'){ + $dir=substr($dir,0,-1); + } + $tree=array(); + $tree[]=$dir; + $dirRelative=$dir; + $dir=$this->datadir.$dir; + if (!file_exists($dir)) return true; + foreach (scandir($dir) as $item) { + if ($item == '.' || $item == '..') continue; + if(is_file($dir.'/'.$item)){ + $tree[]=$dirRelative.'/'.$item; + }elseif(is_dir($dir.'/'.$item)){ + if ($subTree=$this->getTree($dirRelative. "/" . $item)){ + $tree=array_merge($tree,$subTree); + } + } + } + return $tree; + } + + public function hash($type,$path,$raw){ + return hash_file($type,$this->datadir.$path,$raw); + } + + public function free_space($path){ + return disk_free_space($this->datadir.$path); + } + + public function search($query){ + return $this->searchInDir($query); + } + public function getLocalFile($path){ + return $this->datadir.$path; + } + + private function searchInDir($query,$dir=''){ + $files=array(); + foreach (scandir($this->datadir.$dir) as $item) { + if ($item == '.' || $item == '..') continue; + if(strstr(strtolower($item),strtolower($query))!==false){ + $files[]=$dir.'/'.$item; + } + if(is_dir($this->datadir.$dir.'/'.$item)){ + $files=array_merge($files,$this->searchInDir($query,$dir.'/'.$item)); + } + } + return $files; + } + + /** + * @brief get the size of folder and it's content + * @param string $path file path + * @return int size of folder and it's content + */ + public function getFolderSize($path){ + $path=str_replace('//','/',$path); + if($this->is_dir($path) and substr($path,-1)!='/'){ + $path.='/'; + } + $query=OC_DB::prepare("SELECT size FROM *PREFIX*foldersize WHERE path=?"); + $size=$query->execute(array($path))->fetchAll(); + if(count($size)>0){// we already the size, just return it + return $size[0]['size']; + }else{//the size of the folder isn't know, calulate it + return $this->calculateFolderSize($path); + } + } + + /** + * @brief calulate the size of folder and it's content and cache it + * @param string $path file path + * @return int size of folder and it's content + */ + public function calculateFolderSize($path){ + if($this->is_file($path)){ + $path=dirname($path); + } + $path=str_replace('//','/',$path); + if($this->is_dir($path) and substr($path,-1)!='/'){ + $path.='/'; + } + $size=0; + if ($dh = $this->opendir($path)) { + while (($filename = readdir($dh)) !== false) { + if($filename!='.' and $filename!='..'){ + $subFile=$path.'/'.$filename; + if($this->is_file($subFile)){ + $size+=$this->filesize($subFile); + }else{ + $size+=$this->getFolderSize($subFile); + } + } + } + if($size>0){ + $query=OC_DB::prepare("INSERT INTO *PREFIX*foldersize VALUES(?,?)"); + $result=$query->execute(array($path,$size)); + } + } + return $size; + } + + /** + * @brief clear the folder size cache of folders containing a file + * @param string $path + */ + public function clearFolderSizeCache($path){ + if($this->is_file($path)){ + $path=dirname($path); + } + $path=str_replace('//','/',$path); + if($this->is_dir($path) and substr($path,-1)!='/'){ + $path.='/'; + } + $query=OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?"); + $result=$query->execute(array($path)); + if($path!='/' and $path!=''){ + $parts=explode('/',$path); + //pop empty part + $part=array_pop($parts); + if(empty($part)){ + array_pop($parts); + } + $parent=implode('/',$parts); + $this->clearFolderSizeCache($parent); + } + } +} + diff --git a/lib/remote/cloud.php b/lib/remote/cloud.php new file mode 100644 index 00000000000..6358bea46fc --- /dev/null +++ b/lib/remote/cloud.php @@ -0,0 +1,206 @@ +cookiefile){ + $this->cookiefile=sys_get_temp_dir().'/remoteCloudCookie'.uniqid(); + } + $url=$this->path.='/files/api.php'; + $fields_string="action=$action&"; + if(is_array($parameters)){ + foreach($parameters as $key=>$value){ + $fields_string.=$key.'='.$value.'&'; + } + rtrim($fields_string,'&'); + } + $ch=curl_init(); + curl_setopt($ch,CURLOPT_URL,$url); + curl_setopt($ch,CURLOPT_POST,count($parameters)); + curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); + curl_setopt($ch, CURLOPT_COOKIEFILE,$this->cookiefile); + curl_setopt($ch, CURLOPT_COOKIEJAR,$this->cookiefile); + curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); + $result=curl_exec($ch); + $result=trim($result); + $info=curl_getinfo($ch); + $httpCode=$info['http_code']; + curl_close($ch); + if($httpCode==200 or $httpCode==0){ + return json_decode($result,$assoc); + }else{ + return false; + } + } + + public function __construct($path,$user,$password){ + $this->path=$path; + $this->connected=$this->apiCall('login',array('username'=>$user,'password'=>$password)); + } + + /** + * check if we are stull logged in on the remote cloud + * + */ + public function isLoggedIn(){ + if(!$this->connected){ + return false; + } + return $this->apiCall('checklogin'); + } + + public function __get($name){ + switch($name){ + case 'connected': + return $this->connected; + } + } + + /** + * disconnect from the remote cloud + * + */ + public function disconnect(){ + $this->connected=false; + if(is_file($this->cookiefile)){ + unlink($this->cookiefile); + } + $this->cookiefile=false; + } + + /** + * create a new file or directory + * @param string $dir + * @param string $name + * @param string $type + */ + public function newFile($dir,$name,$type){ + if(!$this->connected){ + return false; + } + return $this->apiCall('new',array('dir'=>$dir,'name'=>$name,'type'=>$type),true); + } + + /** + * deletes a file or directory + * @param string $dir + * @param string $file + */ + public function delete($dir,$name){ + if(!$this->connected){ + return false; + } + return $this->apiCall('delete',array('dir'=>$dir,'file'=>$name),true); + } + + /** + * moves a file or directory + * @param string $sorceDir + * @param string $sorceFile + * @param string $targetDir + * @param string $targetFile + */ + public function move($sourceDir,$sourceFile,$targetDir,$targetFile){ + if(!$this->connected){ + return false; + } + return $this->apiCall('move',array('sourcedir'=>$sourceDir,'source'=>$sourceFile,'targetdir'=>$targetDir,'target'=>$targetFile),true); + } + + /** + * copies a file or directory + * @param string $sorceDir + * @param string $sorceFile + * @param string $targetDir + * @param string $targetFile + */ + public function copy($sourceDir,$sourceFile,$targetDir,$targetFile){ + if(!$this->connected){ + return false; + } + return $this->apiCall('copy',array('sourcedir'=>$sourceDir,'source'=>$sourceFile,'targetdir'=>$targetDir,'target'=>$targetFile),true); + } + + /** + * get a file tree + * @param string $dir + */ + public function getTree($dir){ + if(!$this->connected){ + return false; + } + return $this->apiCall('gettree',array('dir'=>$dir),true); + } + + /** + * get the files inside a directory of the remote cloud + * @param string $dir + */ + public function getFiles($dir){ + if(!$this->connected){ + return false; + } + return $this->apiCall('getfiles',array('dir'=>$dir),true); + } + + /** + * get a remove file and save it in a temporary file and return the path of the temporary file + * @param string $dir + * @param string $file + * @return string + */ + public function getFile($dir, $file){ + if(!$this->connected){ + return false; + } + $ch=curl_init(); + if(!$this->cookiefile){ + $this->cookiefile=sys_get_temp_dir().'/remoteCloudCookie'.uniqid(); + } + $tmpfile=tempnam(sys_get_temp_dir(),'remoteCloudFile'); + $fp=fopen($tmpfile,'w+'); + $url=$this->path.="/files/api.php?action=get&dir=$dir&file=$file"; + curl_setopt($ch,CURLOPT_URL,$url); + curl_setopt($ch, CURLOPT_COOKIEFILE,$this->cookiefile); + curl_setopt($ch, CURLOPT_COOKIEJAR,$this->cookiefile); + curl_setopt($ch, CURLOPT_FILE, $fp); + curl_exec($ch); + fclose($fp); + curl_close($ch); + return $tmpfile; + } + + public function sendFile($sourceDir,$sourceFile,$targetDir,$targetFile){ + global $WEBROOT; + $source=$sourceDir.'/'.$sourceFile; + $tmp=OC_FILESYSTEM::toTmpFile($source); + return $this->sendTmpFile($tmp,$targetDir,$targetFile); + } + + public function sendTmpFile($tmp,$targetDir,$targetFile){ + $token=sha1(uniqid().$tmp); + global $WEBROOT; + $file=sys_get_temp_dir().'/'.'remoteCloudFile'.$token; + rename($tmp,$file); + if( OC_CONFIG::getValue( "forcessl", false ) or isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') { + $url = "https://". $_SERVER['SERVER_NAME'] . $WEBROOT; + }else{ + $url = "http://". $_SERVER['SERVER_NAME'] . $WEBROOT; + } + return $this->apiCall('pull',array('dir'=>$targetDir,'file'=>$targetFile,'token'=>$token,'source'=>$url),true); + } +} + -- cgit v1.2.3 From e69079f9354464d21f31ae8b6d9e47988ba22fb4 Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Wed, 27 Jul 2011 20:04:42 +0200 Subject: Further improvements --- lib/base.php | 12 ++- lib/connect.php | 206 ---------------------------------------------------- lib/filestorage.php | 2 - lib/user.php | 4 - 4 files changed, 10 insertions(+), 214 deletions(-) diff --git a/lib/base.php b/lib/base.php index 7c2e7cf88c1..0c0921ca8b1 100644 --- a/lib/base.php +++ b/lib/base.php @@ -44,8 +44,8 @@ $DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']); $SERVERROOT=str_replace("\\",'/',$SERVERROOT); $SUBURI=substr(realpath($_SERVER["SCRIPT_FILENAME"]),strlen($SERVERROOT)); $scriptName=$_SERVER["SCRIPT_NAME"]; -if(substr($scriptName,-1)=='/'){//if the script isn't a file assume index.php - $scriptName.='index.php'; +if(substr($scriptName,-1)=='/'){ + $scriptName.='index.php'; } $WEBROOT=substr($scriptName,0,strlen($scriptName)-strlen($SUBURI)); @@ -83,9 +83,17 @@ if( OC_CONFIG::getValue( "forcessl", false )){ $error=(count(OC_UTIL::checkServer())>0); +// User and Groups +if( !OC_CONFIG::getValue( "installed", false )){ + $_SESSION['user_id'] = ''; +} + OC_USER::useBackend( OC_CONFIG::getValue( "userbackend", "database" )); OC_GROUP::setBackend( OC_CONFIG::getValue( "groupbackend", "database" )); +// Was in required file ... put it here +OC_FILESYSTEM::registerStorageType('local','OC_FILESTORAGE_LOCAL',array('datadir'=>'string')); + // Set up file system unless forbidden if(!$error and !$RUNTIME_NOSETUPFS ){ OC_UTIL::setupFS(); diff --git a/lib/connect.php b/lib/connect.php index 6fc8f2165cf..57017cf9bb4 100644 --- a/lib/connect.php +++ b/lib/connect.php @@ -39,212 +39,6 @@ class OC_CONNECT{ } } - -/** - * Class for connection to a remote owncloud installation - * - */ -class OC_REMOTE_CLOUD{ - private $path; - private $connected=false; - private $cookiefile=false; - - /** - * make an api call to the remote cloud - * @param string $action - * @param array parameters - * @param bool assoc when set to true, the result will be parsed as associative array - * - */ - private function apiCall($action,$parameters=false,$assoc=false){ - if(!$this->cookiefile){ - $this->cookiefile=sys_get_temp_dir().'/remoteCloudCookie'.uniqid(); - } - $url=$this->path.='/files/api.php'; - $fields_string="action=$action&"; - if(is_array($parameters)){ - foreach($parameters as $key=>$value){ - $fields_string.=$key.'='.$value.'&'; - } - rtrim($fields_string,'&'); - } - $ch=curl_init(); - curl_setopt($ch,CURLOPT_URL,$url); - curl_setopt($ch,CURLOPT_POST,count($parameters)); - curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); - curl_setopt($ch, CURLOPT_COOKIEFILE,$this->cookiefile); - curl_setopt($ch, CURLOPT_COOKIEJAR,$this->cookiefile); - curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); - $result=curl_exec($ch); - $result=trim($result); - $info=curl_getinfo($ch); - $httpCode=$info['http_code']; - curl_close($ch); - if($httpCode==200 or $httpCode==0){ - return json_decode($result,$assoc); - }else{ - return false; - } - } - - public function __construct($path,$user,$password){ - $this->path=$path; - $this->connected=$this->apiCall('login',array('username'=>$user,'password'=>$password)); - } - - /** - * check if we are stull logged in on the remote cloud - * - */ - public function isLoggedIn(){ - if(!$this->connected){ - return false; - } - return $this->apiCall('checklogin'); - } - - public function __get($name){ - switch($name){ - case 'connected': - return $this->connected; - } - } - - /** - * disconnect from the remote cloud - * - */ - public function disconnect(){ - $this->connected=false; - if(is_file($this->cookiefile)){ - unlink($this->cookiefile); - } - $this->cookiefile=false; - } - - /** - * create a new file or directory - * @param string $dir - * @param string $name - * @param string $type - */ - public function newFile($dir,$name,$type){ - if(!$this->connected){ - return false; - } - return $this->apiCall('new',array('dir'=>$dir,'name'=>$name,'type'=>$type),true); - } - - /** - * deletes a file or directory - * @param string $dir - * @param string $file - */ - public function delete($dir,$name){ - if(!$this->connected){ - return false; - } - return $this->apiCall('delete',array('dir'=>$dir,'file'=>$name),true); - } - - /** - * moves a file or directory - * @param string $sorceDir - * @param string $sorceFile - * @param string $targetDir - * @param string $targetFile - */ - public function move($sourceDir,$sourceFile,$targetDir,$targetFile){ - if(!$this->connected){ - return false; - } - return $this->apiCall('move',array('sourcedir'=>$sourceDir,'source'=>$sourceFile,'targetdir'=>$targetDir,'target'=>$targetFile),true); - } - - /** - * copies a file or directory - * @param string $sorceDir - * @param string $sorceFile - * @param string $targetDir - * @param string $targetFile - */ - public function copy($sourceDir,$sourceFile,$targetDir,$targetFile){ - if(!$this->connected){ - return false; - } - return $this->apiCall('copy',array('sourcedir'=>$sourceDir,'source'=>$sourceFile,'targetdir'=>$targetDir,'target'=>$targetFile),true); - } - - /** - * get a file tree - * @param string $dir - */ - public function getTree($dir){ - if(!$this->connected){ - return false; - } - return $this->apiCall('gettree',array('dir'=>$dir),true); - } - - /** - * get the files inside a directory of the remote cloud - * @param string $dir - */ - public function getFiles($dir){ - if(!$this->connected){ - return false; - } - return $this->apiCall('getfiles',array('dir'=>$dir),true); - } - - /** - * get a remove file and save it in a temporary file and return the path of the temporary file - * @param string $dir - * @param string $file - * @return string - */ - public function getFile($dir, $file){ - if(!$this->connected){ - return false; - } - $ch=curl_init(); - if(!$this->cookiefile){ - $this->cookiefile=sys_get_temp_dir().'/remoteCloudCookie'.uniqid(); - } - $tmpfile=tempnam(sys_get_temp_dir(),'remoteCloudFile'); - $fp=fopen($tmpfile,'w+'); - $url=$this->path.="/files/api.php?action=get&dir=$dir&file=$file"; - curl_setopt($ch,CURLOPT_URL,$url); - curl_setopt($ch, CURLOPT_COOKIEFILE,$this->cookiefile); - curl_setopt($ch, CURLOPT_COOKIEJAR,$this->cookiefile); - curl_setopt($ch, CURLOPT_FILE, $fp); - curl_exec($ch); - fclose($fp); - curl_close($ch); - return $tmpfile; - } - - public function sendFile($sourceDir,$sourceFile,$targetDir,$targetFile){ - global $WEBROOT; - $source=$sourceDir.'/'.$sourceFile; - $tmp=OC_FILESYSTEM::toTmpFile($source); - return $this->sendTmpFile($tmp,$targetDir,$targetFile); - } - - public function sendTmpFile($tmp,$targetDir,$targetFile){ - $token=sha1(uniqid().$tmp); - global $WEBROOT; - $file=sys_get_temp_dir().'/'.'remoteCloudFile'.$token; - rename($tmp,$file); - if( OC_CONFIG::getValue( "forcessl", false ) or isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') { - $url = "https://". $_SERVER['SERVER_NAME'] . $WEBROOT; - }else{ - $url = "http://". $_SERVER['SERVER_NAME'] . $WEBROOT; - } - return $this->apiCall('pull',array('dir'=>$targetDir,'file'=>$targetFile,'token'=>$token,'source'=>$url),true); - } -} - function OC_CONNECT_TEST($path,$user,$password){ echo 'connecting...'; $remote=OC_CONNECT::connect($path,$user,$password); diff --git a/lib/filestorage.php b/lib/filestorage.php index 46612687a92..ada85f1a50d 100644 --- a/lib/filestorage.php +++ b/lib/filestorage.php @@ -59,6 +59,4 @@ class OC_FILESTORAGE{ public function getLocalFile($path){}// get a path to a local version of the file, whether the original file is local or remote } - -OC_FILESYSTEM::registerStorageType('local','OC_FILESTORAGE_LOCAL',array('datadir'=>'string')); ?> \ No newline at end of file diff --git a/lib/user.php b/lib/user.php index b93e2133352..f6fbc33f640 100644 --- a/lib/user.php +++ b/lib/user.php @@ -20,10 +20,6 @@ * */ -if( !OC_CONFIG::getValue( "installed", false )){ - $_SESSION['user_id'] = ''; -} - /** * This class provides all methods for user management. * -- cgit v1.2.3 From 2ff8d7a8bc067901ecbc64599b86d1b325f5fe98 Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Fri, 29 Jul 2011 21:03:53 +0200 Subject: One class per file! --- apps/media/lib_media.php | 8 +- lib/app.php | 1 - lib/appconfig.php | 1 - lib/base.php | 90 +++++++++++ lib/config.php | 1 - lib/connect.php | 54 ------- lib/connector/sabre/locks.php | 1 - lib/connector/sabre/node.php | 1 - lib/db.php | 1 - lib/fakedirstream.php | 45 ++++++ lib/files.php | 76 --------- lib/filestorage/remote.php | 350 +++++++++++++++++++++++++++++++++++++++++ lib/filesystem.php | 1 - lib/helper.php | 2 - lib/log.php | 4 - lib/mimetypes.list.php | 1 - lib/ocs.php | 2 - lib/ocsclient.php | 1 - lib/preferences.php | 1 - lib/remote/cloud.php | 2 +- lib/remotestorage.php | 353 ------------------------------------------ lib/search.php | 75 +-------- lib/search/provider.php | 16 ++ lib/search/provider/file.php | 16 ++ lib/search/result.php | 37 +++++ lib/setup.php | 2 - lib/template.php | 2 - 27 files changed, 561 insertions(+), 583 deletions(-) create mode 100644 lib/fakedirstream.php create mode 100644 lib/filestorage/remote.php delete mode 100644 lib/remotestorage.php create mode 100644 lib/search/provider.php create mode 100644 lib/search/provider/file.php create mode 100644 lib/search/result.php diff --git a/apps/media/lib_media.php b/apps/media/lib_media.php index 9c3d0622360..6fde2ab7487 100644 --- a/apps/media/lib_media.php +++ b/apps/media/lib_media.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/lib/app.php b/lib/app.php index b6c2512e79a..fad0714c3f4 100644 --- a/lib/app.php +++ b/lib/app.php @@ -408,4 +408,3 @@ class OC_APP{ } } } -?> \ No newline at end of file diff --git a/lib/appconfig.php b/lib/appconfig.php index 4fef7542f40..b4735a309bc 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -158,4 +158,3 @@ class OC_APPCONFIG{ return true; } } -?> diff --git a/lib/base.php b/lib/base.php index 4e1b9bd0064..236b5d926a4 100644 --- a/lib/base.php +++ b/lib/base.php @@ -110,3 +110,93 @@ OC_UTIL::addStyle( "styles" ); if(!$error and !$RUNTIME_NOAPPS ){ OC_APP::loadApps(); } + +// FROM Connect.php +function OC_CONNECT_TEST($path,$user,$password){ + echo 'connecting...'; + $remote=OC_CONNECT::connect($path,$user,$password); + if($remote->connected){ + echo 'done
'; + if($remote->isLoggedIn()){ + echo 'logged in, session working
'; + echo 'trying to get remote files...'; + $files=$remote->getFiles(''); + if($files){ + echo count($files).' files found:
'; + foreach($files as $file){ + echo "{$file['type']} {$file['name']}: {$file['size']} bytes
"; + } + echo 'getting file "'.$file['name'].'"...'; + $size=$file['size']; + $file=$remote->getFile('',$file['name']); + if(file_exists($file)){ + $newSize=filesize($file); + if($size!=$newSize){ + echo "fail
Error: $newSize bytes received, $size expected."; + echo '

Recieved file:
'; + readfile($file); + unlink($file); + return; + } + OC_FILESYSTEM::fromTmpFile($file,'/remoteFile'); + echo 'done
'; + echo 'sending file "burning_avatar.png"...'; + $res=$remote->sendFile('','burning_avatar.png','','burning_avatar.png'); + if($res){ + echo 'done
'; + }else{ + echo 'fail
'; + } + }else{ + echo 'fail
'; + } + }else{ + echo 'fail
'; + } + }else{ + echo 'no longer logged in, session fail
'; + } + }else{ + echo 'fail
'; + } + $remote->disconnect(); + die(); +} + +// From files.php +function zipAddDir($dir,$zip,$internalDir=''){ + $dirname=basename($dir); + $zip->addEmptyDir($internalDir.$dirname); + $internalDir.=$dirname.='/'; + $files=OC_FILES::getdirectorycontent($dir); + foreach($files as $file){ + $filename=$file['name']; + $file=$dir.'/'.$filename; + if(OC_FILESYSTEM::is_file($file)){ + $tmpFile=OC_FILESYSTEM::toTmpFile($file); + OC_FILES::$tmpFiles[]=$tmpFile; + $zip->addFile($tmpFile,$internalDir.$filename); + }elseif(OC_FILESYSTEM::is_dir($file)){ + zipAddDir($file,$zip,$internalDir); + } + } +} + +if(!function_exists('sys_get_temp_dir')) { + function sys_get_temp_dir() { + if( $temp=getenv('TMP') ) return $temp; + if( $temp=getenv('TEMP') ) return $temp; + if( $temp=getenv('TMPDIR') ) return $temp; + $temp=tempnam(__FILE__,''); + if (file_exists($temp)) { + unlink($temp); + return dirname($temp); + } + return null; + } +} + +require_once('fakedirstream.php'); + +// FROM search.php +new OC_Search_Provider_File(); diff --git a/lib/config.php b/lib/config.php index cd18ddd499c..ea3647858ed 100644 --- a/lib/config.php +++ b/lib/config.php @@ -182,4 +182,3 @@ class OC_CONFIG{ return true; } } -?> diff --git a/lib/connect.php b/lib/connect.php index 57017cf9bb4..c02b999ffc2 100644 --- a/lib/connect.php +++ b/lib/connect.php @@ -38,57 +38,3 @@ class OC_CONNECT{ } } } - -function OC_CONNECT_TEST($path,$user,$password){ - echo 'connecting...'; - $remote=OC_CONNECT::connect($path,$user,$password); - if($remote->connected){ - echo 'done
'; - if($remote->isLoggedIn()){ - echo 'logged in, session working
'; - echo 'trying to get remote files...'; - $files=$remote->getFiles(''); - if($files){ - echo count($files).' files found:
'; - foreach($files as $file){ - echo "{$file['type']} {$file['name']}: {$file['size']} bytes
"; - } - echo 'getting file "'.$file['name'].'"...'; - $size=$file['size']; - $file=$remote->getFile('',$file['name']); - if(file_exists($file)){ - $newSize=filesize($file); - if($size!=$newSize){ - echo "fail
Error: $newSize bytes received, $size expected."; - echo '

Recieved file:
'; - readfile($file); - unlink($file); - return; - } - OC_FILESYSTEM::fromTmpFile($file,'/remoteFile'); - echo 'done
'; - echo 'sending file "burning_avatar.png"...'; - $res=$remote->sendFile('','burning_avatar.png','','burning_avatar.png'); - if($res){ - echo 'done
'; - }else{ - echo 'fail
'; - } - }else{ - echo 'fail
'; - } - }else{ - echo 'fail
'; - } - }else{ - echo 'no longer logged in, session fail
'; - } - }else{ - echo 'fail
'; - } - $remote->disconnect(); - die(); -} - - -?> diff --git a/lib/connector/sabre/locks.php b/lib/connector/sabre/locks.php index 88bab509898..9f0b983a5cc 100644 --- a/lib/connector/sabre/locks.php +++ b/lib/connector/sabre/locks.php @@ -149,4 +149,3 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract { } } - diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index 03d5e90012e..0edd9b78161 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -155,4 +155,3 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr return $props; } } - diff --git a/lib/db.php b/lib/db.php index 8d7c76756c1..f5f877176e9 100644 --- a/lib/db.php +++ b/lib/db.php @@ -362,4 +362,3 @@ class OC_DB { } } } -?> \ No newline at end of file diff --git a/lib/fakedirstream.php b/lib/fakedirstream.php new file mode 100644 index 00000000000..fa3e64da62c --- /dev/null +++ b/lib/fakedirstream.php @@ -0,0 +1,45 @@ +name=substr($path,strlen('fakedir://')); + $this->index=0; + if(isset($FAKEDIRS[$this->name])){ + $this->data=$FAKEDIRS[$this->name]; + }else{ + $this->data=array(); + } + return true; + } + + public function dir_readdir(){ + if($this->index>=count($this->data)){ + return false; + } + $filename=$this->data[$this->index]; + $this->index++; + return $filename; + } + + public function dir_closedir() { + $this->data=false; + $this->name=''; + return true; + } + + public function dir_rewinddir() { + $this->index=0; + return true; + } +} + +stream_wrapper_register("fakedir", "fakeDirStream"); + diff --git a/lib/files.php b/lib/files.php index d24eb282c45..03e159f9bee 100644 --- a/lib/files.php +++ b/lib/files.php @@ -298,79 +298,3 @@ class OC_FILES { @file_put_contents($SERVERROOT.'/.htaccess', $content); //supress errors in case we don't have permissions for it } } - -function zipAddDir($dir,$zip,$internalDir=''){ - $dirname=basename($dir); - $zip->addEmptyDir($internalDir.$dirname); - $internalDir.=$dirname.='/'; - $files=OC_FILES::getdirectorycontent($dir); - foreach($files as $file){ - $filename=$file['name']; - $file=$dir.'/'.$filename; - if(OC_FILESYSTEM::is_file($file)){ - $tmpFile=OC_FILESYSTEM::toTmpFile($file); - OC_FILES::$tmpFiles[]=$tmpFile; - $zip->addFile($tmpFile,$internalDir.$filename); - }elseif(OC_FILESYSTEM::is_dir($file)){ - zipAddDir($file,$zip,$internalDir); - } - } -} - -if(!function_exists('sys_get_temp_dir')) { - function sys_get_temp_dir() { - if( $temp=getenv('TMP') ) return $temp; - if( $temp=getenv('TEMP') ) return $temp; - if( $temp=getenv('TMPDIR') ) return $temp; - $temp=tempnam(__FILE__,''); - if (file_exists($temp)) { - unlink($temp); - return dirname($temp); - } - return null; - } -} - -global $FAKEDIRS; -$FAKEDIRS=array(); - -class fakeDirStream{ - private $name; - private $data; - private $index; - - public function dir_opendir($path,$options){ - global $FAKEDIRS; - $url=parse_url($path); - $this->name=substr($path,strlen('fakedir://')); - $this->index=0; - if(isset($FAKEDIRS[$this->name])){ - $this->data=$FAKEDIRS[$this->name]; - }else{ - $this->data=array(); - } - return true; - } - - public function dir_readdir(){ - if($this->index>=count($this->data)){ - return false; - } - $filename=$this->data[$this->index]; - $this->index++; - return $filename; - } - - public function dir_closedir() { - $this->data=false; - $this->name=''; - return true; - } - - public function dir_rewinddir() { - $this->index=0; - return true; - } -} -stream_wrapper_register("fakedir", "fakeDirStream"); -?> diff --git a/lib/filestorage/remote.php b/lib/filestorage/remote.php new file mode 100644 index 00000000000..74234f4d8db --- /dev/null +++ b/lib/filestorage/remote.php @@ -0,0 +1,350 @@ +. +* +*/ + +class OC_FILESTORAGE_REMOTE extends OC_FILESTORAGE{ + private $url; + private $username; + private $password; + private $remote=false; + private $statCache; + private $statCacheDir=false; + private $changed=array(); + + private function cacheDir($dir){ + if($this->statCacheDir!=$dir or $this->statCacheDir===false){ + $this->statCache=$this->remote->getFiles($dir); + $keys=array_keys($this->statCache); + $this->statCacheDir=$dir; + } + } + + public function __construct($arguments){ + $this->url=$arguments['url']; + $this->username=$arguments['username']; + $this->password=$arguments['password']; + } + private function connect(){ + if($this->remote===false){ + $this->remote=OC_CONNECT::connect($this->url,$this->username,$this->password); + } + } + public function mkdir($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $return=$this->remote->newFile($parent,$name,'dir'); + if($return){ + $this->notifyObservers($path,OC_FILEACTION_CREATE); + } + return $return; + } + public function rmdir($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $return=$this->remote->delete($parent,$name); + if($return){ + $this->notifyObservers($path,OC_FILEACTION_DELETE); + } + return $return; + } + public function opendir($path){ + $this->connect(); + $this->cacheDir($path); + $dirs=array_keys($this->statCache); + $id=uniqid(); + global $FAKEDIRS; + $FAKEDIRS[$id]=$dirs; + if($return=opendir("fakedir://$id")){ + $this->notifyObservers($path,OC_FILEACTION_READ); + } + return $return; + } + public function is_dir($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $this->cacheDir($path); + if($path=='' or $path=='/'){ + return true; + } + if(!isset($this->statCache[$name])){ + return false; + } + return ($this->statCache[$name]['type'=='dir']); + } + public function is_file($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $this->cacheDir($parent); + if(!isset($this->statCache[$name])){ + return false; + } + return ($this->statCache[$name]['type'!='dir']); + } + public function stat($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $this->cacheDir($parent); + if(!isset($this->statCache[$name])){ + return $false; + } + return $this->statCache[$name]; + } + public function filetype($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $this->cacheDir($parent); + if(!isset($this->statCache[$name])){ + return false; + } + return $this->statCache[$name]['type']; + } + public function filesize($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $this->cacheDir($parent); + if(!isset($this->statCache[$name])){ + return $false; + } + return $this->statCache[$name]['size']; + } + public function is_readable($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $this->cacheDir($parent); + if(!isset($this->statCache[$name])){ + return false; + } + return $this->statCache[$name]['readable']; + } + public function is_writeable($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $this->cacheDir($parent); + if(!isset($this->statCache[$name])){ + return false; + } + return $this->statCache[$name]['writeable']; + } + public function file_exists($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $this->cacheDir($parent); + return isset($this->statCache[$name]); + } + public function readfile($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $file=$this->remote->getFile($parent,$name); + readfile($file); + unlink($file); + } + public function filectime($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $this->cacheDir($parent); + if(!isset($this->statCache[$name])){ + return false; + } + return $this->statCache[$name]['ctime']; + } + public function filemtime($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $this->cacheDir($parent); + if(!isset($this->statCache[$name])){ + return false; + } + return $this->statCache[$name]['mtime']; + } + public function fileatime($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $this->cacheDir($parent); + if(!isset($this->statCache[$name])){ + return false; + } + return $this->statCache[$name]['atime']; + } + public function file_get_contents($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $file=$this->remote->getFile($parent,$name); + file_get_contents($file); + unlink($file); + } + public function file_put_contents($path,$data){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $file=$this->remote->getFile($parent,$name); + $file=tempnam(sys_get_temp_dir(),'oc_'); + file_put_contents($file,$data); + if($return=$this->remote->sendTmpFile($file,$parent,$name)){ + $this->notifyObservers($path,OC_FILEACTION_WRITE); + } + } + public function unlink($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + if($return=$this->remote->delete($paren,$name)){ + $this->notifyObservers($path,OC_FILEACTION_DELETE); + } + return $return; + } + public function rename($path1,$path2){ + $this->connect(); + $parent1=dirname($path1); + $name1=substr($path1,strlen($parent1)+1); + $parent2=dirname($path2); + $name2=substr($path2,strlen($parent2)+1); + if($return=$this->remote->move($parent1,$name1,$parent2,$name2)){ + $this->notifyObservers($path1.'->'.$path2,OC_FILEACTION_RENAME); + } + return $return; + } + public function copy($path1,$path2){ + $this->connect(); + $parent1=dirname($path1); + $name1=substr($path1,strlen($parent1)+1); + $parent2=dirname($path2); + $name2=substr($path2,strlen($parent2)+1); + if($return=$this->copy->rename($parent1,$name1,$parent2,$name2)){ + $this->notifyObservers($path1.'->'.$path2,OC_FILEACTION_RENAME); + } + return $return; + } + public function fopen($path,$mode){ + $this->connect(); + $changed=false; + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + $file=$this->remote->getFile($parent,$name); + if($return=fopen($file,$mode)){ + switch($mode){ + case 'r': + $this->notifyObservers($path,OC_FILEACTION_READ); + break; + case 'r+': + case 'w+': + case 'x+': + case 'a+': + $this->notifyObservers($path,OC_FILEACTION_READ | OC_FILEACTION_WRITE); + $this->changed[]=array('dir'=>$parent,'file'=>$name,'tmp'=>$file); + break; + case 'w': + case 'x': + case 'a': + $this->notifyObservers($path,OC_FILEACTION_WRITE); + $this->changed[]=array('dir'=>$parent,'file'=>$name,'tmp'=>$file); + break; + } + } + return $return; + } + + public function getMimeType($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + if(substr($name,0,1)=='/'){ + $name=substr($name,1); + } + $this->cacheDir($parent); + if(!isset($this->statCache[$name])){ + return false; + } + return $this->statCache[$name]['mime']; + } + + public function toTmpFile($path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + if(substr($name,0,1)=='/'){ + $name=substr($name,1); + } + $filename=$this->remote->getFile($parent,$name); + if($filename){ + $this->notifyObservers($path,OC_FILEACTION_READ); + return $filename; + }else{ + return false; + } + } + + public function fromTmpFile($tmpFile,$path){ + $this->connect(); + $parent=dirname($path); + $name=substr($path,strlen($parent)+1); + if($this->remote->sendTmpFile($tmpFile,$parent,$name)){ + $this->notifyObservers($path,OC_FILEACTION_CREATE); + return true; + }else{ + return false; + } + } + + public function delTree($dir) { + $this->connect(); + $parent=dirname($dir); + $name=substr($dir,strlen($parent)+1); + $return=$this->remote->delete($parent,$name); + if($return=rmdir($dir)){ + $this->notifyObservers($dir,OC_FILEACTION_DELETE); + } + return $return; + } + + public function find($path){ + return $this->getTree($path); + } + + public function getTree($dir) { + $this->connect(); + if($return=$this->remote->getTree($dir)){ + $this->notifyObservers($dir,OC_FILEACTION_READ); + } + return $return; + } + + public function __destruct(){ + foreach($this->changed as $changed){ + $this->remote->sendTmpFile($changed['tmp'],$changed['dir'],$changed['file']); + } + } +} diff --git a/lib/filesystem.php b/lib/filesystem.php index b82fe2afebf..d44416cf9cb 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -588,4 +588,3 @@ class OC_FILESYSTEM{ } } -?> diff --git a/lib/helper.php b/lib/helper.php index ffb25877433..b976705a7cf 100755 --- a/lib/helper.php +++ b/lib/helper.php @@ -318,5 +318,3 @@ class OC_HELPER { return false; } } - -?> diff --git a/lib/log.php b/lib/log.php index 764c094c919..d7c280ea65e 100644 --- a/lib/log.php +++ b/lib/log.php @@ -149,7 +149,3 @@ class OC_LOG { return $filteredLogs; } } - - - -?> diff --git a/lib/mimetypes.list.php b/lib/mimetypes.list.php index 6d8b3b9abce..24679257199 100644 --- a/lib/mimetypes.list.php +++ b/lib/mimetypes.list.php @@ -78,4 +78,3 @@ return array( 'webm'=>'video/webm', 'wmv'=>'video/x-ms-asf' ); -?> \ No newline at end of file diff --git a/lib/ocs.php b/lib/ocs.php index b1be2cb11cf..c91871377a0 100644 --- a/lib/ocs.php +++ b/lib/ocs.php @@ -556,5 +556,3 @@ class OC_OCS { return OC_PREFERENCES::deleteKey($user,$app,$key); } } - -?> diff --git a/lib/ocsclient.php b/lib/ocsclient.php index cfd529b2ec4..1b6280e2587 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -160,4 +160,3 @@ class OC_OCSCLIENT{ } -?> diff --git a/lib/preferences.php b/lib/preferences.php index 0f4636f6832..89598f478d1 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -217,4 +217,3 @@ class OC_PREFERENCES{ return true; } } -?> diff --git a/lib/remote/cloud.php b/lib/remote/cloud.php index 6358bea46fc..1acd48ea5af 100644 --- a/lib/remote/cloud.php +++ b/lib/remote/cloud.php @@ -203,4 +203,4 @@ class OC_REMOTE_CLOUD{ return $this->apiCall('pull',array('dir'=>$targetDir,'file'=>$targetFile,'token'=>$token,'source'=>$url),true); } } - + \ No newline at end of file diff --git a/lib/remotestorage.php b/lib/remotestorage.php deleted file mode 100644 index ed90cf1fdaf..00000000000 --- a/lib/remotestorage.php +++ /dev/null @@ -1,353 +0,0 @@ -. -* -*/ - - -class OC_FILESTORAGE_REMOTE extends OC_FILESTORAGE{ - private $url; - private $username; - private $password; - private $remote=false; - private $statCache; - private $statCacheDir=false; - private $changed=array(); - - private function cacheDir($dir){ - if($this->statCacheDir!=$dir or $this->statCacheDir===false){ - $this->statCache=$this->remote->getFiles($dir); - $keys=array_keys($this->statCache); - $this->statCacheDir=$dir; - } - } - - public function __construct($arguments){ - $this->url=$arguments['url']; - $this->username=$arguments['username']; - $this->password=$arguments['password']; - } - private function connect(){ - if($this->remote===false){ - $this->remote=OC_CONNECT::connect($this->url,$this->username,$this->password); - } - } - public function mkdir($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $return=$this->remote->newFile($parent,$name,'dir'); - if($return){ - $this->notifyObservers($path,OC_FILEACTION_CREATE); - } - return $return; - } - public function rmdir($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $return=$this->remote->delete($parent,$name); - if($return){ - $this->notifyObservers($path,OC_FILEACTION_DELETE); - } - return $return; - } - public function opendir($path){ - $this->connect(); - $this->cacheDir($path); - $dirs=array_keys($this->statCache); - $id=uniqid(); - global $FAKEDIRS; - $FAKEDIRS[$id]=$dirs; - if($return=opendir("fakedir://$id")){ - $this->notifyObservers($path,OC_FILEACTION_READ); - } - return $return; - } - public function is_dir($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $this->cacheDir($path); - if($path=='' or $path=='/'){ - return true; - } - if(!isset($this->statCache[$name])){ - return false; - } - return ($this->statCache[$name]['type'=='dir']); - } - public function is_file($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $this->cacheDir($parent); - if(!isset($this->statCache[$name])){ - return false; - } - return ($this->statCache[$name]['type'!='dir']); - } - public function stat($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $this->cacheDir($parent); - if(!isset($this->statCache[$name])){ - return $false; - } - return $this->statCache[$name]; - } - public function filetype($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $this->cacheDir($parent); - if(!isset($this->statCache[$name])){ - return false; - } - return $this->statCache[$name]['type']; - } - public function filesize($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $this->cacheDir($parent); - if(!isset($this->statCache[$name])){ - return $false; - } - return $this->statCache[$name]['size']; - } - public function is_readable($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $this->cacheDir($parent); - if(!isset($this->statCache[$name])){ - return false; - } - return $this->statCache[$name]['readable']; - } - public function is_writeable($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $this->cacheDir($parent); - if(!isset($this->statCache[$name])){ - return false; - } - return $this->statCache[$name]['writeable']; - } - public function file_exists($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $this->cacheDir($parent); - return isset($this->statCache[$name]); - } - public function readfile($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $file=$this->remote->getFile($parent,$name); - readfile($file); - unlink($file); - } - public function filectime($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $this->cacheDir($parent); - if(!isset($this->statCache[$name])){ - return false; - } - return $this->statCache[$name]['ctime']; - } - public function filemtime($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $this->cacheDir($parent); - if(!isset($this->statCache[$name])){ - return false; - } - return $this->statCache[$name]['mtime']; - } - public function fileatime($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $this->cacheDir($parent); - if(!isset($this->statCache[$name])){ - return false; - } - return $this->statCache[$name]['atime']; - } - public function file_get_contents($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $file=$this->remote->getFile($parent,$name); - file_get_contents($file); - unlink($file); - } - public function file_put_contents($path,$data){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $file=$this->remote->getFile($parent,$name); - $file=tempnam(sys_get_temp_dir(),'oc_'); - file_put_contents($file,$data); - if($return=$this->remote->sendTmpFile($file,$parent,$name)){ - $this->notifyObservers($path,OC_FILEACTION_WRITE); - } - } - public function unlink($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - if($return=$this->remote->delete($paren,$name)){ - $this->notifyObservers($path,OC_FILEACTION_DELETE); - } - return $return; - } - public function rename($path1,$path2){ - $this->connect(); - $parent1=dirname($path1); - $name1=substr($path1,strlen($parent1)+1); - $parent2=dirname($path2); - $name2=substr($path2,strlen($parent2)+1); - if($return=$this->remote->move($parent1,$name1,$parent2,$name2)){ - $this->notifyObservers($path1.'->'.$path2,OC_FILEACTION_RENAME); - } - return $return; - } - public function copy($path1,$path2){ - $this->connect(); - $parent1=dirname($path1); - $name1=substr($path1,strlen($parent1)+1); - $parent2=dirname($path2); - $name2=substr($path2,strlen($parent2)+1); - if($return=$this->copy->rename($parent1,$name1,$parent2,$name2)){ - $this->notifyObservers($path1.'->'.$path2,OC_FILEACTION_RENAME); - } - return $return; - } - public function fopen($path,$mode){ - $this->connect(); - $changed=false; - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - $file=$this->remote->getFile($parent,$name); - if($return=fopen($file,$mode)){ - switch($mode){ - case 'r': - $this->notifyObservers($path,OC_FILEACTION_READ); - break; - case 'r+': - case 'w+': - case 'x+': - case 'a+': - $this->notifyObservers($path,OC_FILEACTION_READ | OC_FILEACTION_WRITE); - $this->changed[]=array('dir'=>$parent,'file'=>$name,'tmp'=>$file); - break; - case 'w': - case 'x': - case 'a': - $this->notifyObservers($path,OC_FILEACTION_WRITE); - $this->changed[]=array('dir'=>$parent,'file'=>$name,'tmp'=>$file); - break; - } - } - return $return; - } - - public function getMimeType($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - if(substr($name,0,1)=='/'){ - $name=substr($name,1); - } - $this->cacheDir($parent); - if(!isset($this->statCache[$name])){ - return false; - } - return $this->statCache[$name]['mime']; - } - - public function toTmpFile($path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - if(substr($name,0,1)=='/'){ - $name=substr($name,1); - } - $filename=$this->remote->getFile($parent,$name); - if($filename){ - $this->notifyObservers($path,OC_FILEACTION_READ); - return $filename; - }else{ - return false; - } - } - - public function fromTmpFile($tmpFile,$path){ - $this->connect(); - $parent=dirname($path); - $name=substr($path,strlen($parent)+1); - if($this->remote->sendTmpFile($tmpFile,$parent,$name)){ - $this->notifyObservers($path,OC_FILEACTION_CREATE); - return true; - }else{ - return false; - } - } - - public function delTree($dir) { - $this->connect(); - $parent=dirname($dir); - $name=substr($dir,strlen($parent)+1); - $return=$this->remote->delete($parent,$name); - if($return=rmdir($dir)){ - $this->notifyObservers($dir,OC_FILEACTION_DELETE); - } - return $return; - } - - public function find($path){ - return $this->getTree($path); - } - - public function getTree($dir) { - $this->connect(); - if($return=$this->remote->getTree($dir)){ - $this->notifyObservers($dir,OC_FILEACTION_READ); - } - return $return; - } - - public function __destruct(){ - foreach($this->changed as $changed){ - $this->remote->sendTmpFile($changed['tmp'],$changed['dir'],$changed['file']); - } - } -} - -?> diff --git a/lib/search.php b/lib/search.php index ef82e225f3d..cb5e5eee78b 100644 --- a/lib/search.php +++ b/lib/search.php @@ -29,7 +29,7 @@ class OC_SEARCH{ /** * register a new search provider to be used - * @param OC_SearchProvider $provider + * @param OC_Search_Provider $provider */ public static function registerProvider($provider){ self::$providers[]=$provider; @@ -38,7 +38,7 @@ class OC_SEARCH{ /** * search all provider for $query * @param string query - * @return array An array of OC_SearchResult's + * @return array An array of OC_Search_Result's */ public static function search($query){ $results=array(); @@ -48,74 +48,3 @@ class OC_SEARCH{ return $results; } } - -/** - * provides search functionalty - */ -abstract class OC_SearchProvider{ - public function __construct(){ - OC_SEARCH::registerProvider($this); - } - - /** - * search for $query - * @param string $query - * @return array An array of OC_SearchResult's - */ - abstract function search($query); -} - -/** - * a result of a search - */ -class OC_SearchResult{ - private $name; - private $text; - private $link; - private $type; - - /** - * create a new search result - * @param string $name short name for the result - * @param string $text some more information about the result - * @param string $link link for the result - * @param string $type the type of result as human readable string ('File', 'Music', etc) - */ - public function __construct($name,$text,$link,$type){ - $this->name=$name; - $this->text=$text; - $this->link=$link; - $this->type=$type; - } - - public function __get($name){ - switch($name){ - case 'name': - return $this->name; - case 'text': - return $this->text; - case 'link': - return $this->link; - case 'type': - return $this->type; - } - } -} - -class OC_FileSearchProvider extends OC_SearchProvider{ - function search($query){ - $files=OC_FILESYSTEM::search($query); - $results=array(); - foreach($files as $file){ - if(OC_FILESYSTEM::is_dir($file)){ - $results[]=new OC_SearchResult(basename($file),$file,OC_HELPER::linkTo( 'files', 'index.php?dir='.$file ),'Files'); - }else{ - $results[]=new OC_SearchResult(basename($file),$file,OC_HELPER::linkTo( 'files', 'download.php?file='.$file ),'Files'); - } - } - return $results; - } -} - -new OC_FileSearchProvider(); -?> \ No newline at end of file diff --git a/lib/search/provider.php b/lib/search/provider.php new file mode 100644 index 00000000000..f0e0ba85249 --- /dev/null +++ b/lib/search/provider.php @@ -0,0 +1,16 @@ +name=$name; + $this->text=$text; + $this->link=$link; + $this->type=$type; + } + + public function __get($name){ + switch($name){ + case 'name': + return $this->name; + case 'text': + return $this->text; + case 'link': + return $this->link; + case 'type': + return $this->type; + } + } +} diff --git a/lib/setup.php b/lib/setup.php index f9bc6fd1bdd..bf7166016d4 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -1,7 +1,5 @@ printPage(); } } - -?> -- cgit v1.2.3 -- cgit v1.2.3 From bafd684eb694ed0bd86b46ff7cd36382c1cebc34 Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Fri, 29 Jul 2011 21:36:03 +0200 Subject: Renaming classes :-) --- 3dparty/MDB2/Driver/Manager/sqlite.php | 2 +- 3dparty/MDB2/Driver/sqlite.php | 2 +- admin/ajax/changepassword.php | 4 +- admin/ajax/creategroup.php | 6 +- admin/ajax/createuser.php | 10 +- admin/ajax/disableapp.php | 2 +- admin/ajax/enableapp.php | 2 +- admin/ajax/removegroup.php | 4 +- admin/ajax/removeuser.php | 4 +- admin/ajax/togglegroups.php | 8 +- admin/appinfo/app.php | 10 +- admin/apps.php | 40 ++++---- admin/system.php | 8 +- admin/templates/apps.php | 4 +- admin/templates/users.php | 2 +- admin/users.php | 18 ++-- apps/files_imageviewer/appinfo/app.php | 6 +- apps/files_publiclink/admin.php | 16 +-- apps/files_publiclink/appinfo/app.php | 2 +- apps/files_publiclink/get.php | 24 ++--- apps/files_publiclink/lib_public.php | 10 +- apps/media/ajax/api.php | 18 ++-- apps/media/ajax/autoupdate.php | 2 +- apps/media/appinfo/app.php | 10 +- apps/media/index.php | 20 ++-- apps/media/lib_ampache.php | 6 +- apps/media/lib_collection.php | 2 +- apps/media/lib_media.php | 18 ++-- apps/media/lib_scanner.php | 14 +-- apps/media/settings.php | 16 +-- apps/media/tomahawk.php | 14 +-- apps/user_ldap/appinfo/app.php | 6 +- apps/user_ldap/settings.php | 14 +-- apps/user_ldap/user_ldap.php | 14 +-- apps/user_openid/appinfo/app.php | 8 +- apps/user_openid/phpmyid.php | 4 +- apps/user_openid/settings.php | 14 +-- apps/user_openid/user.php | 2 +- apps/user_openid/user_openid.php | 2 +- core/templates/404.php | 2 +- core/templates/installation.php | 22 ++--- docs/skeleton/admin.php | 8 +- docs/skeleton/appinfo/app.sample.php | 6 +- docs/skeleton/index.php | 12 +-- files/admin.php | 10 +- files/ajax/autocomplete.php | 8 +- files/ajax/delete.php | 4 +- files/ajax/download.php | 6 +- files/ajax/list.php | 10 +- files/ajax/move.php | 4 +- files/ajax/newfolder.php | 4 +- files/ajax/rename.php | 4 +- files/ajax/upload.php | 6 +- files/appinfo/app.php | 8 +- files/download.php | 14 +-- files/index.php | 30 +++--- files/settings.php | 12 +-- files/templates/admin.php | 2 +- help/appinfo/app.php | 10 +- help/index.php | 12 +-- help/templates/index.php | 4 +- index.php | 34 +++---- lib/MDB2/Driver/Manager/sqlite3.php | 2 +- lib/MDB2/Driver/sqlite3.php | 2 +- lib/app.php | 20 ++-- lib/appconfig.php | 2 +- lib/base.php | 42 ++++---- lib/config.php | 2 +- lib/connect.php | 2 +- lib/connector/sabre/auth.php | 4 +- lib/connector/sabre/directory.php | 20 ++-- lib/connector/sabre/file.php | 10 +- lib/connector/sabre/locks.php | 8 +- lib/connector/sabre/node.php | 14 +-- lib/db.php | 26 ++--- lib/files.php | 74 +++++++------- lib/filestorage.php | 2 +- lib/filestorage/local.php | 4 +- lib/filestorage/remote.php | 4 +- lib/filesystem.php | 92 +++++++++--------- lib/group.php | 22 ++--- lib/group/backend.php | 2 +- lib/group/database.php | 2 +- lib/helper.php | 2 +- lib/hook.php | 2 +- lib/installer.php | 36 +++---- lib/l10n.php | 4 +- lib/log.php | 4 +- lib/ocs.php | 16 +-- lib/ocsclient.php | 2 +- lib/preferences.php | 2 +- lib/remote/cloud.php | 4 +- lib/search.php | 2 +- lib/search/provider.php | 2 +- lib/search/provider/file.php | 8 +- lib/setup.php | 44 ++++----- lib/template.php | 66 ++++++------- lib/user.php | 32 +++--- lib/user/backend.php | 4 +- lib/user/database.php | 4 +- lib/user/example.php | 4 +- lib/util.php | 48 ++++----- log/appinfo/app.php | 4 +- log/index.php | 30 +++--- search/appinfo/app.php | 2 +- search/index.php | 12 +-- settings/ajax/changepassword.php | 6 +- settings/ajax/setlanguage.php | 4 +- settings/appinfo/app.php | 4 +- settings/index.php | 22 ++--- tests/index.php | 2 +- tests/lib/filesystem.php | 172 ++++++++++++++++----------------- 112 files changed, 750 insertions(+), 750 deletions(-) diff --git a/3dparty/MDB2/Driver/Manager/sqlite.php b/3dparty/MDB2/Driver/Manager/sqlite.php index 5258cff891d..64019669645 100644 --- a/3dparty/MDB2/Driver/Manager/sqlite.php +++ b/3dparty/MDB2/Driver/Manager/sqlite.php @@ -72,7 +72,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common function createDatabase($name, $options = array()) { global $SERVERROOT; - $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); + $datadir=OC_Config::getValue( "datadirectory", "$SERVERROOT/data" ); $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; diff --git a/3dparty/MDB2/Driver/sqlite.php b/3dparty/MDB2/Driver/sqlite.php index 48f233167c7..63db241b863 100644 --- a/3dparty/MDB2/Driver/sqlite.php +++ b/3dparty/MDB2/Driver/sqlite.php @@ -348,7 +348,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common function connect() { global $SERVERROOT; - $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); + $datadir=OC_Config::getValue( "datadirectory", "$SERVERROOT/data" ); $database_file = $this->_getDatabaseFile($this->database_name); if (is_resource($this->connection)) { //if (count(array_diff($this->connected_dsn, $this->dsn)) == 0 diff --git a/admin/ajax/changepassword.php b/admin/ajax/changepassword.php index 51634908a76..98c2a8b37a1 100644 --- a/admin/ajax/changepassword.php +++ b/admin/ajax/changepassword.php @@ -7,7 +7,7 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){ +if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -16,7 +16,7 @@ $username = $_POST["username"]; $password = $_POST["password"]; // Return Success story -if( OC_USER::setPassword( $username, $password )){ +if( OC_User::setPassword( $username, $password )){ echo json_encode( array( "status" => "success", "data" => array( "username" => $username ))); } else{ diff --git a/admin/ajax/creategroup.php b/admin/ajax/creategroup.php index df9a36aaa2f..2631937b14d 100644 --- a/admin/ajax/creategroup.php +++ b/admin/ajax/creategroup.php @@ -7,7 +7,7 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){ +if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -15,13 +15,13 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )) $groupname = $_POST["groupname"]; // Does the group exist? -if( in_array( $groupname, OC_GROUP::getGroups())){ +if( in_array( $groupname, OC_Group::getGroups())){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Group already exists" ))); exit(); } // Return Success story -if( OC_GROUP::createGroup( $groupname )){ +if( OC_Group::createGroup( $groupname )){ echo json_encode( array( "status" => "success", "data" => array( "groupname" => $groupname ))); } else{ diff --git a/admin/ajax/createuser.php b/admin/ajax/createuser.php index 507ded9079f..1bb655ed336 100644 --- a/admin/ajax/createuser.php +++ b/admin/ajax/createuser.php @@ -7,7 +7,7 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){ +if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -20,17 +20,17 @@ $username = $_POST["username"]; $password = $_POST["password"]; // Does the group exist? -if( in_array( $username, OC_USER::getUsers())){ +if( in_array( $username, OC_User::getUsers())){ echo json_encode( array( "status" => "error", "data" => array( "message" => "User already exists" ))); exit(); } // Return Success story -if( OC_USER::createUser( $username, $password )){ +if( OC_User::createUser( $username, $password )){ foreach( $groups as $i ){ - OC_GROUP::addToGroup( $username, $i ); + OC_Group::addToGroup( $username, $i ); } - echo json_encode( array( "status" => "success", "data" => array( "username" => $username, "groups" => implode( ", ", OC_GROUP::getUserGroups( $username ))))); + echo json_encode( array( "status" => "success", "data" => array( "username" => $username, "groups" => implode( ", ", OC_Group::getUserGroups( $username ))))); } else{ echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to add user" ))); diff --git a/admin/ajax/disableapp.php b/admin/ajax/disableapp.php index d23f8de7ef0..dce62fa11d4 100644 --- a/admin/ajax/disableapp.php +++ b/admin/ajax/disableapp.php @@ -4,6 +4,6 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); -OC_APP::disable($_POST['appid']); +OC_App::disable($_POST['appid']); ?> diff --git a/admin/ajax/enableapp.php b/admin/ajax/enableapp.php index d988d7fd2df..eb1bfc54a04 100644 --- a/admin/ajax/enableapp.php +++ b/admin/ajax/enableapp.php @@ -4,6 +4,6 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); -OC_APP::enable($_POST['appid']); +OC_App::enable($_POST['appid']); ?> diff --git a/admin/ajax/removegroup.php b/admin/ajax/removegroup.php index e3d62e5fac8..bf80da741c7 100644 --- a/admin/ajax/removegroup.php +++ b/admin/ajax/removegroup.php @@ -7,7 +7,7 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){ +if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -15,7 +15,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )) $name = $_POST["groupname"]; // Return Success story -if( OC_GROUP::deleteGroup( $name )){ +if( OC_Group::deleteGroup( $name )){ echo json_encode( array( "status" => "success", "data" => array( "groupname" => $name ))); } else{ diff --git a/admin/ajax/removeuser.php b/admin/ajax/removeuser.php index 6b48146ad45..0a94884cb96 100644 --- a/admin/ajax/removeuser.php +++ b/admin/ajax/removeuser.php @@ -7,7 +7,7 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){ +if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -15,7 +15,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )) $username = $_POST["username"]; // Return Success story -if( OC_USER::deleteUser( $username )){ +if( OC_User::deleteUser( $username )){ echo json_encode( array( "status" => "success", "data" => array( "username" => $username ))); } else{ diff --git a/admin/ajax/togglegroups.php b/admin/ajax/togglegroups.php index 5c7bd393e92..808e57dc9d6 100644 --- a/admin/ajax/togglegroups.php +++ b/admin/ajax/togglegroups.php @@ -7,7 +7,7 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( OC_USER::getUser(), 'admin' )){ +if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -20,13 +20,13 @@ $username = $_POST["username"]; $group = $_POST["group"]; // Toggle group -if( OC_GROUP::inGroup( $username, $group )){ +if( OC_Group::inGroup( $username, $group )){ $action = "remove"; $error = "remove user from"; - $success = OC_GROUP::removeFromGroup( $username, $group ); + $success = OC_Group::removeFromGroup( $username, $group ); } else{ - $success = OC_GROUP::addToGroup( $username, $group ); + $success = OC_Group::addToGroup( $username, $group ); } // Return Success story diff --git a/admin/appinfo/app.php b/admin/appinfo/app.php index 7ce784cfb98..dfb9aee8159 100644 --- a/admin/appinfo/app.php +++ b/admin/appinfo/app.php @@ -1,12 +1,12 @@ 1, "id" => "admin", "name" => "Administration" )); +OC_App::register( array( "order" => 1, "id" => "admin", "name" => "Administration" )); -// OC_APP::addAdminPage( array( "id" => "core_system", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" =>"System", "icon" => OC_HELPER::imagePath( "admin", "administration.png" ))); -OC_APP::addAdminPage( array( "id" => "core_users", "order" => 2, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_HELPER::imagePath( "admin", "users.png" ))); -OC_APP::addAdminPage( array( "id" => "core_apps", "order" => 3, "href" => OC_HELPER::linkTo( "admin", "apps.php?installed" ), "name" => "Apps", "icon" => OC_HELPER::imagePath( "admin", "apps.png" ))); +// OC_App::addAdminPage( array( "id" => "core_system", "order" => 1, "href" => OC_Helper::linkTo( "admin", "system.php" ), "name" =>"System", "icon" => OC_Helper::imagePath( "admin", "administration.png" ))); +OC_App::addAdminPage( array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "admin", "users.php" ), "name" => "Users", "icon" => OC_Helper::imagePath( "admin", "users.png" ))); +OC_App::addAdminPage( array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "admin", "apps.php?installed" ), "name" => "Apps", "icon" => OC_Helper::imagePath( "admin", "apps.png" ))); // Add subentries for App installer -OC_APP::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_get", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Get new apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); +OC_App::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_get", "order" => 4, "href" => OC_Helper::linkTo( "admin", "apps.php" ), "name" => "Get new apps", "icon" => OC_Helper::imagePath( "admin", "navicon.png" ))); ?> diff --git a/admin/apps.php b/admin/apps.php index 4bbf1c813b0..4f39feab0c5 100644 --- a/admin/apps.php +++ b/admin/apps.php @@ -22,14 +22,14 @@ */ require_once('../lib/base.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(); } // Load the files we need -OC_UTIL::addStyle( "admin", "apps" ); -OC_UTIL::addScript( "admin", "apps" ); +OC_Util::addStyle( "admin", "apps" ); +OC_Util::addScript( "admin", "apps" ); if(isset($_GET['id'])) $id=$_GET['id']; else $id=0; @@ -38,32 +38,32 @@ if(isset($_GET['installed'])) $installed=true; else $installed=false; if($installed){ global $SERVERROOT; - OC_INSTALLER::installShippedApps(false); - $apps = OC_APPCONFIG::getApps(); + OC_Installer::installShippedApps(false); + $apps = OC_Appconfig::getApps(); $records = array(); - OC_APP::setActiveNavigationEntry( "core_apps" ); + OC_App::setActiveNavigationEntry( "core_apps" ); foreach($apps as $app){ - $info=OC_APP::getAppInfo("$SERVERROOT/apps/$app/appinfo/info.xml"); + $info=OC_App::getAppInfo("$SERVERROOT/apps/$app/appinfo/info.xml"); $record = array( 'id' => $app, 'name' => $info['name'], 'version' => $info['version'], 'author' => $info['author'], - 'enabled' => OC_APP::isEnabled( $app )); + 'enabled' => OC_App::isEnabled( $app )); $records[]=$record; } - $tmpl = new OC_TEMPLATE( "admin", "appsinst", "admin" ); + $tmpl = new OC_Template( "admin", "appsinst", "admin" ); $tmpl->assign( "apps", $records ); $tmpl->printPage(); unset($tmpl); exit(); }else{ - $categories=OC_OCSCLIENT::getCategories(); + $categories=OC_OCSClient::getCategories(); if($categories==NULL){ - OC_APP::setActiveNavigationEntry( "core_apps" ); + OC_App::setActiveNavigationEntry( "core_apps" ); - $tmpl = new OC_TEMPLATE( "admin", "app_noconn", "admin" ); + $tmpl = new OC_Template( "admin", "app_noconn", "admin" ); $tmpl->printPage(); unset($tmpl); exit(); @@ -71,18 +71,18 @@ if($installed){ if($id==0) { - OC_APP::setActiveNavigationEntry( "core_apps_get" ); + OC_App::setActiveNavigationEntry( "core_apps_get" ); if($cat==0){ $numcats=array(); foreach($categories as $key=>$value) $numcats[]=$key; - $apps=OC_OCSCLIENT::getApplications($numcats); + $apps=OC_OCSClient::getApplications($numcats); }else{ - $apps=OC_OCSCLIENT::getApplications($cat); + $apps=OC_OCSClient::getApplications($cat); } // return template - $tmpl = new OC_TEMPLATE( "admin", "apps", "admin" ); + $tmpl = new OC_Template( "admin", "apps", "admin" ); $tmpl->assign( "categories", $categories ); $tmpl->assign( "apps", $apps ); @@ -90,11 +90,11 @@ if($installed){ unset($tmpl); }else{ - OC_APP::setActiveNavigationEntry( "core_apps" ); + OC_App::setActiveNavigationEntry( "core_apps" ); - $app=OC_OCSCLIENT::getApplication($id); + $app=OC_OCSClient::getApplication($id); - $tmpl = new OC_TEMPLATE( "admin", "app", "admin" ); + $tmpl = new OC_Template( "admin", "app", "admin" ); $tmpl->assign( "categories", $categories ); $tmpl->assign( "app", $app ); $tmpl->printPage(); diff --git a/admin/system.php b/admin/system.php index 9286ab9c2b3..11a76132b4c 100644 --- a/admin/system.php +++ b/admin/system.php @@ -22,14 +22,14 @@ */ require_once('../lib/base.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(); } -OC_APP::setActiveNavigationEntry( "administration" ); +OC_App::setActiveNavigationEntry( "administration" ); -$tmpl = new OC_TEMPLATE( "admin", "system", "admin" ); +$tmpl = new OC_Template( "admin", "system", "admin" ); $tmpl->printPage(); ?> diff --git a/admin/templates/apps.php b/admin/templates/apps.php index 593aad63182..50dd497c333 100644 --- a/admin/templates/apps.php +++ b/admin/templates/apps.php @@ -17,8 +17,8 @@ - "") { echo(''); } ?> - " title="">
'.$app['typename'].''); ?> + "") { echo(''); } ?> + " title="">
'.$app['typename'].''); ?> l('datetime', $app["changed"]); ?> diff --git a/admin/templates/users.php b/admin/templates/users.php index 147db7c7aa4..6fc3e643010 100644 --- a/admin/templates/users.php +++ b/admin/templates/users.php @@ -33,7 +33,7 @@
- + t( 'remove' ); ?> diff --git a/admin/users.php b/admin/users.php index 4065cc471f1..fd0b6fec01b 100644 --- a/admin/users.php +++ b/admin/users.php @@ -22,34 +22,34 @@ */ require_once('../lib/base.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(); } // We have some javascript foo! -OC_UTIL::addScript( "admin", "users" ); -OC_UTIL::addStyle( "admin", "users" ); -OC_APP::setActiveNavigationEntry( "core_users" ); +OC_Util::addScript( "admin", "users" ); +OC_Util::addStyle( "admin", "users" ); +OC_App::setActiveNavigationEntry( "core_users" ); $users = array(); $groups = array(); -foreach( OC_USER::getUsers() as $i ){ +foreach( OC_User::getUsers() as $i ){ // Do some more work here soon $ingroups = array(); - foreach( OC_GROUP::getUserGroups( $i ) as $userGroup ){ + foreach( OC_Group::getUserGroups( $i ) as $userGroup ){ $ingroups[] = $userGroup; } $users[] = array( "name" => $i, "groups" => join( ", ", $ingroups )); } -foreach( OC_GROUP::getGroups() as $i ){ +foreach( OC_Group::getGroups() as $i ){ // Do some more work here soon $groups[] = array( "name" => $i ); } -$tmpl = new OC_TEMPLATE( "admin", "users", "admin" ); +$tmpl = new OC_Template( "admin", "users", "admin" ); $tmpl->assign( "users", $users ); $tmpl->assign( "groups", $groups ); $tmpl->printPage(); 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 @@ diff --git a/apps/files_publiclink/admin.php b/apps/files_publiclink/admin.php index 9a1a9ce03c2..8187039c3a6 100644 --- a/apps/files_publiclink/admin.php +++ b/apps/files_publiclink/admin.php @@ -28,25 +28,25 @@ require_once( 'lib_public.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 @@ "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 3bc961bc37d..6bcefc2e4e8 100644 --- a/apps/files_publiclink/get.php +++ b/apps/files_publiclink/get.php @@ -18,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']=''; @@ -47,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/media/ajax/api.php b/apps/media/ajax/api.php index 84d5dd17882..225bce7b092 100644 --- a/apps/media/ajax/api.php +++ b/apps/media/ajax/api.php @@ -52,16 +52,16 @@ 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(); @@ -78,11 +78,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 +103,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 +112,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..d75bac031e9 100644 --- a/apps/media/appinfo/app.php +++ b/apps/media/appinfo/app.php @@ -22,12 +22,12 @@ 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' ))); ?> diff --git a/apps/media/index.php b/apps/media/index.php index fbf1c395d99..152c4583412 100644 --- a/apps/media/index.php +++ b/apps/media/index.php @@ -25,25 +25,25 @@ 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'); -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','jquery.jplayer.min'); +OC_Util::addStyle('media','player'); +OC_Util::addStyle('media','music'); -OC_APP::setActiveNavigationEntry( 'media_index' ); +OC_App::setActiveNavigationEntry( 'media_index' ); -$tmpl = new OC_TEMPLATE( 'media', 'music', 'user' ); +$tmpl = new OC_Template( 'media', 'music', 'user' ); -$player = new OC_TEMPLATE( 'media', 'player'); +$player = new OC_Template( 'media', 'player'); $tmpl->assign('player',$player->fetchPage()); $tmpl->printPage(); ?> 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..d9f567aa682 100644 --- a/apps/media/lib_collection.php +++ b/apps/media/lib_collection.php @@ -125,7 +125,7 @@ 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']); diff --git a/apps/media/lib_media.php b/apps/media/lib_media.php index 6fde2ab7487..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'; @@ -90,18 +90,18 @@ class OC_MediaSearchProvider extends OC_Search_Provider{ $songs=OC_MEDIA_COLLECTION::getSongs(0,0,$query); $results=array(); foreach($artists as $artist){ - $results[]=new OC_Search_Result($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_Search_Result($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_Search_Result($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 4bd9acfd80b..0563bc38fb3 100644 --- a/apps/media/settings.php +++ b/apps/media/settings.php @@ -24,19 +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( '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){ @@ -44,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/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 8f9d282d2b1..cae3542a65b 100644 --- a/apps/user_ldap/settings.php +++ b/apps/user_ldap/settings.php @@ -23,8 +23,8 @@ require_once('../../lib/base.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(); } @@ -32,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 a197c0a10e0..54fc51fe0cd 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -21,7 +21,7 @@ * */ -class OC_USER_LDAP extends OC_USER_BACKEND { +class OC_USER_LDAP extends OC_User_Backend { protected $ds; protected $configured = false; @@ -35,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 5726ca99948..bcab9e55cbb 100644 --- a/apps/user_openid/phpmyid.php +++ b/apps/user_openid/phpmyid.php @@ -205,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; @@ -559,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 29c18eaa497..4293a6c8aaf 100644 --- a/apps/user_openid/settings.php +++ b/apps/user_openid/settings.php @@ -1,22 +1,22 @@ 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 c18edccf2db..d9af94dcafa 100644 --- a/apps/user_openid/user_openid.php +++ b/apps/user_openid/user_openid.php @@ -26,7 +26,7 @@ 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 diff --git a/core/templates/404.php b/core/templates/404.php index 65cfaec3b7c..d042944c193 100644 --- a/core/templates/404.php +++ b/core/templates/404.php @@ -2,7 +2,7 @@ if(!isset($_)){//also provide standalone error page require_once '../../lib/base.php'; - $tmpl = new OC_TEMPLATE( '', '404', 'guest' ); + $tmpl = new OC_Template( '', '404', 'guest' ); $tmpl->printPage(); exit; } diff --git a/core/templates/installation.php b/core/templates/installation.php index 0a6dacad955..8b36d14bbf5 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -24,15 +24,15 @@
t( 'Create an admin account.' ); ?> -

-

+

+

- t( 'Advanced' ); ?> '> + t( 'Advanced' ); ?> '>
t( 'Set where to store the data.' ); ?> -

+

@@ -43,7 +43,7 @@

t( 'SQLite will be used for the database. You have nothing to do.' ); ?>

-

/>

+

/>

@@ -53,14 +53,14 @@

t( 'MySQL will be used for the database.' ); ?>

-

/>

+

/>

-

-

-

-

-

+

+

+

+

+

diff --git a/docs/skeleton/admin.php b/docs/skeleton/admin.php index 723c7f7612b..20df8a0c71d 100644 --- a/docs/skeleton/admin.php +++ b/docs/skeleton/admin.php @@ -29,12 +29,12 @@ $RUNTIME_NOSETUPFS = true; require_once('../lib/base.php'); // We need the file system although we said do not load it! Do it by hand now -OC_UTIL::setupFS(); +OC_Util::setupFS(); // The user should have admin rights. This is an admin page! -if( !OC_USER::isLoggedIn() || !OC_USER::ingroup( $_SESSION['username'], 'admin' )){ +if( !OC_User::isLoggedIn() || !OC_User::ingroup( $_SESSION['username'], 'admin' )){ // Bad boy! Go to the very first page of owncloud - header( "Location: ".OC_HELPER::linkTo( "index.php" )); + header( "Location: ".OC_Helper::linkTo( "index.php" )); exit(); } @@ -43,7 +43,7 @@ $myvar = 2; $myarray = array( "foo" => array( 0, 1, 2 ), "bar" => "baz" ); // Preparing for output! -$tmpl = new OC_TEMPLATE( "skeleton", "admin", "admin" ); // Programname, template, mode +$tmpl = new OC_Template( "skeleton", "admin", "admin" ); // Programname, template, mode // Assign the vars $tmpl->assign( "var", $myvar ); $tmpl->assign( "array", $myarray ); diff --git a/docs/skeleton/appinfo/app.sample.php b/docs/skeleton/appinfo/app.sample.php index 12db7154c2b..ce310996b05 100644 --- a/docs/skeleton/appinfo/app.sample.php +++ b/docs/skeleton/appinfo/app.sample.php @@ -4,12 +4,12 @@ */ // Hello, we are here -OC_APP::register( array( "id" => "skeleton", "name" => "Files", "order" => 1000 )); +OC_App::register( array( "id" => "skeleton", "name" => "Files", "order" => 1000 )); // Add application to navigation -OC_UTIL::addNavigationEntry( array( "id" => "skeleton_index", "order" => 1000, "href" => OC_HELPER::linkTo( "skeleton", "index.php" ), "icon" => OC_HELPER::imagePath( "skeleton", "app.png" ), "name" => "Example app" )); +OC_Util::addNavigationEntry( array( "id" => "skeleton_index", "order" => 1000, "href" => OC_Helper::linkTo( "skeleton", "index.php" ), "icon" => OC_Helper::imagePath( "skeleton", "app.png" ), "name" => "Example app" )); // Add an admin page -OC_UTIL::addAdminPage( array( "order" => 1, "href" => OC_HELPER::linkTo( "skeleton", "admin.php" ), "name" => "Example app options" )); +OC_Util::addAdminPage( array( "order" => 1, "href" => OC_Helper::linkTo( "skeleton", "admin.php" ), "name" => "Example app options" )); ?> diff --git a/docs/skeleton/index.php b/docs/skeleton/index.php index 5402990e4c9..10043887845 100644 --- a/docs/skeleton/index.php +++ b/docs/skeleton/index.php @@ -26,20 +26,20 @@ 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(); } // Load the files we need -OC_UTIL::addStyle( "files", "files" ); -OC_UTIL::addScript( "files", "files" ); +OC_Util::addStyle( "files", "files" ); +OC_Util::addScript( "files", "files" ); // Load the files $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; $files = array(); -foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ +foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ $i["date"] = date( $CONFIG_DATEFORMAT, $i["mtime"] ); $files[] = $i; } @@ -55,7 +55,7 @@ foreach( explode( "/", $dir ) as $i ){ } // return template -$tmpl = new OC_TEMPLATE( "files", "index", "user" ); +$tmpl = new OC_Template( "files", "index", "user" ); $tmpl->assign( "files", $files ); $tmpl->assign( "breadcrumb", $breadcrumb ); $tmpl->printPage(); diff --git a/files/admin.php b/files/admin.php index c0a41335f5e..0b8639f38ca 100644 --- a/files/admin.php +++ b/files/admin.php @@ -27,22 +27,22 @@ require_once('../lib/base.php'); // Check if we are a user -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(); } $htaccessWorking=(getenv('htaccessWorking')=='true'); if(isset($_POST['maxUploadSize'])){ $maxUploadFilesize=$_POST['maxUploadSize']; - OC_FILES::setUploadLimit(OC_HELPER::computerFileSize($maxUploadFilesize)); + OC_Files::setUploadLimit(OC_Helper::computerFileSize($maxUploadFilesize)); }else{ $maxUploadFilesize = ini_get('upload_max_filesize').'B'; } -OC_APP::setActiveNavigationEntry( "files_administration" ); +OC_App::setActiveNavigationEntry( "files_administration" ); // return template -$tmpl = new OC_TEMPLATE( "files", "admin", "admin" ); +$tmpl = new OC_Template( "files", "admin", "admin" ); $tmpl->assign( 'htaccessWorking', $htaccessWorking ); $tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize); $tmpl->printPage(); diff --git a/files/ajax/autocomplete.php b/files/ajax/autocomplete.php index 2c2f665fd6c..183ee86c788 100644 --- a/files/ajax/autocomplete.php +++ b/files/ajax/autocomplete.php @@ -9,7 +9,7 @@ require_once('../../lib/base.php'); // header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn()){ +if( !OC_User::isLoggedIn()){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -40,8 +40,8 @@ $query=strtolower($query); $files=array(); -if(OC_FILESYSTEM::file_exists($base) and OC_FILESYSTEM::is_dir($base)){ - $dh = OC_FILESYSTEM::opendir($base); +if(OC_Filesystem::file_exists($base) and OC_Filesystem::is_dir($base)){ + $dh = OC_Filesystem::opendir($base); if($dh){ if(substr($base,-1,1)!='/'){ $base=$base.'/'; @@ -50,7 +50,7 @@ if(OC_FILESYSTEM::file_exists($base) and OC_FILESYSTEM::is_dir($base)){ if ($file != "." && $file != ".."){ if(substr(strtolower($file),0,$queryLen)==$query){ $item=$base.$file; - if((!$dirOnly or OC_FILESYSTEM::is_dir($item))){ + if((!$dirOnly or OC_Filesystem::is_dir($item))){ $files[]=(object)array('id'=>$item,'label'=>$item,'name'=>$item); } } diff --git a/files/ajax/delete.php b/files/ajax/delete.php index 79caf4d0bb2..782db215dfc 100644 --- a/files/ajax/delete.php +++ b/files/ajax/delete.php @@ -7,7 +7,7 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn()){ +if( !OC_User::isLoggedIn()){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -21,7 +21,7 @@ $filesWithError = ''; $status = 'success'; //Now delete foreach($files as $file) { - if( !OC_FILES::delete( $dir, $file )){ + if( !OC_Files::delete( $dir, $file )){ $filesWithError .= $file . "\n"; $status = 'error'; } diff --git a/files/ajax/download.php b/files/ajax/download.php index 0b2f894a11b..2bbf1df4eca 100644 --- a/files/ajax/download.php +++ b/files/ajax/download.php @@ -25,13 +25,13 @@ 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(); } $files = $_GET["files"]; $dir = $_GET["dir"]; -OC_FILES::get($dir,$files); +OC_Files::get($dir,$files); ?> diff --git a/files/ajax/list.php b/files/ajax/list.php index 26462eb5ab9..547bc91fb05 100644 --- a/files/ajax/list.php +++ b/files/ajax/list.php @@ -7,7 +7,7 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn()){ +if( !OC_User::isLoggedIn()){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -28,7 +28,7 @@ if($doBreadcrumb){ } } - $breadcrumbNav = new OC_TEMPLATE( "files", "part.breadcrumb", "" ); + $breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" ); $breadcrumbNav->assign( "breadcrumb", $breadcrumb ); $data['breadcrumb'] = $breadcrumbNav->fetchPage(); @@ -36,12 +36,12 @@ if($doBreadcrumb){ // make filelist $files = array(); -foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ - $i["date"] = OC_UTIL::formatDate($i["mtime"] ); +foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ + $i["date"] = OC_Util::formatDate($i["mtime"] ); $files[] = $i; } -$list = new OC_TEMPLATE( "files", "part.list", "" ); +$list = new OC_Template( "files", "part.list", "" ); $list->assign( "files", $files ); $data = array('files' => $list->fetchPage()); diff --git a/files/ajax/move.php b/files/ajax/move.php index b1ba641c5b1..4224cbce6d0 100644 --- a/files/ajax/move.php +++ b/files/ajax/move.php @@ -7,7 +7,7 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn()){ +if( !OC_User::isLoggedIn()){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -18,7 +18,7 @@ $file = $_GET["file"]; $target = $_GET["target"]; -if(OC_FILES::move($dir,$file,$target,$file)){ +if(OC_Files::move($dir,$file,$target,$file)){ echo json_encode( array( "status" => 'success', "data" => array( "dir" => $dir, "files" => $file ))); }else{ echo json_encode( array( "status" => 'error', "data" => array( "message" => "Could move $file" ))); diff --git a/files/ajax/newfolder.php b/files/ajax/newfolder.php index 988e7f04012..610418583bd 100644 --- a/files/ajax/newfolder.php +++ b/files/ajax/newfolder.php @@ -7,7 +7,7 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn()){ +if( !OC_User::isLoggedIn()){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -21,7 +21,7 @@ if($foldername == '') { exit(); } error_log('try to create ' . $foldername . ' in ' . $dir); -if(OC_FILES::newFile($dir, $foldername, 'dir')) { +if(OC_Files::newFile($dir, $foldername, 'dir')) { echo json_encode( array( "status" => "success", "data" => array())); exit(); } diff --git a/files/ajax/rename.php b/files/ajax/rename.php index 7554aa0dd62..516077f6fda 100644 --- a/files/ajax/rename.php +++ b/files/ajax/rename.php @@ -7,7 +7,7 @@ require_once('../../lib/base.php'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn()){ +if( !OC_User::isLoggedIn()){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -18,7 +18,7 @@ $file = $_GET["file"]; $newname = $_GET["newname"]; // Delete -if( OC_FILES::move( $dir, $file, $dir, $newname )) { +if( OC_Files::move( $dir, $file, $dir, $newname )) { echo json_encode( array( "status" => "success", "data" => array( "dir" => $dir, "file" => $file, "newname" => $newname ))); } else{ diff --git a/files/ajax/upload.php b/files/ajax/upload.php index f47f9b3d282..5dcd2f2b6af 100644 --- a/files/ajax/upload.php +++ b/files/ajax/upload.php @@ -9,7 +9,7 @@ require_once('../../lib/base.php'); header( "Content-Type: text/plain" ); // Check if we are a user -if( !OC_USER::isLoggedIn()){ +if( !OC_User::isLoggedIn()){ echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" ))); exit(); } @@ -24,8 +24,8 @@ if(strpos($dir,'..') === false){ $fileCount=count($files['name']); for($i=0;$i<$fileCount;$i++){ $target='/' . stripslashes($dir) . $files['name'][$i]; - if(OC_FILESYSTEM::fromUploadedFile($files['tmp_name'][$i],$target)){ - $result[]=array( "status" => "success", 'mime'=>OC_FILESYSTEM::getMimeType($target),'size'=>OC_FILESYSTEM::filesize($target),'name'=>$files['name'][$i]); + if(OC_Filesystem::fromUploadedFile($files['tmp_name'][$i],$target)){ + $result[]=array( "status" => "success", 'mime'=>OC_Filesystem::getMimeType($target),'size'=>OC_Filesystem::filesize($target),'name'=>$files['name'][$i]); } } echo json_encode($result); diff --git a/files/appinfo/app.php b/files/appinfo/app.php index 06ca16e82d4..0f95b19f592 100644 --- a/files/appinfo/app.php +++ b/files/appinfo/app.php @@ -1,12 +1,12 @@ 2, "id" => "files", "name" => "Files" )); +OC_App::register( array( "order" => 2, "id" => "files", "name" => "Files" )); -OC_APP::addNavigationEntry( array( "id" => "files_index", "order" => 1, "href" => OC_HELPER::linkTo( "files", "index.php" ), "icon" => OC_HELPER::imagePath( "files", "home.png" ), "name" => "Files" )); -OC_APP::addAdminPage( array( "id" => "files_administration", "order" => 3, "href" => OC_HELPER::linkTo( "files", "admin.php" ), "name" => "Files", "icon" => OC_HELPER::imagePath( "files", "folder.png" ))); +OC_App::addNavigationEntry( array( "id" => "files_index", "order" => 1, "href" => OC_Helper::linkTo( "files", "index.php" ), "icon" => OC_Helper::imagePath( "files", "home.png" ), "name" => "Files" )); +OC_App::addAdminPage( array( "id" => "files_administration", "order" => 3, "href" => OC_Helper::linkTo( "files", "admin.php" ), "name" => "Files", "icon" => OC_Helper::imagePath( "files", "folder.png" ))); // To add navigation sub entries use -// OC_APP::addNavigationSubEntry( "files_index", array( ... )); +// OC_App::addNavigationSubEntry( "files_index", array( ... )); ?> diff --git a/files/download.php b/files/download.php index ab3dee51348..cc52b930f72 100644 --- a/files/download.php +++ b/files/download.php @@ -25,30 +25,30 @@ 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(); } $filename = $_GET["file"]; -if(!OC_FILESYSTEM::file_exists($filename)){ +if(!OC_Filesystem::file_exists($filename)){ header("HTTP/1.0 404 Not Found"); - $tmpl = new OC_TEMPLATE( '', '404', 'guest' ); + $tmpl = new OC_Template( '', '404', 'guest' ); $tmpl->assign('file',$filename); $tmpl->printPage(); exit; } -$ftype=OC_FILESYSTEM::getMimeType( $filename ); +$ftype=OC_Filesystem::getMimeType( $filename ); header('Content-Type:'.$ftype); header('Content-Disposition: attachment; filename="'.basename($filename).'"'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); -header('Content-Length: '.OC_FILESYSTEM::filesize($filename)); +header('Content-Length: '.OC_Filesystem::filesize($filename)); ob_end_clean(); -OC_FILESYSTEM::readfile( $filename ); +OC_Filesystem::readfile( $filename ); ?> diff --git a/files/index.php b/files/index.php index 4f40e70393b..821879b0346 100644 --- a/files/index.php +++ b/files/index.php @@ -26,26 +26,26 @@ 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(); } // Load the files we need -OC_UTIL::addStyle( "files", "files" ); -OC_UTIL::addScript( "files", "files" ); -OC_UTIL::addScript( 'files', 'filelist' ); -OC_UTIL::addScript( 'files', 'fileactions' ); +OC_Util::addStyle( "files", "files" ); +OC_Util::addScript( "files", "files" ); +OC_Util::addScript( 'files', 'filelist' ); +OC_Util::addScript( 'files', 'fileactions' ); if(!isset($_SESSION['timezone'])){ - OC_UTIL::addScript( 'files', 'timezone' ); + OC_Util::addScript( 'files', 'timezone' ); } -OC_APP::setActiveNavigationEntry( "files_index" ); +OC_App::setActiveNavigationEntry( "files_index" ); // Load the files $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; $files = array(); -foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ - $i["date"] = OC_UTIL::formatDate($i["mtime"] ); +foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ + $i["date"] = OC_Util::formatDate($i["mtime"] ); if($i['type']=='file'){ $i['extention']=substr($i['name'],strrpos($i['name'],'.')); $i['basename']=substr($i['name'],0,strrpos($i['name'],'.')); @@ -67,19 +67,19 @@ foreach( explode( "/", $dir ) as $i ){ } // make breadcrumb und filelist markup -$list = new OC_TEMPLATE( "files", "part.list", "" ); +$list = new OC_Template( "files", "part.list", "" ); $list->assign( "files", $files ); -$breadcrumbNav = new OC_TEMPLATE( "files", "part.breadcrumb", "" ); +$breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" ); $breadcrumbNav->assign( "breadcrumb", $breadcrumb ); -$maxUploadFilesize = OC_HELPER::computerFileSize(ini_get('upload_max_filesize')); +$maxUploadFilesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize')); -$tmpl = new OC_TEMPLATE( "files", "index", "user" ); +$tmpl = new OC_Template( "files", "index", "user" ); $tmpl->assign( "fileList", $list->fetchPage() ); $tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() ); $tmpl->assign( 'dir', $dir); $tmpl->assign( 'uploadMaxFilesize', $maxUploadFilesize); -$tmpl->assign( 'uploadMaxHumanFilesize', OC_HELPER::humanFileSize($maxUploadFilesize)); +$tmpl->assign( 'uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize)); $tmpl->printPage(); ?> diff --git a/files/settings.php b/files/settings.php index 447a38b1815..1f2e9d9868c 100644 --- a/files/settings.php +++ b/files/settings.php @@ -26,20 +26,20 @@ 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(); } // Load the files we need -OC_UTIL::addStyle( "files", "files" ); -OC_UTIL::addScript( "files", "files" ); +OC_Util::addStyle( "files", "files" ); +OC_Util::addScript( "files", "files" ); // Load the files $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; $files = array(); -foreach( OC_FILES::getdirectorycontent( $dir ) as $i ){ +foreach( OC_Files::getdirectorycontent( $dir ) as $i ){ $i["date"] = date( $CONFIG_DATEFORMAT, $i["mtime"] ); $files[] = $i; } @@ -55,7 +55,7 @@ foreach( explode( "/", $dir ) as $i ){ } // return template -$tmpl = new OC_TEMPLATE( "files", "index", "user" ); +$tmpl = new OC_Template( "files", "index", "user" ); $tmpl->assign( 'files', $files ); $tmpl->assign( "breadcrumb", $breadcrumb ); $tmpl->printPage(); diff --git a/files/templates/admin.php b/files/templates/admin.php index 40880d34911..e0cf2608301 100644 --- a/files/templates/admin.php +++ b/files/templates/admin.php @@ -1,4 +1,4 @@ - +
diff --git a/help/appinfo/app.php b/help/appinfo/app.php index fd46085ef77..2e82c0cd181 100644 --- a/help/appinfo/app.php +++ b/help/appinfo/app.php @@ -1,14 +1,14 @@ 1, "id" => "help", "name" => "Help" )); +OC_App::register( array( "order" => 1, "id" => "help", "name" => "Help" )); // Workaround for having help as the last entry always -$entry = array( "id" => "help", "order" => 1000, "href" => OC_HELPER::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_HELPER::imagePath( "help", "help.png" )); -if( isset( $_SESSION["user_id"] ) && OC_GROUP::inGroup( $_SESSION["user_id"], "admin" )){ - OC_APP::addAdminPage( $entry ); +$entry = array( "id" => "help", "order" => 1000, "href" => OC_Helper::linkTo( "help", "index.php" ), "name" => "Help", "icon" => OC_Helper::imagePath( "help", "help.png" )); +if( isset( $_SESSION["user_id"] ) && OC_Group::inGroup( $_SESSION["user_id"], "admin" )){ + OC_App::addAdminPage( $entry ); } else{ - OC_APP::addSettingsPage( $entry ); + OC_App::addSettingsPage( $entry ); } ?> diff --git a/help/index.php b/help/index.php index adcb47f08f6..f1adea0be01 100644 --- a/help/index.php +++ b/help/index.php @@ -1,8 +1,8 @@ assign( "kbe", $kbe ); $tmpl->assign( "pagecount", $pagecount ); $tmpl->assign( "page", $page ); diff --git a/help/templates/index.php b/help/templates/index.php index 7105507f5eb..f239de217d0 100644 --- a/help/templates/index.php +++ b/help/templates/index.php @@ -17,8 +17,8 @@ printPage(); ?> t( 'ASK A QUESTION' ); ?> diff --git a/index.php b/index.php index 6e580a508c8..46dc990af68 100644 --- a/index.php +++ b/index.php @@ -25,14 +25,14 @@ $RUNTIME_NOAPPS = TRUE; //no apps, yet require_once('lib/base.php'); -OC_UTIL::addScript('setup'); +OC_Util::addScript('setup'); -$not_installed = !OC_CONFIG::getValue('installed', false); +$not_installed = !OC_Config::getValue('installed', false); $install_called = (isset($_POST['install']) AND $_POST['install']=='true'); // First step : check if the server is correctly configured for ownCloud : -$errors = OC_UTIL::checkServer(); +$errors = OC_Util::checkServer(); if(count($errors) > 0) { - OC_TEMPLATE::printGuestPage("", "error", array("errors" => $errors)); + OC_Template::printGuestPage("", "error", array("errors" => $errors)); } // Setup required : @@ -41,47 +41,47 @@ elseif($not_installed OR $install_called) { } // Someone is logged in : -elseif(OC_USER::isLoggedIn()) { +elseif(OC_User::isLoggedIn()) { if(isset($_GET["logout"]) and ($_GET["logout"])) { - OC_USER::logout(); + OC_User::logout(); header("Location: ".$WEBROOT.'/'); exit(); } else { - header("Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue("core", "defaultpage", "files/index.php")); + header("Location: ".$WEBROOT.'/'.OC_Appconfig::getValue("core", "defaultpage", "files/index.php")); exit(); } } // Someone wants to log in : elseif(isset($_POST["user"])) { - OC_APP::loadApps(); - if(OC_USER::login($_POST["user"], $_POST["password"])) { - header("Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue("core", "defaultpage", "files/index.php")); + OC_App::loadApps(); + if(OC_User::login($_POST["user"], $_POST["password"])) { + header("Location: ".$WEBROOT.'/'.OC_Appconfig::getValue("core", "defaultpage", "files/index.php")); if(!empty($_POST["remember_login"])){ - OC_USER::setUsernameInCookie($_POST["user"]); + OC_User::setUsernameInCookie($_POST["user"]); } else { - OC_USER::unsetUsernameInCookie(); + OC_User::unsetUsernameInCookie(); } exit(); } else { if(isset($_COOKIE["username"])){ - OC_TEMPLATE::printGuestPage("", "login", array("error" => true, "username" => $_COOKIE["username"])); + OC_Template::printGuestPage("", "login", array("error" => true, "username" => $_COOKIE["username"])); }else{ - OC_TEMPLATE::printGuestPage("", "login", array("error" => true)); + OC_Template::printGuestPage("", "login", array("error" => true)); } } } // For all others cases, we display the guest page : else { - OC_APP::loadApps(); + OC_App::loadApps(); if(isset($_COOKIE["username"])){ - OC_TEMPLATE::printGuestPage("", "login", array("error" => false, "username" => $_COOKIE["username"])); + OC_Template::printGuestPage("", "login", array("error" => false, "username" => $_COOKIE["username"])); }else{ - OC_TEMPLATE::printGuestPage("", "login", array("error" => false)); + OC_Template::printGuestPage("", "login", array("error" => false)); } } diff --git a/lib/MDB2/Driver/Manager/sqlite3.php b/lib/MDB2/Driver/Manager/sqlite3.php index 7096126a523..4e420b5d0b2 100644 --- a/lib/MDB2/Driver/Manager/sqlite3.php +++ b/lib/MDB2/Driver/Manager/sqlite3.php @@ -70,7 +70,7 @@ class MDB2_Driver_Manager_sqlite3 extends MDB2_Driver_Manager_Common function createDatabase($name, $options = array()) { global $SERVERROOT; - $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); + $datadir=OC_Config::getValue( "datadirectory", "$SERVERROOT/data" ); $db =$this->getDBInstance(); if (PEAR::isError($db)) { return $db; diff --git a/lib/MDB2/Driver/sqlite3.php b/lib/MDB2/Driver/sqlite3.php index 3b74afed146..ccf6bb53688 100644 --- a/lib/MDB2/Driver/sqlite3.php +++ b/lib/MDB2/Driver/sqlite3.php @@ -352,7 +352,7 @@ class MDB2_Driver_sqlite3 extends MDB2_Driver_Common return MDB2_OK; } global $SERVERROOT; - $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); + $datadir=OC_Config::getValue( "datadirectory", "$SERVERROOT/data" ); $database_file = $this->_getDatabaseFile($this->database_name); if (is_resource($this->connection)) { //if (count(array_diff($this->connected_dsn, $this->dsn)) == 0 diff --git a/lib/app.php b/lib/app.php index fad0714c3f4..9e81ed8184e 100644 --- a/lib/app.php +++ b/lib/app.php @@ -26,7 +26,7 @@ * owncloud ecosystem. Furthermore, this class is responsible for installing, * upgrading and removing apps. */ -class OC_APP{ +class OC_App{ static private $init = false; static private $apps = array(); static private $activeapp = ''; @@ -57,7 +57,7 @@ class OC_APP{ } // The rest comes here - $apps = OC_APPCONFIG::getApps(); + $apps = OC_Appconfig::getApps(); foreach( $apps as $app ){ if( self::isEnabled( $app )){ if(is_file($SERVERROOT.'/apps/'.$app.'/appinfo/app.php')){ @@ -80,7 +80,7 @@ class OC_APP{ * This function checks whether or not an app is enabled. */ public static function isEnabled( $app ){ - if( 'yes' == OC_APPCONFIG::getValue( $app, 'enabled' )){ + if( 'yes' == OC_Appconfig::getValue( $app, 'enabled' )){ return true; } @@ -95,7 +95,7 @@ class OC_APP{ * This function set an app as enabled in appconfig. */ public static function enable( $app ){ - OC_APPCONFIG::setValue( $app, 'enabled', 'yes' ); + OC_Appconfig::setValue( $app, 'enabled', 'yes' ); } /** @@ -106,7 +106,7 @@ class OC_APP{ * This function set an app as enabled in appconfig. */ public static function disable( $app ){ - OC_APPCONFIG::setValue( $app, 'enabled', 'no' ); + OC_Appconfig::setValue( $app, 'enabled', 'no' ); } /** @@ -126,7 +126,7 @@ class OC_APP{ * */ public static function register( $data ){ - OC_APP::$apps[] = $data; + OC_App::$apps[] = $data; } /** @@ -137,7 +137,7 @@ class OC_APP{ */ public static function get(){ // TODO: write function - return OC_APP::$apps; + return OC_App::$apps; } /** @@ -162,7 +162,7 @@ class OC_APP{ if(!isset($data['icon'])){ $data['icon']=''; } - OC_APP::$navigation[] = $data; + OC_App::$navigation[] = $data; return true; } @@ -241,7 +241,7 @@ class OC_APP{ */ public static function addAdminPage( $data = array()){ // TODO: write function - OC_APP::$adminpages[] = $data; + OC_App::$adminpages[] = $data; return true; } @@ -266,7 +266,7 @@ class OC_APP{ */ public static function addSettingsPage( $data = array()){ // TODO: write function - OC_APP::$settingspages[] = $data; + OC_App::$settingspages[] = $data; return true; } diff --git a/lib/appconfig.php b/lib/appconfig.php index b4735a309bc..06281d38585 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -37,7 +37,7 @@ * This class provides an easy way for apps to store config values in the * database. */ -class OC_APPCONFIG{ +class OC_Appconfig{ /** * @brief Get all apps using the config * @returns array with app ids diff --git a/lib/base.php b/lib/base.php index 236b5d926a4..5b88bd899e9 100644 --- a/lib/base.php +++ b/lib/base.php @@ -70,10 +70,10 @@ if( !isset( $RUNTIME_NOAPPS )){ // WARNING: to make everything even more confusing, DATADIRECTORY is a var that // changes and DATATIRECTORY_ROOT stays the same, but is set by // "datadirectory". Any questions? -$CONFIG_DATADIRECTORY = OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); +$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", "$SERVERROOT/data" ); // redirect to https site if configured -if( OC_CONFIG::getValue( "forcessl", false )){ +if( OC_Config::getValue( "forcessl", false )){ if(!isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] != 'on') { $url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; header("Location: $url"); @@ -81,40 +81,40 @@ if( OC_CONFIG::getValue( "forcessl", false )){ } } -$error=(count(OC_UTIL::checkServer())>0); +$error=(count(OC_Util::checkServer())>0); // User and Groups -if( !OC_CONFIG::getValue( "installed", false )){ +if( !OC_Config::getValue( "installed", false )){ $_SESSION['user_id'] = ''; } -OC_USER::useBackend( OC_CONFIG::getValue( "userbackend", "database" )); -OC_GROUP::setBackend( OC_CONFIG::getValue( "groupbackend", "database" )); +OC_User::useBackend( OC_Config::getValue( "userbackend", "database" )); +OC_Group::setBackend( OC_Config::getValue( "groupbackend", "database" )); // Was in required file ... put it here -OC_FILESYSTEM::registerStorageType('local','OC_FILESTORAGE_LOCAL',array('datadir'=>'string')); +OC_Filesystem::registerStorageType('local','OC_Filestorage_Local',array('datadir'=>'string')); // Set up file system unless forbidden if(!$error and !$RUNTIME_NOSETUPFS ){ - OC_UTIL::setupFS(); + OC_Util::setupFS(); } // Add the stuff we need always -OC_UTIL::addScript( "jquery-1.6.2.min" ); -OC_UTIL::addScript( "jquery-ui-1.8.14.custom.min" ); -OC_UTIL::addScript( "js" ); -OC_UTIL::addStyle( "jquery-ui-1.8.14.custom" ); -OC_UTIL::addStyle( "styles" ); +OC_Util::addScript( "jquery-1.6.2.min" ); +OC_Util::addScript( "jquery-ui-1.8.14.custom.min" ); +OC_Util::addScript( "js" ); +OC_Util::addStyle( "jquery-ui-1.8.14.custom" ); +OC_Util::addStyle( "styles" ); // Load Apps if(!$error and !$RUNTIME_NOAPPS ){ - OC_APP::loadApps(); + OC_App::loadApps(); } // FROM Connect.php function OC_CONNECT_TEST($path,$user,$password){ echo 'connecting...'; - $remote=OC_CONNECT::connect($path,$user,$password); + $remote=OC_Connect::connect($path,$user,$password); if($remote->connected){ echo 'done
'; if($remote->isLoggedIn()){ @@ -138,7 +138,7 @@ function OC_CONNECT_TEST($path,$user,$password){ unlink($file); return; } - OC_FILESYSTEM::fromTmpFile($file,'/remoteFile'); + OC_Filesystem::fromTmpFile($file,'/remoteFile'); echo 'done
'; echo 'sending file "burning_avatar.png"...'; $res=$remote->sendFile('','burning_avatar.png','','burning_avatar.png'); @@ -168,15 +168,15 @@ function zipAddDir($dir,$zip,$internalDir=''){ $dirname=basename($dir); $zip->addEmptyDir($internalDir.$dirname); $internalDir.=$dirname.='/'; - $files=OC_FILES::getdirectorycontent($dir); + $files=OC_Files::getdirectorycontent($dir); foreach($files as $file){ $filename=$file['name']; $file=$dir.'/'.$filename; - if(OC_FILESYSTEM::is_file($file)){ - $tmpFile=OC_FILESYSTEM::toTmpFile($file); - OC_FILES::$tmpFiles[]=$tmpFile; + if(OC_Filesystem::is_file($file)){ + $tmpFile=OC_Filesystem::toTmpFile($file); + OC_Files::$tmpFiles[]=$tmpFile; $zip->addFile($tmpFile,$internalDir.$filename); - }elseif(OC_FILESYSTEM::is_dir($file)){ + }elseif(OC_Filesystem::is_dir($file)){ zipAddDir($file,$zip,$internalDir); } } diff --git a/lib/config.php b/lib/config.php index ea3647858ed..16e9ea441d5 100644 --- a/lib/config.php +++ b/lib/config.php @@ -38,7 +38,7 @@ * This class is responsible for reading and writing config.php, the very basic * configuration file of owncloud. */ -class OC_CONFIG{ +class OC_Config{ // associative array key => value private static $cache = array(); diff --git a/lib/connect.php b/lib/connect.php index c02b999ffc2..22e48750a62 100644 --- a/lib/connect.php +++ b/lib/connect.php @@ -25,7 +25,7 @@ * Class for connecting multiply ownCloud installations * */ -class OC_CONNECT{ +class OC_Connect{ static private $clouds=array(); static function connect($path,$user,$password){ diff --git a/lib/connector/sabre/auth.php b/lib/connector/sabre/auth.php index 4e974ad821d..1e87c7cee08 100644 --- a/lib/connector/sabre/auth.php +++ b/lib/connector/sabre/auth.php @@ -23,8 +23,8 @@ class OC_Connector_Sabre_Auth extends Sabre_DAV_Auth_Backend_AbstractBasic { * @return bool */ protected function validateUserPass($username, $password){ - if(OC_USER::login($username,$password)){ - OC_UTIL::setUpFS(); + if(OC_User::login($username,$password)){ + OC_Util::setUpFS(); return true; } else{ diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php index a73888ca732..139c6b784b1 100644 --- a/lib/connector/sabre/directory.php +++ b/lib/connector/sabre/directory.php @@ -22,7 +22,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa public function createFile($name, $data = null) { $newPath = $this->path . '/' . $name; - OC_FILESYSTEM::file_put_contents($newPath,$data); + OC_Filesystem::file_put_contents($newPath,$data); } @@ -35,7 +35,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa public function createDirectory($name) { $newPath = $this->path . '/' . $name; - OC_FILESYSTEM::mkdir($newPath); + OC_Filesystem::mkdir($newPath); } @@ -50,9 +50,9 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa $path = $this->path . '/' . $name; - if (!OC_FILESYSTEM::file_exists($path)) throw new Sabre_DAV_Exception_FileNotFound('File with name ' . $path . ' could not be located'); + if (!OC_Filesystem::file_exists($path)) throw new Sabre_DAV_Exception_FileNotFound('File with name ' . $path . ' could not be located'); - if (OC_FILESYSTEM::is_dir($path)) { + if (OC_Filesystem::is_dir($path)) { return new OC_Connector_Sabre_Directory($path); @@ -73,8 +73,8 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa $nodes = array(); // foreach(scandir($this->path) as $node) if($node!='.' && $node!='..') $nodes[] = $this->getChild($node); - if( OC_FILESYSTEM::is_dir($this->path)){ - $dh = OC_FILESYSTEM::opendir($this->path); + if( OC_Filesystem::is_dir($this->path)){ + $dh = OC_Filesystem::opendir($this->path); while(( $node = readdir($dh)) !== false ){ if($node!='.' && $node!='..'){ $nodes[] = $this->getChild($node); @@ -94,7 +94,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa public function childExists($name) { $path = $this->path . '/' . $name; - return OC_FILESYSTEM::file_exists($path); + return OC_Filesystem::file_exists($path); } @@ -106,7 +106,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa public function delete() { foreach($this->getChildren() as $child) $child->delete(); - OC_FILESYSTEM::rmdir($this->path); + OC_Filesystem::rmdir($this->path); } @@ -118,8 +118,8 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa public function getQuotaInfo() { return array( - OC_FILESYSTEM::filesize('/'), - OC_FILESYSTEM::free_space() + OC_Filesystem::filesize('/'), + OC_Filesystem::free_space() ); } diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php index fb4e559aa50..b049f39c171 100644 --- a/lib/connector/sabre/file.php +++ b/lib/connector/sabre/file.php @@ -18,7 +18,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function put($data) { - OC_FILESYSTEM::file_put_contents($this->path,$data); + OC_Filesystem::file_put_contents($this->path,$data); } @@ -29,7 +29,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function get() { - return OC_FILESYSTEM::file_get_contents($this->path); + return OC_Filesystem::file_get_contents($this->path); } @@ -40,7 +40,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function delete() { - OC_FILESYSTEM::unlink($this->path); + OC_Filesystem::unlink($this->path); } @@ -51,7 +51,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function getSize() { - return OC_FILESYSTEM::filesize($this->path); + return OC_Filesystem::filesize($this->path); } @@ -80,7 +80,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function getContentType() { - return OC_FILESYSTEM::getMimeType($this->path); + return OC_Filesystem::getMimeType($this->path); } } diff --git a/lib/connector/sabre/locks.php b/lib/connector/sabre/locks.php index 9f0b983a5cc..7164d9a09c1 100644 --- a/lib/connector/sabre/locks.php +++ b/lib/connector/sabre/locks.php @@ -50,7 +50,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract { // pure sql. MySQL's non-standard string concatination prevents us // from doing this though. $query = 'SELECT * FROM *PREFIX*locks WHERE userid = ? AND (created + timeout) > ? AND ((uri = ?)'; - $params = array(OC_USER::getUser(),time(),$uri); + $params = array(OC_User::getUser(),time(),$uri); // We need to check locks for every part in the uri. $uriParts = explode('/',$uri); @@ -122,10 +122,10 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract { if ($exists) { $query = OC_DB::prepare( 'UPDATE *PREFIX*locks SET owner = ?, timeout = ?, scope = ?, depth = ?, uri = ?, created = ? WHERE userid = ? AND token = ?' ); - $result = $query->execute( array($lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,OC_USER::getUser(),$lockInfo->token)); + $result = $query->execute( array($lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,OC_User::getUser(),$lockInfo->token)); } else { $query = OC_DB::prepare( 'INSERT INTO *PREFIX*locks (userid,owner,timeout,scope,depth,uri,created,token) VALUES (?,?,?,?,?,?,?,?)' ); - $result = $query->execute( array(OC_USER::getUser(),$lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,$lockInfo->token)); + $result = $query->execute( array(OC_User::getUser(),$lockInfo->owner,$lockInfo->timeout,$lockInfo->scope,$lockInfo->depth,$uri,$lockInfo->created,$lockInfo->token)); } return true; @@ -142,7 +142,7 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract { public function unlock($uri,Sabre_DAV_Locks_LockInfo $lockInfo) { $query = OC_DB::prepare( 'DELETE FROM *PREFIX*locks WHERE userid = ? AND uri=? AND token=?' ); - $result = $query->execute( array(OC_USER::getUser(),$uri,$lockInfo->token)); + $result = $query->execute( array(OC_User::getUser(),$uri,$lockInfo->token)); return $result->numRows() === 1; diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index 0edd9b78161..ace572a1ee3 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -70,12 +70,12 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr $newPath = $parentPath . '/' . $newName; $oldPath = $this->path; - OC_FILESYSTEM::rename($this->path,$newPath); + OC_Filesystem::rename($this->path,$newPath); $this->path = $newPath; $query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertypath = ? WHERE userid = ? AND propertypath = ?' ); - $query->execute( array( $newPath,OC_USER::getUser(), $oldPath )); + $query->execute( array( $newPath,OC_User::getUser(), $oldPath )); } @@ -88,7 +88,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr */ public function getLastModified() { - return OC_FILESYSTEM::filemtime($this->path); + return OC_Filesystem::filemtime($this->path); } @@ -106,17 +106,17 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr if (is_null($propertyValue)) { if(array_key_exists( $propertyName, $existing )){ $query = OC_DB::prepare( 'DELETE FROM *PREFIX*properties WHERE userid = ? AND propertypath = ? AND propertyname = ?' ); - $query->execute( array( OC_USER::getUser(), $this->path, $propertyName )); + $query->execute( array( OC_User::getUser(), $this->path, $propertyName )); } } else { if(!array_key_exists( $propertyName, $existing )){ $query = OC_DB::prepare( 'INSERT INTO *PREFIX*properties (userid,propertypath,propertyname,propertyvalue) VALUES(?,?,?,?)' ); - $query->execute( array( OC_USER::getUser(), $this->path, $propertyName,$propertyValue )); + $query->execute( array( OC_User::getUser(), $this->path, $propertyName,$propertyValue )); } else{ $query = OC_DB::prepare( 'UPDATE *PREFIX*properties SET propertyvalue = ? WHERE userid = ? AND propertypath = ? AND propertyname = ?' ); - $query->execute( array( $propertyValue,OC_USER::getUser(), $this->path, $propertyName )); + $query->execute( array( $propertyValue,OC_User::getUser(), $this->path, $propertyName )); } } @@ -136,7 +136,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr function getProperties($properties) { // At least some magic in here :-) $query = OC_DB::prepare( 'SELECT * FROM *PREFIX*properties WHERE userid = ? AND propertypath = ?' ); - $result = $query->execute( array( OC_USER::getUser(), $this->path )); + $result = $query->execute( array( OC_User::getUser(), $this->path )); $existing = array(); while( $row = $result->fetchRow()){ diff --git a/lib/db.php b/lib/db.php index f5f877176e9..858db09b764 100644 --- a/lib/db.php +++ b/lib/db.php @@ -38,13 +38,13 @@ class OC_DB { */ static public function connect(){ // The global data we need - $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" );; - $CONFIG_DBHOST = OC_CONFIG::getValue( "dbhost", "" );; - $CONFIG_DBUSER = OC_CONFIG::getValue( "dbuser", "" );; - $CONFIG_DBPASSWORD = OC_CONFIG::getValue( "dbpassword", "" );; - $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" );; + $CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" );; + $CONFIG_DBHOST = OC_Config::getValue( "dbhost", "" );; + $CONFIG_DBUSER = OC_Config::getValue( "dbuser", "" );; + $CONFIG_DBPASSWORD = OC_Config::getValue( "dbpassword", "" );; + $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );; global $SERVERROOT; - $datadir=OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); + $datadir=OC_Config::getValue( "datadirectory", "$SERVERROOT/data" ); // do nothing if the connection already has been established if(!self::$DBConnection){ @@ -235,8 +235,8 @@ class OC_DB { * TODO: write more documentation */ public static function createDbFromStructure( $file ){ - $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); - $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); + $CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" ); + $CONFIG_DBTABLEPREFIX = OC_Config::getValue( "dbtableprefix", "oc_" ); self::connectScheme(); @@ -259,7 +259,7 @@ class OC_DB { if( $definition instanceof MDB2_Schema_Error ){ die( $definition->getMessage().': '.$definition->getUserInfo()); } -// if(OC_CONFIG::getValue('dbtype','sqlite')=='sqlite'){ +// if(OC_Config::getValue('dbtype','sqlite')=='sqlite'){ // $definition['overwrite']=true;//always overwrite for sqlite // } $ret=self::$schema->createDatabase( $definition ); @@ -302,8 +302,8 @@ class OC_DB { private static function processQuery( $query ){ self::connect(); // We need Database type and table prefix - $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" ); - $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); + $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); + $CONFIG_DBTABLEPREFIX = OC_Config::getValue( "dbtableprefix", "oc_" ); // differences is getting the current timestamp $query = str_replace( 'NOW()', self::$DBConnection->now(), $query ); @@ -339,8 +339,8 @@ class OC_DB { * @param string $file the xml file describing the tables */ public static function removeDBStructure($file){ - $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); - $CONFIG_DBTABLEPREFIX = OC_CONFIG::getValue( "dbtableprefix", "oc_" ); + $CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" ); + $CONFIG_DBTABLEPREFIX = OC_Config::getValue( "dbtableprefix", "oc_" ); self::connectScheme(); // read file diff --git a/lib/files.php b/lib/files.php index 03e159f9bee..d189a96fd89 100644 --- a/lib/files.php +++ b/lib/files.php @@ -25,7 +25,7 @@ * Class for fileserver access * */ -class OC_FILES { +class OC_Files { static $tmpFiles=array(); /** @@ -42,21 +42,21 @@ class OC_FILES { $dirs=array(); $file=array(); $files=array(); - if(OC_FILESYSTEM::is_dir($directory)) { - if ($dh = OC_FILESYSTEM::opendir($directory)) { + if(OC_Filesystem::is_dir($directory)) { + if ($dh = OC_Filesystem::opendir($directory)) { while (($filename = readdir($dh)) !== false) { if($filename<>'.' and $filename<>'..' and substr($filename,0,1)!='.'){ $file=array(); $filesfound=true; $file['name']=$filename; $file['directory']=$directory; - $stat=OC_FILESYSTEM::stat($directory.'/'.$filename); + $stat=OC_Filesystem::stat($directory.'/'.$filename); $file=array_merge($file,$stat); - $file['size']=OC_FILESYSTEM::filesize($directory.'/'.$filename); - $file['mime']=OC_FILES::getMimeType($directory .'/'. $filename); - $file['readable']=OC_FILESYSTEM::is_readable($directory .'/'. $filename); - $file['writeable']=OC_FILESYSTEM::is_writeable($directory .'/'. $filename); - $file['type']=OC_FILESYSTEM::filetype($directory .'/'. $filename); + $file['size']=OC_Filesystem::filesize($directory.'/'.$filename); + $file['mime']=OC_Files::getMimeType($directory .'/'. $filename); + $file['readable']=OC_Filesystem::is_readable($directory .'/'. $filename); + $file['writeable']=OC_Filesystem::is_writeable($directory .'/'. $filename); + $file['type']=OC_Filesystem::filetype($directory .'/'. $filename); if($file['type']=='dir'){ $dirs[$file['name']]=$file; }else{ @@ -98,16 +98,16 @@ class OC_FILES { } foreach($files as $file){ $file=$dir.'/'.$file; - if(OC_FILESYSTEM::is_file($file)){ - $tmpFile=OC_FILESYSTEM::toTmpFile($file); + if(OC_Filesystem::is_file($file)){ + $tmpFile=OC_Filesystem::toTmpFile($file); self::$tmpFiles[]=$tmpFile; $zip->addFile($tmpFile,basename($file)); - }elseif(OC_FILESYSTEM::is_dir($file)){ + }elseif(OC_Filesystem::is_dir($file)){ zipAddDir($file,$zip); } } $zip->close(); - }elseif(OC_FILESYSTEM::is_dir($dir.'/'.$files)){ + }elseif(OC_Filesystem::is_dir($dir.'/'.$files)){ $zip = new ZipArchive(); $filename = sys_get_temp_dir()."/ownCloud.zip"; if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) { @@ -120,7 +120,7 @@ class OC_FILES { $zip=false; $filename=$dir.'/'.$files; } - if($zip or OC_FILESYSTEM::is_readable($filename)){ + if($zip or OC_Filesystem::is_readable($filename)){ header('Content-Disposition: attachment; filename='.basename($filename)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); @@ -130,12 +130,12 @@ class OC_FILES { header('Content-Type: application/zip'); header('Content-Length: ' . filesize($filename)); }else{ - header('Content-Type: ' . OC_FILESYSTEM::getMimeType($filename)); - header('Content-Length: ' . OC_FILESYSTEM::filesize($filename)); + header('Content-Type: ' . OC_Filesystem::getMimeType($filename)); + header('Content-Length: ' . OC_Filesystem::filesize($filename)); } - }elseif($zip or !OC_FILESYSTEM::file_exists($filename)){ + }elseif($zip or !OC_Filesystem::file_exists($filename)){ header("HTTP/1.0 404 Not Found"); - $tmpl = new OC_TEMPLATE( '', '404', 'guest' ); + $tmpl = new OC_Template( '', '404', 'guest' ); $tmpl->assign('file',$filename); $tmpl->printPage(); // die('404 Not Found'); @@ -144,12 +144,12 @@ class OC_FILES { die('403 Forbidden'); } ob_end_clean(); -// OC_LOG::event($_SESSION['username'],3,"$dir/$files"); +// OC_Log::event($_SESSION['username'],3,"$dir/$files"); if($zip){ readfile($filename); unlink($filename); }else{ - OC_FILESYSTEM::readfile($filename); + OC_Filesystem::readfile($filename); } foreach(self::$tmpFiles as $tmpFile){ if(file_exists($tmpFile) and is_file($tmpFile)){ @@ -167,10 +167,10 @@ class OC_FILES { * @param file $target */ public static function move($sourceDir,$source,$targetDir,$target){ - if(OC_USER::isLoggedIn()){ + if(OC_User::isLoggedIn()){ $targetFile=$targetDir.'/'.$target; $sourceFile=$sourceDir.'/'.$source; - return OC_FILESYSTEM::rename($sourceFile,$targetFile); + return OC_Filesystem::rename($sourceFile,$targetFile); } } @@ -183,10 +183,10 @@ class OC_FILES { * @param file $target */ public static function copy($sourceDir,$source,$targetDir,$target){ - if(OC_USER::isLoggedIn()){ + if(OC_User::isLoggedIn()){ $targetFile=$targetDir.'/'.$target; $sourceFile=$sourceDir.'/'.$source; - return OC_FILESYSTEM::copy($sourceFile,$targetFile); + return OC_Filesystem::copy($sourceFile,$targetFile); } } @@ -198,15 +198,15 @@ class OC_FILES { * @param type $type */ public static function newFile($dir,$name,$type){ - if(OC_USER::isLoggedIn()){ + if(OC_User::isLoggedIn()){ $file=$dir.'/'.$name; if($type=='dir'){ - return OC_FILESYSTEM::mkdir($file); + return OC_Filesystem::mkdir($file); }elseif($type=='file'){ - $fileHandle=OC_FILESYSTEM::fopen($file, 'w'); + $fileHandle=OC_Filesystem::fopen($file, 'w'); if($fileHandle){ fclose($fileHandle); -// OC_LOG::event($_SESSION['username'],4,"$dir/$name"); +// OC_Log::event($_SESSION['username'],4,"$dir/$name"); return true; }else{ return false; @@ -222,12 +222,12 @@ class OC_FILES { * @param file $name */ public static function delete($dir,$file){ - if(OC_USER::isLoggedIn()){ + if(OC_User::isLoggedIn()){ $file=$dir.'/'.$file; - if(OC_FILESYSTEM::is_file($file)){ - return OC_FILESYSTEM::unlink($file); - }elseif(OC_FILESYSTEM::is_dir($file)){ - return OC_FILESYSTEM::delTree($file); + if(OC_Filesystem::is_file($file)){ + return OC_Filesystem::unlink($file); + }elseif(OC_Filesystem::is_dir($file)){ + return OC_Filesystem::delTree($file); } } } @@ -239,7 +239,7 @@ class OC_FILES { * @return string guessed mime type */ static function getMimeType($path){ - return OC_FILESYSTEM::getMimeType($path); + return OC_Filesystem::getMimeType($path); } /** @@ -249,7 +249,7 @@ class OC_FILES { * @return array */ static function getTree($path){ - return OC_FILESYSTEM::getTree($path); + return OC_Filesystem::getTree($path); } /** @@ -273,7 +273,7 @@ class OC_FILES { $httpCode=$info['http_code']; curl_close($ch); if($httpCode==200 or $httpCode==0){ - OC_FILESYSTEM::fromTmpFile($tmpfile,$dir.'/'.$file); + OC_Filesystem::fromTmpFile($tmpfile,$dir.'/'.$file); return true; }else{ return false; @@ -287,7 +287,7 @@ class OC_FILES { static function setUploadLimit($size){ global $SERVERROOT; global $WEBROOT; - $size=OC_HELPER::humanFileSize($size); + $size=OC_Helper::humanFileSize($size); $size=substr($size,0,-1);//strip the B $size=str_replace(' ','',$size); //remove the space between the size and the postfix $content = "ErrorDocument 404 /$WEBROOT/core/templates/404.php\n";//custom 404 error page diff --git a/lib/filestorage.php b/lib/filestorage.php index ba1a4b295aa..b398285d340 100644 --- a/lib/filestorage.php +++ b/lib/filestorage.php @@ -23,7 +23,7 @@ /** * Privde a common interface to all different storage options */ -class OC_FILESTORAGE{ +class OC_Filestorage{ public function __construct($parameters){} public function mkdir($path){} public function rmdir($path){} diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index fd3f043de3b..3bbdd6b4137 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -2,7 +2,7 @@ /** * for local filestore, we only have to map the paths */ -class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ +class OC_Filestorage_Local extends OC_Filestorage{ private $datadir; private static $mimetypes=null; public function __construct($arguments){ @@ -138,7 +138,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{ } else if (function_exists("mime_content_type")) { // use mime magic extension if available $mime_type = mime_content_type($this->datadir.$fspath); - } else if (OC_HELPER::canExecute("file")) { + } else if (OC_Helper::canExecute("file")) { // it looks like we have a 'file' command, // lets see it it does have mime support $fp = popen("file -i -b '{$this->datadir}$fspath' 2>/dev/null", "r"); diff --git a/lib/filestorage/remote.php b/lib/filestorage/remote.php index 74234f4d8db..fb14c4121a2 100644 --- a/lib/filestorage/remote.php +++ b/lib/filestorage/remote.php @@ -21,7 +21,7 @@ * */ -class OC_FILESTORAGE_REMOTE extends OC_FILESTORAGE{ +class OC_Filestorage_Remote extends OC_Filestorage{ private $url; private $username; private $password; @@ -45,7 +45,7 @@ class OC_FILESTORAGE_REMOTE extends OC_FILESTORAGE{ } private function connect(){ if($this->remote===false){ - $this->remote=OC_CONNECT::connect($this->url,$this->username,$this->password); + $this->remote=OC_Connect::connect($this->url,$this->username,$this->password); } } public function mkdir($path){ diff --git a/lib/filesystem.php b/lib/filesystem.php index d44416cf9cb..6022aa585ba 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -24,7 +24,7 @@ /** * Class for abstraction of filesystem functions - * This class won't call any filesystem functions for itself but but will pass them to the correct OC_FILESTORAGE object + * This class won't call any filesystem functions for itself but but will pass them to the correct OC_Filestorage object * this class should also handle all the file premission related stuff * * Hooks provided: @@ -42,7 +42,7 @@ * * the &run parameter can be set to false to prevent the operation from occuring */ -class OC_FILESYSTEM{ +class OC_Filesystem{ static private $storages=array(); static private $fakeRoot=''; static private $storageTypes=array(); @@ -89,7 +89,7 @@ class OC_FILESYSTEM{ * create a new storage of a specific type * @param string type * @param array arguments - * @return OC_FILESTORAGE + * @return OC_Filestorage */ static public function createStorage($type,$arguments){ if(!self::hasStorageType($type)){ @@ -159,8 +159,8 @@ class OC_FILESYSTEM{ } /** - * mount an OC_FILESTORAGE in our virtual filesystem - * @param OC_FILESTORAGE storage + * mount an OC_Filestorage in our virtual filesystem + * @param OC_Filestorage storage * @param string mountpoint */ static public function mount($storage,$mountpoint){ @@ -173,7 +173,7 @@ class OC_FILESYSTEM{ /** * get the storage object for a path * @param string path - * @return OC_FILESTORAGE + * @return OC_Filestorage */ static private function getStorage($path){ $mountpoint=self::getMountPoint($path); @@ -231,14 +231,14 @@ class OC_FILESYSTEM{ $parent=substr($path,0,strrpos($path,'/')); if(self::canWrite($parent) and $storage=self::getStorage($path)){ $run=true; - OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'create', array( 'path' => $path, 'run' => &$run)); if($run){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'write', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run)); } if($run){ $result=$storage->mkdir(self::getInternalPath($path)); - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_create', array( 'path' => $path)); - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_write', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_create', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_write', array( 'path' => $path)); return $result; } } @@ -246,17 +246,17 @@ class OC_FILESYSTEM{ static public function rmdir($path){ if(self::canWrite($path) and $storage=self::getStorage($path)){ $run=true; - OC_HOOK::emit( 'OC_FILESYSTEM', 'delete', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'delete', array( 'path' => $path, 'run' => &$run)); if($run){ $result=$storage->rmdir(self::getInternalPath($path)); - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_delete', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_delete', array( 'path' => $path)); return $result; } } } static public function opendir($path){ if(self::canRead($path) and $storage=self::getStorage($path)){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path)); return $storage->opendir(self::getInternalPath($path)); } } @@ -293,7 +293,7 @@ class OC_FILESYSTEM{ } static public function readfile($path){ if(self::canRead($path) and $storage=self::getStorage($path)){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path)); return $storage->readfile(self::getInternalPath($path)); } } @@ -335,7 +335,7 @@ class OC_FILESYSTEM{ } static public function file_get_contents($path){ if(self::canRead($path) and $storage=self::getStorage($path)){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path)); return $storage->file_get_contents(self::getInternalPath($path)); } } @@ -344,17 +344,17 @@ class OC_FILESYSTEM{ $run=true; $exists=self::file_exists($path); if(!$exists){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'create', array( 'path' => $path, 'run' => &$run)); } if($run){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'write', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run)); } if($run){ $result=$storage->file_put_contents(self::getInternalPath($path),$data); if(!$exists){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_create', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_create', array( 'path' => $path)); } - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_write', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_write', array( 'path' => $path)); return $result; } } @@ -362,10 +362,10 @@ class OC_FILESYSTEM{ static public function unlink($path){ if(self::canWrite($path) and $storage=self::getStorage($path)){ $run=true; - OC_HOOK::emit( 'OC_FILESYSTEM', 'delete', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'delete', array( 'path' => $path, 'run' => &$run)); if($run){ $result=$storage->unlink(self::getInternalPath($path)); - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_delete', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_delete', array( 'path' => $path)); return $result; } } @@ -373,7 +373,7 @@ class OC_FILESYSTEM{ static public function rename($path1,$path2){ if(self::canWrite($path1) and self::canWrite($path2)){ $run=true; - OC_HOOK::emit( 'OC_FILESYSTEM', 'rename', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'rename', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run)); if($run){ $mp1=self::getMountPoint($path1); $mp2=self::getMountPoint($path2); @@ -386,7 +386,7 @@ class OC_FILESYSTEM{ $result=$storage2->fromTmpFile($tmpFile,self::getInternalPath($path2)); $storage1->unlink(self::getInternalPath($path1)); } - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_rename', array( 'oldpath' => $path1, 'newpath'=>$path2)); + OC_Hook::emit( 'OC_Filesystem', 'post_rename', array( 'oldpath' => $path1, 'newpath'=>$path2)); return $result; } } @@ -394,13 +394,13 @@ class OC_FILESYSTEM{ static public function copy($path1,$path2){ if(self::canRead($path1) and self::canWrite($path2)){ $run=true; - OC_HOOK::emit( 'OC_FILESYSTEM', 'copy', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'copy', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run)); $exists=self::file_exists($path2); if($run and !$exists){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path2, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'create', array( 'path' => $path2, 'run' => &$run)); } if($run){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'write', array( 'path' => $path2, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path2, 'run' => &$run)); } if($run){ $mp1=self::getMountPoint($path1); @@ -413,11 +413,11 @@ class OC_FILESYSTEM{ $tmpFile=$storage1->toTmpFile(self::getInternalPath($path1)); $result=$storage2->fromTmpFile($tmpFile,self::getInternalPath($path2)); } - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_copy', array( 'oldpath' => $path1 ,'newpath'=>$path2)); + OC_Hook::emit( 'OC_Filesystem', 'post_copy', array( 'oldpath' => $path1 ,'newpath'=>$path2)); if(!$exists){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_create', array( 'path' => $path2)); + OC_Hook::emit( 'OC_Filesystem', 'post_create', array( 'path' => $path2)); } - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_write', array( 'path' => $path2)); + OC_Hook::emit( 'OC_Filesystem', 'post_write', array( 'path' => $path2)); return $result; } } @@ -431,13 +431,13 @@ class OC_FILESYSTEM{ $write=false; switch($mode){ case 'r': - OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path)); break; case 'r+': case 'w+': case 'x+': case 'a+': - OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path)); $write=true; break; case 'w': @@ -448,20 +448,20 @@ class OC_FILESYSTEM{ } if($write){ if(!$exists){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'create', array( 'path' => $path)); } if($run){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'write', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run)); } } if($run){ $result=$storage->fopen(self::getInternalPath($path),$mode); if($write){ if(!$exists){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_create', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_create', array( 'path' => $path)); } if($run){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_write', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_write', array( 'path' => $path)); } } return $result; @@ -471,7 +471,7 @@ class OC_FILESYSTEM{ } static public function toTmpFile($path){ if(self::canRead($path) and $storage=self::getStorage($path)){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path)); return $storage->toTmpFile(self::getInternalPath($path)); } } @@ -480,17 +480,17 @@ class OC_FILESYSTEM{ $run=true; $exists=self::file_exists($path); if(!$exists){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'create', array( 'path' => $path, 'run' => &$run)); } if($run){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'write', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run)); } if($run){ $result=$storage->fromTmpFile($tmpFile,self::getInternalPath($path)); if(!$exists){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_create', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_create', array( 'path' => $path)); } - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_write', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_write', array( 'path' => $path)); return $result; } } @@ -501,18 +501,18 @@ class OC_FILESYSTEM{ $run=true; $exists=self::file_exists($path); if(!$exists){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'create', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'create', array( 'path' => $path, 'run' => &$run)); } if($run){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'write', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'write', array( 'path' => $path, 'run' => &$run)); } error_log('upload2'); if($run){ $result=$storage->fromUploadedFile($tmpFile,self::getInternalPath($path)); if(!$exists){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_create', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_create', array( 'path' => $path)); } - OC_HOOK::emit( 'OC_FILESYSTEM', 'post_write', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'post_write', array( 'path' => $path)); return $result; } } @@ -525,7 +525,7 @@ class OC_FILESYSTEM{ static public function delTree($path){ if(self::canWrite($path) and $storage=self::getStorage($path)){ $run=true; - OC_HOOK::emit( 'OC_FILESYSTEM', 'delete', array( 'path' => $path, 'run' => &$run)); + OC_Hook::emit( 'OC_Filesystem', 'delete', array( 'path' => $path, 'run' => &$run)); if($run){ return $storage->delTree(self::getInternalPath($path)); } @@ -560,7 +560,7 @@ class OC_FILESYSTEM{ } static public function hash($type,$path,$raw=false){ if(self::canRead($path) and $storage=self::getStorage($path)){ - OC_HOOK::emit( 'OC_FILESYSTEM', 'read', array( 'path' => $path)); + OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path)); return $storage->hash($type,self::getInternalPath($path),$raw); } } diff --git a/lib/group.php b/lib/group.php index 71caaee6132..1161b9035fa 100644 --- a/lib/group.php +++ b/lib/group.php @@ -33,7 +33,7 @@ * pre_removeFromGroup(&run, uid, gid) * post_removeFromGroup(uid, gid) */ -class OC_GROUP { +class OC_Group { // The backend used for user management private static $_backend; @@ -78,7 +78,7 @@ class OC_GROUP { case 'database': case 'mysql': case 'sqlite': - self::$_backend = new OC_GROUP_DATABASE(); + self::$_backend = new OC_Group_Database(); break; default: $className = 'OC_GROUP_' . strToUpper($backend); @@ -113,10 +113,10 @@ class OC_GROUP { } $run = true; - OC_HOOK::emit( "OC_GROUP", "pre_createGroup", array( "run" => &$run, "gid" => $gid )); + OC_Hook::emit( "OC_Group", "pre_createGroup", array( "run" => &$run, "gid" => $gid )); if( $run && self::$_backend->createGroup( $gid )){ - OC_HOOK::emit( "OC_GROUP", "post_createGroup", array( "gid" => $gid )); + OC_Hook::emit( "OC_Group", "post_createGroup", array( "gid" => $gid )); return true; } else{ @@ -138,10 +138,10 @@ class OC_GROUP { } $run = true; - OC_HOOK::emit( "OC_GROUP", "pre_deleteGroup", array( "run" => &$run, "gid" => $gid )); + OC_Hook::emit( "OC_Group", "pre_deleteGroup", array( "run" => &$run, "gid" => $gid )); if( $run && self::$_backend->deleteGroup( $gid )){ - OC_HOOK::emit( "OC_GROUP", "post_deleteGroup", array( "gid" => $gid )); + OC_Hook::emit( "OC_Group", "post_deleteGroup", array( "gid" => $gid )); return true; } else{ @@ -171,7 +171,7 @@ class OC_GROUP { */ public static function addToGroup( $uid, $gid ){ // Does the user exist? - if( !in_array( $uid, OC_USER::getUsers())){ + if( !in_array( $uid, OC_User::getUsers())){ return false; } // Does the group exist? @@ -181,10 +181,10 @@ class OC_GROUP { // Go go go $run = true; - OC_HOOK::emit( "OC_GROUP", "pre_addToGroup", array( "run" => &$run, "uid" => $uid, "gid" => $gid )); + OC_Hook::emit( "OC_Group", "pre_addToGroup", array( "run" => &$run, "uid" => $uid, "gid" => $gid )); if( $run && self::$_backend->addToGroup( $uid, $gid )){ - OC_HOOK::emit( "OC_GROUP", "post_addToGroup", array( "uid" => $uid, "gid" => $gid )); + OC_Hook::emit( "OC_Group", "post_addToGroup", array( "uid" => $uid, "gid" => $gid )); return true; } else{ @@ -202,10 +202,10 @@ class OC_GROUP { */ public static function removeFromGroup( $uid, $gid ){ $run = true; - OC_HOOK::emit( "OC_GROUP", "pre_removeFromGroup", array( "run" => &$run, "uid" => $uid, "gid" => $gid )); + OC_Hook::emit( "OC_Group", "pre_removeFromGroup", array( "run" => &$run, "uid" => $uid, "gid" => $gid )); if( $run && self::$_backend->removeFromGroup( $uid, $gid )){ - OC_HOOK::emit( "OC_GROUP", "post_removeFromGroup", array( "uid" => $uid, "gid" => $gid )); + OC_Hook::emit( "OC_Group", "post_removeFromGroup", array( "uid" => $uid, "gid" => $gid )); return true; } else{ diff --git a/lib/group/backend.php b/lib/group/backend.php index 298cced7ff5..ebee8aacb91 100644 --- a/lib/group/backend.php +++ b/lib/group/backend.php @@ -26,7 +26,7 @@ /** * Abstract base class for user management */ -abstract class OC_GROUP_BACKEND { +abstract class OC_Group_Backend { /** * @brief Try to create a new group * @param $gid The name of the group to create diff --git a/lib/group/database.php b/lib/group/database.php index 8c04ca5d36b..6ca80b93985 100644 --- a/lib/group/database.php +++ b/lib/group/database.php @@ -40,7 +40,7 @@ /** * Class for group management in a SQL Database (e.g. MySQL, SQLite) */ -class OC_GROUP_DATABASE extends OC_GROUP_BACKEND { +class OC_Group_Database extends OC_Group_Backend { static private $userGroupCache=array(); /** diff --git a/lib/helper.php b/lib/helper.php index b976705a7cf..5dc3dd44a15 100755 --- a/lib/helper.php +++ b/lib/helper.php @@ -24,7 +24,7 @@ /** * Collection of useful functions */ -class OC_HELPER { +class OC_Helper { /** * @brief Creates an url * @param $app app diff --git a/lib/hook.php b/lib/hook.php index 08b6d5e8b6b..b069a7da6c0 100644 --- a/lib/hook.php +++ b/lib/hook.php @@ -4,7 +4,7 @@ * This class manages the hooks. It basically provides two functions: adding * slots and emitting signals. */ -class OC_HOOK{ +class OC_Hook{ static private $registered = array(); /** diff --git a/lib/installer.php b/lib/installer.php index a237caa0983..e25f9d9c4ce 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -23,7 +23,7 @@ /** * This class provides the functionality needed to install, update and remove plugins/apps */ -class OC_INSTALLER{ +class OC_Installer{ /** * @brief Installs an app * @param $data array with all information @@ -88,7 +88,7 @@ class OC_INSTALLER{ $zip->close(); } else { error_log("Failed to open archive when installing app"); - OC_HELPER::rmdirr($extractDir); + OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); } @@ -98,19 +98,19 @@ class OC_INSTALLER{ //load the info.xml file of the app if(!is_file($extractDir.'/appinfo/info.xml')){ error_log("App does not provide an info.xml file"); - OC_HELPER::rmdirr($extractDir); + OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); } return false; } - $info=OC_APP::getAppInfo($extractDir.'/appinfo/info.xml'); + $info=OC_App::getAppInfo($extractDir.'/appinfo/info.xml'); $basedir=$SERVERROOT.'/apps/'.$info['id']; //check if an app with the same id is already installed if(self::isInstalled( $info['id'] )){ error_log("App already installed"); - OC_HELPER::rmdirr($extractDir); + OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); } @@ -120,7 +120,7 @@ class OC_INSTALLER{ //check if the destination directory already exists if(is_dir($basedir)){ error_log("App's directory already exists"); - OC_HELPER::rmdirr($extractDir); + OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); } @@ -134,16 +134,16 @@ class OC_INSTALLER{ //copy the app to the correct place if(!mkdir($basedir)){ error_log('Can\'t create app folder ('.$basedir.')'); - OC_HELPER::rmdirr($extractDir); + OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); } return false; } - OC_HELPER::copyr($extractDir,$basedir); + OC_Helper::copyr($extractDir,$basedir); //remove temporary files - OC_HELPER::rmdirr($extractDir); + OC_Helper::rmdirr($extractDir); if($data['source']=='http'){ unlink($path); } @@ -159,8 +159,8 @@ class OC_INSTALLER{ } //set the installed version - OC_APPCONFIG::setValue($info['id'],'installed_version',$info['version']); - OC_APPCONFIG::setValue($info['id'],'enabled','no'); + OC_Appconfig::setValue($info['id'],'installed_version',$info['version']); + OC_Appconfig::setValue($info['id'],'enabled','no'); return true; } @@ -173,7 +173,7 @@ class OC_INSTALLER{ */ public static function isInstalled( $app ){ - if( null == OC_APPCONFIG::getValue( $app, "installed_version" )){ + if( null == OC_Appconfig::getValue( $app, "installed_version" )){ return false; } @@ -205,7 +205,7 @@ class OC_INSTALLER{ * -# including appinfo/upgrade.php * -# setting the installed version * - * upgrade.php can determine the current installed version of the app using "OC_APPCONFIG::getValue($appid,'installed_version')" + * upgrade.php can determine the current installed version of the app using "OC_Appconfig::getValue($appid,'installed_version')" */ public static function upgradeApp( $data = array()){ // TODO: write function @@ -251,7 +251,7 @@ class OC_INSTALLER{ while( false !== ( $filename = readdir( $dir ))){ if( substr( $filename, 0, 1 ) != '.' and is_dir("$SERVERROOT/apps/$filename") ){ if( file_exists( "$SERVERROOT/apps/$filename/appinfo/app.php" )){ - if(!OC_INSTALLER::isInstalled($filename)){ + if(!OC_Installer::isInstalled($filename)){ //install the database if(is_file("$SERVERROOT/apps/$filename/appinfo/database.xml")){ OC_DB::createDbFromStructure("$SERVERROOT/apps/$filename/appinfo/database.xml"); @@ -261,12 +261,12 @@ class OC_INSTALLER{ if(is_file("$SERVERROOT/apps/$filename/appinfo/install.php")){ include("$SERVERROOT/apps/$filename/appinfo/install.php"); } - $info=OC_APP::getAppInfo("$SERVERROOT/apps/$filename/appinfo/info.xml"); - OC_APPCONFIG::setValue($filename,'installed_version',$info['version']); + $info=OC_App::getAppInfo("$SERVERROOT/apps/$filename/appinfo/info.xml"); + OC_Appconfig::setValue($filename,'installed_version',$info['version']); if( $enabled ){ - OC_APPCONFIG::setValue($filename,'enabled','yes'); + OC_Appconfig::setValue($filename,'enabled','yes'); }else{ - OC_APPCONFIG::setValue($filename,'enabled','no'); + OC_Appconfig::setValue($filename,'enabled','no'); } } } diff --git a/lib/l10n.php b/lib/l10n.php index 053c6fbc10e..4e65af66c4f 100644 --- a/lib/l10n.php +++ b/lib/l10n.php @@ -200,8 +200,8 @@ class OC_L10N{ else{ $available=self::findAvailableLanguages( $app ); } - if( OC_USER::getUser() && OC_PREFERENCES::getValue( OC_USER::getUser(), 'core', 'lang' )){ - $lang = OC_PREFERENCES::getValue( OC_USER::getUser(), 'core', 'lang' ); + if( OC_User::getUser() && OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang' )){ + $lang = OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang' ); self::$language = $lang; if( array_search( $lang, $available ) !== false ){ return $lang; diff --git a/lib/log.php b/lib/log.php index d7c280ea65e..d51b2ef0785 100644 --- a/lib/log.php +++ b/lib/log.php @@ -39,7 +39,7 @@ /** * This class is for logging */ -class OC_LOG { +class OC_Log { /** * @brief adds an entry to the log * @param $appid id of the app @@ -101,7 +101,7 @@ class OC_LOG { $result=$query->execute($params)->fetchAll(); if(count($result)>0 and is_numeric($result[0]['moment'])){ foreach($result as &$row){ - $row['moment']=OC_UTIL::formatDate($row['moment']); + $row['moment']=OC_Util::formatDate($row['moment']); } } return $result; diff --git a/lib/ocs.php b/lib/ocs.php index c91871377a0..8c7556a173b 100644 --- a/lib/ocs.php +++ b/lib/ocs.php @@ -207,7 +207,7 @@ class OC_OCS { $identifieduser=''; } }else{ - if(!OC_USER::login($authuser,$authpw)){ + if(!OC_User::login($authuser,$authpw)){ if($forceuser){ header('WWW-Authenticate: Basic realm="your valid user account or api key"'); header('HTTP/1.0 401 Unauthorized'); @@ -377,7 +377,7 @@ class OC_OCS { */ private static function personCheck($format,$login,$passwd) { if($login<>''){ - if(OC_USER::login($login,$passwd)){ + if(OC_User::login($login,$passwd)){ $xml['person']['personid']=$login; echo(OC_OCS::generatexml($format,'ok',100,'',$xml,'person','check',2)); }else{ @@ -426,7 +426,7 @@ class OC_OCS { $xml[$i]['timestamp']=date('c',$log['timestamp']); $xml[$i]['type']=1; - $xml[$i]['message']=OC_LOG::$TYPE[$log['type']].' '.strip_tags($log['message']); + $xml[$i]['message']=OC_Log::$TYPE[$log['type']].' '.strip_tags($log['message']); $xml[$i]['link']=$url; } @@ -514,19 +514,19 @@ class OC_OCS { if($app){ $apps=array($app); }else{ - $apps=OC_PREFERENCES::getApps($user); + $apps=OC_Preferences::getApps($user); } if($key){ $keys=array($key); }else{ foreach($apps as $app){ - $keys=OC_PREFERENCES::getKeys($user,$app); + $keys=OC_Preferences::getKeys($user,$app); } } $result=array(); foreach($apps as $app){ foreach($keys as $key){ - $value=OC_PREFERENCES::getValue($user,$app,$key); + $value=OC_Preferences::getValue($user,$app,$key); $result[]=array('app'=>$app,'key'=>$key,'value'=>$value); } } @@ -542,7 +542,7 @@ class OC_OCS { * @return bool */ public static function setData($user, $app, $key, $value) { - return OC_PREFERENCES::setValue($user,$app,$key,$value); + return OC_Preferences::setValue($user,$app,$key,$value); } /** @@ -553,6 +553,6 @@ class OC_OCS { * @return string xml/json */ public static function deleteData($user, $app, $key) { - return OC_PREFERENCES::deleteKey($user,$app,$key); + return OC_Preferences::deleteKey($user,$app,$key); } } diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 1b6280e2587..2d85e715090 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -26,7 +26,7 @@ * database. */ -class OC_OCSCLIENT{ +class OC_OCSClient{ /** * @brief Get all the categories from the OCS server diff --git a/lib/preferences.php b/lib/preferences.php index 89598f478d1..d53cdd538e0 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -37,7 +37,7 @@ /** * This class provides an easy way for storing user preferences. */ -class OC_PREFERENCES{ +class OC_Preferences{ /** * @brief Get all users using the preferences * @returns array with user ids diff --git a/lib/remote/cloud.php b/lib/remote/cloud.php index 1acd48ea5af..2d3dee47b1c 100644 --- a/lib/remote/cloud.php +++ b/lib/remote/cloud.php @@ -186,7 +186,7 @@ class OC_REMOTE_CLOUD{ public function sendFile($sourceDir,$sourceFile,$targetDir,$targetFile){ global $WEBROOT; $source=$sourceDir.'/'.$sourceFile; - $tmp=OC_FILESYSTEM::toTmpFile($source); + $tmp=OC_Filesystem::toTmpFile($source); return $this->sendTmpFile($tmp,$targetDir,$targetFile); } @@ -195,7 +195,7 @@ class OC_REMOTE_CLOUD{ global $WEBROOT; $file=sys_get_temp_dir().'/'.'remoteCloudFile'.$token; rename($tmp,$file); - if( OC_CONFIG::getValue( "forcessl", false ) or isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') { + if( OC_Config::getValue( "forcessl", false ) or isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') { $url = "https://". $_SERVER['SERVER_NAME'] . $WEBROOT; }else{ $url = "http://". $_SERVER['SERVER_NAME'] . $WEBROOT; diff --git a/lib/search.php b/lib/search.php index cb5e5eee78b..f6f805bfe65 100644 --- a/lib/search.php +++ b/lib/search.php @@ -24,7 +24,7 @@ /** * provides an interface to all search providers */ -class OC_SEARCH{ +class OC_Search{ static private $providers=array(); /** diff --git a/lib/search/provider.php b/lib/search/provider.php index f0e0ba85249..cceed8b04a3 100644 --- a/lib/search/provider.php +++ b/lib/search/provider.php @@ -4,7 +4,7 @@ */ abstract class OC_Search_Provider{ public function __construct(){ - OC_SEARCH::registerProvider($this); + OC_Search::registerProvider($this); } /** diff --git a/lib/search/provider/file.php b/lib/search/provider/file.php index 892c431e05a..e257b82a694 100644 --- a/lib/search/provider/file.php +++ b/lib/search/provider/file.php @@ -2,13 +2,13 @@ class OC_Search_Provider_File extends OC_Search_Provider{ function search($query){ - $files=OC_FILESYSTEM::search($query); + $files=OC_Filesystem::search($query); $results=array(); foreach($files as $file){ - if(OC_FILESYSTEM::is_dir($file)){ - $results[]=new OC_Search_Result(basename($file),$file,OC_HELPER::linkTo( 'files', 'index.php?dir='.$file ),'Files'); + if(OC_Filesystem::is_dir($file)){ + $results[]=new OC_Search_Result(basename($file),$file,OC_Helper::linkTo( 'files', 'index.php?dir='.$file ),'Files'); }else{ - $results[]=new OC_Search_Result(basename($file),$file,OC_HELPER::linkTo( 'files', 'download.php?file='.$file ),'Files'); + $results[]=new OC_Search_Result(basename($file),$file,OC_Helper::linkTo( 'files', 'download.php?file='.$file ),'Files'); } } return $results; diff --git a/lib/setup.php b/lib/setup.php index bf7166016d4..41cfa1750ab 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -2,7 +2,7 @@ $hasSQLite = (is_callable('sqlite_open') or class_exists('SQLite3')); $hasMySQL = is_callable('mysql_connect'); -$datadir = OC_CONFIG::getValue('datadir', $SERVERROOT.'/data'); +$datadir = OC_Config::getValue('datadir', $SERVERROOT.'/data'); $opts = array( 'hasSQLite' => $hasSQLite, 'hasMySQL' => $hasMySQL, @@ -12,13 +12,13 @@ $opts = array( if(isset($_POST['install']) AND $_POST['install']=='true') { // We have to launch the installation process : - $e = OC_SETUP::install($_POST); + $e = OC_Setup::install($_POST); $errors = array('errors' => $e); if(count($e) > 0) { - //OC_TEMPLATE::printGuestPage("", "error", array("errors" => $errors)); + //OC_Template::printGuestPage("", "error", array("errors" => $errors)); $options = array_merge($_POST, $opts, $errors); - OC_TEMPLATE::printGuestPage("", "installation", $options); + OC_Template::printGuestPage("", "installation", $options); } else { header("Location: ".$WEBROOT.'/'); @@ -26,10 +26,10 @@ if(isset($_POST['install']) AND $_POST['install']=='true') { } } else { - OC_TEMPLATE::printGuestPage("", "installation", $opts); + OC_Template::printGuestPage("", "installation", $opts); } -class OC_SETUP { +class OC_Setup { public static function install($options) { $error = array(); $dbtype = $options['dbtype']; @@ -72,18 +72,18 @@ class OC_SETUP { } //write the config file - OC_CONFIG::setValue('datadirectory', $datadir); - OC_CONFIG::setValue('dbtype', $dbtype); - OC_CONFIG::setValue('version',implode('.',OC_UTIL::getVersion())); + OC_Config::setValue('datadirectory', $datadir); + OC_Config::setValue('dbtype', $dbtype); + OC_Config::setValue('version',implode('.',OC_Util::getVersion())); if($dbtype == 'mysql') { $dbuser = $options['dbuser']; $dbpass = $options['dbpass']; $dbname = $options['dbname']; $dbhost = $options['dbhost']; $dbtableprefix = $options['dbtableprefix']; - OC_CONFIG::setValue('dbname', $dbname); - OC_CONFIG::setValue('dbhost', $dbhost); - OC_CONFIG::setValue('dbtableprefix', $dbtableprefix); + OC_Config::setValue('dbname', $dbname); + OC_Config::setValue('dbhost', $dbhost); + OC_Config::setValue('dbtableprefix', $dbtableprefix); //check if the database user has admin right $connection = @mysql_connect($dbhost, $dbuser, $dbpass); @@ -105,15 +105,15 @@ class OC_SETUP { self::createDBUser($dbusername, $dbpassword, $connection); - OC_CONFIG::setValue('dbuser', $dbusername); - OC_CONFIG::setValue('dbpassword', $dbpassword); + OC_Config::setValue('dbuser', $dbusername); + OC_Config::setValue('dbpassword', $dbpassword); //create the database self::createDatabase($dbname, $dbusername, $connection); } else { - OC_CONFIG::setValue('dbuser', $dbuser); - OC_CONFIG::setValue('dbpassword', $dbpass); + OC_Config::setValue('dbuser', $dbuser); + OC_Config::setValue('dbpassword', $dbpass); //create the database self::createDatabase($dbname, $dbuser, $connection); @@ -139,18 +139,18 @@ class OC_SETUP { if(count($error) == 0) { //create the user and group - OC_USER::createUser($username, $password); - OC_GROUP::createGroup('admin'); - OC_GROUP::addToGroup($username, 'admin'); + OC_User::createUser($username, $password); + OC_Group::createGroup('admin'); + OC_Group::addToGroup($username, 'admin'); //guess what this does - OC_INSTALLER::installShippedApps(true); + OC_Installer::installShippedApps(true); //create htaccess files for apache hosts self::createHtaccess(); //TODO detect if apache is used //and we are done - OC_CONFIG::setValue('installed', true); + OC_Config::setValue('installed', true); } } @@ -193,7 +193,7 @@ class OC_SETUP { @file_put_contents($SERVERROOT.'/.htaccess', $content); //supress errors in case we don't have permissions for it $content = "deny from all"; - file_put_contents(OC_CONFIG::getValue('datadirectory', $SERVERROOT.'/data').'/.htaccess', $content); + file_put_contents(OC_Config::getValue('datadirectory', $SERVERROOT.'/data').'/.htaccess', $content); } } diff --git a/lib/template.php b/lib/template.php index edfdf3bda80..fe173f609b2 100644 --- a/lib/template.php +++ b/lib/template.php @@ -22,49 +22,49 @@ */ /** - * @brief make OC_HELPER::linkTo available as a simple function + * @brief make OC_Helper::linkTo available as a simple function * @param $app app * @param $file file * @returns link to the file * - * For further information have a look at OC_HELPER::linkTo + * For further information have a look at OC_Helper::linkTo */ function link_to( $app, $file ){ - return OC_HELPER::linkTo( $app, $file ); + return OC_Helper::linkTo( $app, $file ); } /** - * @brief make OC_HELPER::imagePath available as a simple function + * @brief make OC_Helper::imagePath available as a simple function * @param $app app * @param $image image * @returns link to the image * - * For further information have a look at OC_HELPER::imagePath + * For further information have a look at OC_Helper::imagePath */ function image_path( $app, $image ){ - return OC_HELPER::imagePath( $app, $image ); + return OC_Helper::imagePath( $app, $image ); } /** - * @brief make OC_HELPER::mimetypeIcon available as a simple function + * @brief make OC_Helper::mimetypeIcon available as a simple function * @param $mimetype mimetype * @returns link to the image * - * For further information have a look at OC_HELPER::mimetypeIcon + * For further information have a look at OC_Helper::mimetypeIcon */ function mimetype_icon( $mimetype ){ - return OC_HELPER::mimetypeIcon( $mimetype ); + return OC_Helper::mimetypeIcon( $mimetype ); } /** - * @brief make OC_HELPER::humanFileSize available as a simple function + * @brief make OC_Helper::humanFileSize available as a simple function * @param $bytes size in bytes * @returns size as string * - * For further information have a look at OC_HELPER::humanFileSize + * For further information have a look at OC_Helper::humanFileSize */ function human_file_size( $bytes ){ - return OC_HELPER::humanFileSize( $bytes ); + return OC_Helper::humanFileSize( $bytes ); } function simple_file_size($bytes) { @@ -101,7 +101,7 @@ function relative_modified_date($timestamp) { /** * This class provides the templates for owncloud. */ -class OC_TEMPLATE{ +class OC_Template{ private $renderas; // Create a full page? private $application; // template Application private $vars; // Vars @@ -114,11 +114,11 @@ class OC_TEMPLATE{ * @param $app app providing the template * @param $file name of the tempalte file (without suffix) * @param $renderas = ""; produce a full page - * @returns OC_TEMPLATE object + * @returns OC_Template object * - * This function creates an OC_TEMPLATE object. + * This function creates an OC_Template object. * - * If $renderas is set, OC_TEMPLATE will try to produce a full page in the + * If $renderas is set, OC_Template will try to produce a full page in the * according layout. For now, renderas can be set to "guest", "user" or * "admin". */ @@ -233,34 +233,34 @@ class OC_TEMPLATE{ // Decide which page we show if( $this->renderas == "user" ) { - $page = new OC_TEMPLATE( "core", "layout.user" ); - $search=new OC_TEMPLATE( 'core', 'part.searchbox'); - $search->assign('searchurl',OC_HELPER::linkTo( 'search', 'index.php' )); + $page = new OC_Template( "core", "layout.user" ); + $search=new OC_Template( 'core', 'part.searchbox'); + $search->assign('searchurl',OC_Helper::linkTo( 'search', 'index.php' )); $page->assign('searchbox', $search->fetchPage()); // Add navigation entry - $page->assign( "navigation", OC_APP::getNavigation()); + $page->assign( "navigation", OC_App::getNavigation()); } elseif( $this->renderas == "admin" ) { - $page = new OC_TEMPLATE( "core", "layout.admin" ); - $search=new OC_TEMPLATE( 'core', 'part.searchbox'); - $search->assign('searchurl',OC_HELPER::linkTo( 'search', 'index.php' )); + $page = new OC_Template( "core", "layout.admin" ); + $search=new OC_Template( 'core', 'part.searchbox'); + $search->assign('searchurl',OC_Helper::linkTo( 'search', 'index.php' )); $page->assign('searchbox', $search->fetchPage()); // Add menu data - if( OC_GROUP::inGroup( $_SESSION["user_id"], "admin" )){ - $page->assign( "adminnavigation", OC_APP::getAdminNavigation()); + if( OC_Group::inGroup( $_SESSION["user_id"], "admin" )){ + $page->assign( "adminnavigation", OC_App::getAdminNavigation()); } - $page->assign( "settingsnavigation", OC_APP::getSettingsNavigation()); + $page->assign( "settingsnavigation", OC_App::getSettingsNavigation()); } else { - $page = new OC_TEMPLATE( "core", "layout.guest" ); + $page = new OC_Template( "core", "layout.guest" ); } // Add the css and js files - foreach(OC_UTIL::$scripts as $script){ + foreach(OC_Util::$scripts as $script){ if(is_file("$SERVERROOT/apps/$script.js" )){ $page->append( "jsfiles", "$WEBROOT/apps/$script.js" ); } @@ -271,7 +271,7 @@ class OC_TEMPLATE{ $page->append( "jsfiles", "$WEBROOT/core/$script.js" ); } } - foreach(OC_UTIL::$styles as $style){ + foreach(OC_Util::$styles as $style){ if(is_file("$SERVERROOT/apps/$style.css" )){ $page->append( "cssfiles", "$WEBROOT/apps/$style.css" ); } @@ -285,7 +285,7 @@ class OC_TEMPLATE{ // Add custom headers $page->assign('headers',$this->headers); - foreach(OC_UTIL::$headers as $header){ + foreach(OC_Util::$headers as $header){ $page->append('headers',$header); } @@ -328,7 +328,7 @@ class OC_TEMPLATE{ * @returns true/false */ public static function printUserPage( $application, $name, $parameters = array() ){ - $content = new OC_TEMPLATE( $application, $name, "user" ); + $content = new OC_Template( $application, $name, "user" ); foreach( $parameters as $key => $value ){ $content->assign( $key, $value ); } @@ -343,7 +343,7 @@ class OC_TEMPLATE{ * @returns true/false */ public static function printAdminPage( $application, $name, $parameters = array() ){ - $content = new OC_TEMPLATE( $application, $name, "admin" ); + $content = new OC_Template( $application, $name, "admin" ); foreach( $parameters as $key => $value ){ $content->assign( $key, $value ); } @@ -358,7 +358,7 @@ class OC_TEMPLATE{ * @returns true/false */ public static function printGuestPage( $application, $name, $parameters = array() ){ - $content = new OC_TEMPLATE( $application, $name, "guest" ); + $content = new OC_Template( $application, $name, "guest" ); foreach( $parameters as $key => $value ){ $content->assign( $key, $value ); } diff --git a/lib/user.php b/lib/user.php index f6fbc33f640..9b8f5fb13e7 100644 --- a/lib/user.php +++ b/lib/user.php @@ -34,7 +34,7 @@ * post_login(uid) * logout() */ -class OC_USER { +class OC_User { // The backend used for user management private static $_usedBackends = array(); @@ -91,7 +91,7 @@ class OC_USER { case 'database': case 'mysql': case 'sqlite': - self::$_usedBackends[$backend] = new OC_USER_DATABASE(); + self::$_usedBackends[$backend] = new OC_User_Database(); break; default: $className = 'OC_USER_' . strToUpper($backend); @@ -108,7 +108,7 @@ class OC_USER { * @param $password The password of the new user * @returns true/false * - * Creates a new user. Basic checking of username is done in OC_USER + * Creates a new user. Basic checking of username is done in OC_User * itself, not in its subclasses. * * Allowed characters in the username are: "a-z", "A-Z", "0-9" and "_.@-" @@ -130,7 +130,7 @@ class OC_USER { $run = true; - OC_HOOK::emit( "OC_USER", "pre_createUser", array( "run" => &$run, "uid" => $uid, "password" => $password )); + OC_Hook::emit( "OC_User", "pre_createUser", array( "run" => &$run, "uid" => $uid, "password" => $password )); if( $run ){ //create the user in the first backend that supports creating users @@ -139,7 +139,7 @@ class OC_USER { continue; $backend->createUser($uid,$password); - OC_HOOK::emit( "OC_USER", "post_createUser", array( "uid" => $uid, "password" => $password )); + OC_Hook::emit( "OC_User", "post_createUser", array( "uid" => $uid, "password" => $password )); return true; } @@ -156,7 +156,7 @@ class OC_USER { */ public static function deleteUser( $uid ){ $run = true; - OC_HOOK::emit( "OC_USER", "pre_deleteUser", array( "run" => &$run, "uid" => $uid )); + OC_Hook::emit( "OC_User", "pre_deleteUser", array( "run" => &$run, "uid" => $uid )); if( $run ){ //delete the user from all backends @@ -166,12 +166,12 @@ class OC_USER { } } // We have to delete the user from all groups - foreach( OC_GROUP::getUserGroups( $uid ) as $i ){ - OC_GROUP::removeFromGroup( $uid, $i ); + foreach( OC_Group::getUserGroups( $uid ) as $i ){ + OC_Group::removeFromGroup( $uid, $i ); } // Emit and exit - OC_HOOK::emit( "OC_USER", "post_deleteUser", array( "uid" => $uid )); + OC_Hook::emit( "OC_User", "post_deleteUser", array( "uid" => $uid )); return true; } else{ @@ -189,12 +189,12 @@ class OC_USER { */ public static function login( $uid, $password ){ $run = true; - OC_HOOK::emit( "OC_USER", "pre_login", array( "run" => &$run, "uid" => $uid )); + OC_Hook::emit( "OC_User", "pre_login", array( "run" => &$run, "uid" => $uid )); if( $run && self::checkPassword( $uid, $password )){ $_SESSION['user_id'] = $uid; - OC_LOG::add( "core", $_SESSION['user_id'], "login" ); - OC_HOOK::emit( "OC_USER", "post_login", array( "uid" => $uid )); + OC_Log::add( "core", $_SESSION['user_id'], "login" ); + OC_Hook::emit( "OC_User", "post_login", array( "uid" => $uid )); return true; } else{ @@ -209,8 +209,8 @@ class OC_USER { * Logout, destroys session */ public static function logout(){ - OC_HOOK::emit( "OC_USER", "logout", array()); - OC_LOG::add( "core", $_SESSION['user_id'], "logout" ); + OC_Hook::emit( "OC_User", "logout", array()); + OC_Log::add( "core", $_SESSION['user_id'], "logout" ); $_SESSION['user_id'] = false; return true; } @@ -263,7 +263,7 @@ class OC_USER { */ public static function setPassword( $uid, $password ){ $run = true; - OC_HOOK::emit( "OC_USER", "pre_setPassword", array( "run" => &$run, "uid" => $uid, "password" => $password )); + OC_Hook::emit( "OC_User", "pre_setPassword", array( "run" => &$run, "uid" => $uid, "password" => $password )); if( $run ){ foreach(self::$_usedBackends as $backend){ @@ -273,7 +273,7 @@ class OC_USER { } } } - OC_HOOK::emit( "OC_USER", "post_setPassword", array( "uid" => $uid, "password" => $password )); + OC_Hook::emit( "OC_User", "post_setPassword", array( "uid" => $uid, "password" => $password )); return true; } else{ diff --git a/lib/user/backend.php b/lib/user/backend.php index 1797d0c475a..4afdf152150 100644 --- a/lib/user/backend.php +++ b/lib/user/backend.php @@ -41,9 +41,9 @@ define('OC_USER_BACKEND_USER_EXISTS', 0x100000); /** * abstract base class for user management - * subclass this for your own backends and see OC_USER_EXAMPLE for descriptions + * subclass this for your own backends and see OC_User_Example for descriptions */ -abstract class OC_USER_BACKEND { +abstract class OC_User_Backend { protected $possibleActions = array( OC_USER_BACKEND_CREATE_USER => 'createUser', diff --git a/lib/user/database.php b/lib/user/database.php index ace3c897703..4992c2aa164 100644 --- a/lib/user/database.php +++ b/lib/user/database.php @@ -36,7 +36,7 @@ /** * Class for user management in a SQL Database (e.g. MySQL, SQLite) */ -class OC_USER_DATABASE extends OC_USER_BACKEND { +class OC_User_Database extends OC_User_Backend { static private $userGroupCache=array(); /** @@ -45,7 +45,7 @@ class OC_USER_DATABASE extends OC_USER_BACKEND { * @param $password The password of the new user * @returns true/false * - * Creates a new user. Basic checking of username is done in OC_USER + * Creates a new user. Basic checking of username is done in OC_User * itself, not in its subclasses. */ public function createUser( $uid, $password ){ diff --git a/lib/user/example.php b/lib/user/example.php index 069f14492a4..7481014de77 100644 --- a/lib/user/example.php +++ b/lib/user/example.php @@ -25,14 +25,14 @@ * abstract reference class for user management * this class should only be used as a reference for method signatures and their descriptions */ -abstract class OC_USER_EXAMPLE extends OC_USER_BACKEND { +abstract class OC_User_Example extends OC_User_Backend { /** * @brief Create a new user * @param $uid The username of the user to create * @param $password The password of the new user * @returns true/false * - * Creates a new user. Basic checking of username is done in OC_USER + * Creates a new user. Basic checking of username is done in OC_User * itself, not in its subclasses. */ public function createUser($uid, $password){ diff --git a/lib/util.php b/lib/util.php index 2a50114b053..d9c749521ea 100644 --- a/lib/util.php +++ b/lib/util.php @@ -4,7 +4,7 @@ * Class for utility functions * */ -class OC_UTIL { +class OC_Util { public static $scripts=array(); public static $styles=array(); public static $headers=array(); @@ -20,8 +20,8 @@ class OC_UTIL { global $SERVERROOT; global $CONFIG_DATADIRECTORY; - $CONFIG_DATADIRECTORY_ROOT = OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" ); - $CONFIG_BACKUPDIRECTORY = OC_CONFIG::getValue( "backupdirectory", "$SERVERROOT/backup" ); + $CONFIG_DATADIRECTORY_ROOT = OC_Config::getValue( "datadirectory", "$SERVERROOT/data" ); + $CONFIG_BACKUPDIRECTORY = OC_Config::getValue( "backupdirectory", "$SERVERROOT/backup" ); // Create root dir if(!is_dir($CONFIG_DATADIRECTORY_ROOT)){ @@ -29,23 +29,23 @@ class OC_UTIL { } // If we are not forced to load a specific user we load the one that is logged in - if( $user == "" && OC_USER::isLoggedIn()){ - $user = OC_USER::getUser(); + if( $user == "" && OC_User::isLoggedIn()){ + $user = OC_User::getUser(); } if( $user != "" ){ //if we aren't logged in, there is no use to set up the filesystem //first set up the local "root" storage and the backupstorage if needed - $rootStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_DATADIRECTORY_ROOT)); -// if( OC_CONFIG::getValue( "enablebackup", false )){ + $rootStorage=OC_Filesystem::createStorage('local',array('datadir'=>$CONFIG_DATADIRECTORY_ROOT)); +// if( OC_Config::getValue( "enablebackup", false )){ // // This creates the Directorys recursively // if(!is_dir( "$CONFIG_BACKUPDIRECTORY/$user/$root" )){ // mkdir( "$CONFIG_BACKUPDIRECTORY/$user/$root", 0755, true ); // } -// $backupStorage=OC_FILESYSTEM::createStorage('local',array('datadir'=>$CONFIG_BACKUPDIRECTORY)); +// $backupStorage=OC_Filesystem::createStorage('local',array('datadir'=>$CONFIG_BACKUPDIRECTORY)); // $backup=new OC_FILEOBSERVER_BACKUP(array('storage'=>$backupStorage)); // $rootStorage->addObserver($backup); // } - OC_FILESYSTEM::mount($rootStorage,'/'); + OC_Filesystem::mount($rootStorage,'/'); $CONFIG_DATADIRECTORY = "$CONFIG_DATADIRECTORY_ROOT/$user/$root"; if( !is_dir( $CONFIG_DATADIRECTORY )){ @@ -55,25 +55,25 @@ class OC_UTIL { // TODO: find a cool way for doing this // //set up the other storages according to the system settings // foreach($CONFIG_FILESYSTEM as $storageConfig){ -// if(OC_FILESYSTEM::hasStorageType($storageConfig['type'])){ +// if(OC_Filesystem::hasStorageType($storageConfig['type'])){ // $arguments=$storageConfig; // unset($arguments['type']); // unset($arguments['mountpoint']); -// $storage=OC_FILESYSTEM::createStorage($storageConfig['type'],$arguments); +// $storage=OC_Filesystem::createStorage($storageConfig['type'],$arguments); // if($storage){ -// OC_FILESYSTEM::mount($storage,$storageConfig['mountpoint']); +// OC_Filesystem::mount($storage,$storageConfig['mountpoint']); // } // } // } //jail the user into his "home" directory - OC_FILESYSTEM::chroot("/$user/$root"); + OC_Filesystem::chroot("/$user/$root"); self::$fsSetup=true; } } public static function tearDownFS(){ - OC_FILESYSTEM::tearDown(); + OC_Filesystem::tearDown(); self::$fsSetup=false; } @@ -153,7 +153,7 @@ class OC_UTIL { * @param int $pagecount * @param int $page * @param string $url - * @return OC_TEMPLATE + * @return OC_Template */ public static function getPageNavi($pagecount,$page,$url) { @@ -164,7 +164,7 @@ class OC_UTIL { $pagestop=$page+$pagelinkcount; if($pagestop>$pagecount) $pagestop=$pagecount; - $tmpl = new OC_TEMPLATE( '', 'part.pagenavi', '' ); + $tmpl = new OC_Template( '', 'part.pagenavi', '' ); $tmpl->assign('page',$page); $tmpl->assign('pagecount',$pagecount); $tmpl->assign('pagestart',$pagestart); @@ -184,17 +184,17 @@ class OC_UTIL { global $SERVERROOT; global $CONFIG_DATADIRECTORY; - $CONFIG_DATADIRECTORY_ROOT = OC_CONFIG::getValue( "datadirectory", "$SERVERROOT/data" );; - $CONFIG_BACKUPDIRECTORY = OC_CONFIG::getValue( "backupdirectory", "$SERVERROOT/backup" ); - $CONFIG_INSTALLED = OC_CONFIG::getValue( "installed", false ); + $CONFIG_DATADIRECTORY_ROOT = OC_Config::getValue( "datadirectory", "$SERVERROOT/data" );; + $CONFIG_BACKUPDIRECTORY = OC_Config::getValue( "backupdirectory", "$SERVERROOT/backup" ); + $CONFIG_INSTALLED = OC_Config::getValue( "installed", false ); $errors=array(); //check for database drivers if(!is_callable('sqlite_open') and !is_callable('mysql_connect')){ $errors[]=array('error'=>'No database drivers (sqlite or mysql) installed.
','hint'=>'');//TODO: sane hint } - $CONFIG_DBTYPE = OC_CONFIG::getValue( "dbtype", "sqlite" ); - $CONFIG_DBNAME = OC_CONFIG::getValue( "dbname", "owncloud" ); + $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); + $CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" ); //try to get the username the httpd server runs on, used in hints $stat=stat($_SERVER['DOCUMENT_ROOT']); @@ -212,17 +212,17 @@ class OC_UTIL { if(!stristr(PHP_OS, 'WIN')){ $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); if(substr($prems,-1)!='0'){ - OC_HELPER::chmodr($CONFIG_DATADIRECTORY_ROOT,0770); + OC_Helper::chmodr($CONFIG_DATADIRECTORY_ROOT,0770); clearstatcache(); $prems=substr(decoct(fileperms($CONFIG_DATADIRECTORY_ROOT)),-3); if(substr($prems,2,1)!='0'){ $errors[]=array('error'=>'Data directory ('.$CONFIG_DATADIRECTORY_ROOT.') is readable from the web
','hint'=>$permissionsHint); } } - if( OC_CONFIG::getValue( "enablebackup", false )){ + if( OC_Config::getValue( "enablebackup", false )){ $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); if(substr($prems,-1)!='0'){ - OC_HELPER::chmodr($CONFIG_BACKUPDIRECTORY,0770); + OC_Helper::chmodr($CONFIG_BACKUPDIRECTORY,0770); clearstatcache(); $prems=substr(decoct(fileperms($CONFIG_BACKUPDIRECTORY)),-3); if(substr($prems,2,1)!='0'){ diff --git a/log/appinfo/app.php b/log/appinfo/app.php index 7247104b95d..f3ef650704d 100644 --- a/log/appinfo/app.php +++ b/log/appinfo/app.php @@ -1,6 +1,6 @@ 1, "id" => "log", "name" => "Log" )); -OC_APP::addSettingsPage( array( "id" => "log", "order" => 999, "href" => OC_HELPER::linkTo( "log", "index.php" ), "name" => "Log", "icon" => OC_HELPER::imagePath( "log", "logs.png" ))); +OC_App::register( array( "order" => 1, "id" => "log", "name" => "Log" )); +OC_App::addSettingsPage( array( "id" => "log", "order" => 999, "href" => OC_Helper::linkTo( "log", "index.php" ), "name" => "Log", "icon" => OC_Helper::imagePath( "log", "logs.png" ))); ?> diff --git a/log/index.php b/log/index.php index 096180347e5..e201411e483 100644 --- a/log/index.php +++ b/log/index.php @@ -24,13 +24,13 @@ //require_once('../../config/config.php'); 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(); } //load the script -OC_UTIL::addScript( "log", "log" ); +OC_Util::addScript( "log", "log" ); $allActions=array('login','logout','read','write','create','delete'); @@ -42,29 +42,29 @@ if(isset($_POST['save'])){ $selectedActions[]=$action; } } - OC_PREFERENCES::setValue(OC_USER::getUser(),'log','actions',implode(',',$selectedActions)); - OC_PREFERENCES::setValue(OC_USER::getUser(),'log','pagesize',$_POST['size']); + OC_Preferences::setValue(OC_User::getUser(),'log','actions',implode(',',$selectedActions)); + OC_Preferences::setValue(OC_User::getUser(),'log','pagesize',$_POST['size']); } //clear log entries elseif(isset($_POST['clear'])){ $removeBeforeDate=(isset($_POST['removeBeforeDate']))?$_POST['removeBeforeDate']:0; if($removeBeforeDate!==0){ $removeBeforeDate=strtotime($removeBeforeDate); - OC_LOG::deleteBefore($removeBeforeDate); + OC_Log::deleteBefore($removeBeforeDate); } } elseif(isset($_POST['clearall'])){ - OC_LOG::deleteAll(); + OC_Log::deleteAll(); } -OC_APP::setActiveNavigationEntry( 'log' ); -$logs=OC_LOG::get(); +OC_App::setActiveNavigationEntry( 'log' ); +$logs=OC_Log::get(); -$selectedActions=explode(',',OC_PREFERENCES::getValue(OC_USER::getUser(),'log','actions',implode(',',$allActions))); -$logs=OC_LOG::filterAction($logs,$selectedActions); +$selectedActions=explode(',',OC_Preferences::getValue(OC_User::getUser(),'log','actions',implode(',',$allActions))); +$logs=OC_Log::filterAction($logs,$selectedActions); -$pageSize=OC_PREFERENCES::getValue(OC_USER::getUser(),'log','pagesize',20); +$pageSize=OC_Preferences::getValue(OC_User::getUser(),'log','pagesize',20); $pageCount=ceil(count($logs)/$pageSize); $page=isset($_GET['page'])?$_GET['page']:0; if($page>=$pageCount){ @@ -77,8 +77,8 @@ foreach( $logs as &$i ){ $i['date'] =$i['moment']; } -$url=OC_HELPER::linkTo( 'log', 'index.php' ).'?page='; -$pager=OC_UTIL::getPageNavi($pageCount,$page,$url); +$url=OC_Helper::linkTo( 'log', 'index.php' ).'?page='; +$pager=OC_Util::getPageNavi($pageCount,$page,$url); if($pager){ $pagerHTML=$pager->fetchPage(); } @@ -96,7 +96,7 @@ foreach($allActions as $action){ } } -$tmpl = new OC_TEMPLATE( 'log', 'index', 'admin' ); +$tmpl = new OC_Template( 'log', 'index', 'admin' ); $tmpl->assign( 'logs', $logs ); $tmpl->assign( 'pager', $pagerHTML ); $tmpl->assign( 'size', $pageSize ); diff --git a/search/appinfo/app.php b/search/appinfo/app.php index 44834498fec..b91341643f2 100644 --- a/search/appinfo/app.php +++ b/search/appinfo/app.php @@ -1,5 +1,5 @@ 2, "id" => 'search', 'name' => 'Search' )); +OC_App::register( array( 'order' => 2, "id" => 'search', 'name' => 'Search' )); ?> diff --git a/search/index.php b/search/index.php index b9aca57cdec..7369a6d81ce 100644 --- a/search/index.php +++ b/search/index.php @@ -26,19 +26,19 @@ 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(); } // Load the files we need -OC_UTIL::addStyle( 'search', 'search' ); +OC_Util::addStyle( 'search', 'search' ); $query=(isset($_POST['query']))?$_POST['query']:''; if($query){ - $results=OC_SEARCH::search($query); + $results=OC_Search::search($query); }else{ - header("Location: ".$WEBROOT.'/'.OC_APPCONFIG::getValue("core", "defaultpage", "files/index.php")); + header("Location: ".$WEBROOT.'/'.OC_Appconfig::getValue("core", "defaultpage", "files/index.php")); exit(); } @@ -50,7 +50,7 @@ foreach($results as $result){ $resultTypes[$result->type][]=$result; } -$tmpl = new OC_TEMPLATE( 'search', 'index', 'user' ); +$tmpl = new OC_Template( 'search', 'index', 'user' ); $tmpl->assign('resultTypes',$resultTypes); $tmpl->printPage(); diff --git a/settings/ajax/changepassword.php b/settings/ajax/changepassword.php index f568d3ef876..c8c1f740889 100644 --- a/settings/ajax/changepassword.php +++ b/settings/ajax/changepassword.php @@ -9,7 +9,7 @@ $l=new OC_L10N('settings'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn()){ +if( !OC_User::isLoggedIn()){ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t( "Authentication error" ) ))); exit(); } @@ -21,13 +21,13 @@ if( !isset( $_POST["password"] ) && !isset( $_POST["oldpassword"] )){ } // Check if the old password is correct -if( !OC_USER::checkPassword( $_SESSION["user_id"], $_POST["oldpassword"] )){ +if( !OC_User::checkPassword( $_SESSION["user_id"], $_POST["oldpassword"] )){ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Your old password is wrong!") ))); exit(); } // Change password -if( OC_USER::setPassword( $_SESSION["user_id"], $_POST["password"] )){ +if( OC_User::setPassword( $_SESSION["user_id"], $_POST["password"] )){ echo json_encode( array( "status" => "success", "data" => array( "message" => $l->t("Password changed") ))); } else{ diff --git a/settings/ajax/setlanguage.php b/settings/ajax/setlanguage.php index bc467fb9004..a5ba3d81ba3 100644 --- a/settings/ajax/setlanguage.php +++ b/settings/ajax/setlanguage.php @@ -9,7 +9,7 @@ $l=new OC_L10N('settings'); header( "Content-Type: application/jsonrequest" ); // Check if we are a user -if( !OC_USER::isLoggedIn()){ +if( !OC_User::isLoggedIn()){ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Authentication error") ))); exit(); } @@ -17,7 +17,7 @@ if( !OC_USER::isLoggedIn()){ // Get data if( isset( $_POST['lang'] ) ){ $lang=$_POST['lang']; - OC_PREFERENCES::setValue( OC_USER::getUser(), 'core', 'lang', $lang ); + OC_Preferences::setValue( OC_User::getUser(), 'core', 'lang', $lang ); echo json_encode( array( "status" => "success", "data" => array( "message" => $l->t("Language changed") ))); }else{ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Invalid request") ))); diff --git a/settings/appinfo/app.php b/settings/appinfo/app.php index f0bf1c71bb4..db4594dcc2d 100644 --- a/settings/appinfo/app.php +++ b/settings/appinfo/app.php @@ -1,6 +1,6 @@ "settings", "name" => "Settings" )); -OC_APP::addSettingsPage( array( "id" => "settings", "order" => -1000, "href" => OC_HELPER::linkTo( "settings", "index.php" ), "name" => "Personal", "icon" => OC_HELPER::imagePath( "settings", "personal.png" ))); +OC_App::register( array( "id" => "settings", "name" => "Settings" )); +OC_App::addSettingsPage( array( "id" => "settings", "order" => -1000, "href" => OC_Helper::linkTo( "settings", "index.php" ), "name" => "Personal", "icon" => OC_Helper::imagePath( "settings", "personal.png" ))); ?> diff --git a/settings/index.php b/settings/index.php index 17c878b1a25..a37ae7e6ea2 100644 --- a/settings/index.php +++ b/settings/index.php @@ -1,32 +1,32 @@ assign('usage',OC_HELPER::humanFileSize($used)); -$tmpl->assign('total_space',OC_HELPER::humanFileSize($total)); +$tmpl = new OC_Template( "settings", "index", "admin"); +$tmpl->assign('usage',OC_Helper::humanFileSize($used)); +$tmpl->assign('total_space',OC_Helper::humanFileSize($total)); $tmpl->assign('usage_relative',$relative); $tmpl->assign('languages',$languages); $tmpl->printPage(); diff --git a/tests/index.php b/tests/index.php index 3d410cd4330..efa730f6f8f 100644 --- a/tests/index.php +++ b/tests/index.php @@ -46,7 +46,7 @@ foreach($testCases as $testCaseClass){ $testResults[$testCaseClass]=$results; } -$tmpl = new OC_TEMPLATE( 'tests', 'index'); +$tmpl = new OC_Template( 'tests', 'index'); $tmpl->assign('tests',$testResults); $tmpl->printPage(); diff --git a/tests/lib/filesystem.php b/tests/lib/filesystem.php index 1b1703a06d7..4bfa23884f4 100644 --- a/tests/lib/filesystem.php +++ b/tests/lib/filesystem.php @@ -2,46 +2,46 @@ class OC_FILEYSYSTEM_Test extends OC_TestCase { public function setup(){ - OC_UTIL::setupFS('testuser','testcase'); + OC_Util::setupFS('testuser','testcase'); } public function tearDown(){ - OC_FILESYSTEM::chroot(''); - OC_FILESYSTEM::delTree('/testuser'); - OC_UTIL::tearDownFS(); + OC_Filesystem::chroot(''); + OC_Filesystem::delTree('/testuser'); + OC_Util::tearDownFS(); } public function isDir(){ - $this->assertEquals(true, OC_FILESYSTEM::is_dir('/'),'Root is not a directory'); + $this->assertEquals(true, OC_Filesystem::is_dir('/'),'Root is not a directory'); } public function fileExists(){ - $this->assertEquals(false, OC_FILESYSTEM::file_exists('/dummy'),'Unexpected result with non-existing file'); - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - $this->assertEquals(true, OC_FILESYSTEM::file_exists('/dummy'),'Unexpected result with existing file'); + $this->assertEquals(false, OC_Filesystem::file_exists('/dummy'),'Unexpected result with non-existing file'); + OC_Filesystem::file_put_contents('/dummy','foo'); + $this->assertEquals(true, OC_Filesystem::file_exists('/dummy'),'Unexpected result with existing file'); } public function mkdir(){ - OC_FILESYSTEM::mkdir('/dummy'); - $this->assertEquals(true, OC_FILESYSTEM::file_exists('/dummy'),'No such file or directory after creating folder'); - $this->assertEquals(true, OC_FILESYSTEM::is_dir('/dummy'),'File created instead of filder'); + OC_Filesystem::mkdir('/dummy'); + $this->assertEquals(true, OC_Filesystem::file_exists('/dummy'),'No such file or directory after creating folder'); + $this->assertEquals(true, OC_Filesystem::is_dir('/dummy'),'File created instead of filder'); } public function rmdir(){ - OC_FILESYSTEM::mkdir('/dummy'); - OC_FILESYSTEM::rmdir('/dummy'); - $this->assertEquals(false, OC_FILESYSTEM::file_exists('/dummy'),'Folder still exists after removing'); + OC_Filesystem::mkdir('/dummy'); + OC_Filesystem::rmdir('/dummy'); + $this->assertEquals(false, OC_Filesystem::file_exists('/dummy'),'Folder still exists after removing'); } public function isFile(){ - $this->assertEquals(false, OC_FILESYSTEM::is_file('/'),'Root is a file'); - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - $this->assertEquals(true, OC_FILESYSTEM::is_file('/dummy'),'Created file is not said to be a file'); + $this->assertEquals(false, OC_Filesystem::is_file('/'),'Root is a file'); + OC_Filesystem::file_put_contents('/dummy','foo'); + $this->assertEquals(true, OC_Filesystem::is_file('/dummy'),'Created file is not said to be a file'); } public function opendir(){ - OC_FILESYSTEM::file_put_contents('/dummy1','foo'); - OC_FILESYSTEM::file_put_contents('/dummy2','foo'); - $dh=OC_FILESYSTEM::opendir('/'); + OC_Filesystem::file_put_contents('/dummy1','foo'); + OC_Filesystem::file_put_contents('/dummy2','foo'); + $dh=OC_Filesystem::opendir('/'); if(!$dh){ $this->fail('Failed to open root'); } @@ -61,14 +61,14 @@ class OC_FILEYSYSTEM_Test extends OC_TestCase } public function filesize(){ - OC_FILESYSTEM::file_put_contents('/dummy','1234567890'); - $this->assertEquals(10, OC_FILESYSTEM::filesize('/dummy'),'Unexpected filesize'); + OC_Filesystem::file_put_contents('/dummy','1234567890'); + $this->assertEquals(10, OC_Filesystem::filesize('/dummy'),'Unexpected filesize'); } public function stat(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); + OC_Filesystem::file_put_contents('/dummy','foo'); $time=time(); - $stat=OC_FILESYSTEM::stat('/dummy'); + $stat=OC_Filesystem::stat('/dummy'); $this->assertEquals(true,abs($time-$stat['atime'])<1,'Unexpected access time');//there can be small difference between those values due to running time $this->assertEquals(true,abs($time-$stat['ctime'])<1,'Unexpected creation time'); $this->assertEquals(true,abs($time-$stat['mtime'])<1,'Unexpected modified time'); @@ -76,146 +76,146 @@ class OC_FILEYSYSTEM_Test extends OC_TestCase } public function filetype(){ - OC_FILESYSTEM::file_put_contents('/dummyFile','foo'); - OC_FILESYSTEM::mkdir('/dummyFolder'); - $this->assertEquals('file', OC_FILESYSTEM::filetype('/dummyFile'),'Unexpected filetype of file'); - $this->assertEquals('dir', OC_FILESYSTEM::filetype('/dummyFolder'),'Unexpected filetype of folder'); + OC_Filesystem::file_put_contents('/dummyFile','foo'); + OC_Filesystem::mkdir('/dummyFolder'); + $this->assertEquals('file', OC_Filesystem::filetype('/dummyFile'),'Unexpected filetype of file'); + $this->assertEquals('dir', OC_Filesystem::filetype('/dummyFolder'),'Unexpected filetype of folder'); } public function readfile(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); + OC_Filesystem::file_put_contents('/dummy','foo'); ob_start(); - OC_FILESYSTEM::readfile('/dummy'); + OC_Filesystem::readfile('/dummy'); $this->assertEquals('foo', ob_get_contents(),'Unexpected output of readfile'); ob_end_clean(); } public function isReadable(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - $this->assertEquals(true, OC_FILESYSTEM::is_readable('/dummy'),'Can\'t read created file'); + OC_Filesystem::file_put_contents('/dummy','foo'); + $this->assertEquals(true, OC_Filesystem::is_readable('/dummy'),'Can\'t read created file'); } public function isWritable(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - $this->assertEquals(true, OC_FILESYSTEM::is_writeable('/dummy'),'Can\'t write created file'); + OC_Filesystem::file_put_contents('/dummy','foo'); + $this->assertEquals(true, OC_Filesystem::is_writeable('/dummy'),'Can\'t write created file'); } public function fileatime(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); + OC_Filesystem::file_put_contents('/dummy','foo'); $time=time(); - $this->assertEquals(true,abs($time-OC_FILESYSTEM::fileatime('/dummy'))<1,'Unexpected access time');//there can be small difference between those values due to running time + $this->assertEquals(true,abs($time-OC_Filesystem::fileatime('/dummy'))<1,'Unexpected access time');//there can be small difference between those values due to running time } public function filectime(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); + OC_Filesystem::file_put_contents('/dummy','foo'); $time=time(); - $this->assertEquals(true,abs($time-OC_FILESYSTEM::filectime('/dummy'))<1,'Unexpected creation time');//there can be small difference between those values due to running time + $this->assertEquals(true,abs($time-OC_Filesystem::filectime('/dummy'))<1,'Unexpected creation time');//there can be small difference between those values due to running time } public function filemtime(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); + OC_Filesystem::file_put_contents('/dummy','foo'); $time=time(); - $this->assertEquals(true,abs($time-OC_FILESYSTEM::filemtime('/dummy'))<1,'Unexpected modified time');//there can be small difference between those values due to running time + $this->assertEquals(true,abs($time-OC_Filesystem::filemtime('/dummy'))<1,'Unexpected modified time');//there can be small difference between those values due to running time } public function fileGetContents(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - $this->assertEquals('foo', OC_FILESYSTEM::file_get_contents('/dummy'),'Unexpected content of file'); + OC_Filesystem::file_put_contents('/dummy','foo'); + $this->assertEquals('foo', OC_Filesystem::file_get_contents('/dummy'),'Unexpected content of file'); } public function unlink(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - OC_FILESYSTEM::unlink('/dummy'); - $this->assertEquals(false, OC_FILESYSTEM::file_exists('/dummy'),'File still exists after deletion'); + OC_Filesystem::file_put_contents('/dummy','foo'); + OC_Filesystem::unlink('/dummy'); + $this->assertEquals(false, OC_Filesystem::file_exists('/dummy'),'File still exists after deletion'); } public function rename(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - OC_FILESYSTEM::rename('/dummy','/bar'); - $this->assertEquals(true, OC_FILESYSTEM::file_exists('/bar'),'New file doesnt exists after moving'); - $this->assertEquals(false, OC_FILESYSTEM::file_exists('/dummy'),'Old file still exists after moving'); - $this->assertEquals('foo', OC_FILESYSTEM::file_get_contents('/bar'),'Unexpected content of file after moving'); + OC_Filesystem::file_put_contents('/dummy','foo'); + OC_Filesystem::rename('/dummy','/bar'); + $this->assertEquals(true, OC_Filesystem::file_exists('/bar'),'New file doesnt exists after moving'); + $this->assertEquals(false, OC_Filesystem::file_exists('/dummy'),'Old file still exists after moving'); + $this->assertEquals('foo', OC_Filesystem::file_get_contents('/bar'),'Unexpected content of file after moving'); } public function copy(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - OC_FILESYSTEM::copy('/dummy','/bar'); - $this->assertEquals(true, OC_FILESYSTEM::file_exists('/bar'),'New file doesnt exists after copying'); - $this->assertEquals(true, OC_FILESYSTEM::file_exists('/dummy'),'Old file doesnt exists after copying'); - $this->assertEquals('foo', OC_FILESYSTEM::file_get_contents('/bar'),'Unexpected content of file after copying'); + OC_Filesystem::file_put_contents('/dummy','foo'); + OC_Filesystem::copy('/dummy','/bar'); + $this->assertEquals(true, OC_Filesystem::file_exists('/bar'),'New file doesnt exists after copying'); + $this->assertEquals(true, OC_Filesystem::file_exists('/dummy'),'Old file doesnt exists after copying'); + $this->assertEquals('foo', OC_Filesystem::file_get_contents('/bar'),'Unexpected content of file after copying'); } public function fopen(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - $fh=OC_FILESYSTEM::fopen('/dummy','r'); + OC_Filesystem::file_put_contents('/dummy','foo'); + $fh=OC_Filesystem::fopen('/dummy','r'); if(!$fh){ $this->fail('Cant open file for reading'); } $content=fread($fh,3); $this->assertEquals('foo', $content,'Unexpected content of file'); fclose($fh); - $fh=OC_FILESYSTEM::fopen('/dummy','a'); + $fh=OC_Filesystem::fopen('/dummy','a'); fwrite($fh,'bar',3); fclose($fh); - $this->assertEquals('foobar', OC_FILESYSTEM::file_get_contents('/dummy'),'Unexpected content of file after appending'); - $fh=OC_FILESYSTEM::fopen('/dummy','w'); + $this->assertEquals('foobar', OC_Filesystem::file_get_contents('/dummy'),'Unexpected content of file after appending'); + $fh=OC_Filesystem::fopen('/dummy','w'); fwrite($fh,'bar',3); fclose($fh); - $this->assertEquals('bar', OC_FILESYSTEM::file_get_contents('/dummy'),'Unexpected content of file after writing'); + $this->assertEquals('bar', OC_Filesystem::file_get_contents('/dummy'),'Unexpected content of file after writing'); } public function toTmpFile(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - $tmp=OC_FILESYSTEM::toTmpFile('/dummy'); + OC_Filesystem::file_put_contents('/dummy','foo'); + $tmp=OC_Filesystem::toTmpFile('/dummy'); $this->assertEquals('foo', file_get_contents($tmp),'Unexpected content of temporary file'); unlink($tmp); } public function fromTmpFile(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - $tmp=OC_FILESYSTEM::toTmpFile('/dummy'); - OC_FILESYSTEM::fromTmpFile($tmp,'/bar'); - $this->assertEquals('foo', OC_FILESYSTEM::file_get_contents('/bar'),'Unexpected content of new file'); + OC_Filesystem::file_put_contents('/dummy','foo'); + $tmp=OC_Filesystem::toTmpFile('/dummy'); + OC_Filesystem::fromTmpFile($tmp,'/bar'); + $this->assertEquals('foo', OC_Filesystem::file_get_contents('/bar'),'Unexpected content of new file'); $this->assertEquals(false, file_exists($tmp),'Temporary file still exists'); } public function getMimeType(){ - OC_FILESYSTEM::file_put_contents('/dummy','some plain text'); - $this->assertEquals('text/plain', OC_FILESYSTEM::getMimeType('/dummy'),'Unexpected mimetype of pain text file'); - OC_FILESYSTEM::file_put_contents('/dummy',"\n"); - $this->assertEquals('application/xml', OC_FILESYSTEM::getMimeType('/dummy'),'Unexpected mimetype of xml file'); + OC_Filesystem::file_put_contents('/dummy','some plain text'); + $this->assertEquals('text/plain', OC_Filesystem::getMimeType('/dummy'),'Unexpected mimetype of pain text file'); + OC_Filesystem::file_put_contents('/dummy',"\n"); + $this->assertEquals('application/xml', OC_Filesystem::getMimeType('/dummy'),'Unexpected mimetype of xml file'); } public function delTree(){ - OC_FILESYSTEM::mkdir('/dummy'); - OC_FILESYSTEM::file_put_contents('/dummy/bar','foo'); - OC_FILESYSTEM::delTree('/dummy'); - $this->assertEquals(false, OC_FILESYSTEM::file_exists('/dummy/bar'),'File in deleted folder still exists'); - $this->assertEquals(false, OC_FILESYSTEM::file_exists('/dummy'),'Deleted folder still exists'); + OC_Filesystem::mkdir('/dummy'); + OC_Filesystem::file_put_contents('/dummy/bar','foo'); + OC_Filesystem::delTree('/dummy'); + $this->assertEquals(false, OC_Filesystem::file_exists('/dummy/bar'),'File in deleted folder still exists'); + $this->assertEquals(false, OC_Filesystem::file_exists('/dummy'),'Deleted folder still exists'); } public function getTree(){ - OC_FILESYSTEM::mkdir('/dummy'); - OC_FILESYSTEM::file_put_contents('/dummy/bar','foo'); + OC_Filesystem::mkdir('/dummy'); + OC_Filesystem::file_put_contents('/dummy/bar','foo'); $expected=array('/dummy','/dummy/bar'); - $this->assertEquals($expected, OC_FILESYSTEM::getTree('/dummy'),'Unexpected filelist returned'); + $this->assertEquals($expected, OC_Filesystem::getTree('/dummy'),'Unexpected filelist returned'); } public function hash(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - $this->assertEquals(md5('foo'), OC_FILESYSTEM::hash('md5','/dummy'),'Unexpected md5 hash of file'); + OC_Filesystem::file_put_contents('/dummy','foo'); + $this->assertEquals(md5('foo'), OC_Filesystem::hash('md5','/dummy'),'Unexpected md5 hash of file'); } public function freeSpace(){ - $oldSpace=OC_FILESYSTEM::free_space('/'); - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - $newSpace=OC_FILESYSTEM::free_space('/'); + $oldSpace=OC_Filesystem::free_space('/'); + OC_Filesystem::file_put_contents('/dummy','foo'); + $newSpace=OC_Filesystem::free_space('/'); $this->assertEquals(true, $newSpace<$oldSpace,'free space not smaller after creating a non empty file'); } public function search(){ - OC_FILESYSTEM::file_put_contents('/dummy','foo'); - $this->assertEquals(array('/dummy'),OC_FILESYSTEM::search('my'),'unexpected file list after search'); + OC_Filesystem::file_put_contents('/dummy','foo'); + $this->assertEquals(array('/dummy'),OC_Filesystem::search('my'),'unexpected file list after search'); } } return 'OC_FILEYSYSTEM_Test'; -- cgit v1.2.3 From 94e25ecb0c2dcd895fb080b3b2cf296d58676e17 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 29 Jul 2011 23:53:22 +0200 Subject: Some much needed interface work on the media player --- apps/media/ajax/api.php | 1 - apps/media/appinfo/app.php | 34 ++++++++- apps/media/css/music.css | 12 ++- apps/media/css/player.css | 2 +- apps/media/index.php | 22 ++++-- apps/media/js/collection.js | 126 ++++++++++++++++++++++++++++++++ apps/media/js/music.js | 91 ++++------------------- apps/media/js/player.js | 39 +++------- apps/media/js/playlist.js | 142 ++++++++++++++++++++++++++++++++++++ apps/media/lib_collection.php | 4 +- apps/media/templates/collection.php | 9 +++ apps/media/templates/music.php | 4 +- apps/media/templates/playlist.php | 30 ++++++++ 13 files changed, 393 insertions(+), 123 deletions(-) create mode 100644 apps/media/js/collection.js create mode 100644 apps/media/js/playlist.js create mode 100644 apps/media/templates/collection.php create mode 100644 apps/media/templates/playlist.php diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php index 225bce7b092..b86c69d0beb 100644 --- a/apps/media/ajax/api.php +++ b/apps/media/ajax/api.php @@ -67,7 +67,6 @@ if($arguments['action']){ $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']); } diff --git a/apps/media/appinfo/app.php b/apps/media/appinfo/app.php index d75bac031e9..fbfa441f93d 100644 --- a/apps/media/appinfo/app.php +++ b/apps/media/appinfo/app.php @@ -28,6 +28,36 @@ if(OC_App::getCurrentApp()=='files'){ 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 152c4583412..bd994e06341 100644 --- a/apps/media/index.php +++ b/apps/media/index.php @@ -33,18 +33,26 @@ if( !OC_User::isLoggedIn()){ require_once('lib_collection.php'); require_once('lib_scanner.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','playlist'); +OC_UTIL::addStyle('media','music'); -OC_App::setActiveNavigationEntry( 'media_index' ); +OC_APP::setActiveNavigationEntry( 'media_playlist' ); $tmpl = new OC_Template( 'media', 'music', 'user' ); -$player = new OC_Template( 'media', 'player'); +$player = new OC_TEMPLATE( 'media', 'player'); +$playlist = new OC_TEMPLATE( 'media', 'playlist'); +$collection= new OC_TEMPLATE( 'media', 'collection'); + $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..0a6e0e4eb3f --- /dev/null +++ b/apps/media/js/collection.js @@ -0,0 +1,126 @@ +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'); + for(var i=0;i'); + for(var i=0;ispan').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..d43b260d1eb 100644 --- a/apps/media/js/music.js +++ b/apps/media/js/music.js @@ -1,85 +1,20 @@ $(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(); + }); + $('#plugins a[href="#playlist"]').click(function(){ + $('#plugins li.subentry a.active').removeClass('active'); + $(this).addClass('active'); + PlayList.render(); + Collection.hide(); }); }); -function displayCollection(collection){ - $('#collection').data('collection',collection); - $.each(collection,function(index,artist){ - var artistNode=$('
  • '+artist.artist_name+'
      '); - artistNode.data('name',artist.artist_name); - artistNode.data('stuff',artist); - $('#collection>ul').append(artistNode); - $.each(artist.albums,function(index,album){ - var albumNode=$('
    • '+album.album_name+'
        '); - albumNode.data('name',album.album_name); - albumNode.data('stuff',album); - artistNode.children('ul').append(albumNode); - $.each(album.songs,function(index,song){ - var songNode=$('
      • '+song.song_name+'
      • '); - 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; - }); - $('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(); - } - -} + function getUrlVars(){ var vars = [], hash; @@ -94,7 +29,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..7beb01b6013 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){ @@ -66,6 +67,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 +85,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 +96,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'+song.artist+' - '+song.album+' - '+song.name+''); - 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..570e725b57e --- /dev/null +++ b/apps/media/js/playlist.js @@ -0,0 +1,142 @@ +PlayList.render=function(){ + $('#playlist').show(); + PlayList.parent.empty(); + for(var i=0;i'); + 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($('td.name input:checkbox').length==$('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 $('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 + $('td.name input:checkbox').attr('checked', true); + $('td.name input:checkbox').parent().parent().addClass('selected'); + }else{ + // Uncheck all + $('td.name input:checkbox').attr('checked', false); + $('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'); + 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_collection.php b/apps/media/lib_collection.php index d9f567aa682..5a16aaee848 100644 --- a/apps/media/lib_collection.php +++ b/apps/media/lib_collection.php @@ -128,7 +128,7 @@ class OC_MEDIA_COLLECTION{ $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/templates/collection.php b/apps/media/templates/collection.php new file mode 100644 index 00000000000..e132eeae07a --- /dev/null +++ b/apps/media/templates/collection.php @@ -0,0 +1,9 @@ +
          +
        • + loadingLoading Collection... +
        • +
        • + + +
        • +
        \ 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 @@ -
          -
            \ No newline at end of file + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
            NameArtistAlbumTimePlays
            + The playlist is empty +
            + + +
            \ No newline at end of file -- cgit v1.2.3 From aa7c6f057bafceabfcfcedf8882044921e96f53b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 30 Jul 2011 00:05:44 +0200 Subject: fix issue with selecting songs in playlist --- apps/media/js/playlist.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/media/js/playlist.js b/apps/media/js/playlist.js index 570e725b57e..c278c507fab 100644 --- a/apps/media/js/playlist.js +++ b/apps/media/js/playlist.js @@ -46,7 +46,7 @@ PlayList.render=function(){ event.stopPropagation(); if($(this).attr('checked')){ $(this).parent().parent().addClass('selected'); - if($('td.name input:checkbox').length==$('td.name input:checkbox:checked').length){ + if($('tbody td.name input:checkbox').length==$('tbody td.name input:checkbox:checked').length){ $('#selectAll').attr('checked',true); } }else{ @@ -59,7 +59,7 @@ PlayList.render=function(){ } } PlayList.getSelected=function(){ - return $('td.name input:checkbox:checked').parent().parent(); + return $('tbody td.name input:checkbox:checked').parent().parent(); } PlayList.hide=function(){ $('#playlist').hide(); @@ -71,12 +71,12 @@ $(document).ready(function(){ $('#selectAll').click(function(){ if($(this).attr('checked')){ // Check all - $('td.name input:checkbox').attr('checked', true); - $('td.name input:checkbox').parent().parent().addClass('selected'); + $('tbody td.name input:checkbox').attr('checked', true); + $('tbody td.name input:checkbox').parent().parent().addClass('selected'); }else{ // Uncheck all - $('td.name input:checkbox').attr('checked', false); - $('td.name input:checkbox').parent().parent().removeClass('selected'); + $('tbody td.name input:checkbox').attr('checked', false); + $('tbody td.name input:checkbox').parent().parent().removeClass('selected'); } procesSelection(); }); -- cgit v1.2.3 From 93dd1c57ccc68ec36b6a1deba5af2026990b2e4c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 30 Jul 2011 00:21:24 +0200 Subject: update playcount correctly without having to reload the collection --- apps/media/index.php | 1 - apps/media/js/collection.js | 21 ++++++++++++++++++--- apps/media/js/player.js | 4 ++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/apps/media/index.php b/apps/media/index.php index bd994e06341..0fe7c12f63c 100644 --- a/apps/media/index.php +++ b/apps/media/index.php @@ -39,7 +39,6 @@ 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','playlist'); OC_UTIL::addStyle('media','music'); OC_APP::setActiveNavigationEntry( 'media_playlist' ); diff --git a/apps/media/js/collection.js b/apps/media/js/collection.js index 0a6e0e4eb3f..5aa0d058bdc 100644 --- a/apps/media/js/collection.js +++ b/apps/media/js/collection.js @@ -23,7 +23,6 @@ Collection={ for(var w=0;w Date: Sat, 30 Jul 2011 00:32:09 +0200 Subject: open the correct subpage when the media player loads --- apps/media/js/music.js | 4 ++++ apps/media/js/playlist.js | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/media/js/music.js b/apps/media/js/music.js index d43b260d1eb..b2464c3842f 100644 --- a/apps/media/js/music.js +++ b/apps/media/js/music.js @@ -12,6 +12,10 @@ $(document).ready(function(){ PlayList.render(); Collection.hide(); }); + var tab=window.location.href.slice(window.location.href.indexOf('#') + 1); + if(tab=='collection'){ + $('#plugins a[href="#collection"]').trigger('click'); + } }); diff --git a/apps/media/js/playlist.js b/apps/media/js/playlist.js index c278c507fab..54fe5b792e7 100644 --- a/apps/media/js/playlist.js +++ b/apps/media/js/playlist.js @@ -26,8 +26,7 @@ PlayList.render=function(){ tr.data('index',i); tr.click(function(){ PlayList.play($(this).data('index')); - PlayList.parent.children('tr').removeClass('current'); - $(this).addClass('current'); + PlayList.render(); }); tr.hover(function(){ var button=$(''); -- cgit v1.2.3 From eee2a2266d66c5571aad1d71d9dd2b86c8adfabf Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 30 Jul 2011 03:25:15 +0200 Subject: disable unimplemented subentries for media player --- apps/media/appinfo/app.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/media/appinfo/app.php b/apps/media/appinfo/app.php index fbfa441f93d..d611e59eb31 100644 --- a/apps/media/appinfo/app.php +++ b/apps/media/appinfo/app.php @@ -46,18 +46,18 @@ $entry = array( '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); +// $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); ?> -- cgit v1.2.3 From 51e00d074cf4f1481c96f6a18da9c8ab7f412393 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 30 Jul 2011 04:15:09 +0200 Subject: add play button to collection overview to add songs to the playlist and play them imediatly --- apps/media/js/collection.js | 27 ++++++++++++++++++--------- apps/media/templates/collection.php | 3 ++- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/apps/media/js/collection.js b/apps/media/js/collection.js index 5aa0d058bdc..b8fd515ba60 100644 --- a/apps/media/js/collection.js +++ b/apps/media/js/collection.js @@ -53,10 +53,9 @@ Collection={ li.data('artist',artist); li.removeClass('template'); li.addClass('artist'); + li.data('type','artist'); li.children('span').text(artist.artist_name); - li.children('button').click(function(){ - PlayList.add($(this).parent().data('artist')); - }) + Collection.addButtons(li); Collection.parent.append(li); } } @@ -81,10 +80,9 @@ Collection={ li.removeClass('template'); li.addClass('album'); li.data('album',album); + li.data('type','album'); li.children('span').text(album.album_name); - li.children('button').click(function(){ - PlayList.add($(this).parent().data('album')); - }) + Collection.addButtons(li); ul.append(li); } artistLi.append(ul); @@ -102,10 +100,9 @@ Collection={ li.removeClass('template'); li.addClass('song'); li.data('song',song); + li.data('type','song'); li.children('span').text(song.song_name); - li.children('button').click(function(){ - PlayList.add($(this).parent().data('song')); - }) + Collection.addButtons(li); ul.append(li); } albumLi.append(ul); @@ -124,6 +121,18 @@ Collection={ } } } + }, + 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); + }); } } diff --git a/apps/media/templates/collection.php b/apps/media/templates/collection.php index e132eeae07a..e2c256a6480 100644 --- a/apps/media/templates/collection.php +++ b/apps/media/templates/collection.php @@ -4,6 +4,7 @@
          • - + +
          \ No newline at end of file -- cgit v1.2.3 From 924cd17f2ed18dcc860a5e15543c3fc835203c4c Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Sat, 30 Jul 2011 08:56:08 +0200 Subject: Icewind destroyed my changes :-( --- apps/media/appinfo/app.php | 12 ++++++------ apps/media/index.php | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/media/appinfo/app.php b/apps/media/appinfo/app.php index d611e59eb31..b29b842d23a 100644 --- a/apps/media/appinfo/app.php +++ b/apps/media/appinfo/app.php @@ -28,8 +28,8 @@ if(OC_App::getCurrentApp()=='files'){ 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( @@ -38,26 +38,26 @@ $entry = array( 'href' => '#playlist', 'name' => 'Playlist' ); -OC_APP::addNavigationSubEntry( "media_index", $entry); +OC_App::addNavigationSubEntry( "media_index", $entry); $entry = array( 'id' => "media_collection", 'order'=>1, 'href' => '#collection', 'name' => 'Collection' ); -OC_APP::addNavigationSubEntry( "media_index", $entry); +OC_App::addNavigationSubEntry( "media_index", $entry); // $entry = array( // 'id' => "media_recent", // 'order'=>1, // 'href' => '#recent', // 'name' => 'Most Recent' // ); -// OC_APP::addNavigationSubEntry( "media_index", $entry); +// OC_App::addNavigationSubEntry( "media_index", $entry); // $entry = array( // 'id' => "media_mostplayer", // 'order'=>1, // 'href' => '#mostplayed', // 'name' => 'Most Played' // ); -// OC_APP::addNavigationSubEntry( "media_index", $entry); +// OC_App::addNavigationSubEntry( "media_index", $entry); ?> diff --git a/apps/media/index.php b/apps/media/index.php index 0fe7c12f63c..43423d27de6 100644 --- a/apps/media/index.php +++ b/apps/media/index.php @@ -33,21 +33,21 @@ if( !OC_User::isLoggedIn()){ require_once('lib_collection.php'); require_once('lib_scanner.php'); -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_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_playlist' ); +OC_App::setActiveNavigationEntry( 'media_playlist' ); $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'); +$playlist = new OC_Template( 'media', 'playlist'); +$collection= new OC_Template( 'media', 'collection'); $tmpl->assign('player',$player->fetchPage()); $tmpl->assign('playlist',$playlist->fetchPage()); -- cgit v1.2.3 From bb5e6c9823a6c89f9eecd82c45d48f664063cace Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 30 Jul 2011 10:20:05 +0200 Subject: Transifex connection, added French and part of Bulgarian --- .tx/config | 28 +++++++++ admin/l10n/da.php | 5 +- admin/l10n/de.php | 4 +- admin/l10n/fr.php | 20 +++++++ admin/l10n/nl.php | 3 +- admin/l10n/pl.php | 8 +-- core/l10n/bg_BG.php | 17 ++++++ core/l10n/da.php | 12 +--- core/l10n/de.php | 35 ++++++------ core/l10n/fr.php | 28 +++++++++ core/l10n/nl.php | 12 +--- core/l10n/pl.php | 12 +--- files/templates/part.list.php | 2 +- help/l10n/bg_BG.php | 4 ++ help/l10n/fr.php | 4 ++ l10n/bg_BG/core.po | 128 +++++++++++++++++++++++++++++++++++++++++ l10n/bg_BG/help.po | 28 +++++++++ l10n/bg_BG/log.po | 68 ++++++++++++++++++++++ l10n/bg_BG/settings.po | 88 ++++++++++++++++++++++++++++ l10n/da/admin.po | 65 ++++++++++----------- l10n/da/core.po | 87 +++++++++++++++------------- l10n/da/help.po | 21 +++---- l10n/da/log.po | 21 +++---- l10n/da/settings.po | 22 +++---- l10n/de/admin.po | 58 ++++++++++--------- l10n/de/core.po | 100 +++++++++++++++++--------------- l10n/de/help.po | 25 ++++---- l10n/de/log.po | 21 +++---- l10n/de/settings.po | 23 ++++---- l10n/fr/admin.po | 93 ++++++++++++++++++++++++++++++ l10n/fr/core.po | 130 ++++++++++++++++++++++++++++++++++++++++++ l10n/fr/help.po | 28 +++++++++ l10n/fr/log.po | 68 ++++++++++++++++++++++ l10n/fr/settings.po | 88 ++++++++++++++++++++++++++++ l10n/nl/admin.po | 56 +++++++++--------- l10n/nl/core.po | 83 ++++++++++++++------------- l10n/nl/help.po | 23 ++++---- l10n/nl/log.po | 21 +++---- l10n/nl/settings.po | 19 +++--- l10n/pl/admin.po | 61 ++++++++++---------- l10n/pl/core.po | 89 +++++++++++++++-------------- l10n/pl/help.po | 24 ++++---- l10n/pl/log.po | 22 +++---- l10n/pl/settings.po | 22 +++---- l10n/templates/admin.pot | 91 ----------------------------- l10n/templates/core.pot | 124 ---------------------------------------- l10n/templates/help.pot | 26 --------- l10n/templates/log.pot | 66 --------------------- l10n/templates/settings.pot | 86 ---------------------------- log/l10n/bg_BG.php | 14 +++++ log/l10n/fr.php | 14 +++++ settings/l10n/bg_BG.php | 19 ++++++ settings/l10n/fr.php | 19 ++++++ 53 files changed, 1363 insertions(+), 872 deletions(-) create mode 100644 .tx/config create mode 100644 admin/l10n/fr.php create mode 100644 core/l10n/bg_BG.php create mode 100644 core/l10n/fr.php create mode 100644 help/l10n/bg_BG.php create mode 100644 help/l10n/fr.php create mode 100644 l10n/bg_BG/core.po create mode 100644 l10n/bg_BG/help.po create mode 100644 l10n/bg_BG/log.po create mode 100644 l10n/bg_BG/settings.po create mode 100644 l10n/fr/admin.po create mode 100644 l10n/fr/core.po create mode 100644 l10n/fr/help.po create mode 100644 l10n/fr/log.po create mode 100644 l10n/fr/settings.po delete mode 100644 l10n/templates/admin.pot delete mode 100644 l10n/templates/core.pot delete mode 100644 l10n/templates/help.pot delete mode 100644 l10n/templates/log.pot delete mode 100644 l10n/templates/settings.pot create mode 100644 log/l10n/bg_BG.php create mode 100644 log/l10n/fr.php create mode 100644 settings/l10n/bg_BG.php create mode 100644 settings/l10n/fr.php diff --git a/.tx/config b/.tx/config new file mode 100644 index 00000000000..55ae6df0f4e --- /dev/null +++ b/.tx/config @@ -0,0 +1,28 @@ +[main] +host = https://www.transifex.net + +[owncloud.admin] +file_filter = l10n//admin.po +source_file = l10n/templates/admin.pot +source_lang = en + +[owncloud.core] +file_filter = l10n//core.po +source_file = l10n/templates/core.pot +source_lang = en + +[owncloud.help] +file_filter = l10n//help.po +source_file = l10n/templates/help.pot +source_lang = en + +[owncloud.log] +file_filter = l10n//log.po +source_file = l10n/templates/log.pot +source_lang = en + +[owncloud.settings] +file_filter = l10n//settings.po +source_file = l10n/templates/settings.pot +source_lang = en + diff --git a/admin/l10n/da.php b/admin/l10n/da.php index 477dd9db9e2..467c259dc37 100644 --- a/admin/l10n/da.php +++ b/admin/l10n/da.php @@ -7,11 +7,10 @@ "Modified" => "Ændret", "Administration" => "Administration", "System Settings" => "System indstillinger", -"Add user" => "Tilføj bruger", +"Users" => "Brugere", +"Groups" => "Grupper", "Password" => "Kodeord", -"Create user" => "Lav bruger", "remove" => "slet", -"Groups" => "Grupper", "Create group" => "Lav gruppe", "Force new password:" => "Tving ny adgangskode", "Set" => "Indstil", diff --git a/admin/l10n/de.php b/admin/l10n/de.php index 9d1b12b1a16..a1a0ec099e7 100644 --- a/admin/l10n/de.php +++ b/admin/l10n/de.php @@ -7,10 +7,10 @@ "Modified" => "Änderungsdatum", "Administration" => "Verwaltung", "System Settings" => "Systemeinstellungen", +"Users" => "Nutzer", "Groups" => "Gruppen", -"Add user" => "Nutzer hinzufügen", "Password" => "Passwort", -"Create user" => "Nutzer erstellen", +"Create" => "Erstellen", "remove" => "entfernen", "Create group" => "Gruppe erstellen", "Force new password:" => "Neues Passwort:", diff --git a/admin/l10n/fr.php b/admin/l10n/fr.php new file mode 100644 index 00000000000..e8d41a4be72 --- /dev/null +++ b/admin/l10n/fr.php @@ -0,0 +1,20 @@ + "en lire plus", +"INSTALL" => "INSTALLATION", +"Apps Repository" => "Répertoire d'applications", +"Cannot connect to apps repository" => "Impossible de se connecter au répertoire d'applications", +"Name" => "Nom", +"Modified" => "Modifié le", +"Administration" => "Administration", +"System Settings" => "Préférences Système", +"Users" => "Utilisateurs", +"Groups" => "Groupes", +"Password" => "Mot de passe", +"Create" => "Créer", +"remove" => "retirer", +"Create group" => "Créer un groupe", +"Force new password:" => "Forcer un nouveau mot de passe :", +"Set" => "Appliquer", +"Do you really want to delete user" => "Voulez-vous réellement supprimer cet utilisateur", +"Do you really want to delete group" => "Voulez-vous réellement supprimer ce groupe" +); diff --git a/admin/l10n/nl.php b/admin/l10n/nl.php index cfbc1b0f515..138c95d2c98 100644 --- a/admin/l10n/nl.php +++ b/admin/l10n/nl.php @@ -7,10 +7,9 @@ "Modified" => "Laatst aangepast", "Administration" => "Administratie", "System Settings" => "Systeeminstellingen", +"Users" => "Gebruikers", "Groups" => "Groepen", -"Add user" => "Gebruiker toevoegen", "Password" => "Wachtwoord", -"Create user" => "Gebruiker aanmaken", "remove" => "verwijder", "Create group" => "Groep aanmaken", "Force new password:" => "Forceer nieuw wachtwoord:", diff --git a/admin/l10n/pl.php b/admin/l10n/pl.php index 9995c5da56f..169bb37b109 100644 --- a/admin/l10n/pl.php +++ b/admin/l10n/pl.php @@ -7,15 +7,13 @@ "Modified" => "Zmodyfikowano", "Administration" => "Administracja", "System Settings" => "Ustawienia systemowe", -"Add user" => "Dodaj użytkownika", +"Users" => "Użytkownicy", +"Groups" => "Grupy", "Password" => "Hasło", -"Create user" => "Utwórz użytkownika", "remove" => "usuń", -"Groups" => "Grupy", "Create group" => "Utwórz grupę", "Force new password:" => "Wymuś nowe hasło", "Set" => "Ustaw", "Do you really want to delete user" => "Czy naprawdę chcesz usunąć użytkownika", -"Do you really want to delete group" => "Czy naprawdę chcesz usunąć grupę", -"Users" => "Użytkownicy" +"Do you really want to delete group" => "Czy naprawdę chcesz usunąć grupę" ); diff --git a/core/l10n/bg_BG.php b/core/l10n/bg_BG.php new file mode 100644 index 00000000000..bd9886fcd90 --- /dev/null +++ b/core/l10n/bg_BG.php @@ -0,0 +1,17 @@ + "Грешка 404, обклакът не намерен", +"Advanced" => "Разширено", +"Set where to store the data." => "Изберете къде да записва данните", +"Data directory:" => "Директория за данни:", +"SQLite" => "SQLite", +"Database name:" => "Име на базата:", +"Host:" => "хост:", +"Table prefix:" => "Префикс за таблиците:", +"Finish setup" => "Завършване на настройките", +"ownCloud is a personal cloud which runs on your own server.

          " => "ownCloud е персонален облак който работи от Ваш собствен сървър.

          ", +"Login failed!" => "Входа пропадна!", +"You are logged out." => "Вие излязохте.", +"prev" => "пред.", +"next" => "следващо", +"Search" => "Търсене" +); diff --git a/core/l10n/da.php b/core/l10n/da.php index 631201bab60..20d769f3856 100644 --- a/core/l10n/da.php +++ b/core/l10n/da.php @@ -1,22 +1,12 @@ "Fejl 404, Skyen kan ikke findes", -"Welcome to ownCloud, your personnal cloud." => "Velkommen til ownCloud, din personlige Sky.", -"To finish the installation, please follow the steps below." => "For at fuldføre installationen, følg venligst nedenstående trin", -"Create an admin account." => "Lav en administrator konto.", -"Login:" => "Login:", -"Password:" => "Kodeord:", "Advanced" => "Avanceret", "Set where to store the data." => "Indstil data mappe.", "Data directory:" => "Data mappe:", -"Configure your database." => "Konfigurer din database.", -"I will use a SQLite database. You have nothing to do!" => "Jeg vil benytte en SQLite database. Du skal ikke gøre noget!", "SQLite" => "SQLite", -"I will use a MySQL database." => "Jeg vil benytte en MySQL database.", -"Host:" => "Host:", "Database name:" => "Database navn:", +"Host:" => "Host:", "Table prefix:" => "Tabel prefix:", -"MySQL user login:" => "MySQL bruger login:", -"MySQL user password:" => "MySQL bruger password:", "Finish setup" => "Afslut installation", "ownCloud is a personal cloud which runs on your own server.

          " => "ownCloud er din personly sky der køre på din egen server.

          ", "Login failed!" => "Login mislykkedes", diff --git a/core/l10n/de.php b/core/l10n/de.php index b1309beed06..9b5225dd0fa 100644 --- a/core/l10n/de.php +++ b/core/l10n/de.php @@ -1,27 +1,28 @@ "Cloud konnte nicht gefunden werden.", -"Welcome to ownCloud, your personnal cloud." => "Willkommen bei ownCloud, deinem persönlichen Online-Speicher.", -"To finish the installation, please follow the steps below." => "Die Installation ist fast abgeschlossen.", -"Create an admin account." => "Verwaltungskonto erstellen.", -"Login:" => "Benutzername:", -"Password:" => "Passwort:", +"ownCloud is your personal web storage." => "ownCloud ist dein persönlicher Online-Speicher.", +"Finish the setup by following the steps below." => "Die Installation ist fast abgeschlossen.", +"Create an admin account." => "Verwalter-Konto erstellen", +"Username" => "Nutzername", +"Password" => "Passwort", "Advanced" => "Erweitert", "Set where to store the data." => "Speicherort der Daten", "Data directory:" => "Datenverzeichnis:", -"Configure your database." => "Datenbank einstellen.", -"I will use a SQLite database. You have nothing to do!" => "Es wird eine SQLite-Datenbank genutzt.", +"Configure the database." => "Datenbank einrichten", +"SQLite will be used for the database. You have nothing to do." => "SQLite wird als Datenbank genutzt.", "SQLite" => "SQLite", -"I will use a MySQL database." => "Es wird eine MySQL-Datenbank genutzt.", -"Host:" => "Host:", +"MySQL will be used for the database." => "MySQL wird als Datenbank genutzt.", +"MySQL username:" => "MySQL-Nutzername:", +"MySQL password:" => "MySQL-Passwort:", "Database name:" => "Datenbankname:", +"Host:" => "Host:", "Table prefix:" => "Tabellenpräfix:", -"MySQL user login:" => "MySQL-Nutzername:", -"MySQL user password:" => "MySQL-Passwort:", +"Finish setup" => "Installation abschließen", "ownCloud is a personal cloud which runs on your own server.

          " => "ownCloud ist ein privater Online-Speicher für deinen eigenen Server.

          ", -"Login failed!" => "Anmeldung Fehlgeschlagen!", -"You are logged out." => "Sie wurden abgemeldet.", -"prev" => "zurück", -"next" => "weiter", -"Search" => "Suchen", -"Finish setup" => "Installation abschließen" +"Login failed!" => "Anmeldung fehlgeschlagen!", +"Remember login" => "Anmeldung merken", +"You are logged out." => "Erfolgreich abgemeldet.", +"prev" => "Zurück", +"next" => "Weiter", +"Search" => "Suchen" ); diff --git a/core/l10n/fr.php b/core/l10n/fr.php new file mode 100644 index 00000000000..540eaef9ca9 --- /dev/null +++ b/core/l10n/fr.php @@ -0,0 +1,28 @@ + "Erreur 404, la page demandée n'existe pas", +"ownCloud is your personal web storage." => "ownCloud est votre espace de stockage web personnel.", +"Finish the setup by following the steps below." => "Terminez l'installation en suivant les étapes ci-dessous.", +"Create an admin account." => "Veuillez créer un compte administrateur.", +"Username" => "Nom d'utilisateur", +"Password" => "Mot de passe", +"Advanced" => "Avancé", +"Set where to store the data." => "Sélectionnez où sauvegarder les données", +"Data directory:" => "Répertoire de données", +"Configure the database." => "Configurez la base de données.", +"SQLite will be used for the database. You have nothing to do." => "SQLite sera utilisé comme moteur pour la base de données. Vous n'avez rien de plus à faire.", +"SQLite" => "SQLite", +"MySQL will be used for the database." => "MySQL sera utilisé comme moteur pour la base de données.", +"MySQL username:" => "Nom d'utilisateur MySQL :", +"MySQL password:" => "Mot de passe MySQL :", +"Database name:" => "Nom de la base de données :", +"Host:" => "Hôte :", +"Table prefix:" => "Préfixe de table :", +"Finish setup" => "Terminer l'installation", +"ownCloud is a personal cloud which runs on your own server.

          " => "ownCloud est votre solution cloud personnelle qui tourne sur votre propre serveur.

          ", +"Login failed!" => "Échec de la connexion !", +"Remember login" => "Se souvenir de moi", +"You are logged out." => "Vous êtes désormais déconnecté.", +"prev" => "précédent", +"next" => "suivant", +"Search" => "Rechercher" +); diff --git a/core/l10n/nl.php b/core/l10n/nl.php index 66d96505971..033adc0e432 100644 --- a/core/l10n/nl.php +++ b/core/l10n/nl.php @@ -1,22 +1,12 @@ "Fout 404, Cloud niet gevonden.", -"Welcome to ownCloud, your personnal cloud." => "Welkom by ownCloud, uw persoonlijke cloud", -"To finish the installation, please follow the steps below." => "Volg de volgende stappen om de installatie te voltooien.", -"Create an admin account." => "Maak een beheerdersaccount aan", -"Login:" => "Gebruikersnaam:", -"Password:" => "Wachtwoord:", "Advanced" => "Geavanceerd", "Set where to store the data." => "Bepaal de opslaglocatie.", "Data directory:" => "Gegevensmap:", -"Configure your database." => "Configureer uw database.", -"I will use a SQLite database. You have nothing to do!" => "Er zal een SQLite database gebruikt worden. U hoeft geen verdere instellingen te maken.", "SQLite" => "SQLite", -"I will use a MySQL database." => "Er zal een MySQL database gebruikt worden.", -"Host:" => "Host:", "Database name:" => "Databasenaam:", +"Host:" => "Host:", "Table prefix:" => "Voorvoegsel voor tabelnamen:", -"MySQL user login:" => "MySQL gebruikersnaam.", -"MySQL user password:" => "MySQL wachtwoord", "Finish setup" => "Installatie afronden", "ownCloud is a personal cloud which runs on your own server.

          " => "ownCloud is een persoonlijke cloud die op uw eigen server draait.

          ", "Login failed!" => "Aanmelden mislukt.", diff --git a/core/l10n/pl.php b/core/l10n/pl.php index 6914e11557a..3e4993d4827 100644 --- a/core/l10n/pl.php +++ b/core/l10n/pl.php @@ -1,22 +1,12 @@ "Błąd 404, Chmura nie znaleziona", -"Welcome to ownCloud, your personnal cloud." => "Witaj w ownCloud, Twojej osobistej chmurze.", -"To finish the installation, please follow the steps below." => "By zakończyć instalację, podążaj poniższymi krokami.", -"Create an admin account." => "Utwórz konto administratora.", -"Login:" => "Login:", -"Password:" => "Hasło:", "Advanced" => "Zaawansowane", "Set where to store the data." => "Ustaw, gdzie przechowywać dane.", "Data directory:" => "Katalog danych:", -"Configure your database." => "Skonfiguruj Twoją bazę danych.", -"I will use a SQLite database. You have nothing to do!" => "Użyję bazy SQLite. Nie masz tu nic do roboty!", "SQLite" => "SQLite", -"I will use a MySQL database." => "Użyję bazy danych MySQL.", -"Host:" => "Host:", "Database name:" => "Nazwa bazy:", +"Host:" => "Host:", "Table prefix:" => "Przedrostek tabeli:", -"MySQL user login:" => "Login użytkownika MySQL:", -"MySQL user password:" => "Hasło użytkownika MySQL:", "Finish setup" => "Zakończ instalację", "ownCloud is a personal cloud which runs on your own server.

          " => "ownCloud jest osobistą chmurą działającą na Twoim własnym serwerze.

          ", "Login failed!" => "Nie udało się zalogować!", diff --git a/files/templates/part.list.php b/files/templates/part.list.php index d249455c55c..9ed3494732d 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -1,7 +1,7 @@ Nothing in here. Upload something!'; foreach($_['files'] as $file): $simple_file_size = simple_file_size($file['size']); - $simple_size_color = 200-intval($file['size']/(1024*1024)*5); + $simple_size_color = 200-intval($file['size']/(1024*1024)*2); if($simple_size_color<0) $simple_size_color = 0; $relative_modified_date = relative_modified_date($file['mtime']); $relative_date_color = round((time()-$file['mtime'])/60/60/24*7); //days ago diff --git a/help/l10n/bg_BG.php b/help/l10n/bg_BG.php new file mode 100644 index 00000000000..44f260693b3 --- /dev/null +++ b/help/l10n/bg_BG.php @@ -0,0 +1,4 @@ + "Въпроси и отговори", +"ASK A QUESTION" => "ЗАДАЙТЕ ВЪПРОС" +); diff --git a/help/l10n/fr.php b/help/l10n/fr.php new file mode 100644 index 00000000000..2b9bf96684d --- /dev/null +++ b/help/l10n/fr.php @@ -0,0 +1,4 @@ + "Questions / Réponses", +"ASK A QUESTION" => "Poser une question" +); diff --git a/l10n/bg_BG/core.po b/l10n/bg_BG/core.po new file mode 100644 index 00000000000..63deb14b5c5 --- /dev/null +++ b/l10n/bg_BG/core.po @@ -0,0 +1,128 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Stefan Ilivanov , 2011. +msgid "" +msgstr "" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-28 00:33+0000\n" +"Last-Translator: ep98 \n" +"Language-Team: Bulgarian (Bulgaria) (http://www.transifex.net/projects/p/owncloud/team/bg_BG/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg_BG\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +#: ../templates/404.php:15 +msgid "Error 404, Cloud not found" +msgstr "Грешка 404, обклакът не намерен" + +#: ../templates/installation.php:6 +msgid "ownCloud is your personal web storage." +msgstr "" + +#: ../templates/installation.php:7 +msgid "Finish the setup by following the steps below." +msgstr "" + +#: ../templates/installation.php:26 +msgid "Create an admin account." +msgstr "" + +#: ../templates/installation.php:27 +msgid "Username" +msgstr "" + +#: ../templates/installation.php:28 +msgid "Password" +msgstr "" + +#: ../templates/installation.php:31 +msgid "Advanced" +msgstr "Разширено" + +#: ../templates/installation.php:34 +msgid "Set where to store the data." +msgstr "Изберете къде да записва данните" + +#: ../templates/installation.php:35 +msgid "Data directory:" +msgstr "Директория за данни:" + +#: ../templates/installation.php:39 +msgid "Configure the database." +msgstr "" + +#: ../templates/installation.php:43 +msgid "SQLite will be used for the database. You have nothing to do." +msgstr "" + +#: ../templates/installation.php:46 +msgid "SQLite" +msgstr "SQLite" + +#: ../templates/installation.php:53 +msgid "MySQL will be used for the database." +msgstr "" + +#: ../templates/installation.php:59 +msgid "MySQL username:" +msgstr "" + +#: ../templates/installation.php:60 +msgid "MySQL password:" +msgstr "" + +#: ../templates/installation.php:61 +msgid "Database name:" +msgstr "Име на базата:" + +#: ../templates/installation.php:62 +msgid "Host:" +msgstr "хост:" + +#: ../templates/installation.php:63 +msgid "Table prefix:" +msgstr "Префикс за таблиците:" + +#: ../templates/installation.php:69 +msgid "Finish setup" +msgstr "Завършване на настройките" + +#: ../templates/layout.guest.php:33 +msgid "" +"ownCloud is a personal cloud which runs" +" on your own server.

          " +msgstr "" +"ownCloud е персонален облак който " +"работи от Ваш собствен сървър.

          " + +#: ../templates/login.php:6 +msgid "Login failed!" +msgstr "Входа пропадна!" + +#: ../templates/login.php:11 ../templates/login.php:15 +msgid "Remember login" +msgstr "" + +#: ../templates/logout.php:1 +msgid "You are logged out." +msgstr "Вие излязохте." + +#: ../templates/part.pagenavi.php:6 +msgid "prev" +msgstr "пред." + +#: ../templates/part.pagenavi.php:26 +msgid "next" +msgstr "следващо" + +#: ../templates/part.searchbox.php:3 +msgid "Search" +msgstr "Търсене" + + diff --git a/l10n/bg_BG/help.po b/l10n/bg_BG/help.po new file mode 100644 index 00000000000..b204195b8be --- /dev/null +++ b/l10n/bg_BG/help.po @@ -0,0 +1,28 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Stefan Ilivanov , 2011. +msgid "" +msgstr "" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 21:21+0000\n" +"Last-Translator: ep98 \n" +"Language-Team: Bulgarian (Bulgaria) (http://www.transifex.net/projects/p/owncloud/team/bg_BG/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg_BG\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +#: ../templates/index.php:2 +msgid "Questions and Answers" +msgstr "Въпроси и отговори" + +#: ../templates/index.php:24 +msgid "ASK A QUESTION" +msgstr "ЗАДАЙТЕ ВЪПРОС" + + diff --git a/l10n/bg_BG/log.po b/l10n/bg_BG/log.po new file mode 100644 index 00000000000..ff886397449 --- /dev/null +++ b/l10n/bg_BG/log.po @@ -0,0 +1,68 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Stefan Ilivanov , 2011. +msgid "" +msgstr "" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 21:23+0000\n" +"Last-Translator: ep98 \n" +"Language-Team: Bulgarian (Bulgaria) (http://www.transifex.net/projects/p/owncloud/team/bg_BG/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg_BG\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +#: ../templates/index.php:4 +msgid "Filter:" +msgstr "Филтър:" + +#: ../templates/index.php:7 +msgid "Logins" +msgstr "Влизания:" + +#: ../templates/index.php:8 +msgid "Logouts" +msgstr "Изходи:" + +#: ../templates/index.php:9 +msgid "Downloads" +msgstr "Тегления" + +#: ../templates/index.php:10 +msgid "Uploads" +msgstr "Качвания" + +#: ../templates/index.php:11 +msgid "Creations" +msgstr "Създавания:" + +#: ../templates/index.php:12 +msgid "Deletions" +msgstr "Изтривания:" + +#: ../templates/index.php:15 +msgid "Show:" +msgstr "Показва:" + +#: ../templates/index.php:16 +msgid "entries per page." +msgstr "записа на страница." + +#: ../templates/index.php:26 +msgid "What" +msgstr "Какво" + +#: ../templates/index.php:27 +msgid "When" +msgstr "Кога" + +#: ../templates/index.php:45 +msgid "Clear log entries before" +msgstr "Изчисти записите от журналите" + + diff --git a/l10n/bg_BG/settings.po b/l10n/bg_BG/settings.po new file mode 100644 index 00000000000..e6ad1aaf6ee --- /dev/null +++ b/l10n/bg_BG/settings.po @@ -0,0 +1,88 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Stefan Ilivanov , 2011. +msgid "" +msgstr "" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 21:25+0000\n" +"Last-Translator: ep98 \n" +"Language-Team: Bulgarian (Bulgaria) (http://www.transifex.net/projects/p/owncloud/team/bg_BG/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg_BG\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" + +#: ../templates/index.php:3 +msgid "Account information" +msgstr "Информация за профила" + +#: ../templates/index.php:5 +msgid "You're currently using" +msgstr "Вие ползвате" + +#: ../templates/index.php:5 +msgid "of your" +msgstr "на Вашето" + +#: ../templates/index.php:5 +msgid "space" +msgstr "място" + +#: ../templates/index.php:11 +msgid "Change Password" +msgstr "Промяна на парола" + +#: ../templates/index.php:12 +msgid "Your password got changed" +msgstr "Вашата парола е сменена" + +#: ../templates/index.php:15 +msgid "Old password:" +msgstr "Стара парола" + +#: ../templates/index.php:19 +msgid "New password" +msgstr "Нова парола" + +#: ../templates/index.php:24 +msgid "Show new password" +msgstr "Покажи новата парола" + +#: ../templates/index.php:34 +msgid "Language" +msgstr "Език" + +#: ../ajax/changepassword.php:13 ../ajax/setlanguage.php:13 +msgid "Authentication error" +msgstr "Проблем с индентификацията" + +#: ../ajax/changepassword.php:19 +msgid "You have to enter the old and the new password!" +msgstr "Трябва да въведете новата и старата парола!" + +#: ../ajax/changepassword.php:25 +msgid "Your old password is wrong!" +msgstr "Вашата стара парола е грешна!" + +#: ../ajax/changepassword.php:31 +msgid "Password changed" +msgstr "Паролата е сменена" + +#: ../ajax/changepassword.php:34 +msgid "Unable to change password" +msgstr "Невъзможна смяна на паролата" + +#: ../ajax/setlanguage.php:21 +msgid "Language changed" +msgstr "Езика е сменен" + +#: ../ajax/setlanguage.php:23 +msgid "Invalid request" +msgstr "Невалидна заявка" + + diff --git a/l10n/da/admin.po b/l10n/da/admin.po index be62e2cd3db..82c29165438 100644 --- a/l10n/da/admin.po +++ b/l10n/da/admin.po @@ -1,20 +1,21 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# +# +# Jan-Christoph Borchardt , 2011. msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: 2011-06-21 15:08+0100\n" -"Last-Translator: Mikkel Bjerg Larsen \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-28 00:09+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: Danish (http://www.transifex.net/projects/p/owncloud/team/da/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: da\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/app.php:22 msgid "read more" @@ -24,8 +25,7 @@ msgstr "læs mere" msgid "INSTALL" msgstr "INSTALLER" -#: ../templates/app_noconn.php:6 -#: ../templates/apps.php:6 +#: ../templates/app_noconn.php:6 ../templates/apps.php:6 msgid "Apps Repository" msgstr "Applikation arkiv" @@ -33,10 +33,8 @@ msgstr "Applikation arkiv" msgid "Cannot connect to apps repository" msgstr "Kan ikke oprette forbindelse til applikations arkivet" -#: ../templates/apps.php:13 -#: ../templates/users.php:6 -#: ../templates/users.php:20 -#: ../templates/users.php:50 +#: ../templates/apps.php:13 ../templates/users.php:6 ../templates/users.php:15 +#: ../templates/users.php:51 msgid "Name" msgstr "Navn" @@ -52,45 +50,44 @@ msgstr "Administration" msgid "System Settings" msgstr "System indstillinger" -#: ../templates/users.php:13 -msgid "Add user" -msgstr "Tilføj bruger" +#: ../templates/users.php:2 +msgid "Users" +msgstr "Brugere" -#: ../templates/users.php:21 +#: ../templates/users.php:7 ../templates/users.php:47 +msgid "Groups" +msgstr "Grupper" + +#: ../templates/users.php:16 msgid "Password" msgstr "Kodeord" -#: ../templates/users.php:30 -msgid "Create user" -msgstr "Lav bruger" +#: ../templates/users.php:25 +msgid "Create" +msgstr "" -#: ../templates/users.php:40 -#: ../templates/users.php:68 +#: ../templates/users.php:37 ../templates/users.php:69 msgid "remove" msgstr "slet" -#: ../templates/users.php:46 -#: ../templates/users.php:7 -msgid "Groups" -msgstr "Grupper" - -#: ../templates/users.php:58 +#: ../templates/users.php:59 msgid "Create group" msgstr "Lav gruppe" -#: ../templates/users.php:94 +#: ../templates/users.php:95 msgid "Force new password:" msgstr "Tving ny adgangskode" -#: ../templates/users.php:96 +#: ../templates/users.php:97 msgid "Set" msgstr "Indstil" -#: ../templates/users.php:102 +#: ../templates/users.php:103 msgid "Do you really want to delete user" msgstr "Vil du virkelig slette denne bruger?" -#: ../templates/users.php:109 +#: ../templates/users.php:110 msgid "Do you really want to delete group" msgstr "Vil du virkelig slette denne gruppe?" + diff --git a/l10n/da/core.po b/l10n/da/core.po index df83958287b..0b37d9ac8ce 100644 --- a/l10n/da/core.po +++ b/l10n/da/core.po @@ -1,44 +1,44 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# +# msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: 2011-06-21 15:10+0100\n" -"Last-Translator: Mikkel Bjerg Larsen \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-28 00:33+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: Danish (http://www.transifex.net/projects/p/owncloud/team/da/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: da\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/404.php:15 msgid "Error 404, Cloud not found" msgstr "Fejl 404, Skyen kan ikke findes" #: ../templates/installation.php:6 -msgid "Welcome to ownCloud, your personnal cloud." -msgstr "Velkommen til ownCloud, din personlige Sky." +msgid "ownCloud is your personal web storage." +msgstr "" #: ../templates/installation.php:7 -msgid "To finish the installation, please follow the steps below." -msgstr "For at fuldføre installationen, følg venligst nedenstående trin" +msgid "Finish the setup by following the steps below." +msgstr "" #: ../templates/installation.php:26 -msgid "Create an admin account." -msgstr "Lav en administrator konto." +msgid "Create an admin account." +msgstr "" #: ../templates/installation.php:27 -msgid "Login:" -msgstr "Login:" +msgid "Username" +msgstr "" #: ../templates/installation.php:28 -msgid "Password:" -msgstr "Kodeord:" +msgid "Password" +msgstr "" #: ../templates/installation.php:31 msgid "Advanced" @@ -53,53 +53,61 @@ msgid "Data directory:" msgstr "Data mappe:" #: ../templates/installation.php:39 -msgid "Configure your database." -msgstr "Konfigurer din database." +msgid "Configure the database." +msgstr "" #: ../templates/installation.php:43 -msgid "I will use a SQLite database. You have nothing to do!" -msgstr "Jeg vil benytte en SQLite database. Du skal ikke gøre noget!" +msgid "SQLite will be used for the database. You have nothing to do." +msgstr "" #: ../templates/installation.php:46 msgid "SQLite" msgstr "SQLite" #: ../templates/installation.php:53 -msgid "I will use a MySQL database." -msgstr "Jeg vil benytte en MySQL database." +msgid "MySQL will be used for the database." +msgstr "" #: ../templates/installation.php:59 -msgid "Host:" -msgstr "Host:" +msgid "MySQL username:" +msgstr "" #: ../templates/installation.php:60 -msgid "Database name:" -msgstr "Database navn:" +msgid "MySQL password:" +msgstr "" #: ../templates/installation.php:61 -msgid "Table prefix:" -msgstr "Tabel prefix:" +msgid "Database name:" +msgstr "Database navn:" #: ../templates/installation.php:62 -msgid "MySQL user login:" -msgstr "MySQL bruger login:" +msgid "Host:" +msgstr "Host:" #: ../templates/installation.php:63 -msgid "MySQL user password:" -msgstr "MySQL bruger password:" +msgid "Table prefix:" +msgstr "Tabel prefix:" -#: ../templates/installation.php:68 +#: ../templates/installation.php:69 msgid "Finish setup" msgstr "Afslut installation" -#: ../templates/layout.guest.php:20 -msgid "ownCloud is a personal cloud which runs on your own server.

          " -msgstr "ownCloud er din personly sky der køre på din egen server.

          " +#: ../templates/layout.guest.php:33 +msgid "" +"ownCloud is a personal cloud which runs" +" on your own server.

          " +msgstr "" +"ownCloud er din personly sky der køre " +"på din egen server.

          " #: ../templates/login.php:6 msgid "Login failed!" msgstr "Login mislykkedes" +#: ../templates/login.php:11 ../templates/login.php:15 +msgid "Remember login" +msgstr "" + #: ../templates/logout.php:1 msgid "You are logged out." msgstr "Du er nu logget ud" @@ -116,3 +124,4 @@ msgstr "næste" msgid "Search" msgstr "Søg" + diff --git a/l10n/da/help.po b/l10n/da/help.po index d09d34e0aa8..e3300adc4d4 100644 --- a/l10n/da/help.po +++ b/l10n/da/help.po @@ -1,26 +1,27 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# +# msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: 2011-06-21 15:02+0100\n" -"Last-Translator: Mikkel Bjerg Larsen \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:17+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: Danish (http://www.transifex.net/projects/p/owncloud/team/da/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: da\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/index.php:2 msgid "Questions and Answers" msgstr "Spørgsmål og Svar" -#: ../templates/index.php:21 +#: ../templates/index.php:24 msgid "ASK A QUESTION" msgstr "STIL ET SPØRGSMÅL" + diff --git a/l10n/da/log.po b/l10n/da/log.po index 4c81d97ea4b..b52c2ad512c 100644 --- a/l10n/da/log.po +++ b/l10n/da/log.po @@ -1,21 +1,20 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy +# msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:17+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: Danish (http://www.transifex.net/projects/p/owncloud/team/da/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: da\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/index.php:4 msgid "Filter:" @@ -64,3 +63,5 @@ msgstr "Hvornår" #: ../templates/index.php:45 msgid "Clear log entries before" msgstr "Slet log poster før" + + diff --git a/l10n/da/settings.po b/l10n/da/settings.po index c7981c921fb..17e84dbfcd0 100644 --- a/l10n/da/settings.po +++ b/l10n/da/settings.po @@ -1,20 +1,20 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# +# msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: 2011-06-21 15:00+0100\n" -"Last-Translator: Mikkel Bjerg Larsen \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:17+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: Danish (http://www.transifex.net/projects/p/owncloud/team/da/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: da\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/index.php:3 msgid "Account information" @@ -56,8 +56,7 @@ msgstr "Vis den nye adgangskode" msgid "Language" msgstr "Sprog" -#: ../ajax/changepassword.php:13 -#: ../ajax/setlanguage.php:13 +#: ../ajax/changepassword.php:13 ../ajax/setlanguage.php:13 msgid "Authentication error" msgstr "Godkendelsesfejl" @@ -85,3 +84,4 @@ msgstr "Sprog ændret" msgid "Invalid request" msgstr "Invalid forespørgsel" + diff --git a/l10n/de/admin.po b/l10n/de/admin.po index 58db3b78e6d..4495f3994e1 100644 --- a/l10n/de/admin.po +++ b/l10n/de/admin.po @@ -1,21 +1,21 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy +# +# Jan-Christoph Borchardt , 2011. msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-28 00:09+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: German (http://www.transifex.net/projects/p/owncloud/team/de/)\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/app.php:22 msgid "read more" @@ -33,8 +33,8 @@ msgstr "Anwendungen" msgid "Cannot connect to apps repository" msgstr "Verbindung fehlgeschlagen" -#: ../templates/apps.php:13 ../templates/users.php:6 ../templates/users.php:20 -#: ../templates/users.php:50 +#: ../templates/apps.php:13 ../templates/users.php:6 ../templates/users.php:15 +#: ../templates/users.php:51 msgid "Name" msgstr "Name" @@ -50,42 +50,44 @@ msgstr "Verwaltung" msgid "System Settings" msgstr "Systemeinstellungen" -#: ../templates/users.php:7 ../templates/users.php:46 +#: ../templates/users.php:2 +msgid "Users" +msgstr "Nutzer" + +#: ../templates/users.php:7 ../templates/users.php:47 msgid "Groups" msgstr "Gruppen" -#: ../templates/users.php:13 -msgid "Add user" -msgstr "Nutzer hinzufügen" - -#: ../templates/users.php:21 +#: ../templates/users.php:16 msgid "Password" msgstr "Passwort" -#: ../templates/users.php:30 -msgid "Create user" -msgstr "Nutzer erstellen" +#: ../templates/users.php:25 +msgid "Create" +msgstr "Erstellen" -#: ../templates/users.php:40 ../templates/users.php:68 +#: ../templates/users.php:37 ../templates/users.php:69 msgid "remove" msgstr "entfernen" -#: ../templates/users.php:58 +#: ../templates/users.php:59 msgid "Create group" msgstr "Gruppe erstellen" -#: ../templates/users.php:94 +#: ../templates/users.php:95 msgid "Force new password:" msgstr "Neues Passwort:" -#: ../templates/users.php:96 +#: ../templates/users.php:97 msgid "Set" msgstr "OK" -#: ../templates/users.php:102 +#: ../templates/users.php:103 msgid "Do you really want to delete user" msgstr "Möchtest du den Nutzer wirklich entfernen?" -#: ../templates/users.php:109 +#: ../templates/users.php:110 msgid "Do you really want to delete group" msgstr "Möchtest du die Gruppe wirklich entfernen?" + + diff --git a/l10n/de/core.po b/l10n/de/core.po index b78c7996190..20aa6c30ecc 100644 --- a/l10n/de/core.po +++ b/l10n/de/core.po @@ -1,45 +1,45 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy +# +# Jan-Christoph Borchardt , 2011. msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-28 12:04+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: German (http://www.transifex.net/projects/p/owncloud/team/de/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/404.php:15 msgid "Error 404, Cloud not found" msgstr "Cloud konnte nicht gefunden werden." #: ../templates/installation.php:6 -msgid "Welcome to ownCloud, your personnal cloud." -msgstr "Willkommen bei ownCloud, deinem persönlichen Online-Speicher." +msgid "ownCloud is your personal web storage." +msgstr "ownCloud ist dein persönlicher Online-Speicher." #: ../templates/installation.php:7 -msgid "To finish the installation, please follow the steps below." +msgid "Finish the setup by following the steps below." msgstr "Die Installation ist fast abgeschlossen." #: ../templates/installation.php:26 -msgid "Create an admin account." -msgstr "Verwaltungskonto erstellen." +msgid "Create an admin account." +msgstr "Verwalter-Konto erstellen" #: ../templates/installation.php:27 -msgid "Login:" -msgstr "Benutzername:" +msgid "Username" +msgstr "Nutzername" #: ../templates/installation.php:28 -msgid "Password:" -msgstr "Passwort:" +msgid "Password" +msgstr "Passwort" #: ../templates/installation.php:31 msgid "Advanced" @@ -54,69 +54,75 @@ msgid "Data directory:" msgstr "Datenverzeichnis:" #: ../templates/installation.php:39 -msgid "Configure your database." -msgstr "Datenbank einstellen." +msgid "Configure the database." +msgstr "Datenbank einrichten" #: ../templates/installation.php:43 -msgid "I will use a SQLite database. You have nothing to do!" -msgstr "Es wird eine SQLite-Datenbank genutzt." +msgid "SQLite will be used for the database. You have nothing to do." +msgstr "SQLite wird als Datenbank genutzt." #: ../templates/installation.php:46 msgid "SQLite" msgstr "SQLite" #: ../templates/installation.php:53 -msgid "I will use a MySQL database." -msgstr "Es wird eine MySQL-Datenbank genutzt." +msgid "MySQL will be used for the database." +msgstr "MySQL wird als Datenbank genutzt." #: ../templates/installation.php:59 -msgid "Host:" -msgstr "Host:" +msgid "MySQL username:" +msgstr "MySQL-Nutzername:" #: ../templates/installation.php:60 -msgid "Database name:" -msgstr "Datenbankname:" +msgid "MySQL password:" +msgstr "MySQL-Passwort:" #: ../templates/installation.php:61 -msgid "Table prefix:" -msgstr "Tabellenpräfix:" +msgid "Database name:" +msgstr "Datenbankname:" #: ../templates/installation.php:62 -msgid "MySQL user login:" -msgstr "MySQL-Nutzername:" +msgid "Host:" +msgstr "Host:" #: ../templates/installation.php:63 -msgid "MySQL user password:" -msgstr "MySQL-Passwort:" +msgid "Table prefix:" +msgstr "Tabellenpräfix:" -#: ../templates/layout.guest.php:17 ../templates/layout.guest.php:20 +#: ../templates/installation.php:69 +msgid "Finish setup" +msgstr "Installation abschließen" + +#: ../templates/layout.guest.php:33 msgid "" -"ownCloud is a personal cloud which runs " -"on your own server.

          " +"ownCloud is a personal cloud which runs" +" on your own server.

          " msgstr "" -"ownCloud ist ein privater Online-Speicher " -"für deinen eigenen Server.

          " +"ownCloud ist ein privater Online-" +"Speicher für deinen eigenen Server.

          " #: ../templates/login.php:6 msgid "Login failed!" -msgstr "Anmeldung Fehlgeschlagen!" +msgstr "Anmeldung fehlgeschlagen!" + +#: ../templates/login.php:11 ../templates/login.php:15 +msgid "Remember login" +msgstr "Anmeldung merken" #: ../templates/logout.php:1 msgid "You are logged out." -msgstr "Sie wurden abgemeldet." +msgstr "Erfolgreich abgemeldet." #: ../templates/part.pagenavi.php:6 msgid "prev" -msgstr "zurück" +msgstr "Zurück" #: ../templates/part.pagenavi.php:26 msgid "next" -msgstr "weiter" +msgstr "Weiter" #: ../templates/part.searchbox.php:3 msgid "Search" msgstr "Suchen" -#: ../templates/installation.php:68 -msgid "Finish setup" -msgstr "Installation abschließen" + diff --git a/l10n/de/help.po b/l10n/de/help.po index 37029fffc70..2b9f1eaa91e 100644 --- a/l10n/de/help.po +++ b/l10n/de/help.po @@ -1,26 +1,27 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy +# msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:15+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: German (http://www.transifex.net/projects/p/owncloud/team/de/)\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/index.php:2 msgid "Questions and Answers" msgstr "Fragen & Antworten" -#: ../templates/index.php:21 +#: ../templates/index.php:24 msgid "ASK A QUESTION" msgstr "Stell eine Frage" + + diff --git a/l10n/de/log.po b/l10n/de/log.po index f552e1fd14c..c249e412a7b 100644 --- a/l10n/de/log.po +++ b/l10n/de/log.po @@ -1,21 +1,21 @@ +# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# +# # Jakob Sack , 2011. msgid "" msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: 2011-06-21 16:44+0200\n" -"Last-Translator: Jakob Sack \n" -"Language-Team: German \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:15+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: German (http://www.transifex.net/projects/p/owncloud/team/de/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.2\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/index.php:4 msgid "Filter:" @@ -65,3 +65,4 @@ msgstr "Wann" msgid "Clear log entries before" msgstr "Lösche Einträge vor dem" + diff --git a/l10n/de/settings.po b/l10n/de/settings.po index 423514bc130..e1ecc38c991 100644 --- a/l10n/de/settings.po +++ b/l10n/de/settings.po @@ -1,21 +1,20 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy +# msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:15+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: German (http://www.transifex.net/projects/p/owncloud/team/de/)\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/index.php:3 msgid "Account information" @@ -84,3 +83,5 @@ msgstr "Sprache geändert" #: ../ajax/setlanguage.php:23 msgid "Invalid request" msgstr "Ungültige Anfrage" + + diff --git a/l10n/fr/admin.po b/l10n/fr/admin.po new file mode 100644 index 00000000000..b1dad1da675 --- /dev/null +++ b/l10n/fr/admin.po @@ -0,0 +1,93 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# , 2011. +msgid "" +msgstr "" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-30 07:29+0000\n" +"Last-Translator: rom1dep \n" +"Language-Team: French (http://www.transifex.net/projects/p/owncloud/team/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" + +#: ../templates/app.php:22 +msgid "read more" +msgstr "en lire plus" + +#: ../templates/app.php:24 +msgid "INSTALL" +msgstr "INSTALLATION" + +#: ../templates/app_noconn.php:6 ../templates/apps.php:6 +msgid "Apps Repository" +msgstr "Répertoire d'applications" + +#: ../templates/app_noconn.php:7 +msgid "Cannot connect to apps repository" +msgstr "Impossible de se connecter au répertoire d'applications" + +#: ../templates/apps.php:13 ../templates/users.php:6 ../templates/users.php:15 +#: ../templates/users.php:51 +msgid "Name" +msgstr "Nom" + +#: ../templates/apps.php:14 +msgid "Modified" +msgstr "Modifié le" + +#: ../templates/system.php:6 +msgid "Administration" +msgstr "Administration" + +#: ../templates/system.php:7 +msgid "System Settings" +msgstr "Préférences Système" + +#: ../templates/users.php:2 +msgid "Users" +msgstr "Utilisateurs" + +#: ../templates/users.php:7 ../templates/users.php:47 +msgid "Groups" +msgstr "Groupes" + +#: ../templates/users.php:16 +msgid "Password" +msgstr "Mot de passe" + +#: ../templates/users.php:25 +msgid "Create" +msgstr "Créer" + +#: ../templates/users.php:37 ../templates/users.php:69 +msgid "remove" +msgstr "retirer" + +#: ../templates/users.php:59 +msgid "Create group" +msgstr "Créer un groupe" + +#: ../templates/users.php:95 +msgid "Force new password:" +msgstr "Forcer un nouveau mot de passe :" + +#: ../templates/users.php:97 +msgid "Set" +msgstr "Appliquer" + +#: ../templates/users.php:103 +msgid "Do you really want to delete user" +msgstr "Voulez-vous réellement supprimer cet utilisateur" + +#: ../templates/users.php:110 +msgid "Do you really want to delete group" +msgstr "Voulez-vous réellement supprimer ce groupe" + + diff --git a/l10n/fr/core.po b/l10n/fr/core.po new file mode 100644 index 00000000000..9546fca7ead --- /dev/null +++ b/l10n/fr/core.po @@ -0,0 +1,130 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# , 2011. +msgid "" +msgstr "" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-30 07:25+0000\n" +"Last-Translator: rom1dep \n" +"Language-Team: French (http://www.transifex.net/projects/p/owncloud/team/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" + +#: ../templates/404.php:15 +msgid "Error 404, Cloud not found" +msgstr "Erreur 404, la page demandée n'existe pas" + +#: ../templates/installation.php:6 +msgid "ownCloud is your personal web storage." +msgstr "ownCloud est votre espace de stockage web personnel." + +#: ../templates/installation.php:7 +msgid "Finish the setup by following the steps below." +msgstr "Terminez l'installation en suivant les étapes ci-dessous." + +#: ../templates/installation.php:26 +msgid "Create an admin account." +msgstr "Veuillez créer un compte administrateur." + +#: ../templates/installation.php:27 +msgid "Username" +msgstr "Nom d'utilisateur" + +#: ../templates/installation.php:28 +msgid "Password" +msgstr "Mot de passe" + +#: ../templates/installation.php:31 +msgid "Advanced" +msgstr "Avancé" + +#: ../templates/installation.php:34 +msgid "Set where to store the data." +msgstr "Sélectionnez où sauvegarder les données" + +#: ../templates/installation.php:35 +msgid "Data directory:" +msgstr "Répertoire de données" + +#: ../templates/installation.php:39 +msgid "Configure the database." +msgstr "Configurez la base de données." + +#: ../templates/installation.php:43 +msgid "SQLite will be used for the database. You have nothing to do." +msgstr "" +"SQLite sera utilisé comme moteur pour la base de données. Vous n'avez rien " +"de plus à faire." + +#: ../templates/installation.php:46 +msgid "SQLite" +msgstr "SQLite" + +#: ../templates/installation.php:53 +msgid "MySQL will be used for the database." +msgstr "MySQL sera utilisé comme moteur pour la base de données." + +#: ../templates/installation.php:59 +msgid "MySQL username:" +msgstr "Nom d'utilisateur MySQL :" + +#: ../templates/installation.php:60 +msgid "MySQL password:" +msgstr "Mot de passe MySQL :" + +#: ../templates/installation.php:61 +msgid "Database name:" +msgstr "Nom de la base de données :" + +#: ../templates/installation.php:62 +msgid "Host:" +msgstr "Hôte :" + +#: ../templates/installation.php:63 +msgid "Table prefix:" +msgstr "Préfixe de table :" + +#: ../templates/installation.php:69 +msgid "Finish setup" +msgstr "Terminer l'installation" + +#: ../templates/layout.guest.php:33 +msgid "" +"ownCloud is a personal cloud which runs" +" on your own server.

          " +msgstr "" +"ownCloud est votre solution cloud " +"personnelle qui tourne sur votre propre serveur.

          " + +#: ../templates/login.php:6 +msgid "Login failed!" +msgstr "Échec de la connexion !" + +#: ../templates/login.php:11 ../templates/login.php:15 +msgid "Remember login" +msgstr "Se souvenir de moi" + +#: ../templates/logout.php:1 +msgid "You are logged out." +msgstr "Vous êtes désormais déconnecté." + +#: ../templates/part.pagenavi.php:6 +msgid "prev" +msgstr "précédent" + +#: ../templates/part.pagenavi.php:26 +msgid "next" +msgstr "suivant" + +#: ../templates/part.searchbox.php:3 +msgid "Search" +msgstr "Rechercher" + + diff --git a/l10n/fr/help.po b/l10n/fr/help.po new file mode 100644 index 00000000000..d8c869024b9 --- /dev/null +++ b/l10n/fr/help.po @@ -0,0 +1,28 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# , 2011. +msgid "" +msgstr "" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-30 07:17+0000\n" +"Last-Translator: rom1dep \n" +"Language-Team: French (http://www.transifex.net/projects/p/owncloud/team/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" + +#: ../templates/index.php:2 +msgid "Questions and Answers" +msgstr "Questions / Réponses" + +#: ../templates/index.php:24 +msgid "ASK A QUESTION" +msgstr "Poser une question" + + diff --git a/l10n/fr/log.po b/l10n/fr/log.po new file mode 100644 index 00000000000..4e59e55d392 --- /dev/null +++ b/l10n/fr/log.po @@ -0,0 +1,68 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# , 2011. +msgid "" +msgstr "" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-30 07:16+0000\n" +"Last-Translator: rom1dep \n" +"Language-Team: French (http://www.transifex.net/projects/p/owncloud/team/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" + +#: ../templates/index.php:4 +msgid "Filter:" +msgstr "Filtre :" + +#: ../templates/index.php:7 +msgid "Logins" +msgstr "Connexions" + +#: ../templates/index.php:8 +msgid "Logouts" +msgstr "Déconnexions" + +#: ../templates/index.php:9 +msgid "Downloads" +msgstr "Téléchargements" + +#: ../templates/index.php:10 +msgid "Uploads" +msgstr "Téléversements" + +#: ../templates/index.php:11 +msgid "Creations" +msgstr "Créations" + +#: ../templates/index.php:12 +msgid "Deletions" +msgstr "Suppressions" + +#: ../templates/index.php:15 +msgid "Show:" +msgstr "Afficher :" + +#: ../templates/index.php:16 +msgid "entries per page." +msgstr "entrées par page." + +#: ../templates/index.php:26 +msgid "What" +msgstr "Quoi" + +#: ../templates/index.php:27 +msgid "When" +msgstr "Quand" + +#: ../templates/index.php:45 +msgid "Clear log entries before" +msgstr "Effacer les entrées du journal au préalable" + + diff --git a/l10n/fr/settings.po b/l10n/fr/settings.po new file mode 100644 index 00000000000..3a8855b981e --- /dev/null +++ b/l10n/fr/settings.po @@ -0,0 +1,88 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# , 2011. +msgid "" +msgstr "" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-30 07:10+0000\n" +"Last-Translator: rom1dep \n" +"Language-Team: French (http://www.transifex.net/projects/p/owncloud/team/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" + +#: ../templates/index.php:3 +msgid "Account information" +msgstr "Informations sur le compte" + +#: ../templates/index.php:5 +msgid "You're currently using" +msgstr "Vous utilisez actuellement" + +#: ../templates/index.php:5 +msgid "of your" +msgstr "de votre" + +#: ../templates/index.php:5 +msgid "space" +msgstr "espace de stockage" + +#: ../templates/index.php:11 +msgid "Change Password" +msgstr "Changer votre mot de passe" + +#: ../templates/index.php:12 +msgid "Your password got changed" +msgstr "Votre mot de passe a été changé" + +#: ../templates/index.php:15 +msgid "Old password:" +msgstr "Ancien mot de passe :" + +#: ../templates/index.php:19 +msgid "New password" +msgstr "Nouveau mot de passe :" + +#: ../templates/index.php:24 +msgid "Show new password" +msgstr "Afficher votre nouveau mot de passe" + +#: ../templates/index.php:34 +msgid "Language" +msgstr "Langue" + +#: ../ajax/changepassword.php:13 ../ajax/setlanguage.php:13 +msgid "Authentication error" +msgstr "Erreur d'authentification" + +#: ../ajax/changepassword.php:19 +msgid "You have to enter the old and the new password!" +msgstr "Vous devez saisir l'ancien et le nouveau mot de passe !" + +#: ../ajax/changepassword.php:25 +msgid "Your old password is wrong!" +msgstr "Votre ancien mot de passe est erroné !" + +#: ../ajax/changepassword.php:31 +msgid "Password changed" +msgstr "Mot de passe changé avec succès" + +#: ../ajax/changepassword.php:34 +msgid "Unable to change password" +msgstr "Impossible de changer le mot de passe" + +#: ../ajax/setlanguage.php:21 +msgid "Language changed" +msgstr "Langue changée avec succès" + +#: ../ajax/setlanguage.php:23 +msgid "Invalid request" +msgstr "Requète invalide" + + diff --git a/l10n/nl/admin.po b/l10n/nl/admin.po index 506d5906b8a..6c59b0b864e 100644 --- a/l10n/nl/admin.po +++ b/l10n/nl/admin.po @@ -1,21 +1,22 @@ +# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# +# # Robin Appelman , 2011. +# Jan-Christoph Borchardt , 2011. msgid "" msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: 2011-06-21 15:00+0200\n" -"Last-Translator: Robin Appelman \n" -"Language-Team: American English \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-28 00:09+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.2\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/app.php:22 msgid "read more" @@ -33,8 +34,8 @@ msgstr "Applicatiedatabase" msgid "Cannot connect to apps repository" msgstr "Kan geen verbinding maken met de applicatiedatabase" -#: ../templates/apps.php:13 ../templates/users.php:6 ../templates/users.php:20 -#: ../templates/users.php:50 +#: ../templates/apps.php:13 ../templates/users.php:6 ../templates/users.php:15 +#: ../templates/users.php:51 msgid "Name" msgstr "Naam" @@ -50,43 +51,44 @@ msgstr "Administratie" msgid "System Settings" msgstr "Systeeminstellingen" -#: ../templates/users.php:7 ../templates/users.php:46 +#: ../templates/users.php:2 +msgid "Users" +msgstr "Gebruikers" + +#: ../templates/users.php:7 ../templates/users.php:47 msgid "Groups" msgstr "Groepen" -#: ../templates/users.php:13 -msgid "Add user" -msgstr "Gebruiker toevoegen" - -#: ../templates/users.php:21 +#: ../templates/users.php:16 msgid "Password" msgstr "Wachtwoord" -#: ../templates/users.php:30 -msgid "Create user" -msgstr "Gebruiker aanmaken" +#: ../templates/users.php:25 +msgid "Create" +msgstr "" -#: ../templates/users.php:40 ../templates/users.php:68 +#: ../templates/users.php:37 ../templates/users.php:69 msgid "remove" msgstr "verwijder" -#: ../templates/users.php:58 +#: ../templates/users.php:59 msgid "Create group" msgstr "Groep aanmaken" -#: ../templates/users.php:94 +#: ../templates/users.php:95 msgid "Force new password:" msgstr "Forceer nieuw wachtwoord:" -#: ../templates/users.php:96 +#: ../templates/users.php:97 msgid "Set" msgstr "Ok" -#: ../templates/users.php:102 +#: ../templates/users.php:103 msgid "Do you really want to delete user" msgstr "Wilt u deze gebruiker verwijderen" -#: ../templates/users.php:109 +#: ../templates/users.php:110 msgid "Do you really want to delete group" msgstr "Wilt u deze groep verwijderen" + diff --git a/l10n/nl/core.po b/l10n/nl/core.po index 3923dcb413d..dc797db0089 100644 --- a/l10n/nl/core.po +++ b/l10n/nl/core.po @@ -1,45 +1,44 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy +# msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-28 00:33+0000\n" +"Last-Translator: JanCBorchardt \n" "Language-Team: LANGUAGE \n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/404.php:15 msgid "Error 404, Cloud not found" msgstr "Fout 404, Cloud niet gevonden." #: ../templates/installation.php:6 -msgid "Welcome to ownCloud, your personnal cloud." -msgstr "Welkom by ownCloud, uw persoonlijke cloud" +msgid "ownCloud is your personal web storage." +msgstr "" #: ../templates/installation.php:7 -msgid "To finish the installation, please follow the steps below." -msgstr "Volg de volgende stappen om de installatie te voltooien." +msgid "Finish the setup by following the steps below." +msgstr "" #: ../templates/installation.php:26 -msgid "Create an admin account." -msgstr "Maak een beheerdersaccount aan" +msgid "Create an admin account." +msgstr "" #: ../templates/installation.php:27 -msgid "Login:" -msgstr "Gebruikersnaam:" +msgid "Username" +msgstr "" #: ../templates/installation.php:28 -msgid "Password:" -msgstr "Wachtwoord:" +msgid "Password" +msgstr "" #: ../templates/installation.php:31 msgid "Advanced" @@ -54,49 +53,49 @@ msgid "Data directory:" msgstr "Gegevensmap:" #: ../templates/installation.php:39 -msgid "Configure your database." -msgstr "Configureer uw database." +msgid "Configure the database." +msgstr "" #: ../templates/installation.php:43 -msgid "I will use a SQLite database. You have nothing to do!" -msgstr "Er zal een SQLite database gebruikt worden. U hoeft geen verdere instellingen te maken." +msgid "SQLite will be used for the database. You have nothing to do." +msgstr "" #: ../templates/installation.php:46 msgid "SQLite" msgstr "SQLite" #: ../templates/installation.php:53 -msgid "I will use a MySQL database." -msgstr "Er zal een MySQL database gebruikt worden." +msgid "MySQL will be used for the database." +msgstr "" #: ../templates/installation.php:59 -msgid "Host:" -msgstr "Host:" +msgid "MySQL username:" +msgstr "" #: ../templates/installation.php:60 -msgid "Database name:" -msgstr "Databasenaam:" +msgid "MySQL password:" +msgstr "" #: ../templates/installation.php:61 -msgid "Table prefix:" -msgstr "Voorvoegsel voor tabelnamen:" +msgid "Database name:" +msgstr "Databasenaam:" #: ../templates/installation.php:62 -msgid "MySQL user login:" -msgstr "MySQL gebruikersnaam." +msgid "Host:" +msgstr "Host:" #: ../templates/installation.php:63 -msgid "MySQL user password:" -msgstr "MySQL wachtwoord" +msgid "Table prefix:" +msgstr "Voorvoegsel voor tabelnamen:" -#: ../templates/installation.php:68 +#: ../templates/installation.php:69 msgid "Finish setup" msgstr "Installatie afronden" -#: ../templates/layout.guest.php:20 +#: ../templates/layout.guest.php:33 msgid "" -"ownCloud is a personal cloud which runs " -"on your own server.

          " +"ownCloud is a personal cloud which runs" +" on your own server.

          " msgstr "" "ownCloud is een persoonlijke cloud die " "op uw eigen server draait.

          " @@ -105,6 +104,10 @@ msgstr "" msgid "Login failed!" msgstr "Aanmelden mislukt." +#: ../templates/login.php:11 ../templates/login.php:15 +msgid "Remember login" +msgstr "" + #: ../templates/logout.php:1 msgid "You are logged out." msgstr "U bent afgemeld." @@ -120,3 +123,5 @@ msgstr "volgende" #: ../templates/part.searchbox.php:3 msgid "Search" msgstr "Zoeken" + + diff --git a/l10n/nl/help.po b/l10n/nl/help.po index b1f1f4bc447..7d8108c804d 100644 --- a/l10n/nl/help.po +++ b/l10n/nl/help.po @@ -1,27 +1,28 @@ +# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# +# # Robin Appelman , 2011. msgid "" msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: 2011-06-21 15:03+0200\n" -"Last-Translator: Robin Appelman \n" -"Language-Team: Dutch <>\n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:18+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.2\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/index.php:2 msgid "Questions and Answers" msgstr "Vraag en Antwoord" -#: ../templates/index.php:21 +#: ../templates/index.php:24 msgid "ASK A QUESTION" msgstr "Stel een vraag" + diff --git a/l10n/nl/log.po b/l10n/nl/log.po index 3bf2f43a920..8d5f86c5b37 100644 --- a/l10n/nl/log.po +++ b/l10n/nl/log.po @@ -1,21 +1,21 @@ +# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# +# # Robin Appelman , 2011. msgid "" msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: 2011-06-21 15:01+0200\n" -"Last-Translator: Robin Appelman \n" -"Language-Team: American English \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:18+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.2\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/index.php:4 msgid "Filter:" @@ -65,3 +65,4 @@ msgstr "Wanneer" msgid "Clear log entries before" msgstr "Verwijder logboekitem ouder dan" + diff --git a/l10n/nl/settings.po b/l10n/nl/settings.po index 866e8b702cd..9a185102a2a 100644 --- a/l10n/nl/settings.po +++ b/l10n/nl/settings.po @@ -1,21 +1,20 @@ # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy +# msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-20 22:00+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:18+0000\n" +"Last-Translator: JanCBorchardt \n" "Language-Team: LANGUAGE \n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" #: ../templates/index.php:3 msgid "Account information" @@ -84,3 +83,5 @@ msgstr "Taal aangepast" #: ../ajax/setlanguage.php:23 msgid "Invalid request" msgstr "Ongeldig verzoek" + + diff --git a/l10n/pl/admin.po b/l10n/pl/admin.po index 858dccf6687..8efe13a268b 100644 --- a/l10n/pl/admin.po +++ b/l10n/pl/admin.po @@ -1,21 +1,21 @@ +# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# +# # Kamil Domański , 2011. msgid "" msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-21 16:19+0200\n" -"PO-Revision-Date: 2011-06-22 03:28+0200\n" -"Last-Translator: Kamil Domański \n" -"Language-Team: American English \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-28 00:09+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.2\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: pl\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" #: ../templates/app.php:22 msgid "read more" @@ -33,8 +33,8 @@ msgstr "Repozytorium aplikacji" msgid "Cannot connect to apps repository" msgstr "Nie można połączyć się z repozytorium aplikacji" -#: ../templates/apps.php:13 ../templates/users.php:6 ../templates/users.php:20 -#: ../templates/users.php:50 +#: ../templates/apps.php:13 ../templates/users.php:6 ../templates/users.php:15 +#: ../templates/users.php:51 msgid "Name" msgstr "Nazwa" @@ -50,47 +50,44 @@ msgstr "Administracja" msgid "System Settings" msgstr "Ustawienia systemowe" -#: ../templates/users.php:13 -msgid "Add user" -msgstr "Dodaj użytkownika" +#: ../templates/users.php:2 +msgid "Users" +msgstr "Użytkownicy" + +#: ../templates/users.php:7 ../templates/users.php:47 +msgid "Groups" +msgstr "Grupy" -#: ../templates/users.php:21 +#: ../templates/users.php:16 msgid "Password" msgstr "Hasło" -#: ../templates/users.php:30 -msgid "Create user" -msgstr "Utwórz użytkownika" +#: ../templates/users.php:25 +msgid "Create" +msgstr "" -#: ../templates/users.php:40 ../templates/users.php:68 +#: ../templates/users.php:37 ../templates/users.php:69 msgid "remove" msgstr "usuń" -#: ../templates/users.php:46 ../templates/users.php:7 -msgid "Groups" -msgstr "Grupy" - -#: ../templates/users.php:58 +#: ../templates/users.php:59 msgid "Create group" msgstr "Utwórz grupę" -#: ../templates/users.php:94 +#: ../templates/users.php:95 msgid "Force new password:" msgstr "Wymuś nowe hasło" -#: ../templates/users.php:96 +#: ../templates/users.php:97 msgid "Set" msgstr "Ustaw" -#: ../templates/users.php:102 +#: ../templates/users.php:103 msgid "Do you really want to delete user" msgstr "Czy naprawdę chcesz usunąć użytkownika" -#: ../templates/users.php:109 +#: ../templates/users.php:110 msgid "Do you really want to delete group" msgstr "Czy naprawdę chcesz usunąć grupę" -#: ../templates/users.php:1 -msgid "Users" -msgstr "Użytkownicy" diff --git a/l10n/pl/core.po b/l10n/pl/core.po index 717555818e2..073bb8cd31d 100644 --- a/l10n/pl/core.po +++ b/l10n/pl/core.po @@ -1,45 +1,45 @@ +# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# +# # Kamil Domański , 2011. msgid "" msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-21 16:19+0200\n" -"PO-Revision-Date: 2011-06-22 03:36+0200\n" -"Last-Translator: Kamil Domański \n" -"Language-Team: American English \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-28 00:33+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.2\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: pl\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" #: ../templates/404.php:15 msgid "Error 404, Cloud not found" msgstr "Błąd 404, Chmura nie znaleziona" #: ../templates/installation.php:6 -msgid "Welcome to ownCloud, your personnal cloud." -msgstr "Witaj w ownCloud, Twojej osobistej chmurze." +msgid "ownCloud is your personal web storage." +msgstr "" #: ../templates/installation.php:7 -msgid "To finish the installation, please follow the steps below." -msgstr "By zakończyć instalację, podążaj poniższymi krokami." +msgid "Finish the setup by following the steps below." +msgstr "" #: ../templates/installation.php:26 -msgid "Create an admin account." -msgstr "Utwórz konto administratora." +msgid "Create an admin account." +msgstr "" #: ../templates/installation.php:27 -msgid "Login:" -msgstr "Login:" +msgid "Username" +msgstr "" #: ../templates/installation.php:28 -msgid "Password:" -msgstr "Hasło:" +msgid "Password" +msgstr "" #: ../templates/installation.php:31 msgid "Advanced" @@ -54,57 +54,61 @@ msgid "Data directory:" msgstr "Katalog danych:" #: ../templates/installation.php:39 -msgid "Configure your database." -msgstr "Skonfiguruj Twoją bazę danych." +msgid "Configure the database." +msgstr "" #: ../templates/installation.php:43 -msgid "I will use a SQLite database. You have nothing to do!" -msgstr "Użyję bazy SQLite. Nie masz tu nic do roboty!" +msgid "SQLite will be used for the database. You have nothing to do." +msgstr "" #: ../templates/installation.php:46 msgid "SQLite" msgstr "SQLite" #: ../templates/installation.php:53 -msgid "I will use a MySQL database." -msgstr "Użyję bazy danych MySQL." +msgid "MySQL will be used for the database." +msgstr "" #: ../templates/installation.php:59 -msgid "Host:" -msgstr "Host:" +msgid "MySQL username:" +msgstr "" #: ../templates/installation.php:60 -msgid "Database name:" -msgstr "Nazwa bazy:" +msgid "MySQL password:" +msgstr "" #: ../templates/installation.php:61 -msgid "Table prefix:" -msgstr "Przedrostek tabeli:" +msgid "Database name:" +msgstr "Nazwa bazy:" #: ../templates/installation.php:62 -msgid "MySQL user login:" -msgstr "Login użytkownika MySQL:" +msgid "Host:" +msgstr "Host:" #: ../templates/installation.php:63 -msgid "MySQL user password:" -msgstr "Hasło użytkownika MySQL:" +msgid "Table prefix:" +msgstr "Przedrostek tabeli:" -#: ../templates/installation.php:68 +#: ../templates/installation.php:69 msgid "Finish setup" msgstr "Zakończ instalację" -#: ../templates/layout.guest.php:20 +#: ../templates/layout.guest.php:33 msgid "" -"ownCloud is a personal cloud which runs " -"on your own server.

          " +"ownCloud is a personal cloud which runs" +" on your own server.

          " msgstr "" -"ownCloud jest osobistą chmurą działającą " -"na Twoim własnym serwerze.

          " +"ownCloud jest osobistą chmurą " +"działającą na Twoim własnym serwerze.

          " #: ../templates/login.php:6 msgid "Login failed!" msgstr "Nie udało się zalogować!" +#: ../templates/login.php:11 ../templates/login.php:15 +msgid "Remember login" +msgstr "" + #: ../templates/logout.php:1 msgid "You are logged out." msgstr "Jesteś wylogowany." @@ -121,3 +125,4 @@ msgstr "dalej" msgid "Search" msgstr "Szukaj" + diff --git a/l10n/pl/help.po b/l10n/pl/help.po index a9d8481d5ce..a4390c8bdad 100644 --- a/l10n/pl/help.po +++ b/l10n/pl/help.po @@ -1,28 +1,28 @@ +# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# +# # Kamil Domański , 2011. msgid "" msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-21 16:19+0200\n" -"PO-Revision-Date: 2011-06-22 03:45+0200\n" -"Last-Translator: Kamil Domański \n" -"Language-Team: Polish \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:16+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.2\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\n" +"Language: pl\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" #: ../templates/index.php:2 msgid "Questions and Answers" msgstr "Pytania i odpowiedzi" -#: ../templates/index.php:21 +#: ../templates/index.php:24 msgid "ASK A QUESTION" msgstr "ZADAJ PYTANIE" + diff --git a/l10n/pl/log.po b/l10n/pl/log.po index 9c426ec2318..5afe1b6f4c3 100644 --- a/l10n/pl/log.po +++ b/l10n/pl/log.po @@ -1,22 +1,21 @@ +# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# +# # Kamil Domański , 2011. msgid "" msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-21 16:19+0200\n" -"PO-Revision-Date: 2011-06-22 03:50+0200\n" -"Last-Translator: Kamil Domański \n" -"Language-Team: Polish \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:16+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.2\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\n" +"Language: pl\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" #: ../templates/index.php:4 msgid "Filter:" @@ -66,3 +65,4 @@ msgstr "Kiedy" msgid "Clear log entries before" msgstr "Wyczyść spisy dziennika sprzed" + diff --git a/l10n/pl/settings.po b/l10n/pl/settings.po index 6dec38f1054..99ae9c3ff08 100644 --- a/l10n/pl/settings.po +++ b/l10n/pl/settings.po @@ -1,22 +1,21 @@ +# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. -# +# # Kamil Domański , 2011. msgid "" msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-06-21 16:19+0200\n" -"PO-Revision-Date: 2011-06-22 03:52+0200\n" -"Last-Translator: Kamil Domański \n" -"Language-Team: Polish \n" -"Language: \n" +"Project-Id-Version: ownCloud\n" +"Report-Msgid-Bugs-To: http://bugs.kde.org/buglist.cgi?product=owncloud\n" +"POT-Creation-Date: 2011-07-27 12:03+0200\n" +"PO-Revision-Date: 2011-07-25 16:16+0000\n" +"Last-Translator: JanCBorchardt \n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.2\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2);\n" +"Language: pl\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" #: ../templates/index.php:3 msgid "Account information" @@ -86,3 +85,4 @@ msgstr "Język zmieniony" msgid "Invalid request" msgstr "Nieprawidłowe żądanie" + diff --git a/l10n/templates/admin.pot b/l10n/templates/admin.pot deleted file mode 100644 index d6233365185..00000000000 --- a/l10n/templates/admin.pot +++ /dev/null @@ -1,91 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-07-27 12:03+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../templates/app.php:22 -msgid "read more" -msgstr "" - -#: ../templates/app.php:24 -msgid "INSTALL" -msgstr "" - -#: ../templates/app_noconn.php:6 ../templates/apps.php:6 -msgid "Apps Repository" -msgstr "" - -#: ../templates/app_noconn.php:7 -msgid "Cannot connect to apps repository" -msgstr "" - -#: ../templates/apps.php:13 ../templates/users.php:6 ../templates/users.php:15 -#: ../templates/users.php:51 -msgid "Name" -msgstr "" - -#: ../templates/apps.php:14 -msgid "Modified" -msgstr "" - -#: ../templates/system.php:6 -msgid "Administration" -msgstr "" - -#: ../templates/system.php:7 -msgid "System Settings" -msgstr "" - -#: ../templates/users.php:2 -msgid "Users" -msgstr "" - -#: ../templates/users.php:7 ../templates/users.php:47 -msgid "Groups" -msgstr "" - -#: ../templates/users.php:16 -msgid "Password" -msgstr "" - -#: ../templates/users.php:25 -msgid "Create" -msgstr "" - -#: ../templates/users.php:37 ../templates/users.php:69 -msgid "remove" -msgstr "" - -#: ../templates/users.php:59 -msgid "Create group" -msgstr "" - -#: ../templates/users.php:95 -msgid "Force new password:" -msgstr "" - -#: ../templates/users.php:97 -msgid "Set" -msgstr "" - -#: ../templates/users.php:103 -msgid "Do you really want to delete user" -msgstr "" - -#: ../templates/users.php:110 -msgid "Do you really want to delete group" -msgstr "" diff --git a/l10n/templates/core.pot b/l10n/templates/core.pot deleted file mode 100644 index 6bcadf8cfc7..00000000000 --- a/l10n/templates/core.pot +++ /dev/null @@ -1,124 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-07-27 12:03+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../templates/404.php:15 -msgid "Error 404, Cloud not found" -msgstr "" - -#: ../templates/installation.php:6 -msgid "ownCloud is your personal web storage." -msgstr "" - -#: ../templates/installation.php:7 -msgid "Finish the setup by following the steps below." -msgstr "" - -#: ../templates/installation.php:26 -msgid "Create an admin account." -msgstr "" - -#: ../templates/installation.php:27 -msgid "Username" -msgstr "" - -#: ../templates/installation.php:28 -msgid "Password" -msgstr "" - -#: ../templates/installation.php:31 -msgid "Advanced" -msgstr "" - -#: ../templates/installation.php:34 -msgid "Set where to store the data." -msgstr "" - -#: ../templates/installation.php:35 -msgid "Data directory:" -msgstr "" - -#: ../templates/installation.php:39 -msgid "Configure the database." -msgstr "" - -#: ../templates/installation.php:43 -msgid "SQLite will be used for the database. You have nothing to do." -msgstr "" - -#: ../templates/installation.php:46 -msgid "SQLite" -msgstr "" - -#: ../templates/installation.php:53 -msgid "MySQL will be used for the database." -msgstr "" - -#: ../templates/installation.php:59 -msgid "MySQL username:" -msgstr "" - -#: ../templates/installation.php:60 -msgid "MySQL password:" -msgstr "" - -#: ../templates/installation.php:61 -msgid "Database name:" -msgstr "" - -#: ../templates/installation.php:62 -msgid "Host:" -msgstr "" - -#: ../templates/installation.php:63 -msgid "Table prefix:" -msgstr "" - -#: ../templates/installation.php:69 -msgid "Finish setup" -msgstr "" - -#: ../templates/layout.guest.php:33 -msgid "" -"ownCloud is a personal cloud which runs " -"on your own server.

          " -msgstr "" - -#: ../templates/login.php:6 -msgid "Login failed!" -msgstr "" - -#: ../templates/login.php:11 ../templates/login.php:15 -msgid "Remember login" -msgstr "" - -#: ../templates/logout.php:1 -msgid "You are logged out." -msgstr "" - -#: ../templates/part.pagenavi.php:6 -msgid "prev" -msgstr "" - -#: ../templates/part.pagenavi.php:26 -msgid "next" -msgstr "" - -#: ../templates/part.searchbox.php:3 -msgid "Search" -msgstr "" diff --git a/l10n/templates/help.pot b/l10n/templates/help.pot deleted file mode 100644 index e5ffb5a4cf5..00000000000 --- a/l10n/templates/help.pot +++ /dev/null @@ -1,26 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-07-27 12:03+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../templates/index.php:2 -msgid "Questions and Answers" -msgstr "" - -#: ../templates/index.php:24 -msgid "ASK A QUESTION" -msgstr "" diff --git a/l10n/templates/log.pot b/l10n/templates/log.pot deleted file mode 100644 index ea98e5c2b14..00000000000 --- a/l10n/templates/log.pot +++ /dev/null @@ -1,66 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-07-27 12:03+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../templates/index.php:4 -msgid "Filter:" -msgstr "" - -#: ../templates/index.php:7 -msgid "Logins" -msgstr "" - -#: ../templates/index.php:8 -msgid "Logouts" -msgstr "" - -#: ../templates/index.php:9 -msgid "Downloads" -msgstr "" - -#: ../templates/index.php:10 -msgid "Uploads" -msgstr "" - -#: ../templates/index.php:11 -msgid "Creations" -msgstr "" - -#: ../templates/index.php:12 -msgid "Deletions" -msgstr "" - -#: ../templates/index.php:15 -msgid "Show:" -msgstr "" - -#: ../templates/index.php:16 -msgid "entries per page." -msgstr "" - -#: ../templates/index.php:26 -msgid "What" -msgstr "" - -#: ../templates/index.php:27 -msgid "When" -msgstr "" - -#: ../templates/index.php:45 -msgid "Clear log entries before" -msgstr "" diff --git a/l10n/templates/settings.pot b/l10n/templates/settings.pot deleted file mode 100644 index 24e255fa259..00000000000 --- a/l10n/templates/settings.pot +++ /dev/null @@ -1,86 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-07-27 12:03+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../templates/index.php:3 -msgid "Account information" -msgstr "" - -#: ../templates/index.php:5 -msgid "You're currently using" -msgstr "" - -#: ../templates/index.php:5 -msgid "of your" -msgstr "" - -#: ../templates/index.php:5 -msgid "space" -msgstr "" - -#: ../templates/index.php:11 -msgid "Change Password" -msgstr "" - -#: ../templates/index.php:12 -msgid "Your password got changed" -msgstr "" - -#: ../templates/index.php:15 -msgid "Old password:" -msgstr "" - -#: ../templates/index.php:19 -msgid "New password" -msgstr "" - -#: ../templates/index.php:24 -msgid "Show new password" -msgstr "" - -#: ../templates/index.php:34 -msgid "Language" -msgstr "" - -#: ../ajax/changepassword.php:13 ../ajax/setlanguage.php:13 -msgid "Authentication error" -msgstr "" - -#: ../ajax/changepassword.php:19 -msgid "You have to enter the old and the new password!" -msgstr "" - -#: ../ajax/changepassword.php:25 -msgid "Your old password is wrong!" -msgstr "" - -#: ../ajax/changepassword.php:31 -msgid "Password changed" -msgstr "" - -#: ../ajax/changepassword.php:34 -msgid "Unable to change password" -msgstr "" - -#: ../ajax/setlanguage.php:21 -msgid "Language changed" -msgstr "" - -#: ../ajax/setlanguage.php:23 -msgid "Invalid request" -msgstr "" diff --git a/log/l10n/bg_BG.php b/log/l10n/bg_BG.php new file mode 100644 index 00000000000..407b447905f --- /dev/null +++ b/log/l10n/bg_BG.php @@ -0,0 +1,14 @@ + "Филтър:", +"Logins" => "Влизания:", +"Logouts" => "Изходи:", +"Downloads" => "Тегления", +"Uploads" => "Качвания", +"Creations" => "Създавания:", +"Deletions" => "Изтривания:", +"Show:" => "Показва:", +"entries per page." => "записа на страница.", +"What" => "Какво", +"When" => "Кога", +"Clear log entries before" => "Изчисти записите от журналите" +); diff --git a/log/l10n/fr.php b/log/l10n/fr.php new file mode 100644 index 00000000000..d411a0e1599 --- /dev/null +++ b/log/l10n/fr.php @@ -0,0 +1,14 @@ + "Filtre :", +"Logins" => "Connexions", +"Logouts" => "Déconnexions", +"Downloads" => "Téléchargements", +"Uploads" => "Téléversements", +"Creations" => "Créations", +"Deletions" => "Suppressions", +"Show:" => "Afficher :", +"entries per page." => "entrées par page.", +"What" => "Quoi", +"When" => "Quand", +"Clear log entries before" => "Effacer les entrées du journal au préalable" +); diff --git a/settings/l10n/bg_BG.php b/settings/l10n/bg_BG.php new file mode 100644 index 00000000000..f81a9f5e413 --- /dev/null +++ b/settings/l10n/bg_BG.php @@ -0,0 +1,19 @@ + "Информация за профила", +"You're currently using" => "Вие ползвате", +"of your" => "на Вашето", +"space" => "място", +"Change Password" => "Промяна на парола", +"Your password got changed" => "Вашата парола е сменена", +"Old password:" => "Стара парола", +"New password" => "Нова парола", +"Show new password" => "Покажи новата парола", +"Language" => "Език", +"Authentication error" => "Проблем с индентификацията", +"You have to enter the old and the new password!" => "Трябва да въведете новата и старата парола!", +"Your old password is wrong!" => "Вашата стара парола е грешна!", +"Password changed" => "Паролата е сменена", +"Unable to change password" => "Невъзможна смяна на паролата", +"Language changed" => "Езика е сменен", +"Invalid request" => "Невалидна заявка" +); diff --git a/settings/l10n/fr.php b/settings/l10n/fr.php new file mode 100644 index 00000000000..758189e18bc --- /dev/null +++ b/settings/l10n/fr.php @@ -0,0 +1,19 @@ + "Informations sur le compte", +"You're currently using" => "Vous utilisez actuellement", +"of your" => "de votre", +"space" => "espace de stockage", +"Change Password" => "Changer votre mot de passe", +"Your password got changed" => "Votre mot de passe a été changé", +"Old password:" => "Ancien mot de passe :", +"New password" => "Nouveau mot de passe :", +"Show new password" => "Afficher votre nouveau mot de passe", +"Language" => "Langue", +"Authentication error" => "Erreur d'authentification", +"You have to enter the old and the new password!" => "Vous devez saisir l'ancien et le nouveau mot de passe !", +"Your old password is wrong!" => "Votre ancien mot de passe est erroné !", +"Password changed" => "Mot de passe changé avec succès", +"Unable to change password" => "Impossible de changer le mot de passe", +"Language changed" => "Langue changée avec succès", +"Invalid request" => "Requète invalide" +); -- cgit v1.2.3 From 8426babab962539d91ee00d348a0004755a15866 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 30 Jul 2011 10:56:28 +0200 Subject: updated navigation subentry styling --- core/css/styles.css | 6 +++--- core/templates/layout.user.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/css/styles.css b/core/css/styles.css index 00433979d24..400108c454d 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -87,9 +87,9 @@ input[type="search"] { font-size:1em; padding-left:2em; background:#eee url('../ #plugins a { display:block; padding:0.5em 0.5em 0.5em 3em; background-position:1.5em center; background-repeat:no-repeat; border-bottom:1px solid #ddd; border-top:1px solid #fff; text-decoration:none; font-size:1.2em; color:#666; } #plugins a.active, #plugins a:hover, #plugins a:focus, #plugins a.selected { background-color:#ccc; border-top:1px solid #ccc; border-bottom:1px solid #ccc; color:#000; outline:0; } #plugins a:active { outline:0; } -#plugins .subentry { background-color:#ddd; border-top:1px solid #aaa; border-bottom:1px solid #ccc; color:#000; outline:0; } -#plugins .subentry.active { background-color:#bbb; border-top:1px solid #aaa; border-bottom:1px solid #ccc; color:#000; outline:0; } -#plugins li.subentry a {padding-left:4em;} +#plugins .subentry { background-color:#ddd; border-top:1px solid #aaa; color:#000; outline:0; } +#plugins .subentry.active { background-color:#bbb; border-top:1px solid #aaa; color:#000; outline:0; } +#plugins li.subentry a { padding-left:3.7em; font-size:1em; } /* CONTENT ------------------------------------------------------------------ */ #content { margin:3.5em 0 0 15.7em; } diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 8f073914a1f..1de0ccf80c1 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -47,7 +47,7 @@ -- cgit v1.2.3 From f9ddbc4925fe250ce678182375b26f018f2c525e Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 30 Jul 2011 11:00:25 +0200 Subject: documented file size and date color calculation part --- files/templates/part.list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 9ed3494732d..3713d483b00 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -1,10 +1,10 @@ Nothing in here. Upload something!'; foreach($_['files'] as $file): $simple_file_size = simple_file_size($file['size']); - $simple_size_color = 200-intval($file['size']/(1024*1024)*2); + $simple_size_color = 200-intval($file['size']/(1024*1024)*2); // the bigger the file, the darker the shade of grey if($simple_size_color<0) $simple_size_color = 0; $relative_modified_date = relative_modified_date($file['mtime']); - $relative_date_color = round((time()-$file['mtime'])/60/60/24*7); //days ago + $relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey if($relative_date_color>200) $relative_date_color = 200; ?> '> -- cgit v1.2.3 From 48fb1e2dae3d6c91b5c9bded455b38eb7c4c4df0 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 30 Jul 2011 12:14:09 +0200 Subject: hide empty folder notification when a folder or file got uploaded --- files/js/files.js | 4 +++- files/templates/part.list.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/files/js/files.js b/files/js/files.js index be7e48aeeeb..d3f91fe9a2f 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -69,6 +69,7 @@ $(document).ready(function() { $('#file_newfolder_name').blur(); });} }); + $('#emptyfolder').remove(); }); $('#file_newfolder_name').click(function(){ @@ -181,6 +182,7 @@ $(document).ready(function() { clone.insertBefore(form); form.hide(); } + $('#emptyfolder').remove(); }); //add multiply file upload attribute to all browsers except konqueror (which crashes when it's used) @@ -433,4 +435,4 @@ function getMimeIcon(mime){ mime='file'; } return OC.imagePath('core','mimetypes/'+mime+'.png'); -} \ No newline at end of file +} diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 3713d483b00..40586664328 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -1,4 +1,4 @@ - Nothing in here. Upload something!'; + Nothing in here. Upload something!'; foreach($_['files'] as $file): $simple_file_size = simple_file_size($file['size']); $simple_size_color = 200-intval($file['size']/(1024*1024)*2); // the bigger the file, the darker the shade of grey -- cgit v1.2.3 From 95ec75b919f58fb55e561789d8a54d59312c7e19 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 30 Jul 2011 12:55:12 +0200 Subject: only bold current folder in breadcrumb navigation --- files/css/files.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/css/files.css b/files/css/files.css index 50b61a488d1..578d5df174b 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -19,7 +19,8 @@ table { position:relative; top:37px; width:100%; } tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#eee; } tbody a { color:#000; } span.extention, td.date { color:#999; } -div.crumb { float:left; display:block; background:no-repeat right 0; font-weight:bold; padding:8px 1.5em 0 1em; height:28px; /*36-8*/ } +div.crumb { float:left; display:block; background:no-repeat right 0; padding:8px 1.5em 0 1em; height:28px; /*36-8*/ } +div.crumb:last-child { font-weight:bold; } table tr.mouseOver td { background-color:#eee; } table th { padding:.5em; height:2em; } table th .name { float:left; margin-left:.5em; } -- cgit v1.2.3 From 78d41a03e074c708d5f6082fd299bdbb3d545f73 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 30 Jul 2011 14:42:58 +0200 Subject: automatically hide show/hide the empty folder message --- files/css/files.css | 1 + files/js/filelist.js | 6 ++++++ files/js/files.js | 4 ++++ files/templates/part.list.php | 4 ++-- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/files/css/files.css b/files/css/files.css index 578d5df174b..c81960f5e48 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -6,6 +6,7 @@ #fileSelector, #file_upload_submit, #file_newfolder_submit { display:none; } .file_upload_filename, #file_newfolder_name { background-repeat:no-repeat; background-position:0.5em 0; padding-left:2em; } .file_upload_filename { background-image:url("../img/file.png"); font-weight:bold; }.file_upload_start { opacity:0;filter:alpha(opacity = 0); } +input.highlight{ background-color:#ffc100; border:#dda600 1px solid; } #file_newfolder_name { background-image:url("../img/folder.png"); font-weight:bold; width:11em; } .file_upload_start, .file_upload_filename { position:absolute; top:0px; left:0px; width:11em; font-size:0.9em; } diff --git a/files/js/filelist.js b/files/js/filelist.js index c3a2522fb6a..862fb1797a6 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -66,6 +66,10 @@ FileList={ remove:function(name){ $('tr[data-file="'+name+'"] td.filename').draggable('destroy'); $('tr[data-file="'+name+'"]').remove(); + if($('tr[data-file]').length==0){ + $('#emptyfolder').show(); + $('.file_upload_filename').addClass('highlight'); + } }, insertElement:function(name,type,element){ //find the correct spot to insert the file or folder @@ -93,6 +97,8 @@ FileList={ }else{ $('#fileList').append(element); } + $('#emptyfolder').hide(); + $('.file_upload_filename').removeClass('highlight'); }, loadingDone:function(name){ $('tr[data-file="'+name+'"]').data('loading',false); diff --git a/files/js/files.js b/files/js/files.js index d3f91fe9a2f..7005502d942 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -1,4 +1,8 @@ $(document).ready(function() { + if($('tr[data-file]').length==0){ + $('.file_upload_filename').addClass('highlight'); + } + $('#file_action_panel').attr('activeAction', false); //drag/drop of files diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 40586664328..8f55440fe48 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -1,5 +1,5 @@ - Nothing in here. Upload something!'; - foreach($_['files'] as $file): + >Nothing in here. Upload something! + Date: Sat, 30 Jul 2011 14:46:41 +0200 Subject: dont need to remove the empty folder message twice --- files/js/files.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/files/js/files.js b/files/js/files.js index 7005502d942..7812d70bbb3 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -73,7 +73,6 @@ $(document).ready(function() { $('#file_newfolder_name').blur(); });} }); - $('#emptyfolder').remove(); }); $('#file_newfolder_name').click(function(){ @@ -186,7 +185,6 @@ $(document).ready(function() { clone.insertBefore(form); form.hide(); } - $('#emptyfolder').remove(); }); //add multiply file upload attribute to all browsers except konqueror (which crashes when it's used) -- cgit v1.2.3 From 9714bab6533a0c8b7be0990b77063df7037bc0a1 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 30 Jul 2011 15:16:20 +0200 Subject: fixed table heading and multiselect style --- files/css/files.css | 5 +++-- files/js/files.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/files/css/files.css b/files/css/files.css index c81960f5e48..7d0471bc26b 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -17,14 +17,15 @@ input.highlight{ background-color:#ffc100; border:#dda600 1px solid; } /* FILE TABLE */ span#emptyfolder { position:absolute; margin:10em 0 0 10em; font-size:1.5em; font-weight:bold; color:#888; text-shadow:#fff 0 1px 0; } table { position:relative; top:37px; width:100%; } -tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#eee; } +tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#eee; height:1em; } tbody a { color:#000; } span.extention, td.date { color:#999; } div.crumb { float:left; display:block; background:no-repeat right 0; padding:8px 1.5em 0 1em; height:28px; /*36-8*/ } div.crumb:last-child { font-weight:bold; } table tr.mouseOver td { background-color:#eee; } -table th { padding:.5em; height:2em; } +table th { height:2em; padding-left:.5em; color:#999; } table th .name { float:left; margin-left:.5em; } +table th.multiselect { background:#ddd; color:#000; font-weight:bold; } table th, table td { border-bottom:1px solid #ddd; text-align:left; font-weight:normal; } table td { border-bottom:1px solid #eee; font-style:normal; } table th#headerSize, table td.filesize { width:5em; padding:0 1em; text-align:right; } diff --git a/files/js/files.js b/files/js/files.js index 7812d70bbb3..3d3d8ca49fd 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -342,7 +342,7 @@ function procesSelection(){ $('#headerName>span.name').text('Name'); $('#headerSize').text('Size MB'); $('#modified').text('Modified'); - $('th').css({background:'#fff',fontWeight:'normal'}); + $('th').removeClass('multiselect'); $('.selectedActions').hide(); }else{ $('.selectedActions').show(); @@ -376,7 +376,7 @@ function procesSelection(){ } $('#headerName>span.name').text(selection); $('#modified').text(''); - $('th').css({background:'#ddd', fontWeight:'bold'}); + $('th').addClass('multiselect'); } } -- cgit v1.2.3 From 103d45539d4db6b5c646df46acd487a05c121290 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 30 Jul 2011 15:31:11 +0200 Subject: fixed file size and date color calculation in JavaScript --- files/css/files.css | 2 +- files/js/filelist.js | 4 ++-- files/templates/part.list.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/files/css/files.css b/files/css/files.css index 7d0471bc26b..4aaca82f124 100644 --- a/files/css/files.css +++ b/files/css/files.css @@ -23,7 +23,7 @@ span.extention, td.date { color:#999; } div.crumb { float:left; display:block; background:no-repeat right 0; padding:8px 1.5em 0 1em; height:28px; /*36-8*/ } div.crumb:last-child { font-weight:bold; } table tr.mouseOver td { background-color:#eee; } -table th { height:2em; padding-left:.5em; color:#999; } +table th { height:2em; padding:0 .5em; color:#999; } table th .name { float:left; margin-left:.5em; } table th.multiselect { background:#ddd; color:#000; font-weight:bold; } table th, table td { border-bottom:1px solid #ddd; text-align:left; font-weight:normal; } diff --git a/files/js/filelist.js b/files/js/filelist.js index 862fb1797a6..359725cdc0d 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -23,9 +23,9 @@ FileList={ }else{ simpleSize='Pending'; } - sizeColor = Math.round(200-Math.pow((size/(1024*1024)),2)); + sizeColor = Math.round(200-size/1024*1024*2); lastModifiedTime=Math.round(lastModified.getTime() / 1000); - modifiedColor=Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*5); + modifiedColor=Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*14); html+=''+simpleSize+''; html+=''+relative_modified_date(lastModified.getTime() / 1000)+''; html+=''; diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 8f55440fe48..22edd9351cd 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -1,10 +1,10 @@ >Nothing in here. Upload something! 200) $relative_date_color = 200; ?> '> -- cgit v1.2.3 From b2f1d26d9312ece3a370d3af4672ad55f288bf31 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 30 Jul 2011 15:42:34 +0200 Subject: fixed color calculation again --- files/js/filelist.js | 2 +- files/templates/part.list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/js/filelist.js b/files/js/filelist.js index 359725cdc0d..3f9b3984465 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -23,7 +23,7 @@ FileList={ }else{ simpleSize='Pending'; } - sizeColor = Math.round(200-size/1024*1024*2); + sizeColor = Math.round(200-size/(1024*1024)*2); lastModifiedTime=Math.round(lastModified.getTime() / 1000); modifiedColor=Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*14); html+=''+simpleSize+''; diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 22edd9351cd..93ed70990b7 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -1,7 +1,7 @@ >Nothing in here. Upload something! Date: Sat, 30 Jul 2011 16:42:20 +0200 Subject: provide json interface for search --- lib/search/result.php | 21 ++++----------------- search/ajax/search.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 search/ajax/search.php diff --git a/lib/search/result.php b/lib/search/result.php index 80a6b494c5e..cd78a5cf253 100644 --- a/lib/search/result.php +++ b/lib/search/result.php @@ -3,10 +3,10 @@ * a result of a search */ class OC_Search_Result{ - private $name; - private $text; - private $link; - private $type; + public $name; + public $text; + public $link; + public $type; /** * create a new search result @@ -21,17 +21,4 @@ class OC_Search_Result{ $this->link=$link; $this->type=$type; } - - public function __get($name){ - switch($name){ - case 'name': - return $this->name; - case 'text': - return $this->text; - case 'link': - return $this->link; - case 'type': - return $this->type; - } - } } diff --git a/search/ajax/search.php b/search/ajax/search.php new file mode 100644 index 00000000000..c65fbbc63fa --- /dev/null +++ b/search/ajax/search.php @@ -0,0 +1,42 @@ +. +* +*/ + + +// Init owncloud +require_once('../../lib/base.php'); + +// Check if we are a user +if( !OC_User::isLoggedIn()){ + header( "Location: ".OC_Helper::linkTo( '', 'index.php' )); + exit(); +} + +$query=(isset($_GET['query']))?$_GET['query']:''; +if($query){ + $result=OC_Search::search($query); + echo json_encode($result); +}else{ + echo 'false'; +} + +?> \ No newline at end of file -- cgit v1.2.3 From d2d77b2a481a63cb5b7346ab26565edefdc7f901 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 30 Jul 2011 18:05:20 +0200 Subject: initial work on instant search --- core/js/js.js | 66 +++++++++++++++++++++++++++++++++++---- core/templates/part.searchbox.php | 2 +- 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/core/js/js.js b/core/js/js.js index db96a1adb3e..fbc014006b0 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -47,18 +47,63 @@ OC={ }, addScript:function(app,script,ready){ var path=OC.filePath(app,'js',script+'.js'); - if(ready){ - $.getScript(path,ready); - }else{ - $.getScript(path); + if(OC.addStyle.loaded.indexOf(path)==-1){ + OC.addStyle.loaded.push(path); + if(ready){ + $.getScript(path,ready); + }else{ + $.getScript(path); + } } }, addStyle:function(app,style){ var path=OC.filePath(app,'css',style+'.css'); - var style=$(''); - $('head').append(style); + if(OC.addScript.loaded.indexOf(path)==-1){ + OC.addScript.loaded.push(path); + var style=$(''); + $('head').append(style); + } + }, + search:function(query){ + if(query){ + OC.addStyle('search','results'); + $.getJSON(OC.filePath('search','ajax','search.php')+'?query='+encodeURIComponent(query), OC.search.showResults); + } } } +OC.addStyle.loaded=[]; +OC.addScript.loaded=[]; + +OC.search.catagorizeResults=function(results){ + var types={}; + for(var i=0;i
            '); + for(var name in types){ + var type=types[name]; + if(type.length>0){ + ul.append($('
          • '+name+'
          • ')); + for(var i=0;i')); + li.append($(''+item.name+'')); + li.append($(''+item.text+'')); + ul.append(li); + } + } + } + $('body').append(ul); +} if (!Array.prototype.filter) { Array.prototype.filter = function(fun /*, thisp*/) { @@ -112,4 +157,13 @@ $(document).ready(function(){ element.attr('src',src.substr(0,src.length-3)+'png'); }); }; + $('#searchbox').keyup(function(){ + var query=$('#searchbox').val(); + if(query.length>2){ + OC.search(query); + }else{ + $('#searchresults').remove(); + } + }); + $('#searchbox').click(function(){$('#searchbox').trigger('keyup')}); }); diff --git a/core/templates/part.searchbox.php b/core/templates/part.searchbox.php index efce47ecd24..ddf184ed5b6 100644 --- a/core/templates/part.searchbox.php +++ b/core/templates/part.searchbox.php @@ -1,3 +1,3 @@ - + -- cgit v1.2.3 From aa08196c32894333b14570348446463385058c94 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 30 Jul 2011 21:18:54 +0200 Subject: some interface work on instant search --- core/css/styles.css | 1 + core/js/js.js | 45 +++++++---------------------- search/css/results.css | 8 ++++++ search/js/result.js | 60 +++++++++++++++++++++++++++++++++++++++ search/templates/part.results.php | 15 ++++++++++ 5 files changed, 95 insertions(+), 34 deletions(-) create mode 100644 search/css/results.css create mode 100644 search/js/result.js create mode 100644 search/templates/part.results.php diff --git a/core/css/styles.css b/core/css/styles.css index 400108c454d..05546541153 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -23,6 +23,7 @@ form input[type="submit"]:active { outline:0; } form input[type="button"], form input[type="text"] { font-size:0.9em; } fieldset { padding:1em; background-color:#f7f7f7; border:1px solid #ddd; max-width:600px; margin:2em 2em 2em 3em; } legend { padding:0.5em; font-size:1.2em; } +.template{display:none;} div.controls { width:100%; margin:0px; background-color:#f7f7f7; border-bottom:1px solid #eee; position:fixed; z-index:2; } diff --git a/core/js/js.js b/core/js/js.js index fbc014006b0..f85331db60a 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -54,6 +54,10 @@ OC={ }else{ $.getScript(path); } + }else{ + if(ready){ + ready(); + } } }, addStyle:function(app,style){ @@ -66,45 +70,16 @@ OC={ }, search:function(query){ if(query){ - OC.addStyle('search','results'); - $.getJSON(OC.filePath('search','ajax','search.php')+'?query='+encodeURIComponent(query), OC.search.showResults); + OC.addScript('search','result',function(){ + OC.addStyle('search','results'); + $.getJSON(OC.filePath('search','ajax','search.php')+'?query='+encodeURIComponent(query), OC.search.showResults); + }); } } } OC.addStyle.loaded=[]; OC.addScript.loaded=[]; -OC.search.catagorizeResults=function(results){ - var types={}; - for(var i=0;i
              '); - for(var name in types){ - var type=types[name]; - if(type.length>0){ - ul.append($('
            • '+name+'
            • ')); - for(var i=0;i')); - li.append($(''+item.name+'')); - li.append($(''+item.text+'')); - ul.append(li); - } - } - } - $('body').append(ul); -} - if (!Array.prototype.filter) { Array.prototype.filter = function(fun /*, thisp*/) { var len = this.length >>> 0; @@ -162,7 +137,9 @@ $(document).ready(function(){ if(query.length>2){ OC.search(query); }else{ - $('#searchresults').remove(); + if(OC.search.hide){ + OC.search.hide(); + } } }); $('#searchbox').click(function(){$('#searchbox').trigger('keyup')}); diff --git a/search/css/results.css b/search/css/results.css new file mode 100644 index 00000000000..61b7cf541c5 --- /dev/null +++ b/search/css/results.css @@ -0,0 +1,8 @@ +#searchresults { position:fixed; top:3.3em; right:0; z-index:50; background-color:white; border:1px solid black; margin-bottom:3em; overflow:auto; max-height:80%; width:40em; } +#searchresults table{ width:100%; table-layout:fixed; top:1em;border-spacing:0} +#searchresults td{padding-right:0.3em;padding-left:0.3em;vertical-align:top} +#searchresults td.result div.text{padding-left:1em;} +#searchresults div.text,div.name{width:30em; white-space:normal} +#searchresults td.result{width:30em;} +#searchresults td.result *{cursor:pointer} +#searchresults td.type{width:7em;text-align:right; border-right:1px solid #aaa;border-bottom:none} diff --git a/search/js/result.js b/search/js/result.js new file mode 100644 index 00000000000..b550d4d314d --- /dev/null +++ b/search/js/result.js @@ -0,0 +1,60 @@ +OC.search.catagorizeResults=function(results){ + var types={}; + for(var i=0;i2){ + $('#searchbox').val(''); + }; +} +OC.search.showResults=function(results){ + if(!OC.search.showResults.loaded){ + var parent=$('
              '); + $('body').append(parent); + parent.load(OC.filePath('search','templates','part.results.php'),function(){ + OC.search.showResults.loaded=true; + $('#searchresults').click(function(event){ + event.stopPropagation(); + }); + $(window).click(function(event){ + OC.search.hide(); + }); + OC.search.showResults(results); + }); + }else{ + var types=OC.search.catagorizeResults(results); + $('#searchresults').show(); + $('#searchresults tr.result').remove(); + for(var name in types){ + var type=types[name]; + if(type.length>0){ + var row=$('#searchresults tr.template').clone(); + row.removeClass('template'); + row.addClass('result'); + row.children('td.type').text(name); + row.find('td.result a').attr('href',type[0].link); + row.find('td.result div.name').text(type[0].name); + row.find('td.result div.text').text(type[0].text); + $('#searchresults tbody').append(row); + for(var i=1;i + + + + + + + +
              + +
              +
              +
              +
              +
              -- cgit v1.2.3 From d6faa89ed720da7319923cba33a83d0210216d57 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Sat, 30 Jul 2011 21:58:00 +0200 Subject: fix header on error page --- core/css/styles.css | 2 +- core/templates/404.php | 4 ++-- core/templates/error.php | 7 +------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/core/css/styles.css b/core/css/styles.css index 05546541153..eb6b04d28df 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -32,7 +32,7 @@ div.controls { width:100%; margin:0px; background-color:#f7f7f7; border-bottom:1 #body-login p.info { width:16em; margin:2em auto; padding:1em; background-color:#eee; border:1px solid #ccc; -moz-border-radius:10px; -webkit-border-radius:10px; border-radius:10px; } #body-login p.info a { font-weight:bold; } -#login div.header { margin-top:-2em; height:10em; +#body-login header { margin-top:-2em; height:10em; -moz-box-shadow:0 0 5px #000; -webkit-box-shadow:0 0 20px #000; box-shadow:0 0 20px #000; background: #1d2d44; /* Old browsers */ background: -moz-linear-gradient(top, #35537a 0%, #1d2d42 100%); /* FF3.6+ */ diff --git a/core/templates/404.php b/core/templates/404.php index d042944c193..67ce8c8026c 100644 --- a/core/templates/404.php +++ b/core/templates/404.php @@ -8,11 +8,11 @@ if(!isset($_)){//also provide standalone error page } ?>
              - " alt="ownCloud" /> +
              ownCloud
              • t( 'Error 404, Cloud not found' ); ?>

              -
              \ No newline at end of file + diff --git a/core/templates/error.php b/core/templates/error.php index ae3f029708f..aa8a8d473b4 100644 --- a/core/templates/error.php +++ b/core/templates/error.php @@ -1,10 +1,5 @@ -
              - " alt="ownCloud" /> +
              ownCloud
              • -- cgit v1.2.3