2013-08-28 22:47:04 +02:00
|
|
|
<?php
|
2014-02-15 12:57:05 +01:00
|
|
|
|
2013-08-28 22:47:04 +02:00
|
|
|
/**
|
|
|
|
* File: page_contact.php.
|
|
|
|
* Author: Ulrich Block
|
|
|
|
* Date: 28.10.12
|
|
|
|
* Time: 18:07
|
|
|
|
* Contact: <ulrich.block@easy-wi.com>
|
|
|
|
*
|
|
|
|
* This file is part of Easy-WI.
|
|
|
|
*
|
|
|
|
* Easy-WI is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Easy-WI 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. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Easy-WI. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Diese Datei ist Teil von Easy-WI.
|
|
|
|
*
|
|
|
|
* Easy-WI ist Freie Software: Sie koennen es unter den Bedingungen
|
|
|
|
* der GNU General Public License, wie von der Free Software Foundation,
|
|
|
|
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder spaeteren
|
|
|
|
* veroeffentlichten Version, weiterverbreiten und/oder modifizieren.
|
|
|
|
*
|
|
|
|
* Easy-WI wird in der Hoffnung, dass es nuetzlich sein wird, aber
|
|
|
|
* OHNE JEDE GEWAEHELEISTUNG, bereitgestellt; sogar ohne die implizite
|
|
|
|
* Gewaehrleistung der MARKTFAEHIGKEIT oder EIGNUNG FUER EINEN BESTIMMTEN ZWECK.
|
|
|
|
* Siehe die GNU General Public License fuer weitere Details.
|
|
|
|
*
|
|
|
|
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
|
|
|
|
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2013-10-13 11:42:31 +02:00
|
|
|
$name = $ui->names('name',255, 'post');
|
|
|
|
$email = $ui->ismail('email', 'post');
|
2014-02-15 12:57:05 +01:00
|
|
|
$comments = nl2br(htmlentities(trim($ui->escaped('comments', 'post')), ENT_QUOTES, 'UTF-8'));
|
|
|
|
|
2013-10-13 11:42:31 +02:00
|
|
|
if ($ui->escaped('email', 'post')) {
|
2014-02-15 12:57:05 +01:00
|
|
|
|
2013-09-29 15:29:58 +02:00
|
|
|
$error = array();
|
2014-02-15 12:57:05 +01:00
|
|
|
|
|
|
|
if (!$ui->ismail('email', 'post')) {
|
|
|
|
$error[] = 'Mail';
|
|
|
|
}
|
|
|
|
|
2013-10-13 11:42:31 +02:00
|
|
|
if (!$ui->names('name',255, 'post')) $error[] = 'Name';
|
2014-02-15 12:57:05 +01:00
|
|
|
|
|
|
|
if (!isset($_SESSION['token'])) {
|
|
|
|
$error[] = 'No Token';
|
|
|
|
} else if ($_SESSION['token'] != $ui->escaped('token', 'post')) {
|
|
|
|
$error[] = 'Spamprotect';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_SESSION['token'])) {
|
|
|
|
unset($_SESSION['token']);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (count($error) > 0) {
|
|
|
|
|
|
|
|
$token = md5(passwordgenerate(32));
|
2013-10-05 13:39:56 +02:00
|
|
|
$_SESSION['token'] = $token;
|
2014-02-15 12:57:05 +01:00
|
|
|
$comments = str_replace('<br />', '', $comments);
|
|
|
|
|
2013-08-28 22:47:04 +02:00
|
|
|
} else {
|
2014-02-15 12:57:05 +01:00
|
|
|
|
|
|
|
$comments = $name . ' (' . $email . '):<br />' . $comments;
|
|
|
|
|
2015-05-31 13:10:33 +02:00
|
|
|
$query = $sql->prepare("SELECT `email_setting_value` FROM `settings_email` WHERE `reseller_id`=? AND `email_setting_name`='email' LIMIT 1");
|
|
|
|
$query->execute(array($reseller_id));
|
|
|
|
|
|
|
|
if (sendmail('contact', $name, $comments, $query->fetchColumn())) {
|
|
|
|
unset($error);
|
|
|
|
$success = true;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$error[] = 'Sending the mail failed';
|
|
|
|
|
|
|
|
$token = md5(passwordgenerate(32));
|
|
|
|
$_SESSION['token'] = $token;
|
|
|
|
}
|
2013-08-28 22:47:04 +02:00
|
|
|
}
|
2014-02-15 12:57:05 +01:00
|
|
|
|
2013-08-28 22:47:04 +02:00
|
|
|
} else {
|
2014-02-15 12:57:05 +01:00
|
|
|
$token = md5(passwordgenerate(32));
|
2013-10-05 13:39:56 +02:00
|
|
|
$_SESSION['token'] = $token;
|
2013-08-28 22:47:04 +02:00
|
|
|
}
|
2014-02-15 12:57:05 +01:00
|
|
|
|
|
|
|
$page_data->title = $page_sprache->contact;
|
2013-08-28 22:47:04 +02:00
|
|
|
$page_data->setCanonicalUrl($s);
|
2013-09-07 11:31:00 +02:00
|
|
|
|
|
|
|
// https://github.com/easy-wi/developer/issues/62
|
2013-09-29 15:29:58 +02:00
|
|
|
$langLinks = array();
|
2013-09-07 11:31:00 +02:00
|
|
|
foreach ($languages as $l) {
|
2014-02-15 12:57:05 +01:00
|
|
|
$tempLanguage = getlanguagefile('page', $l, 0);
|
|
|
|
$langLinks[$l]=($page_data->seo == 'Y') ? szrp($tempLanguage->$s) : '?s=' . $s;
|
2013-09-07 11:31:00 +02:00
|
|
|
}
|
2014-02-15 12:57:05 +01:00
|
|
|
|
2013-09-07 11:31:00 +02:00
|
|
|
$page_data->langLinks($langLinks);
|
|
|
|
|
2013-09-29 15:29:58 +02:00
|
|
|
$template_file = 'contact.tpl';
|