Source for file private_frameset.php

Documentation is available at private_frameset.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: letreo $
  32. $Date: 2003/10/10 16:45:14 $
  33. $Source: /cvsroot/phpopenchat/chat3/private_frameset.php,v $
  34. $Revision: 1.11 $
  35. */
  36.  
  37. //Get default values
  38. require_once('config.inc.php');
  39.  
  40. require_once(POC_INCLUDE_PATH.'/adodb/adodb.inc.php');
  41. require_once(POC_INCLUDE_PATH.'/class.Translator.inc');
  42. require_once(POC_INCLUDE_PATH.'/class.Chatter.inc');
  43. require_once(POC_INCLUDE_PATH.'/class.Channel_Buffer_'.CHANNEL_BUFFER_TYPE.'.inc');
  44. require_once(POC_INCLUDE_PATH.'/class.Channel.inc');
  45. require_once(POC_INCLUDE_PATH.'/class.Line.inc');
  46. require_once(POC_INCLUDE_PATH.'/class.Logger.inc');
  47.  
  48. session_start();
  49.  
  50. if(!isset($_SESSION['chatter']))
  51. die('Login first!');
  52.  
  53. if( !isset($_GET['channel'])
  54. || ( $_GET['channel'] != $_SESSION['chatter']->get_nick()
  55. && $_GET['channel'] != $_SESSION['invited_from'] )
  56. ) {
  57. die('Permission denied!');
  58. }
  59.  
  60. if(function_exists('session_unregister')) {
  61. session_unregister('p_in');unset($_SESSION['p_in']);
  62. }
  63. $prefix = abs(crc32($_REQUEST['channel']));
  64. if(function_exists('session_register')) {
  65. session_register($prefix.'_channel', $prefix.'_channel_buffer', $prefix.'_lastRedLine');
  66. }
  67. /* invited chatter*/
  68. if(isset($_SESSION['invited_from']) && $_GET['channel'] == $_SESSION['invited_from'] )
  69. {
  70. $recipient = $_GET['channel'];
  71. $_SESSION['chatter']->join_channel( $_GET['channel'], true );
  72. unset($_SESSION['invited_from']);
  73. }
  74. /* inviting chatter */
  75. if( $_GET['channel'] == $_SESSION['chatter']->get_nick() )
  76. {
  77. $recipient = $_GET['dialog_partner'];
  78. $_SESSION['chatter']->join_channel( $_GET['channel'], true );
  79. $_SESSION['chatter']->invite_private( $_SESSION['chatter']->get_nick(), $_GET['dialog_partner'] );
  80. }
  81.  
  82. $TEMPLATE_OUT['channel'] = urlencode( $_GET['channel'] );
  83. $TEMPLATE_OUT['recipient'] = urlencode($recipient);
  84. $TEMPLATE_OUT['recipient_title'] = $recipient;
  85. $TEMPLATE_OUT['channel_prefix'] = $prefix;
  86. $TEMPLATE_OUT['interval'] = LINE_POLLING_INTERVAL * 1000;
  87.  
  88. header('Content-type: text/html; charset='.$_SESSION['translator']->out('CHARACTER_ENCODING'));
  89. print '<?xml version="1.0" encoding="'.$_SESSION['translator']->out('CHARACTER_ENCODING').'"?>'.NL;
  90. flush();
  91. ?>
  92. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
  93. <html>
  94. <head>
  95. <title><?=$TEMPLATE_OUT['recipient_title']?></title>
  96. <meta http-equiv="Content-type" content="text/html; charset='<?=$_SESSION['translator']->out('CHARACTER_ENCODING')?>'" />
  97. <script type="text/javascript">
  98. /*<![CDATA[*/
  99. var refresh = <?=$TEMPLATE_OUT['interval']?>;
  100. var BufferInt = window.setInterval("reload_getlines()",refresh);
  101. var serialize_private_refresh = 0;
  102.  
  103. function reload_getlines(){
  104. if(serialize_privat_refresh == 0)
  105. {
  106. serialize_privat_refresh = 1;
  107. getlines.location.href = 'private_getlines.php?login=0&<?=session_name()."=".session_id()?>&channel=<?=$TEMPLATE_OUT['channel']?>&recipient=<?=$TEMPLATE_OUT['recipient']?>';
  108. }
  109. }
  110.  
  111. var scrollTO;
  112. var timeout_on = false;
  113. var speed = 1;
  114. function scroll_it() {
  115. to=20;
  116. if(speed != 0){
  117. if(speed==3){
  118. to = 5;
  119. down=3;
  120. }else if(speed == 2){
  121. to = 10;
  122. down=2;
  123. }else{
  124. to = 20;
  125. down=1;
  126. }
  127. window.output.scrollBy(-1,down);
  128. if (timeout_on == true) {
  129. clearTimeout(scrollTO);
  130. }
  131. timeout_on = true;
  132. scrollTO = setTimeout('scroll_it()',to);
  133. }
  134. }
  135.  
  136. function mk_clean()
  137. {
  138. opener.parent.dummy.location.href = 'private_destroy.php?<?=session_name()."=".session_id()?>&channel=<?=$TEMPLATE_OUT['channel']?>&recipient=<?=$TEMPLATE_OUT['recipient']?>';
  139. }
  140. /*]]>*/
  141. </script>
  142. </head>
  143. <frameset rows="75%,*,0,0" onunload="mk_clean();">
  144. <frame name="output" src="output.php?<?=session_name()."=".session_id()?>" frameborder="0" />
  145. <frame name="input" src="private_input.php?<?=session_name()."=".session_id()?>&amp;channel=<?=$TEMPLATE_OUT['channel']?>&amp;recipient=<?=$TEMPLATE_OUT['recipient']?>" frameborder="0" />
  146. <frame name="getlines" src="private_getlines.php?login=1&amp;<?=session_name()."=".session_id()?>&amp;channel=<?=$TEMPLATE_OUT['channel']?>&amp;recipient=<?=$TEMPLATE_OUT['recipient']?>" frameborder="0" />
  147. <frame name="_dummy" src="output.php?<?=session_name()."=".session_id()?>" frameborder="0" />
  148. <noframes>
  149. <body>
  150. Sorry you are using an outdated browser, please download the newest release of:
  151. <menu>
  152. <li>Mozilla at <a href="http://www.mozilla.org/">http://www.mozilla.org/</a> or</li>
  153. <li>Opera at <a href="http://www.opera.com/">http://www.opera.com/</a> or</li>
  154. <li>Konqueror at <a href="http://www.konqueror.org/">http://www.konqueror.org/</a> or</li>
  155. <li>Netscape at <a href="http://www.netscape.com/">http://www.netscape.com/</a> or</li>
  156. <li>Lynx at <a href="http://lynx.browser.org/">http://lynx.browser.org/</a></li>
  157. </menu>
  158. </body>
  159. </noframes>
  160. </frameset>
  161. </html>

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