PHPOpenChat PHP Cross Reference Customer Relationship Management

Source: /friends.php - 93 lines - 4480 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/12 13:39:10 $
  33    $Source: /cvsroot/phpopenchat/chat3/friends.php,v $
  34    $Revision: 1.18.2.3 $
  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  
  54  if( isset($_GET['silent']) )
  55  {
  56    /*call from right click menu*/
  57    $_SESSION['chat']->connect();
  58     if($_SESSION['chat']->is_online($_GET['new_friend']))
  59       $_SESSION['chatter']->add_friend( $_GET['new_friend'] );
  60    $_SESSION['chat']->disconnect();
  61    print '
  62    <html>
  63      <body onload="alert(\''.$_SESSION['translator']->out('CONFIRM_FRIEND').'\')"></body>
  64    </html>
  65    ';
  66    exit;
  67  }
  68  if( $_SESSION['chatter']->is_guest() )
  69    die($_SESSION['translator']->out('DENIED_FOR_GUESTS'));
  70  
  71  $TEMPLATE_OUT['option_list_of_no_friends'] = '<option />';
  72  if( isset($_POST['add']) && isset($_POST['all_chatters']) )
  73    $_SESSION['chatter']->add_friend( $_POST['all_chatters'] );
  74    
  75  if( (isset($_POST['del_x'])&&$_POST['del_x']>0) && isset($_POST['friends']) )
  76    $_SESSION['chatter']->del_friend( $_POST['friends'] );
  77  
  78  if( !isset($_POST['nick_constraint']) )
  79    $_POST['nick_constraint'] = $_SESSION['translator']->out('RESTRICT');
  80  elseif( $_POST['nick_constraint'] != $_SESSION['translator']->out('RESTRICT') 
  81  && $_POST['nick_constraint'] != '' )
  82  {
  83    $_SESSION['chat']->set_nick_restrict($_POST['nick_constraint']);
  84    $_SESSION['chat']->connect();
  85    $TEMPLATE_OUT['option_list_of_no_friends'] = $_SESSION['chat']->get_chatters_excepting( $_SESSION['chatter']->get_friends(), 'as_option_list' );
  86    $_SESSION['chat']->disconnect();
  87    $_SESSION['chat']->set_nick_restrict('');
  88  }
  89  
  90  $TEMPLATE_OUT['option_list_of_friends'] = $_SESSION['chatter']->get_friends_as_option_list();
  91  header('Content-type: text/html; charset='.$_SESSION['translator']->out('CHARACTER_ENCODING'));
  92  $_SESSION['template']->get_template();
  93  ?>

title

Description

title

Description

title

Description

title

title

Body