summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/activity/iconsumer.php5
-rw-r--r--lib/public/activity/imanager.php6
-rw-r--r--lib/public/appframework/app.php28
-rw-r--r--lib/public/appframework/controller.php7
-rw-r--r--lib/public/appframework/http.php8
-rw-r--r--lib/public/appframework/http/jsonresponse.php11
-rw-r--r--lib/public/appframework/http/response.php4
-rw-r--r--lib/public/appframework/http/templateresponse.php26
-rw-r--r--lib/public/appframework/iapi.php4
-rw-r--r--lib/public/appframework/middleware.php4
-rw-r--r--lib/public/authentication/iapachebackend.php5
-rw-r--r--lib/public/contacts/imanager.php4
-rw-r--r--lib/public/db.php2
-rw-r--r--lib/public/defaults.php28
-rw-r--r--lib/public/files/alreadyexistsexception.php8
-rw-r--r--lib/public/files/entitytoolargeexception.php8
-rw-r--r--lib/public/files/file.php5
-rw-r--r--lib/public/files/folder.php5
-rw-r--r--lib/public/files/invalidcontentexception.php8
-rw-r--r--lib/public/files/invalidpathexception.php8
-rw-r--r--lib/public/files/node.php5
-rw-r--r--lib/public/files/notenoughspaceexception.php8
-rw-r--r--lib/public/files/notfoundexception.php8
-rw-r--r--lib/public/files/notpermittedexception.php8
-rw-r--r--lib/public/files/storage.php5
-rw-r--r--lib/public/iaddressbook.php5
-rw-r--r--lib/public/icontainer.php2
-rw-r--r--lib/public/idbconnection.php2
-rw-r--r--lib/public/iservercontainer.php11
-rw-r--r--lib/public/share.php67
30 files changed, 267 insertions, 38 deletions
diff --git a/lib/public/activity/iconsumer.php b/lib/public/activity/iconsumer.php
index a0134a379dc..9afacf4e745 100644
--- a/lib/public/activity/iconsumer.php
+++ b/lib/public/activity/iconsumer.php
@@ -20,6 +20,11 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Activity/IConsumer interface
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Activity;
diff --git a/lib/public/activity/imanager.php b/lib/public/activity/imanager.php
index 90215d637c0..086e430d677 100644
--- a/lib/public/activity/imanager.php
+++ b/lib/public/activity/imanager.php
@@ -20,6 +20,11 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Activity/IManager interface
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Activity;
@@ -47,7 +52,6 @@ interface IManager {
*
* $callable has to return an instance of OCA\Activity\IConsumer
*
- * @param string $key
* @param \Closure $callable
*/
function registerConsumer(\Closure $callable);
diff --git a/lib/public/appframework/app.php b/lib/public/appframework/app.php
index 6ac48bf102a..90150245c41 100644
--- a/lib/public/appframework/app.php
+++ b/lib/public/appframework/app.php
@@ -20,7 +20,13 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * AppFramework/App class
+ */
+
namespace OCP\AppFramework;
+use OC\AppFramework\routing\RouteConfig;
/**
@@ -48,6 +54,28 @@ class App {
}
/**
+ * This function is to be called to create single routes and restful routes based on the given $routes array.
+ *
+ * Example code in routes.php of tasks app (it will register two restful resources):
+ * $routes = array(
+ * 'resources' => array(
+ * 'lists' => array('url' => '/tasklists'),
+ * 'tasks' => array('url' => '/tasklists/{listId}/tasks')
+ * )
+ * );
+ *
+ * $a = new TasksApp();
+ * $a->registerRoutes($this, $routes);
+ *
+ * @param \OC_Router $router
+ * @param array $routes
+ */
+ public function registerRoutes($router, $routes) {
+ $routeConfig = new RouteConfig($this->container, $router, $routes);
+ $routeConfig->register();
+ }
+
+ /**
* This function is called by the routing component to fire up the frameworks dispatch mechanism.
*
* Example code in routes.php of the task app:
diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php
index 320e0cfebb2..dc8da967871 100644
--- a/lib/public/appframework/controller.php
+++ b/lib/public/appframework/controller.php
@@ -20,6 +20,10 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * AppFramework\Controller class
+ */
namespace OCP\AppFramework;
@@ -34,16 +38,19 @@ use OCP\IRequest;
abstract class Controller {
/**
+ * app container for dependency injection
* @var \OCP\AppFramework\IAppContainer
*/
protected $app;
/**
+ * current request
* @var \OCP\IRequest
*/
protected $request;
/**
+ * constructor of the controller
* @param IAppContainer $app interface to the app
* @param IRequest $request an instance of the request
*/
diff --git a/lib/public/appframework/http.php b/lib/public/appframework/http.php
index c584d4ec670..60f314202cc 100644
--- a/lib/public/appframework/http.php
+++ b/lib/public/appframework/http.php
@@ -20,10 +20,16 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * AppFramework\HTTP class
+ */
namespace OCP\AppFramework;
-
+/**
+ * Base class which contains constants for HTTP status codes
+ */
class Http {
const STATUS_CONTINUE = 100;
diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php
index 7c2b609bc2e..b54b23a34e6 100644
--- a/lib/public/appframework/http/jsonresponse.php
+++ b/lib/public/appframework/http/jsonresponse.php
@@ -20,6 +20,10 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * AppFramework\HTTP\JSONResponse class
+ */
namespace OCP\AppFramework\Http;
@@ -30,10 +34,15 @@ use OCP\AppFramework\Http;
*/
class JSONResponse extends Response {
+ /**
+ * response data
+ * @var array|object
+ */
protected $data;
/**
+ * constructor of JSONResponse
* @param array|object $data the object or array that should be transformed
* @param int $statusCode the Http status code, defaults to 200
*/
@@ -55,7 +64,7 @@ class JSONResponse extends Response {
/**
* Sets values in the data json array
- * @param array|object $params an array or object which will be transformed
+ * @param array|object $data an array or object which will be transformed
* to JSON
*/
public function setData($data){
diff --git a/lib/public/appframework/http/response.php b/lib/public/appframework/http/response.php
index f776878a814..0f5a18ca4fe 100644
--- a/lib/public/appframework/http/response.php
+++ b/lib/public/appframework/http/response.php
@@ -20,6 +20,10 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * AppFramework\HTTP\Response class
+ */
namespace OCP\AppFramework\Http;
diff --git a/lib/public/appframework/http/templateresponse.php b/lib/public/appframework/http/templateresponse.php
index 6156f8062fc..2200a38beca 100644
--- a/lib/public/appframework/http/templateresponse.php
+++ b/lib/public/appframework/http/templateresponse.php
@@ -20,6 +20,10 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * AppFramework\HTTP\TemplateResponse class
+ */
namespace OCP\AppFramework\Http;
@@ -29,14 +33,34 @@ namespace OCP\AppFramework\Http;
*/
class TemplateResponse extends Response {
+ /**
+ * name of the template
+ * @var string
+ */
protected $templateName;
+
+ /**
+ * parameters
+ * @var array
+ */
protected $params;
+
+ /**
+ * rendering type (admin, user, blank)
+ * @var string
+ */
protected $renderAs;
+
+ /**
+ * app name
+ * @var string
+ */
protected $appName;
/**
- * @param string $templateName the name of the template
+ * constructor of TemplateResponse
* @param string $appName the name of the app to load the template from
+ * @param string $templateName the name of the template
*/
public function __construct($appName, $templateName) {
$this->templateName = $templateName;
diff --git a/lib/public/appframework/iapi.php b/lib/public/appframework/iapi.php
index a22b056635e..963e870f79b 100644
--- a/lib/public/appframework/iapi.php
+++ b/lib/public/appframework/iapi.php
@@ -20,6 +20,10 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * AppFramework/IApi interface
+ */
namespace OCP\AppFramework;
diff --git a/lib/public/appframework/middleware.php b/lib/public/appframework/middleware.php
index c4ee1c0dbae..24f31939935 100644
--- a/lib/public/appframework/middleware.php
+++ b/lib/public/appframework/middleware.php
@@ -20,6 +20,10 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * AppFramework\Middleware class
+ */
namespace OCP\AppFramework;
diff --git a/lib/public/authentication/iapachebackend.php b/lib/public/authentication/iapachebackend.php
index 2d2f8c4e486..3979a14302e 100644
--- a/lib/public/authentication/iapachebackend.php
+++ b/lib/public/authentication/iapachebackend.php
@@ -20,6 +20,11 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Authentication/IApacheBackend interface
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Authentication;
diff --git a/lib/public/contacts/imanager.php b/lib/public/contacts/imanager.php
index 3bfbca7be50..973d48be5ec 100644
--- a/lib/public/contacts/imanager.php
+++ b/lib/public/contacts/imanager.php
@@ -119,11 +119,15 @@ namespace OCP\Contacts {
function isEnabled();
/**
+ * Registers an address book
+ *
* @param \OCP\IAddressBook $address_book
*/
function registerAddressBook(\OCP\IAddressBook $address_book);
/**
+ * Unregisters an address book
+ *
* @param \OCP\IAddressBook $address_book
*/
function unregisterAddressBook(\OCP\IAddressBook $address_book);
diff --git a/lib/public/db.php b/lib/public/db.php
index b9424b53862..c9997c79c3c 100644
--- a/lib/public/db.php
+++ b/lib/public/db.php
@@ -37,6 +37,8 @@ class DB {
/**
* Prepare a SQL query
* @param string $query Query string
+ * @param int $limit Limit of the SQL statement
+ * @param int $offset Offset of the SQL statement
* @return \MDB2_Statement_Common prepared SQL query
*
* SQL query via MDB2 prepare(), needs to be execute()'d!
diff --git a/lib/public/defaults.php b/lib/public/defaults.php
index 8f7853a86a3..34b68903ee8 100644
--- a/lib/public/defaults.php
+++ b/lib/public/defaults.php
@@ -30,19 +30,27 @@
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
-/*
+/**
* public api to access default strings and urls for your templates
*/
class Defaults {
+ /**
+ * \OC_Defaults instance to retrieve the defaults
+ * @return string
+ */
private $defaults;
+ /**
+ * creates a \OC_Defaults instance which is used in all methods to retrieve the
+ * actual defaults
+ */
function __construct() {
$this->defaults = new \OC_Defaults();
}
/**
- * @breif get base URL for the organisation behind your ownCloud instance
+ * get base URL for the organisation behind your ownCloud instance
* @return string
*/
public function getBaseUrl() {
@@ -50,7 +58,7 @@ class Defaults {
}
/**
- * @breif link to the desktop sync client
+ * link to the desktop sync client
* @return string
*/
public function getSyncClientUrl() {
@@ -58,7 +66,7 @@ class Defaults {
}
/**
- * @breif base URL to the documentation of your ownCloud instance
+ * base URL to the documentation of your ownCloud instance
* @return string
*/
public function getDocBaseUrl() {
@@ -66,7 +74,7 @@ class Defaults {
}
/**
- * @breif name of your ownCloud instance
+ * name of your ownCloud instance
* @return string
*/
public function getName() {
@@ -74,7 +82,7 @@ class Defaults {
}
/**
- * @breif Entity behind your onwCloud instance
+ * Entity behind your onwCloud instance
* @return string
*/
public function getEntity() {
@@ -82,7 +90,7 @@ class Defaults {
}
/**
- * @breif ownCloud slogan
+ * ownCloud slogan
* @return string
*/
public function getSlogan() {
@@ -90,7 +98,7 @@ class Defaults {
}
/**
- * @breif logo claim
+ * logo claim
* @return string
*/
public function getLogoClaim() {
@@ -98,7 +106,7 @@ class Defaults {
}
/**
- * @breif footer, short version
+ * footer, short version
* @return string
*/
public function getShortFooter() {
@@ -106,7 +114,7 @@ class Defaults {
}
/**
- * @breif footer, long version
+ * footer, long version
* @return string
*/
public function getLongFooter() {
diff --git a/lib/public/files/alreadyexistsexception.php b/lib/public/files/alreadyexistsexception.php
index 3132e3b0c31..7bea947aef0 100644
--- a/lib/public/files/alreadyexistsexception.php
+++ b/lib/public/files/alreadyexistsexception.php
@@ -20,8 +20,16 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/AlreadyExistsException class
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
+/**
+ * Exception for already existing files/folders
+ */
class AlreadyExistsException extends \Exception {}
diff --git a/lib/public/files/entitytoolargeexception.php b/lib/public/files/entitytoolargeexception.php
index e0d93ccbcd0..eaa68a548b9 100644
--- a/lib/public/files/entitytoolargeexception.php
+++ b/lib/public/files/entitytoolargeexception.php
@@ -20,8 +20,16 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/EntityTooLargeException class
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
+/**
+ * Exception for too large entity
+ */
class EntityTooLargeException extends \Exception {}
diff --git a/lib/public/files/file.php b/lib/public/files/file.php
index 730213039d0..c6cda59f9b0 100644
--- a/lib/public/files/file.php
+++ b/lib/public/files/file.php
@@ -20,6 +20,11 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/File interface
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
diff --git a/lib/public/files/folder.php b/lib/public/files/folder.php
index 5c9785db571..7fec1c529a5 100644
--- a/lib/public/files/folder.php
+++ b/lib/public/files/folder.php
@@ -20,6 +20,11 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/Folder interface
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
diff --git a/lib/public/files/invalidcontentexception.php b/lib/public/files/invalidcontentexception.php
index 2e1356e2ba3..3dfe7378c4d 100644
--- a/lib/public/files/invalidcontentexception.php
+++ b/lib/public/files/invalidcontentexception.php
@@ -20,8 +20,16 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/InvalidContentException class
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
+/**
+ * Exception for invalid content
+ */
class InvalidContentException extends \Exception {}
diff --git a/lib/public/files/invalidpathexception.php b/lib/public/files/invalidpathexception.php
index 893eb1e43f8..8ecfa7d89ad 100644
--- a/lib/public/files/invalidpathexception.php
+++ b/lib/public/files/invalidpathexception.php
@@ -20,8 +20,16 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/InvalidPathException class
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
+/**
+ * Exception for invalid path
+ */
class InvalidPathException extends \Exception {}
diff --git a/lib/public/files/node.php b/lib/public/files/node.php
index e38bfa3b2ef..972b1cfa492 100644
--- a/lib/public/files/node.php
+++ b/lib/public/files/node.php
@@ -20,6 +20,11 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/Node interface
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
diff --git a/lib/public/files/notenoughspaceexception.php b/lib/public/files/notenoughspaceexception.php
index 1597a4518b0..17f91b31bfc 100644
--- a/lib/public/files/notenoughspaceexception.php
+++ b/lib/public/files/notenoughspaceexception.php
@@ -20,8 +20,16 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/NotEnoughSpaceException class
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
+/**
+ * Exception for not enough space
+ */
class NotEnoughSpaceException extends \Exception {}
diff --git a/lib/public/files/notfoundexception.php b/lib/public/files/notfoundexception.php
index 489e43fc5fb..cb35199220b 100644
--- a/lib/public/files/notfoundexception.php
+++ b/lib/public/files/notfoundexception.php
@@ -20,8 +20,16 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/NotFoundException class
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
+/**
+ * Exception for not found entity
+ */
class NotFoundException extends \Exception {}
diff --git a/lib/public/files/notpermittedexception.php b/lib/public/files/notpermittedexception.php
index a5be43dbf57..e37bd6fad3c 100644
--- a/lib/public/files/notpermittedexception.php
+++ b/lib/public/files/notpermittedexception.php
@@ -20,8 +20,16 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/NotPermittedException class
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
+/**
+ * Exception for not permitted action
+ */
class NotPermittedException extends \Exception {}
diff --git a/lib/public/files/storage.php b/lib/public/files/storage.php
index 7a7d5ec1efc..194b42a6481 100644
--- a/lib/public/files/storage.php
+++ b/lib/public/files/storage.php
@@ -20,6 +20,11 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * Files/Storage interface
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
diff --git a/lib/public/iaddressbook.php b/lib/public/iaddressbook.php
index 77e8750d9da..dcfe08012e6 100644
--- a/lib/public/iaddressbook.php
+++ b/lib/public/iaddressbook.php
@@ -20,6 +20,11 @@
*
*/
+/**
+ * Public interface of ownCloud for apps to use.
+ * IAddressBook interface
+ */
+
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP {
diff --git a/lib/public/icontainer.php b/lib/public/icontainer.php
index 6b7052cc4f4..eaffa5d5a06 100644
--- a/lib/public/icontainer.php
+++ b/lib/public/icontainer.php
@@ -64,7 +64,7 @@ interface IContainer {
* In case the parameter is false the service will be recreated on every call.
*
* @param string $name
- * @param callable $closure
+ * @param \Closure $closure
* @param bool $shared
* @return void
*/
diff --git a/lib/public/idbconnection.php b/lib/public/idbconnection.php
index 17e3de0ffe7..656b5e7e5b2 100644
--- a/lib/public/idbconnection.php
+++ b/lib/public/idbconnection.php
@@ -45,7 +45,7 @@ interface IDBConnection {
/**
* Used to get the id of the just inserted element
- * @param string $tableName the name of the table where we inserted the item
+ * @param string $table the name of the table where we inserted the item
* @return int the id of the inserted element
*/
public function lastInsertId($table = null);
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index 36296a59850..b958d2d03f4 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -100,11 +100,15 @@ interface IServerContainer {
function getUserSession();
/**
+ * Returns the navigation manager
+ *
* @return \OCP\INavigationManager
*/
function getNavigationManager();
/**
+ * Returns the config manager
+ *
* @return \OCP\IConfig
*/
function getConfig();
@@ -117,11 +121,15 @@ interface IServerContainer {
function getL10N($app);
/**
+ * Returns the URL generator
+ *
* @return \OCP\IURLGenerator
*/
function getURLGenerator();
/**
+ * Returns the Helper
+ *
* @return \OCP\IHelper
*/
function getHelper();
@@ -155,7 +163,8 @@ interface IServerContainer {
function getDatabaseConnection();
/**
- * @brief Returns an avatar manager, used for avatar functionality
+ * Returns an avatar manager, used for avatar functionality
+ *
* @return \OCP\IAvatarManager
*/
function getAvatarManager();
diff --git a/lib/public/share.php b/lib/public/share.php
index caa274b8579..6b3397c85c6 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -244,7 +244,9 @@ class Share {
* Get the items of item type shared with the current user
* @param string Item type
* @param int Format (optional) Format type must be defined by the backend
+ * @param mixed Parameters (optional)
* @param int Number of items to return (optional) Returns all by default
+ * @param bool include collections (optional)
* @return Return depends on format
*/
public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE,
@@ -256,8 +258,10 @@ class Share {
/**
* Get the item of item type shared with the current user
* @param string $itemType
- * @param string $ItemTarget
+ * @param string $itemTarget
* @param int $format (optional) Format type must be defined by the backend
+ * @param mixed Parameters (optional)
+ * @param bool include collections (optional)
* @return Return depends on format
*/
public static function getItemSharedWith($itemType, $itemTarget, $format = self::FORMAT_NONE,
@@ -268,8 +272,8 @@ class Share {
/**
* Get the item of item type shared with a given user by source
- * @param string $ItemType
- * @param string $ItemSource
+ * @param string $itemType
+ * @param string $itemSource
* @param string $user User user to whom the item was shared
* @return array Return list of items with file_target, permissions and expiration
*/
@@ -419,11 +423,13 @@ class Share {
* @param string Item source
* @param string Owner
* @param bool Include collections
+ * @praram bool check expire date
* @return Return array of users
*/
- public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false) {
+ public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false, $checkExpireDate = true) {
+
$users = array();
- $items = self::getItems($itemType, $itemSource, null, null, $uidOwner, self::FORMAT_NONE, null, -1, $includeCollections);
+ $items = self::getItems($itemType, $itemSource, null, null, $uidOwner, self::FORMAT_NONE, null, -1, $includeCollections, false, $checkExpireDate);
if ($items) {
foreach ($items as $item) {
if ((int)$item['share_type'] === self::SHARE_TYPE_USER) {
@@ -823,11 +829,12 @@ class Share {
$date = null;
} else {
$date = new \DateTime($date);
- $date = date('Y-m-d H:i', $date->format('U') - $date->getOffset());
}
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?');
+ $query->bindValue(1, $date, 'datetime');
foreach ($items as $item) {
- $query->execute(array($date, $item['id']));
+ $query->bindValue(2, (int) $item['id']);
+ $query->execute();
}
return true;
}
@@ -843,7 +850,8 @@ class Share {
protected static function expireItem(array $item) {
if (!empty($item['expiration'])) {
$now = new \DateTime();
- $expirationDate = new \DateTime($item['expiration'], new \DateTimeZone('UTC'));
+ $expirationDate = \Doctrine\DBAL\Types\Type::getType('datetime')
+ ->convertToPhpValue($item['expiration'], \OC_DB::getConnection()->getDatabasePlatform());
if ($now > $expirationDate) {
self::unshareItem($item);
return true;
@@ -860,12 +868,14 @@ class Share {
protected static function unshareItem(array $item) {
// Pass all the vars we have for now, they may be useful
$hookParams = array(
- 'itemType' => $item['item_type'],
- 'itemSource' => $item['item_source'],
- 'shareType' => $item['share_type'],
- 'shareWith' => $item['share_with'],
- 'itemParent' => $item['parent'],
+ 'itemType' => $item['item_type'],
+ 'itemSource' => $item['item_source'],
+ 'shareType' => $item['share_type'],
+ 'shareWith' => $item['share_with'],
+ 'itemParent' => $item['parent'],
+ 'uidOwner' => $item['uid_owner'],
);
+
\OC_Hook::emit('OCP\Share', 'pre_unshare', $hookParams + array(
'fileSource' => $item['file_source'],
));
@@ -954,6 +964,8 @@ class Share {
* @param mixed Parameters to pass to formatItems()
* @param int Number of items to return, -1 to return all matches (optional)
* @param bool Include collection item types (optional)
+ * @param bool TODO (optional)
+ * @prams bool check expire date
* @return mixed
*
* See public functions getItem(s)... for parameter usage
@@ -961,7 +973,7 @@ class Share {
*/
private static function getItems($itemType, $item = null, $shareType = null, $shareWith = null,
$uidOwner = null, $format = self::FORMAT_NONE, $parameters = null, $limit = -1,
- $includeCollections = false, $itemShareWithBySource = false) {
+ $includeCollections = false, $itemShareWithBySource = false, $checkExpireDate = true) {
if (!self::isEnabled()) {
if ($limit == 1 || (isset($uidOwner) && isset($item))) {
return false;
@@ -1101,19 +1113,19 @@ class Share {
if ($format == self::FORMAT_STATUSES) {
if ($itemType == 'file' || $itemType == 'folder') {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`,'
- .' `share_type`, `file_source`, `path`, `expiration`, `storage`, `mail_send`';
+ .' `share_type`, `file_source`, `path`, `expiration`, `storage`, `share_with`, `mail_send`, `uid_owner`';
} else {
- $select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `expiration`, `mail_send`';
+ $select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `expiration`, `mail_send`, `uid_owner`';
}
} else {
if (isset($uidOwner)) {
if ($itemType == 'file' || $itemType == 'folder') {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`,'
.' `share_type`, `share_with`, `file_source`, `path`, `permissions`, `stime`,'
- .' `expiration`, `token`, `storage`, `mail_send`';
+ .' `expiration`, `token`, `storage`, `mail_send`, `uid_owner`';
} else {
$select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `permissions`,'
- .' `stime`, `file_source`, `expiration`, `token`, `mail_send`';
+ .' `stime`, `file_source`, `expiration`, `token`, `mail_send`, `uid_owner`';
}
} else {
if ($fileDependent) {
@@ -1227,8 +1239,10 @@ class Share {
}
}
}
- if (self::expireItem($row)) {
- continue;
+ if($checkExpireDate) {
+ if (self::expireItem($row)) {
+ continue;
+ }
}
// Check if resharing is allowed, if not remove share permission
if (isset($row['permissions']) && !self::isResharingAllowed()) {
@@ -1354,8 +1368,11 @@ class Share {
* @param string Item source
* @param int SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
* @param string User or group the item is being shared with
+ * @param string User that is the owner of shared item
* @param int CRUDS permissions
* @param bool|array Parent folder target (optional)
+ * @param string token (optional)
+ * @param string name of the source item (optional)
* @return bool Returns true on success or false on failure
*/
private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
@@ -1593,6 +1610,7 @@ class Share {
* @param string Item source
* @param int SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
* @param string User or group the item is being shared with
+ * @param string User that is the owner of shared item
* @param string The suggested target originating from a reshare (optional)
* @param int The id of the parent group share (optional)
* @return string Item target
@@ -1780,6 +1798,7 @@ class Share {
*/
/**
+ * Function that is called after a user is deleted. Cleans up the shares of that user.
* @param array arguments
*/
public static function post_deleteUser($arguments) {
@@ -1796,6 +1815,8 @@ class Share {
}
/**
+ * Function that is called after a user is added to a group.
+ * TODO what does it do?
* @param array arguments
*/
public static function post_addToGroup($arguments) {
@@ -1829,6 +1850,7 @@ class Share {
}
/**
+ * Function that is called after a user is removed from a group. Shares are cleaned up.
* @param array arguments
*/
public static function post_removeFromGroup($arguments) {
@@ -1848,6 +1870,7 @@ class Share {
}
/**
+ * Function that is called after a group is removed. Cleans up the shares to that group.
* @param array arguments
*/
public static function post_deleteGroup($arguments) {
@@ -1894,7 +1917,7 @@ interface Share_Backend {
* Converts the shared item sources back into the item in the specified format
* @param array Shared items
* @param int Format
- * @return ?
+ * @return TODO
*
* The items array is a 3-dimensional array with the item_source as the
* first key and the share id as the second key to an array with the share
@@ -1923,6 +1946,8 @@ interface Share_Backend_File_Dependent extends Share_Backend {
/**
* Get the file path of the item
+ * @param string Item source
+ * @param string User that is the owner of shared item
*/
public function getFilePath($itemSource, $uidOwner);