2007-10-10 19:15:47 +04:00
|
|
|
<?php
|
|
|
|
/*
|
2013-03-07 01:22:53 +04:00
|
|
|
* Copyright 2005-2013 the original author or authors.
|
2013-03-05 03:24:26 +04:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2007-10-10 19:15:47 +04:00
|
|
|
*/
|
|
|
|
|
2012-09-13 17:35:25 +04:00
|
|
|
require_once('libs/init.php');
|
2008-06-05 01:36:54 +04:00
|
|
|
require_once('libs/chat.php');
|
2008-10-11 03:28:58 +04:00
|
|
|
require_once('libs/expand.php');
|
2012-03-13 21:26:18 +04:00
|
|
|
require_once('libs/groups.php');
|
2011-02-16 03:43:19 +03:00
|
|
|
require_once('libs/notify.php');
|
2012-09-28 18:46:42 +04:00
|
|
|
require_once('libs/classes/thread.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}$/");
|
|
|
|
|
2012-09-28 18:46:42 +04:00
|
|
|
$thread = Thread::load($threadid, $token);
|
|
|
|
if (! $thread) {
|
2007-10-10 19:15:47 +04:00
|
|
|
die("wrong thread");
|
|
|
|
}
|
|
|
|
|
2008-05-06 01:08:57 +04:00
|
|
|
$email = getparam('email');
|
|
|
|
$page['email'] = $email;
|
2012-09-28 18:46:42 +04:00
|
|
|
$group = is_null($thread->groupId)?NULL:group_by_id($thread->groupId);
|
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;
|
2013-02-18 17:06:16 +04:00
|
|
|
$page['chat.thread.id'] = $thread->id;
|
2013-02-18 17:14:05 +04:00
|
|
|
$page['chat.thread.token'] = $thread->lastToken;
|
2007-12-03 00:32:47 +03:00
|
|
|
$page['level'] = "";
|
2013-02-18 16:09:53 +04:00
|
|
|
$page = array_merge_recursive(
|
|
|
|
$page,
|
|
|
|
setup_logo($group)
|
|
|
|
);
|
2011-12-14 19:50:10 +04:00
|
|
|
expand("styles/dialogs", getchatstyle(), "mail.tpl");
|
2007-12-03 00:32:47 +03:00
|
|
|
exit;
|
|
|
|
}
|
2007-10-10 19:15:47 +04:00
|
|
|
|
|
|
|
$history = "";
|
2012-10-02 14:53:52 +04:00
|
|
|
$last_id = -1;
|
|
|
|
$messages = $thread->getMessages(true, $last_id);
|
|
|
|
foreach ($messages as $msg) {
|
|
|
|
$history .= message_to_text($msg);
|
2007-10-10 19:15:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
$subject = getstring("mail.user.history.subject");
|
2012-09-28 18:46:42 +04:00
|
|
|
$body = getstring2(
|
|
|
|
"mail.user.history.body",
|
|
|
|
array($thread->userName, $history, Settings::get('title'), Settings::get('hosturl'))
|
|
|
|
);
|
2007-10-10 19:15:47 +04:00
|
|
|
|
2012-07-13 16:56:50 +04:00
|
|
|
webim_mail($email, $webim_mailbox, $subject, $body);
|
2007-10-10 19:15:47 +04:00
|
|
|
|
2013-02-18 16:09:53 +04:00
|
|
|
$page = array_merge_recursive(
|
|
|
|
$page,
|
|
|
|
setup_logo($group)
|
|
|
|
);
|
2011-12-14 19:50:10 +04:00
|
|
|
expand("styles/dialogs", getchatstyle(), "mailsent.tpl");
|
2009-03-08 23:53:16 +03:00
|
|
|
exit;
|
2007-05-10 21:31:10 +04:00
|
|
|
?>
|