summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php70
-rw-r--r--lib/l10n/af_ZA.php7
-rw-r--r--lib/l10n/ar.php4
-rw-r--r--lib/l10n/ast.php30
-rw-r--r--lib/l10n/az.php10
-rw-r--r--lib/l10n/ca.php6
-rw-r--r--lib/l10n/cs_CZ.php16
-rw-r--r--lib/l10n/da.php4
-rw-r--r--lib/l10n/de.php26
-rw-r--r--lib/l10n/de_CH.php4
-rw-r--r--lib/l10n/de_DE.php26
-rw-r--r--lib/l10n/el.php6
-rw-r--r--lib/l10n/en_GB.php26
-rw-r--r--lib/l10n/es.php22
-rw-r--r--lib/l10n/es_AR.php4
-rw-r--r--lib/l10n/es_CR.php8
-rw-r--r--lib/l10n/es_MX.php4
-rw-r--r--lib/l10n/et_EE.php26
-rw-r--r--lib/l10n/eu.php5
-rw-r--r--lib/l10n/fa.php4
-rw-r--r--lib/l10n/fi_FI.php20
-rw-r--r--lib/l10n/fr.php22
-rw-r--r--lib/l10n/gl.php28
-rw-r--r--lib/l10n/he.php4
-rw-r--r--lib/l10n/hu_HU.php5
-rw-r--r--lib/l10n/ia.php14
-rw-r--r--lib/l10n/id.php4
-rw-r--r--lib/l10n/it.php26
-rw-r--r--lib/l10n/ja.php5
-rw-r--r--lib/l10n/jv.php8
-rw-r--r--lib/l10n/ka_GE.php4
-rw-r--r--lib/l10n/km.php4
-rw-r--r--lib/l10n/ko.php4
-rw-r--r--lib/l10n/lt_LT.php4
-rw-r--r--lib/l10n/lv.php5
-rw-r--r--lib/l10n/mk.php4
-rw-r--r--lib/l10n/nb_NO.php4
-rw-r--r--lib/l10n/nl.php6
-rw-r--r--lib/l10n/nn_NO.php4
-rw-r--r--lib/l10n/or_IN.php8
-rw-r--r--lib/l10n/pl.php24
-rw-r--r--lib/l10n/pt_BR.php26
-rw-r--r--lib/l10n/pt_PT.php4
-rw-r--r--lib/l10n/ro.php4
-rw-r--r--lib/l10n/ru.php4
-rw-r--r--lib/l10n/sk_SK.php21
-rw-r--r--lib/l10n/sl.php16
-rw-r--r--lib/l10n/sq.php4
-rw-r--r--lib/l10n/sr.php4
-rw-r--r--lib/l10n/sv.php30
-rw-r--r--lib/l10n/tr.php52
-rw-r--r--lib/l10n/ug.php4
-rw-r--r--lib/l10n/uk.php4
-rw-r--r--lib/l10n/zh_CN.php4
-rw-r--r--lib/l10n/zh_TW.php4
-rwxr-xr-xlib/private/activitymanager.php2
-rw-r--r--lib/private/api.php4
-rw-r--r--lib/private/app.php19
-rw-r--r--lib/private/appconfig.php7
-rw-r--r--lib/private/appframework/dependencyinjection/dicontainer.php10
-rw-r--r--lib/private/appframework/http/request.php87
-rw-r--r--lib/private/appframework/middleware/security/securitymiddleware.php2
-rw-r--r--lib/private/appframework/routing/routeconfig.php10
-rw-r--r--lib/private/archive.php7
-rw-r--r--lib/private/arrayparser.php13
-rw-r--r--lib/private/cache.php2
-rw-r--r--lib/private/cache/file.php7
-rw-r--r--lib/private/config.php2
-rw-r--r--lib/private/connector/sabre/aborteduploaddetectionplugin.php33
-rw-r--r--lib/private/connector/sabre/directory.php56
-rw-r--r--lib/private/connector/sabre/file.php81
-rw-r--r--lib/private/connector/sabre/node.php176
-rw-r--r--lib/private/connector/sabre/objecttree.php109
-rw-r--r--lib/private/connector/sabre/quotaplugin.php35
-rw-r--r--lib/private/contactsmanager.php11
-rw-r--r--lib/private/davclient.php13
-rw-r--r--lib/private/db.php5
-rw-r--r--lib/private/defaults.php4
-rw-r--r--lib/private/filechunking.php7
-rw-r--r--lib/private/files.php5
-rw-r--r--lib/private/files/cache/scanner.php7
-rw-r--r--lib/private/files/filesystem.php3
-rw-r--r--lib/private/files/mount/manager.php7
-rw-r--r--lib/private/files/mount/mount.php7
-rw-r--r--lib/private/files/storage/common.php23
-rw-r--r--lib/private/files/storage/local.php6
-rw-r--r--lib/private/files/storage/mappedlocal.php3
-rw-r--r--lib/private/files/type/detection.php40
-rw-r--r--lib/private/files/view.php57
-rw-r--r--lib/private/geo.php12
-rw-r--r--lib/private/group.php11
-rw-r--r--lib/private/group/backend.php2
-rw-r--r--lib/private/group/database.php14
-rw-r--r--lib/private/group/dummy.php10
-rw-r--r--lib/private/group/group.php33
-rw-r--r--lib/private/group/manager.php6
-rw-r--r--lib/private/helper.php21
-rw-r--r--lib/private/image.php8
-rw-r--r--lib/private/json.php7
-rw-r--r--lib/private/l10n.php46
-rw-r--r--lib/private/legacy/appconfig.php2
-rw-r--r--lib/private/legacy/config.php6
-rw-r--r--lib/private/migrate.php39
-rw-r--r--lib/private/migration/content.php2
-rw-r--r--lib/private/mimetypes.list.php215
-rw-r--r--lib/private/ocs.php29
-rw-r--r--lib/private/ocs/cloud.php27
-rw-r--r--lib/private/ocs/result.php2
-rw-r--r--lib/private/ocsclient.php17
-rwxr-xr-xlib/private/preview.php252
-rw-r--r--lib/private/preview/movies.php37
-rwxr-xr-xlib/private/request.php10
-rw-r--r--lib/private/response.php2
-rw-r--r--lib/private/route/cachingrouter.php3
-rw-r--r--lib/private/route/route.php6
-rw-r--r--lib/private/route/router.php19
-rw-r--r--lib/private/search.php2
-rw-r--r--lib/private/server.php11
-rw-r--r--lib/private/share/constants.php8
-rw-r--r--lib/private/share/helper.php49
-rw-r--r--lib/private/share/mailnotifications.php1
-rw-r--r--lib/private/share/share.php315
-rw-r--r--lib/private/subadmin.php22
-rw-r--r--lib/private/template.php27
-rw-r--r--lib/private/template/base.php2
-rw-r--r--lib/private/template/functions.php9
-rw-r--r--lib/private/templatelayout.php45
-rw-r--r--lib/private/urlgenerator.php4
-rw-r--r--lib/private/user.php11
-rw-r--r--lib/private/user/database.php105
-rw-r--r--lib/private/user/manager.php25
-rwxr-xr-xlib/private/util.php19
-rw-r--r--lib/private/vobject.php59
-rw-r--r--lib/public/appframework/controller.php14
-rw-r--r--lib/public/appframework/http/downloadresponse.php (renamed from lib/private/appframework/http/downloadresponse.php)2
-rw-r--r--lib/public/appframework/http/jsonresponse.php4
-rw-r--r--lib/public/appframework/http/redirectresponse.php (renamed from lib/private/appframework/http/redirectresponse.php)2
-rw-r--r--lib/public/appframework/http/response.php13
-rw-r--r--lib/public/appframework/http/templateresponse.php6
-rw-r--r--lib/public/appframework/iappcontainer.php4
-rw-r--r--lib/public/config.php6
-rw-r--r--lib/public/contacts/imanager.php4
-rw-r--r--lib/public/iappconfig.php5
-rw-r--r--lib/public/il10n.php12
-rw-r--r--lib/public/iservercontainer.php2
-rw-r--r--lib/public/route/iroute.php6
-rw-r--r--lib/public/route/irouter.php6
-rw-r--r--lib/public/share.php27
-rw-r--r--lib/public/template.php2
-rw-r--r--lib/public/util.php21
150 files changed, 2126 insertions, 1118 deletions
diff --git a/lib/base.php b/lib/base.php
index 15a3ec8bc8a..37008b5a351 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -185,7 +185,6 @@ class OC {
if (file_exists(self::$configDir . "/config.php")
and !is_writable(self::$configDir . "/config.php")
) {
- $defaults = new OC_Defaults();
if (self::$CLI) {
echo "Can't write into config directory!\n";
echo "This can usually be fixed by giving the webserver write access to the config directory\n";
@@ -213,6 +212,34 @@ class OC {
}
}
+ /*
+ * This function adds some security related headers to all requests served via base.php
+ * The implementation of this function has to happen here to ensure that all third-party
+ * components (e.g. SabreDAV) also benefit from this headers.
+ */
+ public static function addSecurityHeaders() {
+ header('X-XSS-Protection: 1; mode=block'); // Enforce browser based XSS filters
+ header('X-Content-Type-Options: nosniff'); // Disable sniffing the content type for IE
+
+ // iFrame Restriction Policy
+ $xFramePolicy = OC_Config::getValue('xframe_restriction', true);
+ if($xFramePolicy) {
+ header('X-Frame-Options: Sameorigin'); // Disallow iFraming from other domains
+ }
+
+ // Content Security Policy
+ // If you change the standard policy, please also change it in config.sample.php
+ $policy = OC_Config::getValue('custom_csp_policy',
+ 'default-src \'self\'; '
+ .'script-src \'self\' \'unsafe-eval\'; '
+ .'style-src \'self\' \'unsafe-inline\'; '
+ .'frame-src *; '
+ .'img-src *; '
+ .'font-src \'self\' data:; '
+ .'media-src *');
+ header('Content-Security-Policy:'.$policy);
+ }
+
public static function checkSSL() {
// redirect to https site if configured
if (OC_Config::getValue("forcessl", false)) {
@@ -277,6 +304,11 @@ class OC {
}
}
+ /**
+ * Checks if the version requires an update and shows
+ * @param bool $showTemplate Whether an update screen should get shown
+ * @return bool|void
+ */
public static function checkUpgrade($showTemplate = true) {
if (self::needUpgrade()) {
if ($showTemplate && !OC_Config::getValue('maintenance', false)) {
@@ -305,6 +337,7 @@ class OC {
OC_Util::addScript("jquery.placeholder");
OC_Util::addScript("jquery-tipsy");
OC_Util::addScript("compatibility");
+ OC_Util::addScript("underscore");
OC_Util::addScript("jquery.ocdialog");
OC_Util::addScript("oc-dialogs");
OC_Util::addScript("js");
@@ -511,6 +544,7 @@ class OC {
self::checkConfig();
self::checkInstalled();
self::checkSSL();
+ self::addSecurityHeaders();
$errors = OC_Util::checkServer();
if (count($errors) > 0) {
@@ -664,6 +698,7 @@ class OC {
* @brief Handle the request
*/
public static function handleRequest() {
+ $l = \OC_L10N::get('lib');
// load all the classpaths from the enabled apps so they are available
// in the routing files of each app
OC::loadAppClassPaths();
@@ -685,8 +720,8 @@ class OC {
header('HTTP/1.1 400 Bad Request');
header('Status: 400 Bad Request');
OC_Template::printErrorPage(
- 'You are accessing the server from an untrusted domain.',
- 'Please contact your administrator'
+ $l->t('You are accessing the server from an untrusted domain.'),
+ $l->t('Please contact your administrator. If you are an administrator of this instance, configure the "trusted_domain" setting in config/config.php. An example configuration is provided in config/config.sample.php.')
);
return;
}
@@ -769,6 +804,11 @@ class OC {
self::handleLogin();
}
+ /**
+ * Load a PHP file belonging to the specified application
+ * @param array $param The application and file to load
+ * @return bool Whether the file has been found (will return 404 and false if not)
+ */
public static function loadAppScriptFile($param) {
OC_App::loadApps();
$app = $param['app'];
@@ -811,6 +851,10 @@ class OC {
OC_Util::displayLoginPage(array_unique($error));
}
+ /**
+ * Remove outdated and therefore invalid tokens for a user
+ * @param string $user
+ */
protected static function cleanupLoginTokens($user) {
$cutoff = time() - OC_Config::getValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15);
$tokens = OC_Preferences::getKeys($user, 'login_token');
@@ -822,6 +866,10 @@ class OC {
}
}
+ /**
+ * Try to login a user via HTTP authentication
+ * @return bool|void
+ */
protected static function tryApacheAuth() {
$return = OC_User::handleApacheAuth();
@@ -836,6 +884,10 @@ class OC {
return is_null($return) ? false : true;
}
+ /**
+ * Try to login a user using the remember me cookie.
+ * @return bool Whether the provided cookie was valid
+ */
protected static function tryRememberLogin() {
if (!isset($_COOKIE["oc_remember_login"])
|| !isset($_COOKIE["oc_token"])
@@ -877,6 +929,10 @@ class OC {
return true;
}
+ /**
+ * Tries to login a user using the formbased authentication
+ * @return bool|void
+ */
protected static function tryFormLogin() {
if (!isset($_POST["user"]) || !isset($_POST['password'])) {
return false;
@@ -911,6 +967,10 @@ class OC {
return true;
}
+ /**
+ * Try to login a user using HTTP authentication.
+ * @return bool
+ */
protected static function tryBasicAuthLogin() {
if (!isset($_SERVER["PHP_AUTH_USER"])
|| !isset($_SERVER["PHP_AUTH_PW"])
@@ -929,6 +989,10 @@ class OC {
}
if (!function_exists('get_temp_dir')) {
+ /**
+ * Get the temporary dir to store uploaded data
+ * @return null|string Path to the temporary directory or null
+ */
function get_temp_dir() {
if ($temp = ini_get('upload_tmp_dir')) return $temp;
if ($temp = getenv('TMP')) return $temp;
diff --git a/lib/l10n/af_ZA.php b/lib/l10n/af_ZA.php
index d6bf5771e8d..34d750ab65d 100644
--- a/lib/l10n/af_ZA.php
+++ b/lib/l10n/af_ZA.php
@@ -5,10 +5,11 @@ $TRANSLATIONS = array(
"Settings" => "Instellings",
"Users" => "Gebruikers",
"Admin" => "Admin",
+"Unknown filetype" => "Onbekende leertipe",
"web services under your control" => "webdienste onder jou beheer",
"_%n minute ago_::_%n minutes ago_" => array("",""),
-"_%n hour ago_::_%n hours ago_" => array("",""),
-"_%n day go_::_%n days ago_" => array("",""),
-"_%n month ago_::_%n months ago_" => array("","")
+"_%n hour ago_::_%n hours ago_" => array("","%n ure gelede"),
+"_%n day go_::_%n days ago_" => array("","%n dae gelede"),
+"_%n month ago_::_%n months ago_" => array("","%n maande gelede")
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ar.php b/lib/l10n/ar.php
index 6287a53d619..c8b51a3bb7e 100644
--- a/lib/l10n/ar.php
+++ b/lib/l10n/ar.php
@@ -56,6 +56,8 @@ $TRANSLATIONS = array(
"last month" => "الشهر الماضي",
"_%n month ago_::_%n months ago_" => array("","","","","",""),
"last year" => "السنةالماضية",
-"years ago" => "سنة مضت"
+"years ago" => "سنة مضت",
+"A valid username must be provided" => "يجب ادخال اسم مستخدم صحيح",
+"A valid password must be provided" => "يجب ادخال كلمة مرور صحيحة"
);
$PLURAL_FORMS = "nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;";
diff --git a/lib/l10n/ast.php b/lib/l10n/ast.php
new file mode 100644
index 00000000000..219317c19b9
--- /dev/null
+++ b/lib/l10n/ast.php
@@ -0,0 +1,30 @@
+<?php
+$TRANSLATIONS = array(
+"Personal" => "Personal",
+"Settings" => "Axustes",
+"Users" => "Usuarios",
+"Failed to upgrade \"%s\"." => "Fallu al anovar \"%s\".",
+"Invalid image" => "Imaxe inválida",
+"Application is not enabled" => "L'aplicación nun ta habilitada",
+"Authentication error" => "Fallu d'autenticación",
+"Files" => "Ficheros",
+"Text" => "Testu",
+"Images" => "Imaxes",
+"Set an admin username." => "Afitar nome d'usuariu p'almin",
+"Set an admin password." => "Afitar contraseña p'almin",
+"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "El sirvidor web entá nun ta configurado pa permitir la sincronización de ficheros yá que la interface WebDAV paez nun tar funcionando.",
+"Could not find category \"%s\"" => "Nun pudo alcontrase la estaya \"%s.\"",
+"seconds ago" => "fai segundos",
+"_%n minute ago_::_%n minutes ago_" => array("","fai %n minutos"),
+"_%n hour ago_::_%n hours ago_" => array("","fai %n hores"),
+"today" => "güei",
+"yesterday" => "ayeri",
+"_%n day go_::_%n days ago_" => array("","fai %n díes"),
+"last month" => "mes caberu",
+"_%n month ago_::_%n months ago_" => array("","fai %n meses"),
+"last year" => "añu caberu",
+"years ago" => "fai años",
+"A valid username must be provided" => "Tien d'apurrise un nome d'usuariu válidu",
+"A valid password must be provided" => "Tien d'apurrise una contraseña válida"
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/az.php b/lib/l10n/az.php
index e7b09649a24..15f78e0bce6 100644
--- a/lib/l10n/az.php
+++ b/lib/l10n/az.php
@@ -1,8 +1,8 @@
<?php
$TRANSLATIONS = array(
-"_%n minute ago_::_%n minutes ago_" => array(""),
-"_%n hour ago_::_%n hours ago_" => array(""),
-"_%n day go_::_%n days ago_" => array(""),
-"_%n month ago_::_%n months ago_" => array("")
+"_%n minute ago_::_%n minutes ago_" => array("",""),
+"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","")
);
-$PLURAL_FORMS = "nplurals=1; plural=0;";
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ca.php b/lib/l10n/ca.php
index 88bb8ec9eee..22d8c457f5e 100644
--- a/lib/l10n/ca.php
+++ b/lib/l10n/ca.php
@@ -66,6 +66,10 @@ $TRANSLATIONS = array(
"last month" => "el mes passat",
"_%n month ago_::_%n months ago_" => array("fa %n mes","fa %n mesos"),
"last year" => "l'any passat",
-"years ago" => "anys enrere"
+"years ago" => "anys enrere",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Només els caràcters següents estan permesos en el nom d'usuari: \"a-z\", \"A-Z\", \"0-9\" i \"_.@-\"",
+"A valid username must be provided" => "Heu de facilitar un nom d'usuari vàlid",
+"A valid password must be provided" => "Heu de facilitar una contrasenya vàlida",
+"The username is already being used" => "El nom d'usuari ja està en ús"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/cs_CZ.php b/lib/l10n/cs_CZ.php
index 6b5c8441ca1..6fef446d8c4 100644
--- a/lib/l10n/cs_CZ.php
+++ b/lib/l10n/cs_CZ.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"You are accessing the server from an untrusted domain." => "Přistupujete na server z nedůvěryhodné domény.",
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "Aplikace \"%s\" nemůže být nainstalována, protože není kompatibilní s touto verzí ownCloud.",
"No app name specified" => "Nebyl zadan název aplikace",
"Help" => "Nápověda",
@@ -56,6 +57,15 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Váš webový server není správně nastaven pro umožnění synchronizace, rozhraní WebDAV se zdá být rozbité.",
"Please double check the <a href='%s'>installation guides</a>." => "Zkonzultujte, prosím, <a href='%s'>průvodce instalací</a>.",
"%s shared »%s« with you" => "%s s vámi sdílí »%s«",
+"Sharing %s failed, because the file does not exist" => "Sdílení %s selhalo, protože soubor neexistuje",
+"Sharing %s failed, because the user %s is the item owner" => "Sdílení položky %s selhalo, protože uživatel %s je jejím vlastníkem",
+"Sharing %s failed, because the user %s does not exist" => "Sdílení položky %s selhalo, protože uživatel %s neexistuje",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "Sdílení položky %s selhalo, protože uživatel %s není členem žádné skupiny společné s uživatelem %s",
+"Sharing %s failed, because this item is already shared with %s" => "Sdílení položky %s selhalo, protože položka již je s uživatelem %s sdílena",
+"Sharing %s failed, because the group %s does not exist" => "Sdílení položky %s selhalo, protože skupina %s neexistuje",
+"Sharing %s failed, because %s is not a member of the group %s" => "Sdílení položky %s selhalo, protože uživatel %s není členem skupiny %s",
+"Sharing %s failed, because sharing with links is not allowed" => "Sdílení položky %s selhalo, protože sdílení pomocí linků není povoleno",
+"Setting permissions for %s failed, because the item was not found" => "Nastavení práv pro %s selhalo, protože položka nebyla nalezena",
"Could not find category \"%s\"" => "Nelze nalézt kategorii \"%s\"",
"seconds ago" => "před pár sekundami",
"_%n minute ago_::_%n minutes ago_" => array("před %n minutou","před %n minutami","před %n minutami"),
@@ -66,6 +76,10 @@ $TRANSLATIONS = array(
"last month" => "minulý měsíc",
"_%n month ago_::_%n months ago_" => array("před %n měsícem","před %n měsíci","před %n měsíci"),
"last year" => "minulý rok",
-"years ago" => "před lety"
+"years ago" => "před lety",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Pouze následující znaky jsou povoleny v uživatelském jménu: \"a-z\", \"A-Z\", \"0-9\" a \"_.@-\"",
+"A valid username must be provided" => "Musíte zadat platné uživatelské jméno",
+"A valid password must be provided" => "Musíte zadat platné heslo",
+"The username is already being used" => "Uživatelské jméno je již využíváno"
);
$PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;";
diff --git a/lib/l10n/da.php b/lib/l10n/da.php
index c3166000727..3be45001030 100644
--- a/lib/l10n/da.php
+++ b/lib/l10n/da.php
@@ -66,6 +66,8 @@ $TRANSLATIONS = array(
"last month" => "sidste måned",
"_%n month ago_::_%n months ago_" => array("%n måned siden","%n måneder siden"),
"last year" => "sidste år",
-"years ago" => "år siden"
+"years ago" => "år siden",
+"A valid username must be provided" => "Et gyldigt brugernavn skal angives",
+"A valid password must be provided" => "En gyldig adgangskode skal angives"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/de.php b/lib/l10n/de.php
index d644582b91e..3c7fdd42f07 100644
--- a/lib/l10n/de.php
+++ b/lib/l10n/de.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"You are accessing the server from an untrusted domain." => "Du greifst von einer nicht vertrauenswürdigen Domain auf den Server zu.",
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "Applikation \"%s\" kann nicht installiert werden, da sie mit dieser ownCloud Version nicht kompatibel ist.",
"No app name specified" => "Es wurde kein Applikation-Name angegeben",
"Help" => "Hilfe",
@@ -56,6 +57,25 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Dein Web-Server ist noch nicht für Datei-Synchronisation bereit, weil die WebDAV-Schnittstelle vermutlich defekt ist.",
"Please double check the <a href='%s'>installation guides</a>." => "Bitte prüfe die <a href='%s'>Installationsanleitungen</a>.",
"%s shared »%s« with you" => "%s teilte »%s« mit Dir",
+"Sharing %s failed, because the file does not exist" => "Freigabe von %s fehlgeschlagen, da die Datei nicht existiert",
+"Sharing %s failed, because the user %s is the item owner" => "Freigabe von %s fehlgeschlagen, da der Nutzer %s Besitzer des Objektes ist",
+"Sharing %s failed, because the user %s does not exist" => "Freigabe von %s fehlgeschlagen, da der Nutzer %s nicht existiert",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "Freigabe von %s fehlgeschlagen, da der Nutzer %s kein Gruppenmitglied einer der Gruppen von %s ist",
+"Sharing %s failed, because this item is already shared with %s" => "Freigabe von %s fehlgeschlagen, da dieses Objekt schon mit %s geteilt wird",
+"Sharing %s failed, because the group %s does not exist" => "Freigabe von %s fehlgeschlagen, da die Gruppe %s nicht existiert",
+"Sharing %s failed, because %s is not a member of the group %s" => "Freigabe von %s fehlgeschlagen, da %s kein Mitglied der Gruppe %s ist",
+"Sharing %s failed, because sharing with links is not allowed" => "Freigabe von %s fehlgeschlagen, da das Teilen von Verknüpfungen nicht erlaubt ist",
+"Share type %s is not valid for %s" => "Freigabetyp %s ist nicht gültig für %s",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Das Setzen der Berechtigungen für %s ist fehlgeschlagen, da die Berechtigungen, die erteilten Berechtigungen %s überschreiten",
+"Setting permissions for %s failed, because the item was not found" => "Das Setzen der Berechtigungen für %s ist fehlgeschlagen, da das Objekt nicht gefunden wurde",
+"Sharing backend %s must implement the interface OCP\\Share_Backend" => "Freigabe-Backend %s muss in der OCP\\Share_Backend - Schnittstelle implementiert werden",
+"Sharing backend %s not found" => "Freigabe-Backend %s nicht gefunden",
+"Sharing backend for %s not found" => "Freigabe-Backend für %s nicht gefunden",
+"Sharing %s failed, because the user %s is the original sharer" => "Freigabe von %s fehlgeschlagen, da der Nutzer %s der offizielle Freigeber ist",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "Freigabe von %s fehlgeschlagen, da die Berechtigungen die erteilten Berechtigungen %s überschreiten",
+"Sharing %s failed, because resharing is not allowed" => "Freigabe von %s fehlgeschlagen, da das nochmalige Freigeben einer Freigabe nicht erlaubt ist",
+"Sharing %s failed, because the sharing backend for %s could not find its source" => "Freigabe von %s fehlgeschlagen, da das Freigabe-Backend für %s nicht in dieser Quelle gefunden werden konnte",
+"Sharing %s failed, because the file could not be found in the file cache" => "Freigabe von %s fehlgeschlagen, da die Datei im Datei-Cache nicht gefunden werden konnte",
"Could not find category \"%s\"" => "Die Kategorie \"%s\" konnte nicht gefunden werden.",
"seconds ago" => "Gerade eben",
"_%n minute ago_::_%n minutes ago_" => array("Vor %n Minute","Vor %n Minuten"),
@@ -66,6 +86,10 @@ $TRANSLATIONS = array(
"last month" => "Letzten Monat",
"_%n month ago_::_%n months ago_" => array("Vor %n Monat","Vor %n Monaten"),
"last year" => "Letztes Jahr",
-"years ago" => "Vor Jahren"
+"years ago" => "Vor Jahren",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Folgende Zeichen sind im Benutzernamen erlaubt: \"a-z\", \"A-Z\", \"0-9\" und \"_.@-\"",
+"A valid username must be provided" => "Es muss ein gültiger Benutzername angegeben werden",
+"A valid password must be provided" => "Es muss ein gültiges Passwort angegeben werden",
+"The username is already being used" => "Dieser Benutzername existiert bereits"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/de_CH.php b/lib/l10n/de_CH.php
index fe1a519ccf7..e034cc3c209 100644
--- a/lib/l10n/de_CH.php
+++ b/lib/l10n/de_CH.php
@@ -47,6 +47,8 @@ $TRANSLATIONS = array(
"last month" => "Letzten Monat",
"_%n month ago_::_%n months ago_" => array("","Vor %n Monaten"),
"last year" => "Letztes Jahr",
-"years ago" => "Vor Jahren"
+"years ago" => "Vor Jahren",
+"A valid username must be provided" => "Es muss ein gültiger Benutzername angegeben werden",
+"A valid password must be provided" => "Es muss ein gültiges Passwort angegeben werden"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/de_DE.php b/lib/l10n/de_DE.php
index 85ed7e5c80a..62d2e6f3c31 100644
--- a/lib/l10n/de_DE.php
+++ b/lib/l10n/de_DE.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"You are accessing the server from an untrusted domain." => "Sie greifen von einer nicht vertrauenswürdigen Domain auf den Server zu.",
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "Applikation \"%s\" kann nicht installiert werden, da sie mit dieser ownCloud Version nicht kompatibel ist.",
"No app name specified" => "Es wurde kein Applikation-Name angegeben",
"Help" => "Hilfe",
@@ -56,6 +57,25 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Ihr Web-Server ist noch nicht für eine Datei-Synchronisation konfiguriert, weil die WebDAV-Schnittstelle vermutlich defekt ist.",
"Please double check the <a href='%s'>installation guides</a>." => "Bitte prüfen Sie die <a href='%s'>Installationsanleitungen</a>.",
"%s shared »%s« with you" => "%s hat »%s« mit Ihnen geteilt",
+"Sharing %s failed, because the file does not exist" => "Freigabe von %s fehlgeschlagen, da die Datei nicht existiert",
+"Sharing %s failed, because the user %s is the item owner" => "Freigabe von %s fehlgeschlagen, da der Nutzer %s Besitzer des Objektes ist",
+"Sharing %s failed, because the user %s does not exist" => "Freigabe von %s fehlgeschlagen, da der Nutzer %s nicht existiert",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "Freigabe von %s fehlgeschlagen, da der Nutzer %s kein Gruppenmitglied einer der Gruppen von %s ist",
+"Sharing %s failed, because this item is already shared with %s" => "Freigabe von %s fehlgeschlagen, da dieses Objekt schon mit %s geteilt wird",
+"Sharing %s failed, because the group %s does not exist" => "Freigabe von %s fehlgeschlagen, da die Gruppe %s nicht existiert",
+"Sharing %s failed, because %s is not a member of the group %s" => "Freigabe von %s fehlgeschlagen, da %s kein Mitglied der Gruppe %s ist",
+"Sharing %s failed, because sharing with links is not allowed" => "Freigabe von %s fehlgeschlagen, da das Teilen von Verknüpfungen nicht erlaubt ist",
+"Share type %s is not valid for %s" => "Freigabetyp %s ist nicht gültig für %s",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Das Setzen der Berechtigungen für %s ist fehlgeschlagen, da die Berechtigungen, die erteilten Berechtigungen %s überschreiten",
+"Setting permissions for %s failed, because the item was not found" => "Das Setzen der Berechtigungen für %s ist fehlgeschlagen, da das Objekt nicht gefunden wurde",
+"Sharing backend %s must implement the interface OCP\\Share_Backend" => "Freigabe-Backend %s muss in der OCP\\Share_Backend - Schnittstelle implementiert werden",
+"Sharing backend %s not found" => "Freigabe-Backend %s nicht gefunden",
+"Sharing backend for %s not found" => "Freigabe-Backend für %s nicht gefunden",
+"Sharing %s failed, because the user %s is the original sharer" => "Freigabe von %s fehlgeschlagen, da der Nutzer %s der offizielle Freigeber ist",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "Freigabe von %s fehlgeschlagen, da die Berechtigungen die erteilten Berechtigungen %s überschreiten",
+"Sharing %s failed, because resharing is not allowed" => "Freigabe von %s fehlgeschlagen, da das nochmalige Freigeben einer Freigabe nicht erlaubt ist",
+"Sharing %s failed, because the sharing backend for %s could not find its source" => "Freigabe von %s fehlgeschlagen, da das Freigabe-Backend für %s nicht in dieser Quelle gefunden werden konnte",
+"Sharing %s failed, because the file could not be found in the file cache" => "Freigabe von %s fehlgeschlagen, da die Datei im Datei-Cache nicht gefunden werden konnte",
"Could not find category \"%s\"" => "Die Kategorie \"%s\" konnte nicht gefunden werden.",
"seconds ago" => "Gerade eben",
"_%n minute ago_::_%n minutes ago_" => array("Vor %n Minute","Vor %n Minuten"),
@@ -66,6 +86,10 @@ $TRANSLATIONS = array(
"last month" => "Letzten Monat",
"_%n month ago_::_%n months ago_" => array("Vor %n Monat","Vor %n Monaten"),
"last year" => "Letztes Jahr",
-"years ago" => "Vor Jahren"
+"years ago" => "Vor Jahren",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Folgende Zeichen sind im Benutzernamen erlaubt: \"a-z\", \"A-Z\", \"0-9\" und \"_.@-\"",
+"A valid username must be provided" => "Es muss ein gültiger Benutzername angegeben werden",
+"A valid password must be provided" => "Es muss ein gültiges Passwort angegeben werden",
+"The username is already being used" => "Der Benutzername existiert bereits"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/el.php b/lib/l10n/el.php
index a169ae38649..109104e4061 100644
--- a/lib/l10n/el.php
+++ b/lib/l10n/el.php
@@ -6,7 +6,7 @@ $TRANSLATIONS = array(
"Personal" => "Προσωπικά",
"Settings" => "Ρυθμίσεις",
"Users" => "Χρήστες",
-"Admin" => "Διαχειριστής",
+"Admin" => "Διαχείριση",
"Failed to upgrade \"%s\"." => "Αποτυχία αναβάθμισης του \"%s\".",
"Unknown filetype" => "Άγνωστος τύπος αρχείου",
"Invalid image" => "Μη έγκυρη εικόνα",
@@ -66,6 +66,8 @@ $TRANSLATIONS = array(
"last month" => "τελευταίο μήνα",
"_%n month ago_::_%n months ago_" => array("","%n μήνες πριν"),
"last year" => "τελευταίο χρόνο",
-"years ago" => "χρόνια πριν"
+"years ago" => "χρόνια πριν",
+"A valid username must be provided" => "Πρέπει να δοθεί έγκυρο όνομα χρήστη",
+"A valid password must be provided" => "Πρέπει να δοθεί έγκυρο συνθηματικό"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/en_GB.php b/lib/l10n/en_GB.php
index 7d2246eb66b..ca82017bbf5 100644
--- a/lib/l10n/en_GB.php
+++ b/lib/l10n/en_GB.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"You are accessing the server from an untrusted domain." => "You are accessing the server from an untrusted domain.",
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "App \"%s\" can't be installed because it is not compatible with this version of ownCloud.",
"No app name specified" => "No app name specified",
"Help" => "Help",
@@ -56,6 +57,25 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Your web server is not yet properly setup to allow files synchronisation because the WebDAV interface seems to be broken.",
"Please double check the <a href='%s'>installation guides</a>." => "Please double check the <a href='%s'>installation guides</a>.",
"%s shared »%s« with you" => "%s shared \"%s\" with you",
+"Sharing %s failed, because the file does not exist" => "Sharing %s failed, because the file does not exist",
+"Sharing %s failed, because the user %s is the item owner" => "Sharing %s failed, because the user %s is the item owner",
+"Sharing %s failed, because the user %s does not exist" => "Sharing %s failed, because the user %s does not exist",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "Sharing %s failed, because the user %s is not a member of any groups that %s is a member of",
+"Sharing %s failed, because this item is already shared with %s" => "Sharing %s failed, because this item is already shared with %s",
+"Sharing %s failed, because the group %s does not exist" => "Sharing %s failed, because the group %s does not exist",
+"Sharing %s failed, because %s is not a member of the group %s" => "Sharing %s failed, because %s is not a member of the group %s",
+"Sharing %s failed, because sharing with links is not allowed" => "Sharing %s failed, because sharing with links is not allowed",
+"Share type %s is not valid for %s" => "Share type %s is not valid for %s",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Setting permissions for %s failed, because the permissions exceed permissions granted to %s",
+"Setting permissions for %s failed, because the item was not found" => "Setting permissions for %s failed, because the item was not found",
+"Sharing backend %s must implement the interface OCP\\Share_Backend" => "Sharing backend %s must implement the interface OCP\\Share_Backend",
+"Sharing backend %s not found" => "Sharing backend %s not found",
+"Sharing backend for %s not found" => "Sharing backend for %s not found",
+"Sharing %s failed, because the user %s is the original sharer" => "Sharing %s failed, because the user %s is the original sharer",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "Sharing %s failed, because the permissions exceed permissions granted to %s",
+"Sharing %s failed, because resharing is not allowed" => "Sharing %s failed, because resharing is not allowed",
+"Sharing %s failed, because the sharing backend for %s could not find its source" => "Sharing %s failed, because the sharing backend for %s could not find its source",
+"Sharing %s failed, because the file could not be found in the file cache" => "Sharing %s failed, because the file could not be found in the file cache",
"Could not find category \"%s\"" => "Could not find category \"%s\"",
"seconds ago" => "seconds ago",
"_%n minute ago_::_%n minutes ago_" => array("%n minute ago","%n minutes ago"),
@@ -66,6 +86,10 @@ $TRANSLATIONS = array(
"last month" => "last month",
"_%n month ago_::_%n months ago_" => array("%n month ago","%n months ago"),
"last year" => "last year",
-"years ago" => "years ago"
+"years ago" => "years ago",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"",
+"A valid username must be provided" => "A valid username must be provided",
+"A valid password must be provided" => "A valid password must be provided",
+"The username is already being used" => "The username is already being used"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/es.php b/lib/l10n/es.php
index 14d6435c891..20da58c3514 100644
--- a/lib/l10n/es.php
+++ b/lib/l10n/es.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"You are accessing the server from an untrusted domain." => "Está accediendo al servidor desde un dominio inseguro.",
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "La aplicación \"%s\" no puede ser instalada porque no es compatible con esta versión de ownCloud",
"No app name specified" => "No se ha especificado nombre de la aplicación",
"Help" => "Ayuda",
@@ -56,6 +57,21 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Su servidor web aún no está configurado adecuadamente para permitir sincronización de archivos ya que la interfaz WebDAV parece no estar funcionando.",
"Please double check the <a href='%s'>installation guides</a>." => "Por favor, vuelva a comprobar las <a href='%s'>guías de instalación</a>.",
"%s shared »%s« with you" => "%s ha compatido »%s« contigo",
+"Sharing %s failed, because the file does not exist" => "No se pudo compartir %s porque el archivo no existe",
+"Sharing %s failed, because the user %s is the item owner" => "Compartiendo %s ha fallado, ya que el usuario %s es el dueño del elemento",
+"Sharing %s failed, because the user %s does not exist" => "Compartiendo %s ha fallado, 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" => "Compartiendo %s ha fallado, ya que el usuario %s no es miembro de algún grupo que %s es miembro",
+"Sharing %s failed, because this item is already shared with %s" => "Compartiendo %s ha fallado, ya que este elemento ya está compartido con %s",
+"Sharing %s failed, because the group %s does not exist" => "Compartiendo %s ha fallado, ya que el grupo %s no existe",
+"Sharing %s failed, because %s is not a member of the group %s" => "Compartiendo %s ha fallado, ya que %s no es miembro del grupo %s",
+"Sharing %s failed, because sharing with links is not allowed" => "Compartiendo %s ha fallado, ya que compartir con enlaces no está permitido",
+"Share type %s is not valid for %s" => "Compartir tipo %s no es válido para %s",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Configuración de permisos para %s ha fallado, ya que los permisos superan los permisos dados a %s",
+"Setting permissions for %s failed, because the item was not found" => "Configuración de permisos para %s ha fallado, ya que el elemento no fue encontrado",
+"Sharing %s failed, because the user %s is the original sharer" => "Compartiendo %s ha fallado, ya que el usuario %s es el compartidor original",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "Compartiendo %s ha fallado, ya que los permisos superan los permisos otorgados a %s",
+"Sharing %s failed, because resharing is not allowed" => "Compartiendo %s ha fallado, ya que volver a compartir no está permitido",
+"Sharing %s failed, because the file could not be found in the file cache" => "Compartiendo %s ha fallado, ya que el archivo no pudo ser encontrado en el cache de archivo",
"Could not find category \"%s\"" => "No puede encontrar la categoria \"%s\"",
"seconds ago" => "hace segundos",
"_%n minute ago_::_%n minutes ago_" => array("Hace %n minuto","Hace %n minutos"),
@@ -66,6 +82,10 @@ $TRANSLATIONS = array(
"last month" => "mes pasado",
"_%n month ago_::_%n months ago_" => array("Hace %n mes","Hace %n meses"),
"last year" => "año pasado",
-"years ago" => "hace años"
+"years ago" => "hace años",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Solo los siguientes caracteres están permitidos en un nombre de usuario: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"",
+"A valid username must be provided" => "Se debe proporcionar un nombre de usuario válido",
+"A valid password must be provided" => "Se debe proporcionar una contraseña válida",
+"The username is already being used" => "El nombre de usuario ya está en uso"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/es_AR.php b/lib/l10n/es_AR.php
index a925e22ba88..34775b16b22 100644
--- a/lib/l10n/es_AR.php
+++ b/lib/l10n/es_AR.php
@@ -60,6 +60,8 @@ $TRANSLATIONS = array(
"last month" => "el mes pasado",
"_%n month ago_::_%n months ago_" => array("Hace %n mes","Hace %n meses"),
"last year" => "el año pasado",
-"years ago" => "años atrás"
+"years ago" => "años atrás",
+"A valid username must be provided" => "Debe ingresar un nombre de usuario válido",
+"A valid password must be provided" => "Debe ingresar una contraseña válida"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/es_CR.php b/lib/l10n/es_CR.php
new file mode 100644
index 00000000000..15f78e0bce6
--- /dev/null
+++ b/lib/l10n/es_CR.php
@@ -0,0 +1,8 @@
+<?php
+$TRANSLATIONS = array(
+"_%n minute ago_::_%n minutes ago_" => array("",""),
+"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/es_MX.php b/lib/l10n/es_MX.php
index 2f0ed33f6b3..befb076b7de 100644
--- a/lib/l10n/es_MX.php
+++ b/lib/l10n/es_MX.php
@@ -60,6 +60,8 @@ $TRANSLATIONS = array(
"last month" => "mes pasado",
"_%n month ago_::_%n months ago_" => array("Hace %n mes","Hace %n meses"),
"last year" => "año pasado",
-"years ago" => "hace años"
+"years ago" => "hace años",
+"A valid username must be provided" => "Se debe proporcionar un nombre de usuario válido",
+"A valid password must be provided" => "Se debe proporcionar una contraseña válida"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/et_EE.php b/lib/l10n/et_EE.php
index 7d8cc0f4b49..079ff3ba472 100644
--- a/lib/l10n/et_EE.php
+++ b/lib/l10n/et_EE.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"You are accessing the server from an untrusted domain." => "Sa kasutad serverit usalduseta asukohast",
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "Rakendit \"%s\" ei saa paigaldada, kuna see pole ühilduv selle ownCloud versiooniga.",
"No app name specified" => "Ühegi rakendi nime pole määratletud",
"Help" => "Abiinfo",
@@ -56,6 +57,25 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Veebiserveri ei ole veel korralikult seadistatud võimaldamaks failide sünkroniseerimist, kuna WebDAV liides näib olevat mittetoimiv.",
"Please double check the <a href='%s'>installation guides</a>." => "Palun tutvu veelkord <a href='%s'>paigalduse juhenditega</a>.",
"%s shared »%s« with you" => "%s jagas sinuga »%s«",
+"Sharing %s failed, because the file does not exist" => "%s jagamine ebaõnnestus, kuna faili pole olemas",
+"Sharing %s failed, because the user %s is the item owner" => "%s jagamine ebaõnnestus, kuna kuna kasutaja %s on üksuse omanik",
+"Sharing %s failed, because the user %s does not exist" => "%s jagamine ebaõnnestus, kuna kasutajat %s pole olemas",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "%s jagamine ebaõnnestus, kuna kasutaja %s pole ühegi grupi liige, millede liige on %s",
+"Sharing %s failed, because this item is already shared with %s" => "%s jagamine ebaõnnestus, kuna see üksus on juba jagatud %s",
+"Sharing %s failed, because the group %s does not exist" => "%s jagamine ebaõnnestus, kuna gruppi %s pole olemas",
+"Sharing %s failed, because %s is not a member of the group %s" => "%s jagamine ebaõnnestus, kuna %s pole grupi %s liige",
+"Sharing %s failed, because sharing with links is not allowed" => "%s jagamine ebaõnnestus, kuna linkidega jagamine pole lubatud",
+"Share type %s is not valid for %s" => "Jagamise tüüp %s ei ole õige %s jaoks",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Lubade seadistus %s jaoks ebaõnnestus, kuna antud õigused ületavad %s jaoks määratud õigusi",
+"Setting permissions for %s failed, because the item was not found" => "Lubade seadistus %s jaoks ebaõnnestus, kuna üksust ei leitud",
+"Sharing backend %s must implement the interface OCP\\Share_Backend" => "Jagamise tagarakend %s peab kasutusele võtma OCP\\Share_Backend liidese",
+"Sharing backend %s not found" => "Jagamise tagarakendit %s ei leitud",
+"Sharing backend for %s not found" => "Jagamise tagarakendit %s jaoks ei leitud",
+"Sharing %s failed, because the user %s is the original sharer" => "%s jagamine ebaõnnestus, kuna kasutaja %s on algne jagaja",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "%s jagamine ebaõnnestus, kuna antud õigused ületavad %s jaoks määratud õigusi",
+"Sharing %s failed, because resharing is not allowed" => "%s jagamine ebaõnnestus, kuna edasijagamine pole lubatud",
+"Sharing %s failed, because the sharing backend for %s could not find its source" => "%s jagamine ebaõnnestus, kuna jagamise tagarakend ei suutnud leida %s jaoks lähteallikat",
+"Sharing %s failed, because the file could not be found in the file cache" => "%s jagamine ebaõnnestus, kuna faili ei suudetud leida failide puhvrist",
"Could not find category \"%s\"" => "Ei leia kategooriat \"%s\"",
"seconds ago" => "sekundit tagasi",
"_%n minute ago_::_%n minutes ago_" => array("","%n minutit tagasi"),
@@ -66,6 +86,10 @@ $TRANSLATIONS = array(
"last month" => "viimasel kuul",
"_%n month ago_::_%n months ago_" => array("","%n kuud tagasi"),
"last year" => "viimasel aastal",
-"years ago" => "aastat tagasi"
+"years ago" => "aastat tagasi",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Kasutajanimes on lubatud ainult järgnevad tähemärgid: \"a-z\", \"A-Z\", \"0-9\" ja \"_.@-\"",
+"A valid username must be provided" => "Sisesta nõuetele vastav kasutajatunnus",
+"A valid password must be provided" => "Sisesta nõuetele vastav parool",
+"The username is already being used" => "Kasutajanimi on juba kasutuses"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/eu.php b/lib/l10n/eu.php
index 58c198cff14..7a8a11f5b32 100644
--- a/lib/l10n/eu.php
+++ b/lib/l10n/eu.php
@@ -60,6 +60,9 @@ $TRANSLATIONS = array(
"last month" => "joan den hilabetean",
"_%n month ago_::_%n months ago_" => array("orain dela hilabete %n","orain dela %n hilabete"),
"last year" => "joan den urtean",
-"years ago" => "urte"
+"years ago" => "urte",
+"A valid username must be provided" => "Baliozko erabiltzaile izena eman behar da",
+"A valid password must be provided" => "Baliozko pasahitza eman behar da",
+"The username is already being used" => "Erabiltzaile izena dagoeneko erabiltzen ari da"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/fa.php b/lib/l10n/fa.php
index 7323ffe1918..c1c16cf94b4 100644
--- a/lib/l10n/fa.php
+++ b/lib/l10n/fa.php
@@ -42,6 +42,8 @@ $TRANSLATIONS = array(
"last month" => "ماه قبل",
"_%n month ago_::_%n months ago_" => array(""),
"last year" => "سال قبل",
-"years ago" => "سال‌های قبل"
+"years ago" => "سال‌های قبل",
+"A valid username must be provided" => "نام کاربری صحیح باید وارد شود",
+"A valid password must be provided" => "رمز عبور صحیح باید وارد شود"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/fi_FI.php b/lib/l10n/fi_FI.php
index 018e4c04c4f..8396cf14387 100644
--- a/lib/l10n/fi_FI.php
+++ b/lib/l10n/fi_FI.php
@@ -23,6 +23,7 @@ $TRANSLATIONS = array(
"App does not provide an info.xml file" => "Sovellus ei sisällä info.xml-tiedostoa",
"App can't be installed because of not allowed code in the App" => "Sovellusta ei voi asentaa, koska sovellus sisältää kiellettyä koodia",
"App can't be installed because it is not compatible with this version of ownCloud" => "Sovellusta ei voi asentaa, koska se ei ole yhteensopiva käytössä olevan ownCloud-version kanssa",
+"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "Sovellusta ei voi asentaa, koska info.xml/version ilmoittaa versioksi eri arvon kuin sovelluskauppa",
"App directory already exists" => "Sovelluskansio on jo olemassa",
"Can't create app folder. Please fix permissions. %s" => "Sovelluskansion luominen ei onnistu. Korjaa käyttöoikeudet. %s",
"Application is not enabled" => "Sovellusta ei ole otettu käyttöön",
@@ -38,17 +39,30 @@ $TRANSLATIONS = array(
"MS SQL username and/or password not valid: %s" => "MS SQL -käyttäjätunnus ja/tai -salasana on väärin: %s",
"MySQL/MariaDB username and/or password not valid" => "MySQL/MariaDB-käyttäjätunnus ja/tai salasana on virheellinen",
"DB Error: \"%s\"" => "Tietokantavirhe: \"%s\"",
+"Offending command was: \"%s\"" => "Loukkaava komento oli: \"%s\"",
"MySQL/MariaDB user '%s'@'localhost' exists already." => "MySQL/MariaDB-käyttäjä '%s'@'localhost' on jo olemassa.",
"Drop this user from MySQL/MariaDB" => "Pudota tämä käyttäjä MySQL/MariaDB:stä",
"MySQL/MariaDB user '%s'@'%%' already exists" => "MySQL/MariaDB-käyttäjä '%s'@'%%' on jo olemassa",
"Drop this user from MySQL/MariaDB." => "Pudota tämä käyttäjä MySQL/MariaDB:stä.",
"Oracle connection could not be established" => "Oracle-yhteyttä ei voitu muodostaa",
"Oracle username and/or password not valid" => "Oraclen käyttäjätunnus ja/tai salasana on väärin",
+"Offending command was: \"%s\", name: %s, password: %s" => "Loukkaava komento oli: \"%s\", nimi: %s, salasana: %s",
"PostgreSQL username and/or password not valid" => "PostgreSQL:n käyttäjätunnus ja/tai salasana on väärin",
"Set an admin username." => "Aseta ylläpitäjän käyttäjätunnus.",
"Set an admin password." => "Aseta ylläpitäjän salasana.",
+"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Web-palvelimen asetukset eivät ole kelvolliset tiedostojen synkronointia varten, koska WebDAV-liitäntä vaikuttaa olevan rikki.",
"Please double check the <a href='%s'>installation guides</a>." => "Lue tarkasti <a href='%s'>asennusohjeet</a>.",
"%s shared »%s« with you" => "%s jakoi kohteen »%s« kanssasi",
+"Sharing %s failed, because the user %s is the item owner" => "Kohteen %s jakaminen epäonnistui, koska käyttäjä %s on kohteen omistaja",
+"Sharing %s failed, because the user %s does not exist" => "Kohteen %s jakaminen epäonnistui, koska käyttäjää %s ei ole olemassa",
+"Sharing %s failed, because this item is already shared with %s" => "Kohteen %s jakaminen epäonnistui, koska kohde on jo jaettu käyttäjän %s kanssa",
+"Sharing %s failed, because the group %s does not exist" => "Kohteen %s jakaminen epäonnistui, koska ryhmää %s ei ole olemassa",
+"Sharing %s failed, because %s is not a member of the group %s" => "Kohteen %s jakaminen epäonnistui, koska käyttäjä %s ei ole ryhmän %s jäsen",
+"Sharing %s failed, because sharing with links is not allowed" => "Kohteen %s jakaminen epäonnistui, koska jakaminen linkkejä käyttäen ei ole sallittu",
+"Setting permissions for %s failed, because the item was not found" => "Kohteen %s oikeuksien asettaminen epäonnistui, koska kohdetta ei löytynyt",
+"Sharing %s failed, because the user %s is the original sharer" => "Kohteen %s jakaminen epäonnistui, koska käyttäjä %s on alkuperäinen jakaja",
+"Sharing %s failed, because resharing is not allowed" => "Kohteen %s jakaminen epäonnistui, koska jakaminen uudelleen ei ole sallittu",
+"Sharing %s failed, because the file could not be found in the file cache" => "Kohteen %s jakaminen epäonnistui, koska tiedostoa ei löytynyt tiedostovälimuistista",
"Could not find category \"%s\"" => "Luokkaa \"%s\" ei löytynyt",
"seconds ago" => "sekuntia sitten",
"_%n minute ago_::_%n minutes ago_" => array("%n minuutti sitten","%n minuuttia sitten"),
@@ -59,6 +73,10 @@ $TRANSLATIONS = array(
"last month" => "viime kuussa",
"_%n month ago_::_%n months ago_" => array("%n kuukausi sitten","%n kuukautta sitten"),
"last year" => "viime vuonna",
-"years ago" => "vuotta sitten"
+"years ago" => "vuotta sitten",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Vain seuraavat merkit ovat sallittuja käyttäjätunnuksessa: \"a-z\", \"A-Z\", \"0-9\" ja \"_.@-\"",
+"A valid username must be provided" => "Anna kelvollinen käyttäjätunnus",
+"A valid password must be provided" => "Anna kelvollinen salasana",
+"The username is already being used" => "Käyttäjätunnus on jo käytössä"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php
index d866fb664ee..3bfa3fe8916 100644
--- a/lib/l10n/fr.php
+++ b/lib/l10n/fr.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"You are accessing the server from an untrusted domain." => "Vous accédez au serveur à partir d'un domaine non-approuvé.",
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "L'application \"%s\" ne peut être installée car elle n'est pas compatible avec cette version de ownCloud.",
"No app name specified" => "Aucun nom d'application spécifié",
"Help" => "Aide",
@@ -56,6 +57,21 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Votre serveur web, n'est pas correctement configuré pour permettre la synchronisation des fichiers, car l'interface WebDav ne fonctionne pas comme il faut.",
"Please double check the <a href='%s'>installation guides</a>." => "Veuillez vous référer au <a href='%s'>guide d'installation</a>.",
"%s shared »%s« with you" => "%s partagé »%s« avec vous",
+"Sharing %s failed, because the file does not exist" => "Le partage de %s a échoué car le fichier n'existe pas",
+"Sharing %s failed, because the user %s is the item owner" => "Le partage de %s a échoué car l'utilisateur %s est le propriétaire de l'objet",
+"Sharing %s failed, because the user %s does not exist" => "Le partage de %s a échoué car l'utilisateur %s n'existe pas",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "Le partage de %s a échoué car l'utilisateur %s n'est membre d'aucun groupe auquel %s appartient",
+"Sharing %s failed, because this item is already shared with %s" => "Le partage de %s a échoué car cet objet est déjà partagé avec %s",
+"Sharing %s failed, because the group %s does not exist" => "Le partage de %s a échoué car le groupe %s n'existe pas",
+"Sharing %s failed, because %s is not a member of the group %s" => "Le partage de %s a échoué car %s n'est pas membre du groupe %s",
+"Sharing %s failed, because sharing with links is not allowed" => "Le partage de %s a échoué car un partage de lien n'est pas permis",
+"Share type %s is not valid for %s" => "Le type de partage %s n'est pas valide pour %s",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Le réglage des permissions pour %s a échoué car les permissions dépassent celle accordée à %s",
+"Setting permissions for %s failed, because the item was not found" => "Le réglage des permissions pour %s a échoué car l'objet n'a pas été trouvé",
+"Sharing %s failed, because the user %s is the original sharer" => "Le partage de %s a échoué car l'utilisateur %s est déjà l'utilisateur à l'origine du partage.",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "Le partage de %s a échoué car les permissions dépassent les permissions accordées à %s",
+"Sharing %s failed, because resharing is not allowed" => "Le partage de %s a échoué car le repartage n'est pas autorisé",
+"Sharing %s failed, because the file could not be found in the file cache" => "Le partage de %s a échoué car le fichier n'a pas été trouvé dans les fichiers mis en cache.",
"Could not find category \"%s\"" => "Impossible de trouver la catégorie \"%s\"",
"seconds ago" => "il y a quelques secondes",
"_%n minute ago_::_%n minutes ago_" => array("","il y a %n minutes"),
@@ -66,6 +82,10 @@ $TRANSLATIONS = array(
"last month" => "le mois dernier",
"_%n month ago_::_%n months ago_" => array("","Il y a %n mois"),
"last year" => "l'année dernière",
-"years ago" => "il y a plusieurs années"
+"years ago" => "il y a plusieurs années",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Seuls les caractères suivants sont autorisés dans un nom d'utilisateur : \"a-z\", \"A-Z\", \"0-9\", et \"_.@-\"",
+"A valid username must be provided" => "Un nom d'utilisateur valide doit être saisi",
+"A valid password must be provided" => "Un mot de passe valide doit être saisi",
+"The username is already being used" => "Le nom d'utilisateur est déjà utilisé"
);
$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/lib/l10n/gl.php b/lib/l10n/gl.php
index cc1351c2f15..b8ee5bb4cad 100644
--- a/lib/l10n/gl.php
+++ b/lib/l10n/gl.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"You are accessing the server from an untrusted domain." => "Esta accedendo desde un dominio non fiábel.",
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "Non é posíbel instalar o aplicativo «%s» por non seren compatíbel con esta versión do ownCloud.",
"No app name specified" => "Non se especificou o nome do aplicativo",
"Help" => "Axuda",
@@ -56,16 +57,39 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "O seu servidor web non está aínda configurado adecuadamente para permitir a sincronización de ficheiros xa que semella que a interface WebDAV non está a funcionar.",
"Please double check the <a href='%s'>installation guides</a>." => "Volva comprobar as <a href='%s'>guías de instalación</a>",
"%s shared »%s« with you" => "%s compartiu «%s» con vostede",
+"Sharing %s failed, because the file does not exist" => "Fallou a compartición de %s, o ficheiro non existe",
+"Sharing %s failed, because the user %s is the item owner" => "Fallou a compartición de %s, o propietario do elemento é o usuario %s",
+"Sharing %s failed, because the user %s does not exist" => "Fallou a compartición de %s, o usuario %s non existe",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "Fallou a compartición de %s, o usuario %s non é membro de ningún grupo que sexa membro de %s",
+"Sharing %s failed, because this item is already shared with %s" => "Fallou a compartición de %s, este elemento xa está compartido con %s",
+"Sharing %s failed, because the group %s does not exist" => "Fallou a compartición de %s, o grupo %s non existe",
+"Sharing %s failed, because %s is not a member of the group %s" => "Fallou a compartición de %s, %s non é membro do grupo %s",
+"Sharing %s failed, because sharing with links is not allowed" => "Fallou a compartición de %s, non está permitido compartir con ligazóns",
+"Share type %s is not valid for %s" => "Non se admite a compartición do tipo %s para %s",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Non é posíbel estabelecer permisos para %s, os permisos superan os permisos concedidos a %s",
+"Setting permissions for %s failed, because the item was not found" => "Non é posíbel estabelecer permisos para %s, non se atopa o elemento",
+"Sharing backend %s must implement the interface OCP\\Share_Backend" => "A infraestrutura de compartición %s ten que implementar a interface OCP\\Share_Backend",
+"Sharing backend %s not found" => "Non se atopou a infraestrutura de compartición %s",
+"Sharing backend for %s not found" => "Non se atopou a infraestrutura de compartición para %s",
+"Sharing %s failed, because the user %s is the original sharer" => "Fallou a compartición de %s, compartición orixinal é do usuario %s",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "Fallou a compartición de %s, os permisos superan os permisos concedidos a %s",
+"Sharing %s failed, because resharing is not allowed" => "Fallou a compartición de %s, non está permitido repetir a compartción",
+"Sharing %s failed, because the sharing backend for %s could not find its source" => "Fallou a compartición de %s, a infraestrutura de compartición para %s non foi quen de atopar a orixe",
+"Sharing %s failed, because the file could not be found in the file cache" => "Fallou a compartición de %s, non foi posíbel atopar o ficheiro na caché de ficheiros",
"Could not find category \"%s\"" => "Non foi posíbel atopar a categoría «%s»",
"seconds ago" => "segundos atrás",
"_%n minute ago_::_%n minutes ago_" => array("hai %n minuto","hai %n minutos"),
"_%n hour ago_::_%n hours ago_" => array("hai %n hora","hai %n horas"),
"today" => "hoxe",
"yesterday" => "onte",
-"_%n day go_::_%n days ago_" => array("hai %n día","hai %n días"),
+"_%n day go_::_%n days ago_" => array("hai %n día","vai %n días"),
"last month" => "último mes",
"_%n month ago_::_%n months ago_" => array("hai %n mes","hai %n meses"),
"last year" => "último ano",
-"years ago" => "anos atrás"
+"years ago" => "anos atrás",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Só se permiten os seguintes caracteres no nome de usuario: «a-z», «A-Z», «0-9», e «_.@-»",
+"A valid username must be provided" => "Debe fornecer un nome de usuario",
+"A valid password must be provided" => "Debe fornecer un contrasinal",
+"The username is already being used" => "Este nome de usuario xa está a ser usado"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/he.php b/lib/l10n/he.php
index 6a9020009e9..27267c2e34d 100644
--- a/lib/l10n/he.php
+++ b/lib/l10n/he.php
@@ -29,6 +29,8 @@ $TRANSLATIONS = array(
"last month" => "חודש שעבר",
"_%n month ago_::_%n months ago_" => array("","לפני %n חודשים"),
"last year" => "שנה שעברה",
-"years ago" => "שנים"
+"years ago" => "שנים",
+"A valid username must be provided" => "יש לספק שם משתמש תקני",
+"A valid password must be provided" => "יש לספק ססמה תקנית"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/hu_HU.php b/lib/l10n/hu_HU.php
index 2a03f72a51e..0637773d17c 100644
--- a/lib/l10n/hu_HU.php
+++ b/lib/l10n/hu_HU.php
@@ -60,6 +60,9 @@ $TRANSLATIONS = array(
"last month" => "múlt hónapban",
"_%n month ago_::_%n months ago_" => array("%n hónappal ezelőtt","%n hónappal ezelőtt"),
"last year" => "tavaly",
-"years ago" => "több éve"
+"years ago" => "több éve",
+"A valid username must be provided" => "Érvényes felhasználónevet kell megadnia",
+"A valid password must be provided" => "Érvényes jelszót kell megadnia",
+"The username is already being used" => "Ez a bejelentkezési név már foglalt"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ia.php b/lib/l10n/ia.php
index 34f43bc424a..1fb600d76b4 100644
--- a/lib/l10n/ia.php
+++ b/lib/l10n/ia.php
@@ -5,12 +5,20 @@ $TRANSLATIONS = array(
"Settings" => "Configurationes",
"Users" => "Usatores",
"Admin" => "Administration",
+"Unknown filetype" => "Typo de file incognite",
+"Invalid image" => "Imagine invalide",
"web services under your control" => "servicios web sub tu controlo",
"Files" => "Files",
"Text" => "Texto",
-"_%n minute ago_::_%n minutes ago_" => array("",""),
-"_%n hour ago_::_%n hours ago_" => array("",""),
+"seconds ago" => "secundas passate",
+"_%n minute ago_::_%n minutes ago_" => array("","%n minutas passate"),
+"_%n hour ago_::_%n hours ago_" => array("","%n horas passate"),
+"today" => "hodie",
+"yesterday" => "heri",
"_%n day go_::_%n days ago_" => array("",""),
-"_%n month ago_::_%n months ago_" => array("","")
+"last month" => "ultime mense",
+"_%n month ago_::_%n months ago_" => array("",""),
+"last year" => "ultime anno",
+"years ago" => "annos passate"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/id.php b/lib/l10n/id.php
index 76dda80cf70..d694967cd42 100644
--- a/lib/l10n/id.php
+++ b/lib/l10n/id.php
@@ -60,6 +60,8 @@ $TRANSLATIONS = array(
"last month" => "bulan kemarin",
"_%n month ago_::_%n months ago_" => array("%n bulan yang lalu"),
"last year" => "tahun kemarin",
-"years ago" => "beberapa tahun lalu"
+"years ago" => "beberapa tahun lalu",
+"A valid username must be provided" => "Tuliskan nama pengguna yang valid",
+"A valid password must be provided" => "Tuliskan sandi yang valid"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/it.php b/lib/l10n/it.php
index ed1cbc2e31a..ed97ebbadad 100644
--- a/lib/l10n/it.php
+++ b/lib/l10n/it.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"You are accessing the server from an untrusted domain." => "Stai accedendo al server da un dominio non affidabile.",
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "L'applicazione \"%s\" non può essere installata poiché non è compatibile con questa versione di ownCloud.",
"No app name specified" => "Il nome dell'applicazione non è specificato",
"Help" => "Aiuto",
@@ -56,6 +57,25 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Il tuo server web non è configurato correttamente per consentire la sincronizzazione dei file poiché l'interfaccia WebDAV sembra essere danneggiata.",
"Please double check the <a href='%s'>installation guides</a>." => "Leggi attentamente le <a href='%s'>guide d'installazione</a>.",
"%s shared »%s« with you" => "%s ha condiviso «%s» con te",
+"Sharing %s failed, because the file does not exist" => "Condivisione di %s non riuscita, poiché il file non esiste",
+"Sharing %s failed, because the user %s is the item owner" => "Condivisione di %s non riuscita, poiché l'utente %s è il proprietario dell'oggetto",
+"Sharing %s failed, because the user %s does not exist" => "Condivisione di %s non riuscita, poiché l'utente %s non esiste",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "Condivisione di %s non riuscita, poiché l'utente %s non appartiene ad alcun gruppo di cui %s è membro",
+"Sharing %s failed, because this item is already shared with %s" => "Condivisione di %s non riuscita, poiché l'oggetto è già condiviso con %s",
+"Sharing %s failed, because the group %s does not exist" => "Condivisione di %s non riuscita, poiché il gruppo %s non esiste",
+"Sharing %s failed, because %s is not a member of the group %s" => "Condivisione di %s non riuscita, poiché %s non appartiene al gruppo %s",
+"Sharing %s failed, because sharing with links is not allowed" => "Condivisione di %s non riuscita, poiché i collegamenti non sono consentiti",
+"Share type %s is not valid for %s" => "Il tipo di condivisione %s non è valido per %s",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Impostazione permessi per %s non riuscita, poiché i permessi superano i permessi accordati a %s",
+"Setting permissions for %s failed, because the item was not found" => "Impostazione permessi per %s non riuscita, poiché l'elemento non è stato trovato",
+"Sharing backend %s must implement the interface OCP\\Share_Backend" => "Il motore di condivisione %s deve implementare l'interfaccia OCP\\Share_Backend",
+"Sharing backend %s not found" => "Motore di condivisione %s non trovato",
+"Sharing backend for %s not found" => "Motore di condivisione di %s non trovato",
+"Sharing %s failed, because the user %s is the original sharer" => "Condivisione di %s non riuscita, poiché l'utente %s l'ha condiviso precedentemente",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "Condivisione di %s non riuscita, poiché i permessi superano quelli accordati a %s",
+"Sharing %s failed, because resharing is not allowed" => "Condivisione di %s non riuscita, poiché la ri-condivisione non è consentita",
+"Sharing %s failed, because the sharing backend for %s could not find its source" => "Condivisione di %s non riuscita, poiché il motore di condivisione per %s non riesce a trovare la sua fonte",
+"Sharing %s failed, because the file could not be found in the file cache" => "Condivisione di %s non riuscita, poiché il file non è stato trovato nella cache",
"Could not find category \"%s\"" => "Impossibile trovare la categoria \"%s\"",
"seconds ago" => "secondi fa",
"_%n minute ago_::_%n minutes ago_" => array("%n minuto fa","%n minuti fa"),
@@ -66,6 +86,10 @@ $TRANSLATIONS = array(
"last month" => "mese scorso",
"_%n month ago_::_%n months ago_" => array("%n mese fa","%n mesi fa"),
"last year" => "anno scorso",
-"years ago" => "anni fa"
+"years ago" => "anni fa",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Solo i seguenti caratteri sono ammessi in un nome utente: \"a-z\", \"A-Z\", \"0-9\", e \"_.@-\"",
+"A valid username must be provided" => "Deve essere fornito un nome utente valido",
+"A valid password must be provided" => "Deve essere fornita una password valida",
+"The username is already being used" => "Il nome utente è già utilizzato"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ja.php b/lib/l10n/ja.php
index 015c885904e..6d72836f775 100644
--- a/lib/l10n/ja.php
+++ b/lib/l10n/ja.php
@@ -66,6 +66,9 @@ $TRANSLATIONS = array(
"last month" => "1ヶ月前",
"_%n month ago_::_%n months ago_" => array("%nヶ月前"),
"last year" => "1年前",
-"years ago" => "年前"
+"years ago" => "年前",
+"A valid username must be provided" => "有効なユーザー名を指定する必要があります",
+"A valid password must be provided" => "有効なパスワードを指定する必要があります",
+"The username is already being used" => "ユーザ名はすでに使われています"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/jv.php b/lib/l10n/jv.php
new file mode 100644
index 00000000000..15f78e0bce6
--- /dev/null
+++ b/lib/l10n/jv.php
@@ -0,0 +1,8 @@
+<?php
+$TRANSLATIONS = array(
+"_%n minute ago_::_%n minutes ago_" => array("",""),
+"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ka_GE.php b/lib/l10n/ka_GE.php
index e2a719d0746..f15563c297d 100644
--- a/lib/l10n/ka_GE.php
+++ b/lib/l10n/ka_GE.php
@@ -40,6 +40,8 @@ $TRANSLATIONS = array(
"last month" => "გასულ თვეში",
"_%n month ago_::_%n months ago_" => array(""),
"last year" => "ბოლო წელს",
-"years ago" => "წლის წინ"
+"years ago" => "წლის წინ",
+"A valid username must be provided" => "უნდა მიუთითოთ არსებული მომხმარებლის სახელი",
+"A valid password must be provided" => "უნდა მიუთითოთ არსებული პაროლი"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/km.php b/lib/l10n/km.php
index 51dd4f33a7e..d5fdc025760 100644
--- a/lib/l10n/km.php
+++ b/lib/l10n/km.php
@@ -39,6 +39,8 @@ $TRANSLATIONS = array(
"last month" => "ខែមុន",
"_%n month ago_::_%n months ago_" => array("%n ខែ​មុន"),
"last year" => "ឆ្នាំ​មុន",
-"years ago" => "ឆ្នាំ​មុន"
+"years ago" => "ឆ្នាំ​មុន",
+"A valid username must be provided" => "ត្រូវ​ផ្ដល់​ឈ្មោះ​អ្នក​ប្រើ​ឲ្យ​បាន​ត្រឹម​ត្រូវ",
+"A valid password must be provided" => "ត្រូវ​ផ្ដល់​ពាក្យ​សម្ងាត់​ឲ្យ​បាន​ត្រឹម​ត្រូវ"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/ko.php b/lib/l10n/ko.php
index 833476f6464..2c94ebdcc22 100644
--- a/lib/l10n/ko.php
+++ b/lib/l10n/ko.php
@@ -60,6 +60,8 @@ $TRANSLATIONS = array(
"last month" => "지난 달",
"_%n month ago_::_%n months ago_" => array("%n달 전 "),
"last year" => "작년",
-"years ago" => "년 전"
+"years ago" => "년 전",
+"A valid username must be provided" => "올바른 사용자 이름을 입력해야 함",
+"A valid password must be provided" => "올바른 암호를 입력해야 함"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/lt_LT.php b/lib/l10n/lt_LT.php
index dac8eed7633..88aca7aba46 100644
--- a/lib/l10n/lt_LT.php
+++ b/lib/l10n/lt_LT.php
@@ -60,6 +60,8 @@ $TRANSLATIONS = array(
"last month" => "praeitą mėnesį",
"_%n month ago_::_%n months ago_" => array("Prieš %n mėnesį","Prieš %n mėnesius","Prieš %n mėnesių"),
"last year" => "praeitais metais",
-"years ago" => "prieš metus"
+"years ago" => "prieš metus",
+"A valid username must be provided" => "Vartotojo vardas turi būti tinkamas",
+"A valid password must be provided" => "Slaptažodis turi būti tinkamas"
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/lv.php b/lib/l10n/lv.php
index 5461e077ec9..1c8a31aff2f 100644
--- a/lib/l10n/lv.php
+++ b/lib/l10n/lv.php
@@ -43,6 +43,9 @@ $TRANSLATIONS = array(
"last month" => "pagājušajā mēnesī",
"_%n month ago_::_%n months ago_" => array("","","Pirms %n mēnešiem"),
"last year" => "gājušajā gadā",
-"years ago" => "gadus atpakaļ"
+"years ago" => "gadus atpakaļ",
+"A valid username must be provided" => "Jānorāda derīgs lietotājvārds",
+"A valid password must be provided" => "Jānorāda derīga parole",
+"The username is already being used" => "Šāds lietotājvārds jau tiek izmantots"
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);";
diff --git a/lib/l10n/mk.php b/lib/l10n/mk.php
index deaf1bc8d05..a0b3c39865a 100644
--- a/lib/l10n/mk.php
+++ b/lib/l10n/mk.php
@@ -28,6 +28,8 @@ $TRANSLATIONS = array(
"last month" => "минатиот месец",
"_%n month ago_::_%n months ago_" => array("",""),
"last year" => "минатата година",
-"years ago" => "пред години"
+"years ago" => "пред години",
+"A valid username must be provided" => "Мора да се обезбеди валидно корисничко име ",
+"A valid password must be provided" => "Мора да се обезбеди валидна лозинка"
);
$PLURAL_FORMS = "nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;";
diff --git a/lib/l10n/nb_NO.php b/lib/l10n/nb_NO.php
index 4b41e54ef44..fd9b631f23c 100644
--- a/lib/l10n/nb_NO.php
+++ b/lib/l10n/nb_NO.php
@@ -60,6 +60,8 @@ $TRANSLATIONS = array(
"last month" => "forrige måned",
"_%n month ago_::_%n months ago_" => array("","%n dager siden"),
"last year" => "forrige år",
-"years ago" => "år siden"
+"years ago" => "år siden",
+"A valid username must be provided" => "Oppgi et gyldig brukernavn",
+"A valid password must be provided" => "Oppgi et gyldig passord"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/nl.php b/lib/l10n/nl.php
index dcf893af630..c43703c504e 100644
--- a/lib/l10n/nl.php
+++ b/lib/l10n/nl.php
@@ -66,6 +66,10 @@ $TRANSLATIONS = array(
"last month" => "vorige maand",
"_%n month ago_::_%n months ago_" => array("%n maand geleden","%n maanden geleden"),
"last year" => "vorig jaar",
-"years ago" => "jaar geleden"
+"years ago" => "jaar geleden",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Alleen de volgende tekens zijn toegestaan in een gebruikersnaam: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"",
+"A valid username must be provided" => "Er moet een geldige gebruikersnaam worden opgegeven",
+"A valid password must be provided" => "Er moet een geldig wachtwoord worden opgegeven",
+"The username is already being used" => "De gebruikersnaam bestaat al"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/nn_NO.php b/lib/l10n/nn_NO.php
index db257f35dce..77aebb26ffa 100644
--- a/lib/l10n/nn_NO.php
+++ b/lib/l10n/nn_NO.php
@@ -23,6 +23,8 @@ $TRANSLATIONS = array(
"last month" => "førre månad",
"_%n month ago_::_%n months ago_" => array("","%n månadar sidan"),
"last year" => "i fjor",
-"years ago" => "år sidan"
+"years ago" => "år sidan",
+"A valid username must be provided" => "Du må oppgje eit gyldig brukarnamn",
+"A valid password must be provided" => "Du må oppgje eit gyldig passord"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/or_IN.php b/lib/l10n/or_IN.php
new file mode 100644
index 00000000000..15f78e0bce6
--- /dev/null
+++ b/lib/l10n/or_IN.php
@@ -0,0 +1,8 @@
+<?php
+$TRANSLATIONS = array(
+"_%n minute ago_::_%n minutes ago_" => array("",""),
+"_%n hour ago_::_%n hours ago_" => array("",""),
+"_%n day go_::_%n days ago_" => array("",""),
+"_%n month ago_::_%n months ago_" => array("","")
+);
+$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/pl.php b/lib/l10n/pl.php
index bc5e4a947c7..66af696900e 100644
--- a/lib/l10n/pl.php
+++ b/lib/l10n/pl.php
@@ -56,6 +56,24 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Serwer internetowy nie jest jeszcze poprawnie skonfigurowany, aby umożliwić synchronizację plików, ponieważ interfejs WebDAV wydaje się być uszkodzony.",
"Please double check the <a href='%s'>installation guides</a>." => "Sprawdź ponownie <a href='%s'>przewodniki instalacji</a>.",
"%s shared »%s« with you" => "%s Współdzielone »%s« z tobą",
+"Sharing %s failed, because the user %s is the item owner" => "Współdzielenie %s nie powiodło się, ponieważ użytkownik %s jest właścicielem elementu",
+"Sharing %s failed, because the user %s does not exist" => "Współdzielenie %s nie powiodło się, ponieważ użytkownik %s nie istnieje",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "Współdzielenie %s nie powiodło się, ponieważ użytkownik %s nie jest członkiem żadnej grupy której członkiem jest %s",
+"Sharing %s failed, because this item is already shared with %s" => "Współdzielenie %s nie powiodło się, ponieważ element jest już współdzielony z %s",
+"Sharing %s failed, because the group %s does not exist" => "Współdzielenie %s nie powiodło się, ponieważ grupa %s nie istnieje",
+"Sharing %s failed, because %s is not a member of the group %s" => "Współdzielenie %s nie powiodło się, ponieważ %s nie jest członkiem grupy %s",
+"Sharing %s failed, because sharing with links is not allowed" => "Współdzielenie %s nie powiodło się, ponieważ współdzielenie z linkami nie jest dozwolone",
+"Share type %s is not valid for %s" => "Typ udziału %s nie jest właściwy dla %s",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Ustawienie uprawnień dla %s nie powiodło się, ponieważ uprawnienia wykraczają poza przydzielone %s",
+"Setting permissions for %s failed, because the item was not found" => "Ustawienie uprawnień dla %s nie powiodło się, ponieważ element nie został znaleziony",
+"Sharing backend %s must implement the interface OCP\\Share_Backend" => "Zaplecze do współdzielenia %s musi implementować interfejs OCP\\Share_Backend",
+"Sharing backend %s not found" => "Zaplecze %s do współdzielenia nie zostało znalezione",
+"Sharing backend for %s not found" => "Zaplecze do współdzielenia %s nie zostało znalezione",
+"Sharing %s failed, because the user %s is the original sharer" => "Współdzielenie %s nie powiodło się, ponieważ użytkownik %s jest udostępniającym",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "Współdzielenie %s nie powiodło się, ponieważ uprawnienia przekraczają te udzielone %s",
+"Sharing %s failed, because resharing is not allowed" => "Współdzielenie %s nie powiodło się, ponieważ ponowne współdzielenie nie jest dozwolone",
+"Sharing %s failed, because the sharing backend for %s could not find its source" => "Współdzielenie %s nie powiodło się, ponieważ zaplecze współdzielenia dla %s nie mogło znaleźć jego źródła",
+"Sharing %s failed, because the file could not be found in the file cache" => "Współdzielenie %s nie powiodło się, ponieważ plik nie może zostać odnaleziony w buforze plików",
"Could not find category \"%s\"" => "Nie można odnaleźć kategorii \"%s\"",
"seconds ago" => "sekund temu",
"_%n minute ago_::_%n minutes ago_" => array("%n minute temu","%n minut temu","%n minut temu"),
@@ -66,6 +84,10 @@ $TRANSLATIONS = array(
"last month" => "w zeszłym miesiącu",
"_%n month ago_::_%n months ago_" => array("%n miesiąc temu","%n miesięcy temu","%n miesięcy temu"),
"last year" => "w zeszłym roku",
-"years ago" => "lat temu"
+"years ago" => "lat temu",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "W nazwach użytkowników dozwolone są wyłącznie następujące znaki: \"a-z\", \"A-Z\", \"0-9\", oraz \"_.@-\"",
+"A valid username must be provided" => "Należy podać prawidłową nazwę użytkownika",
+"A valid password must be provided" => "Należy podać prawidłowe hasło",
+"The username is already being used" => "Ta nazwa użytkownika jest już używana"
);
$PLURAL_FORMS = "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/pt_BR.php b/lib/l10n/pt_BR.php
index 6c8ea586de8..4f1525ccd41 100644
--- a/lib/l10n/pt_BR.php
+++ b/lib/l10n/pt_BR.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"You are accessing the server from an untrusted domain." => "Você está acessando o servidor a partir de um domínio não confiável.",
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "O aplicativo \"%s\" não pode ser instalado porque não é compatível com esta versão do ownCloud.",
"No app name specified" => "O nome do aplicativo não foi especificado.",
"Help" => "Ajuda",
@@ -56,6 +57,25 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Seu servidor web não está configurado corretamente para permitir sincronização de arquivos porque a interface WebDAV parece estar quebrada.",
"Please double check the <a href='%s'>installation guides</a>." => "Por favor, confira os <a href='%s'>guias de instalação</a>.",
"%s shared »%s« with you" => "%s compartilhou »%s« com você",
+"Sharing %s failed, because the file does not exist" => "Compartilhamento %s falhou, porque o arquivo não existe",
+"Sharing %s failed, because the user %s is the item owner" => "Compartilhamento %s falhou, porque o usuário %s é o proprietário do item",
+"Sharing %s failed, because the user %s does not exist" => "Compartilhamento %s falhou, porque o usuário %s não existe",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "Compartilhamento %s falhou, porque o usuário %s não é membro de nenhum grupo que o usuário %s pertença",
+"Sharing %s failed, because this item is already shared with %s" => "Compartilhamento %s falhou, porque este ítem já está compartilhado com %s",
+"Sharing %s failed, because the group %s does not exist" => "Compartilhamento %s falhou, porque o grupo %s não existe",
+"Sharing %s failed, because %s is not a member of the group %s" => "Compartilhamento %s falhou, porque %s não é membro do grupo %s",
+"Sharing %s failed, because sharing with links is not allowed" => "Compartilhamento %s falhou, porque compartilhamento com links não é permitido",
+"Share type %s is not valid for %s" => "Tipo de compartilhamento %s não é válido para %s",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Definir permissões para %s falhou, porque as permissões excedem as permissões concedidas a %s",
+"Setting permissions for %s failed, because the item was not found" => "Definir permissões para %s falhou, porque o item não foi encontrado",
+"Sharing backend %s must implement the interface OCP\\Share_Backend" => "Compartilhando backend %s deve implementar a interface OCP\\Share_Backend",
+"Sharing backend %s not found" => "Compartilhamento backend %s não encontrado",
+"Sharing backend for %s not found" => "Compartilhamento backend para %s não encontrado",
+"Sharing %s failed, because the user %s is the original sharer" => "Compartilhando %s falhou, porque o usuário %s é o compartilhador original",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "Compartilhamento %s falhou, porque as permissões excedem as permissões concedidas a %s",
+"Sharing %s failed, because resharing is not allowed" => "Compartilhamento %s falhou, porque recompartilhamentos não são permitidos",
+"Sharing %s failed, because the sharing backend for %s could not find its source" => "Compartilhamento %s falhou, porque a infra-estrutura de compartilhamento para %s não conseguiu encontrar a sua fonte",
+"Sharing %s failed, because the file could not be found in the file cache" => "Compartilhamento %s falhou, porque o arquivo não pôde ser encontrado no cache de arquivos",
"Could not find category \"%s\"" => "Impossível localizar categoria \"%s\"",
"seconds ago" => "segundos atrás",
"_%n minute ago_::_%n minutes ago_" => array("","ha %n minutos"),
@@ -66,6 +86,10 @@ $TRANSLATIONS = array(
"last month" => "último mês",
"_%n month ago_::_%n months ago_" => array("","ha %n meses"),
"last year" => "último ano",
-"years ago" => "anos atrás"
+"years ago" => "anos atrás",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Somente os seguintes caracteres são permitidos no nome do usuário: \"a-z\", \"A-Z\", \"0-9\", e \"_.@-\"",
+"A valid username must be provided" => "Forneça um nome de usuário válido",
+"A valid password must be provided" => "Forneça uma senha válida",
+"The username is already being used" => "Este nome de usuário já está sendo usado"
);
$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php
index e6dd459a7e1..8b3c003678d 100644
--- a/lib/l10n/pt_PT.php
+++ b/lib/l10n/pt_PT.php
@@ -61,6 +61,8 @@ $TRANSLATIONS = array(
"last month" => "ultímo mês",
"_%n month ago_::_%n months ago_" => array("","%n meses atrás"),
"last year" => "ano passado",
-"years ago" => "anos atrás"
+"years ago" => "anos atrás",
+"A valid username must be provided" => "Um nome de utilizador válido deve ser fornecido",
+"A valid password must be provided" => "Uma password válida deve ser fornecida"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/ro.php b/lib/l10n/ro.php
index 6bff105a61f..87e9a92c464 100644
--- a/lib/l10n/ro.php
+++ b/lib/l10n/ro.php
@@ -31,6 +31,8 @@ $TRANSLATIONS = array(
"last month" => "ultima lună",
"_%n month ago_::_%n months ago_" => array("","",""),
"last year" => "ultimul an",
-"years ago" => "ani în urmă"
+"years ago" => "ani în urmă",
+"A valid username must be provided" => "Trebuie să furnizaţi un nume de utilizator valid",
+"A valid password must be provided" => "Trebuie să furnizaţi o parolă validă"
);
$PLURAL_FORMS = "nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));";
diff --git a/lib/l10n/ru.php b/lib/l10n/ru.php
index 214849721da..2611fcf7a6b 100644
--- a/lib/l10n/ru.php
+++ b/lib/l10n/ru.php
@@ -60,6 +60,8 @@ $TRANSLATIONS = array(
"last month" => "в прошлом месяце",
"_%n month ago_::_%n months ago_" => array("%n месяц назад","%n месяца назад","%n месяцев назад"),
"last year" => "в прошлом году",
-"years ago" => "несколько лет назад"
+"years ago" => "несколько лет назад",
+"A valid username must be provided" => "Укажите правильное имя пользователя",
+"A valid password must be provided" => "Укажите валидный пароль"
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/sk_SK.php b/lib/l10n/sk_SK.php
index 424f0f5bd8c..6e3a48a74fb 100644
--- a/lib/l10n/sk_SK.php
+++ b/lib/l10n/sk_SK.php
@@ -40,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "V názve databázy %s nemôžete používať bodky",
"MS SQL username and/or password not valid: %s" => "Používateľské meno, alebo heslo MS SQL nie je platné: %s",
"You need to enter either an existing account or the administrator." => "Musíte zadať jestvujúci účet alebo administrátora.",
+"MySQL/MariaDB username and/or password not valid" => "Používateľské meno a/alebo heslo pre MySQL/MariaDB databázu je neplatné",
"DB Error: \"%s\"" => "Chyba DB: \"%s\"",
"Offending command was: \"%s\"" => "Podozrivý príkaz bol: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "Používateľ '%s'@'localhost' už v MySQL/MariaDB existuje.",
+"Drop this user from MySQL/MariaDB" => "Zahodiť používateľa z MySQL/MariaDB.",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "Používateľ '%s'@'%%' už v MySQL/MariaDB existuje",
+"Drop this user from MySQL/MariaDB." => "Zahodiť používateľa z MySQL/MariaDB.",
"Oracle connection could not be established" => "Nie je možné pripojiť sa k Oracle",
"Oracle username and/or password not valid" => "Používateľské meno a/alebo heslo pre Oracle databázu je neplatné",
"Offending command was: \"%s\", name: %s, password: %s" => "Podozrivý príkaz bol: \"%s\", meno: %s, heslo: %s",
@@ -51,6 +56,16 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Váš webový server nie je správne nastavený na synchronizáciu, pretože rozhranie WebDAV je poškodené.",
"Please double check the <a href='%s'>installation guides</a>." => "Prosím skontrolujte <a href='%s'>inštalačnú príručku</a>.",
"%s shared »%s« with you" => "%s s vami zdieľa »%s«",
+"Sharing %s failed, because the file does not exist" => "Zdieľanie %s zlyhalo, pretože súbor neexistuje",
+"Sharing %s failed, because the user %s is the item owner" => "Zdieľanie %s zlyhalo, pretože používateľ %s je vlastníkom položky",
+"Sharing %s failed, because the user %s does not exist" => "Zdieľanie %s zlyhalo, pretože používateľ %s neexistuje",
+"Sharing %s failed, because this item is already shared with %s" => "Zdieľanie %s zlyhalo, pretože táto položka už je zdieľaná s %s",
+"Sharing %s failed, because the group %s does not exist" => "Zdieľanie %s zlyhalo, pretože skupina %s neexistuje",
+"Sharing %s failed, because %s is not a member of the group %s" => "Zdieľanie %s zlyhalo, pretože %s nie je členom skupiny %s",
+"Sharing %s failed, because sharing with links is not allowed" => "Zdieľanie %s zlyhalo, pretože zdieľanie odkazom nie je povolené",
+"Share type %s is not valid for %s" => "Typ zdieľania %s nie je platný pre %s",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Nastavenie povolení pre %s zlyhalo, pretože povolenia prekračujú povolenia udelené %s",
+"Setting permissions for %s failed, because the item was not found" => "Nastavenie povolení pre %s zlyhalo, pretože položka sa nenašla",
"Could not find category \"%s\"" => "Nemožno nájsť danú kategóriu \"%s\"",
"seconds ago" => "pred sekundami",
"_%n minute ago_::_%n minutes ago_" => array("pred %n minútou","pred %n minútami","pred %n minútami"),
@@ -61,6 +76,10 @@ $TRANSLATIONS = array(
"last month" => "minulý mesiac",
"_%n month ago_::_%n months ago_" => array("pred %n mesiacom","pred %n mesiacmi","pred %n mesiacmi"),
"last year" => "minulý rok",
-"years ago" => "pred rokmi"
+"years ago" => "pred rokmi",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "V mene používateľa sú povolené len nasledovné znaky: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"",
+"A valid username must be provided" => "Musíte zadať platné používateľské meno",
+"A valid password must be provided" => "Musíte zadať platné heslo",
+"The username is already being used" => "Meno používateľa je už použité"
);
$PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;";
diff --git a/lib/l10n/sl.php b/lib/l10n/sl.php
index 411a14370ee..eeaa0ddf96b 100644
--- a/lib/l10n/sl.php
+++ b/lib/l10n/sl.php
@@ -56,6 +56,16 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Spletni stražnik še ni ustrezno nastavljen in ne omogoča usklajevanja, saj je nastavitev WebDAV okvarjena.",
"Please double check the <a href='%s'>installation guides</a>." => "Preverite <a href='%s'>navodila namestitve</a>.",
"%s shared »%s« with you" => "%s je omogočil souporabo »%s«",
+"Sharing %s failed, because the user %s is the item owner" => "Nastavljanje souporabe %s je spodletelo, ker je uporabnik %s lastnik predmeta.",
+"Sharing %s failed, because the user %s does not exist" => "Nastavljanje souporabe %s je spodletelo, ker uporabnik %s ne obstaja.",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "Nastavljanje souporabe %s je spodletelo, ker uporabnik %s ni član nobene skupine, v kateri je tudi uporabnik %s.",
+"Sharing %s failed, because this item is already shared with %s" => "Nastavljanje souporabe %s je spodletela, ker je ima uporabnik %s predmet že v souporabi.",
+"Sharing %s failed, because the group %s does not exist" => "Nastavljanje souporabe %s je spodletelo, ker je skupina %s ne obstaja.",
+"Sharing %s failed, because %s is not a member of the group %s" => "Nastavljanje souporabe %s je spodletelo, ker uporabnik %s ni član skupine %s.",
+"Sharing %s failed, because sharing with links is not allowed" => "Nastavljanje souporabe %s je spodletelo, ker souporaba preko povezave ni dovoljena.",
+"Share type %s is not valid for %s" => "Vrsta souporabe %s za %s ni veljavna.",
+"Sharing backend %s not found" => "Ozadnjega programa %s za souporabo ni mogoče najti",
+"Sharing backend for %s not found" => "Ozadnjega programa za souporabo za %s ni mogoče najti",
"Could not find category \"%s\"" => "Kategorije \"%s\" ni mogoče najti.",
"seconds ago" => "pred nekaj sekundami",
"_%n minute ago_::_%n minutes ago_" => array("pred %n minuto","pred %n minutama","pred %n minutami","pred %n minutami"),
@@ -66,6 +76,10 @@ $TRANSLATIONS = array(
"last month" => "zadnji mesec",
"_%n month ago_::_%n months ago_" => array("pred %n mesecem","pred %n mesecema","pred %n meseci","pred %n meseci"),
"last year" => "lansko leto",
-"years ago" => "let nazaj"
+"years ago" => "let nazaj",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "V uporabniškem imenu je dovoljeno uporabiti le znake: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"",
+"A valid username must be provided" => "Navedeno mora biti veljavno uporabniško ime",
+"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"
);
$PLURAL_FORMS = "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);";
diff --git a/lib/l10n/sq.php b/lib/l10n/sq.php
index b22663f76df..e29fa2cee53 100644
--- a/lib/l10n/sq.php
+++ b/lib/l10n/sq.php
@@ -41,6 +41,8 @@ $TRANSLATIONS = array(
"last month" => "muajin e shkuar",
"_%n month ago_::_%n months ago_" => array("","%n muaj më parë"),
"last year" => "vitin e shkuar",
-"years ago" => "vite më parë"
+"years ago" => "vite më parë",
+"A valid username must be provided" => "Duhet të jepni një emër të vlefshëm përdoruesi",
+"A valid password must be provided" => "Duhet të jepni një fjalëkalim te vlefshëm"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/sr.php b/lib/l10n/sr.php
index 47a84803683..f9155bfd575 100644
--- a/lib/l10n/sr.php
+++ b/lib/l10n/sr.php
@@ -28,6 +28,8 @@ $TRANSLATIONS = array(
"last month" => "прошлог месеца",
"_%n month ago_::_%n months ago_" => array("","",""),
"last year" => "прошле године",
-"years ago" => "година раније"
+"years ago" => "година раније",
+"A valid username must be provided" => "Морате унети исправно корисничко име",
+"A valid password must be provided" => "Морате унети исправну лозинку"
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/sv.php b/lib/l10n/sv.php
index a1f371210ac..ba63531ad76 100644
--- a/lib/l10n/sv.php
+++ b/lib/l10n/sv.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "Applikationen är inte aktiverad",
"Authentication error" => "Fel vid autentisering",
"Token expired. Please reload page." => "Ogiltig token. Ladda om sidan.",
+"Unknown user" => "Okänd användare",
"Files" => "Filer",
"Text" => "Text",
"Images" => "Bilder",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s du får inte använda punkter i databasnamnet",
"MS SQL username and/or password not valid: %s" => "MS SQL-användaren och/eller lösenordet var inte giltigt: %s",
"You need to enter either an existing account or the administrator." => "Du måste antingen ange ett befintligt konto eller administratör.",
+"MySQL/MariaDB username and/or password not valid" => "MySQL/MariaDB användarnamn och/eller lösenord är felaktigt",
"DB Error: \"%s\"" => "DB error: \"%s\"",
"Offending command was: \"%s\"" => "Det felaktiga kommandot var: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "MySQL/MariaDB användare '%s'@'localhost' existerar redan.",
+"Drop this user from MySQL/MariaDB" => "Radera denna användare från MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "MySQL/MariaDB användare '%s'@'%%' existerar redan",
+"Drop this user from MySQL/MariaDB." => "Radera denna användare från MySQL/MariaDB.",
"Oracle connection could not be established" => "Oracle-anslutning kunde inte etableras",
"Oracle username and/or password not valid" => "Oracle-användarnamnet och/eller lösenordet är felaktigt",
"Offending command was: \"%s\", name: %s, password: %s" => "Det felande kommandot var: \"%s\", name: %s, password: %s",
@@ -50,6 +56,24 @@ $TRANSLATIONS = array(
"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Din webbserver är inte korrekt konfigurerad för att tillåta filsynkronisering eftersom WebDAV inte verkar fungera.",
"Please double check the <a href='%s'>installation guides</a>." => "Var god kontrollera <a href='%s'>installationsguiden</a>.",
"%s shared »%s« with you" => "%s delade »%s« med dig",
+"Sharing %s failed, because the user %s is the item owner" => "Delning %s misslyckades därför att användaren %s är den som äger objektet",
+"Sharing %s failed, because the user %s does not exist" => "Delning %s misslyckades därför att användaren %s inte existerar",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "Delning %s misslyckades därför att användaren %s inte är medlem i någon utav de grupper som %s är medlem i",
+"Sharing %s failed, because this item is already shared with %s" => "Delning %s misslyckades därför att objektet redan är delat med %s",
+"Sharing %s failed, because the group %s does not exist" => "Delning %s misslyckades därför att gruppen %s inte existerar",
+"Sharing %s failed, because %s is not a member of the group %s" => "Delning %s misslyckades därför att %s inte ingår i gruppen %s",
+"Sharing %s failed, because sharing with links is not allowed" => "Delning %s misslyckades därför att delning utav länkar inte är tillåtet",
+"Share type %s is not valid for %s" => "Delningstyp %s är inte giltig för %s",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "Misslyckades att sätta rättigheter för %s därför att rättigheterna överskrider de som är tillåtna för %s",
+"Setting permissions for %s failed, because the item was not found" => "Att sätta rättigheterna för %s misslyckades därför att objektet inte hittades",
+"Sharing backend %s must implement the interface OCP\\Share_Backend" => "Delningsgränssnittet %s måste implementera gränssnittet OCP\\Share_Backend",
+"Sharing backend %s not found" => "Delningsgränssnittet %s hittades inte",
+"Sharing backend for %s not found" => "Delningsgränssnittet för %s hittades inte",
+"Sharing %s failed, because the user %s is the original sharer" => "Delning %s misslyckades därför att användaren %s är den som delade objektet först",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "Delning %s misslyckades därför att rättigheterna överskrider de rättigheter som är tillåtna för %s",
+"Sharing %s failed, because resharing is not allowed" => "Delning %s misslyckades därför att vidaredelning inte är tillåten",
+"Sharing %s failed, because the sharing backend for %s could not find its source" => "Delning %s misslyckades därför att delningsgränsnittet för %s inte kunde hitta sin källa",
+"Sharing %s failed, because the file could not be found in the file cache" => "Delning %s misslyckades därför att filen inte kunde hittas i filcachen",
"Could not find category \"%s\"" => "Kunde inte hitta kategorin \"%s\"",
"seconds ago" => "sekunder sedan",
"_%n minute ago_::_%n minutes ago_" => array("%n minut sedan","%n minuter sedan"),
@@ -60,6 +84,10 @@ $TRANSLATIONS = array(
"last month" => "förra månaden",
"_%n month ago_::_%n months ago_" => array("%n månad sedan","%n månader sedan"),
"last year" => "förra året",
-"years ago" => "år sedan"
+"years ago" => "år sedan",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Endast följande tecken är tillåtna i ett användarnamn: \"az\", \"AZ\", \"0-9\", och \"_ @ -.\"",
+"A valid username must be provided" => "Ett giltigt användarnamn måste anges",
+"A valid password must be provided" => "Ett giltigt lösenord måste anges",
+"The username is already being used" => "Användarnamnet används redan"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/lib/l10n/tr.php b/lib/l10n/tr.php
index 0473c2232d4..a687d132ae1 100644
--- a/lib/l10n/tr.php
+++ b/lib/l10n/tr.php
@@ -1,7 +1,8 @@
<?php
$TRANSLATIONS = array(
+"You are accessing the server from an untrusted domain." => "Sunucuya güvenilmeyen bir alan adından ulaşıyorsunuz.",
"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => "ownCloud yazılımının bu sürümü ile uyumlu olmadığı için \"%s\" uygulaması kurulamaz.",
-"No app name specified" => "Uygulama adı belirtimedli",
+"No app name specified" => "Uygulama adı belirtilmedi",
"Help" => "Yardım",
"Personal" => "Kişisel",
"Settings" => "Ayarlar",
@@ -12,8 +13,8 @@ $TRANSLATIONS = array(
"Invalid image" => "Geçersiz resim",
"web services under your control" => "kontrolünüzün altındaki web hizmetleri",
"ZIP download is turned off." => "ZIP indirmeleri kapatıldı.",
-"Files need to be downloaded one by one." => "Dosyaların birer birer indirilmesi gerekmektedir.",
-"Back to Files" => "Dosyalara dön",
+"Files need to be downloaded one by one." => "Dosyaların tek tek indirilmesi gerekmektedir.",
+"Back to Files" => "Dosyalara Dön",
"Selected files too large to generate zip file." => "Seçilen dosyalar bir zip dosyası oluşturmak için fazla büyük.",
"Please download the files separately in smaller chunks or kindly ask your administrator." => "Dosyaları ayrı ayrı, küçük parçalar halinde indirin veya yöneticinizden yardım isteyin. ",
"No source specified when installing app" => "Uygulama kurulurken bir kaynak belirtilmedi",
@@ -39,25 +40,44 @@ $TRANSLATIONS = array(
"%s enter the database name." => "%s veritabanı adını girin.",
"%s you may not use dots in the database name" => "%s veritabanı adında nokta kullanamayabilirsiniz",
"MS SQL username and/or password not valid: %s" => "MS SQL kullanıcı adı ve/veya parolası geçersiz: %s",
-"You need to enter either an existing account or the administrator." => "Bir konto veya kullanici birlemek ihtiyacin. ",
+"You need to enter either an existing account or the administrator." => "Mevcut bit hesap ya da yönetici hesabını girmelisiniz.",
"MySQL/MariaDB username and/or password not valid" => "MySQL/MariaDB kullanıcı adı ve/veya parolası geçersiz",
-"DB Error: \"%s\"" => "DB Hata: ''%s''",
-"Offending command was: \"%s\"" => "Komut rahasiz ''%s''. ",
+"DB Error: \"%s\"" => "VT Hatası: \"%s\"",
+"Offending command was: \"%s\"" => "Saldırgan komut: \"%s\"",
"MySQL/MariaDB user '%s'@'localhost' exists already." => "MySQL/MariaDB kullanıcı '%s'@'localhost' zaten mevcut.",
"Drop this user from MySQL/MariaDB" => "Bu kullanıcıyı MySQL/MariaDB'dan at (drop)",
"MySQL/MariaDB user '%s'@'%%' already exists" => "MySQL/MariaDB kullanıcısı '%s'@'%%' zaten mevcut",
-"Drop this user from MySQL/MariaDB." => "Bu kullanıcıyı MySQL/MariaDB'dan at (drop)",
+"Drop this user from MySQL/MariaDB." => "Bu kullanıcıyı MySQL/MariaDB'dan at (drop).",
"Oracle connection could not be established" => "Oracle bağlantısı kurulamadı",
-"Oracle username and/or password not valid" => "Adi klullanici ve/veya parola Oracle mantikli değildir. ",
+"Oracle username and/or password not valid" => "Oracle kullanıcı adı ve/veya parolası geçerli değil",
"Offending command was: \"%s\", name: %s, password: %s" => "Hatalı komut: \"%s\", ad: %s, parola: %s",
-"PostgreSQL username and/or password not valid" => "PostgreSQL adi kullanici ve/veya parola yasal degildir. ",
-"Set an admin username." => "Bir adi kullanici vermek. ",
-"Set an admin password." => "Parola yonetici birlemek. ",
-"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Web sunucunuz dosya aktarımı için düzgün bir şekilde yapılandırılmamış. WevDAV arayüzü sorunlu görünüyor.",
+"PostgreSQL username and/or password not valid" => "PostgreSQL kullanıcı adı ve/veya parolası geçerli değil",
+"Set an admin username." => "Bir yönetici kullanıcı adı ayarlayın.",
+"Set an admin password." => "Bir yönetici kullanıcı parolası ayarlayın.",
+"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Web sunucunuz dosya eşitlemesine izin vermek üzere düzgün bir şekilde yapılandırılmamış. WebDAV arayüzü sorunlu görünüyor.",
"Please double check the <a href='%s'>installation guides</a>." => "Lütfen <a href='%s'>kurulum kılavuzlarını</a> iki kez kontrol edin.",
"%s shared »%s« with you" => "%s sizinle »%s« paylaşımında bulundu",
+"Sharing %s failed, because the file does not exist" => "%s paylaşımı, dosya mevcut olmadığından başarısız oldu",
+"Sharing %s failed, because the user %s is the item owner" => "%s paylaşımı, %s öge sahibi olduğundan başarısız oldu",
+"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",
+"Sharing %s failed, because the group %s does not exist" => "%s paylaşımı, %s grubu mevcut olmadığından başarısız oldu",
+"Sharing %s failed, because %s is not a member of the group %s" => "%s paylaşımı, %s kullanıcısı %s grup üyesi olmadığından başarısız oldu",
+"Sharing %s failed, because sharing with links is not allowed" => "%s paylaşımı, bağlantılar ile paylaşım izin verilmediğinden başarısız oldu",
+"Share type %s is not valid for %s" => "%s paylaşım türü %s için geçerli değil",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "%s için izinler, izinler %s için verilen izinleri aştığından dolayı ayarlanamadı",
+"Setting permissions for %s failed, because the item was not found" => "%s için izinler öge bulunamadığından ayarlanamadı",
+"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 %s failed, because the user %s is the original sharer" => "%s paylaşımı, %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",
+"Sharing %s failed, because the file could not be found in the file cache" => "%s paylaşımı, dosyanın dosya önbelleğinde bulunamamasınndan dolayı başarısız oldu",
"Could not find category \"%s\"" => "\"%s\" kategorisi bulunamadı",
-"seconds ago" => "saniye önce",
+"seconds ago" => "saniyeler önce",
"_%n minute ago_::_%n minutes ago_" => array("","%n dakika önce"),
"_%n hour ago_::_%n hours ago_" => array("","%n saat önce"),
"today" => "bugün",
@@ -66,6 +86,10 @@ $TRANSLATIONS = array(
"last month" => "geçen ay",
"_%n month ago_::_%n months ago_" => array("","%n ay önce"),
"last year" => "geçen yıl",
-"years ago" => "yıl önce"
+"years ago" => "yıllar önce",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "Kullanıcı adında sadece bu karakterlere izin verilmektedir: \"a-z\", \"A-Z\", \"0-9\", ve \"_.@-\"",
+"A valid username must be provided" => "Geçerli bir kullanıcı adı mutlaka sağlanmalı",
+"A valid password must be provided" => "Geçerli bir parola mutlaka sağlanmalı",
+"The username is already being used" => "Bu kullanıcı adı zaten kullanımda"
);
$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
diff --git a/lib/l10n/ug.php b/lib/l10n/ug.php
index e2cf38ecc8c..8cfa99732ab 100644
--- a/lib/l10n/ug.php
+++ b/lib/l10n/ug.php
@@ -14,6 +14,8 @@ $TRANSLATIONS = array(
"today" => "بۈگۈن",
"yesterday" => "تۈنۈگۈن",
"_%n day go_::_%n days ago_" => array(""),
-"_%n month ago_::_%n months ago_" => array("")
+"_%n month ago_::_%n months ago_" => array(""),
+"A valid username must be provided" => "چوقۇم ئىناۋەتلىك ئىشلەتكۈچى ئىسمىدىن بىرنى تەمىنلەش كېرەك",
+"A valid password must be provided" => "چوقۇم ئىناۋەتلىك ئىم تەمىنلەش كېرەك"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/uk.php b/lib/l10n/uk.php
index 94163f0b6f5..fed6277fdd8 100644
--- a/lib/l10n/uk.php
+++ b/lib/l10n/uk.php
@@ -43,6 +43,8 @@ $TRANSLATIONS = array(
"last month" => "минулого місяця",
"_%n month ago_::_%n months ago_" => array("","","%n місяців тому"),
"last year" => "минулого року",
-"years ago" => "роки тому"
+"years ago" => "роки тому",
+"A valid username must be provided" => "Потрібно задати вірне ім'я користувача",
+"A valid password must be provided" => "Потрібно задати вірний пароль"
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/lib/l10n/zh_CN.php b/lib/l10n/zh_CN.php
index 684ee17f98e..8fca52f3dbd 100644
--- a/lib/l10n/zh_CN.php
+++ b/lib/l10n/zh_CN.php
@@ -48,6 +48,8 @@ $TRANSLATIONS = array(
"last month" => "上月",
"_%n month ago_::_%n months ago_" => array("%n 月前"),
"last year" => "去年",
-"years ago" => "年前"
+"years ago" => "年前",
+"A valid username must be provided" => "必须提供合法的用户名",
+"A valid password must be provided" => "必须提供合法的密码"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/zh_TW.php b/lib/l10n/zh_TW.php
index 1fbae6e2355..83616cf6a42 100644
--- a/lib/l10n/zh_TW.php
+++ b/lib/l10n/zh_TW.php
@@ -60,6 +60,8 @@ $TRANSLATIONS = array(
"last month" => "上個月",
"_%n month ago_::_%n months ago_" => array("%n 個月前"),
"last year" => "去年",
-"years ago" => "幾年前"
+"years ago" => "幾年前",
+"A valid username must be provided" => "必須提供一個有效的用戶名",
+"A valid password must be provided" => "一定要提供一個有效的密碼"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/private/activitymanager.php b/lib/private/activitymanager.php
index 685809581ac..66aa039eb18 100755
--- a/lib/private/activitymanager.php
+++ b/lib/private/activitymanager.php
@@ -46,7 +46,7 @@ class ActivityManager implements IManager {
$type,
$priority);
} catch (\Exception $ex) {
- // TODO: log the excepetion
+ // TODO: log the exception
}
}
diff --git a/lib/private/api.php b/lib/private/api.php
index b3b5eb1067b..74887690952 100644
--- a/lib/private/api.php
+++ b/lib/private/api.php
@@ -127,9 +127,9 @@ class OC_API {
/**
* merge the returned result objects into one response
* @param array $responses
+ * @return array|\OC_OCS_Result
*/
public static function mergeResponses($responses) {
- $response = array();
// Sort into shipped and thirdparty
$shipped = array(
'succeeded' => array(),
@@ -191,7 +191,7 @@ class OC_API {
// Merge the successful responses
$data = array();
- foreach($responses as $app => $response) {
+ foreach($responses as $response) {
if($response['shipped']) {
$data = array_merge_recursive($response['response']->getData(), $data);
} else {
diff --git a/lib/private/app.php b/lib/private/app.php
index 58bf67c1d47..2f55b54b328 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -459,9 +459,11 @@ class OC_App{
return false;
}
/**
- * Get the directory for the given app.
- * If the app is defined in multiple directories, the first one is taken. (false if not found)
- */
+ * Get the directory for the given app.
+ * If the app is defined in multiple directories, the first one is taken. (false if not found)
+ * @param string $appid
+ * @return string|false
+ */
public static function getAppPath($appid) {
if( ($dir = self::findAppInDirectories($appid)) != false) {
return $dir['path'].'/'.$appid;
@@ -470,9 +472,11 @@ class OC_App{
}
/**
- * Get the path for the given app on the access
- * If the app is defined in multiple directories, the first one is taken. (false if not found)
- */
+ * Get the path for the given app on the access
+ * If the app is defined in multiple directories, the first one is taken. (false if not found)
+ * @param string $appid
+ * @return string|false
+ */
public static function getAppWebPath($appid) {
if( ($dir = self::findAppInDirectories($appid)) != false) {
return OC::$WEBROOT.$dir['url'].'/'.$appid;
@@ -482,6 +486,7 @@ class OC_App{
/**
* get the last version of the app, either from appinfo/version or from appinfo/info.xml
+ * @param string $appid
* @return string
*/
public static function getAppVersion($appid) {
@@ -563,7 +568,7 @@ class OC_App{
/**
* @brief Returns the navigation
- * @return string
+ * @return array
*
* This function returns an array containing all entries added. The
* entries are sorted by the key 'order' ascending. Additional to the keys
diff --git a/lib/private/appconfig.php b/lib/private/appconfig.php
index cdaaebb87e5..0cd6b3bc35b 100644
--- a/lib/private/appconfig.php
+++ b/lib/private/appconfig.php
@@ -71,6 +71,7 @@ class AppConfig implements \OCP\IAppConfig {
/**
* @param string $app
+ * @return \string[]
*/
private function getAppValues($app) {
$appCache = $this->getAppCache($app);
@@ -147,7 +148,7 @@ class AppConfig implements \OCP\IAppConfig {
*/
public function hasKey($app, $key) {
$values = $this->getAppValues($app);
- return isset($values[$key]);
+ return array_key_exists($key, $values);
}
/**
@@ -218,8 +219,8 @@ class AppConfig implements \OCP\IAppConfig {
/**
* get multiply values, either the app or key can be used as wildcard by setting it to false
*
- * @param boolean $app
- * @param string $key
+ * @param string|false $app
+ * @param string|false $key
* @return array
*/
public function getValues($app, $key) {
diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php
index 4821ecaf67b..e478225a53d 100644
--- a/lib/private/appframework/dependencyinjection/dicontainer.php
+++ b/lib/private/appframework/dependencyinjection/dicontainer.php
@@ -92,13 +92,13 @@ class DIContainer extends SimpleContainer implements IAppContainer{
return new SecurityMiddleware($app, $c['Request']);
});
- $middleWares = $this->middleWares;
- $this['MiddlewareDispatcher'] = $this->share(function($c) use ($middleWares) {
+ $middleWares = &$this->middleWares;
+ $this['MiddlewareDispatcher'] = $this->share(function($c) use (&$middleWares) {
$dispatcher = new MiddlewareDispatcher();
$dispatcher->registerMiddleware($c['SecurityMiddleware']);
foreach($middleWares as $middleWare) {
- $dispatcher->registerMiddleware($middleWare);
+ $dispatcher->registerMiddleware($c[$middleWare]);
}
return $dispatcher;
@@ -133,10 +133,10 @@ class DIContainer extends SimpleContainer implements IAppContainer{
}
/**
- * @param Middleware $middleWare
+ * @param string $middleWare
* @return boolean|null
*/
- function registerMiddleWare(Middleware $middleWare) {
+ function registerMiddleWare($middleWare) {
array_push($this->middleWares, $middleWare);
}
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php
index 40f47a7bd2f..643fa685adc 100644
--- a/lib/private/appframework/http/request.php
+++ b/lib/private/appframework/http/request.php
@@ -60,7 +60,14 @@ class Request implements \ArrayAccess, \Countable, IRequest {
* @param string|false 'requesttoken' the requesttoken or false when not available
* @see http://www.php.net/manual/en/reserved.variables.php
*/
- public function __construct(array $vars=array()) {
+ public function __construct(array $vars=array(), $stream='php://input') {
+
+ $this->inputStream = $stream;
+ $this->items['params'] = array();
+
+ if(!array_key_exists('method', $vars)) {
+ $vars['method'] = 'GET';
+ }
foreach($this->allowedKeys as $name) {
$this->items[$name] = isset($vars[$name])
@@ -68,25 +75,32 @@ class Request implements \ArrayAccess, \Countable, IRequest {
: array();
}
- if (defined('PHPUNIT_RUN') && PHPUNIT_RUN
- && in_array('fakeinput', stream_get_wrappers())) {
- $this->inputStream = 'fakeinput://data';
- } else {
- $this->inputStream = 'php://input';
- }
-
- // Only 'application/x-www-form-urlencoded' requests are automatically
- // transformed by PHP, 'application/json' must be decoded manually.
- if ($this->method === 'POST'
- && strpos($this->getHeader('Content-Type'), 'application/json') !== false
- ) {
- $this->items['params'] = $this->items['post'] = json_decode(file_get_contents($this->inputStream), true);
- }
+ // 'application/json' must be decoded manually.
+ if (strpos($this->getHeader('Content-Type'), 'application/json') !== false) {
+ $params = json_decode(file_get_contents($this->inputStream), true);
+ if(count($params) > 0) {
+ $this->items['params'] = $params;
+ if($vars['method'] === 'POST') {
+ $this->items['post'] = $params;
+ }
+ }
+ // Handle application/x-www-form-urlencoded for methods other than GET
+ // or post correctly
+ } elseif($vars['method'] !== 'GET'
+ && $vars['method'] !== 'POST'
+ && strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') !== false) {
+
+ parse_str(file_get_contents($this->inputStream), $params);
+ if(is_array($params)) {
+ $this->items['params'] = $params;
+ }
+ }
$this->items['parameters'] = array_merge(
$this->items['get'],
$this->items['post'],
- $this->items['urlParams']
+ $this->items['urlParams'],
+ $this->items['params']
);
}
@@ -313,47 +327,22 @@ class Request implements \ArrayAccess, \Countable, IRequest {
* @throws \LogicException
*/
protected function getContent() {
- if ($this->content === false && $this->method === 'PUT') {
- throw new \LogicException(
- '"put" can only be accessed once if not '
- . 'application/x-www-form-urlencoded or application/json.'
- );
- }
-
// If the content can't be parsed into an array then return a stream resource.
if ($this->method === 'PUT'
&& strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === false
&& strpos($this->getHeader('Content-Type'), 'application/json') === false
) {
+ if ($this->content === false) {
+ throw new \LogicException(
+ '"put" can only be accessed once if not '
+ . 'application/x-www-form-urlencoded or application/json.'
+ );
+ }
$this->content = false;
return fopen($this->inputStream, 'rb');
+ } else {
+ return $this->parameters;
}
-
- if (is_null($this->content)) {
- $this->content = file_get_contents($this->inputStream);
-
- /*
- * Normal jquery ajax requests are sent as application/x-www-form-urlencoded
- * and in $_GET and $_POST PHP transformes the data into an array.
- * The first condition mimics this.
- * The second condition allows for sending raw application/json data while
- * still getting the result as an array.
- *
- */
- if (strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') !== false) {
- parse_str($this->content, $content);
- if(is_array($content)) {
- $this->content = $content;
- }
- } elseif (strpos($this->getHeader('Content-Type'), 'application/json') !== false) {
- $content = json_decode($this->content, true);
- if(is_array($content)) {
- $this->content = $content;
- }
- }
- }
-
- return $this->content;
}
/**
diff --git a/lib/private/appframework/middleware/security/securitymiddleware.php b/lib/private/appframework/middleware/security/securitymiddleware.php
index bb02d565fa4..0f160d224ad 100644
--- a/lib/private/appframework/middleware/security/securitymiddleware.php
+++ b/lib/private/appframework/middleware/security/securitymiddleware.php
@@ -25,8 +25,8 @@
namespace OC\AppFramework\Middleware\Security;
use OC\AppFramework\Http;
-use OC\AppFramework\Http\RedirectResponse;
use OC\AppFramework\Utility\MethodAnnotationReader;
+use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Middleware;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\JSONResponse;
diff --git a/lib/private/appframework/routing/routeconfig.php b/lib/private/appframework/routing/routeconfig.php
index 35bee75cc4d..a3bbde6af53 100644
--- a/lib/private/appframework/routing/routeconfig.php
+++ b/lib/private/appframework/routing/routeconfig.php
@@ -84,7 +84,15 @@ class RouteConfig {
// register the route
$handler = new RouteActionHandler($this->container, $controllerName, $actionName);
- $this->router->create($this->appName.'.'.$controller.'.'.$action, $url)->method($verb)->action($handler);
+ $router = $this->router->create($this->appName.'.'.$controller.'.'.$action, $url)
+ ->method($verb)
+ ->action($handler);
+
+ // optionally register requirements for route. This is used to
+ // tell the route parser how url parameters should be matched
+ if(array_key_exists('requirements', $simpleRoute)) {
+ $router->requirements($simpleRoute['requirements']);
+ }
}
}
diff --git a/lib/private/archive.php b/lib/private/archive.php
index 6f51066ddf8..a62f22cf6d7 100644
--- a/lib/private/archive.php
+++ b/lib/private/archive.php
@@ -10,7 +10,7 @@ abstract class OC_Archive{
/**
* open any of the supported archive types
* @param string $path
- * @return OC_Archive
+ * @return OC_Archive|void
*/
public static function open($path) {
$ext=substr($path, strrpos($path, '.'));
@@ -29,6 +29,9 @@ abstract class OC_Archive{
}
}
+ /**
+ * @param $source
+ */
abstract function __construct($source);
/**
* add an empty folder to the archive
@@ -39,7 +42,7 @@ abstract class OC_Archive{
/**
* add a file to the archive
* @param string $path
- * @param string source either a local file or string data
+ * @param string $source either a local file or string data
* @return bool
*/
abstract function addFile($path, $source='');
diff --git a/lib/private/arrayparser.php b/lib/private/arrayparser.php
index d353e486577..a5e1f6653fc 100644
--- a/lib/private/arrayparser.php
+++ b/lib/private/arrayparser.php
@@ -32,6 +32,7 @@ class ArrayParser {
/**
* @param string $string
+ * @return array|bool|int|null|string
*/
function parsePHP($string) {
$string = $this->stripPHPTags($string);
@@ -41,6 +42,7 @@ class ArrayParser {
/**
* @param string $string
+ * @return string
*/
function stripPHPTags($string) {
$string = trim($string);
@@ -55,6 +57,7 @@ class ArrayParser {
/**
* @param string $string
+ * @return string
*/
function stripAssignAndReturn($string) {
$string = trim($string);
@@ -67,6 +70,10 @@ class ArrayParser {
return $string;
}
+ /**
+ * @param string $string
+ * @return array|bool|int|null|string
+ */
function parse($string) {
$string = trim($string);
$string = trim($string, ';');
@@ -85,6 +92,7 @@ class ArrayParser {
/**
* @param string $string
+ * @return int
*/
function getType($string) {
$string = strtolower($string);
@@ -104,6 +112,7 @@ class ArrayParser {
/**
* @param string $string
+ * @return string
*/
function parseString($string) {
return substr($string, 1, -1);
@@ -111,6 +120,7 @@ class ArrayParser {
/**
* @param string $string
+ * @return int
*/
function parseNum($string) {
return intval($string);
@@ -118,6 +128,7 @@ class ArrayParser {
/**
* @param string $string
+ * @return bool
*/
function parseBool($string) {
$string = strtolower($string);
@@ -126,6 +137,7 @@ class ArrayParser {
/**
* @param string $string
+ * @return array
*/
function parseArray($string) {
$body = substr($string, 5);
@@ -157,6 +169,7 @@ class ArrayParser {
/**
* @param string $body
+ * @return array
*/
function splitArray($body) {
$inSingleQuote = false;//keep track if we are inside quotes
diff --git a/lib/private/cache.php b/lib/private/cache.php
index a311f10a00f..961270c334c 100644
--- a/lib/private/cache.php
+++ b/lib/private/cache.php
@@ -97,7 +97,7 @@ class Cache {
/**
* creates cache key based on the files given
- * @param $files
+ * @param string[] $files
* @return string
*/
static public function generateCacheKeyFromFiles($files) {
diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php
index be6805a9a57..feee9cc32b6 100644
--- a/lib/private/cache/file.php
+++ b/lib/private/cache/file.php
@@ -14,7 +14,7 @@ class File {
/**
* Returns the cache storage for the logged in user
- * @return cache storage
+ * @return \OC\Files\View cache storage
*/
protected function getStorage() {
if (isset($this->storage)) {
@@ -84,11 +84,6 @@ class File {
public function hasKey($key) {
$storage = $this->getStorage();
if ($storage && $storage->is_file($key)) {
- $mtime = $storage->filemtime($key);
- if ($mtime < time()) {
- $storage->unlink($key);
- return false;
- }
return true;
}
return false;
diff --git a/lib/private/config.php b/lib/private/config.php
index 56f47256134..6701ca0532b 100644
--- a/lib/private/config.php
+++ b/lib/private/config.php
@@ -172,7 +172,7 @@ class Config {
$result = @file_put_contents($this->configFilename, $content);
if (!$result) {
$defaults = new \OC_Defaults;
- $url = \OC_Helper::linkToDocs('admin-dir-permissions');
+ $url = \OC_Helper::linkToDocs('admin-dir_permissions');
throw new HintException(
"Can't write into config directory!",
'This can usually be fixed by '
diff --git a/lib/private/connector/sabre/aborteduploaddetectionplugin.php b/lib/private/connector/sabre/aborteduploaddetectionplugin.php
index ad759d1d84a..1a092a59a82 100644
--- a/lib/private/connector/sabre/aborteduploaddetectionplugin.php
+++ b/lib/private/connector/sabre/aborteduploaddetectionplugin.php
@@ -22,11 +22,16 @@ class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPl
private $server;
/**
- * is kept public to allow overwrite for unit testing
- *
* @var \OC\Files\View
*/
- public $fileView;
+ private $fileView;
+
+ /**
+ * @param \OC\Files\View $view
+ */
+ public function __construct($view) {
+ $this->fileView = $view;
+ }
/**
* This initializes the plugin.
@@ -55,7 +60,7 @@ class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPl
// we should only react on PUT which is used for upload
// e.g. with LOCK this will not work, but LOCK uses createFile() as well
- if ($this->server->httpRequest->getMethod() !== 'PUT' ) {
+ if ($this->server->httpRequest->getMethod() !== 'PUT') {
return;
}
@@ -70,9 +75,9 @@ class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPl
if (!$expected) {
return;
}
- $actual = $this->getFileView()->filesize($filePath);
+ $actual = $this->fileView->filesize($filePath);
if ($actual != $expected) {
- $this->getFileView()->unlink($filePath);
+ $this->fileView->unlink($filePath);
throw new Sabre_DAV_Exception_BadRequest('expected filesize ' . $expected . ' got ' . $actual);
}
@@ -81,8 +86,7 @@ class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPl
/**
* @return string
*/
- public function getLength()
- {
+ public function getLength() {
$req = $this->server->httpRequest;
$length = $req->getHeader('X-Expected-Entity-Length');
if (!$length) {
@@ -91,17 +95,4 @@ class OC_Connector_Sabre_AbortedUploadDetectionPlugin extends Sabre_DAV_ServerPl
return $length;
}
-
- /**
- * @return \OC\Files\View
- */
- public function getFileView()
- {
- if (is_null($this->fileView)) {
- // initialize fileView
- $this->fileView = \OC\Files\Filesystem::getView();
- }
-
- return $this->fileView;
- }
}
diff --git a/lib/private/connector/sabre/directory.php b/lib/private/connector/sabre/directory.php
index 3ed9e94d69b..1bb526e451e 100644
--- a/lib/private/connector/sabre/directory.php
+++ b/lib/private/connector/sabre/directory.php
@@ -29,7 +29,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
* Data will either be supplied as a stream resource, or in certain cases
* as a string. Keep in mind that you may have to support either.
*
- * After succesful creation of the file, you may choose to return the ETag
+ * After successful creation of the file, you may choose to return the ETag
* of the new file here.
*
* The returned ETag must be surrounded by double-quotes (The quotes should
@@ -50,30 +50,28 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
*/
public function createFile($name, $data = null) {
- if (strtolower($name) === 'shared' && empty($this->path)) {
- throw new \Sabre_DAV_Exception_Forbidden();
- }
-
// for chunked upload also updating a existing file is a "createFile"
- // because we create all the chunks before reasamble them to the existing file.
+ // because we create all the chunks before re-assemble them to the existing file.
if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
// exit if we can't create a new file and we don't updatable existing file
$info = OC_FileChunking::decodeName($name);
- if (!\OC\Files\Filesystem::isCreatable($this->path) &&
- !\OC\Files\Filesystem::isUpdatable($this->path . '/' . $info['name'])) {
+ if (!$this->fileView->isCreatable($this->path) &&
+ !$this->fileView->isUpdatable($this->path . '/' . $info['name'])) {
throw new \Sabre_DAV_Exception_Forbidden();
}
} else {
// For non-chunked upload it is enough to check if we can create a new file
- if (!\OC\Files\Filesystem::isCreatable($this->path)) {
+ if (!$this->fileView->isCreatable($this->path)) {
throw new \Sabre_DAV_Exception_Forbidden();
}
}
- $path = $this->path . '/' . $name;
- $node = new OC_Connector_Sabre_File($path);
+ $path = $this->fileView->getAbsolutePath($this->path) . '/' . $name;
+ // using a dummy FileInfo is acceptable here since it will be refreshed after the put is complete
+ $info = new \OC\Files\FileInfo($path, null, null, array());
+ $node = new OC_Connector_Sabre_File($this->fileView, $info);
return $node->put($data);
}
@@ -85,17 +83,12 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
* @return void
*/
public function createDirectory($name) {
-
- if (strtolower($name) === 'shared' && empty($this->path)) {
- throw new \Sabre_DAV_Exception_Forbidden();
- }
-
- if (!\OC\Files\Filesystem::isCreatable($this->path)) {
+ if (!$this->fileView->isCreatable($this->path)) {
throw new \Sabre_DAV_Exception_Forbidden();
}
$newPath = $this->path . '/' . $name;
- if(!\OC\Files\Filesystem::mkdir($newPath)) {
+ if(!$this->fileView->mkdir($newPath)) {
throw new Sabre_DAV_Exception_Forbidden('Could not create directory '.$newPath);
}
@@ -105,14 +98,15 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
* Returns a specific child node, referenced by its name
*
* @param string $name
- * @throws Sabre_DAV_Exception_FileNotFound
+ * @param \OCP\Files\FileInfo $info
+ * @throws Sabre_DAV_Exception_NotFound
* @return Sabre_DAV_INode
*/
public function getChild($name, $info = null) {
$path = $this->path . '/' . $name;
if (is_null($info)) {
- $info = \OC\Files\Filesystem::getFileInfo($path);
+ $info = $this->fileView->getFileInfo($path);
}
if (!$info) {
@@ -120,12 +114,10 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
}
if ($info['mimetype'] == 'httpd/unix-directory') {
- $node = new OC_Connector_Sabre_Directory($path);
+ $node = new OC_Connector_Sabre_Directory($this->fileView, $info);
} else {
- $node = new OC_Connector_Sabre_File($path);
+ $node = new OC_Connector_Sabre_File($this->fileView, $info);
}
-
- $node->setFileinfoCache($info);
return $node;
}
@@ -136,7 +128,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
*/
public function getChildren() {
- $folder_content = \OC\Files\Filesystem::getDirectoryContent($this->path);
+ $folder_content = $this->fileView->getDirectoryContent($this->path);
$paths = array();
foreach($folder_content as $info) {
$paths[] = $this->path.'/'.$info['name'];
@@ -167,7 +159,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
$nodes = array();
foreach($folder_content as $info) {
- $node = $this->getChild($info['name'], $info);
+ $node = $this->getChild($info->getName(), $info);
$node->setPropertyCache($properties[$this->path.'/'.$info['name']]);
$nodes[] = $node;
}
@@ -183,7 +175,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
public function childExists($name) {
$path = $this->path . '/' . $name;
- return \OC\Files\Filesystem::file_exists($path);
+ return $this->fileView->file_exists($path);
}
@@ -195,15 +187,11 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
*/
public function delete() {
- if ($this->path === 'Shared') {
- throw new \Sabre_DAV_Exception_Forbidden();
- }
-
- if (!\OC\Files\Filesystem::isDeletable($this->path)) {
+ if (!$this->info->isDeletable()) {
throw new \Sabre_DAV_Exception_Forbidden();
}
- \OC\Files\Filesystem::rmdir($this->path);
+ $this->fileView->rmdir($this->path);
}
@@ -235,7 +223,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
public function getProperties($properties) {
$props = parent::getProperties($properties);
if (in_array(self::GETETAG_PROPERTYNAME, $properties) && !isset($props[self::GETETAG_PROPERTYNAME])) {
- $props[self::GETETAG_PROPERTYNAME] = $this->getETagPropertyForPath($this->path);
+ $props[self::GETETAG_PROPERTYNAME] = $this->info->getEtag();
}
return $props;
}
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php
index ef6caaf22a7..66b50a87552 100644
--- a/lib/private/connector/sabre/file.php
+++ b/lib/private/connector/sabre/file.php
@@ -42,14 +42,16 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
*
* @param resource $data
* @throws Sabre_DAV_Exception_Forbidden
+ * @throws OC_Connector_Sabre_Exception_UnsupportedMediaType
+ * @throws Sabre_DAV_Exception_BadRequest
+ * @throws Sabre_DAV_Exception
+ * @throws OC_Connector_Sabre_Exception_EntityTooLarge
+ * @throws Sabre_DAV_Exception_ServiceUnavailable
* @return string|null
*/
public function put($data) {
-
- $fs = $this->getFS();
-
- if ($fs->file_exists($this->path) &&
- !$fs->isUpdatable($this->path)) {
+ if ($this->info && $this->fileView->file_exists($this->path) &&
+ !$this->info->isUpdateable()) {
throw new \Sabre_DAV_Exception_Forbidden();
}
@@ -71,18 +73,11 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
// mark file as partial while uploading (ignored by the scanner)
$partpath = $this->path . '.ocTransferId' . rand() . '.part';
- // if file is located in /Shared we write the part file to the users
- // root folder because we can't create new files in /shared
- // we extend the name with a random number to avoid overwriting a existing file
- if (dirname($partpath) === 'Shared') {
- $partpath = pathinfo($partpath, PATHINFO_FILENAME) . rand() . '.part';
- }
-
try {
- $putOkay = $fs->file_put_contents($partpath, $data);
+ $putOkay = $this->fileView->file_put_contents($partpath, $data);
if ($putOkay === false) {
\OC_Log::write('webdav', '\OC\Files\Filesystem::file_put_contents() failed', \OC_Log::ERROR);
- $fs->unlink($partpath);
+ $this->fileView->unlink($partpath);
// because we have no clue about the cause we can only throw back a 500/Internal Server Error
throw new Sabre_DAV_Exception('Could not write file contents');
}
@@ -105,29 +100,30 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
}
// rename to correct path
- $renameOkay = $fs->rename($partpath, $this->path);
- $fileExists = $fs->file_exists($this->path);
+ $renameOkay = $this->fileView->rename($partpath, $this->path);
+ $fileExists = $this->fileView->file_exists($this->path);
if ($renameOkay === false || $fileExists === false) {
\OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
- $fs->unlink($partpath);
+ $this->fileView->unlink($partpath);
throw new Sabre_DAV_Exception('Could not rename part file to final file');
}
// allow sync clients to send the mtime along in a header
$mtime = OC_Request::hasModificationTime();
if ($mtime !== false) {
- if($fs->touch($this->path, $mtime)) {
+ if($this->fileView->touch($this->path, $mtime)) {
header('X-OC-MTime: accepted');
}
}
+ $this->refreshInfo();
- return $this->getETagPropertyForPath($this->path);
+ return '"' . $this->info->getEtag() . '"';
}
/**
* Returns the data
*
- * @return string
+ * @return string | resource
*/
public function get() {
@@ -135,7 +131,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
if (\OC_Util::encryptedFiles()) {
throw new \Sabre_DAV_Exception_ServiceUnavailable();
} else {
- return \OC\Files\Filesystem::fopen($this->path, 'rb');
+ return $this->fileView->fopen($this->path, 'rb');
}
}
@@ -147,16 +143,10 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
* @throws Sabre_DAV_Exception_Forbidden
*/
public function delete() {
- $fs = $this->getFS();
-
- if ($this->path === 'Shared') {
- throw new \Sabre_DAV_Exception_Forbidden();
- }
-
- if (!$fs->isDeletable($this->path)) {
+ if (!$this->info->isDeletable()) {
throw new \Sabre_DAV_Exception_Forbidden();
}
- $fs->unlink($this->path);
+ $this->fileView->unlink($this->path);
// remove properties
$this->removeProperties();
@@ -169,12 +159,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
* @return int
*/
public function getSize() {
- $this->getFileinfoCache();
- if ($this->fileinfo_cache['size'] > -1) {
- return $this->fileinfo_cache['size'];
- } else {
- return null;
- }
+ return $this->info->getSize();
}
/**
@@ -189,11 +174,7 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
* @return mixed
*/
public function getETag() {
- $properties = $this->getProperties(array(self::GETETAG_PROPERTYNAME));
- if (isset($properties[self::GETETAG_PROPERTYNAME])) {
- return $properties[self::GETETAG_PROPERTYNAME];
- }
- return null;
+ return '"' . $this->info->getEtag() . '"';
}
/**
@@ -204,16 +185,14 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
* @return mixed
*/
public function getContentType() {
- if (isset($this->fileinfo_cache['mimetype'])) {
- return $this->fileinfo_cache['mimetype'];
- }
-
- return \OC\Files\Filesystem::getMimeType($this->path);
+ $mimeType = $this->info->getMimetype();
+ return \OC_Helper::getSecureMimeType($mimeType);
}
/**
* @param resource $data
+ * @return null|string
*/
private function createFileChunked($data)
{
@@ -245,15 +224,14 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
$chunk_handler->file_assemble($partFile);
// here is the final atomic rename
- $fs = $this->getFS();
$targetPath = $path . '/' . $info['name'];
- $renameOkay = $fs->rename($partFile, $targetPath);
- $fileExists = $fs->file_exists($targetPath);
+ $renameOkay = $this->fileView->rename($partFile, $targetPath);
+ $fileExists = $this->fileView->file_exists($targetPath);
if ($renameOkay === false || $fileExists === false) {
\OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
// only delete if an error occurred and the target file was already created
if ($fileExists) {
- $fs->unlink($targetPath);
+ $this->fileView->unlink($targetPath);
}
throw new Sabre_DAV_Exception('Could not rename part file assembled from chunks');
}
@@ -261,12 +239,13 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
// allow sync clients to send the mtime along in a header
$mtime = OC_Request::hasModificationTime();
if ($mtime !== false) {
- if($fs->touch($targetPath, $mtime)) {
+ if($this->fileView->touch($targetPath, $mtime)) {
header('X-OC-MTime: accepted');
}
}
- return OC_Connector_Sabre_Node::getETagPropertyForPath($targetPath);
+ $info = $this->fileView->getFileInfo($targetPath);
+ return $info->getEtag();
}
return null;
diff --git a/lib/private/connector/sabre/node.php b/lib/private/connector/sabre/node.php
index 5807c5c7f71..eede39cba8b 100644
--- a/lib/private/connector/sabre/node.php
+++ b/lib/private/connector/sabre/node.php
@@ -20,7 +20,6 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IProperties {
const GETETAG_PROPERTYNAME = '{DAV:}getetag';
const LASTMODIFIED_PROPERTYNAME = '{DAV:}lastmodified';
@@ -29,15 +28,13 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* Allow configuring the method used to generate Etags
*
* @var array(class_name, function_name)
- */
+ */
public static $ETagFunction = null;
/**
- * is kept public to allow overwrite for unit testing
- *
* @var \OC\Files\View
*/
- public $fileView;
+ protected $fileView;
/**
* The path to the current node
@@ -47,52 +44,54 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
protected $path;
/**
- * node fileinfo cache
- * @var array
- */
- protected $fileinfo_cache;
- /**
* node properties cache
+ *
* @var array
*/
protected $property_cache = null;
/**
+ * @var \OCP\Files\FileInfo
+ */
+ protected $info;
+
+ /**
* @brief Sets up the node, expects a full path name
- * @param string $path
- * @return void
+ * @param \OC\Files\View $view
+ * @param \OCP\Files\FileInfo $info
*/
- public function __construct($path) {
- $this->path = $path;
+ public function __construct($view, $info) {
+ $this->fileView = $view;
+ $this->path = $this->fileView->getRelativePath($info->getPath());
+ $this->info = $info;
}
-
+ protected function refreshInfo() {
+ $this->info = $this->fileView->getFileInfo($this->path);
+ }
/**
* @brief Returns the name of the node
* @return string
*/
public function getName() {
-
- list(, $name) = Sabre_DAV_URLUtil::splitPath($this->path);
- return $name;
-
+ return $this->info->getName();
}
/**
* @brief Renames the node
* @param string $name The new name
- * @return void
+ * @throws Sabre_DAV_Exception_BadRequest
+ * @throws Sabre_DAV_Exception_Forbidden
*/
public function setName($name) {
- $fs = $this->getFS();
// rename is only allowed if the update privilege is granted
- if (!$fs->isUpdatable($this->path)) {
+ if (!$this->info->isUpdateable()) {
throw new \Sabre_DAV_Exception_Forbidden();
}
- list($parentPath, ) = Sabre_DAV_URLUtil::splitPath($this->path);
+ list($parentPath,) = Sabre_DAV_URLUtil::splitPath($this->path);
list(, $newName) = Sabre_DAV_URLUtil::splitPath($name);
if (!\OCP\Util::isValidFileName($newName)) {
@@ -102,49 +101,30 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
$newPath = $parentPath . '/' . $newName;
$oldPath = $this->path;
- $fs->rename($this->path, $newPath);
+ $this->fileView->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 ));
-
- }
-
- public function setFileinfoCache($fileinfo_cache)
- {
- $this->fileinfo_cache = $fileinfo_cache;
- }
-
- /**
- * @brief Ensure that the fileinfo cache is filled
- * @note Uses OC_FileCache or a direct stat
- */
- protected function getFileinfoCache() {
- if (!isset($this->fileinfo_cache)) {
- if ($fileinfo_cache = \OC\Files\Filesystem::getFileInfo($this->path)) {
- } else {
- $fileinfo_cache = \OC\Files\Filesystem::stat($this->path);
- }
-
- $this->fileinfo_cache = $fileinfo_cache;
- }
+ $query = OC_DB::prepare('UPDATE `*PREFIX*properties` SET `propertypath` = ?'
+ . ' WHERE `userid` = ? AND `propertypath` = ?');
+ $query->execute(array($newPath, OC_User::getUser(), $oldPath));
+ $this->refreshInfo();
}
- public function setPropertyCache($property_cache)
- {
+ public function setPropertyCache($property_cache) {
$this->property_cache = $property_cache;
}
/**
* @brief Returns the last modification time, as a unix timestamp
- * @return int
+ * @return int timestamp as integer
*/
public function getLastModified() {
- $this->getFileinfoCache();
- return $this->fileinfo_cache['mtime'];
-
+ $timestamp = $this->info->getMtime();
+ if (!empty($timestamp)) {
+ return (int)$timestamp;
+ }
+ return $timestamp;
}
/**
@@ -153,39 +133,40 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* Even if the modification time is set to a custom value the access time is set to now.
*/
public function touch($mtime) {
- \OC\Files\Filesystem::touch($this->path, $mtime);
+ $this->fileView->touch($this->path, $mtime);
+ $this->refreshInfo();
}
/**
* @brief Updates properties on this node,
* @see Sabre_DAV_IProperties::updateProperties
+ * @param array $properties
* @return boolean
*/
public function updateProperties($properties) {
$existing = $this->getProperties(array());
- foreach($properties as $propertyName => $propertyValue) {
+ 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 ));
+ 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( strcmp( $propertyName, self::GETETAG_PROPERTYNAME) === 0 ) {
- \OC\Files\Filesystem::putFileInfo($this->path, array('etag'=> $propertyValue));
- } elseif( strcmp( $propertyName, self::LASTMODIFIED_PROPERTYNAME) === 0 ) {
+ } else {
+ if (strcmp($propertyName, self::GETETAG_PROPERTYNAME) === 0) {
+ \OC\Files\Filesystem::putFileInfo($this->path, array('etag' => $propertyValue));
+ } elseif (strcmp($propertyName, self::LASTMODIFIED_PROPERTYNAME) === 0) {
$this->touch($propertyValue);
} 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 ));
+ 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 ));
+ $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));
}
}
}
@@ -199,9 +180,9 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* removes all properties for this node and user
*/
public function removeProperties() {
- $query = OC_DB::prepare( 'DELETE FROM `*PREFIX*properties`'
- .' WHERE `userid` = ? AND `propertypath` = ?' );
- $query->execute( array( OC_User::getUser(), $this->path));
+ $query = OC_DB::prepare('DELETE FROM `*PREFIX*properties`'
+ . ' WHERE `userid` = ? AND `propertypath` = ?');
+ $query->execute(array(OC_User::getUser(), $this->path));
$this->setPropertyCache(null);
}
@@ -219,29 +200,23 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
if (is_null($this->property_cache)) {
$sql = 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` = ?';
- $result = OC_DB::executeAudited( $sql, array( OC_User::getUser(), $this->path ) );
+ $result = OC_DB::executeAudited($sql, array(OC_User::getUser(), $this->path));
$this->property_cache = array();
- while( $row = $result->fetchRow()) {
+ while ($row = $result->fetchRow()) {
$this->property_cache[$row['propertyname']] = $row['propertyvalue'];
}
- // Don't call the static getETagPropertyForPath, its result is not cached
- $this->getFileinfoCache();
- if ($this->fileinfo_cache['etag']) {
- $this->property_cache[self::GETETAG_PROPERTYNAME] = '"'.$this->fileinfo_cache['etag'].'"';
- } else {
- $this->property_cache[self::GETETAG_PROPERTYNAME] = null;
- }
+ $this->property_cache[self::GETETAG_PROPERTYNAME] = '"' . $this->info->getEtag() . '"';
}
// if the array was empty, we need to return everything
- if(count($properties) == 0) {
+ if (count($properties) == 0) {
return $this->property_cache;
}
$props = array();
- foreach($properties as $property) {
+ foreach ($properties as $property) {
if (isset($this->property_cache[$property])) {
$props[$property] = $this->property_cache[$property];
}
@@ -251,35 +226,12 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
}
/**
- * Returns the ETag surrounded by double-quotes for this path.
- * @param string $path Path of the file
- * @return string|null Returns null if the ETag can not effectively be determined
- */
- protected function getETagPropertyForPath($path) {
- $data = $this->getFS()->getFileInfo($path);
- if (isset($data['etag'])) {
- return '"'.$data['etag'].'"';
- }
- return null;
- }
-
- protected function getFS() {
- if (is_null($this->fileView)) {
- $this->fileView = \OC\Files\Filesystem::getView();
- }
- return $this->fileView;
- }
-
- /**
* @return string|null
*/
- public function getFileId()
- {
- $this->getFileinfoCache();
-
- if (isset($this->fileinfo_cache['fileid'])) {
+ public function getFileId() {
+ if ($this->info->getId()) {
$instanceId = OC_Util::getInstanceId();
- $id = sprintf('%08d', $this->fileinfo_cache['fileid']);
+ $id = sprintf('%08d', $this->info->getId());
return $id . $instanceId;
}
diff --git a/lib/private/connector/sabre/objecttree.php b/lib/private/connector/sabre/objecttree.php
index accf020daa2..35cc1679ab6 100644
--- a/lib/private/connector/sabre/objecttree.php
+++ b/lib/private/connector/sabre/objecttree.php
@@ -8,25 +8,45 @@
namespace OC\Connector\Sabre;
+use OC\Files\FileInfo;
use OC\Files\Filesystem;
class ObjectTree extends \Sabre_DAV_ObjectTree {
/**
- * keep this public to allow mock injection during unit test
- *
* @var \OC\Files\View
*/
- public $fileView;
+ protected $fileView;
+
+ /**
+ * Creates the object
+ *
+ * This method expects the rootObject to be passed as a parameter
+ */
+ public function __construct() {
+ }
+
+ /**
+ * @param \Sabre_DAV_ICollection $rootNode
+ * @param \OC\Files\View $view
+ */
+ public function init(\Sabre_DAV_ICollection $rootNode, \OC\Files\View $view) {
+ $this->rootNode = $rootNode;
+ $this->fileView = $view;
+ }
/**
* Returns the INode object for the requested path
*
* @param string $path
+ * @throws \Sabre_DAV_Exception_ServiceUnavailable
* @throws \Sabre_DAV_Exception_NotFound
* @return \Sabre_DAV_INode
*/
public function getNodeForPath($path) {
+ if (!$this->fileView) {
+ throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup');
+ }
$path = trim($path, '/');
if (isset($this->cache[$path])) {
@@ -40,31 +60,34 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
if (pathinfo($path, PATHINFO_EXTENSION) === 'part') {
// read from storage
- $absPath = $this->getFileView()->getAbsolutePath($path);
+ $absPath = $this->fileView->getAbsolutePath($path);
list($storage, $internalPath) = Filesystem::resolvePath('/' . $absPath);
if ($storage) {
+ /**
+ * @var \OC\Files\Storage\Storage $storage
+ */
$scanner = $storage->getScanner($internalPath);
// get data directly
- $info = $scanner->getData($internalPath);
+ $data = $scanner->getData($internalPath);
+ $info = new FileInfo($absPath, $storage, $internalPath, $data);
+ } else {
+ $info = null;
}
- }
- else {
+ } else {
// read from cache
- $info = $this->getFileView()->getFileInfo($path);
+ $info = $this->fileView->getFileInfo($path);
}
if (!$info) {
throw new \Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
}
- if ($info['mimetype'] === 'httpd/unix-directory') {
- $node = new \OC_Connector_Sabre_Directory($path);
+ if ($info->getType() === 'dir') {
+ $node = new \OC_Connector_Sabre_Directory($this->fileView, $info);
} else {
- $node = new \OC_Connector_Sabre_File($path);
+ $node = new \OC_Connector_Sabre_File($this->fileView, $info);
}
- $node->setFileinfoCache($info);
-
$this->cache[$path] = $node;
return $node;
@@ -75,10 +98,15 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
*
* @param string $sourcePath The path to the file which should be moved
* @param string $destinationPath The full destination path, so not just the destination parent node
+ * @throws \Sabre_DAV_Exception_BadRequest
+ * @throws \Sabre_DAV_Exception_ServiceUnavailable
* @throws \Sabre_DAV_Exception_Forbidden
* @return int
*/
public function move($sourcePath, $destinationPath) {
+ if (!$this->fileView) {
+ throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup');
+ }
$sourceNode = $this->getNodeForPath($sourcePath);
if ($sourceNode instanceof \Sabre_DAV_ICollection and $this->nodeExists($destinationPath)) {
@@ -87,23 +115,28 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
list($sourceDir,) = \Sabre_DAV_URLUtil::splitPath($sourcePath);
list($destinationDir,) = \Sabre_DAV_URLUtil::splitPath($destinationPath);
+ $isShareMountPoint = false;
+ list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath( '/' . \OCP\User::getUser() . '/files/' . $sourcePath);
+ if ($storage instanceof \OC\Files\Storage\Shared && !$internalPath) {
+ $isShareMountPoint = true;
+ }
+
// check update privileges
- $fs = $this->getFileView();
- if (!$fs->isUpdatable($sourcePath)) {
+ if (!$this->fileView->isUpdatable($sourcePath) && !$isShareMountPoint) {
throw new \Sabre_DAV_Exception_Forbidden();
}
if ($sourceDir !== $destinationDir) {
// for a full move we need update privileges on sourcePath and sourceDir as well as destinationDir
- if (ltrim($destinationDir, '/') === '' && strtolower($sourceNode->getName()) === 'shared') {
+ if (ltrim($destinationDir, '/') === '') {
throw new \Sabre_DAV_Exception_Forbidden();
}
- if (!$fs->isUpdatable($sourceDir)) {
+ if (!$this->fileView->isUpdatable($sourceDir)) {
throw new \Sabre_DAV_Exception_Forbidden();
}
- if (!$fs->isUpdatable($destinationDir)) {
+ if (!$this->fileView->isUpdatable($destinationDir)) {
throw new \Sabre_DAV_Exception_Forbidden();
}
- if (!$fs->isDeletable($sourcePath)) {
+ if (!$this->fileView->isDeletable($sourcePath)) {
throw new \Sabre_DAV_Exception_Forbidden();
}
}
@@ -113,15 +146,15 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
throw new \Sabre_DAV_Exception_BadRequest();
}
- $renameOkay = $fs->rename($sourcePath, $destinationPath);
+ $renameOkay = $this->fileView->rename($sourcePath, $destinationPath);
if (!$renameOkay) {
throw new \Sabre_DAV_Exception_Forbidden('');
}
// update properties
- $query = \OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertypath` = ?'
- .' WHERE `userid` = ? AND `propertypath` = ?' );
- $query->execute( array( $destinationPath, \OC_User::getUser(), $sourcePath ));
+ $query = \OC_DB::prepare('UPDATE `*PREFIX*properties` SET `propertypath` = ?'
+ . ' WHERE `userid` = ? AND `propertypath` = ?');
+ $query->execute(array(\OC\Files\Filesystem::normalizePath($destinationPath), \OC_User::getUser(), \OC\Files\Filesystem::normalizePath($sourcePath)));
$this->markDirty($sourceDir);
$this->markDirty($destinationDir);
@@ -136,20 +169,24 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
*
* @param string $source
* @param string $destination
+ * @throws \Sabre_DAV_Exception_ServiceUnavailable
* @return void
*/
public function copy($source, $destination) {
+ if (!$this->fileView) {
+ throw new \Sabre_DAV_Exception_ServiceUnavailable('filesystem not setup');
+ }
- if (Filesystem::is_file($source)) {
- Filesystem::copy($source, $destination);
+ if ($this->fileView->is_file($source)) {
+ $this->fileView->copy($source, $destination);
} else {
- Filesystem::mkdir($destination);
- $dh = Filesystem::opendir($source);
- if(is_resource($dh)) {
- while (($subnode = readdir($dh)) !== false) {
+ $this->fileView->mkdir($destination);
+ $dh = $this->fileView->opendir($source);
+ if (is_resource($dh)) {
+ while (($subNode = readdir($dh)) !== false) {
- if ($subnode == '.' || $subnode == '..') continue;
- $this->copy($source . '/' . $subnode, $destination . '/' . $subnode);
+ if ($subNode == '.' || $subNode == '..') continue;
+ $this->copy($source . '/' . $subNode, $destination . '/' . $subNode);
}
}
@@ -158,14 +195,4 @@ class ObjectTree extends \Sabre_DAV_ObjectTree {
list($destinationDir,) = \Sabre_DAV_URLUtil::splitPath($destination);
$this->markDirty($destinationDir);
}
-
- /**
- * @return \OC\Files\View
- */
- public function getFileView() {
- if (is_null($this->fileView)) {
- $this->fileView = \OC\Files\Filesystem::getView();
- }
- return $this->fileView;
- }
}
diff --git a/lib/private/connector/sabre/quotaplugin.php b/lib/private/connector/sabre/quotaplugin.php
index 227e684741c..1e73e1645c3 100644
--- a/lib/private/connector/sabre/quotaplugin.php
+++ b/lib/private/connector/sabre/quotaplugin.php
@@ -10,6 +10,11 @@
class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
/**
+ * @var \OC\Files\View
+ */
+ private $view;
+
+ /**
* Reference to main server object
*
* @var Sabre_DAV_Server
@@ -17,11 +22,11 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
private $server;
/**
- * is kept public to allow overwrite for unit testing
- *
- * @var \OC\Files\View
+ * @param \OC\Files\View $view
*/
- public $fileView;
+ public function __construct($view) {
+ $this->view = $view;
+ }
/**
* This initializes the plugin.
@@ -45,22 +50,23 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
/**
* This method is called before any HTTP method and validates there is enough free space to store the file
*
- * @throws Sabre_DAV_Exception
* @param string $uri
+ * @param null $data
+ * @throws Sabre_DAV_Exception_InsufficientStorage
* @return bool
*/
public function checkQuota($uri, $data = null) {
$length = $this->getLength();
if ($length) {
- if (substr($uri, 0, 1)!=='/') {
- $uri='/'.$uri;
+ if (substr($uri, 0, 1) !== '/') {
+ $uri = '/' . $uri;
}
list($parentUri, $newName) = Sabre_DAV_URLUtil::splitPath($uri);
$req = $this->server->httpRequest;
if ($req->getHeader('OC-Chunked')) {
$info = OC_FileChunking::decodeName($newName);
$chunkHandler = new OC_FileChunking($info);
- // substract the already uploaded size to see whether
+ // subtract the already uploaded size to see whether
// there is still enough space for the remaining chunks
$length -= $chunkHandler->getCurrentSize();
}
@@ -75,8 +81,7 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
return true;
}
- public function getLength()
- {
+ public function getLength() {
$req = $this->server->httpRequest;
$length = $req->getHeader('X-Expected-Entity-Length');
if (!$length) {
@@ -95,14 +100,8 @@ class OC_Connector_Sabre_QuotaPlugin extends Sabre_DAV_ServerPlugin {
* @param $parentUri
* @return mixed
*/
- public function getFreeSpace($parentUri)
- {
- if (is_null($this->fileView)) {
- // initialize fileView
- $this->fileView = \OC\Files\Filesystem::getView();
- }
-
- $freeSpace = $this->fileView->free_space($parentUri);
+ public function getFreeSpace($parentUri) {
+ $freeSpace = $this->view->free_space($parentUri);
return $freeSpace;
}
}
diff --git a/lib/private/contactsmanager.php b/lib/private/contactsmanager.php
index fc6745b4505..4299d88017a 100644
--- a/lib/private/contactsmanager.php
+++ b/lib/private/contactsmanager.php
@@ -37,7 +37,12 @@ namespace OC {
$result = array();
foreach($this->address_books as $address_book) {
$r = $address_book->search($pattern, $searchProperties, $options);
- $result = array_merge($result, $r);
+ $contacts = array();
+ foreach($r as $c){
+ $c['addressbook-key'] = $address_book->getKey();
+ $contacts[] = $c;
+ }
+ $result = array_merge($result, $contacts);
}
return $result;
@@ -47,7 +52,7 @@ namespace OC {
* This function can be used to delete the contact identified by the given id
*
* @param object $id the unique identifier to a contact
- * @param $address_book_key
+ * @param string $address_book_key identifier of the address book in which the contact shall be deleted
* @return bool successful or not
*/
public function delete($id, $address_book_key) {
@@ -66,7 +71,7 @@ namespace OC {
* Otherwise the contact will be updated by replacing the entire data set.
*
* @param array $properties this array if key-value-pairs defines a contact
- * @param $address_book_key string to identify the address book in which the contact shall be created or updated
+ * @param string $address_book_key identifier of the address book in which the contact shall be created or updated
* @return array representing the contact just created or updated
*/
public function createOrUpdate($properties, $address_book_key) {
diff --git a/lib/private/davclient.php b/lib/private/davclient.php
index afa4e1103b4..916dc11d17a 100644
--- a/lib/private/davclient.php
+++ b/lib/private/davclient.php
@@ -29,6 +29,8 @@ class OC_DAVClient extends \Sabre_DAV_Client {
protected $requestTimeout;
+ protected $verifyHost;
+
/**
* @brief Sets the request timeout or 0 to disable timeout.
* @param integer $timeout in seconds or 0 to disable
@@ -37,10 +39,21 @@ class OC_DAVClient extends \Sabre_DAV_Client {
$this->requestTimeout = (int)$timeout;
}
+ /**
+ * @brief Sets the CURLOPT_SSL_VERIFYHOST setting
+ * @param integer $value value to set CURLOPT_SSL_VERIFYHOST to
+ */
+ public function setVerifyHost($value) {
+ $this->verifyHost = $value;
+ }
+
protected function curlRequest($url, $settings) {
if ($this->requestTimeout > 0) {
$settings[CURLOPT_TIMEOUT] = $this->requestTimeout;
}
+ if (!is_null($this->verifyHost)) {
+ $settings[CURLOPT_SSL_VERIFYHOST] = $this->verifyHost;
+ }
return parent::curlRequest($url, $settings);
}
}
diff --git a/lib/private/db.php b/lib/private/db.php
index cfdac766bff..322a13642ae 100644
--- a/lib/private/db.php
+++ b/lib/private/db.php
@@ -313,9 +313,8 @@ class OC_DB {
/**
* @brief Insert a row if a matching row doesn't exists.
- * @param string $table. The table to insert into in the form '*PREFIX*tableName'
- * @param array $input. An array of fieldname/value pairs
- * @param string $table
+ * @param string $table The table to insert into in the form '*PREFIX*tableName'
+ * @param array $input An array of fieldname/value pairs
* @return boolean number of updated rows
*/
public static function insertIfNotExist($table, $input) {
diff --git a/lib/private/defaults.php b/lib/private/defaults.php
index 79be211b82f..fca798568c5 100644
--- a/lib/private/defaults.php
+++ b/lib/private/defaults.php
@@ -29,8 +29,8 @@ class OC_Defaults {
$this->defaultEntity = "ownCloud"; /* e.g. company name, used for footers and copyright notices */
$this->defaultName = "ownCloud"; /* short name, used when referring to the software */
$this->defaultTitle = "ownCloud"; /* can be a longer name, for titles */
- $this->defaultBaseUrl = "http://owncloud.org";
- $this->defaultSyncClientUrl = " http://owncloud.org/sync-clients/";
+ $this->defaultBaseUrl = "https://owncloud.org";
+ $this->defaultSyncClientUrl = "https://owncloud.org/sync-clients/";
$this->defaultDocBaseUrl = "http://doc.owncloud.org";
$this->defaultSlogan = $this->l->t("web services under your control");
$this->defaultLogoClaim = "";
diff --git a/lib/private/filechunking.php b/lib/private/filechunking.php
index 1da02fc81e3..990499e40b4 100644
--- a/lib/private/filechunking.php
+++ b/lib/private/filechunking.php
@@ -70,7 +70,7 @@ class OC_FileChunking {
*
* @param string $f target path
*
- * @return assembled file size
+ * @return integer assembled file size
*
* @throws \OC\InsufficientStorageException when file could not be fully
* assembled due to lack of free space
@@ -91,7 +91,7 @@ class OC_FileChunking {
/**
* Returns the size of the chunks already present
- * @return size in bytes
+ * @return integer size in bytes
*/
public function getCurrentSize() {
$cache = $this->getCache();
@@ -159,7 +159,7 @@ class OC_FileChunking {
*
* @param string $path target path
*
- * @return assembled file size or false if file could not be created
+ * @return boolean assembled file size or false if file could not be created
*
* @throws \OC\InsufficientStorageException when file could not be fully
* assembled due to lack of free space
@@ -216,5 +216,6 @@ class OC_FileChunking {
return false;
}
}
+ return false;
}
}
diff --git a/lib/private/files.php b/lib/private/files.php
index bfe6d3c02da..152595ba697 100644
--- a/lib/private/files.php
+++ b/lib/private/files.php
@@ -231,7 +231,7 @@ class OC_Files {
OC_Template::printErrorPage(
$l->t('ZIP download is turned off.'),
$l->t('Files need to be downloaded one by one.')
- . '<br/><a href="javascript:history.back()">' . $l->t('Back to Files') . '</a>'
+ . '<br/><a href="'.OCP\Util::linkTo('files', 'index.php', array('dir' => $dir)).'">' . $l->t('Back to Files') . '</a>'
);
exit;
}
@@ -258,8 +258,7 @@ class OC_Files {
OC_Template::printErrorPage(
$l->t('Selected files too large to generate zip file.'),
$l->t('Please download the files separately in smaller chunks or kindly ask your administrator.')
- .'<br/><a href="javascript:history.back()">'
- . $l->t('Back to Files') . '</a>'
+ . '<br/><a href="'.OCP\Util::linkTo('files', 'index.php', array('dir' => $dir)).'">' . $l->t('Back to Files') . '</a>'
);
exit;
}
diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php
index 79159724d16..c0bdde06a75 100644
--- a/lib/private/files/cache/scanner.php
+++ b/lib/private/files/cache/scanner.php
@@ -115,11 +115,12 @@ class Scanner extends BasicEmitter {
}
if ($reuseExisting) {
// prevent empty etag
- $etag = $cacheData['etag'];
- $propagateETagChange = false;
- if (empty($etag)) {
+ if (empty($cacheData['etag'])) {
$etag = $data['etag'];
$propagateETagChange = true;
+ } else {
+ $etag = $cacheData['etag'];
+ $propagateETagChange = false;
}
// only reuse data if the file hasn't explicitly changed
if (isset($data['storage_mtime']) && isset($cacheData['storage_mtime']) && $data['storage_mtime'] === $cacheData['storage_mtime']) {
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php
index 7e27650c557..434ee495870 100644
--- a/lib/private/files/filesystem.php
+++ b/lib/private/files/filesystem.php
@@ -374,6 +374,9 @@ class Filesystem {
* Returns path like /admin/files
*/
static public function getRoot() {
+ if (!self::$defaultInstance) {
+ return null;
+ }
return self::$defaultInstance->getRoot();
}
diff --git a/lib/private/files/mount/manager.php b/lib/private/files/mount/manager.php
index ff4a336f347..91460b72730 100644
--- a/lib/private/files/mount/manager.php
+++ b/lib/private/files/mount/manager.php
@@ -24,6 +24,13 @@ class Manager {
}
/**
+ * @param string $mountPoint
+ */
+ public function removeMount($mountPoint) {
+ unset($this->mounts[$mountPoint]);
+ }
+
+ /**
* Find the mount for $path
*
* @param $path
diff --git a/lib/private/files/mount/mount.php b/lib/private/files/mount/mount.php
index 0ce2f5975c7..08d5ddf348b 100644
--- a/lib/private/files/mount/mount.php
+++ b/lib/private/files/mount/mount.php
@@ -66,6 +66,13 @@ class Mount {
}
/**
+ * @param string $mountPoint new mount point
+ */
+ public function setMountPoint($mountPoint) {
+ $this->mountPoint = $mountPoint;
+ }
+
+ /**
* create the storage that is mounted
*
* @return \OC\Files\Storage\Storage
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 2b697141515..8a263d4ce1e 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -118,17 +118,17 @@ abstract class Common implements \OC\Files\Storage\Storage {
if (!$handle) {
return false;
}
- $size = $this->filesize($path);
- if ($size == 0) {
- return '';
- }
- return fread($handle, $size);
+ $data = stream_get_contents($handle);
+ fclose($handle);
+ return $data;
}
public function file_put_contents($path, $data) {
$handle = $this->fopen($path, "w");
$this->removeCachedFile($path);
- return fwrite($handle, $data);
+ $count = fwrite($handle, $data);
+ fclose($handle);
+ return $count;
}
public function rename($path1, $path2) {
@@ -159,9 +159,11 @@ abstract class Common implements \OC\Files\Storage\Storage {
}
public function hash($type, $path, $raw = false) {
- $tmpFile = $this->getLocalFile($path);
- $hash = hash_file($type, $tmpFile, $raw);
- return $hash;
+ $fh = $this->fopen($path, 'rb');
+ $ctx = hash_init($type);
+ hash_update_stream($ctx, $fh);
+ fclose($fh);
+ return hash_final($ctx, $raw);
}
public function search($query) {
@@ -361,6 +363,9 @@ abstract class Common implements \OC\Files\Storage\Storage {
return false;
}
+ /**
+ * @param string $path
+ */
protected function getCachedFile($path) {
if (!isset($this->cachedFiles[$path])) {
$this->cachedFiles[$path] = $this->toTmpFile($path);
diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php
index 571bf7f97c1..ff2949d33b6 100644
--- a/lib/private/files/storage/local.php
+++ b/lib/private/files/storage/local.php
@@ -305,7 +305,11 @@ if (\OC_Util::runningOnWindows()) {
* @return bool
*/
public function hasUpdated($path, $time) {
- return $this->filemtime($path) > $time;
+ if ($this->file_exists($path)) {
+ return $this->filemtime($path) > $time;
+ } else {
+ return true;
+ }
}
/**
diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php
index 94ee28ca763..75582fd6c83 100644
--- a/lib/private/files/storage/mappedlocal.php
+++ b/lib/private/files/storage/mappedlocal.php
@@ -360,6 +360,9 @@ class MappedLocal extends \OC\Files\Storage\Common{
$this->mapper->copy($fullPath1, $fullPath2);
}
+ /**
+ * @param string $path
+ */
private function stripLeading($path) {
if(strpos($path, '/') === 0) {
$path = substr($path, 1);
diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php
index 11e439032ce..8ee53917814 100644
--- a/lib/private/files/type/detection.php
+++ b/lib/private/files/type/detection.php
@@ -17,24 +17,40 @@ namespace OC\Files\Type;
*/
class Detection {
protected $mimetypes = array();
+ protected $secureMimeTypes = array();
/**
- * add an extension -> mimetype mapping
+ * Add an extension -> mimetype mapping
+ *
+ * $mimetype is the assumed correct mime type
+ * The optional $secureMimeType is an alternative to send to send
+ * to avoid potential XSS.
*
* @param string $extension
* @param string $mimetype
+ * @param string|null $secureMimeType
*/
- public function registerType($extension, $mimetype) {
- $this->mimetypes[$extension] = $mimetype;
+ public function registerType($extension, $mimetype, $secureMimeType = null) {
+ $this->mimetypes[$extension] = array($mimetype, $secureMimeType);
+ $this->secureMimeTypes[$mimetype] = $secureMimeType ?: $mimetype;
}
/**
- * add an array of extension -> mimetype mappings
+ * Add an array of extension -> mimetype mappings
+ *
+ * The mimetype value is in itself an array where the first index is
+ * the assumed correct mimetype and the second is either a secure alternative
+ * or null if the correct is considered secure.
*
* @param array $types
*/
public function registerTypeArray($types) {
$this->mimetypes = array_merge($this->mimetypes, $types);
+
+ // Update the alternative mimetypes to avoid having to look them up each time.
+ foreach ($this->mimetypes as $mimeType) {
+ $this->secureMimeTypes[$mimeType[0]] = $mimeType[1] ?: $mimeType[0];
+ }
}
/**
@@ -48,7 +64,9 @@ class Detection {
//try to guess the type by the file extension
$extension = strtolower(strrchr(basename($path), "."));
$extension = substr($extension, 1); //remove leading .
- return (isset($this->mimetypes[$extension])) ? $this->mimetypes[$extension] : 'application/octet-stream';
+ return (isset($this->mimetypes[$extension]) && isset($this->mimetypes[$extension][0]))
+ ? $this->mimetypes[$extension][0]
+ : 'application/octet-stream';
} else {
return 'application/octet-stream';
}
@@ -123,4 +141,16 @@ class Detection {
return $mime;
}
}
+
+ /**
+ * Get a secure mimetype that won't expose potential XSS.
+ *
+ * @param string $mimeType
+ * @return string
+ */
+ public function getSecureMimeType($mimeType) {
+ return isset($this->secureMimeTypes[$mimeType])
+ ? $this->secureMimeTypes[$mimeType]
+ : 'application/octet-stream';
+ }
}
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 90b0da09c37..31ec8cfacff 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -348,7 +348,8 @@ class View {
$postFix = (substr($path, -1, 1) === '/') ? '/' : '';
$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
- if (!$internalPath || $internalPath === '' || $internalPath === '/') {
+ if (!($storage instanceof \OC\Files\Storage\Shared) &&
+ (!$internalPath || $internalPath === '' || $internalPath === '/')) {
// do not allow deleting the storage's root / the mount point
// because for some storages it might delete the whole contents
// but isn't supposed to work that way
@@ -404,11 +405,21 @@ class View {
if ($run) {
$mp1 = $this->getMountPoint($path1 . $postFix1);
$mp2 = $this->getMountPoint($path2 . $postFix2);
- if ($mp1 == $mp2) {
- list($storage, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
- list(, $internalPath2) = Filesystem::resolvePath($absolutePath2 . $postFix2);
- if ($storage) {
- $result = $storage->rename($internalPath1, $internalPath2);
+ list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
+ list(, $internalPath2) = Filesystem::resolvePath($absolutePath2 . $postFix2);
+ // if source and target are on the same storage we can call the rename operation from the
+ // storage. If it is a "Shared" file/folder we call always the rename operation of the
+ // shared storage to handle mount point renaming, etc correctly
+ if ($storage1 instanceof \OC\Files\Storage\Shared) {
+ if ($storage1) {
+ $result = $storage1->rename($absolutePath1, $absolutePath2);
+ \OC_FileProxy::runPostProxies('rename', $absolutePath1, $absolutePath2);
+ } else {
+ $result = false;
+ }
+ } elseif ($mp1 == $mp2) {
+ if ($storage1) {
+ $result = $storage1->rename($internalPath1, $internalPath2);
\OC_FileProxy::runPostProxies('rename', $absolutePath1, $absolutePath2);
} else {
$result = false;
@@ -417,7 +428,6 @@ class View {
if ($this->is_dir($path1)) {
$result = $this->copy($path1, $path2);
if ($result === true) {
- list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
$result = $storage1->unlink($internalPath1);
}
} else {
@@ -431,7 +441,6 @@ class View {
fclose($target);
if ($result !== false) {
- list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
$storage1->unlink($internalPath1);
}
}
@@ -629,10 +638,21 @@ class View {
}
public function fromTmpFile($tmpFile, $path) {
+
if (Filesystem::isValidPath($path)) {
+
+ // Get directory that the file is going into
+ $filePath = dirname($path);
+
+ // Create the directories if any
+ if (!$this->file_exists($filePath)) {
+ $this->mkdir($filePath);
+ }
+
if (!$tmpFile) {
debug_print_backtrace();
}
+
$source = fopen($tmpFile, 'r');
if ($source) {
$this->file_put_contents($path, $source);
@@ -832,6 +852,9 @@ class View {
$user = \OC_User::getUser();
if (!$cache->inCache($internalPath)) {
+ if (!$storage->file_exists($internalPath)) {
+ return false;
+ }
$scanner = $storage->getScanner($internalPath);
$scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
} else {
@@ -958,8 +981,13 @@ class View {
$permissions = $subStorage->getPermissions($rootEntry['path']);
$subPermissionsCache->set($rootEntry['fileid'], $user, $permissions);
}
- // do not allow renaming/deleting the mount point
- $rootEntry['permissions'] = $permissions & (\OCP\PERMISSION_ALL - (\OCP\PERMISSION_UPDATE | \OCP\PERMISSION_DELETE));
+ // do not allow renaming/deleting the mount point if they are not shared files/folders
+ // for shared files/folders we use the permissions given by the owner
+ if ($subStorage instanceof \OC\Files\Storage\Shared) {
+ $rootEntry['permissions'] = $permissions;
+ } else {
+ $rootEntry['permissions'] = $permissions & (\OCP\PERMISSION_ALL - (\OCP\PERMISSION_UPDATE | \OCP\PERMISSION_DELETE));
+ }
//remove any existing entry with the same name
foreach ($files as $i => $file) {
@@ -968,6 +996,7 @@ class View {
break;
}
}
+ $rootEntry['path'] = substr($path . '/' . $rootEntry['name'], strlen($user) + 2); // full path without /$user/
$files[] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry);
}
}
@@ -1081,8 +1110,9 @@ class View {
if ($results) {
foreach ($results as $result) {
$internalPath = $result['path'];
- $result['path'] = $relativeMountPoint . $result['path'];
- $files[] = new FileInfo($mountPoint . $result['path'], $storage, $internalPath, $result);
+ $result['path'] = rtrim($relativeMountPoint . $result['path'], '/');
+ $path = rtrim($mountPoint . $internalPath, '/');
+ $files[] = new FileInfo($path, $storage, $internalPath, $result);
}
}
}
@@ -1140,7 +1170,8 @@ class View {
* @var \OC\Files\Mount\Mount $mount
*/
$cache = $mount->getStorage()->getCache();
- if ($internalPath = $cache->getPathById($id)) {
+ $internalPath = $cache->getPathById($id);
+ if (is_string($internalPath)) {
$fullPath = $mount->getMountPoint() . $internalPath;
if (!is_null($path = $this->getRelativePath($fullPath))) {
return $path;
diff --git a/lib/private/geo.php b/lib/private/geo.php
index 7094d885af6..cd62511f0c1 100644
--- a/lib/private/geo.php
+++ b/lib/private/geo.php
@@ -6,15 +6,11 @@
* See the COPYING-README file.
*/
class OC_Geo{
- /*
- * @brief returns the closest timezone to coordinates
- * @param (string) $latitude - Latitude
- * @param (string) $longitude - Longitude
- * @return (string) $timezone - closest timezone
- */
/**
- * @param integer $latitude
- * @param integer $longitude
+ * @brief returns the closest timezone to coordinates
+ * @param $latitude
+ * @param $longitude
+ * @return mixed Closest timezone
*/
public static function timezone($latitude, $longitude) {
$alltimezones = DateTimeZone::listIdentifiers();
diff --git a/lib/private/group.php b/lib/private/group.php
index 4c187b538af..d9f430f833b 100644
--- a/lib/private/group.php
+++ b/lib/private/group.php
@@ -200,6 +200,9 @@ class OC_Group {
/**
* @brief get a list of all groups
+ * @param string $search
+ * @param int|null $limit
+ * @param int|null $offset
* @returns array with group names
*
* Returns a list with all groups
@@ -225,6 +228,10 @@ class OC_Group {
/**
* @brief get a list of all users in a group
+ * @param string $gid
+ * @param string $search
+ * @param int $limit
+ * @param int $offset
* @returns array with user ids
*/
public static function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
@@ -260,6 +267,10 @@ class OC_Group {
/**
* @brief get a list of all display names in a group
+ * @param string $gid
+ * @param string $search
+ * @param int $limit
+ * @param int $offset
* @returns array with display names (value) and user ids(key)
*/
public static function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) {
diff --git a/lib/private/group/backend.php b/lib/private/group/backend.php
index 2e17b5d0b7f..b0ed0d90d76 100644
--- a/lib/private/group/backend.php
+++ b/lib/private/group/backend.php
@@ -34,6 +34,7 @@ define('OC_GROUP_BACKEND_DELETE_GROUP', 0x00000010);
define('OC_GROUP_BACKEND_ADD_TO_GROUP', 0x00000100);
define('OC_GROUP_BACKEND_REMOVE_FROM_GOUP', 0x00001000);
define('OC_GROUP_BACKEND_GET_DISPLAYNAME', 0x00010000);
+define('OC_GROUP_BACKEND_COUNT_USERS', 0x00100000);
/**
* Abstract base class for user management
@@ -45,6 +46,7 @@ abstract class OC_Group_Backend implements OC_Group_Interface {
OC_GROUP_BACKEND_ADD_TO_GROUP => 'addToGroup',
OC_GROUP_BACKEND_REMOVE_FROM_GOUP => 'removeFromGroup',
OC_GROUP_BACKEND_GET_DISPLAYNAME => 'displayNamesInGroup',
+ OC_GROUP_BACKEND_COUNT_USERS => 'countUsersInGroup',
);
/**
diff --git a/lib/private/group/database.php b/lib/private/group/database.php
index d0974685ff6..3815dcff2e5 100644
--- a/lib/private/group/database.php
+++ b/lib/private/group/database.php
@@ -212,6 +212,20 @@ class OC_Group_Database extends OC_Group_Backend {
}
/**
+ * @brief get the number of all users matching the search string in a group
+ * @param string $gid
+ * @param string $search
+ * @param int $limit
+ * @param int $offset
+ * @return int | false
+ */
+ public function countUsersInGroup($gid, $search = '') {
+ $stmt = OC_DB::prepare('SELECT COUNT(`uid`) AS `count` FROM `*PREFIX*group_user` WHERE `gid` = ? AND `uid` LIKE ?');
+ $result = $stmt->execute(array($gid, $search.'%'));
+ return $result->fetchOne();
+ }
+
+ /**
* @brief get a list of all display names in a group
* @param string $gid
* @param string $search
diff --git a/lib/private/group/dummy.php b/lib/private/group/dummy.php
index da26e1b910e..94cbb607ad1 100644
--- a/lib/private/group/dummy.php
+++ b/lib/private/group/dummy.php
@@ -157,4 +157,14 @@ class OC_Group_Dummy extends OC_Group_Backend {
}
}
+ /**
+ * @brief get the number of all users in a group
+ * @returns int | bool
+ */
+ public function countUsersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
+ if(isset($this->groups[$gid])) {
+ return count($this->groups[$gid]);
+ }
+ }
+
}
diff --git a/lib/private/group/group.php b/lib/private/group/group.php
index 8d2aa87a788..3efbb6e7023 100644
--- a/lib/private/group/group.php
+++ b/lib/private/group/group.php
@@ -172,12 +172,6 @@ class Group {
$users = array();
foreach ($this->backends as $backend) {
$userIds = $backend->usersInGroup($this->gid, $search, $limit, $offset);
- if (!is_null($limit)) {
- $limit -= count($userIds);
- }
- if (!is_null($offset)) {
- $offset -= count($userIds);
- }
$users += $this->getVerifiedUsers($userIds);
if (!is_null($limit) and $limit <= 0) {
return array_values($users);
@@ -187,6 +181,27 @@ class Group {
}
/**
+ * returns the number of users matching the search string
+ *
+ * @param string $search
+ * @return int | bool
+ */
+ public function count($search) {
+ $users = false;
+ foreach ($this->backends as $backend) {
+ if($backend->implementsActions(OC_GROUP_BACKEND_COUNT_USERS)) {
+ if($users === false) {
+ //we could directly add to a bool variable, but this would
+ //be ugly
+ $users = 0;
+ }
+ $users += $backend->countUsersInGroup($this->gid, $search);
+ }
+ }
+ return $users;
+ }
+
+ /**
* search for users in the group by displayname
*
* @param string $search
@@ -202,12 +217,6 @@ class Group {
} else {
$userIds = $backend->usersInGroup($this->gid, $search, $limit, $offset);
}
- if (!is_null($limit)) {
- $limit -= count($userIds);
- }
- if (!is_null($offset)) {
- $offset -= count($userIds);
- }
$users = $this->getVerifiedUsers($userIds);
if (!is_null($limit) and $limit <= 0) {
return array_values($users);
diff --git a/lib/private/group/manager.php b/lib/private/group/manager.php
index 9b433b64fd4..f591bd32aba 100644
--- a/lib/private/group/manager.php
+++ b/lib/private/group/manager.php
@@ -134,12 +134,6 @@ class Manager extends PublicEmitter {
$groups = array();
foreach ($this->backends as $backend) {
$groupIds = $backend->getGroups($search, $limit, $offset);
- if (!is_null($limit)) {
- $limit -= count($groupIds);
- }
- if (!is_null($offset)) {
- $offset -= count($groupIds);
- }
foreach ($groupIds as $groupId) {
$groups[$groupId] = $this->getGroupObject($groupId);
}
diff --git a/lib/private/helper.php b/lib/private/helper.php
index d7ac0b5f4fa..ab1e0d38924 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -36,7 +36,7 @@ class OC_Helper {
* @param array $parameters
* @return
* @internal param array $args with param=>value, will be appended to the returned url
- * @returns the url
+ * @returns string the url
*
* Returns a url to the given app and file.
*/
@@ -431,6 +431,16 @@ class OC_Helper {
}
/**
+ * Get a secure mimetype that won't expose potential XSS.
+ *
+ * @param string $mimeType
+ * @return string
+ */
+ static function getSecureMimeType($mimeType) {
+ return self::getMimetypeDetector()->getSecureMimeType($mimeType);
+ }
+
+ /**
* get the mimetype form a data string
*
* @param string $data
@@ -875,12 +885,15 @@ class OC_Helper {
* Calculate the disc space for the given path
*
* @param string $path
+ * @param \OCP\Files\FileInfo $rootInfo (optional)
* @return array
*/
- public static function getStorageInfo($path) {
+ public static function getStorageInfo($path, $rootInfo = null) {
// return storage info without adding mount points
- $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false);
- $used = $rootInfo['size'];
+ if (is_null($rootInfo)) {
+ $rootInfo = \OC\Files\Filesystem::getFileInfo($path, false);
+ }
+ $used = $rootInfo->getSize();
if ($used < 0) {
$used = 0;
}
diff --git a/lib/private/image.php b/lib/private/image.php
index c987ce92c3c..14aa64d12da 100644
--- a/lib/private/image.php
+++ b/lib/private/image.php
@@ -34,7 +34,7 @@ class OC_Image {
/**
* @brief Get mime type for an image file.
- * @param string|null $filepath The path to a local image file.
+ * @param string|null $filePath The path to a local image file.
* @return string The mime type if the it could be determined, otherwise an empty string.
*/
static public function getMimeTypeForFile($filePath) {
@@ -49,7 +49,7 @@ class OC_Image {
/**
* @brief Constructor.
- * @param resource|string $imageref The path to a local file, a base64 encoded string or a resource created by
+ * @param resource|string $imageRef The path to a local file, a base64 encoded string or a resource created by
* an imagecreate* function.
* @return \OC_Image False on error
*/
@@ -79,7 +79,7 @@ class OC_Image {
/**
* @brief Returns the MIME type of the image or an empty string if no image is loaded.
- * @return int
+ * @return string
*/
public function mimeType() {
return $this->valid() ? $this->mimeType : '';
@@ -397,7 +397,7 @@ class OC_Image {
/**
* @brief Loads an image from a local file, a base64 encoded string or a resource created by an imagecreate* function.
- * @param resource|string $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function or a file resource (file handle ).
+ * @param resource|string $imageRef The path to a local file, a base64 encoded string or a resource created by an imagecreate* function or a file resource (file handle ).
* @return resource|false An image resource or false on error
*/
public function load($imageRef) {
diff --git a/lib/private/json.php b/lib/private/json.php
index 4ccdb490a6c..4634d7adfea 100644
--- a/lib/private/json.php
+++ b/lib/private/json.php
@@ -43,8 +43,7 @@ class OC_JSON{
}
/**
- * @brief Check an ajax get/post call if the request token is valid.
- * @return json Error msg if not valid.
+ * Check an ajax get/post call if the request token is valid, send json error msg if not.
*/
public static function callCheck() {
if( !OC_Util::isCallRegistered()) {
@@ -55,7 +54,7 @@ class OC_JSON{
}
/**
- * Check if the user is a admin, send json error msg if not
+ * Check if the user is a admin, send json error msg if not.
*/
public static function checkAdminUser() {
if( !OC_User::isAdminUser(OC_User::getUser())) {
@@ -119,8 +118,6 @@ class OC_JSON{
* Encode and print $data in json format
*/
public static function encodedPrint($data, $setContentType=true) {
- // Disable mimesniffing, don't move this to setContentTypeHeader!
- header( 'X-Content-Type-Options: nosniff' );
if($setContentType) {
self::setContentTypeHeader();
}
diff --git a/lib/private/l10n.php b/lib/private/l10n.php
index 197b2d6791b..c7e4328161e 100644
--- a/lib/private/l10n.php
+++ b/lib/private/l10n.php
@@ -75,7 +75,7 @@ class OC_L10N implements \OCP\IL10N {
* get an L10N instance
* @param string $app
* @param string|null $lang
- * @return OC_L10N
+ * @return \OC_L10N
*/
public static function get($app, $lang=null) {
if (is_null($lang)) {
@@ -89,7 +89,6 @@ class OC_L10N implements \OCP\IL10N {
* @brief The constructor
* @param string $app app requesting l10n
* @param string $lang default: null Language
- * @returns OC_L10N-Object
*
* If language is not set, the constructor tries to find the right
* language.
@@ -268,43 +267,18 @@ class OC_L10N implements \OCP\IL10N {
$identifier = "_${text_singular}_::_${text_plural}_";
if( array_key_exists($identifier, $this->translations)) {
return new OC_L10N_String( $this, $identifier, $parameters, $count );
- }
- else{
+ }else{
if($count === 1) {
return new OC_L10N_String($this, $text_singular, $parameters, $count);
- }
- else{
+ }else{
return new OC_L10N_String($this, $text_plural, $parameters, $count);
}
}
}
/**
- * @brief Translating
- * @param $textArray The text array we need a translation for
- * @returns Translation or the same text
- *
- * Returns the translation. If no translation is found, $textArray will be
- * returned.
- *
- *
- * @deprecated deprecated since ownCloud version 5.0
- * This method will probably be removed with ownCloud 6.0
- *
- *
- */
- public function tA($textArray) {
- OC_Log::write('core', 'DEPRECATED: the method tA is deprecated and will be removed soon.', OC_Log::WARN);
- $result = array();
- foreach($textArray as $key => $text) {
- $result[$key] = (string)$this->t($text);
- }
- return $result;
- }
-
- /**
* @brief getTranslations
- * @returns Fetch all translations
+ * @returns array Fetch all translations
*
* Returns an associative array with all translations
*/
@@ -340,7 +314,7 @@ class OC_L10N implements \OCP\IL10N {
/**
* @brief get localizations
- * @returns Fetch all localizations
+ * @returns array Fetch all localizations
*
* Returns an associative array with all localizations
*/
@@ -352,7 +326,7 @@ class OC_L10N implements \OCP\IL10N {
/**
* @brief Localization
* @param string $type Type of localization
- * @param $params parameters for this localization
+ * @param array $data parameters for this localization
* @returns String or false
*
* Returns the localized data.
@@ -420,6 +394,14 @@ class OC_L10N implements \OCP\IL10N {
}
/**
+ * The given language is forced to be used while executing the current request
+ * @param string $lang
+ */
+ public static function forceLanguage($lang) {
+ self::$language = $lang;
+ }
+
+ /**
* @brief find the best language
* @param array|string $app details below
* @returns string language
diff --git a/lib/private/legacy/appconfig.php b/lib/private/legacy/appconfig.php
index b6c3542a673..cb5cef7e350 100644
--- a/lib/private/legacy/appconfig.php
+++ b/lib/private/legacy/appconfig.php
@@ -116,8 +116,6 @@ class OC_Appconfig {
/**
* get multiply values, either the app or key can be used as wildcard by setting it to false
*
- * @param app
- * @param key
* @param string|false $app
* @param string|false $key
* @return array
diff --git a/lib/private/legacy/config.php b/lib/private/legacy/config.php
index ab67c8d3020..6c2103179ab 100644
--- a/lib/private/legacy/config.php
+++ b/lib/private/legacy/config.php
@@ -63,8 +63,8 @@ class OC_Config {
/**
* @brief Gets a value from config.php
* @param string $key key
- * @param string $default = null default value
- * @return string the value or $default
+ * @param mixed $default = null default value
+ * @return mixed the value or $default
*
* This function gets the value from config.php. If it does not exist,
* $default will be returned.
@@ -76,7 +76,7 @@ class OC_Config {
/**
* @brief Sets a value
* @param string $key key
- * @param string $value value
+ * @param mixed $value value
*
* This function sets the value and writes the config.php.
*
diff --git a/lib/private/migrate.php b/lib/private/migrate.php
index 3fb3e334ea2..5bcc11b061b 100644
--- a/lib/private/migrate.php
+++ b/lib/private/migrate.php
@@ -69,9 +69,9 @@ class OC_Migrate{
/**
* @brief exports a user, or owncloud instance
- * @param optional $uid string user id of user to export if export type is user, defaults to current
- * @param ootional $type string type of export, defualts to user
- * @param otional $path string path to zip output folder
+ * @param string $uid user id of user to export if export type is user, defaults to current
+ * @param string $type type of export, defualts to user
+ * @param string $path path to zip output folder
* @return string on error, path to zip on success
*/
public static function export( $uid=null, $type='user', $path=null ) {
@@ -192,11 +192,12 @@ class OC_Migrate{
}
/**
- * @brief imports a user, or owncloud instance
- * @param $path string path to zip
- * @param optional $type type of import (user or instance)
- * @param optional $uid userid of new user
- */
+ * @brief imports a user, or owncloud instance
+ * @param string $path path to zip
+ * @param string $type type of import (user or instance)
+ * @param string|null|int $uid userid of new user
+ * @return string
+ */
public static function import( $path, $type='user', $uid=null ) {
$datadir = OC_Config::getValue( 'datadirectory' );
@@ -307,8 +308,8 @@ class OC_Migrate{
/**
* @brief recursively deletes a directory
- * @param string $dir string path of dir to delete
- * $param optional $deleteRootToo bool delete the root directory
+ * @param string $dir path of dir to delete
+ * @param bool $deleteRootToo delete the root directory
* @return bool
*/
private static function unlink_r( $dir, $deleteRootToo=true ) {
@@ -406,7 +407,7 @@ class OC_Migrate{
/**
* @brief generates json containing export info, and merges any data supplied
- * @param optional $array array of data to include in the returned json
+ * @param array $array of data to include in the returned json
* @return string
*/
static private function getExportInfo( $array=array() ) {
@@ -430,8 +431,7 @@ class OC_Migrate{
/**
* @brief connects to migration.db, or creates if not found
- * @param $db optional path to migration.db, defaults to user data dir
- * @param string $path
+ * @param string $path to migration.db, defaults to user data dir
* @return bool whether the operation was successful
*/
static private function connectDB( $path=null ) {
@@ -461,7 +461,7 @@ class OC_Migrate{
/**
* @brief creates the tables in migration.db from an apps database.xml
- * @param string $appid string id of the app
+ * @param string $appid id of the app
* @return bool whether the operation was successful
*/
static private function createAppTables( $appid ) {
@@ -499,7 +499,6 @@ class OC_Migrate{
/**
* @brief tries to create the zip
- * @param $path string path to zip destination
* @return bool
*/
static private function createZip() {
@@ -538,7 +537,7 @@ class OC_Migrate{
* @brief imports a new user
* @param string $db string path to migration.db
* @param $info object of migration info
- * @param $uid optional uid to use
+ * @param string|null|int $uid uid to use
* @return array of apps with import statuses, or false on failure.
*/
public static function importAppData( $db, $info, $uid=null ) {
@@ -601,10 +600,10 @@ class OC_Migrate{
}
- /*
- * @brief creates a new user in the database
- * @param $uid string user_id of the user to be created
- * @param $hash string hash of the user to be created
+ /**
+ * creates a new user in the database
+ * @param string $uid user_id of the user to be created
+ * @param string $hash hash of the user to be created
* @return bool result of user creation
*/
public static function createUser( $uid, $hash ) {
diff --git a/lib/private/migration/content.php b/lib/private/migration/content.php
index 43eba89b8d5..b0e7a4e9528 100644
--- a/lib/private/migration/content.php
+++ b/lib/private/migration/content.php
@@ -36,7 +36,7 @@ class OC_Migration_Content{
* @brief sets up the
* @param ZipArchive $zip ZipArchive object
* @param $db a database object (required for exporttype user)
- * @return boolean|null
+ * @return bool|null
*/
public function __construct( $zip, $db=null ) {
diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php
index 91bcf584267..3fe454f41f1 100644
--- a/lib/private/mimetypes.list.php
+++ b/lib/private/mimetypes.list.php
@@ -22,111 +22,116 @@
/**
* Array mapping file extensions to mimetypes (in alphabetical order).
+ *
+ * The first index in the mime type array is the assumed correct mimetype
+ * and the second is either a secure alternative or null if the correct
+ * is considered secure.
*/
return array(
- '7z' => 'application/x-7z-compressed',
- 'accdb' => 'application/msaccess',
- 'ai' => 'application/illustrator',
- 'avi' => 'video/x-msvideo',
- 'bash' => 'text/x-shellscript',
- 'blend' => 'application/x-blender',
- 'bin' => 'application/x-bin',
- 'bmp' => 'image/bmp',
- 'cb7' => 'application/x-cbr',
- 'cba' => 'application/x-cbr',
- 'cbr' => 'application/x-cbr',
- 'cbt' => 'application/x-cbr',
- 'cbtc' => 'application/x-cbr',
- 'cbz' => 'application/x-cbr',
- 'cc' => 'text/x-c',
- 'cdr' => 'application/coreldraw',
- 'cpp' => 'text/x-c++src',
- 'css' => 'text/css',
- 'csv' => 'text/csv',
- 'cvbdl' => 'application/x-cbr',
- 'c' => 'text/x-c',
- 'c++' => 'text/x-c++src',
- 'deb' => 'application/x-deb',
- 'doc' => 'application/msword',
- 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
- 'dot' => 'application/msword',
- 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
- 'dv' => 'video/dv',
- 'eot' => 'application/vnd.ms-fontobject',
- 'epub' => 'application/epub+zip',
- 'exe' => 'application/x-ms-dos-executable',
- 'flac' => 'audio/flac',
- 'gif' => 'image/gif',
- 'gz' => 'application/x-gzip',
- 'gzip' => 'application/x-gzip',
- 'html' => 'text/html',
- 'htm' => 'text/html',
- 'ical' => 'text/calendar',
- 'ics' => 'text/calendar',
- 'impress' => 'text/impress',
- 'jpeg' => 'image/jpeg',
- 'jpg' => 'image/jpeg',
- 'js' => 'application/javascript',
- 'json' => 'application/json',
- 'keynote' => 'application/x-iwork-keynote-sffkey',
- 'kra' => 'application/x-krita',
- 'm2t' => 'video/mp2t',
- 'm4v' => 'video/mp4',
- 'markdown' => 'text/markdown',
- 'mdown' => 'text/markdown',
- 'md' => 'text/markdown',
- 'mdb' => 'application/msaccess',
- 'mdwn' => 'text/markdown',
- 'mkv' => 'video/x-matroska',
- 'mobi' => 'application/x-mobipocket-ebook',
- 'mov' => 'video/quicktime',
- 'mp3' => 'audio/mpeg',
- 'mp4' => 'video/mp4',
- 'mpeg' => 'video/mpeg',
- 'mpg' => 'video/mpeg',
- 'msi' => 'application/x-msi',
- 'numbers' => 'application/x-iwork-numbers-sffnumbers',
- 'odg' => 'application/vnd.oasis.opendocument.graphics',
- 'odp' => 'application/vnd.oasis.opendocument.presentation',
- 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
- 'odt' => 'application/vnd.oasis.opendocument.text',
- 'oga' => 'audio/ogg',
- 'ogg' => 'audio/ogg',
- 'ogv' => 'video/ogg',
- 'otf' => 'font/opentype',
- 'pages' => 'application/x-iwork-pages-sffpages',
- 'pdf' => 'application/pdf',
- 'php' => 'application/x-php',
- 'pl' => 'application/x-perl',
- 'png' => 'image/png',
- 'ppt' => 'application/mspowerpoint',
- 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
- 'psd' => 'application/x-photoshop',
- 'py' => 'text/x-python',
- 'rar' => 'application/x-rar-compressed',
- 'reveal' => 'text/reveal',
- 'sgf' => 'application/sgf',
- 'sh-lib' => 'text/x-shellscript',
- 'sh' => 'text/x-shellscript',
- 'svg' => 'image/svg+xml',
- 'swf' => 'application/x-shockwave-flash',
- 'tar' => 'application/x-tar',
- 'tar.gz' => 'application/x-compressed',
- 'tex' => 'application/x-tex',
- 'tgz' => 'application/x-compressed',
- 'tiff' => 'image/tiff',
- 'tif' => 'image/tiff',
- 'ttf' => 'application/x-font-ttf',
- 'txt' => 'text/plain',
- 'vcard' => 'text/vcard',
- 'vcf' => 'text/vcard',
- 'wav' => 'audio/wav',
- 'webm' => 'video/webm',
- 'woff' => 'application/font-woff',
- 'wmv' => 'video/x-ms-asf',
- 'xcf' => 'application/x-gimp',
- 'xls' => 'application/msexcel',
- 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
- 'xml' => 'application/xml',
- 'zip' => 'application/zip',
+ '7z' => array('application/x-7z-compressed', null),
+ 'accdb' => array('application/msaccess', null),
+ 'ai' => array('application/illustrator', null),
+ 'avi' => array('video/x-msvideo', null),
+ 'bash' => array('text/x-shellscript', null),
+ 'blend' => array('application/x-blender', null),
+ 'bin' => array('application/x-bin', null),
+ 'bmp' => array('image/bmp', null),
+ 'cb7' => array('application/x-cbr', null),
+ 'cba' => array('application/x-cbr', null),
+ 'cbr' => array('application/x-cbr', null),
+ 'cbt' => array('application/x-cbr', null),
+ 'cbtc' => array('application/x-cbr', null),
+ 'cbz' => array('application/x-cbr', null),
+ 'cc' => array('text/x-c', null),
+ 'cdr' => array('application/coreldraw', null),
+ 'cpp' => array('text/x-c++src', null),
+ 'css' => array('text/css', null),
+ 'csv' => array('text/csv', null),
+ 'cvbdl' => array('application/x-cbr', null),
+ 'c' => array('text/x-c', null),
+ 'c++' => array('text/x-c++src', null),
+ 'deb' => array('application/x-deb', null),
+ 'doc' => array('application/msword', null),
+ 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', null),
+ 'dot' => array('application/msword', null),
+ 'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.template', null),
+ 'dv' => array('video/dv', null),
+ 'eot' => array('application/vnd.ms-fontobject', null),
+ 'epub' => array('application/epub+zip', null),
+ 'exe' => array('application/x-ms-dos-executable', null),
+ 'flac' => array('audio/flac', null),
+ 'flv' => array('video/x-flv', null),
+ 'gif' => array('image/gif', null),
+ 'gz' => array('application/x-gzip', null),
+ 'gzip' => array('application/x-gzip', null),
+ 'html' => array('text/html', 'text/plain'),
+ 'htm' => array('text/html', 'text/plain'),
+ 'ical' => array('text/calendar', null),
+ 'ics' => array('text/calendar', null),
+ 'impress' => array('text/impress', null),
+ 'jpeg' => array('image/jpeg', null),
+ 'jpg' => array('image/jpeg', null),
+ 'js' => array('application/javascript', 'text/plain'),
+ 'json' => array('application/json', 'text/plain'),
+ 'keynote' => array('application/x-iwork-keynote-sffkey', null),
+ 'kra' => array('application/x-krita', null),
+ 'm2t' => array('video/mp2t', null),
+ 'm4v' => array('video/mp4', null),
+ 'markdown' => array('text/markdown', null),
+ 'mdown' => array('text/markdown', null),
+ 'md' => array('text/markdown', null),
+ 'mdb' => array('application/msaccess', null),
+ 'mdwn' => array('text/markdown', null),
+ 'mkv' => array('video/x-matroska', null),
+ 'mobi' => array('application/x-mobipocket-ebook', null),
+ 'mov' => array('video/quicktime', null),
+ 'mp3' => array('audio/mpeg', null),
+ 'mp4' => array('video/mp4', null),
+ 'mpeg' => array('video/mpeg', null),
+ 'mpg' => array('video/mpeg', null),
+ 'msi' => array('application/x-msi', null),
+ 'numbers' => array('application/x-iwork-numbers-sffnumbers', null),
+ 'odg' => array('application/vnd.oasis.opendocument.graphics', null),
+ 'odp' => array('application/vnd.oasis.opendocument.presentation', null),
+ 'ods' => array('application/vnd.oasis.opendocument.spreadsheet', null),
+ 'odt' => array('application/vnd.oasis.opendocument.text', null),
+ 'oga' => array('audio/ogg', null),
+ 'ogg' => array('audio/ogg', null),
+ 'ogv' => array('video/ogg', null),
+ 'otf' => array('font/opentype', null),
+ 'pages' => array('application/x-iwork-pages-sffpages', null),
+ 'pdf' => array('application/pdf', null),
+ 'php' => array('application/x-php', null),
+ 'pl' => array('application/x-perl', null),
+ 'png' => array('image/png', null),
+ 'ppt' => array('application/mspowerpoint', null),
+ 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', null),
+ 'psd' => array('application/x-photoshop', null),
+ 'py' => array('text/x-python', null),
+ 'rar' => array('application/x-rar-compressed', null),
+ 'reveal' => array('text/reveal', null),
+ 'sgf' => array('application/sgf', null),
+ 'sh-lib' => array('text/x-shellscript', null),
+ 'sh' => array('text/x-shellscript', null),
+ 'svg' => array('image/svg+xml', 'text/plain'),
+ 'swf' => array('application/x-shockwave-flash', 'application/octet-stream'),
+ 'tar' => array('application/x-tar', null),
+ 'tar.gz' => array('application/x-compressed', null),
+ 'tex' => array('application/x-tex', null),
+ 'tgz' => array('application/x-compressed', null),
+ 'tiff' => array('image/tiff', null),
+ 'tif' => array('image/tiff', null),
+ 'ttf' => array('application/x-font-ttf', null),
+ 'txt' => array('text/plain', null),
+ 'vcard' => array('text/vcard', null),
+ 'vcf' => array('text/vcard', null),
+ 'wav' => array('audio/wav', null),
+ 'webm' => array('video/webm', null),
+ 'woff' => array('application/font-woff', null),
+ 'wmv' => array('video/x-ms-asf', null),
+ 'xcf' => array('application/x-gimp', null),
+ 'xls' => array('application/msexcel', null),
+ 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', null),
+ 'xml' => array('application/xml', 'text/plain'),
+ 'zip' => array('application/zip', null),
);
diff --git a/lib/private/ocs.php b/lib/private/ocs.php
index bbe965ce561..211e8222145 100644
--- a/lib/private/ocs.php
+++ b/lib/private/ocs.php
@@ -39,6 +39,7 @@ class OC_OCS {
* @return string Data or if the key is not found and no default is set it will exit with a 400 Bad request
*/
public static function readData($method, $key, $type = 'raw', $default = null) {
+ $data = false;
if ($method == 'get') {
if (isset($_GET[$key])) {
$data = $_GET[$key];
@@ -107,19 +108,19 @@ class OC_OCS {
/**
- * generates the xml or json response for the API call from an multidimenional data array.
- * @param string $format
- * @param string $status
- * @param string $statuscode
- * @param string $message
- * @param array $data
- * @param string $tag
- * @param string $tagattribute
- * @param int $dimension
- * @param int $itemscount
- * @param int $itemsperpage
- * @return string xml/json
- */
+ * generates the xml or json response for the API call from an multidimenional data array.
+ * @param string $format
+ * @param string $status
+ * @param string $statuscode
+ * @param string $message
+ * @param array $data
+ * @param string $tag
+ * @param string $tagattribute
+ * @param int $dimension
+ * @param int|string $itemscount
+ * @param int|string $itemsperpage
+ * @return string xml/json
+ */
private static function generateXml($format, $status, $statuscode,
$message, $data=array(), $tag='', $tagattribute='', $dimension=-1, $itemscount='', $itemsperpage='') {
if($format=='json') {
@@ -212,6 +213,8 @@ class OC_OCS {
}
/**
+ * @param $writer
+ * @param $data
* @param string $node
*/
public static function toXml($writer, $data, $node) {
diff --git a/lib/private/ocs/cloud.php b/lib/private/ocs/cloud.php
index 06d6a8eb4b0..c8bb9425f1a 100644
--- a/lib/private/ocs/cloud.php
+++ b/lib/private/ocs/cloud.php
@@ -99,31 +99,4 @@ class OC_OCS_Cloud {
);
return new OC_OCS_Result($data);
}
-
- public static function getUserPublickey($parameters) {
-
- if(OC_User::userExists($parameters['user'])) {
- // calculate the disc space
- // TODO
- return new OC_OCS_Result(array());
- } else {
- return new OC_OCS_Result(null, 300);
- }
- }
-
- public static function getUserPrivatekey($parameters) {
- $user = OC_User::getUser();
- if(OC_User::isAdminUser($user) or ($user==$parameters['user'])) {
-
- if(OC_User::userExists($user)) {
- // calculate the disc space
- $txt = 'this is the private key of '.$parameters['user'];
- echo($txt);
- } else {
- return new OC_OCS_Result(null, 300, 'User does not exist');
- }
- } else {
- return new OC_OCS_Result('null', 300, 'You don´t have permission to access this ressource.');
- }
- }
}
diff --git a/lib/private/ocs/result.php b/lib/private/ocs/result.php
index 9f14e8da7e8..0e3b85d5905 100644
--- a/lib/private/ocs/result.php
+++ b/lib/private/ocs/result.php
@@ -96,7 +96,7 @@ class OC_OCS_Result{
* @return bool
*/
public function succeeded() {
- return (substr($this->statusCode, 0, 1) === '1');
+ return ($this->statusCode == 100);
}
diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php
index 68dc2c2d6ec..b0480caf028 100644
--- a/lib/private/ocsclient.php
+++ b/lib/private/ocsclient.php
@@ -95,7 +95,8 @@ class OC_OCSClient{
* @returns array with application data
*
* This function returns a list of all the applications on the OCS server
- * @param integer $page
+ * @param $categories
+ * @param int $page
* @param string $filter
*/
public static function getApplications($categories, $page, $filter) {
@@ -148,6 +149,7 @@ class OC_OCSClient{
/**
* @brief Get an the applications from the OCS server
+ * @param string $id
* @returns array with application data
*
* This function returns an applications from the OCS server
@@ -189,12 +191,13 @@ class OC_OCSClient{
}
/**
- * @brief Get the download url for an application from the OCS server
- * @returns array with application data
- *
- * This function returns an download url for an applications from the OCS server
- * @param integer $item
- */
+ * @brief Get the download url for an application from the OCS server
+ * @returns array with application data
+ *
+ * This function returns an download url for an applications from the OCS server
+ * @param string $id
+ * @param integer $item
+ */
public static function getApplicationDownload($id, $item) {
if(OC_Config::getValue('appstoreenabled', true)==false) {
return null;
diff --git a/lib/private/preview.php b/lib/private/preview.php
index 0c1af3c9588..cdf22240382 100755
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -13,6 +13,8 @@
*/
namespace OC;
+use OC\Preview\Provider;
+
require_once 'preview/image.php';
require_once 'preview/movies.php';
require_once 'preview/mp3.php';
@@ -39,15 +41,16 @@ class Preview {
private $file;
private $maxX;
private $maxY;
- private $scalingup;
- private $mimetype;
+ private $scalingUp;
+ private $mimeType;
//filemapper used for deleting previews
// index is path, value is fileinfo
static public $deleteFileMapper = array();
- //preview images object
/**
+ * preview images object
+ *
* @var \OC_Image
*/
private $preview;
@@ -69,6 +72,7 @@ class Preview {
* @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image
* @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
* @param bool $scalingUp Disable/Enable upscaling of previews
+ * @throws \Exception
* @return mixed (bool / string)
* false if thumbnail does not exist
* path to thumbnail if thumbnail exists
@@ -109,7 +113,7 @@ class Preview {
* @brief returns the path of the file you want a thumbnail from
* @return string
*/
- public function getFile() {
+ public function getFile() {
return $this->file;
}
@@ -134,7 +138,7 @@ class Preview {
* @return bool
*/
public function getScalingUp() {
- return $this->scalingup;
+ return $this->scalingUp;
}
/**
@@ -169,6 +173,9 @@ class Preview {
return $this->configMaxY;
}
+ /**
+ * @return false|Files\FileInfo|\OCP\Files\FileInfo
+ */
protected function getFileInfo() {
$absPath = $this->fileView->getAbsolutePath($this->file);
$absPath = Files\Filesystem::normalizePath($absPath);
@@ -191,23 +198,24 @@ class Preview {
if ($file !== '') {
$this->getFileInfo();
if($this->info !== null && $this->info !== false) {
- $this->mimetype = $this->info->getMimetype();
+ $this->mimeType = $this->info->getMimetype();
}
}
return $this;
}
/**
- * @brief set mimetype explicitely
- * @param string $mimetype
+ * @brief set mime type explicitly
+ * @param string $mimeType
*/
- public function setMimetype($mimetype) {
- $this->mimetype = $mimetype;
+ public function setMimetype($mimeType) {
+ $this->mimeType = $mimeType;
}
/**
* @brief set the the max width of the preview
* @param int $maxX
+ * @throws \Exception
* @return $this
*/
public function setMaxX($maxX = 1) {
@@ -228,6 +236,7 @@ class Preview {
/**
* @brief set the the max height of the preview
* @param int $maxY
+ * @throws \Exception
* @return $this
*/
public function setMaxY($maxY = 1) {
@@ -254,7 +263,7 @@ class Preview {
if ($this->getMaxScaleFactor() === 1) {
$scalingUp = false;
}
- $this->scalingup = $scalingUp;
+ $this->scalingUp = $scalingUp;
return $this;
}
@@ -314,35 +323,68 @@ class Preview {
/**
* @brief check if thumbnail or bigger version of thumbnail of file is cached
- * @return mixed (bool / string)
- * false if thumbnail does not exist
- * path to thumbnail if thumbnail exists
+ * @param int $fileId fileId of the original image
+ * @return string|false path to thumbnail if it exists or false
*/
- private function isCached() {
- $file = $this->getFile();
+ public function isCached($fileId) {
+ if (is_null($fileId)) {
+ return false;
+ }
+
$maxX = $this->getMaxX();
$maxY = $this->getMaxY();
- $scalingUp = $this->getScalingUp();
- $maxScaleFactor = $this->getMaxScaleFactor();
- $fileInfo = $this->getFileInfo($file);
- $fileId = $fileInfo->getId();
+ $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
+
+ //does a preview with the wanted height and width already exist?
+ if ($this->userView->file_exists($previewPath . $maxX . '-' . $maxY . '.png')) {
+ return $previewPath . $maxX . '-' . $maxY . '.png';
+ }
+
+ return $this->isCachedBigger($fileId);
+ }
+
+ /**
+ * @brief check if a bigger version of thumbnail of file is cached
+ * @param int $fileId fileId of the original image
+ * @return string|false path to bigger thumbnail if it exists or false
+ */
+ private function isCachedBigger($fileId) {
if (is_null($fileId)) {
return false;
}
- $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
- if (!$this->userView->is_dir($previewPath)) {
- return false;
+ $maxX = $this->getMaxX();
+
+ //array for usable cached thumbnails
+ $possibleThumbnails = $this->getPossibleThumbnails($fileId);
+
+ foreach ($possibleThumbnails as $width => $path) {
+ if ($width < $maxX) {
+ continue;
+ } else {
+ return $path;
+ }
}
- //does a preview with the wanted height and width already exist?
- if ($this->userView->file_exists($previewPath . $maxX . '-' . $maxY . '.png')) {
- return $previewPath . $maxX . '-' . $maxY . '.png';
+ return false;
+ }
+
+ /**
+ * @brief get possible bigger thumbnails of the given image
+ * @param int $fileId fileId of the original image
+ * @return array of paths to bigger thumbnails
+ */
+ private function getPossibleThumbnails($fileId) {
+
+ if (is_null($fileId)) {
+ return array();
}
- $wantedAspectRatio = (float)($maxX / $maxY);
+ $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
+
+ $wantedAspectRatio = (float) ($this->getMaxX() / $this->getMaxY());
//array for usable cached thumbnails
$possibleThumbnails = array();
@@ -350,53 +392,56 @@ class Preview {
$allThumbnails = $this->userView->getDirectoryContent($previewPath);
foreach ($allThumbnails as $thumbnail) {
$name = rtrim($thumbnail['name'], '.png');
- $size = explode('-', $name);
- $x = (int)$size[0];
- $y = (int)$size[1];
+ list($x, $y, $aspectRatio) = $this->getDimensionsFromFilename($name);
- $aspectRatio = (float)($x / $y);
- if ($aspectRatio !== $wantedAspectRatio) {
+ if (abs($aspectRatio - $wantedAspectRatio) >= 0.000001
+ || $this->unscalable($x, $y)
+ ) {
continue;
}
-
- if ($x < $maxX || $y < $maxY) {
- if ($scalingUp) {
- $scalefactor = $maxX / $x;
- if ($scalefactor > $maxScaleFactor) {
- continue;
- }
- } else {
- continue;
- }
- }
$possibleThumbnails[$x] = $thumbnail['path'];
}
- if (count($possibleThumbnails) === 0) {
- return false;
- }
-
- if (count($possibleThumbnails) === 1) {
- return current($possibleThumbnails);
- }
-
ksort($possibleThumbnails);
- if (key(reset($possibleThumbnails)) > $maxX) {
- return current(reset($possibleThumbnails));
- }
+ return $possibleThumbnails;
+ }
- if (key(end($possibleThumbnails)) < $maxX) {
- return current(end($possibleThumbnails));
- }
+ /**
+ * @param string $name
+ * @return array
+ */
+ private function getDimensionsFromFilename($name) {
+ $size = explode('-', $name);
+ $x = (int) $size[0];
+ $y = (int) $size[1];
+ $aspectRatio = (float) ($x / $y);
+ return array($x, $y, $aspectRatio);
+ }
- foreach ($possibleThumbnails as $width => $path) {
- if ($width < $maxX) {
- continue;
+ /**
+ * @param int $x
+ * @param int $y
+ * @return bool
+ */
+ private function unscalable($x, $y) {
+
+ $maxX = $this->getMaxX();
+ $maxY = $this->getMaxY();
+ $scalingUp = $this->getScalingUp();
+ $maxScaleFactor = $this->getMaxScaleFactor();
+
+ if ($x < $maxX || $y < $maxY) {
+ if ($scalingUp) {
+ $scalefactor = $maxX / $x;
+ if ($scalefactor > $maxScaleFactor) {
+ return true;
+ }
} else {
- return $path;
+ return true;
}
}
+ return false;
}
/**
@@ -420,7 +465,7 @@ class Preview {
}
$fileId = $fileInfo->getId();
- $cached = $this->isCached();
+ $cached = $this->isCached($fileId);
if ($cached) {
$stream = $this->userView->fopen($cached, 'r');
@@ -434,13 +479,14 @@ class Preview {
if (is_null($this->preview)) {
$preview = null;
- foreach (self::$providers as $supportedMimetype => $provider) {
- if (!preg_match($supportedMimetype, $this->mimetype)) {
+ foreach (self::$providers as $supportedMimeType => $provider) {
+ if (!preg_match($supportedMimeType, $this->mimeType)) {
continue;
}
\OC_Log::write('core', 'Generating preview for "' . $file . '" with "' . get_class($provider) . '"', \OC_Log::DEBUG);
+ /** @var $provider Provider */
$preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingUp, $this->fileView);
if (!($preview instanceof \OC_Image)) {
@@ -484,7 +530,6 @@ class Preview {
$this->getPreview();
}
$this->preview->show('image/png');
- return;
}
/**
@@ -493,7 +538,6 @@ class Preview {
*/
public function show() {
$this->showPreview();
- return;
}
/**
@@ -505,7 +549,7 @@ class Preview {
$x = $this->getMaxX();
$y = $this->getMaxY();
$scalingUp = $this->getScalingUp();
- $maxscalefactor = $this->getMaxScaleFactor();
+ $maxScaleFactor = $this->getMaxScaleFactor();
if (!($image instanceof \OC_Image)) {
\OC_Log::write('core', '$this->preview is not an instance of OC_Image', \OC_Log::DEBUG);
@@ -514,16 +558,16 @@ class Preview {
$image->fixOrientation();
- $realx = (int)$image->width();
- $realy = (int)$image->height();
+ $realX = (int)$image->width();
+ $realY = (int)$image->height();
- if ($x === $realx && $y === $realy) {
+ if ($x === $realX && $y === $realY) {
$this->preview = $image;
return;
}
- $factorX = $x / $realx;
- $factorY = $y / $realy;
+ $factorX = $x / $realX;
+ $factorY = $y / $realY;
if ($factorX >= $factorY) {
$factor = $factorX;
@@ -537,25 +581,25 @@ class Preview {
}
}
- if (!is_null($maxscalefactor)) {
- if ($factor > $maxscalefactor) {
- \OC_Log::write('core', 'scalefactor reduced from ' . $factor . ' to ' . $maxscalefactor, \OC_Log::DEBUG);
- $factor = $maxscalefactor;
+ if (!is_null($maxScaleFactor)) {
+ if ($factor > $maxScaleFactor) {
+ \OC_Log::write('core', 'scale factor reduced from ' . $factor . ' to ' . $maxScaleFactor, \OC_Log::DEBUG);
+ $factor = $maxScaleFactor;
}
}
- $newXsize = (int)($realx * $factor);
- $newYsize = (int)($realy * $factor);
+ $newXSize = (int)($realX * $factor);
+ $newYSize = (int)($realY * $factor);
- $image->preciseResize($newXsize, $newYsize);
+ $image->preciseResize($newXSize, $newYSize);
- if ($newXsize === $x && $newYsize === $y) {
+ if ($newXSize === $x && $newYSize === $y) {
$this->preview = $image;
return;
}
- if ($newXsize >= $x && $newYsize >= $y) {
- $cropX = floor(abs($x - $newXsize) * 0.5);
+ if ($newXSize >= $x && $newYSize >= $y) {
+ $cropX = floor(abs($x - $newXSize) * 0.5);
//don't crop previews on the Y axis, this sucks if it's a document.
//$cropY = floor(abs($y - $newYsize) * 0.5);
$cropY = 0;
@@ -566,36 +610,36 @@ class Preview {
return;
}
- if ($newXsize < $x || $newYsize < $y) {
- if ($newXsize > $x) {
- $cropX = floor(($newXsize - $x) * 0.5);
- $image->crop($cropX, 0, $x, $newYsize);
+ if ($newXSize < $x || $newYSize < $y) {
+ if ($newXSize > $x) {
+ $cropX = floor(($newXSize - $x) * 0.5);
+ $image->crop($cropX, 0, $x, $newYSize);
}
- if ($newYsize > $y) {
- $cropY = floor(($newYsize - $y) * 0.5);
- $image->crop(0, $cropY, $newXsize, $y);
+ if ($newYSize > $y) {
+ $cropY = floor(($newYSize - $y) * 0.5);
+ $image->crop(0, $cropY, $newXSize, $y);
}
- $newXsize = (int)$image->width();
- $newYsize = (int)$image->height();
+ $newXSize = (int)$image->width();
+ $newYSize = (int)$image->height();
//create transparent background layer
- $backgroundlayer = imagecreatetruecolor($x, $y);
- $white = imagecolorallocate($backgroundlayer, 255, 255, 255);
- imagefill($backgroundlayer, 0, 0, $white);
+ $backgroundLayer = imagecreatetruecolor($x, $y);
+ $white = imagecolorallocate($backgroundLayer, 255, 255, 255);
+ imagefill($backgroundLayer, 0, 0, $white);
$image = $image->resource();
- $mergeX = floor(abs($x - $newXsize) * 0.5);
- $mergeY = floor(abs($y - $newYsize) * 0.5);
+ $mergeX = floor(abs($x - $newXSize) * 0.5);
+ $mergeY = floor(abs($y - $newYSize) * 0.5);
- imagecopy($backgroundlayer, $image, $mergeX, $mergeY, 0, 0, $newXsize, $newYsize);
+ imagecopy($backgroundLayer, $image, $mergeX, $mergeY, 0, 0, $newXSize, $newYSize);
//$black = imagecolorallocate(0,0,0);
//imagecolortransparent($transparentlayer, $black);
- $image = new \OC_Image($backgroundlayer);
+ $image = new \OC_Image($backgroundLayer);
$this->preview = $image;
return;
@@ -630,6 +674,7 @@ class Preview {
$class = $provider['class'];
$options = $provider['options'];
+ /** @var $object Provider */
$object = new $class($options);
self::$providers[$object->getMimeType()] = $object;
@@ -640,7 +685,7 @@ class Preview {
}
public static function post_write($args) {
- self::post_delete($args);
+ self::post_delete($args, 'files/');
}
public static function prepare_delete_files($args) {
@@ -676,9 +721,10 @@ class Preview {
}
/**
- * @param string $mimetype
+ * @param string $mimeType
+ * @return bool
*/
- public static function isMimeSupported($mimetype) {
+ public static function isMimeSupported($mimeType) {
if (!\OC_Config::getValue('enable_previews', true)) {
return false;
}
@@ -690,8 +736,8 @@ class Preview {
//remove last element because it has the mimetype *
$providers = array_slice(self::$providers, 0, -1);
- foreach ($providers as $supportedMimetype => $provider) {
- if (preg_match($supportedMimetype, $mimetype)) {
+ foreach ($providers as $supportedMimeType => $provider) {
+ if (preg_match($supportedMimeType, $mimeType)) {
return true;
}
}
diff --git a/lib/private/preview/movies.php b/lib/private/preview/movies.php
index 7e0ff51ad2e..72ccfadc6e9 100644
--- a/lib/private/preview/movies.php
+++ b/lib/private/preview/movies.php
@@ -42,7 +42,6 @@ if (!\OC_Util::runningOnWindows()) {
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
// TODO: use proc_open() and stream the source file ?
$absPath = \OC_Helper::tmpFile();
- $tmpPath = \OC_Helper::tmpFile();
$handle = $fileview->fopen($path, 'rb');
@@ -51,14 +50,39 @@ if (!\OC_Util::runningOnWindows()) {
$firstmb = stream_get_contents($handle, 5242880);
file_put_contents($absPath, $firstmb);
+ $result = $this->generateThumbNail($maxX, $maxY, $absPath, 5);
+ if ($result === false) {
+ $result = $this->generateThumbNail($maxX, $maxY, $absPath, 1);
+ if ($result === false) {
+ $result = $this->generateThumbNail($maxX, $maxY, $absPath, 0);
+ }
+ }
+
+ unlink($absPath);
+
+
+ return $result;
+ }
+
+ /**
+ * @param int $maxX
+ * @param int $maxY
+ * @param string $absPath
+ * @param string $tmpPath
+ * @param int $second
+ * @return bool|\OC_Image
+ */
+ private function generateThumbNail($maxX, $maxY, $absPath, $second)
+ {
+ $tmpPath = \OC_Helper::tmpFile();
+
if (self::$avconvBinary) {
- $cmd = self::$avconvBinary . ' -an -y -ss 5'.
+ $cmd = self::$avconvBinary . ' -an -y -ss ' . escapeshellarg($second) .
' -i ' . escapeshellarg($absPath) .
' -f mjpeg -vframes 1 -vsync 1 ' . escapeshellarg($tmpPath) .
' > /dev/null 2>&1';
- }
- else {
- $cmd = self::$ffmpegBinary . ' -y -ss 5' .
+ } else {
+ $cmd = self::$ffmpegBinary . ' -y -ss ' . escapeshellarg($second) .
' -i ' . escapeshellarg($absPath) .
' -f mjpeg -vframes 1' .
' -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) .
@@ -68,14 +92,13 @@ if (!\OC_Util::runningOnWindows()) {
exec($cmd, $output, $returnCode);
- unlink($absPath);
-
if ($returnCode === 0) {
$image = new \OC_Image();
$image->loadFromFile($tmpPath);
unlink($tmpPath);
return $image->valid() ? $image : false;
}
+ unlink($tmpPath);
return false;
}
}
diff --git a/lib/private/request.php b/lib/private/request.php
index 8041c4f0048..90f7488eea5 100755
--- a/lib/private/request.php
+++ b/lib/private/request.php
@@ -31,7 +31,7 @@ class OC_Request {
* of trusted domains. If no trusted domains have been configured, returns
* true.
* This is used to prevent Host Header Poisoning.
- * @param string $host
+ * @param string $domain
* @return bool true if the given domain is trusted or if no trusted domains
* have been configured
*/
@@ -76,7 +76,7 @@ class OC_Request {
/**
* Returns the overwritehost setting from the config if set and
* if the overwrite condition is met
- * @return overwritehost value or null if not defined or the defined condition
+ * @return string|null overwritehost value or null if not defined or the defined condition
* isn't met
*/
public static function getOverwriteHost() {
@@ -166,10 +166,11 @@ class OC_Request {
*/
public static function scriptName() {
$name = $_SERVER['SCRIPT_NAME'];
- if (OC_Config::getValue('overwritewebroot', '') !== '' and self::isOverwriteCondition()) {
+ $overwriteWebRoot = OC_Config::getValue('overwritewebroot', '');
+ if ($overwriteWebRoot !== '' and self::isOverwriteCondition()) {
$serverroot = str_replace("\\", '/', substr(__DIR__, 0, -strlen('lib/private/')));
$suburi = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen($serverroot)));
- $name = OC_Config::getValue('overwritewebroot', '') . $suburi;
+ $name = '/' . ltrim($overwriteWebRoot . $suburi, '/');
}
return $name;
}
@@ -200,6 +201,7 @@ class OC_Request {
/**
* @brief get Path info from request, not urldecoded
+ * @throws Exception
* @return string Path info or false when not found
*/
public static function getRawPathInfo() {
diff --git a/lib/private/response.php b/lib/private/response.php
index 983c682bf3f..1aa5e629b8b 100644
--- a/lib/private/response.php
+++ b/lib/private/response.php
@@ -50,7 +50,7 @@ class OC_Response {
/**
* @brief Set response status
- * @param $status a HTTP status code, see also the STATUS constants
+ * @param int $status a HTTP status code, see also the STATUS constants
*/
static public function setStatus($status) {
$protocol = $_SERVER['SERVER_PROTOCOL'];
diff --git a/lib/private/route/cachingrouter.php b/lib/private/route/cachingrouter.php
index ad25372391f..6412ceb0418 100644
--- a/lib/private/route/cachingrouter.php
+++ b/lib/private/route/cachingrouter.php
@@ -31,7 +31,8 @@ class CachingRouter extends Router {
* @return string
*/
public function generate($name, $parameters = array(), $absolute = false) {
- $key = $name . json_encode($parameters) . $absolute;
+ sort($parameters);
+ $key = $this->context->getHost() . '#' . $this->context->getBaseUrl() . $name . json_encode($parameters) . intval($absolute);
if ($this->cache->hasKey($key)) {
return $this->cache->get($key);
} else {
diff --git a/lib/private/route/route.php b/lib/private/route/route.php
index 6ade9ec15f6..df80facf9c1 100644
--- a/lib/private/route/route.php
+++ b/lib/private/route/route.php
@@ -25,6 +25,7 @@ class Route extends SymfonyRoute implements IRoute {
/**
* Specify POST as the method to use with this route
+ * @return \OC\Route\Route
*/
public function post() {
$this->method('POST');
@@ -33,6 +34,7 @@ class Route extends SymfonyRoute implements IRoute {
/**
* Specify GET as the method to use with this route
+ * @return \OC\Route\Route
*/
public function get() {
$this->method('GET');
@@ -41,6 +43,7 @@ class Route extends SymfonyRoute implements IRoute {
/**
* Specify PUT as the method to use with this route
+ * @return \OC\Route\Route
*/
public function put() {
$this->method('PUT');
@@ -49,6 +52,7 @@ class Route extends SymfonyRoute implements IRoute {
/**
* Specify DELETE as the method to use with this route
+ * @return \OC\Route\Route
*/
public function delete() {
$this->method('DELETE');
@@ -57,6 +61,7 @@ class Route extends SymfonyRoute implements IRoute {
/**
* Specify PATCH as the method to use with this route
+ * @return \OC\Route\Route
*/
public function patch() {
$this->method('PATCH');
@@ -120,6 +125,7 @@ class Route extends SymfonyRoute implements IRoute {
* The action to execute when this route matches, includes a file like
* it is called directly
* @param $file
+ * @return void
*/
public function actionInclude($file) {
$function = create_function('$param',
diff --git a/lib/private/route/router.php b/lib/private/route/router.php
index 1f0a23ee124..f7900362bec 100644
--- a/lib/private/route/router.php
+++ b/lib/private/route/router.php
@@ -81,6 +81,9 @@ class Router implements IRouter {
return $this->routingFiles;
}
+ /**
+ * @return string
+ */
public function getCacheKey() {
if (!isset($this->cacheKey)) {
$files = $this->getRoutingFiles();
@@ -94,6 +97,7 @@ class Router implements IRouter {
/**
* loads the api routes
+ * @return void
*/
public function loadRoutes($app = null) {
if ($this->loaded) {
@@ -117,7 +121,7 @@ class Router implements IRouter {
if (!isset($this->loadedApps[$app])) {
$this->loadedApps[$app] = true;
$this->useCollection($app);
- require_once $file;
+ $this->requireRouteFile($file);
$collection = $this->getCollection($app);
$collection->addPrefix('/apps/' . $app);
$this->root->addCollection($collection);
@@ -152,6 +156,7 @@ class Router implements IRouter {
* Sets the collection to use for adding routes
*
* @param string $name Name of the collection to use.
+ * @return void
*/
public function useCollection($name) {
$this->collection = $this->getCollection($name);
@@ -177,13 +182,14 @@ class Router implements IRouter {
*
* @param string $url The url to find
* @throws \Exception
+ * @return void
*/
public function match($url) {
if (substr($url, 0, 6) === '/apps/') {
// empty string / 'apps' / $app / rest of the route
list(, , $app,) = explode('/', $url, 4);
$this->loadRoutes($app);
- } else if (substr($url, 0, 6) === '/core/' or substr($url, 0, 5) === '/ocs/' or substr($url, 0, 10) === '/settings/') {
+ } else if (substr($url, 0, 6) === '/core/' or substr($url, 0, 10) === '/settings/') {
$this->loadRoutes('core');
} else {
$this->loadRoutes();
@@ -207,6 +213,7 @@ class Router implements IRouter {
/**
* Get the url generator
+ * @return \Symfony\Component\Routing\Generator\UrlGenerator
*
*/
public function getGenerator() {
@@ -230,4 +237,12 @@ class Router implements IRouter {
return $this->getGenerator()->generate($name, $parameters, $absolute);
}
+ /**
+ * To isolate the variable scope used inside the $file it is required in it's own method
+ * @param $file
+ */
+ private function requireRouteFile($file) {
+ require_once $file;
+ }
+
}
diff --git a/lib/private/search.php b/lib/private/search.php
index 70d670e048e..3f540090fdd 100644
--- a/lib/private/search.php
+++ b/lib/private/search.php
@@ -45,7 +45,7 @@ class OC_Search{
/**
* search all provider for $query
- * @param string query
+ * @param string $query
* @return array An array of OC_Search_Result's
*/
public static function search($query) {
diff --git a/lib/private/server.php b/lib/private/server.php
index 5c83f3ef495..5d90a0b19fc 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -35,6 +35,13 @@ class Server extends SimpleContainer implements IServerContainer {
$requesttoken = false;
}
+ if (defined('PHPUNIT_RUN') && PHPUNIT_RUN
+ && in_array('fakeinput', stream_get_wrappers())) {
+ $stream = 'fakeinput://data';
+ } else {
+ $stream = 'php://input';
+ }
+
return new Request(
array(
'get' => $_GET,
@@ -48,7 +55,7 @@ class Server extends SimpleContainer implements IServerContainer {
: null,
'urlParams' => $urlParams,
'requesttoken' => $requesttoken,
- )
+ ), $stream
);
});
$this->registerService('PreviewManager', function($c) {
@@ -302,7 +309,7 @@ class Server extends SimpleContainer implements IServerContainer {
/**
* get an L10N instance
- * @param $app string appid
+ * @param string $app appid
* @return \OC_L10N
*/
function getL10N($app) {
diff --git a/lib/private/share/constants.php b/lib/private/share/constants.php
index 7e4223d10fa..4c398c43c2d 100644
--- a/lib/private/share/constants.php
+++ b/lib/private/share/constants.php
@@ -26,13 +26,13 @@ class Constants {
const SHARE_TYPE_USER = 0;
const SHARE_TYPE_GROUP = 1;
const SHARE_TYPE_LINK = 3;
- const SHARE_TYPE_EMAIL = 4;
- const SHARE_TYPE_CONTACT = 5;
- const SHARE_TYPE_REMOTE = 6;
+ const SHARE_TYPE_EMAIL = 4; // ToDo Check if it is still in use otherwise remove it
+ const SHARE_TYPE_CONTACT = 5; // ToDo Check if it is still in use otherwise remove it
+ const SHARE_TYPE_REMOTE = 6; // ToDo Check if it is still in use otherwise remove it
const FORMAT_NONE = -1;
const FORMAT_STATUSES = -2;
- const FORMAT_SOURCES = -3;
+ const FORMAT_SOURCES = -3; // ToDo Check if it is still in use otherwise remove it
const TOKEN_LENGTH = 32; // see db_structure.xml
diff --git a/lib/private/share/helper.php b/lib/private/share/helper.php
index fde55667281..515ec85909a 100644
--- a/lib/private/share/helper.php
+++ b/lib/private/share/helper.php
@@ -199,4 +199,53 @@ class Helper extends \OC\Share\Constants {
$query->execute();
}
}
+
+ /**
+ * @brief get default expire settings defined by the admin
+ * @return array contains 'defaultExpireDateSet', 'enforceExpireDate', 'expireAfterDays'
+ */
+ public static function getDefaultExpireSetting() {
+
+ $defaultExpireSettings = array('defaultExpireDateSet' => false);
+
+ // get default expire settings
+ $defaultExpireDate = \OC_Appconfig::getValue('core', 'shareapi_default_expire_date', 'no');
+ if ($defaultExpireDate === 'yes') {
+ $enforceExpireDate = \OC_Appconfig::getValue('core', 'shareapi_enforce_expire_date', 'no');
+ $defaultExpireSettings['defaultExpireDateSet'] = true;
+ $defaultExpireSettings['expireAfterDays'] = (int)\OC_Appconfig::getValue('core', 'shareapi_expire_after_n_days', '7');
+ $defaultExpireSettings['enforceExpireDate'] = $enforceExpireDate === 'yes' ? true : false;
+ }
+
+ return $defaultExpireSettings;
+ }
+
+ /**
+ * @brief calculate expire date
+ * @param array $defaultExpireSettings contains 'defaultExpireDateSet', 'enforceExpireDate', 'expireAfterDays'
+ * @param int $creationTime timestamp when the share was created
+ * @param int $userExpireDate expire timestamp set by the user
+ * @return mixed integer timestamp or False
+ */
+ public static function calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate = null) {
+
+ $expires = false;
+
+ if (isset($defaultExpireSettings['defaultExpireDateSet']) && $defaultExpireSettings['defaultExpireDateSet']) {
+ $expires = $creationTime + $defaultExpireSettings['expireAfterDays'] * 86400;
+ }
+
+
+ if (isset($userExpireDate)) {
+ // if the admin decided to enforce the default expire date then we only take
+ // the user defined expire date of it is before the default expire date
+ if ($expires && isset($defaultExpireSettings['enforceExpireDate']) && $defaultExpireSettings['enforceExpireDate']) {
+ $expires = ($userExpireDate < $expires) ? $userExpireDate : $expires;
+ } else {
+ $expires = $userExpireDate;
+ }
+ }
+
+ return $expires;
+ }
}
diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php
index 45734818731..4799db52330 100644
--- a/lib/private/share/mailnotifications.php
+++ b/lib/private/share/mailnotifications.php
@@ -30,7 +30,6 @@ class MailNotifications {
/**
*
- * @param string $recipient user id
* @param string $sender user id (if nothing is set we use the currently logged-in user)
*/
public function __construct($sender = null) {
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 7bab98b00bf..c0ce3a1d8af 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -91,23 +91,25 @@ class Share extends \OC\Share\Constants {
/**
* Find which users can access a shared item
- * @param $path to the file
- * @param $user owner of the file
- * @param include owner to the list of users with access to the file
+ * @param string $path to the file
+ * @param string $ownerUser owner of the file
+ * @param bool $includeOwner include owner to the list of users with access to the file
+ * @param bool $returnUserPaths Return an array with the user => path map
* @return array
* @note $path needs to be relative to user data dir, e.g. 'file.txt'
* not '/admin/data/file.txt'
*/
- public static function getUsersSharingFile($path, $user, $includeOwner = false) {
+ public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false) {
- $shares = array();
+ $shares = $sharePaths = $fileTargets = array();
$publicShare = false;
$source = -1;
$cache = false;
- $view = new \OC\Files\View('/' . $user . '/files');
+ $view = new \OC\Files\View('/' . $ownerUser . '/files');
if ($view->file_exists($path)) {
$meta = $view->getFileInfo($path);
+ $path = substr($meta->getPath(), strlen('/' . $ownerUser . '/files'));
} else {
// if the file doesn't exists yet we start with the parent folder
$meta = $view->getFileInfo(dirname($path));
@@ -119,10 +121,9 @@ class Share extends \OC\Share\Constants {
}
while ($source !== -1) {
-
// Fetch all shares with another user
$query = \OC_DB::prepare(
- 'SELECT `share_with`
+ 'SELECT `share_with`, `file_source`, `file_target`
FROM
`*PREFIX*share`
WHERE
@@ -136,12 +137,15 @@ class Share extends \OC\Share\Constants {
} else {
while ($row = $result->fetchRow()) {
$shares[] = $row['share_with'];
+ if ($returnUserPaths) {
+ $fileTargets[(int) $row['file_source']][$row['share_with']] = $row;
+ }
}
}
- // We also need to take group shares into account
+ // We also need to take group shares into account
$query = \OC_DB::prepare(
- 'SELECT `share_with`
+ 'SELECT `share_with`, `file_source`, `file_target`
FROM
`*PREFIX*share`
WHERE
@@ -156,6 +160,11 @@ class Share extends \OC\Share\Constants {
while ($row = $result->fetchRow()) {
$usersInGroup = \OC_Group::usersInGroup($row['share_with']);
$shares = array_merge($shares, $usersInGroup);
+ if ($returnUserPaths) {
+ foreach ($usersInGroup as $user) {
+ $fileTargets[(int) $row['file_source']][$user] = $row;
+ }
+ }
}
}
@@ -188,9 +197,41 @@ class Share extends \OC\Share\Constants {
$source = -1;
}
}
+
// Include owner in list of users, if requested
if ($includeOwner) {
- $shares[] = $user;
+ $shares[] = $ownerUser;
+ if ($returnUserPaths) {
+ $sharePaths[$ownerUser] = $path;
+ }
+ }
+
+ if ($returnUserPaths) {
+ $fileTargetIDs = array_keys($fileTargets);
+ $fileTargetIDs = array_unique($fileTargetIDs);
+
+ if (!empty($fileTargetIDs)) {
+ $query = \OC_DB::prepare(
+ 'SELECT `fileid`, `path`
+ FROM `*PREFIX*filecache`
+ WHERE `fileid` IN (' . implode(',', $fileTargetIDs) . ')'
+ );
+ $result = $query->execute();
+
+ if (\OCP\DB::isError($result)) {
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
+ } else {
+ while ($row = $result->fetchRow()) {
+ foreach ($fileTargets[$row['fileid']] as $uid => $shareData) {
+ $sharedPath = $shareData['file_target'];
+ $sharedPath .= substr($path, strlen($row['path']) -5);
+ $sharePaths[$uid] = $sharedPath;
+ }
+ }
+ }
+ }
+
+ return $sharePaths;
}
return array("users" => array_unique($shares), "public" => $publicShare);
@@ -212,6 +253,22 @@ class Share extends \OC\Share\Constants {
}
/**
+ * Get the items of item type shared with a user
+ * @param string Item type
+ * @param sting user id for which user we want the shares
+ * @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 getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE,
+ $parameters = null, $limit = -1, $includeCollections = false) {
+ return self::getItems($itemType, null, self::$shareTypeUserAndGroups, $user, null, $format,
+ $parameters, $limit, $includeCollections);
+ }
+
+ /**
* Get the item of item type shared with the current user
* @param string $itemType
* @param string $itemTarget
@@ -426,30 +483,61 @@ class Share extends \OC\Share\Constants {
public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null) {
$uidOwner = \OC_User::getUser();
$sharingPolicy = \OC_Appconfig::getValue('core', 'shareapi_share_policy', 'global');
+ $l = \OC_L10N::get('lib');
if (is_null($itemSourceName)) {
$itemSourceName = $itemSource;
}
+
+ // verify that the file exists before we try to share it
+ if ($itemType === 'file' or $itemType === 'folder') {
+ $path = \OC\Files\Filesystem::getPath($itemSource);
+ if (!$path) {
+ $message = 'Sharing %s failed, because the file does not exist';
+ $message_t = $l->t('Sharing %s failed, because the file does not exist', array($itemSourceName));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ throw new \Exception($message_t);
+ }
+ }
+
+ //verify that we don't share a folder which already contains a share mount point
+ if ($itemType === 'folder') {
+ $path = '/' . $uidOwner . '/files' . \OC\Files\Filesystem::getPath($itemSource) . '/';
+ $mountManager = \OC\Files\Filesystem::getMountManager();
+ $mounts = $mountManager->getAll();
+ foreach ($mounts as $mountPoint => $mount) {
+ if ($mount->getStorage() instanceof \OC\Files\Storage\Shared && strpos($mountPoint, $path) === 0) {
+ $message = 'Sharing "' . $itemSourceName . '" failed, because it contains files shared with you!';
+ \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
+ throw new \Exception($message);
+ }
+
+ }
+ }
+
// Verify share type and sharing conditions are met
if ($shareType === self::SHARE_TYPE_USER) {
if ($shareWith == $uidOwner) {
- $message = 'Sharing '.$itemSourceName.' failed, because the user '.$shareWith.' is the item owner';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because the user %s is the item owner';
+ $message_t = $l->t('Sharing %s failed, because the user %s is the item owner', array($itemSourceName, $shareWith));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
if (!\OC_User::userExists($shareWith)) {
- $message = 'Sharing '.$itemSourceName.' failed, because the user '.$shareWith.' does not exist';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because the user %s does not exist';
+ $message_t = $l->t('Sharing %s failed, because the user %s does not exist', array($itemSourceName, $shareWith));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
if ($sharingPolicy == 'groups_only') {
$inGroup = array_intersect(\OC_Group::getUserGroups($uidOwner), \OC_Group::getUserGroups($shareWith));
if (empty($inGroup)) {
- $message = 'Sharing '.$itemSourceName.' failed, because the user '
- .$shareWith.' is not a member of any groups that '.$uidOwner.' is a member of';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because the user '
+ .'%s is not a member of any groups that %s is a member of';
+ $message_t = $l->t('Sharing %s failed, because the user %s is not a member of any groups that %s is a member of', array($itemSourceName, $shareWith, $uidOwner));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith, $uidOwner), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
}
// Check if the item source is already shared with the user, either from the same owner or a different user
@@ -459,22 +547,25 @@ class Share extends \OC\Share\Constants {
// owner and is not a user share, this use case is for increasing
// permissions for a specific user
if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
- $message = 'Sharing '.$itemSourceName.' failed, because this item is already shared with '.$shareWith;
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because this item is already shared with %s';
+ $message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
}
} else if ($shareType === self::SHARE_TYPE_GROUP) {
if (!\OC_Group::groupExists($shareWith)) {
- $message = 'Sharing '.$itemSourceName.' failed, because the group '.$shareWith.' does not exist';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because the group %s does not exist';
+ $message_t = $l->t('Sharing %s failed, because the group %s does not exist', array($itemSourceName, $shareWith));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
if ($sharingPolicy == 'groups_only' && !\OC_Group::inGroup($uidOwner, $shareWith)) {
- $message = 'Sharing '.$itemSourceName.' failed, because '
- .$uidOwner.' is not a member of the group '.$shareWith;
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because '
+ .'%s is not a member of the group %s';
+ $message_t = $l->t('Sharing %s failed, because %s is not a member of the group %s', array($itemSourceName, $uidOwner, $shareWith));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
// Check if the item source is already shared with the group, either from the same owner or a different user
// The check for each user in the group is done inside the put() function
@@ -484,9 +575,10 @@ class Share extends \OC\Share\Constants {
// owner and is not a group share, this use case is for increasing
// permissions for a specific user
if ($checkExists['uid_owner'] != $uidOwner || $checkExists['share_type'] == $shareType) {
- $message = 'Sharing '.$itemSourceName.' failed, because this item is already shared with '.$shareWith;
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because this item is already shared with %s';
+ $message_t = $l->t('Sharing %s failed, because this item is already shared with %s', array($itemSourceName, $shareWith));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
}
// Convert share with into an array with the keys group and users
@@ -533,15 +625,17 @@ class Share extends \OC\Share\Constants {
return false;
}
}
- $message = 'Sharing '.$itemSourceName.' failed, because sharing with links is not allowed';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because sharing with links is not allowed';
+ $message_t = $l->t('Sharing %s failed, because sharing with links is not allowed', array($itemSourceName));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ throw new \Exception($message_t);
return false;
} else {
// Future share types need to include their own conditions
- $message = 'Share type '.$shareType.' is not valid for '.$itemSource;
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Share type %s is not valid for %s';
+ $message_t = $l->t('Share type %s is not valid for %s', array($shareType, $itemSource));
+ \OC_Log::write('OCP\Share', sprintf($message, $shareType, $itemSource), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
// Put the item into the database
return self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, null, null, $itemSourceName);
@@ -665,6 +759,7 @@ class Share extends \OC\Share\Constants {
* @return Returns true on success or false on failure
*/
public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) {
+ $l = \OC_L10N::get('lib');
if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith,
\OC_User::getUser(), self::FORMAT_NONE, null, 1, false)) {
// Check if this item is a reshare and verify that the permissions
@@ -673,10 +768,11 @@ class Share extends \OC\Share\Constants {
$query = \OC_DB::prepare('SELECT `permissions` FROM `*PREFIX*share` WHERE `id` = ?', 1);
$result = $query->execute(array($item['parent']))->fetchRow();
if (~(int)$result['permissions'] & $permissions) {
- $message = 'Setting permissions for '.$itemSource.' failed,'
- .' because the permissions exceed permissions granted to '.\OC_User::getUser();
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Setting permissions for %s failed,'
+ .' because the permissions exceed permissions granted to %s';
+ $message_t = $l->t('Setting permissions for %s failed, because the permissions exceed permissions granted to %s', array($itemSource, \OC_User::getUser()));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSource, \OC_User::getUser()), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
}
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `permissions` = ? WHERE `id` = ?');
@@ -734,9 +830,11 @@ class Share extends \OC\Share\Constants {
}
return true;
}
- $message = 'Setting permissions for '.$itemSource.' failed, because the item was not found';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Setting permissions for %s failed, because the item was not found';
+ $message_t = $l->t('Setting permissions for %s failed, because the item was not found', array($itemSource));
+
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSource), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
/**
@@ -778,9 +876,20 @@ class Share extends \OC\Share\Constants {
* @return bool True if item was expired, false otherwise.
*/
protected static function expireItem(array $item) {
+
+ // get default expire settings
+ $defaultSettings = Helper::getDefaultExpireSetting();
+ // calculate expire date
if (!empty($item['expiration'])) {
- $now = new \DateTime();
- $expires = new \DateTime($item['expiration']);
+ $userDefinedExpire = new \DateTime($item['expiration']);
+ $userDefinedExpireTimestamp = $userDefinedExpire->getTimestamp();
+ } else {
+ $userDefinedExpireTimestamp = null;
+ }
+ $expires = Helper::calculateExpireDate($defaultSettings, $item['stime'], $userDefinedExpireTimestamp);
+
+ if (is_int($expires)) {
+ $now = time();
if ($now > $expires) {
self::unshareItem($item);
return true;
@@ -799,6 +908,7 @@ class Share extends \OC\Share\Constants {
$hookParams = array(
'itemType' => $item['item_type'],
'itemSource' => $item['item_source'],
+ 'fileSource' => $item['file_source'],
'shareType' => $item['share_type'],
'shareWith' => $item['share_with'],
'itemParent' => $item['parent'],
@@ -818,6 +928,7 @@ class Share extends \OC\Share\Constants {
* @return \OCP\Share_Backend
*/
public static function getBackend($itemType) {
+ $l = \OC_L10N::get('lib');
if (isset(self::$backends[$itemType])) {
return self::$backends[$itemType];
} else if (isset(self::$backendTypes[$itemType]['class'])) {
@@ -825,20 +936,23 @@ class Share extends \OC\Share\Constants {
if (class_exists($class)) {
self::$backends[$itemType] = new $class;
if (!(self::$backends[$itemType] instanceof \OCP\Share_Backend)) {
- $message = 'Sharing backend '.$class.' must implement the interface OCP\Share_Backend';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing backend %s must implement the interface OCP\Share_Backend';
+ $message_t = $l->t('Sharing backend %s must implement the interface OCP\Share_Backend', array($class));
+ \OC_Log::write('OCP\Share', sprintf($message, $class), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
return self::$backends[$itemType];
} else {
- $message = 'Sharing backend '.$class.' not found';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing backend %s not found';
+ $message_t = $l->t('Sharing backend %s not found', array($class));
+ \OC_Log::write('OCP\Share', sprintf($message, $class), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
}
- $message = 'Sharing backend for '.$itemType.' not found';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing backend for %s not found';
+ $message_t = $l->t('Sharing backend for %s not found', array($itemType));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemType), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
/**
@@ -1054,6 +1168,7 @@ class Share extends \OC\Share\Constants {
// Filter out duplicate group shares for users with unique targets
if ($row['share_type'] == self::$shareTypeGroupUserUnique && isset($items[$row['parent']])) {
$row['share_type'] = self::SHARE_TYPE_GROUP;
+ $row['unique_name'] = true; // remember that we use a unique name for this user
$row['share_with'] = $items[$row['parent']]['share_with'];
// Remove the parent group share
unset($items[$row['parent']]);
@@ -1092,10 +1207,6 @@ class Share extends \OC\Share\Constants {
// Remove root from file source paths if retrieving own shared items
if (isset($uidOwner) && isset($row['path'])) {
if (isset($row['parent'])) {
- // FIXME: Doesn't always construct the correct path, example:
- // Folder '/a/b', share '/a' and '/a/b' to user2
- // user2 reshares /Shared/b and ask for share status of /Shared/a/b
- // expected result: path=/Shared/a/b; actual result /Shared/b because of the parent
$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
$parentResult = $query->execute(array($row['parent']));
if (\OC_DB::isError($result)) {
@@ -1104,7 +1215,7 @@ class Share extends \OC\Share\Constants {
\OC_Log::ERROR);
} else {
$parentRow = $parentResult->fetchRow();
- $tmpPath = '/Shared' . $parentRow['file_target'];
+ $tmpPath = $parentRow['file_target'];
// find the right position where the row path continues from the target path
$pos = strrpos($row['path'], $parentRow['file_target']);
$subPath = substr($row['path'], $pos);
@@ -1246,23 +1357,26 @@ class Share extends \OC\Share\Constants {
private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
$permissions, $parentFolder = null, $token = null, $itemSourceName = null) {
$backend = self::getBackend($itemType);
-
+ $l = \OC_L10N::get('lib');
// Check if this is a reshare
if ($checkReshare = self::getItemSharedWithBySource($itemType, $itemSource, self::FORMAT_NONE, null, true)) {
// Check if attempting to share back to owner
if ($checkReshare['uid_owner'] == $shareWith && $shareType == self::SHARE_TYPE_USER) {
- $message = 'Sharing '.$itemSourceName.' failed, because the user '.$shareWith.' is the original sharer';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because the user %s is the original sharer';
+ $message_t = $l->t('Sharing %s failed, because the user %s is the original sharer', array($itemSourceName, $shareWith));
+
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
// Check if share permissions is granted
if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\PERMISSION_SHARE) {
if (~(int)$checkReshare['permissions'] & $permissions) {
- $message = 'Sharing '.$itemSourceName
- .' failed, because the permissions exceed permissions granted to '.$uidOwner;
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because the permissions exceed permissions granted to %s';
+ $message_t = $l->t('Sharing %s failed, because the permissions exceed permissions granted to %s', array($itemSourceName, $uidOwner));
+
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName, $uidOwner), \OC_Log::ERROR);
+ throw new \Exception($message_t);
} else {
// TODO Don't check if inside folder
$parent = $checkReshare['id'];
@@ -1273,19 +1387,22 @@ class Share extends \OC\Share\Constants {
$filePath = $checkReshare['file_target'];
}
} else {
- $message = 'Sharing '.$itemSourceName.' failed, because resharing is not allowed';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because resharing is not allowed';
+ $message_t = $l->t('Sharing %s failed, because resharing is not allowed', array($itemSourceName));
+
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSourceName), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
} else {
$parent = null;
$suggestedItemTarget = null;
$suggestedFileTarget = null;
if (!$backend->isValidSource($itemSource, $uidOwner)) {
- $message = 'Sharing '.$itemSource.' failed, because the sharing backend for '
- .$itemType.' could not find its source';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because the sharing backend for '
+ .'%s could not find its source';
+ $message_t = $l->t('Sharing %s failed, because the sharing backend for %s could not find its source', array($itemSource, $itemType));
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSource, $itemType), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
if ($backend instanceof \OCP\Share_Backend_File_Dependent) {
$filePath = $backend->getFilePath($itemSource, $uidOwner);
@@ -1296,9 +1413,11 @@ class Share extends \OC\Share\Constants {
$fileSource = $meta['fileid'];
}
if ($fileSource == -1) {
- $message = 'Sharing '.$itemSource.' failed, because the file could not be found in the file cache';
- \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
- throw new \Exception($message);
+ $message = 'Sharing %s failed, because the file could not be found in the file cache';
+ $message_t = $l->t('Sharing %s failed, because the file could not be found in the file cache', array($itemSource));
+
+ \OC_Log::write('OCP\Share', sprintf($message, $itemSource), \OC_Log::ERROR);
+ throw new \Exception($message_t);
}
} else {
$filePath = null;
@@ -1306,8 +1425,8 @@ class Share extends \OC\Share\Constants {
}
}
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`item_type`, `item_source`, `item_target`,'
- .' `parent`, `share_type`, `share_with`, `uid_owner`, `permissions`, `stime`, `file_source`,'
- .' `file_target`, `token`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)');
+ .' `share_type`, `share_with`, `uid_owner`, `permissions`, `stime`, `file_source`,'
+ .' `file_target`, `token`, `parent`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)');
// Share with a group
if ($shareType == self::SHARE_TYPE_GROUP) {
$groupItemTarget = Helper::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'],
@@ -1351,10 +1470,9 @@ class Share extends \OC\Share\Constants {
} else {
$groupFileTarget = null;
}
- $query->execute(array($itemType, $itemSource, $groupItemTarget, $parent, $shareType,
- $shareWith['group'], $uidOwner, $permissions, time(), $fileSource, $groupFileTarget, $token));
- // Save this id, any extra rows for this group share will need to reference it
- $parent = \OC_DB::insertid('*PREFIX*share');
+ $queriesToExecute = array();
+ $queriesToExecute['groupShare'] = array($itemType, $itemSource, $groupItemTarget, $shareType,
+ $shareWith['group'], $uidOwner, $permissions, time(), $fileSource, $groupFileTarget, $token, $parent);
// Loop through all users of this group in case we need to add an extra row
foreach ($shareWith['users'] as $uid) {
$itemTarget = Helper::generateTarget($itemType, $itemSource, self::SHARE_TYPE_USER, $uid,
@@ -1380,12 +1498,21 @@ class Share extends \OC\Share\Constants {
}
// Insert an extra row for the group share if the item or file target is unique for this user
if ($itemTarget != $groupItemTarget || (isset($fileSource) && $fileTarget != $groupFileTarget)) {
- $query->execute(array($itemType, $itemSource, $itemTarget, $parent,
+ $queriesToExecute[] = array($itemType, $itemSource, $itemTarget,
self::$shareTypeGroupUserUnique, $uid, $uidOwner, $permissions, time(),
- $fileSource, $fileTarget, $token));
+ $fileSource, $fileTarget, $token);
$id = \OC_DB::insertid('*PREFIX*share');
}
}
+ $query->execute($queriesToExecute['groupShare']);
+ // Save this id, any extra rows for this group share will need to reference it
+ $parent = \OC_DB::insertid('*PREFIX*share');
+ unset($queriesToExecute['groupShare']);
+ foreach ($queriesToExecute as $qe) {
+ $qe[] = $parent;
+ $query->execute($qe);
+ }
+
\OC_Hook::emit('OCP\Share', 'post_shared', array(
'itemType' => $itemType,
'itemSource' => $itemSource,
@@ -1445,8 +1572,8 @@ class Share extends \OC\Share\Constants {
} else {
$fileTarget = null;
}
- $query->execute(array($itemType, $itemSource, $itemTarget, $parent, $shareType, $shareWith, $uidOwner,
- $permissions, time(), $fileSource, $fileTarget, $token));
+ $query->execute(array($itemType, $itemSource, $itemTarget, $shareType, $shareWith, $uidOwner,
+ $permissions, time(), $fileSource, $fileTarget, $token, $parent));
$id = \OC_DB::insertid('*PREFIX*share');
\OC_Hook::emit('OCP\Share', 'post_shared', array(
'itemType' => $itemType,
@@ -1523,9 +1650,9 @@ class Share extends \OC\Share\Constants {
$select = '*';
if ($format == self::FORMAT_STATUSES) {
if ($fileDependent) {
- $select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `share_with`, `uid_owner` , `file_source`';
+ $select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `storage`, `share_with`, `uid_owner` , `file_source`, `stime`';
} else {
- $select = '`id`, `parent`, `share_type`, `share_with`, `uid_owner`, `item_source`';
+ $select = '`id`, `parent`, `share_type`, `share_with`, `uid_owner`, `item_source`, `stime`';
}
} else {
if (isset($uidOwner)) {
@@ -1541,7 +1668,7 @@ class Share extends \OC\Share\Constants {
if ($fileDependent) {
if ($format == \OC_Share_Backend_File::FORMAT_GET_FOLDER_CONTENTS || $format == \OC_Share_Backend_File::FORMAT_FILE_APP_ROOT) {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`, `uid_owner`, '
- . '`share_type`, `share_with`, `file_source`, `path`, `file_target`, '
+ . '`share_type`, `share_with`, `file_source`, `path`, `file_target`, `stime`, '
. '`permissions`, `expiration`, `storage`, `*PREFIX*filecache`.`parent` as `file_parent`, '
. '`name`, `mtime`, `mimetype`, `mimepart`, `size`, `unencrypted_size`, `encrypted`, `etag`, `mail_send`';
} else {
diff --git a/lib/private/subadmin.php b/lib/private/subadmin.php
index 8cda7240ac9..5b6072987ad 100644
--- a/lib/private/subadmin.php
+++ b/lib/private/subadmin.php
@@ -32,8 +32,8 @@ class OC_SubAdmin{
/**
* @brief add a SubAdmin
- * @param $uid uid of the SubAdmin
- * @param $gid gid of the group
+ * @param string $uid uid of the SubAdmin
+ * @param string $gid gid of the group
* @return boolean
*/
public static function createSubAdmin($uid, $gid) {
@@ -45,8 +45,8 @@ class OC_SubAdmin{
/**
* @brief delete a SubAdmin
- * @param $uid uid of the SubAdmin
- * @param $gid gid of the group
+ * @param string $uid uid of the SubAdmin
+ * @param string $gid gid of the group
* @return boolean
*/
public static function deleteSubAdmin($uid, $gid) {
@@ -58,7 +58,7 @@ class OC_SubAdmin{
/**
* @brief get groups of a SubAdmin
- * @param $uid uid of the SubAdmin
+ * @param string $uid uid of the SubAdmin
* @return array
*/
public static function getSubAdminsGroups($uid) {
@@ -73,7 +73,7 @@ class OC_SubAdmin{
/**
* @brief get SubAdmins of a group
- * @param $gid gid of the group
+ * @param string $gid gid of the group
* @return array
*/
public static function getGroupsSubAdmins($gid) {
@@ -102,8 +102,8 @@ class OC_SubAdmin{
/**
* @brief checks if a user is a SubAdmin of a group
- * @param $uid uid of the subadmin
- * @param $gid gid of the group
+ * @param string $uid uid of the subadmin
+ * @param string $gid gid of the group
* @return bool
*/
public static function isSubAdminofGroup($uid, $gid) {
@@ -118,7 +118,7 @@ class OC_SubAdmin{
/**
* @brief checks if a user is a SubAdmin
- * @param $uid uid of the subadmin
+ * @param string $uid uid of the subadmin
* @return bool
*/
public static function isSubAdmin($uid) {
@@ -138,8 +138,8 @@ class OC_SubAdmin{
/**
* @brief checks if a user is a accessible by a subadmin
- * @param $subadmin uid of the subadmin
- * @param $user uid of the user
+ * @param string $subadmin uid of the subadmin
+ * @param string $user uid of the user
* @return bool
*/
public static function isUserAccessible($subadmin, $user) {
diff --git a/lib/private/template.php b/lib/private/template.php
index c6851c6cc8d..3d18b52bac9 100644
--- a/lib/private/template.php
+++ b/lib/private/template.php
@@ -64,29 +64,6 @@ class OC_Template extends \OC\Template\Base {
$this->path = $path;
parent::__construct($template, $requesttoken, $l10n, $themeDefaults);
-
- // Some headers to enhance security
- header('X-XSS-Protection: 1; mode=block'); // Enforce browser based XSS filters
- header('X-Content-Type-Options: nosniff'); // Disable sniffing the content type for IE
-
- // iFrame Restriction Policy
- $xFramePolicy = OC_Config::getValue('xframe_restriction', true);
- if($xFramePolicy) {
- header('X-Frame-Options: Sameorigin'); // Disallow iFraming from other domains
- }
-
- // Content Security Policy
- // If you change the standard policy, please also change it in config.sample.php
- $policy = OC_Config::getValue('custom_csp_policy',
- 'default-src \'self\'; '
- .'script-src \'self\' \'unsafe-eval\'; '
- .'style-src \'self\' \'unsafe-inline\'; '
- .'frame-src *; '
- .'img-src *; '
- .'font-src \'self\' data:; '
- .'media-src *');
- header('Content-Security-Policy:'.$policy); // Standard
-
}
/**
@@ -159,6 +136,7 @@ class OC_Template extends \OC\Template\Base {
* @param string $theme
* @param string $app
* @param string $fext
+ * @return array
*/
protected function findTemplate($theme, $app, $name, $fext) {
// Check if it is a app template or not.
@@ -255,7 +233,7 @@ class OC_Template extends \OC\Template\Base {
* @brief Shortcut to print a simple page for guests
* @param string $application The application we render the template for
* @param string $name Name of the template
- * @param string $parameters Parameters for the template
+ * @param array|string $parameters Parameters for the template
* @return bool
*/
public static function printGuestPage( $application, $name, $parameters = array() ) {
@@ -284,7 +262,6 @@ class OC_Template extends \OC\Template\Base {
* print error page using Exception details
* @param Exception $exception
*/
-
public static function printExceptionErrorPage(Exception $exception) {
$error_msg = $exception->getMessage();
if ($exception->getCode()) {
diff --git a/lib/private/template/base.php b/lib/private/template/base.php
index 7aa0cb4a956..3d7c685c1cf 100644
--- a/lib/private/template/base.php
+++ b/lib/private/template/base.php
@@ -77,7 +77,7 @@ class Base {
/**
* @brief Appends a variable
* @param string $key key
- * @param string $value value
+ * @param mixed $value value
* @return boolean|null
*
* This function assigns a variable in an array context. If the key already
diff --git a/lib/private/template/functions.php b/lib/private/template/functions.php
index a72d41f72da..3c42d441efa 100644
--- a/lib/private/template/functions.php
+++ b/lib/private/template/functions.php
@@ -7,16 +7,17 @@
*/
/**
- * Prints an XSS escaped string
- * @param string $string the string which will be escaped and printed
+ * Prints a sanitized string
+ * @param string|array $string the string which will be escaped and printed
*/
function p($string) {
print(OC_Util::sanitizeHTML($string));
}
/**
- * Prints an unescaped string
- * @param string $string the string which will be printed as it is
+ * Prints an unsanitized string - usage of this function may result into XSS.
+ * Consider using p() instead.
+ * @param string|array $string the string which will be printed as it is
*/
function print_unescaped($string) {
print($string);
diff --git a/lib/private/templatelayout.php b/lib/private/templatelayout.php
index af17adb11c6..b7ac02a753d 100644
--- a/lib/private/templatelayout.php
+++ b/lib/private/templatelayout.php
@@ -1,8 +1,6 @@
<?php
use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
-use Assetic\Asset\GlobAsset;
-use Assetic\AssetManager;
use Assetic\AssetWriter;
use Assetic\Filter\CssRewriteFilter;
@@ -66,7 +64,7 @@ class OC_TemplateLayout extends OC_Template {
}
$versionParameter = '?v=' . md5(implode(OC_Util::getVersion()));
- $useAssetPipeline = OC_Config::getValue('asset-pipeline.enabled', false);
+ $useAssetPipeline = $this->isAssetPipelineEnabled();
if ($useAssetPipeline) {
$this->append( 'jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
@@ -99,6 +97,10 @@ class OC_TemplateLayout extends OC_Template {
}
}
+ /**
+ * @param $styles
+ * @return array
+ */
static public function findStylesheetFiles($styles) {
// Read the selected theme from the config file
$theme = OC_Util::getTheme();
@@ -113,6 +115,10 @@ class OC_TemplateLayout extends OC_Template {
return $locator->getResources();
}
+ /**
+ * @param $scripts
+ * @return array
+ */
static public function findJavascriptFiles($scripts) {
// Read the selected theme from the config file
$theme = OC_Util::getTheme();
@@ -168,6 +174,10 @@ class OC_TemplateLayout extends OC_Template {
$this->append('cssfiles', OC_Helper::linkTo('assets', "$cssHash.css"));
}
+ /**
+ * @param $files
+ * @return string
+ */
private static function hashScriptNames($files)
{
$files = array_map(function ($item) {
@@ -179,4 +189,33 @@ class OC_TemplateLayout extends OC_Template {
sort($files);
return hash('md5', implode('', $files));
}
+
+ /**
+ * @return bool
+ */
+ private function isAssetPipelineEnabled() {
+ // asset management enabled?
+ $useAssetPipeline = OC_Config::getValue('asset-pipeline.enabled', false);
+ if (!$useAssetPipeline) {
+ return false;
+ }
+
+ // assets folder exists?
+ $assetDir = \OC::$SERVERROOT . '/assets';
+ if (!is_dir($assetDir)) {
+ if (!mkdir($assetDir)) {
+ \OCP\Util::writeLog('assets',
+ "Folder <$assetDir> does not exist and/or could not be generated.", \OCP\Util::ERROR);
+ return false;
+ }
+ }
+
+ // assets folder can be accessed?
+ if (!touch($assetDir."/.oc")) {
+ \OCP\Util::writeLog('assets',
+ "Folder <$assetDir> could not be accessed.", \OCP\Util::ERROR);
+ return false;
+ }
+ return $useAssetPipeline;
+ }
}
diff --git a/lib/private/urlgenerator.php b/lib/private/urlgenerator.php
index 260eeb15108..a56b0fe3378 100644
--- a/lib/private/urlgenerator.php
+++ b/lib/private/urlgenerator.php
@@ -32,9 +32,8 @@ class URLGenerator implements IURLGenerator {
* @brief Creates an url using a defined route
* @param $route
* @param array $parameters
- * @return
* @internal param array $args with param=>value, will be appended to the returned url
- * @returns string the url
+ * @return string the url
*
* Returns a url to the given app and file.
*/
@@ -96,6 +95,7 @@ class URLGenerator implements IURLGenerator {
* @brief Creates path to an image
* @param string $app app
* @param string $image image name
+ * @throws \RuntimeException If the image does not exist
* @return string the url
*
* Returns the path to the image.
diff --git a/lib/private/user.php b/lib/private/user.php
index dc4c7ec3b61..7106d664aca 100644
--- a/lib/private/user.php
+++ b/lib/private/user.php
@@ -37,6 +37,10 @@
* logout()
*/
class OC_User {
+
+ /**
+ * @return \OC\User\Session
+ */
public static function getUserSession() {
return OC::$server->getUserSession();
}
@@ -220,8 +224,8 @@ class OC_User {
/**
* @brief Try to login a user
- * @param $uid The username of the user to log in
- * @param $password The password of the user
+ * @param string $uid The username of the user to log in
+ * @param string $password The password of the user
* @return boolean|null
*
* Log in a user and regenerate a new session - if the password is ok
@@ -291,6 +295,8 @@ class OC_User {
/**
* @brief Sets user display name for session
* @param string $uid
+ * @param null $displayName
+ * @return bool Whether the display name could get set
*/
public static function setDisplayName($uid, $displayName = null) {
if (is_null($displayName)) {
@@ -514,6 +520,7 @@ class OC_User {
* @returns array with all uids
*
* Get a list of all users.
+ * @param string $search
* @param integer $limit
* @param integer $offset
*/
diff --git a/lib/private/user/database.php b/lib/private/user/database.php
index 15e6643dfb3..681f03981f5 100644
--- a/lib/private/user/database.php
+++ b/lib/private/user/database.php
@@ -42,7 +42,9 @@ class OC_User_Database extends OC_User_Backend {
/**
* @var PasswordHash
*/
- static private $hasher = null;
+ private static $hasher = null;
+
+ private $cache = array();
private function getHasher() {
if (!self::$hasher) {
@@ -51,7 +53,6 @@ class OC_User_Database extends OC_User_Backend {
self::$hasher = new PasswordHash(8, $forcePortable);
}
return self::$hasher;
-
}
/**
@@ -64,9 +65,7 @@ class OC_User_Database extends OC_User_Backend {
* itself, not in its subclasses.
*/
public function createUser($uid, $password) {
- if ($this->userExists($uid)) {
- return false;
- } else {
+ if (!$this->userExists($uid)) {
$hasher = $this->getHasher();
$hash = $hasher->HashPassword($password . OC_Config::getValue('passwordsalt', ''));
$query = OC_DB::prepare('INSERT INTO `*PREFIX*users` ( `uid`, `password` ) VALUES( ?, ? )');
@@ -74,6 +73,8 @@ class OC_User_Database extends OC_User_Backend {
return $result ? true : false;
}
+
+ return false;
}
/**
@@ -86,8 +87,13 @@ class OC_User_Database extends OC_User_Backend {
public function deleteUser($uid) {
// Delete user-group-relation
$query = OC_DB::prepare('DELETE FROM `*PREFIX*users` WHERE `uid` = ?');
- $query->execute(array($uid));
- return true;
+ $result = $query->execute(array($uid));
+
+ if (isset($this->cache[$uid])) {
+ unset($this->cache[$uid]);
+ }
+
+ return $result ? true : false;
}
/**
@@ -103,12 +109,12 @@ class OC_User_Database extends OC_User_Backend {
$hasher = $this->getHasher();
$hash = $hasher->HashPassword($password . OC_Config::getValue('passwordsalt', ''));
$query = OC_DB::prepare('UPDATE `*PREFIX*users` SET `password` = ? WHERE `uid` = ?');
- $query->execute(array($hash, $uid));
+ $result = $query->execute(array($hash, $uid));
- return true;
- } else {
- return false;
+ return $result ? true : false;
}
+
+ return false;
}
/**
@@ -121,12 +127,14 @@ class OC_User_Database extends OC_User_Backend {
*/
public function setDisplayName($uid, $displayName) {
if ($this->userExists($uid)) {
- $query = OC_DB::prepare('UPDATE `*PREFIX*users` SET `displayname` = ? WHERE LOWER(`uid`) = ?');
+ $query = OC_DB::prepare('UPDATE `*PREFIX*users` SET `displayname` = ? WHERE LOWER(`uid`) = LOWER(?)');
$query->execute(array($displayName, $uid));
+ $this->cache[$uid]['displayname'] = $displayName;
+
return true;
- } else {
- return false;
}
+
+ return false;
}
/**
@@ -135,14 +143,8 @@ class OC_User_Database extends OC_User_Backend {
* @return string display name
*/
public function getDisplayName($uid) {
- $query = OC_DB::prepare('SELECT `displayname` FROM `*PREFIX*users` WHERE `uid` = ?');
- $result = $query->execute(array($uid))->fetchAll();
- $displayName = trim($result[0]['displayname'], ' ');
- if (!empty($displayName)) {
- return $displayName;
- } else {
- return $uid;
- }
+ $this->loadUser($uid);
+ return empty($this->cache[$uid]['displayname']) ? $uid : $this->cache[$uid]['displayname'];
}
/**
@@ -185,21 +187,41 @@ class OC_User_Database extends OC_User_Backend {
$hasher = $this->getHasher();
if ($hasher->CheckPassword($password . OC_Config::getValue('passwordsalt', ''), $storedHash)) {
return $row['uid'];
- } else {
- return false;
- }
- } else { //old sha1 based hashing
- if (sha1($password) == $storedHash) {
- //upgrade to new hashing
- $this->setPassword($row['uid'], $password);
- return $row['uid'];
- } else {
- return false;
}
+
+ //old sha1 based hashing
+ } elseif (sha1($password) == $storedHash) {
+ //upgrade to new hashing
+ $this->setPassword($row['uid'], $password);
+ return $row['uid'];
}
- } else {
- return false;
}
+
+ return false;
+ }
+
+ /**
+ * @brief Load an user in the cache
+ * @param string $uid the username
+ * @returns boolean
+ */
+ private function loadUser($uid) {
+ if (empty($this->cache[$uid])) {
+ $query = OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)');
+ $result = $query->execute(array($uid));
+
+ if (OC_DB::isError($result)) {
+ OC_Log::write('core', OC_DB::getErrorMessage($result), OC_Log::ERROR);
+ return false;
+ }
+
+ while ($row = $result->fetchRow()) {
+ $this->cache[$uid]['uid'] = $row['uid'];
+ $this->cache[$uid]['displayname'] = $row['displayname'];
+ }
+ }
+
+ return true;
}
/**
@@ -224,13 +246,8 @@ class OC_User_Database extends OC_User_Backend {
* @return boolean
*/
public function userExists($uid) {
- $query = OC_DB::prepare('SELECT COUNT(*) FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)');
- $result = $query->execute(array($uid));
- if (OC_DB::isError($result)) {
- OC_Log::write('core', OC_DB::getErrorMessage($result), OC_Log::ERROR);
- return false;
- }
- return $result->fetchOne() > 0;
+ $this->loadUser($uid);
+ return !empty($this->cache[$uid]);
}
/**
@@ -241,9 +258,9 @@ class OC_User_Database extends OC_User_Backend {
public function getHome($uid) {
if ($this->userExists($uid)) {
return OC_Config::getValue("datadirectory", OC::$SERVERROOT . "/data") . '/' . $uid;
- } else {
- return false;
}
+
+ return false;
}
/**
@@ -256,7 +273,7 @@ class OC_User_Database extends OC_User_Backend {
/**
* counts the users in the database
*
- * @return false|string | bool
+ * @return int | bool
*/
public function countUsers() {
$query = OC_DB::prepare('SELECT COUNT(*) FROM `*PREFIX*users`');
diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php
index 8583a451f2d..14698452e88 100644
--- a/lib/private/user/manager.php
+++ b/lib/private/user/manager.php
@@ -175,13 +175,6 @@ class Manager extends PublicEmitter {
if (is_array($backendUsers)) {
foreach ($backendUsers as $uid) {
$users[] = $this->getUserObject($uid, $backend);
- if (!is_null($limit)) {
- $limit--;
- }
- if (!is_null($offset) and $offset > 0) {
- $offset--;
- }
-
}
}
}
@@ -211,13 +204,6 @@ class Manager extends PublicEmitter {
if (is_array($backendUsers)) {
foreach ($backendUsers as $uid => $displayName) {
$users[] = $this->getUserObject($uid, $backend);
- if (!is_null($limit)) {
- $limit--;
- }
- if (!is_null($offset) and $offset > 0) {
- $offset--;
- }
-
}
}
}
@@ -239,24 +225,25 @@ class Manager extends PublicEmitter {
* @return bool | \OC\User\User the created user of false
*/
public function createUser($uid, $password) {
+ $l = \OC_L10N::get('lib');
// Check the name for bad characters
// Allowed are: "a-z", "A-Z", "0-9" and "_.@-"
if (preg_match('/[^a-zA-Z0-9 _\.@\-]/', $uid)) {
- throw new \Exception('Only the following characters are allowed in a username:'
- . ' "a-z", "A-Z", "0-9", and "_.@-"');
+ throw new \Exception($l->t('Only the following characters are allowed in a username:'
+ . ' "a-z", "A-Z", "0-9", and "_.@-"'));
}
// No empty username
if (trim($uid) == '') {
- throw new \Exception('A valid username must be provided');
+ throw new \Exception($l->t('A valid username must be provided'));
}
// No empty password
if (trim($password) == '') {
- throw new \Exception('A valid password must be provided');
+ throw new \Exception($l->t('A valid password must be provided'));
}
// Check if user already exists
if ($this->userExists($uid)) {
- throw new \Exception('The username is already being used');
+ throw new \Exception($l->t('The username is already being used'));
}
$this->emit('\OC\User', 'preCreateUser', array($uid, $password));
diff --git a/lib/private/util.php b/lib/private/util.php
index 731b7c97503..e6aa7b061b5 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -87,7 +87,9 @@ class OC_Util {
}
/**
+ * Get the quota of a user
* @param string $user
+ * @return int Quota bytes
*/
public static function getUserQuota($user){
$config = \OC::$server->getConfig();
@@ -301,8 +303,6 @@ class OC_Util {
return $errors;
}
- $defaults = new \OC_Defaults();
-
$webServerRestart = false;
//check for database drivers
if(!(is_callable('sqlite_open') or class_exists('SQLite3'))
@@ -598,11 +598,11 @@ class OC_Util {
}
/**
- * @return void
+ * @param array $errors
*/
public static function displayLoginPage($errors = array()) {
$parameters = array();
- foreach( $errors as $key => $value ) {
+ foreach( $errors as $value ) {
$parameters[$value] = true;
}
if (!empty($_POST['user'])) {
@@ -805,7 +805,7 @@ class OC_Util {
array_walk_recursive($value, 'OC_Util::sanitizeHTML');
} else {
//Specify encoding for PHP<5.4
- $value = htmlentities((string)$value, ENT_QUOTES, 'UTF-8');
+ $value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
}
return $value;
}
@@ -827,12 +827,13 @@ class OC_Util {
}
/**
- * @brief Check if the htaccess file is working
+ * @brief Check if the .htaccess file is working
+ * @throws OC\HintException If the testfile can't get written.
* @return bool
- * @description Check if the htaccess file is working by creating a test
+ * @description Check if the .htaccess file is working by creating a test
* file in the data directory and trying to access via http
*/
- public static function isHtAccessWorking() {
+ public static function isHtaccessWorking() {
if (!\OC_Config::getValue("check_for_working_htaccess", true)) {
return true;
}
@@ -902,6 +903,8 @@ class OC_Util {
// for this self test we don't care if the ssl certificate is self signed and the peer cannot be verified.
$client->setVerifyPeer(false);
+ // also don't care if the host can't be verified
+ $client->setVerifyHost(0);
$return = true;
try {
diff --git a/lib/private/vobject.php b/lib/private/vobject.php
index 267176ebc07..a3e9f7ef790 100644
--- a/lib/private/vobject.php
+++ b/lib/private/vobject.php
@@ -36,8 +36,8 @@ class OC_VObject{
/**
* @brief Parses the VObject
- * @param string VObject as string
- * @returns Sabre_VObject or null
+ * @param string $data VObject as string
+ * @returns Sabre\VObject\Reader|null
*/
public static function parse($data) {
try {
@@ -55,7 +55,7 @@ class OC_VObject{
/**
* @brief Escapes semicolons
- * @param string $value
+ * @param array $value
* @return string
*/
public static function escapeSemicolons($value) {
@@ -88,7 +88,7 @@ class OC_VObject{
}
/**
- * Constuctor
+ * Constructor
* @param Sabre\VObject\Component or string
*/
public function __construct($vobject_or_name) {
@@ -99,6 +99,11 @@ class OC_VObject{
}
}
+ /**
+ * @todo Write documentation
+ * @param $item
+ * @param null $itemValue
+ */
public function add($item, $itemValue = null) {
if ($item instanceof OC_VObject) {
$item = $item->getVObject();
@@ -110,8 +115,8 @@ class OC_VObject{
* @brief Add property to vobject
* @param object $name of property
* @param object $value of property
- * @param object $parameters of property
- * @returns Sabre_VObject_Property newly created
+ * @param array|object $parameters of property
+ * @returns Sabre\VObject\Property newly created
*/
public function addProperty($name, $value, $parameters=array()) {
if(is_array($value)) {
@@ -131,6 +136,11 @@ class OC_VObject{
$this->vobject->add('UID', $uid);
}
+ /**
+ * @todo Write documentation
+ * @param mixed $name
+ * @param string $string
+ */
public function setString($name, $string) {
if ($string != '') {
$string = strtr($string, array("\r\n"=>"\n"));
@@ -145,7 +155,7 @@ class OC_VObject{
* When $datetime is set to 'now', use the current time
* When $datetime is null, unset the property
*
- * @param string property name
+ * @param string $name
* @param DateTime $datetime
* @param int $dateType
* @return void
@@ -163,12 +173,22 @@ class OC_VObject{
}
}
+ /**
+ * @todo Write documentation
+ * @param $name
+ * @return string
+ */
public function getAsString($name) {
return $this->vobject->__isset($name) ?
$this->vobject->__get($name)->value :
'';
}
+ /**
+ * @todo Write documentation
+ * @param $name
+ * @return array
+ */
public function getAsArray($name) {
$values = array();
if ($this->vobject->__isset($name)) {
@@ -178,6 +198,11 @@ class OC_VObject{
return $values;
}
+ /**
+ * @todo Write documentation
+ * @param $name
+ * @return array|OC_VObject|\Sabre\VObject\Property
+ */
public function &__get($name) {
if ($name == 'children') {
return $this->vobject->children;
@@ -189,18 +214,38 @@ class OC_VObject{
return $return;
}
+ /**
+ * @todo Write documentation
+ * @param string $name
+ * @param string $value
+ */
public function __set($name, $value) {
return $this->vobject->__set($name, $value);
}
+ /**
+ * @todo Write documentation
+ * @param string $name
+ */
public function __unset($name) {
return $this->vobject->__unset($name);
}
+ /**
+ * @todo Write documentation
+ * @param string $name
+ * @return bool
+ */
public function __isset($name) {
return $this->vobject->__isset($name);
}
+ /**
+ * @todo Write documentation
+ * @param $function
+ * @param $arguments
+ * @return mixed
+ */
public function __call($function, $arguments) {
return call_user_func_array(array($this->vobject, $function), $arguments);
}
diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php
index 7c2219bd046..758f0a80083 100644
--- a/lib/public/appframework/controller.php
+++ b/lib/public/appframework/controller.php
@@ -38,10 +38,10 @@ use OCP\IRequest;
abstract class Controller {
/**
- * app container for dependency injection
- * @var \OCP\AppFramework\IAppContainer
+ * app name
+ * @var string
*/
- protected $app;
+ protected $appName;
/**
* current request
@@ -51,11 +51,11 @@ abstract class Controller {
/**
* constructor of the controller
- * @param IAppContainer $app interface to the app
+ * @param string $appName the name of the app
* @param IRequest $request an instance of the request
*/
- public function __construct(IAppContainer $app, IRequest $request){
- $this->app = $app;
+ public function __construct($appName, IRequest $request){
+ $this->appName = $appName;
$this->request = $request;
}
@@ -136,7 +136,7 @@ abstract class Controller {
*/
public function render($templateName, array $params=array(),
$renderAs='user', array $headers=array()){
- $response = new TemplateResponse($this->app->getAppName(), $templateName);
+ $response = new TemplateResponse($this->appName, $templateName);
$response->setParams($params);
$response->renderAs($renderAs);
diff --git a/lib/private/appframework/http/downloadresponse.php b/lib/public/appframework/http/downloadresponse.php
index 67b9542dba6..d3c2818e828 100644
--- a/lib/private/appframework/http/downloadresponse.php
+++ b/lib/public/appframework/http/downloadresponse.php
@@ -22,7 +22,7 @@
*/
-namespace OC\AppFramework\Http;
+namespace OCP\AppFramework\Http;
/**
diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php
index b54b23a34e6..6d029b7464a 100644
--- a/lib/public/appframework/http/jsonresponse.php
+++ b/lib/public/appframework/http/jsonresponse.php
@@ -49,7 +49,6 @@ class JSONResponse extends Response {
public function __construct($data=array(), $statusCode=Http::STATUS_OK) {
$this->data = $data;
$this->setStatus($statusCode);
- $this->addHeader('X-Content-Type-Options', 'nosniff');
$this->addHeader('Content-type', 'application/json; charset=utf-8');
}
@@ -66,9 +65,12 @@ class JSONResponse extends Response {
* Sets values in the data json array
* @param array|object $data an array or object which will be transformed
* to JSON
+ * @return JSONResponse Reference to this object
*/
public function setData($data){
$this->data = $data;
+
+ return $this;
}
diff --git a/lib/private/appframework/http/redirectresponse.php b/lib/public/appframework/http/redirectresponse.php
index 05353349065..416e1533635 100644
--- a/lib/private/appframework/http/redirectresponse.php
+++ b/lib/public/appframework/http/redirectresponse.php
@@ -22,7 +22,7 @@
*/
-namespace OC\AppFramework\Http;
+namespace OCP\AppFramework\Http;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http;
diff --git a/lib/public/appframework/http/response.php b/lib/public/appframework/http/response.php
index d223621d4fd..45402d9b3b3 100644
--- a/lib/public/appframework/http/response.php
+++ b/lib/public/appframework/http/response.php
@@ -80,6 +80,7 @@ class Response {
$this->addHeader('Cache-Control', 'no-cache, must-revalidate');
}
+ return $this;
}
@@ -88,6 +89,7 @@ class Response {
* function
* @param string $name The name of the HTTP header
* @param string $value The value, null will delete it
+ * @return Response Reference to this object
*/
public function addHeader($name, $value) {
if(is_null($value)) {
@@ -95,6 +97,8 @@ class Response {
} else {
$this->headers[$name] = $value;
}
+
+ return $this;
}
@@ -130,9 +134,12 @@ class Response {
/**
* Set response status
* @param int $status a HTTP status code, see also the STATUS constants
+ * @return Response Reference to this object
*/
public function setStatus($status) {
$this->status = $status;
+
+ return $this;
}
@@ -165,18 +172,24 @@ class Response {
/**
* Set the ETag
* @param string $ETag
+ * @return Response Reference to this object
*/
public function setETag($ETag) {
$this->ETag = $ETag;
+
+ return $this;
}
/**
* Set "last modified" date
* @param \DateTime $lastModified
+ * @return Response Reference to this object
*/
public function setLastModified($lastModified) {
$this->lastModified = $lastModified;
+
+ return $this;
}
diff --git a/lib/public/appframework/http/templateresponse.php b/lib/public/appframework/http/templateresponse.php
index 2200a38beca..f5baf788ada 100644
--- a/lib/public/appframework/http/templateresponse.php
+++ b/lib/public/appframework/http/templateresponse.php
@@ -74,9 +74,12 @@ class TemplateResponse extends Response {
* Sets template parameters
* @param array $params an array with key => value structure which sets template
* variables
+ * @return TemplateResponse Reference to this object
*/
public function setParams(array $params){
$this->params = $params;
+
+ return $this;
}
@@ -104,9 +107,12 @@ class TemplateResponse extends Response {
* settings header and footer, user renders the normal
* normal page including footer and header and blank
* just renders the plain template
+ * @return TemplateResponse Reference to this object
*/
public function renderAs($renderAs){
$this->renderAs = $renderAs;
+
+ return $this;
}
diff --git a/lib/public/appframework/iappcontainer.php b/lib/public/appframework/iappcontainer.php
index e4f5f37cad2..a0b0c06881a 100644
--- a/lib/public/appframework/iappcontainer.php
+++ b/lib/public/appframework/iappcontainer.php
@@ -50,10 +50,10 @@ interface IAppContainer extends IContainer{
function getServer();
/**
- * @param Middleware $middleWare
+ * @param string $middleWare
* @return boolean
*/
- function registerMiddleWare(Middleware $middleWare);
+ function registerMiddleWare($middleWare);
/**
* @return boolean
diff --git a/lib/public/config.php b/lib/public/config.php
index bb973939f44..8e3791b449b 100644
--- a/lib/public/config.php
+++ b/lib/public/config.php
@@ -64,7 +64,7 @@ class Config {
public static function setSystemValue( $key, $value ) {
try {
\OC_Config::setValue( $key, $value );
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return false;
}
return true;
@@ -96,7 +96,7 @@ class Config {
public static function setAppValue( $app, $key, $value ) {
try {
\OC_Appconfig::setValue( $app, $key, $value );
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return false;
}
return true;
@@ -131,7 +131,7 @@ class Config {
public static function setUserValue( $user, $app, $key, $value ) {
try {
\OC_Preferences::setValue( $user, $app, $key, $value );
- } catch (Exception $e) {
+ } catch (\Exception $e) {
return false;
}
return true;
diff --git a/lib/public/contacts/imanager.php b/lib/public/contacts/imanager.php
index 5b9d64ecc41..005b71f298b 100644
--- a/lib/public/contacts/imanager.php
+++ b/lib/public/contacts/imanager.php
@@ -96,7 +96,7 @@ namespace OCP\Contacts {
* This function can be used to delete the contact identified by the given id
*
* @param object $id the unique identifier to a contact
- * @param $address_book_key
+ * @param string $address_book_key identifier of the address book in which the contact shall be deleted
* @return bool successful or not
*/
function delete($id, $address_book_key);
@@ -106,7 +106,7 @@ namespace OCP\Contacts {
* Otherwise the contact will be updated by replacing the entire data set.
*
* @param array $properties this array if key-value-pairs defines a contact
- * @param $address_book_key string to identify the address book in which the contact shall be created or updated
+ * @param string $address_book_key identifier of the address book in which the contact shall be created or updated
* @return array representing the contact just created or updated
*/
function createOrUpdate($properties, $address_book_key);
diff --git a/lib/public/iappconfig.php b/lib/public/iappconfig.php
index 1f31898bf2c..2b014df2e42 100644
--- a/lib/public/iappconfig.php
+++ b/lib/public/iappconfig.php
@@ -55,9 +55,8 @@ interface IAppConfig {
/**
* get multiply values, either the app or key can be used as wildcard by setting it to false
*
- * @param app
- * @param key
- * @param string $key
+ * @param string|false $key
+ * @param string|false $app
* @return array
*/
public function getValues($app, $key);
diff --git a/lib/public/il10n.php b/lib/public/il10n.php
index 1c025e7824f..1388274c21a 100644
--- a/lib/public/il10n.php
+++ b/lib/public/il10n.php
@@ -23,7 +23,7 @@ namespace OCP;
interface IL10N {
/**
* Translating
- * @param $text String The text we need a translation for
+ * @param string $text The text we need a translation for
* @param array $parameters default:array() Parameters for sprintf
* @return \OC_L10N_String Translation or the same text
*
@@ -34,9 +34,9 @@ interface IL10N {
/**
* Translating
- * @param $text_singular String the string to translate for exactly one object
- * @param $text_plural String the string to translate for n objects
- * @param $count Integer Number of objects
+ * @param string $text_singular the string to translate for exactly one object
+ * @param string $text_plural the string to translate for n objects
+ * @param integer $count Number of objects
* @param array $parameters default:array() Parameters for sprintf
* @return \OC_L10N_String Translation or the same text
*
@@ -51,8 +51,8 @@ interface IL10N {
/**
* Localization
- * @param $type Type of localization
- * @param $params parameters for this localization
+ * @param string $type Type of localization
+ * @param array $data parameters for this localization
* @return String or false
*
* Returns the localized data.
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index dc3aff663d4..600d81d83af 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -122,7 +122,7 @@ interface IServerContainer {
/**
* get an L10N instance
- * @param $app string appid
+ * @param string $app appid
* @return \OCP\IL10N
*/
function getL10N($app);
diff --git a/lib/public/route/iroute.php b/lib/public/route/iroute.php
index 66fdb841821..d5610e762a8 100644
--- a/lib/public/route/iroute.php
+++ b/lib/public/route/iroute.php
@@ -10,6 +10,7 @@ namespace OCP\Route;
interface IRoute {
/**
* Specify PATCH as the method to use with this route
+ * @return \OCP\Route\IRoute
*/
public function patch();
@@ -26,21 +27,25 @@ interface IRoute {
* it is called directly
*
* @param $file
+ * @return void
*/
public function actionInclude($file);
/**
* Specify GET as the method to use with this route
+ * @return \OCP\Route\IRoute
*/
public function get();
/**
* Specify POST as the method to use with this route
+ * @return \OCP\Route\IRoute
*/
public function post();
/**
* Specify DELETE as the method to use with this route
+ * @return \OCP\Route\IRoute
*/
public function delete();
@@ -74,6 +79,7 @@ interface IRoute {
/**
* Specify PUT as the method to use with this route
+ * @return \OCP\Route\IRoute
*/
public function put();
}
diff --git a/lib/public/route/irouter.php b/lib/public/route/irouter.php
index 125cd29e81b..1c003c7b4b9 100644
--- a/lib/public/route/irouter.php
+++ b/lib/public/route/irouter.php
@@ -17,10 +17,14 @@ interface IRouter {
*/
public function getRoutingFiles();
+ /**
+ * @return string
+ */
public function getCacheKey();
/**
* loads the api routes
+ * @return void
*/
public function loadRoutes($app = null);
@@ -28,6 +32,7 @@ interface IRouter {
* Sets the collection to use for adding routes
*
* @param string $name Name of the collection to use.
+ * @return void
*/
public function useCollection($name);
@@ -47,6 +52,7 @@ interface IRouter {
*
* @param string $url The url to find
* @throws \Exception
+ * @return void
*/
public function match($url);
diff --git a/lib/public/share.php b/lib/public/share.php
index a08134b3837..230a517b5ee 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -63,15 +63,16 @@ class Share extends \OC\Share\Constants {
/**
* Find which users can access a shared item
- * @param $path to the file
- * @param $user owner of the file
- * @param include owner to the list of users with access to the file
+ * @param string $path to the file
+ * @param string $ownerUser owner of the file
+ * @param bool $includeOwner include owner to the list of users with access to the file
+ * @param bool $returnUserPaths Return an array with the user => path map
* @return array
* @note $path needs to be relative to user data dir, e.g. 'file.txt'
* not '/admin/data/file.txt'
*/
- public static function getUsersSharingFile($path, $user, $includeOwner = false) {
- return \OC\Share\Share::getUsersSharingFile($path, $user, $includeOwner);
+ public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false) {
+ return \OC\Share\Share::getUsersSharingFile($path, $ownerUser, $includeOwner, $returnUserPaths);
}
/**
@@ -90,6 +91,22 @@ class Share extends \OC\Share\Constants {
}
/**
+ * Get the items of item type shared with a user
+ * @param string Item type
+ * @param sting user id for which user we want the shares
+ * @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 getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE,
+ $parameters = null, $limit = -1, $includeCollections = false) {
+
+ return \OC\Share\Share::getItemsSharedWithUser($itemType, $user, $format, $parameters, $limit, $includeCollections);
+ }
+
+ /**
* Get the item of item type shared with the current user
* @param string $itemType
* @param string $itemTarget
diff --git a/lib/public/template.php b/lib/public/template.php
index 9a994c1bea8..6cc984b12d5 100644
--- a/lib/public/template.php
+++ b/lib/public/template.php
@@ -67,7 +67,7 @@ function preview_icon( $path ) {
* Returns the path to the preview of the image.
* @param string $path of file
* @param string $token
- * @return link to the preview
+ * @return string link to the preview
*/
function publicPreview_icon ( $path, $token ) {
return(\publicPreview_icon( $path, $token ));
diff --git a/lib/public/util.php b/lib/public/util.php
index f02213f2446..f06ddd66641 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -57,7 +57,7 @@ class Util {
* @param string $mailtext
* @param string $fromaddress
* @param string $fromname
- * @param bool $html
+ * @param int $html
* @param string $altbody
* @param string $ccaddress
* @param string $ccname
@@ -85,7 +85,7 @@ class Util {
* write exception into the log. Include the stack trace
* if DEBUG mode is enabled
* @param string $app app name
- * @param Exception $ex exception to log
+ * @param \Exception $ex exception to log
*/
public static function logException( $app, \Exception $ex ) {
$class = get_class($ex);
@@ -156,6 +156,7 @@ class Util {
* formats a timestamp in the "right" way
* @param int $timestamp $timestamp
* @param bool $dateOnly option to omit time from the result
+ * @return string timestamp
*/
public static function formatDate( $timestamp, $dateOnly=false) {
return(\OC_Util::formatDate( $timestamp, $dateOnly ));
@@ -203,9 +204,8 @@ class Util {
* Creates an url using a defined route
* @param $route
* @param array $parameters
- * @return
* @internal param array $args with param=>value, will be appended to the returned url
- * @return the url
+ * @return string the url
*/
public static function linkToRoute( $route, $parameters = array() ) {
return \OC_Helper::linkToRoute($route, $parameters);
@@ -284,8 +284,7 @@ class Util {
/**
* Returns the request uri, even if the website uses one or more reverse proxies
- *
- * @return the request uri
+ * @return string the request uri
*/
public static function getRequestUri() {
return(\OC_Request::requestUri());
@@ -293,8 +292,7 @@ class Util {
/**
* Returns the script name, even if the website uses one or more reverse proxies
- *
- * @return the script name
+ * @returns string the script name
*/
public static function getScriptName() {
return(\OC_Request::scriptName());
@@ -350,7 +348,7 @@ class Util {
* Emits a signal. To get data from the slot use references!
* @param string $signalclass class name of emitter
* @param string $signalname name of signal
- * @param string $params defautl: array() array with additional data
+ * @param array $params default: array() array with additional data
* @return bool true if slots exists or false if not
*
* TODO: write example
@@ -467,9 +465,8 @@ class Util {
/**
* Calculate free space left within user quota
- *
- * @param $dir the current folder where the user currently operates
- * @return number of bytes representing
+ * @param string $dir the current folder where the user currently operates
+ * @return int number of bytes representing
*/
public static function freeSpace($dir) {
return \OC_Helper::freeSpace($dir);