Source for file whois_online.php

Documentation is available at whois_online.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/08/06 12:19:36 $
  33. $Source: /cvsroot/phpopenchat/chat3/whois_online.php,v $
  34. $Revision: 1.13 $
  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.Chat.inc');
  42. require_once(POC_INCLUDE_PATH.'/class.Chatter.inc');
  43. require_once(POC_INCLUDE_PATH.'/class.Translator.inc');
  44. require_once(POC_INCLUDE_PATH.'/class.Template.inc');
  45.  
  46. session_start();
  47.  
  48. //check if chatter is authorized to get this page
  49. if( !isset($_SESSION['chatter']) )
  50. die('Login first!');
  51.  
  52. header('Content-type: text/html; charset='.$_SESSION['translator']->out('CHARACTER_ENCODING'));
  53. $_SESSION['template']->get_cached_content( 60 );//get cached content with a max age of one minute
  54. $_SESSION['reload_count'] = 0;//reset chat session expiration time
  55. $chatters_online_list = '';
  56. function check_private_icon( $nick )
  57. {
  58. global $ACCEPTED_MIME_TYPES;
  59. $smiley_dir = '/images/icons/chatter';
  60. for ($i=0;$i<count($ACCEPTED_MIME_TYPES);$i++)
  61. {
  62. preg_match('#image/[x\-]?(.*)#',$ACCEPTED_MIME_TYPES[$i], $parts);
  63. $file_extension = $parts[1];
  64. $smiley_path = $smiley_dir.'/'.strtolower($nick).'.'.$file_extension;
  65. if( file_exists($_SESSION['template']->get_tmpl_sys_path().$smiley_path) )
  66. return '<img title="'.$_SESSION['translator']->out('OPEN_USER_PAGE').'" src="'.$_SESSION['template']->get_tmpl_web_path().$smiley_path.'" align="middle" alt="'.$_SESSION['translator']->out('PRIVATE_IMAGE').'" border="0" />';
  67. }
  68. return '';
  69. }
  70.  
  71. $_SESSION['chat']->connect();
  72. $chatters_online = array();
  73. $chatters_online = $_SESSION['chat']->get_online_chatter();
  74. $count_chatters_online = count($chatters_online);
  75. if( $count_chatters_online > 0 )
  76. {
  77. /* reset($chatters_online);
  78. do{
  79. $key = key($chatters_online);
  80. $current = current($chatters_online);
  81. if( ($key % COL_COUNT_CHATTER_LIST) == 0)
  82. $chatters_online_list .= NL.TAB.'<tr>';
  83. */
  84. $td_count = 0;
  85. for($i=0;$i<$count_chatters_online;$i++)
  86. {
  87. $current = $chatters_online[$i];
  88. $td_count++;
  89. if($i==0 || ($i % COL_COUNT_CHATTER_LIST) == 0) $chatters_online_list .= NL.TAB.'<tr>';
  90.  
  91. $prefix='';
  92. $postfix='';
  93. if( $_SESSION['chatter']->is_friend($current['NICK']) )
  94. {
  95. $prefix='<strong>';
  96. $postfix='</strong>';
  97. }
  98.  
  99. $chatters_online_list .= NL.TAB.TAB.'<td class="chatterTableImgCell" style="padding-left: 3px;border-right: 1px solid yellow;">&nbsp;';
  100. //$chatters_online_list .= check_private_icon( $current['NICK'] ).'</a></td>';
  101. $chatters_online_list .= $prefix.preg_replace( "/\#{3}([^#]*)\#{3}/e", "htmlentities(\$_SESSION['translator']->out('\\1'))", $current['NICK'] ).$postfix.'&nbsp;';
  102. $chatters_online_list .= '['.$current['LAST_CHANNEL'].']';
  103. //ignored?
  104. if($_SESSION['chatter']->is_ignored($current['NICK']))
  105. $chatters_online_list .= '<img title="'.$_SESSION['translator']->out('IGNORED').'" src="'.$_SESSION['template']->get_tmpl_web_path().'/images/icons/ignore_list.gif" alt="'.$_SESSION['translator']->out('IGNORED').'" border="0" align="middle" />';
  106. //userpage
  107. $chatters_online_list .= '&nbsp;<a class="imageLink" href="#" onclick="showUserPage(\''.$current['NICK'].'\');return false">';
  108. $chatters_online_list .= '<img title="'.$_SESSION['translator']->out('USER_PAGE').'" src="'.$_SESSION['template']->get_tmpl_web_path().'/images/icons/userpage.gif" alt="'.$_SESSION['translator']->out('USER_PAGE').'" border="0" align="middle" /></a>';
  109. if( $_SESSION['channel']->get_name() == $current['LAST_CHANNEL'] )
  110. {
  111. //select nick
  112. $chatters_online_list .= '&nbsp;<a class="imageLink" href="#" onclick="select_nick(\''.$current['NICK'].'\');window.close();return false">';
  113. $chatters_online_list .= '<img title="'.$_SESSION['translator']->out('SAY_TO').' '.$current['NICK'].'" src="'.$_SESSION['template']->get_tmpl_web_path().'/images/icons/face_to_face.gif" alt="'.$_SESSION['translator']->out('SAY_TO').'" border="0" align="middle" /></a></td>';
  114. }
  115. else
  116. {
  117. //change channel
  118. $chatters_online_list .= '&nbsp;<a class="imageLink" href="#" onclick="change_channel(\''.$current['LAST_CHANNEL'].'\');window.close();return false;">';
  119. $chatters_online_list .= '<img title="'.$_SESSION['translator']->out('CHANGE_CHANNEL').' ('.$current['LAST_CHANNEL'].')" src="'.$_SESSION['template']->get_tmpl_web_path().'/images/icons/change_channel.gif" alt="'.$_SESSION['translator']->out('CHANGE_CHANNEL').' ('.$current['LAST_CHANNEL'].')" border="0" align="middle" /></a></td>';
  120. }
  121. if($i > 0 && ($i % COL_COUNT_CHATTER_LIST) == 0)
  122. {
  123. $td_count = 0;
  124. $chatters_online_list .= NL.TAB.'</tr>';
  125. }
  126. }
  127. for ($i = $td_count; $i < COL_COUNT_CHATTER_LIST; $i++)
  128. {
  129. $chatters_online_list .= NL.TAB.TAB.'<td></td>';
  130. }
  131. if( $td_count > 0 ) $chatters_online_list .= NL.TAB.'</tr>';
  132. }
  133. else
  134. $chatters_online_list = '<tr><td>&nbsp;</td></tr>';
  135. $_SESSION['chat']->disconnect();
  136. $TEMPLATE_OUT['chatters_online_list'] = $chatters_online_list;
  137.  
  138. header('Content-type: text/html; charset='.$_SESSION['translator']->out('CHARACTER_ENCODING'));
  139. $_SESSION['template']->get_template();
  140. ?>

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