//-*- C -*- /* ******************************************************************** ** ** Copyright (C) 1995-2000 Michael Oertel ** ** Copyright (C) 2000- PHPOpenChat Development Team ** ** http://www.ortelius.de/phpopenchat/ ** ** ** ** This program is free software. You can redistribute it and/or modify ** ** it under the terms of the PHPOpenChat License Version 1.0 ** ** ** ** This program is distributed in the hope that it will be useful, ** ** but WITHOUT ANY WARRANTY, without even the implied warranty of ** ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ** ** ** ** You should have received a copy of the PHPOpenChat License ** ** along with this program. ** ** ******************************************************************** */ /** description of UNREAD variable in table chat_mail * if UNREAD is set to: * 0 = mail is unread, will be shown in output and is deleted by nobody * 1 = mail is unread, will be shown in output and is deleted by sender * 2 = mail is unread and deleted by nobody * 3 = mail is unread and deleted by sender * 4 = mail is read and deleted by nobody * 5 = mail is read and deleted by sender * 6 = mail is read and deleted by receipient */ /** * Include default values */ include "defaults_inc.php"; require_once('GoogleSuggestCloneJax.class.php'); include 'check_kick_inc.php'; //start session if($ENABLE_SESSION){ @session_start(); } $nick=urldecode($_SESSION['nick']); /** * Check for access permissions of this page * * compare the given and the calculated checksum, * if they don't match the user has no permissions * and the script ends by printing a status header of 204 * (no content change by client browser) */ if(!check_permissions($nick,$pruef) ){ //the user has no access permission for this page header("Status: 204 OK");//browser don't refresh his content exit; } /** * Open a database connection * * This include returns a database identifier '$db_handle' * used by some database querys. */ include ("connect_db_inc.php"); $db_handle=connect_db($DATABASEHOST,$DATABASEUSER,$DATABASEPASSWD); if(!$db_handle){ exit; } if($IS_KICKED = check_kick()){ //gekickte d�rfen keine chatmails schreiben und lesen echo 'not allowed'; exit; } if($_SESSION['darf_fluestern'] == 0){ echo 'diese Funktion ist gesperrt'; exit; } if(trim($nick) == '' || check_kick()){ exit ('ung�ltiger aufruf'); } $ajax = new GoogleSuggestCloneJax(); $ajax->handleRequest(); $q = isset($_GET['search']) ? $_GET['search'] : ''; $ret = array(); $chatmail_heading = $WRITE_MAIL; if($send && $chat){ if($mail_to){ $chat = substr($chat,0,10000); $chat = str_replace('>','>',$chat); $chat = str_replace('<','<',$chat); $chat = strip_tags($chat); $chat = str_replace("'","'",$chat); $chat = mysql_real_escape_string($chat, $db_handle); if($subject==''){ $subject = $NOSUBJECT; }else{ $subject = strip_tags($subject); $subject = str_replace("'","'",$subject); $subject = mysql_real_escape_string($subject, $db_handle); } $update = mysql_query("INSERT INTO chat_mail (NICK,SENDER,BODY,TIME,SUBJECT,UNREAD)VALUES('".mysql_real_escape_string($mail_to, $db_handle)."','".$_SESSION['nick']."','$chat',CURRENT_TIMESTAMP(),'$subject','0')",$db_handle); $select_msg_to = '
| '.$CHOOSE_NICK.': | |||||||||||||||||||||||
';
$show_content = TRUE;
}else{
$select_msg_to = '
'; $select_msg_to .= ''; } elseif(!$ID){ $show_subjects = ' '.$MSG_SEND_TO.' '; $show_subjects .= ' '; } if($what=='answer'){ $query= " select TIME, SENDER, SUBJECT, BODY from chat_mail where NICK='".$_SESSION['nick']."' && ID=".(int)$ID; $result= mysql_query($query,$db_handle); $row=mysql_fetch_array($result); $showtime = substr($row['TIME'],8,2)."."; $showtime .= substr($row['TIME'],5,2)."."; $showtime .= substr($row['TIME'],0,4)." - "; $showtime .= substr($row['TIME'],11,5); $select_msg_to = '
'; @mysql_free_result($result); } if($what=='forward'){ $show_subjects = ' '.$MSG_SEND_TO.' '; $show_subjects .= ''; $show_subjects .= ' '; } if($show_content){ if($insert_forward && $ID){ $result = mysql_query("select TIME, SENDER, SUBJECT, BODY from chat_mail where ID=".(int)$ID,$db_handle); $row=mysql_fetch_array($result); $showtime = substr($row['TIME'],8,2)."."; $showtime .= substr($row['TIME'],5,2)."."; $showtime .= substr($row['TIME'],0,4)." - "; $showtime .= substr($row['TIME'],11,5); if(substr($row['SUBJECT'],0,3) != "FW:"){ $subject = 'FW: '.$row['SUBJECT']; }else{ $subject = $row['SUBJECT']; } $row['BODY']="> ".$row['BODY']; $row['BODY'] = str_replace(nl,nl.'> ',$row['BODY']); // now put $text_content together $text_content = '('.$showtime.') '.$row['SENDER'].' '.$WROTE.':'.nl.$row['BODY'].nl; $content = '
|