Source for file private_input.php

Documentation is available at private_input.php

  1. <?php //-*-php-*-
  2. /* ******************************************************************** **
  3. ** Copyright notice **
  4. ** **
  5. ** (c) 1995-2003 PHPOpenChat Development Team **
  6. ** http://phpopenchat.sourceforge.net/ **
  7. ** **
  8. ** All rights reserved **
  9. ** **
  10. ** This script is part of the PHPOpenChat project. The PHPOpenChat **
  11. ** project is free software; you can redistribute it and/or modify **
  12. ** it under the terms of the GNU General Public License as published by **
  13. ** the Free Software Foundation; either version 2 of the License, or **
  14. ** (at your option) any later version. **
  15. ** **
  16. ** The GNU General Public License can be found at **
  17. ** http://www.gnu.org/copyleft/gpl.html. **
  18. ** A copy is found in the textfile GPL and important notices to the **
  19. ** license from the team is found in the textfile LICENSE distributed **
  20. ** with these scripts. **
  21. ** **
  22. ** This script is distributed in the hope that it will be useful, **
  23. ** but WITHOUT ANY WARRANTY; without even the implied warranty of **
  24. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
  25. ** GNU General Public License for more details. **
  26. ** **
  27. ** This copyright notice MUST APPEAR in all copies of the script! **
  28. ** ******************************************************************** */
  29.  
  30. /*
  31. $Author:
  32. $Date:
  33. $Source:
  34. $Revision:
  35. */
  36.  
  37. require_once('config.inc.php');
  38.  
  39. require_once(POC_INCLUDE_PATH.'/adodb/adodb.inc.php');
  40. require_once(POC_INCLUDE_PATH.'/class.Chat.inc');
  41. require_once(POC_INCLUDE_PATH.'/class.Chatter.inc');
  42. require_once(POC_INCLUDE_PATH.'/class.Recipient.inc');//extents Chatter
  43. require_once(POC_INCLUDE_PATH.'/class.Line.inc');
  44. require_once(POC_INCLUDE_PATH.'/class.Channel.inc');
  45. require_once(POC_INCLUDE_PATH.'/class.Channel_Buffer_'.CHANNEL_BUFFER_TYPE.'.inc');
  46. require_once(POC_INCLUDE_PATH.'/class.Translator.inc');
  47. require_once(POC_INCLUDE_PATH.'/class.Template.inc');
  48.  
  49. session_start();
  50.  
  51. //check if chatter is authorized to get this page
  52. if( !isset($_SESSION['chatter']) )
  53. {
  54. header('Status: 301');
  55. header('Location: index.php?forceOnTop=1');
  56. exit;
  57. }
  58.  
  59. $prefix = abs(crc32($_REQUEST['channel']));
  60. //$TEMPLATE_OUT['test'] = $_SESSION[$prefix.'_channel_buffer']->get_name();
  61.  
  62. if( isset($_POST['line']) && $_POST['line'] != '' )
  63. {
  64. $_SESSION['reload_count'] = 0;//reset chat session expiration time
  65. $_POST['line'] = preg_replace('/\'/', '&#39;', $_POST['line'] );
  66.  
  67. $said = $_POST['line'];
  68. $line = &new Line( $_SESSION['chatter'], $said);
  69. $recipient = &new Chatter(STATUS_BOT_NAME);
  70. $recipient->set_nick($_REQUEST['recipient']);
  71. $line->set_recipient($recipient);
  72. $line->set_in_private_window();
  73. $line->filter_buffer_input();
  74. //Bug: sometimes, the channel buffer doen't exits in the session
  75. //may be a timing problem, so we try to wait if this problem occur
  76. if(! is_object( $_SESSION[$prefix.'_channel_buffer']) ) sleep(1);
  77. $_SESSION[$prefix.'_channel_buffer']->connect();
  78. $_SESSION[$prefix.'_channel_buffer']->put_line($line);
  79. $_SESSION[$prefix.'_channel_buffer']->disconnect();
  80. $_SESSION['chatter']->count_hit('line');
  81. $TEMPLATE_OUT['show_message_locally'] = $line->out();
  82. }
  83. $TEMPLATE_OUT['channel'] = $_REQUEST['channel'];
  84. $TEMPLATE_OUT['recipient'] = $_REQUEST['recipient'];
  85. $_SESSION['template']->get_template('private_input');
  86. ?>

Documentation generated on Tue, 29 Jun 2004 14:42:40 +0200 by phpDocumentor 1.3.0RC3