[Piwik-svn] r538 - trunk/plugins/Feedback
svnmaster at piwik.org
svnmaster at piwik.org
Mon Jun 30 00:02:20 CEST 2008
Author: matt
Date: 2008-06-30 00:02:17 +0200 (Mon, 30 Jun 2008)
New Revision: 538
Modified:
trunk/plugins/Feedback/Controller.php
Log:
- feedback form updates (error when empty message or wrong email, limiting spam)
Modified: trunk/plugins/Feedback/Controller.php
===================================================================
--- trunk/plugins/Feedback/Controller.php 2008-06-28 09:04:59 UTC (rev 537)
+++ trunk/plugins/Feedback/Controller.php 2008-06-29 22:02:17 UTC (rev 538)
@@ -28,18 +28,26 @@
function sendFeedback()
{
// TODO: require user login or captcha if anonymous
-
$body = Piwik_Common::getRequestVar('body', '', 'string');
$email = Piwik_Common::getRequestVar('email', '', 'string');
$view = new Piwik_View('Feedback/sent.tpl');
-
try
{
+ $minimumBodyLength = 10;
+ if(strlen($body) < $minimumBodyLength)
+ {
+ throw new Exception(sprintf("Message must be at least %s characters long.", $minimumBodyLength));
+ }
+ if(!Piwik::isValidEmailString($email))
+ {
+ throw new Exception(Piwik_Translate('UsersManager_ExceptionInvalidEmail'));
+ }
+
$mail = new Piwik_Mail();
$mail->setFrom($email);
$mail->addTo('hello at piwik.org','Piwik Team');
- $mail->setSubject('[ Feedback form ]');
+ $mail->setSubject('[ Feedback form - Piwik ]');
$mail->setBodyText($body);
@$mail->send();
}
More information about the Piwik-svn
mailing list