send_message.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2009 Dokeos SPRL
  6. Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
  7. Copyright (c) Facultad de Matematicas, UADY (México)
  8. Copyright (c) Evie, Free University of Brussels (Belgium)
  9. Copyright (c) 2009 Isaac Flores Paz <isaac.flores@dokeos.com>
  10. For a full list of contributors, see "credits.txt".
  11. The full license can be read in "license.txt".
  12. This program is free software; you can redistribute it and/or
  13. modify it under the terms of the GNU General Public License
  14. as published by the Free Software Foundation; either version 2
  15. of the License, or (at your option) any later version.
  16. See the GNU General Public License for more details.
  17. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  18. Mail: info@dokeos.com
  19. ==============================================================================
  20. */
  21. $language_file = array('registration','messages','userInfo','admin');
  22. $cidReset=true;
  23. require_once '../inc/global.inc.php';
  24. require_once '../messages/message.class.php';
  25. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  26. require_once api_get_path(LIBRARY_PATH).'message.lib.php';
  27. require_once api_get_path(LIBRARY_PATH).'social.lib.php';
  28. if (api_is_anonymous()) {
  29. api_not_allowed();
  30. }
  31. $user_id=intval($_POST['user_id']);
  32. $panel_id=intval($_POST['panel_id']);
  33. $content_message=Security::remove_XSS($_POST['txt_content'],COURSEMANAGERLOWSECURITY); //check this is filtered on output
  34. $subject_message=Security::remove_XSS($_POST['txt_subject']); //check this is filtered on output
  35. $user_info=array();
  36. $user_info=api_get_user_info($user_id);
  37. if ($panel_id==2) {
  38. ?>
  39. <td height="20"><?php //echo api_xml_http_response_encode(get_lang('Info')).' :'; ?></td>
  40. <td height="20"><?php //echo api_xml_http_response_encode(get_lang('SocialUserInformationAttach')); ?></td>
  41. <td height="20"><?php echo api_xml_http_response_encode(get_lang('WriteAMessage')); ?> :<br/><textarea id="txt_area_invite" rows="3" cols="25"></textarea></td>
  42. <td height="20"><input type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendInviteMessage')); ?>" onclick="action_database_panel('4','<?php echo $user_id;?>')" /></td>
  43. <?php
  44. }
  45. if ($panel_id==1) {
  46. ?>
  47. <td height="20"><?php echo api_xml_http_response_encode(get_lang('To')); ?> &nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?></td>
  48. <td height="20"><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br/><input id="txt_subject_id" type="text" style="width:200px;"></td>
  49. <td height="20"><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br/><textarea id="txt_area_invite" rows="3" cols="25"></textarea></td>
  50. <td height="20"><input type="button" value="<?php echo api_xml_http_response_encode(get_lang('NewMessage')); ?>" onclick="hide_display_message()" />&nbsp;&nbsp;&nbsp; <input type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="action_database_panel('5','<?php echo $user_id;?>')" /></td>
  51. <?php
  52. }
  53. if ($panel_id==3) {
  54. ?>
  55. <dl>
  56. <dd><a href="javascript:void(0)" onclick="change_panel('2','<?php echo $user_id; ?>')"><?php echo api_xml_http_response_encode(get_lang('SendInviteMessage')); ?></a></dd>
  57. <dd><a href="javascript:void(0)" onclick="change_panel('1','<?php echo $user_id; ?>')"><?php echo api_xml_http_response_encode(get_lang('SendMessage'));?></a></dd>
  58. </dl>
  59. <?php
  60. // <dd><a href="main/social/index.php#remote-tab-5"> echo api_xml_http_response_encode(get_lang('SocialSeeContacts'));</a></dd>
  61. }
  62. if ($panel_id==4) {
  63. if ($subject_message=='clear') {
  64. $subject_message=null;
  65. }
  66. UserFriend::send_invitation_friend_user($user_id,$subject_message,$content_message);
  67. } elseif ($panel_id==5) {
  68. UserFriend::send_invitation_friend_user($user_id,$subject_message,$content_message);
  69. }
  70. ?>