summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/l10n/nb_NO.js2
-rw-r--r--lib/l10n/nb_NO.json2
-rw-r--r--lib/l10n/pt_PT.js18
-rw-r--r--lib/l10n/pt_PT.json18
-rw-r--r--lib/l10n/tr.js2
-rw-r--r--lib/l10n/tr.json2
-rw-r--r--lib/private/files/filesystem.php10
-rw-r--r--lib/private/files/mapper.php18
-rw-r--r--lib/private/helper.php3
-rw-r--r--lib/private/mimetypes.list.php5
-rw-r--r--lib/private/util.php3
-rw-r--r--lib/repair/repairmimetypes.php189
12 files changed, 172 insertions, 100 deletions
diff --git a/lib/l10n/nb_NO.js b/lib/l10n/nb_NO.js
index 22f50896cf8..fea128e6f0a 100644
--- a/lib/l10n/nb_NO.js
+++ b/lib/l10n/nb_NO.js
@@ -119,6 +119,8 @@ OC.L10N.register(
"Please ask your server administrator to install the module." : "Be server-administratoren om å installere modulen.",
"PHP module %s not installed." : "PHP-modul %s er ikke installert.",
"Please ask your server administrator to update PHP to the latest version. Your PHP version is no longer supported by ownCloud and the PHP community." : "Be server-administratoren om å oppdatere PHP til nyeste versjon. PHP-versjonen du bruker støttes ikke lenger av ownCloud og PHP-fellesskapet.",
+ "PHP is configured to populate raw post data. Since PHP 5.6 this will lead to PHP throwing notices for perfectly valid code." : "PHP er konfigurert til å fylle \"raw post data\". Fra og med PHP 5.6 vil dette føre til at PHP utsteder notiser for fullstendig gyldig kode.",
+ "To fix this issue set <code>always_populate_raw_post_data</code> to <code>-1</code> in your php.ini" : "For å fikse dette problemet, sett <code>always_populate_raw_post_data</code> til <code>-1</code> i php.ini",
"PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible." : "Det ser ut for at PHP er satt opp til å fjerne innebygde doc blocks. Dette gjør at flere av kjerneapplikasjonene blir utilgjengelige.",
"This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "Dette forårsakes sannsynligvis av en bufrer/akselerator, som f.eks. Zend OPcache eller eAccelerator.",
"PHP modules have been installed, but they are still listed as missing?" : "PHP-moduler har blitt installert, men de listes fortsatt som fraværende?",
diff --git a/lib/l10n/nb_NO.json b/lib/l10n/nb_NO.json
index 201dfeeea69..0fe634772f7 100644
--- a/lib/l10n/nb_NO.json
+++ b/lib/l10n/nb_NO.json
@@ -117,6 +117,8 @@
"Please ask your server administrator to install the module." : "Be server-administratoren om å installere modulen.",
"PHP module %s not installed." : "PHP-modul %s er ikke installert.",
"Please ask your server administrator to update PHP to the latest version. Your PHP version is no longer supported by ownCloud and the PHP community." : "Be server-administratoren om å oppdatere PHP til nyeste versjon. PHP-versjonen du bruker støttes ikke lenger av ownCloud og PHP-fellesskapet.",
+ "PHP is configured to populate raw post data. Since PHP 5.6 this will lead to PHP throwing notices for perfectly valid code." : "PHP er konfigurert til å fylle \"raw post data\". Fra og med PHP 5.6 vil dette føre til at PHP utsteder notiser for fullstendig gyldig kode.",
+ "To fix this issue set <code>always_populate_raw_post_data</code> to <code>-1</code> in your php.ini" : "For å fikse dette problemet, sett <code>always_populate_raw_post_data</code> til <code>-1</code> i php.ini",
"PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible." : "Det ser ut for at PHP er satt opp til å fjerne innebygde doc blocks. Dette gjør at flere av kjerneapplikasjonene blir utilgjengelige.",
"This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "Dette forårsakes sannsynligvis av en bufrer/akselerator, som f.eks. Zend OPcache eller eAccelerator.",
"PHP modules have been installed, but they are still listed as missing?" : "PHP-moduler har blitt installert, men de listes fortsatt som fraværende?",
diff --git a/lib/l10n/pt_PT.js b/lib/l10n/pt_PT.js
index 05bda3ed595..5abfa3f57cd 100644
--- a/lib/l10n/pt_PT.js
+++ b/lib/l10n/pt_PT.js
@@ -8,6 +8,15 @@ OC.L10N.register(
"Sample configuration detected" : "Exemplo de configuração detectada",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Foi detectado que a configuração de amostra foi copiada. Isso pode danificar a sua instalação e não é suportado. Por favor, leia a documentação antes de realizar mudanças no config.php",
"PHP %s or higher is required." : "Necessário PHP %s ou maior.",
+ "PHP with a version lower than %s is required." : "É necessário um PHP com uma versão inferir a %s.",
+ "Following databases are supported: %s" : "As seguintes bases de dados são suportadas: %s",
+ "The command line tool %s could not be found" : "A ferramenta de linha de comento %s não foi encontrada",
+ "The library %s is not available." : "A biblioteca %s não está disponível.",
+ "Library %s with a version higher than %s is required - available version %s." : "É necessário que a biblioteca %s tenha uma versão superior a %s - versão disponível: %s.",
+ "Library %s with a version lower than %s is required - available version %s." : "É necessário que a biblioteca %s tenha uma versão inferior a %s - versão disponível: %s.",
+ "Following platforms are supported: %s" : "As seguintes plataformas são suportadas: %s",
+ "ownCloud %s or higher is required." : "É necessário ownCloud %s ou superior.",
+ "ownCloud with a version lower than %s is required." : "É necessário uma versão do ownCloud inferior a %s.",
"Help" : "Ajuda",
"Personal" : "Pessoal",
"Settings" : "Configurações",
@@ -15,16 +24,17 @@ OC.L10N.register(
"Admin" : "Admin",
"Recommended" : "Recomendado",
"App \\\"%s\\\" can't be installed because it is not compatible with this version of ownCloud." : "A Aplicação \\\"%s\\\" não pode ser instalada porque não é compatível com esta versão do owncloud.",
+ "App \\\"%s\\\" cannot be installed because the following dependencies are not fulfilled: %s" : "A aplicação \\\"%s\\\" não pode ser instalada porque as seguintes dependências não podem ser realizadas: %s",
"No app name specified" : "O nome da aplicação não foi especificado",
"Unknown filetype" : "Ficheiro desconhecido",
"Invalid image" : "Imagem inválida",
"today" : "hoje",
"yesterday" : "ontem",
- "_%n day ago_::_%n days ago_" : ["",""],
+ "_%n day ago_::_%n days ago_" : ["%n dia atrás","%n dias atrás"],
"last month" : "ultímo mês",
"_%n month ago_::_%n months ago_" : ["","%n meses atrás"],
"last year" : "ano passado",
- "_%n year ago_::_%n years ago_" : ["",""],
+ "_%n year ago_::_%n years ago_" : ["%n ano atrás","%n anos atrás"],
"_%n hour ago_::_%n hours ago_" : ["","%n horas atrás"],
"_%n minute ago_::_%n minutes ago_" : ["","%n minutos atrás"],
"seconds ago" : "Minutos atrás",
@@ -67,6 +77,7 @@ OC.L10N.register(
"Set an admin password." : "Definiar uma password de administrador",
"Can't create or write into the data directory %s" : "Não é possível criar ou escrever a directoria data %s",
"%s shared »%s« with you" : "%s partilhado »%s« consigo",
+ "Sharing %s failed, because the backend does not allow shares from type %i" : "A partilha de %s falhou porque não são autorizadas partilhas do tipo %i",
"Sharing %s failed, because the file does not exist" : "A partilha de %s falhou, porque o ficheiro não existe",
"You are not allowed to share %s" : "Não está autorizado a partilhar %s",
"Sharing %s failed, because the user %s is the item owner" : "A partilha %s falhou, porque o utilizador %s é o proprietário",
@@ -77,6 +88,7 @@ OC.L10N.register(
"Sharing %s failed, because %s is not a member of the group %s" : "A partilha %s falhou, porque o utilizador %s não é membro do grupo %s",
"You need to provide a password to create a public link, only protected links are allowed" : "Necessita de fornecer a senha para criar um link publico, só são permitidos links protegidos",
"Sharing %s failed, because sharing with links is not allowed" : "A partilha de %s falhou, porque partilhar com links não é permitido",
+ "Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "A partilha de %s falhou, não foi possível encontrar %s. É possível que o servidor esteja inacessível.",
"Share type %s is not valid for %s" : "O tipo de partilha %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",
@@ -107,6 +119,8 @@ OC.L10N.register(
"Please ask your server administrator to install the module." : "Por favor pergunte ao seu administrador do servidor para instalar o modulo.",
"PHP module %s not installed." : "O modulo %s PHP não está instalado.",
"Please ask your server administrator to update PHP to the latest version. Your PHP version is no longer supported by ownCloud and the PHP community." : "Por favor pessa ao seu administrador de servidor para actualizar o PHP para a ultima versão. A sua versão de PHP não é mais suportada pelo owncloud e a comunidade PHP.",
+ "PHP is configured to populate raw post data. Since PHP 5.6 this will lead to PHP throwing notices for perfectly valid code." : "O PHP está configurado para popular dados raw post. Desde o PHP 5.6 isto levará a que o PHP mostre avisos sobre código perfeitamente válido.",
+ "To fix this issue set <code>always_populate_raw_post_data</code> to <code>-1</code> in your php.ini" : "Para corrigir este problema altere <code>always_populate_raw_post_data</code> para <code>-1</code> no seu php.ini",
"PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible." : "PHP está aparentemente configurado a remover blocos doc em linha. Isto vai fazer algumas aplicações basicas inacessíveis.",
"This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "Isto é provavelmente causado por uma cache/acelerador como o Zend OPcache or eAcelerador.",
"PHP modules have been installed, but they are still listed as missing?" : "Os módulos PHP foram instalados, mas eles ainda estão listados como desaparecidos?",
diff --git a/lib/l10n/pt_PT.json b/lib/l10n/pt_PT.json
index e61ca5e06fa..fff334cb3b0 100644
--- a/lib/l10n/pt_PT.json
+++ b/lib/l10n/pt_PT.json
@@ -6,6 +6,15 @@
"Sample configuration detected" : "Exemplo de configuração detectada",
"It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Foi detectado que a configuração de amostra foi copiada. Isso pode danificar a sua instalação e não é suportado. Por favor, leia a documentação antes de realizar mudanças no config.php",
"PHP %s or higher is required." : "Necessário PHP %s ou maior.",
+ "PHP with a version lower than %s is required." : "É necessário um PHP com uma versão inferir a %s.",
+ "Following databases are supported: %s" : "As seguintes bases de dados são suportadas: %s",
+ "The command line tool %s could not be found" : "A ferramenta de linha de comento %s não foi encontrada",
+ "The library %s is not available." : "A biblioteca %s não está disponível.",
+ "Library %s with a version higher than %s is required - available version %s." : "É necessário que a biblioteca %s tenha uma versão superior a %s - versão disponível: %s.",
+ "Library %s with a version lower than %s is required - available version %s." : "É necessário que a biblioteca %s tenha uma versão inferior a %s - versão disponível: %s.",
+ "Following platforms are supported: %s" : "As seguintes plataformas são suportadas: %s",
+ "ownCloud %s or higher is required." : "É necessário ownCloud %s ou superior.",
+ "ownCloud with a version lower than %s is required." : "É necessário uma versão do ownCloud inferior a %s.",
"Help" : "Ajuda",
"Personal" : "Pessoal",
"Settings" : "Configurações",
@@ -13,16 +22,17 @@
"Admin" : "Admin",
"Recommended" : "Recomendado",
"App \\\"%s\\\" can't be installed because it is not compatible with this version of ownCloud." : "A Aplicação \\\"%s\\\" não pode ser instalada porque não é compatível com esta versão do owncloud.",
+ "App \\\"%s\\\" cannot be installed because the following dependencies are not fulfilled: %s" : "A aplicação \\\"%s\\\" não pode ser instalada porque as seguintes dependências não podem ser realizadas: %s",
"No app name specified" : "O nome da aplicação não foi especificado",
"Unknown filetype" : "Ficheiro desconhecido",
"Invalid image" : "Imagem inválida",
"today" : "hoje",
"yesterday" : "ontem",
- "_%n day ago_::_%n days ago_" : ["",""],
+ "_%n day ago_::_%n days ago_" : ["%n dia atrás","%n dias atrás"],
"last month" : "ultímo mês",
"_%n month ago_::_%n months ago_" : ["","%n meses atrás"],
"last year" : "ano passado",
- "_%n year ago_::_%n years ago_" : ["",""],
+ "_%n year ago_::_%n years ago_" : ["%n ano atrás","%n anos atrás"],
"_%n hour ago_::_%n hours ago_" : ["","%n horas atrás"],
"_%n minute ago_::_%n minutes ago_" : ["","%n minutos atrás"],
"seconds ago" : "Minutos atrás",
@@ -65,6 +75,7 @@
"Set an admin password." : "Definiar uma password de administrador",
"Can't create or write into the data directory %s" : "Não é possível criar ou escrever a directoria data %s",
"%s shared »%s« with you" : "%s partilhado »%s« consigo",
+ "Sharing %s failed, because the backend does not allow shares from type %i" : "A partilha de %s falhou porque não são autorizadas partilhas do tipo %i",
"Sharing %s failed, because the file does not exist" : "A partilha de %s falhou, porque o ficheiro não existe",
"You are not allowed to share %s" : "Não está autorizado a partilhar %s",
"Sharing %s failed, because the user %s is the item owner" : "A partilha %s falhou, porque o utilizador %s é o proprietário",
@@ -75,6 +86,7 @@
"Sharing %s failed, because %s is not a member of the group %s" : "A partilha %s falhou, porque o utilizador %s não é membro do grupo %s",
"You need to provide a password to create a public link, only protected links are allowed" : "Necessita de fornecer a senha para criar um link publico, só são permitidos links protegidos",
"Sharing %s failed, because sharing with links is not allowed" : "A partilha de %s falhou, porque partilhar com links não é permitido",
+ "Sharing %s failed, could not find %s, maybe the server is currently unreachable." : "A partilha de %s falhou, não foi possível encontrar %s. É possível que o servidor esteja inacessível.",
"Share type %s is not valid for %s" : "O tipo de partilha %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",
@@ -105,6 +117,8 @@
"Please ask your server administrator to install the module." : "Por favor pergunte ao seu administrador do servidor para instalar o modulo.",
"PHP module %s not installed." : "O modulo %s PHP não está instalado.",
"Please ask your server administrator to update PHP to the latest version. Your PHP version is no longer supported by ownCloud and the PHP community." : "Por favor pessa ao seu administrador de servidor para actualizar o PHP para a ultima versão. A sua versão de PHP não é mais suportada pelo owncloud e a comunidade PHP.",
+ "PHP is configured to populate raw post data. Since PHP 5.6 this will lead to PHP throwing notices for perfectly valid code." : "O PHP está configurado para popular dados raw post. Desde o PHP 5.6 isto levará a que o PHP mostre avisos sobre código perfeitamente válido.",
+ "To fix this issue set <code>always_populate_raw_post_data</code> to <code>-1</code> in your php.ini" : "Para corrigir este problema altere <code>always_populate_raw_post_data</code> para <code>-1</code> no seu php.ini",
"PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible." : "PHP está aparentemente configurado a remover blocos doc em linha. Isto vai fazer algumas aplicações basicas inacessíveis.",
"This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator." : "Isto é provavelmente causado por uma cache/acelerador como o Zend OPcache or eAcelerador.",
"PHP modules have been installed, but they are still listed as missing?" : "Os módulos PHP foram instalados, mas eles ainda estão listados como desaparecidos?",
diff --git a/lib/l10n/tr.js b/lib/l10n/tr.js
index 0819c2b40f6..f6f8a89713f 100644
--- a/lib/l10n/tr.js
+++ b/lib/l10n/tr.js
@@ -11,7 +11,7 @@ OC.L10N.register(
"PHP with a version lower than %s is required." : "PHP'nin %s sürümü öncesi gerekli.",
"Following databases are supported: %s" : "Şu veritabanları desteklenmekte: %s",
"The command line tool %s could not be found" : "Komut satırı aracı %s bulunamadı",
- "The library %s is not available." : "%s kütüphanesi kullanılamıyor.",
+ "The library %s is not available." : "%s kütüphanesi mevcut değil.",
"Library %s with a version higher than %s is required - available version %s." : "%s kütüphanesinin %s sürümünden daha yüksek sürümü gerekli - kullanılabilir sürüm %s.",
"Library %s with a version lower than %s is required - available version %s." : "%s kütüphanesinin %s sürümünden daha düşük sürümü gerekli - kullanılabilir sürüm %s.",
"Following platforms are supported: %s" : "Aşağıdaki platformlar destekleniyor: %s",
diff --git a/lib/l10n/tr.json b/lib/l10n/tr.json
index adbf8b1b94f..778818c8a86 100644
--- a/lib/l10n/tr.json
+++ b/lib/l10n/tr.json
@@ -9,7 +9,7 @@
"PHP with a version lower than %s is required." : "PHP'nin %s sürümü öncesi gerekli.",
"Following databases are supported: %s" : "Şu veritabanları desteklenmekte: %s",
"The command line tool %s could not be found" : "Komut satırı aracı %s bulunamadı",
- "The library %s is not available." : "%s kütüphanesi kullanılamıyor.",
+ "The library %s is not available." : "%s kütüphanesi mevcut değil.",
"Library %s with a version higher than %s is required - available version %s." : "%s kütüphanesinin %s sürümünden daha yüksek sürümü gerekli - kullanılabilir sürüm %s.",
"Library %s with a version lower than %s is required - available version %s." : "%s kütüphanesinin %s sürümünden daha düşük sürümü gerekli - kullanılabilir sürüm %s.",
"Following platforms are supported: %s" : "Aşağıdaki platformlar destekleniyor: %s",
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php
index 140d892652f..e933782ce2f 100644
--- a/lib/private/files/filesystem.php
+++ b/lib/private/files/filesystem.php
@@ -543,9 +543,11 @@ class Filesystem {
* @return bool
*/
static public function isFileBlacklisted($filename) {
+ $filename = self::normalizePath($filename);
+
$blacklist = \OC_Config::getValue('blacklisted_files', array('.htaccess'));
$filename = strtolower(basename($filename));
- return (in_array($filename, $blacklist));
+ return in_array($filename, $blacklist);
}
/**
@@ -734,6 +736,9 @@ class Filesystem {
return '/';
}
+ //normalize unicode if possible
+ $path = \OC_Util::normalizeUnicode($path);
+
//no windows style slashes
$path = str_replace('\\', '/', $path);
@@ -770,9 +775,6 @@ class Filesystem {
$path = substr($path, 0, -2);
}
- //normalize unicode if possible
- $path = \OC_Util::normalizeUnicode($path);
-
$normalizedPath = $windows_drive_letter . $path;
self::$normalizedPathCache[$cacheKey] = $normalizedPath;
diff --git a/lib/private/files/mapper.php b/lib/private/files/mapper.php
index 5e78ef03dd0..86c23c62e4b 100644
--- a/lib/private/files/mapper.php
+++ b/lib/private/files/mapper.php
@@ -115,6 +115,8 @@ class Mapper
/**
* @param string $logicPath
+ * @return null
+ * @throws \OC\DatabaseException
*/
private function resolveLogicPath($logicPath) {
$logicPath = $this->resolveRelativePath($logicPath);
@@ -162,7 +164,8 @@ class Mapper
/**
* @param string $logicPath
- * @param boolean $store
+ * @param bool $store
+ * @return string
*/
private function create($logicPath, $store) {
$logicPath = $this->resolveRelativePath($logicPath);
@@ -191,7 +194,9 @@ class Mapper
}
/**
- * @param integer $index
+ * @param string $path
+ * @param int $index
+ * @return string
*/
public function slugifyPath($path, $index = null) {
$path = $this->stripRootFolder($path, $this->unchangedPhysicalRoot);
@@ -205,7 +210,7 @@ class Mapper
continue;
}
- $sluggedElements[] = self::slugify($pathElement);
+ $sluggedElements[] = $this->slugify($pathElement);
}
// apply index to file name
@@ -253,13 +258,18 @@ class Mapper
// trim ending dots (for security reasons and win compatibility)
$text = preg_replace('~\.+$~', '', $text);
- if (empty($text)) {
+ if (empty($text) || \OC\Files\Filesystem::isFileBlacklisted($text)) {
/**
* Item slug would be empty. Previously we used uniqid() here.
* However this means that the behaviour is not reproducible, so
* when uploading files into a "empty" folder, the folders name is
* different.
*
+ * The other case is, that the slugified name would be a blacklisted
+ * filename. In this case we just use the same workaround by
+ * returning the secure md5 hash of the original name.
+ *
+ *
* If there would be a md5() hash collision, the deduplicate check
* will spot this and append an index later, so this should not be
* a problem.
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 6268bd3d42e..c87eb63b662 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -40,7 +40,8 @@ class OC_Helper {
'application/x-gimp' => 'image',
'application/x-photoshop' => 'image',
- 'application/x-font-ttf' => 'font',
+ 'application/font-sfnt' => 'font',
+ 'application/x-font' => 'font',
'application/font-woff' => 'font',
'application/vnd.ms-fontobject' => 'font',
diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php
index 4f11829859a..265fffa7db3 100644
--- a/lib/private/mimetypes.list.php
+++ b/lib/private/mimetypes.list.php
@@ -104,9 +104,10 @@ return array(
'oga' => array('audio/ogg', null),
'ogg' => array('audio/ogg', null),
'ogv' => array('video/ogg', null),
- 'otf' => array('font/opentype', null),
+ 'otf' => array('application/font-sfnt', null),
'pages' => array('application/x-iwork-pages-sffpages', null),
'pdf' => array('application/pdf', null),
+ 'pfb' => array('application/x-font', null),
'php' => array('application/x-php', null),
'pl' => array('application/x-perl', null),
'png' => array('image/png', null),
@@ -137,7 +138,7 @@ return array(
'tgz' => array('application/x-compressed', null),
'tiff' => array('image/tiff', null),
'tif' => array('image/tiff', null),
- 'ttf' => array('application/x-font-ttf', null),
+ 'ttf' => array('application/font-sfnt', null),
'txt' => array('text/plain', null),
'vcard' => array('text/vcard', null),
'vcf' => array('text/vcard', null),
diff --git a/lib/private/util.php b/lib/private/util.php
index c08cff81469..9a01ca3ac95 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -818,8 +818,7 @@ class OC_Util {
$parameters['user_autofocus'] = true;
}
if (isset($_REQUEST['redirect_url'])) {
- $redirectUrl = $_REQUEST['redirect_url'];
- $parameters['redirect_url'] = urlencode($redirectUrl);
+ $parameters['redirect_url'] = $_REQUEST['redirect_url'];
}
$parameters['alt_login'] = OC_App::getAlternativeLogIns();
diff --git a/lib/repair/repairmimetypes.php b/lib/repair/repairmimetypes.php
index e3f4402cfd5..06cd144bff4 100644
--- a/lib/repair/repairmimetypes.php
+++ b/lib/repair/repairmimetypes.php
@@ -2,6 +2,7 @@
/**
* Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com>
* Copyright (c) 2014 Jörn Dreyer jfd@owncloud.com
+ * Copyright (c) 2014 Olivier Paroz owncloud@oparoz.com
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
@@ -16,32 +17,32 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
public function getName() {
return 'Repair mime types';
}
-
- private function fixOfficeMimeTypes() {
- // update wrong mimetypes
- $wrongMimetypes = array(
- 'application/mspowerpoint' => 'application/vnd.ms-powerpoint',
- 'application/msexcel' => 'application/vnd.ms-excel',
- );
-
- $existsStmt = \OC_DB::prepare('
+
+ private static function existsStmt() {
+ return \OC_DB::prepare('
SELECT count(`mimetype`)
FROM `*PREFIX*mimetypes`
WHERE `mimetype` = ?
');
+ }
- $getIdStmt = \OC_DB::prepare('
+ private static function getIdStmt() {
+ return \OC_DB::prepare('
SELECT `id`
FROM `*PREFIX*mimetypes`
WHERE `mimetype` = ?
');
+ }
- $insertStmt = \OC_DB::prepare('
+ private static function insertStmt() {
+ return \OC_DB::prepare('
INSERT INTO `*PREFIX*mimetypes` ( `mimetype` )
VALUES ( ? )
');
+ }
- $updateWrongStmt = \OC_DB::prepare('
+ private static function updateWrongStmt() {
+ return \OC_DB::prepare('
UPDATE `*PREFIX*filecache`
SET `mimetype` = (
SELECT `id`
@@ -49,106 +50,125 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
WHERE `mimetype` = ?
) WHERE `mimetype` = ?
');
-
- $deleteStmt = \OC_DB::prepare('
+ }
+
+ private static function deleteStmt() {
+ return \OC_DB::prepare('
DELETE FROM `*PREFIX*mimetypes`
WHERE `id` = ?
');
-
+ }
+
+ private static function updateByNameStmt() {
+ return \OC_DB::prepare('
+ UPDATE `*PREFIX*filecache`
+ SET `mimetype` = (
+ SELECT `id`
+ FROM `*PREFIX*mimetypes`
+ WHERE `mimetype` = ?
+ ) WHERE `name` LIKE ?
+ ');
+ }
+
+ private function repairMimetypes($wrongMimetypes) {
foreach ($wrongMimetypes as $wrong => $correct) {
-
-
// do we need to remove a wrong mimetype?
- $result = \OC_DB::executeAudited($getIdStmt, array($wrong));
+ $result = \OC_DB::executeAudited(self::getIdStmt(), array($wrong));
$wrongId = $result->fetchOne();
if ($wrongId !== false) {
-
// do we need to insert the correct mimetype?
- $result = \OC_DB::executeAudited($existsStmt, array($correct));
+ $result = \OC_DB::executeAudited(self::existsStmt(), array($correct));
$exists = $result->fetchOne();
- if ( ! $exists ) {
- // insert mimetype
- \OC_DB::executeAudited($insertStmt, array($correct));
- }
-
- // change wrong mimetype to correct mimetype in filecache
- \OC_DB::executeAudited($updateWrongStmt, array($correct, $wrongId));
+ if ( ! is_null($correct) ) {
+ if ( ! $exists ) {
+ // insert mimetype
+ \OC_DB::executeAudited(self::insertStmt(), array($correct));
+ }
+ // change wrong mimetype to correct mimetype in filecache
+ \OC_DB::executeAudited(self::updateWrongStmt(), array($correct, $wrongId));
+ }
+
// delete wrong mimetype
- \OC_DB::executeAudited($deleteStmt, array($wrongId));
+ \OC_DB::executeAudited(self::deleteStmt(), array($wrongId));
}
-
}
-
- $updatedMimetypes = array(
- 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
- 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
- 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
- );
-
- $updateByNameStmt = \OC_DB::prepare('
- UPDATE `*PREFIX*filecache`
- SET `mimetype` = (
- SELECT `id`
- FROM `*PREFIX*mimetypes`
- WHERE `mimetype` = ?
- ) WHERE `name` LIKE ?
- ');
-
- // separate doc from docx etc
+ }
+
+ private function updateMimetypes($updatedMimetypes) {
+
foreach ($updatedMimetypes as $extension => $mimetype ) {
- $result = \OC_DB::executeAudited($existsStmt, array($mimetype));
+ $result = \OC_DB::executeAudited(self::existsStmt(), array($mimetype));
$exists = $result->fetchOne();
if ( ! $exists ) {
// insert mimetype
- \OC_DB::executeAudited($insertStmt, array($mimetype));
+ \OC_DB::executeAudited(self::insertStmt(), array($mimetype));
}
// change mimetype for files with x extension
- \OC_DB::executeAudited($updateByNameStmt, array($mimetype, '%.'.$extension));
+ \OC_DB::executeAudited(self::updateByNameStmt(), array($mimetype, '%.'.$extension));
}
}
- private function fixAPKMimeType() {
- $existsStmt = \OC_DB::prepare('
- SELECT count(`mimetype`)
- FROM `*PREFIX*mimetypes`
- WHERE `mimetype` = ?
- ');
+ private function fixOfficeMimeTypes() {
+ // update wrong mimetypes
+ $wrongMimetypes = array(
+ 'application/mspowerpoint' => 'application/vnd.ms-powerpoint',
+ 'application/msexcel' => 'application/vnd.ms-excel',
+ );
- $insertStmt = \OC_DB::prepare('
- INSERT INTO `*PREFIX*mimetypes` ( `mimetype` )
- VALUES ( ? )
- ');
+ self::repairMimetypes($wrongMimetypes);
+ $updatedMimetypes = array(
+ 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
+ );
- $updateByNameStmt = \OC_DB::prepare('
- UPDATE `*PREFIX*filecache`
- SET `mimetype` = (
- SELECT `id`
- FROM `*PREFIX*mimetypes`
- WHERE `mimetype` = ?
- ) WHERE `name` LIKE ?
- ');
+ // separate doc from docx etc
+ self::updateMimetypes($updatedMimetypes);
+
+ }
+
+ private function fixApkMimeType() {
+ $updatedMimetypes = array(
+ 'apk' => 'application/vnd.android.package-archive',
+ );
- $mimeTypeExtension = 'apk';
- $mimeTypeName = 'application/vnd.android.package-archive';
+ self::updateMimetypes($updatedMimetypes);
+ }
+
+ private function fixFontsMimeTypes() {
+ // update wrong mimetypes
+ $wrongMimetypes = array(
+ 'font' => null,
+ 'font/opentype' => 'application/font-sfnt',
+ 'application/x-font-ttf' => 'application/font-sfnt',
+ );
- $result = \OC_DB::executeAudited($existsStmt, array($mimeTypeName));
- $exists = $result->fetchOne();
+ self::repairMimetypes($wrongMimetypes);
+
+ $updatedMimetypes = array(
+ 'ttf' => 'application/font-sfnt',
+ 'otf' => 'application/font-sfnt',
+ 'pfb' => 'application/x-font',
+ );
- if ( ! $exists ) {
- // insert mimetype
- \OC_DB::executeAudited($insertStmt, array($mimeTypeName));
- }
+ self::updateMimetypes($updatedMimetypes);
+ }
+
+ private function fixPostscriptMimeType() {
+ $updatedMimetypes = array(
+ 'eps' => 'application/postscript',
+ 'ps' => 'application/postscript',
+ );
- // change mimetype for files with x extension
- \OC_DB::executeAudited($updateByNameStmt, array($mimeTypeName, '%.'.$mimeTypeExtension));
+ self::updateMimetypes($updatedMimetypes);
}
/**
@@ -158,10 +178,17 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
if ($this->fixOfficeMimeTypes()) {
$this->emit('\OC\Repair', 'info', array('Fixed office mime types'));
}
-
- if ($this->fixAPKMimeType()) {
+
+ if ($this->fixApkMimeType()) {
$this->emit('\OC\Repair', 'info', array('Fixed APK mime type'));
}
+
+ if ($this->fixFontsMimeTypes()) {
+ $this->emit('\OC\Repair', 'info', array('Fixed fonts mime types'));
+ }
+
+ if ($this->fixPostscriptMimeType()) {
+ $this->emit('\OC\Repair', 'info', array('Fixed Postscript mime types'));
+ }
}
-}
-
+} \ No newline at end of file