[pLog-svn] r7021 - in plugins/branches/lifetype-1.2/hiddeninput: . class/action class/security class/view locale templates
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Thu Aug 19 12:28:00 EDT 2010
Author: jondaley
Date: 2010-08-19 12:28:00 -0400 (Thu, 19 Aug 2010)
New Revision: 7021
Modified:
plugins/branches/lifetype-1.2/hiddeninput/class/action/pluginhiddeninputupdateconfigaction.class.php
plugins/branches/lifetype-1.2/hiddeninput/class/security/hiddeninputfilter.class.php
plugins/branches/lifetype-1.2/hiddeninput/class/view/pluginhiddeninputconfigview.class.php
plugins/branches/lifetype-1.2/hiddeninput/locale/locale_en_UK.php
plugins/branches/lifetype-1.2/hiddeninput/pluginhiddeninput.class.php
plugins/branches/lifetype-1.2/hiddeninput/templates/hiddeninput.template
Log:
Lots of blogs don't use the topic field, and I just noticed one spammer that has been working hard at spamming me always fills in the topic field
Modified: plugins/branches/lifetype-1.2/hiddeninput/class/action/pluginhiddeninputupdateconfigaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/hiddeninput/class/action/pluginhiddeninputupdateconfigaction.class.php 2010-08-18 19:25:30 UTC (rev 7020)
+++ plugins/branches/lifetype-1.2/hiddeninput/class/action/pluginhiddeninputupdateconfigaction.class.php 2010-08-19 16:28:00 UTC (rev 7021)
@@ -10,6 +10,7 @@
class PluginHiddenInputUpdateConfigAction extends AdminAction
{
var $_pluginEnabled;
+ var $_noTopic;
var $_hiddenFields;
var $_emptyFields;
@@ -22,6 +23,8 @@
{
$this->_pluginEnabled = $this->_request->getValue( "pluginEnabled" );
$this->_pluginEnabled = ($this->_pluginEnabled != "" );
+ $this->_noTopic = $this->_request->getValue( "noTopic" );
+ $this->_noTopic = ($this->_noTopic != "" );
$this->_hiddenFields = $this->_request->getValue( "hiddenFields" );
$this->_hiddenFields = ereg_replace("[^0-9A-Za-z,]", "", $this->_hiddenFields);
$val = new StringValidator();
@@ -60,6 +63,7 @@
// update the plugin configurations to blog setting
$blogSettings = $this->_blogInfo->getSettings();
$blogSettings->setValue( "plugin_hiddeninput_enabled", $this->_pluginEnabled );
+ $blogSettings->setValue( "plugin_hiddeninput_notopic", $this->_noTopic );
$blogSettings->setValue( "plugin_hiddeninput_hiddenfields", $this->_hiddenFields );
$blogSettings->setValue( "plugin_hiddeninput_emptyfields", $this->_emptyFields );
$this->_blogInfo->setSettings( $blogSettings );
Modified: plugins/branches/lifetype-1.2/hiddeninput/class/security/hiddeninputfilter.class.php
===================================================================
--- plugins/branches/lifetype-1.2/hiddeninput/class/security/hiddeninputfilter.class.php 2010-08-18 19:25:30 UTC (rev 7020)
+++ plugins/branches/lifetype-1.2/hiddeninput/class/security/hiddeninputfilter.class.php 2010-08-19 16:28:00 UTC (rev 7021)
@@ -47,7 +47,14 @@
// if this is already rejected, there is no reason to do anything here
if ( $this->_pipelineRequest->getRejectedState() )
return new PipelineResult();
-
+
+ // check if the blog expects to have the topic field filled out
+ $noTopic = $blogSettings->getValue( "plugin_hiddeninput_notopic" );
+ if($noTopic && $request->getValue("commentTopic")){
+ return new PipelineResult( false, HIDDEN_INPUT_MATCH_FOUND,
+ $locale->tr("error_hiddeninput_field_missing"));
+ }
+
$hiddenFields = $blogSettings->getValue( "plugin_hiddeninput_hiddenfields" );
$hiddenFieldsList = explode(",", $hiddenFields);
Modified: plugins/branches/lifetype-1.2/hiddeninput/class/view/pluginhiddeninputconfigview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/hiddeninput/class/view/pluginhiddeninputconfigview.class.php 2010-08-18 19:25:30 UTC (rev 7020)
+++ plugins/branches/lifetype-1.2/hiddeninput/class/view/pluginhiddeninputconfigview.class.php 2010-08-19 16:28:00 UTC (rev 7021)
@@ -17,12 +17,14 @@
{
$blogSettings = $this->_blogInfo->getSettings();
$pluginEnabled = $blogSettings->getValue( "plugin_hiddeninput_enabled" );
+ $noTopic = $blogSettings->getValue( "plugin_hiddeninput_notopic" );
$hiddenFields = $blogSettings->getValue( "plugin_hiddeninput_hiddenfields" );
$emptyFields = $blogSettings->getValue( "plugin_hiddeninput_emptyfields" );
- if ($hiddenFields == "") $hiddenFields = "GetOutSpammer,GoHellSpammer";
+ if ($hiddenFields == "") $hiddenFields = "GetOutSpammer,enterdatahere";
// create a view and export the settings to the template
$this->setValue( "pluginEnabled", $pluginEnabled );
+ $this->setValue( "noTopic", $noTopic );
$this->setValue( "hiddenFields", $hiddenFields );
$this->setValue( "emptyFields", $emptyFields );
Modified: plugins/branches/lifetype-1.2/hiddeninput/locale/locale_en_UK.php
===================================================================
--- plugins/branches/lifetype-1.2/hiddeninput/locale/locale_en_UK.php 2010-08-18 19:25:30 UTC (rev 7020)
+++ plugins/branches/lifetype-1.2/hiddeninput/locale/locale_en_UK.php 2010-08-19 16:28:00 UTC (rev 7021)
@@ -5,6 +5,7 @@
$messages["hiddeninput_hiddenfields"] = 'Hidden fields for comment form, use "," to separate each field name. List a couple fields here, and then put some of them in the "Empty Fields" box below.';
$messages["hiddeninput_emptyfields"] = 'Hidden fields for comment form, use "," to separate each field name. These fields should be left empty when the comment is submitted.';
$messages["hiddeninput_plugin_enabled"] = "Enable this plugin";
+$messages["hiddeninput_plugin_notopic"] = "Enable this if your template doesn't use the 'topic' field for comments, and you want comments blocked if the topic is filled out.";
$messages["hiddeninput_plugin"] = "Hidden Input Plugin";
$messages["hiddeninput_settings_saved_ok"] = "Hidden Input settings saved successfully!";
@@ -14,6 +15,7 @@
$messages["label_configuration"] = "Configuration";
$messages["label_enable"] = "Enable";
+$messages["label_notopic"] = "Check for empty topic field";
$messages["label_hiddenfields"] = "Hidden Fields";
$messages["label_emptyfields"] = "Empty Fields";
?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/hiddeninput/pluginhiddeninput.class.php
===================================================================
--- plugins/branches/lifetype-1.2/hiddeninput/pluginhiddeninput.class.php 2010-08-18 19:25:30 UTC (rev 7020)
+++ plugins/branches/lifetype-1.2/hiddeninput/pluginhiddeninput.class.php 2010-08-19 16:28:00 UTC (rev 7021)
@@ -18,7 +18,7 @@
$this->id = "hiddeninput";
$this->author = "Mark Wu";
$this->desc = "This plugin offers hidden fields to comment form to prevent spammer post from spam robot.";
- $this->version = "20101009";
+ $this->version = "20100819";
$this->prefix = Db::getPrefix();
@@ -90,6 +90,8 @@
return (Array(
Array("name" => "plugin_hiddeninput_enabled",
"type" => "boolean"),
+ Array("name" => "plugin_hiddeninput_notopic_enabled",
+ "type" => "boolean"),
Array("name" => "plugin_hiddeninput_hiddenfields",
"validator" => new StringValidator(),
"type" => "string", "allowEmpty" => true ),
Modified: plugins/branches/lifetype-1.2/hiddeninput/templates/hiddeninput.template
===================================================================
--- plugins/branches/lifetype-1.2/hiddeninput/templates/hiddeninput.template 2010-08-18 19:25:30 UTC (rev 7020)
+++ plugins/branches/lifetype-1.2/hiddeninput/templates/hiddeninput.template 2010-08-19 16:28:00 UTC (rev 7021)
@@ -19,6 +19,21 @@
{$locale->tr("hiddeninput_plugin_enabled")}
</div>
</div>
+
+ <div class="field">
+ <label for="noTopic">{$locale->tr("label_notopic")}</label>
+ <span class="required"></span>
+ <div class="formHelp">
+ <input class="checkbox" type="checkbox" name="noTopic"
+ id="noTopic" {if $noTopic} checked="checked"
+ {/if}
+ {user_cannot_override
+ key=plugin_hiddeninput_notopic}disabled="disabled"
+ {/user_cannot_override}
+ value="1" />
+ {$locale->tr("hiddeninput_plugin_notopic")}
+ </div>
+ </div>
<div class="field">
<label for="hiddenFields">{$locale->tr("label_hiddenfields")}</label>
More information about the pLog-svn
mailing list