diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php
index 48a4cf9c12..f0bee95d7c 100755
--- a/main/inc/lib/message.lib.php
+++ b/main/inc/lib/message.lib.php
@@ -185,7 +185,18 @@ class MessageManager
$receiver_user_id = intval($receiver_user_id);
$parent_id = intval($parent_id);
$user_sender_id = api_get_user_id();
-
+
+ $total_filesize = 0;
+ if (is_array($file_attachments)) {
+ foreach ($file_attachments as $file_attach) {
+ $total_filesize += $file_attach['size'];
+ }
+ }
+
+ if ($total_filesize > intval(api_get_setting('message_max_upload_filesize'))) {
+ return sprintf(get_lang("FilesSizeExceedsX"),format_file_size(api_get_setting('message_max_upload_filesize')));
+ }
+
if (!empty($receiver_user_id) || !empty($group_id)) {
// message for user friend
$title = api_convert_encoding($title,$charset);
@@ -331,7 +342,6 @@ class MessageManager
// user's file name
$file_name =$file_attach['name'];
-
if (!filter_extension($new_file_name)) {
Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
} else {
diff --git a/main/install/dokeos_main.sql b/main/install/dokeos_main.sql
index a4e229e6ec..186a4304af 100755
--- a/main/install/dokeos_main.sql
+++ b/main/install/dokeos_main.sql
@@ -744,7 +744,8 @@ VALUES
('students_download_folders',NULL,'radio','Tools','true','AllowStudentsDownloadFoldersTitle','AllowStudentsDownloadFoldersComment',NULL,NULL, 0),
('show_tabs', 'social', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsSocial', 0),
('allow_students_to_create_groups_in_social',NULL,'radio','Tools','false','AllowStudentsToCreateGroupsInSocialTitle','AllowStudentsToCreateGroupsInSocialComment',NULL,NULL, 0),
-('allow_send_message_to_all_platform_users',NULL,'radio','Tools','false','AllowSendMessageToAllPlatformUsersTitle','AllowSendMessageToAllPlatformUsersComment',NULL,NULL, 0);
+('allow_send_message_to_all_platform_users',NULL,'radio','Tools','false','AllowSendMessageToAllPlatformUsersTitle','AllowSendMessageToAllPlatformUsersComment',NULL,NULL, 0),
+('message_max_upload_filesize',NULL,'textfield','Tools','20971520','MessageMaxUploadFilesizeTitle','MessageMaxUploadFilesizeComment',NULL,NULL, 0);
UNLOCK TABLES;
/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
diff --git a/main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql b/main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql
index 9645b33476..562d2ab096 100755
--- a/main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql
+++ b/main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql
@@ -84,6 +84,7 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_send_message_to_all_platform_users', 'true', 'Yes');
INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_send_message_to_all_platform_users', 'false', 'No');
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('message_max_upload_filesize', NULL, 'textfield', 'Tools', '20971520', 'MessageMaxUploadFilesizeTitle','MessageMaxUploadFilesizeComment',NULL,NULL, 0);
-- xxSTATSxx
ALTER TABLE track_e_exercices ADD COLUMN expired_time_control datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
diff --git a/main/lang/english/admin.inc.php b/main/lang/english/admin.inc.php
old mode 100755
new mode 100644
index 4729ce0693..dc3220f9f6
--- a/main/lang/english/admin.inc.php
+++ b/main/lang/english/admin.inc.php
@@ -1121,4 +1121,5 @@ $AllowStudentsToCreateGroupsInSocialTitle = "Allow students to create groups in
$AllowStudentsToCreateGroupsInSocialComment = "Allow students to create groups in social network";
$AllowSendMessageToAllPlatformUsersTitle = "Allow send message to all platform users";
$AllowSendMessageToAllPlatformUsersComment = "Allow send message to all platform users";
+$TabsSocial = "Tabs social";
?>
\ No newline at end of file
diff --git a/main/lang/english/userInfo.inc.php b/main/lang/english/userInfo.inc.php
old mode 100755
new mode 100644
index ce9a93d284..a78f449393
--- a/main/lang/english/userInfo.inc.php
+++ b/main/lang/english/userInfo.inc.php
@@ -121,7 +121,7 @@ $Members = "Members";
$Admin = "Administrator";
$AttachmentFiles = "Attachments";
$AddOneMoreFile = "Add one more file";
-$MaximunFileSizeXMB = "Maximun file size %s MB";
+$MaximunFileSizeX = "Maximun file size %s MB";
$ModifyInformation = "Modify information";
$GroupList = "Groups list";
$GroupEdit = "Edit group";
diff --git a/main/lang/spanish/admin.inc.php b/main/lang/spanish/admin.inc.php
index 1dc1afaef2..47b85bf964 100644
--- a/main/lang/spanish/admin.inc.php
+++ b/main/lang/spanish/admin.inc.php
@@ -1121,5 +1121,5 @@ $AllowStudentsToCreateGroupsInSocialTitle = "Permitir a los alumnos de crear gru
$AllowStudentsToCreateGroupsInSocialComment = "Permitir a los alumnos crear sus propios grupos en la red social";
$AllowSendMessageToAllPlatformUsersTitle = "Permitir enviar mensajes a todos los usuarios de la plataforma";
$AllowSendMessageToAllPlatformUsersComment = "Permite poder enviar mensajes a todos los usuarios de la plataforma";
-$TabsSocial = "Pestaña red social";
+$TabsSocial = "Pestaña Red social";
?>
\ No newline at end of file
diff --git a/main/lang/spanish/userInfo.inc.php b/main/lang/spanish/userInfo.inc.php
index ee028d7cf4..ab33d8462b 100644
--- a/main/lang/spanish/userInfo.inc.php
+++ b/main/lang/spanish/userInfo.inc.php
@@ -121,7 +121,7 @@ $Members = "Miembros";
$Admin = "Administrador";
$AttachmentFiles = "Adjuntar archivos";
$AddOneMoreFile = "Agregar otro fichero";
-$MaximunFileSizeXMB = "Tamaño máximo de archivo %s MB";
+$MaximunFileSizeX = "Tamaño máximo de archivo %s";
$ModifyInformation = "Modificar información";
$GroupList = "Lista de grupos";
$GroupEdit = "Editar grupo";
diff --git a/main/messages/new_message.php b/main/messages/new_message.php
index 8c38db0890..5a3bb34934 100755
--- a/main/messages/new_message.php
+++ b/main/messages/new_message.php
@@ -69,23 +69,36 @@ $(document).ready(function (){
});
});
-var counter_image = 1;
+var counter_image = 1;
+/*
function remove_image_form(id_elem1) {
var elem1 = document.getElementById(id_elem1);
- elem1.parentNode.removeChild(elem1);
-}
-function add_image_form() {
- counter_image = counter_image + 1;
+ elem1.parentNode.removeChild(elem1);
+}
+*/
+function add_image_form() {
// Multiple filepaths for image form
- var filepaths = document.getElementById("filepaths");
+ var filepaths = document.getElementById("filepaths");
+ if (document.getElementById("filepath_"+counter_image)) {
+ counter_image = counter_image + 1;
+ } else {
+ counter_image = counter_image;
+ }
var elem1 = document.createElement("div");
elem1.setAttribute("id","filepath_"+counter_image);
filepaths.appendChild(elem1);
id_elem1 = "filepath_"+counter_image;
id_elem1 = "\'"+id_elem1+"\'";
- document.getElementById("filepath_"+counter_image).innerHTML = "
";
-}
-
+ //document.getElementById("filepath_"+counter_image).innerHTML = "
";
+ document.getElementById("filepath_"+counter_image).innerHTML = " ";
+ if (filepaths.childNodes.length == 6) {
+ var link_attach = document.getElementById("link-more-attach");
+ if (link_attach) {
+ link_attach.innerHTML="";
+ }
+ }
+}
+
';
$nameTools = get_lang('ComposeMessage');
@@ -190,7 +203,7 @@ function manage_form ($default, $select_from_user_list = null) {
');
- $form->addElement('html','