mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
bot-safer contact form
This commit is contained in:
parent
84a9f87127
commit
0c586d9ff0
@ -7,7 +7,7 @@
|
|||||||
* @package addressbook
|
* @package addressbook
|
||||||
* @copyright (c) 2007 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @copyright (c) 2007 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.uietemplate.inc.php');
|
require_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.uietemplate.inc.php');
|
||||||
@ -37,7 +37,9 @@ class addressbook_contactform
|
|||||||
|
|
||||||
if (is_array($content))
|
if (is_array($content))
|
||||||
{
|
{
|
||||||
if (isset($content['captcha_result']) && $content['captcha'] != $content['captcha_result'])
|
if (isset($content['captcha_result']) && $content['captcha'] != $content['captcha_result'] || // no correct captcha OR
|
||||||
|
time() - $content['start_time'] < 10 && // bot indicator (less then 10 sec to fill out the form and
|
||||||
|
!$GLOBALS['egw_info']['etemplate']['java_script']) // javascript disabled)
|
||||||
{
|
{
|
||||||
$tpl->set_validation_error('captcha',lang('Wrong - try again ...'));
|
$tpl->set_validation_error('captcha',lang('Wrong - try again ...'));
|
||||||
}
|
}
|
||||||
@ -75,12 +77,12 @@ class addressbook_contactform
|
|||||||
}
|
}
|
||||||
if ($tracking->do_notifications($content,null))
|
if ($tracking->do_notifications($content,null))
|
||||||
{
|
{
|
||||||
return '<p align="center">'.$content['msg'].'</p>';
|
return '<p align="center">'.$content['msg'].'</p>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return '<p align="center">'.lang('There was an error saving your data :-(').'<br />'.
|
return '<p align="center">'.lang('There was an error saving your data :-(').'<br />'.
|
||||||
lang('Either the configured email addesses are wrong or the mail configuration.').'</p>';
|
lang('Either the configured email addesses are wrong or the mail configuration.').'</p>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,12 +123,13 @@ class addressbook_contactform
|
|||||||
$content['show'][$name] = true;
|
$content['show'][$name] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$preserv['start_time'] = time();
|
||||||
}
|
}
|
||||||
$content['addr_format'] = $GLOBALS['egw_info']['user']['preferences']['addressbook']['addr_format'];
|
$content['addr_format'] = $GLOBALS['egw_info']['user']['preferences']['addressbook']['addr_format'];
|
||||||
|
|
||||||
if ($addressbook) $preserv['owner'] = $addressbook;
|
if ($addressbook) $preserv['owner'] = $addressbook;
|
||||||
if ($msg) $preserv['msg'] = $msg;
|
if ($msg) $preserv['msg'] = $msg;
|
||||||
|
|
||||||
// a simple calculation captcha
|
// a simple calculation captcha
|
||||||
$num1 = rand(1,99);
|
$num1 = rand(1,99);
|
||||||
$num2 = rand(1,99);
|
$num2 = rand(1,99);
|
||||||
|
Loading…
Reference in New Issue
Block a user