'smarty' => '2.6.7',
'php' => '4.1.0'
));
- $propbag->add('version', '1.31');
+ $propbag->add('version', '1.32');
$propbag->add('event_hooks', array(
'frontend_saveComment' => true,
'external_plugin' => true,
break;
case 'captchas':
- $propbag->add('type', 'boolean');
+ $propbag->add('type', 'radio');
$propbag->add('name', PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS);
$propbag->add('description', PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS_DESC);
- $propbag->add('default', true);
+ $propbag->add('default', 'yes');
+ $propbag->add('radio', array(
+ 'value' => array(true, 'no', 'scramble'),
+ 'desc' => array(YES, NO, PLUGIN_EVENT_SPAMBLOCK_CAPTCHAS_SCRAMBLE)
+ ));
break;
case 'killswitch':
if (isset($hooks[$event])) {
$captchas_ttl = $this->get_config('captchas_ttl', 7);
- $captchas = (serendipity_db_bool($this->get_config('captchas', true)) ? true : false);
+ $_captchas = $this->get_config('captchas', 'yes');
+ $captchas = ($_captchas !== 'no' && ($_captchas === 'yes' || $_captchas === 'scramble' || serendipity_db_bool($_captchas)));
+
// Check if the entry is older than the allowed amount of time. Enforce kaptchas if that is true
// of if kaptchas are activated for every entry
$show_captcha = ($captchas && isset($eventData['timestamp']) && ($captchas_ttl < 1 || ($eventData['timestamp'] < (time() - ($captchas_ttl*60*60*24)))) ? true : false);
header('Content-Type: image/jpeg');
$image = imagecreate($width, $height);
- imagecolorallocate($image, trim($bgcolors[0]), trim($bgcolors[1]), trim($bgcolors[2]));
+ $bgcol = imagecolorallocate($image, trim($bgcolors[0]), trim($bgcolors[1]), trim($bgcolors[2]));
// imagettftext($image, 10, 1, 1, 15, imagecolorallocate($image, 255, 255, 255), $font, 'String: ' . $string);
$pos_x = 5;
$pos_x = $pos_x + $size + 2;
}
+
+ if ($_captchas === 'scramble') {
+ $line_diff = mt_rand(5, 15);
+ $pixel_col = imagecolorallocate($image, trim($bgcolors[0])-mt_rand(10,50), trim($bgcolors[1])-mt_rand(10,50), trim($bgcolors[2])-mt_rand(10,50));
+ for ($y = $line_diff; $y < $height; $y += $line_diff) {
+ $row_diff = mt_rand(5, 15);
+ for ($x = $row_diff; $x < $width; $x+= $row_diff) {
+ imagerectangle($image, $x, $y, $x+1, $y+1, $pixel_col);
+ }
+ }
+ }
imagejpeg($image, '', 90);
imagedestroy($image);
} else {