Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Feedback/Controller.php')
-rw-r--r--plugins/Feedback/Controller.php38
1 files changed, 14 insertions, 24 deletions
diff --git a/plugins/Feedback/Controller.php b/plugins/Feedback/Controller.php
index a626e71989..7060f72816 100644
--- a/plugins/Feedback/Controller.php
+++ b/plugins/Feedback/Controller.php
@@ -1,11 +1,11 @@
<?php
/**
* Piwik - Open source web analytics
- *
+ *
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
* @version $Id$
- *
+ *
* @category Piwik_Plugins
* @package Piwik_Feedback
*/
@@ -15,11 +15,10 @@
* @package Piwik_Feedback
*/
class Piwik_Feedback_Controller extends Piwik_Controller
-{
+{
function index()
- {
+ {
$view = Piwik_View::factory('index');
- $view->nonce = Piwik_Nonce::getNonce('Piwik_Feedback.sendFeedback', 3600);
echo $view->render();
}
@@ -28,18 +27,16 @@ class Piwik_Feedback_Controller extends Piwik_Controller
*/
function sendFeedback()
{
- $email = Piwik_Common::getRequestVar('email', '', 'string');
$body = Piwik_Common::getRequestVar('body', '', 'string');
- $category = Piwik_Common::getRequestVar('category', '', 'string');
- $nonce = Piwik_Common::getRequestVar('nonce', '', 'string');
+ $email = Piwik_Common::getRequestVar('email', '', 'string');
$view = Piwik_View::factory('sent');
- try
+ try
{
$minimumBodyLength = 35;
if(strlen($body) < $minimumBodyLength)
{
- throw new Exception(Piwik_TranslateException('Feedback_ExceptionBodyLength', array($minimumBodyLength)));
+ throw new Exception(sprintf("Message must be at least %s characters long.", $minimumBodyLength));
}
if(!Piwik::isValidEmailString($email))
{
@@ -47,21 +44,14 @@ class Piwik_Feedback_Controller extends Piwik_Controller
}
if(strpos($body, 'http://') !== false)
{
- throw new Exception(Piwik_TranslateException('Feedback_ExceptionNoUrls'));
+ throw new Exception("The message cannot contain a URL, to avoid spams messages.");
}
- if(!Piwik_Nonce::verifyNonce('Piwik_Feedback.sendFeedback', $nonce))
- {
- throw new Exception(Piwik_TranslateException('General_ExceptionNonceMismatch'));
- }
-
+
$mail = new Piwik_Mail();
- $mail->setFrom(Piwik_Common::unsanitizeInputValue($email));
- $mail->addTo('hello@piwik.org', 'Piwik Team');
- $mail->setSubject('[ Feedback form - Piwik ] ' . $category);
- $mail->setBodyText(Piwik_Common::unsanitizeInputValue($body) . "\n"
- . 'Piwik ' . Piwik_Version::VERSION . "\n"
- . 'IP: ' . Piwik_Common::getIpString() . "\n"
- . 'URL: ' . Piwik_Url::getReferer() . "\n");
+ $mail->setFrom($email);
+ $mail->addTo('hello@piwik.org','Piwik Team');
+ $mail->setSubject('[ Feedback form - Piwik ]');
+ $mail->setBodyText($body);
@$mail->send();
}
catch(Exception $e)
@@ -69,7 +59,7 @@ class Piwik_Feedback_Controller extends Piwik_Controller
$view->ErrorString = $e->getMessage();
$view->message = $body;
}
-
+
echo $view->render();
}
}