Source for file ignore.php

Documentation is available at ignore.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/ignore.php,v $
  34. $Revision: 1.25 $
  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.Channel_Buffer_'.CHANNEL_BUFFER_TYPE.'.inc');
  44. require_once(POC_INCLUDE_PATH.'/class.Translator.inc');
  45. require_once(POC_INCLUDE_PATH.'/class.Template.inc');
  46.  
  47. session_start();
  48.  
  49. //check if chatter is authorized to get this page
  50. if( !isset($_SESSION['chatter']) )
  51. die('Login first!');
  52. $_SESSION['reload_count'] = 0;//reset chat session expiration time
  53. //if( $_SESSION['chatter']->is_guest() )
  54. // die($_SESSION['translator']->out('DENIED_FOR_GUESTS'));
  55.  
  56.  
  57.  
  58. $ignored_chatters_option_list = '';
  59. $ignore_success = false;
  60. $option_list_of_channel_chatters = '<option />'.NL;
  61. if( (isset($_POST['add'])&&$_POST['add']!='') && isset($_POST['unignored_chatter']) )
  62. $ignore_success = $_SESSION['chatter']->ignore( $_POST['unignored_chatter'] );
  63. elseif( isset($_GET['unignored_chatter']) )
  64. {
  65. /* launched by the right click menu within the output frame*/
  66. if($ignore_success) {
  67. define('CONFIRM_MSG',$_SESSION['translator']->out('CONFIRM_IGNORE'));
  68. } else {
  69. define('CONFIRM_MSG',$_SESSION['translator']->out('CONFIRM_IGNORE_FAILED'));
  70. }
  71. $_SESSION['chatter']->ignore( $_GET['unignored_chatter'] );
  72. if( isset($_GET['silent']) )
  73. {
  74. include_once($_SESSION['template']->get_template('confirmation_message'));
  75. exit;
  76. }
  77. }
  78.  
  79. if( ( isset($_POST['del']) || (isset($_POST['del_x']) && $_POST['del_x'] > 0) )
  80. && isset($_POST['ignored_chatter']) )
  81. $_SESSION['chatter']->unignore( $_POST['ignored_chatter'] );
  82. elseif( isset($_GET['ignored_chatter']) )
  83. {
  84. /* launched by the right click menu within the output frame*/
  85. define('CONFIRM_MSG',$_SESSION['translator']->out('CONFIRM_UNIGNORE'));
  86. $_SESSION['chatter']->unignore( $_GET['ignored_chatter'] );
  87. if( isset($_GET['silent']) )
  88. {
  89. include_once($_SESSION['template']->get_template('confirmation_message'));
  90. exit;
  91. }
  92. }
  93.  
  94. $nick_constraint = '';
  95. if( !isset($_POST['nick_constraint']) )
  96. $_POST['nick_constraint'] = $_SESSION['translator']->out('RESTRICT');
  97. elseif( $_POST['nick_constraint'] != $_SESSION['translator']->out('RESTRICT')
  98. && $_POST['nick_constraint'] != '' )
  99. {
  100. //get the list of unignored chatters
  101. $_SESSION['chat']->connect();
  102. $option_list_of_channel_chatters = $_SESSION['chat']->get_unignored_chatters_option_list( $_SESSION['channel_buffer']->get_name(), $_POST['nick_constraint'] );
  103. $_SESSION['chat']->disconnect();
  104. }
  105.  
  106. //create the list of ignored chatters
  107. $ignored = $_SESSION['chatter']->get_ignored_sender();
  108. reset($ignored);
  109. do{
  110. $ignored_chatters_option_list .= TAB.'<option value="'.current($ignored).'">'.preg_replace( "/\#{3}([^#]*)\#{3}/e", "htmlentities(\$_SESSION['translator']->out('\\1'))", current($ignored) ).'</option>'.NL;
  111. }while(next($ignored));
  112.  
  113. $TEMPLATE_OUT['ignored_chatters_option_list'] = $ignored_chatters_option_list;
  114. $TEMPLATE_OUT['option_list_of_channel_chatters'] = $option_list_of_channel_chatters;
  115. $_SESSION['template']->get_template();
  116. ?>

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