function perform(&$request, &$response)
 {
     $chat_room_data =& fetch_requested_object();
     session::destroy('last_message_ids');
     setcookie('chat_room_id', $chat_room_data['object_id'], time() + 365 * 24 * 3600);
     if ($chat_user_data = chat_user::get_chat_user_data()) {
         if ($chat_user_data['chat_room_id'] != $chat_room_data['object_id']) {
             chat_system::leave_chat_room($chat_user_data['id'], $chat_user_data['nickname'], $chat_user_data['chat_room_id']);
             chat_system::enter_chat_room($chat_user_data['id'], $chat_user_data['nickname'], $chat_room_data['object_id']);
         }
         $this->view->set('nickname', $chat_user_data['nickname']);
     }
     parent::perform(&$request, &$response);
 }
Exemplo n.º 2
0
*
* Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
***********************************************************************************
*
* $Id$
*
***********************************************************************************/

require_once(LIMB_DIR . 'core/lib/session/session.class.php');
require_once(LIMB_DIR . 'core/model/chat/chat_system.class.php');

start_user_session();

if(!$_REQUEST['id'])
	exit();

$file = chat_system :: get_chat_file($_REQUEST['id']);

if (!$file)
{
	header("HTTP/1.1 404 Not found");
}
else
{
	header("Pragma: public");
	header("Cache-Control: private");
	header("Date: " . date("D, d M Y H:i:s") . " GMT");
	header("Content-type: {$file['mime_type']}");
	echo $file['file_data'];
}
?>
Exemplo n.º 3
0
* Copyright 2004 BIT, Ltd. http://www.0x00.ru, mailto: bit@0x00.ru
*
* Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
***********************************************************************************
*
* $Id$
*
***********************************************************************************/
require_once LIMB_DIR . 'core/lib/session/session.class.php';
require_once LIMB_DIR . 'core/model/chat/chat_system.class.php';
require_once LIMB_DIR . 'core/model/chat/chat_user.class.php';
start_user_session();
$chat_user_data = chat_user::get_chat_user_data();
if ($_REQUEST['ignorant_id'] && $chat_user_data) {
    chat_system::toggle_ignore_user($chat_user_data['id'], $chat_user_data['nickname'], $_REQUEST['ignorant_id'], $chat_user_data['chat_room_id']);
}
//$_COOKIE['chat_room_id']
$chat_room_id = $chat_user_data['chat_room_id'];
$chat_users = chat_system::get_users_for_room($chat_room_id, $chat_user_data['id']);
if (sizeof($chat_users)) {
    $users = '';
    foreach ($chat_users as $chat_user) {
        $users[] = "['{$chat_user['id']}','{$chat_user['nickname']}','{$chat_user['status']}', '{$chat_user['ignored']}']";
    }
    $users = '[' . implode(',', $users) . ']';
    $header = sprintf(strings::get('users_header', 'chat'), count($chat_users));
    echo "<script>\n";
    echo "top.set_active_users({$users});\n";
    echo "top.update_active_users_header('{$header}');\n";
    echo "</script>\n";
}
 function toggle_ignore_user($ignorer_id, $ignorer_nickname, $ignorant_id, $chat_room_id)
 {
     $db =& db_factory::instance();
     $sql = "SELECT count(*) as count\r\n\t\t\t\t\t\tFROM chat_ignores \r\n\t\t\t\t\t\tWHERE chat_user_id='{$ignorer_id}' AND ignorant_id='{$ignorant_id}'";
     $db->sql_exec($sql);
     $row = $db->fetch_row();
     if ($row['count']) {
         $sql = "DELETE FROM chat_ignores\r\n\t\t\t\t\t\t\tWHERE chat_user_id='{$ignorer_id}' AND ignorant_id='{$ignorant_id}'";
         $message = "system_message:" . sprintf(strings::get('user_enters_chat_room', 'chat'), $ignorer_nickname);
     } else {
         $sql = "INSERT INTO chat_ignores \r\n\t\t\t\t\t\t\t(chat_user_id, ignorant_id)\r\n\t\t\t\t\t\t\tVALUES\r\n\t\t\t\t\t\t\t('{$ignorer_id}', '{$ignorant_id}')";
         $message = "system_message:" . sprintf(strings::get('user_leaves_chat_room', 'chat'), $ignorer_nickname);
     }
     $db->sql_exec($sql);
     chat_system::system_message($message, $chat_room_id, $ignorant_id);
 }
Exemplo n.º 5
0
 function logout()
 {
     if (!($chat_user_data = chat_user::get_chat_user_data())) {
         return true;
     }
     chat_system::leave_chat_room($chat_user_data['id'], $chat_user_data['nickname'], $chat_user_data['chat_room_id']);
     chat_user::_session_destroy();
     return true;
 }
Exemplo n.º 6
0
require_once LIMB_DIR . 'core/lib/i18n/strings.class.php';
require_once LIMB_DIR . 'core/lib/i18n/locale.class.php';
require_once LIMB_DIR . 'core/lib/date/date.class.php';
require_once LIMB_DIR . 'core/lib/util/mime_type.class.php';
require_once LIMB_DIR . 'core/model/chat/chat_user.class.php';
require_once LIMB_DIR . 'core/model/chat/chat_system.class.php';
require_once LIMB_DIR . 'core/model/chat/smiles.class.php';
start_user_session();
$smiles =& new smiles();
$chat_user_data = chat_user::get_chat_user_data();
chat_system::update_user_time($chat_user_data['id']);
$last_message_ids = session::get("last_message_ids");
if (!($last_message_id = $last_message_ids[$chat_user_data['chat_room_id']])) {
    $last_message_id = 0;
}
$messages = chat_system::get_messages_for_user($chat_user_data['id'], $chat_user_data['chat_room_id'], $last_message_id);
$date =& new date();
$locale =& locale::instance($this->locale_type);
$format_string = $locale->get_short_date_time_format();
echo "<html>\r\n\t\t\t<script>";
foreach ($messages as $message) {
    $message_text = $smiles->decode_smiles($message['message']);
    $message_text = str_replace("\r", "", $message_text);
    $message_text = str_replace("\n", "<br>", $message_text);
    $message_color = $message['color'];
    $sender_name = $message['nickname'];
    $date->set_by_stamp($message['time']);
    $message_date = $date->format($format_string);
    switch (true) {
        case $message['sender_id'] == -1:
            list($message_type, $string) = explode(':', $message['message'], 2);
Exemplo n.º 7
0
*
* Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
***********************************************************************************
*
* $Id$
*
***********************************************************************************/

require_once(LIMB_DIR . '/core/lib/session/session.class.php');
require_once(LIMB_DIR . '/core/model/chat/chat_user.class.php');
require_once(LIMB_DIR . '/core/model/chat/chat_system.class.php');

start_user_session();

if(!isset($_POST['recipient_id']) || !isset($_POST['message']))
	exit;

if(!$chat_user_data = chat_user :: get_chat_user_data())
	exit();

$file = ($_FILES['file']) ? ($_FILES['file']) : null;

chat_system :: send_message($_POST['message'], 
														$chat_user_data['chat_room_id'],
														$chat_user_data['id'],
														$_POST['recipient_id'], 
														$file);
?>
<script>
	top.send_message_finished();
</script>
Exemplo n.º 8
0
<?php	
/**********************************************************************************
* Copyright 2004 BIT, Ltd. http://www.0x00.ru, mailto: bit@0x00.ru
*
* Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
***********************************************************************************
*
* $Id$
*
***********************************************************************************/

require_once(LIMB_DIR . '/core/lib/session/session.class.php');
require_once(LIMB_DIR . '/core/model/chat/chat_user.class.php');
require_once(LIMB_DIR . '/core/model/chat/chat_system.class.php');

start_user_session();

$chat_user_data = chat_user :: get_chat_user_data();
chat_system :: leave_chat_room(
	$chat_user_data['id'],
	$chat_user_data['nickname'],
	$chat_user_data['chat_room_id']
);
?>
Exemplo n.º 9
0
 function leave_chat_room()
 {
     $chat_user_data = chat_user::get_chat_user_data();
     chat_system::leave_chat_room($chat_user_data['id'], $chat_user_data['nickname'], $chat_user_data['chat_room_id']);
     $chat_user_data['chat_room_id'] = 0;
     chat_user::_set_session_chat_user_data($chat_user_data);
 }