2007-10-10 19:15:47 +04:00
|
|
|
<?php
|
|
|
|
/*
|
2009-06-04 02:44:32 +04:00
|
|
|
* This file is part of Mibew Messenger project.
|
2007-10-10 19:15:47 +04:00
|
|
|
*
|
2009-06-04 02:44:32 +04:00
|
|
|
* Copyright (c) 2005-2009 Mibew Messenger Community
|
2009-08-04 19:03:27 +04:00
|
|
|
* All rights reserved. The contents of this file are subject to the terms of
|
|
|
|
* the Eclipse Public License v1.0 which accompanies this distribution, and
|
|
|
|
* is available at http://www.eclipse.org/legal/epl-v10.html
|
2007-10-10 19:15:47 +04:00
|
|
|
*
|
2009-08-04 17:38:37 +04:00
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* the GNU General Public License Version 2 or later (the "GPL"), in which case
|
|
|
|
* the provisions of the GPL are applicable instead of those above. If you wish
|
|
|
|
* to allow use of your version of this file only under the terms of the GPL, and
|
|
|
|
* not to allow others to use your version of this file under the terms of the
|
|
|
|
* EPL, indicate your decision by deleting the provisions above and replace them
|
|
|
|
* with the notice and other provisions required by the GPL.
|
|
|
|
*
|
2007-10-10 19:15:47 +04:00
|
|
|
* Contributors:
|
|
|
|
* Evgeny Gryaznov - initial API and implementation
|
|
|
|
*/
|
|
|
|
|
2008-06-05 01:36:54 +04:00
|
|
|
require_once('libs/common.php');
|
|
|
|
require_once('libs/chat.php');
|
2008-10-11 03:28:58 +04:00
|
|
|
require_once('libs/expand.php');
|
2007-10-10 19:15:47 +04:00
|
|
|
|
2007-12-03 00:32:47 +03:00
|
|
|
$errors = array();
|
|
|
|
$page = array();
|
|
|
|
|
2007-10-10 19:15:47 +04:00
|
|
|
$token = verifyparam( "token", "/^\d{1,8}$/");
|
|
|
|
$threadid = verifyparam( "thread", "/^\d{1,8}$/");
|
|
|
|
|
|
|
|
$thread = thread_by_id($threadid);
|
|
|
|
if( !$thread || !isset($thread['ltoken']) || $token != $thread['ltoken'] ) {
|
|
|
|
die("wrong thread");
|
|
|
|
}
|
|
|
|
|
2008-05-06 01:08:57 +04:00
|
|
|
$email = getparam('email');
|
|
|
|
$page['email'] = $email;
|
2007-10-10 19:15:47 +04:00
|
|
|
|
2008-05-06 01:08:57 +04:00
|
|
|
if( !$email ) {
|
2007-12-03 00:32:47 +03:00
|
|
|
$errors[] = no_field("form.field.email");
|
2008-05-06 01:08:57 +04:00
|
|
|
} else if( !is_valid_email($email)) {
|
2007-12-03 00:32:47 +03:00
|
|
|
$errors[] = wrong_field("form.field.email");
|
|
|
|
}
|
|
|
|
|
|
|
|
if( count($errors) > 0 ) {
|
2008-05-06 01:08:57 +04:00
|
|
|
$page['formemail'] = $email;
|
2007-12-03 00:32:47 +03:00
|
|
|
$page['ct.chatThreadId'] = $thread['threadid'];
|
|
|
|
$page['ct.token'] = $thread['ltoken'];
|
|
|
|
$page['level'] = "";
|
2008-11-08 02:24:45 +03:00
|
|
|
setup_logo();
|
2008-10-15 00:21:25 +04:00
|
|
|
expand("styles", getchatstyle(), "mail.tpl");
|
2007-12-03 00:32:47 +03:00
|
|
|
exit;
|
|
|
|
}
|
2007-10-10 19:15:47 +04:00
|
|
|
|
|
|
|
$history = "";
|
|
|
|
$lastid = -1;
|
|
|
|
$output = get_messages( $threadid,"text",true,$lastid );
|
|
|
|
foreach( $output as $msg ) {
|
|
|
|
$history .= $msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
$subject = getstring("mail.user.history.subject");
|
2008-09-29 20:47:06 +04:00
|
|
|
$body = getstring2("mail.user.history.body", array($thread['userName'],$history) );
|
2007-10-10 19:15:47 +04:00
|
|
|
|
2009-03-08 23:53:16 +03:00
|
|
|
webim_mail($email, $webim_mailbox, $subject, $body);
|
2007-10-10 19:15:47 +04:00
|
|
|
|
2008-11-08 02:24:45 +03:00
|
|
|
setup_logo();
|
2008-10-15 00:21:25 +04:00
|
|
|
expand("styles", getchatstyle(), "mailsent.tpl");
|
2009-03-08 23:53:16 +03:00
|
|
|
exit;
|
2007-05-10 21:31:10 +04:00
|
|
|
?>
|