summaryrefslogtreecommitdiffstats
path: root/apps/theming
diff options
context:
space:
mode:
Diffstat (limited to 'apps/theming')
-rw-r--r--apps/theming/css/settings-admin.css1
-rw-r--r--apps/theming/js/settings-admin.js2
-rw-r--r--apps/theming/l10n/de.js8
-rw-r--r--apps/theming/l10n/de.json8
-rw-r--r--apps/theming/l10n/de_DE.js8
-rw-r--r--apps/theming/l10n/de_DE.json8
-rw-r--r--apps/theming/l10n/fr.js8
-rw-r--r--apps/theming/l10n/fr.json8
-rw-r--r--apps/theming/l10n/it.js8
-rw-r--r--apps/theming/l10n/it.json8
-rw-r--r--apps/theming/l10n/nb.js8
-rw-r--r--apps/theming/l10n/nb.json8
-rw-r--r--apps/theming/l10n/pt_BR.js8
-rw-r--r--apps/theming/l10n/pt_BR.json8
-rw-r--r--apps/theming/l10n/sr.js8
-rw-r--r--apps/theming/l10n/sr.json8
-rw-r--r--apps/theming/lib/Controller/ThemingController.php38
-rw-r--r--apps/theming/tests/Controller/ThemingControllerTest.php203
18 files changed, 334 insertions, 22 deletions
diff --git a/apps/theming/css/settings-admin.css b/apps/theming/css/settings-admin.css
index b32ed189ceb..7270ec59b83 100644
--- a/apps/theming/css/settings-admin.css
+++ b/apps/theming/css/settings-admin.css
@@ -78,6 +78,7 @@ form.uploadButton {
#theming_settings_msg {
vertical-align: middle;
+ border-radius: 3px;
}
#theming-preview-logo {
diff --git a/apps/theming/js/settings-admin.js b/apps/theming/js/settings-admin.js
index d9e66284d14..44a799a19b4 100644
--- a/apps/theming/js/settings-admin.js
+++ b/apps/theming/js/settings-admin.js
@@ -141,6 +141,7 @@ $(document).ready(function () {
fail: function (e, response){
OC.msg.finishedError('#theming_settings_msg', response._response.jqXHR.responseJSON.data.message);
$('label#uploadlogo').addClass('icon-upload').removeClass('icon-loading-small');
+ $('#theming_settings_loading').hide();
}
};
var uploadParamsLogin = {
@@ -159,6 +160,7 @@ $(document).ready(function () {
fail: function (e, response){
$('label#upload-login-background').removeClass('icon-loading-small').addClass('icon-upload');
OC.msg.finishedError('#theming_settings_msg', response._response.jqXHR.responseJSON.data.message);
+ $('#theming_settings_loading').hide();
}
};
diff --git a/apps/theming/l10n/de.js b/apps/theming/l10n/de.js
index 52c12d1f093..86226c364b1 100644
--- a/apps/theming/l10n/de.js
+++ b/apps/theming/l10n/de.js
@@ -9,6 +9,14 @@ OC.L10N.register(
"The given web address is too long" : "Die eingegebene Adresse ist zu lang",
"The given slogan is too long" : "Der eingegebene Slogan ist zu lang",
"The given color is invalid" : "Die gewählte Farbe ist ungültig",
+ "There is no error, the file uploaded with success" : "Es ist kein Fehler aufgetreten. Die Datei wurde erfolgreich hochgeladen.",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Die hochgeladene Datei überschreitet die upload_max_filesize-Vorgabe in php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Die Datei ist größer, als die MAX_FILE_SIZE-Vorgabe erlaubt, die im HTML-Formular spezifiziert ist",
+ "The uploaded file was only partially uploaded" : "Die Datei konnte nur teilweise übertragen werden",
+ "No file was uploaded" : "Es wurde keine Datei hochgeladen",
+ "Missing a temporary folder" : "Kein temporärer Ordner vorhanden",
+ "Failed to write file to disk." : "Fehler beim Schreiben der Datei auf die Festplatte.",
+ "A PHP extension stopped the file upload." : "Eine PHP-Erweiterung hat das Hochladen der Datei gestoppt.",
"No file uploaded" : "Keine Datei hochgeladen",
"Unsupported image type" : "Nicht unterstütztes Bild-Format",
"You are already using a custom theme" : "Du benutzt bereits ein eigenes Thema",
diff --git a/apps/theming/l10n/de.json b/apps/theming/l10n/de.json
index b9684f0a672..dc88a7be984 100644
--- a/apps/theming/l10n/de.json
+++ b/apps/theming/l10n/de.json
@@ -7,6 +7,14 @@
"The given web address is too long" : "Die eingegebene Adresse ist zu lang",
"The given slogan is too long" : "Der eingegebene Slogan ist zu lang",
"The given color is invalid" : "Die gewählte Farbe ist ungültig",
+ "There is no error, the file uploaded with success" : "Es ist kein Fehler aufgetreten. Die Datei wurde erfolgreich hochgeladen.",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Die hochgeladene Datei überschreitet die upload_max_filesize-Vorgabe in php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Die Datei ist größer, als die MAX_FILE_SIZE-Vorgabe erlaubt, die im HTML-Formular spezifiziert ist",
+ "The uploaded file was only partially uploaded" : "Die Datei konnte nur teilweise übertragen werden",
+ "No file was uploaded" : "Es wurde keine Datei hochgeladen",
+ "Missing a temporary folder" : "Kein temporärer Ordner vorhanden",
+ "Failed to write file to disk." : "Fehler beim Schreiben der Datei auf die Festplatte.",
+ "A PHP extension stopped the file upload." : "Eine PHP-Erweiterung hat das Hochladen der Datei gestoppt.",
"No file uploaded" : "Keine Datei hochgeladen",
"Unsupported image type" : "Nicht unterstütztes Bild-Format",
"You are already using a custom theme" : "Du benutzt bereits ein eigenes Thema",
diff --git a/apps/theming/l10n/de_DE.js b/apps/theming/l10n/de_DE.js
index 8e9ec2fe8d9..88dab08c44a 100644
--- a/apps/theming/l10n/de_DE.js
+++ b/apps/theming/l10n/de_DE.js
@@ -9,6 +9,14 @@ OC.L10N.register(
"The given web address is too long" : "Die eingegebene Adresse ist zu lang",
"The given slogan is too long" : "Der eingegebene Slogan ist zu lang",
"The given color is invalid" : "Die gewählte Farbe ist ungültig",
+ "There is no error, the file uploaded with success" : "Es ist kein Fehler aufgetreten. Die Datei wurde erfolgreich hochgeladen.",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Die hochgeladene Datei überschreitet die upload_max_filesize-Vorgabe in php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Die Datei ist größer, als die MAX_FILE_SIZE-Vorgabe erlaubt, die im HTML-Formular spezifiziert ist",
+ "The uploaded file was only partially uploaded" : "Die Datei konnte nur teilweise übertragen werden",
+ "No file was uploaded" : "Es wurde keine Datei hochgeladen",
+ "Missing a temporary folder" : "Kein temporärer Ordner vorhanden",
+ "Failed to write file to disk." : "Fehler beim Schreiben der Datei auf die Festplatte.",
+ "A PHP extension stopped the file upload." : "Eine PHP-Erweiterung hat das Hochladen der Datei gestoppt.",
"No file uploaded" : "Keine Datei hochgeladen",
"Unsupported image type" : "Nicht unterstütztes Bild-Format",
"You are already using a custom theme" : "Sie benutzen bereits ein eigenes Thema",
diff --git a/apps/theming/l10n/de_DE.json b/apps/theming/l10n/de_DE.json
index f4dfa4d6bba..14043ad1fd6 100644
--- a/apps/theming/l10n/de_DE.json
+++ b/apps/theming/l10n/de_DE.json
@@ -7,6 +7,14 @@
"The given web address is too long" : "Die eingegebene Adresse ist zu lang",
"The given slogan is too long" : "Der eingegebene Slogan ist zu lang",
"The given color is invalid" : "Die gewählte Farbe ist ungültig",
+ "There is no error, the file uploaded with success" : "Es ist kein Fehler aufgetreten. Die Datei wurde erfolgreich hochgeladen.",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Die hochgeladene Datei überschreitet die upload_max_filesize-Vorgabe in php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Die Datei ist größer, als die MAX_FILE_SIZE-Vorgabe erlaubt, die im HTML-Formular spezifiziert ist",
+ "The uploaded file was only partially uploaded" : "Die Datei konnte nur teilweise übertragen werden",
+ "No file was uploaded" : "Es wurde keine Datei hochgeladen",
+ "Missing a temporary folder" : "Kein temporärer Ordner vorhanden",
+ "Failed to write file to disk." : "Fehler beim Schreiben der Datei auf die Festplatte.",
+ "A PHP extension stopped the file upload." : "Eine PHP-Erweiterung hat das Hochladen der Datei gestoppt.",
"No file uploaded" : "Keine Datei hochgeladen",
"Unsupported image type" : "Nicht unterstütztes Bild-Format",
"You are already using a custom theme" : "Sie benutzen bereits ein eigenes Thema",
diff --git a/apps/theming/l10n/fr.js b/apps/theming/l10n/fr.js
index ed5ac6af520..634f4a6f8a2 100644
--- a/apps/theming/l10n/fr.js
+++ b/apps/theming/l10n/fr.js
@@ -9,6 +9,14 @@ OC.L10N.register(
"The given web address is too long" : "L'adresse web donnée est trop longue",
"The given slogan is too long" : "Le slogan donné est trop long",
"The given color is invalid" : "La couleur donnée est invalide",
+ "There is no error, the file uploaded with success" : "Aucune erreur, le fichier a été téléversé avec succès",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Le fichier téléversé dépasse la valeur upload_max_filesize située dans le fichier php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Le fichier téléversé dépasse la valeur MAX_FILE_SIZE spécifiée dans le formulaire HTML",
+ "The uploaded file was only partially uploaded" : "Le fichier n'a été que partiellement téléversé",
+ "No file was uploaded" : "Aucun fichier téléversé",
+ "Missing a temporary folder" : "Absence de dossier temporaire",
+ "Failed to write file to disk." : "Erreur d'écriture du fichier sur le disque.",
+ "A PHP extension stopped the file upload." : "Une extension PHP a arrêté le téléversement du fichier.",
"No file uploaded" : "Aucun fichier téléversé",
"Unsupported image type" : "Ce type d'image n'est pas pris en charge",
"You are already using a custom theme" : "Vous utilisez déjà un thème personnalisé",
diff --git a/apps/theming/l10n/fr.json b/apps/theming/l10n/fr.json
index a6d45297e25..aac3b06b6d3 100644
--- a/apps/theming/l10n/fr.json
+++ b/apps/theming/l10n/fr.json
@@ -7,6 +7,14 @@
"The given web address is too long" : "L'adresse web donnée est trop longue",
"The given slogan is too long" : "Le slogan donné est trop long",
"The given color is invalid" : "La couleur donnée est invalide",
+ "There is no error, the file uploaded with success" : "Aucune erreur, le fichier a été téléversé avec succès",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Le fichier téléversé dépasse la valeur upload_max_filesize située dans le fichier php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Le fichier téléversé dépasse la valeur MAX_FILE_SIZE spécifiée dans le formulaire HTML",
+ "The uploaded file was only partially uploaded" : "Le fichier n'a été que partiellement téléversé",
+ "No file was uploaded" : "Aucun fichier téléversé",
+ "Missing a temporary folder" : "Absence de dossier temporaire",
+ "Failed to write file to disk." : "Erreur d'écriture du fichier sur le disque.",
+ "A PHP extension stopped the file upload." : "Une extension PHP a arrêté le téléversement du fichier.",
"No file uploaded" : "Aucun fichier téléversé",
"Unsupported image type" : "Ce type d'image n'est pas pris en charge",
"You are already using a custom theme" : "Vous utilisez déjà un thème personnalisé",
diff --git a/apps/theming/l10n/it.js b/apps/theming/l10n/it.js
index 06747e43aa7..33e18252f2b 100644
--- a/apps/theming/l10n/it.js
+++ b/apps/theming/l10n/it.js
@@ -9,6 +9,14 @@ OC.L10N.register(
"The given web address is too long" : "Questo indirizzo web è troppo lungo",
"The given slogan is too long" : "Questo slogan è troppo lungo",
"The given color is invalid" : "Questo colore non è valido",
+ "There is no error, the file uploaded with success" : "Non ci sono errori, il file è stato caricato correttamente",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Il file caricato supera la direttiva upload_max_filesize in php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Il file caricato supera la direttiva MAX_FILE_SIZE specificata nel modulo HTML",
+ "The uploaded file was only partially uploaded" : "Il file è stato caricato solo parzialmente",
+ "No file was uploaded" : "Non è stato caricato alcun file",
+ "Missing a temporary folder" : "Manca una cartella temporanea",
+ "Failed to write file to disk." : "Scrittura su disco non riuscita",
+ "A PHP extension stopped the file upload." : "Un'estensione PHP ha fermato il caricamento del file.",
"No file uploaded" : "Nessun file caricato",
"Unsupported image type" : "Tipo di immagine non supportato",
"You are already using a custom theme" : "Stai già usando un tema personalizzato",
diff --git a/apps/theming/l10n/it.json b/apps/theming/l10n/it.json
index 54517d5ba47..56c1a122765 100644
--- a/apps/theming/l10n/it.json
+++ b/apps/theming/l10n/it.json
@@ -7,6 +7,14 @@
"The given web address is too long" : "Questo indirizzo web è troppo lungo",
"The given slogan is too long" : "Questo slogan è troppo lungo",
"The given color is invalid" : "Questo colore non è valido",
+ "There is no error, the file uploaded with success" : "Non ci sono errori, il file è stato caricato correttamente",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Il file caricato supera la direttiva upload_max_filesize in php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Il file caricato supera la direttiva MAX_FILE_SIZE specificata nel modulo HTML",
+ "The uploaded file was only partially uploaded" : "Il file è stato caricato solo parzialmente",
+ "No file was uploaded" : "Non è stato caricato alcun file",
+ "Missing a temporary folder" : "Manca una cartella temporanea",
+ "Failed to write file to disk." : "Scrittura su disco non riuscita",
+ "A PHP extension stopped the file upload." : "Un'estensione PHP ha fermato il caricamento del file.",
"No file uploaded" : "Nessun file caricato",
"Unsupported image type" : "Tipo di immagine non supportato",
"You are already using a custom theme" : "Stai già usando un tema personalizzato",
diff --git a/apps/theming/l10n/nb.js b/apps/theming/l10n/nb.js
index 9b286698355..f3ae7b15a97 100644
--- a/apps/theming/l10n/nb.js
+++ b/apps/theming/l10n/nb.js
@@ -9,6 +9,14 @@ OC.L10N.register(
"The given web address is too long" : "Nettadressen er for lang",
"The given slogan is too long" : "Slagordet er for langt",
"The given color is invalid" : "Fargen er ugyldig",
+ "There is no error, the file uploaded with success" : "Det er ingen feil, opplastingen av filen var vellykket",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Filen er større enn grensen satt i upload_max_filesize i php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Filen du prøvde å laste opp er større enn grensen satt i MAX_FILE_SIZE i HTML-skjemaet",
+ "The uploaded file was only partially uploaded" : "Filen ble bare delvis lastet opp",
+ "No file was uploaded" : "Ingen filer ble lastet opp",
+ "Missing a temporary folder" : "Mangler midlertidig mappe",
+ "Failed to write file to disk." : "Klarte ikke å skrive til disk.",
+ "A PHP extension stopped the file upload." : "En PHP-utvidelse stoppet filopplastingen.",
"No file uploaded" : "Ingen fil lastet opp",
"Unsupported image type" : "Filtypen støttes ikke",
"You are already using a custom theme" : "Du bruker allerede en egendefinert drakt",
diff --git a/apps/theming/l10n/nb.json b/apps/theming/l10n/nb.json
index 6557edea2b8..841c215d0d9 100644
--- a/apps/theming/l10n/nb.json
+++ b/apps/theming/l10n/nb.json
@@ -7,6 +7,14 @@
"The given web address is too long" : "Nettadressen er for lang",
"The given slogan is too long" : "Slagordet er for langt",
"The given color is invalid" : "Fargen er ugyldig",
+ "There is no error, the file uploaded with success" : "Det er ingen feil, opplastingen av filen var vellykket",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Filen er større enn grensen satt i upload_max_filesize i php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Filen du prøvde å laste opp er større enn grensen satt i MAX_FILE_SIZE i HTML-skjemaet",
+ "The uploaded file was only partially uploaded" : "Filen ble bare delvis lastet opp",
+ "No file was uploaded" : "Ingen filer ble lastet opp",
+ "Missing a temporary folder" : "Mangler midlertidig mappe",
+ "Failed to write file to disk." : "Klarte ikke å skrive til disk.",
+ "A PHP extension stopped the file upload." : "En PHP-utvidelse stoppet filopplastingen.",
"No file uploaded" : "Ingen fil lastet opp",
"Unsupported image type" : "Filtypen støttes ikke",
"You are already using a custom theme" : "Du bruker allerede en egendefinert drakt",
diff --git a/apps/theming/l10n/pt_BR.js b/apps/theming/l10n/pt_BR.js
index 1f05a513bd4..6ea5b601ae9 100644
--- a/apps/theming/l10n/pt_BR.js
+++ b/apps/theming/l10n/pt_BR.js
@@ -9,6 +9,14 @@ OC.L10N.register(
"The given web address is too long" : "O endereço web fornecido é muito longo",
"The given slogan is too long" : "O slogan dado é muito longo",
"The given color is invalid" : "A cor fornecida é inválida",
+ "There is no error, the file uploaded with success" : "Sem erros. Arquivo enviado com sucesso",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "O arquivo enviado excede a diretiva upload_max_filesize do php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "O arquivo enviado excede a diretiva MAX_FILE_SIZE especificada no formulário HTML",
+ "The uploaded file was only partially uploaded" : "O arquivo foi enviado parcialmente",
+ "No file was uploaded" : "Nenhum arquivo foi enviado",
+ "Missing a temporary folder" : "Falta uma pasta temporária",
+ "Failed to write file to disk." : "Falha ao escrever no disco.",
+ "A PHP extension stopped the file upload." : "Uma extensão PHP parou o envio do arquivo.",
"No file uploaded" : "Nenhum arquivo enviado",
"Unsupported image type" : "Tipo de imagem não suportado",
"You are already using a custom theme" : "Você já está usando um tema personalizado",
diff --git a/apps/theming/l10n/pt_BR.json b/apps/theming/l10n/pt_BR.json
index 41b06d8316f..a1d07f342f0 100644
--- a/apps/theming/l10n/pt_BR.json
+++ b/apps/theming/l10n/pt_BR.json
@@ -7,6 +7,14 @@
"The given web address is too long" : "O endereço web fornecido é muito longo",
"The given slogan is too long" : "O slogan dado é muito longo",
"The given color is invalid" : "A cor fornecida é inválida",
+ "There is no error, the file uploaded with success" : "Sem erros. Arquivo enviado com sucesso",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "O arquivo enviado excede a diretiva upload_max_filesize do php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "O arquivo enviado excede a diretiva MAX_FILE_SIZE especificada no formulário HTML",
+ "The uploaded file was only partially uploaded" : "O arquivo foi enviado parcialmente",
+ "No file was uploaded" : "Nenhum arquivo foi enviado",
+ "Missing a temporary folder" : "Falta uma pasta temporária",
+ "Failed to write file to disk." : "Falha ao escrever no disco.",
+ "A PHP extension stopped the file upload." : "Uma extensão PHP parou o envio do arquivo.",
"No file uploaded" : "Nenhum arquivo enviado",
"Unsupported image type" : "Tipo de imagem não suportado",
"You are already using a custom theme" : "Você já está usando um tema personalizado",
diff --git a/apps/theming/l10n/sr.js b/apps/theming/l10n/sr.js
index 186d82d74ae..49344ec96ce 100644
--- a/apps/theming/l10n/sr.js
+++ b/apps/theming/l10n/sr.js
@@ -9,6 +9,14 @@ OC.L10N.register(
"The given web address is too long" : "Адреса је предугачка",
"The given slogan is too long" : "Слоган је предугачак",
"The given color is invalid" : "Задата боја није исправна",
+ "There is no error, the file uploaded with success" : "Нема грешке, фајл је отпремљен успешно",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Отпремани фајл превазилази смерницу upload_max_filesize у фајлу php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Отпремани фајл превазилази смерницу MAX_FILE_SIZE која је наведена у HTML обрасцу",
+ "The uploaded file was only partially uploaded" : "Отпремани фајл је само делимично отпремљен",
+ "No file was uploaded" : "Ниједан фајл није отпремљен",
+ "Missing a temporary folder" : "Недостаје привремена фасцикла",
+ "Failed to write file to disk." : "Не могу да пишем фајл на диск",
+ "A PHP extension stopped the file upload." : "PHP екстензија је зауставила отпремање фајла.",
"No file uploaded" : "Ниједан фајл није отпремљен",
"Unsupported image type" : "Неподржани тип слике",
"You are already using a custom theme" : "Већ користите прилагођену тему",
diff --git a/apps/theming/l10n/sr.json b/apps/theming/l10n/sr.json
index dac1603b3d9..db82d478ee7 100644
--- a/apps/theming/l10n/sr.json
+++ b/apps/theming/l10n/sr.json
@@ -7,6 +7,14 @@
"The given web address is too long" : "Адреса је предугачка",
"The given slogan is too long" : "Слоган је предугачак",
"The given color is invalid" : "Задата боја није исправна",
+ "There is no error, the file uploaded with success" : "Нема грешке, фајл је отпремљен успешно",
+ "The uploaded file exceeds the upload_max_filesize directive in php.ini" : "Отпремани фајл превазилази смерницу upload_max_filesize у фајлу php.ini",
+ "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form" : "Отпремани фајл превазилази смерницу MAX_FILE_SIZE која је наведена у HTML обрасцу",
+ "The uploaded file was only partially uploaded" : "Отпремани фајл је само делимично отпремљен",
+ "No file was uploaded" : "Ниједан фајл није отпремљен",
+ "Missing a temporary folder" : "Недостаје привремена фасцикла",
+ "Failed to write file to disk." : "Не могу да пишем фајл на диск",
+ "A PHP extension stopped the file upload." : "PHP екстензија је зауставила отпремање фајла.",
"No file uploaded" : "Ниједан фајл није отпремљен",
"Unsupported image type" : "Неподржани тип слике",
"You are already using a custom theme" : "Већ користите прилагођену тему",
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index 06c2c430b7f..ccc2634ec14 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -207,12 +207,34 @@ class ThemingController extends Controller {
}
$newLogo = $this->request->getUploadedFile('uploadlogo');
$newBackgroundLogo = $this->request->getUploadedFile('upload-login-background');
+ $error = null;
+ $phpFileUploadErrors = [
+ UPLOAD_ERR_OK => $this->l10n->t('There is no error, the file uploaded with success'),
+ UPLOAD_ERR_INI_SIZE => $this->l10n->t('The uploaded file exceeds the upload_max_filesize directive in php.ini'),
+ UPLOAD_ERR_FORM_SIZE => $this->l10n->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'),
+ UPLOAD_ERR_PARTIAL => $this->l10n->t('The uploaded file was only partially uploaded'),
+ UPLOAD_ERR_NO_FILE => $this->l10n->t('No file was uploaded'),
+ UPLOAD_ERR_NO_TMP_DIR => $this->l10n->t('Missing a temporary folder'),
+ UPLOAD_ERR_CANT_WRITE => $this->l10n->t('Failed to write file to disk.'),
+ UPLOAD_ERR_EXTENSION => $this->l10n->t('A PHP extension stopped the file upload.'),
+ ];
if (empty($newLogo) && empty($newBackgroundLogo)) {
+ $error = $this->l10n->t('No file uploaded');
+ }
+ if (!empty($newLogo) && array_key_exists('error', $newLogo) && $newLogo['error'] !== UPLOAD_ERR_OK) {
+ $error = $phpFileUploadErrors[$newLogo['error']];
+ }
+ if (!empty($newBackgroundLogo) && array_key_exists('error', $newBackgroundLogo) && $newBackgroundLogo['error'] !== UPLOAD_ERR_OK) {
+ $error = $phpFileUploadErrors[$newBackgroundLogo['error']];
+ }
+
+ if ($error !== null) {
return new DataResponse(
[
'data' => [
- 'message' => $this->l10n->t('No file uploaded')
- ]
+ 'message' => $error
+ ],
+ 'status' => 'failure',
],
Http::STATUS_UNPROCESSABLE_ENTITY
);
@@ -227,6 +249,18 @@ class ThemingController extends Controller {
if (!empty($newLogo)) {
$target = $folder->newFile('logo');
+ $supportedFormats = ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'text/svg'];
+ if (!in_array($newLogo['type'], $supportedFormats)) {
+ return new DataResponse(
+ [
+ 'data' => [
+ 'message' => $this->l10n->t('Unsupported image type'),
+ ],
+ 'status' => 'failure',
+ ],
+ Http::STATUS_UNPROCESSABLE_ENTITY
+ );
+ }
$target->putContent(file_get_contents($newLogo['tmp_name'], 'r'));
$this->themingDefaults->set('logoMime', $newLogo['type']);
$name = $newLogo['name'];
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php
index c03eccb6eef..e964e886e5c 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -131,8 +131,9 @@ class ThemingControllerTest extends TestCase {
$this->l10n
->expects($this->once())
->method('t')
- ->with($message)
- ->willReturn($message);
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$this->scssCacher
->expects($this->once())
->method('getCachedSCSS')
@@ -183,8 +184,9 @@ class ThemingControllerTest extends TestCase {
$this->l10n
->expects($this->once())
->method('t')
- ->with($message)
- ->willReturn($message);
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$expected = new DataResponse(
[
@@ -215,10 +217,11 @@ class ThemingControllerTest extends TestCase {
->with('upload-login-background')
->willReturn(null);
$this->l10n
- ->expects($this->once())
+ ->expects($this->any())
->method('t')
- ->with('No file uploaded')
- ->willReturn('No file uploaded');
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$expected = new DataResponse(
[
@@ -226,6 +229,56 @@ class ThemingControllerTest extends TestCase {
[
'message' => 'No file uploaded',
],
+ 'status' => 'failure',
+ ],
+ Http::STATUS_UNPROCESSABLE_ENTITY
+ );
+
+ $this->assertEquals($expected, $this->themingController->updateLogo());
+ }
+
+ public function testUpdateLogoInvalidMimeType() {
+ $this->request
+ ->expects($this->at(0))
+ ->method('getParam')
+ ->with('backgroundColor')
+ ->willReturn(false);
+ $this->request
+ ->expects($this->at(1))
+ ->method('getUploadedFile')
+ ->with('uploadlogo')
+ ->willReturn([
+ 'tmp_name' => 'logo.pdf',
+ 'type' => 'application/pdf',
+ 'name' => 'logo.pdf',
+ 'error' => 0,
+ ]);
+ $this->request
+ ->expects($this->at(2))
+ ->method('getUploadedFile')
+ ->with('upload-login-background')
+ ->willReturn(null);
+ $this->l10n
+ ->expects($this->any())
+ ->method('t')
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
+
+ $folder = $this->createMock(ISimpleFolder::class);
+ $this->appData
+ ->expects($this->once())
+ ->method('getFolder')
+ ->with('images')
+ ->willReturn($folder);
+
+ $expected = new DataResponse(
+ [
+ 'data' =>
+ [
+ 'message' => 'Unsupported image type',
+ ],
+ 'status' => 'failure'
],
Http::STATUS_UNPROCESSABLE_ENTITY
);
@@ -258,13 +311,17 @@ class ThemingControllerTest extends TestCase {
public function dataUpdateImages() {
return [
- [false],
- [true]
+ ['image/jpeg', false],
+ ['image/jpeg', true],
+ ['image/gif'],
+ ['image/png'],
+ ['image/svg+xml'],
+ ['text/svg'],
];
}
/** @dataProvider dataUpdateImages */
- public function testUpdateLogoNormalLogoUpload($folderExists) {
+ public function testUpdateLogoNormalLogoUpload($mimeType, $folderExists=true) {
$tmpLogo = \OC::$server->getTempManager()->getTemporaryFolder() . '/logo.svg';
$destination = \OC::$server->getTempManager()->getTemporaryFolder();
@@ -280,8 +337,9 @@ class ThemingControllerTest extends TestCase {
->with('uploadlogo')
->willReturn([
'tmp_name' => $tmpLogo,
- 'type' => 'text/svg',
+ 'type' => $mimeType,
'name' => 'logo.svg',
+ 'error' => 0,
]);
$this->request
->expects($this->at(2))
@@ -289,10 +347,11 @@ class ThemingControllerTest extends TestCase {
->with('upload-login-background')
->willReturn(null);
$this->l10n
- ->expects($this->once())
+ ->expects($this->any())
->method('t')
- ->with('Saved')
- ->willReturn('Saved');
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$file = $this->createMock(ISimpleFile::class);
@@ -357,12 +416,14 @@ class ThemingControllerTest extends TestCase {
'tmp_name' => $tmpLogo,
'type' => 'text/svg',
'name' => 'logo.svg',
+ 'error' => 0,
]);
$this->l10n
- ->expects($this->once())
+ ->expects($this->any())
->method('t')
- ->with('Saved')
- ->willReturn('Saved');
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$file = $this->createMock(ISimpleFile::class);
$folder = $this->createMock(ISimpleFolder::class);
@@ -425,12 +486,14 @@ class ThemingControllerTest extends TestCase {
'tmp_name' => $tmpLogo,
'type' => 'text/svg',
'name' => 'logo.svg',
+ 'error' => 0,
]);
$this->l10n
- ->expects($this->once())
+ ->expects($this->any())
->method('t')
- ->with('Unsupported image type')
- ->willReturn('Unsupported image type');
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
$folder = $this->createMock(ISimpleFolder::class);
$this->appData
@@ -452,6 +515,106 @@ class ThemingControllerTest extends TestCase {
$this->assertEquals($expected, $this->themingController->updateLogo());
}
+ public function dataPhpUploadErrors() {
+ return [
+ [UPLOAD_ERR_INI_SIZE, 'The uploaded file exceeds the upload_max_filesize directive in php.ini'],
+ [UPLOAD_ERR_FORM_SIZE, 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'],
+ [UPLOAD_ERR_PARTIAL, 'The uploaded file was only partially uploaded'],
+ [UPLOAD_ERR_NO_FILE, 'No file was uploaded'],
+ [UPLOAD_ERR_NO_TMP_DIR, 'Missing a temporary folder'],
+ [UPLOAD_ERR_CANT_WRITE, 'Failed to write file to disk.'],
+ [UPLOAD_ERR_EXTENSION, 'A PHP extension stopped the file upload.'],
+ ];
+ }
+
+ /**
+ * @dataProvider dataPhpUploadErrors
+ */
+ public function testUpdateLogoLoginScreenUploadWithInvalidImageUpload($error, $expectedErrorMessage) {
+ $this->request
+ ->expects($this->at(0))
+ ->method('getParam')
+ ->with('backgroundColor')
+ ->willReturn(false);
+ $this->request
+ ->expects($this->at(1))
+ ->method('getUploadedFile')
+ ->with('uploadlogo')
+ ->willReturn(null);
+ $this->request
+ ->expects($this->at(2))
+ ->method('getUploadedFile')
+ ->with('upload-login-background')
+ ->willReturn([
+ 'tmp_name' => '',
+ 'type' => 'text/svg',
+ 'name' => 'logo.svg',
+ 'error' => $error,
+ ]);
+ $this->l10n
+ ->expects($this->any())
+ ->method('t')
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
+
+ $expected = new DataResponse(
+ [
+ 'data' =>
+ [
+ 'message' => $expectedErrorMessage,
+ ],
+ 'status' => 'failure'
+ ],
+ Http::STATUS_UNPROCESSABLE_ENTITY
+ );
+ $this->assertEquals($expected, $this->themingController->updateLogo());
+ }
+
+ /**
+ * @dataProvider dataPhpUploadErrors
+ */
+ public function testUpdateLogoUploadWithInvalidImageUpload($error, $expectedErrorMessage) {
+ $this->request
+ ->expects($this->at(0))
+ ->method('getParam')
+ ->with('backgroundColor')
+ ->willReturn(false);
+ $this->request
+ ->expects($this->at(1))
+ ->method('getUploadedFile')
+ ->with('uploadlogo')
+ ->willReturn([
+ 'tmp_name' => '',
+ 'type' => 'text/svg',
+ 'name' => 'logo.svg',
+ 'error' => $error,
+ ]);
+ $this->request
+ ->expects($this->at(2))
+ ->method('getUploadedFile')
+ ->with('upload-login-background')
+ ->willReturn(null);
+ $this->l10n
+ ->expects($this->any())
+ ->method('t')
+ ->will($this->returnCallback(function($str) {
+ return $str;
+ }));
+
+ $expected = new DataResponse(
+ [
+ 'data' =>
+ [
+ 'message' => $expectedErrorMessage
+ ],
+ 'status' => 'failure'
+ ],
+ Http::STATUS_UNPROCESSABLE_ENTITY
+ );
+ $this->assertEquals($expected, $this->themingController->updateLogo());
+ }
+
public function testUndo() {
$this->l10n
->expects($this->once())