2007-12-03 00:32:47 +03:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* This file is part of Web Instant Messenger project.
|
|
|
|
*
|
2008-05-06 01:08:57 +04:00
|
|
|
* Copyright (c) 2005-2008 Internet Services Ltd.
|
2007-12-03 00:32:47 +03:00
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under 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
|
|
|
|
*
|
|
|
|
* 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');
|
2007-12-03 00:32:47 +03:00
|
|
|
|
|
|
|
$errors = array();
|
|
|
|
$page = array();
|
|
|
|
|
2008-05-06 01:08:57 +04:00
|
|
|
$email = getparam('email');
|
|
|
|
$visitor_name = getparam('name');
|
2007-12-03 00:32:47 +03:00
|
|
|
$message = getparam('message');
|
|
|
|
|
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( !$visitor_name ) {
|
2007-12-03 00:32:47 +03:00
|
|
|
$errors[] = no_field("form.field.name");
|
|
|
|
} else if( !$message ) {
|
|
|
|
$errors[] = no_field("form.field.message");
|
|
|
|
} else {
|
2008-05-06 01:08:57 +04:00
|
|
|
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 15:14:48 +04:00
|
|
|
$page['formname'] = topage($visitor_name);
|
2008-05-06 01:08:57 +04:00
|
|
|
$page['formemail'] = $email;
|
2008-05-06 15:14:48 +04:00
|
|
|
$page['formmessage'] = topage($message);
|
2007-12-03 00:32:47 +03:00
|
|
|
start_html_output();
|
|
|
|
require('view/chat_leavemsg.php');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2008-05-06 15:14:48 +04:00
|
|
|
// FIXME mail encoding
|
|
|
|
|
2008-05-06 01:08:57 +04:00
|
|
|
$subject = getstring2_("leavemail.subject", array($visitor_name), $webim_messages_encoding);
|
|
|
|
$body = getstring2_("leavemail.body", array($visitor_name,$email,$message), $webim_messages_encoding);
|
2007-12-03 00:32:47 +03:00
|
|
|
|
|
|
|
$headers = 'From: '.$webim_from_email."\r\n" .
|
2008-05-06 01:08:57 +04:00
|
|
|
'Reply-To: '.$email."\r\n" .
|
2007-12-03 00:32:47 +03:00
|
|
|
'X-Mailer: PHP/'.phpversion();
|
|
|
|
|
|
|
|
mail($webim_messages_mail,$subject,wordwrap($body,70),$headers);
|
|
|
|
|
|
|
|
|
|
|
|
start_html_output();
|
|
|
|
require('view/chat_leavemsgsent.php');
|
|
|
|
?>
|