summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/l10n/sl.js3
-rw-r--r--lib/l10n/sl.json3
-rw-r--r--lib/private/appframework/utility/controllermethodreflector.php2
-rw-r--r--lib/private/files/view.php6
-rw-r--r--lib/private/group/manager.php2
-rw-r--r--lib/private/preview.php52
-rw-r--r--lib/private/server.php10
-rw-r--r--lib/private/updater.php1
-rw-r--r--lib/public/appframework/db/doesnotexistexception.php1
-rw-r--r--lib/public/appframework/db/entity.php10
-rw-r--r--lib/public/appframework/db/mapper.php2
-rw-r--r--lib/public/appframework/db/multipleobjectsreturnedexception.php1
-rw-r--r--lib/public/defaults.php1
-rw-r--r--lib/public/files/folder.php1
-rw-r--r--lib/public/files/locknotacquiredexception.php10
-rw-r--r--lib/public/igroupmanager.php2
-rw-r--r--lib/public/iuser.php2
-rw-r--r--lib/public/iusermanager.php1
18 files changed, 78 insertions, 32 deletions
diff --git a/lib/l10n/sl.js b/lib/l10n/sl.js
index 958e38ee374..769a7f7054f 100644
--- a/lib/l10n/sl.js
+++ b/lib/l10n/sl.js
@@ -41,6 +41,7 @@ OC.L10N.register(
"File name is a reserved word" : "Ime datoteke je zadržana beseda",
"File name contains at least one invalid character" : "Ime datoteke vsebuje vsaj en neveljaven znak.",
"File name is too long" : "Ime datoteke je predolgo",
+ "Can't read file" : "Datoteke ni mogoče prebrati.",
"App directory already exists" : "Programska mapa že obstaja",
"Can't create app folder. Please fix permissions. %s" : "Programske mape ni mogoče ustvariti. Ni ustreznih dovoljenj. %s",
"No source specified when installing app" : "Ni podanega vira med nameščenjem programa",
@@ -79,6 +80,7 @@ OC.L10N.register(
"Set an admin password." : "Nastavi geslo skrbnika.",
"Can't create or write into the data directory %s" : "Ni mogoče zapisati podatkov v podatkovno mapo %s",
"%s shared »%s« with you" : "%s je omogočil souporabo »%s«",
+ "%s via %s" : "%s prek %s",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Omogočanje souporabe %s je spodletelo, ker ozadnji program ne dopušča souporabe vrste %i.",
"Sharing %s failed, because the file does not exist" : "Souporaba %s je spodletela, ker ta datoteka ne obstaja",
"You are not allowed to share %s" : "Omogočanje souporabe %s brez ustreznih dovoljenj ni mogoče.",
@@ -110,6 +112,7 @@ OC.L10N.register(
"A valid password must be provided" : "Navedeno mora biti veljavno geslo",
"The username is already being used" : "Vpisano uporabniško ime je že v uporabi",
"No database drivers (sqlite, mysql, or postgresql) installed." : "Ni nameščenih programnikov podatkovnih zbirk (sqlite, mysql, ali postgresql).",
+ "Microsoft Windows Platform is not supported" : "Okolje Microsoft Windows ni podprto.",
"Cannot write into \"config\" directory" : "Mapa 'config' nima nastavljenih ustreznih dovoljenj za pisanje!",
"Cannot write into \"apps\" directory" : "Mapa \"apps\" nima nastavljenih ustreznih dovoljenj za pisanje!",
"This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." : "Napako je mogoče odpraviti z dodelitvijo dovoljenja spletnemu strežniku %s za pisanje v mapo programov %s, ali pa z onemogočanjem nameščanja programov v nastavitveni datoteki.",
diff --git a/lib/l10n/sl.json b/lib/l10n/sl.json
index 3e9711d98bc..ab717c21dc2 100644
--- a/lib/l10n/sl.json
+++ b/lib/l10n/sl.json
@@ -39,6 +39,7 @@
"File name is a reserved word" : "Ime datoteke je zadržana beseda",
"File name contains at least one invalid character" : "Ime datoteke vsebuje vsaj en neveljaven znak.",
"File name is too long" : "Ime datoteke je predolgo",
+ "Can't read file" : "Datoteke ni mogoče prebrati.",
"App directory already exists" : "Programska mapa že obstaja",
"Can't create app folder. Please fix permissions. %s" : "Programske mape ni mogoče ustvariti. Ni ustreznih dovoljenj. %s",
"No source specified when installing app" : "Ni podanega vira med nameščenjem programa",
@@ -77,6 +78,7 @@
"Set an admin password." : "Nastavi geslo skrbnika.",
"Can't create or write into the data directory %s" : "Ni mogoče zapisati podatkov v podatkovno mapo %s",
"%s shared »%s« with you" : "%s je omogočil souporabo »%s«",
+ "%s via %s" : "%s prek %s",
"Sharing %s failed, because the backend does not allow shares from type %i" : "Omogočanje souporabe %s je spodletelo, ker ozadnji program ne dopušča souporabe vrste %i.",
"Sharing %s failed, because the file does not exist" : "Souporaba %s je spodletela, ker ta datoteka ne obstaja",
"You are not allowed to share %s" : "Omogočanje souporabe %s brez ustreznih dovoljenj ni mogoče.",
@@ -108,6 +110,7 @@
"A valid password must be provided" : "Navedeno mora biti veljavno geslo",
"The username is already being used" : "Vpisano uporabniško ime je že v uporabi",
"No database drivers (sqlite, mysql, or postgresql) installed." : "Ni nameščenih programnikov podatkovnih zbirk (sqlite, mysql, ali postgresql).",
+ "Microsoft Windows Platform is not supported" : "Okolje Microsoft Windows ni podprto.",
"Cannot write into \"config\" directory" : "Mapa 'config' nima nastavljenih ustreznih dovoljenj za pisanje!",
"Cannot write into \"apps\" directory" : "Mapa \"apps\" nima nastavljenih ustreznih dovoljenj za pisanje!",
"This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." : "Napako je mogoče odpraviti z dodelitvijo dovoljenja spletnemu strežniku %s za pisanje v mapo programov %s, ali pa z onemogočanjem nameščanja programov v nastavitveni datoteki.",
diff --git a/lib/private/appframework/utility/controllermethodreflector.php b/lib/private/appframework/utility/controllermethodreflector.php
index 93510093c08..e013a74253a 100644
--- a/lib/private/appframework/utility/controllermethodreflector.php
+++ b/lib/private/appframework/utility/controllermethodreflector.php
@@ -59,7 +59,7 @@ class ControllerMethodReflector implements IControllerMethodReflector{
$this->annotations = $matches[1];
// extract type parameter information
- preg_match_all('/@param (?P<type>\w+) \$(?P<var>\w+)/', $docs, $matches);
+ preg_match_all('/@param\h+(?P<type>\w+)\h+\$(?P<var>\w+)/', $docs, $matches);
// this is just a fix for PHP 5.3 (array_combine raises warning if called with
// two empty arrays
if($matches['var'] === array() && $matches['type'] === array()) {
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 47cbf35836c..73daf8a141f 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -1081,7 +1081,8 @@ class View {
if ($this->fakeRoot === $defaultRoot) {
return true;
}
- return (strlen($this->fakeRoot) > strlen($defaultRoot)) && (substr($this->fakeRoot, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/');
+ $fullPath = $this->getAbsolutePath($path);
+ return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/');
}
/**
@@ -1091,10 +1092,11 @@ class View {
* @return bool
*/
private function runHooks($hooks, $path, $post = false) {
+ $relativePath = $path;
$path = $this->getHookPath($path);
$prefix = ($post) ? 'post_' : '';
$run = true;
- if ($this->shouldEmitHooks($path)) {
+ if ($this->shouldEmitHooks($relativePath)) {
foreach ($hooks as $hook) {
if ($hook != 'read') {
\OC_Hook::emit(
diff --git a/lib/private/group/manager.php b/lib/private/group/manager.php
index 70263fc2afa..f8defe476c4 100644
--- a/lib/private/group/manager.php
+++ b/lib/private/group/manager.php
@@ -245,7 +245,7 @@ class Manager extends PublicEmitter implements IGroupManager {
/**
* Checks if a userId is in a group
* @param string $userId
- * @param group $group
+ * @param string $group
* @return bool if in group
*/
public function isInGroup($userId, $group) {
diff --git a/lib/private/preview.php b/lib/private/preview.php
index 145b7924c05..f3599852838 100644
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -701,7 +701,7 @@ class Preview {
$this->generatePreview($fileId);
}
- // We still don't have a preview, so we generate an empty object which can't be displayed
+ // We still don't have a preview, so we send back an empty object
if (is_null($this->preview)) {
$this->preview = new \OC_Image();
}
@@ -712,22 +712,26 @@ class Preview {
/**
* Sends the preview, including the headers to client which requested it
*
- * @param null|string $mimeType
+ * @param null|string $mimeTypeForHeaders the media type to use when sending back the reply
*
* @throws NotFoundException
*/
- public function showPreview($mimeType = null) {
+ public function showPreview($mimeTypeForHeaders = null) {
// Check if file is valid
if ($this->isFileValid() === false) {
throw new NotFoundException('File not found.');
}
- \OCP\Response::enableCaching(3600 * 24); // 24 hours
if (is_null($this->preview)) {
$this->getPreview();
}
if ($this->preview instanceof \OCP\IImage) {
- $this->preview->show($mimeType);
+ if ($this->preview->valid()) {
+ \OCP\Response::enableCaching(3600 * 24); // 24 hours
+ } else {
+ $this->getMimeIcon();
+ }
+ $this->preview->show($mimeTypeForHeaders);
}
}
@@ -812,9 +816,8 @@ class Preview {
*/
// It turns out the scaled preview is now too big, so we crop the image
if ($newPreviewWidth >= $askedWidth && $newPreviewHeight >= $askedHeight) {
- list($newPreviewWidth, $newPreviewHeight) =
- $this->crop($image, $askedWidth, $askedHeight, $newPreviewWidth, $newPreviewHeight);
- $this->storePreview($fileId, $newPreviewWidth, $newPreviewHeight);
+ $this->crop($image, $askedWidth, $askedHeight, $newPreviewWidth, $newPreviewHeight);
+ $this->storePreview($fileId, $askedWidth, $askedHeight);
return;
}
@@ -822,11 +825,10 @@ class Preview {
// At least one dimension of the scaled preview is too small,
// so we fill the space with a transparent background
if (($newPreviewWidth < $askedWidth || $newPreviewHeight < $askedHeight)) {
- list($newPreviewWidth, $newPreviewHeight) =
- $this->cropAndFill(
- $image, $askedWidth, $askedHeight, $newPreviewWidth, $newPreviewHeight
- );
- $this->storePreview($fileId, $newPreviewWidth, $newPreviewHeight);
+ $this->cropAndFill(
+ $image, $askedWidth, $askedHeight, $newPreviewWidth, $newPreviewHeight
+ );
+ $this->storePreview($fileId, $askedWidth, $askedHeight);
return;
}
@@ -894,8 +896,6 @@ class Preview {
* @param int $askedHeight
* @param int $previewWidth
* @param null $previewHeight
- *
- * @return \int[]
*/
private function crop($image, $askedWidth, $askedHeight, $previewWidth, $previewHeight = null) {
$cropX = floor(abs($askedWidth - $previewWidth) * 0.5);
@@ -904,8 +904,6 @@ class Preview {
$cropY = 0;
$image->crop($cropX, $cropY, $askedWidth, $askedHeight);
$this->preview = $image;
-
- return [$askedWidth, $askedHeight];
}
/**
@@ -917,8 +915,6 @@ class Preview {
* @param int $askedHeight
* @param int $previewWidth
* @param null $previewHeight
- *
- * @return \int[]
*/
private function cropAndFill($image, $askedWidth, $askedHeight, $previewWidth, $previewHeight) {
if ($previewWidth > $askedWidth) {
@@ -954,8 +950,6 @@ class Preview {
$image = new \OC_Image($backgroundLayer);
$this->preview = $image;
-
- return [$askedWidth, $askedHeight];
}
/**
@@ -1092,6 +1086,22 @@ class Preview {
}
/**
+ * Defines the media icon, for the media type of the original file, as the preview
+ */
+ private function getMimeIcon() {
+ $image = new \OC_Image();
+ $mimeIconWebPath = \OC_Helper::mimetypeIcon($this->mimeType);
+ if (empty(\OC::$WEBROOT)) {
+ $mimeIconServerPath = \OC::$SERVERROOT . $mimeIconWebPath;
+ } else {
+ $mimeIconServerPath = str_replace(\OC::$WEBROOT, \OC::$SERVERROOT, $mimeIconWebPath);
+ }
+ $image->loadFromFile($mimeIconServerPath);
+
+ $this->preview = $image;
+ }
+
+ /**
* Stores the max preview in the cache
*
* @param string $previewPath path to the preview
diff --git a/lib/private/server.php b/lib/private/server.php
index 497f43206ff..7e233e64575 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -785,19 +785,19 @@ class Server extends SimpleContainer implements IServerContainer {
/**
* Get the certificate manager for the user
*
- * @param string $uid (optional) if not specified the current loggedin user is used
+ * @param string $userId (optional) if not specified the current loggedin user is used
* @return \OCP\ICertificateManager | null if $uid is null and no user is logged in
*/
- public function getCertificateManager($uid = null) {
- if (is_null($uid)) {
+ public function getCertificateManager($userId = null) {
+ if (is_null($userId)) {
$userSession = $this->getUserSession();
$user = $userSession->getUser();
if (is_null($user)) {
return null;
}
- $uid = $user->getUID();
+ $userId = $user->getUID();
}
- return new CertificateManager($uid, new \OC\Files\View());
+ return new CertificateManager($userId, new \OC\Files\View());
}
/**
diff --git a/lib/private/updater.php b/lib/private/updater.php
index 7f1a493d2a0..bd9e8a65363 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -386,6 +386,7 @@ class Updater extends BasicEmitter {
foreach ($stacks as $type => $stack) {
foreach ($stack as $appId) {
if (\OC_App::shouldUpgrade($appId)) {
+ $this->emit('\OC\Updater', 'appUpgradeStarted', array($appId, \OC_App::getAppVersion($appId)));
\OC_App::updateApp($appId);
$this->emit('\OC\Updater', 'appUpgrade', array($appId, \OC_App::getAppVersion($appId)));
}
diff --git a/lib/public/appframework/db/doesnotexistexception.php b/lib/public/appframework/db/doesnotexistexception.php
index 6df0477498c..2cefa0fe827 100644
--- a/lib/public/appframework/db/doesnotexistexception.php
+++ b/lib/public/appframework/db/doesnotexistexception.php
@@ -34,6 +34,7 @@ class DoesNotExistException extends \Exception {
/**
* Constructor
* @param string $msg the error message
+ * @since 7.0.0
*/
public function __construct($msg){
parent::__construct($msg);
diff --git a/lib/public/appframework/db/entity.php b/lib/public/appframework/db/entity.php
index a12f759357e..f7beebef154 100644
--- a/lib/public/appframework/db/entity.php
+++ b/lib/public/appframework/db/entity.php
@@ -92,6 +92,10 @@ abstract class Entity {
$this->_updatedFields = array();
}
+ /**
+ * Generic setter for properties
+ * @since 7.0.0
+ */
protected function setter($name, $args) {
// setters should only work for existing attributes
if(property_exists($this, $name)){
@@ -112,6 +116,10 @@ abstract class Entity {
}
}
+ /**
+ * Generic getter for properties
+ * @since 7.0.0
+ */
protected function getter($name) {
// getters should only work for existing attributes
if(property_exists($this, $name)){
@@ -148,6 +156,7 @@ abstract class Entity {
/**
* Mark am attribute as updated
* @param string $attribute the name of the attribute
+ * @since 7.0.0
*/
protected function markFieldUpdated($attribute){
$this->_updatedFields[$attribute] = true;
@@ -212,6 +221,7 @@ abstract class Entity {
* that value once its being returned from the database
* @param string $fieldName the name of the attribute
* @param string $type the type which will be used to call settype()
+ * @since 7.0.0
*/
protected function addType($fieldName, $type){
$this->_fieldTypes[$fieldName] = $type;
diff --git a/lib/public/appframework/db/mapper.php b/lib/public/appframework/db/mapper.php
index 157bea36916..2b99c99b71e 100644
--- a/lib/public/appframework/db/mapper.php
+++ b/lib/public/appframework/db/mapper.php
@@ -193,6 +193,7 @@ abstract class Mapper {
* Checks if an array is associative
* @param array $array
* @return bool true if associative
+ * @since 8.1.0
*/
private function isAssocArray(array $array) {
return array_values($array) !== $array;
@@ -202,6 +203,7 @@ abstract class Mapper {
* Returns the correct PDO constant based on the value type
* @param $value
* @return PDO constant
+ * @since 8.1.0
*/
private function getPDOType($value) {
switch (gettype($value)) {
diff --git a/lib/public/appframework/db/multipleobjectsreturnedexception.php b/lib/public/appframework/db/multipleobjectsreturnedexception.php
index cdfb748b145..988bf6bb033 100644
--- a/lib/public/appframework/db/multipleobjectsreturnedexception.php
+++ b/lib/public/appframework/db/multipleobjectsreturnedexception.php
@@ -34,6 +34,7 @@ class MultipleObjectsReturnedException extends \Exception {
/**
* Constructor
* @param string $msg the error message
+ * @since 7.0.0
*/
public function __construct($msg){
parent::__construct($msg);
diff --git a/lib/public/defaults.php b/lib/public/defaults.php
index 2d55a64f002..723c6ecbb78 100644
--- a/lib/public/defaults.php
+++ b/lib/public/defaults.php
@@ -48,6 +48,7 @@ class Defaults {
/**
* creates a \OC_Defaults instance which is used in all methods to retrieve the
* actual defaults
+ * @since 6.0.0
*/
function __construct() {
$this->defaults = new \OC_Defaults();
diff --git a/lib/public/files/folder.php b/lib/public/files/folder.php
index f5f91e8158c..533e490634f 100644
--- a/lib/public/files/folder.php
+++ b/lib/public/files/folder.php
@@ -107,6 +107,7 @@ interface Folder extends Node {
* @param string $path relative path of the new file
* @return \OCP\Files\File
* @throws \OCP\Files\NotPermittedException
+ * @since 6.0.0
*/
public function newFile($path);
diff --git a/lib/public/files/locknotacquiredexception.php b/lib/public/files/locknotacquiredexception.php
index 66e131ab1e5..d078ff34818 100644
--- a/lib/public/files/locknotacquiredexception.php
+++ b/lib/public/files/locknotacquiredexception.php
@@ -41,12 +41,20 @@ class LockNotAcquiredException extends \Exception {
/** @var integer $lockType The type of the lock that was attempted */
public $lockType;
+ /**
+ * @since 7.0.0
+ */
public function __construct($path, $lockType, $code = 0, \Exception $previous = null) {
$message = \OC::$server->getL10N('core')->t('Could not obtain lock type %d on "%s".', array($lockType, $path));
parent::__construct($message, $code, $previous);
}
- // custom string representation of object
+ /**
+ * custom string representation of object
+ *
+ * @return string
+ * @since 7.0.0
+ */
public function __toString() {
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
diff --git a/lib/public/igroupmanager.php b/lib/public/igroupmanager.php
index ec4b03c5d18..4f41c808c9f 100644
--- a/lib/public/igroupmanager.php
+++ b/lib/public/igroupmanager.php
@@ -127,7 +127,7 @@ interface IGroupManager {
/**
* Checks if a userId is in a group
* @param string $userId
- * @param group $group
+ * @param string $group
* @return bool if in group
* @since 8.0.0
*/
diff --git a/lib/public/iuser.php b/lib/public/iuser.php
index 393ab90d260..6cbcfbf2312 100644
--- a/lib/public/iuser.php
+++ b/lib/public/iuser.php
@@ -93,6 +93,7 @@ interface IUser {
* get the users home folder to mount
*
* @return string
+ * @since 8.0.0
*/
public function getHome();
@@ -116,6 +117,7 @@ interface IUser {
* check if the backend supports changing passwords
*
* @return bool
+ * @since 8.0.0
*/
public function canChangePassword();
diff --git a/lib/public/iusermanager.php b/lib/public/iusermanager.php
index 212d21759b0..e3857d6231a 100644
--- a/lib/public/iusermanager.php
+++ b/lib/public/iusermanager.php
@@ -64,6 +64,7 @@ interface IUserManager {
/**
* remove all user backends
+ * @since 8.0.0
*/
public function clearBackends() ;