aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php5
-rw-r--r--lib/l10n/el.php4
-rw-r--r--lib/l10n/fr.php6
-rw-r--r--lib/l10n/gl.php6
-rw-r--r--lib/l10n/ja.php71
-rw-r--r--lib/l10n/pl.php6
-rw-r--r--lib/l10n/pt_PT.php1
-rw-r--r--lib/l10n/sl.php6
-rw-r--r--lib/l10n/tr.php6
-rw-r--r--lib/private/image.php152
-rwxr-xr-xlib/private/preview.php67
-rw-r--r--lib/private/setup/postgresql.php20
-rw-r--r--lib/public/share.php6
13 files changed, 285 insertions, 71 deletions
diff --git a/lib/base.php b/lib/base.php
index 86ee5349828..6ad3a84bcac 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -661,7 +661,10 @@ class OC {
*/
public static function registerPreviewHooks() {
OC_Hook::connect('OC_Filesystem', 'post_write', 'OC\Preview', 'post_write');
- OC_Hook::connect('OC_Filesystem', 'delete', 'OC\Preview', 'post_delete');
+ OC_Hook::connect('OC_Filesystem', 'preDelete', 'OC\Preview', 'prepare_delete_files');
+ OC_Hook::connect('\OCP\Versions', 'preDelete', 'OC\Preview', 'prepare_delete');
+ OC_Hook::connect('\OCP\Trashbin', 'preDelete', 'OC\Preview', 'prepare_delete');
+ OC_Hook::connect('OC_Filesystem', 'delete', 'OC\Preview', 'post_delete_files');
OC_Hook::connect('\OCP\Versions', 'delete', 'OC\Preview', 'post_delete');
OC_Hook::connect('\OCP\Trashbin', 'delete', 'OC\Preview', 'post_delete');
}
diff --git a/lib/l10n/el.php b/lib/l10n/el.php
index 18dc3b83794..148b7fc1fe5 100644
--- a/lib/l10n/el.php
+++ b/lib/l10n/el.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "Δεν ενεργοποιήθηκε η εφαρμογή",
"Authentication error" => "Σφάλμα πιστοποίησης",
"Token expired. Please reload page." => "Το αναγνωριστικό έληξε. Παρακαλώ φορτώστε ξανά την σελίδα.",
+"Unknown user" => "Άγνωστος χρήστης",
"Files" => "Αρχεία",
"Text" => "Κείμενο",
"Images" => "Εικόνες",
@@ -39,8 +40,11 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s μάλλον δεν χρησιμοποιείτε τελείες στο όνομα της βάσης δεδομένων",
"MS SQL username and/or password not valid: %s" => "Το όνομα χρήστη και/ή ο κωδικός της MS SQL δεν είναι έγκυρα: %s",
"You need to enter either an existing account or the administrator." => "Χρειάζεται να εισάγετε είτε έναν υπάρχον λογαριασμό ή του διαχειριστή.",
+"MySQL/MariaDB username and/or password not valid" => "Μη έγκυρο όνομα χρήστη ή/και συνθηματικό της MySQL/MariaDB",
"DB Error: \"%s\"" => "Σφάλμα Βάσης Δεδομένων: \"%s\"",
"Offending command was: \"%s\"" => "Η εντολη παραβατικοτητας ηταν: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "Υπάρχει ήδη ο χρήστης '%s'@'localhost' της MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "Υπάρχει ήδη ο χρήστης '%s'@'%%' της MySQL/MariaDB",
"Oracle connection could not be established" => "Αδυναμία σύνδεσης Oracle",
"Oracle username and/or password not valid" => "Μη έγκυρος χρήστης και/ή συνθηματικό της Oracle",
"Offending command was: \"%s\", name: %s, password: %s" => "Η εντολη παραβατικοτητας ηταν: \"%s\", ονομα: %s, κωδικος: %s",
diff --git a/lib/l10n/fr.php b/lib/l10n/fr.php
index ebed0588588..d866fb664ee 100644
--- a/lib/l10n/fr.php
+++ b/lib/l10n/fr.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "L'application n'est pas activée",
"Authentication error" => "Erreur d'authentification",
"Token expired. Please reload page." => "La session a expiré. Veuillez recharger la page.",
+"Unknown user" => "Utilisateur inconnu",
"Files" => "Fichiers",
"Text" => "Texte",
"Images" => "Images",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s vous nez pouvez pas utiliser de points dans le nom de la base de données",
"MS SQL username and/or password not valid: %s" => "Le nom d'utilisateur et/ou le mot de passe de la base MS SQL est invalide : %s",
"You need to enter either an existing account or the administrator." => "Vous devez spécifier soit le nom d'un compte existant, soit celui de l'administrateur.",
+"MySQL/MariaDB username and/or password not valid" => "Nom d'utilisateur et/ou mot de passe MySQL/MariaDB invalide",
"DB Error: \"%s\"" => "Erreur de la base de données : \"%s\"",
"Offending command was: \"%s\"" => "La requête en cause est : \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "L'utilisateur MySQL/MariaDB '%s'@'localhost' existe déjà.",
+"Drop this user from MySQL/MariaDB" => "Retirer cet utilisateur de la base MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "L'utilisateur MySQL/MariaDB '%s'@'%%' existe déjà",
+"Drop this user from MySQL/MariaDB." => "Retirer cet utilisateur de la base MySQL/MariaDB.",
"Oracle connection could not be established" => "La connexion Oracle ne peut pas être établie",
"Oracle username and/or password not valid" => "Nom d'utilisateur et/ou mot de passe de la base Oracle invalide",
"Offending command was: \"%s\", name: %s, password: %s" => "La requête en cause est : \"%s\", nom : %s, mot de passe : %s",
diff --git a/lib/l10n/gl.php b/lib/l10n/gl.php
index 8a06f40d0e1..cc1351c2f15 100644
--- a/lib/l10n/gl.php
+++ b/lib/l10n/gl.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "O aplicativo non está activado",
"Authentication error" => "Produciuse un erro de autenticación",
"Token expired. Please reload page." => "Testemuña caducada. Recargue a páxina.",
+"Unknown user" => "Usuario descoñecido",
"Files" => "Ficheiros",
"Text" => "Texto",
"Images" => "Imaxes",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s non se poden empregar puntos na base de datos",
"MS SQL username and/or password not valid: %s" => "Nome de usuario e/ou contrasinal de MS SQL incorrecto: %s",
"You need to enter either an existing account or the administrator." => "Deberá introducir unha conta existente ou o administrador.",
+"MySQL/MariaDB username and/or password not valid" => "O nome e/ou o contrasinal do usuario de MySQL/MariaDB non é correcto",
"DB Error: \"%s\"" => "Produciuse un erro na base de datos: «%s»",
"Offending command was: \"%s\"" => "A orde ofensiva foi: «%s»",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "Xa existe o usuario «%s»@«localhost» no MySQL/MariaDB.",
+"Drop this user from MySQL/MariaDB" => "Eliminar este usuario do MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "Xa existe o usuario «%s»@«%%» no MySQL/MariaDB",
+"Drop this user from MySQL/MariaDB." => "Eliminar este usuario do MySQL/MariaDB.",
"Oracle connection could not be established" => "Non foi posíbel estabelecer a conexión con Oracle",
"Oracle username and/or password not valid" => "Nome de usuario e/ou contrasinal de Oracle incorrecto",
"Offending command was: \"%s\", name: %s, password: %s" => "A orde ofensiva foi: «%s», nome: %s, contrasinal: %s",
diff --git a/lib/l10n/ja.php b/lib/l10n/ja.php
new file mode 100644
index 00000000000..015c885904e
--- /dev/null
+++ b/lib/l10n/ja.php
@@ -0,0 +1,71 @@
+<?php
+$TRANSLATIONS = array(
+"App \"%s\" can't be installed because it is not compatible with this version of ownCloud." => " \"%s\" アプリは、このバージョンのownCloudと互換性がないためインストールできません。",
+"No app name specified" => "アプリ名が未指定",
+"Help" => "ヘルプ",
+"Personal" => "個人",
+"Settings" => "設定",
+"Users" => "ユーザー",
+"Admin" => "管理",
+"Failed to upgrade \"%s\"." => "\"%s\" へのアップグレードに失敗しました。",
+"Unknown filetype" => "不明なファイルタイプ",
+"Invalid image" => "無効な画像",
+"web services under your control" => "管理下のウェブサービス",
+"ZIP download is turned off." => "ZIPダウンロードは無効です。",
+"Files need to be downloaded one by one." => "ファイルは1つずつダウンロードする必要があります。",
+"Back to Files" => "ファイルに戻る",
+"Selected files too large to generate zip file." => "選択したファイルはZIPファイルの生成には大きすぎます。",
+"Please download the files separately in smaller chunks or kindly ask your administrator." => "少しずつに分けてファイルをダウンロードするか、管理者に問い合わせてください。",
+"No source specified when installing app" => "アプリインストール時のソースが未指定",
+"No href specified when installing app from http" => "アプリインストール時のhttpの URL が未指定",
+"No path specified when installing app from local file" => "アプリインストール時のローカルファイルのパスが未指定",
+"Archives of type %s are not supported" => "\"%s\"タイプのアーカイブ形式は未サポート",
+"Failed to open archive when installing app" => "アプリをインストール中にアーカイブファイルを開けませんでした。",
+"App does not provide an info.xml file" => "アプリにinfo.xmlファイルが入っていません",
+"App can't be installed because of not allowed code in the App" => "アプリで許可されないコードが入っているのが原因でアプリがインストールできません",
+"App can't be installed because it is not compatible with this version of ownCloud" => "アプリは、このバージョンのownCloudと互換性がないためインストールできません。",
+"App can't be installed because it contains the <shipped>true</shipped> tag which is not allowed for non shipped apps" => "非shippedアプリには許可されない<shipped>true</shipped>タグが含まれているためにアプリをインストールできません。",
+"App can't be installed because the version in info.xml/version is not the same as the version reported from the app store" => "info.xml/versionのバージョンがアプリストアのバージョンと合っていないため、アプリはインストールされません",
+"App directory already exists" => "アプリディレクトリはすでに存在します",
+"Can't create app folder. Please fix permissions. %s" => "アプリフォルダーを作成できませんでした。%s のパーミッションを修正してください。",
+"Application is not enabled" => "アプリケーションは無効です",
+"Authentication error" => "認証エラー",
+"Token expired. Please reload page." => "トークンが無効になりました。ページを再読込してください。",
+"Unknown user" => "不明なユーザー",
+"Files" => "ファイル",
+"Text" => "TTY TDD",
+"Images" => "画像",
+"%s enter the database username." => "%s のデータベースのユーザー名を入力してください。",
+"%s enter the database name." => "%s のデータベース名を入力してください。",
+"%s you may not use dots in the database name" => "%s ではデータベース名にドットを利用できないかもしれません。",
+"MS SQL username and/or password not valid: %s" => "MS SQL サーバーのユーザー名/パスワードが正しくありません: %s",
+"You need to enter either an existing account or the administrator." => "既存のアカウントもしくは管理者のどちらかを入力する必要があります。",
+"MySQL/MariaDB username and/or password not valid" => "MySQL/MariaDB のユーザー名及び/またはパスワードが無効",
+"DB Error: \"%s\"" => "DBエラー: \"%s\"",
+"Offending command was: \"%s\"" => "違反コマンド: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "MySQL/MariaDB のユーザー '%s'@'localhost' はすでに存在します。",
+"Drop this user from MySQL/MariaDB" => "MySQL/MariaDB からこのユーザーを削除",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "MySQL/MariaDB のユーザー '%s'@'%%' はすでに存在します",
+"Drop this user from MySQL/MariaDB." => "MySQL/MariaDB からこのユーザーを削除。",
+"Oracle connection could not be established" => "Oracleへの接続が確立できませんでした。",
+"Oracle username and/or password not valid" => "Oracleのユーザー名もしくはパスワードは有効ではありません",
+"Offending command was: \"%s\", name: %s, password: %s" => "違反コマンド: \"%s\"、名前: %s、パスワード: %s",
+"PostgreSQL username and/or password not valid" => "PostgreSQLのユーザー名もしくはパスワードは有効ではありません",
+"Set an admin username." => "管理者のユーザー名を設定",
+"Set an admin password." => "管理者のパスワードを設定。",
+"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "WebDAVインターフェースに問題があると思われるため、WEBサーバーはまだファイルの同期を許可するよう適切に設定されていません。",
+"Please double check the <a href='%s'>installation guides</a>." => "<a href='%s'>インストールガイド</a>をよく確認してください。",
+"%s shared »%s« with you" => "%sが あなたと »%s«を共有しました",
+"Could not find category \"%s\"" => "カテゴリ \"%s\" が見つかりませんでした",
+"seconds ago" => "数秒前",
+"_%n minute ago_::_%n minutes ago_" => array("%n 分前"),
+"_%n hour ago_::_%n hours ago_" => array("%n 時間前"),
+"today" => "今日",
+"yesterday" => "1日前",
+"_%n day go_::_%n days ago_" => array("%n日前"),
+"last month" => "1ヶ月前",
+"_%n month ago_::_%n months ago_" => array("%nヶ月前"),
+"last year" => "1年前",
+"years ago" => "年前"
+);
+$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/l10n/pl.php b/lib/l10n/pl.php
index 56f0b80efdb..bc5e4a947c7 100644
--- a/lib/l10n/pl.php
+++ b/lib/l10n/pl.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "Aplikacja nie jest włączona",
"Authentication error" => "Błąd uwierzytelniania",
"Token expired. Please reload page." => "Token wygasł. Proszę ponownie załadować stronę.",
+"Unknown user" => "Nieznany użytkownik",
"Files" => "Pliki",
"Text" => "Połączenie tekstowe",
"Images" => "Obrazy",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s nie można używać kropki w nazwie bazy danych",
"MS SQL username and/or password not valid: %s" => "Nazwa i/lub hasło serwera MS SQL jest niepoprawne: %s.",
"You need to enter either an existing account or the administrator." => "Należy wprowadzić istniejące konto użytkownika lub administratora.",
+"MySQL/MariaDB username and/or password not valid" => "Użytkownik i/lub hasło do MySQL/MariaDB są niepoprawne",
"DB Error: \"%s\"" => "Błąd DB: \"%s\"",
"Offending command was: \"%s\"" => "Niepoprawna komenda: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "Użytkownik '%s'@'localhost' MySQL/MariaDB już istnieje.",
+"Drop this user from MySQL/MariaDB" => "Usuń tego użytkownika z MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "Użytkownik '%s'@'%%' MySQL/MariaDB już istnieje.",
+"Drop this user from MySQL/MariaDB." => "Usuń tego użytkownika z MySQL/MariaDB",
"Oracle connection could not be established" => "Nie można ustanowić połączenia z bazą Oracle",
"Oracle username and/or password not valid" => "Oracle: Nazwa użytkownika i/lub hasło jest niepoprawne",
"Offending command was: \"%s\", name: %s, password: %s" => "Niepoprawne polecania: \"%s\", nazwa: %s, hasło: %s",
diff --git a/lib/l10n/pt_PT.php b/lib/l10n/pt_PT.php
index 27d79092e76..e6dd459a7e1 100644
--- a/lib/l10n/pt_PT.php
+++ b/lib/l10n/pt_PT.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "A aplicação não está activada",
"Authentication error" => "Erro na autenticação",
"Token expired. Please reload page." => "O token expirou. Por favor recarregue a página.",
+"Unknown user" => "Utilizador desconhecido",
"Files" => "Ficheiros",
"Text" => "Texto",
"Images" => "Imagens",
diff --git a/lib/l10n/sl.php b/lib/l10n/sl.php
index 2a65e03b6f0..411a14370ee 100644
--- a/lib/l10n/sl.php
+++ b/lib/l10n/sl.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "Program ni omogočen",
"Authentication error" => "Napaka overjanja",
"Token expired. Please reload page." => "Žeton je potekel. Stran je treba ponovno naložiti.",
+"Unknown user" => "Neznan uporabnik",
"Files" => "Datoteke",
"Text" => "Besedilo",
"Images" => "Slike",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%s you may not use dots in the database name" => "%s - v imenu podatkovne zbirke ni dovoljeno uporabljati pik.",
"MS SQL username and/or password not valid: %s" => "Uporabniško ime ali geslo MS SQL ni veljavno: %s",
"You need to enter either an existing account or the administrator." => "Prijaviti se je treba v obstoječi ali pa skrbniški račun.",
+"MySQL/MariaDB username and/or password not valid" => "Uporabniško ime ali geslo za MySQL/MariaDB ni veljavno",
"DB Error: \"%s\"" => "Napaka podatkovne zbirke: \"%s\"",
"Offending command was: \"%s\"" => "Napačni ukaz je: \"%s\"",
+"MySQL/MariaDB user '%s'@'localhost' exists already." => "Uporabnik podatkovne zbirke MySQL/MariaDB '%s'@'localhost' že obstaja.",
+"Drop this user from MySQL/MariaDB" => "Odstrani uporabnika iz podatkovne zbirke MySQL/MariaDB",
+"MySQL/MariaDB user '%s'@'%%' already exists" => "Uporabnik podatkovne zbirke MySQL/MariaDB '%s'@'%%' že obstaja.",
+"Drop this user from MySQL/MariaDB." => "Odstrani uporabnika iz podatkovne zbirke MySQL/MariaDB.",
"Oracle connection could not be established" => "Povezave s sistemom Oracle ni mogoče vzpostaviti.",
"Oracle username and/or password not valid" => "Uporabniško ime ali geslo Oracle ni veljavno",
"Offending command was: \"%s\", name: %s, password: %s" => "Napačni ukaz je: \"%s\", ime: %s, geslo: %s",
diff --git a/lib/l10n/tr.php b/lib/l10n/tr.php
index 314012b29a8..2fce8b87bf4 100644
--- a/lib/l10n/tr.php
+++ b/lib/l10n/tr.php
@@ -31,6 +31,7 @@ $TRANSLATIONS = array(
"Application is not enabled" => "Uygulama etkinleştirilmedi",
"Authentication error" => "Kimlik doğrulama hatası",
"Token expired. Please reload page." => "Jetonun süresi geçti. Lütfen sayfayı yenileyin.",
+"Unknown user" => "Bilinmeyen kullanıcı",
"Files" => "Dosyalar",
"Text" => "Metin",
"Images" => "Resimler",
@@ -39,8 +40,13 @@ $TRANSLATIONS = array(
"%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. ",
+"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''. ",
+"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)",
"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. ",
"Offending command was: \"%s\", name: %s, password: %s" => "Hatalı komut: \"%s\", ad: %s, parola: %s",
diff --git a/lib/private/image.php b/lib/private/image.php
index a4a23f0f097..c987ce92c3c 100644
--- a/lib/private/image.php
+++ b/lib/private/image.php
@@ -35,7 +35,7 @@ class OC_Image {
/**
* @brief Get mime type for an image file.
* @param string|null $filepath The path to a local image file.
- * @returns string The mime type if the it could be determined, otherwise an empty string.
+ * @return string The mime type if the it could be determined, otherwise an empty string.
*/
static public function getMimeTypeForFile($filePath) {
// exif_imagetype throws "read error!" if file is less than 12 byte
@@ -48,10 +48,11 @@ class OC_Image {
}
/**
- * @brief Constructor.
- * @param string|resource $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function.
- * @returns bool False on error
- */
+ * @brief Constructor.
+ * @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
+ */
public function __construct($imageRef = null) {
//OC_Log::write('core',__METHOD__.'(): start', OC_Log::DEBUG);
if(!extension_loaded('gd') || !function_exists('gd_info')) {
@@ -70,7 +71,7 @@ class OC_Image {
/**
* @brief Determine whether the object contains an image resource.
- * @returns bool
+ * @return bool
*/
public function valid() { // apparently you can't name a method 'empty'...
return is_resource($this->resource);
@@ -78,7 +79,7 @@ class OC_Image {
/**
* @brief Returns the MIME type of the image or an empty string if no image is loaded.
- * @returns int
+ * @return int
*/
public function mimeType() {
return $this->valid() ? $this->mimeType : '';
@@ -86,7 +87,7 @@ class OC_Image {
/**
* @brief Returns the width of the image or -1 if no image is loaded.
- * @returns int
+ * @return int
*/
public function width() {
return $this->valid() ? imagesx($this->resource) : -1;
@@ -94,7 +95,7 @@ class OC_Image {
/**
* @brief Returns the height of the image or -1 if no image is loaded.
- * @returns int
+ * @return int
*/
public function height() {
return $this->valid() ? imagesy($this->resource) : -1;
@@ -102,7 +103,7 @@ class OC_Image {
/**
* @brief Returns the width when the image orientation is top-left.
- * @returns int
+ * @return int
*/
public function widthTopLeft() {
$o = $this->getOrientation();
@@ -125,7 +126,7 @@ class OC_Image {
/**
* @brief Returns the height when the image orientation is top-left.
- * @returns int
+ * @return int
*/
public function heightTopLeft() {
$o = $this->getOrientation();
@@ -147,34 +148,46 @@ class OC_Image {
}
/**
- * @brief Outputs the image.
- * @returns bool
- */
- public function show() {
- header('Content-Type: '.$this->mimeType());
- return $this->_output();
+ * @brief Outputs the image.
+ * @param string $mimeType
+ * @return bool
+ */
+ public function show($mimeType=null) {
+ if($mimeType === null) {
+ $mimeType = $this->mimeType();
+ }
+ header('Content-Type: '.$mimeType);
+ return $this->_output(null, $mimeType);
}
/**
- * @brief Saves the image.
- * @returns bool
- * @param string $filePath
- */
+ * @brief Saves the image.
+ * @param string $filePath
+ * @param string $mimeType
+ * @return bool
+ */
- public function save($filePath=null) {
+ public function save($filePath=null, $mimeType=null) {
+ if($mimeType === null) {
+ $mimeType = $this->mimeType();
+ }
if($filePath === null && $this->filePath === null) {
OC_Log::write('core', __METHOD__.'(): called with no path.', OC_Log::ERROR);
return false;
} elseif($filePath === null && $this->filePath !== null) {
$filePath = $this->filePath;
}
- return $this->_output($filePath);
+ return $this->_output($filePath, $mimeType);
}
/**
- * @brief Outputs/saves the image.
- */
- private function _output($filePath=null) {
+ * @brief Outputs/saves the image.
+ * @param string $filePath
+ * @param string $mimeType
+ * @return bool
+ * @throws Exception
+ */
+ private function _output($filePath=null, $mimeType=null) {
if($filePath) {
if (!file_exists(dirname($filePath)))
mkdir(dirname($filePath), 0777, true);
@@ -192,7 +205,30 @@ class OC_Image {
return false;
}
- switch($this->imageType) {
+ $imageType = $this->imageType;
+ if($mimeType !== null) {
+ switch($mimeType) {
+ case 'image/gif':
+ $imageType = IMAGETYPE_GIF;
+ break;
+ case 'image/jpeg':
+ $imageType = IMAGETYPE_JPEG;
+ break;
+ case 'image/png':
+ $imageType = IMAGETYPE_PNG;
+ break;
+ case 'image/x-xbitmap':
+ $imageType = IMAGETYPE_XBM;
+ break;
+ case 'image/bmp':
+ $imageType = IMAGETYPE_BMP;
+ break;
+ default:
+ throw new Exception('\OC_Image::_output(): "' . $mimeType . '" is not supported when forcing a specific output format');
+ }
+ }
+
+ switch($imageType) {
case IMAGETYPE_GIF:
$retVal = imagegif($this->resource, $filePath);
break;
@@ -203,7 +239,12 @@ class OC_Image {
$retVal = imagepng($this->resource, $filePath);
break;
case IMAGETYPE_XBM:
- $retVal = imagexbm($this->resource, $filePath);
+ if (function_exists('imagexbm')) {
+ $retVal = imagexbm($this->resource, $filePath);
+ } else {
+ throw new Exception('\OC_Image::_output(): imagexbm() is not supported.');
+ }
+
break;
case IMAGETYPE_WBMP:
$retVal = imagewbmp($this->resource, $filePath);
@@ -225,14 +266,14 @@ class OC_Image {
}
/**
- * @returns resource Returns the image resource in any.
+ * @return resource Returns the image resource in any.
*/
public function resource() {
return $this->resource;
}
/**
- * @returns Returns the raw image data.
+ * @return string Returns the raw image data.
*/
function data() {
ob_start();
@@ -267,7 +308,7 @@ class OC_Image {
/**
* (I'm open for suggestions on better method name ;)
* @brief Get the orientation based on EXIF data.
- * @returns The orientation or -1 if no EXIF data is available.
+ * @return int The orientation or -1 if no EXIF data is available.
*/
public function getOrientation() {
if(!is_callable('exif_read_data')) {
@@ -295,7 +336,7 @@ class OC_Image {
/**
* (I'm open for suggestions on better method name ;)
* @brief Fixes orientation based on EXIF data.
- * @returns bool.
+ * @return bool.
*/
public function fixOrientation() {
$o = $this->getOrientation();
@@ -355,10 +396,10 @@ class OC_Image {
}
/**
- * @brief Loads an image from a local file, a base64 encoded string or a resource created by an imagecreate* function.
- * @param $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 ).
- * @returns An image resource or false on error
- */
+ * @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 ).
+ * @return resource|false An image resource or false on error
+ */
public function load($imageRef) {
if(is_resource($imageRef)) {
if(get_resource_type($imageRef) == 'gd') {
@@ -383,7 +424,7 @@ class OC_Image {
* @brief Loads an image from an open file handle.
* It is the responsibility of the caller to position the pointer at the correct place and to close the handle again.
* @param resource $handle
- * @returns An image resource or false on error
+ * @return An image resource or false on error
*/
public function loadFromFileHandle($handle) {
OC_Log::write('core', __METHOD__.'(): Trying', OC_Log::DEBUG);
@@ -395,8 +436,8 @@ class OC_Image {
/**
* @brief Loads an image from a local file.
- * @param $imagePath The path to a local file.
- * @returns An image resource or false on error
+ * @param bool|string $imagePath The path to a local file.
+ * @return bool|resource An image resource or false on error
*/
public function loadFromFile($imagePath=false) {
// exif_imagetype throws "read error!" if file is less than 12 byte
@@ -496,8 +537,8 @@ class OC_Image {
/**
* @brief Loads an image from a string of data.
- * @param $str A string of image data as read from a file.
- * @returns An image resource or false on error
+ * @param string $str A string of image data as read from a file.
+ * @return bool|resource An image resource or false on error
*/
public function loadFromData($str) {
if(is_resource($str)) {
@@ -521,8 +562,8 @@ class OC_Image {
/**
* @brief Loads an image from a base64 encoded string.
- * @param $str A string base64 encoded string of image data.
- * @returns An image resource or false on error
+ * @param string $str A string base64 encoded string of image data.
+ * @return bool|resource An image resource or false on error
*/
public function loadFromBase64($str) {
if(!is_string($str)) {
@@ -551,7 +592,7 @@ class OC_Image {
* @param string $fileName <p>
* Path to the BMP image.
* </p>
- * @return resource an image resource identifier on success, <b>FALSE</b> on errors.
+ * @return bool|resource an image resource identifier on success, <b>FALSE</b> on errors.
*/
private function imagecreatefrombmp($fileName) {
if (!($fh = fopen($fileName, 'rb'))) {
@@ -690,7 +731,7 @@ class OC_Image {
/**
* @brief Resizes the image preserving ratio.
* @param integer $maxSize The maximum size of either the width or height.
- * @returns bool
+ * @return bool
*/
public function resize($maxSize) {
if(!$this->valid()) {
@@ -713,6 +754,11 @@ class OC_Image {
return true;
}
+ /**
+ * @param int $width
+ * @param int $height
+ * @return bool
+ */
public function preciseResize($width, $height) {
if (!$this->valid()) {
OC_Log::write('core', __METHOD__.'(): No image loaded', OC_Log::ERROR);
@@ -748,8 +794,8 @@ class OC_Image {
/**
* @brief Crops the image to the middle square. If the image is already square it just returns.
- * @param int maximum size for the result (optional)
- * @returns bool for success or failure
+ * @param int $size maximum size for the result (optional)
+ * @return bool for success or failure
*/
public function centerCrop($size=0) {
if(!$this->valid()) {
@@ -807,11 +853,11 @@ class OC_Image {
/**
* @brief Crops the image from point $x$y with dimension $wx$h.
- * @param $x Horizontal position
- * @param $y Vertical position
- * @param $w Width
- * @param $h Height
- * @returns bool for success or failure
+ * @param int $x Horizontal position
+ * @param int $y Vertical position
+ * @param int $w Width
+ * @param int $h Height
+ * @return bool for success or failure
*/
public function crop($x, $y, $w, $h) {
if(!$this->valid()) {
@@ -839,7 +885,7 @@ class OC_Image {
* @brief Resizes the image to fit within a boundry while preserving ratio.
* @param integer $maxWidth
* @param integer $maxHeight
- * @returns bool
+ * @return bool
*/
public function fitIn($maxWidth, $maxHeight) {
if(!$this->valid()) {
diff --git a/lib/private/preview.php b/lib/private/preview.php
index 74051fbc2a3..0c1af3c9588 100755
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -42,6 +42,10 @@ class Preview {
private $scalingup;
private $mimetype;
+ //filemapper used for deleting previews
+ // index is path, value is fileinfo
+ static public $deleteFileMapper = array();
+
//preview images object
/**
* @var \OC_Image
@@ -166,7 +170,11 @@ class Preview {
}
protected function getFileInfo() {
- if (!$this->info) {
+ $absPath = $this->fileView->getAbsolutePath($this->file);
+ $absPath = Files\Filesystem::normalizePath($absPath);
+ if(array_key_exists($absPath, self::$deleteFileMapper)) {
+ $this->info = self::$deleteFileMapper[$absPath];
+ } else if (!$this->info) {
$this->info = $this->fileView->getFileInfo($this->file);
}
return $this->info;
@@ -181,7 +189,10 @@ class Preview {
$this->file = $file;
$this->info = null;
if ($file !== '') {
- $this->mimetype = $this->getFileInfo()->getMimetype();
+ $this->getFileInfo();
+ if($this->info !== null && $this->info !== false) {
+ $this->mimetype = $this->info->getMimetype();
+ }
}
return $this;
}
@@ -274,10 +285,13 @@ class Preview {
$file = $this->getFile();
$fileInfo = $this->getFileInfo($file);
- $fileId = $fileInfo->getId();
+ if($fileInfo !== null && $fileInfo !== false) {
+ $fileId = $fileInfo->getId();
- $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png';
- return $this->userView->unlink($previewPath);
+ $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png';
+ return $this->userView->unlink($previewPath);
+ }
+ return false;
}
/**
@@ -288,11 +302,14 @@ class Preview {
$file = $this->getFile();
$fileInfo = $this->getFileInfo($file);
- $fileId = $fileInfo->getId();
+ if($fileInfo !== null && $fileInfo !== false) {
+ $fileId = $fileInfo->getId();
- $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
- $this->userView->deleteAll($previewPath);
- return $this->userView->rmdir($previewPath);
+ $previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
+ $this->userView->deleteAll($previewPath);
+ return $this->userView->rmdir($previewPath);
+ }
+ return false;
}
/**
@@ -398,6 +415,9 @@ class Preview {
$scalingUp = $this->getScalingUp();
$fileInfo = $this->getFileInfo($file);
+ if($fileInfo === null || $fileInfo === false) {
+ return new \OC_Image();
+ }
$fileId = $fileInfo->getId();
$cached = $this->isCached();
@@ -463,7 +483,7 @@ class Preview {
if (is_null($this->preview)) {
$this->getPreview();
}
- $this->preview->show();
+ $this->preview->show('image/png');
return;
}
@@ -623,12 +643,35 @@ class Preview {
self::post_delete($args);
}
- public static function post_delete($args) {
+ public static function prepare_delete_files($args) {
+ self::prepare_delete($args, 'files/');
+ }
+
+ public static function prepare_delete($args, $prefix='') {
$path = $args['path'];
if (substr($path, 0, 1) === '/') {
$path = substr($path, 1);
}
- $preview = new Preview(\OC_User::getUser(), 'files/', $path);
+
+ $view = new \OC\Files\View('/' . \OC_User::getUser() . '/' . $prefix);
+ $info = $view->getFileInfo($path);
+
+ \OC\Preview::$deleteFileMapper = array_merge(
+ \OC\Preview::$deleteFileMapper,
+ array(
+ Files\Filesystem::normalizePath($view->getAbsolutePath($path)) => $info,
+ )
+ );
+ }
+
+ public static function post_delete_files($args) {
+ self::post_delete($args, 'files/');
+ }
+
+ public static function post_delete($args, $prefix='') {
+ $path = Files\Filesystem::normalizePath($args['path']);
+
+ $preview = new Preview(\OC_User::getUser(), $prefix, $path);
$preview->deleteAllPreviews();
}
diff --git a/lib/private/setup/postgresql.php b/lib/private/setup/postgresql.php
index 89d328ada19..4d0c9b52a4d 100644
--- a/lib/private/setup/postgresql.php
+++ b/lib/private/setup/postgresql.php
@@ -10,13 +10,20 @@ class PostgreSQL extends AbstractDatabase {
$e_user = addslashes($this->dbuser);
$e_password = addslashes($this->dbpassword);
+ // Fix database with port connection
+ if(strpos($e_host, ':')) {
+ list($e_host, $port)=explode(':', $e_host, 2);
+ } else {
+ $port=false;
+ }
+
//check if the database user has admin rights
- $connection_string = "host='$e_host' dbname=postgres user='$e_user' password='$e_password'";
+ $connection_string = "host='$e_host' dbname=postgres user='$e_user' port='$port' password='$e_password'";
$connection = @pg_connect($connection_string);
if(!$connection) {
// Try if we can connect to the DB with the specified name
$e_dbname = addslashes($this->dbname);
- $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' password='$e_password'";
+ $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' port='$port' password='$e_password'";
$connection = @pg_connect($connection_string);
if(!$connection)
@@ -63,7 +70,14 @@ class PostgreSQL extends AbstractDatabase {
$e_user = addslashes($this->dbuser);
$e_password = addslashes($this->dbpassword);
- $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' password='$e_password'";
+ // Fix database with port connection
+ if(strpos($e_host, ':')) {
+ list($e_host, $port)=explode(':', $e_host, 2);
+ } else {
+ $port=false;
+ }
+
+ $connection_string = "host='$e_host' dbname='$e_dbname' user='$e_user' port='$port' password='$e_password'";
$connection = @pg_connect($connection_string);
if(!$connection) {
throw new \DatabaseSetupException($this->trans->t('PostgreSQL username and/or password not valid'),
diff --git a/lib/public/share.php b/lib/public/share.php
index dd9e1bbf9a9..5066d40354d 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -1250,10 +1250,12 @@ class Share {
// 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']));
- //$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
- //$parentResult = $query->execute(array($row['id']));
if (\OC_DB::isError($result)) {
\OC_Log::write('OCP\Share', 'Can\'t select parent: ' .
\OC_DB::getErrorMessage($result) . ', select=' . $select . ' where=' . $where,