PHPOpenChat PHP Cross Reference Customer Relationship Management

Source: /invite.php - 134 lines - 6151 bytes - Summary - Text - Print

   1  <?php //-*-php-*-
   2  /*   ********************************************************************   **
   3  **   Copyright notice                                                       **
   4  **                                                                          **
   5  **   (c) 1995-2004 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: 2004/02/24 17:05:18 $
  33    $Source: /cvsroot/phpopenchat/chat3/invite.php,v $
  34    $Revision: 1.19.2.6 $
  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  require_once (POC_INCLUDE_PATH.'/class.Line.inc');
  47  
  48  session_start();
  49  
  50  //check if chatter is authorized to get this page
  51  if( !isset($_SESSION['chatter']) )
  52    die('Login first!');
  53  $_SESSION['reload_count'] = 0;//reset chat session expiration time
  54  
  55  //if( $_SESSION['chatter']->is_guest() )
  56  //  die($_SESSION['translator']->out('DENIED_FOR_GUESTS'));
  57  
  58  function post_line( $to, $string )
  59  {
  60    $line = &new POC_Line();
  61    $recipient = &new POC_Chatter( STATUS_BOT_NAME );
  62    $recipient->set_nick( $to );
  63    $line->set_recipient( $recipient );
  64    $line->set_sender( $_SESSION['chatter'] );
  65    $line->set_said( $string );
  66    $line->set_whispered();
  67    //$line->set_invitationMsg();
  68  
  69    $_SESSION['channel_buffer']->connect();
  70    $_SESSION['channel_buffer']->put_line($line);
  71    $_SESSION['channel_buffer']->disconnect();
  72    $_SESSION['chatter']->count_hit('line');
  73  }
  74  
  75  $invited_chatters_option_list = '';
  76  $option_list_of_disinvited_chatters = '<option />';
  77  
  78  if( (isset($_POST['add'])&&$_POST['add']!='') && isset($_POST['disinvited_chatter']) )
  79    $_SESSION['chatter']->invite( $_POST['disinvited_chatter'] );
  80  elseif( isset($_GET['disinvited_chatter']) )
  81  {
  82    /* launched by the right click menu within the output frame*/
  83    define('CONFIRM_MSG',$_SESSION['translator']->out('CONFIRM_INVITE'));
  84    $_SESSION['chatter']->invite( $_GET['disinvited_chatter'] );
  85    post_line( $_GET['disinvited_chatter'], '<span class="invitationMsg">###INVITATION_MESSAGE###'.' "'.$_SESSION['chatter']->get_nick().'"</span>' );
  86    if( isset($_GET['silent']) )
  87    {
  88      print '<?xml version="1.0" encoding="'.$_SESSION['translator']->out('CHARACTER_ENCODING').'"?>'.NL;
  89      include_once($_SESSION['template']->get_template('confirmation_message'));
  90      exit;
  91    }
  92  }
  93    
  94  if( (isset($_POST['del_x'])&&$_POST['del_x']>0) && isset($_POST['invited_chatter']) )
  95    $_SESSION['chatter']->disinvite( $_POST['invited_chatter'] );
  96  elseif( isset($_GET['invited_chatter']) )
  97  {
  98    /* launched by the right click menu within the output frame*/
  99    define('CONFIRM_MSG',$_SESSION['translator']->out('CONFIRM_DISINVITE'));
 100    $_SESSION['chatter']->disinvite( $_GET['invited_chatter'] );
 101    if( isset($_GET['silent']) )
 102    {
 103      print '<?xml version="1.0" encoding="'.$_SESSION['translator']->out('CHARACTER_ENCODING').'"?>'.NL;
 104      include_once($_SESSION['template']->get_template('confirmation_message'));
 105      exit;
 106    }
 107  }
 108    
 109  //get list of invited chatters
 110  $invited = $_SESSION['chatter']->get_db_invited();
 111  
 112  if( !isset($_POST['nick_constraint']) )
 113    $_POST['nick_constraint'] = $_SESSION['translator']->out('RESTRICT');
 114  elseif( $_POST['nick_constraint'] != $_SESSION['translator']->out('RESTRICT') 
 115  && $_POST['nick_constraint'] != '' )
 116  {
 117    $_SESSION['chat']->set_nick_restrict($_POST['nick_constraint']);
 118    $_SESSION['chat']->connect();
 119     //get option list of disinvited chatters
 120     $option_list_of_disinvited_chatters = $_SESSION['chat']->get_chatters_excepting( $invited, true );
 121    $_SESSION['chat']->disconnect();
 122    $_SESSION['chat']->set_nick_restrict('');
 123  }
 124  
 125  reset($invited);
 126  do{
 127    $invited_chatters_option_list .= TAB.'<option value="'.current($invited).'">'.preg_replace( "/\#{3}([^#]*)\#{3}/e", "htmlentities(\$_SESSION['translator']->out('\\1'))", current($invited) ).'</option>'.NL;
 128  }while(next($invited));
 129  
 130  $TEMPLATE_OUT['invited_chatters_option_list'] = $invited_chatters_option_list;
 131  $TEMPLATE_OUT['option_list_of_disinvited_chatters'] = $option_list_of_disinvited_chatters;
 132  
 133  $_SESSION['template']->get_template();
 134  ?>

title

Description

title

Description

title

Description

title

title

Body