diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-01-15 22:28:46 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-01-15 22:28:46 +0000 |
commit | 43c33492d2ab65a783c17559cf8dabd7832e9ea1 (patch) | |
tree | 7107fed1b5424db1405b842972c7e4c47f11bfd3 /mod/messages/actions/messages/send.php | |
parent | e8d148970261207efbe5435e1abcf68c5ed59cc8 (diff) | |
download | elgg-43c33492d2ab65a783c17559cf8dabd7832e9ea1.tar.gz elgg-43c33492d2ab65a783c17559cf8dabd7832e9ea1.tar.bz2 |
Updated the messages plugin to use the new CSS/HTML
git-svn-id: http://code.elgg.org/elgg/trunk@7886 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/messages/actions/messages/send.php')
-rw-r--r-- | mod/messages/actions/messages/send.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/mod/messages/actions/messages/send.php b/mod/messages/actions/messages/send.php new file mode 100644 index 000000000..f6bac606d --- /dev/null +++ b/mod/messages/actions/messages/send.php @@ -0,0 +1,46 @@ +<?php +/** +* Ssend a message action +* +* @package ElggMessages +*/ + +$subject = strip_tags(get_input('subject')); +$body = get_input('body'); +$recipient_guid = get_input('recipient_guid'); + +elgg_make_sticky_form('messages'); + +//$reply = get_input('reply',0); // this is the guid of the message replying to + +if (!$recipient_guid) { + register_error(elgg_echo("messages:user:blank")); + forward("pg/messages/compose"); +} + +$user = get_user($recipient_guid); +if (!$user) { + register_error(elgg_echo("messages:user:nonexist")); + forward("pg/messages/compose"); +} + +// Make sure the message field, send to field and title are not blank +if (!$body || !$subject) { + register_error(elgg_echo("messages:blank")); + forward("pg/messages/compose"); +} + +// Otherwise, 'send' the message +$result = messages_send($subject, $body, $recipient_guid, 0, $reply); + +// Save 'send' the message +if (!$result) { + register_error(elgg_echo("messages:error")); + forward("pg/messages/compose"); +} + +elgg_clear_sticky_form('messages'); + +system_message(elgg_echo("messages:posted")); + +forward('pg/messages/inbox/' . get_loggedin_user()->username); |