message.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /* $Id: message.php 2893 2007-04-14 13:20:30Z b4rt $ */
  3. /*******************************************************************************
  4. LICENSE
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License (GPL)
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. To read the license please visit http://www.gnu.org/copyleft/gpl.html
  14. *******************************************************************************/
  15. // prevent direct invocation
  16. if ((!isset($cfg['user'])) || (isset($_REQUEST['cfg']))) {
  17. @ob_end_clean();
  18. @header("location: ../../index.php");
  19. exit();
  20. }
  21. /******************************************************************************/
  22. // common functions
  23. require_once('inc/functions/functions.common.php');
  24. // to-user
  25. $to_user = tfb_getRequestVar('to_user');
  26. if (empty($to_user) or empty($cfg["user"])) {
  27. // the user probably hit this page direct
  28. @header("location: index.php?iid=index");
  29. exit();
  30. }
  31. // message
  32. $message = tfb_getRequestVar('message');
  33. if (!empty($message)) {
  34. $to_all_r = tfb_getRequestVar('to_all');
  35. $force_read_r = tfb_getRequestVar('force_read');
  36. $message = check_html($message, "nohtml");
  37. SaveMessage($to_user, $cfg["user"], htmlentities($message), (empty($to_all_r)) ? 0 : 1, (!empty($force_read_r) && $cfg['isAdmin']) ? 1 : 0);
  38. @header("location: index.php?iid=readmsg");
  39. exit();
  40. }
  41. // rmid
  42. if (isset($_REQUEST['rmid'])) {
  43. $rmid = tfb_getRequestVar('rmid');
  44. if (!empty($rmid)) {
  45. list($from_user, $message, $ip, $time) = GetMessage($rmid);
  46. $message = $cfg['_DATE'].": ".date($cfg['_DATETIMEFORMAT'], $time)."\n".$from_user." ".$cfg['_WROTE'].":\n\n".$message;
  47. $message = ">".str_replace("\n", "\n>", $message);
  48. $message = "\n\n\n".$message;
  49. }
  50. }
  51. // init template-instance
  52. tmplInitializeInstance($cfg["theme"], "page.message.tmpl");
  53. // set vars
  54. $tmpl->setvar('to_user', $to_user);
  55. $tmpl->setvar('user', $cfg["user"]);
  56. $tmpl->setvar('message', $message);
  57. //
  58. $tmpl->setvar('_TO', $cfg['_TO']);
  59. $tmpl->setvar('_FROM', $cfg['_FROM']);
  60. $tmpl->setvar('_YOURMESSAGE', $cfg['_YOURMESSAGE']);
  61. $tmpl->setvar('_SEND', $cfg['_SEND']);
  62. $tmpl->setvar('_SENDTOALLUSERS', $cfg['_SENDTOALLUSERS']);
  63. $tmpl->setvar('_FORCEUSERSTOREAD', $cfg['_FORCEUSERSTOREAD']);
  64. //
  65. tmplSetTitleBar($cfg["pagetitle"].' - '.$cfg['_SENDMESSAGETITLE']);
  66. tmplSetFoot();
  67. tmplSetIidVars();
  68. // parse template
  69. $tmpl->pparse();
  70. ?>