diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php
index 57e5613930..d2b1b2abf2 100755
--- a/main/inc/lib/message.lib.php
+++ b/main/inc/lib/message.lib.php
@@ -213,7 +213,10 @@ class MessageManager
}
}
- if ($total_filesize > intval(api_get_setting('message_max_upload_filesize'))) {
+ // validating fields
+ if (empty($subject)) {
+ return get_lang('YouShouldWriteASubject');
+ } else 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')));
}
diff --git a/main/messages/send_message.php b/main/messages/send_message.php
index bcbe075d79..f7f81429bd 100755
--- a/main/messages/send_message.php
+++ b/main/messages/send_message.php
@@ -49,15 +49,14 @@ if ($panel_id == 2 || $panel_id == 4 ) {
:
-
:
-
:
-
-
+
* :
+
:
+
@@ -68,7 +67,7 @@ if ($panel_id==4 && !empty($content_message)) {
$subject_message=null;
}
SocialManager::send_invitation_friend_user($user_id,$subject_message,$content_message);
-} elseif ($panel_id==5 && !empty($content_message) ) {
+} elseif ($panel_id==5 && !empty($subject_message) ) {
SocialManager::send_invitation_friend_user($user_id,$subject_message,$content_message);
}
-?>
+?>
\ No newline at end of file
diff --git a/main/messages/send_message_to_userfriend.inc.php b/main/messages/send_message_to_userfriend.inc.php
index e7a5b75f5f..fc4e4f84f1 100755
--- a/main/messages/send_message_to_userfriend.inc.php
+++ b/main/messages/send_message_to_userfriend.inc.php
@@ -49,10 +49,11 @@ if ( isset($_REQUEST['user_friend']) ) {
:
-
:
-
:
+
* :
+
:
+
*
-
+
" onclick="action_database_panel('4','')" >
-
diff --git a/main/social/groups.php b/main/social/groups.php
index dac3ee0049..140a96f8aa 100755
--- a/main/social/groups.php
+++ b/main/social/groups.php
@@ -60,6 +60,14 @@ function add_image_form() {
}
}
+function validate_text_empty (str,msg) {
+ var str = str.replace(/^\s*|\s*$/g,"");
+ if (str.length == 0) {
+ alert(msg);
+ return true;
+ }
+}
+
jQuery(document).ready(function() {
$(".head").click(function() {
$(this).next().slideToggle("fast");
@@ -82,7 +90,6 @@ jQuery(document).ready(function() {
return false;
}).next().hide();
});
-
';
$interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social'));
@@ -108,7 +115,8 @@ if (isset($_POST['token']) && $_POST['token'] === $_SESSION['sec_token']) {
} else {
$res = MessageManager::send_message(0, $title, $content, $_FILES, '', $group_id, $parent_id);
}
-
+
+ // display error messages
if (is_string($res)) {
Display::display_error_message($res);
}
diff --git a/main/social/message_for_group_form.inc.php b/main/social/message_for_group_form.inc.php
index a3040dc27b..2dcae6b6ae 100755
--- a/main/social/message_for_group_form.inc.php
+++ b/main/social/message_for_group_form.inc.php
@@ -72,7 +72,7 @@ if (!empty($group_id) && $allowed_action) {
$user_info=api_get_user_info($userfriend_id);
echo api_xml_http_response_encode(get_lang('To')); ?> :
-
:
+
* :
:
:
-
+
-
+
+ *