summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/l10n/es.js2
-rw-r--r--lib/l10n/es.json2
-rw-r--r--lib/l10n/lt_LT.js5
-rw-r--r--lib/l10n/lt_LT.json5
-rw-r--r--lib/l10n/tr.js2
-rw-r--r--lib/l10n/tr.json2
-rw-r--r--lib/private/appframework/http/request.php5
-rw-r--r--lib/private/db/adapteroci8.php3
-rw-r--r--lib/private/db/connection.php3
-rw-r--r--lib/private/notification/inotification.php14
-rw-r--r--lib/private/notification/notification.php31
-rw-r--r--lib/private/share/share.php17
-rw-r--r--lib/private/share20/defaultshareprovider.php53
-rw-r--r--lib/private/share20/ishareprovider.php13
-rw-r--r--lib/private/share20/manager.php76
-rw-r--r--lib/private/template.php11
-rw-r--r--lib/private/template/functions.php2
-rw-r--r--lib/private/util.php9
18 files changed, 156 insertions, 99 deletions
diff --git a/lib/l10n/es.js b/lib/l10n/es.js
index 3eb2e71a7d4..9ee1f96f034 100644
--- a/lib/l10n/es.js
+++ b/lib/l10n/es.js
@@ -87,6 +87,7 @@ OC.L10N.register(
"Sharing %s failed, because the backend does not allow shares from type %i" : "No se pudo compartir %s porque el repositorio no permite recursos compartidos del tipo %i",
"Sharing %s failed, because the file does not exist" : "No se pudo compartir %s porque el archivo no existe",
"You are not allowed to share %s" : "Usted no está autorizado para compartir %s",
+ "Sharing %s failed, because you can not share with yourself" : "Se falló al compartir %s, porque no puedes compartir contigo mismo",
"Sharing %s failed, because the user %s does not exist" : "Se ha fallado al compartir %s, ya que el usuario %s no existe",
"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "Se ha fallado al compartir %s, ya que el usuario %s no es miembro de ningún grupo del que %s sea miembro",
"Sharing %s failed, because this item is already shared with %s" : "Se falló al compartir %s, ya que este elemento ya está compartido con %s",
@@ -105,6 +106,7 @@ OC.L10N.register(
"Sharing backend %s must implement the interface OCP\\Share_Backend" : "El motor compartido %s debe implementar la interfaz OCP\\Share_Backend",
"Sharing backend %s not found" : "El motor compartido %s no se ha encontrado",
"Sharing backend for %s not found" : "Motor compartido para %s no encontrado",
+ "Sharing failed, because the user %s is the original sharer" : "Se ha fallado al compartir, ya que el usuario %s es el compartidor original",
"Sharing %s failed, because the permissions exceed permissions granted to %s" : "Se ha fallado al compartir %s, ya que los permisos superan los permisos otorgados a %s",
"Sharing %s failed, because resharing is not allowed" : "Se ha fallado al compartir %s, ya que volver a compartir no está permitido",
"Sharing %s failed, because the sharing backend for %s could not find its source" : "Se ha fallado al compartir %s porque el motor compartido para %s podría no encontrar su origen",
diff --git a/lib/l10n/es.json b/lib/l10n/es.json
index bbc50f2b5b8..2d67df87024 100644
--- a/lib/l10n/es.json
+++ b/lib/l10n/es.json
@@ -85,6 +85,7 @@
"Sharing %s failed, because the backend does not allow shares from type %i" : "No se pudo compartir %s porque el repositorio no permite recursos compartidos del tipo %i",
"Sharing %s failed, because the file does not exist" : "No se pudo compartir %s porque el archivo no existe",
"You are not allowed to share %s" : "Usted no está autorizado para compartir %s",
+ "Sharing %s failed, because you can not share with yourself" : "Se falló al compartir %s, porque no puedes compartir contigo mismo",
"Sharing %s failed, because the user %s does not exist" : "Se ha fallado al compartir %s, ya que el usuario %s no existe",
"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "Se ha fallado al compartir %s, ya que el usuario %s no es miembro de ningún grupo del que %s sea miembro",
"Sharing %s failed, because this item is already shared with %s" : "Se falló al compartir %s, ya que este elemento ya está compartido con %s",
@@ -103,6 +104,7 @@
"Sharing backend %s must implement the interface OCP\\Share_Backend" : "El motor compartido %s debe implementar la interfaz OCP\\Share_Backend",
"Sharing backend %s not found" : "El motor compartido %s no se ha encontrado",
"Sharing backend for %s not found" : "Motor compartido para %s no encontrado",
+ "Sharing failed, because the user %s is the original sharer" : "Se ha fallado al compartir, ya que el usuario %s es el compartidor original",
"Sharing %s failed, because the permissions exceed permissions granted to %s" : "Se ha fallado al compartir %s, ya que los permisos superan los permisos otorgados a %s",
"Sharing %s failed, because resharing is not allowed" : "Se ha fallado al compartir %s, ya que volver a compartir no está permitido",
"Sharing %s failed, because the sharing backend for %s could not find its source" : "Se ha fallado al compartir %s porque el motor compartido para %s podría no encontrar su origen",
diff --git a/lib/l10n/lt_LT.js b/lib/l10n/lt_LT.js
index 27392c84d2c..c93903ff75e 100644
--- a/lib/l10n/lt_LT.js
+++ b/lib/l10n/lt_LT.js
@@ -1,6 +1,9 @@
OC.L10N.register(
"lib",
{
+ "Cannot write into \"config\" directory!" : "Negalima rašyti į \"config\" aplanką!",
+ "This can usually be fixed by giving the webserver write access to the config directory" : "Tai gali būti ištaisyta suteikiant web serveriui rašymo teises į config aplanką",
+ "PHP %s or higher is required." : "Reikalinga PHP %s arba aukštesnė.",
"Help" : "Pagalba",
"Personal" : "Asmeniniai",
"Users" : "Vartotojai",
@@ -17,6 +20,8 @@ OC.L10N.register(
"_%n minute ago_::_%n minutes ago_" : ["prieš %n min.","Prieš % minutes","Prieš %n minučių"],
"seconds ago" : "prieš sekundę",
"web services under your control" : "jūsų valdomos web paslaugos",
+ "Empty filename is not allowed" : "Tuščias failo pavadinimas neleidžiamas",
+ "File name is a reserved word" : "Failo pavadinimas negalimas, žodis rezervuotas",
"File name contains at least one invalid character" : "Failo vardas sudarytas iš neleistinų simbolių",
"App directory already exists" : "Programos aplankas jau egzistuoja",
"Can't create app folder. Please fix permissions. %s" : "Nepavyksta sukurti aplanko. Prašome pataisyti leidimus. %s",
diff --git a/lib/l10n/lt_LT.json b/lib/l10n/lt_LT.json
index 674939a7a0a..2784c3aefc1 100644
--- a/lib/l10n/lt_LT.json
+++ b/lib/l10n/lt_LT.json
@@ -1,4 +1,7 @@
{ "translations": {
+ "Cannot write into \"config\" directory!" : "Negalima rašyti į \"config\" aplanką!",
+ "This can usually be fixed by giving the webserver write access to the config directory" : "Tai gali būti ištaisyta suteikiant web serveriui rašymo teises į config aplanką",
+ "PHP %s or higher is required." : "Reikalinga PHP %s arba aukštesnė.",
"Help" : "Pagalba",
"Personal" : "Asmeniniai",
"Users" : "Vartotojai",
@@ -15,6 +18,8 @@
"_%n minute ago_::_%n minutes ago_" : ["prieš %n min.","Prieš % minutes","Prieš %n minučių"],
"seconds ago" : "prieš sekundę",
"web services under your control" : "jūsų valdomos web paslaugos",
+ "Empty filename is not allowed" : "Tuščias failo pavadinimas neleidžiamas",
+ "File name is a reserved word" : "Failo pavadinimas negalimas, žodis rezervuotas",
"File name contains at least one invalid character" : "Failo vardas sudarytas iš neleistinų simbolių",
"App directory already exists" : "Programos aplankas jau egzistuoja",
"Can't create app folder. Please fix permissions. %s" : "Nepavyksta sukurti aplanko. Prašome pataisyti leidimus. %s",
diff --git a/lib/l10n/tr.js b/lib/l10n/tr.js
index 963bbbacc24..e2bf3c5a659 100644
--- a/lib/l10n/tr.js
+++ b/lib/l10n/tr.js
@@ -87,6 +87,7 @@ OC.L10N.register(
"Sharing %s failed, because the backend does not allow shares from type %i" : "Arka uç %i türündeki paylaşımlara izin vermediğinden %s paylaşımı başarısız",
"Sharing %s failed, because the file does not exist" : "%s paylaşımı, dosya mevcut olmadığından başarısız oldu",
"You are not allowed to share %s" : "%s paylaşımını yapma izniniz yok",
+ "Sharing %s failed, because you can not share with yourself" : "%s paylaşımı başarısız, kendiniz ile paylaşamazsınız",
"Sharing %s failed, because the user %s does not exist" : "%s paylaşımı, %s kullanıcısı mevcut olmadığından başarısız oldu",
"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "%s paylaşımı, %s kullanıcısının %s üyeliklerinden birine sahip olmadığından başarısız oldu",
"Sharing %s failed, because this item is already shared with %s" : "%s paylaşımı, %s ile zaten paylaşıldığından dolayı başarısız oldu",
@@ -105,6 +106,7 @@ OC.L10N.register(
"Sharing backend %s must implement the interface OCP\\Share_Backend" : "Paylaşma arka ucu %s OCP\\Share_Backend arayüzünü desteklemeli",
"Sharing backend %s not found" : "Paylaşım arka ucu %s bulunamadı",
"Sharing backend for %s not found" : "%s için paylaşım arka ucu bulunamadı",
+ "Sharing failed, because the user %s is the original sharer" : "%s kullanıcısı özgün paylaşan kişi olduğundan başarısız oldu",
"Sharing %s failed, because the permissions exceed permissions granted to %s" : "%s paylaşımı, izinler %s için verilen izinleri aştığından dolayı başarısız oldu",
"Sharing %s failed, because resharing is not allowed" : "%s paylaşımı, tekrar paylaşımın izin verilmemesinden dolayı başarısız oldu",
"Sharing %s failed, because the sharing backend for %s could not find its source" : "%s paylaşımı, %s için arka ucun kaynağını bulamamasından dolayı başarısız oldu",
diff --git a/lib/l10n/tr.json b/lib/l10n/tr.json
index 1880b659fa9..fafe0c26f7a 100644
--- a/lib/l10n/tr.json
+++ b/lib/l10n/tr.json
@@ -85,6 +85,7 @@
"Sharing %s failed, because the backend does not allow shares from type %i" : "Arka uç %i türündeki paylaşımlara izin vermediğinden %s paylaşımı başarısız",
"Sharing %s failed, because the file does not exist" : "%s paylaşımı, dosya mevcut olmadığından başarısız oldu",
"You are not allowed to share %s" : "%s paylaşımını yapma izniniz yok",
+ "Sharing %s failed, because you can not share with yourself" : "%s paylaşımı başarısız, kendiniz ile paylaşamazsınız",
"Sharing %s failed, because the user %s does not exist" : "%s paylaşımı, %s kullanıcısı mevcut olmadığından başarısız oldu",
"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" : "%s paylaşımı, %s kullanıcısının %s üyeliklerinden birine sahip olmadığından başarısız oldu",
"Sharing %s failed, because this item is already shared with %s" : "%s paylaşımı, %s ile zaten paylaşıldığından dolayı başarısız oldu",
@@ -103,6 +104,7 @@
"Sharing backend %s must implement the interface OCP\\Share_Backend" : "Paylaşma arka ucu %s OCP\\Share_Backend arayüzünü desteklemeli",
"Sharing backend %s not found" : "Paylaşım arka ucu %s bulunamadı",
"Sharing backend for %s not found" : "%s için paylaşım arka ucu bulunamadı",
+ "Sharing failed, because the user %s is the original sharer" : "%s kullanıcısı özgün paylaşan kişi olduğundan başarısız oldu",
"Sharing %s failed, because the permissions exceed permissions granted to %s" : "%s paylaşımı, izinler %s için verilen izinleri aştığından dolayı başarısız oldu",
"Sharing %s failed, because resharing is not allowed" : "%s paylaşımı, tekrar paylaşımın izin verilmemesinden dolayı başarısız oldu",
"Sharing %s failed, because the sharing backend for %s could not find its source" : "%s paylaşımı, %s için arka ucun kaynağını bulamamasından dolayı başarısız oldu",
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php
index 96620838dfb..ea42c9a8967 100644
--- a/lib/private/appframework/http/request.php
+++ b/lib/private/appframework/http/request.php
@@ -42,7 +42,7 @@ use OCP\Security\ISecureRandom;
*/
class Request implements \ArrayAccess, \Countable, IRequest {
- const USER_AGENT_IE = '/MSIE/';
+ const USER_AGENT_IE = '/(MSIE)|(Trident)/';
const USER_AGENT_IE_8 = '/MSIE 8.0/';
// Android Chrome user agent: https://developers.google.com/chrome/mobile/docs/user-agent
const USER_AGENT_ANDROID_MOBILE_CHROME = '#Android.*Chrome/[.0-9]*#';
@@ -674,6 +674,9 @@ class Request implements \ArrayAccess, \Countable, IRequest {
* @return bool true if at least one of the given agent matches, false otherwise
*/
public function isUserAgent(array $agent) {
+ if (!isset($this->server['HTTP_USER_AGENT'])) {
+ return false;
+ }
foreach ($agent as $regex) {
if (preg_match($regex, $this->server['HTTP_USER_AGENT'])) {
return true;
diff --git a/lib/private/db/adapteroci8.php b/lib/private/db/adapteroci8.php
index 6e7857e6620..76c265bc178 100644
--- a/lib/private/db/adapteroci8.php
+++ b/lib/private/db/adapteroci8.php
@@ -26,6 +26,9 @@ namespace OC\DB;
class AdapterOCI8 extends Adapter {
public function lastInsertId($table) {
+ if (is_null($table)) {
+ throw new \InvalidArgumentException('Oracle requires a table name to be passed into lastInsertId()');
+ }
if ($table !== null) {
$suffix = '_SEQ';
$table = '"' . $table . $suffix . '"';
diff --git a/lib/private/db/connection.php b/lib/private/db/connection.php
index 1b86d3d383a..85b1b7cd5ea 100644
--- a/lib/private/db/connection.php
+++ b/lib/private/db/connection.php
@@ -214,8 +214,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
* @param string $seqName Name of the sequence object from which the ID should be returned.
* @return string A string representation of the last inserted ID.
*/
- public function lastInsertId($seqName = null)
- {
+ public function lastInsertId($seqName = null) {
if ($seqName) {
$seqName = $this->replaceTablePrefix($seqName);
}
diff --git a/lib/private/notification/inotification.php b/lib/private/notification/inotification.php
index a8bf5b110ab..b79b7f6d9d3 100644
--- a/lib/private/notification/inotification.php
+++ b/lib/private/notification/inotification.php
@@ -61,18 +61,18 @@ interface INotification {
public function getUser();
/**
- * @param int $timestamp
+ * @param \DateTime $dateTime
* @return $this
- * @throws \InvalidArgumentException if the timestamp are invalid
- * @since 8.2.0
+ * @throws \InvalidArgumentException if the $dateTime is invalid
+ * @since 9.0.0
*/
- public function setTimestamp($timestamp);
+ public function setDateTime(\DateTime $dateTime);
/**
- * @return int
- * @since 8.2.0
+ * @return \DateTime
+ * @since 9.0.0
*/
- public function getTimestamp();
+ public function getDateTime();
/**
* @param string $type
diff --git a/lib/private/notification/notification.php b/lib/private/notification/notification.php
index 01df659d4a1..a22d5446f45 100644
--- a/lib/private/notification/notification.php
+++ b/lib/private/notification/notification.php
@@ -29,8 +29,8 @@ class Notification implements INotification {
/** @var string */
protected $user;
- /** @var int */
- protected $timestamp;
+ /** @var \DateTime */
+ protected $dateTime;
/** @var string */
protected $objectType;
@@ -80,7 +80,8 @@ class Notification implements INotification {
public function __construct() {
$this->app = '';
$this->user = '';
- $this->timestamp = 0;
+ $this->dateTime = new \DateTime();
+ $this->dateTime->setTimestamp(0);
$this->objectType = '';
$this->objectId = 0;
$this->subject = '';
@@ -140,25 +141,25 @@ class Notification implements INotification {
}
/**
- * @param int $timestamp
+ * @param \DateTime $dateTime
* @return $this
- * @throws \InvalidArgumentException if the timestamp is invalid
- * @since 8.2.0
+ * @throws \InvalidArgumentException if the $dateTime is invalid
+ * @since 9.0.0
*/
- public function setTimestamp($timestamp) {
- if (!is_int($timestamp)) {
- throw new \InvalidArgumentException('The given timestamp is invalid');
+ public function setDateTime(\DateTime $dateTime) {
+ if ($dateTime->getTimestamp() === 0) {
+ throw new \InvalidArgumentException('The given date time is invalid');
}
- $this->timestamp = $timestamp;
+ $this->dateTime = $dateTime;
return $this;
}
/**
- * @return int
- * @since 8.2.0
+ * @return \DateTime
+ * @since 9.0.0
*/
- public function getTimestamp() {
- return $this->timestamp;
+ public function getDateTime() {
+ return $this->dateTime;
}
/**
@@ -438,7 +439,7 @@ class Notification implements INotification {
&&
$this->getUser() !== ''
&&
- $this->getTimestamp() !== 0
+ $this->getDateTime()->getTimestamp() !== 0
&&
$this->getObjectType() !== ''
&&
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index d377708a268..6aac0d6264d 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -2332,22 +2332,7 @@ class Share extends Constants {
$id = false;
if ($result) {
- $id = \OC::$server->getDatabaseConnection()->lastInsertId();
- // Fallback, if lastInterId() doesn't work we need to perform a select
- // to get the ID (seems to happen sometimes on Oracle)
- if (!$id) {
- $getId = \OC_DB::prepare('
- SELECT `id`
- FROM`*PREFIX*share`
- WHERE `uid_owner` = ? AND `item_target` = ? AND `item_source` = ? AND `stime` = ?
- ');
- $r = $getId->execute(array($shareData['uidOwner'], $shareData['itemTarget'], $shareData['itemSource'], $shareData['shareTime']));
- if ($r) {
- $row = $r->fetchRow();
- $id = $row['id'];
- }
- }
-
+ $id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share');
}
return $id;
diff --git a/lib/private/share20/defaultshareprovider.php b/lib/private/share20/defaultshareprovider.php
index 7f21d3aadf5..5805e41d411 100644
--- a/lib/private/share20/defaultshareprovider.php
+++ b/lib/private/share20/defaultshareprovider.php
@@ -69,19 +69,20 @@ class DefaultShareProvider implements IShareProvider {
}
/**
- * Get all childre of this share
+ * Get all children of this share
*
- * @param IShare $share
+ * @param IShare $parent
* @return IShare[]
*/
- private function getChildren(IShare $share) {
+ public function getChildren(IShare $parent) {
$children = [];
$qb = $this->dbConn->getQueryBuilder();
$qb->select('*')
->from('share')
->where($qb->expr()->eq('parent', $qb->createParameter('parent')))
- ->setParameter(':parent', $share->getId());
+ ->setParameter(':parent', $parent->getId())
+ ->orderBy('id');
$cursor = $qb->execute();
while($data = $cursor->fetch()) {
@@ -93,50 +94,15 @@ class DefaultShareProvider implements IShareProvider {
}
/**
- * Delete all the children of this share
- *
- * @param IShare $share
- */
- protected function deleteChildren(IShare $share) {
- foreach($this->getChildren($share) as $child) {
- $this->delete($child);
- }
- }
-
- /**
* Delete a share
*
- * @param Share $share
+ * @param IShare $share
* @throws BackendError
*/
public function delete(IShare $share) {
- $this->deleteChildren($share);
-
// Fetch share to make sure it exists
$share = $this->getShareById($share->getId());
- $shareType = $share->getShareType();
- $sharedWith = '';
- if ($shareType === \OCP\Share::SHARE_TYPE_USER) {
- $sharedWith = $share->getSharedWith()->getUID();
- } else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) {
- $sharedWith = $share->getSharedWith()->getGID();
- }
-
- $hookParams = [
- 'id' => $share->getId(),
- 'itemType' => $share->getPath() instanceof \OCP\Files\File ? 'file' : 'folder',
- 'itemSource' => $share->getPath()->getId(),
- 'shareType' => $shareType,
- 'shareWith' => $sharedWith,
- 'itemparent' => $share->getParent(),
- 'uidOwner' => $share->getSharedBy()->getUID(),
- 'fileSource' => $share->getPath()->getId(),
- 'fileTarget' => $share->getTarget()
- ];
-
- \OC_Hook::emit('OCP\Share', 'pre_unshare', $hookParams);
-
$qb = $this->dbConn->getQueryBuilder();
$qb->delete('share')
->where($qb->expr()->eq('id', $qb->createParameter('id')))
@@ -147,8 +113,6 @@ class DefaultShareProvider implements IShareProvider {
} catch (\Exception $e) {
throw new BackendError();
}
-
- \OC_Hook::emit('OCP\Share', 'post_unshare', $hookParams);
}
/**
@@ -195,8 +159,9 @@ class DefaultShareProvider implements IShareProvider {
/**
* Get shares for a given path
*
+ * @param \OCP\IUser $user
* @param \OCP\Files\Node $path
- * @param Share[]
+ * @return IShare[]
*/
public function getSharesByPath(\OCP\IUser $user, \OCP\Files\Node $path) {
throw new \Exception();
@@ -253,7 +218,7 @@ class DefaultShareProvider implements IShareProvider {
$share->setSharedBy($this->userManager->get($data['uid_owner']));
// TODO: getById can return an array. How to handle this properly??
- $path = $this->userFolder->getById($data['file_source']);
+ $path = $this->userFolder->getById((int)$data['file_source']);
$path = $path[0];
$share->setPath($path);
diff --git a/lib/private/share20/ishareprovider.php b/lib/private/share20/ishareprovider.php
index b3f4eb6868f..833de1b58f6 100644
--- a/lib/private/share20/ishareprovider.php
+++ b/lib/private/share20/ishareprovider.php
@@ -45,7 +45,7 @@ interface IShareProvider {
/**
* Delete a share
*
- * @param Share $share
+ * @param IShare $share
* @throws BackendError
*/
public function delete(IShare $share);
@@ -71,10 +71,19 @@ interface IShareProvider {
public function getShareById($id);
/**
+ * Get children
+ *
+ * @param IShare $parent
+ * @return IShare[]
+ */
+ public function getChildren(IShare $parent);
+
+ /**
* Get shares for a given path
*
+ * @param \OCP\IUser $user
* @param \OCP\Files\Node $path
- * @param Share[]
+ * @return IShare[]
*/
public function getSharesByPath(\OCP\IUser $user, \OCP\Files\Node $path);
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php
index 52e43a9aa9f..57d84967977 100644
--- a/lib/private/share20/manager.php
+++ b/lib/private/share20/manager.php
@@ -97,6 +97,25 @@ class Manager {
}
/**
+ * Delete all the children of this share
+ *
+ * @param IShare $share
+ * @return IShare[] List of deleted shares
+ */
+ protected function deleteChildren(IShare $share) {
+ $deletedShares = [];
+ foreach($this->defaultProvider->getChildren($share) as $child) {
+ $deletedChildren = $this->deleteChildren($child);
+ $deletedShares = array_merge($deletedShares, $deletedChildren);
+
+ $this->defaultProvider->delete($child);
+ $deletedShares[] = $child;
+ }
+
+ return $deletedShares;
+ }
+
+ /**
* Delete a share
*
* @param Share $share
@@ -104,11 +123,58 @@ class Manager {
* @throws \OC\Share20\Exception\BackendError
*/
public function deleteShare(IShare $share) {
- if ($share->getId() === null) {
- throw new ShareNotFound();
- }
+ // Just to make sure we have all the info
+ $share = $this->getShareById($share->getId());
+
+ $formatHookParams = function($share) {
+ // Prepare hook
+ $shareType = $share->getShareType();
+ $sharedWith = '';
+ if ($shareType === \OCP\Share::SHARE_TYPE_USER) {
+ $sharedWith = $share->getSharedWith()->getUID();
+ } else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) {
+ $sharedWith = $share->getSharedWith()->getGID();
+ } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
+ $sharedWith = $share->getSharedWith();
+ }
+ $hookParams = [
+ 'id' => $share->getId(),
+ 'itemType' => $share->getPath() instanceof \OCP\Files\File ? 'file' : 'folder',
+ 'itemSource' => $share->getPath()->getId(),
+ 'shareType' => $shareType,
+ 'shareWith' => $sharedWith,
+ 'itemparent' => $share->getParent(),
+ 'uidOwner' => $share->getSharedBy()->getUID(),
+ 'fileSource' => $share->getPath()->getId(),
+ 'fileTarget' => $share->getTarget()
+ ];
+ return $hookParams;
+ };
+
+ $hookParams = $formatHookParams($share);
+
+ // Emit pre-hook
+ \OC_Hook::emit('OCP\Share', 'pre_unshare', $hookParams);
+
+ // Get all children and delete them as well
+ $deletedShares = $this->deleteChildren($share);
+
+ // Do the actual delete
$this->defaultProvider->delete($share);
+
+ // All the deleted shares caused by this delete
+ $deletedShares[] = $share;
+
+ //Format hook info
+ $formattedDeletedShares = array_map(function($share) use ($formatHookParams) {
+ return $formatHookParams($share);
+ }, $deletedShares);
+
+ $hookParams['deletedShares'] = $formattedDeletedShares;
+
+ // Emit post hook
+ \OC_Hook::emit('OCP\Share', 'post_unshare', $hookParams);
}
/**
@@ -131,6 +197,10 @@ class Manager {
* @throws ShareNotFound
*/
public function getShareById($id) {
+ if ($id === null) {
+ throw new ShareNotFound();
+ }
+
$share = $this->defaultProvider->getShareById($id);
if ($share->getSharedWith() !== $this->currentUser &&
diff --git a/lib/private/template.php b/lib/private/template.php
index 97666f0b8dc..1476a964ef3 100644
--- a/lib/private/template.php
+++ b/lib/private/template.php
@@ -143,7 +143,9 @@ class OC_Template extends \OC\Template\Base {
OC_Util::addStyle("jquery.ocdialog");
OC_Util::addScript("compatibility", null, true);
OC_Util::addScript("placeholders", null, true);
-
+ OC_Util::addScript('files/fileinfo');
+ OC_Util::addScript('files/client');
+
// Add the stuff we need always
// following logic will import all vendor libraries that are
// specified in core/js/core.json
@@ -158,7 +160,12 @@ class OC_Template extends \OC\Template\Base {
} else {
throw new \Exception('Cannot read core/js/core.json');
}
-
+
+ if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE])) {
+ // shim for the davclient.js library
+ \OCP\Util::addScript('files/iedavclient');
+ }
+
self::$initTemplateEngineFirstRun = false;
}
diff --git a/lib/private/template/functions.php b/lib/private/template/functions.php
index 1c6eaa9a389..cea5860cec6 100644
--- a/lib/private/template/functions.php
+++ b/lib/private/template/functions.php
@@ -30,7 +30,7 @@
/**
* Prints a sanitized string
- * @param string|array $string the string which will be escaped and printed
+ * @param string $string the string which will be escaped and printed
*/
function p($string) {
print(OC_Util::sanitizeHTML($string));
diff --git a/lib/private/util.php b/lib/private/util.php
index e48cdd4d9fc..69f01c22be9 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -864,12 +864,9 @@ class OC_Util {
}
}
} catch (\Doctrine\DBAL\DBALException $e) {
- \OCP\Util::logException('core', $e);
- $errors[] = array(
- 'error' => $l->t('Error occurred while checking PostgreSQL version'),
- 'hint' => $l->t('Please make sure you have PostgreSQL >= 9 or'
- . ' check the logs for more information about the error')
- );
+ $logger = \OC::$server->getLogger();
+ $logger->warning('Error occurred while checking PostgreSQL version, assuming >= 9');
+ $logger->logException($e);
}
}
return $errors;