2007-12-03 00:32:47 +03:00
|
|
|
<?php
|
|
|
|
/*
|
2009-06-04 02:44:32 +04:00
|
|
|
* This file is part of Mibew Messenger project.
|
2007-12-03 00:32:47 +03:00
|
|
|
*
|
2009-06-04 02:44:32 +04:00
|
|
|
* Copyright (c) 2005-2009 Mibew Messenger Community
|
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
|
|
|
|
*
|
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-12-03 00:32:47 +03: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 01:40:57 +04:00
|
|
|
require_once('libs/expand.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');
|
2009-02-08 03:28:33 +03:00
|
|
|
$info = getparam('info');
|
2007-12-03 00:32:47 +03: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( !$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");
|
|
|
|
}
|
|
|
|
}
|
2009-07-18 17:54:45 +04:00
|
|
|
|
|
|
|
loadsettings();
|
|
|
|
if($settings["enablecaptcha"] == "1") {
|
|
|
|
$captcha = getparam('captcha');
|
|
|
|
$original = $_SESSION['captcha'];
|
|
|
|
if(empty($original) || empty($captcha) || $captcha != $original) {
|
|
|
|
$errors[] = getlocal('errors.captcha');
|
|
|
|
}
|
|
|
|
unset($_SESSION['captcha']);
|
2009-07-02 18:59:52 +04:00
|
|
|
}
|
2007-12-03 00:32:47 +03:00
|
|
|
|
|
|
|
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);
|
2009-07-18 17:54:45 +04:00
|
|
|
$page['showcaptcha'] = $settings["enablecaptcha"] == "1" ? "1" : "";
|
2009-03-08 23:53:16 +03:00
|
|
|
$page['info'] = topage($info);
|
2008-11-08 02:24:45 +03:00
|
|
|
setup_logo();
|
2008-10-15 00:21:25 +04:00
|
|
|
expand("styles", getchatstyle(), "leavemessage.tpl");
|
2007-12-03 00:32:47 +03:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2009-03-08 23:53:16 +03:00
|
|
|
$message_locale = $settings['left_messages_locale'];
|
|
|
|
if(!locale_exists($message_locale)) {
|
|
|
|
$message_locale = $home_locale;
|
|
|
|
}
|
|
|
|
|
|
|
|
$subject = getstring2_("leavemail.subject", array($visitor_name), $message_locale);
|
|
|
|
$body = getstring2_("leavemail.body", array($visitor_name,$email,$message,$info ? "$info\n" : ""), $message_locale);
|
|
|
|
|
2008-09-30 03:10:03 +04:00
|
|
|
$inbox_mail = $settings['email'];
|
2007-12-03 00:32:47 +03:00
|
|
|
|
2008-09-30 03:10:03 +04:00
|
|
|
if($inbox_mail) {
|
|
|
|
webim_mail($inbox_mail, $email, $subject, $body);
|
|
|
|
}
|
2007-12-03 00:32:47 +03:00
|
|
|
|
2008-11-08 02:24:45 +03:00
|
|
|
setup_logo();
|
2008-10-15 00:21:25 +04:00
|
|
|
expand("styles", getchatstyle(), "leavemessagesent.tpl");
|
2007-12-03 00:32:47 +03:00
|
|
|
?>
|