From 326d9013b211cb9698ad3a932dc9adb150f6b4d1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 22 Sep 2012 16:32:29 +0200 Subject: [PATCH] Add missing language variable "NO_FILE_B3P" --- install.xml | 4 +++- root/language/de/mods/info_acp_portal.php | 1 + root/language/en/mods/info_acp_portal.php | 1 + root/portal/includes/functions_upload.php | 19 +++++++++++++++---- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/install.xml b/install.xml index 294e35d6..ffd22ed0 100644 --- a/install.xml +++ b/install.xml @@ -106,7 +106,7 @@ Weitere Sprachen kannst in unserem Internationalen Forum finden: http://www.boar - 2012-08-26 + 2012-10-13 2.0.1 Redirect to portal.php when detecting incorrect announcement parameter @@ -133,6 +133,7 @@ Weitere Sprachen kannst in unserem Internationalen Forum finden: http://www.boar Add missing error messages to links & main menu modules Remove update instructions for old releases Remove update for beta version + Add missing language variable "NO_FILE_B3P" Leite bei falschen Parametern für Ankündigungen an die portal.php weiter @@ -159,6 +160,7 @@ Weitere Sprachen kannst in unserem Internationalen Forum finden: http://www.boar Füge fehlende Fehlermeldungen zu Links & Menü Modulen hinzu Entferne Update Anleitungen für ältere Veröffentlichungen Entferne Update Anleitung für Beta Version + Füge fehlende Sprachvariable "NO_FILE_B3P" hinzu diff --git a/root/language/de/mods/info_acp_portal.php b/root/language/de/mods/info_acp_portal.php index 67906d8c..28495c7b 100644 --- a/root/language/de/mods/info_acp_portal.php +++ b/root/language/de/mods/info_acp_portal.php @@ -113,6 +113,7 @@ $lang = array_merge($lang, array( 'MODULE_UPLOAD_EXP' => 'Wähle die ZIP-Datei des Moduls das du hochladen willst:', 'MODULE_UPLOAD_GO' => 'Hochladen', 'NO_MODULE_UPLOAD' => 'Deine Server-Konfiguration erlaubt das Hochladen von Dateien nicht.', + 'NO_FILE_B3P' => 'Es wurde keine Zip-Datei ausgewählt.', 'MODULE_UPLOADED' => 'Modul erfolgreich hochgeladen.', 'MODULE_UPLOAD_MKDIR_FAILURE' => 'Es konnte kein Ordner erstellt werden.', 'MODULE_COPY_FAILURE' => 'Die folgende Datei konnte nicht kopiert werden: %1$s', diff --git a/root/language/en/mods/info_acp_portal.php b/root/language/en/mods/info_acp_portal.php index 7ffcf694..cc5a8013 100755 --- a/root/language/en/mods/info_acp_portal.php +++ b/root/language/en/mods/info_acp_portal.php @@ -112,6 +112,7 @@ $lang = array_merge($lang, array( 'MODULE_UPLOAD_EXP' => 'Choose the zip file of the module you want to upload:', 'MODULE_UPLOAD_GO' => 'Upload', 'NO_MODULE_UPLOAD' => 'Your server configuration does not allow file uploads.', + 'NO_FILE_B3P' => 'No zip file specified.', 'MODULE_UPLOADED' => 'Module uploaded successfully.', 'MODULE_UPLOAD_MKDIR_FAILURE' => 'Unable to create a folder.', 'MODULE_COPY_FAILURE' => 'Unable to copy the following file: %1$s', diff --git a/root/portal/includes/functions_upload.php b/root/portal/includes/functions_upload.php index fa152e30..e5a25b06 100755 --- a/root/portal/includes/functions_upload.php +++ b/root/portal/includes/functions_upload.php @@ -52,10 +52,11 @@ class portal_upload $upload->set_allowed_extensions(array('zip')); $file = $upload->form_upload('modupload'); - - if (empty($file->filename)) + + // this is for module zips so don't allow anything else + if (empty($file->filename) || !preg_match('.zip.', $file->get('realname'))) { - trigger_error($user->lang['NO_UPLOAD_FILE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($user->lang['NO_FILE_B3P'] . adm_back_link($this->u_action), E_USER_WARNING); } else { @@ -113,7 +114,17 @@ class portal_upload $cur_path = str_replace($mod_dir . '/', '', $cur_path); $cut_pos = strpos($cur_path, '/'); - // Only allow files in adm, language, portal and styles folder + /* + * We only copy files. The recursive iterator might grab paths depending on + * the PHP version. This will trigger our error handle with trigger_error() + * though. If we are trying to copy a directory just move on. + */ + if (is_dir($cur_path)) + { + continue; + } + + // Only allow files in adm, language, portal and styles folder and a license.txt if(!in_array(substr($cur_path, 0, $cut_pos), array('adm', 'language', 'portal', 'styles')) && $cur_file->getFilename() != 'license.txt') { $file->remove();